target
stringlengths 5
300
| feat_repo_name
stringlengths 6
76
| text
stringlengths 26
1.05M
|
---|---|---|
plugins/DepGraph/DepGraph.js | hasErico/react-devtools | /**
* 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.
*
* @ xx flow unused at the moment
*/
'use strict';
var React = require('react');
var decorate = require('../../frontend/decorate');
var crawlChildren = require('./crawlChildren');
var dagre = require('dagre');
class DepGraph extends React.Component {
constructor(props: Object) {
super(props);
this.state = {renderCount: 0};
}
render() {
if (this.state.renderCount > 0) {
return (
<DepWrapper
renderCount={this.state.renderCount}
onClose={() => this.setState({renderCount: 0})}
onReload={() => this.setState({renderCount: this.state.renderCount + 1})}
/>
);
}
return <button onClick={() => this.setState({renderCount: 1})}>Calculate DepGraph</button>;
}
}
class DisplayDeps {
props: Object;
componentWillReceiveProps(nextProps) {
if (nextProps.selected !== this.props.selected) {
return this.props.onClose();
}
}
render() {
return (
<div style={styles.container}>
<div style={styles.scrollParent}>
{/* $FlowFixMe doesn't need to inherit from React.Component */}
<SvgGraph
onHover={this.props.onHover}
onClick={this.props.onClick}
graph={this.props.graph}
/>
</div>
<div style={styles.buttons}>
<button onClick={this.props.onReload}>Reload</button>
<button onClick={this.props.onClose}>×</button>
</div>
</div>
);
}
}
class SvgGraph {
props: Object;
render() {
var graph = this.props.graph;
if (!graph) {
return <em>No graph to display. Select something else</em>;
}
var transform = 'translate(10, 10)';
return (
<svg style={styles.svg} width={graph.graph().width + 20} height={graph.graph().height + 20}>
<g transform={transform}>
{graph.edges().map(n => {
var edge = graph.edge(n);
return (
<polyline
points={edge.points.map(p => p.x + ',' + p.y).join(' ')}
fill="none"
stroke="orange"
strokeWidth="2"
/>
);
})}
</g>
<g transform={transform}>
{graph.nodes().map(n => {
var node = graph.node(n);
return (
<rect
onMouseOver={this.props.onHover.bind(null, node.label)}
onMouseOut={this.props.onHover.bind(null, null)}
onClick={this.props.onClick.bind(null, node.label)}
height={node.height}
width={node.width}
x={node.x - node.width / 2}
y={node.y - node.height / 2}
style={styles.rect}
fill="white"
stroke="black"
strokeWidth="1"
/>
);
})}
</g>
<g transform={transform}>
{graph.nodes().map(n => {
var node = graph.node(n);
return (
<text
style={{pointerEvents: 'none'}}
x={node.x}
y={node.y + node.height / 4}
textAnchor="middle"
fontSize="10"
fontFamily="sans-serif"
>{node.label + ' ' + node.count}</text>
);
})}
</g>
</svg>
);
}
}
var styles = {
container: {
border: '1px solid red',
position: 'relative',
minWidth: 0,
minHeight: 0,
flex: 1,
},
scrollParent: {
overflow: 'auto',
top: 0,
position: 'absolute',
bottom: 0,
left: 0,
right: 0,
textAlign: 'center',
},
rect: {
cursor: 'pointer',
},
svg: {
flexShrink: 0,
},
buttons: {
position: 'absolute',
bottom: 3,
right: 3,
},
};
function dagrize(graph) {
var g = new dagre.graphlib.Graph();
g.setGraph({
nodesep: 20,
ranksep: 50,
});
g.setDefaultEdgeLabel(() => ({}));
var hasNodes = false;
for (var name in graph.nodes) {
hasNodes = true;
g.setNode(name, {
label: name,
count: graph.nodes[name],
width: name.length * 7 + 20,
height: 20
});
}
if (!hasNodes) {
return false;
}
for (var name in graph.edges) {
var parts = name.split('\x1f');
if (parts[0] === '$root') {
continue;
}
g.setEdge(parts[0], parts[1], {label: graph[name]});
}
dagre.layout(g);
return g;
}
var DepWrapper = decorate({
listeners: () => ['selected'],
shouldUpdate(nextProps, props) {
return nextProps.renderCount !== props.renderCount;
},
props(store) {
var graph = {
edges: {},
nodes: {},
};
crawlChildren('$root', [store.selected], store._nodes, 0, graph);
return {
selected: store.selected,
graph: dagrize(graph),
onHover: name => store.hoverClass(name),
onClick: name => store.selectFirstOfClass(name),
};
}
}, DisplayDeps);
module.exports = DepGraph;
|
app/components/location-search.js | sirbrillig/voyageur-js-client | import React from 'react';
class LocationSearch extends React.Component {
componentDidMount() {
if ( ! window ) return;
window.document.body.addEventListener( 'keyup', this.searchKeyListener );
}
componentWillUnmount() {
if ( ! window ) return;
window.document.body.removeEventListener( 'keyup', this.searchKeyListener );
}
searchKeyListener = ( evt ) => {
if ( this.props.isShowingModal ) return;
// pressing forward slash focuses the search field
if ( evt.keyCode === 191 ) this.focusSearchField();
// pressing escape clears the search field
if ( evt.keyCode === 27 ) this.clearSearch();
}
clearSearch = () => {
this.props.onChange( '' );
}
focusSearchField = () => {
if ( this.searchField ) this.searchField.focus();
}
render() {
const inputWasMounted = ( searchField ) => this.searchField = searchField;
const onChange = event => this.props.onChange( event.target.value );
return (
<div className="location-search">
<input ref={ inputWasMounted } value={ this.props.searchString } className="form-control" type="search" placeholder="Search" onChange={ onChange } />
<div className="location-search__help alert">Press '/' to Search, up/down to select, 'enter' to add, shift-esc to clear trip.</div>
</div>
);
}
}
LocationSearch.propTypes = {
onChange: React.PropTypes.func.isRequired,
searchString: React.PropTypes.string,
isShowingModal: React.PropTypes.bool,
};
export default LocationSearch;
|
src/routes/Home/components/HomeView.js | aburd/issues-tracker | import React from 'react'
import RepoLinks from '../../../components/RepoLinks'
import './HomeView.scss'
export const HomeView = () => (
<div>
<p>レポジトリーを選択してください。</p>
<RepoLinks />
</div>
)
export default HomeView
|
packages/material-ui-icons/src/DesktopMacOutlined.js | allanalexandre/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="M21 2H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h7l-2 3v1h8v-1l-2-3h7c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 12H3V4h18v10z" /></g></React.Fragment>
, 'DesktopMacOutlined');
|
ajax/libs/vkui/4.24.0/cssm/components/ChipsSelect/useChipsSelect.min.js | cdnjs/cdnjs | import _objectSpread from"@babel/runtime/helpers/objectSpread2";import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _createForOfIteratorHelper from"@babel/runtime/helpers/createForOfIteratorHelper";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";var _excluded=["fieldValue","selectedOptions"];import*as React from"react";import{useChipsInput}from"../ChipsInput/useChipsInput";var useChipsSelect=function(e){var t=e.options,r=e.filterFn,o=e.getOptionLabel,a=e.getOptionValue,n=e.showSelected,i=React.useState(!1),u=_slicedToArray(i,2),s=u[0],l=u[1],p=React.useState(0),i=_slicedToArray(p,2),u=i[0],c=i[1],p=React.useState(null),i=_slicedToArray(p,2),p=i[0],i=i[1],e=useChipsInput(e),d=e.fieldValue,f=e.selectedOptions,m=_objectWithoutProperties(e,_excluded),b=React.useMemo(function(){return r?t.filter(function(e){return r(d,e,o)}):t},[t,r,d,o]),b=React.useMemo(function(){if(!b.length)return b;var e,t=new Set(b),r=f.map(function(e){return a(e)}),o=_createForOfIteratorHelper(t);try{for(o.s();!(e=o.n()).done;){var n=e.value;r.includes(a(n))&&t.delete(n)}}catch(e){o.e(e)}finally{o.f()}return _toConsumableArray(t)},[n,b,f]);return _objectSpread(_objectSpread({},m),{},{fieldValue:d,handleInputChange:function(e){m.handleInputChange(e),s||(l(!0),c(0))},opened:s,setOpened:l,filteredOptions:b,focusedOptionIndex:u,setFocusedOptionIndex:c,focusedOption:p,setFocusedOption:i,selectedOptions:f})};export{useChipsSelect}; |
test/DropdownButtonSpec.js | insionng/react-bootstrap | import React from 'react';
import ReactTestUtils from 'react/lib/ReactTestUtils';
import DropdownButton from '../src/DropdownButton';
import MenuItem from '../src/MenuItem';
import DropdownMenu from '../src/DropdownMenu';
import Button from '../src/Button';
describe('DropdownButton', function () {
let instance;
afterEach(function() {
if (instance && ReactTestUtils.isCompositeComponent(instance) && instance.isMounted()) {
React.unmountComponentAtNode(React.findDOMNode(instance));
}
});
it('Should render button correctly', function () {
instance = ReactTestUtils.renderIntoDocument(
<DropdownButton title="Title" className="test-class">
<MenuItem eventKey="1">MenuItem 1 content</MenuItem>
<MenuItem eventKey="2">MenuItem 2 content</MenuItem>
</DropdownButton>
);
let button = React.findDOMNode(ReactTestUtils.findRenderedComponentWithType(instance, Button));
assert.ok(React.findDOMNode(instance).className.match(/\bbtn-group\b/));
assert.ok(React.findDOMNode(instance).className.match(/\btest-class\b/));
assert.ok(button.className.match(/\bbtn\b/));
assert.equal(button.nodeName, 'BUTTON');
assert.equal(button.type, 'button');
assert.ok(button.className.match(/\bdropdown-toggle\b/));
assert.ok(button.lastChild.className.match(/\bcaret\b/));
assert.equal(button.innerText.trim(), 'Title');
});
it('Should render menu correctly', function () {
instance = ReactTestUtils.renderIntoDocument(
<DropdownButton title="Title">
<MenuItem eventKey="1">MenuItem 1 content</MenuItem>
<MenuItem eventKey="2">MenuItem 2 content</MenuItem>
</DropdownButton>
);
let menu = ReactTestUtils.findRenderedComponentWithType(instance, DropdownMenu);
let allMenuItems = ReactTestUtils.scryRenderedComponentsWithType(menu, MenuItem);
assert.equal(allMenuItems.length, 2);
});
it('Should pass props to button', function () {
instance = ReactTestUtils.renderIntoDocument(
<DropdownButton title="Title" bsStyle="primary" id="testId" disabled>
<MenuItem eventKey="1">MenuItem 1 content</MenuItem>
<MenuItem eventKey="2">MenuItem 2 content</MenuItem>
</DropdownButton>
);
let button = React.findDOMNode(ReactTestUtils.findRenderedComponentWithType(instance, Button));
assert.ok(button.className.match(/\bbtn-primary\b/));
assert.equal(button.getAttribute('id'), 'testId');
assert.ok(button.disabled);
});
it('Should be closed by default', function () {
instance = ReactTestUtils.renderIntoDocument(
<DropdownButton title="Title">
<MenuItem eventKey="1">MenuItem 1 content</MenuItem>
<MenuItem eventKey="2">MenuItem 2 content</MenuItem>
</DropdownButton>);
assert.notOk(React.findDOMNode(instance).className.match(/\bopen\b/));
});
it('Should open when clicked', function () {
instance = ReactTestUtils.renderIntoDocument(
<DropdownButton title="Title">
<MenuItem eventKey="1">MenuItem 1 content</MenuItem>
<MenuItem eventKey="2">MenuItem 2 content</MenuItem>
</DropdownButton>
);
ReactTestUtils.SimulateNative.click(React.findDOMNode(instance.refs.dropdownButton));
assert.ok(React.findDOMNode(instance).className.match(/\bopen\b/));
});
it('should call onSelect with eventKey when MenuItem is clicked', function (done) {
function handleSelect(eventKey) {
assert.equal(eventKey, '2');
assert.equal(instance.state.open, false);
done();
}
instance = ReactTestUtils.renderIntoDocument(
<DropdownButton title="Title" onSelect={handleSelect}>
<MenuItem eventKey='1'>MenuItem 1 content</MenuItem>
<MenuItem eventKey='2'>MenuItem 2 content</MenuItem>
</DropdownButton>
);
let menuItems = ReactTestUtils.scryRenderedComponentsWithType(instance, MenuItem);
assert.equal(menuItems.length, 2);
ReactTestUtils.SimulateNative.click(
ReactTestUtils.findRenderedDOMComponentWithTag(menuItems[1], 'a')
);
});
it('should call MenuItem onSelect with eventKey when MenuItem is clicked', function (done) {
function handleSelect(eventKey) {
assert.equal(eventKey, '2');
assert.equal(instance.state.open, false);
done();
}
instance = ReactTestUtils.renderIntoDocument(
<DropdownButton title="Title">
<MenuItem eventKey='1'>MenuItem 1 content</MenuItem>
<MenuItem eventKey='2' onSelect={handleSelect}>MenuItem 2 content</MenuItem>
</DropdownButton>
);
let menuItems = ReactTestUtils.scryRenderedComponentsWithType(instance, MenuItem);
assert.equal(menuItems.length, 2);
ReactTestUtils.SimulateNative.click(
ReactTestUtils.findRenderedDOMComponentWithTag(menuItems[1], 'a')
);
});
it('should not set onSelect to child with no onSelect prop', function () {
instance = ReactTestUtils.renderIntoDocument(
<DropdownButton title="Title">
<MenuItem eventKey={1}>MenuItem 1 content</MenuItem>
<MenuItem eventKey={2}>MenuItem 2 content</MenuItem>
</DropdownButton>
);
let menuItems = ReactTestUtils.scryRenderedComponentsWithType(instance, MenuItem);
assert.notOk(menuItems[0].props.onSelect);
});
describe('when open', function () {
beforeEach(function () {
instance = ReactTestUtils.renderIntoDocument(
<DropdownButton title="Title">
<MenuItem eventKey={1}>MenuItem 1 content</MenuItem>
<MenuItem eventKey={2}>MenuItem 2 content</MenuItem>
</DropdownButton>
);
instance.setDropdownState(true);
});
it('should close on click', function () {
let evt = document.createEvent('HTMLEvents');
evt.initEvent('click', true, true);
document.documentElement.dispatchEvent(evt);
assert.notOk(React.findDOMNode(instance).className.match(/\bopen\b/));
});
});
it('Should render li when in nav', function () {
instance = ReactTestUtils.renderIntoDocument(
<DropdownButton title="Title" className="test-class" navItem>
<MenuItem eventKey="1">MenuItem 1 content</MenuItem>
<MenuItem eventKey="2">MenuItem 2 content</MenuItem>
</DropdownButton>
);
let li = React.findDOMNode(instance);
let button = React.findDOMNode(ReactTestUtils.findRenderedComponentWithType(instance, Button));
assert.equal(li.nodeName, 'LI');
assert.ok(li.className.match(/\bdropdown\b/));
assert.ok(li.className.match(/\btest-class\b/));
assert.equal(button.nodeName, 'A');
assert.ok(button.className.match(/\bdropdown-toggle\b/));
assert.ok(button.lastChild.className.match(/\bcaret\b/));
assert.equal(button.innerText.trim(), 'Title');
});
it('should render a caret by default', function() {
instance = ReactTestUtils.renderIntoDocument(
<DropdownButton title="Title">
<MenuItem eventKey="1">MenuItem 1 content</MenuItem>
<MenuItem eventKey="2">MenuItem 2 content</MenuItem>
</DropdownButton>
);
let button = React.findDOMNode(ReactTestUtils.findRenderedComponentWithType(instance, Button));
let carets = button.getElementsByClassName('caret');
assert.equal(carets.length, 1);
});
it('should not render a caret if noCaret prop is given', function() {
instance = ReactTestUtils.renderIntoDocument(
<DropdownButton title="Title" noCaret>
<MenuItem eventKey="1">MenuItem 1 content</MenuItem>
<MenuItem eventKey="2">MenuItem 2 content</MenuItem>
</DropdownButton>
);
let button = React.findDOMNode(ReactTestUtils.findRenderedComponentWithType(instance, Button));
let carets = button.getElementsByClassName('caret');
assert.equal(carets.length, 0);
});
it('should set button class when buttonClassName is given', function() {
instance = ReactTestUtils.renderIntoDocument(
<DropdownButton buttonClassName="test-class">
<MenuItem eventKey="1">MenuItem 1 content</MenuItem>
<MenuItem eventKey="2">MenuItem 2 content</MenuItem>
</DropdownButton>
);
let button = React.findDOMNode(ReactTestUtils.findRenderedComponentWithType(instance, Button));
assert.ok(button.className.match(/\btest-class\b/));
});
it('should set onClick on Button', function (done) {
function handleClick() {
done();
}
instance = ReactTestUtils.renderIntoDocument(
<DropdownButton title="Title" onClick={handleClick}>
<MenuItem eventKey='1'>MenuItem 1 content</MenuItem>
<MenuItem eventKey='2'>MenuItem 2 content</MenuItem>
</DropdownButton>
);
let button = ReactTestUtils.findRenderedComponentWithType(instance, Button);
ReactTestUtils.SimulateNative.click(
ReactTestUtils.findRenderedDOMComponentWithClass(button, 'dropdown-toggle')
);
});
});
|
src/svg-icons/action/android.js | skarnecki/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionAndroid = (props) => (
<SvgIcon {...props}>
<path d="M6 18c0 .55.45 1 1 1h1v3.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V19h2v3.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V19h1c.55 0 1-.45 1-1V8H6v10zM3.5 8C2.67 8 2 8.67 2 9.5v7c0 .83.67 1.5 1.5 1.5S5 17.33 5 16.5v-7C5 8.67 4.33 8 3.5 8zm17 0c-.83 0-1.5.67-1.5 1.5v7c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5v-7c0-.83-.67-1.5-1.5-1.5zm-4.97-5.84l1.3-1.3c.2-.2.2-.51 0-.71-.2-.2-.51-.2-.71 0l-1.48 1.48C13.85 1.23 12.95 1 12 1c-.96 0-1.86.23-2.66.63L7.85.15c-.2-.2-.51-.2-.71 0-.2.2-.2.51 0 .71l1.31 1.31C6.97 3.26 6 5.01 6 7h12c0-1.99-.97-3.75-2.47-4.84zM10 5H9V4h1v1zm5 0h-1V4h1v1z"/>
</SvgIcon>
);
ActionAndroid = pure(ActionAndroid);
ActionAndroid.displayName = 'ActionAndroid';
export default ActionAndroid;
|
ajax/libs/backbone-react-component/0.7.2/backbone-react-component.js | chrillep/cdnjs | // Backbone React Component
// ========================
//
// Backbone.React.Component v0.7.2
//
// (c) 2014 "Magalhas" José Magalhães <[email protected]>
// Backbone.React.Component can be freely distributed under the MIT license.
//
//
// `Backbone.React.Component` is a mixin that glues [Backbone](http://backbonejs.org/)
// models and collections into [React](http://facebook.github.io/react/) components.
//
// When the component is mounted, a wrapper starts listening to models and
// collections changes to automatically set your component props and achieve UI
// binding through reactive updates.
//
//
//
// Basic Usage
//
// var MyComponent = React.createClass({
// mixins: [Backbone.React.Component.mixin],
// render: function () {
// return <div>{this.props.foo}</div>;
// }
// });
// var model = new Backbone.Model({foo: 'bar'});
// React.renderComponent(<MyComponent model={model} />, document.body);
(function (root, factory) {
// Universal module definition
if (typeof define === 'function' && define.amd)
define(['react', 'backbone', 'underscore'], factory);
else if (typeof module !== 'undefined' && module.exports) {
var React = require('react');
var Backbone = require('backbone');
var _ = require('underscore');
module.exports = factory(React, Backbone, _);
} else
factory(root.React, root.Backbone, root._);
}(this, function (React, Backbone, _) {
'use strict';
!Backbone.React && (Backbone.React = {});
!Backbone.React.Component && (Backbone.React.Component = {});
// Mixin used in all component instances. Exported through `Backbone.React.Component.mixin`.
Backbone.React.Component.mixin = {
// Sets `this.el` and `this.$el` when the component mounts.
componentDidMount: function () {
this.setElement(this.getDOMNode());
},
// Sets `this.el` and `this.$el` when the component updates.
componentDidUpdate: function () {
this.setElement(this.getDOMNode());
},
// When the component mounts, instance a `Wrapper` to take care
// of models and collections binding with `this.props`.
componentWillMount: function () {
if (!this.wrapper) {
this.wrapper = new Wrapper(this, this.props);
}
},
// When the component unmounts, dispose listeners and delete
// `this.wrapper` reference.
componentWillUnmount: function () {
if (this.wrapper) {
this.wrapper.stopListening();
delete this.wrapper;
}
},
// In order to allow passing nested models and collections as reference we
// filter `nextProps.model` and `nextProps.collection`.
componentWillReceiveProps: function (nextProps) {
var model = nextProps.model;
var collection = nextProps.collection;
var key;
if (this.wrapper.model && model) {
delete nextProps.model;
if (this.wrapper.model.attributes) {
this.wrapper.setProps(model, void 0, nextProps);
} else {
for (key in model) {
this.wrapper.setProps(model[key], key, nextProps);
}
}
}
if (this.wrapper.collection && collection && !(collection instanceof Array)) {
delete nextProps.collection;
if (this.wrapper.collection.models) {
this.wrapper.setProps(collection, void 0, nextProps);
} else {
for (key in collection) {
this.wrapper.setProps(collection[key], key, nextProps);
}
}
}
},
// Shortcut to `this.$el.find`. Inspired by `Backbone.View`.
$: function () {
return this.$el && this.$el.find.apply(this.$el, arguments);
},
// Crawls up to the owner of the component searching for a collection.
getCollection: function () {
var owner = this;
var lookup = owner.wrapper;
while (!lookup.collection) {
owner = owner._owner;
if (!owner) {
throw new Error('Collection not found');
}
lookup = owner.wrapper;
}
return lookup.collection;
},
// Crawls up to the owner of the component searching for a model.
getModel: function () {
var owner = this;
var lookup = owner.wrapper;
while (!lookup.model) {
owner = owner._owner;
if (!owner) {
throw new Error('Model not found');
}
lookup = owner.wrapper;
}
return lookup.model;
},
// Crawls `this._owner` recursively until it finds the owner of `this`
// component. In case of being a parent component (no owners) it returns itself.
getOwner: function () {
var owner = this;
while (owner._owner) {
owner = owner._owner;
}
return owner;
},
// Sets a DOM element to render/mount this component on this.el and this.$el.
setElement: function (el) {
if (el && Backbone.$ && el instanceof Backbone.$) {
if (el.length > 1) {
throw new Error('You can only assign one element to a component');
}
this.el = el[0];
this.$el = el;
} else if (el) {
this.el = el;
Backbone.$ && (this.$el = Backbone.$(el));
}
return this;
}
};
// Binds models and collections to a `React.Component`. It mixes `Backbone.Events`.
function Wrapper (component, props) {
props = props || {};
var model = props.model, collection = props.collection;
// Check if `props.model` is a `Backbone.Model` or an hashmap of them
if (typeof model !== 'undefined' && (model.attributes ||
typeof model === 'object' && _.values(model)[0].attributes)) {
delete props.model;
// The model(s) bound to this component
this.model = model;
// Set model(s) attributes on `props` for the first render
this.setPropsBackbone(model, void 0, props);
}
// Check if `props.collection` is a `Backbone.Collection` or an hashmap of them
if (typeof collection !== 'undefined' && (collection.models ||
typeof collection === 'object' && _.values(collection)[0].models)) {
delete props.collection;
// The collection(s) bound to this component
this.collection = collection;
// Set collection(s) models on props for the first render
this.setPropsBackbone(collection, void 0, props);
}
// 1:1 relation with the `component`
this.component = component;
// Start listeners if this is a root node and if there's DOM
if (!component._owner && typeof document !== 'undefined') {
this.startModelListeners();
this.startCollectionListeners();
}
}
// Mixing `Backbone.Events` into `Wrapper.prototype`
_.extend(Wrapper.prototype, Backbone.Events, {
// Sets `this.props` when a model/collection request results in error. It delegates
// to `this.setProps`. It listens to `Backbone.Model#error` and `Backbone.Collection#error`.
onError: function (modelOrCollection, res, options) {
// Set props only if there's no silent option
if (!options.silent)
this.setProps({
isRequesting: false,
hasError: true,
error: res
});
},
// Sets `this.props` when a model/collection request starts. It delegates to
// `this.setProps`. It listens to `Backbone.Model#request` and `Backbone.Collection#request`.
onRequest: function (modelOrCollection, xhr, options) {
// Set props only if there's no silent option
if (!options.silent)
this.setProps({
isRequesting: true,
hasError: false
});
},
// Sets `this.props` when a model/collection syncs. It delegates to `this.setProps`.
// It listens to `Backbone.Model#sync` and `Backbone.Collection#sync`
onSync: function (modelOrCollection, res, options) {
// Set props only if there's no silent option
if (!options.silent)
this.setProps({isRequesting: false});
},
// Used internally to set `this.collection` or `this.model` on `this.props`. Delegates to
// `this.setProps`. It listens to `Backbone.Collection` events such as `add`, `remove`,
// `change`, `sort`, `reset` and to `Backbone.Model` `change`.
setPropsBackbone: function (modelOrCollection, key, target) {
if (!(modelOrCollection.models || modelOrCollection.attributes)) {
for (key in modelOrCollection)
this.setPropsBackbone(modelOrCollection[key], key, target);
return;
}
this.setProps.apply(this, arguments);
},
// Sets a model, collection or object into props by delegating to `this.setProps`.
setProps: function (modelOrCollection, key, target) {
var props = {};
var newProps = modelOrCollection.toJSON ? modelOrCollection.toJSON() : modelOrCollection;
if (key) {
props[key] = newProps;
} else if (modelOrCollection instanceof Backbone.Collection) {
props.collection = newProps;
} else {
props = newProps;
}
if (target) {
_.extend(target, props);
} else {
this.nextProps = _.extend(this.nextProps || {}, props);
_.defer(_.bind(function () {
if (this.nextProps) {
this.component && this.component.setProps(this.nextProps);
delete this.nextProps;
}
}, this));
}
},
// Binds the component to any collection changes.
startCollectionListeners: function (collection, key) {
if (!collection) collection = this.collection;
if (collection) {
if (collection.models)
this
.listenTo(collection, 'add remove change sort reset',
_.partial(this.setPropsBackbone, collection, key, void 0))
.listenTo(collection, 'error', this.onError)
.listenTo(collection, 'request', this.onRequest)
.listenTo(collection, 'sync', this.onSync);
else if (typeof collection === 'object')
for (key in collection)
if (collection.hasOwnProperty(key))
this.startCollectionListeners(collection[key], key);
}
},
// Binds the component to any model changes.
startModelListeners: function (model, key) {
if (!model) model = this.model;
if (model) {
if (model.attributes)
this
.listenTo(model, 'change',
_.partial(this.setPropsBackbone, model, key, void 0))
.listenTo(model, 'error', this.onError)
.listenTo(model, 'request', this.onRequest)
.listenTo(model, 'sync', this.onSync);
else if (typeof model === 'object')
for (key in model)
this.startModelListeners(model[key], key);
}
}
});
// Expose `Backbone.React.Component.mixin`.
return Backbone.React.Component.mixin;
}));
// <a href="https://github.com/magalhas/backbone-react-component"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://github-camo.global.ssl.fastly.net/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
|
react_native_frontend/src/app.js | CUNYTech/BudgetApp | import React, { Component } from 'react';
import { StyleSheet, View } from 'react-native';
import * as firebase from 'firebase';
import { Drawer } from 'native-base';
import { AppSideMenu, AppRouter } from './components';
const firebaseConfig = require('../firebaseconfig.json');
const firebaseApp = firebase.initializeApp(firebaseConfig);
export { firebaseApp };
export default class App extends Component {
constructor() {
super();
this.state = {
isOpen: false,
};
this.toggleSideMenu = this.toggleSideMenu.bind(this);
}
toggleSideMenu() {
this.setState({ isOpen: !this.state.isOpen });
}
render() {
return (
<Drawer
type="overlay"
tapToClose
openDrawerOffset={60}
ref={(ref) => { this._drawer = ref; }}
content={<AppSideMenu toggleSideMenu={this.toggleSideMenu} />}
open={this.state.isOpen}
style={{ backgroundColor: 'transparent' }}
>
<View style={styles.background}>
<AppRouter
toggleSideMenu={this.toggleSideMenu}
handleNavPress={this.handleNavPress}
firebaseApp={firebaseApp}
/>
</View>
</Drawer>
);
}
}
const styles = StyleSheet.create({
background: {
flex: 1,
height: null,
width: null,
backgroundColor: '#212121',
},
});
|
app/javascript/mastodon/features/ui/util/react_router_helpers.js | mosaxiv/mastodon | import React from 'react';
import PropTypes from 'prop-types';
import { Switch, Route } from 'react-router-dom';
import ColumnLoading from '../components/column_loading';
import BundleColumnError from '../components/bundle_column_error';
import BundleContainer from '../containers/bundle_container';
// Small wrapper to pass multiColumn to the route components
export class WrappedSwitch extends React.PureComponent {
render () {
const { multiColumn, children } = this.props;
return (
<Switch>
{React.Children.map(children, child => React.cloneElement(child, { multiColumn }))}
</Switch>
);
}
}
WrappedSwitch.propTypes = {
multiColumn: PropTypes.bool,
children: PropTypes.node,
};
// Small Wraper to extract the params from the route and pass
// them to the rendered component, together with the content to
// be rendered inside (the children)
export class WrappedRoute extends React.Component {
static propTypes = {
component: PropTypes.func.isRequired,
content: PropTypes.node,
multiColumn: PropTypes.bool,
componentParams: PropTypes.object,
};
static defaultProps = {
componentParams: {},
};
renderComponent = ({ match }) => {
const { component, content, multiColumn, componentParams } = this.props;
return (
<BundleContainer fetchComponent={component} loading={this.renderLoading} error={this.renderError}>
{Component => <Component params={match.params} multiColumn={multiColumn} {...componentParams}>{content}</Component>}
</BundleContainer>
);
}
renderLoading = () => {
return <ColumnLoading />;
}
renderError = (props) => {
return <BundleColumnError {...props} />;
}
render () {
const { component: Component, content, ...rest } = this.props;
return <Route {...rest} render={this.renderComponent} />;
}
}
|
src/svg-icons/social/mood-bad.js | igorbt/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let SocialMoodBad = (props) => (
<SvgIcon {...props}>
<path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm3.5-9c.83 0 1.5-.67 1.5-1.5S16.33 8 15.5 8 14 8.67 14 9.5s.67 1.5 1.5 1.5zm-7 0c.83 0 1.5-.67 1.5-1.5S9.33 8 8.5 8 7 8.67 7 9.5 7.67 11 8.5 11zm3.5 3c-2.33 0-4.31 1.46-5.11 3.5h10.22c-.8-2.04-2.78-3.5-5.11-3.5z"/>
</SvgIcon>
);
SocialMoodBad = pure(SocialMoodBad);
SocialMoodBad.displayName = 'SocialMoodBad';
SocialMoodBad.muiName = 'SvgIcon';
export default SocialMoodBad;
|
src/components/location.js | akabekobeko/akabeko.me | import React from 'react'
import PropTypes from 'prop-types'
import Link from 'gatsby-link'
const Location = ({ prev, next }) => {
if (!(prev || next)) {
return null
}
return (
<nav className="location">
{prev ? (
<div className="prev to">
<i className="icon-chevron-thin-left" />
<Link to={prev.frontmatter.path}>{prev.frontmatter.title}</Link>
</div>
) : (
<div className="prev to" />
)}
{next ? (
<div className="next to">
<Link to={next.frontmatter.path}>{next.frontmatter.title}</Link>
<i className="icon-chevron-thin-right" />
</div>
) : (
<div className="next to" />
)}
<div className="clearfix" />
</nav>
)
}
Location.propTypes = {
prev: PropTypes.object,
next: PropTypes.object
}
export default Location
|
packages/react/src/components/Select/Select.js | carbon-design-system/carbon-components | /**
* Copyright IBM Corp. 2016, 2018
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import PropTypes from 'prop-types';
import React from 'react';
import classNames from 'classnames';
import {
ChevronDown16,
WarningFilled16,
WarningAltFilled16,
} from '@carbon/icons-react';
import deprecate from '../../prop-types/deprecate';
import { useFeatureFlag } from '../FeatureFlags';
import { usePrefix } from '../../internal/usePrefix';
const Select = React.forwardRef(function Select(
{
className,
id,
inline,
labelText,
disabled,
children,
// reserved for use with <Pagination> component
noLabel,
// eslint-disable-next-line no-unused-vars
iconDescription,
hideLabel,
invalid,
invalidText,
helperText,
light,
size,
warn,
warnText,
...other
},
ref
) {
const prefix = usePrefix();
const enabled = useFeatureFlag('enable-v11-release');
const selectClasses = classNames(
{
[`${prefix}--select`]: true,
[`${prefix}--select--inline`]: inline,
[`${prefix}--select--light`]: light,
[`${prefix}--select--invalid`]: invalid,
[`${prefix}--select--disabled`]: disabled,
[`${prefix}--select--warning`]: warn,
},
[enabled ? null : className]
);
const labelClasses = classNames(`${prefix}--label`, {
[`${prefix}--visually-hidden`]: hideLabel,
[`${prefix}--label--disabled`]: disabled,
});
const inputClasses = classNames({
[`${prefix}--select-input`]: true,
[`${prefix}--select-input--${size}`]: size,
});
const errorId = `${id}-error-msg`;
const errorText = (() => {
if (invalid) {
return invalidText;
}
if (warn) {
return warnText;
}
})();
const error =
invalid || warn ? (
<div className={`${prefix}--form-requirement`} id={errorId}>
{errorText}
</div>
) : null;
const helperTextClasses = classNames(`${prefix}--form__helper-text`, {
[`${prefix}--form__helper-text--disabled`]: disabled,
});
const helper = helperText ? (
<div className={helperTextClasses}>{helperText}</div>
) : null;
const ariaProps = {};
if (invalid) {
ariaProps['aria-describedby'] = errorId;
}
const input = (() => {
return (
<>
<select
{...other}
{...ariaProps}
id={id}
className={inputClasses}
disabled={disabled || undefined}
aria-invalid={invalid || undefined}
ref={ref}>
{children}
</select>
<ChevronDown16 className={`${prefix}--select__arrow`} />
{invalid && (
<WarningFilled16 className={`${prefix}--select__invalid-icon`} />
)}
{!invalid && warn && (
<WarningAltFilled16
className={`${prefix}--select__invalid-icon ${prefix}--select__invalid-icon--warning`}
/>
)}
</>
);
})();
return (
<div
className={
enabled
? classNames(`${prefix}--form-item`, className)
: `${prefix}--form-item`
}>
<div className={selectClasses}>
{!noLabel && (
<label htmlFor={id} className={labelClasses}>
{labelText}
</label>
)}
{inline && (
<div className={`${prefix}--select-input--inline__wrapper`}>
<div
className={`${prefix}--select-input__wrapper`}
data-invalid={invalid || null}>
{input}
</div>
{error}
</div>
)}
{!inline && (
<div
className={`${prefix}--select-input__wrapper`}
data-invalid={invalid || null}>
{input}
</div>
)}
{!inline && error ? error : helper}
</div>
</div>
);
});
Select.displayName = 'Select';
Select.propTypes = {
/**
* Provide the contents of your Select
*/
children: PropTypes.node,
/**
* Specify an optional className to be applied to the node containing the label and the select box
*/
className: PropTypes.string,
/**
* Optionally provide the default value of the `<select>`
*/
defaultValue: PropTypes.any,
/**
* Specify whether the control is disabled
*/
disabled: PropTypes.bool,
/**
* Provide text that is used alongside the control label for additional help
*/
helperText: PropTypes.node,
/**
* Specify whether the label should be hidden, or not
*/
hideLabel: PropTypes.bool,
/**
* Provide a description for the twistie icon that can be read by screen readers
*/
iconDescription: deprecate(
PropTypes.string,
'The `iconDescription` prop for `Select` is no longer needed and has ' +
'been deprecated. It will be moved in the next major release.'
),
/**
* Specify a custom `id` for the `<select>`
*/
id: PropTypes.string.isRequired,
/**
* Specify whether you want the inline version of this control
*/
inline: PropTypes.bool,
/**
* Specify if the currently value is invalid.
*/
invalid: PropTypes.bool,
/**
* Message which is displayed if the value is invalid.
*/
invalidText: PropTypes.node,
/**
* Provide label text to be read by screen readers when interacting with the
* control
*/
labelText: PropTypes.node,
/**
* Specify whether you want the light version of this control
*/
light: PropTypes.bool,
/**
* Reserved for use with <Pagination> component. Will not render a label for the
* select since Pagination renders one for us.
*/
noLabel: PropTypes.bool,
/**
* Provide an optional `onChange` hook that is called each time the value of
* the underlying `<input>` changes
*/
onChange: PropTypes.func,
/**
* Specify the size of the Select Input. Currently supports either `sm`, 'md' (default) or 'lg` as an option.
* TODO V11: remove `xl` (replaced with lg)
*/
size: PropTypes.oneOf(['sm', 'md', 'lg', 'xl']),
/**
* Specify whether the control is currently in warning state
*/
warn: PropTypes.bool,
/**
* Provide the text that is displayed when the control is in warning state
*/
warnText: PropTypes.node,
};
Select.defaultProps = {
disabled: false,
labelText: 'Select',
inline: false,
invalid: false,
invalidText: '',
helperText: '',
light: false,
};
export default Select;
|
__tests__/index.android.js | TalentedEurope/te-app | import 'react-native';
import React from 'react';
import Index from '../index.android.js';
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';
it('renders correctly', () => {
const tree = renderer.create(
<Index />
);
});
|
ajax/libs/onsen/1.3.19/js/onsenui.min.js | dada0423/cdnjs | /*! onsenui - v1.3.17 - 2016-06-29 */
!function(){function getAttributes(element){return Node_get_attributes.call(element)}function setAttribute(element,attribute,value){try{Element_setAttribute.call(element,attribute,value)}catch(e){}}function removeAttribute(element,attribute){Element_removeAttribute.call(element,attribute)}function childNodes(element){return Node_get_childNodes.call(element)}function empty(element){for(;element.childNodes.length;)element.removeChild(element.lastChild)}function insertAdjacentHTML(element,position,html){HTMLElement_insertAdjacentHTMLPropertyDescriptor.value.call(element,position,html)}function inUnsafeMode(){var isUnsafe=!0;try{detectionDiv.innerHTML="<test/>"}catch(ex){isUnsafe=!1}return isUnsafe}function cleanse(html,targetElement){function cleanseAttributes(element){var attributes=getAttributes(element);if(attributes&&attributes.length){for(var events,i=0,len=attributes.length;len>i;i++){var attribute=attributes[i],name=attribute.name;"o"!==name[0]&&"O"!==name[0]||"n"!==name[1]&&"N"!==name[1]||(events=events||[],events.push({name:attribute.name,value:attribute.value}))}if(events)for(var i=0,len=events.length;len>i;i++){var attribute=events[i];removeAttribute(element,attribute.name),setAttribute(element,"x-"+attribute.name,attribute.value)}}for(var children=childNodes(element),i=0,len=children.length;len>i;i++)cleanseAttributes(children[i])}var cleaner=document.implementation.createHTMLDocument("cleaner");empty(cleaner.documentElement),MSApp.execUnsafeLocalFunction(function(){insertAdjacentHTML(cleaner.documentElement,"afterbegin",html)});var scripts=cleaner.documentElement.querySelectorAll("script");Array.prototype.forEach.call(scripts,function(script){switch(script.type.toLowerCase()){case"":script.type="text/inert";break;case"text/javascript":case"text/ecmascript":case"text/x-javascript":case"text/jscript":case"text/livescript":case"text/javascript1.1":case"text/javascript1.2":case"text/javascript1.3":script.type="text/inert-"+script.type.slice("text/".length);break;case"application/javascript":case"application/ecmascript":case"application/x-javascript":script.type="application/inert-"+script.type.slice("application/".length)}}),cleanseAttributes(cleaner.documentElement);var cleanedNodes=[];return"HTML"===targetElement.tagName?cleanedNodes=Array.prototype.slice.call(document.adoptNode(cleaner.documentElement).childNodes):(cleaner.head&&(cleanedNodes=cleanedNodes.concat(Array.prototype.slice.call(document.adoptNode(cleaner.head).childNodes))),cleaner.body&&(cleanedNodes=cleanedNodes.concat(Array.prototype.slice.call(document.adoptNode(cleaner.body).childNodes)))),cleanedNodes}function cleansePropertySetter(property,setter){var propertyDescriptor=Object.getOwnPropertyDescriptor(HTMLElement.prototype,property),originalSetter=propertyDescriptor.set;Object.defineProperty(HTMLElement.prototype,property,{get:propertyDescriptor.get,set:function(value){if(window.WinJS&&window.WinJS._execUnsafe&&inUnsafeMode())originalSetter.call(this,value);else{var that=this,nodes=cleanse(value,that);MSApp.execUnsafeLocalFunction(function(){setter(propertyDescriptor,that,nodes)})}},enumerable:propertyDescriptor.enumerable,configurable:propertyDescriptor.configurable})}if(window.MSApp&&MSApp.execUnsafeLocalFunction){var Element_setAttribute=Object.getOwnPropertyDescriptor(Element.prototype,"setAttribute").value,Element_removeAttribute=Object.getOwnPropertyDescriptor(Element.prototype,"removeAttribute").value,HTMLElement_insertAdjacentHTMLPropertyDescriptor=Object.getOwnPropertyDescriptor(HTMLElement.prototype,"insertAdjacentHTML"),Node_get_attributes=Object.getOwnPropertyDescriptor(Node.prototype,"attributes").get,Node_get_childNodes=Object.getOwnPropertyDescriptor(Node.prototype,"childNodes").get,detectionDiv=document.createElement("div");cleansePropertySetter("innerHTML",function(propertyDescriptor,target,elements){empty(target);for(var i=0,len=elements.length;len>i;i++)target.appendChild(elements[i])}),cleansePropertySetter("outerHTML",function(propertyDescriptor,target,elements){for(var i=0,len=elements.length;len>i;i++)target.insertAdjacentElement("afterend",elements[i]);target.parentNode.removeChild(target)})}}(),function(){var initializing=!1,fnTest=/xyz/.test(function(){})?/\b_super\b/:/.*/;this.Class=function(){},Class.extend=function(prop){function Class(){!initializing&&this.init&&this.init.apply(this,arguments)}var _super=this.prototype;initializing=!0;var prototype=new this;initializing=!1;for(var name in prop)prototype[name]="function"==typeof prop[name]&&"function"==typeof _super[name]&&fnTest.test(prop[name])?function(name,fn){return function(){var tmp=this._super;this._super=_super[name];var ret=fn.apply(this,arguments);return this._super=tmp,ret}}(name,prop[name]):prop[name];return Class.prototype=prototype,Class.prototype.constructor=Class,Class.extend=arguments.callee,Class}}(),function(){"use strict";function FastClick(layer,options){function bind(method,context){return function(){return method.apply(context,arguments)}}var oldOnClick;if(options=options||{},this.trackingClick=!1,this.trackingClickStart=0,this.targetElement=null,this.touchStartX=0,this.touchStartY=0,this.lastTouchIdentifier=0,this.touchBoundary=options.touchBoundary||10,this.layer=layer,this.tapDelay=options.tapDelay||200,this.tapTimeout=options.tapTimeout||700,!FastClick.notNeeded(layer)){for(var methods=["onMouse","onClick","onTouchStart","onTouchMove","onTouchEnd","onTouchCancel"],context=this,i=0,l=methods.length;l>i;i++)context[methods[i]]=bind(context[methods[i]],context);deviceIsAndroid&&(layer.addEventListener("mouseover",this.onMouse,!0),layer.addEventListener("mousedown",this.onMouse,!0),layer.addEventListener("mouseup",this.onMouse,!0)),layer.addEventListener("click",this.onClick,!0),layer.addEventListener("touchstart",this.onTouchStart,!1),layer.addEventListener("touchmove",this.onTouchMove,!1),layer.addEventListener("touchend",this.onTouchEnd,!1),layer.addEventListener("touchcancel",this.onTouchCancel,!1),Event.prototype.stopImmediatePropagation||(layer.removeEventListener=function(type,callback,capture){var rmv=Node.prototype.removeEventListener;"click"===type?rmv.call(layer,type,callback.hijacked||callback,capture):rmv.call(layer,type,callback,capture)},layer.addEventListener=function(type,callback,capture){var adv=Node.prototype.addEventListener;"click"===type?adv.call(layer,type,callback.hijacked||(callback.hijacked=function(event){event.propagationStopped||callback(event)}),capture):adv.call(layer,type,callback,capture)}),"function"==typeof layer.onclick&&(oldOnClick=layer.onclick,layer.addEventListener("click",function(event){oldOnClick(event)},!1),layer.onclick=null)}}var deviceIsWindowsPhone=navigator.userAgent.indexOf("Windows Phone")>=0,deviceIsAndroid=navigator.userAgent.indexOf("Android")>0&&!deviceIsWindowsPhone,deviceIsIOS=/iP(ad|hone|od)/.test(navigator.userAgent)&&!deviceIsWindowsPhone,deviceIsIOS4=deviceIsIOS&&/OS 4_\d(_\d)?/.test(navigator.userAgent),deviceIsIOSWithBadTarget=deviceIsIOS&&/OS [6-7]_\d/.test(navigator.userAgent),deviceIsBlackBerry10=navigator.userAgent.indexOf("BB10")>0;FastClick.prototype.needsClick=function(target){switch(target.nodeName.toLowerCase()){case"button":case"select":case"textarea":if(target.disabled)return!0;break;case"input":if(deviceIsIOS&&"file"===target.type||target.disabled)return!0;break;case"label":case"iframe":case"video":return!0}return/\bneedsclick\b/.test(target.className)},FastClick.prototype.needsFocus=function(target){switch(target.nodeName.toLowerCase()){case"textarea":return!0;case"select":return!deviceIsAndroid;case"input":switch(target.type){case"button":case"checkbox":case"file":case"image":case"radio":case"submit":return!1}return!target.disabled&&!target.readOnly;default:return/\bneedsfocus\b/.test(target.className)}},FastClick.prototype.sendClick=function(targetElement,event){var clickEvent,touch;document.activeElement&&document.activeElement!==targetElement&&document.activeElement.blur(),touch=event.changedTouches[0],clickEvent=document.createEvent("MouseEvents"),clickEvent.initMouseEvent(this.determineEventType(targetElement),!0,!0,window,1,touch.screenX,touch.screenY,touch.clientX,touch.clientY,!1,!1,!1,!1,0,null),clickEvent.forwardedTouchEvent=!0,targetElement.dispatchEvent(clickEvent)},FastClick.prototype.determineEventType=function(targetElement){return deviceIsAndroid&&"select"===targetElement.tagName.toLowerCase()?"mousedown":"click"},FastClick.prototype.focus=function(targetElement){var length;deviceIsIOS&&targetElement.setSelectionRange&&0!==targetElement.type.indexOf("date")&&"time"!==targetElement.type&&"month"!==targetElement.type?(length=targetElement.value.length,targetElement.setSelectionRange(length,length)):targetElement.focus()},FastClick.prototype.updateScrollParent=function(targetElement){var scrollParent,parentElement;if(scrollParent=targetElement.fastClickScrollParent,!scrollParent||!scrollParent.contains(targetElement)){parentElement=targetElement;do{if(parentElement.scrollHeight>parentElement.offsetHeight){scrollParent=parentElement,targetElement.fastClickScrollParent=parentElement;break}parentElement=parentElement.parentElement}while(parentElement)}scrollParent&&(scrollParent.fastClickLastScrollTop=scrollParent.scrollTop)},FastClick.prototype.getTargetElementFromEventTarget=function(eventTarget){return eventTarget.nodeType===Node.TEXT_NODE?eventTarget.parentNode:eventTarget},FastClick.prototype.onTouchStart=function(event){var targetElement,touch,selection;if(event.targetTouches.length>1)return!0;if(targetElement=this.getTargetElementFromEventTarget(event.target),touch=event.targetTouches[0],deviceIsIOS){if(selection=window.getSelection(),selection.rangeCount&&!selection.isCollapsed)return!0;if(!deviceIsIOS4){if(touch.identifier&&touch.identifier===this.lastTouchIdentifier)return event.preventDefault(),!1;this.lastTouchIdentifier=touch.identifier,this.updateScrollParent(targetElement)}}return this.trackingClick=!0,this.trackingClickStart=event.timeStamp,this.targetElement=targetElement,this.touchStartX=touch.pageX,this.touchStartY=touch.pageY,event.timeStamp-this.lastClickTime<this.tapDelay&&event.timeStamp-this.lastClickTime>-1&&event.preventDefault(),!0},FastClick.prototype.touchHasMoved=function(event){var touch=event.changedTouches[0],boundary=this.touchBoundary;return Math.abs(touch.pageX-this.touchStartX)>boundary||Math.abs(touch.pageY-this.touchStartY)>boundary?!0:!1},FastClick.prototype.onTouchMove=function(event){return this.trackingClick?((this.targetElement!==this.getTargetElementFromEventTarget(event.target)||this.touchHasMoved(event))&&(this.trackingClick=!1,this.targetElement=null),!0):!0},FastClick.prototype.findControl=function(labelElement){return void 0!==labelElement.control?labelElement.control:labelElement.htmlFor?document.getElementById(labelElement.htmlFor):labelElement.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")},FastClick.prototype.onTouchEnd=function(event){var forElement,trackingClickStart,targetTagName,scrollParent,touch,targetElement=this.targetElement;if(!this.trackingClick)return!0;if(event.timeStamp-this.lastClickTime<this.tapDelay&&event.timeStamp-this.lastClickTime>-1)return this.cancelNextClick=!0,!0;if(event.timeStamp-this.trackingClickStart>this.tapTimeout)return!0;if(this.cancelNextClick=!1,this.lastClickTime=event.timeStamp,trackingClickStart=this.trackingClickStart,this.trackingClick=!1,this.trackingClickStart=0,deviceIsIOSWithBadTarget&&(touch=event.changedTouches[0],targetElement=document.elementFromPoint(touch.pageX-window.pageXOffset,touch.pageY-window.pageYOffset)||targetElement,targetElement.fastClickScrollParent=this.targetElement.fastClickScrollParent),targetTagName=targetElement.tagName.toLowerCase(),"label"===targetTagName){if(forElement=this.findControl(targetElement)){if(this.focus(targetElement),deviceIsAndroid)return!1;targetElement=forElement}}else if(this.needsFocus(targetElement))return event.timeStamp-trackingClickStart>100||deviceIsIOS&&window.top!==window&&"input"===targetTagName?(this.targetElement=null,!1):(this.focus(targetElement),this.sendClick(targetElement,event),deviceIsIOS&&"select"===targetTagName||(this.targetElement=null,event.preventDefault()),!1);return deviceIsIOS&&!deviceIsIOS4&&(scrollParent=targetElement.fastClickScrollParent,scrollParent&&scrollParent.fastClickLastScrollTop!==scrollParent.scrollTop)?!0:(this.needsClick(targetElement)||(event.preventDefault(),this.sendClick(targetElement,event)),!1)},FastClick.prototype.onTouchCancel=function(){this.trackingClick=!1,this.targetElement=null},FastClick.prototype.onMouse=function(event){return this.targetElement?event.forwardedTouchEvent?!0:event.cancelable?!this.needsClick(this.targetElement)||this.cancelNextClick?(event.stopImmediatePropagation?event.stopImmediatePropagation():event.propagationStopped=!0,event.stopPropagation(),event.preventDefault(),!1):!0:!0:!0},FastClick.prototype.onClick=function(event){var permitted;return this.trackingClick?(this.targetElement=null,this.trackingClick=!1,!0):"submit"===event.target.type&&0===event.detail?!0:(permitted=this.onMouse(event),permitted||(this.targetElement=null),permitted)},FastClick.prototype.destroy=function(){var layer=this.layer;deviceIsAndroid&&(layer.removeEventListener("mouseover",this.onMouse,!0),layer.removeEventListener("mousedown",this.onMouse,!0),layer.removeEventListener("mouseup",this.onMouse,!0)),layer.removeEventListener("click",this.onClick,!0),layer.removeEventListener("touchstart",this.onTouchStart,!1),layer.removeEventListener("touchmove",this.onTouchMove,!1),layer.removeEventListener("touchend",this.onTouchEnd,!1),layer.removeEventListener("touchcancel",this.onTouchCancel,!1)},FastClick.notNeeded=function(layer){var metaViewport,chromeVersion,blackberryVersion,firefoxVersion;if("undefined"==typeof window.ontouchstart)return!0;if(chromeVersion=+(/Chrome\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1]){if(!deviceIsAndroid)return!0;if(metaViewport=document.querySelector("meta[name=viewport]")){if(-1!==metaViewport.content.indexOf("user-scalable=no"))return!0;if(chromeVersion>31&&document.documentElement.scrollWidth<=window.outerWidth)return!0}}if(deviceIsBlackBerry10&&(blackberryVersion=navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/),blackberryVersion[1]>=10&&blackberryVersion[2]>=3&&(metaViewport=document.querySelector("meta[name=viewport]")))){if(-1!==metaViewport.content.indexOf("user-scalable=no"))return!0;if(document.documentElement.scrollWidth<=window.outerWidth)return!0}return"none"===layer.style.msTouchAction||"manipulation"===layer.style.touchAction?!0:(firefoxVersion=+(/Firefox\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1],firefoxVersion>=27&&(metaViewport=document.querySelector("meta[name=viewport]"),metaViewport&&(-1!==metaViewport.content.indexOf("user-scalable=no")||document.documentElement.scrollWidth<=window.outerWidth))?!0:"none"===layer.style.touchAction||"manipulation"===layer.style.touchAction?!0:!1)},FastClick.attach=function(layer,options){return new FastClick(layer,options)},"function"==typeof define&&"object"==typeof define.amd&&define.amd?define(function(){return FastClick}):"undefined"!=typeof module&&module.exports?(module.exports=FastClick.attach,module.exports.FastClick=FastClick):window.FastClick=FastClick}(),function(window,undefined){"use strict";function setup(){Hammer.READY||(Event.determineEventTypes(),Utils.each(Hammer.gestures,function(gesture){Detection.register(gesture)}),Event.onTouch(Hammer.DOCUMENT,EVENT_MOVE,Detection.detect),Event.onTouch(Hammer.DOCUMENT,EVENT_END,Detection.detect),Hammer.READY=!0)}var Hammer=function Hammer(element,options){return new Hammer.Instance(element,options||{})};Hammer.VERSION="1.1.3",Hammer.defaults={behavior:{userSelect:"none",touchAction:"pan-y",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},Hammer.DOCUMENT=document,Hammer.HAS_POINTEREVENTS=navigator.pointerEnabled||navigator.msPointerEnabled,Hammer.HAS_TOUCHEVENTS="ontouchstart"in window,Hammer.IS_MOBILE=/mobile|tablet|ip(ad|hone|od)|android|silk/i.test(navigator.userAgent),Hammer.NO_MOUSEEVENTS=Hammer.HAS_TOUCHEVENTS&&Hammer.IS_MOBILE||Hammer.HAS_POINTEREVENTS,Hammer.CALCULATE_INTERVAL=25;var EVENT_TYPES={},DIRECTION_DOWN=Hammer.DIRECTION_DOWN="down",DIRECTION_LEFT=Hammer.DIRECTION_LEFT="left",DIRECTION_UP=Hammer.DIRECTION_UP="up",DIRECTION_RIGHT=Hammer.DIRECTION_RIGHT="right",POINTER_MOUSE=Hammer.POINTER_MOUSE="mouse",POINTER_TOUCH=Hammer.POINTER_TOUCH="touch",POINTER_PEN=Hammer.POINTER_PEN="pen",EVENT_START=Hammer.EVENT_START="start",EVENT_MOVE=Hammer.EVENT_MOVE="move",EVENT_END=Hammer.EVENT_END="end",EVENT_RELEASE=Hammer.EVENT_RELEASE="release",EVENT_TOUCH=Hammer.EVENT_TOUCH="touch";Hammer.READY=!1,Hammer.plugins=Hammer.plugins||{},Hammer.gestures=Hammer.gestures||{};var Utils=Hammer.utils={extend:function(dest,src,merge){for(var key in src)!src.hasOwnProperty(key)||dest[key]!==undefined&&merge||(dest[key]=src[key]);return dest},on:function(element,type,handler){element.addEventListener(type,handler,!1)},off:function(element,type,handler){element.removeEventListener(type,handler,!1)},each:function(obj,iterator,context){var i,len;if("forEach"in obj)obj.forEach(iterator,context);else if(obj.length!==undefined){for(i=0,len=obj.length;len>i;i++)if(iterator.call(context,obj[i],i,obj)===!1)return}else for(i in obj)if(obj.hasOwnProperty(i)&&iterator.call(context,obj[i],i,obj)===!1)return},inStr:function(src,find){return src.indexOf(find)>-1},inArray:function(src,find){if(src.indexOf){var index=src.indexOf(find);return-1===index?!1:index}for(var i=0,len=src.length;len>i;i++)if(src[i]===find)return i;return!1},toArray:function(obj){return Array.prototype.slice.call(obj,0)},hasParent:function(node,parent){for(;node;){if(node==parent)return!0;node=node.parentNode}return!1},getCenter:function(touches){var pageX=[],pageY=[],clientX=[],clientY=[],min=Math.min,max=Math.max;return 1===touches.length?{pageX:touches[0].pageX,pageY:touches[0].pageY,clientX:touches[0].clientX,clientY:touches[0].clientY}:(Utils.each(touches,function(touch){pageX.push(touch.pageX),pageY.push(touch.pageY),clientX.push(touch.clientX),clientY.push(touch.clientY)}),{pageX:(min.apply(Math,pageX)+max.apply(Math,pageX))/2,pageY:(min.apply(Math,pageY)+max.apply(Math,pageY))/2,clientX:(min.apply(Math,clientX)+max.apply(Math,clientX))/2,clientY:(min.apply(Math,clientY)+max.apply(Math,clientY))/2})},getVelocity:function(deltaTime,deltaX,deltaY){return{x:Math.abs(deltaX/deltaTime)||0,y:Math.abs(deltaY/deltaTime)||0}},getAngle:function(touch1,touch2){var x=touch2.clientX-touch1.clientX,y=touch2.clientY-touch1.clientY;return 180*Math.atan2(y,x)/Math.PI},getDirection:function(touch1,touch2){var x=Math.abs(touch1.clientX-touch2.clientX),y=Math.abs(touch1.clientY-touch2.clientY);return x>=y?touch1.clientX-touch2.clientX>0?DIRECTION_LEFT:DIRECTION_RIGHT:touch1.clientY-touch2.clientY>0?DIRECTION_UP:DIRECTION_DOWN},getDistance:function(touch1,touch2){var x=touch2.clientX-touch1.clientX,y=touch2.clientY-touch1.clientY;return Math.sqrt(x*x+y*y)},getScale:function(start,end){return start.length>=2&&end.length>=2?this.getDistance(end[0],end[1])/this.getDistance(start[0],start[1]):1},getRotation:function(start,end){return start.length>=2&&end.length>=2?this.getAngle(end[1],end[0])-this.getAngle(start[1],start[0]):0},isVertical:function(direction){return direction==DIRECTION_UP||direction==DIRECTION_DOWN},setPrefixedCss:function(element,prop,value,toggle){var prefixes=["","Webkit","Moz","O","ms"];prop=Utils.toCamelCase(prop);for(var i=0;i<prefixes.length;i++){var p=prop;if(prefixes[i]&&(p=prefixes[i]+p.slice(0,1).toUpperCase()+p.slice(1)),p in element.style){element.style[p]=(null==toggle||toggle)&&value||"";break}}},toggleBehavior:function(element,props,toggle){if(props&&element&&element.style){Utils.each(props,function(value,prop){Utils.setPrefixedCss(element,prop,value,toggle)});var falseFn=toggle&&function(){return!1};"none"==props.userSelect&&(element.onselectstart=falseFn),"none"==props.userDrag&&(element.ondragstart=falseFn)}},toCamelCase:function(str){return str.replace(/[_-]([a-z])/g,function(s){return s[1].toUpperCase()})}},Event=Hammer.event={preventMouseEvents:!1,started:!1,shouldDetect:!1,on:function(element,type,handler,hook){var types=type.split(" ");Utils.each(types,function(type){Utils.on(element,type,handler),hook&&hook(type)})},off:function(element,type,handler,hook){var types=type.split(" ");Utils.each(types,function(type){Utils.off(element,type,handler),hook&&hook(type)})},onTouch:function(element,eventType,handler){var self=this,onTouchHandler=function(ev){var triggerType,srcType=ev.type.toLowerCase(),isPointer=Hammer.HAS_POINTEREVENTS,isMouse=Utils.inStr(srcType,"mouse");isMouse&&self.preventMouseEvents||(isMouse&&eventType==EVENT_START&&0===ev.button?(self.preventMouseEvents=!1,self.shouldDetect=!0):isPointer&&eventType==EVENT_START?self.shouldDetect=1===ev.buttons||PointerEvent.matchType(POINTER_TOUCH,ev):isMouse||eventType!=EVENT_START||(self.preventMouseEvents=!0,self.shouldDetect=!0),isPointer&&eventType!=EVENT_END&&PointerEvent.updatePointer(eventType,ev),self.shouldDetect&&(triggerType=self.doDetect.call(self,ev,eventType,element,handler)),triggerType==EVENT_END&&(self.preventMouseEvents=!1,self.shouldDetect=!1,PointerEvent.reset()),isPointer&&eventType==EVENT_END&&PointerEvent.updatePointer(eventType,ev))};return this.on(element,EVENT_TYPES[eventType],onTouchHandler),onTouchHandler},doDetect:function(ev,eventType,element,handler){var touchList=this.getTouchList(ev,eventType),touchListLength=touchList.length,triggerType=eventType,triggerChange=touchList.trigger,changedLength=touchListLength;eventType==EVENT_START?triggerChange=EVENT_TOUCH:eventType==EVENT_END&&(triggerChange=EVENT_RELEASE,changedLength=touchList.length-(ev.changedTouches?ev.changedTouches.length:1)),changedLength>0&&this.started&&(triggerType=EVENT_MOVE),this.started=!0;var evData=this.collectEventData(element,triggerType,touchList,ev);return eventType!=EVENT_END&&handler.call(Detection,evData),triggerChange&&(evData.changedLength=changedLength,evData.eventType=triggerChange,handler.call(Detection,evData),evData.eventType=triggerType,delete evData.changedLength),triggerType==EVENT_END&&(handler.call(Detection,evData),this.started=!1),triggerType},determineEventTypes:function(){var types;return types=Hammer.HAS_POINTEREVENTS?window.PointerEvent?["pointerdown","pointermove","pointerup pointercancel lostpointercapture"]:["MSPointerDown","MSPointerMove","MSPointerUp MSPointerCancel MSLostPointerCapture"]:Hammer.NO_MOUSEEVENTS?["touchstart","touchmove","touchend touchcancel"]:["touchstart mousedown","touchmove mousemove","touchend touchcancel mouseup"],EVENT_TYPES[EVENT_START]=types[0],EVENT_TYPES[EVENT_MOVE]=types[1],EVENT_TYPES[EVENT_END]=types[2],EVENT_TYPES},getTouchList:function(ev,eventType){if(Hammer.HAS_POINTEREVENTS)return PointerEvent.getTouchList();if(ev.touches){if(eventType==EVENT_MOVE)return ev.touches;var identifiers=[],concat=[].concat(Utils.toArray(ev.touches),Utils.toArray(ev.changedTouches)),touchList=[];return Utils.each(concat,function(touch){Utils.inArray(identifiers,touch.identifier)===!1&&touchList.push(touch),identifiers.push(touch.identifier)}),touchList}return ev.identifier=1,[ev]},collectEventData:function(element,eventType,touches,ev){var pointerType=POINTER_TOUCH;return Utils.inStr(ev.type,"mouse")||PointerEvent.matchType(POINTER_MOUSE,ev)?pointerType=POINTER_MOUSE:PointerEvent.matchType(POINTER_PEN,ev)&&(pointerType=POINTER_PEN),{center:Utils.getCenter(touches),timeStamp:Date.now(),target:ev.target,touches:touches,eventType:eventType,pointerType:pointerType,srcEvent:ev,preventDefault:function(){var srcEvent=this.srcEvent;srcEvent.preventManipulation&&srcEvent.preventManipulation(),srcEvent.preventDefault&&srcEvent.preventDefault()},stopPropagation:function(){this.srcEvent.stopPropagation()},stopDetect:function(){return Detection.stopDetect()}}}},PointerEvent=Hammer.PointerEvent={pointers:{},getTouchList:function(){var touchlist=[];return Utils.each(this.pointers,function(pointer){touchlist.push(pointer)}),touchlist},updatePointer:function(eventType,pointerEvent){eventType==EVENT_END||eventType!=EVENT_END&&1!==pointerEvent.buttons?delete this.pointers[pointerEvent.pointerId]:(pointerEvent.identifier=pointerEvent.pointerId,this.pointers[pointerEvent.pointerId]=pointerEvent)},matchType:function(pointerType,ev){if(!ev.pointerType)return!1;var pt=ev.pointerType,types={};return types[POINTER_MOUSE]=pt===(ev.MSPOINTER_TYPE_MOUSE||POINTER_MOUSE),types[POINTER_TOUCH]=pt===(ev.MSPOINTER_TYPE_TOUCH||POINTER_TOUCH),types[POINTER_PEN]=pt===(ev.MSPOINTER_TYPE_PEN||POINTER_PEN),types[pointerType]},reset:function(){this.pointers={}}},Detection=Hammer.detection={gestures:[],current:null,previous:null,stopped:!1,startDetect:function(inst,eventData){this.current||(this.stopped=!1,this.current={inst:inst,startEvent:Utils.extend({},eventData),lastEvent:!1,lastCalcEvent:!1,futureCalcEvent:!1,lastCalcData:{},name:""},this.detect(eventData))},detect:function(eventData){if(this.current&&!this.stopped){eventData=this.extendEventData(eventData);var inst=this.current.inst,instOptions=inst.options;return Utils.each(this.gestures,function(gesture){!this.stopped&&inst.enabled&&instOptions[gesture.name]&&gesture.handler.call(gesture,eventData,inst)},this),this.current&&(this.current.lastEvent=eventData),eventData.eventType==EVENT_END&&this.stopDetect(),eventData}},stopDetect:function(){this.previous=Utils.extend({},this.current),this.current=null,this.stopped=!0},getCalculatedData:function(ev,center,deltaTime,deltaX,deltaY){var cur=this.current,recalc=!1,calcEv=cur.lastCalcEvent,calcData=cur.lastCalcData;calcEv&&ev.timeStamp-calcEv.timeStamp>Hammer.CALCULATE_INTERVAL&&(center=calcEv.center,deltaTime=ev.timeStamp-calcEv.timeStamp,deltaX=ev.center.clientX-calcEv.center.clientX,deltaY=ev.center.clientY-calcEv.center.clientY,recalc=!0),(ev.eventType==EVENT_TOUCH||ev.eventType==EVENT_RELEASE)&&(cur.futureCalcEvent=ev),(!cur.lastCalcEvent||recalc)&&(calcData.velocity=Utils.getVelocity(deltaTime,deltaX,deltaY),calcData.angle=Utils.getAngle(center,ev.center),calcData.direction=Utils.getDirection(center,ev.center),cur.lastCalcEvent=cur.futureCalcEvent||ev,cur.futureCalcEvent=ev),ev.velocityX=calcData.velocity.x,ev.velocityY=calcData.velocity.y,ev.interimAngle=calcData.angle,ev.interimDirection=calcData.direction},extendEventData:function(ev){var cur=this.current,startEv=cur.startEvent,lastEv=cur.lastEvent||startEv;(ev.eventType==EVENT_TOUCH||ev.eventType==EVENT_RELEASE)&&(startEv.touches=[],Utils.each(ev.touches,function(touch){startEv.touches.push({clientX:touch.clientX,clientY:touch.clientY})}));var deltaTime=ev.timeStamp-startEv.timeStamp,deltaX=ev.center.clientX-startEv.center.clientX,deltaY=ev.center.clientY-startEv.center.clientY;return this.getCalculatedData(ev,lastEv.center,deltaTime,deltaX,deltaY),Utils.extend(ev,{startEvent:startEv,deltaTime:deltaTime,deltaX:deltaX,deltaY:deltaY,distance:Utils.getDistance(startEv.center,ev.center),angle:Utils.getAngle(startEv.center,ev.center),direction:Utils.getDirection(startEv.center,ev.center),scale:Utils.getScale(startEv.touches,ev.touches),rotation:Utils.getRotation(startEv.touches,ev.touches)}),ev},register:function(gesture){var options=gesture.defaults||{};return options[gesture.name]===undefined&&(options[gesture.name]=!0),Utils.extend(Hammer.defaults,options,!0),gesture.index=gesture.index||1e3,this.gestures.push(gesture),this.gestures.sort(function(a,b){return a.index<b.index?-1:a.index>b.index?1:0}),this.gestures}};Hammer.Instance=function(element,options){var self=this;setup(),this.element=element,this.enabled=!0,Utils.each(options,function(value,name){delete options[name],options[Utils.toCamelCase(name)]=value}),this.options=Utils.extend(Utils.extend({},Hammer.defaults),options||{}),this.options.behavior&&Utils.toggleBehavior(this.element,this.options.behavior,!0),this.eventStartHandler=Event.onTouch(element,EVENT_START,function(ev){self.enabled&&ev.eventType==EVENT_START?Detection.startDetect(self,ev):ev.eventType==EVENT_TOUCH&&Detection.detect(ev)}),this.eventHandlers=[]},Hammer.Instance.prototype={on:function(gestures,handler){var self=this;return Event.on(self.element,gestures,handler,function(type){self.eventHandlers.push({gesture:type,handler:handler})}),self},off:function(gestures,handler){var self=this;return Event.off(self.element,gestures,handler,function(type){var index=Utils.inArray({gesture:type,handler:handler});index!==!1&&self.eventHandlers.splice(index,1)}),self},trigger:function(gesture,eventData){eventData||(eventData={});var event=Hammer.DOCUMENT.createEvent("Event");event.initEvent(gesture,!0,!0),event.gesture=eventData;var element=this.element;return Utils.hasParent(eventData.target,element)&&(element=eventData.target),element.dispatchEvent(event),this},enable:function(state){return this.enabled=state,this},dispose:function(){var i,eh;for(Utils.toggleBehavior(this.element,this.options.behavior,!1),i=-1;eh=this.eventHandlers[++i];)Utils.off(this.element,eh.gesture,eh.handler);return this.eventHandlers=[],Event.off(this.element,EVENT_TYPES[EVENT_START],this.eventStartHandler),null}},function(name){function dragGesture(ev,inst){var cur=Detection.current;if(!(inst.options.dragMaxTouches>0&&ev.touches.length>inst.options.dragMaxTouches))switch(ev.eventType){case EVENT_START:triggered=!1;break;case EVENT_MOVE:if(ev.distance<inst.options.dragMinDistance&&cur.name!=name)return;var startCenter=cur.startEvent.center;if(cur.name!=name&&(cur.name=name,inst.options.dragDistanceCorrection&&ev.distance>0)){var factor=Math.abs(inst.options.dragMinDistance/ev.distance);startCenter.pageX+=ev.deltaX*factor,startCenter.pageY+=ev.deltaY*factor,startCenter.clientX+=ev.deltaX*factor,startCenter.clientY+=ev.deltaY*factor,ev=Detection.extendEventData(ev)}(cur.lastEvent.dragLockToAxis||inst.options.dragLockToAxis&&inst.options.dragLockMinDistance<=ev.distance)&&(ev.dragLockToAxis=!0);var lastDirection=cur.lastEvent.direction;ev.dragLockToAxis&&lastDirection!==ev.direction&&(ev.direction=Utils.isVertical(lastDirection)?ev.deltaY<0?DIRECTION_UP:DIRECTION_DOWN:ev.deltaX<0?DIRECTION_LEFT:DIRECTION_RIGHT),triggered||(inst.trigger(name+"start",ev),triggered=!0),inst.trigger(name,ev),inst.trigger(name+ev.direction,ev);var isVertical=Utils.isVertical(ev.direction);(inst.options.dragBlockVertical&&isVertical||inst.options.dragBlockHorizontal&&!isVertical)&&ev.preventDefault();break;case EVENT_RELEASE:triggered&&ev.changedLength<=inst.options.dragMaxTouches&&(inst.trigger(name+"end",ev),triggered=!1);break;case EVENT_END:triggered=!1}}var triggered=!1;Hammer.gestures.Drag={name:name,index:50,handler:dragGesture,defaults:{dragMinDistance:10,dragDistanceCorrection:!0,dragMaxTouches:1,dragBlockHorizontal:!1,dragBlockVertical:!1,dragLockToAxis:!1,dragLockMinDistance:25}}}("drag"),Hammer.gestures.Gesture={name:"gesture",index:1337,handler:function(ev,inst){inst.trigger(this.name,ev)}},function(name){function holdGesture(ev,inst){var options=inst.options,current=Detection.current;switch(ev.eventType){case EVENT_START:clearTimeout(timer),current.name=name,timer=setTimeout(function(){current&¤t.name==name&&inst.trigger(name,ev)},options.holdTimeout);break;case EVENT_MOVE:ev.distance>options.holdThreshold&&clearTimeout(timer);break;case EVENT_RELEASE:clearTimeout(timer)}}var timer;Hammer.gestures.Hold={name:name,index:10,defaults:{holdTimeout:500,holdThreshold:2},handler:holdGesture}}("hold"),Hammer.gestures.Release={name:"release",index:1/0,handler:function(ev,inst){ev.eventType==EVENT_RELEASE&&inst.trigger(this.name,ev)}},Hammer.gestures.Swipe={name:"swipe",index:40,defaults:{swipeMinTouches:1,swipeMaxTouches:1,swipeVelocityX:.6,swipeVelocityY:.6},handler:function(ev,inst){if(ev.eventType==EVENT_RELEASE){var touches=ev.touches.length,options=inst.options;
if(touches<options.swipeMinTouches||touches>options.swipeMaxTouches)return;(ev.velocityX>options.swipeVelocityX||ev.velocityY>options.swipeVelocityY)&&(inst.trigger(this.name,ev),inst.trigger(this.name+ev.direction,ev))}}},function(name){function tapGesture(ev,inst){var sincePrev,didDoubleTap,options=inst.options,current=Detection.current,prev=Detection.previous;switch(ev.eventType){case EVENT_START:hasMoved=!1;break;case EVENT_MOVE:hasMoved=hasMoved||ev.distance>options.tapMaxDistance;break;case EVENT_END:!Utils.inStr(ev.srcEvent.type,"cancel")&&ev.deltaTime<options.tapMaxTime&&!hasMoved&&(sincePrev=prev&&prev.lastEvent&&ev.timeStamp-prev.lastEvent.timeStamp,didDoubleTap=!1,prev&&prev.name==name&&sincePrev&&sincePrev<options.doubleTapInterval&&ev.distance<options.doubleTapDistance&&(inst.trigger("doubletap",ev),didDoubleTap=!0),(!didDoubleTap||options.tapAlways)&&(current.name=name,inst.trigger(current.name,ev)))}}var hasMoved=!1;Hammer.gestures.Tap={name:name,index:100,handler:tapGesture,defaults:{tapMaxTime:250,tapMaxDistance:10,tapAlways:!0,doubleTapDistance:20,doubleTapInterval:300}}}("tap"),Hammer.gestures.Touch={name:"touch",index:-1/0,defaults:{preventDefault:!1,preventMouse:!1},handler:function(ev,inst){return inst.options.preventMouse&&ev.pointerType==POINTER_MOUSE?(ev.stopDetect(),void 0):(inst.options.preventDefault&&ev.preventDefault(),ev.eventType==EVENT_TOUCH&&inst.trigger("touch",ev),void 0)}},function(name){function transformGesture(ev,inst){switch(ev.eventType){case EVENT_START:triggered=!1;break;case EVENT_MOVE:if(ev.touches.length<2)return;var scaleThreshold=Math.abs(1-ev.scale),rotationThreshold=Math.abs(ev.rotation);if(scaleThreshold<inst.options.transformMinScale&&rotationThreshold<inst.options.transformMinRotation)return;Detection.current.name=name,triggered||(inst.trigger(name+"start",ev),triggered=!0),inst.trigger(name,ev),rotationThreshold>inst.options.transformMinRotation&&inst.trigger("rotate",ev),scaleThreshold>inst.options.transformMinScale&&(inst.trigger("pinch",ev),inst.trigger("pinch"+(ev.scale<1?"in":"out"),ev));break;case EVENT_RELEASE:triggered&&ev.changedLength<2&&(inst.trigger(name+"end",ev),triggered=!1)}}var triggered=!1;Hammer.gestures.Transform={name:name,index:45,defaults:{transformMinScale:.01,transformMinRotation:1},handler:transformGesture}}("transform"),"function"==typeof define&&define.amd?define(function(){return Hammer}):"undefined"!=typeof module&&module.exports?module.exports=Hammer:window.Hammer=Hammer}(window);var IScroll=function(window,document,Math){function IScroll(el,options){this.wrapper="string"==typeof el?document.querySelector(el):el,this.scroller=this.wrapper.children[0],this.scrollerStyle=this.scroller.style,this.options={startX:0,startY:0,scrollY:!0,directionLockThreshold:5,momentum:!0,bounce:!0,bounceTime:600,bounceEasing:"",preventDefault:!0,preventDefaultException:{tagName:/^(INPUT|TEXTAREA|BUTTON|SELECT)$/},HWCompositing:!0,useTransition:!0,useTransform:!0};for(var i in options)this.options[i]=options[i];this.translateZ=this.options.HWCompositing&&utils.hasPerspective?" translateZ(0)":"",this.options.useTransition=utils.hasTransition&&this.options.useTransition,this.options.useTransform=utils.hasTransform&&this.options.useTransform,this.options.eventPassthrough=this.options.eventPassthrough===!0?"vertical":this.options.eventPassthrough,this.options.preventDefault=!this.options.eventPassthrough&&this.options.preventDefault,this.options.scrollY="vertical"==this.options.eventPassthrough?!1:this.options.scrollY,this.options.scrollX="horizontal"==this.options.eventPassthrough?!1:this.options.scrollX,this.options.freeScroll=this.options.freeScroll&&!this.options.eventPassthrough,this.options.directionLockThreshold=this.options.eventPassthrough?0:this.options.directionLockThreshold,this.options.bounceEasing="string"==typeof this.options.bounceEasing?utils.ease[this.options.bounceEasing]||utils.ease.circular:this.options.bounceEasing,this.options.resizePolling=void 0===this.options.resizePolling?60:this.options.resizePolling,this.options.tap===!0&&(this.options.tap="tap"),this.x=0,this.y=0,this.directionX=0,this.directionY=0,this._events={},this._init(),this.refresh(),this.scrollTo(this.options.startX,this.options.startY),this.enable()}var rAF=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(callback){window.setTimeout(callback,1e3/60)},utils=function(){function _prefixStyle(style){return _vendor===!1?!1:""===_vendor?style:_vendor+style.charAt(0).toUpperCase()+style.substr(1)}var me={},_elementStyle=document.createElement("div").style,_vendor=function(){for(var transform,vendors=["t","webkitT","MozT","msT","OT"],i=0,l=vendors.length;l>i;i++)if(transform=vendors[i]+"ransform",transform in _elementStyle)return vendors[i].substr(0,vendors[i].length-1);return!1}();me.getTime=Date.now||function(){return(new Date).getTime()},me.extend=function(target,obj){for(var i in obj)target[i]=obj[i]},me.addEvent=function(el,type,fn,capture){el.addEventListener(type,fn,!!capture)},me.removeEvent=function(el,type,fn,capture){el.removeEventListener(type,fn,!!capture)},me.momentum=function(current,start,time,lowerMargin,wrapperSize){var destination,duration,distance=current-start,speed=Math.abs(distance)/time,deceleration=6e-4;return destination=current+speed*speed/(2*deceleration)*(0>distance?-1:1),duration=speed/deceleration,lowerMargin>destination?(destination=wrapperSize?lowerMargin-wrapperSize/2.5*(speed/8):lowerMargin,distance=Math.abs(destination-current),duration=distance/speed):destination>0&&(destination=wrapperSize?wrapperSize/2.5*(speed/8):0,distance=Math.abs(current)+destination,duration=distance/speed),{destination:Math.round(destination),duration:duration}};var _transform=_prefixStyle("transform");return me.extend(me,{hasTransform:_transform!==!1,hasPerspective:_prefixStyle("perspective")in _elementStyle,hasTouch:"ontouchstart"in window,hasPointer:navigator.msPointerEnabled,hasTransition:_prefixStyle("transition")in _elementStyle}),me.isAndroidBrowser=/Android/.test(window.navigator.appVersion)&&/Version\/\d/.test(window.navigator.appVersion),me.extend(me.style={},{transform:_transform,transitionTimingFunction:_prefixStyle("transitionTimingFunction"),transitionDuration:_prefixStyle("transitionDuration"),transformOrigin:_prefixStyle("transformOrigin")}),me.hasClass=function(e,c){var re=new RegExp("(^|\\s)"+c+"(\\s|$)");return re.test(e.className)},me.addClass=function(e,c){if(!me.hasClass(e,c)){var newclass=e.className.split(" ");newclass.push(c),e.className=newclass.join(" ")}},me.removeClass=function(e,c){if(me.hasClass(e,c)){var re=new RegExp("(^|\\s)"+c+"(\\s|$)","g");e.className=e.className.replace(re," ")}},me.offset=function(el){for(var left=-el.offsetLeft,top=-el.offsetTop;el=el.offsetParent;)left-=el.offsetLeft,top-=el.offsetTop;return{left:left,top:top}},me.preventDefaultException=function(el,exceptions){for(var i in exceptions)if(exceptions[i].test(el[i]))return!0;return!1},me.extend(me.eventType={},{touchstart:1,touchmove:1,touchend:1,mousedown:2,mousemove:2,mouseup:2,MSPointerDown:3,MSPointerMove:3,MSPointerUp:3}),me.extend(me.ease={},{quadratic:{style:"cubic-bezier(0.25, 0.46, 0.45, 0.94)",fn:function(k){return k*(2-k)}},circular:{style:"cubic-bezier(0.1, 0.57, 0.1, 1)",fn:function(k){return Math.sqrt(1- --k*k)}},back:{style:"cubic-bezier(0.175, 0.885, 0.32, 1.275)",fn:function(k){var b=4;return(k-=1)*k*((b+1)*k+b)+1}},bounce:{style:"",fn:function(k){return(k/=1)<1/2.75?7.5625*k*k:2/2.75>k?7.5625*(k-=1.5/2.75)*k+.75:2.5/2.75>k?7.5625*(k-=2.25/2.75)*k+.9375:7.5625*(k-=2.625/2.75)*k+.984375}},elastic:{style:"",fn:function(k){var f=.22,e=.4;return 0===k?0:1==k?1:e*Math.pow(2,-10*k)*Math.sin(2*(k-f/4)*Math.PI/f)+1}}}),me.tap=function(e,eventName){var ev=document.createEvent("Event");ev.initEvent(eventName,!0,!0),ev.pageX=e.pageX,ev.pageY=e.pageY,e.target.dispatchEvent(ev)},me.click=function(e){var ev,target=e.target;"SELECT"!=target.tagName&&"INPUT"!=target.tagName&&"TEXTAREA"!=target.tagName&&(ev=document.createEvent("MouseEvents"),ev.initMouseEvent("click",!0,!0,e.view,1,target.screenX,target.screenY,target.clientX,target.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,0,null),ev._constructed=!0,target.dispatchEvent(ev))},me}();return IScroll.prototype={version:"5.0.6",_init:function(){this._initEvents()},destroy:function(){this._initEvents(!0),this._execEvent("destroy")},_transitionEnd:function(e){e.target==this.scroller&&(this._transitionTime(0),this.resetPosition(this.options.bounceTime)||this._execEvent("scrollEnd"))},_start:function(e){if(!(1!=utils.eventType[e.type]&&0!==e.button||!this.enabled||this.initiated&&utils.eventType[e.type]!==this.initiated)){!this.options.preventDefault||utils.isAndroidBrowser||utils.preventDefaultException(e.target,this.options.preventDefaultException)||e.preventDefault();var pos,point=e.touches?e.touches[0]:e;this.initiated=utils.eventType[e.type],this.moved=!1,this.distX=0,this.distY=0,this.directionX=0,this.directionY=0,this.directionLocked=0,this._transitionTime(),this.isAnimating=!1,this.startTime=utils.getTime(),this.options.useTransition&&this.isInTransition&&(pos=this.getComputedPosition(),this._translate(Math.round(pos.x),Math.round(pos.y)),this._execEvent("scrollEnd"),this.isInTransition=!1),this.startX=this.x,this.startY=this.y,this.absStartX=this.x,this.absStartY=this.y,this.pointX=point.pageX,this.pointY=point.pageY,this._execEvent("beforeScrollStart")}},_move:function(e){if(this.enabled&&utils.eventType[e.type]===this.initiated){this.options.preventDefault&&e.preventDefault();var newX,newY,absDistX,absDistY,point=e.touches?e.touches[0]:e,deltaX=point.pageX-this.pointX,deltaY=point.pageY-this.pointY,timestamp=utils.getTime();if(this.pointX=point.pageX,this.pointY=point.pageY,this.distX+=deltaX,this.distY+=deltaY,absDistX=Math.abs(this.distX),absDistY=Math.abs(this.distY),!(timestamp-this.endTime>300&&10>absDistX&&10>absDistY)){if(this.directionLocked||this.options.freeScroll||(this.directionLocked=absDistX>absDistY+this.options.directionLockThreshold?"h":absDistY>=absDistX+this.options.directionLockThreshold?"v":"n"),"h"==this.directionLocked){if("vertical"==this.options.eventPassthrough)e.preventDefault();else if("horizontal"==this.options.eventPassthrough)return this.initiated=!1,void 0;deltaY=0}else if("v"==this.directionLocked){if("horizontal"==this.options.eventPassthrough)e.preventDefault();else if("vertical"==this.options.eventPassthrough)return this.initiated=!1,void 0;deltaX=0}deltaX=this.hasHorizontalScroll?deltaX:0,deltaY=this.hasVerticalScroll?deltaY:0,newX=this.x+deltaX,newY=this.y+deltaY,(newX>0||newX<this.maxScrollX)&&(newX=this.options.bounce?this.x+deltaX/3:newX>0?0:this.maxScrollX),(newY>0||newY<this.maxScrollY)&&(newY=this.options.bounce?this.y+deltaY/3:newY>0?0:this.maxScrollY),this.directionX=deltaX>0?-1:0>deltaX?1:0,this.directionY=deltaY>0?-1:0>deltaY?1:0,this.moved||this._execEvent("scrollStart"),this.moved=!0,this._translate(newX,newY),timestamp-this.startTime>300&&(this.startTime=timestamp,this.startX=this.x,this.startY=this.y)}}},_end:function(e){if(this.enabled&&utils.eventType[e.type]===this.initiated){this.options.preventDefault&&!utils.preventDefaultException(e.target,this.options.preventDefaultException)&&e.preventDefault();var momentumX,momentumY,duration=(e.changedTouches?e.changedTouches[0]:e,utils.getTime()-this.startTime),newX=Math.round(this.x),newY=Math.round(this.y),distanceX=Math.abs(newX-this.startX),distanceY=Math.abs(newY-this.startY),time=0,easing="";if(this.scrollTo(newX,newY),this.isInTransition=0,this.initiated=0,this.endTime=utils.getTime(),!this.resetPosition(this.options.bounceTime))return this.moved?this._events.flick&&200>duration&&100>distanceX&&100>distanceY?(this._execEvent("flick"),void 0):(this.options.momentum&&300>duration&&(momentumX=this.hasHorizontalScroll?utils.momentum(this.x,this.startX,duration,this.maxScrollX,this.options.bounce?this.wrapperWidth:0):{destination:newX,duration:0},momentumY=this.hasVerticalScroll?utils.momentum(this.y,this.startY,duration,this.maxScrollY,this.options.bounce?this.wrapperHeight:0):{destination:newY,duration:0},newX=momentumX.destination,newY=momentumY.destination,time=Math.max(momentumX.duration,momentumY.duration),this.isInTransition=1),newX!=this.x||newY!=this.y?((newX>0||newX<this.maxScrollX||newY>0||newY<this.maxScrollY)&&(easing=utils.ease.quadratic),this.scrollTo(newX,newY,time,easing),void 0):(this._execEvent("scrollEnd"),void 0)):(this.options.tap&&utils.tap(e,this.options.tap),this.options.click&&utils.click(e),void 0)}},_resize:function(){var that=this;clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(function(){that.refresh()},this.options.resizePolling)},resetPosition:function(time){var x=this.x,y=this.y;return time=time||0,!this.hasHorizontalScroll||this.x>0?x=0:this.x<this.maxScrollX&&(x=this.maxScrollX),!this.hasVerticalScroll||this.y>0?y=0:this.y<this.maxScrollY&&(y=this.maxScrollY),x==this.x&&y==this.y?!1:(this.scrollTo(x,y,time,this.options.bounceEasing),!0)},disable:function(){this.enabled=!1},enable:function(){this.enabled=!0},refresh:function(){this.wrapper.offsetHeight;this.wrapperWidth=this.wrapper.clientWidth,this.wrapperHeight=this.wrapper.clientHeight,this.scrollerWidth=this.scroller.offsetWidth,this.scrollerHeight=this.scroller.offsetHeight,this.maxScrollX=this.wrapperWidth-this.scrollerWidth,this.maxScrollY=this.wrapperHeight-this.scrollerHeight,this.hasHorizontalScroll=this.options.scrollX&&this.maxScrollX<0,this.hasVerticalScroll=this.options.scrollY&&this.maxScrollY<0,this.hasHorizontalScroll||(this.maxScrollX=0,this.scrollerWidth=this.wrapperWidth),this.hasVerticalScroll||(this.maxScrollY=0,this.scrollerHeight=this.wrapperHeight),this.endTime=0,this.directionX=0,this.directionY=0,this.wrapperOffset=utils.offset(this.wrapper),this._execEvent("refresh"),this.resetPosition()},on:function(type,fn){this._events[type]||(this._events[type]=[]),this._events[type].push(fn)},_execEvent:function(type){if(this._events[type]){var i=0,l=this._events[type].length;if(l)for(;l>i;i++)this._events[type][i].call(this)}},scrollBy:function(x,y,time,easing){x=this.x+x,y=this.y+y,time=time||0,this.scrollTo(x,y,time,easing)},scrollTo:function(x,y,time,easing){easing=easing||utils.ease.circular,!time||this.options.useTransition&&easing.style?(this._transitionTimingFunction(easing.style),this._transitionTime(time),this._translate(x,y)):this._animate(x,y,time,easing.fn)},scrollToElement:function(el,time,offsetX,offsetY,easing){if(el=el.nodeType?el:this.scroller.querySelector(el)){var pos=utils.offset(el);pos.left-=this.wrapperOffset.left,pos.top-=this.wrapperOffset.top,offsetX===!0&&(offsetX=Math.round(el.offsetWidth/2-this.wrapper.offsetWidth/2)),offsetY===!0&&(offsetY=Math.round(el.offsetHeight/2-this.wrapper.offsetHeight/2)),pos.left-=offsetX||0,pos.top-=offsetY||0,pos.left=pos.left>0?0:pos.left<this.maxScrollX?this.maxScrollX:pos.left,pos.top=pos.top>0?0:pos.top<this.maxScrollY?this.maxScrollY:pos.top,time=void 0===time||null===time||"auto"===time?Math.max(Math.abs(this.x-pos.left),Math.abs(this.y-pos.top)):time,this.scrollTo(pos.left,pos.top,time,easing)}},_transitionTime:function(time){time=time||0,this.scrollerStyle[utils.style.transitionDuration]=time+"ms"},_transitionTimingFunction:function(easing){this.scrollerStyle[utils.style.transitionTimingFunction]=easing},_translate:function(x,y){this.options.useTransform?this.scrollerStyle[utils.style.transform]="translate("+x+"px,"+y+"px)"+this.translateZ:(x=Math.round(x),y=Math.round(y),this.scrollerStyle.left=x+"px",this.scrollerStyle.top=y+"px"),this.x=x,this.y=y},_initEvents:function(remove){var eventType=remove?utils.removeEvent:utils.addEvent,target=this.options.bindToWrapper?this.wrapper:window;eventType(window,"orientationchange",this),eventType(window,"resize",this),this.options.click&&eventType(this.wrapper,"click",this,!0),this.options.disableMouse||(eventType(this.wrapper,"mousedown",this),eventType(target,"mousemove",this),eventType(target,"mousecancel",this),eventType(target,"mouseup",this)),utils.hasPointer&&!this.options.disablePointer&&(eventType(this.wrapper,"MSPointerDown",this),eventType(target,"MSPointerMove",this),eventType(target,"MSPointerCancel",this),eventType(target,"MSPointerUp",this)),utils.hasTouch&&!this.options.disableTouch&&(eventType(this.wrapper,"touchstart",this),eventType(target,"touchmove",this),eventType(target,"touchcancel",this),eventType(target,"touchend",this)),eventType(this.scroller,"transitionend",this),eventType(this.scroller,"webkitTransitionEnd",this),eventType(this.scroller,"oTransitionEnd",this),eventType(this.scroller,"MSTransitionEnd",this)},getComputedPosition:function(){var x,y,matrix=window.getComputedStyle(this.scroller,null);return this.options.useTransform?(matrix=matrix[utils.style.transform].split(")")[0].split(", "),x=+(matrix[12]||matrix[4]),y=+(matrix[13]||matrix[5])):(x=+matrix.left.replace(/[^-\d]/g,""),y=+matrix.top.replace(/[^-\d]/g,"")),{x:x,y:y}},_animate:function(destX,destY,duration,easingFn){function step(){var newX,newY,easing,now=utils.getTime();return now>=destTime?(that.isAnimating=!1,that._translate(destX,destY),that.resetPosition(that.options.bounceTime)||that._execEvent("scrollEnd"),void 0):(now=(now-startTime)/duration,easing=easingFn(now),newX=(destX-startX)*easing+startX,newY=(destY-startY)*easing+startY,that._translate(newX,newY),that.isAnimating&&rAF(step),void 0)}var that=this,startX=this.x,startY=this.y,startTime=utils.getTime(),destTime=startTime+duration;this.isAnimating=!0,step()},handleEvent:function(e){switch(e.type){case"touchstart":case"MSPointerDown":case"mousedown":this._start(e);break;case"touchmove":case"MSPointerMove":case"mousemove":this._move(e);break;case"touchend":case"MSPointerUp":case"mouseup":case"touchcancel":case"MSPointerCancel":case"mousecancel":this._end(e);break;case"orientationchange":case"resize":this._resize();break;case"transitionend":case"webkitTransitionEnd":case"oTransitionEnd":case"MSTransitionEnd":this._transitionEnd(e);break;case"DOMMouseScroll":case"mousewheel":this._wheel(e);break;case"keydown":this._key(e);break;case"click":e._constructed||(e.preventDefault(),e.stopPropagation())}}},IScroll.ease=utils.ease,IScroll}(window,document,Math),MicroEvent=function(){};MicroEvent.prototype={on:function(event,fct){this._events=this._events||{},this._events[event]=this._events[event]||[],this._events[event].push(fct)},once:function(event,fct){var self=this,wrapper=function(){return self.off(event,wrapper),fct.apply(null,arguments)};this.on(event,wrapper)},off:function(event,fct){this._events=this._events||{},event in this._events!=!1&&this._events[event].splice(this._events[event].indexOf(fct),1)},emit:function(event){if(this._events=this._events||{},event in this._events!=!1)for(var i=0;i<this._events[event].length;i++)this._events[event][i].apply(this,Array.prototype.slice.call(arguments,1))}},MicroEvent.mixin=function(destObject){for(var props=["on","once","off","emit"],i=0;i<props.length;i++)"function"==typeof destObject?destObject.prototype[props[i]]=MicroEvent.prototype[props[i]]:destObject[props[i]]=MicroEvent.prototype[props[i]]},"undefined"!=typeof module&&"exports"in module&&(module.exports=MicroEvent),window.Modernizr=function(window,document,undefined){function setCss(str){mStyle.cssText=str}function is(obj,type){return typeof obj===type}function contains(str,substr){return!!~(""+str).indexOf(substr)}function testProps(props,prefixed){for(var i in props){var prop=props[i];if(!contains(prop,"-")&&mStyle[prop]!==undefined)return"pfx"==prefixed?prop:!0}return!1}function testDOMProps(props,obj,elem){for(var i in props){var item=obj[props[i]];if(item!==undefined)return elem===!1?props[i]:is(item,"function")?item.bind(elem||obj):item}return!1}function testPropsAll(prop,prefixed,elem){var ucProp=prop.charAt(0).toUpperCase()+prop.slice(1),props=(prop+" "+cssomPrefixes.join(ucProp+" ")+ucProp).split(" ");return is(prefixed,"string")||is(prefixed,"undefined")?testProps(props,prefixed):(props=(prop+" "+domPrefixes.join(ucProp+" ")+ucProp).split(" "),testDOMProps(props,prefixed,elem))}var inputElem,featureName,hasOwnProp,version="2.6.2",Modernizr={},enableClasses=!0,docElement=document.documentElement,mod="modernizr",modElem=document.createElement(mod),mStyle=modElem.style,prefixes=({}.toString," -webkit- -moz- -o- -ms- ".split(" ")),omPrefixes="Webkit Moz O ms",cssomPrefixes=omPrefixes.split(" "),domPrefixes=omPrefixes.toLowerCase().split(" "),ns={svg:"http://www.w3.org/2000/svg"},tests={},classes=[],slice=classes.slice,injectElementWithStyles=function(rule,callback,nodes,testnames){var style,ret,node,docOverflow,div=document.createElement("div"),body=document.body,fakeBody=body||document.createElement("body");if(parseInt(nodes,10))for(;nodes--;)node=document.createElement("div"),node.id=testnames?testnames[nodes]:mod+(nodes+1),div.appendChild(node);return style=["­",'<style id="s',mod,'">',rule,"</style>"].join(""),div.id=mod,(body?div:fakeBody).innerHTML+=style,fakeBody.appendChild(div),body||(fakeBody.style.background="",fakeBody.style.overflow="hidden",docOverflow=docElement.style.overflow,docElement.style.overflow="hidden",docElement.appendChild(fakeBody)),ret=callback(div,rule),body?div.parentNode.removeChild(div):(fakeBody.parentNode.removeChild(fakeBody),docElement.style.overflow=docOverflow),!!ret},_hasOwnProperty={}.hasOwnProperty;hasOwnProp=is(_hasOwnProperty,"undefined")||is(_hasOwnProperty.call,"undefined")?function(object,property){return property in object&&is(object.constructor.prototype[property],"undefined")}:function(object,property){return _hasOwnProperty.call(object,property)},Function.prototype.bind||(Function.prototype.bind=function(that){var target=this;if("function"!=typeof target)throw new TypeError;var args=slice.call(arguments,1),bound=function(){if(this instanceof bound){var F=function(){};F.prototype=target.prototype;var self=new F,result=target.apply(self,args.concat(slice.call(arguments)));return Object(result)===result?result:self}return target.apply(that,args.concat(slice.call(arguments)))};return bound}),tests.canvas=function(){var elem=document.createElement("canvas");return!(!elem.getContext||!elem.getContext("2d"))},tests.borderradius=function(){return testPropsAll("borderRadius")},tests.boxshadow=function(){return testPropsAll("boxShadow")},tests.cssanimations=function(){return testPropsAll("animationName")},tests.csstransforms=function(){return!!testPropsAll("transform")},tests.csstransforms3d=function(){var ret=!!testPropsAll("perspective");return ret&&"webkitPerspective"in docElement.style&&injectElementWithStyles("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(node){ret=9===node.offsetLeft&&3===node.offsetHeight}),ret},tests.csstransitions=function(){return testPropsAll("transition")},tests.svg=function(){return!!document.createElementNS&&!!document.createElementNS(ns.svg,"svg").createSVGRect};for(var feature in tests)hasOwnProp(tests,feature)&&(featureName=feature.toLowerCase(),Modernizr[featureName]=tests[feature](),classes.push((Modernizr[featureName]?"":"no-")+featureName));return Modernizr.addTest=function(feature,test){if("object"==typeof feature)for(var key in feature)hasOwnProp(feature,key)&&Modernizr.addTest(key,feature[key]);else{if(feature=feature.toLowerCase(),Modernizr[feature]!==undefined)return Modernizr;test="function"==typeof test?test():test,"undefined"!=typeof enableClasses&&enableClasses&&(docElement.className+=" "+(test?"":"no-")+feature),Modernizr[feature]=test}return Modernizr},setCss(""),modElem=inputElem=null,function(window,document){function addStyleSheet(ownerDocument,cssText){var p=ownerDocument.createElement("p"),parent=ownerDocument.getElementsByTagName("head")[0]||ownerDocument.documentElement;return p.innerHTML="x<style>"+cssText+"</style>",parent.insertBefore(p.lastChild,parent.firstChild)}function getElements(){var elements=html5.elements;return"string"==typeof elements?elements.split(" "):elements}function getExpandoData(ownerDocument){var data=expandoData[ownerDocument[expando]];return data||(data={},expanID++,ownerDocument[expando]=expanID,expandoData[expanID]=data),data}function createElement(nodeName,ownerDocument,data){if(ownerDocument||(ownerDocument=document),supportsUnknownElements)return ownerDocument.createElement(nodeName);data||(data=getExpandoData(ownerDocument));var node;return node=data.cache[nodeName]?data.cache[nodeName].cloneNode():saveClones.test(nodeName)?(data.cache[nodeName]=data.createElem(nodeName)).cloneNode():data.createElem(nodeName),node.canHaveChildren&&!reSkip.test(nodeName)?data.frag.appendChild(node):node}function createDocumentFragment(ownerDocument,data){if(ownerDocument||(ownerDocument=document),supportsUnknownElements)return ownerDocument.createDocumentFragment();data=data||getExpandoData(ownerDocument);for(var clone=data.frag.cloneNode(),i=0,elems=getElements(),l=elems.length;l>i;i++)clone.createElement(elems[i]);return clone}function shivMethods(ownerDocument,data){data.cache||(data.cache={},data.createElem=ownerDocument.createElement,data.createFrag=ownerDocument.createDocumentFragment,data.frag=data.createFrag()),ownerDocument.createElement=function(nodeName){return html5.shivMethods?createElement(nodeName,ownerDocument,data):data.createElem(nodeName)},ownerDocument.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+getElements().join().replace(/\w+/g,function(nodeName){return data.createElem(nodeName),data.frag.createElement(nodeName),'c("'+nodeName+'")'})+");return n}")(html5,data.frag)}function shivDocument(ownerDocument){ownerDocument||(ownerDocument=document);var data=getExpandoData(ownerDocument);return!html5.shivCSS||supportsHtml5Styles||data.hasCSS||(data.hasCSS=!!addStyleSheet(ownerDocument,"article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}")),supportsUnknownElements||shivMethods(ownerDocument,data),ownerDocument}var supportsHtml5Styles,supportsUnknownElements,options=window.html5||{},reSkip=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,saveClones=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,expando="_html5shiv",expanID=0,expandoData={};!function(){try{var a=document.createElement("a");a.innerHTML="<xyz></xyz>",supportsHtml5Styles="hidden"in a,supportsUnknownElements=1==a.childNodes.length||function(){document.createElement("a");var frag=document.createDocumentFragment();return"undefined"==typeof frag.cloneNode||"undefined"==typeof frag.createDocumentFragment||"undefined"==typeof frag.createElement}()}catch(e){supportsHtml5Styles=!0,supportsUnknownElements=!0}}();var html5={elements:options.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:options.shivCSS!==!1,supportsUnknownElements:supportsUnknownElements,shivMethods:options.shivMethods!==!1,type:"default",shivDocument:shivDocument,createElement:createElement,createDocumentFragment:createDocumentFragment};window.html5=html5,shivDocument(document)}(this,document),Modernizr._version=version,Modernizr._prefixes=prefixes,Modernizr._domPrefixes=domPrefixes,Modernizr._cssomPrefixes=cssomPrefixes,Modernizr.testProp=function(prop){return testProps([prop])},Modernizr.testAllProps=testPropsAll,Modernizr.testStyles=injectElementWithStyles,docElement.className=docElement.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(enableClasses?" js "+classes.join(" "):""),Modernizr}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var A,B,l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}};B=function(a){function b(a){var e,f,g,a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a};for(f=0;d>f;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;b>f;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var c,b=0;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var m,n,h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var l,o,k=b.createElement("script"),e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var j,e=b.createElement("link"),c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))},function(global,undefined){"use strict";function addFromSetImmediateArguments(args){return tasksByHandle[nextHandle]=partiallyApplied.apply(undefined,args),nextHandle++}function partiallyApplied(handler){var args=[].slice.call(arguments,1);return function(){"function"==typeof handler?handler.apply(undefined,args):new Function(""+handler)()
}}function runIfPresent(handle){if(currentlyRunningATask)setTimeout(partiallyApplied(runIfPresent,handle),0);else{var task=tasksByHandle[handle];if(task){currentlyRunningATask=!0;try{task()}finally{clearImmediate(handle),currentlyRunningATask=!1}}}}function clearImmediate(handle){delete tasksByHandle[handle]}function installNextTickImplementation(){setImmediate=function(){var handle=addFromSetImmediateArguments(arguments);return process.nextTick(partiallyApplied(runIfPresent,handle)),handle}}function canUsePostMessage(){if(global.postMessage&&!global.importScripts){var postMessageIsAsynchronous=!0,oldOnMessage=global.onmessage;return global.onmessage=function(){postMessageIsAsynchronous=!1},global.postMessage("","*"),global.onmessage=oldOnMessage,postMessageIsAsynchronous}}function installPostMessageImplementation(){var messagePrefix="setImmediate$"+Math.random()+"$",onGlobalMessage=function(event){event.source===global&&"string"==typeof event.data&&0===event.data.indexOf(messagePrefix)&&runIfPresent(+event.data.slice(messagePrefix.length))};global.addEventListener?global.addEventListener("message",onGlobalMessage,!1):global.attachEvent("onmessage",onGlobalMessage),setImmediate=function(){var handle=addFromSetImmediateArguments(arguments);return global.postMessage(messagePrefix+handle,"*"),handle}}function installMessageChannelImplementation(){var channel=new MessageChannel;channel.port1.onmessage=function(event){var handle=event.data;runIfPresent(handle)},setImmediate=function(){var handle=addFromSetImmediateArguments(arguments);return channel.port2.postMessage(handle),handle}}function installReadyStateChangeImplementation(){var html=doc.documentElement;setImmediate=function(){var handle=addFromSetImmediateArguments(arguments),script=doc.createElement("script");return script.onreadystatechange=function(){runIfPresent(handle),script.onreadystatechange=null,html.removeChild(script),script=null},html.appendChild(script),handle}}function installSetTimeoutImplementation(){setImmediate=function(){var handle=addFromSetImmediateArguments(arguments);return setTimeout(partiallyApplied(runIfPresent,handle),0),handle}}if(!global.setImmediate){var setImmediate,nextHandle=1,tasksByHandle={},currentlyRunningATask=!1,doc=global.document,attachTo=Object.getPrototypeOf&&Object.getPrototypeOf(global);attachTo=attachTo&&attachTo.setTimeout?attachTo:global,"[object process]"==={}.toString.call(global.process)?installNextTickImplementation():canUsePostMessage()?installPostMessageImplementation():global.MessageChannel?installMessageChannelImplementation():doc&&"onreadystatechange"in doc.createElement("script")?installReadyStateChangeImplementation():installSetTimeoutImplementation(),attachTo.setImmediate=setImmediate,attachTo.clearImmediate=clearImmediate}}(function(){return this}()),function(){function Viewport(){return this.PRE_IOS7_VIEWPORT="initial-scale=1, maximum-scale=1, user-scalable=no",this.IOS7_VIEWPORT="initial-scale=1, maximum-scale=1, user-scalable=no",this.DEFAULT_VIEWPORT="initial-scale=1, maximum-scale=1, user-scalable=no",this.ensureViewportElement(),this.platform={},this.platform.name=this.getPlatformName(),this.platform.version=this.getPlatformVersion(),this}Viewport.prototype.ensureViewportElement=function(){this.viewportElement=document.querySelector("meta[name=viewport]"),this.viewportElement||(this.viewportElement=document.createElement("meta"),this.viewportElement.name="viewport",document.head.appendChild(this.viewportElement))},Viewport.prototype.setup=function(){function isWebView(){return!!(window.cordova||window.phonegap||window.PhoneGap)}this.viewportElement&&"true"!=this.viewportElement.getAttribute("data-no-adjust")&&("ios"==this.platform.name?this.platform.version>=7&&isWebView()?this.viewportElement.setAttribute("content",this.IOS7_VIEWPORT):this.viewportElement.setAttribute("content",this.PRE_IOS7_VIEWPORT):this.viewportElement.setAttribute("content",this.DEFAULT_VIEWPORT))},Viewport.prototype.getPlatformName=function(){return navigator.userAgent.match(/Android/i)?"android":navigator.userAgent.match(/iPhone|iPad|iPod/i)?"ios":void 0},Viewport.prototype.getPlatformVersion=function(){var start=window.navigator.userAgent.indexOf("OS ");return window.Number(window.navigator.userAgent.substr(start+3,3).replace("_","."))},window.Viewport=Viewport}(),function(){try{app=angular.module("templates-main")}catch(err){app=angular.module("templates-main",[])}app.run(["$templateCache",function($templateCache){"use strict";$templateCache.put("templates/back_button.tpl",'<span \n class="toolbar-button--quiet {{modifierTemplater(\'toolbar-button--*\')}}" \n ng-click="$root.ons.findParentComponentUntil(\'ons-navigator\', $event).popPage({cancelIfRunning: true})"\n ng-show="showBackButton"\n style="height: 44px; line-height: 0; padding: 0 10px 0 0; position: relative;">\n \n <i \n class="ion-ios-arrow-back ons-back-button__icon" \n style="vertical-align: top; background-color: transparent; height: 44px; line-height: 44px; font-size: 36px; margin-left: 8px; margin-right: 2px; width: 16px; display: inline-block; padding-top: 1px;"></i>\n\n <span \n style="vertical-align: top; display: inline-block; line-height: 44px; height: 44px;" \n class="back-button__label"></span>\n</span>\n')}])}(),function(){try{app=angular.module("templates-main")}catch(err){app=angular.module("templates-main",[])}app.run(["$templateCache",function($templateCache){"use strict";$templateCache.put("templates/button.tpl",'<span class="label ons-button-inner"></span>\n<span class="spinner button__spinner {{modifierTemplater(\'button--*__spinner\')}}"></span>\n')}])}(),function(){try{app=angular.module("templates-main")}catch(err){app=angular.module("templates-main",[])}app.run(["$templateCache",function($templateCache){"use strict";$templateCache.put("templates/dialog.tpl",'<div class="dialog-mask"></div>\n<div class="dialog {{ modifierTemplater(\'dialog--*\') }}"></div>\n</div>\n')}])}(),function(){try{app=angular.module("templates-main")}catch(err){app=angular.module("templates-main",[])}app.run(["$templateCache",function($templateCache){"use strict";$templateCache.put("templates/icon.tpl",'<i class="fa fa-{{icon}} fa-{{spin}} fa-{{fixedWidth}} fa-rotate-{{rotate}} fa-flip-{{flip}}" ng-class="sizeClass" ng-style="style"></i>\n')}])}(),function(){try{app=angular.module("templates-main")}catch(err){app=angular.module("templates-main",[])}app.run(["$templateCache",function($templateCache){"use strict";$templateCache.put("templates/popover.tpl",'<div class="popover-mask"></div>\n<div class="popover popover--{{ direction }} {{ modifierTemplater(\'popover--*\') }}">\n <div class="popover__content {{ modifierTemplater(\'popover__content--*\') }}"></div>\n <div class="popover__{{ arrowPosition }}-arrow"></div>\n</div>\n')}])}(),function(){try{app=angular.module("templates-main")}catch(err){app=angular.module("templates-main",[])}app.run(["$templateCache",function($templateCache){"use strict";$templateCache.put("templates/row.tpl",'<div class="row row-{{align}} ons-row-inner"></div>\n')}])}(),function(){try{app=angular.module("templates-main")}catch(err){app=angular.module("templates-main",[])}app.run(["$templateCache",function($templateCache){"use strict";$templateCache.put("templates/sliding_menu.tpl",'<div class="onsen-sliding-menu__menu ons-sliding-menu-inner"></div>\n<div class="onsen-sliding-menu__main ons-sliding-menu-inner"></div>\n')}])}(),function(){try{app=angular.module("templates-main")}catch(err){app=angular.module("templates-main",[])}app.run(["$templateCache",function($templateCache){"use strict";$templateCache.put("templates/split_view.tpl",'<div class="onsen-split-view__secondary full-screen ons-split-view-inner"></div>\n<div class="onsen-split-view__main full-screen ons-split-view-inner"></div>\n')}])}(),function(){try{app=angular.module("templates-main")}catch(err){app=angular.module("templates-main",[])}app.run(["$templateCache",function($templateCache){"use strict";$templateCache.put("templates/switch.tpl",'<label class="switch {{modifierTemplater(\'switch--*\')}}">\n <input type="checkbox" class="switch__input {{modifierTemplater(\'switch--*__input\')}}" ng-model="model">\n <div class="switch__toggle {{modifierTemplater(\'switch--*__toggle\')}}"></div>\n</label>\n')}])}(),function(){try{app=angular.module("templates-main")}catch(err){app=angular.module("templates-main",[])}app.run(["$templateCache",function($templateCache){"use strict";$templateCache.put("templates/tab.tpl",'<input type="radio" name="tab-bar-{{tabbarId}}" style="display: none">\n<button class="tab-bar__button tab-bar-inner {{tabbarModifierTemplater(\'tab-bar--*__button\')}} {{modifierTemplater(\'tab-bar__button--*\')}}" ng-click="tryToChange()">\n</button>\n')}])}(),function(){try{app=angular.module("templates-main")}catch(err){app=angular.module("templates-main",[])}app.run(["$templateCache",function($templateCache){"use strict";$templateCache.put("templates/tab_bar.tpl",'<div class="ons-tab-bar__content tab-bar__content"></div>\n<div ng-hide="hideTabs" class="tab-bar ons-tab-bar__footer {{modifierTemplater(\'tab-bar--*\')}} ons-tabbar-inner"></div>\n')}])}(),function(){try{app=angular.module("templates-main")}catch(err){app=angular.module("templates-main",[])}app.run(["$templateCache",function($templateCache){"use strict";$templateCache.put("templates/toolbar_button.tpl","<span class=\"toolbar-button {{modifierTemplater('toolbar-button--*')}} navigation-bar__line-height\" ng-transclude></span>\n")}])}(),window.DoorLock=function(){var DoorLock=function(options){options=options||{},this._lockList=[],this._waitList=[],this._log=options.log||function(){}};return DoorLock.generateId=function(){var i=0;return function(){return i++}}(),DoorLock.prototype={lock:function(){var self=this,unlock=function(){self._unlock(unlock)};return unlock.id=DoorLock.generateId(),this._lockList.push(unlock),this._log("lock: "+unlock.id),unlock},_unlock:function(fn){var index=this._lockList.indexOf(fn);if(-1===index)throw new Error("This function is not registered in the lock list.");this._lockList.splice(index,1),this._log("unlock: "+fn.id),this._tryToFreeWaitList()},_tryToFreeWaitList:function(){for(;!this.isLocked()&&this._waitList.length>0;)this._waitList.shift()()},waitUnlock:function(callback){if(!(callback instanceof Function))throw new Error("The callback param must be a function.");this.isLocked()?this._waitList.push(callback):callback()},isLocked:function(){return this._lockList.length>0}},DoorLock}(),window.ons=function(){"use strict";function waitDeviceReady(){var unlockDeviceReady=ons._readyLock.lock();window.addEventListener("DOMContentLoaded",function(){ons.isWebView()?window.document.addEventListener("deviceready",unlockDeviceReady,!1):unlockDeviceReady()},!1)}function waitOnsenUILoad(){var unlockOnsenUI=ons._readyLock.lock();module.run(["$compile","$rootScope","$onsen",function($compile,$rootScope){if("loading"===document.readyState||"uninitialized"==document.readyState)window.addEventListener("DOMContentLoaded",function(){document.body.appendChild(document.createElement("ons-dummy-for-init"))});else{if(!document.body)throw new Error("Invalid initialization state.");document.body.appendChild(document.createElement("ons-dummy-for-init"))}$rootScope.$on("$ons-ready",unlockOnsenUI)}])}function initAngularModule(){module.value("$onsGlobal",ons),module.run(["$compile","$rootScope","$onsen","$q",function($compile,$rootScope,$onsen,$q){ons._onsenService=$onsen,ons._qService=$q,$rootScope.ons=window.ons,$rootScope.console=window.console,$rootScope.alert=window.alert,ons.$compile=$compile}])}function initKeyboardEvents(){ons.softwareKeyboard=new MicroEvent,ons.softwareKeyboard._visible=!1;var onShow=function(){ons.softwareKeyboard._visible=!0,ons.softwareKeyboard.emit("show")},onHide=function(){ons.softwareKeyboard._visible=!1,ons.softwareKeyboard.emit("hide")},bindEvents=function(){return"undefined"!=typeof Keyboard?(Keyboard.onshow=onShow,Keyboard.onhide=onHide,ons.softwareKeyboard.emit("init",{visible:Keyboard.isVisible}),!0):"undefined"!=typeof cordova.plugins&&"undefined"!=typeof cordova.plugins.Keyboard?(window.addEventListener("native.keyboardshow",onShow),window.addEventListener("native.keyboardhide",onHide),ons.softwareKeyboard.emit("init",{visible:cordova.plugins.Keyboard.isVisible}),!0):!1},noPluginError=function(){console.warn("ons-keyboard: Cordova Keyboard plugin is not present.")};document.addEventListener("deviceready",function(){bindEvents()||((document.querySelector("[ons-keyboard-active]")||document.querySelector("[ons-keyboard-inactive]"))&&noPluginError(),ons.softwareKeyboard.on=noPluginError)})}function createOnsenFacade(){var ons={_readyLock:new DoorLock,_onsenService:null,_config:{autoStatusBarFill:!0},_unlockersDict:{},componentBase:window,bootstrap:function(name,deps){angular.isArray(name)&&(deps=name,name=void 0),name||(name="myOnsenApp"),deps=["onsen"].concat(angular.isArray(deps)?deps:[]);var module=angular.module(name,deps),doc=window.document;if("loading"==doc.readyState||"uninitialized"==doc.readyState||"interactive"==doc.readyState)doc.addEventListener("DOMContentLoaded",function(){angular.bootstrap(doc.documentElement,[name])},!1);else{if(!doc.documentElement)throw new Error("Invalid state");angular.bootstrap(doc.documentElement,[name])}return module},enableAutoStatusBarFill:function(){if(this.isReady())throw new Error("This method must be called before ons.isReady() is true.");this._config.autoStatusBarFill=!0},disableAutoStatusBarFill:function(){if(this.isReady())throw new Error("This method must be called before ons.isReady() is true.");this._config.autoStatusBarFill=!1},findParentComponentUntil:function(name,dom){var element;return dom instanceof HTMLElement?element=angular.element(dom):dom instanceof angular.element?element=dom:dom.target&&(element=angular.element(dom.target)),element.inheritedData(name)},setDefaultDeviceBackButtonListener:function(listener){this._getOnsenService().getDefaultDeviceBackButtonHandler().setListener(listener)},disableDeviceBackButtonHandler:function(){this._getOnsenService().DeviceBackButtonHandler.disable()},enableDeviceBackButtonHandler:function(){this._getOnsenService().DeviceBackButtonHandler.enable()},findComponent:function(selector,dom){var target=(dom?dom:document).querySelector(selector);return target?angular.element(target).data(target.nodeName.toLowerCase())||null:null},isReady:function(){return!ons._readyLock.isLocked()},compile:function(dom){if(!ons.$compile)throw new Error("ons.$compile() is not ready. Wait for initialization with ons.ready().");if(!(dom instanceof HTMLElement))throw new Error("First argument must be an instance of HTMLElement.");var scope=angular.element(dom).scope();if(!scope)throw new Error("AngularJS Scope is null. Argument DOM element must be attached in DOM document.");ons.$compile(dom)(scope)},_getOnsenService:function(){if(!this._onsenService)throw new Error("$onsen is not loaded, wait for ons.ready().");return this._onsenService},ready:function(callback){if(callback instanceof Function)ons.isReady()?callback():ons._readyLock.waitUnlock(callback);else if(angular.isArray(callback)&&arguments[1]instanceof Function){var dependencies=callback;callback=arguments[1],ons.ready(function(){var $onsen=ons._getOnsenService();$onsen.waitForVariables(dependencies,callback)})}},isWebView:function(){if("loading"===document.readyState||"uninitialized"==document.readyState)throw new Error("isWebView() method is available after dom contents loaded.");return!!(window.cordova||window.phonegap||window.PhoneGap)},createAlertDialog:function(page,options){if(options=options||{},!page)throw new Error("Page url must be defined.");var alertDialog=angular.element("<ons-alert-dialog>"),$onsen=this._getOnsenService();return angular.element(document.body).append(angular.element(alertDialog)),$onsen.getPageHTMLAsync(page).then(function(html){var div=document.createElement("div");div.innerHTML=html;for(var el=angular.element(div.querySelector("ons-alert-dialog")),attrs=el.prop("attributes"),i=0,l=attrs.length;l>i;i++)alertDialog.attr(attrs[i].name,attrs[i].value);alertDialog.html(el.html());var parentScope;return options.parentScope?(parentScope=options.parentScope.$new(),ons.$compile(alertDialog)(parentScope)):ons.compile(alertDialog[0]),el.attr("disabled")&&alertDialog.attr("disabled","disabled"),parentScope&&(alertDialog.data("ons-alert-dialog")._parentScope=parentScope),alertDialog.data("ons-alert-dialog")})},createDialog:function(page,options){if(options=options||{},!page)throw new Error("Page url must be defined.");var dialog=angular.element("<ons-dialog>"),$onsen=this._getOnsenService();return angular.element(document.body).append(angular.element(dialog)),$onsen.getPageHTMLAsync(page).then(function(html){var div=document.createElement("div");div.innerHTML=html;for(var el=angular.element(div.querySelector("ons-dialog")),attrs=el.prop("attributes"),i=0,l=attrs.length;l>i;i++)dialog.attr(attrs[i].name,attrs[i].value);dialog.html(el.html());var parentScope;options.parentScope?(parentScope=options.parentScope.$new(),ons.$compile(dialog)(parentScope)):ons.compile(dialog[0]),el.attr("disabled")&&dialog.attr("disabled","disabled");var deferred=ons._qService.defer();return dialog.on("ons-dialog:init",function(e){var child=dialog[0].querySelector(".dialog");if(el[0].hasAttribute("style")){var parentStyle=el[0].getAttribute("style"),childStyle=child.getAttribute("style"),newStyle=function(a,b){var c=(";"===a.substr(-1)?a:a+";")+(";"===b.substr(-1)?b:b+";");return c}(parentStyle,childStyle);child.setAttribute("style",newStyle)}parentScope&&(e.component._parentScope=parentScope),deferred.resolve(e.component)}),deferred.promise})},createPopover:function(page,options){if(options=options||{},!page)throw new Error("Page url must be defined.");var popover=angular.element("<ons-popover>"),$onsen=this._getOnsenService();return angular.element(document.body).append(angular.element(popover)),$onsen.getPageHTMLAsync(page).then(function(html){var div=document.createElement("div");div.innerHTML=html;for(var el=angular.element(div.querySelector("ons-popover")),attrs=el.prop("attributes"),i=0,l=attrs.length;l>i;i++)popover.attr(attrs[i].name,attrs[i].value);popover.html(el.html());var parentScope;options.parentScope?(parentScope=options.parentScope.$new(),ons.$compile(popover)(parentScope)):ons.compile(popover[0]),el.attr("disabled")&&popover.attr("disabled","disabled");var deferred=ons._qService.defer();return popover.on("ons-popover:init",function(e){var child=popover[0].querySelector(".popover");if(el[0].hasAttribute("style")){var parentStyle=el[0].getAttribute("style"),childStyle=child.getAttribute("style"),newStyle=function(a,b){var c=(";"===a.substr(-1)?a:a+";")+(";"===b.substr(-1)?b:b+";");return c}(parentStyle,childStyle);child.setAttribute("style",newStyle)}parentScope&&(e.component._parentScope=parentScope),deferred.resolve(e.component)}),deferred.promise})}};return ons}var module=angular.module("onsen",["templates-main"]);angular.module("onsen.directives",["onsen"]);var ons=createOnsenFacade();return initKeyboardEvents(),waitDeviceReady(),waitOnsenUILoad(),initAngularModule(),ons}(),function(){"use strict";var module=angular.module("onsen");module.factory("AlertDialogView",["$onsen","DialogAnimator","SlideDialogAnimator","AndroidAlertDialogAnimator","IOSAlertDialogAnimator",function($onsen,DialogAnimator,SlideDialogAnimator,AndroidAlertDialogAnimator,IOSAlertDialogAnimator){var AlertDialogView=Class.extend({init:function(scope,element,attrs){if(this._scope=scope,this._element=element,this._attrs=attrs,this._element.css({display:"none",zIndex:20001}),this._dialog=element,this._visible=!1,this._doorLock=new DoorLock,this._animation=AlertDialogView._animatorDict["undefined"!=typeof attrs.animation?attrs.animation:"default"],!this._animation)throw new Error("No such animation: "+attrs.animation);this._deviceBackButtonHandler=$onsen.DeviceBackButtonHandler.create(this._element,this._onDeviceBackButton.bind(this)),this._createMask(attrs.maskColor),this._scope.$on("$destroy",this._destroy.bind(this))},show:function(options){options=options||{};var cancel=!1,callback=options.callback||function(){};this.emit("preshow",{alertDialog:this,cancel:function(){cancel=!0}}),cancel||this._doorLock.waitUnlock(function(){var unlock=this._doorLock.lock(),animation=this._animation;this._mask.css("display","block"),this._mask.css("opacity",1),this._element.css("display","block"),options.animation&&(animation=AlertDialogView._animatorDict[options.animation]),animation.show(this,function(){this._visible=!0,unlock(),this.emit("postshow",{alertDialog:this}),callback()}.bind(this))}.bind(this))},hide:function(options){options=options||{};var cancel=!1,callback=options.callback||function(){};this.emit("prehide",{alertDialog:this,cancel:function(){cancel=!0}}),cancel||this._doorLock.waitUnlock(function(){var unlock=this._doorLock.lock(),animation=this._animation;options.animation&&(animation=AlertDialogView._animatorDict[options.animation]),animation.hide(this,function(){this._element.css("display","none"),this._mask.css("display","none"),this._visible=!1,unlock(),this.emit("posthide",{alertDialog:this}),callback()}.bind(this))}.bind(this))},isShown:function(){return this._visible},destroy:function(){this._parentScope?(this._parentScope.$destroy(),this._parentScope=null):this._scope.$destroy()},_destroy:function(){this.emit("destroy"),this._mask.off(),this._element.remove(),this._mask.remove(),this._deviceBackButtonHandler.destroy(),this._deviceBackButtonHandler=this._scope=this._attrs=this._element=this._mask=null},setDisabled:function(disabled){if("boolean"!=typeof disabled)throw new Error("Argument must be a boolean.");disabled?this._element.attr("disabled",!0):this._element.removeAttr("disabled")},isDisabled:function(){return this._element[0].hasAttribute("disabled")},setCancelable:function(cancelable){if("boolean"!=typeof cancelable)throw new Error("Argument must be a boolean.");cancelable?this._element.attr("cancelable",!0):this._element.removeAttr("cancelable")},isCancelable:function(){return this._element[0].hasAttribute("cancelable")},_cancel:function(){this.isCancelable()&&this.hide({callback:function(){this.emit("cancel")}.bind(this)})},_onDeviceBackButton:function(event){this.isCancelable()?this._cancel.bind(this)():event.callParentHandler()},_createMask:function(color){this._mask=angular.element("<div>").addClass("alert-dialog-mask").css({zIndex:2e4,display:"none"}),this._mask.on("click",this._cancel.bind(this)),color&&this._mask.css("background-color",color),angular.element(document.body).append(this._mask)}});return AlertDialogView._animatorDict={"default":$onsen.isAndroid()?new AndroidAlertDialogAnimator:new IOSAlertDialogAnimator,fade:$onsen.isAndroid()?new AndroidAlertDialogAnimator:new IOSAlertDialogAnimator,slide:new SlideDialogAnimator,none:new DialogAnimator},AlertDialogView.registerAnimator=function(name,animator){if(!(animator instanceof DialogAnimator))throw new Error('"animator" param must be an instance of DialogAnimator');this._animatorDict[name]=animator},MicroEvent.mixin(AlertDialogView),AlertDialogView}])}(),function(){"use strict;";var module=angular.module("onsen");module.factory("AndroidAlertDialogAnimator",["DialogAnimator",function(DialogAnimator){var AndroidAlertDialogAnimator=DialogAnimator.extend({timing:"cubic-bezier(.1, .7, .4, 1)",duration:.2,init:function(options){options=options||{},this.timing=options.timing||this.timing,this.duration=void 0!==options.duration?options.duration:this.duration},show:function(dialog,callback){callback=callback?callback:function(){},animit.runAll(animit(dialog._mask[0]).queue({opacity:0}).queue({opacity:1},{duration:this.duration,timing:this.timing}),animit(dialog._dialog[0]).queue({css:{transform:"translate3d(-50%, -50%, 0) scale3d(0.9, 0.9, 1.0)",opacity:0},duration:0}).queue({css:{transform:"translate3d(-50%, -50%, 0) scale3d(1.0, 1.0, 1.0)",opacity:1},duration:this.duration,timing:this.timing}).resetStyle().queue(function(done){callback(),done()}))},hide:function(dialog,callback){callback=callback?callback:function(){},animit.runAll(animit(dialog._mask[0]).queue({opacity:1}).queue({opacity:0},{duration:this.duration,timing:this.timing}),animit(dialog._dialog[0]).queue({css:{transform:"translate3d(-50%, -50%, 0) scale3d(1.0, 1.0, 1.0)",opacity:1},duration:0}).queue({css:{transform:"translate3d(-50%, -50%, 0) scale3d(0.9, 0.9, 1.0)",opacity:0},duration:this.duration,timing:this.timing}).resetStyle().queue(function(done){callback(),done()}))}});return AndroidAlertDialogAnimator}])}(),function(){"use strict;";var module=angular.module("onsen");module.factory("AndroidDialogAnimator",["DialogAnimator",function(DialogAnimator){var AndroidDialogAnimator=DialogAnimator.extend({timing:"ease-in-out",duration:.3,init:function(options){options=options||{},this.timing=options.timing||this.timing,this.duration=void 0!==options.duration?options.duration:this.duration},show:function(dialog,callback){callback=callback?callback:function(){},animit.runAll(animit(dialog._mask[0]).queue({opacity:0}).queue({opacity:1},{duration:this.duration,timing:this.timing}),animit(dialog._dialog[0]).queue({css:{transform:"translate3d(-50%, -60%, 0)",opacity:0},duration:0}).queue({css:{transform:"translate3d(-50%, -50%, 0)",opacity:1},duration:this.duration,timing:this.timing}).resetStyle().queue(function(done){callback(),done()}))},hide:function(dialog,callback){callback=callback?callback:function(){},animit.runAll(animit(dialog._mask[0]).queue({opacity:1}).queue({opacity:0},{duration:this.duration,timing:this.timing}),animit(dialog._dialog[0]).queue({css:{transform:"translate3d(-50%, -50%, 0)",opacity:1},duration:0}).queue({css:{transform:"translate3d(-50%, -60%, 0)",opacity:0},duration:this.duration,timing:this.timing}).resetStyle().queue(function(done){callback(),done()}))}});return AndroidDialogAnimator}])}(),function(){"use strict";var module=angular.module("onsen");module.factory("ButtonView",["$onsen",function(){var ButtonView=Class.extend({init:function(scope,element,attrs){this._element=element,this._scope=scope,this._attrs=attrs},startSpin:function(){this._attrs.$set("shouldSpin","true")},stopSpin:function(){this._attrs.$set("shouldSpin","false")},isSpinning:function(){return"true"===this._attrs.shouldSpin},setSpinAnimation:function(animation){this._scope.$apply(function(){var animations=["slide-left","slide-right","slide-up","slide-down","expand-left","expand-right","expand-up","expand-down","zoom-out","zoom-in"];animations.indexOf(animation)<0&&(console.warn("Animation "+animation+"doesn't exist."),animation="slide-left"),this._scope.animation=animation}.bind(this))},isDisabled:function(){return this._element[0].hasAttribute("disabled")},setDisabled:function(disabled){if("boolean"!=typeof disabled)throw new Error("Argument must be a boolean.");disabled?this._element[0].setAttribute("disabled",""):this._element[0].removeAttribute("disabled")}});return MicroEvent.mixin(ButtonView),ButtonView}])}(),function(){"use strict;";var module=angular.module("onsen");module.factory("CarouselView",["$onsen",function(){var VerticalModeTrait={_getScrollDelta:function(event){return event.gesture.deltaY},_getScrollVelocity:function(event){return event.gesture.velocityY},_getElementSize:function(){return this._currentElementSize||(this._currentElementSize=this._element[0].getBoundingClientRect().height),this._currentElementSize},_generateScrollTransform:function(scroll){return"translate3d(0px, "+-scroll+"px, 0px)"},_layoutCarouselItems:function(){for(var children=this._getCarouselItemElements(),sizeAttr=this._getCarouselItemSizeAttr(),sizeInfo=this._decomposeSizeString(sizeAttr),i=0;i<children.length;i++)angular.element(children[i]).css({position:"absolute",height:sizeAttr,width:"100%",visibility:"visible",left:"0px",top:i*sizeInfo.number+sizeInfo.unit})}},HorizontalModeTrait={_getScrollDelta:function(event){return event.gesture.deltaX},_getScrollVelocity:function(event){return event.gesture.velocityX},_getElementSize:function(){return this._currentElementSize||(this._currentElementSize=this._element[0].getBoundingClientRect().width),this._currentElementSize},_generateScrollTransform:function(scroll){return"translate3d("+-scroll+"px, 0px, 0px)"},_layoutCarouselItems:function(){for(var children=this._getCarouselItemElements(),sizeAttr=this._getCarouselItemSizeAttr(),sizeInfo=this._decomposeSizeString(sizeAttr),i=0;i<children.length;i++)angular.element(children[i]).css({position:"absolute",width:sizeAttr,height:"100%",top:"0px",visibility:"visible",left:i*sizeInfo.number+sizeInfo.unit})}},CarouselView=Class.extend({_element:void 0,_scope:void 0,_doorLock:void 0,_scroll:void 0,init:function(scope,element,attrs){this._element=element,this._scope=scope,this._attrs=attrs,this._doorLock=new DoorLock,this._scroll=0,this._lastActiveIndex=0,this._bindedOnDrag=this._onDrag.bind(this),this._bindedOnDragEnd=this._onDragEnd.bind(this),this._bindedOnResize=this._onResize.bind(this),this._mixin(this._isVertical()?VerticalModeTrait:HorizontalModeTrait),this._prepareEventListeners(),this._layoutCarouselItems(),this._setupInitialIndex(),this._attrs.$observe("direction",this._onDirectionChange.bind(this)),this._scope.$on("$destroy",this._destroy.bind(this)),this._saveLastState()},_onResize:function(){this.refresh()},_onDirectionChange:function(){this._isVertical()?this._element.css({overflowX:"auto",overflowY:""}):this._element.css({overflowX:"",overflowY:"auto"})},_saveLastState:function(){this._lastState={elementSize:this._getCarouselItemSize(),carouselElementCount:this._getCarouselItemCount(),width:this._getCarouselItemSize()*this._getCarouselItemCount()}},_getCarouselItemSize:function(){var sizeAttr=this._getCarouselItemSizeAttr(),sizeInfo=this._decomposeSizeString(sizeAttr),elementSize=this._getElementSize();if("%"===sizeInfo.unit)return Math.round(sizeInfo.number/100*elementSize);if("px"===sizeInfo.unit)return sizeInfo.number;throw new Error("Invalid state")},_getInitialIndex:function(){var index=parseInt(this._element.attr("initial-index"),10);return"number"!=typeof index||isNaN(index)?0:Math.max(Math.min(index,this._getCarouselItemCount()-1),0)},_getCarouselItemSizeAttr:function(){var attrName="item-"+(this._isVertical()?"height":"width"),itemSizeAttr=(""+this._element.attr(attrName)).trim();return itemSizeAttr.match(/^\d+(px|%)$/)?itemSizeAttr:"100%"},_decomposeSizeString:function(size){var matches=size.match(/^(\d+)(px|%)/);return{number:parseInt(matches[1],10),unit:matches[2]}},_setupInitialIndex:function(){this._scroll=this._getCarouselItemSize()*this._getInitialIndex(),this._lastActiveIndex=this._getInitialIndex(),this._scrollTo(this._scroll)},setSwipeable:function(swipeable){swipeable?this._element[0].setAttribute("swipeable",""):this._element[0].removeAttribute("swipeable")},isSwipeable:function(){return this._element[0].hasAttribute("swipeable")},setAutoScrollRatio:function(ratio){if(0>ratio||ratio>1)throw new Error("Invalid ratio.");this._element[0].setAttribute("auto-scroll-ratio",ratio)},getAutoScrollRatio:function(){var attr=this._element[0].getAttribute("auto-scroll-ratio");if(!attr)return.5;var scrollRatio=parseFloat(attr);if(0>scrollRatio||scrollRatio>1)throw new Error("Invalid ratio.");return isNaN(scrollRatio)?.5:scrollRatio},setActiveCarouselItemIndex:function(index,options){options=options||{},index=Math.max(0,Math.min(index,this._getCarouselItemCount()-1));var scroll=this._getCarouselItemSize()*index,max=this._calculateMaxScroll();this._scroll=Math.max(0,Math.min(max,scroll)),this._scrollTo(this._scroll,{animate:"none"!==options.animation,callback:options.callback}),this._tryFirePostChangeEvent()},getActiveCarouselItemIndex:function(){var scroll=this._scroll,count=this._getCarouselItemCount(),size=this._getCarouselItemSize();if(0>scroll)return 0;for(var i=0;count>i;i++)if(scroll>=size*i&&size*(i+1)>scroll)return i;
return i},next:function(options){this.setActiveCarouselItemIndex(this.getActiveCarouselItemIndex()+1,options)},prev:function(options){this.setActiveCarouselItemIndex(this.getActiveCarouselItemIndex()-1,options)},setAutoScrollEnabled:function(enabled){enabled?this._element[0].setAttribute("auto-scroll",""):this._element[0].removeAttribute("auto-scroll")},isAutoScrollEnabled:function(){return this._element[0].hasAttribute("auto-scroll")},setDisabled:function(disabled){disabled?this._element[0].setAttribute("disabled",""):this._element[0].removeAttribute("disabled")},isDisabled:function(){return this._element[0].hasAttribute("disabled")},setOverscrollable:function(scrollable){scrollable?this._element[0].setAttribute("overscrollable",""):this._element[0].removeAttribute("overscrollable")},_mixin:function(trait){Object.keys(trait).forEach(function(key){this[key]=trait[key]}.bind(this))},_isEnabledChangeEvent:function(){var elementSize=this._getElementSize(),carouselItemSize=this._getCarouselItemSize();return this.isAutoScrollEnabled()&&elementSize===carouselItemSize},_isVertical:function(){return"vertical"===this._element.attr("direction")},_prepareEventListeners:function(){this._hammer=new Hammer(this._element[0],{dragMinDistance:1}),this._hammer.on("drag dragleft dragright dragup dragdown swipe swipeleft swiperight swipeup swipedown",this._bindedOnDrag),this._hammer.on("dragend",this._bindedOnDragEnd),angular.element(window).on("resize",this._bindedOnResize)},_tryFirePostChangeEvent:function(){var currentIndex=this.getActiveCarouselItemIndex();if(this._lastActiveIndex!==currentIndex){var lastActiveIndex=this._lastActiveIndex;this._lastActiveIndex=currentIndex,this.emit("postchange",{carousel:this,activeIndex:currentIndex,lastActiveIndex:lastActiveIndex})}},_onDrag:function(event){if(this.isSwipeable()){var direction=event.gesture.direction;if((!this._isVertical()||"left"!==direction&&"right"!==direction)&&(this._isVertical()||"up"!==direction&&"down"!==direction)){event.stopPropagation(),this._lastDragEvent=event;var scroll=this._scroll-this._getScrollDelta(event);this._scrollTo(scroll),event.gesture.preventDefault(),this._tryFirePostChangeEvent()}}},_onDragEnd:function(event){if(this._currentElementSize=void 0,this._carouselItemElements=void 0,this.isSwipeable()){if(this._scroll=this._scroll-this._getScrollDelta(event),0!==this._getScrollDelta(event)&&event.stopPropagation(),this._isOverScroll(this._scroll)){var waitForAction=!1;this.emit("overscroll",{carousel:this,activeIndex:this.getActiveCarouselItemIndex(),direction:this._getOverScrollDirection(),waitToReturn:function(promise){waitForAction=!0,promise.then(function(){this._scrollToKillOverScroll()}.bind(this))}.bind(this)}),waitForAction||this._scrollToKillOverScroll()}else this._startMomemtumScroll(event);this._lastDragEvent=null,event.gesture.preventDefault()}},_getTouchEvents:function(){var EVENTS=["drag","dragstart","dragend","dragup","dragdown","dragleft","dragright","swipe","swipeup","swipedown","swipeleft","swiperight"];return EVENTS.join(" ")},isOverscrollable:function(){return this._element[0].hasAttribute("overscrollable")},_startMomemtumScroll:function(){if(this._lastDragEvent){var velocity=this._getScrollVelocity(this._lastDragEvent),duration=.3,scrollDelta=100*duration*velocity,scroll=this._scroll+(this._getScrollDelta(this._lastDragEvent)>0?-scrollDelta:scrollDelta);scroll=this._normalizeScrollPosition(scroll),this._scroll=scroll,animit(this._getCarouselItemElements()).queue({transform:this._generateScrollTransform(this._scroll)},{duration:duration,timing:"cubic-bezier(.1, .7, .1, 1)"}).queue(function(done){done(),this._tryFirePostChangeEvent()}.bind(this)).play()}},_normalizeScrollPosition:function(scroll){var max=this._calculateMaxScroll();if(this.isAutoScrollEnabled()){for(var arr=[],size=this._getCarouselItemSize(),i=0;i<this._getCarouselItemCount();i++)max>=i*size&&arr.push(i*size);arr.push(max),arr.sort(function(left,right){return left=Math.abs(left-scroll),right=Math.abs(right-scroll),left-right}),arr=arr.filter(function(item,pos){return!pos||item!=arr[pos-1]});var lastScroll=this._lastActiveIndex*size,scrollRatio=Math.abs(scroll-lastScroll)/size;return scrollRatio<=this.getAutoScrollRatio()?lastScroll:scrollRatio>this.getAutoScrollRatio()&&1>scrollRatio&&arr[0]===lastScroll&&arr.length>1?arr[1]:arr[0]}return Math.max(0,Math.min(max,scroll))},_getCarouselItemElements:function(){for(var nodeList=this._element[0].children,rv=[],i=nodeList.length;i--;)rv.unshift(nodeList[i]);return rv=rv.filter(function(item){return"ons-carousel-item"===item.nodeName.toLowerCase()})},_scrollTo:function(scroll,options){function normalizeScroll(scroll){var ratio=.35;if(0>scroll)return isOverscrollable?Math.round(scroll*ratio):0;var maxScroll=self._calculateMaxScroll();return scroll>maxScroll?isOverscrollable?maxScroll+Math.round((scroll-maxScroll)*ratio):maxScroll:scroll}options=options||{};var self=this,isOverscrollable=this.isOverscrollable();options.animate?animit(this._getCarouselItemElements()).queue({transform:this._generateScrollTransform(normalizeScroll(scroll))},{duration:.3,timing:"cubic-bezier(.1, .7, .1, 1)"}).play(options.callback):animit(this._getCarouselItemElements()).queue({transform:this._generateScrollTransform(normalizeScroll(scroll))}).play(options.callback)},_calculateMaxScroll:function(){var max=this._getCarouselItemCount()*this._getCarouselItemSize()-this._getElementSize();return Math.ceil(0>max?0:max)},_isOverScroll:function(scroll){return 0>scroll||scroll>this._calculateMaxScroll()?!0:!1},_getOverScrollDirection:function(){return this._isVertical()?this._scroll<=0?"up":"down":this._scroll<=0?"left":"right"},_scrollToKillOverScroll:function(){var duration=.4;if(this._scroll<0)return animit(this._getCarouselItemElements()).queue({transform:this._generateScrollTransform(0)},{duration:duration,timing:"cubic-bezier(.1, .4, .1, 1)"}).queue(function(done){done(),this._tryFirePostChangeEvent()}.bind(this)).play(),this._scroll=0,void 0;var maxScroll=this._calculateMaxScroll();return maxScroll<this._scroll?(animit(this._getCarouselItemElements()).queue({transform:this._generateScrollTransform(maxScroll)},{duration:duration,timing:"cubic-bezier(.1, .4, .1, 1)"}).queue(function(done){done(),this._tryFirePostChangeEvent()}.bind(this)).play(),this._scroll=maxScroll,void 0):void 0},_getCarouselItemCount:function(){return this._getCarouselItemElements().length},refresh:function(){if(0!==this._getCarouselItemSize()){if(this._mixin(this._isVertical()?VerticalModeTrait:HorizontalModeTrait),this._layoutCarouselItems(),this._lastState&&this._lastState.width>0){var scroll=this._scroll;this._isOverScroll(scroll)?this._scrollToKillOverScroll():(this.isAutoScrollEnabled()&&(scroll=this._normalizeScrollPosition(scroll)),this._scrollTo(scroll))}this._saveLastState(),this.emit("refresh",{carousel:this})}},first:function(){this.setActiveCarouselItemIndex(0)},last:function(){this.setActiveCarouselItemIndex(Math.max(this._getCarouselItemCount()-1,0))},_destroy:function(){this.emit("destroy"),this._hammer.off("drag dragleft dragright dragup dragdown swipe swipeleft swiperight swipeup swipedown",this._bindedOnDrag),this._hammer.off("dragend",this._bindedOnDragEnd),angular.element(window).off("resize",this._bindedOnResize),this._element=this._scope=this._attrs=null}});return MicroEvent.mixin(CarouselView),CarouselView}])}(),function(){"use strict";var module=angular.module("onsen");module.factory("DialogView",["$onsen","DialogAnimator","IOSDialogAnimator","AndroidDialogAnimator","SlideDialogAnimator",function($onsen,DialogAnimator,IOSDialogAnimator,AndroidDialogAnimator,SlideDialogAnimator){var DialogView=Class.extend({init:function(scope,element,attrs){if(this._scope=scope,this._element=element,this._attrs=attrs,this._element.css("display","none"),this._dialog=angular.element(element[0].querySelector(".dialog")),this._mask=angular.element(element[0].querySelector(".dialog-mask")),this._dialog.css("z-index",20001),this._mask.css("z-index",2e4),this._mask.on("click",this._cancel.bind(this)),this._visible=!1,this._doorLock=new DoorLock,this._animation=DialogView._animatorDict["undefined"!=typeof attrs.animation?attrs.animation:"default"],!this._animation)throw new Error("No such animation: "+attrs.animation);this._deviceBackButtonHandler=$onsen.DeviceBackButtonHandler.create(this._element,this._onDeviceBackButton.bind(this)),this._scope.$on("$destroy",this._destroy.bind(this))},getDeviceBackButtonHandler:function(){return this._deviceBackButtonHandler},_getMaskColor:function(){return this._element[0].getAttribute("mask-color")||"rgba(0, 0, 0, 0.2)"},show:function(options){options=options||{};var cancel=!1,callback=options.callback||function(){};this.emit("preshow",{dialog:this,cancel:function(){cancel=!0}}),cancel||this._doorLock.waitUnlock(function(){var unlock=this._doorLock.lock(),animation=this._animation;this._element.css("display","block"),this._mask.css("opacity",1),this._mask.css("backgroundColor",this._getMaskColor()),options.animation&&(animation=DialogView._animatorDict[options.animation]),animation.show(this,function(){this._visible=!0,unlock(),this.emit("postshow",{dialog:this}),callback()}.bind(this))}.bind(this))},hide:function(options){options=options||{};var cancel=!1,callback=options.callback||function(){};this.emit("prehide",{dialog:this,cancel:function(){cancel=!0}}),cancel||this._doorLock.waitUnlock(function(){var unlock=this._doorLock.lock(),animation=this._animation;options.animation&&(animation=DialogView._animatorDict[options.animation]),animation.hide(this,function(){this._element.css("display","none"),this._visible=!1,unlock(),this.emit("posthide",{dialog:this}),callback()}.bind(this))}.bind(this))},isShown:function(){return this._visible},destroy:function(){this._parentScope?(this._parentScope.$destroy(),this._parentScope=null):this._scope.$destroy()},_destroy:function(){this.emit("destroy"),this._element.remove(),this._deviceBackButtonHandler.destroy(),this._mask.off(),this._deviceBackButtonHandler=this._scope=this._attrs=this._element=this._dialog=this._mask=null},setDisabled:function(disabled){if("boolean"!=typeof disabled)throw new Error("Argument must be a boolean.");disabled?this._element.attr("disabled",!0):this._element.removeAttr("disabled")},isDisabled:function(){return this._element[0].hasAttribute("disabled")},setCancelable:function(cancelable){if("boolean"!=typeof cancelable)throw new Error("Argument must be a boolean.");cancelable?this._element.attr("cancelable",!0):this._element.removeAttr("cancelable")},isCancelable:function(){return this._element[0].hasAttribute("cancelable")},_cancel:function(){this.isCancelable()&&this.hide({callback:function(){this.emit("cancel")}.bind(this)})},_onDeviceBackButton:function(event){this.isCancelable()?this._cancel.bind(this)():event.callParentHandler()}});return DialogView._animatorDict={"default":$onsen.isAndroid()?new AndroidDialogAnimator:new IOSDialogAnimator,fade:$onsen.isAndroid()?new AndroidDialogAnimator:new IOSDialogAnimator,slide:new SlideDialogAnimator,none:new DialogAnimator},DialogView.registerAnimator=function(name,animator){if(!(animator instanceof DialogAnimator))throw new Error('"animator" param must be an instance of DialogAnimator');this._animatorDict[name]=animator},MicroEvent.mixin(DialogView),DialogView}])}(),function(){"use strict;";var module=angular.module("onsen");module.factory("DialogAnimator",function(){var DialogAnimator=Class.extend({show:function(dialog,callback){callback()},hide:function(dialog,callback){callback()}});return DialogAnimator})}(),function(){"use strict";var module=angular.module("onsen");module.factory("FadePopoverAnimator",["PopoverAnimator",function(PopoverAnimator){var FadePopoverAnimator=PopoverAnimator.extend({timing:"cubic-bezier(.1, .7, .4, 1)",duration:.2,init:function(options){options=options||{},this.timing=options.timing||this.timing,this.duration=void 0!==options.duration?options.duration:this.duration},show:function(popover,callback){var pop=popover._element[0].querySelector(".popover"),mask=popover._element[0].querySelector(".popover-mask");animit.runAll(animit(mask).queue({opacity:0}).queue({opacity:1},{duration:this.duration,timing:this.timing}),animit(pop).queue({transform:"scale3d(1.3, 1.3, 1.0)",opacity:0}).queue({transform:"scale3d(1.0, 1.0, 1.0)",opacity:1},{duration:this.duration,timing:this.timing}).resetStyle().queue(function(done){callback(),done()}))},hide:function(popover,callback){var pop=popover._element[0].querySelector(".popover"),mask=popover._element[0].querySelector(".popover-mask");animit.runAll(animit(mask).queue({opacity:1}).queue({opacity:0},{duration:this.duration,timing:this.timing}),animit(pop).queue({opacity:1}).queue({opacity:0},{duration:this.duration,timing:this.timing}).resetStyle().queue(function(done){callback(),done()}))}});return FadePopoverAnimator}])}(),function(){"use strict;";var module=angular.module("onsen");module.factory("FadeTransitionAnimator",["NavigatorTransitionAnimator",function(NavigatorTransitionAnimator){var FadeTransitionAnimator=NavigatorTransitionAnimator.extend({push:function(enterPage,leavePage,callback){animit.runAll(animit([enterPage.getPageView().getContentElement(),enterPage.getPageView().getBackgroundElement()]).queue({css:{transform:"translate3D(0, 0, 0)",opacity:0},duration:0}).queue({css:{transform:"translate3D(0, 0, 0)",opacity:1},duration:.4,timing:"linear"}).resetStyle().queue(function(done){callback(),done()}),animit(enterPage.getPageView().getToolbarElement()).queue({css:{transform:"translate3D(0, 0, 0)",opacity:0},duration:0}).queue({css:{transform:"translate3D(0, 0, 0)",opacity:1},duration:.4,timing:"linear"}).resetStyle())},pop:function(enterPage,leavePage,callback){animit.runAll(animit([leavePage.getPageView().getContentElement(),leavePage.getPageView().getBackgroundElement()]).queue({css:{transform:"translate3D(0, 0, 0)",opacity:1},duration:0}).queue({css:{transform:"translate3D(0, 0, 0)",opacity:0},duration:.4,timing:"linear"}).queue(function(done){callback(),done()}),animit(leavePage.getPageView().getToolbarElement()).queue({css:{transform:"translate3D(0, 0, 0)",opacity:1},duration:0}).queue({css:{transform:"translate3D(0, 0, 0)",opacity:0},duration:.4,timing:"linear"}))}});return FadeTransitionAnimator}])}(),function(){"use strict";var module=angular.module("onsen");module.factory("GenericView",["$onsen",function(){var GenericView=Class.extend({init:function(scope,element){this._element=element,this._scope=scope}});return MicroEvent.mixin(GenericView),GenericView}])}(),function(){"use strict;";var module=angular.module("onsen");module.factory("IOSAlertDialogAnimator",["DialogAnimator",function(DialogAnimator){var IOSAlertDialogAnimator=DialogAnimator.extend({timing:"cubic-bezier(.1, .7, .4, 1)",duration:.2,init:function(options){options=options||{},this.timing=options.timing||this.timing,this.duration=void 0!==options.duration?options.duration:this.duration},show:function(dialog,callback){callback=callback?callback:function(){},animit.runAll(animit(dialog._mask[0]).queue({opacity:0}).queue({opacity:1},{duration:this.duration,timing:this.timing}),animit(dialog._dialog[0]).queue({css:{transform:"translate3d(-50%, -50%, 0) scale3d(1.3, 1.3, 1.0)",opacity:0},duration:0}).queue({css:{transform:"translate3d(-50%, -50%, 0) scale3d(1.0, 1.0, 1.0)",opacity:1},duration:this.duration,timing:this.timing}).resetStyle().queue(function(done){callback(),done()}))},hide:function(dialog,callback){callback=callback?callback:function(){},animit.runAll(animit(dialog._mask[0]).queue({opacity:1}).queue({opacity:0},{duration:this.duration,timing:this.timing}),animit(dialog._dialog[0]).queue({css:{opacity:1},duration:0}).queue({css:{opacity:0},duration:this.duration,timing:this.timing}).resetStyle().queue(function(done){callback(),done()}))}});return IOSAlertDialogAnimator}])}(),function(){"use strict;";var module=angular.module("onsen");module.factory("IOSDialogAnimator",["DialogAnimator",function(DialogAnimator){var IOSDialogAnimator=DialogAnimator.extend({timing:"ease-in-out",duration:.3,init:function(options){options=options||{},this.timing=options.timing||this.timing,this.duration=void 0!==options.duration?options.duration:this.duration},show:function(dialog,callback){callback=callback?callback:function(){},animit.runAll(animit(dialog._mask[0]).queue({opacity:0}).queue({opacity:1},{duration:this.duration,timing:this.timing}),animit(dialog._dialog[0]).queue({css:{transform:"translate3d(-50%, 300%, 0)"},duration:0}).queue({css:{transform:"translate3d(-50%, -50%, 0)"},duration:this.duration,timing:this.timing}).resetStyle().queue(function(done){callback(),done()}))},hide:function(dialog,callback){callback=callback?callback:function(){},animit.runAll(animit(dialog._mask[0]).queue({opacity:1}).queue({opacity:0},{duration:this.duration,timing:this.timing}),animit(dialog._dialog[0]).queue({css:{transform:"translate3d(-50%, -50%, 0)"},duration:0}).queue({css:{transform:"translate3d(-50%, 300%, 0)"},duration:this.duration,timing:this.timing}).resetStyle().queue(function(done){callback(),done()}))}});return IOSDialogAnimator}])}(),function(){"use strict;";var module=angular.module("onsen");module.factory("IOSSlideTransitionAnimator",["NavigatorTransitionAnimator","PageView",function(NavigatorTransitionAnimator){var IOSSlideTransitionAnimator=NavigatorTransitionAnimator.extend({backgroundMask:angular.element('<div style="position: absolute; width: 100%;height: 100%; background-color: black; opacity: 0;"></div>'),_decompose:function(page){function excludeBackButtonLabel(elements){for(var result=[],i=0;i<elements.length;i++)"ons-back-button"===elements[i].nodeName.toLowerCase()?result.push(elements[i].querySelector(".ons-back-button__icon")):result.push(elements[i]);return result}var left=page.getPageView().getToolbarLeftItemsElement(),right=page.getPageView().getToolbarRightItemsElement(),other=[].concat(0===left.children.length?left:excludeBackButtonLabel(left.children)).concat(0===right.children.length?right:excludeBackButtonLabel(right.children)),pageLabels=[page.getPageView().getToolbarCenterItemsElement(),page.getPageView().getToolbarBackButtonLabelElement()];return{pageLabels:pageLabels,other:other,content:page.getPageView().getContentElement(),background:page.getPageView().getBackgroundElement(),toolbar:page.getPageView().getToolbarElement(),bottomToolbar:page.getPageView().getBottomToolbarElement()}},_shouldAnimateToolbar:function(enterPage,leavePage){var bothPageHasToolbar=enterPage.getPageView().hasToolbarElement()&&leavePage.getPageView().hasToolbarElement(),noAndroidLikeToolbar=!angular.element(enterPage.getPageView().getToolbarElement()).hasClass("navigation-bar--android")&&!angular.element(leavePage.getPageView().getToolbarElement()).hasClass("navigation-bar--android");return bothPageHasToolbar&&noAndroidLikeToolbar},push:function(enterPage,leavePage,callback){var mask=this.backgroundMask.remove();leavePage.element[0].parentNode.insertBefore(mask[0],leavePage.element[0].nextSibling);var enterPageDecomposition=this._decompose(enterPage),leavePageDecomposition=this._decompose(leavePage),delta=function(){var rect=leavePage.element[0].getBoundingClientRect();return Math.round((rect.right-rect.left)/2*.6)}(),maskClear=animit(mask[0]).queue({opacity:0,transform:"translate3d(0, 0, 0)"}).queue({opacity:.1},{duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)"}).resetStyle().queue(function(done){mask.remove(),done()}),shouldAnimateToolbar=this._shouldAnimateToolbar(enterPage,leavePage);shouldAnimateToolbar?(enterPage.element.css({zIndex:"auto"}),leavePage.element.css({zIndex:"auto"}),animit.runAll(maskClear,animit([enterPageDecomposition.content,enterPageDecomposition.bottomToolbar,enterPageDecomposition.background]).queue({css:{transform:"translate3D(100%, 0px, 0px)"},duration:0}).queue({css:{transform:"translate3D(0px, 0px, 0px)"},duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)"}).resetStyle(),animit(enterPageDecomposition.toolbar).queue({css:{background:"none",backgroundColor:"rgba(0, 0, 0, 0)",borderColor:"rgba(0, 0, 0, 0)"},duration:0}).wait(.3).resetStyle({duration:.1,transition:"background-color 0.1s linear, border-color 0.1s linear"}),animit(enterPageDecomposition.pageLabels).queue({css:{transform:"translate3d("+delta+"px, 0, 0)",opacity:0},duration:0}).queue({css:{transform:"translate3d(0, 0, 0)",opacity:1},duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)"}).resetStyle(),animit(enterPageDecomposition.other).queue({css:{opacity:0},duration:0}).queue({css:{opacity:1},duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)"}).resetStyle(),animit([leavePageDecomposition.content,leavePageDecomposition.bottomToolbar,leavePageDecomposition.background]).queue({css:{transform:"translate3D(0, 0, 0)"},duration:0}).queue({css:{transform:"translate3D(-25%, 0px, 0px)"},duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)"}).resetStyle().queue(function(done){enterPage.element.css({zIndex:""}),leavePage.element.css({zIndex:""}),callback(),done()}),animit(leavePageDecomposition.pageLabels).queue({css:{transform:"translate3d(0, 0, 0)",opacity:1},duration:0}).queue({css:{transform:"translate3d(-"+delta+"px, 0, 0)",opacity:0},duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)"}).resetStyle(),animit(leavePageDecomposition.other).queue({css:{opacity:1},duration:0}).queue({css:{opacity:0},duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)"}).resetStyle())):animit.runAll(maskClear,animit(enterPage.element[0]).queue({css:{transform:"translate3D(100%, 0px, 0px)"},duration:0}).queue({css:{transform:"translate3D(0px, 0px, 0px)"},duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)"}).resetStyle(),animit(leavePage.element[0]).queue({css:{transform:"translate3D(0, 0, 0)"},duration:0}).queue({css:{transform:"translate3D(-25%, 0px, 0px)"},duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)"}).resetStyle().queue(function(done){callback(),done()}))},pop:function(enterPage,leavePage,done){var mask=this.backgroundMask.remove();enterPage.element[0].parentNode.insertBefore(mask[0],enterPage.element[0].nextSibling);var enterPageDecomposition=this._decompose(enterPage),leavePageDecomposition=this._decompose(leavePage),delta=function(){var rect=leavePage.element[0].getBoundingClientRect();return Math.round((rect.right-rect.left)/2*.6)}(),maskClear=animit(mask[0]).queue({opacity:.1,transform:"translate3d(0, 0, 0)"}).queue({opacity:0},{duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)"}).resetStyle().queue(function(done){mask.remove(),done()}),shouldAnimateToolbar=this._shouldAnimateToolbar(enterPage,leavePage);shouldAnimateToolbar?(enterPage.element.css({zIndex:"auto"}),leavePage.element.css({zIndex:"auto"}),animit.runAll(maskClear,animit([enterPageDecomposition.content,enterPageDecomposition.bottomToolbar,enterPageDecomposition.background]).queue({css:{transform:"translate3D(-25%, 0px, 0px)",opacity:.9},duration:0}).queue({css:{transform:"translate3D(0px, 0px, 0px)",opacity:1},duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)"}).resetStyle(),animit(enterPageDecomposition.pageLabels).queue({css:{transform:"translate3d(-"+delta+"px, 0, 0)",opacity:0},duration:0}).queue({css:{transform:"translate3d(0, 0, 0)",opacity:1},duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)"}).resetStyle(),animit(enterPageDecomposition.toolbar).queue({css:{transform:"translate3d(0, 0, 0)",opacity:1},duration:0}).queue({css:{transform:"translate3d(0, 0, 0)",opacity:1},duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)"}).resetStyle(),animit(enterPageDecomposition.other).queue({css:{opacity:0},duration:0}).queue({css:{opacity:1},duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)"}).resetStyle(),animit([leavePageDecomposition.content,leavePageDecomposition.bottomToolbar,leavePageDecomposition.background]).queue({css:{transform:"translate3D(0px, 0px, 0px)"},duration:0}).queue({css:{transform:"translate3D(100%, 0px, 0px)"},duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)"}).wait(0).queue(function(finish){enterPage.element.css({zIndex:""}),leavePage.element.css({zIndex:""}),done(),finish()}),animit(leavePageDecomposition.other).queue({css:{transform:"translate3d(0, 0, 0)",opacity:1},duration:0}).queue({css:{transform:"translate3d(0, 0, 0)",opacity:0},duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)"}),animit(leavePageDecomposition.toolbar).queue({css:{background:"none",backgroundColor:"rgba(0, 0, 0, 0)",borderColor:"rgba(0, 0, 0, 0)"},duration:0}),animit(leavePageDecomposition.pageLabels).queue({css:{transform:"translate3d(0, 0, 0)",opacity:1},duration:0}).queue({css:{transform:"translate3d("+delta+"px, 0, 0)",opacity:0},duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)"}))):animit.runAll(maskClear,animit(enterPage.element[0]).queue({css:{transform:"translate3D(-25%, 0px, 0px)",opacity:.9},duration:0}).queue({css:{transform:"translate3D(0px, 0px, 0px)",opacity:1},duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)"}).resetStyle(),animit(leavePage.element[0]).queue({css:{transform:"translate3D(0px, 0px, 0px)"},duration:0}).queue({css:{transform:"translate3D(100%, 0px, 0px)"},duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)"}).queue(function(finish){done(),finish()}))}});return IOSSlideTransitionAnimator}])}(),function(){"use strict";var module=angular.module("onsen");module.factory("LazyRepeatView",["$onsen","$document","$compile",function($onsen,$document,$compile){var LazyRepeatView=Class.extend({init:function(scope,element,attrs,linker){if(this._element=element,this._scope=scope,this._attrs=attrs,this._linker=linker,this._parentElement=element.parent(),this._pageContent=this._findPageContent(),!this._pageContent)throw new Error("ons-lazy-repeat must be a descendant of an <ons-page> or an <ons-scroller> element.");this._itemHeightSum=[],this._maxIndex=0,this._delegate=this._getDelegate(),this._renderedElements={},this._addEventListeners(),this._scope.$watch(this._countItems.bind(this),this._onChange.bind(this)),this._scope.$on("$destroy",this._destroy.bind(this)),this._onChange()},_getDelegate:function(){var delegate=this._scope.$eval(this._attrs.onsLazyRepeat);return"undefined"==typeof delegate&&(delegate=eval(this._attrs.onsLazyRepeat)),delegate},_countItems:function(){return this._delegate.countItems()},_getItemHeight:function(i){return this._delegate.calculateItemHeight(i)},_getTopOffset:function(){return this._parentElement[0].getBoundingClientRect().top},_render:function(){var items=this._getItemsInView(),keep={};this._parentElement.css("height",this._itemHeightSum[this._maxIndex]+"px");for(var i=0,l=items.length;l>i;i++){var _item=items[i];this._renderElement(_item),keep[_item.index]=!0}for(var key in this._renderedElements)this._renderedElements.hasOwnProperty(key)&&!keep.hasOwnProperty(key)&&this._removeElement(key)},_isRendered:function(i){return this._renderedElements.hasOwnProperty(i)},_renderElement:function(item){if(this._isRendered(item.index)){var currentItem=this._renderedElements[item.index];this._delegate.configureItemScope&&this._delegate.configureItemScope(item.index,currentItem.scope);var element=this._renderedElements[item.index].element;return element[0].style.top=item.top+"px",void 0}var childScope=this._scope.$new();this._addSpecialProperties(item.index,childScope),this._linker(childScope,function(clone){this._delegate.configureItemScope?this._delegate.configureItemScope(item.index,childScope):this._delegate.createItemContent&&(clone.append(this._delegate.createItemContent(item.index)),$compile(clone[0].firstChild)(childScope)),this._parentElement.append(clone),clone.css({position:"absolute",top:item.top+"px",left:"0px",right:"0px",display:"none"});var element={element:clone,scope:childScope};this._scope.$evalAsync(function(){clone.css("display","block")}),this._renderedElements[item.index]=element}.bind(this))},_removeElement:function(i){if(this._isRendered(i)){var element=this._renderedElements[i];this._delegate.destroyItemScope?this._delegate.destroyItemScope(i,element.scope):this._delegate.destroyItemContent&&this._delegate.destroyItemContent(i,element.element.children()[0]),element.element.remove(),element.scope.$destroy(),element.element=element.scope=null,delete this._renderedElements[i]}},_removeAllElements:function(){for(var key in this._renderedElements)this._removeElement.hasOwnProperty(key)&&this._removeElement(key)},_calculateStartIndex:function(current){for(var start=0,end=this._maxIndex;;){var middle=Math.floor((start+end)/2),value=current+this._itemHeightSum[middle];if(start>end)return 0;if(value>=0&&value-this._getItemHeight(middle)<0)return middle;isNaN(value)||value>=0?end=middle-1:start=middle+1}},_recalculateItemHeightSum:function(){for(var sums=this._itemHeightSum,i=0,sum=0;i<Math.min(sums.length,this._countItems());i++)sum+=this._getItemHeight(i),sums[i]=sum},_getItemsInView:function(){var topOffset=this._getTopOffset(),topPosition=topOffset,cnt=this._countItems();cnt!==this._itemCount&&(this._recalculateItemHeightSum(),this._maxIndex=cnt-1),this._itemCount=cnt;var startIndex=this._calculateStartIndex(topPosition);startIndex=Math.max(startIndex-30,0),startIndex>0&&(topPosition+=this._itemHeightSum[startIndex-1]);for(var items=[],i=startIndex;cnt>i&&topPosition<4*window.innerHeight;i++){var h=this._getItemHeight(i);i>=this._itemHeightSum.length&&(this._itemHeightSum=this._itemHeightSum.concat(new Array(100))),this._itemHeightSum[i]=i>0?this._itemHeightSum[i-1]+h:h,this._maxIndex=Math.max(i,this._maxIndex),items.push({index:i,top:topPosition-topOffset}),topPosition+=h}return items},_addSpecialProperties:function(i,scope){scope.$index=i,scope.$first=0===i,scope.$last=i===this._countItems()-1,scope.$middle=!scope.$first&&!scope.$last,scope.$even=i%2===0,scope.$odd=!scope.$even},_onChange:function(){this._render()},_findPageContent:function(){for(var e=this._element[0];e.parentNode;)if(e=e.parentNode,e.className){var classNames=e.className.split(/\s+/);if(classNames.indexOf("page__content")>=0||classNames.indexOf("ons-scroller__content")>=0)return e}return null},_debounce:function(func,wait,immediate){var timeout;return function(){var context=this,args=arguments,later=function(){timeout=null,immediate||func.apply(context,args)},callNow=immediate&&!timeout;clearTimeout(timeout),timeout=setTimeout(later,wait),callNow&&func.apply(context,args)}},_doubleFireOnTouchend:function(){this._render(),this._debounce(this._render.bind(this),100)},_addEventListeners:function(){this._boundOnChange=ons.platform.isIOS()?this._debounce(this._onChange.bind(this),30):this._onChange.bind(this),this._pageContent.addEventListener("scroll",this._boundOnChange,!0),ons.platform.isIOS()&&(this._pageContent.addEventListener("touchmove",this._boundOnChange,!0),this._pageContent.addEventListener("touchend",this._doubleFireOnTouchend,!0)),$document[0].addEventListener("resize",this._boundOnChange,!0)},_removeEventListeners:function(){this._pageContent.removeEventListener("scroll",this._boundOnChange,!0),ons.platform.isIOS()&&(this._pageContent.removeEventListener("touchmove",this._boundOnChange,!0),this._pageContent.removeEventListener("touchend",this._doubleFireOnTouchend,!0)),$document[0].removeEventListener("resize",this._boundOnChange,!0)},_destroy:function(){this._removeEventListeners(),this._removeAllElements(),this._parentElement=this._renderedElements=this._element=this._scope=this._attrs=null}});return LazyRepeatView}])}(),function(){"use strict;";var module=angular.module("onsen");module.factory("LiftTransitionAnimator",["NavigatorTransitionAnimator",function(NavigatorTransitionAnimator){var LiftTransitionAnimator=NavigatorTransitionAnimator.extend({backgroundMask:angular.element('<div style="position: absolute; width: 100%;height: 100%; background-color: black;"></div>'),push:function(enterPage,leavePage,callback){var mask=this.backgroundMask.remove();leavePage.element[0].parentNode.insertBefore(mask[0],leavePage.element[0]);var maskClear=animit(mask[0]).wait(.6).queue(function(done){mask.remove(),done()});animit.runAll(maskClear,animit(enterPage.element[0]).queue({css:{transform:"translate3D(0, 100%, 0)"},duration:0}).queue({css:{transform:"translate3D(0, 0, 0)"},duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)"}).wait(.2).resetStyle().queue(function(done){callback(),done()
}),animit(leavePage.element[0]).queue({css:{transform:"translate3D(0, 0, 0)",opacity:1},duration:0}).queue({css:{transform:"translate3D(0, -10%, 0)",opacity:.9},duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)"}))},pop:function(enterPage,leavePage,callback){var mask=this.backgroundMask.remove();enterPage.element[0].parentNode.insertBefore(mask[0],enterPage.element[0]),animit.runAll(animit(mask[0]).wait(.4).queue(function(done){mask.remove(),done()}),animit(enterPage.element[0]).queue({css:{transform:"translate3D(0, -10%, 0)",opacity:.9},duration:0}).queue({css:{transform:"translate3D(0, 0, 0)",opacity:1},duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)"}).resetStyle().wait(.4).queue(function(done){callback(),done()}),animit(leavePage.element[0]).queue({css:{transform:"translate3D(0, 0, 0)"},duration:0}).queue({css:{transform:"translate3D(0, 100%, 0)"},duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)"}))}});return LiftTransitionAnimator}])}(),function(){"use strict;";var module=angular.module("onsen");module.factory("ModalView",["$onsen","$rootScope",function($onsen,$rootScope){var ModalView=Class.extend({_element:void 0,_scope:void 0,init:function(scope,element){this._scope=scope,this._element=element;var pageView=$rootScope.ons.findParentComponentUntil("ons-page",this._element);pageView&&(this._pageContent=angular.element(pageView._element[0].querySelector(".page__content"))),this._scope.$on("$destroy",this._destroy.bind(this)),this._deviceBackButtonHandler=$onsen.DeviceBackButtonHandler.create(this._element,this._onDeviceBackButton.bind(this)),this.hide()},getDeviceBackButtonHandler:function(){return this._deviceBackButtonHandler},show:function(){this._element.css("display","table")},_isVisible:function(){return this._element[0].clientWidth>0},_onDeviceBackButton:function(){},hide:function(){this._element.css("display","none")},toggle:function(){return this._isVisible()?this.hide.apply(this,arguments):this.show.apply(this,arguments)},_destroy:function(){this.emit("destroy",{page:this}),this._deviceBackButtonHandler.destroy(),this._element=this._scope=null}});return MicroEvent.mixin(ModalView),ModalView}])}(),function(){"use strict;";var module=angular.module("onsen"),NavigatorPageObject=Class.extend({init:function(params){this.page=params.page,this.name=params.page,this.element=params.element,this.pageScope=params.pageScope,this.options=params.options,this.navigator=params.navigator,this._blockEvents=function(event){(this.navigator._isPopping||this.navigator._isPushing)&&(event.preventDefault(),event.stopPropagation())}.bind(this),this.element.on(this._pointerEvents,this._blockEvents)},_pointerEvents:"touchmove",getPageView:function(){if(!this._pageView&&(this._pageView=this.element.inheritedData("ons-page"),!this._pageView))throw new Error("Fail to fetch PageView from ons-page element.");return this._pageView},destroy:function(){this.pageScope.$destroy(),this.element.off(this._pointerEvents,this._blockEvents),this.element.remove(),this.element=null,this._pageView=null,this.pageScope=null,this.options=null;var index=this.navigator.pages.indexOf(this);-1!==index&&this.navigator.pages.splice(index,1),this.navigator=null}});module.factory("NavigatorView",["$http","$parse","$templateCache","$compile","$onsen","$timeout","SimpleSlideTransitionAnimator","NavigatorTransitionAnimator","LiftTransitionAnimator","NullTransitionAnimator","IOSSlideTransitionAnimator","FadeTransitionAnimator",function($http,$parse,$templateCache,$compile,$onsen,$timeout,SimpleSlideTransitionAnimator,NavigatorTransitionAnimator,LiftTransitionAnimator,NullTransitionAnimator,IOSSlideTransitionAnimator,FadeTransitionAnimator){var NavigatorView=Class.extend({_element:void 0,_attrs:void 0,pages:void 0,_scope:void 0,_doorLock:void 0,_profiling:!1,init:function(scope,element,attrs){this._element=element||angular.element(window.document.body),this._scope=scope||this._element.scope(),this._attrs=attrs,this._doorLock=new DoorLock,this.pages=[],this._isPopping=this._isPushing=!1,this._deviceBackButtonHandler=$onsen.DeviceBackButtonHandler.create(this._element,this._onDeviceBackButton.bind(this)),this._scope.$on("$destroy",this._destroy.bind(this))},_destroy:function(){this.emit("destroy"),this.pages.forEach(function(page){page.destroy()}),this._deviceBackButtonHandler.destroy(),this._deviceBackButtonHandler=null,this._element=this._scope=this._attrs=null},_onDeviceBackButton:function(event){this.pages.length>1?this._scope.$evalAsync(this.popPage.bind(this)):event.callParentHandler()},_normalizePageElement:function(element){for(var i=0;i<element.length;i++)if(1===element[i].nodeType)return angular.element(element[i]);throw new Error("invalid state")},_createPageElementAndLinkFunction:function(templateHTML,pageScope){function safeApply(scope){var phase=scope.$root.$$phase;"$apply"!==phase&&"$digest"!==phase&&scope.$apply()}var div=document.createElement("div");div.innerHTML=templateHTML.trim();var pageElement=angular.element(div),hasPage=1===div.childElementCount&&"ons-page"===div.childNodes[0].nodeName.toLowerCase();if(!hasPage)throw new Error('You can not supply no "ons-page" element to "ons-navigator".');pageElement=angular.element(div.childNodes[0]);var link=$compile(pageElement);return{element:pageElement,link:function(){link(pageScope),safeApply(pageScope)}}},insertPage:function(index,page,options){if(options=options||{},options&&"object"!=typeof options)throw new Error("options must be an object. You supplied "+options);if(index===this.pages.length)return this.pushPage.apply(this,[].slice.call(arguments,1));this._doorLock.waitUnlock(function(){var unlock=this._doorLock.lock();$onsen.getPageHTMLAsync(page).then(function(templateHTML){var pageScope=this._createPageScope(),object=this._createPageElementAndLinkFunction(templateHTML,pageScope),element=object.element,link=object.link;element=this._normalizePageElement(element);var pageObject=this._createPageObject(page,element,pageScope,options);this.pages.length>0?(index=normalizeIndex(index),this._element[0].insertBefore(element[0],this.pages[index]?this.pages[index].element[0]:null),this.pages.splice(index,0,pageObject),link(),setTimeout(function(){this.getCurrentPage()!==pageObject&&element.css("display","none"),unlock(),element=null}.bind(this),1e3/60)):(this._element.append(element),this.pages.push(pageObject),link(),unlock(),element=null)}.bind(this),function(){throw unlock(),new Error("Page is not found: "+page)})}.bind(this));var normalizeIndex=function(index){return 0>index&&(index=this.pages.length+index),index}.bind(this)},pushPage:function(page,options){if(this._profiling&&console.time("pushPage"),options=options||{},!options.cancelIfRunning||!this._isPushing){if(options&&"object"!=typeof options)throw new Error("options must be an object. You supplied "+options);this._emitPrePushEvent()||this._doorLock.waitUnlock(function(){this._pushPage(page,options)}.bind(this))}},_pushPage:function(page,options){var unlock=this._doorLock.lock(),done=function(){unlock(),this._profiling&&console.timeEnd("pushPage")};$onsen.getPageHTMLAsync(page).then(function(templateHTML){var pageScope=this._createPageScope(),object=this._createPageElementAndLinkFunction(templateHTML,pageScope);setImmediate(function(){this._pushPageDOM(page,object.element,object.link,pageScope,options,done),object=null}.bind(this))}.bind(this),function(){throw done(),new Error("Page is not found: "+page)}.bind(this))},getDeviceBackButtonHandler:function(){return this._deviceBackButtonHandler},_getAnimatorOption:function(options,defaultAnimator){var animator=null;if(options.animation instanceof NavigatorTransitionAnimator)return options.animation;if("string"==typeof options.animation&&(animator=NavigatorView._transitionAnimatorDict[options.animation]),!animator&&this._element.attr("animation")&&(animator=NavigatorView._transitionAnimatorDict[this._element.attr("animation")]),animator||(animator=defaultAnimator||NavigatorView._transitionAnimatorDict["default"]),!(animator instanceof NavigatorTransitionAnimator))throw new Error('"animator" is not an instance of NavigatorTransitionAnimator.');return animator},_createPageScope:function(){return this._scope.$new()},_createPageObject:function(page,element,pageScope,options){return options.animator=this._getAnimatorOption(options),new NavigatorPageObject({page:page,element:element,pageScope:pageScope,options:options,navigator:this})},_pushPageDOM:function(page,element,link,pageScope,options,unlock){this._profiling&&console.time("pushPageDOM"),unlock=unlock||function(){},options=options||{},element=this._normalizePageElement(element);var pageObject=this._createPageObject(page,element,pageScope,options),event={enterPage:pageObject,leavePage:this.pages[this.pages.length-1],navigator:this};this.pages.push(pageObject);var done=function(){this.pages[this.pages.length-2]&&this.pages[this.pages.length-2].element.css("display","none"),this._profiling&&console.timeEnd("pushPageDOM"),this._isPushing=!1,unlock(),this.emit("postpush",event),"function"==typeof options.onTransitionEnd&&options.onTransitionEnd(),element=null}.bind(this);if(this._isPushing=!0,this.pages.length>1){var leavePage=this.pages.slice(-2)[0],enterPage=this.pages.slice(-1)[0];this._element.append(element),link(),options.animator.push(enterPage,leavePage,done),element=null}else this._element.append(element),link(),done(),element=null},_emitPrePushEvent:function(){var isCanceled=!1,prePushEvent={navigator:this,currentPage:this.getCurrentPage(),cancel:function(){isCanceled=!0}};return this.emit("prepush",prePushEvent),isCanceled},_emitPrePopEvent:function(){var isCanceled=!1,leavePage=this.getCurrentPage(),prePopEvent={navigator:this,currentPage:leavePage,leavePage:leavePage,enterPage:this.pages[this.pages.length-2],cancel:function(){isCanceled=!0}};return this.emit("prepop",prePopEvent),isCanceled},popPage:function(options){options=options||{},options.cancelIfRunning&&this._isPopping||this._doorLock.waitUnlock(function(){if(this.pages.length<=1)throw new Error("NavigatorView's page stack is empty.");this._emitPrePopEvent()||this._popPage(options)}.bind(this))},_popPage:function(options){var unlock=this._doorLock.lock(),leavePage=this.pages.pop();this.pages[this.pages.length-1]&&this.pages[this.pages.length-1].element.css("display","block");var enterPage=this.pages[this.pages.length-1],event={leavePage:leavePage,enterPage:this.pages[this.pages.length-1],navigator:this},callback=function(){leavePage.destroy(),this._isPopping=!1,unlock(),this.emit("postpop",event),event.leavePage=null,"function"==typeof options.onTransitionEnd&&options.onTransitionEnd()}.bind(this);this._isPopping=!0;var animator=this._getAnimatorOption(options,leavePage.options.animator);animator.pop(enterPage,leavePage,callback)},replacePage:function(page,options){options=options||{};var onTransitionEnd=options.onTransitionEnd||function(){};options.onTransitionEnd=function(){this.pages.length>1&&this.pages[this.pages.length-2].destroy(),onTransitionEnd()}.bind(this),this.pushPage(page,options)},resetToPage:function(page,options){options=options||{},options.animator||options.animation||(options.animation="none");var onTransitionEnd=options.onTransitionEnd||function(){},self=this;options.onTransitionEnd=function(){for(;self.pages.length>1;)self.pages.shift().destroy();self._scope.$digest(),onTransitionEnd()},this.pushPage(page,options)},getCurrentPage:function(){return this.pages[this.pages.length-1]},getPages:function(){return this.pages},canPopPage:function(){return this.pages.length>1}});return NavigatorView._transitionAnimatorDict={"default":$onsen.isAndroid()?new SimpleSlideTransitionAnimator:new IOSSlideTransitionAnimator,slide:$onsen.isAndroid()?new SimpleSlideTransitionAnimator:new IOSSlideTransitionAnimator,simpleslide:new SimpleSlideTransitionAnimator,lift:new LiftTransitionAnimator,fade:new FadeTransitionAnimator,none:new NullTransitionAnimator},NavigatorView.registerTransitionAnimator=function(name,animator){if(!(animator instanceof NavigatorTransitionAnimator))throw new Error('"animator" param must be an instance of NavigatorTransitionAnimator');this._transitionAnimatorDict[name]=animator},MicroEvent.mixin(NavigatorView),NavigatorView}])}(),function(){"use strict;";var module=angular.module("onsen");module.factory("NavigatorTransitionAnimator",function(){var NavigatorTransitionAnimator=Class.extend({push:function(enterPage,leavePage,callback){callback()},pop:function(enterPage,leavePage,callback){callback()}});return NavigatorTransitionAnimator})}(),function(){"use strict;";var module=angular.module("onsen");module.factory("NullTransitionAnimator",["NavigatorTransitionAnimator",function(NavigatorTransitionAnimator){var NullTransitionAnimator=NavigatorTransitionAnimator.extend({});return NullTransitionAnimator}])}(),function(){"use strict";var module=angular.module("onsen");module.factory("OverlaySlidingMenuAnimator",["SlidingMenuAnimator",function(SlidingMenuAnimator){var OverlaySlidingMenuAnimator=SlidingMenuAnimator.extend({_blackMask:void 0,_isRight:!1,_element:!1,_menuPage:!1,_mainPage:!1,_width:!1,_duration:!1,setup:function(element,mainPage,menuPage,options){options=options||{},this._width=options.width||"90%",this._isRight=!!options.isRight,this._element=element,this._mainPage=mainPage,this._menuPage=menuPage,this._duration=.4,menuPage.css("box-shadow","0px 0 10px 0px rgba(0, 0, 0, 0.2)"),menuPage.css({width:options.width,display:"none",zIndex:2}),menuPage.css("-webkit-transform","translate3d(0px, 0px, 0px)"),mainPage.css({zIndex:1}),this._isRight?menuPage.css({right:"-"+options.width,left:"auto"}):menuPage.css({right:"auto",left:"-"+options.width}),this._blackMask=angular.element("<div></div>").css({backgroundColor:"black",top:"0px",left:"0px",right:"0px",bottom:"0px",position:"absolute",display:"none",zIndex:0}),element.prepend(this._blackMask)},onResized:function(options){if(this._menuPage.css("width",options.width),this._isRight?this._menuPage.css({right:"-"+options.width,left:"auto"}):this._menuPage.css({right:"auto",left:"-"+options.width}),options.isOpened){var max=this._menuPage[0].clientWidth,menuStyle=this._generateMenuPageStyle(max);animit(this._menuPage[0]).queue(menuStyle).play()}},destroy:function(){this._blackMask&&(this._blackMask.remove(),this._blackMask=null),this._mainPage.removeAttr("style"),this._menuPage.removeAttr("style"),this._element=this._mainPage=this._menuPage=null},openMenu:function(callback,instant){var duration=instant===!0?0:this._duration;this._menuPage.css("display","block"),this._blackMask.css("display","block");var max=this._menuPage[0].clientWidth,menuStyle=this._generateMenuPageStyle(max),mainPageStyle=this._generateMainPageStyle(max);setTimeout(function(){animit(this._mainPage[0]).queue(mainPageStyle,{duration:duration,timing:"cubic-bezier(.1, .7, .1, 1)"}).queue(function(done){callback(),done()}).play(),animit(this._menuPage[0]).queue(menuStyle,{duration:duration,timing:"cubic-bezier(.1, .7, .1, 1)"}).play()}.bind(this),1e3/60)},closeMenu:function(callback,instant){var duration=instant===!0?0:this._duration;this._blackMask.css({display:"block"});var menuPageStyle=this._generateMenuPageStyle(0),mainPageStyle=this._generateMainPageStyle(0);setTimeout(function(){animit(this._mainPage[0]).queue(mainPageStyle,{duration:duration,timing:"cubic-bezier(.1, .7, .1, 1)"}).queue(function(done){this._menuPage.css("display","none"),callback(),done()}.bind(this)).play(),animit(this._menuPage[0]).queue(menuPageStyle,{duration:duration,timing:"cubic-bezier(.1, .7, .1, 1)"}).play()}.bind(this),1e3/60)},translateMenu:function(options){this._menuPage.css("display","block"),this._blackMask.css({display:"block"});var menuPageStyle=this._generateMenuPageStyle(Math.min(options.maxDistance,options.distance)),mainPageStyle=this._generateMainPageStyle(Math.min(options.maxDistance,options.distance));delete mainPageStyle.opacity,animit(this._menuPage[0]).queue(menuPageStyle).play(),Object.keys(mainPageStyle).length>0&&animit(this._mainPage[0]).queue(mainPageStyle).play()},_generateMenuPageStyle:function(distance){var x=(this._menuPage[0].clientWidth,this._isRight?-distance:distance),transform="translate3d("+x+"px, 0, 0)";return{transform:transform,"box-shadow":0===distance?"none":"0px 0 10px 0px rgba(0, 0, 0, 0.2)"}},_generateMainPageStyle:function(distance){var max=this._menuPage[0].clientWidth,opacity=1-.1*distance/max;return{opacity:opacity}},copy:function(){return new OverlaySlidingMenuAnimator}});return OverlaySlidingMenuAnimator}])}(),function(){"use strict;";var module=angular.module("onsen");module.factory("PageView",["$onsen","$parse",function($onsen,$parse){var PageView=Class.extend({_registeredToolbarElement:!1,_registeredBottomToolbarElement:!1,_nullElement:window.document.createElement("div"),_toolbarElement:null,_bottomToolbarElement:null,init:function(scope,element,attrs){this._scope=scope,this._element=element,this._attrs=attrs,this._registeredToolbarElement=!1,this._registeredBottomToolbarElement=!1,this._nullElement=window.document.createElement("div"),this._toolbarElement=angular.element(this._nullElement),this._bottomToolbarElement=angular.element(this._nullElement),this._clearListener=scope.$on("$destroy",this._destroy.bind(this)),this._userDeviceBackButtonListener=angular.noop,(this._attrs.ngDeviceBackbutton||this._attrs.onDeviceBackbutton)&&(this._deviceBackButtonHandler=$onsen.DeviceBackButtonHandler.create(this._element,this._onDeviceBackButton.bind(this)))},_onDeviceBackButton:function($event){if(this._userDeviceBackButtonListener($event),this._attrs.ngDeviceBackbutton&&$parse(this._attrs.ngDeviceBackbutton)(this._scope,{$event:$event}),this._attrs.onDeviceBackbutton){var lastEvent=window.$event;window.$event=$event,new Function(this._attrs.onDeviceBackbutton)(),window.$event=lastEvent}},setDeviceBackButtonHandler:function(callback){this._deviceBackButtonHandler||(this._deviceBackButtonHandler=$onsen.DeviceBackButtonHandler.create(this._element,this._onDeviceBackButton.bind(this))),this._userDeviceBackButtonListener=callback},getDeviceBackButtonHandler:function(){return this._deviceBackButtonHandler||null},registerToolbar:function(element){if(this._registeredToolbarElement)throw new Error("This page's toolbar is already registered.");angular.element(this.getContentElement()).attr("no-status-bar-fill",""),element.remove();var statusFill=this._element[0].querySelector(".page__status-bar-fill");statusFill?angular.element(statusFill).after(element):this._element.prepend(element),this._toolbarElement=element,this._registeredToolbarElement=!0},registerBottomToolbar:function(element){if(this._registeredBottomToolbarElement)throw new Error("This page's bottom-toolbar is already registered.");element.remove(),this._bottomToolbarElement=element,this._registeredBottomToolbarElement=!0;var fill=angular.element(document.createElement("div"));fill.addClass("page__bottom-bar-fill"),fill.css({width:"0px",height:"0px"}),this._element.prepend(fill),this._element.append(element)},registerExtraElement:function(element){this._extraElement||(this._extraElement=angular.element("<div></div>"),this._extraElement.addClass("page__extra"),this._extraElement.css({"z-index":"10001"}),this._element.append(this._extraElement)),this._extraElement.append(element.remove())},hasToolbarElement:function(){return!!this._registeredToolbarElement},hasBottomToolbarElement:function(){return!!this._registeredBottomToolbarElement},getContentElement:function(){for(var i=0;i<this._element.length;i++)if(this._element[i].querySelector){var content=this._element[i].querySelector(".page__content");if(content)return content}throw Error('fail to get ".page__content" element.')},getBackgroundElement:function(){for(var i=0;i<this._element.length;i++)if(this._element[i].querySelector){var content=this._element[i].querySelector(".page__background");if(content)return content}throw Error('fail to get ".page__background" element.')},getToolbarElement:function(){return this._toolbarElement[0]||this._nullElement},getBottomToolbarElement:function(){return this._bottomToolbarElement[0]||this._nullElement},getToolbarLeftItemsElement:function(){return this._toolbarElement[0].querySelector(".left")||this._nullElement},getToolbarCenterItemsElement:function(){return this._toolbarElement[0].querySelector(".center")||this._nullElement},getToolbarRightItemsElement:function(){return this._toolbarElement[0].querySelector(".right")||this._nullElement},getToolbarBackButtonLabelElement:function(){return this._toolbarElement[0].querySelector("ons-back-button .back-button__label")||this._nullElement},_destroy:function(){this.emit("destroy",{page:this}),this._deviceBackButtonHandler&&(this._deviceBackButtonHandler.destroy(),this._deviceBackButtonHandler=null),this._element=null,this._toolbarElement=null,this._nullElement=null,this._bottomToolbarElement=null,this._extraElement=null,this._scope=null,this._clearListener()}});return MicroEvent.mixin(PageView),PageView}])}(),function(){"use strict";var module=angular.module("onsen");module.factory("PopoverView",["$onsen","PopoverAnimator","FadePopoverAnimator",function($onsen,PopoverAnimator,FadePopoverAnimator){var PopoverView=Class.extend({init:function(scope,element,attrs){if(this._element=element,this._scope=scope,this._attrs=attrs,this._mask=angular.element(this._element[0].querySelector(".popover-mask")),this._popover=angular.element(this._element[0].querySelector(".popover")),this._mask.css("z-index",2e4),this._popover.css("z-index",20001),this._element.css("display","none"),attrs.maskColor&&this._mask.css("background-color",attrs.maskColor),this._mask.on("click",this._cancel.bind(this)),this._visible=!1,this._doorLock=new DoorLock,this._animation=PopoverView._animatorDict["undefined"!=typeof attrs.animation?attrs.animation:"fade"],!this._animation)throw new Error("No such animation: "+attrs.animation);this._deviceBackButtonHandler=$onsen.DeviceBackButtonHandler.create(this._element,this._onDeviceBackButton.bind(this)),this._onChange=function(){setImmediate(function(){this._currentTarget&&this._positionPopover(this._currentTarget)}.bind(this))}.bind(this),this._popover[0].addEventListener("DOMNodeInserted",this._onChange,!1),this._popover[0].addEventListener("DOMNodeRemoved",this._onChange,!1),window.addEventListener("resize",this._onChange,!1),this._scope.$on("$destroy",this._destroy.bind(this))},_onDeviceBackButton:function(event){this.isCancelable()?this._cancel.bind(this)():event.callParentHandler()},_setDirection:function(direction){if("up"===direction)this._scope.direction=direction,this._scope.arrowPosition="bottom";else if("left"===direction)this._scope.direction=direction,this._scope.arrowPosition="right";else if("down"===direction)this._scope.direction=direction,this._scope.arrowPosition="top";else{if("right"!=direction)throw new Error("Invalid direction.");this._scope.direction=direction,this._scope.arrowPosition="left"}this._scope.$$phase||this._scope.$apply()},_positionPopoverByDirection:function(target,direction){var el=angular.element(this._element[0].querySelector(".popover")),pos=target.getBoundingClientRect(),own=el[0].getBoundingClientRect(),arrow=angular.element(el.children()[1]),offset=14,margin=6,radius=parseInt(window.getComputedStyle(el[0].querySelector(".popover__content")).borderRadius);arrow.css({top:"",left:""});var diff=function(x){return x/2*Math.sqrt(2)-x/2}(parseInt(window.getComputedStyle(arrow[0]).width)),limit=margin+radius+diff;this._setDirection(direction),["left","right"].indexOf(direction)>-1?("left"==direction?el.css("left",pos.right-pos.width-own.width-offset+"px"):el.css("left",pos.right+offset+"px"),el.css("top",pos.bottom-pos.height/2-own.height/2+"px")):("up"==direction?el.css("top",pos.bottom-pos.height-own.height-offset+"px"):el.css("top",pos.bottom+offset+"px"),el.css("left",pos.right-pos.width/2-own.width/2+"px")),own=el[0].getBoundingClientRect(),["left","right"].indexOf(direction)>-1?own.top<margin?(arrow.css("top",Math.max(own.height/2+own.top-margin,limit)+"px"),el.css("top",margin+"px")):own.bottom>window.innerHeight-margin&&(arrow.css("top",Math.min(own.height/2-(window.innerHeight-own.bottom)+margin,own.height-limit)+"px"),el.css("top",window.innerHeight-own.height-margin+"px")):own.left<margin?(arrow.css("left",Math.max(own.width/2+own.left-margin,limit)+"px"),el.css("left",margin+"px")):own.right>window.innerWidth-margin&&(arrow.css("left",Math.min(own.width/2-(window.innerWidth-own.right)+margin,own.width-limit)+"px"),el.css("left",window.innerWidth-own.width-margin+"px"))},_positionPopover:function(target){var directions;directions=this._element.attr("direction")?this._element.attr("direction").split(/\s+/):["up","down","left","right"];for(var position=target.getBoundingClientRect(),scores={left:position.left,right:window.innerWidth-position.right,up:position.top,down:window.innerHeight-position.bottom},orderedDirections=Object.keys(scores).sort(function(a,b){return-(scores[a]-scores[b])}),i=0,l=orderedDirections.length;l>i;i++){var direction=orderedDirections[i];if(directions.indexOf(direction)>-1)return this._positionPopoverByDirection(target,direction),void 0}},show:function(target,options){if("string"==typeof target?target=document.querySelector(target):target instanceof Event&&(target=target.target),!target)throw new Error("Target undefined");options=options||{};var cancel=!1;this.emit("preshow",{popover:this,cancel:function(){cancel=!0}}),cancel||this._doorLock.waitUnlock(function(){var unlock=this._doorLock.lock(),animation=this._animation;this._element.css("display","block"),this._currentTarget=target,this._positionPopover(target),options.animation&&(animation=PopoverView._animatorDict[options.animation]),animation.show(this,function(){this._visible=!0,this._positionPopover(target),unlock(),this.emit("postshow",{popover:this})}.bind(this))}.bind(this))},hide:function(options){options=options||{};var cancel=!1;this.emit("prehide",{popover:this,cancel:function(){cancel=!0}}),cancel||this._doorLock.waitUnlock(function(){var unlock=this._doorLock.lock(),animation=this._animation;options.animation&&(animation=PopoverView._animatorDict[options.animation]),animation.hide(this,function(){this._element.css("display","none"),this._visible=!1,unlock(),this.emit("posthide",{popover:this})}.bind(this))}.bind(this))},isShown:function(){return this._visible},destroy:function(){this._parentScope?(this._parentScope.$destroy(),this._parentScope=null):this._scope.$destroy()},_destroy:function(){this.emit("destroy"),this._deviceBackButtonHandler.destroy(),this._popover[0].removeEventListener("DOMNodeInserted",this._onChange,!1),this._popover[0].removeEventListener("DOMNodeRemoved",this._onChange,!1),window.removeEventListener("resize",this._onChange,!1),this._mask.off(),this._mask.remove(),this._popover.remove(),this._element.remove(),this._onChange=this._deviceBackButtonHandler=this._mask=this._popover=this._element=this._scope=null},setCancelable:function(cancelable){if("boolean"!=typeof cancelable)throw new Error("Argument must be a boolean.");cancelable?this._element.attr("cancelable",!0):this._element.removeAttr("cancelable")},isCancelable:function(){return this._element[0].hasAttribute("cancelable")},_cancel:function(){this.isCancelable()&&this.hide()}});return PopoverView._animatorDict={fade:new FadePopoverAnimator,none:new PopoverAnimator},PopoverView.registerAnimator=function(name,animator){if(!(animator instanceof PopoverAnimator))throw new Error('"animator" param must be an instance of PopoverAnimator');this._animatorDict[name]=animator},MicroEvent.mixin(PopoverView),PopoverView}])}(),function(){"use strict";var module=angular.module("onsen");module.factory("PopoverAnimator",function(){var PopoverAnimator=Class.extend({show:function(popover,callback){callback()},hide:function(popover,callback){callback()}});return PopoverAnimator})}(),function(){"use strict";var module=angular.module("onsen");module.factory("PullHookView",["$onsen","$parse",function($onsen,$parse){var PullHookView=Class.extend({STATE_INITIAL:"initial",STATE_PREACTION:"preaction",STATE_ACTION:"action",init:function(scope,element,attrs){if(this._element=element,this._scope=scope,this._attrs=attrs,this._scrollElement=this._createScrollElement(),this._pageElement=this._scrollElement.parent(),!this._pageElement.hasClass("page__content")&&!this._pageElement.hasClass("ons-scroller__content"))throw new Error("<ons-pull-hook> must be a direct descendant of an <ons-page> or an <ons-scroller> element.");this._currentTranslation=0,this._createEventListeners(),this._setState(this.STATE_INITIAL,!0),this._setStyle(),this._scope.$on("$destroy",this._destroy.bind(this))},_createScrollElement:function(){var scrollElement=angular.element("<div>").addClass("scroll"),pageElement=this._element.parent(),children=pageElement.children();return pageElement.append(scrollElement),scrollElement.append(children),scrollElement},_setStyle:function(){var h=this._getHeight();this._element.css({top:"-"+h+"px",height:h+"px",lineHeight:h+"px"})},_onScroll:function(){var el=this._pageElement[0];el.scrollTop<0&&(el.scrollTop=0)},_generateTranslationTransform:function(scroll){return"translate3d(0px, "+scroll+"px, 0px)"},_onDrag:function(event){if(!this.isDisabled()&&"left"!==event.gesture.direction&&"right"!==event.gesture.direction){if($onsen.isAndroid()){var el=this._pageElement[0];el.scrollTop=this._startScroll-event.gesture.deltaY,el.scrollTop<window.innerHeight&&"up"!==event.gesture.direction&&event.gesture.preventDefault()}if(0===this._currentTranslation&&0===this._getCurrentScroll()){this._transitionDragLength=event.gesture.deltaY;var direction=event.gesture.interimDirection;"down"===direction?this._transitionDragLength-=1:this._transitionDragLength+=1}var scroll=event.gesture.deltaY-this._startScroll;scroll=Math.max(scroll,0),this._thresholdHeightEnabled()&&scroll>=this._getThresholdHeight()?(event.gesture.stopDetect(),setImmediate(function(){this._setState(this.STATE_ACTION),this._translateTo(this._getHeight(),{animate:!0}),this._waitForAction(this._onDone.bind(this))}.bind(this))):scroll>=this._getHeight()?this._setState(this.STATE_PREACTION):this._setState(this.STATE_INITIAL),event.stopPropagation(),this._translateTo(scroll)}},_onDragStart:function(){this.isDisabled()||(this._startScroll=this._getCurrentScroll())},_onDragEnd:function(){if(!this.isDisabled()&&this._currentTranslation>0){var scroll=this._currentTranslation;scroll>this._getHeight()?(this._setState(this.STATE_ACTION),this._translateTo(this._getHeight(),{animate:!0}),this._waitForAction(this._onDone.bind(this))):this._translateTo(0,{animate:!0})}},_waitForAction:function(done){this._attrs.ngAction?this._scope.$eval(this._attrs.ngAction,{$done:done}):this._attrs.onAction?eval(this._attrs.onAction):done()},_onDone:function(){this._element&&(this._translateTo(0,{animate:!0}),this._setState(this.STATE_INITIAL))},_getHeight:function(){return parseInt(this._element[0].getAttribute("height")||"64",10)},setHeight:function(height){this._element[0].setAttribute("height",height+"px"),this._setStyle()},setThresholdHeight:function(thresholdHeight){this._element[0].setAttribute("threshold-height",thresholdHeight+"px")},_getThresholdHeight:function(){return parseInt(this._element[0].getAttribute("threshold-height")||"96",10)},_thresholdHeightEnabled:function(){var th=this._getThresholdHeight();return th>0&&th>=this._getHeight()},_setState:function(state,noEvent){var oldState=this._getState();this._scope.$evalAsync(function(){this._element[0].setAttribute("state",state),noEvent||oldState===this._getState()||this.emit("changestate",{state:state,pullHook:this})}.bind(this))},_getState:function(){return this._element[0].getAttribute("state")},getCurrentState:function(){return this._getState()},_getCurrentScroll:function(){return this._pageElement[0].scrollTop},isDisabled:function(){return this._element[0].hasAttribute("disabled")},setDisabled:function(disabled){disabled?this._element[0].setAttribute("disabled",""):this._element[0].removeAttribute("disabled")
},_translateTo:function(scroll,options){if(options=options||{},0!=this._currentTranslation||0!=scroll){var done=function(){0===scroll&&this._scrollElement[0].removeAttribute("style"),options.callback&&options.callback()}.bind(this);this._currentTranslation=scroll,options.animate?animit(this._scrollElement[0]).queue({transform:this._generateTranslationTransform(scroll)},{duration:.3,timing:"cubic-bezier(.1, .7, .1, 1)"}).play(done):animit(this._scrollElement[0]).queue({transform:this._generateTranslationTransform(scroll)}).play(done)}},_getMinimumScroll:function(){var scrollHeight=this._scrollElement[0].getBoundingClientRect().height,pageHeight=this._pageElement[0].getBoundingClientRect().height;return scrollHeight>pageHeight?-(scrollHeight-pageHeight):0},_createEventListeners:function(){var element=this._scrollElement.parent();this._hammer=new Hammer(element[0],{dragMinDistance:1,dragDistanceCorrection:!1}),this._bindedOnDrag=this._onDrag.bind(this),this._bindedOnDragStart=this._onDragStart.bind(this),this._bindedOnDragEnd=this._onDragEnd.bind(this),this._bindedOnScroll=this._onScroll.bind(this),this._hammer.on("drag",this._bindedOnDrag),this._hammer.on("dragstart",this._bindedOnDragStart),this._hammer.on("dragend",this._bindedOnDragEnd),element.on("scroll",this._bindedOnScroll)},_destroyEventListeners:function(){var element=this._scrollElement.parent();this._hammer.off("drag",this._bindedOnDrag),this._hammer.off("dragstart",this._bindedOnDragStart),this._hammer.off("dragend",this._bindedOnDragEnd),element.off("scroll",this._bindedOnScroll)},_destroy:function(){this.emit("destroy"),this._destroyEventListeners(),this._element=this._scope=this._attrs=null}});return MicroEvent.mixin(PullHookView),PullHookView}])}(),function(){"use strict";var module=angular.module("onsen");module.factory("PushSlidingMenuAnimator",["SlidingMenuAnimator",function(SlidingMenuAnimator){var PushSlidingMenuAnimator=SlidingMenuAnimator.extend({_isRight:!1,_element:void 0,_menuPage:void 0,_mainPage:void 0,_width:void 0,_duration:!1,setup:function(element,mainPage,menuPage,options){options=options||{},this._element=element,this._mainPage=mainPage,this._menuPage=menuPage,this._isRight=!!options.isRight,this._width=options.width||"90%",this._duration=.4,menuPage.css({width:options.width,display:"none"}),this._isRight?menuPage.css({right:"-"+options.width,left:"auto"}):menuPage.css({right:"auto",left:"-"+options.width})},onResized:function(options){if(this._menuPage.css("width",options.width),this._isRight?this._menuPage.css({right:"-"+options.width,left:"auto"}):this._menuPage.css({right:"auto",left:"-"+options.width}),options.isOpened){var max=this._menuPage[0].clientWidth,mainPageTransform=this._generateAbovePageTransform(max),menuPageStyle=this._generateBehindPageStyle(max);animit(this._mainPage[0]).queue({transform:mainPageTransform}).play(),animit(this._menuPage[0]).queue(menuPageStyle).play()}},destroy:function(){this._mainPage.removeAttr("style"),this._menuPage.removeAttr("style"),this._element=this._mainPage=this._menuPage=null},openMenu:function(callback,instant){var duration=instant===!0?0:this._duration;this._menuPage.css("display","block");var max=this._menuPage[0].clientWidth,aboveTransform=this._generateAbovePageTransform(max),behindStyle=this._generateBehindPageStyle(max);setTimeout(function(){animit(this._mainPage[0]).queue({transform:aboveTransform},{duration:duration,timing:"cubic-bezier(.1, .7, .1, 1)"}).queue(function(done){callback(),done()}).play(),animit(this._menuPage[0]).queue(behindStyle,{duration:duration,timing:"cubic-bezier(.1, .7, .1, 1)"}).play()}.bind(this),1e3/60)},closeMenu:function(callback,instant){var duration=instant===!0?0:this._duration,aboveTransform=this._generateAbovePageTransform(0),behindStyle=this._generateBehindPageStyle(0);setTimeout(function(){animit(this._mainPage[0]).queue({transform:aboveTransform},{duration:duration,timing:"cubic-bezier(.1, .7, .1, 1)"}).queue({transform:"translate3d(0, 0, 0)"}).queue(function(done){this._menuPage.css("display","none"),callback(),done()}.bind(this)).play(),animit(this._menuPage[0]).queue(behindStyle,{duration:duration,timing:"cubic-bezier(.1, .7, .1, 1)"}).queue(function(done){done()}).play()}.bind(this),1e3/60)},translateMenu:function(options){this._menuPage.css("display","block");var aboveTransform=this._generateAbovePageTransform(Math.min(options.maxDistance,options.distance)),behindStyle=this._generateBehindPageStyle(Math.min(options.maxDistance,options.distance));animit(this._mainPage[0]).queue({transform:aboveTransform}).play(),animit(this._menuPage[0]).queue(behindStyle).play()},_generateAbovePageTransform:function(distance){var x=this._isRight?-distance:distance,aboveTransform="translate3d("+x+"px, 0, 0)";return aboveTransform},_generateBehindPageStyle:function(distance){var behindX=(this._menuPage[0].clientWidth,this._isRight?-distance:distance),behindTransform="translate3d("+behindX+"px, 0, 0)";return{transform:behindTransform}},copy:function(){return new PushSlidingMenuAnimator}});return PushSlidingMenuAnimator}])}(),function(){"use strict";var module=angular.module("onsen");module.factory("RevealSlidingMenuAnimator",["SlidingMenuAnimator",function(SlidingMenuAnimator){var RevealSlidingMenuAnimator=SlidingMenuAnimator.extend({_blackMask:void 0,_isRight:!1,_menuPage:void 0,_element:void 0,_mainPage:void 0,_duration:void 0,setup:function(element,mainPage,menuPage,options){this._element=element,this._menuPage=menuPage,this._mainPage=mainPage,this._isRight=!!options.isRight,this._width=options.width||"90%",this._duration=.4,mainPage.css({boxShadow:"0px 0 10px 0px rgba(0, 0, 0, 0.2)"}),menuPage.css({width:options.width,opacity:.9,display:"none"}),this._isRight?menuPage.css({right:"0px",left:"auto"}):menuPage.css({right:"auto",left:"0px"}),this._blackMask=angular.element("<div></div>").css({backgroundColor:"black",top:"0px",left:"0px",right:"0px",bottom:"0px",position:"absolute",display:"none"}),element.prepend(this._blackMask),animit(mainPage[0]).queue({transform:"translate3d(0, 0, 0)"}).play()},onResized:function(options){if(this._width=options.width,this._menuPage.css("width",this._width),options.isOpened){var max=this._menuPage[0].clientWidth,aboveTransform=this._generateAbovePageTransform(max),behindStyle=this._generateBehindPageStyle(max);animit(this._mainPage[0]).queue({transform:aboveTransform}).play(),animit(this._menuPage[0]).queue(behindStyle).play()}},destroy:function(){this._blackMask&&(this._blackMask.remove(),this._blackMask=null),this._mainPage&&this._mainPage.attr("style",""),this._menuPage&&this._menuPage.attr("style",""),this._mainPage=this._menuPage=this._element=void 0},openMenu:function(callback,instant){var duration=instant===!0?0:this._duration;this._menuPage.css("display","block"),this._blackMask.css("display","block");var max=this._menuPage[0].clientWidth,aboveTransform=this._generateAbovePageTransform(max),behindStyle=this._generateBehindPageStyle(max);setTimeout(function(){animit(this._mainPage[0]).queue({transform:aboveTransform},{duration:duration,timing:"cubic-bezier(.1, .7, .1, 1)"}).queue(function(done){callback(),done()}).play(),animit(this._menuPage[0]).queue(behindStyle,{duration:duration,timing:"cubic-bezier(.1, .7, .1, 1)"}).play()}.bind(this),1e3/60)},closeMenu:function(callback,instant){var duration=instant===!0?0:this._duration;this._blackMask.css("display","block");var aboveTransform=this._generateAbovePageTransform(0),behindStyle=this._generateBehindPageStyle(0);setTimeout(function(){animit(this._mainPage[0]).queue({transform:aboveTransform},{duration:duration,timing:"cubic-bezier(.1, .7, .1, 1)"}).queue({transform:"translate3d(0, 0, 0)"}).queue(function(done){this._menuPage.css("display","none"),callback(),done()}.bind(this)).play(),animit(this._menuPage[0]).queue(behindStyle,{duration:duration,timing:"cubic-bezier(.1, .7, .1, 1)"}).queue(function(done){done()}).play()}.bind(this),1e3/60)},translateMenu:function(options){this._menuPage.css("display","block"),this._blackMask.css("display","block");var aboveTransform=this._generateAbovePageTransform(Math.min(options.maxDistance,options.distance)),behindStyle=this._generateBehindPageStyle(Math.min(options.maxDistance,options.distance));delete behindStyle.opacity,animit(this._mainPage[0]).queue({transform:aboveTransform}).play(),animit(this._menuPage[0]).queue(behindStyle).play()},_generateAbovePageTransform:function(distance){var x=this._isRight?-distance:distance,aboveTransform="translate3d("+x+"px, 0, 0)";return aboveTransform},_generateBehindPageStyle:function(distance){var max=this._menuPage[0].getBoundingClientRect().width,behindDistance=(distance-max)/max*10;behindDistance=isNaN(behindDistance)?0:Math.max(Math.min(behindDistance,0),-10);var behindX=this._isRight?-behindDistance:behindDistance,behindTransform="translate3d("+behindX+"%, 0, 0)",opacity=1+behindDistance/100;return{transform:behindTransform,opacity:opacity}},copy:function(){return new RevealSlidingMenuAnimator}});return RevealSlidingMenuAnimator}])}(),function(){"use strict;";var module=angular.module("onsen");module.factory("SimpleSlideTransitionAnimator",["NavigatorTransitionAnimator",function(NavigatorTransitionAnimator){var SimpleSlideTransitionAnimator=NavigatorTransitionAnimator.extend({backgroundMask:angular.element('<div style="z-index: 2; position: absolute; width: 100%;height: 100%; background-color: black; opacity: 0;"></div>'),timing:"cubic-bezier(.1, .7, .4, 1)",duration:.3,blackMaskOpacity:.4,init:function(options){options=options||{},this.timing=options.timing||this.timing,this.duration=void 0!==options.duration?options.duration:this.duration},push:function(enterPage,leavePage,callback){var mask=this.backgroundMask.remove();leavePage.element[0].parentNode.insertBefore(mask[0],leavePage.element[0].nextSibling),animit.runAll(animit(mask[0]).queue({opacity:0,transform:"translate3d(0, 0, 0)"}).queue({opacity:this.blackMaskOpacity},{duration:this.duration,timing:this.timing}).resetStyle().queue(function(done){mask.remove(),done()}),animit(enterPage.element[0]).queue({css:{transform:"translate3D(100%, 0, 0)"},duration:0}).queue({css:{transform:"translate3D(0, 0, 0)"},duration:this.duration,timing:this.timing}).resetStyle(),animit(leavePage.element[0]).queue({css:{transform:"translate3D(0, 0, 0)"},duration:0}).queue({css:{transform:"translate3D(-45%, 0px, 0px)"},duration:this.duration,timing:this.timing}).resetStyle().wait(.2).queue(function(done){callback(),done()}))},pop:function(enterPage,leavePage,done){var mask=this.backgroundMask.remove();enterPage.element[0].parentNode.insertBefore(mask[0],enterPage.element[0].nextSibling),animit.runAll(animit(mask[0]).queue({opacity:this.blackMaskOpacity,transform:"translate3d(0, 0, 0)"}).queue({opacity:0},{duration:this.duration,timing:this.timing}).resetStyle().queue(function(done){mask.remove(),done()}),animit(enterPage.element[0]).queue({css:{transform:"translate3D(-45%, 0px, 0px)",opacity:.9},duration:0}).queue({css:{transform:"translate3D(0px, 0px, 0px)",opacity:1},duration:this.duration,timing:this.timing}).resetStyle(),animit(leavePage.element[0]).queue({css:{transform:"translate3D(0px, 0px, 0px)"},duration:0}).queue({css:{transform:"translate3D(100%, 0px, 0px)"},duration:this.duration,timing:this.timing}).wait(.2).queue(function(finish){done(),finish()}))}});return SimpleSlideTransitionAnimator}])}(),function(){"use strict;";var module=angular.module("onsen");module.factory("SlideDialogAnimator",["DialogAnimator",function(DialogAnimator){var SlideDialogAnimator=DialogAnimator.extend({timing:"cubic-bezier(.1, .7, .4, 1)",duration:.2,init:function(options){options=options||{},this.timing=options.timing||this.timing,this.duration=void 0!==options.duration?options.duration:this.duration},show:function(dialog,callback){callback=callback?callback:function(){},animit.runAll(animit(dialog._mask[0]).queue({opacity:0}).queue({opacity:1},{duration:this.duration,timing:this.timing}),animit(dialog._dialog[0]).queue({css:{transform:"translate3D(-50%, -350%, 0)"},duration:0}).queue({css:{transform:"translate3D(-50%, -50%, 0)"},duration:this.duration,timing:this.timing}).resetStyle().queue(function(done){callback(),done()}))},hide:function(dialog,callback){callback=callback?callback:function(){},animit.runAll(animit(dialog._mask[0]).queue({opacity:1}).queue({opacity:0},{duration:this.duration,timing:this.timing}),animit(dialog._dialog[0]).queue({css:{transform:"translate3D(-50%, -50%, 0)"},duration:0}).queue({css:{transform:"translate3D(-50%, -350%, 0)"},duration:this.duration,timing:this.timing}).resetStyle().queue(function(done){callback(),done()}))}});return SlideDialogAnimator}])}(),function(){"use strict";var module=angular.module("onsen"),SlidingMenuViewModel=Class.extend({_distance:0,_maxDistance:void 0,init:function(options){if(!angular.isNumber(options.maxDistance))throw new Error("options.maxDistance must be number");this.setMaxDistance(options.maxDistance)},setMaxDistance:function(maxDistance){if(0>=maxDistance)throw new Error("maxDistance must be greater then zero.");this.isOpened()&&(this._distance=maxDistance),this._maxDistance=maxDistance},shouldOpen:function(){return!this.isOpened()&&this._distance>=this._maxDistance/2},shouldClose:function(){return!this.isClosed()&&this._distance<this._maxDistance/2},openOrClose:function(options){this.shouldOpen()?this.open(options):this.shouldClose()&&this.close(options)},close:function(options){var callback=options.callback||function(){};this.isClosed()?callback():(this._distance=0,this.emit("close",options))},open:function(options){var callback=options.callback||function(){};this.isOpened()?callback():(this._distance=this._maxDistance,this.emit("open",options))},isClosed:function(){return 0===this._distance},isOpened:function(){return this._distance===this._maxDistance},getX:function(){return this._distance},getMaxDistance:function(){return this._maxDistance},translate:function(x){this._distance=Math.max(1,Math.min(this._maxDistance-1,x));var options={distance:this._distance,maxDistance:this._maxDistance};this.emit("translate",options)},toggle:function(){this.isClosed()?this.open():this.close()}});MicroEvent.mixin(SlidingMenuViewModel),module.factory("SlidingMenuView",["$onsen","$compile","SlidingMenuAnimator","RevealSlidingMenuAnimator","PushSlidingMenuAnimator","OverlaySlidingMenuAnimator",function($onsen,$compile,SlidingMenuAnimator,RevealSlidingMenuAnimator,PushSlidingMenuAnimator,OverlaySlidingMenuAnimator){var SlidingMenuView=Class.extend({_scope:void 0,_attrs:void 0,_element:void 0,_menuPage:void 0,_mainPage:void 0,_doorLock:void 0,_isRightMenu:!1,init:function(scope,element,attrs){this._scope=scope,this._attrs=attrs,this._element=element,this._menuPage=angular.element(element[0].querySelector(".onsen-sliding-menu__menu")),this._mainPage=angular.element(element[0].querySelector(".onsen-sliding-menu__main")),this._doorLock=new DoorLock,this._isRightMenu="right"===attrs.side,this._mainPageHammer=new Hammer(this._mainPage[0]),this._bindedOnTap=this._onTap.bind(this);var maxDistance=this._normalizeMaxSlideDistanceAttr();this._logic=new SlidingMenuViewModel({maxDistance:Math.max(maxDistance,1)}),this._logic.on("translate",this._translate.bind(this)),this._logic.on("open",function(options){this._open(options)}.bind(this)),this._logic.on("close",function(options){this._close(options)}.bind(this)),attrs.$observe("maxSlideDistance",this._onMaxSlideDistanceChanged.bind(this)),attrs.$observe("swipeable",this._onSwipeableChanged.bind(this)),this._bindedOnWindowResize=this._onWindowResize.bind(this),window.addEventListener("resize",this._bindedOnWindowResize),this._boundHandleEvent=this._handleEvent.bind(this),this._bindEvents(),attrs.mainPage&&this.setMainPage(attrs.mainPage),attrs.menuPage&&this.setMenuPage(attrs.menuPage),this._deviceBackButtonHandler=$onsen.DeviceBackButtonHandler.create(this._element,this._onDeviceBackButton.bind(this));var unlock=this._doorLock.lock();window.setTimeout(function(){var maxDistance=this._normalizeMaxSlideDistanceAttr();this._logic.setMaxDistance(maxDistance),this._menuPage.css({opacity:1}),this._animator=this._getAnimatorOption(),this._animator.setup(this._element,this._mainPage,this._menuPage,{isRight:this._isRightMenu,width:this._attrs.maxSlideDistance||"90%"}),unlock()}.bind(this),400),scope.$on("$destroy",this._destroy.bind(this)),attrs.swipeable||this.setSwipeable(!0)},getDeviceBackButtonHandler:function(){return this._deviceBackButtonHandler},_onDeviceBackButton:function(event){this.isMenuOpened()?this.closeMenu():event.callParentHandler()},_onTap:function(){this.isMenuOpened()&&this.closeMenu()},_refreshMenuPageWidth:function(){var width="maxSlideDistance"in this._attrs?this._attrs.maxSlideDistance:"90%";this._animator&&this._animator.onResized({isOpened:this._logic.isOpened(),width:width})},_destroy:function(){this.emit("destroy"),this._deviceBackButtonHandler.destroy(),window.removeEventListener("resize",this._bindedOnWindowResize),this._mainPageHammer.off("tap",this._bindedOnTap),this._element=this._scope=this._attrs=null},_getAnimatorOption:function(){var animator=SlidingMenuView._animatorDict[this._attrs.type];return animator instanceof SlidingMenuAnimator||(animator=SlidingMenuView._animatorDict["default"]),animator.copy()},_onSwipeableChanged:function(swipeable){swipeable=""===swipeable||void 0===swipeable||"true"==swipeable,this.setSwipeable(swipeable)},setSwipeable:function(enabled){enabled?this._activateHammer():this._deactivateHammer()},_onWindowResize:function(){this._recalculateMAX(),this._refreshMenuPageWidth()},_onMaxSlideDistanceChanged:function(){this._recalculateMAX(),this._refreshMenuPageWidth()},_normalizeMaxSlideDistanceAttr:function(){var maxDistance=this._attrs.maxSlideDistance;if("maxSlideDistance"in this._attrs){if("string"!=typeof maxDistance)throw new Error("invalid state");-1!==maxDistance.indexOf("px",maxDistance.length-2)?maxDistance=parseInt(maxDistance.replace("px",""),10):maxDistance.indexOf("%",maxDistance.length-1)>0&&(maxDistance=maxDistance.replace("%",""),maxDistance=parseFloat(maxDistance)/100*this._mainPage[0].clientWidth)}else maxDistance=.9*this._mainPage[0].clientWidth;return maxDistance},_recalculateMAX:function(){var maxDistance=this._normalizeMaxSlideDistanceAttr();maxDistance&&this._logic.setMaxDistance(parseInt(maxDistance,10))},_activateHammer:function(){this._hammertime.on("touch dragleft dragright swipeleft swiperight release",this._boundHandleEvent)},_deactivateHammer:function(){this._hammertime.off("touch dragleft dragright swipeleft swiperight release",this._boundHandleEvent)},_bindEvents:function(){this._hammertime=new Hammer(this._element[0],{dragMinDistance:1})},_appendMainPage:function(pageUrl,templateHTML){var pageScope=this._scope.$new(),pageContent=angular.element(templateHTML),link=$compile(pageContent);this._mainPage.append(pageContent),this._currentPageElement&&(this._currentPageElement.remove(),this._currentPageScope.$destroy()),link(pageScope),this._currentPageElement=pageContent,this._currentPageScope=pageScope,this._currentPageUrl=pageUrl},_appendMenuPage:function(templateHTML){var pageScope=this._scope.$new(),pageContent=angular.element(templateHTML),link=$compile(pageContent);this._menuPage.append(pageContent),this._currentMenuPageScope&&(this._currentMenuPageScope.$destroy(),this._currentMenuPageElement.remove()),link(pageScope),this._currentMenuPageElement=pageContent,this._currentMenuPageScope=pageScope},setMenuPage:function(page,options){if(!page)throw new Error("cannot set undefined page");options=options||{},options.callback=options.callback||function(){};var self=this;$onsen.getPageHTMLAsync(page).then(function(html){self._appendMenuPage(angular.element(html)),options.closeMenu&&self.close(),options.callback()},function(){throw new Error("Page is not found: "+page)})},setMainPage:function(pageUrl,options){options=options||{},options.callback=options.callback||function(){};var done=function(){options.closeMenu&&this.close(),options.callback()}.bind(this);if(this.currentPageUrl===pageUrl)return done(),void 0;if(!pageUrl)throw new Error("cannot set undefined page");var self=this;$onsen.getPageHTMLAsync(pageUrl).then(function(html){self._appendMainPage(pageUrl,html),done()},function(){throw new Error("Page is not found: "+page)})},_handleEvent:function(event){if(!this._doorLock.isLocked())switch(this._isInsideIgnoredElement(event.target)&&this._deactivateHammer(),event.type){case"dragleft":case"dragright":if(this._logic.isClosed()&&!this._isInsideSwipeTargetArea(event))return;event.gesture.preventDefault();var deltaX=event.gesture.deltaX,deltaDistance=this._isRightMenu?-deltaX:deltaX,startEvent=event.gesture.startEvent;if("isOpened"in startEvent||(startEvent.isOpened=this._logic.isOpened()),0>deltaDistance&&this._logic.isClosed())break;if(deltaDistance>0&&this._logic.isOpened())break;var distance=startEvent.isOpened?deltaDistance+this._logic.getMaxDistance():deltaDistance;this._logic.translate(distance);break;case"swipeleft":if(event.gesture.preventDefault(),this._logic.isClosed()&&!this._isInsideSwipeTargetArea(event))return;this._isRightMenu?this.open():this.close(),event.gesture.stopDetect();break;case"swiperight":if(event.gesture.preventDefault(),this._logic.isClosed()&&!this._isInsideSwipeTargetArea(event))return;this._isRightMenu?this.close():this.open(),event.gesture.stopDetect();break;case"release":this._lastDistance=null,this._logic.shouldOpen()?this.open():this._logic.shouldClose()&&this.close()}},_isInsideIgnoredElement:function(element){do{if(element.getAttribute&&element.getAttribute("sliding-menu-ignore"))return!0;element=element.parentNode}while(element);return!1},_isInsideSwipeTargetArea:function(event){var x=event.gesture.center.pageX;"_swipeTargetWidth"in event.gesture.startEvent||(event.gesture.startEvent._swipeTargetWidth=this._getSwipeTargetWidth());var targetWidth=event.gesture.startEvent._swipeTargetWidth;return this._isRightMenu?this._mainPage[0].clientWidth-x<targetWidth:targetWidth>x},_getSwipeTargetWidth:function(){var targetWidth=this._attrs.swipeTargetWidth;"string"==typeof targetWidth&&(targetWidth=targetWidth.replace("px",""));var width=parseInt(targetWidth,10);return 0>width||!targetWidth?this._mainPage[0].clientWidth:width},closeMenu:function(){return this.close.apply(this,arguments)},close:function(options){options=options||{},options="function"==typeof options?{callback:options}:options,this._logic.isClosed()||(this.emit("preclose",{slidingMenu:this}),this._doorLock.waitUnlock(function(){this._logic.close(options)}.bind(this)))},_close:function(options){var callback=options.callback||function(){},unlock=this._doorLock.lock(),instant="none"==options.animation;this._animator.closeMenu(function(){unlock(),this._mainPage.children().css("pointer-events",""),this._mainPageHammer.off("tap",this._bindedOnTap),this.emit("postclose",{slidingMenu:this}),callback()}.bind(this),instant)},openMenu:function(){return this.open.apply(this,arguments)},open:function(options){options=options||{},options="function"==typeof options?{callback:options}:options,this.emit("preopen",{slidingMenu:this}),this._doorLock.waitUnlock(function(){this._logic.open(options)}.bind(this))},_open:function(options){var callback=options.callback||function(){},unlock=this._doorLock.lock(),instant="none"==options.animation;this._animator.openMenu(function(){unlock(),this._mainPage.children().css("pointer-events","none"),this._mainPageHammer.on("tap",this._bindedOnTap),this.emit("postopen",{slidingMenu:this}),callback()}.bind(this),instant)},toggle:function(options){this._logic.isClosed()?this.open(options):this.close(options)},toggleMenu:function(){return this.toggle.apply(this,arguments)},isMenuOpened:function(){return this._logic.isOpened()},_translate:function(event){this._animator.translateMenu(event)}});return SlidingMenuView._animatorDict={"default":new RevealSlidingMenuAnimator,overlay:new OverlaySlidingMenuAnimator,reveal:new RevealSlidingMenuAnimator,push:new PushSlidingMenuAnimator},SlidingMenuView.registerSlidingMenuAnimator=function(name,animator){if(!(animator instanceof SlidingMenuAnimator))throw new Error('"animator" param must be an instance of SlidingMenuAnimator');this._animatorDict[name]=animator},MicroEvent.mixin(SlidingMenuView),SlidingMenuView}])}(),function(){"use strict";var module=angular.module("onsen");module.factory("SlidingMenuAnimator",function(){return Class.extend({setup:function(){},onResized:function(){},openMenu:function(){},closeClose:function(){},destroy:function(){},translateMenu:function(){},copy:function(){throw new Error("Override copy method.")}})})}(),function(){"use strict";var module=angular.module("onsen");module.factory("SplitView",["$compile","RevealSlidingMenuAnimator","$onsen","$onsGlobal",function($compile,RevealSlidingMenuAnimator,$onsen,$onsGlobal){function isNumber(n){return!isNaN(parseFloat(n))&&isFinite(n)}var SPLIT_MODE=0,COLLAPSE_MODE=1,MAIN_PAGE_RATIO=.9,SplitView=Class.extend({init:function(scope,element,attrs){element.addClass("onsen-sliding-menu"),this._element=element,this._scope=scope,this._attrs=attrs,this._mainPage=angular.element(element[0].querySelector(".onsen-split-view__main")),this._secondaryPage=angular.element(element[0].querySelector(".onsen-split-view__secondary")),this._max=this._mainPage[0].clientWidth*MAIN_PAGE_RATIO,this._mode=SPLIT_MODE,this._doorLock=new DoorLock,this._doSplit=!1,this._doCollapse=!1,$onsGlobal.orientation.on("change",this._onResize.bind(this)),this._animator=new RevealSlidingMenuAnimator,this._element.css("display","none"),attrs.mainPage&&this.setMainPage(attrs.mainPage),attrs.secondaryPage&&this.setSecondaryPage(attrs.secondaryPage);var unlock=this._doorLock.lock();this._considerChangingCollapse(),this._setSize(),setTimeout(function(){this._element.css("display","block"),unlock()}.bind(this),1e3/60*2),scope.$on("$destroy",this._destroy.bind(this))},_appendSecondPage:function(templateHTML){var pageScope=this._scope.$new(),pageContent=$compile(templateHTML)(pageScope);this._secondaryPage.append(pageContent),this._currentSecondaryPageElement&&(this._currentSecondaryPageElement.remove(),this._currentSecondaryPageScope.$destroy()),this._currentSecondaryPageElement=pageContent,this._currentSecondaryPageScope=pageScope},_appendMainPage:function(templateHTML){var pageScope=this._scope.$new(),pageContent=$compile(templateHTML)(pageScope);this._mainPage.append(pageContent),this._currentPage&&(this._currentPage.remove(),this._currentPageScope.$destroy()),this._currentPage=pageContent,this._currentPageScope=pageScope},setSecondaryPage:function(page){if(!page)throw new Error("cannot set undefined page");$onsen.getPageHTMLAsync(page).then(function(html){this._appendSecondPage(angular.element(html.trim()))}.bind(this),function(){throw new Error("Page is not found: "+page)})},setMainPage:function(page){if(!page)throw new Error("cannot set undefined page");$onsen.getPageHTMLAsync(page).then(function(html){this._appendMainPage(angular.element(html.trim()))}.bind(this),function(){throw new Error("Page is not found: "+page)})},_onResize:function(){var lastMode=this._mode;this._considerChangingCollapse(),lastMode===COLLAPSE_MODE&&this._mode===COLLAPSE_MODE&&this._animator.onResized({isOpened:!1,width:"90%"}),this._max=this._mainPage[0].clientWidth*MAIN_PAGE_RATIO},_considerChangingCollapse:function(){var should=this._shouldCollapse();should&&this._mode!==COLLAPSE_MODE?(this._fireUpdateEvent(),this._doSplit?this._activateSplitMode():this._activateCollapseMode()):should||this._mode!==COLLAPSE_MODE||(this._fireUpdateEvent(),this._doCollapse?this._activateCollapseMode():this._activateSplitMode()),this._doCollapse=this._doSplit=!1},update:function(){this._fireUpdateEvent();var should=this._shouldCollapse();this._doSplit?this._activateSplitMode():this._doCollapse?this._activateCollapseMode():should?this._activateCollapseMode():should||this._activateSplitMode(),this._doSplit=this._doCollapse=!1},_getOrientation:function(){return $onsGlobal.orientation.isPortrait()?"portrait":"landscape"},getCurrentMode:function(){return this._mode===COLLAPSE_MODE?"collapse":"split"},_shouldCollapse:function(){var c="portrait";if("string"==typeof this._attrs.collapse&&(c=this._attrs.collapse.trim()),"portrait"==c)return $onsGlobal.orientation.isPortrait();if("landscape"==c)return $onsGlobal.orientation.isLandscape();if("width"==c.substr(0,5)){var num=c.split(" ")[1];num.indexOf("px")>=0&&(num=num.substr(0,num.length-2));var width=window.innerWidth;return isNumber(num)&&num>width}var mq=window.matchMedia(c);return mq.matches},_setSize:function(){if(this._mode===SPLIT_MODE){this._attrs.mainPageWidth||(this._attrs.mainPageWidth="70");var secondarySize=100-this._attrs.mainPageWidth.replace("%","");this._secondaryPage.css({width:secondarySize+"%",opacity:1}),this._mainPage.css({width:this._attrs.mainPageWidth+"%"}),this._mainPage.css("left",secondarySize+"%")}},_fireEvent:function(name){this.emit(name,{splitView:this,width:window.innerWidth,orientation:this._getOrientation()})},_fireUpdateEvent:function(){var that=this;this.emit("update",{splitView:this,shouldCollapse:this._shouldCollapse(),currentMode:this.getCurrentMode(),split:function(){that._doSplit=!0,that._doCollapse=!1},collapse:function(){that._doSplit=!1,that._doCollapse=!0},width:window.innerWidth,orientation:this._getOrientation()})},_activateCollapseMode:function(){this._mode!==COLLAPSE_MODE&&(this._fireEvent("precollapse"),this._secondaryPage.attr("style",""),this._mainPage.attr("style",""),this._mode=COLLAPSE_MODE,this._animator.setup(this._element,this._mainPage,this._secondaryPage,{isRight:!1,width:"90%"}),this._fireEvent("postcollapse"))},_activateSplitMode:function(){this._mode!==SPLIT_MODE&&(this._fireEvent("presplit"),this._animator.destroy(),this._secondaryPage.attr("style",""),this._mainPage.attr("style",""),this._mode=SPLIT_MODE,this._setSize(),this._fireEvent("postsplit"))},_destroy:function(){this.emit("destroy"),this._element=null,this._scope=null}});return MicroEvent.mixin(SplitView),SplitView}])}(),function(){"use strict";var module=angular.module("onsen");module.factory("SwitchView",["$onsen",function(){var SwitchView=Class.extend({init:function(element,scope,attrs){this._element=element,this._checkbox=angular.element(element[0].querySelector("input[type=checkbox]")),this._scope=scope,attrs.$observe("disabled",function(){element.attr("disabled")?this._checkbox.attr("disabled","disabled"):this._checkbox.removeAttr("disabled")}.bind(this)),this._checkbox.on("change",function(){this.emit("change",{"switch":this,value:this._checkbox[0].checked,isInteractive:!0})}.bind(this))},isChecked:function(){return this._checkbox[0].checked},setChecked:function(isChecked){isChecked=!!isChecked,this._checkbox[0].checked!=isChecked&&(this._scope.model=isChecked,this._checkbox[0].checked=isChecked,this._scope.$evalAsync(),this.emit("change",{"switch":this,value:isChecked,isInteractive:!1}))},getCheckboxElement:function(){return this._checkbox[0]}});return MicroEvent.mixin(SwitchView),SwitchView}])}(),function(){"use strict;";var module=angular.module("onsen");module.factory("TabbarAnimator",function(){var TabbarAnimator=Class.extend({apply:function(){throw new Error("This method must be implemented.")}});return TabbarAnimator}),module.factory("TabbarNoneAnimator",["TabbarAnimator",function(TabbarAnimator){var TabbarNoneAnimator=TabbarAnimator.extend({apply:function(enterPage,leavePage,done){done()}});return TabbarNoneAnimator}]),module.factory("TabbarFadeAnimator",["TabbarAnimator",function(TabbarAnimator){var TabbarFadeAnimator=TabbarAnimator.extend({apply:function(enterPage,leavePage,done){animit.runAll(animit(enterPage[0]).queue({transform:"translate3D(0, 0, 0)",opacity:0}).queue({transform:"translate3D(0, 0, 0)",opacity:1},{duration:.4,timing:"linear"}).resetStyle().queue(function(callback){done(),callback()}),animit(leavePage[0]).queue({transform:"translate3D(0, 0, 0)",opacity:1}).queue({transform:"translate3D(0, 0, 0)",opacity:0},{duration:.4,timing:"linear"}))
}});return TabbarFadeAnimator}]),module.factory("TabbarView",["$onsen","$compile","TabbarAnimator","TabbarNoneAnimator","TabbarFadeAnimator",function($onsen,$compile,TabbarAnimator,TabbarNoneAnimator,TabbarFadeAnimator){var TabbarView=Class.extend({_tabbarId:void 0,_tabItems:void 0,init:function(scope,element,attrs){this._scope=scope,this._element=element,this._attrs=attrs,this._tabbarId=Date.now(),this._tabItems=[],this._contentElement=angular.element(element[0].querySelector(".ons-tab-bar__content")),this._tabbarElement=angular.element(element[0].querySelector(".ons-tab-bar__footer")),this._scope.$on("$destroy",this._destroy.bind(this)),this._hasTopTabbar()&&this._prepareForTopTabbar()},_prepareForTopTabbar:function(){this._contentElement.attr("no-status-bar-fill",""),setImmediate(function(){this._contentElement.addClass("tab-bar--top__content"),this._tabbarElement.addClass("tab-bar--top")}.bind(this));var page=ons.findParentComponentUntil("ons-page",this._element[0]);if(page&&this._element.css("top",window.getComputedStyle(page.getContentElement(),null).getPropertyValue("padding-top")),$onsen.shouldFillStatusBar(this._element[0])){var fill=angular.element(document.createElement("div"));fill.addClass("tab-bar__status-bar-fill"),fill.css({width:"0px",height:"0px"}),this._element.prepend(fill)}},_hasTopTabbar:function(){return"top"===this._attrs.position},setActiveTab:function(index,options){options=options||{};var previousTabItem=this._tabItems[this.getActiveTabIndex()],selectedTabItem=this._tabItems[index];if(("undefined"!=typeof selectedTabItem.noReload||selectedTabItem.isPersistent())&&index===this.getActiveTabIndex())return this.emit("reactive",{index:index,tabItem:selectedTabItem}),!1;var needLoad=selectedTabItem.page&&!options.keepPage;if(!selectedTabItem)return!1;var canceled=!1;if(this.emit("prechange",{index:index,tabItem:selectedTabItem,cancel:function(){canceled=!0}}),canceled)return selectedTabItem.setInactive(),previousTabItem&&previousTabItem.setActive(),!1;selectedTabItem.setActive();for(var i=0;i<this._tabItems.length;i++)this._tabItems[i]!=selectedTabItem?this._tabItems[i].setInactive():needLoad||this.emit("postchange",{index:index,tabItem:selectedTabItem});if(needLoad){var removeElement=!0;previousTabItem&&previousTabItem.isPersistent()&&(removeElement=!1,previousTabItem._pageElement=this._currentPageElement);var params={callback:function(){this.emit("postchange",{index:index,tabItem:selectedTabItem})}.bind(this),_removeElement:removeElement};options.animation&&(params.animation=options.animation),selectedTabItem.isPersistent()&&selectedTabItem._pageElement?this._loadPersistentPageDOM(selectedTabItem._pageElement,params):this._loadPage(selectedTabItem.page,params)}return!0},setTabbarVisibility:function(visible){this._scope.hideTabs=!visible,this._onTabbarVisibilityChanged()},_onTabbarVisibilityChanged:function(){this._hasTopTabbar()?this._scope.hideTabs?this._contentElement.css("top","0px"):this._contentElement.css("top",""):this._scope.hideTabs?this._contentElement.css("bottom","0px"):this._contentElement.css("bottom","")},addTabItem:function(tabItem){this._tabItems.push(tabItem)},getActiveTabIndex:function(){for(var tabItem,i=0;i<this._tabItems.length;i++)if(tabItem=this._tabItems[i],tabItem.isActive())return i;return-1},loadPage:function(page,options){return options=options||{},options._removeElement=!0,this._loadPage(page,options)},_loadPage:function(page,options){$onsen.getPageHTMLAsync(page).then(function(html){var pageElement=angular.element(html.trim());this._loadPageDOM(pageElement,options)}.bind(this),function(){throw new Error("Page is not found: "+page)})},_switchPage:function(element,options){if(this._currentPageElement){var oldPageElement=this._currentPageElement,oldPageScope=this._currentPageScope;this._currentPageElement=element,this._currentPageScope=element.data("_scope"),this._getAnimatorOption(options).apply(element,oldPageElement,function(){options._removeElement?(oldPageElement.remove(),oldPageScope.$destroy()):oldPageElement.css("display","none"),options.callback instanceof Function&&options.callback()})}else this._currentPageElement=element,this._currentPageScope=element.data("_scope"),options.callback instanceof Function&&options.callback()},_loadPageDOM:function(element,options){options=options||{};var pageScope=this._scope.$new(),link=$compile(element);this._contentElement.append(element);var pageContent=link(pageScope);pageScope.$evalAsync(),this._switchPage(pageContent,options)},_loadPersistentPageDOM:function(element,options){options=options||{},element.css("display","block"),this._switchPage(element,options)},_getAnimatorOption:function(options){var animationAttr=this._element.attr("animation")||"default";return TabbarView._animatorDict[options.animation||animationAttr]||TabbarView._animatorDict["default"]},_destroy:function(){this.emit("destroy"),this._element=this._scope=this._attrs=null}});return MicroEvent.mixin(TabbarView),TabbarView._animatorDict={"default":new TabbarNoneAnimator,none:new TabbarNoneAnimator,fade:new TabbarFadeAnimator},TabbarView.registerAnimator=function(name,animator){if(!(animator instanceof TabbarAnimator))throw new Error('"animator" param must be an instance of TabbarAnimator');this._animatorDict[name]=animator},TabbarView}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsAlertDialog",["$onsen","AlertDialogView",function($onsen,AlertDialogView){return{restrict:"E",replace:!1,scope:!0,transclude:!1,compile:function(element,attrs){var modifierTemplater=$onsen.generateModifierTemplater(attrs);element.addClass("alert-dialog "+modifierTemplater("alert-dialog--*"));var titleElement=angular.element(element[0].querySelector(".alert-dialog-title")),contentElement=angular.element(element[0].querySelector(".alert-dialog-content"));return titleElement.length&&titleElement.addClass(modifierTemplater("alert-dialog-title--*")),contentElement.length&&contentElement.addClass(modifierTemplater("alert-dialog-content--*")),{pre:function(scope,element,attrs){var alertDialog=new AlertDialogView(scope,element,attrs);$onsen.declareVarAttribute(attrs,alertDialog),$onsen.registerEventHandlers(alertDialog,"preshow prehide postshow posthide destroy"),$onsen.addModifierMethods(alertDialog,"alert-dialog--*",element),titleElement.length&&$onsen.addModifierMethods(alertDialog,"alert-dialog-title--*",titleElement),contentElement.length&&$onsen.addModifierMethods(alertDialog,"alert-dialog-content--*",contentElement),$onsen.isAndroid()&&alertDialog.addModifier("android"),element.data("ons-alert-dialog",alertDialog),scope.$on("$destroy",function(){alertDialog._events=void 0,$onsen.removeModifierMethods(alertDialog),element.data("ons-alert-dialog",void 0),element=null})},post:function(scope,element){$onsen.fireComponentEvent(element[0],"init")}}}}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsBackButton",["$onsen","$compile","GenericView","ComponentCleaner",function($onsen,$compile,GenericView,ComponentCleaner){return{restrict:"E",replace:!1,templateUrl:$onsen.DIRECTIVE_TEMPLATE_URL+"/back_button.tpl",transclude:!0,scope:!0,link:{pre:function(scope,element,attrs,controller,transclude){var backButton=new GenericView(scope,element,attrs);$onsen.declareVarAttribute(attrs,backButton),element.data("ons-back-button",backButton),scope.$on("$destroy",function(){backButton._events=void 0,$onsen.removeModifierMethods(backButton),element.data("ons-back-button",void 0),element=null}),scope.modifierTemplater=$onsen.generateModifierTemplater(attrs);var navigator=ons.findParentComponentUntil("ons-navigator",element);scope.$watch(function(){return navigator.pages.length},function(nbrOfPages){scope.showBackButton=nbrOfPages>1}),$onsen.addModifierMethods(backButton,"toolbar-button--*",element.children()),transclude(scope,function(clonedElement){clonedElement[0]&&element[0].querySelector(".back-button__label").appendChild(clonedElement[0])}),ComponentCleaner.onDestroy(scope,function(){ComponentCleaner.destroyScope(scope),ComponentCleaner.destroyAttributes(attrs),element=null,scope=null,attrs=null})},post:function(scope,element){$onsen.fireComponentEvent(element[0],"init")}}}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsBottomToolbar",["$onsen","GenericView",function($onsen,GenericView){return{restrict:"E",replace:!1,transclude:!1,scope:!1,compile:function(element,attrs){var modifierTemplater=$onsen.generateModifierTemplater(attrs),inline="undefined"!=typeof attrs.inline;return element.addClass("bottom-bar"),element.addClass(modifierTemplater("bottom-bar--*")),element.css({"z-index":0}),inline&&element.css("position","static"),{pre:function(scope,element,attrs){var bottomToolbar=new GenericView(scope,element,attrs);$onsen.declareVarAttribute(attrs,bottomToolbar),element.data("ons-bottomToolbar",bottomToolbar),scope.$on("$destroy",function(){bottomToolbar._events=void 0,$onsen.removeModifierMethods(bottomToolbar),element.data("ons-bottomToolbar",void 0),element=null}),$onsen.addModifierMethods(bottomToolbar,"bottom-bar--*",element);var pageView=element.inheritedData("ons-page");pageView&&!inline&&pageView.registerBottomToolbar(element)},post:function(scope,element){$onsen.fireComponentEvent(element[0],"init")}}}}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsButton",["$onsen","ButtonView",function($onsen,ButtonView){return{restrict:"E",replace:!1,transclude:!0,scope:{animation:"@"},templateUrl:$onsen.DIRECTIVE_TEMPLATE_URL+"/button.tpl",link:function(scope,element,attrs,_,transclude){var button=new ButtonView(scope,element,attrs);$onsen.declareVarAttribute(attrs,button),element.data("ons-button",button),scope.$on("$destroy",function(){button._events=void 0,$onsen.removeModifierMethods(button),element.data("ons-button",void 0),element=null});var initialAnimation="slide-left";if(scope.modifierTemplater=$onsen.generateModifierTemplater(attrs),element.addClass("button effeckt-button"),element.addClass(scope.modifierTemplater("button--*")),element.addClass(initialAnimation),$onsen.addModifierMethods(button,"button--*",element),transclude(scope.$parent,function(cloned){angular.element(element[0].querySelector(".ons-button-inner")).append(cloned)}),attrs.ngController)throw new Error("This element can't accept ng-controller directive.");scope.item={},scope.item.animation=initialAnimation,scope.$watch("animation",function(newAnimation){newAnimation&&(scope.item.animation&&element.removeClass(scope.item.animation),scope.item.animation=newAnimation,element.addClass(scope.item.animation))}),attrs.$observe("shouldSpin",function(shouldSpin){"true"===shouldSpin?element.attr("data-loading",!0):element.removeAttr("data-loading")}),$onsen.cleaner.onDestroy(scope,function(){$onsen.clearComponent({scope:scope,attrs:attrs,element:element}),scope=element=attrs=null}),$onsen.fireComponentEvent(element[0],"init")}}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsCarousel",["$onsen","CarouselView",function($onsen,CarouselView){return{restrict:"E",replace:!1,scope:!1,transclude:!1,compile:function(element,attrs){var templater=$onsen.generateModifierTemplater(attrs);return element.addClass(templater("carousel--*")),function(scope,element,attrs){var carousel=new CarouselView(scope,element,attrs);element.data("ons-carousel",carousel),$onsen.registerEventHandlers(carousel,"postchange refresh overscroll destroy"),$onsen.declareVarAttribute(attrs,carousel),scope.$on("$destroy",function(){carousel._events=void 0,element.data("ons-carousel",void 0),element=null}),element[0].hasAttribute("auto-refresh")&&scope.$watch(function(){return element[0].childNodes.length},function(){setImmediate(function(){carousel.refresh()})}),setImmediate(function(){carousel.refresh()}),$onsen.fireComponentEvent(element[0],"init")}}}}]),module.directive("onsCarouselItem",["$onsen",function($onsen){return{restrict:"E",replace:!1,scope:!1,transclude:!1,compile:function(element,attrs){var templater=$onsen.generateModifierTemplater(attrs);return element.addClass(templater("carousel-item--*")),element.css("width","100%"),function(){}}}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsCol",["$timeout","$onsen",function($timeout,$onsen){return{restrict:"E",replace:!1,transclude:!1,scope:!1,compile:function(element){return element.addClass("col ons-col-inner"),function(scope,element,attrs){function updateAlign(align){"top"===align||"center"===align||"bottom"===align?(element.removeClass("col-top col-center col-bottom"),element.addClass("col-"+align)):element.removeClass("col-top col-center col-bottom")}function updateWidth(width){"string"==typeof width?(width=(""+width).trim(),width=width.match(/^\d+$/)?width+"%":width,element.css({"-webkit-box-flex":"0","-webkit-flex":"0 0 "+width,"-moz-box-flex":"0","-moz-flex":"0 0 "+width,"-ms-flex":"0 0 "+width,flex:"0 0 "+width,"max-width":width})):element.removeAttr("style")}attrs.$observe("align",function(align){updateAlign(align)}),attrs.$observe("width",function(width){updateWidth(width)}),attrs.$observe("size",function(size){attrs.width||updateWidth(size)}),updateAlign(attrs.align),attrs.size&&!attrs.width?updateWidth(attrs.size):updateWidth(attrs.width),$onsen.cleaner.onDestroy(scope,function(){$onsen.clearComponent({scope:scope,element:element,attrs:attrs}),element=attrs=scope=null}),$onsen.fireComponentEvent(element[0],"init")}}}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsDialog",["$onsen","DialogView",function($onsen,DialogView){return{restrict:"E",replace:!1,scope:!0,transclude:!0,templateUrl:$onsen.DIRECTIVE_TEMPLATE_URL+"/dialog.tpl",compile:function(element,attrs,transclude){return element[0].setAttribute("no-status-bar-fill",""),{pre:function(scope,element,attrs){transclude(scope,function(clone){angular.element(element[0].querySelector(".dialog")).append(clone)});var dialog=new DialogView(scope,element,attrs);scope.modifierTemplater=$onsen.generateModifierTemplater(attrs),$onsen.addModifierMethods(dialog,"dialog--*",angular.element(element[0].querySelector(".dialog"))),$onsen.declareVarAttribute(attrs,dialog),$onsen.registerEventHandlers(dialog,"preshow prehide postshow posthide destroy"),element.data("ons-dialog",dialog),scope.$on("$destroy",function(){dialog._events=void 0,$onsen.removeModifierMethods(dialog),element.data("ons-dialog",void 0),element=null})},post:function(scope,element){$onsen.fireComponentEvent(element[0],"init")}}}}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsDummyForInit",["$rootScope",function($rootScope){var isReady=!1;return{restrict:"E",replace:!1,link:{post:function(scope,element){isReady||(isReady=!0,$rootScope.$broadcast("$ons-ready")),element.remove()}}}}])}(),function(){"use strict";var EVENTS="drag dragleft dragright dragup dragdown hold release swipe swipeleft swiperight swipeup swipedown tap doubletap touch transform pinch pinchin pinchout rotate".split(/ +/);angular.module("onsen").directive("onsGestureDetector",["$onsen",function($onsen){function titlize(str){return str.charAt(0).toUpperCase()+str.slice(1)}var scopeDef=EVENTS.reduce(function(dict,name){return dict["ng"+titlize(name)]="&",dict},{});return{restrict:"E",scope:scopeDef,replace:!1,transclude:!0,compile:function(){return function(scope,element,attrs,controller,transclude){function handleEvent(event){var attr="ng"+titlize(event.type);attr in scopeDef&&scope[attr]({$event:event})}transclude(scope.$parent,function(cloned){element.append(cloned)});var hammer=new Hammer(element[0]);hammer.on(EVENTS.join(" "),handleEvent),$onsen.cleaner.onDestroy(scope,function(){hammer.off(EVENTS.join(" "),handleEvent),$onsen.clearComponent({scope:scope,element:element,attrs:attrs}),hammer.element=scope=element=attrs=null}),$onsen.fireComponentEvent(element[0],"init")}}}}])}(),function(){"use strict";function cleanClassAttribute(element){var classList=(""+element.attr("class")).split(/ +/).filter(function(classString){return"fa"!==classString&&"fa-"!==classString.substring(0,3)&&"ion-"!==classString.substring(0,4)});element.attr("class",classList.join(" "))}function buildClassAndStyle(attrs){var classList=["ons-icon"],style={};0===attrs.icon.indexOf("ion-")?(classList.push(attrs.icon),classList.push("ons-icon--ion")):0===attrs.icon.indexOf("fa-")?(classList.push(attrs.icon),classList.push("fa")):(classList.push("fa"),classList.push("fa-"+attrs.icon));var size=""+attrs.size;return size.match(/^[1-5]x|lg$/)?classList.push("fa-"+size):"string"==typeof attrs.size?style["font-size"]=size:classList.push("fa-lg"),{"class":classList.join(" "),style:style}}var module=angular.module("onsen");module.directive("onsIcon",["$onsen",function($onsen){return{restrict:"E",replace:!1,transclude:!1,link:function(scope,element,attrs){if(attrs.ngController)throw new Error("This element can't accept ng-controller directive.");var update=function(){cleanClassAttribute(element);var builded=buildClassAndStyle(attrs);element.css(builded.style),element.addClass(builded["class"])},builded=buildClassAndStyle(attrs);element.css(builded.style),element.addClass(builded["class"]),attrs.$observe("icon",update),attrs.$observe("size",update),attrs.$observe("fixedWidth",update),attrs.$observe("rotate",update),attrs.$observe("flip",update),attrs.$observe("spin",update),$onsen.cleaner.onDestroy(scope,function(){$onsen.clearComponent({scope:scope,element:element,attrs:attrs}),element=scope=attrs=null}),$onsen.fireComponentEvent(element[0],"init")}}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsIfOrientation",["$onsen","$onsGlobal",function($onsen,$onsGlobal){return{restrict:"A",replace:!1,transclude:!1,scope:!1,compile:function(element){return element.css("display","none"),function(scope,element,attrs){function update(){var userOrientation=(""+attrs.onsIfOrientation).toLowerCase(),orientation=getLandscapeOrPortrait();("portrait"===userOrientation||"landscape"===userOrientation)&&(userOrientation===orientation?element.css("display",""):element.css("display","none"))}function getLandscapeOrPortrait(){return $onsGlobal.orientation.isPortrait()?"portrait":"landscape"}element.addClass("ons-if-orientation-inner"),attrs.$observe("onsIfOrientation",update),$onsGlobal.orientation.on("change",update),update(),$onsen.cleaner.onDestroy(scope,function(){$onsGlobal.orientation.off("change",update),$onsen.clearComponent({element:element,scope:scope,attrs:attrs}),element=scope=attrs=null})}}}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsIfPlatform",["$onsen",function($onsen){return{restrict:"A",replace:!1,transclude:!1,scope:!1,compile:function(element){function getPlatformString(){if(navigator.userAgent.match(/Android/i))return"android";if(navigator.userAgent.match(/BlackBerry/i)||navigator.userAgent.match(/RIM Tablet OS/i)||navigator.userAgent.match(/BB10/i))return"blackberry";if(navigator.userAgent.match(/iPhone|iPad|iPod/i))return"ios";if(navigator.userAgent.match(/IEMobile/i))return"windows";var isOpera=!!window.opera||navigator.userAgent.indexOf(" OPR/")>=0;if(isOpera)return"opera";var isFirefox="undefined"!=typeof InstallTrigger;if(isFirefox)return"firefox";var isSafari=Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0;if(isSafari)return"safari";var isChrome=!!window.chrome&&!isOpera;if(isChrome)return"chrome";var isIE=!1||!!document.documentMode;return isIE?"ie":"unknown"}element.addClass("ons-if-platform-inner"),element.css("display","none");var platform=getPlatformString();return function(scope,element,attrs){function update(){attrs.onsIfPlatform.toLowerCase()===platform.toLowerCase()?element.css("display","block"):element.css("display","none")}attrs.$observe("onsIfPlatform",function(userPlatform){userPlatform&&update()}),update(),$onsen.cleaner.onDestroy(scope,function(){$onsen.clearComponent({element:element,scope:scope,attrs:attrs}),element=scope=attrs=null})}}}}])}(),function(){"use strict";var module=angular.module("onsen"),compileFunction=function(show,$onsen){return function(){return function(scope,element,attrs){var dispShow=show?"block":"none",dispHide=show?"none":"block",onShow=function(){element.css("display",dispShow)},onHide=function(){element.css("display",dispHide)},onInit=function(e){e.visible?onShow():onHide()};ons.softwareKeyboard.on("show",onShow),ons.softwareKeyboard.on("hide",onHide),ons.softwareKeyboard.on("init",onInit),ons.softwareKeyboard._visible?onShow():onHide(),$onsen.cleaner.onDestroy(scope,function(){ons.softwareKeyboard.off("show",onShow),ons.softwareKeyboard.off("hide",onHide),ons.softwareKeyboard.off("init",onInit),$onsen.clearComponent({element:element,scope:scope,attrs:attrs}),element=scope=attrs=null})}}};module.directive("onsKeyboardActive",["$onsen",function($onsen){return{restrict:"A",replace:!1,transclude:!1,scope:!1,compile:compileFunction(!0,$onsen)}}]),module.directive("onsKeyboardInactive",["$onsen",function($onsen){return{restrict:"A",replace:!1,transclude:!1,scope:!1,compile:compileFunction(!1,$onsen)}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsLazyRepeat",["$onsen","LazyRepeatView",function($onsen,LazyRepeatView){return{restrict:"A",replace:!1,priority:1e3,transclude:"element",compile:function(element,attrs,linker){return function(scope,element,attrs){new LazyRepeatView(scope,element,attrs,linker);scope.$on("$destroy",function(){scope=element=attrs=linker=null})}}}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsList",["$onsen","GenericView",function($onsen,GenericView){return{restrict:"E",scope:!1,replace:!1,transclude:!1,compile:function(){return function(scope,element,attrs){var list=new GenericView(scope,element,attrs);$onsen.declareVarAttribute(attrs,list),element.data("ons-list",list),scope.$on("$destroy",function(){list._events=void 0,$onsen.removeModifierMethods(list),element.data("ons-list",void 0),element=null});var templater=$onsen.generateModifierTemplater(attrs);element.addClass("list ons-list-inner"),element.addClass(templater("list--*")),$onsen.addModifierMethods(list,"list--*",element),$onsen.fireComponentEvent(element[0],"init")}}}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsListHeader",["$onsen","GenericView",function($onsen,GenericView){return{restrict:"E",replace:!1,transclude:!1,compile:function(){return function(scope,element,attrs){var listHeader=new GenericView(scope,element,attrs);$onsen.declareVarAttribute(attrs,listHeader),element.data("ons-listHeader",listHeader),scope.$on("$destroy",function(){listHeader._events=void 0,$onsen.removeModifierMethods(listHeader),element.data("ons-listHeader",void 0),element=null});var templater=$onsen.generateModifierTemplater(attrs);element.addClass("list__header ons-list-header-inner"),element.addClass(templater("list__header--*")),$onsen.addModifierMethods(listHeader,"list__header--*",element),$onsen.fireComponentEvent(element[0],"init")}}}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsListItem",["$onsen","GenericView",function($onsen,GenericView){return{restrict:"E",replace:!1,transclude:!1,compile:function(){return function(scope,element,attrs){var listItem=new GenericView(scope,element,attrs);$onsen.declareVarAttribute(attrs,listItem),element.data("ons-list-item",listItem),scope.$on("$destroy",function(){listItem._events=void 0,$onsen.removeModifierMethods(listItem),element.data("ons-list-item",void 0),element=null});var templater=$onsen.generateModifierTemplater(attrs);element.addClass("list__item ons-list-item-inner"),element.addClass(templater("list__item--*")),$onsen.addModifierMethods(listItem,"list__item--*",element),$onsen.fireComponentEvent(element[0],"init")}}}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsLoadingPlaceholder",["$onsen","$compile",function($onsen,$compile){return{restrict:"A",replace:!1,transclude:!1,scope:!1,link:function(scope,element,attrs){if(!attrs.onsLoadingPlaceholder.length)throw Error("Must define page to load.");setImmediate(function(){$onsen.getPageHTMLAsync(attrs.onsLoadingPlaceholder).then(function(html){html=html.trim().replace(/^<ons-page>/,"").replace(/<\/ons-page>$/,"");var div=document.createElement("div");div.innerHTML=html;var newElement=angular.element(div);newElement.css("display","none"),element.append(newElement),$compile(newElement)(scope);for(var i=element[0].childNodes.length-1;i>=0;i--){var e=element[0].childNodes[i];e!==div&&element[0].removeChild(e)}newElement.css("display","block")})})}}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsModal",["$onsen","ModalView",function($onsen,ModalView){function compile(element,attrs){var modifierTemplater=$onsen.generateModifierTemplater(attrs),html=element[0].innerHTML;element[0].innerHTML="";var wrapper=angular.element("<div></div>");wrapper.addClass("modal__content"),wrapper.addClass(modifierTemplater("modal--*__content")),element.css("display","none"),element.addClass("modal"),element.addClass(modifierTemplater("modal--*")),wrapper[0].innerHTML=html,element.append(wrapper)}return{restrict:"E",replace:!1,scope:!1,transclude:!1,compile:function(element,attrs){return compile(element,attrs),{pre:function(scope,element,attrs){var page=element.inheritedData("ons-page");page&&page.registerExtraElement(element);var modal=new ModalView(scope,element);$onsen.addModifierMethods(modal,"modal--*",element),$onsen.addModifierMethods(modal,"modal--*__content",element.children()),$onsen.declareVarAttribute(attrs,modal),element.data("ons-modal",modal),scope.$on("$destroy",function(){modal._events=void 0,$onsen.removeModifierMethods(modal),element.data("ons-modal",void 0)})},post:function(scope,element){$onsen.fireComponentEvent(element[0],"init")}}}}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsNavigator",["$compile","NavigatorView","$onsen",function($compile,NavigatorView,$onsen){return{restrict:"E",transclude:!1,scope:!0,compile:function(element){var html=$onsen.normalizePageHTML(element.html());return element.contents().remove(),{pre:function(scope,element,attrs){var navigator=new NavigatorView(scope,element,attrs);if($onsen.declareVarAttribute(attrs,navigator),$onsen.registerEventHandlers(navigator,"prepush prepop postpush postpop destroy"),attrs.page)navigator.pushPage(attrs.page,{});else{var pageScope=navigator._createPageScope(),pageElement=angular.element(html),linkScope=$compile(pageElement),link=function(){linkScope(pageScope)};navigator._pushPageDOM("",pageElement,link,pageScope,{}),pageElement=null}element.data("ons-navigator",navigator),element.data("_scope",scope),scope.$on("$destroy",function(){element.data("_scope",void 0),navigator._events=void 0,element.data("ons-navigator",void 0),element=null})},post:function(scope,element){$onsen.fireComponentEvent(element[0],"init")}}}}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsPage",["$onsen","PageView",function($onsen,PageView){function firePageInitEvent(element){var i=0,f=function(){if(!(i++<5))throw new Error('Fail to fire "pageinit" event. Attach "ons-page" element to the document after initialization.');isAttached(element)?(fillStatusBar(element),$onsen.fireComponentEvent(element,"init"),fireActualPageInitEvent(element)):setImmediate(f)};f()}function fireActualPageInitEvent(element){var event=document.createEvent("HTMLEvents");event.initEvent("pageinit",!0,!0),element.dispatchEvent(event)}function fillStatusBar(element){if($onsen.shouldFillStatusBar(element)){var fill=angular.element(document.createElement("div"));fill.addClass("page__status-bar-fill"),fill.css({width:"0px",height:"0px"}),angular.element(element).prepend(fill)}}function isAttached(element){return document.documentElement===element?!0:element.parentNode?isAttached(element.parentNode):!1}function preLink(scope,element,attrs){var page=new PageView(scope,element,attrs);$onsen.declareVarAttribute(attrs,page),element.data("ons-page",page);var modifierTemplater=$onsen.generateModifierTemplater(attrs),template="page--*";element.addClass("page "+modifierTemplater(template)),$onsen.addModifierMethods(page,template,element);var pageContent=angular.element(element[0].querySelector(".page__content"));pageContent.addClass(modifierTemplater("page--*__content")),pageContent=null;var pageBackground=angular.element(element[0].querySelector(".page__background"));pageBackground.addClass(modifierTemplater("page--*__background")),pageBackground=null,element.data("_scope",scope),$onsen.cleaner.onDestroy(scope,function(){element.data("_scope",void 0),page._events=void 0,$onsen.removeModifierMethods(page),element.data("ons-page",void 0),$onsen.clearComponent({element:element,scope:scope,attrs:attrs}),scope=element=attrs=null})}function postLink(scope,element){firePageInitEvent(element[0])}return{restrict:"E",transclude:!1,scope:!1,compile:function(element){var children=element.children().remove(),content=angular.element('<div class="page__content ons-page-inner"></div>').append(children),background=angular.element('<div class="page__background"></div>');if(element.attr("style")&&(background.attr("style",element.attr("style")),element.attr("style","")),element.append(background),Modernizr.csstransforms3d)element.append(content);else{content.css("overflow","visible");var wrapper=angular.element("<div></div>");wrapper.append(children),content.append(wrapper),element.append(content),wrapper=null;var scroller=new IScroll(content[0],{momentum:!0,bounce:!0,hScrollbar:!1,vScrollbar:!1,preventDefault:!1}),offset=10;scroller.on("scrollStart",function(){var scrolled=scroller.y-offset;scrolled<scroller.maxScrollY+40&&scroller.refresh()})}return content=null,background=null,children=null,{pre:preLink,post:postLink}}}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsPopover",["$onsen","PopoverView",function($onsen,PopoverView){return{restrict:"E",replace:!1,transclude:!0,scope:!0,templateUrl:$onsen.DIRECTIVE_TEMPLATE_URL+"/popover.tpl",compile:function(element,attrs,transclude){return{pre:function(scope,element,attrs){transclude(scope,function(clone){angular.element(element[0].querySelector(".popover__content")).append(clone)});var popover=new PopoverView(scope,element,attrs);$onsen.declareVarAttribute(attrs,popover),$onsen.registerEventHandlers(popover,"preshow prehide postshow posthide destroy"),element.data("ons-popover",popover),scope.$on("$destroy",function(){popover._events=void 0,$onsen.removeModifierMethods(popover),element.data("ons-popover",void 0),element=null}),scope.modifierTemplater=$onsen.generateModifierTemplater(attrs),$onsen.addModifierMethods(popover,"popover--*",angular.element(element[0].querySelector(".popover"))),$onsen.addModifierMethods(popover,"popover__content--*",angular.element(element[0].querySelector(".popover__content"))),$onsen.isAndroid()&&setImmediate(function(){popover.addModifier("android")}),scope.direction="up",scope.arrowPosition="bottom"},post:function(scope,element){$onsen.fireComponentEvent(element[0],"init")}}}}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsPullHook",["$onsen","PullHookView",function($onsen,PullHookView){return{restrict:"E",replace:!1,scope:!0,compile:function(){return{pre:function(scope,element,attrs){var pullHook=new PullHookView(scope,element,attrs);$onsen.declareVarAttribute(attrs,pullHook),$onsen.registerEventHandlers(pullHook,"changestate destroy"),element.data("ons-pull-hook",pullHook),scope.$on("$destroy",function(){pullHook._events=void 0,element.data("ons-pull-hook",void 0),scope=element=attrs=null})},post:function(scope,element){$onsen.fireComponentEvent(element[0],"init")}}}}}])}(),function(){"use strict";
var module=angular.module("onsen");module.directive("onsRow",["$onsen","$timeout",function($onsen){return{restrict:"E",replace:!1,transclude:!1,scope:!1,compile:function(element){return element.addClass("row ons-row-inner"),function(scope,element,attrs){function update(){var align=(""+attrs.align).trim();("top"===align||"center"===align||"bottom"===align)&&(element.removeClass("row-bottom row-center row-top"),element.addClass("row-"+align))}attrs.$observe("align",function(){update()}),update(),$onsen.fireComponentEvent(element[0],"init")}}}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsScroller",["$onsen","$timeout",function($onsen,$timeout){return{restrict:"E",replace:!1,transclude:!0,scope:{onScrolled:"&",infinitScrollEnable:"="},compile:function(element){element.addClass("ons-scroller").children().remove();return function(scope,element,attrs,controller,transclude){if(attrs.ngController)throw new Error('"ons-scroller" can\'t accept "ng-controller" directive.');var wrapper=angular.element("<div></div>");wrapper.addClass("ons-scroller__content ons-scroller-inner"),element.append(wrapper),transclude(scope.$parent,function(cloned){wrapper.append(cloned),wrapper=null});var scrollWrapper;scrollWrapper=element[0];var offset=parseInt(attrs.threshold)||10;scope.onScrolled&&scrollWrapper.addEventListener("scroll",function(){if(scope.infinitScrollEnable){var scrollTopAndOffsetHeight=scrollWrapper.scrollTop+scrollWrapper.offsetHeight,scrollHeightMinusOffset=scrollWrapper.scrollHeight-offset;scrollTopAndOffsetHeight>=scrollHeightMinusOffset&&scope.onScrolled()}}),Modernizr.csstransforms3d||$timeout(function(){var iScroll=new IScroll(scrollWrapper,{momentum:!0,bounce:!0,hScrollbar:!1,vScrollbar:!1,preventDefault:!1});iScroll.on("scrollStart",function(){var scrolled=iScroll.y-offset;scrolled<iScroll.maxScrollY+40&&iScroll.refresh()}),scope.onScrolled&&iScroll.on("scrollEnd",function(){var scrolled=iScroll.y-offset;scrolled<iScroll.maxScrollY&&scope.onScrolled()})},500),$onsen.fireComponentEvent(element[0],"init")}}}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsSlidingMenu",["$compile","SlidingMenuView","$onsen",function($compile,SlidingMenuView,$onsen){return{restrict:"E",replace:!1,transclude:!1,scope:!0,compile:function(element){var main=element[0].querySelector(".main"),menu=element[0].querySelector(".menu");if(main)var mainHtml=angular.element(main).remove().html().trim();if(menu)var menuHtml=angular.element(menu).remove().html().trim();return function(scope,element,attrs){if(attrs.ngController)throw new Error("This element can't accept ng-controller directive.");element.append(angular.element("<div></div>").addClass("onsen-sliding-menu__menu ons-sliding-menu-inner")),element.append(angular.element("<div></div>").addClass("onsen-sliding-menu__main ons-sliding-menu-inner"));var slidingMenu=new SlidingMenuView(scope,element,attrs);$onsen.registerEventHandlers(slidingMenu,"preopen preclose postopen postclose destroy"),mainHtml&&!attrs.mainPage&&slidingMenu._appendMainPage(null,mainHtml),menuHtml&&!attrs.menuPage&&slidingMenu._appendMenuPage(menuHtml),$onsen.declareVarAttribute(attrs,slidingMenu),element.data("ons-sliding-menu",slidingMenu),element.data("_scope",scope),scope.$on("$destroy",function(){element.data("_scope",void 0),slidingMenu._events=void 0,element.data("ons-sliding-menu",void 0)}),$onsen.fireComponentEvent(element[0],"init")}}}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsSplitView",["$compile","SplitView","$onsen",function($compile,SplitView,$onsen){return{restrict:"E",replace:!1,transclude:!1,scope:!0,compile:function(element){var mainPage=element[0].querySelector(".main-page"),secondaryPage=element[0].querySelector(".secondary-page");if(mainPage)var mainHtml=angular.element(mainPage).remove().html().trim();if(secondaryPage)var secondaryHtml=angular.element(secondaryPage).remove().html().trim();return function(scope,element,attrs){if(attrs.ngController)throw new Error("This element can't accept ng-controller directive.");element.append(angular.element("<div></div>").addClass("onsen-split-view__secondary full-screen ons-split-view-inner")),element.append(angular.element("<div></div>").addClass("onsen-split-view__main full-screen ons-split-view-inner"));var splitView=new SplitView(scope,element,attrs);mainHtml&&!attrs.mainPage&&splitView._appendMainPage(mainHtml),secondaryHtml&&!attrs.secondaryPage&&splitView._appendSecondPage(secondaryHtml),$onsen.declareVarAttribute(attrs,splitView),$onsen.registerEventHandlers(splitView,"update presplit precollapse postsplit postcollapse destroy"),element.data("ons-split-view",splitView),element.data("_scope",scope),scope.$on("$destroy",function(){element.data("_scope",void 0),splitView._events=void 0,element.data("ons-split-view",void 0)}),$onsen.fireComponentEvent(element[0],"init")}}}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsSwitch",["$onsen","$parse","SwitchView",function($onsen,$parse,SwitchView){return{restrict:"E",replace:!1,transclude:!1,scope:!0,templateUrl:$onsen.DIRECTIVE_TEMPLATE_URL+"/switch.tpl",compile:function(){return function(scope,element,attrs){if(attrs.ngController)throw new Error("This element can't accept ng-controller directive.");var switchView=new SwitchView(element,scope,attrs),checkbox=angular.element(element[0].querySelector("input[type=checkbox]"));scope.modifierTemplater=$onsen.generateModifierTemplater(attrs);var label=element.children(),input=angular.element(label.children()[0]),toggle=angular.element(label.children()[1]);if($onsen.addModifierMethods(switchView,"switch--*",label),$onsen.addModifierMethods(switchView,"switch--*__input",input),$onsen.addModifierMethods(switchView,"switch--*__toggle",toggle),attrs.$observe("checked",function(){scope.model=!!element.attr("checked")}),attrs.$observe("name",function(name){element.attr("name")&&checkbox.attr("name",name)}),attrs.ngModel){var set=$parse(attrs.ngModel).assign;scope.$parent.$watch(attrs.ngModel,function(value){scope.model=value}),scope.$watch("model",function(to,from){set(scope.$parent,to),to!==from&&scope.$eval(attrs.ngChange)})}$onsen.declareVarAttribute(attrs,switchView),element.data("ons-switch",switchView),$onsen.cleaner.onDestroy(scope,function(){switchView._events=void 0,$onsen.removeModifierMethods(switchView),element.data("ons-switch",void 0),$onsen.clearComponent({element:element,scope:scope,attrs:attrs}),checkbox=element=attrs=scope=null}),$onsen.fireComponentEvent(element[0],"init")}}}}])}(),function(){"use strict";function tab($onsen,$compile){return{restrict:"E",transclude:!0,scope:{page:"@",active:"@",icon:"@",activeIcon:"@",label:"@",noReload:"@",persistent:"@"},templateUrl:$onsen.DIRECTIVE_TEMPLATE_URL+"/tab.tpl",compile:function(element){return element.addClass("tab-bar__item"),function(scope,element,attrs,controller,transclude){var tabbarView=element.inheritedData("ons-tabbar");if(!tabbarView)throw new Error("This ons-tab element is must be child of ons-tabbar element.");element.addClass(tabbarView._scope.modifierTemplater("tab-bar--*__item")),element.addClass(tabbarView._scope.modifierTemplater("tab-bar__item--*")),transclude(scope.$parent,function(cloned){var wrapper=angular.element(element[0].querySelector(".tab-bar-inner"));if(attrs.icon||attrs.label||!cloned[0]){var innerElement=angular.element("<div>"+defaultInnerTemplate+"</div>").children();wrapper.append(innerElement),$compile(innerElement)(scope)}else wrapper.append(cloned)});var radioButton=element[0].querySelector("input");scope.tabbarModifierTemplater=tabbarView._scope.modifierTemplater,scope.modifierTemplater=$onsen.generateModifierTemplater(attrs),scope.tabbarId=tabbarView._tabbarId,scope.tabIcon=scope.icon,tabbarView.addTabItem(scope),scope.setActive=function(){element.addClass("active"),radioButton.checked=!0,scope.activeIcon&&(scope.tabIcon=scope.activeIcon),angular.element(element[0].querySelectorAll("[ons-tab-inactive]")).css("display","none"),angular.element(element[0].querySelectorAll("[ons-tab-active]")).css("display","inherit")},scope.setInactive=function(){element.removeClass("active"),radioButton.checked=!1,scope.tabIcon=scope.icon,angular.element(element[0].querySelectorAll("[ons-tab-inactive]")).css("display","inherit"),angular.element(element[0].querySelectorAll("[ons-tab-active]")).css("display","none")},scope.isPersistent=function(){return"undefined"!=typeof scope.persistent},scope.isActive=function(){return element.hasClass("active")},scope.tryToChange=function(){tabbarView.setActiveTab(tabbarView._tabItems.indexOf(scope))},scope.active&&tabbarView.setActiveTab(tabbarView._tabItems.indexOf(scope)),$onsen.fireComponentEvent(element[0],"init")}}}}var module=angular.module("onsen");module.directive("onsTab",tab),module.directive("onsTabbarItem",tab);var defaultInnerTemplate='<div ng-if="icon != undefined" class="tab-bar__icon"><ons-icon icon="{{tabIcon}}" style="font-size: 28px; line-height: 34px; vertical-align: top;"></ons-icon></div><div ng-if="label" class="tab-bar__label">{{label}}</div>';tab.$inject=["$onsen","$compile"]}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsTabbar",["$onsen","$compile","TabbarView",function($onsen,$compile,TabbarView){return{restrict:"E",replace:!1,transclude:!0,scope:!0,templateUrl:$onsen.DIRECTIVE_TEMPLATE_URL+"/tab_bar.tpl",link:function(scope,element,attrs,controller,transclude){scope.modifierTemplater=$onsen.generateModifierTemplater(attrs),scope.selectedTabItem={source:""},attrs.$observe("hideTabs",function(hide){var visible="true"!==hide;tabbarView.setTabbarVisibility(visible)});var tabbarView=new TabbarView(scope,element,attrs);$onsen.addModifierMethods(tabbarView,"tab-bar--*",angular.element(element.children()[1])),$onsen.registerEventHandlers(tabbarView,"reactive prechange postchange destroy"),scope.tabbarId=tabbarView._tabbarId,element.data("ons-tabbar",tabbarView),$onsen.declareVarAttribute(attrs,tabbarView),transclude(scope,function(cloned){angular.element(element[0].querySelector(".ons-tabbar-inner")).append(cloned)}),scope.$on("$destroy",function(){tabbarView._events=void 0,$onsen.removeModifierMethods(tabbarView),element.data("ons-tabbar",void 0)}),$onsen.fireComponentEvent(element[0],"init")}}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsTemplate",["$onsen","$templateCache",function($onsen,$templateCache){return{restrict:"E",transclude:!1,priority:1e3,terminal:!0,compile:function(element){$templateCache.put(element.attr("id"),element.remove().html()),$onsen.fireComponentEvent(element[0],"init")}}}])}(),function(){"use strict";function ensureLeftContainer(element,modifierTemplater){var container=element[0].querySelector(".left");return container||(container=document.createElement("div"),container.setAttribute("class","left"),container.innerHTML=" "),""===container.innerHTML.trim()&&(container.innerHTML=" "),angular.element(container).addClass("navigation-bar__left").addClass(modifierTemplater("navigation-bar--*__left")),container}function ensureCenterContainer(element,modifierTemplater){var container=element[0].querySelector(".center");return container||(container=document.createElement("div"),container.setAttribute("class","center")),""===container.innerHTML.trim()&&(container.innerHTML=" "),angular.element(container).addClass("navigation-bar__title navigation-bar__center").addClass(modifierTemplater("navigation-bar--*__center")),container}function ensureRightContainer(element,modifierTemplater){var container=element[0].querySelector(".right");return container||(container=document.createElement("div"),container.setAttribute("class","right"),container.innerHTML=" "),""===container.innerHTML.trim()&&(container.innerHTML=" "),angular.element(container).addClass("navigation-bar__right").addClass(modifierTemplater("navigation-bar--*__right")),container}function hasCenterClassElementOnly(element){for(var child,hasCenter=!1,hasOther=!1,children=element.contents(),i=0;i<children.length;i++)child=angular.element(children[i]),child.hasClass("center")?hasCenter=!0:(child.hasClass("left")||child.hasClass("right"))&&(hasOther=!0);return hasCenter&&!hasOther}function ensureToolbarItemElements(element,modifierTemplater){var center;if(hasCenterClassElementOnly(element))center=ensureCenterContainer(element,modifierTemplater),element.contents().remove(),element.append(center);else{center=ensureCenterContainer(element,modifierTemplater);var left=ensureLeftContainer(element,modifierTemplater),right=ensureRightContainer(element,modifierTemplater);element.contents().remove(),element.append(angular.element([left,center,right]))}}var module=angular.module("onsen");module.directive("onsToolbar",["$onsen","GenericView",function($onsen,GenericView){return{restrict:"E",replace:!1,scope:!1,transclude:!1,compile:function(element,attrs){var shouldAppendAndroidModifier=ons.platform.isAndroid()&&!element[0].hasAttribute("fixed-style"),modifierTemplater=$onsen.generateModifierTemplater(attrs,shouldAppendAndroidModifier?["android"]:[]),inline="undefined"!=typeof attrs.inline;return element.addClass("navigation-bar"),element.addClass(modifierTemplater("navigation-bar--*")),inline||element.css({position:"absolute","z-index":"10000",left:"0px",right:"0px",top:"0px"}),ensureToolbarItemElements(element,modifierTemplater),{pre:function(scope,element,attrs){var toolbar=new GenericView(scope,element,attrs);$onsen.declareVarAttribute(attrs,toolbar),scope.$on("$destroy",function(){toolbar._events=void 0,$onsen.removeModifierMethods(toolbar),element.data("ons-toolbar",void 0),element=null}),$onsen.addModifierMethods(toolbar,"navigation-bar--*",element),angular.forEach(["left","center","right"],function(position){var el=element[0].querySelector(".navigation-bar__"+position);el&&$onsen.addModifierMethods(toolbar,"navigation-bar--*__"+position,angular.element(el))});var pageView=element.inheritedData("ons-page");pageView&&!inline&&pageView.registerToolbar(element),element.data("ons-toolbar",toolbar)},post:function(scope,element){$onsen.fireComponentEvent(element[0],"init")}}}}}])}(),function(){"use strict";var module=angular.module("onsen");module.directive("onsToolbarButton",["$onsen","GenericView",function($onsen,GenericView){return{restrict:"E",transclude:!0,scope:{},templateUrl:$onsen.DIRECTIVE_TEMPLATE_URL+"/toolbar_button.tpl",link:{pre:function(scope,element,attrs){var toolbarButton=new GenericView(scope,element,attrs),innerElement=element[0].querySelector(".toolbar-button");$onsen.declareVarAttribute(attrs,toolbarButton),element.data("ons-toolbar-button",toolbarButton),scope.$on("$destroy",function(){toolbarButton._events=void 0,$onsen.removeModifierMethods(toolbarButton),element.data("ons-toolbar-button",void 0),element=null});var modifierTemplater=$onsen.generateModifierTemplater(attrs);if(attrs.ngController)throw new Error("This element can't accept ng-controller directive.");attrs.$observe("disabled",function(value){value===!1||"undefined"==typeof value?innerElement.removeAttribute("disabled"):innerElement.setAttribute("disabled","disabled")}),scope.modifierTemplater=$onsen.generateModifierTemplater(attrs),$onsen.addModifierMethods(toolbarButton,"toolbar-button--*",element.children()),element.children("span").addClass(modifierTemplater("toolbar-button--*")),$onsen.cleaner.onDestroy(scope,function(){$onsen.clearComponent({scope:scope,attrs:attrs,element:element}),scope=element=attrs=null})},post:function(scope,element){$onsen.fireComponentEvent(element[0],"init")}}}}])}(),function(){"use strict";var module=angular.module("onsen"),ComponentCleaner={decomposeNode:function(element){for(var children=element.remove().children(),i=0;i<children.length;i++)ComponentCleaner.decomposeNode(angular.element(children[i]))},destroyAttributes:function(attrs){attrs.$$element=null,attrs.$$observers=null},destroyElement:function(element){element.remove()},destroyScope:function(scope){scope.$$listeners={},scope.$$watchers=null,scope=null},onDestroy:function(scope,fn){var clear=scope.$on("$destroy",function(){clear(),fn.apply(null,arguments)})}};module.factory("ComponentCleaner",function(){return ComponentCleaner}),function(){var ngEventDirectives={};"click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" ").forEach(function(name){function directiveNormalize(name){return name.replace(/-([a-z])/g,function(matches){return matches[1].toUpperCase()})}var directiveName=directiveNormalize("ng-"+name);ngEventDirectives[directiveName]=["$parse",function($parse){return{compile:function($element,attr){var fn=$parse(attr[directiveName]);return function(scope,element,attr){var listener=function(event){scope.$apply(function(){fn(scope,{$event:event})})};element.on(name,listener),ComponentCleaner.onDestroy(scope,function(){element.off(name,listener),element=null,ComponentCleaner.destroyScope(scope),scope=null,ComponentCleaner.destroyAttributes(attr),attr=null})}}}}]}),module.config(["$provide",function($provide){var shift=function($delegate){return $delegate.shift(),$delegate};Object.keys(ngEventDirectives).forEach(function(directiveName){$provide.decorator(directiveName+"Directive",["$delegate",shift])})}]),Object.keys(ngEventDirectives).forEach(function(directiveName){module.directive(directiveName,ngEventDirectives[directiveName])})}()}(),function(){"use strict";var util={init:function(){this.ready=!1},addBackButtonListener:function(fn){this._ready?window.document.addEventListener("backbutton",fn,!1):window.document.addEventListener("deviceready",function(){window.document.addEventListener("backbutton",fn,!1)})},removeBackButtonListener:function(fn){this._ready?window.document.removeEventListener("backbutton",fn,!1):window.document.addEventListener("deviceready",function(){window.document.removeEventListener("backbutton",fn,!1)})}};util.init(),angular.module("onsen").service("DeviceBackButtonHandler",function(){this._init=function(){window.ons.isWebView()?window.document.addEventListener("deviceready",function(){util._ready=!0},!1):util._ready=!0,this._bindedCallback=this._callback.bind(this),this.enable()},this._isEnabled=!1,this.enable=function(){this._isEnabled||(util.addBackButtonListener(this._bindedCallback),this._isEnabled=!0)},this.disable=function(){this._isEnabled&&(util.removeBackButtonListener(this._bindedCallback),this._isEnabled=!1)},this.fireDeviceBackButtonEvent=function(){var event=document.createEvent("Event");event.initEvent("backbutton",!0,!0),document.dispatchEvent(event)},this._callback=function(){this._dispatchDeviceBackButtonEvent()},this.create=function(element,callback){if(!(element instanceof angular.element().constructor))throw new Error("element must be an instance of jqLite");if(!(callback instanceof Function))throw new Error("callback must be an instance of Function");var handler={_callback:callback,_element:element,disable:function(){this._element.data("device-backbutton-handler",null)},setListener:function(callback){this._callback=callback},enable:function(){this._element.data("device-backbutton-handler",this)},isEnabled:function(){return this._element.data("device-backbutton-handler")===this},destroy:function(){this._element.data("device-backbutton-handler",null),this._callback=this._element=null}};return handler.enable(),handler},this._dispatchDeviceBackButtonEvent=function(){function createEvent(element){return{_element:element,callParentHandler:function(){for(var parent=this._element.parent();parent[0];){if(handler=parent.data("device-backbutton-handler"))return handler._callback(createEvent(parent));parent=parent.parent()}}}}var tree=this._captureTree(),element=this._findHandlerLeafElement(tree),handler=element.data("device-backbutton-handler");handler._callback(createEvent(element))},this._dumpParents=function(element){for(;element[0];)console.log(element[0].nodeName.toLowerCase()+"."+element.attr("class")),element=element.parent()},this._captureTree=function(){function createTree(element){return{element:element,children:Array.prototype.concat.apply([],Array.prototype.map.call(element.children(),function(child){if(child=angular.element(child),"none"===child[0].style.display)return[];if(0===child.children().length&&!child.data("device-backbutton-handler"))return[];var result=createTree(child);return 0!==result.children.length||child.data("device-backbutton-handler")?[result]:[]}))}}return createTree(angular.element(document.body))},this._dumpTree=function(node){function _dump(node,level){var pad=new Array(level+1).join(" ");console.log(pad+node.element[0].nodeName.toLowerCase()),node.children.forEach(function(node){_dump(node,level+1)})}_dump(node,0)},this._findHandlerLeafElement=function(tree){function find(node){return 0===node.children.length?node.element:1===node.children.length?find(node.children[0]):node.children.map(function(childNode){return childNode.element}).reduce(function(left,right){if(null===left)return right;var leftZ=parseInt(window.getComputedStyle(left[0],"").zIndex,10),rightZ=parseInt(window.getComputedStyle(right[0],"").zIndex,10);if(!isNaN(leftZ)&&!isNaN(rightZ))return leftZ>rightZ?left:right;throw new Error("Capturing backbutton-handler is failure.")},null)}return find(tree)},this._init()})}(),function(){"use strict";var module=angular.module("onsen");module.factory("$onsen",["$rootScope","$window","$cacheFactory","$document","$templateCache","$http","$q","$onsGlobal","ComponentCleaner","DeviceBackButtonHandler",function($rootScope,$window,$cacheFactory,$document,$templateCache,$http,$q,$onsGlobal,ComponentCleaner,DeviceBackButtonHandler){function createOnsenService(){return{DIRECTIVE_TEMPLATE_URL:"templates",cleaner:ComponentCleaner,DeviceBackButtonHandler:DeviceBackButtonHandler,_defaultDeviceBackButtonHandler:DeviceBackButtonHandler.create(angular.element(document.body),function(){navigator.app.exitApp()}),getDefaultDeviceBackButtonHandler:function(){return this._defaultDeviceBackButtonHandler},isEnabledAutoStatusBarFill:function(){return!!$onsGlobal._config.autoStatusBarFill},shouldFillStatusBar:function(element){if(this.isEnabledAutoStatusBarFill()&&this.isWebView()&&this.isIOS7Above()){if(!(element instanceof HTMLElement))throw new Error("element must be an instance of HTMLElement");for(var debug="ONS-TABBAR"===element.tagName?console.log.bind(console):angular.noop;;){if(element.hasAttribute("no-status-bar-fill"))return!1;if(element=element.parentNode,debug(element),!element||!element.hasAttribute)return!0}}return!1},clearComponent:function(params){params.scope&&ComponentCleaner.destroyScope(params.scope),params.attrs&&ComponentCleaner.destroyAttributes(params.attrs),params.element&&ComponentCleaner.destroyElement(params.element),params.elements&¶ms.elements.forEach(function(element){ComponentCleaner.destroyElement(element)})},upTo:function(el,tagName){tagName=tagName.toLowerCase();do{if(!el)return null;if(el=el.parentNode,el.tagName.toLowerCase()==tagName)return el}while(el.parentNode);return null},waitForVariables:function(dependencies,callback){unlockerDict.addCallback(dependencies,callback)},findElementeObject:function(element,name){return element.inheritedData(name)},getPageHTMLAsync:function(page){var cache=$templateCache.get(page);if(cache){var deferred=$q.defer(),html="string"==typeof cache?cache:cache[1];return deferred.resolve(this.normalizePageHTML(html)),deferred.promise}return $http({url:page,method:"GET"}).then(function(response){var html=response.data;return this.normalizePageHTML(html)}.bind(this))},normalizePageHTML:function(html){return html=(""+html).trim(),html.match(/^<(ons-page|ons-navigator|ons-tabbar|ons-sliding-menu|ons-split-view)/)||(html="<ons-page>"+html+"</ons-page>"),html},generateModifierTemplater:function(attrs,modifiers){var attrModifiers=attrs&&"string"==typeof attrs.modifier?attrs.modifier.trim().split(/ +/):[];return modifiers=angular.isArray(modifiers)?attrModifiers.concat(modifiers):attrModifiers,function(template){return modifiers.map(function(modifier){return template.replace("*",modifier)}).join(" ")}},addModifierMethods:function(view,template,element){var _tr=function(modifier){return template.replace("*",modifier)},fns={hasModifier:function(modifier){return element.hasClass(_tr(modifier))},removeModifier:function(modifier){element.removeClass(_tr(modifier))},addModifier:function(modifier){element.addClass(_tr(modifier))},setModifier:function(modifier){for(var classes=element.attr("class").split(/\s+/),patt=template.replace("*","."),i=0;i<classes.length;i++){var cls=classes[i];cls.match(patt)&&element.removeClass(cls)}element.addClass(_tr(modifier))},toggleModifier:function(modifier){var cls=_tr(modifier);element.hasClass(cls)?element.removeClass(cls):element.addClass(cls)}},append=function(oldFn,newFn){return"undefined"!=typeof oldFn?function(){return oldFn.apply(null,arguments)||newFn.apply(null,arguments)}:newFn};view.hasModifier=append(view.hasModifier,fns.hasModifier),view.removeModifier=append(view.removeModifier,fns.removeModifier),view.addModifier=append(view.addModifier,fns.addModifier),view.setModifier=append(view.setModifier,fns.setModifier),view.toggleModifier=append(view.toggleModifier,fns.toggleModifier)},removeModifierMethods:function(view){view.hasModifier=view.removeModifier=view.addModifier=view.setModifier=view.toggleModifier=void 0},declareVarAttribute:function(attrs,object){if("string"==typeof attrs["var"]){var varName=attrs["var"];this._defineVar(varName,object),unlockerDict.unlockVarName(varName)}},_registerEventHandler:function(component,eventName){var capitalizedEventName=eventName.charAt(0).toUpperCase()+eventName.slice(1);component.on(eventName,function(event){$onsen.fireComponentEvent(component._element[0],eventName,event);var handler=component._attrs["ons"+capitalizedEventName];handler&&(component._scope.$eval(handler,{$event:event}),component._scope.$evalAsync())})},registerEventHandlers:function(component,eventNames){eventNames=eventNames.trim().split(/\s+/);for(var i=0,l=eventNames.length;l>i;i++){var eventName=eventNames[i];this._registerEventHandler(component,eventName)}},isAndroid:function(){return!!window.navigator.userAgent.match(/android/i)},isIOS:function(){return!!window.navigator.userAgent.match(/(ipad|iphone|ipod touch)/i)},isWebView:function(){return window.ons.isWebView()},isIOS7Above:function(){var ua=window.navigator.userAgent,match=ua.match(/(iPad|iPhone|iPod touch);.*CPU.*OS (\d+)_(\d+)/i),result=match?parseFloat(match[2]+"."+match[3])>=7:!1;return function(){return result}}(),fireComponentEvent:function(dom,eventName,data){data=data||{};var event=document.createEvent("HTMLEvents");for(var key in data)data.hasOwnProperty(key)&&(event[key]=data[key]);event.component=dom?angular.element(dom).data(dom.nodeName.toLowerCase())||null:null,event.initEvent(dom.nodeName.toLowerCase()+":"+eventName,!0,!0),dom.dispatchEvent(event)},_defineVar:function(name,object){function set(container,names,object){for(var name,i=0;i<names.length-1;i++)name=names[i],(void 0===container[name]||null===container[name])&&(container[name]={}),container=container[name];if(container[names[names.length-1]]=object,container[names[names.length-1]]!==object)throw new Error('Cannot set var="'+object._attrs.var+'" because it will overwrite a read-only variable.')}var names=name.split(/\./);ons.componentBase&&set(ons.componentBase,names,object),set($rootScope,names,object)}}}function createUnlockerDict(){return{_unlockersDict:{},_unlockedVarDict:{},_addVarLock:function(name,unlocker){if(!(unlocker instanceof Function))throw new Error("unlocker argument must be an instance of Function.");this._unlockersDict[name]?this._unlockersDict[name].push(unlocker):this._unlockersDict[name]=[unlocker]},unlockVarName:function(varName){var unlockers=this._unlockersDict[varName];unlockers&&unlockers.forEach(function(unlock){unlock()}),this._unlockedVarDict[varName]=!0},addCallback:function(dependencies,callback){if(!(callback instanceof Function))throw new Error("callback argument must be an instance of Function.");var doorLock=new DoorLock,self=this;dependencies.forEach(function(varName){if(!self._unlockedVarDict[varName]){var unlock=doorLock.lock();self._addVarLock(varName,unlock)}}),doorLock.isLocked()?doorLock.waitUnlock(callback):callback()}}}var unlockerDict=createUnlockerDict(),$onsen=createOnsenService();return $onsen}])}(),window.animit=function(){"use strict";var Animit=function(element){if(!(this instanceof Animit))return new Animit(element);if(element instanceof HTMLElement)this.elements=[element];else{if("[object Array]"!==Object.prototype.toString.call(element))throw new Error("First argument must be an array or an instance of HTMLElement.");this.elements=element}this.transitionQueue=[],this.lastStyleAttributeDict=[];var self=this;this.elements.forEach(function(element,index){element.hasAttribute("data-animit-orig-style")?self.lastStyleAttributeDict[index]=element.getAttribute("data-animit-orig-style"):(self.lastStyleAttributeDict[index]=element.getAttribute("style"),element.setAttribute("data-animit-orig-style",self.lastStyleAttributeDict[index]||""))})};Animit.prototype={transitionQueue:void 0,element:void 0,play:function(callback){return"function"==typeof callback&&this.transitionQueue.push(function(done){callback(),done()}),this.startAnimation(),this},queue:function(transition,options){var queue=this.transitionQueue;if(transition&&options&&(options.css=transition,transition=new Animit.Transition(options)),transition instanceof Function||transition instanceof Animit.Transition||(transition=transition.css?new Animit.Transition(transition):new Animit.Transition({css:transition})),transition instanceof Function)queue.push(transition);else{if(!(transition instanceof Animit.Transition))throw new Error("Invalid arguments");queue.push(transition.build())}return this},wait:function(seconds){return this.transitionQueue.push(function(done){setTimeout(done,1e3*seconds)}),this},resetStyle:function(options){function reset(){self.elements.forEach(function(element,index){element.style[Animit.prefix+"Transition"]="none",element.style.transition="none",self.lastStyleAttributeDict[index]?element.setAttribute("style",self.lastStyleAttributeDict[index]):(element.setAttribute("style",""),element.removeAttribute("style"))})}options=options||{};var self=this;if(options.transition&&!options.duration)throw new Error('"options.duration" is required when "options.transition" is enabled.');if(options.transition||options.duration&&options.duration>0){var transitionValue=options.transition||"all "+options.duration+"s "+(options.timing||"linear"),transitionStyle="transition: "+transitionValue+"; -"+Animit.prefix+"-transition: "+transitionValue+";";this.transitionQueue.push(function(done){var elements=this.elements;elements.forEach(function(element,index){element.style[Animit.prefix+"Transition"]=transitionValue,element.style.transition=transitionValue;var styleValue=(self.lastStyleAttributeDict[index]?self.lastStyleAttributeDict[index]+"; ":"")+transitionStyle;element.setAttribute("style",styleValue)});var removeListeners=util.addOnTransitionEnd(elements[0],function(){clearTimeout(timeoutId),reset(),done()}),timeoutId=setTimeout(function(){removeListeners(),reset(),done()},1e3*options.duration*1.4)})}else this.transitionQueue.push(function(done){reset(),done()});return this},startAnimation:function(){return this._dequeueTransition(),this},_dequeueTransition:function(){var transition=this.transitionQueue.shift();if(this._currentTransition)throw new Error("Current transition exists.");this._currentTransition=transition;var self=this,called=!1,done=function(){if(called)throw new Error("Invalid state: This callback is called twice.");called=!0,self._currentTransition=void 0,self._dequeueTransition()};transition&&transition.call(this,done)
}},Animit.cssPropertyDict=function(){var styles=window.getComputedStyle(document.documentElement,""),dict={},a="A".charCodeAt(0),z="z".charCodeAt(0);for(var key in styles)if(styles.hasOwnProperty(key)){{key.charCodeAt(0)}a<=key.charCodeAt(0)&&z>=key.charCodeAt(0)&&"cssText"!==key&&"parentText"!==key&&"length"!==key&&(dict[key]=!0)}return dict}(),Animit.hasCssProperty=function(name){return!!Animit.cssPropertyDict[name]},Animit.prefix=function(){var styles=window.getComputedStyle(document.documentElement,""),pre=(Array.prototype.slice.call(styles).join("").match(/-(moz|webkit|ms)-/)||""===styles.OLink&&["","o"])[1];return pre}(),Animit.runAll=function(){for(var i=0;i<arguments.length;i++)arguments[i].play()},Animit.Transition=function(options){this.options=options||{},this.options.duration=this.options.duration||0,this.options.timing=this.options.timing||"linear",this.options.css=this.options.css||{},this.options.property=this.options.property||"all"},Animit.Transition.prototype={build:function(){function createActualCssProps(css){var result={};return Object.keys(css).forEach(function(name){var value=css[name];name=util.normalizeStyleName(name);var prefixed=Animit.prefix+util.capitalize(name);Animit.cssPropertyDict[name]?result[name]=value:Animit.cssPropertyDict[prefixed]?result[prefixed]=value:(result[prefixed]=value,result[name]=value)}),result}if(0===Object.keys(this.options.css).length)throw new Error("options.css is required.");var css=createActualCssProps(this.options.css);if(this.options.duration>0){var transitionValue=util.buildTransitionValue(this.options),self=this;return function(callback){var elements=this.elements,timeout=1e3*self.options.duration*1.4,removeListeners=util.addOnTransitionEnd(elements[0],function(){clearTimeout(timeoutId),callback()}),timeoutId=setTimeout(function(){removeListeners(),callback()},timeout);elements.forEach(function(element){element.style[Animit.prefix+"Transition"]=transitionValue,element.style.transition=transitionValue,Object.keys(css).forEach(function(name){element.style[name]=css[name]})})}}return this.options.duration<=0?function(callback){var elements=this.elements;elements.forEach(function(element){element.style[Animit.prefix+"Transition"]="none",element.transition="none",Object.keys(css).forEach(function(name){element.style[name]=css[name]})}),elements.length&&elements[0].offsetHeight,window.requestAnimationFrame?requestAnimationFrame(callback):setTimeout(callback,1e3/30)}:void 0}};var util={normalizeStyleName:function(name){return name=name.replace(/-[a-zA-Z]/g,function(all){return all.slice(1).toUpperCase()}),name.charAt(0).toLowerCase()+name.slice(1)},capitalize:function(str){return str.charAt(0).toUpperCase()+str.slice(1)},buildTransitionValue:function(params){params.property=params.property||"all",params.duration=params.duration||.4,params.timing=params.timing||"linear";var props=params.property.split(/ +/);return props.map(function(prop){return prop+" "+params.duration+"s "+params.timing}).join(", ")},addOnTransitionEnd:function(element,callback){if(!element)return function(){};var fn=function(event){element==event.target&&(event.stopPropagation(),removeListeners(),callback())},removeListeners=function(){util._transitionEndEvents.forEach(function(eventName){element.removeEventListener(eventName,fn)})};return util._transitionEndEvents.forEach(function(eventName){element.addEventListener(eventName,fn,!1)}),removeListeners},_transitionEndEvents:function(){return"webkit"===Animit.prefix||"o"===Animit.prefix||"moz"===Animit.prefix||"ms"===Animit.prefix?[Animit.prefix+"TransitionEnd","transitionend"]:["transitionend"]}()};return Animit}(),window.ons.notification=function(){var createAlertDialog=function(title,message,buttonLabels,primaryButtonIndex,modifier,animation,callback,messageIsHTML,cancelable,promptDialog,autofocus,placeholder){var inputEl,dialogEl=angular.element("<ons-alert-dialog>"),titleEl=angular.element("<div>").addClass("alert-dialog-title").text(title),messageEl=angular.element("<div>").addClass("alert-dialog-content"),footerEl=angular.element("<div>").addClass("alert-dialog-footer");modifier&&dialogEl.attr("modifier",modifier),dialogEl.attr("animation",animation),messageIsHTML?messageEl.html(message):messageEl.text(message),dialogEl.append(titleEl).append(messageEl),promptDialog&&(inputEl=angular.element("<input>").addClass("text-input").attr("placeholder",placeholder).css({width:"100%",marginTop:"10px"}),messageEl.append(inputEl)),dialogEl.append(footerEl),angular.element(document.body).append(dialogEl),ons.$compile(dialogEl)(dialogEl.injector().get("$rootScope"));var alertDialog=dialogEl.data("ons-alert-dialog");buttonLabels.length<=2&&footerEl.addClass("alert-dialog-footer--one");for(var createButton=function(i){var buttonEl=angular.element("<button>").addClass("alert-dialog-button").text(buttonLabels[i]);i==primaryButtonIndex&&buttonEl.addClass("alert-dialog-button--primal"),buttonLabels.length<=2&&buttonEl.addClass("alert-dialog-button--one"),buttonEl.on("click",function(){buttonEl.off("click"),alertDialog.hide({callback:function(){promptDialog?callback(inputEl.val()):callback(i),alertDialog.destroy(),alertDialog=inputEl=buttonEl=null}})}),footerEl.append(buttonEl)},i=0;i<buttonLabels.length;i++)createButton(i);cancelable&&(alertDialog.setCancelable(cancelable),alertDialog.on("cancel",function(){promptDialog?callback(null):callback(-1),setTimeout(function(){alertDialog.destroy(),alertDialog=null,inputEl=null})})),alertDialog.show({callback:function(){promptDialog&&autofocus&&inputEl[0].focus()}}),dialogEl=titleEl=messageEl=footerEl=null};return{alert:function(options){var defaults={buttonLabel:"OK",animation:"default",title:"Alert",callback:function(){}};if(options=angular.extend({},defaults,options),!options.message&&!options.messageHTML)throw new Error("Alert dialog must contain a message.");createAlertDialog(options.title,options.message||options.messageHTML,[options.buttonLabel],0,options.modifier,options.animation,options.callback,options.message?!1:!0,!1,!1,!1)},confirm:function(options){var defaults={buttonLabels:["Cancel","OK"],primaryButtonIndex:1,animation:"default",title:"Confirm",callback:function(){},cancelable:!1};if(options=angular.extend({},defaults,options),!options.message&&!options.messageHTML)throw new Error("Confirm dialog must contain a message.");createAlertDialog(options.title,options.message||options.messageHTML,options.buttonLabels,options.primaryButtonIndex,options.modifier,options.animation,options.callback,options.message?!1:!0,options.cancelable,!1,!1)},prompt:function(options){var defaults={buttonLabel:"OK",animation:"default",title:"Alert",placeholder:"",callback:function(){},cancelable:!1,autofocus:!0};if(options=angular.extend({},defaults,options),!options.message&&!options.messageHTML)throw new Error("Prompt dialog must contain a message.");createAlertDialog(options.title,options.message||options.messageHTML,[options.buttonLabel],0,options.modifier,options.animation,options.callback,options.message?!1:!0,options.cancelable,!0,options.autofocus,options.placeholder)}}}(),window.ons.orientation=function(){function create(){var obj={_isPortrait:!1,isPortrait:function(){return this._isPortrait()},isLandscape:function(){return!this.isPortrait()},_init:function(){return document.addEventListener("DOMContentLoaded",this._onDOMContentLoaded.bind(this),!1),"orientation"in window?window.addEventListener("orientationchange",this._onOrientationChange.bind(this),!1):window.addEventListener("resize",this._onResize.bind(this),!1),this._isPortrait=function(){return window.innerHeight>window.innerWidth},this},_onDOMContentLoaded:function(){this._installIsPortraitImplementation(),this.emit("change",{isPortrait:this.isPortrait()})},_installIsPortraitImplementation:function(){var isPortrait=window.innerWidth<window.innerHeight;this._isPortrait="orientation"in window?window.orientation%180===0?function(){return 0===Math.abs(window.orientation%180)?isPortrait:!isPortrait}:function(){return 90===Math.abs(window.orientation%180)?isPortrait:!isPortrait}:function(){return window.innerHeight>window.innerWidth}},_onOrientationChange:function(){var isPortrait=this._isPortrait(),nIter=0,interval=setInterval(function(){nIter++;var w=window.innerWidth,h=window.innerHeight;isPortrait&&h>=w||!isPortrait&&w>=h?(this.emit("change",{isPortrait:isPortrait}),clearInterval(interval)):50===nIter&&(this.emit("change",{isPortrait:isPortrait}),clearInterval(interval))}.bind(this),20)},_onResize:function(){this.emit("change",{isPortrait:this.isPortrait()})}};return MicroEvent.mixin(obj),obj}return create()._init()}(),function(){"use strict";window.ons.platform={isWebView:function(){return ons.isWebView()},isIOS:function(){return/iPhone|iPad|iPod/i.test(navigator.userAgent)},isAndroid:function(){return/Android/i.test(navigator.userAgent)},isIPhone:function(){return/iPhone/i.test(navigator.userAgent)},isIPad:function(){return/iPad/i.test(navigator.userAgent)},isBlackBerry:function(){return/BlackBerry|RIM Tablet OS|BB10/i.test(navigator.userAgent)},isOpera:function(){return!!window.opera||navigator.userAgent.indexOf(" OPR/")>=0},isFirefox:function(){return"undefined"!=typeof InstallTrigger},isSafari:function(){return Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0},isChrome:function(){return!!window.chrome&&!(window.opera||navigator.userAgent.indexOf(" OPR/")>=0)},isIE:function(){return!1||!!document.documentMode},isIOS7above:function(){if(/iPhone|iPad|iPod/i.test(navigator.userAgent)){var ver=(navigator.userAgent.match(/\b[0-9]+_[0-9]+(?:_[0-9]+)?\b/)||[""])[0].replace(/_/g,".");return parseInt(ver.split(".")[0])>=7}return!1}}}(),function(){"use strict";window.addEventListener("load",function(){FastClick.attach(document.body)},!1),(new Viewport).setup(),Modernizr.testStyles("#modernizr { -webkit-overflow-scrolling:touch }",function(elem){Modernizr.addTest("overflowtouch",window.getComputedStyle&&"touch"==window.getComputedStyle(elem).getPropertyValue("-webkit-overflow-scrolling"))}),window.jQuery&&angular.element===window.jQuery&&console.warn("Onsen UI require jqLite. Load jQuery after loading AngularJS to fix this error. jQuery may break Onsen UI behavior.")}(),function(){"use strict";angular.module("onsen").run(["$templateCache",function($templateCache){for(var templates=window.document.querySelectorAll('script[type="text/ons-template"]'),i=0;i<templates.length;i++){var template=angular.element(templates[i]),id=template.attr("id");"string"==typeof id&&$templateCache.put(id,template.text())}}])}(); |
packages/mui-icons-material/lib/esm/WifiCallingRounded.js | oliviertassinari/material-ui | import createSvgIcon from './utils/createSvgIcon';
import { jsx as _jsx } from "react/jsx-runtime";
export default createSvgIcon([/*#__PURE__*/_jsx("path", {
d: "M22 4.95C21.79 4.78 19.67 3 16.5 3c-3.18 0-5.29 1.78-5.5 1.95L16.5 12 22 4.95z"
}, "0"), /*#__PURE__*/_jsx("path", {
d: "m19.2 15.28-2.54-.29c-.61-.07-1.21.14-1.64.57l-1.84 1.84c-2.83-1.44-5.15-3.75-6.59-6.59l1.85-1.85c.43-.43.64-1.04.57-1.64L8.72 4.8c-.12-1.01-.97-1.77-1.99-1.77H5c-1.13 0-2.07.94-2 2.07.53 8.54 7.36 15.37 15.9 15.9 1.13.07 2.07-.87 2.07-2v-1.73c0-1.02-.76-1.87-1.77-1.99z"
}, "1")], 'WifiCallingRounded'); |
app/components/AllVsAllTable/index.js | FilipPyrek/school-project-match-generator | // @flow
import React from 'react';
import type { Match, Result } from '../../lib/competitionGenerator/allVsAllGenerator';
import { muiTheme } from '../../containers/Theme';
type AllVsAllTableType = {
generatorResult: Result
};
export default function AllVsAllTable(props: AllVsAllTableType) {
const { generatorResult } = props;
const containerStyle = {
border: '1px solid',
boxSizing: 'border-box',
borderColor: muiTheme.palette.primary1Color,
width: '100%',
textAlign: 'center',
padding: '1vmin 2vmin 2vmin 0',
};
const tdStyle = {
border: '1px solid',
borderColor: muiTheme.palette.primary1Color,
padding: '4px',
};
return (
<div>
{Array(generatorResult.tablesAllVsAll.length).fill(0).map((_, i) =>
<div key={i} style={containerStyle}>
<table style={{ width: '100%', borderCollapse: 'collapse' }}>
<tbody>
<tr>
<th
colSpan={generatorResult.tablesAllVsAll[i].length + 1}
style={{ lineHeight: '4vmin' }}
>
{i + 1}. kolo
</th>
</tr>
<tr>
<th />
{Array(generatorResult.tablesAllVsAll[i].length).fill(0).map((__, j) => {
const team = generatorResult.input.teams[j];
return (
<th key={j}>
{team.name}
</th>
);
})}
</tr>
{Array(generatorResult.tablesAllVsAll[i].length).fill(0).map((__, j) =>
// Foreach line in table
<tr key={j}>
<th>
{generatorResult.input.teams[j].name}
</th>
{Array(generatorResult.tablesAllVsAll[i][j].length).fill(0).map((___, k) => {
// Foreach cell in line
const cellMatchIndex: number | null = generatorResult.tablesAllVsAll[i][j][k];
if (cellMatchIndex !== null) { // Is match in cell? (Is cell free?)
const cellMatch: Match = generatorResult.allMatches[cellMatchIndex];
const { result = {} } = cellMatch;
const { team1Score = null, team2Score = null } = result;
// const team1: Team = generatorResult.input.teams[cellMatch.team1Index];
// const team2: Team = generatorResult.input.teams[cellMatch.team2Index];
return (
typeof team1Score === 'number' && typeof team2Score === 'number'
?
<td key={k} style={tdStyle}>
{String(team1Score)} : {String(team2Score)}
</td>
:
<td key={k} style={tdStyle} />
);
}
return (
<td
key={k}
style={{
backgroundColor: muiTheme.palette.primary1Color,
border: '1px solid',
borderColor: muiTheme.palette.primary1Color,
}}
/>
);
})}
</tr>,
)}
</tbody>
</table>
</div>,
)}
</div>
);
}
|
ajax/libs/onsen/2.2.0/js/angular-onsenui.js | dakshshah96/cdnjs | /*! angular-onsenui.js for onsenui - v2.2.0 - 2017-03-14 */
"use strict";
/* Simple JavaScript Inheritance for ES 5.1
* based on http://ejohn.org/blog/simple-javascript-inheritance/
* (inspired by base2 and Prototype)
* MIT Licensed.
*/
(function () {
"use strict";
var fnTest = /xyz/.test(function () {
xyz;
}) ? /\b_super\b/ : /.*/;
// The base Class implementation (does nothing)
function BaseClass() {}
// Create a new Class that inherits from this class
BaseClass.extend = function (props) {
var _super = this.prototype;
// Set up the prototype to inherit from the base class
// (but without running the init constructor)
var proto = Object.create(_super);
// Copy the properties over onto the new prototype
for (var name in props) {
// Check if we're overwriting an existing function
proto[name] = typeof props[name] === "function" && typeof _super[name] == "function" && fnTest.test(props[name]) ? function (name, fn) {
return function () {
var tmp = this._super;
// Add a new ._super() method that is the same method
// but on the super-class
this._super = _super[name];
// The method only need to be bound temporarily, so we
// remove it when we're done executing
var ret = fn.apply(this, arguments);
this._super = tmp;
return ret;
};
}(name, props[name]) : props[name];
}
// The new constructor
var newClass = typeof proto.init === "function" ? proto.hasOwnProperty("init") ? proto.init // All construction is actually done in the init method
: function SubClass() {
_super.init.apply(this, arguments);
} : function EmptyClass() {};
// Populate our constructed prototype object
newClass.prototype = proto;
// Enforce the constructor to be what we expect
proto.constructor = newClass;
// And make this class extendable
newClass.extend = BaseClass.extend;
return newClass;
};
// export
window.Class = BaseClass;
})();
"use strict";
//HEAD
(function (app) {
try {
app = angular.module("templates-main");
} catch (err) {
app = angular.module("templates-main", []);
}
app.run(["$templateCache", function ($templateCache) {
"use strict";
$templateCache.put("templates/sliding_menu.tpl", "<div class=\"onsen-sliding-menu__menu\"></div>\n" + "<div class=\"onsen-sliding-menu__main\"></div>\n" + "");
$templateCache.put("templates/split_view.tpl", "<div class=\"onsen-split-view__secondary full-screen\"></div>\n" + "<div class=\"onsen-split-view__main full-screen\"></div>\n" + "");
}]);
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
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.
*/
/**
* @object ons
* @description
* [ja]Onsen UIで利用できるグローバルなオブジェクトです。このオブジェクトは、AngularJSのスコープから参照することができます。 [/ja]
* [en]A global object that's used in Onsen UI. This object can be reached from the AngularJS scope.[/en]
*/
(function (ons) {
'use strict';
var module = angular.module('onsen', ['templates-main']);
angular.module('onsen.directives', ['onsen']); // for BC
// JS Global facade for Onsen UI.
initOnsenFacade();
waitOnsenUILoad();
initAngularModule();
initTemplateCache();
function waitOnsenUILoad() {
var unlockOnsenUI = ons._readyLock.lock();
module.run(['$compile', '$rootScope', function ($compile, $rootScope) {
// for initialization hook.
if (document.readyState === 'loading' || document.readyState == 'uninitialized') {
window.addEventListener('DOMContentLoaded', function () {
document.body.appendChild(document.createElement('ons-dummy-for-init'));
});
} else if (document.body) {
document.body.appendChild(document.createElement('ons-dummy-for-init'));
} else {
throw new Error('Invalid initialization state.');
}
$rootScope.$on('$ons-ready', unlockOnsenUI);
}]);
}
function initAngularModule() {
module.value('$onsGlobal', ons);
module.run(['$compile', '$rootScope', '$onsen', '$q', function ($compile, $rootScope, $onsen, $q) {
ons._onsenService = $onsen;
ons._qService = $q;
$rootScope.ons = window.ons;
$rootScope.console = window.console;
$rootScope.alert = window.alert;
ons.$compile = $compile;
}]);
}
function initTemplateCache() {
module.run(['$templateCache', function ($templateCache) {
var tmp = ons._internal.getTemplateHTMLAsync;
ons._internal.getTemplateHTMLAsync = function (page) {
var cache = $templateCache.get(page);
if (cache) {
return Promise.resolve(cache);
} else {
return tmp(page);
}
};
}]);
}
function initOnsenFacade() {
ons._onsenService = null;
// Object to attach component variables to when using the var="..." attribute.
// Can be set to null to avoid polluting the global scope.
ons.componentBase = window;
/**
* @method bootstrap
* @signature bootstrap([moduleName, [dependencies]])
* @description
* [ja]Onsen UIの初期化を行います。Angular.jsのng-app属性を利用すること無しにOnsen UIを読み込んで初期化してくれます。[/ja]
* [en]Initialize Onsen UI. Can be used to load Onsen UI without using the <code>ng-app</code> attribute from AngularJS.[/en]
* @param {String} [moduleName]
* [en]AngularJS module name.[/en]
* [ja]Angular.jsでのモジュール名[/ja]
* @param {Array} [dependencies]
* [en]List of AngularJS module dependencies.[/en]
* [ja]依存するAngular.jsのモジュール名の配列[/ja]
* @return {Object}
* [en]An AngularJS module object.[/en]
* [ja]AngularJSのModuleオブジェクトを表します。[/ja]
*/
ons.bootstrap = function (name, deps) {
if (angular.isArray(name)) {
deps = name;
name = undefined;
}
if (!name) {
name = 'myOnsenApp';
}
deps = ['onsen'].concat(angular.isArray(deps) ? deps : []);
var module = angular.module(name, deps);
var doc = window.document;
if (doc.readyState == 'loading' || doc.readyState == 'uninitialized' || doc.readyState == 'interactive') {
doc.addEventListener('DOMContentLoaded', function () {
angular.bootstrap(doc.documentElement, [name]);
}, false);
} else if (doc.documentElement) {
angular.bootstrap(doc.documentElement, [name]);
} else {
throw new Error('Invalid state');
}
return module;
};
/**
* @method findParentComponentUntil
* @signature findParentComponentUntil(name, [dom])
* @param {String} name
* [en]Name of component, i.e. 'ons-page'.[/en]
* [ja]コンポーネント名を指定します。例えばons-pageなどを指定します。[/ja]
* @param {Object/jqLite/HTMLElement} [dom]
* [en]$event, jqLite or HTMLElement object.[/en]
* [ja]$eventオブジェクト、jqLiteオブジェクト、HTMLElementオブジェクトのいずれかを指定できます。[/ja]
* @return {Object}
* [en]Component object. Will return null if no component was found.[/en]
* [ja]コンポーネントのオブジェクトを返します。もしコンポーネントが見つからなかった場合にはnullを返します。[/ja]
* @description
* [en]Find parent component object of <code>dom</code> element.[/en]
* [ja]指定されたdom引数の親要素をたどってコンポーネントを検索します。[/ja]
*/
ons.findParentComponentUntil = function (name, dom) {
var element;
if (dom instanceof HTMLElement) {
element = angular.element(dom);
} else if (dom instanceof angular.element) {
element = dom;
} else if (dom.target) {
element = angular.element(dom.target);
}
return element.inheritedData(name);
};
/**
* @method findComponent
* @signature findComponent(selector, [dom])
* @param {String} selector
* [en]CSS selector[/en]
* [ja]CSSセレクターを指定します。[/ja]
* @param {HTMLElement} [dom]
* [en]DOM element to search from.[/en]
* [ja]検索対象とするDOM要素を指定します。[/ja]
* @return {Object/null}
* [en]Component object. Will return null if no component was found.[/en]
* [ja]コンポーネントのオブジェクトを返します。もしコンポーネントが見つからなかった場合にはnullを返します。[/ja]
* @description
* [en]Find component object using CSS selector.[/en]
* [ja]CSSセレクタを使ってコンポーネントのオブジェクトを検索します。[/ja]
*/
ons.findComponent = function (selector, dom) {
var target = (dom ? dom : document).querySelector(selector);
return target ? angular.element(target).data(target.nodeName.toLowerCase()) || null : null;
};
/**
* @method compile
* @signature compile(dom)
* @param {HTMLElement} dom
* [en]Element to compile.[/en]
* [ja]コンパイルする要素を指定します。[/ja]
* @description
* [en]Compile Onsen UI components.[/en]
* [ja]通常のHTMLの要素をOnsen UIのコンポーネントにコンパイルします。[/ja]
*/
ons.compile = function (dom) {
if (!ons.$compile) {
throw new Error('ons.$compile() is not ready. Wait for initialization with ons.ready().');
}
if (!(dom instanceof HTMLElement)) {
throw new Error('First argument must be an instance of HTMLElement.');
}
var scope = angular.element(dom).scope();
if (!scope) {
throw new Error('AngularJS Scope is null. Argument DOM element must be attached in DOM document.');
}
ons.$compile(dom)(scope);
};
ons._getOnsenService = function () {
if (!this._onsenService) {
throw new Error('$onsen is not loaded, wait for ons.ready().');
}
return this._onsenService;
};
/**
* @param {String} elementName
* @param {Function} lastReady
* @return {Function}
*/
ons._waitDiretiveInit = function (elementName, lastReady) {
return function (element, callback) {
if (angular.element(element).data(elementName)) {
lastReady(element, callback);
} else {
var listen = function listen() {
lastReady(element, callback);
element.removeEventListener(elementName + ':init', listen, false);
};
element.addEventListener(elementName + ':init', listen, false);
}
};
};
/**
* @method createAlertDialog
* @signature createAlertDialog(page, [options])
* @param {String} page
* [en]Page name. Can be either an HTML file or an <ons-template> containing a <ons-alert-dialog> component.[/en]
* [ja]pageのURLか、もしくはons-templateで宣言したテンプレートのid属性の値を指定できます。[/ja]
* @param {Object} [options]
* [en]Parameter object.[/en]
* [ja]オプションを指定するオブジェクト。[/ja]
* @param {Object} [options.parentScope]
* [en]Parent scope of the dialog. Used to bind models and access scope methods from the dialog.[/en]
* [ja]ダイアログ内で利用する親スコープを指定します。ダイアログからモデルやスコープのメソッドにアクセスするのに使います。このパラメータはAngularJSバインディングでのみ利用できます。[/ja]
* @return {Promise}
* [en]Promise object that resolves to the alert dialog component object.[/en]
* [ja]ダイアログのコンポーネントオブジェクトを解決するPromiseオブジェクトを返します。[/ja]
* @description
* [en]Create a alert dialog instance from a template.[/en]
* [ja]テンプレートからアラートダイアログのインスタンスを生成します。[/ja]
*/
ons.createAlertDialog = function (page, options) {
options = options || {};
options.link = function (element) {
if (options.parentScope) {
ons.$compile(angular.element(element))(options.parentScope.$new());
options.parentScope.$evalAsync();
} else {
ons.compile(element);
}
};
return ons._createAlertDialogOriginal(page, options).then(function (alertDialog) {
return angular.element(alertDialog).data('ons-alert-dialog');
});
};
/**
* @method createDialog
* @signature createDialog(page, [options])
* @param {String} page
* [en]Page name. Can be either an HTML file or an <ons-template> containing a <ons-dialog> component.[/en]
* [ja]pageのURLか、もしくはons-templateで宣言したテンプレートのid属性の値を指定できます。[/ja]
* @param {Object} [options]
* [en]Parameter object.[/en]
* [ja]オプションを指定するオブジェクト。[/ja]
* @param {Object} [options.parentScope]
* [en]Parent scope of the dialog. Used to bind models and access scope methods from the dialog.[/en]
* [ja]ダイアログ内で利用する親スコープを指定します。ダイアログからモデルやスコープのメソッドにアクセスするのに使います。このパラメータはAngularJSバインディングでのみ利用できます。[/ja]
* @return {Promise}
* [en]Promise object that resolves to the dialog component object.[/en]
* [ja]ダイアログのコンポーネントオブジェクトを解決するPromiseオブジェクトを返します。[/ja]
* @description
* [en]Create a dialog instance from a template.[/en]
* [ja]テンプレートからダイアログのインスタンスを生成します。[/ja]
*/
ons.createDialog = function (page, options) {
options = options || {};
options.link = function (element) {
if (options.parentScope) {
ons.$compile(angular.element(element))(options.parentScope.$new());
options.parentScope.$evalAsync();
} else {
ons.compile(element);
}
};
return ons._createDialogOriginal(page, options).then(function (dialog) {
return angular.element(dialog).data('ons-dialog');
});
};
/**
* @method createPopover
* @signature createPopover(page, [options])
* @param {String} page
* [en]Page name. Can be either an HTML file or an <ons-template> containing a <ons-dialog> component.[/en]
* [ja]pageのURLか、もしくはons-templateで宣言したテンプレートのid属性の値を指定できます。[/ja]
* @param {Object} [options]
* [en]Parameter object.[/en]
* [ja]オプションを指定するオブジェクト。[/ja]
* @param {Object} [options.parentScope]
* [en]Parent scope of the dialog. Used to bind models and access scope methods from the dialog.[/en]
* [ja]ダイアログ内で利用する親スコープを指定します。ダイアログからモデルやスコープのメソッドにアクセスするのに使います。このパラメータはAngularJSバインディングでのみ利用できます。[/ja]
* @return {Promise}
* [en]Promise object that resolves to the popover component object.[/en]
* [ja]ポップオーバーのコンポーネントオブジェクトを解決するPromiseオブジェクトを返します。[/ja]
* @description
* [en]Create a popover instance from a template.[/en]
* [ja]テンプレートからポップオーバーのインスタンスを生成します。[/ja]
*/
ons.createPopover = function (page, options) {
options = options || {};
options.link = function (element) {
if (options.parentScope) {
ons.$compile(angular.element(element))(options.parentScope.$new());
options.parentScope.$evalAsync();
} else {
ons.compile(element);
}
};
return ons._createPopoverOriginal(page, options).then(function (popover) {
return angular.element(popover).data('ons-popover');
});
};
/**
* @param {String} page
*/
ons.resolveLoadingPlaceholder = function (page) {
return ons._resolveLoadingPlaceholderOriginal(page, function (element, done) {
ons.compile(element);
angular.element(element).scope().$evalAsync(function () {
setImmediate(done);
});
});
};
ons._setupLoadingPlaceHolders = function () {
// Do nothing
};
}
})(window.ons = window.ons || {});
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.factory('AlertDialogView', ['$onsen', function ($onsen) {
var AlertDialogView = Class.extend({
/**
* @param {Object} scope
* @param {jqLite} element
* @param {Object} attrs
*/
init: function init(scope, element, attrs) {
this._scope = scope;
this._element = element;
this._attrs = attrs;
this._clearDerivingMethods = $onsen.deriveMethods(this, this._element[0], ['show', 'hide']);
this._clearDerivingEvents = $onsen.deriveEvents(this, this._element[0], ['preshow', 'postshow', 'prehide', 'posthide', 'cancel'], function (detail) {
if (detail.alertDialog) {
detail.alertDialog = this;
}
return detail;
}.bind(this));
this._scope.$on('$destroy', this._destroy.bind(this));
},
_destroy: function _destroy() {
this.emit('destroy');
this._element.remove();
this._clearDerivingMethods();
this._clearDerivingEvents();
this._scope = this._attrs = this._element = null;
}
});
MicroEvent.mixin(AlertDialogView);
$onsen.derivePropertiesFromElement(AlertDialogView, ['disabled', 'cancelable', 'visible', 'onDeviceBackButton']);
return AlertDialogView;
}]);
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
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.
*/
angular.module('onsen').value('AlertDialogAnimator', ons._internal.AlertDialogAnimator).value('AndroidAlertDialogAnimator', ons._internal.AndroidAlertDialogAnimator).value('IOSAlertDialogAnimator', ons._internal.IOSAlertDialogAnimator);
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
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.
*/
angular.module('onsen').value('AnimationChooser', ons._internal.AnimatorFactory);
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.factory('CarouselView', ['$onsen', function ($onsen) {
/**
* @class CarouselView
*/
var CarouselView = Class.extend({
/**
* @param {Object} scope
* @param {jqLite} element
* @param {Object} attrs
*/
init: function init(scope, element, attrs) {
this._element = element;
this._scope = scope;
this._attrs = attrs;
this._scope.$on('$destroy', this._destroy.bind(this));
this._clearDerivingMethods = $onsen.deriveMethods(this, element[0], ['setActiveIndex', 'getActiveIndex', 'next', 'prev', 'refresh', 'first', 'last']);
this._clearDerivingEvents = $onsen.deriveEvents(this, element[0], ['refresh', 'postchange', 'overscroll'], function (detail) {
if (detail.carousel) {
detail.carousel = this;
}
return detail;
}.bind(this));
},
_destroy: function _destroy() {
this.emit('destroy');
this._clearDerivingEvents();
this._clearDerivingMethods();
this._element = this._scope = this._attrs = null;
}
});
MicroEvent.mixin(CarouselView);
$onsen.derivePropertiesFromElement(CarouselView, ['centered', 'overscrollable', 'disabled', 'autoScroll', 'swipeable', 'autoScrollRatio', 'itemCount']);
return CarouselView;
}]);
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.factory('DialogView', ['$onsen', function ($onsen) {
var DialogView = Class.extend({
init: function init(scope, element, attrs) {
this._scope = scope;
this._element = element;
this._attrs = attrs;
this._clearDerivingMethods = $onsen.deriveMethods(this, this._element[0], ['show', 'hide']);
this._clearDerivingEvents = $onsen.deriveEvents(this, this._element[0], ['preshow', 'postshow', 'prehide', 'posthide', 'cancel'], function (detail) {
if (detail.dialog) {
detail.dialog = this;
}
return detail;
}.bind(this));
this._scope.$on('$destroy', this._destroy.bind(this));
},
_destroy: function _destroy() {
this.emit('destroy');
this._element.remove();
this._clearDerivingMethods();
this._clearDerivingEvents();
this._scope = this._attrs = this._element = null;
}
});
DialogView.registerAnimator = function (name, Animator) {
return window.ons.DialogElement.registerAnimator(name, Animator);
};
MicroEvent.mixin(DialogView);
$onsen.derivePropertiesFromElement(DialogView, ['disabled', 'cancelable', 'visible', 'onDeviceBackButton']);
return DialogView;
}]);
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
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.
*/
angular.module('onsen').value('DialogAnimator', ons._internal.DialogAnimator).value('IOSDialogAnimator', ons._internal.IOSDialogAnimator).value('AndroidDialogAnimator', ons._internal.AndroidDialogAnimator).value('SlideDialogAnimator', ons._internal.SlideDialogAnimator);
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.factory('FabView', ['$onsen', function ($onsen) {
/**
* @class FabView
*/
var FabView = Class.extend({
/**
* @param {Object} scope
* @param {jqLite} element
* @param {Object} attrs
*/
init: function init(scope, element, attrs) {
this._element = element;
this._scope = scope;
this._attrs = attrs;
this._scope.$on('$destroy', this._destroy.bind(this));
this._clearDerivingMethods = $onsen.deriveMethods(this, element[0], ['show', 'hide', 'toggle']);
},
_destroy: function _destroy() {
this.emit('destroy');
this._clearDerivingMethods();
this._element = this._scope = this._attrs = null;
}
});
$onsen.derivePropertiesFromElement(FabView, ['disabled', 'visible']);
MicroEvent.mixin(FabView);
return FabView;
}]);
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
angular.module('onsen').factory('GenericView', ['$onsen', function ($onsen) {
var GenericView = Class.extend({
/**
* @param {Object} scope
* @param {jqLite} element
* @param {Object} attrs
* @param {Object} [options]
* @param {Boolean} [options.directiveOnly]
* @param {Function} [options.onDestroy]
* @param {String} [options.modifierTemplate]
*/
init: function init(scope, element, attrs, options) {
var self = this;
options = {};
this._element = element;
this._scope = scope;
this._attrs = attrs;
if (options.directiveOnly) {
if (!options.modifierTemplate) {
throw new Error('options.modifierTemplate is undefined.');
}
$onsen.addModifierMethods(this, options.modifierTemplate, element);
} else {
$onsen.addModifierMethodsForCustomElements(this, element);
}
$onsen.cleaner.onDestroy(scope, function () {
self._events = undefined;
$onsen.removeModifierMethods(self);
if (options.onDestroy) {
options.onDestroy(self);
}
$onsen.clearComponent({
scope: scope,
attrs: attrs,
element: element
});
self = element = self._element = self._scope = scope = self._attrs = attrs = options = null;
});
}
});
/**
* @param {Object} scope
* @param {jqLite} element
* @param {Object} attrs
* @param {Object} options
* @param {String} options.viewKey
* @param {Boolean} [options.directiveOnly]
* @param {Function} [options.onDestroy]
* @param {String} [options.modifierTemplate]
*/
GenericView.register = function (scope, element, attrs, options) {
var view = new GenericView(scope, element, attrs, options);
if (!options.viewKey) {
throw new Error('options.viewKey is required.');
}
$onsen.declareVarAttribute(attrs, view);
element.data(options.viewKey, view);
var destroy = options.onDestroy || angular.noop;
options.onDestroy = function (view) {
destroy(view);
element.data(options.viewKey, null);
};
return view;
};
MicroEvent.mixin(GenericView);
return GenericView;
}]);
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.factory('LazyRepeatView', ['AngularLazyRepeatDelegate', function (AngularLazyRepeatDelegate) {
var LazyRepeatView = Class.extend({
/**
* @param {Object} scope
* @param {jqLite} element
* @param {Object} attrs
*/
init: function init(scope, element, attrs, linker) {
var _this = this;
this._element = element;
this._scope = scope;
this._attrs = attrs;
this._linker = linker;
var userDelegate = this._scope.$eval(this._attrs.onsLazyRepeat);
var internalDelegate = new AngularLazyRepeatDelegate(userDelegate, element[0], element.scope());
this._provider = new ons._internal.LazyRepeatProvider(element[0].parentNode, internalDelegate);
// Expose refresh method to user.
userDelegate.refresh = this._provider.refresh.bind(this._provider);
element.remove();
// Render when number of items change.
this._scope.$watch(internalDelegate.countItems.bind(internalDelegate), this._provider._onChange.bind(this._provider));
this._scope.$on('$destroy', function () {
_this._element = _this._scope = _this._attrs = _this._linker = null;
});
}
});
return LazyRepeatView;
}]);
})();
'use strict';
var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
angular.module('onsen').factory('AngularLazyRepeatDelegate', ['$compile', function ($compile) {
var directiveAttributes = ['ons-lazy-repeat', 'ons:lazy:repeat', 'ons_lazy_repeat', 'data-ons-lazy-repeat', 'x-ons-lazy-repeat'];
var AngularLazyRepeatDelegate = function (_ons$_internal$LazyRe) {
_inherits(AngularLazyRepeatDelegate, _ons$_internal$LazyRe);
/**
* @param {Object} userDelegate
* @param {Element} templateElement
* @param {Scope} parentScope
*/
function AngularLazyRepeatDelegate(userDelegate, templateElement, parentScope) {
_classCallCheck(this, AngularLazyRepeatDelegate);
var _this = _possibleConstructorReturn(this, (AngularLazyRepeatDelegate.__proto__ || Object.getPrototypeOf(AngularLazyRepeatDelegate)).call(this, userDelegate, templateElement));
_this._parentScope = parentScope;
directiveAttributes.forEach(function (attr) {
return templateElement.removeAttribute(attr);
});
_this._linker = $compile(templateElement ? templateElement.cloneNode(true) : null);
return _this;
}
_createClass(AngularLazyRepeatDelegate, [{
key: 'configureItemScope',
value: function configureItemScope(item, scope) {
if (this._userDelegate.configureItemScope instanceof Function) {
this._userDelegate.configureItemScope(item, scope);
}
}
}, {
key: 'destroyItemScope',
value: function destroyItemScope(item, element) {
if (this._userDelegate.destroyItemScope instanceof Function) {
this._userDelegate.destroyItemScope(item, element);
}
}
}, {
key: '_usingBinding',
value: function _usingBinding() {
if (this._userDelegate.configureItemScope) {
return true;
}
if (this._userDelegate.createItemContent) {
return false;
}
throw new Error('`lazy-repeat` delegate object is vague.');
}
}, {
key: 'loadItemElement',
value: function loadItemElement(index, done) {
this._prepareItemElement(index, function (_ref) {
var element = _ref.element,
scope = _ref.scope;
done({ element: element, scope: scope });
});
}
}, {
key: '_prepareItemElement',
value: function _prepareItemElement(index, done) {
var _this2 = this;
var scope = this._parentScope.$new();
this._addSpecialProperties(index, scope);
if (this._usingBinding()) {
this.configureItemScope(index, scope);
}
this._linker(scope, function (cloned) {
var element = cloned[0];
if (!_this2._usingBinding()) {
element = _this2._userDelegate.createItemContent(index, element);
$compile(element)(scope);
}
done({ element: element, scope: scope });
});
}
/**
* @param {Number} index
* @param {Object} scope
*/
}, {
key: '_addSpecialProperties',
value: function _addSpecialProperties(i, scope) {
var last = this.countItems() - 1;
angular.extend(scope, {
$index: i,
$first: i === 0,
$last: i === last,
$middle: i !== 0 && i !== last,
$even: i % 2 === 0,
$odd: i % 2 === 1
});
}
}, {
key: 'updateItem',
value: function updateItem(index, item) {
var _this3 = this;
if (this._usingBinding()) {
item.scope.$evalAsync(function () {
return _this3.configureItemScope(index, item.scope);
});
} else {
_get(AngularLazyRepeatDelegate.prototype.__proto__ || Object.getPrototypeOf(AngularLazyRepeatDelegate.prototype), 'updateItem', this).call(this, index, item);
}
}
/**
* @param {Number} index
* @param {Object} item
* @param {Object} item.scope
* @param {Element} item.element
*/
}, {
key: 'destroyItem',
value: function destroyItem(index, item) {
if (this._usingBinding()) {
this.destroyItemScope(index, item.scope);
} else {
_get(AngularLazyRepeatDelegate.prototype.__proto__ || Object.getPrototypeOf(AngularLazyRepeatDelegate.prototype), 'destroyItem', this).call(this, index, item.element);
}
item.scope.$destroy();
}
}, {
key: 'destroy',
value: function destroy() {
_get(AngularLazyRepeatDelegate.prototype.__proto__ || Object.getPrototypeOf(AngularLazyRepeatDelegate.prototype), 'destroy', this).call(this);
this._scope = null;
}
}]);
return AngularLazyRepeatDelegate;
}(ons._internal.LazyRepeatDelegate);
return AngularLazyRepeatDelegate;
}]);
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.value('ModalAnimator', ons._internal.ModalAnimator);
module.value('FadeModalAnimator', ons._internal.FadeModalAnimator);
module.factory('ModalView', ['$onsen', '$parse', function ($onsen, $parse) {
var ModalView = Class.extend({
_element: undefined,
_scope: undefined,
init: function init(scope, element, attrs) {
this._scope = scope;
this._element = element;
this._scope.$on('$destroy', this._destroy.bind(this));
element[0]._animatorFactory.setAnimationOptions($parse(attrs.animationOptions)());
},
show: function show(options) {
return this._element[0].show(options);
},
hide: function hide(options) {
return this._element[0].hide(options);
},
toggle: function toggle(options) {
return this._element[0].toggle(options);
},
_destroy: function _destroy() {
this.emit('destroy', { page: this });
this._events = this._element = this._scope = null;
}
});
ModalView.registerAnimator = function (name, Animator) {
return window.ons.ModalElement.registerAnimator(name, Animator);
};
MicroEvent.mixin(ModalView);
$onsen.derivePropertiesFromElement(ModalView, ['onDeviceBackButton']);
return ModalView;
}]);
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.factory('NavigatorView', ['$compile', '$onsen', function ($compile, $onsen) {
/**
* Manages the page navigation backed by page stack.
*
* @class NavigatorView
*/
var NavigatorView = Class.extend({
/**
* @member {jqLite} Object
*/
_element: undefined,
/**
* @member {Object} Object
*/
_attrs: undefined,
/**
* @member {Object}
*/
_scope: undefined,
/**
* @param {Object} scope
* @param {jqLite} element jqLite Object to manage with navigator
* @param {Object} attrs
*/
init: function init(scope, element, attrs) {
this._element = element || angular.element(window.document.body);
this._scope = scope || this._element.scope();
this._attrs = attrs;
this._previousPageScope = null;
this._boundOnPrepop = this._onPrepop.bind(this);
this._element.on('prepop', this._boundOnPrepop);
this._scope.$on('$destroy', this._destroy.bind(this));
this._clearDerivingEvents = $onsen.deriveEvents(this, element[0], ['prepush', 'postpush', 'prepop', 'postpop', 'init', 'show', 'hide', 'destroy'], function (detail) {
if (detail.navigator) {
detail.navigator = this;
}
return detail;
}.bind(this));
this._clearDerivingMethods = $onsen.deriveMethods(this, element[0], ['insertPage', 'pushPage', 'bringPageTop', 'popPage', 'replacePage', 'resetToPage', 'canPopPage']);
},
_onPrepop: function _onPrepop(event) {
var pages = event.detail.navigator.pages;
angular.element(pages[pages.length - 2]).data('_scope').$evalAsync();
},
_destroy: function _destroy() {
this.emit('destroy');
this._clearDerivingEvents();
this._clearDerivingMethods();
this._element.off('prepop', this._boundOnPrepop);
this._element = this._scope = this._attrs = null;
}
});
MicroEvent.mixin(NavigatorView);
$onsen.derivePropertiesFromElement(NavigatorView, ['pages', 'topPage']);
return NavigatorView;
}]);
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
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.
*/
angular.module('onsen').value('NavigatorTransitionAnimator', ons._internal.NavigatorTransitionAnimator).value('FadeTransitionAnimator', ons._internal.FadeNavigatorTransitionAnimator).value('IOSSlideTransitionAnimator', ons._internal.IOSSlideNavigatorTransitionAnimator).value('LiftTransitionAnimator', ons._internal.LiftNavigatorTransitionAnimator).value('NullTransitionAnimator', ons._internal.NavigatorTransitionAnimator).value('SimpleSlideTransitionAnimator', ons._internal.SimpleSlideNavigatorTransitionAnimator);
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.factory('OverlaySlidingMenuAnimator', ['SlidingMenuAnimator', function (SlidingMenuAnimator) {
var OverlaySlidingMenuAnimator = SlidingMenuAnimator.extend({
_blackMask: undefined,
_isRight: false,
_element: false,
_menuPage: false,
_mainPage: false,
_width: false,
/**
* @param {jqLite} element "ons-sliding-menu" or "ons-split-view" element
* @param {jqLite} mainPage
* @param {jqLite} menuPage
* @param {Object} options
* @param {String} options.width "width" style value
* @param {Boolean} options.isRight
*/
setup: function setup(element, mainPage, menuPage, options) {
options = options || {};
this._width = options.width || '90%';
this._isRight = !!options.isRight;
this._element = element;
this._mainPage = mainPage;
this._menuPage = menuPage;
menuPage.css('box-shadow', '0px 0 10px 0px rgba(0, 0, 0, 0.2)');
menuPage.css({
width: options.width,
display: 'none',
zIndex: 2
});
// Fix for transparent menu page on iOS8.
menuPage.css('-webkit-transform', 'translate3d(0px, 0px, 0px)');
mainPage.css({ zIndex: 1 });
if (this._isRight) {
menuPage.css({
right: '-' + options.width,
left: 'auto'
});
} else {
menuPage.css({
right: 'auto',
left: '-' + options.width
});
}
this._blackMask = angular.element('<div></div>').css({
backgroundColor: 'black',
top: '0px',
left: '0px',
right: '0px',
bottom: '0px',
position: 'absolute',
display: 'none',
zIndex: 0
});
element.prepend(this._blackMask);
},
/**
* @param {Object} options
* @param {String} options.width
*/
onResized: function onResized(options) {
this._menuPage.css('width', options.width);
if (this._isRight) {
this._menuPage.css({
right: '-' + options.width,
left: 'auto'
});
} else {
this._menuPage.css({
right: 'auto',
left: '-' + options.width
});
}
if (options.isOpened) {
var max = this._menuPage[0].clientWidth;
var menuStyle = this._generateMenuPageStyle(max);
ons.animit(this._menuPage[0]).queue(menuStyle).play();
}
},
/**
*/
destroy: function destroy() {
if (this._blackMask) {
this._blackMask.remove();
this._blackMask = null;
}
this._mainPage.removeAttr('style');
this._menuPage.removeAttr('style');
this._element = this._mainPage = this._menuPage = null;
},
/**
* @param {Function} callback
* @param {Boolean} instant
*/
openMenu: function openMenu(callback, instant) {
var duration = instant === true ? 0.0 : this.duration;
var delay = instant === true ? 0.0 : this.delay;
this._menuPage.css('display', 'block');
this._blackMask.css('display', 'block');
var max = this._menuPage[0].clientWidth;
var menuStyle = this._generateMenuPageStyle(max);
var mainPageStyle = this._generateMainPageStyle(max);
setTimeout(function () {
ons.animit(this._mainPage[0]).wait(delay).queue(mainPageStyle, {
duration: duration,
timing: this.timing
}).queue(function (done) {
callback();
done();
}).play();
ons.animit(this._menuPage[0]).wait(delay).queue(menuStyle, {
duration: duration,
timing: this.timing
}).play();
}.bind(this), 1000 / 60);
},
/**
* @param {Function} callback
* @param {Boolean} instant
*/
closeMenu: function closeMenu(callback, instant) {
var duration = instant === true ? 0.0 : this.duration;
var delay = instant === true ? 0.0 : this.delay;
this._blackMask.css({ display: 'block' });
var menuPageStyle = this._generateMenuPageStyle(0);
var mainPageStyle = this._generateMainPageStyle(0);
setTimeout(function () {
ons.animit(this._mainPage[0]).wait(delay).queue(mainPageStyle, {
duration: duration,
timing: this.timing
}).queue(function (done) {
this._menuPage.css('display', 'none');
callback();
done();
}.bind(this)).play();
ons.animit(this._menuPage[0]).wait(delay).queue(menuPageStyle, {
duration: duration,
timing: this.timing
}).play();
}.bind(this), 1000 / 60);
},
/**
* @param {Object} options
* @param {Number} options.distance
* @param {Number} options.maxDistance
*/
translateMenu: function translateMenu(options) {
this._menuPage.css('display', 'block');
this._blackMask.css({ display: 'block' });
var menuPageStyle = this._generateMenuPageStyle(Math.min(options.maxDistance, options.distance));
var mainPageStyle = this._generateMainPageStyle(Math.min(options.maxDistance, options.distance));
delete mainPageStyle.opacity;
ons.animit(this._menuPage[0]).queue(menuPageStyle).play();
if (Object.keys(mainPageStyle).length > 0) {
ons.animit(this._mainPage[0]).queue(mainPageStyle).play();
}
},
_generateMenuPageStyle: function _generateMenuPageStyle(distance) {
var x = this._isRight ? -distance : distance;
var transform = 'translate3d(' + x + 'px, 0, 0)';
return {
transform: transform,
'box-shadow': distance === 0 ? 'none' : '0px 0 10px 0px rgba(0, 0, 0, 0.2)'
};
},
_generateMainPageStyle: function _generateMainPageStyle(distance) {
var max = this._menuPage[0].clientWidth;
var opacity = 1 - 0.1 * distance / max;
return {
opacity: opacity
};
},
copy: function copy() {
return new OverlaySlidingMenuAnimator();
}
});
return OverlaySlidingMenuAnimator;
}]);
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.factory('PageView', ['$onsen', '$parse', function ($onsen, $parse) {
var PageView = Class.extend({
init: function init(scope, element, attrs) {
var _this = this;
this._scope = scope;
this._element = element;
this._attrs = attrs;
this._clearListener = scope.$on('$destroy', this._destroy.bind(this));
this._clearDerivingEvents = $onsen.deriveEvents(this, element[0], ['init', 'show', 'hide', 'destroy']);
Object.defineProperty(this, 'onDeviceBackButton', {
get: function get() {
return _this._element[0].onDeviceBackButton;
},
set: function set(value) {
if (!_this._userBackButtonHandler) {
_this._enableBackButtonHandler();
}
_this._userBackButtonHandler = value;
}
});
if (this._attrs.ngDeviceBackButton || this._attrs.onDeviceBackButton) {
this._enableBackButtonHandler();
}
if (this._attrs.ngInfiniteScroll) {
this._element[0].onInfiniteScroll = function (done) {
$parse(_this._attrs.ngInfiniteScroll)(_this._scope)(done);
};
}
},
_enableBackButtonHandler: function _enableBackButtonHandler() {
this._userBackButtonHandler = angular.noop;
this._element[0].onDeviceBackButton = this._onDeviceBackButton.bind(this);
},
_onDeviceBackButton: function _onDeviceBackButton($event) {
this._userBackButtonHandler($event);
// ng-device-backbutton
if (this._attrs.ngDeviceBackButton) {
$parse(this._attrs.ngDeviceBackButton)(this._scope, { $event: $event });
}
// on-device-backbutton
/* jshint ignore:start */
if (this._attrs.onDeviceBackButton) {
var lastEvent = window.$event;
window.$event = $event;
new Function(this._attrs.onDeviceBackButton)(); // eslint-disable-line no-new-func
window.$event = lastEvent;
}
/* jshint ignore:end */
},
_destroy: function _destroy() {
this._clearDerivingEvents();
this._element = null;
this._scope = null;
this._clearListener();
}
});
MicroEvent.mixin(PageView);
return PageView;
}]);
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
angular.module('onsen').factory('PopoverView', ['$onsen', function ($onsen) {
var PopoverView = Class.extend({
/**
* @param {Object} scope
* @param {jqLite} element
* @param {Object} attrs
*/
init: function init(scope, element, attrs) {
this._element = element;
this._scope = scope;
this._attrs = attrs;
this._scope.$on('$destroy', this._destroy.bind(this));
this._clearDerivingMethods = $onsen.deriveMethods(this, this._element[0], ['show', 'hide']);
this._clearDerivingEvents = $onsen.deriveEvents(this, this._element[0], ['preshow', 'postshow', 'prehide', 'posthide'], function (detail) {
if (detail.popover) {
detail.popover = this;
}
return detail;
}.bind(this));
},
_destroy: function _destroy() {
this.emit('destroy');
this._clearDerivingMethods();
this._clearDerivingEvents();
this._element.remove();
this._element = this._scope = null;
}
});
MicroEvent.mixin(PopoverView);
$onsen.derivePropertiesFromElement(PopoverView, ['cancelable', 'disabled', 'onDeviceBackButton']);
return PopoverView;
}]);
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
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.
*/
angular.module('onsen').value('PopoverAnimator', ons._internal.PopoverAnimator).value('FadePopoverAnimator', ons._internal.FadePopoverAnimator);
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.factory('PullHookView', ['$onsen', '$parse', function ($onsen, $parse) {
var PullHookView = Class.extend({
init: function init(scope, element, attrs) {
var _this = this;
this._element = element;
this._scope = scope;
this._attrs = attrs;
this._clearDerivingEvents = $onsen.deriveEvents(this, this._element[0], ['changestate'], function (detail) {
if (detail.pullHook) {
detail.pullHook = _this;
}
return detail;
});
this.on('changestate', function () {
return _this._scope.$evalAsync();
});
this._element[0].onAction = function (done) {
if (_this._attrs.ngAction) {
_this._scope.$eval(_this._attrs.ngAction, { $done: done });
} else {
_this.onAction ? _this.onAction(done) : done();
}
};
this._scope.$on('$destroy', this._destroy.bind(this));
},
_destroy: function _destroy() {
this.emit('destroy');
this._clearDerivingEvents();
this._element = this._scope = this._attrs = null;
}
});
MicroEvent.mixin(PullHookView);
$onsen.derivePropertiesFromElement(PullHookView, ['state', 'pullDistance', 'height', 'thresholdHeight', 'disabled']);
return PullHookView;
}]);
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.factory('PushSlidingMenuAnimator', ['SlidingMenuAnimator', function (SlidingMenuAnimator) {
var PushSlidingMenuAnimator = SlidingMenuAnimator.extend({
_isRight: false,
_element: undefined,
_menuPage: undefined,
_mainPage: undefined,
_width: undefined,
/**
* @param {jqLite} element "ons-sliding-menu" or "ons-split-view" element
* @param {jqLite} mainPage
* @param {jqLite} menuPage
* @param {Object} options
* @param {String} options.width "width" style value
* @param {Boolean} options.isRight
*/
setup: function setup(element, mainPage, menuPage, options) {
options = options || {};
this._element = element;
this._mainPage = mainPage;
this._menuPage = menuPage;
this._isRight = !!options.isRight;
this._width = options.width || '90%';
menuPage.css({
width: options.width,
display: 'none'
});
if (this._isRight) {
menuPage.css({
right: '-' + options.width,
left: 'auto'
});
} else {
menuPage.css({
right: 'auto',
left: '-' + options.width
});
}
},
/**
* @param {Object} options
* @param {String} options.width
* @param {Object} options.isRight
*/
onResized: function onResized(options) {
this._menuPage.css('width', options.width);
if (this._isRight) {
this._menuPage.css({
right: '-' + options.width,
left: 'auto'
});
} else {
this._menuPage.css({
right: 'auto',
left: '-' + options.width
});
}
if (options.isOpened) {
var max = this._menuPage[0].clientWidth;
var mainPageTransform = this._generateAbovePageTransform(max);
var menuPageStyle = this._generateBehindPageStyle(max);
ons.animit(this._mainPage[0]).queue({ transform: mainPageTransform }).play();
ons.animit(this._menuPage[0]).queue(menuPageStyle).play();
}
},
/**
*/
destroy: function destroy() {
this._mainPage.removeAttr('style');
this._menuPage.removeAttr('style');
this._element = this._mainPage = this._menuPage = null;
},
/**
* @param {Function} callback
* @param {Boolean} instant
*/
openMenu: function openMenu(callback, instant) {
var duration = instant === true ? 0.0 : this.duration;
var delay = instant === true ? 0.0 : this.delay;
this._menuPage.css('display', 'block');
var max = this._menuPage[0].clientWidth;
var aboveTransform = this._generateAbovePageTransform(max);
var behindStyle = this._generateBehindPageStyle(max);
setTimeout(function () {
ons.animit(this._mainPage[0]).wait(delay).queue({
transform: aboveTransform
}, {
duration: duration,
timing: this.timing
}).queue(function (done) {
callback();
done();
}).play();
ons.animit(this._menuPage[0]).wait(delay).queue(behindStyle, {
duration: duration,
timing: this.timing
}).play();
}.bind(this), 1000 / 60);
},
/**
* @param {Function} callback
* @param {Boolean} instant
*/
closeMenu: function closeMenu(callback, instant) {
var duration = instant === true ? 0.0 : this.duration;
var delay = instant === true ? 0.0 : this.delay;
var aboveTransform = this._generateAbovePageTransform(0);
var behindStyle = this._generateBehindPageStyle(0);
setTimeout(function () {
ons.animit(this._mainPage[0]).wait(delay).queue({
transform: aboveTransform
}, {
duration: duration,
timing: this.timing
}).queue({
transform: 'translate3d(0, 0, 0)'
}).queue(function (done) {
this._menuPage.css('display', 'none');
callback();
done();
}.bind(this)).play();
ons.animit(this._menuPage[0]).wait(delay).queue(behindStyle, {
duration: duration,
timing: this.timing
}).queue(function (done) {
done();
}).play();
}.bind(this), 1000 / 60);
},
/**
* @param {Object} options
* @param {Number} options.distance
* @param {Number} options.maxDistance
*/
translateMenu: function translateMenu(options) {
this._menuPage.css('display', 'block');
var aboveTransform = this._generateAbovePageTransform(Math.min(options.maxDistance, options.distance));
var behindStyle = this._generateBehindPageStyle(Math.min(options.maxDistance, options.distance));
ons.animit(this._mainPage[0]).queue({ transform: aboveTransform }).play();
ons.animit(this._menuPage[0]).queue(behindStyle).play();
},
_generateAbovePageTransform: function _generateAbovePageTransform(distance) {
var x = this._isRight ? -distance : distance;
var aboveTransform = 'translate3d(' + x + 'px, 0, 0)';
return aboveTransform;
},
_generateBehindPageStyle: function _generateBehindPageStyle(distance) {
var behindX = this._isRight ? -distance : distance;
var behindTransform = 'translate3d(' + behindX + 'px, 0, 0)';
return {
transform: behindTransform
};
},
copy: function copy() {
return new PushSlidingMenuAnimator();
}
});
return PushSlidingMenuAnimator;
}]);
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.factory('RevealSlidingMenuAnimator', ['SlidingMenuAnimator', function (SlidingMenuAnimator) {
var RevealSlidingMenuAnimator = SlidingMenuAnimator.extend({
_blackMask: undefined,
_isRight: false,
_menuPage: undefined,
_element: undefined,
_mainPage: undefined,
/**
* @param {jqLite} element "ons-sliding-menu" or "ons-split-view" element
* @param {jqLite} mainPage
* @param {jqLite} menuPage
* @param {Object} options
* @param {String} options.width "width" style value
* @param {Boolean} options.isRight
*/
setup: function setup(element, mainPage, menuPage, options) {
this._element = element;
this._menuPage = menuPage;
this._mainPage = mainPage;
this._isRight = !!options.isRight;
this._width = options.width || '90%';
mainPage.css({
boxShadow: '0px 0 10px 0px rgba(0, 0, 0, 0.2)'
});
menuPage.css({
width: options.width,
opacity: 0.9,
display: 'none'
});
if (this._isRight) {
menuPage.css({
right: '0px',
left: 'auto'
});
} else {
menuPage.css({
right: 'auto',
left: '0px'
});
}
this._blackMask = angular.element('<div></div>').css({
backgroundColor: 'black',
top: '0px',
left: '0px',
right: '0px',
bottom: '0px',
position: 'absolute',
display: 'none'
});
element.prepend(this._blackMask);
// Dirty fix for broken rendering bug on android 4.x.
ons.animit(mainPage[0]).queue({ transform: 'translate3d(0, 0, 0)' }).play();
},
/**
* @param {Object} options
* @param {Boolean} options.isOpened
* @param {String} options.width
*/
onResized: function onResized(options) {
this._width = options.width;
this._menuPage.css('width', this._width);
if (options.isOpened) {
var max = this._menuPage[0].clientWidth;
var aboveTransform = this._generateAbovePageTransform(max);
var behindStyle = this._generateBehindPageStyle(max);
ons.animit(this._mainPage[0]).queue({ transform: aboveTransform }).play();
ons.animit(this._menuPage[0]).queue(behindStyle).play();
}
},
/**
* @param {jqLite} element "ons-sliding-menu" or "ons-split-view" element
* @param {jqLite} mainPage
* @param {jqLite} menuPage
*/
destroy: function destroy() {
if (this._blackMask) {
this._blackMask.remove();
this._blackMask = null;
}
if (this._mainPage) {
this._mainPage.attr('style', '');
}
if (this._menuPage) {
this._menuPage.attr('style', '');
}
this._mainPage = this._menuPage = this._element = undefined;
},
/**
* @param {Function} callback
* @param {Boolean} instant
*/
openMenu: function openMenu(callback, instant) {
var duration = instant === true ? 0.0 : this.duration;
var delay = instant === true ? 0.0 : this.delay;
this._menuPage.css('display', 'block');
this._blackMask.css('display', 'block');
var max = this._menuPage[0].clientWidth;
var aboveTransform = this._generateAbovePageTransform(max);
var behindStyle = this._generateBehindPageStyle(max);
setTimeout(function () {
ons.animit(this._mainPage[0]).wait(delay).queue({
transform: aboveTransform
}, {
duration: duration,
timing: this.timing
}).queue(function (done) {
callback();
done();
}).play();
ons.animit(this._menuPage[0]).wait(delay).queue(behindStyle, {
duration: duration,
timing: this.timing
}).play();
}.bind(this), 1000 / 60);
},
/**
* @param {Function} callback
* @param {Boolean} instant
*/
closeMenu: function closeMenu(callback, instant) {
var duration = instant === true ? 0.0 : this.duration;
var delay = instant === true ? 0.0 : this.delay;
this._blackMask.css('display', 'block');
var aboveTransform = this._generateAbovePageTransform(0);
var behindStyle = this._generateBehindPageStyle(0);
setTimeout(function () {
ons.animit(this._mainPage[0]).wait(delay).queue({
transform: aboveTransform
}, {
duration: duration,
timing: this.timing
}).queue({
transform: 'translate3d(0, 0, 0)'
}).queue(function (done) {
this._menuPage.css('display', 'none');
callback();
done();
}.bind(this)).play();
ons.animit(this._menuPage[0]).wait(delay).queue(behindStyle, {
duration: duration,
timing: this.timing
}).queue(function (done) {
done();
}).play();
}.bind(this), 1000 / 60);
},
/**
* @param {Object} options
* @param {Number} options.distance
* @param {Number} options.maxDistance
*/
translateMenu: function translateMenu(options) {
this._menuPage.css('display', 'block');
this._blackMask.css('display', 'block');
var aboveTransform = this._generateAbovePageTransform(Math.min(options.maxDistance, options.distance));
var behindStyle = this._generateBehindPageStyle(Math.min(options.maxDistance, options.distance));
delete behindStyle.opacity;
ons.animit(this._mainPage[0]).queue({ transform: aboveTransform }).play();
ons.animit(this._menuPage[0]).queue(behindStyle).play();
},
_generateAbovePageTransform: function _generateAbovePageTransform(distance) {
var x = this._isRight ? -distance : distance;
var aboveTransform = 'translate3d(' + x + 'px, 0, 0)';
return aboveTransform;
},
_generateBehindPageStyle: function _generateBehindPageStyle(distance) {
var max = this._menuPage[0].getBoundingClientRect().width;
var behindDistance = (distance - max) / max * 10;
behindDistance = isNaN(behindDistance) ? 0 : Math.max(Math.min(behindDistance, 0), -10);
var behindX = this._isRight ? -behindDistance : behindDistance;
var behindTransform = 'translate3d(' + behindX + '%, 0, 0)';
var opacity = 1 + behindDistance / 100;
return {
transform: behindTransform,
opacity: opacity
};
},
copy: function copy() {
return new RevealSlidingMenuAnimator();
}
});
return RevealSlidingMenuAnimator;
}]);
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
var module = angular.module('onsen');
var SlidingMenuViewModel = Class.extend({
/**
* @member Number
*/
_distance: 0,
/**
* @member Number
*/
_maxDistance: undefined,
/**
* @param {Object} options
* @param {Number} maxDistance
*/
init: function init(options) {
if (!angular.isNumber(options.maxDistance)) {
throw new Error('options.maxDistance must be number');
}
this.setMaxDistance(options.maxDistance);
},
/**
* @param {Number} maxDistance
*/
setMaxDistance: function setMaxDistance(maxDistance) {
if (maxDistance <= 0) {
throw new Error('maxDistance must be greater then zero.');
}
if (this.isOpened()) {
this._distance = maxDistance;
}
this._maxDistance = maxDistance;
},
/**
* @return {Boolean}
*/
shouldOpen: function shouldOpen() {
return !this.isOpened() && this._distance >= this._maxDistance / 2;
},
/**
* @return {Boolean}
*/
shouldClose: function shouldClose() {
return !this.isClosed() && this._distance < this._maxDistance / 2;
},
openOrClose: function openOrClose(options) {
if (this.shouldOpen()) {
this.open(options);
} else if (this.shouldClose()) {
this.close(options);
}
},
close: function close(options) {
var callback = options.callback || function () {};
if (!this.isClosed()) {
this._distance = 0;
this.emit('close', options);
} else {
callback();
}
},
open: function open(options) {
var callback = options.callback || function () {};
if (!this.isOpened()) {
this._distance = this._maxDistance;
this.emit('open', options);
} else {
callback();
}
},
/**
* @return {Boolean}
*/
isClosed: function isClosed() {
return this._distance === 0;
},
/**
* @return {Boolean}
*/
isOpened: function isOpened() {
return this._distance === this._maxDistance;
},
/**
* @return {Number}
*/
getX: function getX() {
return this._distance;
},
/**
* @return {Number}
*/
getMaxDistance: function getMaxDistance() {
return this._maxDistance;
},
/**
* @param {Number} x
*/
translate: function translate(x) {
this._distance = Math.max(1, Math.min(this._maxDistance - 1, x));
var options = {
distance: this._distance,
maxDistance: this._maxDistance
};
this.emit('translate', options);
},
toggle: function toggle() {
if (this.isClosed()) {
this.open();
} else {
this.close();
}
}
});
MicroEvent.mixin(SlidingMenuViewModel);
module.factory('SlidingMenuView', ['$onsen', '$compile', '$parse', 'AnimationChooser', 'SlidingMenuAnimator', 'RevealSlidingMenuAnimator', 'PushSlidingMenuAnimator', 'OverlaySlidingMenuAnimator', function ($onsen, $compile, $parse, AnimationChooser, SlidingMenuAnimator, RevealSlidingMenuAnimator, PushSlidingMenuAnimator, OverlaySlidingMenuAnimator) {
var SlidingMenuView = Class.extend({
_scope: undefined,
_attrs: undefined,
_element: undefined,
_menuPage: undefined,
_mainPage: undefined,
_doorLock: undefined,
_isRightMenu: false,
init: function init(scope, element, attrs) {
this._scope = scope;
this._attrs = attrs;
this._element = element;
this._menuPage = angular.element(element[0].querySelector('.onsen-sliding-menu__menu'));
this._mainPage = angular.element(element[0].querySelector('.onsen-sliding-menu__main'));
this._doorLock = new ons._DoorLock();
this._isRightMenu = attrs.side === 'right';
// Close menu on tap event.
this._mainPageGestureDetector = new ons.GestureDetector(this._mainPage[0]);
this._boundOnTap = this._onTap.bind(this);
var maxDistance = this._normalizeMaxSlideDistanceAttr();
this._logic = new SlidingMenuViewModel({ maxDistance: Math.max(maxDistance, 1) });
this._logic.on('translate', this._translate.bind(this));
this._logic.on('open', function (options) {
this._open(options);
}.bind(this));
this._logic.on('close', function (options) {
this._close(options);
}.bind(this));
attrs.$observe('maxSlideDistance', this._onMaxSlideDistanceChanged.bind(this));
attrs.$observe('swipeable', this._onSwipeableChanged.bind(this));
this._boundOnWindowResize = this._onWindowResize.bind(this);
window.addEventListener('resize', this._boundOnWindowResize);
this._boundHandleEvent = this._handleEvent.bind(this);
this._bindEvents();
if (attrs.mainPage) {
this.setMainPage(attrs.mainPage);
}
if (attrs.menuPage) {
this.setMenuPage(attrs.menuPage);
}
this._deviceBackButtonHandler = ons._deviceBackButtonDispatcher.createHandler(this._element[0], this._onDeviceBackButton.bind(this));
var unlock = this._doorLock.lock();
window.setTimeout(function () {
var maxDistance = this._normalizeMaxSlideDistanceAttr();
this._logic.setMaxDistance(maxDistance);
this._menuPage.css({ opacity: 1 });
var animationChooser = new AnimationChooser({
animators: SlidingMenuView._animatorDict,
baseClass: SlidingMenuAnimator,
baseClassName: 'SlidingMenuAnimator',
defaultAnimation: attrs.type,
defaultAnimationOptions: $parse(attrs.animationOptions)()
});
this._animator = animationChooser.newAnimator();
this._animator.setup(this._element, this._mainPage, this._menuPage, {
isRight: this._isRightMenu,
width: this._attrs.maxSlideDistance || '90%'
});
unlock();
}.bind(this), 400);
scope.$on('$destroy', this._destroy.bind(this));
this._clearDerivingEvents = $onsen.deriveEvents(this, element[0], ['init', 'show', 'hide', 'destroy']);
if (!attrs.swipeable) {
this.setSwipeable(true);
}
},
getDeviceBackButtonHandler: function getDeviceBackButtonHandler() {
return this._deviceBackButtonHandler;
},
_onDeviceBackButton: function _onDeviceBackButton(event) {
if (this.isMenuOpened()) {
this.closeMenu();
} else {
event.callParentHandler();
}
},
_onTap: function _onTap() {
if (this.isMenuOpened()) {
this.closeMenu();
}
},
_refreshMenuPageWidth: function _refreshMenuPageWidth() {
var width = 'maxSlideDistance' in this._attrs ? this._attrs.maxSlideDistance : '90%';
if (this._animator) {
this._animator.onResized({
isOpened: this._logic.isOpened(),
width: width
});
}
},
_destroy: function _destroy() {
this.emit('destroy');
this._clearDerivingEvents();
this._deviceBackButtonHandler.destroy();
window.removeEventListener('resize', this._boundOnWindowResize);
this._mainPageGestureDetector.off('tap', this._boundOnTap);
this._element = this._scope = this._attrs = null;
},
_onSwipeableChanged: function _onSwipeableChanged(swipeable) {
swipeable = swipeable === '' || swipeable === undefined || swipeable == 'true';
this.setSwipeable(swipeable);
},
/**
* @param {Boolean} enabled
*/
setSwipeable: function setSwipeable(enabled) {
if (enabled) {
this._activateGestureDetector();
} else {
this._deactivateGestureDetector();
}
},
_onWindowResize: function _onWindowResize() {
this._recalculateMAX();
this._refreshMenuPageWidth();
},
_onMaxSlideDistanceChanged: function _onMaxSlideDistanceChanged() {
this._recalculateMAX();
this._refreshMenuPageWidth();
},
/**
* @return {Number}
*/
_normalizeMaxSlideDistanceAttr: function _normalizeMaxSlideDistanceAttr() {
var maxDistance = this._attrs.maxSlideDistance;
if (!('maxSlideDistance' in this._attrs)) {
maxDistance = 0.9 * this._mainPage[0].clientWidth;
} else if (typeof maxDistance == 'string') {
if (maxDistance.indexOf('px', maxDistance.length - 2) !== -1) {
maxDistance = parseInt(maxDistance.replace('px', ''), 10);
} else if (maxDistance.indexOf('%', maxDistance.length - 1) > 0) {
maxDistance = maxDistance.replace('%', '');
maxDistance = parseFloat(maxDistance) / 100 * this._mainPage[0].clientWidth;
}
} else {
throw new Error('invalid state');
}
return maxDistance;
},
_recalculateMAX: function _recalculateMAX() {
var maxDistance = this._normalizeMaxSlideDistanceAttr();
if (maxDistance) {
this._logic.setMaxDistance(parseInt(maxDistance, 10));
}
},
_activateGestureDetector: function _activateGestureDetector() {
this._gestureDetector.on('touch dragleft dragright swipeleft swiperight release', this._boundHandleEvent);
},
_deactivateGestureDetector: function _deactivateGestureDetector() {
this._gestureDetector.off('touch dragleft dragright swipeleft swiperight release', this._boundHandleEvent);
},
_bindEvents: function _bindEvents() {
this._gestureDetector = new ons.GestureDetector(this._element[0], {
dragMinDistance: 1
});
},
_appendMainPage: function _appendMainPage(pageUrl, templateHTML) {
var _this = this;
var pageScope = this._scope.$new();
var pageContent = angular.element(templateHTML);
var link = $compile(pageContent);
this._mainPage.append(pageContent);
if (this._currentPageElement) {
this._currentPageElement.remove();
this._currentPageScope.$destroy();
}
link(pageScope);
this._currentPageElement = pageContent;
this._currentPageScope = pageScope;
this._currentPageUrl = pageUrl;
setImmediate(function () {
_this._currentPageElement[0]._show();
});
},
/**
* @param {String}
*/
_appendMenuPage: function _appendMenuPage(templateHTML) {
var pageScope = this._scope.$new();
var pageContent = angular.element(templateHTML);
var link = $compile(pageContent);
this._menuPage.append(pageContent);
if (this._currentMenuPageScope) {
this._currentMenuPageScope.$destroy();
this._currentMenuPageElement.remove();
}
link(pageScope);
this._currentMenuPageElement = pageContent;
this._currentMenuPageScope = pageScope;
},
/**
* @param {String} page
* @param {Object} options
* @param {Boolean} [options.closeMenu]
* @param {Boolean} [options.callback]
*/
setMenuPage: function setMenuPage(page, options) {
if (page) {
options = options || {};
options.callback = options.callback || function () {};
var self = this;
$onsen.getPageHTMLAsync(page).then(function (html) {
self._appendMenuPage(angular.element(html));
if (options.closeMenu) {
self.close();
}
options.callback();
}, function () {
throw new Error('Page is not found: ' + page);
});
} else {
throw new Error('cannot set undefined page');
}
},
/**
* @param {String} pageUrl
* @param {Object} options
* @param {Boolean} [options.closeMenu]
* @param {Boolean} [options.callback]
*/
setMainPage: function setMainPage(pageUrl, options) {
options = options || {};
options.callback = options.callback || function () {};
var done = function () {
if (options.closeMenu) {
this.close();
}
options.callback();
}.bind(this);
if (this._currentPageUrl === pageUrl) {
done();
return;
}
if (pageUrl) {
var self = this;
$onsen.getPageHTMLAsync(pageUrl).then(function (html) {
self._appendMainPage(pageUrl, html);
done();
}, function () {
throw new Error('Page is not found: ' + page);
});
} else {
throw new Error('cannot set undefined page');
}
},
_handleEvent: function _handleEvent(event) {
if (this._doorLock.isLocked()) {
return;
}
if (this._isInsideIgnoredElement(event.target)) {
this._deactivateGestureDetector();
}
switch (event.type) {
case 'dragleft':
case 'dragright':
if (this._logic.isClosed() && !this._isInsideSwipeTargetArea(event)) {
return;
}
event.gesture.preventDefault();
var deltaX = event.gesture.deltaX;
var deltaDistance = this._isRightMenu ? -deltaX : deltaX;
var startEvent = event.gesture.startEvent;
if (!('isOpened' in startEvent)) {
startEvent.isOpened = this._logic.isOpened();
}
if (deltaDistance < 0 && this._logic.isClosed()) {
break;
}
if (deltaDistance > 0 && this._logic.isOpened()) {
break;
}
var distance = startEvent.isOpened ? deltaDistance + this._logic.getMaxDistance() : deltaDistance;
this._logic.translate(distance);
break;
case 'swipeleft':
event.gesture.preventDefault();
if (this._logic.isClosed() && !this._isInsideSwipeTargetArea(event)) {
return;
}
if (this._isRightMenu) {
this.open();
} else {
this.close();
}
event.gesture.stopDetect();
break;
case 'swiperight':
event.gesture.preventDefault();
if (this._logic.isClosed() && !this._isInsideSwipeTargetArea(event)) {
return;
}
if (this._isRightMenu) {
this.close();
} else {
this.open();
}
event.gesture.stopDetect();
break;
case 'release':
this._lastDistance = null;
if (this._logic.shouldOpen()) {
this.open();
} else if (this._logic.shouldClose()) {
this.close();
}
break;
}
},
/**
* @param {jqLite} element
* @return {Boolean}
*/
_isInsideIgnoredElement: function _isInsideIgnoredElement(element) {
do {
if (element.getAttribute && element.getAttribute('sliding-menu-ignore')) {
return true;
}
element = element.parentNode;
} while (element);
return false;
},
_isInsideSwipeTargetArea: function _isInsideSwipeTargetArea(event) {
var x = event.gesture.center.pageX;
if (!('_swipeTargetWidth' in event.gesture.startEvent)) {
event.gesture.startEvent._swipeTargetWidth = this._getSwipeTargetWidth();
}
var targetWidth = event.gesture.startEvent._swipeTargetWidth;
return this._isRightMenu ? this._mainPage[0].clientWidth - x < targetWidth : x < targetWidth;
},
_getSwipeTargetWidth: function _getSwipeTargetWidth() {
var targetWidth = this._attrs.swipeTargetWidth;
if (typeof targetWidth == 'string') {
targetWidth = targetWidth.replace('px', '');
}
var width = parseInt(targetWidth, 10);
if (width < 0 || !targetWidth) {
return this._mainPage[0].clientWidth;
} else {
return width;
}
},
closeMenu: function closeMenu() {
return this.close.apply(this, arguments);
},
/**
* Close sliding-menu page.
*
* @param {Object} options
*/
close: function close(options) {
options = options || {};
options = typeof options == 'function' ? { callback: options } : options;
if (!this._logic.isClosed()) {
this.emit('preclose', {
slidingMenu: this
});
this._doorLock.waitUnlock(function () {
this._logic.close(options);
}.bind(this));
}
},
_close: function _close(options) {
var callback = options.callback || function () {},
unlock = this._doorLock.lock(),
instant = options.animation == 'none';
this._animator.closeMenu(function () {
unlock();
this._mainPage.children().css('pointer-events', '');
this._mainPageGestureDetector.off('tap', this._boundOnTap);
this.emit('postclose', {
slidingMenu: this
});
callback();
}.bind(this), instant);
},
/**
* Open sliding-menu page.
*
* @param {Object} [options]
* @param {Function} [options.callback]
*/
openMenu: function openMenu() {
return this.open.apply(this, arguments);
},
/**
* Open sliding-menu page.
*
* @param {Object} [options]
* @param {Function} [options.callback]
*/
open: function open(options) {
options = options || {};
options = typeof options == 'function' ? { callback: options } : options;
this.emit('preopen', {
slidingMenu: this
});
this._doorLock.waitUnlock(function () {
this._logic.open(options);
}.bind(this));
},
_open: function _open(options) {
var callback = options.callback || function () {},
unlock = this._doorLock.lock(),
instant = options.animation == 'none';
this._animator.openMenu(function () {
unlock();
this._mainPage.children().css('pointer-events', 'none');
this._mainPageGestureDetector.on('tap', this._boundOnTap);
this.emit('postopen', {
slidingMenu: this
});
callback();
}.bind(this), instant);
},
/**
* Toggle sliding-menu page.
* @param {Object} [options]
* @param {Function} [options.callback]
*/
toggle: function toggle(options) {
if (this._logic.isClosed()) {
this.open(options);
} else {
this.close(options);
}
},
/**
* Toggle sliding-menu page.
*/
toggleMenu: function toggleMenu() {
return this.toggle.apply(this, arguments);
},
/**
* @return {Boolean}
*/
isMenuOpened: function isMenuOpened() {
return this._logic.isOpened();
},
/**
* @param {Object} event
*/
_translate: function _translate(event) {
this._animator.translateMenu(event);
}
});
// Preset sliding menu animators.
SlidingMenuView._animatorDict = {
'default': RevealSlidingMenuAnimator,
'overlay': OverlaySlidingMenuAnimator,
'reveal': RevealSlidingMenuAnimator,
'push': PushSlidingMenuAnimator
};
/**
* @param {String} name
* @param {Function} Animator
*/
SlidingMenuView.registerAnimator = function (name, Animator) {
if (!(Animator.prototype instanceof SlidingMenuAnimator)) {
throw new Error('"Animator" param must inherit SlidingMenuAnimator');
}
this._animatorDict[name] = Animator;
};
MicroEvent.mixin(SlidingMenuView);
return SlidingMenuView;
}]);
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.factory('SlidingMenuAnimator', function () {
return Class.extend({
delay: 0,
duration: 0.4,
timing: 'cubic-bezier(.1, .7, .1, 1)',
/**
* @param {Object} options
* @param {String} options.timing
* @param {Number} options.duration
* @param {Number} options.delay
*/
init: function init(options) {
options = options || {};
this.timing = options.timing || this.timing;
this.duration = options.duration !== undefined ? options.duration : this.duration;
this.delay = options.delay !== undefined ? options.delay : this.delay;
},
/**
* @param {jqLite} element "ons-sliding-menu" or "ons-split-view" element
* @param {jqLite} mainPage
* @param {jqLite} menuPage
* @param {Object} options
* @param {String} options.width "width" style value
* @param {Boolean} options.isRight
*/
setup: function setup(element, mainPage, menuPage, options) {},
/**
* @param {Object} options
* @param {Boolean} options.isRight
* @param {Boolean} options.isOpened
* @param {String} options.width
*/
onResized: function onResized(options) {},
/**
* @param {Function} callback
*/
openMenu: function openMenu(callback) {},
/**
* @param {Function} callback
*/
closeClose: function closeClose(callback) {},
/**
*/
destroy: function destroy() {},
/**
* @param {Object} options
* @param {Number} options.distance
* @param {Number} options.maxDistance
*/
translateMenu: function translateMenu(mainPage, menuPage, options) {},
/**
* @return {SlidingMenuAnimator}
*/
copy: function copy() {
throw new Error('Override copy method.');
}
});
});
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.factory('SpeedDialView', ['$onsen', function ($onsen) {
/**
* @class SpeedDialView
*/
var SpeedDialView = Class.extend({
/**
* @param {Object} scope
* @param {jqLite} element
* @param {Object} attrs
*/
init: function init(scope, element, attrs) {
this._element = element;
this._scope = scope;
this._attrs = attrs;
this._scope.$on('$destroy', this._destroy.bind(this));
this._clearDerivingMethods = $onsen.deriveMethods(this, element[0], ['show', 'hide', 'showItems', 'hideItems', 'isOpen', 'toggle', 'toggleItems']);
this._clearDerivingEvents = $onsen.deriveEvents(this, element[0], ['open', 'close']).bind(this);
},
_destroy: function _destroy() {
this.emit('destroy');
this._clearDerivingEvents();
this._clearDerivingMethods();
this._element = this._scope = this._attrs = null;
}
});
MicroEvent.mixin(SpeedDialView);
$onsen.derivePropertiesFromElement(SpeedDialView, ['disabled', 'visible', 'inline']);
return SpeedDialView;
}]);
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.factory('SplitView', ['$compile', 'RevealSlidingMenuAnimator', '$onsen', '$onsGlobal', function ($compile, RevealSlidingMenuAnimator, $onsen, $onsGlobal) {
var SPLIT_MODE = 0;
var COLLAPSE_MODE = 1;
var MAIN_PAGE_RATIO = 0.9;
var SplitView = Class.extend({
init: function init(scope, element, attrs) {
element.addClass('onsen-sliding-menu');
this._element = element;
this._scope = scope;
this._attrs = attrs;
this._mainPage = angular.element(element[0].querySelector('.onsen-split-view__main'));
this._secondaryPage = angular.element(element[0].querySelector('.onsen-split-view__secondary'));
this._max = this._mainPage[0].clientWidth * MAIN_PAGE_RATIO;
this._mode = SPLIT_MODE;
this._doorLock = new ons._DoorLock();
this._doSplit = false;
this._doCollapse = false;
$onsGlobal.orientation.on('change', this._onResize.bind(this));
this._animator = new RevealSlidingMenuAnimator();
this._element.css('display', 'none');
if (attrs.mainPage) {
this.setMainPage(attrs.mainPage);
}
if (attrs.secondaryPage) {
this.setSecondaryPage(attrs.secondaryPage);
}
var unlock = this._doorLock.lock();
this._considerChangingCollapse();
this._setSize();
setTimeout(function () {
this._element.css('display', 'block');
unlock();
}.bind(this), 1000 / 60 * 2);
scope.$on('$destroy', this._destroy.bind(this));
this._clearDerivingEvents = $onsen.deriveEvents(this, element[0], ['init', 'show', 'hide', 'destroy']);
},
/**
* @param {String} templateHTML
*/
_appendSecondPage: function _appendSecondPage(templateHTML) {
var pageScope = this._scope.$new();
var pageContent = $compile(templateHTML)(pageScope);
this._secondaryPage.append(pageContent);
if (this._currentSecondaryPageElement) {
this._currentSecondaryPageElement.remove();
this._currentSecondaryPageScope.$destroy();
}
this._currentSecondaryPageElement = pageContent;
this._currentSecondaryPageScope = pageScope;
},
/**
* @param {String} templateHTML
*/
_appendMainPage: function _appendMainPage(templateHTML) {
var _this = this;
var pageScope = this._scope.$new();
var pageContent = $compile(templateHTML)(pageScope);
this._mainPage.append(pageContent);
if (this._currentPage) {
this._currentPageScope.$destroy();
}
this._currentPage = pageContent;
this._currentPageScope = pageScope;
setImmediate(function () {
_this._currentPage[0]._show();
});
},
/**
* @param {String} page
*/
setSecondaryPage: function setSecondaryPage(page) {
if (page) {
$onsen.getPageHTMLAsync(page).then(function (html) {
this._appendSecondPage(angular.element(html.trim()));
}.bind(this), function () {
throw new Error('Page is not found: ' + page);
});
} else {
throw new Error('cannot set undefined page');
}
},
/**
* @param {String} page
*/
setMainPage: function setMainPage(page) {
if (page) {
$onsen.getPageHTMLAsync(page).then(function (html) {
this._appendMainPage(angular.element(html.trim()));
}.bind(this), function () {
throw new Error('Page is not found: ' + page);
});
} else {
throw new Error('cannot set undefined page');
}
},
_onResize: function _onResize() {
var lastMode = this._mode;
this._considerChangingCollapse();
if (lastMode === COLLAPSE_MODE && this._mode === COLLAPSE_MODE) {
this._animator.onResized({
isOpened: false,
width: '90%'
});
}
this._max = this._mainPage[0].clientWidth * MAIN_PAGE_RATIO;
},
_considerChangingCollapse: function _considerChangingCollapse() {
var should = this._shouldCollapse();
if (should && this._mode !== COLLAPSE_MODE) {
this._fireUpdateEvent();
if (this._doSplit) {
this._activateSplitMode();
} else {
this._activateCollapseMode();
}
} else if (!should && this._mode === COLLAPSE_MODE) {
this._fireUpdateEvent();
if (this._doCollapse) {
this._activateCollapseMode();
} else {
this._activateSplitMode();
}
}
this._doCollapse = this._doSplit = false;
},
update: function update() {
this._fireUpdateEvent();
var should = this._shouldCollapse();
if (this._doSplit) {
this._activateSplitMode();
} else if (this._doCollapse) {
this._activateCollapseMode();
} else if (should) {
this._activateCollapseMode();
} else if (!should) {
this._activateSplitMode();
}
this._doSplit = this._doCollapse = false;
},
_getOrientation: function _getOrientation() {
if ($onsGlobal.orientation.isPortrait()) {
return 'portrait';
} else {
return 'landscape';
}
},
getCurrentMode: function getCurrentMode() {
if (this._mode === COLLAPSE_MODE) {
return 'collapse';
} else {
return 'split';
}
},
_shouldCollapse: function _shouldCollapse() {
var c = 'portrait';
if (typeof this._attrs.collapse === 'string') {
c = this._attrs.collapse.trim();
}
if (c == 'portrait') {
return $onsGlobal.orientation.isPortrait();
} else if (c == 'landscape') {
return $onsGlobal.orientation.isLandscape();
} else if (c.substr(0, 5) == 'width') {
var num = c.split(' ')[1];
if (num.indexOf('px') >= 0) {
num = num.substr(0, num.length - 2);
}
var width = window.innerWidth;
return isNumber(num) && width < num;
} else {
var mq = window.matchMedia(c);
return mq.matches;
}
},
_setSize: function _setSize() {
if (this._mode === SPLIT_MODE) {
if (!this._attrs.mainPageWidth) {
this._attrs.mainPageWidth = '70';
}
var secondarySize = 100 - this._attrs.mainPageWidth.replace('%', '');
this._secondaryPage.css({
width: secondarySize + '%',
opacity: 1
});
this._mainPage.css({
width: this._attrs.mainPageWidth + '%'
});
this._mainPage.css('left', secondarySize + '%');
}
},
_fireEvent: function _fireEvent(name) {
this.emit(name, {
splitView: this,
width: window.innerWidth,
orientation: this._getOrientation()
});
},
_fireUpdateEvent: function _fireUpdateEvent() {
var that = this;
this.emit('update', {
splitView: this,
shouldCollapse: this._shouldCollapse(),
currentMode: this.getCurrentMode(),
split: function split() {
that._doSplit = true;
that._doCollapse = false;
},
collapse: function collapse() {
that._doSplit = false;
that._doCollapse = true;
},
width: window.innerWidth,
orientation: this._getOrientation()
});
},
_activateCollapseMode: function _activateCollapseMode() {
if (this._mode !== COLLAPSE_MODE) {
this._fireEvent('precollapse');
this._secondaryPage.attr('style', '');
this._mainPage.attr('style', '');
this._mode = COLLAPSE_MODE;
this._animator.setup(this._element, this._mainPage, this._secondaryPage, { isRight: false, width: '90%' });
this._fireEvent('postcollapse');
}
},
_activateSplitMode: function _activateSplitMode() {
if (this._mode !== SPLIT_MODE) {
this._fireEvent('presplit');
this._animator.destroy();
this._secondaryPage.attr('style', '');
this._mainPage.attr('style', '');
this._mode = SPLIT_MODE;
this._setSize();
this._fireEvent('postsplit');
}
},
_destroy: function _destroy() {
this.emit('destroy');
this._clearDerivingEvents();
this._element = null;
this._scope = null;
}
});
function isNumber(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
MicroEvent.mixin(SplitView);
return SplitView;
}]);
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
angular.module('onsen').factory('SplitterContent', ['$onsen', '$compile', function ($onsen, $compile) {
var SplitterContent = Class.extend({
init: function init(scope, element, attrs) {
this._element = element;
this._scope = scope;
this._attrs = attrs;
this.load = this._element[0].load.bind(this._element[0]);
scope.$on('$destroy', this._destroy.bind(this));
},
_destroy: function _destroy() {
this.emit('destroy');
this._element = this._scope = this._attrs = this.load = this._pageScope = null;
}
});
MicroEvent.mixin(SplitterContent);
$onsen.derivePropertiesFromElement(SplitterContent, ['page']);
return SplitterContent;
}]);
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
angular.module('onsen').factory('SplitterSide', ['$onsen', '$compile', function ($onsen, $compile) {
var SplitterSide = Class.extend({
init: function init(scope, element, attrs) {
var _this = this;
this._element = element;
this._scope = scope;
this._attrs = attrs;
this._clearDerivingMethods = $onsen.deriveMethods(this, this._element[0], ['open', 'close', 'toggle', 'load']);
this._clearDerivingEvents = $onsen.deriveEvents(this, element[0], ['modechange', 'preopen', 'preclose', 'postopen', 'postclose'], function (detail) {
return detail.side ? angular.extend(detail, { side: _this }) : detail;
});
scope.$on('$destroy', this._destroy.bind(this));
},
_destroy: function _destroy() {
this.emit('destroy');
this._clearDerivingMethods();
this._clearDerivingEvents();
this._element = this._scope = this._attrs = null;
}
});
MicroEvent.mixin(SplitterSide);
$onsen.derivePropertiesFromElement(SplitterSide, ['page', 'mode', 'isOpen']);
return SplitterSide;
}]);
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
angular.module('onsen').factory('Splitter', ['$onsen', function ($onsen) {
var Splitter = Class.extend({
init: function init(scope, element, attrs) {
this._element = element;
this._scope = scope;
this._attrs = attrs;
scope.$on('$destroy', this._destroy.bind(this));
},
_destroy: function _destroy() {
this.emit('destroy');
this._element = this._scope = this._attrs = null;
}
});
MicroEvent.mixin(Splitter);
$onsen.derivePropertiesFromElement(Splitter, ['onDeviceBackButton']);
['left', 'right', 'content', 'mask'].forEach(function (prop, i) {
Object.defineProperty(Splitter.prototype, prop, {
get: function get() {
var tagName = 'ons-splitter-' + (i < 2 ? 'side' : prop);
return angular.element(this._element[0][prop]).data(tagName);
}
});
});
return Splitter;
}]);
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
angular.module('onsen').factory('SwitchView', ['$parse', '$onsen', function ($parse, $onsen) {
var SwitchView = Class.extend({
/**
* @param {jqLite} element
* @param {Object} scope
* @param {Object} attrs
*/
init: function init(element, scope, attrs) {
var _this = this;
this._element = element;
this._checkbox = angular.element(element[0].querySelector('input[type=checkbox]'));
this._scope = scope;
this._prepareNgModel(element, scope, attrs);
this._scope.$on('$destroy', function () {
_this.emit('destroy');
_this._element = _this._checkbox = _this._scope = null;
});
},
_prepareNgModel: function _prepareNgModel(element, scope, attrs) {
var _this2 = this;
if (attrs.ngModel) {
var set = $parse(attrs.ngModel).assign;
scope.$parent.$watch(attrs.ngModel, function (value) {
_this2.checked = !!value;
});
this._element.on('change', function (e) {
set(scope.$parent, _this2.checked);
if (attrs.ngChange) {
scope.$eval(attrs.ngChange);
}
scope.$parent.$evalAsync();
});
}
}
});
MicroEvent.mixin(SwitchView);
$onsen.derivePropertiesFromElement(SwitchView, ['disabled', 'checked', 'checkbox']);
return SwitchView;
}]);
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.value('TabbarNoneAnimator', ons._internal.TabbarNoneAnimator);
module.value('TabbarFadeAnimator', ons._internal.TabbarFadeAnimator);
module.value('TabbarSlideAnimator', ons._internal.TabbarSlideAnimator);
module.factory('TabbarView', ['$onsen', function ($onsen) {
var TabbarView = Class.extend({
init: function init(scope, element, attrs) {
if (element[0].nodeName.toLowerCase() !== 'ons-tabbar') {
throw new Error('"element" parameter must be a "ons-tabbar" element.');
}
this._scope = scope;
this._element = element;
this._attrs = attrs;
this._lastPageElement = null;
this._lastPageScope = null;
this._scope.$on('$destroy', this._destroy.bind(this));
this._clearDerivingEvents = $onsen.deriveEvents(this, element[0], ['reactive', 'postchange', 'prechange', 'init', 'show', 'hide', 'destroy']);
this._clearDerivingMethods = $onsen.deriveMethods(this, element[0], ['setActiveTab', 'setTabbarVisibility', 'getActiveTabIndex', 'loadPage']);
},
_destroy: function _destroy() {
this.emit('destroy');
this._clearDerivingEvents();
this._clearDerivingMethods();
this._element = this._scope = this._attrs = null;
}
});
MicroEvent.mixin(TabbarView);
TabbarView.registerAnimator = function (name, Animator) {
return window.ons.TabbarElement.registerAnimator(name, Animator);
};
return TabbarView;
}]);
})();
'use strict';
/**
* @element ons-alert-dialog
*/
/**
* @attribute var
* @initonly
* @type {String}
* @description
* [en]Variable name to refer this alert dialog.[/en]
* [ja]このアラートダイアログを参照するための名前を指定します。[/ja]
*/
/**
* @attribute ons-preshow
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "preshow" event is fired.[/en]
* [ja]"preshow"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-prehide
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "prehide" event is fired.[/en]
* [ja]"prehide"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-postshow
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "postshow" event is fired.[/en]
* [ja]"postshow"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-posthide
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "posthide" event is fired.[/en]
* [ja]"posthide"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-destroy
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "destroy" event is fired.[/en]
* [ja]"destroy"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @method on
* @signature on(eventName, listener)
* @description
* [en]Add an event listener.[/en]
* [ja]イベントリスナーを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]イベントが発火された際に呼び出されるコールバックを指定します。[/ja]
*/
/**
* @method once
* @signature once(eventName, listener)
* @description
* [en]Add an event listener that's only triggered once.[/en]
* [ja]一度だけ呼び出されるイベントリスナーを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]イベントが発火した際に呼び出されるコールバックを指定します。[/ja]
*/
/**
* @method off
* @signature off(eventName, [listener])
* @description
* [en]Remove an event listener. If the listener is not specified all listeners for the event type will be removed.[/en]
* [ja]イベントリスナーを削除します。もしlistenerパラメータが指定されなかった場合、そのイベントのリスナーが全て削除されます。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]削除するイベントリスナーの関数オブジェクトを渡します。[/ja]
*/
(function () {
'use strict';
/**
* Alert dialog directive.
*/
angular.module('onsen').directive('onsAlertDialog', ['$onsen', 'AlertDialogView', function ($onsen, AlertDialogView) {
return {
restrict: 'E',
replace: false,
scope: true,
transclude: false,
compile: function compile(element, attrs) {
return {
pre: function pre(scope, element, attrs) {
var alertDialog = new AlertDialogView(scope, element, attrs);
$onsen.declareVarAttribute(attrs, alertDialog);
$onsen.registerEventHandlers(alertDialog, 'preshow prehide postshow posthide destroy');
$onsen.addModifierMethodsForCustomElements(alertDialog, element);
element.data('ons-alert-dialog', alertDialog);
element.data('_scope', scope);
scope.$on('$destroy', function () {
alertDialog._events = undefined;
$onsen.removeModifierMethods(alertDialog);
element.data('ons-alert-dialog', undefined);
element = null;
});
},
post: function post(scope, element) {
$onsen.fireComponentEvent(element[0], 'init');
}
};
}
};
}]);
})();
'use strict';
(function () {
'use strict';
var module = angular.module('onsen');
module.directive('onsBackButton', ['$onsen', '$compile', 'GenericView', 'ComponentCleaner', function ($onsen, $compile, GenericView, ComponentCleaner) {
return {
restrict: 'E',
replace: false,
compile: function compile(element, attrs) {
return {
pre: function pre(scope, element, attrs, controller, transclude) {
var backButton = GenericView.register(scope, element, attrs, {
viewKey: 'ons-back-button'
});
scope.$on('$destroy', function () {
backButton._events = undefined;
$onsen.removeModifierMethods(backButton);
element = null;
});
ComponentCleaner.onDestroy(scope, function () {
ComponentCleaner.destroyScope(scope);
ComponentCleaner.destroyAttributes(attrs);
element = scope = attrs = null;
});
},
post: function post(scope, element) {
$onsen.fireComponentEvent(element[0], 'init');
}
};
}
};
}]);
})();
'use strict';
(function () {
'use strict';
angular.module('onsen').directive('onsBottomToolbar', ['$onsen', 'GenericView', function ($onsen, GenericView) {
return {
restrict: 'E',
link: {
pre: function pre(scope, element, attrs) {
GenericView.register(scope, element, attrs, {
viewKey: 'ons-bottomToolbar'
});
},
post: function post(scope, element, attrs) {
$onsen.fireComponentEvent(element[0], 'init');
}
}
};
}]);
})();
'use strict';
/**
* @element ons-button
*/
(function () {
'use strict';
angular.module('onsen').directive('onsButton', ['$onsen', 'GenericView', function ($onsen, GenericView) {
return {
restrict: 'E',
link: function link(scope, element, attrs) {
var button = GenericView.register(scope, element, attrs, {
viewKey: 'ons-button'
});
Object.defineProperty(button, 'disabled', {
get: function get() {
return this._element[0].disabled;
},
set: function set(value) {
return this._element[0].disabled = value;
}
});
$onsen.fireComponentEvent(element[0], 'init');
}
};
}]);
})();
'use strict';
/**
* @element ons-carousel
* @description
* [en]Carousel component.[/en]
* [ja]カルーセルを表示できるコンポーネント。[/ja]
* @codepen xbbzOQ
* @guide UsingCarousel
* [en]Learn how to use the carousel component.[/en]
* [ja]carouselコンポーネントの使い方[/ja]
* @example
* <ons-carousel style="width: 100%; height: 200px">
* <ons-carousel-item>
* ...
* </ons-carousel-item>
* <ons-carousel-item>
* ...
* </ons-carousel-item>
* </ons-carousel>
*/
/**
* @attribute var
* @initonly
* @type {String}
* @description
* [en]Variable name to refer this carousel.[/en]
* [ja]このカルーセルを参照するための変数名を指定します。[/ja]
*/
/**
* @attribute ons-postchange
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "postchange" event is fired.[/en]
* [ja]"postchange"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-refresh
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "refresh" event is fired.[/en]
* [ja]"refresh"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-overscroll
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "overscroll" event is fired.[/en]
* [ja]"overscroll"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-destroy
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "destroy" event is fired.[/en]
* [ja]"destroy"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @method once
* @signature once(eventName, listener)
* @description
* [en]Add an event listener that's only triggered once.[/en]
* [ja]一度だけ呼び出されるイベントリスナを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]イベントが発火した際に呼び出される関数オブジェクトを指定します。[/ja]
*/
/**
* @method off
* @signature off(eventName, [listener])
* @description
* [en]Remove an event listener. If the listener is not specified all listeners for the event type will be removed.[/en]
* [ja]イベントリスナーを削除します。もしイベントリスナーが指定されなかった場合には、そのイベントに紐付いているイベントリスナーが全て削除されます。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]イベントが発火した際に呼び出される関数オブジェクトを指定します。[/ja]
*/
/**
* @method on
* @signature on(eventName, listener)
* @description
* [en]Add an event listener.[/en]
* [ja]イベントリスナーを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]イベントが発火した際に呼び出される関数オブジェクトを指定します。[/ja]
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.directive('onsCarousel', ['$onsen', 'CarouselView', function ($onsen, CarouselView) {
return {
restrict: 'E',
replace: false,
// NOTE: This element must coexists with ng-controller.
// Do not use isolated scope and template's ng-transclude.
scope: false,
transclude: false,
compile: function compile(element, attrs) {
return function (scope, element, attrs) {
var carousel = new CarouselView(scope, element, attrs);
element.data('ons-carousel', carousel);
$onsen.registerEventHandlers(carousel, 'postchange refresh overscroll destroy');
$onsen.declareVarAttribute(attrs, carousel);
scope.$on('$destroy', function () {
carousel._events = undefined;
element.data('ons-carousel', undefined);
element = null;
});
$onsen.fireComponentEvent(element[0], 'init');
};
}
};
}]);
module.directive('onsCarouselItem', function () {
return {
restrict: 'E',
compile: function compile(element, attrs) {
return function (scope, element, attrs) {
if (scope.$last) {
element[0].parentElement._setup();
element[0].parentElement._setupInitialIndex();
element[0].parentElement._saveLastState();
}
};
}
};
});
})();
'use strict';
/**
* @element ons-dialog
*/
/**
* @attribute var
* @initonly
* @type {String}
* @description
* [en]Variable name to refer this dialog.[/en]
* [ja]このダイアログを参照するための名前を指定します。[/ja]
*/
/**
* @attribute ons-preshow
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "preshow" event is fired.[/en]
* [ja]"preshow"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-prehide
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "prehide" event is fired.[/en]
* [ja]"prehide"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-postshow
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "postshow" event is fired.[/en]
* [ja]"postshow"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-posthide
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "posthide" event is fired.[/en]
* [ja]"posthide"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-destroy
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "destroy" event is fired.[/en]
* [ja]"destroy"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @method on
* @signature on(eventName, listener)
* @description
* [en]Add an event listener.[/en]
* [ja]イベントリスナーを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]イベントが発火した際に呼び出される関数オブジェクトを指定します。[/ja]
*/
/**
* @method once
* @signature once(eventName, listener)
* @description
* [en]Add an event listener that's only triggered once.[/en]
* [ja]一度だけ呼び出されるイベントリスナを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]イベントが発火した際に呼び出される関数オブジェクトを指定します。[/ja]
*/
/**
* @method off
* @signature off(eventName, [listener])
* @description
* [en]Remove an event listener. If the listener is not specified all listeners for the event type will be removed.[/en]
* [ja]イベントリスナーを削除します。もしイベントリスナーが指定されなかった場合には、そのイベントに紐付いているイベントリスナーが全て削除されます。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]イベントが発火した際に呼び出される関数オブジェクトを指定します。[/ja]
*/
(function () {
'use strict';
angular.module('onsen').directive('onsDialog', ['$onsen', 'DialogView', function ($onsen, DialogView) {
return {
restrict: 'E',
scope: true,
compile: function compile(element, attrs) {
return {
pre: function pre(scope, element, attrs) {
var dialog = new DialogView(scope, element, attrs);
$onsen.declareVarAttribute(attrs, dialog);
$onsen.registerEventHandlers(dialog, 'preshow prehide postshow posthide destroy');
$onsen.addModifierMethodsForCustomElements(dialog, element);
element.data('ons-dialog', dialog);
scope.$on('$destroy', function () {
dialog._events = undefined;
$onsen.removeModifierMethods(dialog);
element.data('ons-dialog', undefined);
element = null;
});
},
post: function post(scope, element) {
$onsen.fireComponentEvent(element[0], 'init');
}
};
}
};
}]);
})();
'use strict';
(function () {
'use strict';
var module = angular.module('onsen');
module.directive('onsDummyForInit', ['$rootScope', function ($rootScope) {
var isReady = false;
return {
restrict: 'E',
replace: false,
link: {
post: function post(scope, element) {
if (!isReady) {
isReady = true;
$rootScope.$broadcast('$ons-ready');
}
element.remove();
}
}
};
}]);
})();
'use strict';
/**
* @element ons-fab
*/
/**
* @attribute var
* @initonly
* @type {String}
* @description
* [en]Variable name to refer the floating action button.[/en]
* [ja]このフローティングアクションボタンを参照するための変数名をしてします。[/ja]
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.directive('onsFab', ['$onsen', 'FabView', function ($onsen, FabView) {
return {
restrict: 'E',
replace: false,
scope: false,
transclude: false,
compile: function compile(element, attrs) {
return function (scope, element, attrs) {
var fab = new FabView(scope, element, attrs);
element.data('ons-fab', fab);
$onsen.declareVarAttribute(attrs, fab);
scope.$on('$destroy', function () {
element.data('ons-fab', undefined);
element = null;
});
$onsen.fireComponentEvent(element[0], 'init');
};
}
};
}]);
})();
'use strict';
(function () {
'use strict';
var EVENTS = ('drag dragleft dragright dragup dragdown hold release swipe swipeleft swiperight ' + 'swipeup swipedown tap doubletap touch transform pinch pinchin pinchout rotate').split(/ +/);
angular.module('onsen').directive('onsGestureDetector', ['$onsen', function ($onsen) {
var scopeDef = EVENTS.reduce(function (dict, name) {
dict['ng' + titlize(name)] = '&';
return dict;
}, {});
function titlize(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
}
return {
restrict: 'E',
scope: scopeDef,
// NOTE: This element must coexists with ng-controller.
// Do not use isolated scope and template's ng-transclude.
replace: false,
transclude: true,
compile: function compile(element, attrs) {
return function link(scope, element, attrs, _, transclude) {
transclude(scope.$parent, function (cloned) {
element.append(cloned);
});
var handler = function handler(event) {
var attr = 'ng' + titlize(event.type);
if (attr in scopeDef) {
scope[attr]({ $event: event });
}
};
var gestureDetector;
setImmediate(function () {
gestureDetector = element[0]._gestureDetector;
gestureDetector.on(EVENTS.join(' '), handler);
});
$onsen.cleaner.onDestroy(scope, function () {
gestureDetector.off(EVENTS.join(' '), handler);
$onsen.clearComponent({
scope: scope,
element: element,
attrs: attrs
});
gestureDetector.element = scope = element = attrs = null;
});
$onsen.fireComponentEvent(element[0], 'init');
};
}
};
}]);
})();
'use strict';
/**
* @element ons-icon
*/
(function () {
'use strict';
angular.module('onsen').directive('onsIcon', ['$onsen', 'GenericView', function ($onsen, GenericView) {
return {
restrict: 'E',
compile: function compile(element, attrs) {
if (attrs.icon.indexOf('{{') !== -1) {
attrs.$observe('icon', function () {
setImmediate(function () {
return element[0]._update();
});
});
}
return function (scope, element, attrs) {
GenericView.register(scope, element, attrs, {
viewKey: 'ons-icon'
});
// $onsen.fireComponentEvent(element[0], 'init');
};
}
};
}]);
})();
'use strict';
/**
* @element ons-if-orientation
* @category conditional
* @description
* [en]Conditionally display content depending on screen orientation. Valid values are portrait and landscape. Different from other components, this component is used as attribute in any element.[/en]
* [ja]画面の向きに応じてコンテンツの制御を行います。portraitもしくはlandscapeを指定できます。すべての要素の属性に使用できます。[/ja]
* @seealso ons-if-platform [en]ons-if-platform component[/en][ja]ons-if-platformコンポーネント[/ja]
* @guide UtilityAPIs [en]Other utility APIs[/en][ja]他のユーティリティAPI[/ja]
* @example
* <div ons-if-orientation="portrait">
* <p>This will only be visible in portrait mode.</p>
* </div>
*/
/**
* @attribute ons-if-orientation
* @initonly
* @type {String}
* @description
* [en]Either "portrait" or "landscape".[/en]
* [ja]portraitもしくはlandscapeを指定します。[/ja]
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.directive('onsIfOrientation', ['$onsen', '$onsGlobal', function ($onsen, $onsGlobal) {
return {
restrict: 'A',
replace: false,
// NOTE: This element must coexists with ng-controller.
// Do not use isolated scope and template's ng-transclude.
transclude: false,
scope: false,
compile: function compile(element) {
element.css('display', 'none');
return function (scope, element, attrs) {
attrs.$observe('onsIfOrientation', update);
$onsGlobal.orientation.on('change', update);
update();
$onsen.cleaner.onDestroy(scope, function () {
$onsGlobal.orientation.off('change', update);
$onsen.clearComponent({
element: element,
scope: scope,
attrs: attrs
});
element = scope = attrs = null;
});
function update() {
var userOrientation = ('' + attrs.onsIfOrientation).toLowerCase();
var orientation = getLandscapeOrPortrait();
if (userOrientation === 'portrait' || userOrientation === 'landscape') {
if (userOrientation === orientation) {
element.css('display', '');
} else {
element.css('display', 'none');
}
}
}
function getLandscapeOrPortrait() {
return $onsGlobal.orientation.isPortrait() ? 'portrait' : 'landscape';
}
};
}
};
}]);
})();
'use strict';
/**
* @element ons-if-platform
* @category conditional
* @description
* [en]Conditionally display content depending on the platform / browser. Valid values are "opera", "firefox", "safari", "chrome", "ie", "edge", "android", "blackberry", "ios" and "wp".[/en]
* [ja]プラットフォームやブラウザーに応じてコンテンツの制御をおこないます。opera, firefox, safari, chrome, ie, edge, android, blackberry, ios, wpのいずれかの値を空白区切りで複数指定できます。[/ja]
* @seealso ons-if-orientation [en]ons-if-orientation component[/en][ja]ons-if-orientationコンポーネント[/ja]
* @guide UtilityAPIs [en]Other utility APIs[/en][ja]他のユーティリティAPI[/ja]
* @example
* <div ons-if-platform="android">
* ...
* </div>
*/
/**
* @attribute ons-if-platform
* @type {String}
* @initonly
* @description
* [en]One or multiple space separated values: "opera", "firefox", "safari", "chrome", "ie", "edge", "android", "blackberry", "ios" or "wp".[/en]
* [ja]"opera", "firefox", "safari", "chrome", "ie", "edge", "android", "blackberry", "ios", "wp"のいずれか空白区切りで複数指定できます。[/ja]
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.directive('onsIfPlatform', ['$onsen', function ($onsen) {
return {
restrict: 'A',
replace: false,
// NOTE: This element must coexists with ng-controller.
// Do not use isolated scope and template's ng-transclude.
transclude: false,
scope: false,
compile: function compile(element) {
element.css('display', 'none');
var platform = getPlatformString();
return function (scope, element, attrs) {
attrs.$observe('onsIfPlatform', function (userPlatform) {
if (userPlatform) {
update();
}
});
update();
$onsen.cleaner.onDestroy(scope, function () {
$onsen.clearComponent({
element: element,
scope: scope,
attrs: attrs
});
element = scope = attrs = null;
});
function update() {
var userPlatforms = attrs.onsIfPlatform.toLowerCase().trim().split(/\s+/);
if (userPlatforms.indexOf(platform.toLowerCase()) >= 0) {
element.css('display', 'block');
} else {
element.css('display', 'none');
}
}
};
function getPlatformString() {
if (navigator.userAgent.match(/Android/i)) {
return 'android';
}
if (navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/RIM Tablet OS/i) || navigator.userAgent.match(/BB10/i)) {
return 'blackberry';
}
if (navigator.userAgent.match(/iPhone|iPad|iPod/i)) {
return 'ios';
}
if (navigator.userAgent.match(/Windows Phone|IEMobile|WPDesktop/i)) {
return 'wp';
}
// Opera 8.0+ (UA detection to detect Blink/v8-powered Opera)
var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
if (isOpera) {
return 'opera';
}
var isFirefox = typeof InstallTrigger !== 'undefined'; // Firefox 1.0+
if (isFirefox) {
return 'firefox';
}
var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
// At least Safari 3+: "[object HTMLElementConstructor]"
if (isSafari) {
return 'safari';
}
var isEdge = navigator.userAgent.indexOf(' Edge/') >= 0;
if (isEdge) {
return 'edge';
}
var isChrome = !!window.chrome && !isOpera && !isEdge; // Chrome 1+
if (isChrome) {
return 'chrome';
}
var isIE = /*@cc_on!@*/false || !!document.documentMode; // At least IE6
if (isIE) {
return 'ie';
}
return 'unknown';
}
}
};
}]);
})();
'use strict';
/**
* @ngdoc directive
* @id input
* @name ons-input
* @category form
* @description
* [en]Input component.[/en]
* [ja]inputコンポ―ネントです。[/ja]
* @codepen ojQxLj
* @guide UsingFormComponents
* [en]Using form components[/en]
* [ja]フォームを使う[/ja]
* @guide EventHandling
* [en]Event handling descriptions[/en]
* [ja]イベント処理の使い方[/ja]
* @example
* <ons-input></ons-input>
* <ons-input modifier="material" label="Username"></ons-input>
*/
/**
* @ngdoc attribute
* @name label
* @type {String}
* @description
* [en]Text for animated floating label.[/en]
* [ja]アニメーションさせるフローティングラベルのテキストを指定します。[/ja]
*/
/**
* @ngdoc attribute
* @name float
* @description
* [en]If this attribute is present, the label will be animated.[/en]
* [ja]この属性が設定された時、ラベルはアニメーションするようになります。[/ja]
*/
/**
* @ngdoc attribute
* @name ng-model
* @extensionOf angular
* @description
* [en]Bind the value to a model. Works just like for normal input elements.[/en]
* [ja]この要素の値をモデルに紐付けます。通常のinput要素の様に動作します。[/ja]
*/
/**
* @ngdoc attribute
* @name ng-change
* @extensionOf angular
* @description
* [en]Executes an expression when the value changes. Works just like for normal input elements.[/en]
* [ja]値が変わった時にこの属性で指定したexpressionが実行されます。通常のinput要素の様に動作します。[/ja]
*/
(function () {
'use strict';
angular.module('onsen').directive('onsInput', ['$parse', function ($parse) {
return {
restrict: 'E',
replace: false,
scope: false,
link: function link(scope, element, attrs) {
var el = element[0];
var onInput = function onInput() {
var set = $parse(attrs.ngModel).assign;
if (el._isTextInput) {
el.type === 'number' ? set(scope, Number(el.value)) : set(scope, el.value);
} else if (el.type === 'radio' && el.checked) {
set(scope, el.value);
} else {
set(scope, el.checked);
}
if (attrs.ngChange) {
scope.$eval(attrs.ngChange);
}
scope.$parent.$evalAsync();
};
if (attrs.ngModel) {
scope.$watch(attrs.ngModel, function (value) {
if (el._isTextInput) {
if (typeof value !== 'undefined' && value !== el.value) {
el.value = value;
}
} else if (el.type === 'radio') {
el.checked = value === el.value;
} else {
el.checked = value;
}
});
el._isTextInput ? element.on('input', onInput) : element.on('change', onInput);
}
scope.$on('$destroy', function () {
el._isTextInput ? element.off('input', onInput) : element.off('change', onInput);
scope = element = attrs = el = null;
});
}
};
}]);
})();
'use strict';
/**
* @element ons-keyboard-active
* @category form
* @description
* [en]
* Conditionally display content depending on if the software keyboard is visible or hidden.
* This component requires cordova and that the com.ionic.keyboard plugin is installed.
* [/en]
* [ja]
* ソフトウェアキーボードが表示されているかどうかで、コンテンツを表示するかどうかを切り替えることが出来ます。
* このコンポーネントは、Cordovaやcom.ionic.keyboardプラグインを必要とします。
* [/ja]
* @guide UtilityAPIs
* [en]Other utility APIs[/en]
* [ja]他のユーティリティAPI[/ja]
* @example
* <div ons-keyboard-active>
* This will only be displayed if the software keyboard is open.
* </div>
* <div ons-keyboard-inactive>
* There is also a component that does the opposite.
* </div>
*/
/**
* @attribute ons-keyboard-active
* @description
* [en]The content of tags with this attribute will be visible when the software keyboard is open.[/en]
* [ja]この属性がついた要素は、ソフトウェアキーボードが表示された時に初めて表示されます。[/ja]
*/
/**
* @attribute ons-keyboard-inactive
* @description
* [en]The content of tags with this attribute will be visible when the software keyboard is hidden.[/en]
* [ja]この属性がついた要素は、ソフトウェアキーボードが隠れている時のみ表示されます。[/ja]
*/
(function () {
'use strict';
var module = angular.module('onsen');
var compileFunction = function compileFunction(show, $onsen) {
return function (element) {
return function (scope, element, attrs) {
var dispShow = show ? 'block' : 'none',
dispHide = show ? 'none' : 'block';
var onShow = function onShow() {
element.css('display', dispShow);
};
var onHide = function onHide() {
element.css('display', dispHide);
};
var onInit = function onInit(e) {
if (e.visible) {
onShow();
} else {
onHide();
}
};
ons.softwareKeyboard.on('show', onShow);
ons.softwareKeyboard.on('hide', onHide);
ons.softwareKeyboard.on('init', onInit);
if (ons.softwareKeyboard._visible) {
onShow();
} else {
onHide();
}
$onsen.cleaner.onDestroy(scope, function () {
ons.softwareKeyboard.off('show', onShow);
ons.softwareKeyboard.off('hide', onHide);
ons.softwareKeyboard.off('init', onInit);
$onsen.clearComponent({
element: element,
scope: scope,
attrs: attrs
});
element = scope = attrs = null;
});
};
};
};
module.directive('onsKeyboardActive', ['$onsen', function ($onsen) {
return {
restrict: 'A',
replace: false,
transclude: false,
scope: false,
compile: compileFunction(true, $onsen)
};
}]);
module.directive('onsKeyboardInactive', ['$onsen', function ($onsen) {
return {
restrict: 'A',
replace: false,
transclude: false,
scope: false,
compile: compileFunction(false, $onsen)
};
}]);
})();
'use strict';
/**
* @element ons-lazy-repeat
* @description
* [en]
* Using this component a list with millions of items can be rendered without a drop in performance.
* It does that by "lazily" loading elements into the DOM when they come into view and
* removing items from the DOM when they are not visible.
* [/en]
* [ja]
* このコンポーネント内で描画されるアイテムのDOM要素の読み込みは、画面に見えそうになった時まで自動的に遅延され、
* 画面から見えなくなった場合にはその要素は動的にアンロードされます。
* このコンポーネントを使うことで、パフォーマンスを劣化させること無しに巨大な数の要素を描画できます。
* [/ja]
* @codepen QwrGBm
* @guide UsingLazyRepeat
* [en]How to use Lazy Repeat[/en]
* [ja]レイジーリピートの使い方[/ja]
* @example
* <script>
* ons.bootstrap()
*
* .controller('MyController', function($scope) {
* $scope.MyDelegate = {
* countItems: function() {
* // Return number of items.
* return 1000000;
* },
*
* calculateItemHeight: function(index) {
* // Return the height of an item in pixels.
* return 45;
* },
*
* configureItemScope: function(index, itemScope) {
* // Initialize scope
* itemScope.item = 'Item #' + (index + 1);
* },
*
* destroyItemScope: function(index, itemScope) {
* // Optional method that is called when an item is unloaded.
* console.log('Destroyed item with index: ' + index);
* }
* };
* });
* </script>
*
* <ons-list ng-controller="MyController">
* <ons-list-item ons-lazy-repeat="MyDelegate">
* {{ item }}
* </ons-list-item>
* </ons-list>
*/
/**
* @attribute ons-lazy-repeat
* @type {Expression}
* @initonly
* @description
* [en]A delegate object, can be either an object attached to the scope (when using AngularJS) or a normal JavaScript variable.[/en]
* [ja]要素のロード、アンロードなどの処理を委譲するオブジェクトを指定します。AngularJSのスコープの変数名や、通常のJavaScriptの変数名を指定します。[/ja]
*/
/**
* @property delegate.configureItemScope
* @type {Function}
* @description
* [en]Function which recieves an index and the scope for the item. Can be used to configure values in the item scope.[/en]
* [ja][/ja]
*/
(function () {
'use strict';
var module = angular.module('onsen');
/**
* Lazy repeat directive.
*/
module.directive('onsLazyRepeat', ['$onsen', 'LazyRepeatView', function ($onsen, LazyRepeatView) {
return {
restrict: 'A',
replace: false,
priority: 1000,
terminal: true,
compile: function compile(element, attrs) {
return function (scope, element, attrs) {
var lazyRepeat = new LazyRepeatView(scope, element, attrs);
scope.$on('$destroy', function () {
scope = element = attrs = lazyRepeat = null;
});
};
}
};
}]);
})();
'use strict';
(function () {
'use strict';
angular.module('onsen').directive('onsList', ['$onsen', 'GenericView', function ($onsen, GenericView) {
return {
restrict: 'E',
link: function link(scope, element, attrs) {
GenericView.register(scope, element, attrs, { viewKey: 'ons-list' });
$onsen.fireComponentEvent(element[0], 'init');
}
};
}]);
})();
'use strict';
(function () {
'use strict';
angular.module('onsen').directive('onsListHeader', ['$onsen', 'GenericView', function ($onsen, GenericView) {
return {
restrict: 'E',
link: function link(scope, element, attrs) {
GenericView.register(scope, element, attrs, { viewKey: 'ons-listHeader' });
$onsen.fireComponentEvent(element[0], 'init');
}
};
}]);
})();
'use strict';
(function () {
'use strict';
angular.module('onsen').directive('onsListItem', ['$onsen', 'GenericView', function ($onsen, GenericView) {
return {
restrict: 'E',
link: function link(scope, element, attrs) {
GenericView.register(scope, element, attrs, { viewKey: 'ons-list-item' });
$onsen.fireComponentEvent(element[0], 'init');
}
};
}]);
})();
'use strict';
/**
* @element ons-loading-placeholder
* @category util
* @description
* [en]Display a placeholder while the content is loading.[/en]
* [ja]Onsen UIが読み込まれるまでに表示するプレースホルダーを表現します。[/ja]
* @guide UtilityAPIs [en]Other utility APIs[/en][ja]他のユーティリティAPI[/ja]
* @example
* <div ons-loading-placeholder="page.html">
* Loading...
* </div>
*/
/**
* @attribute ons-loading-placeholder
* @initonly
* @type {String}
* @description
* [en]The url of the page to load.[/en]
* [ja]読み込むページのURLを指定します。[/ja]
*/
(function () {
'use strict';
angular.module('onsen').directive('onsLoadingPlaceholder', function () {
return {
restrict: 'A',
link: function link(scope, element, attrs) {
if (attrs.onsLoadingPlaceholder) {
ons._resolveLoadingPlaceholder(element[0], attrs.onsLoadingPlaceholder, function (contentElement, done) {
ons.compile(contentElement);
scope.$evalAsync(function () {
setImmediate(done);
});
});
}
}
};
});
})();
'use strict';
/**
* @element ons-modal
*/
/**
* @attribute var
* @type {String}
* @initonly
* @description
* [en]Variable name to refer this modal.[/en]
* [ja]このモーダルを参照するための名前を指定します。[/ja]
*/
(function () {
'use strict';
/**
* Modal directive.
*/
angular.module('onsen').directive('onsModal', ['$onsen', 'ModalView', function ($onsen, ModalView) {
return {
restrict: 'E',
replace: false,
// NOTE: This element must coexists with ng-controller.
// Do not use isolated scope and template's ng-transclude.
scope: false,
transclude: false,
compile: function compile(element, attrs) {
return {
pre: function pre(scope, element, attrs) {
var modal = new ModalView(scope, element, attrs);
$onsen.addModifierMethodsForCustomElements(modal, element);
$onsen.declareVarAttribute(attrs, modal);
element.data('ons-modal', modal);
scope.$on('$destroy', function () {
$onsen.removeModifierMethods(modal);
element.data('ons-modal', undefined);
modal = element = scope = attrs = null;
});
},
post: function post(scope, element) {
$onsen.fireComponentEvent(element[0], 'init');
}
};
}
};
}]);
})();
'use strict';
/**
* @element ons-navigator
* @example
* <ons-navigator animation="slide" var="app.navi">
* <ons-page>
* <ons-toolbar>
* <div class="center">Title</div>
* </ons-toolbar>
*
* <p style="text-align: center">
* <ons-button modifier="light" ng-click="app.navi.pushPage('page.html');">Push</ons-button>
* </p>
* </ons-page>
* </ons-navigator>
*
* <ons-template id="page.html">
* <ons-page>
* <ons-toolbar>
* <div class="center">Title</div>
* </ons-toolbar>
*
* <p style="text-align: center">
* <ons-button modifier="light" ng-click="app.navi.popPage();">Pop</ons-button>
* </p>
* </ons-page>
* </ons-template>
*/
/**
* @attribute var
* @initonly
* @type {String}
* @description
* [en]Variable name to refer this navigator.[/en]
* [ja]このナビゲーターを参照するための名前を指定します。[/ja]
*/
/**
* @attribute ons-prepush
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "prepush" event is fired.[/en]
* [ja]"prepush"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-prepop
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "prepop" event is fired.[/en]
* [ja]"prepop"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-postpush
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "postpush" event is fired.[/en]
* [ja]"postpush"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-postpop
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "postpop" event is fired.[/en]
* [ja]"postpop"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-init
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when a page's "init" event is fired.[/en]
* [ja]ページの"init"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-show
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when a page's "show" event is fired.[/en]
* [ja]ページの"show"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-hide
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when a page's "hide" event is fired.[/en]
* [ja]ページの"hide"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-destroy
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when a page's "destroy" event is fired.[/en]
* [ja]ページの"destroy"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @method on
* @signature on(eventName, listener)
* @description
* [en]Add an event listener.[/en]
* [ja]イベントリスナーを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]このイベントが発火された際に呼び出される関数オブジェクトを指定します。[/ja]
*/
/**
* @method once
* @signature once(eventName, listener)
* @description
* [en]Add an event listener that's only triggered once.[/en]
* [ja]一度だけ呼び出されるイベントリスナーを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]イベントが発火した際に呼び出される関数オブジェクトを指定します。[/ja]
*/
/**
* @method off
* @signature off(eventName, [listener])
* @description
* [en]Remove an event listener. If the listener is not specified all listeners for the event type will be removed.[/en]
* [ja]イベントリスナーを削除します。もしイベントリスナーを指定しなかった場合には、そのイベントに紐づく全てのイベントリスナーが削除されます。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]削除するイベントリスナーを指定します。[/ja]
*/
(function () {
'use strict';
var lastReady = window.ons.NavigatorElement.rewritables.ready;
window.ons.NavigatorElement.rewritables.ready = ons._waitDiretiveInit('ons-navigator', lastReady);
angular.module('onsen').directive('onsNavigator', ['NavigatorView', '$onsen', function (NavigatorView, $onsen) {
return {
restrict: 'E',
// NOTE: This element must coexists with ng-controller.
// Do not use isolated scope and template's ng-transclude.
transclude: false,
scope: true,
compile: function compile(element) {
return {
pre: function pre(scope, element, attrs, controller) {
var view = new NavigatorView(scope, element, attrs);
$onsen.declareVarAttribute(attrs, view);
$onsen.registerEventHandlers(view, 'prepush prepop postpush postpop init show hide destroy');
element.data('ons-navigator', view);
element[0].pageLoader = $onsen.createPageLoader(view);
scope.$on('$destroy', function () {
view._events = undefined;
element.data('ons-navigator', undefined);
scope = element = null;
});
},
post: function post(scope, element, attrs) {
$onsen.fireComponentEvent(element[0], 'init');
}
};
}
};
}]);
})();
'use strict';
/**
* @element ons-page
*/
/**
* @attribute var
* @initonly
* @type {String}
* @description
* [en]Variable name to refer this page.[/en]
* [ja]このページを参照するための名前を指定します。[/ja]
*/
/**
* @attribute ng-infinite-scroll
* @initonly
* @type {String}
* @description
* [en]Path of the function to be executed on infinite scrolling. The path is relative to $scope. The function receives a done callback that must be called when it's finished.[/en]
* [ja][/ja]
*/
/**
* @attribute on-device-back-button
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the back button is pressed.[/en]
* [ja]デバイスのバックボタンが押された時の挙動を設定できます。[/ja]
*/
/**
* @attribute ng-device-back-button
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior with an AngularJS expression when the back button is pressed.[/en]
* [ja]デバイスのバックボタンが押された時の挙動を設定できます。AngularJSのexpressionを指定できます。[/ja]
*/
/**
* @attribute ons-init
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "init" event is fired.[/en]
* [ja]"init"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-show
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "show" event is fired.[/en]
* [ja]"show"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-hide
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "hide" event is fired.[/en]
* [ja]"hide"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-destroy
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "destroy" event is fired.[/en]
* [ja]"destroy"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.directive('onsPage', ['$onsen', 'PageView', function ($onsen, PageView) {
function firePageInitEvent(element) {
// TODO: remove dirty fix
var i = 0,
f = function f() {
if (i++ < 15) {
if (isAttached(element)) {
$onsen.fireComponentEvent(element, 'init');
fireActualPageInitEvent(element);
} else {
if (i > 10) {
setTimeout(f, 1000 / 60);
} else {
setImmediate(f);
}
}
} else {
throw new Error('Fail to fire "pageinit" event. Attach "ons-page" element to the document after initialization.');
}
};
f();
}
function fireActualPageInitEvent(element) {
var event = document.createEvent('HTMLEvents');
event.initEvent('pageinit', true, true);
element.dispatchEvent(event);
}
function isAttached(element) {
if (document.documentElement === element) {
return true;
}
return element.parentNode ? isAttached(element.parentNode) : false;
}
return {
restrict: 'E',
// NOTE: This element must coexists with ng-controller.
// Do not use isolated scope and template's ng-transclude.
transclude: false,
scope: true,
compile: function compile(element, attrs) {
return {
pre: function pre(scope, element, attrs) {
var page = new PageView(scope, element, attrs);
$onsen.declareVarAttribute(attrs, page);
$onsen.registerEventHandlers(page, 'init show hide destroy');
element.data('ons-page', page);
$onsen.addModifierMethodsForCustomElements(page, element);
element.data('_scope', scope);
$onsen.cleaner.onDestroy(scope, function () {
page._events = undefined;
$onsen.removeModifierMethods(page);
element.data('ons-page', undefined);
element.data('_scope', undefined);
$onsen.clearComponent({
element: element,
scope: scope,
attrs: attrs
});
scope = element = attrs = null;
});
},
post: function postLink(scope, element, attrs) {
firePageInitEvent(element[0]);
}
};
}
};
}]);
})();
'use strict';
/**
* @element ons-popover
*/
/**
* @attribute var
* @initonly
* @type {String}
* @description
* [en]Variable name to refer this popover.[/en]
* [ja]このポップオーバーを参照するための名前を指定します。[/ja]
*/
/**
* @attribute ons-preshow
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "preshow" event is fired.[/en]
* [ja]"preshow"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-prehide
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "prehide" event is fired.[/en]
* [ja]"prehide"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-postshow
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "postshow" event is fired.[/en]
* [ja]"postshow"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-posthide
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "posthide" event is fired.[/en]
* [ja]"posthide"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-destroy
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "destroy" event is fired.[/en]
* [ja]"destroy"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @method on
* @signature on(eventName, listener)
* @description
* [en]Add an event listener.[/en]
* [ja]イベントリスナーを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]このイベントが発火された際に呼び出される関数オブジェクトを指定します。[/ja]
*/
/**
* @method once
* @signature once(eventName, listener)
* @description
* [en]Add an event listener that's only triggered once.[/en]
* [ja]一度だけ呼び出されるイベントリスナーを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]イベントが発火した際に呼び出される関数オブジェクトを指定します。[/ja]
*/
/**
* @method off
* @signature off(eventName, [listener])
* @description
* [en]Remove an event listener. If the listener is not specified all listeners for the event type will be removed.[/en]
* [ja]イベントリスナーを削除します。もしイベントリスナーを指定しなかった場合には、そのイベントに紐づく全てのイベントリスナーが削除されます。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]削除するイベントリスナーを指定します。[/ja]
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.directive('onsPopover', ['$onsen', 'PopoverView', function ($onsen, PopoverView) {
return {
restrict: 'E',
replace: false,
scope: true,
compile: function compile(element, attrs) {
return {
pre: function pre(scope, element, attrs) {
var popover = new PopoverView(scope, element, attrs);
$onsen.declareVarAttribute(attrs, popover);
$onsen.registerEventHandlers(popover, 'preshow prehide postshow posthide destroy');
$onsen.addModifierMethodsForCustomElements(popover, element);
element.data('ons-popover', popover);
scope.$on('$destroy', function () {
popover._events = undefined;
$onsen.removeModifierMethods(popover);
element.data('ons-popover', undefined);
element = null;
});
},
post: function post(scope, element) {
$onsen.fireComponentEvent(element[0], 'init');
}
};
}
};
}]);
})();
"use strict";
'use strict';
/**
* @element ons-pull-hook
* @example
* <script>
* ons.bootstrap()
*
* .controller('MyController', function($scope, $timeout) {
* $scope.items = [3, 2 ,1];
*
* $scope.load = function($done) {
* $timeout(function() {
* $scope.items.unshift($scope.items.length + 1);
* $done();
* }, 1000);
* };
* });
* </script>
*
* <ons-page ng-controller="MyController">
* <ons-pull-hook var="loader" ng-action="load($done)">
* <span ng-switch="loader.state">
* <span ng-switch-when="initial">Pull down to refresh</span>
* <span ng-switch-when="preaction">Release to refresh</span>
* <span ng-switch-when="action">Loading data. Please wait...</span>
* </span>
* </ons-pull-hook>
* <ons-list>
* <ons-list-item ng-repeat="item in items">
* Item #{{ item }}
* </ons-list-item>
* </ons-list>
* </ons-page>
*/
/**
* @attribute var
* @initonly
* @type {String}
* @description
* [en]Variable name to refer this component.[/en]
* [ja]このコンポーネントを参照するための名前を指定します。[/ja]
*/
/**
* @attribute ng-action
* @initonly
* @type {Expression}
* @description
* [en]Use to specify custom behavior when the page is pulled down. A <code>$done</code> function is available to tell the component that the action is completed.[/en]
* [ja]pull downしたときの振る舞いを指定します。アクションが完了した時には<code>$done</code>関数を呼び出します。[/ja]
*/
/**
* @attribute ons-changestate
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "changestate" event is fired.[/en]
* [ja]"changestate"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @method on
* @signature on(eventName, listener)
* @description
* [en]Add an event listener.[/en]
* [ja]イベントリスナーを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]このイベントが発火された際に呼び出される関数オブジェクトを指定します。[/ja]
*/
/**
* @method once
* @signature once(eventName, listener)
* @description
* [en]Add an event listener that's only triggered once.[/en]
* [ja]一度だけ呼び出されるイベントリスナーを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]イベントが発火した際に呼び出される関数オブジェクトを指定します。[/ja]
*/
/**
* @method off
* @signature off(eventName, [listener])
* @description
* [en]Remove an event listener. If the listener is not specified all listeners for the event type will be removed.[/en]
* [ja]イベントリスナーを削除します。もしイベントリスナーを指定しなかった場合には、そのイベントに紐づく全てのイベントリスナーが削除されます。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]削除するイベントリスナーを指定します。[/ja]
*/
(function () {
'use strict';
/**
* Pull hook directive.
*/
angular.module('onsen').directive('onsPullHook', ['$onsen', 'PullHookView', function ($onsen, PullHookView) {
return {
restrict: 'E',
replace: false,
scope: true,
compile: function compile(element, attrs) {
return {
pre: function pre(scope, element, attrs) {
var pullHook = new PullHookView(scope, element, attrs);
$onsen.declareVarAttribute(attrs, pullHook);
$onsen.registerEventHandlers(pullHook, 'changestate destroy');
element.data('ons-pull-hook', pullHook);
scope.$on('$destroy', function () {
pullHook._events = undefined;
element.data('ons-pull-hook', undefined);
scope = element = attrs = null;
});
},
post: function post(scope, element) {
$onsen.fireComponentEvent(element[0], 'init');
}
};
}
};
}]);
})();
'use strict';
(function () {
'use strict';
angular.module('onsen').directive('onsRange', ['$parse', function ($parse) {
return {
restrict: 'E',
replace: false,
scope: false,
link: function link(scope, element, attrs) {
var onInput = function onInput() {
var set = $parse(attrs.ngModel).assign;
set(scope, element[0].value);
if (attrs.ngChange) {
scope.$eval(attrs.ngChange);
}
scope.$parent.$evalAsync();
};
if (attrs.ngModel) {
scope.$watch(attrs.ngModel, function (value) {
element[0].value = value;
});
element.on('input', onInput);
}
scope.$on('$destroy', function () {
element.off('input', onInput);
scope = element = attrs = null;
});
}
};
}]);
})();
'use strict';
(function () {
'use strict';
angular.module('onsen').directive('onsRipple', ['$onsen', 'GenericView', function ($onsen, GenericView) {
return {
restrict: 'E',
link: function link(scope, element, attrs) {
GenericView.register(scope, element, attrs, { viewKey: 'ons-ripple' });
$onsen.fireComponentEvent(element[0], 'init');
}
};
}]);
})();
'use strict';
/**
* @element ons-scope
* @category util
* @description
* [en]All child elements using the "var" attribute will be attached to the scope of this element.[/en]
* [ja]"var"属性を使っている全ての子要素のviewオブジェクトは、この要素のAngularJSスコープに追加されます。[/ja]
* @example
* <ons-list>
* <ons-list-item ons-scope ng-repeat="item in items">
* <ons-carousel var="carousel">
* <ons-carousel-item ng-click="carousel.next()">
* {{ item }}
* </ons-carousel-item>
* </ons-carousel-item ng-click="carousel.prev()">
* ...
* </ons-carousel-item>
* </ons-carousel>
* </ons-list-item>
* </ons-list>
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.directive('onsScope', ['$onsen', function ($onsen) {
return {
restrict: 'A',
replace: false,
transclude: false,
scope: false,
link: function link(scope, element) {
element.data('_scope', scope);
scope.$on('$destroy', function () {
element.data('_scope', undefined);
});
}
};
}]);
})();
'use strict';
/**
* @element ons-select
*/
/**
* @method on
* @signature on(eventName, listener)
* @description
* [en]Add an event listener.[/en]
* [ja]イベントリスナーを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]このイベントが発火された際に呼び出される関数オブジェクトを指定します。[/ja]
*/
/**
* @method once
* @signature once(eventName, listener)
* @description
* [en]Add an event listener that's only triggered once.[/en]
* [ja]一度だけ呼び出されるイベントリスナーを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]イベントが発火した際に呼び出される関数オブジェクトを指定します。[/ja]
*/
/**
* @method off
* @signature off(eventName, [listener])
* @description
* [en]Remove an event listener. If the listener is not specified all listeners for the event type will be removed.[/en]
* [ja]イベントリスナーを削除します。もしイベントリスナーを指定しなかった場合には、そのイベントに紐づく全てのイベントリスナーが削除されます。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]削除するイベントリスナーを指定します。[/ja]
*/
(function () {
'use strict';
angular.module('onsen').directive('onsSelect', ['$parse', '$onsen', 'GenericView', function ($parse, $onsen, GenericView) {
return {
restrict: 'E',
replace: false,
scope: false,
link: function link(scope, element, attrs) {
var onInput = function onInput() {
var set = $parse(attrs.ngModel).assign;
set(scope, element[0].value);
if (attrs.ngChange) {
scope.$eval(attrs.ngChange);
}
scope.$parent.$evalAsync();
};
if (attrs.ngModel) {
scope.$watch(attrs.ngModel, function (value) {
element[0].value = value;
});
element.on('input', onInput);
}
scope.$on('$destroy', function () {
element.off('input', onInput);
scope = element = attrs = null;
});
GenericView.register(scope, element, attrs, { viewKey: 'ons-select' });
$onsen.fireComponentEvent(element[0], 'init');
}
};
}]);
})();
'use strict';
/**
* @element ons-sliding-menu
* @category menu
* @description
* [en]Component for sliding UI where one page is overlayed over another page. The above page can be slided aside to reveal the page behind.[/en]
* [ja]スライディングメニューを表現するためのコンポーネントで、片方のページが別のページの上にオーバーレイで表示されます。above-pageで指定されたページは、横からスライドして表示します。[/ja]
* @codepen IDvFJ
* @seealso ons-page
* [en]ons-page component[/en]
* [ja]ons-pageコンポーネント[/ja]
* @guide UsingSlidingMenu
* [en]Using sliding menu[/en]
* [ja]スライディングメニューを使う[/ja]
* @guide EventHandling
* [en]Using events[/en]
* [ja]イベントの利用[/ja]
* @guide CallingComponentAPIsfromJavaScript
* [en]Using navigator from JavaScript[/en]
* [ja]JavaScriptからコンポーネントを呼び出す[/ja]
* @guide DefiningMultiplePagesinSingleHTML
* [en]Defining multiple pages in single html[/en]
* [ja]複数のページを1つのHTMLに記述する[/ja]
* @example
* <ons-sliding-menu var="app.menu" main-page="page.html" menu-page="menu.html" max-slide-distance="200px" type="reveal" side="left">
* </ons-sliding-menu>
*
* <ons-template id="page.html">
* <ons-page>
* <p style="text-align: center">
* <ons-button ng-click="app.menu.toggleMenu()">Toggle</ons-button>
* </p>
* </ons-page>
* </ons-template>
*
* <ons-template id="menu.html">
* <ons-page>
* <!-- menu page's contents -->
* </ons-page>
* </ons-template>
*
*/
/**
* @event preopen
* @description
* [en]Fired just before the sliding menu is opened.[/en]
* [ja]スライディングメニューが開く前に発火します。[/ja]
* @param {Object} event
* [en]Event object.[/en]
* [ja]イベントオブジェクトです。[/ja]
* @param {Object} event.slidingMenu
* [en]Sliding menu view object.[/en]
* [ja]イベントが発火したSlidingMenuオブジェクトです。[/ja]
*/
/**
* @event postopen
* @description
* [en]Fired just after the sliding menu is opened.[/en]
* [ja]スライディングメニューが開き終わった後に発火します。[/ja]
* @param {Object} event
* [en]Event object.[/en]
* [ja]イベントオブジェクトです。[/ja]
* @param {Object} event.slidingMenu
* [en]Sliding menu view object.[/en]
* [ja]イベントが発火したSlidingMenuオブジェクトです。[/ja]
*/
/**
* @event preclose
* @description
* [en]Fired just before the sliding menu is closed.[/en]
* [ja]スライディングメニューが閉じる前に発火します。[/ja]
* @param {Object} event
* [en]Event object.[/en]
* [ja]イベントオブジェクトです。[/ja]
* @param {Object} event.slidingMenu
* [en]Sliding menu view object.[/en]
* [ja]イベントが発火したSlidingMenuオブジェクトです。[/ja]
*/
/**
* @event postclose
* @description
* [en]Fired just after the sliding menu is closed.[/en]
* [ja]スライディングメニューが閉じ終わった後に発火します。[/ja]
* @param {Object} event
* [en]Event object.[/en]
* [ja]イベントオブジェクトです。[/ja]
* @param {Object} event.slidingMenu
* [en]Sliding menu view object.[/en]
* [ja]イベントが発火したSlidingMenuオブジェクトです。[/ja]
*/
/**
* @attribute var
* @initonly
* @type {String}
* @description
* [en]Variable name to refer this sliding menu.[/en]
* [ja]このスライディングメニューを参照するための名前を指定します。[/ja]
*/
/**
* @attribute menu-page
* @initonly
* @type {String}
* @description
* [en]The url of the menu page.[/en]
* [ja]左に位置するメニューページのURLを指定します。[/ja]
*/
/**
* @attribute main-page
* @initonly
* @type {String}
* @description
* [en]The url of the main page.[/en]
* [ja]右に位置するメインページのURLを指定します。[/ja]
*/
/**
* @attribute swipeable
* @initonly
* @type {Boolean}
* @description
* [en]Whether to enable swipe interaction.[/en]
* [ja]スワイプ操作を有効にする場合に指定します。[/ja]
*/
/**
* @attribute swipe-target-width
* @initonly
* @type {String}
* @description
* [en]The width of swipeable area calculated from the left (in pixels). Use this to enable swipe only when the finger touch on the screen edge.[/en]
* [ja]スワイプの判定領域をピクセル単位で指定します。画面の端から指定した距離に達するとページが表示されます。[/ja]
*/
/**
* @attribute max-slide-distance
* @initonly
* @type {String}
* @description
* [en]How far the menu page will slide open. Can specify both in px and %. eg. 90%, 200px[/en]
* [ja]menu-pageで指定されたページの表示幅を指定します。ピクセルもしくは%の両方で指定できます(例: 90%, 200px)[/ja]
*/
/**
* @attribute side
* @initonly
* @type {String}
* @description
* [en]Specify which side of the screen the menu page is located on. Possible values are "left" and "right".[/en]
* [ja]menu-pageで指定されたページが画面のどちら側から表示されるかを指定します。leftもしくはrightのいずれかを指定できます。[/ja]
*/
/**
* @attribute type
* @initonly
* @type {String}
* @description
* [en]Sliding menu animator. Possible values are reveal (default), push and overlay.[/en]
* [ja]スライディングメニューのアニメーションです。"reveal"(デフォルト)、"push"、"overlay"のいずれかを指定できます。[/ja]
*/
/**
* @attribute ons-preopen
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "preopen" event is fired.[/en]
* [ja]"preopen"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-preclose
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "preclose" event is fired.[/en]
* [ja]"preclose"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-postopen
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "postopen" event is fired.[/en]
* [ja]"postopen"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-postclose
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "postclose" event is fired.[/en]
* [ja]"postclose"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-init
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when a page's "init" event is fired.[/en]
* [ja]ページの"init"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-show
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when a page's "show" event is fired.[/en]
* [ja]ページの"show"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-hide
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when a page's "hide" event is fired.[/en]
* [ja]ページの"hide"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-destroy
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when a page's "destroy" event is fired.[/en]
* [ja]ページの"destroy"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @method setMainPage
* @signature setMainPage(pageUrl, [options])
* @param {String} pageUrl
* [en]Page URL. Can be either an HTML document or an <code><ons-template></code>.[/en]
* [ja]pageのURLか、ons-templateで宣言したテンプレートのid属性の値を指定します。[/ja]
* @param {Object} [options]
* [en]Parameter object.[/en]
* [ja]オプションを指定するオブジェクト。[/ja]
* @param {Boolean} [options.closeMenu]
* [en]If true the menu will be closed.[/en]
* [ja]trueを指定すると、開いているメニューを閉じます。[/ja]
* @param {Function} [options.callback]
* [en]Function that is executed after the page has been set.[/en]
* [ja]ページが読み込まれた後に呼び出される関数オブジェクトを指定します。[/ja]
* @description
* [en]Show the page specified in pageUrl in the main contents pane.[/en]
* [ja]中央部分に表示されるページをpageUrlに指定します。[/ja]
*/
/**
* @method setMenuPage
* @signature setMenuPage(pageUrl, [options])
* @param {String} pageUrl
* [en]Page URL. Can be either an HTML document or an <code><ons-template></code>.[/en]
* [ja]pageのURLか、ons-templateで宣言したテンプレートのid属性の値を指定します。[/ja]
* @param {Object} [options]
* [en]Parameter object.[/en]
* [ja]オプションを指定するオブジェクト。[/ja]
* @param {Boolean} [options.closeMenu]
* [en]If true the menu will be closed after the menu page has been set.[/en]
* [ja]trueを指定すると、開いているメニューを閉じます。[/ja]
* @param {Function} [options.callback]
* [en]This function will be executed after the menu page has been set.[/en]
* [ja]メニューページが読み込まれた後に呼び出される関数オブジェクトを指定します。[/ja]
* @description
* [en]Show the page specified in pageUrl in the side menu pane.[/en]
* [ja]メニュー部分に表示されるページをpageUrlに指定します。[/ja]
*/
/**
* @method openMenu
* @signature openMenu([options])
* @param {Object} [options]
* [en]Parameter object.[/en]
* [ja]オプションを指定するオブジェクト。[/ja]
* @param {Function} [options.callback]
* [en]This function will be called after the menu has been opened.[/en]
* [ja]メニューが開いた後に呼び出される関数オブジェクトを指定します。[/ja]
* @description
* [en]Slide the above layer to reveal the layer behind.[/en]
* [ja]メニューページを表示します。[/ja]
*/
/**
* @method closeMenu
* @signature closeMenu([options])
* @param {Object} [options]
* [en]Parameter object.[/en]
* [ja]オプションを指定するオブジェクト。[/ja]
* @param {Function} [options.callback]
* [en]This function will be called after the menu has been closed.[/en]
* [ja]メニューが閉じられた後に呼び出される関数オブジェクトを指定します。[/ja]
* @description
* [en]Slide the above layer to hide the layer behind.[/en]
* [ja]メニューページを非表示にします。[/ja]
*/
/**
* @method toggleMenu
* @signature toggleMenu([options])
* @param {Object} [options]
* [en]Parameter object.[/en]
* [ja]オプションを指定するオブジェクト。[/ja]
* @param {Function} [options.callback]
* [en]This function will be called after the menu has been opened or closed.[/en]
* [ja]メニューが開き終わった後か、閉じ終わった後に呼び出される関数オブジェクトです。[/ja]
* @description
* [en]Slide the above layer to reveal the layer behind if it is currently hidden, otherwise, hide the layer behind.[/en]
* [ja]現在の状況に合わせて、メニューページを表示もしくは非表示にします。[/ja]
*/
/**
* @method isMenuOpened
* @signature isMenuOpened()
* @return {Boolean}
* [en]true if the menu is currently open.[/en]
* [ja]メニューが開いていればtrueとなります。[/ja]
* @description
* [en]Returns true if the menu page is open, otherwise false.[/en]
* [ja]メニューページが開いている場合はtrue、そうでない場合はfalseを返します。[/ja]
*/
/**
* @method getDeviceBackButtonHandler
* @signature getDeviceBackButtonHandler()
* @return {Object}
* [en]Device back button handler.[/en]
* [ja]デバイスのバックボタンハンドラを返します。[/ja]
* @description
* [en]Retrieve the back-button handler.[/en]
* [ja]ons-sliding-menuに紐付いているバックボタンハンドラを取得します。[/ja]
*/
/**
* @method setSwipeable
* @signature setSwipeable(swipeable)
* @param {Boolean} swipeable
* [en]If true the menu will be swipeable.[/en]
* [ja]スワイプで開閉できるようにする場合にはtrueを指定します。[/ja]
* @description
* [en]Specify if the menu should be swipeable or not.[/en]
* [ja]スワイプで開閉するかどうかを設定する。[/ja]
*/
/**
* @method on
* @signature on(eventName, listener)
* @description
* [en]Add an event listener.[/en]
* [ja]イベントリスナーを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]このイベントが発火された際に呼び出される関数オブジェクトを指定します。[/ja]
*/
/**
* @method once
* @signature once(eventName, listener)
* @description
* [en]Add an event listener that's only triggered once.[/en]
* [ja]一度だけ呼び出されるイベントリスナーを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]イベントが発火した際に呼び出される関数オブジェクトを指定します。[/ja]
*/
/**
* @method off
* @signature off(eventName, [listener])
* @description
* [en]Remove an event listener. If the listener is not specified all listeners for the event type will be removed.[/en]
* [ja]イベントリスナーを削除します。もしイベントリスナーを指定しなかった場合には、そのイベントに紐づく全てのイベントリスナーが削除されます。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]削除するイベントリスナーを指定します。[/ja]
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.directive('onsSlidingMenu', ['$compile', 'SlidingMenuView', '$onsen', function ($compile, SlidingMenuView, $onsen) {
return {
restrict: 'E',
replace: false,
// NOTE: This element must coexists with ng-controller.
// Do not use isolated scope and template's ng-transclude.
transclude: false,
scope: true,
compile: function compile(element, attrs) {
ons._util.warn('\'ons-sliding-menu\' component has been deprecated and will be removed in the next release. Please use \'ons-splitter\' instead.');
var main = element[0].querySelector('.main'),
menu = element[0].querySelector('.menu');
if (main) {
var mainHtml = angular.element(main).remove().html().trim();
}
if (menu) {
var menuHtml = angular.element(menu).remove().html().trim();
}
return function (scope, element, attrs) {
element.append(angular.element('<div></div>').addClass('onsen-sliding-menu__menu'));
element.append(angular.element('<div></div>').addClass('onsen-sliding-menu__main'));
var slidingMenu = new SlidingMenuView(scope, element, attrs);
$onsen.registerEventHandlers(slidingMenu, 'preopen preclose postopen postclose init show hide destroy');
if (mainHtml && !attrs.mainPage) {
slidingMenu._appendMainPage(null, mainHtml);
}
if (menuHtml && !attrs.menuPage) {
slidingMenu._appendMenuPage(menuHtml);
}
$onsen.declareVarAttribute(attrs, slidingMenu);
element.data('ons-sliding-menu', slidingMenu);
scope.$on('$destroy', function () {
slidingMenu._events = undefined;
element.data('ons-sliding-menu', undefined);
});
$onsen.fireComponentEvent(element[0], 'init');
};
}
};
}]);
})();
'use strict';
/**
* @element ons-speed-dial
*/
/**
* @attribute var
* @initonly
* @type {String}
* @description
* [en]Variable name to refer the speed dial.[/en]
* [ja]このスピードダイアルを参照するための変数名をしてします。[/ja]
*/
/**
* @attribute ons-open
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "open" event is fired.[/en]
* [ja]"open"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-close
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "close" event is fired.[/en]
* [ja]"close"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @method once
* @signature once(eventName, listener)
* @description
* [en]Add an event listener that's only triggered once.[/en]
* [ja]一度だけ呼び出されるイベントリスナを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]イベントが発火した際に呼び出される関数オブジェクトを指定します。[/ja]
*/
/**
* @method off
* @signature off(eventName, [listener])
* @description
* [en]Remove an event listener. If the listener is not specified all listeners for the event type will be removed.[/en]
* [ja]イベントリスナーを削除します。もしイベントリスナーが指定されなかった場合には、そのイベントに紐付いているイベントリスナーが全て削除されます。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]イベントが発火した際に呼び出される関数オブジェクトを指定します。[/ja]
*/
/**
* @method on
* @signature on(eventName, listener)
* @description
* [en]Add an event listener.[/en]
* [ja]イベントリスナーを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]イベントが発火した際に呼び出される関数オブジェクトを指定します。[/ja]
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.directive('onsSpeedDial', ['$onsen', 'SpeedDialView', function ($onsen, SpeedDialView) {
return {
restrict: 'E',
replace: false,
scope: false,
transclude: false,
compile: function compile(element, attrs) {
return function (scope, element, attrs) {
var speedDial = new SpeedDialView(scope, element, attrs);
element.data('ons-speed-dial', speedDial);
$onsen.registerEventHandlers(speedDial, 'open close');
$onsen.declareVarAttribute(attrs, speedDial);
scope.$on('$destroy', function () {
speedDial._events = undefined;
element.data('ons-speed-dial', undefined);
element = null;
});
$onsen.fireComponentEvent(element[0], 'init');
};
}
};
}]);
})();
'use strict';
/**
* @element ons-split-view
* @category control
* @description
* [en]Divides the screen into a left and right section.[/en]
* [ja]画面を左右に分割するコンポーネントです。[/ja]
* @codepen nKqfv {wide}
* @guide Usingonssplitviewcomponent
* [en]Using ons-split-view.[/en]
* [ja]ons-split-viewコンポーネントを使う[/ja]
* @guide CallingComponentAPIsfromJavaScript
* [en]Using navigator from JavaScript[/en]
* [ja]JavaScriptからコンポーネントを呼び出す[/ja]
* @example
* <ons-split-view
* secondary-page="secondary.html"
* main-page="main.html"
* main-page-width="70%"
* collapse="portrait">
* </ons-split-view>
*/
/**
* @event update
* @description
* [en]Fired when the split view is updated.[/en]
* [ja]split viewの状態が更新された際に発火します。[/ja]
* @param {Object} event
* [en]Event object.[/en]
* [ja]イベントオブジェクトです。[/ja]
* @param {Object} event.splitView
* [en]Split view object.[/en]
* [ja]イベントが発火したSplitViewオブジェクトです。[/ja]
* @param {Boolean} event.shouldCollapse
* [en]True if the view should collapse.[/en]
* [ja]collapse状態の場合にtrueになります。[/ja]
* @param {String} event.currentMode
* [en]Current mode.[/en]
* [ja]現在のモード名を返します。"collapse"か"split"かのいずれかです。[/ja]
* @param {Function} event.split
* [en]Call to force split.[/en]
* [ja]この関数を呼び出すと強制的にsplitモードにします。[/ja]
* @param {Function} event.collapse
* [en]Call to force collapse.[/en]
* [ja]この関数を呼び出すと強制的にcollapseモードにします。[/ja]
* @param {Number} event.width
* [en]Current width.[/en]
* [ja]現在のSplitViewの幅を返します。[/ja]
* @param {String} event.orientation
* [en]Current orientation.[/en]
* [ja]現在の画面のオリエンテーションを返します。"portrait"かもしくは"landscape"です。 [/ja]
*/
/**
* @event presplit
* @description
* [en]Fired just before the view is split.[/en]
* [ja]split状態にる前に発火します。[/ja]
* @param {Object} event
* [en]Event object.[/en]
* [ja]イベントオブジェクト。[/ja]
* @param {Object} event.splitView
* [en]Split view object.[/en]
* [ja]イベントが発火したSplitViewオブジェクトです。[/ja]
* @param {Number} event.width
* [en]Current width.[/en]
* [ja]現在のSplitViewnの幅です。[/ja]
* @param {String} event.orientation
* [en]Current orientation.[/en]
* [ja]現在の画面のオリエンテーションを返します。"portrait"もしくは"landscape"です。[/ja]
*/
/**
* @event postsplit
* @description
* [en]Fired just after the view is split.[/en]
* [ja]split状態になった後に発火します。[/ja]
* @param {Object} event
* [en]Event object.[/en]
* [ja]イベントオブジェクト。[/ja]
* @param {Object} event.splitView
* [en]Split view object.[/en]
* [ja]イベントが発火したSplitViewオブジェクトです。[/ja]
* @param {Number} event.width
* [en]Current width.[/en]
* [ja]現在のSplitViewnの幅です。[/ja]
* @param {String} event.orientation
* [en]Current orientation.[/en]
* [ja]現在の画面のオリエンテーションを返します。"portrait"もしくは"landscape"です。[/ja]
*/
/**
* @event precollapse
* @description
* [en]Fired just before the view is collapsed.[/en]
* [ja]collapse状態になる前に発火します。[/ja]
* @param {Object} event
* [en]Event object.[/en]
* [ja]イベントオブジェクト。[/ja]
* @param {Object} event.splitView
* [en]Split view object.[/en]
* [ja]イベントが発火したSplitViewオブジェクトです。[/ja]
* @param {Number} event.width
* [en]Current width.[/en]
* [ja]現在のSplitViewnの幅です。[/ja]
* @param {String} event.orientation
* [en]Current orientation.[/en]
* [ja]現在の画面のオリエンテーションを返します。"portrait"もしくは"landscape"です。[/ja]
*/
/**
* @event postcollapse
* @description
* [en]Fired just after the view is collapsed.[/en]
* [ja]collapse状態になった後に発火します。[/ja]
* @param {Object} event
* [en]Event object.[/en]
* [ja]イベントオブジェクト。[/ja]
* @param {Object} event.splitView
* [en]Split view object.[/en]
* [ja]イベントが発火したSplitViewオブジェクトです。[/ja]
* @param {Number} event.width
* [en]Current width.[/en]
* [ja]現在のSplitViewnの幅です。[/ja]
* @param {String} event.orientation
* [en]Current orientation.[/en]
* [ja]現在の画面のオリエンテーションを返します。"portrait"もしくは"landscape"です。[/ja]
*/
/**
* @attribute var
* @initonly
* @type {String}
* @description
* [en]Variable name to refer this split view.[/en]
* [ja]このスプリットビューコンポーネントを参照するための名前を指定します。[/ja]
*/
/**
* @attribute main-page
* @initonly
* @type {String}
* @description
* [en]The url of the page on the right.[/en]
* [ja]右側に表示するページのURLを指定します。[/ja]
*/
/**
* @attribute main-page-width
* @initonly
* @type {Number}
* @description
* [en]Main page width percentage. The secondary page width will be the remaining percentage.[/en]
* [ja]右側のページの幅をパーセント単位で指定します。[/ja]
*/
/**
* @attribute secondary-page
* @initonly
* @type {String}
* @description
* [en]The url of the page on the left.[/en]
* [ja]左側に表示するページのURLを指定します。[/ja]
*/
/**
* @attribute collapse
* @initonly
* @type {String}
* @description
* [en]
* Specify the collapse behavior. Valid values are portrait, landscape, width #px or a media query.
* "portrait" or "landscape" means the view will collapse when device is in landscape or portrait orientation.
* "width #px" means the view will collapse when the window width is smaller than the specified #px.
* If the value is a media query, the view will collapse when the media query is true.
* [/en]
* [ja]
* 左側のページを非表示にする条件を指定します。portrait, landscape、width #pxもしくはメディアクエリの指定が可能です。
* portraitもしくはlandscapeを指定すると、デバイスの画面が縦向きもしくは横向きになった時に適用されます。
* width #pxを指定すると、画面が指定した横幅よりも短い場合に適用されます。
* メディアクエリを指定すると、指定したクエリに適合している場合に適用されます。
* [/ja]
*/
/**
* @attribute ons-update
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "update" event is fired.[/en]
* [ja]"update"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-presplit
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "presplit" event is fired.[/en]
* [ja]"presplit"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-precollapse
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "precollapse" event is fired.[/en]
* [ja]"precollapse"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-postsplit
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "postsplit" event is fired.[/en]
* [ja]"postsplit"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-postcollapse
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "postcollapse" event is fired.[/en]
* [ja]"postcollapse"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-init
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when a page's "init" event is fired.[/en]
* [ja]ページの"init"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-show
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when a page's "show" event is fired.[/en]
* [ja]ページの"show"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-hide
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when a page's "hide" event is fired.[/en]
* [ja]ページの"hide"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-destroy
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when a page's "destroy" event is fired.[/en]
* [ja]ページの"destroy"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @method setMainPage
* @signature setMainPage(pageUrl)
* @param {String} pageUrl
* [en]Page URL. Can be either an HTML document or an <ons-template>.[/en]
* [ja]pageのURLか、ons-templateで宣言したテンプレートのid属性の値を指定します。[/ja]
* @description
* [en]Show the page specified in pageUrl in the right section[/en]
* [ja]指定したURLをメインページを読み込みます。[/ja]
*/
/**
* @method setSecondaryPage
* @signature setSecondaryPage(pageUrl)
* @param {String} pageUrl
* [en]Page URL. Can be either an HTML document or an <ons-template>.[/en]
* [ja]pageのURLか、ons-templateで宣言したテンプレートのid属性の値を指定します。[/ja]
* @description
* [en]Show the page specified in pageUrl in the left section[/en]
* [ja]指定したURLを左のページの読み込みます。[/ja]
*/
/**
* @method update
* @signature update()
* @description
* [en]Trigger an 'update' event and try to determine if the split behavior should be changed.[/en]
* [ja]splitモードを変えるべきかどうかを判断するための'update'イベントを発火します。[/ja]
*/
/**
* @method on
* @signature on(eventName, listener)
* @description
* [en]Add an event listener.[/en]
* [ja]イベントリスナーを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]このイベントが発火された際に呼び出される関数オブジェクトを指定します。[/ja]
*/
/**
* @method once
* @signature once(eventName, listener)
* @description
* [en]Add an event listener that's only triggered once.[/en]
* [ja]一度だけ呼び出されるイベントリスナーを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]イベントが発火した際に呼び出される関数オブジェクトを指定します。[/ja]
*/
/**
* @method off
* @signature off(eventName, [listener])
* @description
* [en]Remove an event listener. If the listener is not specified all listeners for the event type will be removed.[/en]
* [ja]イベントリスナーを削除します。もしイベントリスナーを指定しなかった場合には、そのイベントに紐づく全てのイベントリスナーが削除されます。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]削除するイベントリスナーを指定します。[/ja]
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.directive('onsSplitView', ['$compile', 'SplitView', '$onsen', function ($compile, SplitView, $onsen) {
return {
restrict: 'E',
replace: false,
transclude: false,
scope: true,
compile: function compile(element, attrs) {
ons._util.warn('\'ons-split-view\' component has been deprecated and will be removed in the next release. Please use \'ons-splitter\' instead.');
var mainPage = element[0].querySelector('.main-page'),
secondaryPage = element[0].querySelector('.secondary-page');
if (mainPage) {
var mainHtml = angular.element(mainPage).remove().html().trim();
}
if (secondaryPage) {
var secondaryHtml = angular.element(secondaryPage).remove().html().trim();
}
return function (scope, element, attrs) {
element.append(angular.element('<div></div>').addClass('onsen-split-view__secondary full-screen'));
element.append(angular.element('<div></div>').addClass('onsen-split-view__main full-screen'));
var splitView = new SplitView(scope, element, attrs);
if (mainHtml && !attrs.mainPage) {
splitView._appendMainPage(mainHtml);
}
if (secondaryHtml && !attrs.secondaryPage) {
splitView._appendSecondPage(secondaryHtml);
}
$onsen.declareVarAttribute(attrs, splitView);
$onsen.registerEventHandlers(splitView, 'update presplit precollapse postsplit postcollapse init show hide destroy');
element.data('ons-split-view', splitView);
scope.$on('$destroy', function () {
splitView._events = undefined;
element.data('ons-split-view', undefined);
});
$onsen.fireComponentEvent(element[0], 'init');
};
}
};
}]);
})();
'use strict';
/**
* @element ons-splitter
*/
/**
* @attribute var
* @initonly
* @type {String}
* @description
* [en]Variable name to refer this split view.[/en]
* [ja]このスプリットビューコンポーネントを参照するための名前を指定します。[/ja]
*/
/**
* @attribute ons-destroy
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "destroy" event is fired.[/en]
* [ja]"destroy"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @method on
* @signature on(eventName, listener)
* @description
* [en]Add an event listener.[/en]
* [ja]イベントリスナーを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]このイベントが発火された際に呼び出される関数オブジェクトを指定します。[/ja]
*/
/**
* @method once
* @signature once(eventName, listener)
* @description
* [en]Add an event listener that's only triggered once.[/en]
* [ja]一度だけ呼び出されるイベントリスナーを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]イベントが発火した際に呼び出される関数オブジェクトを指定します。[/ja]
*/
/**
* @method off
* @signature off(eventName, [listener])
* @description
* [en]Remove an event listener. If the listener is not specified all listeners for the event type will be removed.[/en]
* [ja]イベントリスナーを削除します。もしイベントリスナーを指定しなかった場合には、そのイベントに紐づく全てのイベントリスナーが削除されます。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]削除するイベントリスナーを指定します。[/ja]
*/
(function () {
'use strict';
angular.module('onsen').directive('onsSplitter', ['$compile', 'Splitter', '$onsen', function ($compile, Splitter, $onsen) {
return {
restrict: 'E',
scope: true,
compile: function compile(element, attrs) {
return function (scope, element, attrs) {
var splitter = new Splitter(scope, element, attrs);
$onsen.declareVarAttribute(attrs, splitter);
$onsen.registerEventHandlers(splitter, 'destroy');
element.data('ons-splitter', splitter);
scope.$on('$destroy', function () {
splitter._events = undefined;
element.data('ons-splitter', undefined);
});
$onsen.fireComponentEvent(element[0], 'init');
};
}
};
}]);
})();
'use strict';
/**
* @element ons-splitter-content
*/
/**
* @attribute ons-destroy
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "destroy" event is fired.[/en]
* [ja]"destroy"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
(function () {
'use strict';
var lastReady = window.ons.SplitterContentElement.rewritables.ready;
window.ons.SplitterContentElement.rewritables.ready = ons._waitDiretiveInit('ons-splitter-content', lastReady);
angular.module('onsen').directive('onsSplitterContent', ['$compile', 'SplitterContent', '$onsen', function ($compile, SplitterContent, $onsen) {
return {
restrict: 'E',
compile: function compile(element, attrs) {
return function (scope, element, attrs) {
var view = new SplitterContent(scope, element, attrs);
$onsen.declareVarAttribute(attrs, view);
$onsen.registerEventHandlers(view, 'destroy');
element.data('ons-splitter-content', view);
element[0].pageLoader = $onsen.createPageLoader(view);
scope.$on('$destroy', function () {
view._events = undefined;
element.data('ons-splitter-content', undefined);
});
$onsen.fireComponentEvent(element[0], 'init');
};
}
};
}]);
})();
'use strict';
/**
* @element ons-splitter-side
*/
/**
* @attribute ons-destroy
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "destroy" event is fired.[/en]
* [ja]"destroy"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-preopen
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "preopen" event is fired.[/en]
* [ja]"preopen"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-preclose
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "preclose" event is fired.[/en]
* [ja]"preclose"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-postopen
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "postopen" event is fired.[/en]
* [ja]"postopen"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-postclose
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "postclose" event is fired.[/en]
* [ja]"postclose"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-modechange
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "modechange" event is fired.[/en]
* [ja]"modechange"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
(function () {
'use strict';
var lastReady = window.ons.SplitterSideElement.rewritables.ready;
window.ons.SplitterSideElement.rewritables.ready = ons._waitDiretiveInit('ons-splitter-side', lastReady);
angular.module('onsen').directive('onsSplitterSide', ['$compile', 'SplitterSide', '$onsen', function ($compile, SplitterSide, $onsen) {
return {
restrict: 'E',
compile: function compile(element, attrs) {
return function (scope, element, attrs) {
var view = new SplitterSide(scope, element, attrs);
$onsen.declareVarAttribute(attrs, view);
$onsen.registerEventHandlers(view, 'destroy preopen preclose postopen postclose modechange');
element.data('ons-splitter-side', view);
element[0].pageLoader = $onsen.createPageLoader(view);
scope.$on('$destroy', function () {
view._events = undefined;
element.data('ons-splitter-side', undefined);
});
$onsen.fireComponentEvent(element[0], 'init');
};
}
};
}]);
})();
'use strict';
/**
* @element ons-switch
*/
/**
* @attribute var
* @initonly
* @type {String}
* @description
* [en]Variable name to refer this switch.[/en]
* [ja]JavaScriptから参照するための変数名を指定します。[/ja]
*/
/**
* @method on
* @signature on(eventName, listener)
* @description
* [en]Add an event listener.[/en]
* [ja]イベントリスナーを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]このイベントが発火された際に呼び出される関数オブジェクトを指定します。[/ja]
*/
/**
* @method once
* @signature once(eventName, listener)
* @description
* [en]Add an event listener that's only triggered once.[/en]
* [ja]一度だけ呼び出されるイベントリスナーを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]イベントが発火した際に呼び出される関数オブジェクトを指定します。[/ja]
*/
/**
* @method off
* @signature off(eventName, [listener])
* @description
* [en]Remove an event listener. If the listener is not specified all listeners for the event type will be removed.[/en]
* [ja]イベントリスナーを削除します。もしイベントリスナーを指定しなかった場合には、そのイベントに紐づく全てのイベントリスナーが削除されます。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]削除するイベントリスナーを指定します。[/ja]
*/
(function () {
'use strict';
angular.module('onsen').directive('onsSwitch', ['$onsen', 'SwitchView', function ($onsen, SwitchView) {
return {
restrict: 'E',
replace: false,
scope: true,
link: function link(scope, element, attrs) {
if (attrs.ngController) {
throw new Error('This element can\'t accept ng-controller directive.');
}
var switchView = new SwitchView(element, scope, attrs);
$onsen.addModifierMethodsForCustomElements(switchView, element);
$onsen.declareVarAttribute(attrs, switchView);
element.data('ons-switch', switchView);
$onsen.cleaner.onDestroy(scope, function () {
switchView._events = undefined;
$onsen.removeModifierMethods(switchView);
element.data('ons-switch', undefined);
$onsen.clearComponent({
element: element,
scope: scope,
attrs: attrs
});
element = attrs = scope = null;
});
$onsen.fireComponentEvent(element[0], 'init');
}
};
}]);
})();
'use strict';
(function () {
'use strict';
tab.$inject = ['$onsen', 'GenericView'];
angular.module('onsen').directive('onsTab', tab).directive('onsTabbarItem', tab); // for BC
function tab($onsen, GenericView) {
return {
restrict: 'E',
link: function link(scope, element, attrs) {
var view = new GenericView(scope, element, attrs);
element[0].pageLoader = $onsen.createPageLoader(view);
$onsen.fireComponentEvent(element[0], 'init');
}
};
}
})();
'use strict';
/**
* @element ons-tabbar
*/
/**
* @attribute var
* @initonly
* @type {String}
* @description
* [en]Variable name to refer this tab bar.[/en]
* [ja]このタブバーを参照するための名前を指定します。[/ja]
*/
/**
* @attribute hide-tabs
* @initonly
* @type {Boolean}
* @default false
* @description
* [en]Whether to hide the tabs. Valid values are true/false.[/en]
* [ja]タブを非表示にする場合に指定します。trueもしくはfalseを指定できます。[/ja]
*/
/**
* @attribute ons-reactive
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "reactive" event is fired.[/en]
* [ja]"reactive"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-prechange
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "prechange" event is fired.[/en]
* [ja]"prechange"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-postchange
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when the "postchange" event is fired.[/en]
* [ja]"postchange"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-init
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when a page's "init" event is fired.[/en]
* [ja]ページの"init"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-show
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when a page's "show" event is fired.[/en]
* [ja]ページの"show"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-hide
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when a page's "hide" event is fired.[/en]
* [ja]ページの"hide"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @attribute ons-destroy
* @initonly
* @type {Expression}
* @description
* [en]Allows you to specify custom behavior when a page's "destroy" event is fired.[/en]
* [ja]ページの"destroy"イベントが発火された時の挙動を独自に指定できます。[/ja]
*/
/**
* @method on
* @signature on(eventName, listener)
* @description
* [en]Add an event listener.[/en]
* [ja]イベントリスナーを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]このイベントが発火された際に呼び出される関数オブジェクトを指定します。[/ja]
*/
/**
* @method once
* @signature once(eventName, listener)
* @description
* [en]Add an event listener that's only triggered once.[/en]
* [ja]一度だけ呼び出されるイベントリスナーを追加します。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]イベントが発火した際に呼び出される関数オブジェクトを指定します。[/ja]
*/
/**
* @method off
* @signature off(eventName, [listener])
* @description
* [en]Remove an event listener. If the listener is not specified all listeners for the event type will be removed.[/en]
* [ja]イベントリスナーを削除します。もしイベントリスナーを指定しなかった場合には、そのイベントに紐づく全てのイベントリスナーが削除されます。[/ja]
* @param {String} eventName
* [en]Name of the event.[/en]
* [ja]イベント名を指定します。[/ja]
* @param {Function} listener
* [en]Function to execute when the event is triggered.[/en]
* [ja]削除するイベントリスナーを指定します。[/ja]
*/
(function () {
'use strict';
var lastReady = window.ons.TabbarElement.rewritables.ready;
window.ons.TabbarElement.rewritables.ready = ons._waitDiretiveInit('ons-tabbar', lastReady);
angular.module('onsen').directive('onsTabbar', ['$onsen', '$compile', '$parse', 'TabbarView', function ($onsen, $compile, $parse, TabbarView) {
return {
restrict: 'E',
replace: false,
scope: true,
link: function link(scope, element, attrs, controller) {
scope.$watch(attrs.hideTabs, function (hide) {
if (typeof hide === 'string') {
hide = hide === 'true';
}
element[0].setTabbarVisibility(!hide);
});
var tabbarView = new TabbarView(scope, element, attrs);
$onsen.addModifierMethodsForCustomElements(tabbarView, element);
$onsen.registerEventHandlers(tabbarView, 'reactive prechange postchange init show hide destroy');
element.data('ons-tabbar', tabbarView);
$onsen.declareVarAttribute(attrs, tabbarView);
scope.$on('$destroy', function () {
tabbarView._events = undefined;
$onsen.removeModifierMethods(tabbarView);
element.data('ons-tabbar', undefined);
});
$onsen.fireComponentEvent(element[0], 'init');
}
};
}]);
})();
'use strict';
(function () {
'use strict';
angular.module('onsen').directive('onsTemplate', ['$templateCache', function ($templateCache) {
return {
restrict: 'E',
terminal: true,
compile: function compile(element) {
var content = element[0].template || element.html();
$templateCache.put(element.attr('id'), content);
}
};
}]);
})();
'use strict';
/**
* @element ons-toolbar
*/
/**
* @attribute var
* @initonly
* @type {String}
* @description
* [en]Variable name to refer this toolbar.[/en]
* [ja]このツールバーを参照するための名前を指定します。[/ja]
*/
(function () {
'use strict';
angular.module('onsen').directive('onsToolbar', ['$onsen', 'GenericView', function ($onsen, GenericView) {
return {
restrict: 'E',
// NOTE: This element must coexists with ng-controller.
// Do not use isolated scope and template's ng-transclude.
scope: false,
transclude: false,
compile: function compile(element) {
return {
pre: function pre(scope, element, attrs) {
// TODO: Remove this dirty fix!
if (element[0].nodeName === 'ons-toolbar') {
GenericView.register(scope, element, attrs, { viewKey: 'ons-toolbar' });
}
},
post: function post(scope, element, attrs) {
$onsen.fireComponentEvent(element[0], 'init');
}
};
}
};
}]);
})();
'use strict';
/**
* @element ons-toolbar-button
*/
/**
* @attribute var
* @initonly
* @type {String}
* @description
* [en]Variable name to refer this button.[/en]
* [ja]このボタンを参照するための名前を指定します。[/ja]
*/
(function () {
'use strict';
var module = angular.module('onsen');
module.directive('onsToolbarButton', ['$onsen', 'GenericView', function ($onsen, GenericView) {
return {
restrict: 'E',
scope: false,
link: {
pre: function pre(scope, element, attrs) {
var toolbarButton = new GenericView(scope, element, attrs);
element.data('ons-toolbar-button', toolbarButton);
$onsen.declareVarAttribute(attrs, toolbarButton);
$onsen.addModifierMethodsForCustomElements(toolbarButton, element);
$onsen.cleaner.onDestroy(scope, function () {
toolbarButton._events = undefined;
$onsen.removeModifierMethods(toolbarButton);
element.data('ons-toolbar-button', undefined);
element = null;
$onsen.clearComponent({
scope: scope,
attrs: attrs,
element: element
});
scope = element = attrs = null;
});
},
post: function post(scope, element, attrs) {
$onsen.fireComponentEvent(element[0], 'init');
}
}
};
}]);
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
var module = angular.module('onsen');
var ComponentCleaner = {
/**
* @param {jqLite} element
*/
decomposeNode: function decomposeNode(element) {
var children = element.remove().children();
for (var i = 0; i < children.length; i++) {
ComponentCleaner.decomposeNode(angular.element(children[i]));
}
},
/**
* @param {Attributes} attrs
*/
destroyAttributes: function destroyAttributes(attrs) {
attrs.$$element = null;
attrs.$$observers = null;
},
/**
* @param {jqLite} element
*/
destroyElement: function destroyElement(element) {
element.remove();
},
/**
* @param {Scope} scope
*/
destroyScope: function destroyScope(scope) {
scope.$$listeners = {};
scope.$$watchers = null;
scope = null;
},
/**
* @param {Scope} scope
* @param {Function} fn
*/
onDestroy: function onDestroy(scope, fn) {
var clear = scope.$on('$destroy', function () {
clear();
fn.apply(null, arguments);
});
}
};
module.factory('ComponentCleaner', function () {
return ComponentCleaner;
});
// override builtin ng-(eventname) directives
(function () {
var ngEventDirectives = {};
'click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste'.split(' ').forEach(function (name) {
var directiveName = directiveNormalize('ng-' + name);
ngEventDirectives[directiveName] = ['$parse', function ($parse) {
return {
compile: function compile($element, attr) {
var fn = $parse(attr[directiveName]);
return function (scope, element, attr) {
var listener = function listener(event) {
scope.$apply(function () {
fn(scope, { $event: event });
});
};
element.on(name, listener);
ComponentCleaner.onDestroy(scope, function () {
element.off(name, listener);
element = null;
ComponentCleaner.destroyScope(scope);
scope = null;
ComponentCleaner.destroyAttributes(attr);
attr = null;
});
};
}
};
}];
function directiveNormalize(name) {
return name.replace(/-([a-z])/g, function (matches) {
return matches[1].toUpperCase();
});
}
});
module.config(['$provide', function ($provide) {
var shift = function shift($delegate) {
$delegate.shift();
return $delegate;
};
Object.keys(ngEventDirectives).forEach(function (directiveName) {
$provide.decorator(directiveName + 'Directive', ['$delegate', shift]);
});
}]);
Object.keys(ngEventDirectives).forEach(function (directiveName) {
module.directive(directiveName, ngEventDirectives[directiveName]);
});
})();
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
var module = angular.module('onsen');
/**
* Internal service class for framework implementation.
*/
module.factory('$onsen', ['$rootScope', '$window', '$cacheFactory', '$document', '$templateCache', '$http', '$q', '$compile', '$onsGlobal', 'ComponentCleaner', function ($rootScope, $window, $cacheFactory, $document, $templateCache, $http, $q, $compile, $onsGlobal, ComponentCleaner) {
var $onsen = createOnsenService();
var ModifierUtil = $onsGlobal._internal.ModifierUtil;
return $onsen;
function createOnsenService() {
return {
DIRECTIVE_TEMPLATE_URL: 'templates',
cleaner: ComponentCleaner,
DeviceBackButtonHandler: $onsGlobal._deviceBackButtonDispatcher,
_defaultDeviceBackButtonHandler: $onsGlobal._defaultDeviceBackButtonHandler,
/**
* @return {Object}
*/
getDefaultDeviceBackButtonHandler: function getDefaultDeviceBackButtonHandler() {
return this._defaultDeviceBackButtonHandler;
},
/**
* @param {Object} view
* @param {Element} element
* @param {Array} methodNames
* @return {Function} A function that dispose all driving methods.
*/
deriveMethods: function deriveMethods(view, element, methodNames) {
methodNames.forEach(function (methodName) {
view[methodName] = function () {
return element[methodName].apply(element, arguments);
};
});
return function () {
methodNames.forEach(function (methodName) {
view[methodName] = null;
});
view = element = null;
};
},
/**
* @param {Class} klass
* @param {Array} properties
*/
derivePropertiesFromElement: function derivePropertiesFromElement(klass, properties) {
properties.forEach(function (property) {
Object.defineProperty(klass.prototype, property, {
get: function get() {
return this._element[0][property];
},
set: function set(value) {
return this._element[0][property] = value; // eslint-disable-line no-return-assign
}
});
});
},
/**
* @param {Object} view
* @param {Element} element
* @param {Array} eventNames
* @param {Function} [map]
* @return {Function} A function that clear all event listeners
*/
deriveEvents: function deriveEvents(view, element, eventNames, map) {
map = map || function (detail) {
return detail;
};
eventNames = [].concat(eventNames);
var listeners = [];
eventNames.forEach(function (eventName) {
var listener = function listener(event) {
map(event.detail || {});
view.emit(eventName, event);
};
listeners.push(listener);
element.addEventListener(eventName, listener, false);
});
return function () {
eventNames.forEach(function (eventName, index) {
element.removeEventListener(eventName, listeners[index], false);
});
view = element = listeners = map = null;
};
},
/**
* @return {Boolean}
*/
isEnabledAutoStatusBarFill: function isEnabledAutoStatusBarFill() {
return !!$onsGlobal._config.autoStatusBarFill;
},
/**
* @return {Boolean}
*/
shouldFillStatusBar: $onsGlobal.shouldFillStatusBar,
/**
* @param {Function} action
*/
autoStatusBarFill: $onsGlobal.autoStatusBarFill,
/**
* @param {Object} directive
* @param {HTMLElement} pageElement
* @param {Function} callback
*/
compileAndLink: function compileAndLink(view, pageElement, callback) {
var link = $compile(pageElement);
var pageScope = view._scope.$new();
link(pageScope);
/**
* Overwrite page scope.
*/
angular.element(pageElement).data('_scope', pageScope);
pageScope.$evalAsync(function () {
callback(pageElement);
});
},
/**
* @param {Object} view
* @return {Object} pageLoader
*/
createPageLoader: function createPageLoader(view) {
var _this = this;
return new window.ons.PageLoader(function (_ref, done) {
var page = _ref.page,
parent = _ref.parent;
window.ons._internal.getPageHTMLAsync(page).then(function (html) {
_this.compileAndLink(view, window.ons._util.createElement(html.trim()), function (element) {
parent.appendChild(element);
done(element);
});
});
}, function (element) {
angular.element(element).data('_scope').$destroy();
element.remove();
});
},
/**
* @param {Object} params
* @param {Scope} [params.scope]
* @param {jqLite} [params.element]
* @param {Array} [params.elements]
* @param {Attributes} [params.attrs]
*/
clearComponent: function clearComponent(params) {
if (params.scope) {
ComponentCleaner.destroyScope(params.scope);
}
if (params.attrs) {
ComponentCleaner.destroyAttributes(params.attrs);
}
if (params.element) {
ComponentCleaner.destroyElement(params.element);
}
if (params.elements) {
params.elements.forEach(function (element) {
ComponentCleaner.destroyElement(element);
});
}
},
/**
* @param {jqLite} element
* @param {String} name
*/
findElementeObject: function findElementeObject(element, name) {
return element.inheritedData(name);
},
/**
* @param {String} page
* @return {Promise}
*/
getPageHTMLAsync: function getPageHTMLAsync(page) {
var cache = $templateCache.get(page);
if (cache) {
var deferred = $q.defer();
var html = typeof cache === 'string' ? cache : cache[1];
deferred.resolve(this.normalizePageHTML(html));
return deferred.promise;
} else {
return $http({
url: page,
method: 'GET'
}).then(function (response) {
var html = response.data;
return this.normalizePageHTML(html);
}.bind(this));
}
},
/**
* @param {String} html
* @return {String}
*/
normalizePageHTML: function normalizePageHTML(html) {
html = ('' + html).trim();
if (!html.match(/^<ons-page/)) {
html = '<ons-page _muted>' + html + '</ons-page>';
}
return html;
},
/**
* Create modifier templater function. The modifier templater generate css classes bound modifier name.
*
* @param {Object} attrs
* @param {Array} [modifiers] an array of appendix modifier
* @return {Function}
*/
generateModifierTemplater: function generateModifierTemplater(attrs, modifiers) {
var attrModifiers = attrs && typeof attrs.modifier === 'string' ? attrs.modifier.trim().split(/ +/) : [];
modifiers = angular.isArray(modifiers) ? attrModifiers.concat(modifiers) : attrModifiers;
/**
* @return {String} template eg. 'ons-button--*', 'ons-button--*__item'
* @return {String}
*/
return function (template) {
return modifiers.map(function (modifier) {
return template.replace('*', modifier);
}).join(' ');
};
},
/**
* Add modifier methods to view object for custom elements.
*
* @param {Object} view object
* @param {jqLite} element
*/
addModifierMethodsForCustomElements: function addModifierMethodsForCustomElements(view, element) {
var methods = {
hasModifier: function hasModifier(needle) {
var tokens = ModifierUtil.split(element.attr('modifier'));
needle = typeof needle === 'string' ? needle.trim() : '';
return ModifierUtil.split(needle).some(function (needle) {
return tokens.indexOf(needle) != -1;
});
},
removeModifier: function removeModifier(needle) {
needle = typeof needle === 'string' ? needle.trim() : '';
var modifier = ModifierUtil.split(element.attr('modifier')).filter(function (token) {
return token !== needle;
}).join(' ');
element.attr('modifier', modifier);
},
addModifier: function addModifier(modifier) {
element.attr('modifier', element.attr('modifier') + ' ' + modifier);
},
setModifier: function setModifier(modifier) {
element.attr('modifier', modifier);
},
toggleModifier: function toggleModifier(modifier) {
if (this.hasModifier(modifier)) {
this.removeModifier(modifier);
} else {
this.addModifier(modifier);
}
}
};
for (var method in methods) {
if (methods.hasOwnProperty(method)) {
view[method] = methods[method];
}
}
},
/**
* Add modifier methods to view object.
*
* @param {Object} view object
* @param {String} template
* @param {jqLite} element
*/
addModifierMethods: function addModifierMethods(view, template, element) {
var _tr = function _tr(modifier) {
return template.replace('*', modifier);
};
var fns = {
hasModifier: function hasModifier(modifier) {
return element.hasClass(_tr(modifier));
},
removeModifier: function removeModifier(modifier) {
element.removeClass(_tr(modifier));
},
addModifier: function addModifier(modifier) {
element.addClass(_tr(modifier));
},
setModifier: function setModifier(modifier) {
var classes = element.attr('class').split(/\s+/),
patt = template.replace('*', '.');
for (var i = 0; i < classes.length; i++) {
var cls = classes[i];
if (cls.match(patt)) {
element.removeClass(cls);
}
}
element.addClass(_tr(modifier));
},
toggleModifier: function toggleModifier(modifier) {
var cls = _tr(modifier);
if (element.hasClass(cls)) {
element.removeClass(cls);
} else {
element.addClass(cls);
}
}
};
var append = function append(oldFn, newFn) {
if (typeof oldFn !== 'undefined') {
return function () {
return oldFn.apply(null, arguments) || newFn.apply(null, arguments);
};
} else {
return newFn;
}
};
view.hasModifier = append(view.hasModifier, fns.hasModifier);
view.removeModifier = append(view.removeModifier, fns.removeModifier);
view.addModifier = append(view.addModifier, fns.addModifier);
view.setModifier = append(view.setModifier, fns.setModifier);
view.toggleModifier = append(view.toggleModifier, fns.toggleModifier);
},
/**
* Remove modifier methods.
*
* @param {Object} view object
*/
removeModifierMethods: function removeModifierMethods(view) {
view.hasModifier = view.removeModifier = view.addModifier = view.setModifier = view.toggleModifier = undefined;
},
/**
* Define a variable to JavaScript global scope and AngularJS scope as 'var' attribute name.
*
* @param {Object} attrs
* @param object
*/
declareVarAttribute: function declareVarAttribute(attrs, object) {
if (typeof attrs.var === 'string') {
var varName = attrs.var;
this._defineVar(varName, object);
}
},
_registerEventHandler: function _registerEventHandler(component, eventName) {
var capitalizedEventName = eventName.charAt(0).toUpperCase() + eventName.slice(1);
component.on(eventName, function (event) {
$onsen.fireComponentEvent(component._element[0], eventName, event && event.detail);
var handler = component._attrs['ons' + capitalizedEventName];
if (handler) {
component._scope.$eval(handler, { $event: event });
component._scope.$evalAsync();
}
});
},
/**
* Register event handlers for attributes.
*
* @param {Object} component
* @param {String} eventNames
*/
registerEventHandlers: function registerEventHandlers(component, eventNames) {
eventNames = eventNames.trim().split(/\s+/);
for (var i = 0, l = eventNames.length; i < l; i++) {
var eventName = eventNames[i];
this._registerEventHandler(component, eventName);
}
},
/**
* @return {Boolean}
*/
isAndroid: function isAndroid() {
return !!window.navigator.userAgent.match(/android/i);
},
/**
* @return {Boolean}
*/
isIOS: function isIOS() {
return !!window.navigator.userAgent.match(/(ipad|iphone|ipod touch)/i);
},
/**
* @return {Boolean}
*/
isWebView: function isWebView() {
return window.ons.isWebView();
},
/**
* @return {Boolean}
*/
isIOS7above: function () {
var ua = window.navigator.userAgent;
var match = ua.match(/(iPad|iPhone|iPod touch);.*CPU.*OS (\d+)_(\d+)/i);
var result = match ? parseFloat(match[2] + '.' + match[3]) >= 7 : false;
return function () {
return result;
};
}(),
/**
* Fire a named event for a component. The view object, if it exists, is attached to event.component.
*
* @param {HTMLElement} [dom]
* @param {String} event name
*/
fireComponentEvent: function fireComponentEvent(dom, eventName, data) {
data = data || {};
var event = document.createEvent('HTMLEvents');
for (var key in data) {
if (data.hasOwnProperty(key)) {
event[key] = data[key];
}
}
event.component = dom ? angular.element(dom).data(dom.nodeName.toLowerCase()) || null : null;
event.initEvent(dom.nodeName.toLowerCase() + ':' + eventName, true, true);
dom.dispatchEvent(event);
},
/**
* Define a variable to JavaScript global scope and AngularJS scope.
*
* Util.defineVar('foo', 'foo-value');
* // => window.foo and $scope.foo is now 'foo-value'
*
* Util.defineVar('foo.bar', 'foo-bar-value');
* // => window.foo.bar and $scope.foo.bar is now 'foo-bar-value'
*
* @param {String} name
* @param object
*/
_defineVar: function _defineVar(name, object) {
var names = name.split(/\./);
function set(container, names, object) {
var name;
for (var i = 0; i < names.length - 1; i++) {
name = names[i];
if (container[name] === undefined || container[name] === null) {
container[name] = {};
}
container = container[name];
}
container[names[names.length - 1]] = object;
if (container[names[names.length - 1]] !== object) {
throw new Error('Cannot set var="' + object._attrs.var + '" because it will overwrite a read-only variable.');
}
}
if (ons.componentBase) {
set(ons.componentBase, names, object);
}
// Attach to ancestor with ons-scope attribute.
var element = object._element[0];
while (element.parentNode) {
if (element.hasAttribute('ons-scope')) {
set(angular.element(element).data('_scope'), names, object);
element = null;
return;
}
element = element.parentNode;
}
element = null;
// If no ons-scope element was found, attach to $rootScope.
set($rootScope, names, object);
}
};
}
}]);
})();
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
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.
*/
['alert', 'confirm', 'prompt'].forEach(function (name) {
var originalNotification = ons.notification[name];
ons.notification[name] = function (message) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
typeof message === 'string' ? options.message = message : options = message;
var compile = options.compile;
var $element = void 0;
options.compile = function (element) {
$element = angular.element(compile ? compile(element) : element);
return ons.$compile($element)($element.injector().get('$rootScope'));
};
options.destroy = function () {
$element.data('_scope').$destroy();
$element = null;
};
return originalNotification(options);
};
});
'use strict';
// confirm to use jqLite
if (window.jQuery && angular.element === window.jQuery) {
console.warn('Onsen UI require jqLite. Load jQuery after loading AngularJS to fix this error. jQuery may break Onsen UI behavior.'); // eslint-disable-line no-console
}
'use strict';
/*
Copyright 2013-2015 ASIAL CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function () {
'use strict';
angular.module('onsen').run(['$templateCache', function ($templateCache) {
var templates = window.document.querySelectorAll('script[type="text/ons-template"]');
for (var i = 0; i < templates.length; i++) {
var template = angular.element(templates[i]);
var id = template.attr('id');
if (typeof id === 'string') {
$templateCache.put(id, template.text());
}
}
}]);
})();
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNsYXNzLmpzIiwidGVtcGxhdGVzLmpzIiwib25zZW4uanMiLCJhbGVydERpYWxvZy5qcyIsImFsZXJ0RGlhbG9nQW5pbWF0b3IuanMiLCJhbmltYXRpb25DaG9vc2VyLmpzIiwiY2Fyb3VzZWwuanMiLCJkaWFsb2cuanMiLCJkaWFsb2dBbmltYXRvci5qcyIsImZhYi5qcyIsImdlbmVyaWMuanMiLCJsYXp5UmVwZWF0LmpzIiwibGF6eVJlcGVhdERlbGVnYXRlLmpzIiwibW9kYWwuanMiLCJuYXZpZ2F0b3IuanMiLCJuYXZpZ2F0b3JUcmFuc2l0aW9uQW5pbWF0b3IuanMiLCJvdmVybGF5U2xpZGluZ01lbnVBbmltYXRvci5qcyIsInBhZ2UuanMiLCJwb3BvdmVyLmpzIiwicG9wb3ZlckFuaW1hdG9yLmpzIiwicHVsbEhvb2suanMiLCJwdXNoU2xpZGluZ01lbnVBbmltYXRvci5qcyIsInJldmVhbFNsaWRpbmdNZW51QW5pbWF0b3IuanMiLCJzbGlkaW5nTWVudS5qcyIsInNsaWRpbmdNZW51QW5pbWF0b3IuanMiLCJzcGVlZERpYWwuanMiLCJzcGxpdFZpZXcuanMiLCJzcGxpdHRlci1jb250ZW50LmpzIiwic3BsaXR0ZXItc2lkZS5qcyIsInNwbGl0dGVyLmpzIiwic3dpdGNoLmpzIiwidGFiYmFyVmlldy5qcyIsImJhY2tCdXR0b24uanMiLCJib3R0b21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hvZE5hbWVdID0gZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgIHJldHVybiBlbGVtZW50W21ldGhvZE5hbWVdLmFwcGx5KGVsZW1lbnQsIGFyZ3VtZW50cyk7XG4gICAgICAgICAgICB9O1xuICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgbWV0aG9kTmFtZXMuZm9yRWFjaChmdW5jdGlvbihtZXRob2ROYW1lKSB7XG4gICAgICAgICAgICAgIHZpZXdbbWV0aG9kTmFtZV0gPSBudWxsO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB2aWV3ID0gZWxlbWVudCA9IG51bGw7XG4gICAgICAgICAgfTtcbiAgICAgICAgfSxcblxuICAgICAgICAvKipcbiAgICAgICAgICogQHBhcmFtIHtDbGFzc30ga2xhc3NcbiAgICAgICAgICogQHBhcmFtIHtBcnJheX0gcHJvcGVydGllc1xuICAgICAgICAgKi9cbiAgICAgICAgZGVyaXZlUHJvcGVydGllc0Zyb21FbGVtZW50OiBmdW5jdGlvbihrbGFzcywgcHJvcGVydGllcykge1xuICAgICAgICAgIHByb3BlcnRpZXMuZm9yRWFjaChmdW5jdGlvbihwcm9wZXJ0eSkge1xuICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KGtsYXNzLnByb3RvdHlwZSwgcHJvcGVydHksIHtcbiAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX2VsZW1lbnRbMF1bcHJvcGVydHldO1xuICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX2VsZW1lbnRbMF1bcHJvcGVydHldID0gdmFsdWU7IC8vIGVzbGludC1kaXNhYmxlLWxpbmUgbm8tcmV0dXJuLWFzc2lnblxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICB9KTtcbiAgICAgICAgfSxcblxuICAgICAgICAvKipcbiAgICAgICAgICogQHBhcmFtIHtPYmplY3R9IHZpZXdcbiAgICAgICAgICogQHBhcmFtIHtFbGVtZW50fSBlbGVtZW50XG4gICAgICAgICAqIEBwYXJhbSB7QXJyYXl9IGV2ZW50TmFtZXNcbiAgICAgICAgICogQHBhcmFtIHtGdW5jdGlvbn0gW21hcF1cbiAgICAgICAgICogQHJldHVybiB7RnVuY3Rpb259IEEgZnVuY3Rpb24gdGhhdCBjbGVhciBhbGwgZXZlbnQgbGlzdGVuZXJzXG4gICAgICAgICAqL1xuICAgICAgICBkZXJpdmVFdmVudHM6IGZ1bmN0aW9uKHZpZXcsIGVsZW1lbnQsIGV2ZW50TmFtZXMsIG1hcCkge1xuICAgICAgICAgIG1hcCA9IG1hcCB8fCBmdW5jdGlvbihkZXRhaWwpIHsgcmV0dXJuIGRldGFpbDsgfTtcbiAgICAgICAgICBldmVudE5hbWVzID0gW10uY29uY2F0KGV2ZW50TmFtZXMpO1xuICAgICAgICAgIHZhciBsaXN0ZW5lcnMgPSBbXTtcblxuICAgICAgICAgIGV2ZW50TmFtZXMuZm9yRWFjaChmdW5jdGlvbihldmVudE5hbWUpIHtcbiAgICAgICAgICAgIHZhciBsaXN0ZW5lciA9IGZ1bmN0aW9uKGV2ZW50KSB7XG4gICAgICAgICAgICAgIG1hcChldmVudC5kZXRhaWwgfHwge30pO1xuICAgICAgICAgICAgICB2aWV3LmVtaXQoZXZlbnROYW1lLCBldmVudCk7XG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgbGlzdGVuZXJzLnB1c2gobGlzdGVuZXIpO1xuICAgICAgICAgICAgZWxlbWVudC5hZGRFdmVudExpc3RlbmVyKGV2ZW50TmFtZSwgbGlzdGVuZXIsIGZhbHNlKTtcbiAgICAgICAgICB9KTtcblxuICAgICAgICAgIHJldHVybiBmdW5jdGlvbigpIH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24odmlldywgcGFnZUVsZW1lbnQsIGNhbGxiYWNrKSB7XG4gICAgICAgICAgdmFyIGxpbmsgPSAkY29tcGlsZShwYWdlRWxlbWVudCk7XG4gICAgICAgICAgdmFyIHBhZ2VTY29wZSA9IHZpZXcuX3Njb3BlLiRuZXcoKTtcblxuICAgICAgICAgIGxpbmsocGFnZVNjb3BlKTtcblxuICAgICAgICAgIC8qKlxuICAgICAgICAgICAqIE92ZXJ3cml0ZSBwYWdlIHNjb3BlLlxuICAgICAgICAgICAqL1xuICAgICAgICAgIGFuZ3VsYXIuZWxlbWVudChwYWdlRWxlbWVudCkuZGF0YSgnX3Njb3BlJywgcGFnZVNjb3BlKTtcblxuICAgICAgICAgIHBhZ2VTY29wZS4kZXZhbEFzeW5jKGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgY2FsbGJhY2socGFnZUVsZW1lbnQpO1xuICAgICAgICAgIH0pO1xuICAgICAgICB9LFxuXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBAcGFyYW0ge09iamVjdH0gdmlld1xuICAgICAgICAgKiBAcmV0dXJuIHtPYmplY3R9IHBhZ2VMb2FkZXJcbiAgICAgICAgICovXG4gICAgICAgIGNyZWF0ZVBhZ2VMb2FkZXI6IGZ1bmN0aW9uKHZpZXcpIHtcbiAgICAgICAgICByZXR1cm4gbmV3IHdpbmRvdy5vbnMuUGFnZUxvYWRlcihcbiAgICAgICAgICAgICh7cGFnZSwgcGFyZW50fSwgZG9uZSkgPT4ge1xuICAgICAgICAgICAgICB3aW5kb3cub25zLl9pbnRlcm5hbC5nZXRQYWdlSFRNTEFzeW5jKHBhZ2UpLnRoZW4oaHRtbCA9PiB7XG4gICAgICAgICAgICAgICAgdGhpcy5jb21waWxlQW5kTGluayhcbiAgICAgICAgICAgICAgICAgIHZpZXcsXG4gICAgICAgICAgICAgICAgICB3aW5kb3cub25zLl91dGlsLmNyZWF0ZUVsZW1lbnQoaHRtbC50cmltKCkpLFxuICAgICAgICAgICAgICAgICAgZWxlbWVudCA9PiB7XG4gICAgICAgICAgICAgICAgICAgIHBhcmVudC5hcHBlbmRDaGlsZChlbGVtZW50KTtcbiAgICAgICAgICAgICAgICAgICAgZG9uZShlbGVtZW50KTtcbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBlbGVtZW50ID0+IHtcbiAgICAgICAgICAgICAgYW5ndWxhci5lbGVtZW50KGVsZW1lbnQpLmRhdGEoJ19zY29wZScpLiRkZXN0cm95KCk7XG4gICAgICAgICAgICAgIGVsZW1lbnQucmVtb3ZlKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgKTtcbiAgICAgICAgfSxcblxuICAgICAgICAvKipcbiAgICAgICAgICogQHBhcmFtIHtPYmplY3R9IHBhcmFtc1xuICAgICAgICAgKiBAcGFyYW0ge1Njb3BlfSBbcGFyYW1zLnNjb3BlXVxuICAgICAgICAgKiBAcGFyYW0ge2pxTGl0ZX0gW3BhcmFtcy5lbGVtZW50XVxuICAgICAgICAgKiBAcGFyYW0ge0FycmF5fSBbcGFyYW1zLmVsZW1lbnRzXVxuICAgICAgICAgKiBAcGFyYW0ge0F0dHJpYnV0ZXN9IFtwYXJhbXMuYXR0cnNdXG4gICAgICAgICAqL1xuICAgICAgICBjbGVhckNvbXBvbmVudDogZnVuY3Rpb24ocGFyYW1zKSB7XG4gICAgICAgICAgaWYgKHBhcmFtcy5zY29wZSkge1xuICAgICAgICAgICAgQ29tcG9uZW50Q2xlYW5lci5kZXN0cm95U2NvcGUocGFyYW1zLnNjb3BlKTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAocGFyYW1zLmF0dHJzKSB7XG4gICAgICAgICAgICBDb21wb25lbnRDbGVhbmVyLmRlc3Ryb3lBdHRyaWJ1dGVzKHBhcmFtcy5hdHRycyk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKHBhcmFtcy5lbGVtZW50KSB7XG4gICAgICAgICAgICBDb21wb25lbnRDbGVhbmVyLmRlc3Ryb3lFbGVtZW50KHBhcmFtcy5lbGVtZW50KTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAocGFyYW1zLmVsZW1lbnRzKSB7XG4gICAgICAgICAgICBwYXJhbXMuZWxlbWVudHMuZm9yRWFjaChmdW5jdGlvbihlbGVtZW50KSB7XG4gICAgICAgICAgICAgIENvbXBvbmVudENsZWFuZXIuZGVzdHJveUVsZW1lbnQoZWxlbWVudCk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICB9XG4gICAgICAgIH0sXG5cbiAgICAgICAgLyoqXG4gICAgICAgICAqIEBwYXJhbSB7anFMaXRlfSBlbGVtZW50XG4gICAgICAgICAqIEBwYXJhbSB7U3RyaW5nfSBuYW1lXG4gICAgICAgICAqL1xuICAgICAgICBmaW5kRWxlbWVudGVPYmplY3Q6IGZ1bmN0aW9uKGVsZW1lbnQsIG5hbWUpIHtcbiAgICAgICAgICByZXR1cm4gZWxlbWVudC5pbmhlcml0ZWREYXRhKG5hbWUpO1xuICAgICAgICB9LFxuXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBAcGFyYW0ge1N0cmluZ30gcGFnZVxuICAgICAgICAgKiBAcmV0dXJuIHtQcm9taXNlfVxuICAgICAgICAgKi9cbiAgICAgICAgZ2V0UGFnZUhUTUxBc3luYzogZnVuY3Rpb24ocGFnZSkge1xuICAgICAgICAgIHZhciBjYWNoZSA9ICR0ZW1wbGF0ZUNhY2hlLmdldChwYWdlKTtcblxuICAgICAgICAgIGlmIChjYWNoZSkge1xuICAgICAgICAgICAgdmFyIGRlZmVycmVkID0gJHEuZGVmZXIoKTtcblxuICAgICAgICAgICAgdmFyIGh0bWwgPSB0eXBlb2YgY2FjaGUgPT09ICdzdHJpbmcnID8gY2FjaGUgOiBjYWNoZVsxXTtcbiAgICAgICAgICAgIGRlZmVycmVkLnJlc29sdmUodGhpcy5ub3JtYWxpemVQYWdlSFRNTChodG1sKSk7XG5cbiAgICAgICAgICAgIHJldHVybiBkZWZlcnJlZC5wcm9taXNlO1xuXG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiAkaHR0cCh7XG4gICAgICAgICAgICAgIHVybDogcGFnZSxcbiAgICAgICAgICAgICAgbWV0aG9kOiAnR0VUJ1xuICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbihyZXNwb25zZSkge1xuICAgICAgICAgICAgICB2YXIgaHRtbCA9IHJlc3BvbnNlLmRhdGE7XG5cbiAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubm9ybWFsaXplUGFnZUhUTUwoaHRtbCk7XG4gICAgICAgICAgICB9LmJpbmQodGhpcykpO1xuICAgICAgICAgIH1cbiAgICAgICAgfSxcblxuICAgICAgICAvKipcbiAgICAgICAgICogQHBhcmFtIHtTdHJpbmd9IGh0bWxcbiAgICAgICAgICogQHJldHVybiB7U3RyaW5nfVxuICAgICAgICAgKi9cbiAgICAgICAgbm9ybWFsaXplUGFnZUhUTUw6IGZ1bmN0aW9uKGh0bWwpIHtcbiAgICAgICAgICBodG1sID0gKCcnICsgaHRtbCkudHJpbSgpO1xuXG4gICAgICAgICAgaWYgKCFodG1sLm1hdGNoKC9ePG9ucy1wYWdlLykpIHtcbiAgICAgICAgICAgIGh0bWwgPSAnPG9ucy1wYWdlIF9tdXRlZD4nICsgaHRtbCArICc8L29ucy1wYWdlPic7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgcmV0dXJuIGh0bWw7XG4gICAgICAgIH0sXG5cbiAgICAgICAgLyoqXG4gICAgICAgICAqIENyZWF0ZSBtb2RpZmllciB0ZW1wbGF0ZXIgZnVuY3Rpb24uIFRoZSBtb2RpZmllciB0ZW1wbGF0ZXIgZ2VuZXJhdGUgY3NzIGNsYXNzZXMgYm91bmQgbW9kaWZpZXIgbmFtZS5cbiAgICAgICAgICpcbiAgICAgICAgICogQHBhcmFtIHtPYmplY3R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AgICAqXG4gICAgICAgICAqIEBwYXJhbSB7T2JqZWN0fSB2aWV3IG9iamVjdFxuICAgICAgICAgKiBAcGFyYW0ge2pxTGl0ZX0gZWxlbWVudFxuICAgICAgICAgKi9cbiAgICAgICAgYWRkTW9kaWZpZXJNZXRob2RzRm9yQ3VzdG9tRWxlbWVudHM6IGZ1bmN0aW9uKHZpZXcsIGVsZW1lbnQpIHtcbiAgICAgICAgICB2YXIgbWV0aG9kcyA9IHtcbiAgICAgICAgICAgIGhhc01vZGlmaWVyOiBmdW5jdGlvbihuZWVkbGUpIHtcbiAgICAgICAgICAgICAgdmFyIHRva2VucyA9IE1vZGlmaWVyVXRpbC5zcGxpdChlbGVtZW50LmF0dHIoJ21vZGlmaWVyJykpO1xuICAgICAgICAgICAgICBuZWVkbGUgPSB0eXBlb2YgbmVlZGxlID09PSAnc3RyaW5nJyA/IG5lZWRsZS50cmltKCkgOiAnJztcblxuICAgICAgICAgICAgICByZXR1cm4gTW9kaWZpZXJVdGlsLnNwbGl0KG5lZWRsZSkuc29tZShmdW5jdGlvbihuZWVkbGUpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdG9rZW5zLmluZGV4T2YobmVlZGxlKSAhPSAtMTtcbiAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9LFxuXG4gICAgICAgICAgICByZW1vdmVNb2RpZmllcjogZnVuY3Rpb24obmVlZGxlKSB7XG4gICAgICAgICAgICAgIG5lZWRsZSA9IHR5cGVvZiBuZWVkbGUgPT09ICdzdHJpbmcnID8gbmVlZGxlLnRyaW0oKSA6ICcnO1xuXG4gICAgICAgICAgICAgIHZhciBtb2RpZmllciA9IE1vZGlmaWVyVXRpbC5zcGxpdChlbGVtZW50LmF0dHIoJ21vZGlmaWVyJykpLmZpbHRlcihmdW5jdGlvbih0b2tlbikge1xuICAgICAgICAgICAgICAgIHJldHVybiB0b2tlbiAhPT0gbmVlZGxlO1xuICAgICAgICAgICAgICB9KS5qb2luKCcgJyk7XG5cbiAgICAgICAgICAgICAgZWxlbWVudC5hdHRyKCdtb2RpZmllcicsIG1vZGlmaWVyKTtcbiAgICAgICAgICAgIH0sXG5cbiAgICAgICAgICAgIGFkZE1vZGlmaWVyOiBmdW5jdGlvbihtb2RpZmllcikge1xuICAgICAgICAgICAgICBlbGVtZW50LmF0dHIoJ21vZGlmaWVyJywgZWxlbWVudC5hdHRyKCdtb2RpZmllcicpICsgJyAnICsgbW9kaWZpZXIpO1xuICAgICAgICAgICAgfSxcblxuICAgICAgICAgICAgc2V0TW9kaWZpZXI6IGZ1bmN0aW9uKG1vZGlmaWVyKSB7XG4gICAgICAgICAgICAgIGVsZW1lbnQuYXR0cignbW9kaWZpZXInLCBtb2RpZmllcik7XG4gICAgICAgICAgICB9LFxuXG4gICAgICAgICAgICB0b2dnbGVNb2RpZmllcjogZnVuY3Rpb24obW9kaWZpZXIpIHtcbiAgICAgICAgICAgICAgaWYgKHRoaXMuaGFzTW9kaWZpZXIobW9kaWZpZXIpKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5yZW1vdmVNb2RpZmllcihtb2RpZmllcik7XG4gICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgdGhpcy5hZGRNb2RpZmllcihtb2RpZmllcik7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9O1xuXG4gICAgICAgICAgZm9yICh2YXIgbWV0aG9kIGluIG1ldGhvZHMpIHtcbiAgICAgICAgICAgIGlmIChtZXRob2RzLmhhc093blByb3BlcnR5KG1ldGhvZCkpIHtcbiAgICAgICAgICAgICAgdmlld1ttZXRob2RdID0gbWV0aG9kc1ttZXRob2RdO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfSxcblxuICAgICAgICAvKipcbiAgICAgICAgICogQWRkIG1vZGlmaWVyIG1ldGhvZHMgdG8gdmlldyBvYmplY3QuXG4gICAgICAgICAqXG4gICAgICAgICAqIEBwYXJhbSB7T2JqZWN0fSB2aWV3IG9iamVjdFxuICAgICAgICAgKiBAcGFyYW0ge1N0cmluZ30gdGVtcGxhdGVcbiAgICAgICAgICogQHBhcmFtIHtqcUxpdGV9IGVsZW1lbnRcbiAgICAgICAgICovXG4gICAgICAgIGFkZE1vZGlmaWVyTWV0aG9kczogZnVuY3Rpb24odmlldywgdGVtcGxhdGUsIGVsZW1lbnQpIHtcbiAgICAgICAgICB2YXIgX3RyID0gZnVuY3Rpb24obW9kaWZpZXIpIHtcbiAgICAgICAgICAgIHJldHVybiB0ZW1wbGF0ZS5yZXBsYWNlKCcqJywgbW9kaWZpZXIpO1xuICAgICAgICAgIH07XG5cbiAgICAgICAgICB2YXIgZm5zID0ge1xuICAgICAgICAgICAgaGFzTW9kaWZpZXI6IGZ1bmN0aW9uKG1vZGlmaWVyKSB7XG4gICAgICAgICAgICAgIHJldHVybiBlbGVtZW50Lmhhc0NsYXNzKF90cihtb2RpZmllcikpO1xuICAgICAgICAgICAgfSxcblxuICAgICAgICAgICAgcmVtb3ZlTW9kaWZpZXI6IGZ1bmN0aW9uKG1vZGlmaWVyKSB7XG4gICAgICAgICAgICAgIGVsZW1lbnQucmVtb3ZlQ2xhc3MoX3RyKG1vZGlmaWVyKSk7XG4gICAgICAgICAgICB9LFxuXG4gICAgICAgICAgICBhZGRNb2RpZmllcjogZnVuY3Rpb24obW9kaWZpZXIpIHtcbiAgICAgICAgICAgICAgZWxlbWVudC5hZGRDbGFzcyhfdHIobW9kaWZpZXIpKTtcbiAgICAgICAgICAgIH0sXG5cbiAgICAgICAgICAgIHNldE1vZGlmaWVyOiBmdW5jdGlvbihtb2RpZmllcikge1xuICAgICAgICAgICAgICB2YXIgY2xhc3NlcyA9IGVsZW1lbnQuYXR0cignY2xhc3MnKS5zcGxpdCgvXFxzKy8pLFxuICAgICAgICAgICAgICAgICAgcGF0dCA9IHRlbXBsYXRlLnJlcGxhY2UoJyonLCAnLicpO1xuXG4gICAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgY2xhc3Nlcy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIHZhciBjbHMgPSBjbGFzc2VzW2ldO1xuXG4gICAgICAgICAgICAgICAgaWYgKGNscy5tYXRjaChwYXR0KSkge1xuICAgICAgICAgICAgICAgICAgZWxlbWVudC5yZW1vdmVDbGFzcyhjbHMpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgIGVsZW1lbnQuYWRkQ2xhc3MoX3RyKG1vZGlmaWVyKSk7XG4gICAgICAgICAgICB9LFxuXG4gICAgICAgICAgICB0b2dnbGVNb2RpZmllcjogZnVuY3Rpb24obW9kaWZpZXIpIHtcbiAgICAgICAgICAgICAgdmFyIGNscyA9IF90cihtb2RpZmllcik7XG4gICAgICAgICAgICAgIGlmIChlbGVtZW50Lmhhc0NsYXNzKGNscykpIHtcbiAgICAgICAgICAgICAgICBlbGVtZW50LnJlbW92ZUNsYXNzKGNscyk7XG4gICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgZWxlbWVudC5hZGRDbGFzcyhjbHMpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfTtcblxuICAgICAgICAgIHZhciBhcHBlbmQgPSBmdW5jdGlvbihvbGRGbiwgbmV3Rm4pIHtcbiAgICAgICAgICAgIGlmICh0eXBlb2Ygb2xkRm4gIT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gb2xkRm4uYXBwbHkobnVsbCwgYXJndW1lbnRzKSB8fCBuZXdGbi5hcHBseShudWxsLCBhcmd1bWVudHMpO1xuICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgcmV0dXJuIG5ld0ZuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH07XG5cbiA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LlxuICAgICAgICAgKlxuICAgICAgICAgKiBAcGFyYW0ge09iamVjdH0gYXR0cnNcbiAgICAgICAgICogQHBhcmFtIG9iamVjdFxuICAgICAgICAgKi9cbiAgICAgICAgZGVjbGFyZVZhckF0dHJpYnV0ZTogZnVuY3Rpb24oYXR0cnMsIG9iamVjdCkge1xuICAgICAgICAgIGlmICh0eXBlb2YgYXR0cnMudmFyID09PSAnc3RyaW5nJykge1xuICAgICAgICAgICAgdmFyIHZhck5hbWUgPSBhdHRycy52YXI7XG4gICAgICAgICAgICB0aGlzLl9kZWZpbmVWYXIodmFyTmFtZSwgb2JqZWN0KTtcbiAgICAgICAgICB9XG4gICAgICAgIH0sXG5cbiAgICAgICAgX3JlZ2lzdGVyRXZlbnRIYW5kbGVyOiBmdW5jdGlvbihjb21wb25lbnQsIGV2ZW50TmFtZSkge1xuICAgICAgICAgIHZhciBjYXBpdGFsaXplZEV2ZW50TmFtZSA9IGV2ZW50TmFtZS5jaGFyQXQoMCkudG9VcHBlckNhc2UoKSArIGV2ZW50TmFtZS5zbGljZSgxKTtcblxuICAgICAgICAgIGNvbXBvbmVudC5vbihldmVudE5hbWUsIGZ1bmN0aW9uKGV2ZW50KSB7XG4gICAgICAgICAgICAkb25zZW4uZmlyZUNvbXBvbmVudEV2ZW50KGNvbXBvbmVudC5fZWxlbWVudFswXSwgZXZlbnROYW1lLCBldmVudCAmJiBldmVudC5kZXRhaWwpO1xuXG4gICAgICAgICAgICB2YXIgaGFuZGxlciA9IGNvbXBvbmVudC5fYXR0cnNbJ29ucycgKyBjYXBpdGFsaXplZEV2ZW50TmFtZV07XG4gICAgICAgICAgICBpZiAoaGFuZGxlcikge1xuICAgICAgICAgICAgICBjb21wb25lbnQuX3Njb3BlLiRldmFsKGhhbmRsZXIsIHskZXZlbnQ6IGV2ZW50fSk7XG4gICAgICAgICAgICAgIGNvbXBvbmVudC5fc2NvcGUuJGV2YWxBc3luYygpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0pO1xuICAgICAgICB9LFxuXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBSZWdpc3RlciBldmVudCBoYW5kbGVycyBmb3IgYXR0cmlidXRlcy5cbiAgICAgICAgICpcbiAgICAgICAgICogQHBhcmFtIHtPYmplY3R9IGNvbXBvbmVudFxuICAgICAgICAgKiBAcGFyYW0ge1N0cmluZ30gZXZlbnROYW1lc1xuICAgICAgICAgKi9cbiAgICAgICAgcmVnaXN0ZXJFdmVudEhhbmRsZXJzOiBmdW5jdGlvbihjb21wb25lbnQsIGV2ZW50TmFtZXMpIHtcbiAgICAgICAgICBldmVudE5hbWVzID0gZXZlbnROYW1lcy50cmltKCkuc3BsaXQoL1xccysvKTtcblxuICAgICAgICAgIGZvciAodmFyIGkgPSAwLCBsID0gZXZlbnROYW1lcy5sZW5ndGg7IGkgPCBsOyBpKyspIHtcbiAgICAgICAgICAgIHZhciBldmVudE5hbWUgPSBldmVudE5hbWVzW2ldO1xuICAgICAgICAgICAgdGhpcy5fcmVnaXN0ZXJFdmVudEhhbmRsZXIoY29tcG9uZW50LCBldmVudE5hbWUpO1xuICAgICAgICAgIH1cbiAgICAgICAgfSxcblxuICAgICAgICAvKipcbiAgICAgICAgICogQHJldHVybiB7Qm9vbGVhbn1cbiAgICAgICAgICovXG4gICAgICAgIGlzQW5kcm9pZDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgcmV0dXJuICEhd2luZG93Lm5hdmlnYXRvci51c2VyQWdlbnQubWF0Y2goL2FuZHJvaWQvaSk7XG4gICAgICAgIH0sXG5cbiAgICAgICAgLyoqXG4gICAgICAgICAqIEByZXR1cm4ge0Jvb2xlYW59XG4gICAgICAgICAqL1xuICAgICAgICBpc0lPUzogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgcmV0dXJuICEhd2luZG93Lm5hdmlnYXRvci51c2VyQWdlbnQubWF0Y2goLyhpcGFkfGlwaG9uZXxpcG9kIHRvdWNoKS9pKTtcbiAgICAgICAgfSxcblxuICAgICAgICAvKipcbiAgICAgICAgICogQHJldHVybiB7Qm9vbGVhbn1cbiAgICAgICAgICovXG4gICAgICAgIGlzV2ViVmlldzogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgcmV0dXJuIHdpbmRvdy5vbnMuaXNXZWJWaWV3KCk7XG4gICAgICAgIH0sXG5cbiAgICAgICAgLyoqXG4gICAgICAgICAqIEByZXR1cm4ge0Jvb2xlYW59XG4gICAgICAgICAqL1xuICAgICAgICBpc0lPUzdhYm92ZTogKGZ1bmN0aW9uKCkge1xuICAgICAgICAgIHZhciB1YSA9IHdpbmRvdy5uYXZpZ2F0b3IudXNlckFnZW50O1xuICAgICAgICAgIHZhciBtYXRjaCA9IHVhLm1hdGNoKC8oaVBhZHxpUGhvbmV8aVBvZCB0b3VjaCk7LipDUFUuKk9TIChcXGQrKV8oXFxkKykvaSk7XG5cbiAgICAgICAgICB2YXIgcmVzdWx0ID0gbWF0Y2ggPyBwYXJzZUZsb2F0KG1hdGNoWzJdICsgJy4nICsgbWF0Y2hbM10pID49IDcgOiBmYWxzZTtcblxuICAgICAgICAgIHJldHVybiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgICAgICAgfTtcbiAgICAgICAgfSkoKSxcblxuICAgICAgICAvKipcbiAgICAgICAgICogRmlyZSBhIG5hbWVkIGV2ZW50IGZvciBhIGNvbXBvbmVudC4gVGhlIHZpZXcgb2JqZWN0LCBpZiBpdCBleGlzdHMsIGlzIGF0dGFjaGVkIHRvIGV2ZW50LmNvbXBvbmVudC5cbiAgICAgICAgICpcbiAgICAgICAgICogQHBhcmFtIHtIVE1MRWxlbWVudH0gW2RvbV1cbiAgICAgICAgICogQHBhcmFtIHtTdHJpbmd9IGV2ZW50IG5hbWVcbiAgICAgICAgICovXG4gICAgICAgIGZpcmVDb21wb25lbnRFdmVudDogZnVuY3Rpb24oZG9tLCBldmVudE5hbWUsIGRhdGEpIHtcbiAgICAgICAgICBkYXRhID0gZGF0YSB8fCB7fTtcblxuICAgICAgICAgIHZhciBldmVudCA9IGRvY3VtZW50LmNyZWF0ZUV2ZW50KCdIVE1MRXZlbnRzJyk7XG5cbiAgICAgICAgICBmb3IgKHZhciBrZXkgaW4gZGF0YSkge1xuICAgICAgICAgICAgaWYgKGRhdGEuaGFzT3duUHJvcGVydHkoa2V5KSkge1xuICAgICAgICAgICAgICBldmVudFtrZXldID0gZGF0YVtrZXldO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cblxuICAgICAgICAgIGV2ZW50LmNvbXBvbmVudCA9IGRvbSA/XG4gICAgICAgICAgICBhbmd1bGFyLmVsZW1lbnQoZG9tKS5kYXRhKGRvbS5ub2RlTmFtZS50b0xvd2VyQ2FzZSgpKSB8fCBudWxsIDogbnVsbDtcbiAgICAgICAgICBldmVudC5pbml0RXZlbnQoZG9tLm5vZGVOYW1lLnRvTG93ZXJDYXNlKCkgKyAnOicgKyBldmVudE5hbWUsIHRydWUsIHRydWUpO1xuXG4gICAgICAgICAgZG9tLmRpc3BhdGNoRXZlbnQoZXZlbnQpO1xuICAgICAgICB9LFxuXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBEZWZpbmUgYSB2YXJpYWJsZSB0byBKYXZhU2NyaXB0IGdsb2JhbCBzY29wZSBhbmQgQW5ndWxhckpTIHNjb3BlLlxuICAgICAgICAgKlxuICAgICAgICAgKiBVdGlsLmRlZmluZVZhcignZm9vJywgJ2Zvby12YWx1ZScpO1xuICAgICAgICAgKiAvLyA9PiB3aW5kb3cuZm9vIGFuZCAkc2NvcGUuZm9vIGlzIG5vdyAnZm9vLXZhbHVlJ1xuICAgICAgICAgKlxuICAgICAgICAgKiBVdGlsLmRlZmluZVZhcignZm9vLmJhcicsICdmb28tYmFyLXZhbHVlJyk7XG4gICAgICAgICAqIC8vID0+IHdpbmRvdy5mb28uYmFyIGFuZCAkc2NvcGUuZm9vLmJhciBpcyBub3cgJ2Zvby1iYXItdmFsdWUnXG4gICAgICAgICAqXG4gICAgICAgICAqIEBwYXJhbSB7U3RyaW5nfSBuYW1lXG4gICAgICAgICAqIEBwYXJhbSBvYmplY3RcbiAgICAgICAgICovXG4gICAgICAgIF9kZWZpbmVWYXI6IGZ1bmN0aW9uKG5hbWUsIG9iamVjdCkge1xuICAgICAgICAgIHZhciBuYW1lcyA9IG5hbWUuc3BsaXQoL1xcLi8pO1xuXG4gICAgICAgICAgZnVuY3Rpb24gc2V0KGNvbnRhaW5lciwgbmFtZXMsIG9iamVjdCkge1xuICAgICAgICAgICAgdmFyIG5hbWU7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IG5hbWVzLmxlbmd0aCAtIDE7IGkrKykge1xuICAgICAgICAgICAgICBuYW1lID0gbmFtZXNbaV07XG4gICAgICAgICAgICAgIGlmIChjb250YWluZXJbbmFtZV0gPT09IHVuZGVmaW5lZCB8fCBjb250YWluZXJbbmFtZV0gPT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICBjb250YWluZXJbbmFtZV0gPSB7fTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBjb250YWluZXIgPSBjb250YWluZXJbbmFtZV07XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGNvbnRhaW5lcltuYW1lc1tuYW1lcy5sZW5ndGggLSAxXV0gPSBvYmplY3Q7XG5cbiAgICAgICAgICAgIGlmIChjb250YWluZXJbbmFtZXNbbmFtZXMubGVuZ3RoIC0gMV1dICE9PSBvYmplY3QpIHtcbiAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdDYW5ub3Qgc2V0IHZhcj1cIicgKyBvYmplY3QuX2F0dHJzLnZhciArICdcIiBiZWNhdXNlIGl0IHdpbGwgb3ZlcndyaXRlIGEgcmVhZC1vbmx5IHZhcmlhYmxlLicpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cblxuICAgICAgICAgIGlmIChvbnMuY29tcG9uZW50QmFzZSkge1xuICAgICAgICAgICAgc2V0KG9ucy5jb21wb25lbnRCYXNlLCBuYW1lcywgb2JqZWN0KTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICAvLyBBdHRhY2ggdG8gYW5jZXN0b3Igd2l0aCBvbnMtc2NvcGUgYXR0cmlidXRlLlxuICAgICAgICAgIHZhciBlbGVtZW50ID0gb2JqZWN0Ll9lbGVtZW50WzBdO1xuXG4gICAgICAgICAgd2hpbGUgKGVsZW1lbnQucGFyZW50Tm9kZSkge1xuICAgICAgICAgICAgaWYgKGVsZW1lbnQuaGFzQXR0cmlidXRlKCdvbnMtc2NvcGUnKSkge1xuICAgICAgICAgICAgICBzZXQoYW5ndWxhci5lbGVtZW50KGVsZW1lbnQpLmRhdGEoJ19zY29wZScpLCBuYW1lcywgb2JqZWN0KTtcbiAgICAgICAgICAgICAgZWxlbWVudCA9IG51bGw7XG4gICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgZWxlbWVudCA9IGVsZW1lbnQucGFyZW50Tm9kZTtcbiAgICAgICAgICB9XG4gICAgICAgICAgZWxlbWVudCA9IG51bGw7XG5cbiAgICAgICAgICAvLyBJZiBubyBvbnMtc2NvcGUgZWxlbWVudCB3YXMgZm91bmQsIGF0dGFjaCB0byAkcm9vdFNjb3BlLlxuICAgICAgICAgIHNldCgkcm9vdFNjb3BlLCBuYW1lcywgb2JqZWN0KTtcbiAgICAgICAgfVxuICAgICAgfTtcbiAgICB9XG5cbiAgfV0pO1xufSkoKTtcbiIsIi8qKlxuICogQGVsZW1lbnQgb25zLWFsZXJ0LWRpYWxvZ1xuICovXG5cbi8qKlxuICogQGF0dHJpYnV0ZSB2YXJcbiAqIEBpbml0b25seVxuICogQHR5cGUge1N0cmluZ31cbiAqIEBkZXNjcmlwdGlvblxuICogIFtlbl1WYXJpYWJsZSBuYW1lIHRvIHJlZmVyIHRoaXMgYWxlcnQgZGlhbG9nLlsvZW5dXG4gKiAgW2phXeOBk+OBruOCouODqeODvOODiOODgOOCp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u+mdouOBq+imi+OBiOOBneOBhuOBq+OBquOBo+OBn+aZguOBvuOBp+iHquWLleeahOOBq+mBheW7tuOBleOCjOOAgVxuICogICAgIOeUu+mdouOBi+OCieimi+OBiOOBquOBj+OBquOBo+OBn+WgtOWQiOOBq+OBr+OBneOBruimgee0oOOBr+WLleeahOOBq+OCouODs+ODreODvOODieOBleOCjOOBvuOBmeOAglxuICogICAgIOOBk+OBruOCs+ODs+ODneODvOODjeODs+ODiOOCkuS9v+OBhuOBk+OBqOOBp+OAgeODkeODleOCqeODvOODnuODs+OCueOCkuWKo+WMluOBleOBm+OCi+OBk+OBqOeEoeOBl+OBq+W3qOWkp+OBquaVsOOBruimgee0oOOCkuaPj+eUu+OBp+OBjeOBvuOBmeOAglxuICogICBbL2phXVxuICogQGNvZGVwZW4gUXdyR0JtXG4gKiBAZ3VpZGUgVXNpbmdMYXp5UmVwZWF0XG4gKiAgIFtlbl1Ib3cgdG8gdXNlIExhenkgUmVwZWF0Wy9lbl1cbiAqICAgW2phXeODrOOCpOOCuOODvOODquODlOODvOODiOOBruS9v+OBhOaWuVsvamFdXG4gKiBAZXhhbXBsZVxuICogPHNjcmlwdD5cbiAqICAgb25zLmJvb3RzdHJhcCgpXG4gKlxuICogICAuY29udHJvbGxlcignTXlDb250cm9sbGVyJywgZnVuY3Rpb24oJHNjb3BlKSB7XG4gKiAgICAgJHNjb3BlLk15RGVsZWdhdGUgPSB7XG4gKiAgICAgICBjb3VudEl0ZW1zOiBmdW5jdGlvbigpIHtcbiAqICAgICAgICAgLy8gUmV0dXJuIG51bWJlciBvZiBpdGVtcy5cbiAqICAgICAgICAgcmV0dXJuIDEwMDAwMDA7XG4gKiAgICAgICB9LFxuICpcbiAqICAgICAgIGNhbGN1bGF0ZUl0ZW1IZWlnaHQ6IGZ1bmN0aW9uKGluZGV4KSB7XG4gKiAgICAgICAgIC8vIFJldHVybiB0aGUgaGVpZ2h0IG9mIGFuIGl0ZW0gaW4gcGl4ZWxzLlxuICogICA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UVsZW1lbnQoaW5kZXgsIGRvbmUpIHtcbiAgICAgICAgdGhpcy5fcHJlcGFyZUl0ZW1FbGVtZW50KGluZGV4LCAoe2VsZW1lbnQsIHNjb3BlfSkgPT4ge1xuICAgICAgICAgIGRvbmUoe2VsZW1lbnQsIHNjb3BlfSk7XG4gICAgICAgIH0pO1xuICAgICAgfVxuXG4gICAgICBfcHJlcGFyZUl0ZW1FbGVtZW50KGluZGV4LCBkb25lKSB7XG4gICAgICAgIGNvbnN0IHNjb3BlID0gdGhpcy5fcGFyZW50U2NvcGUuJG5ldygpO1xuICAgICAgICB0aGlzLl9hZGRTcGVjaWFsUHJvcGVydGllcyhpbmRleCwgc2NvcGUpO1xuXG4gICAgICAgIGlmICh0aGlzLl91c2luZ0JpbmRpbmcoKSkge1xuICAgICAgICAgIHRoaXMuY29uZmlndXJlSXRlbVNjb3BlKGluZGV4LCBzY29wZSk7XG4gICAgICAgIH1cblxuICAgICAgICB0aGlzLl9saW5rZXIoc2NvcGUsIChjbG9uZWQpID0+IHtcbiAgICAgICAgICBsZXQgZWxlbWVudCA9IGNsb25lZFswXTtcbiAgICAgICAgICBpZiAoIXRoaXMuX3VzaW5nQmluZGluZygpKSB7XG4gICAgICAgICAgICBlbGVtZW50ID0gdGhpcy5fdXNlckRlbGVnYXRlLmNyZWF0ZUl0ZW1Db250ZW50KGluZGV4LCBlbGVtZW50KTtcbiAgICAgICAgICAgICRjb21waWxlKGVsZW1lbnQpKHNjb3BlKTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBkb25lKHtlbGVtZW50LCBzY29wZX0pO1xuICAgICAgICB9KTtcbiAgICAgIH1cblxuICAgICAgLyoqXG4gICAgICAgKiBAcGFyYW0ge051bWJlcn0gaW5kZXhcbiAgICAgICAqIEBwYXJhbSB7T2JqZWN0fSBzY29wZVxuICAgICAgICovXG4gICAgICBfYWRkU3BlY2lhbFByb3BlcnRpZXMoaSwgc2NvcGUpIHtcbiAgICAgICAgY29uc3QgbGFzdCA9IHRoaXMuY291bnRJdGVtcygpIC0gMTtcbiAgICAgICAgYW5ndWxhci5leHRlbmQoc2NvcGUsIHtcbiAgICAgICAgICAkaW5kZXg6IGksXG4gICAgICAgICAgJGZpcnN0OiBpID09PSAwLFxuICAgICAgICAgICRsYXN0OiBpID09PSBsYXN0LFxuICAgICAgICAgICRtaWRkbGU6IGkgIT09IDAgJiYgaSAhPT0gbGFzdCxcbiAgICAgICAgICAkZXZlbjogaSAlIDIgPT09IDAsXG4gICAgICAgICAgJG9kZDogaSAlIDIgPT09IDFcbiAgICAgICAgfSk7XG4gICAgICB9XG5cbiAgICAgIHVwZGF0ZUl0ZW0oaW5kZXgsIGl0ZW0pIHtcbiAgICAgICAgaWYgKHRoaXMuX3VzaW5nQmluZGluZygpKSB7XG4gICAgICAgICAgaXRlbS5zY29wZS4kZXZhbEFzeW5jKCgpID0+IHRoaXMuY29uZmlndXJlSXRlbVNjb3BlKGluZGV4LCBpdGVtLnNjb3BlKSk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgc3VwZXIudXBkYXRlSXRlbShpbmRleCwgaXRlbSk7XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgLyoqXG4gICAgICAgKiBAcGFyYW0ge051bWJlcn0gaW5kZXhcbiAgICAgICAqIEBwYXJhbSB7T2JqZWN0fSBpdGVtXG4gICAgICAgKiBAcGFyYW0ge09iamVjdH0gaXRlbS5zY29wZVxuICAgICAgICogQHBhcmFtIHtFbGVtZW50fSBpdGVtLmVsZW1lbnRcbiAgICAgICAqL1xuICAgICAgZGVzdHJveUl0ZW0oaW5kZXgsIGl0ZW0pIHtcbiAgICAgICAgaWYgKHRoaXMuX3VzaW5nQmluZGluZygpKSB7XG4gICAgICAgICAgdGhpcy5kZXN0cm95SXRlbVNjb3BlKGluZGV4LCBpdGVtLnNjb3BlKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBzdXBlci5kZXN0cm95SXRlbShpbmRleCwgaXRlbS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cHRpb25zLndpZHRoIHx8ICc5MCUnO1xuICAgICAgICB0aGlzLl9pc1JpZ2h0ID0gISFvcHRpb25zLmlzUmlnaHQ7XG4gICAgICAgIHRoaXMuX2VsZW1lbnQgPSBlbGVtZW50O1xuICAgICAgICB0aGlzLl9tYWluUGFnZSA9IG1haW5QYWdlO1xuICAgICAgICB0aGlzLl9tZW51UGFnZSA9IG1lbnVQYWdlO1xuXG4gICAgICAgIG1lbnVQYWdlLmNzcygnYm94LXNoYWRvdycsICcwcHggMCAxMHB4IDBweCByZ2JhKDAsIDAsIDAsIDAuMiknKTtcbiAgICAgICAgbWVudVBhZ2UuY3NzKHtcbiAgICAgICAgICB3aWR0aDogb3B0aW9ucy53aWR0aCxcbiAgICAgICAgICBkaXNwbGF5OiAnbm9uZScsXG4gICAgICAgICAgekluZGV4OiAyXG4gICAgICAgIH0pO1xuXG4gICAgICAgIC8vIEZpeCBmb3IgdHJhbnNwYXJlbnQgbWVudSBwYWdlIG9uIGlPUzguXG4gICAgICAgIG1lbnVQYWdlLmNzcygnLXdlYmtpdC10cmFuc2Zvcm0nLCAndHJhbnNsYXRlM2QoMHB4LCAwcHgsIDBweCknKTtcblxuICAgICAgICBtYWluUGFnZS5jc3Moe3pJbmRleDogMX0pO1xuXG4gICAgICAgIGlmICh0aGlzLl9pc1JpZ2h0KSB7XG4gICAgICAgICAgbWVudVBhZ2UuY3NzKHtcbiAgICAgICAgICAgIHJpZ2h0OiAnLScgKyBvcHRpb25zLndpZHRoLFxuICAgICAgICAgICAgbGVmdDogJ2F1dG8nXG4gICAgICAgICAgfSk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgbWVudVBhZ2UuY3NzKHtcbiAgICAgICAgICAgIHJpZ2h0OiAnYXV0bycsXG4gICAgICAgICAgICBsZWZ0OiAnLScgKyBvcHRpb25zLndpZHRoXG4gICAgICAgICAgfSk7XG4gICAgICAgIH1cblxuICAgICAgICB0aGlzLl9ibGFja01hc2sgPSBhbmd1bGFyLmVsZW1lbnQoJzxkaXY+PC9kaXY+JykuY3NzKHtcbiAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6ICdibGFjaycsXG4gICAgICAgICAgdG9wOiAnMHB4JyxcbiAgICAgICAgICBsZWZ0OiAnMHB4JyxcbiAgICAgICAgICByaWdodDogJzBweCcsXG4gICAgICAgICAgYm90dG9tOiAnMHB4JyxcbiAgICAgICAgICBwb3NpdGlvbjogJ2Fic29sdXRlJyxcbiAgICAgICAgICBkaXNwbGF5OiAnbm9uZScsXG4gICAgICAgICAgekluZGV4OiAwXG4gICAgICAgIH0pO1xuXG4gICAgICAgIGVsZW1lbnQucHJlcGVuZCh0aGlzLl9ibGFja01hc2spO1xuICAgICAgfSxcblxuICAgICAgLyoqXG4gICAgICAgKiBAcGFyYW0ge09iamVjdH0gb3B0aW9uc1xuICAgICAgICogQHBhcmFtIHtTdHJpbmd9IG9wdGlvbnMud2lkdGhcbiAgICAgICAqL1xuICAgICAgb25SZXNpemVkOiBmdW5jdGlvbihvcHRpb25zKSB7XG4gICAgICAgIHRoaXMuX21lbnVQYWdlLmNzcygnd2lkdGgnLCBvcHRpb25zLndpZHRoKTtcblxuICAgICAgICBpZiAodGhpcy5faXNSaWdodCkge1xuICAgICAgICAgIHRoaXMuX21lbnVQYWdlLmNzcyh7XG4gICAgICAgICAgICByaWdodDogJy0nICsgb3B0aW9ucy53aWR0aCxcbiAgICAgICAgICAgIGxlZnQ6ICdhdXRvJ1xuICAgICAgICAgIH0pO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHRoaXMuX21lbnVQYWdlLmNzcyh7XG4gICAgICAgICAgICByaWdodDogJ2F1dG8nLFxuICAgICAgICAgICAgbGVmdDogJy0nICsgb3B0aW9ucy53aWR0aFxuICAgICAgICAgIH0pO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKG9wdGlvbnMuaXNPcGVuZWQpIHtcbiAgICAgICAgICB2YXIgbWF4ID0gdGhpcy5fbWVudVBhZ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2JsYWNrTWFzay5jc3MoJ2Rpc3BsYXknLCAnYmxvY2snKTtcblxuICAgICAgICB2YXIgbWF4ID0gdGhpcy5fbWVudVBhZ2VbMF0uY2xpZW50V2lkdGg7XG4gICAgICAgIHZhciBtZW51U3R5bGUgPSB0aGlzLl9nZW5lcmF0ZU1lbnVQYWdlU3R5bGUobWF4KTtcbiAgICAgICAgdmFyIG1haW5QYWdlU3R5bGUgPSB0aGlzLl9nZW5lcmF0ZU1haW5QYWdlU3R5bGUobWF4KTtcblxuICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uKCkge1xuXG4gICAgICAgICAgb25zLmFuaW1pdCh0aGlzLl9tYWluUGFnZVswXSlcbiAgICAgICAgICAgIC53YWl0KGRlbGF5KVxuICAgICAgICAgICAgLnF1ZXVlKG1haW5QYWdlU3R5bGUsIHtcbiAgICAgICAgICAgICAgZHVyYXRpb246IGR1cmF0aW9uLFxuICAgICAgICAgICAgICB0aW1pbmc6IHRoaXMudGltaW5nXG4gICAgICAgICAgICB9KVxuICAgICAgICAgICAgLnF1ZXVlKGZ1bmN0aW9uKGRvbmUpIHtcbiAgICAgICAgICAgICAgY2FsbGJhY2soKTtcbiAgICAgICAgICAgICAgZG9uZSgpO1xuICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIC5wbGF5KCk7XG5cbiAgICAgICAgICBvbnMuYW5pbWl0KHRoaXMuX21lbnVQYWdlWzBdKVxuICAgICAgICAgICAgLndhaXQoZGVsYXkpXG4gICAgICAgICAgICAucXVldWUobWVudVN0eWxlLCB7XG4gICAgICAgICAgICAgIGR1cmF0aW9uOiBkdXJhdGlvbixcbiAgICAgICAgICAgICAgdGltaW5nOiB0aGlzLnRpbWluZ1xuICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIC5wbGF5KCk7XG5cbiAgICAgICAgfS5iaW5kKHRoaXMpLCAxMDAwIC8gNjApO1xuICAgICAgfSxcblxuICAgICAgLyoqXG4gICAgICAgKiBAcGFyYW0ge0Z1bmN0aW9ufSBjYWxsYmFja1xuICAgICAgICogQHBhcmFtIHtCb29sZWFufSBpbnN0YW50XG4gICAgICAgKi9cbiAgICAgIGNsb3NlTWVudTogZnVuY3Rpb24oY2FsbGJhY2ssIGluc3RhbnQpIHtcbiAgICAgICAgdmFyIGR1cmF0aW9uID0gaW5zdGFudCA9PT0gdHJ1ZSA/IDAuMCA6IHRoaXMuZHVyYXRpb247XG4gICAgICAgIHZhciBkZWxheSA9IGluc3RhbnQgPT09IHRydWUgPyAwLjAgOiB0aGlzLmRlbGF5O1xuXG4gICAgICAgIHRoaXMuX2JsYWNrTWFzay5jc3Moe2Rpc3BsYXk6ICdibG9jayd9KTtcblxuICAgICAgICB2YXIgbWVudVBhZ2VTdHlsZSA9IHRoaXMuX2dlbmVyYXRlTWVudVBhZ2VTdHlsZSgwKTtcbiAgICAgICAgdmFyIG1haW5QYWdlU3R5bGUgPSB0aGlzLl9nZW5lcmF0ZU1haW5QYWdlU3R5bGUoMCk7XG5cbiAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbigpIHtcblxuICAgICAgICAgIG9ucy5hbmltaXQodGhpcy5fbWFpblBhZ2VbMF0pXG4gICAgICAgICAgICAud2FpdChkZWxheSlcbiAgICAgICAgICAgIC5xdWV1ZShtYWluUGFnZVN0eWxlLCB7XG4gICAgICAgICAgICAgIGR1cmF0aW9uOiBkdXJhdGlvbixcbiAgICAgICAgICAgICAgdGltaW5nOiB0aGlzLnRpbWluZ1xuICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIC5xdWV1ZShmdW5jdGlvbihkb25lKSB7XG4gICAgICAgICAgICAgIHRoaXMuX21lbnVQYWdlLmNzcygnZGlzcGxheScsICdub25lJyk7XG4gICAgICAgICAgICAgIGNhbGxiYWNrKCk7XG4gICAgICAgICAgICAgIGRvbmUoKTtcbiAgICAgICAgICAgIH0uYmluZCh0aGlzKSlcbiAgICAgICAgICAgIC5wbGF5KCk7XG5cbiAgICAgICAgICBvbnMuYW5pbW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WVudC5kYXRhKCdvbnMtcGFnZScsIHBhZ2UpO1xuICAgICAgICAgICAgJG9uc2VuLmFkZE1vZGlmaWVyTWV0aG9kc0ZvckN1c3RvbUVsZW1lbnRzKHBhZ2UsIGVsZW1lbnQpO1xuXG4gICAgICAgICAgICBlbGVtZW50LmRhdGEoJ19zY29wZScsIHNjb3BlKTtcblxuICAgICAgICAgICAgJG9uc2VuLmNsZWFuZXIub25EZXN0cm95KHNjb3BlLCBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgcGFnZS5fZXZlbnRzID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAkb25zZW4ucmVtb3ZlTW9kaWZpZXJNZXRob2RzKHBhZ2UpO1xuICAgICAgICAgICAgICBlbGVtZW50LmRhdGEoJ29ucy1wYWdlJywgdW5kZWZpbmVkKTtcbiAgICAgICAgICAgICAgZWxlbWVudC5kYXRhKCdfc2NvcGUnLCB1bmRlZmluZWQpO1xuXG4gICAgICAgICAgICAgICRvbnNlbi5jbGVhckNvbXBvbmVudCh7XG4gICAgICAgICAgICAgICAgZWxlbWVudDogZWxlbWVudCxcbiAgICAgICAgICAgICAgICBzY29wZTogc2NvcGUsXG4gICAgICAgICAgICAgICAgYXR0cnM6IGF0dHJzXG4gICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICBzY29wZSA9IGVsZW1lbnQgPSBhdHRycyA9IG51bGw7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICB9LFxuXG4gICAgICAgICAgcG9zdDogZnVuY3Rpb24gcG9zdExpbmsoc2NvcGUsIGVsZW1lbnQsIGF0dHJzKSB7XG4gICAgICAgICAgICBmaXJlUGFnZUluaXRFdmVudChlbGVtZW50WzBdKTtcbiAgICAgICAgICB9XG4gICAgICAgIH07XG4gICAgICB9XG4gICAgfTtcbiAgfV0pO1xufSkoKTtcbiIsIi8qKlxuICogQGVsZW1lbnQgb25zLXBvcG92ZXJcbiAqL1xuXG4vKipcbiAqIEBhdHRyaWJ1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aXMuX21haW5QYWdlID0gbWFpblBhZ2U7XG4gICAgICAgIHRoaXMuX21lbnVQYWdlID0gbWVudVBhZ2U7XG5cbiAgICAgICAgdGhpcy5faXNSaWdodCA9ICEhb3B0aW9ucy5pc1JpZ2h0O1xuICAgICAgICB0aGlzLl93aWR0aCA9IG9wdGlvbnMud2lkdGggfHwgJzkwJSc7XG5cbiAgICAgICAgbWVudVBhZ2UuY3NzKHtcbiAgICAgICAgICB3aWR0aDogb3B0aW9ucy53aWR0aCxcbiAgICAgICAgICBkaXNwbGF5OiAnbm9uZSdcbiAgICAgICAgfSk7XG5cbiAgICAgICAgaWYgKHRoaXMuX2lzUmlnaHQpIHtcbiAgICAgICAgICBtZW51UGFnZS5jc3Moe1xuICAgICAgICAgICAgcmlnaHQ6ICctJyArIG9wdGlvbnMud2lkdGgsXG4gICAgICAgICAgICBsZWZ0OiAnYXV0bydcbiAgICAgICAgICB9KTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBtZW51UGFnZS5jc3Moe1xuICAgICAgICAgICAgcmlnaHQ6ICdhdXRvJyxcbiAgICAgICAgICAgIGxlZnQ6ICctJyArIG9wdGlvbnMud2lkdGhcbiAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgfSxcblxuICAgICAgLyoqXG4gICAgICAgKiBAcGFyYW0ge09iamVjdH0gb3B0aW9uc1xuICAgICAgICogQHBhcmFtIHtTdHJpbmd9IG9wdGlvbnMud2lkdGhcbiAgICAgICAqIEBwYXJhbSB7T2JqZWN0fSBvcHRpb25zLmlzUmlnaHRcbiAgICAgICAqL1xuICAgICAgb25SZXNpemVkOiBmdW5jdGlvbihvcHRpb25zKSB7XG4gICAgICAgIHRoaXMuX21lbnVQYWdlLmNzcygnd2lkdGgnLCBvcHRpb25zLndpZHRoKTtcblxuICAgICAgICBpZiAodGhpcy5faXNSaWdodCkge1xuICAgICAgICAgIHRoaXMuX21lbnVQYWdlLmNzcyh7XG4gICAgICAgICAgICByaWdodDog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gICAgICAgICAgICBkb25lKCk7XG4gICAgICAgICAgICB9KVxuICAgICAgICAgICAgLnBsYXkoKTtcblxuICAgICAgICAgIG9ucy5hbmltaXQodGhpcy5fbWVudVBhZ2VbMF0pXG4gICAgICAgICAgICAud2FpdChkZWxheSlcbiAgICAgICAgICAgIC5xdWV1ZShiZWhpbmRTdHlsZSwge1xuICAgICAgICAgICAgICBkdXJhdGlvbjogZHVyYXRpb24sXG4gICAgICAgICAgICAgIHRpbWluZzogdGhpcy50aW1pbmdcbiAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAucGxheSgpO1xuXG4gICAgICAgIH0uYmluZCh0aGlzKSwgMTAwMCAvIDYwKTtcbiAgICAgIH0sXG5cbiAgICAgIC8qKlxuICAgICAgICogQHBhcmFtIHtGdW5jdGlvbn0gY2FsbGJhY2tcbiAgICAgICAqIEBwYXJhbSB7Qm9vbGVhbn0gaW5zdGFudFxuICAgICAgICovXG4gICAgICBjbG9zZU1lbnU6IGZ1bmN0aW9uKGNhbGxiYWNrLCBpbnN0YW50KSB7XG4gICAgICAgIHZhciBkdXJhdGlvbiA9IGluc3RhbnQgPT09IHRydWUgPyAwLjAgOiB0aGlzLmR1cmF0aW9uO1xuICAgICAgICB2YXIgZGVsYXkgPSBpbnN0YW50ID09PSB0cnVlID8gMC4wIDogdGhpcy5kZWxheTtcblxuICAgICAgICB2YXIgYWJvdmVUcmFuc2Zvcm0gPSB0aGlzLl9nZW5lcmF0ZUFib3ZlUGFnZVRyYW5zZm9ybSgwKTtcbiAgICAgICAgdmFyIGJlaGluZFN0eWxlID0gdGhpcy5fZ2VuZXJhdGVCZWhpbmRQYWdlU3R5bGUoMCk7XG5cbiAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbigpIHtcblxuICAgICAgICAgIG9ucy5hbmltaXQodGhpcy5fbWFpblBhZ2VbMF0pXG4gICAgICAgICAgICAud2FpdChkZWxheSlcbiAgICAgICAgICAgIC5xdWV1ZSh7XG4gICAgICAgICAgICAgIHRyYW5zZm9ybTogYWJvdmVUcmFuc2Zvcm1cbiAgICAgICAgICAgIH0sIHtcbiAgICAgICAgICAgICAgZHVyYXRpb246IGR1cmF0aW9uLFxuICAgICAgICAgICAgICB0aW1pbmc6IHRoaXMudGltaW5nXG4gICAgICAgICAgICB9KVxuICAgICAgICAgICAgLnF1ZXVlKHtcbiAgICAgICAgICAgICAgdHJhbnNmb3JtOiAndHJhbnNsYXRlM2QoMCwgMCwgMCknXG4gICAgICAgICAgICB9KVxuICAgICAgICAgICAgLnF1ZXVlKGZ1bmN0aW9uKGRvbmUpIHtcbiAgICAgICAgICAgICAgdGhpcy5fbWVudVBhZ2UuY3NzKCdkaXNwbGF5JywgJ25vbmUnKTtcbiAgICAgICAgICAgICAgY2FsbGJhY2soKTtcbiAgICAgICAgICAgICAgZG9uZSgpO1xuICAgICAgICAgICAgfS5iaW5kKHRoaXMpKVxuICAgICAgICAgICAgLnBsYXkoKTtcblxuICAgICAgICAgIG9ucy5hbmltaXQodGhpcy5fbWVudVBhZ2VbMF0pXG4gICAgICAgICAgICAud2FpdChkZWxheSlcbiAgICAgICAgICAgIC5xdWV1ZShiZWhpbmRTdHlsZSwge1xuICAgICAgICAgICAgICBkdXJhdGlvbjogZHVyYXRpb24sXG4gICAgICAgICAgICAgIHRpbWluZzogdGhpcy50aW1pbmdcbiAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAucXVldWUoZnVuY3Rpb24oZG9uZSkge1xuICAgICAgICAgICAgICBkb25lKCk7XG4gICAgICAgICAgICB9KVxuICAgICAgICAgICAgLnBsYXkoKTtcblxuICAgICAgICB9LmJpbmQodGhpcyksIDEwMDAgLyA2MCk7XG4gICAgICB9LFxuXG4gICAgICAvKipcbiAgICAgICAqIEBwYXJhbSB7T2JqZWN0fSBvcHRpb25zXG4gICAgICAgKiBAcGFyYW0ge051bWJlcn0gb3B0aW9ucy5kaXN0YW5jZVxuICAgICAgICogQHBhcmFtIHtOdW1iZXJ9IG9wdGlvbnMubWF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xlYW59IG9wdGlvbnMuaXNSaWdodFxuICAgICAgICovXG4gICAgICBzZXR1cDogZnVuY3Rpb24oZWxlbWVudCwgbWFpblBhZ2UsIG1lbnVQYWdlLCBvcHRpb25zKSB7XG4gICAgICAgIHRoaXMuX2VsZW1lbnQgPSBlbGVtZW50O1xuICAgICAgICB0aGlzLl9tZW51UGFnZSA9IG1lbnVQYWdlO1xuICAgICAgICB0aGlzLl9tYWluUGFnZSA9IG1haW5QYWdlO1xuICAgICAgICB0aGlzLl9pc1JpZ2h0ID0gISFvcHRpb25zLmlzUmlnaHQ7XG4gICAgICAgIHRoaXMuX3dpZHRoID0gb3B0aW9ucy53aWR0aCB8fCAnOTAlJztcblxuICAgICAgICBtYWluUGFnZS5jc3Moe1xuICAgICAgICAgIGJveFNoYWRvdzogJzBweCAwIDEwcHggMHB4IHJnYmEoMCwgMCwgMCwgMC4yKSdcbiAgICAgICAgfSk7XG5cbiAgICAgICAgbWVudVBhZ2UuY3NzKHtcbiAgICAgICAgICB3aWR0aDogb3B0aW9ucy53aWR0aCxcbiAgICAgICAgICBvcGFjaXR5OiAwLjksXG4gICAgICAgICAgZGlzcGxheTogJ25vbmUnXG4gICAgICAgIH0pO1xuXG4gICAgICAgIGlmICh0aGlzLl9pc1JpZ2h0KSB7XG4gICAgICAgICAgbWVudVBhZ2UuY3NzKHtcbiAgICAgICAgICAgIHJpZ2h0OiAnMHB4JyxcbiAgICAgICAgICAgIGxlZnQ6ICdhdXRvJ1xuICAgICAgICAgIH0pO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIG1lbnVQYWdlLmNzcyh7XG4gICAgICAgICAgICByaWdodDogJ2F1dG8nLFxuICAgICAgICAgICAgbGVmdDogJzBweCdcbiAgICAgICAgICB9KTtcbiAgICAgICAgfVxuXG4gICAgICAgIHRoaXMuX2JsYWNrTWFzayA9IGFuZ3VsYXIuZWxlbWVudCgnPGRpdj48L2Rpdj4nKS5jc3Moe1xuICAgICAgICAgIGJhY2tncm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AgY2FsbGJhY2soKTtcbiAgICAgICAgICAgICAgZG9uZSgpO1xuICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIC5wbGF5KCk7XG5cbiAgICAgICAgICBvbnMuYW5pbWl0KHRoaXMuX21lbnVQYWdlWzBdKVxuICAgICAgICAgICAgLndhaXQoZGVsYXkpXG4gICAgICAgICAgICAucXVldWUoYmVoaW5kU3R5bGUsIHtcbiAgICAgICAgICAgICAgZHVyYXRpb246IGR1cmF0aW9uLFxuICAgICAgICAgICAgICB0aW1pbmc6IHRoaXMudGltaW5nXG4gICAgICAgICAgICB9KVxuICAgICAgICAgICAgLnBsYXkoKTtcblxuICAgICAgICB9LmJpbmQodGhpcyksIDEwMDAgLyA2MCk7XG4gICAgICB9LFxuXG4gICAgICAvKipcbiAgICAgICAqIEBwYXJhbSB7RnVuY3Rpb259IGNhbGxiYWNrXG4gICAgICAgKiBAcGFyYW0ge0Jvb2xlYW59IGluc3RhbnRcbiAgICAgICAqL1xuICAgICAgY2xvc2VNZW51OiBmdW5jdGlvbihjYWxsYmFjaywgaW5zdGFudCkge1xuICAgICAgICB2YXIgZHVyYXRpb24gPSBpbnN0YW50ID09PSB0cnVlID8gMC4wIDogdGhpcy5kdXJhdGlvbjtcbiAgICAgICAgdmFyIGRlbGF5ID0gaW5zdGFudCA9PT0gdHJ1ZSA/IDAuMCA6IHRoaXMuZGVsYXk7XG5cbiAgICAgICAgdGhpcy5fYmxhY2tNYXNrLmNzcygnZGlzcGxheScsICdibG9jaycpO1xuXG4gICAgICAgIHZhciBhYm92ZVRyYW5zZm9ybSA9IHRoaXMuX2dlbmVyYXRlQWJvdmVQYWdlVHJhbnNmb3JtKDApO1xuICAgICAgICB2YXIgYmVoaW5kU3R5bGUgPSB0aGlzLl9nZW5lcmF0ZUJlaGluZFBhZ2VTdHlsZSgwKTtcblxuICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uKCkge1xuXG4gICAgICAgICAgb25zLmFuaW1pdCh0aGlzLl9tYWluUGFnZVswXSlcbiAgICAgICAgICAgIC53YWl0KGRlbGF5KVxuICAgICAgICAgICAgLnF1ZXVlKHtcbiAgICAgICAgICAgICAgdHJhbnNmb3JtOiBhYm92ZVRyYW5zZm9ybVxuICAgICAgICAgICAgfSwge1xuICAgICAgICAgICAgICBkdXJhdGlvbjogZHVyYXRpb24sXG4gICAgICAgICAgICAgIHRpbWluZzogdGhpcy50aW1pbmdcbiAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAucXVldWUoe1xuICAgICAgICAgICAgICB0cmFuc2Zvcm06ICd0cmFuc2xhdGUzZCgwLCAwLCAwKSdcbiAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAucXVldWUoZnVuY3Rpb24oZG9uZSkge1xuICAgICAgICAgICAgICB0aGlzLl9tZW51UGFnZS5jc3MoJ2Rpc3BsYXknLCAnbm9uZScpO1xuICAgICAgICAgICAgICBjYWxsYmFjaygpO1xuICAgICAgICAgICAgICBkb25lKCk7XG4gICAgICAgICAgICB9LmJpbmQodGhpcykpXG4gICAgICAgICAgICAucGxheSgpO1xuXG4gICAgICAgICAgb25zLmFuaW1pdCh0aGlzLl9tZW51UGFnZVswXSlcbiAgICAgICAgICAgIC53YWl0KGRlbGF5KVxuICAgICAgICAgICAgLnF1ZXVlKGJlaGluZFN0eWxlLCB7XG4gICAgICAgICAgICAgIGR1cmF0aW9uOiBkdXJhdGlvbixcbiAgICAgICAgICAgICAgdGltaW5nOiB0aGlzLnRpbWluZ1xuICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIC5xdWV1ZShmdW5jdGlvbihkb25lKSB7XG4gICAgICAgICAgICAgIGRvbmUoKTtcbiAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAucGxheSgpO1xuXG4gICAgICAgIH0uYmluZCh0aGlzKSwgMTAwMCAvIDYwKTtcbiAgICAgIH0sXG5cbiAgICAgIC8qKlxuICAgICAgICogQHBhcmFtIHtPYmplY3R9IG9wdGlvbnNcbiAgICAgICAqIEB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UmlnaHRcbiAgICAgICAqL1xuICAgICAgc2V0dXA6IGZ1bmN0aW9uKGVsZW1lbnQsIG1haW5QYWdlLCBtZW51UGFnZSwgb3B0aW9ucykge1xuICAgICAgfSxcblxuICAgICAgLyoqXG4gICAgICAgKiBAcGFyYW0ge09iamVjdH0gb3B0aW9uc1xuICAgICAgICogQHBhcmFtIHtCb29sZWFufSBvcHRpb25zLmlzUmlnaHRcbiAgICAgICAqIEBwYXJhbSB7Qm9vbGVhbn0gb3B0aW9ucy5pc09wZW5lZFxuICAgICAgICogQHBhcmFtIHtTdHJpbmd9IG9wdGlvbnMud2lkdGhcbiAgICAgICAqL1xuICAgICAgb25SZXNpemVkOiBmdW5jdGlvbihvcHRpb25zKSB7XG4gICAgICB9LFxuXG4gICAgICAvKipcbiAgICAgICAqIEBwYXJhbSB7RnVuY3Rpb259IGNhbGxiYWNrXG4gICAgICAgKi9cbiAgICAgIG9wZW5NZW51OiBmdW5jdGlvbihjYWxsYmFjaykge1xuICAgICAgfSxcblxuICAgICAgLyoqXG4gICAgICAgKiBAcGFyYW0ge0Z1bmN0aW9ufSBjYWxsYmFja1xuICAgICAgICovXG4gICAgICBjbG9zZUNsb3NlOiBmdW5jdGlvbihjYWxsYmFjaykge1xuICAgICAgfSxcblxuICAgICAgLyoqXG4gICAgICAgKi9cbiAgICAgIGRlc3Ryb3k6IGZ1bmN0aW9uKCkge1xuICAgICAgfSxcblxuICAgICAgLyoqXG4gICAgICAgKiBAcGFyYW0ge09iamVjdH0gb3B0aW9uc1xuICAgICAgICogQHBhcmFtIHtOdW1iZXJ9IG9wdGlvbnMuZGlzdGFuY2VcbiAgICAgICAqIEBwYXJhbSB7TnVtYmVyfSBvcHRpb25zLm1heERpc3RhbmNlXG4gICAgICAgKi9cbiAgICAgIHRyYW5zbGF0ZU1lbnU6IGZ1bmN0aW9uKG1haW5QYWdlLCBtZW51UGFnZSwgb3B0aW9ucykge1xuICAgICAgfSxcblxuICAgICAgLyoqXG4gICAgICAgK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RzY2FwZVwi44Gn44GZ44CCWy9qYV1cbiAqL1xuXG4vKipcbiAqIEBldmVudCBwb3N0c3BsaXRcbiAqIEBkZXNjcmlwdGlvblxuICogICBbZW5dRmlyZWQganVzdCBhZnRlciB0aGUgdmlldyBpcyBzcGxpdC5bL2VuXVxuICogICBbamFdc3BsaXTnirbmhYvjgavjgarjgaPjgZ/lvozjgavnmbrngavjgZfjgb7jgZnjgIJbL2phXVxuICogQHBhcmFtIHtPYmplY3R9IGV2ZW50XG4gKiAgIFtlbl1FdmVudCBvYmplY3QuWy9lbl1cbiAqICAgW2phXeOCpOODmeODs+ODiOOCquODluOCuOOCp+OCr+ODiOOAglsvamFdXG4gKiBAcGFyYW0ge09iamVjdH0gZXZlbnQuc3BsaXRWaWV3XG4gKiAgIFtlbl1TcGxpdCB2aWV3IG9iamVjdC5bL2VuXVxuICogICBbamFd44Kk44OZ44Oz44OI44GM55m654Gr44GX44GfU3BsaXRWaWV344Kq44OW44K444Kn44Kv44OI44Gn44GZ44CCWy9qYV1cbiAqIEBwYXJhbSB7TnVtYmVyfSBldmVudC53aWR0aFxuICogICBbZW5dQ3VycmVudCB3aWR0aC5bL2VuXVxuICogICBbamFd54++5Zyo44GuU3BsaXRWaWV3buOBruW5heOBp+OBmeOAglsvamFdXG4gKiBAcGFyYW0ge1N0cmluZ30gZXZlbnQub3JpZW50YXRpb25cbiAqICAgW2VuXUN1cnJlbnQgb3JpZW50YXRpb24uWy9lbl1cbiAqICAgW2phXeePvuWcqOOBrueUu+mdouOBruOCquODquOCqOODs+ODhuODvOOCt+ODp+ODs+OCkui/lOOBl+OBvuOBmeOAglwicG9ydHJhaXRcIuOCguOBl+OBj+OBr1wibGFuZHNjYXBlXCLjgafjgZnjgIJbL2phXVxuICovXG5cbi8qKlxuICogQGV2ZW50IHByZWNvbGxhcHNlXG4gKiBAZGVzY3JpcHRpb25cbiAqICAgW2VuXUZpcmVkIGp1c3QgYmVmb3JlIHRoZSB2aWV3IGlzIGNvbGxhcHNlZC5bL2VuXVxuICogICBbamFdY29sbGFwc2XnirbmhYvjgavjgarjgovliY3jgavnmbrngavjgZfjgb7jgZnjgIJbL2phXVxuICogQHBhcmFtIHtPYmplY3R9IGV2ZW50XG4gKiAgIFtlbl1FdmVudCBvYmplY3QuWy9lbl1cbiAqICAgW2phXeOCpOODmeODs+ODiOOCquODluOCuOOCp+OCr+ODiOOAglsvamFdXG4gKiBAcGFyYW0ge09iamVjdH0gZXZlbnQuc3BsaXRWaWV3XG4gKiAgIFtlbl1TcGxpdCB2aWV3IG9iamVjdC5bL2VuXVxuICogICBbamFd44Kk44OZ44Oz44OI44GM55m654Gr44GX44GfU3BsaXRWaWV344Kq44OW44K444Kn44Kv44OI44Gn44GZ44CCWy9qYV1cbiAqIEBwYXJhbSB7TnVtYmVyfSBldmVudC53aWR0aFxuICogICBbZW5dQ3VycmVudCB3aWR0aC5bL2VuXVxuICogICBbamFd54++5Zyo44GuU3BsaXRWaWV3buOBruW5heOBp+OBmeOAglsvamFdXG4gKiBAcGFyYW0ge1N0cmluZ30gZXZlbnQub3JpZW50YXRpb25cbiAqICAgW2VuXUN1cnJlbnQgb3JpZW50YXRpb24uWy9lbl1cbiAqICAgW2phXeePvuWcqOOBrueUu+mdouOBruOCquODquOCqOODs+ODhuODvOOCt+ODp+ODs+OCkui/lOOBl+OBvuOBmeOAglwicG9ydHJhaXRcIuOCguOBl+OBj+OBr1wibGFuZHNjYXBlXCLjgafjgZnjgIJbL2phXVxuICovXG5cbi8qKlxuICogQGV2ZW50IHBvc3Rjb2xsYXBzZVxuICogQGRlc2NyaXB0aW9uXG4gKiAgIFtlbl1GaXJlZCBqdXN0IGFmdGVyIHRoZSB2aWV3IGlzIGNvbGxhcHNlZC5bL2VuXVxuICogICBbamFdY29sbGFwc2XnirbmhYvjgavjgarjgaPjgZ/lvozjgavnmbrngavjgZfjgb7jgZnjgIJbL2phXVxuICogQHBhcmFtIHtPYmplY3R9IGV2ZW50XG4gKiAgIFtlbl1FdmVudCBvYmplY3QuWy9lbl1cbiAqICAgW2phXeOCpOODmeODs+ODiOOCquODluOCuOOCp+OCr+ODiOOAglsvamFdXG4gKiBAcGFyYW0ge09iamVjdH0gZXZlbnQuc3BsaXRWaWV3XG4gKiAgIFtlbl1TcGxpdCB2aWV3IG9iamVjdC5bL2VuXVxuICogICBbamFd44Kk44OZ44Oz44OI44GM55m654Gr44GX44GfU3BsaXRWaWV344Kq44OW44K444Kn44Kv44OI44Gn44GZ44CCWy9qYV1cbiAqIEBwYXJhbSB7TnVtYmVyfSBldmVudC53aWR0aFxuICogICBbZW5dQ3VycmVudCB3aWR0aC5bL2VuXVxuICogICBbamFd54++5Zyo44GuU3BsaXRWaWV3buOBruW5heOBp+OBmeOAglsvamFdXG4gKiBAcGFyYW0ge1N0cmluZ30gZXZlbnQub3JpZW50YXRpb25cbiAqICAgW2VuXUN1cnJlbnQgb3JpZW50YXRpb24uWy9lbl1cbiAqICAgW2phXeePvuWcqOOBrueUu+mdouOBruOCquODquOCqOODs+ODhuODvOOCt+ODp+ODs+OCkui/lOOBl+OBvuOBmeOAglwicG9ydHJhaXRcIuOCguOBl+OBj+OBr1wibGFuZHNjYXBlXCLjgafjgZnjgIJbL2phXVxuICovXG5cbi8qKlxuICogQGF0dHJpYnV0ZSB2YXJcbiAqIEBpbml0b25seVxuICogQHR5cGUge1N0cmluZ31cbiAqIEBkZXNjcmlwdGlvblxuICogICBbZW5dVmFyaWFibGUgbmFtZSB0byByZWZlciB0aGlzIHNwbGl0IHZpZXcuWy9lbl1cbiAqICAgW2phXeOBk+OBruOCueODl+ODquODg+ODiOODk+ODpeODvOOCs+ODs+ODneODvOODjeODs+ODiOOCkuWPgueFp+OBmeOCi+OBn+OCgeOBruWQjeWJjeOCkuaMh+WumuOBl+OBvuOBmeOAglsvamFdXG4gKi9cblxuLyoqXG4gKiBAYXR0cmlidXRlIG1haW4tcGFnZVxuICogQGluaXRvbmx5XG4gKiBAdHlwZSB7U3RyaW5nfVxuICogQGR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SwgR2VuZXJpY1ZpZXcsIENvbXBvbmVudENsZWFuZXIpIHtcbiAgICByZXR1cm4ge1xuICAgICAgcmVzdHJpY3Q6ICdFJyxcbiAgICAgIHJlcGxhY2U6IGZhbHNlLFxuXG4gICAgICBjb21waWxlOiBmdW5jdGlvbihlbGVtZW50LCBhdHRycykge1xuXG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgcHJlOiBmdW5jdGlvbihzY29wZSwgZWxlbWVudCwgYXR0cnMsIGNvbnRyb2xsZXIsIHRyYW5zY2x1ZGUpIHtcbiAgICAgICAgICAgIHZhciBiYWNrQnV0dG9uID0gR2VuZXJpY1ZpZXcucmVnaXN0ZXIoc2NvcGUsIGVsZW1lbnQsIGF0dHJzLCB7XG4gICAgICAgICAgICAgIHZpZXdLZXk6ICdvbnMtYmFjay1idXR0b24nXG4gICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgc2NvcGUuJG9uKCckZGVzdHJveScsIGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICBiYWNrQnV0dG9uLl9ldmVudHMgPSB1bmRlZmluZWQ7XG4gICAgICAgICAgICAgICRvbnNlbi5yZW1vdmVNb2RpZmllck1ldGhvZHMoYmFja0J1dHRvbik7XG4gICAgICAgICAgICAgIGVsZW1lbnQgPSBudWxsO1xuICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgIENvbXBvbmVudENsZWFuZXIub25EZXN0cm95KHNjb3BlLCBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgQ29tcG9uZW50Q2xlYW5lci5kZXN0cm95U2NvcGUoc2NvcGUpO1xuICAgICAgICAgICAgICBDb21wb25lbnRDbGVhbmVyLmRlc3Ryb3lBdHRyaWJ1dGVzKGF0dHJzKTtcbiAgICAgICAgICAgICAgZWxlbWVudCA9IHNjb3BlID0gYXR0cnMgPSBudWxsO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgfSxcbiAgICAgICAgICBwb3N0OiBmdW5jdGlvbihzY29w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hbmRsZXIpO1xuICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgJG9uc2VuLmNsZWFuZXIub25EZXN0cm95KHNjb3BlLCBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIGdlc3R1cmVEZXRlY3Rvci5vZmYoRVZFTlRTLmpvaW4oJyAnKSwgaGFuZGxlcik7XG4gICAgICAgICAgICAkb25zZW4uY2xlYXJDb21wb25lbnQoe1xuICAgICAgICAgICAgICBzY29wZTogc2NvcGUsXG4gICAgICAgICAgICAgIGVsZW1lbnQ6IGVsZW1lbnQsXG4gICAgICAgICAgICAgIGF0dHJzOiBhdHRyc1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBnZXN0dXJlRGV0ZWN0b3IuZWxlbWVudCA9IHNjb3BlID0gZWxlbWVudCA9IGF0dHJzID0gbnVsbDtcbiAgICAgICAgICB9KTtcblxuICAgICAgICAgICRvbnNlbi5maXJlQ29tcG9uZW50RXZlbnQoZWxlbWVudFswXSwgJ2luaXQnKTtcbiAgICAgICAgfTtcbiAgICAgIH1cbiAgICB9O1xuICB9XSk7XG59KSgpO1xuXG4iLCJcbi8qKlxuICogQGVsZW1lbnQgb25zLWljb25cbiAqL1xuXG5cbihmdW5jdGlvbigpIHtcbiAgJ3VzZSBzdHJpY3QnO1xuXG4gIGFuZ3VsYXIubW9kdWxlKCdvbnNlbicpLmRpcmVjdGl2ZSgnb25zSWNvbicsIFsnJG9uc2VuJywgJ0dlbmVyaWNWaWV3JywgZnVuY3Rpb24oJG9uc2VuLCBHZW5lcmljVmlldykge1xuICAgIHJldHVybiB7XG4gICAgICByZXN0cmljdDogJ0UnLFxuXG4gICAgICBjb21waWxlOiBmdW5jdGlvbihlbGVtZW50LCBhdHRycykge1xuXG4gICAgICAgIGlmIChhdHRycy5pY29uLmluZGV4T2YoJ3t7JykgIT09IC0xKSB7XG4gICAgICAgICAgYXR0cnMuJG9ic2VydmUoJ2ljb24nLCAoKSA9PiB7XG4gICAgICAgICAgICBzZXR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kge1xuICAgICAgICAgICAgICB1cGRhdGUoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9KTtcblxuICAgICAgICAgIHVwZGF0ZSgpO1xuXG4gICAgICAgICAgJG9uc2VuLmNsZWFuZXIub25EZXN0cm95KHNjb3BlLCBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICRvbnNlbi5jbGVhckNvbXBvbmVudCh7XG4gICAgICAgICAgICAgIGVsZW1lbnQ6IGVsZW1lbnQsXG4gICAgICAgICAgICAgIHNjb3BlOiBzY29wZSxcbiAgICAgICAgICAgICAgYXR0cnM6IGF0dHJzXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGVsZW1lbnQgPSBzY29wZSA9IGF0dHJzID0gbnVsbDtcbiAgICAgICAgICB9KTtcblxuICAgICAgICAgIGZ1bmN0aW9uIHVwZGF0ZSgpIHtcbiAgICAgICAgICAgIHZhciB1c2VyUGxhdGZvcm1zID0gYXR0cnMub25zSWZQbGF0Zm9ybS50b0xvd2VyQ2FzZSgpLnRyaW0oKS5zcGxpdCgvXFxzKy8pO1xuICAgICAgICAgICAgaWYgKHVzZXJQbGF0Zm9ybXMuaW5kZXhPZihwbGF0Zm9ybS50b0xvd2VyQ2FzZSgpKSA+PSAwKSB7XG4gICAgICAgICAgICAgIGVsZW1lbnQuY3NzKCdkaXNwbGF5JywgJ2Jsb2NrJyk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBlbGVtZW50LmNzcygnZGlzcGxheScsICdub25lJyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9O1xuXG4gICAgICAgIGZ1bmN0aW9uIGdldFBsYXRmb3JtU3RyaW5nKCkge1xuXG4gICAgICAgICAgaWYgKG5hdmlnYXRvci51c2VyQWdlbnQubWF0Y2goL0FuZHJvaWQvaSkpIHtcbiAgICAgICAgICAgIHJldHVybiAnYW5kcm9pZCc7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaW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c2UnLCBmdW5jdGlvbigkcGFyc2UpIHtcbiAgICByZXR1cm4ge1xuICAgICAgcmVzdHJpY3Q6ICdFJyxcbiAgICAgIHJlcGxhY2U6IGZhbHNlLFxuICAgICAgc2NvcGU6IGZhbHNlLFxuXG4gICAgICBsaW5rOiBmdW5jdGlvbihzY29wZSwgZWxlbWVudCwgYXR0cnMpIHtcbiAgICAgICAgbGV0IGVsID0gZWxlbWVudFswXTtcblxuICAgICAgICBjb25zdCBvbklucHV0ID0gKCkgPT4ge1xuICAgICAgICAgIGNvbnN0IHNldCA9ICRwYXJzZShhdHRycy5uZ01vZGVsKS5hc3NpZ247XG5cbiAgICAgICAgICBpZiAoZWwuX2lzVGV4dElucHV0KSB7XG4gICAgICAgICAgICBlbC50eXBlID09PSAnbnVtYmVyJyA/IHNldChzY29wZSwgTnVtYmVyKGVsLnZhbHVlKSkgOiBzZXQoc2NvcGUsIGVsLnZhbHVlKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgZWxzZSBpZiAoZWwudHlwZSA9PT0gJ3JhZGlvJyAmJiBlbC5jaGVja2VkKSB7XG4gICAgICAgICAgICBzZXQoc2NvcGUsIGVsLnZhbHVlKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICBzZXQoc2NvcGUsIGVsLmNoZWNrZWQpO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGlmIChhdHRycy5uZ0NoYW5nZSkge1xuICAgICAgICAgICAgc2NvcGUuJGV2YWwoYXR0cnMubmdDaGFuZ2UpO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIHNjb3BlLiRwYXJlbnQuJGV2YWxBc3luYygpO1xuICAgICAgICB9O1xuXG4gICAgICAgIGlmIChhdHRycy5uZ01vZGVsKSB7XG4gICAgICAgICAgc2NvcGUuJHdhdGNoKGF0dHJzLm5nTW9kZWwsICh2YWx1ZSkgPT4ge1xuICAgICAgICAgICAgaWYgKGVsLl9pc1RleHRJbnB1dCkge1xuICAgICAgICAgICAgICBpZiAodHlwZW9mIHZhbHVlICE9PSAndW5kZWZpbmVkJyAmJiB2YWx1ZSAhPT0gZWwudmFsdWUpIHtcbiAgICAgICAgICAgICAgICBlbC52YWx1ZSA9IHZhbHVlO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGVsLnR5cGUgPT09ICdyYWRpbycpIHtcbiAgICAgICAgICAgICAgZWwuY2hlY2tlZCA9IHZhbHVlID09PSBlbC52YWx1ZTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgIGVsLmNoZWNrZWQgPSB2YWx1ZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9KTtcblxuICAgICAgICAgIGVsLl9pc1RleHRJbnB1dFxuICAgICAgICAgICAgPyBlbGVtZW50Lm9uKCdpbnB1dCcsIG9uSW5wdXQpXG4gICAgICAgICAgICA6IGVsZW1lbnQub24oJ2NoYW5nZScsIG9uSW5wdXQpO1xuICAgICAgICB9XG5cbiAgICAgICAgc2NvcGUuJG9uKCckZGVzdHJveScsICgpID0+IHtcbiAgICAgICAgICBlbC5faXNUZXh0SW5wdXRcbiAgICAgICAgICAgID8gZWxlbWVudC5vZmYoJ2lucHV0Jywgb25JbnB1dClcbiAgICAgICAgICAgIDogZWxlbWVudC5vZmYoJ2NoYW5nZScsIG9uSW5wdXQpO1xuXG4gICAgICAgICAgc2NvcGUgPSBlbGVtZW50ID0gYXR0cnMgPSBlbCA9IG51bGw7XG4gICAgICAgIH0pO1xuICAgICAgfVxuICAgIH07XG4gIH1dKTtcbn0pKCk7XG4iLCIvKipcbiAqIEBlbGVtZW50IG9ucy1rZXlib2FyZC1hY3RpdmVcbiAqIEBjYXRlZ29yeSBmb3JtXG4gKiBAZGVzY3JpcHRpb25cbiAqICAgW2VuXVxuICogICAgIENvbmRpdGlvbmFsbHkgZGlzcGxheSBjb250ZW50IGRlcGVuZGluZyBvbiBpZiB0aGUgc29mdHdhcmUga2V5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JyxcbiAgICAgICAgICAgIGRpc3BIaWRlID0gc2hvdyA/ICdub25lJyA6ICdibG9jayc7XG5cbiAgICAgICAgdmFyIG9uU2hvdyA9IGZ1bmN0aW9uKCkge1xuICAgICAgICAgIGVsZW1lbnQuY3NzKCdkaXNwbGF5JywgZGlzcFNob3cpO1xuICAgICAgICB9O1xuXG4gICAgICAgIHZhciBvbkhpZGUgPSBmdW5jdGlvbigpIHtcbiAgICAgICAgICBlbGVtZW50LmNzcygnZGlzcGxheScsIGRpc3BIaWRlKTtcbiAgICAgICAgfTtcblxuICAgICAgICB2YXIgb25Jbml0ID0gZnVuY3Rpb24oZSkge1xuICAgICAgICAgIGlmIChlLnZpc2libGUpIHtcbiAgICAgICAgICAgIG9uU2hvdygpO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBvbkhpZGUoKTtcbiAgICAgICAgICB9XG4gICAgICAgIH07XG5cbiAgICAgICAgb25zLnNvZnR3YXJlS2V5Ym9hcmQub24oJ3Nob3cnLCBvblNob3cpO1xuICAgICAgICBvbnMuc29mdHdhcmVLZXlib2FyZC5vbignaGlkZScsIG9uSGlkZSk7XG4gICAgICAgIG9ucy5zb2Z0d2FyZUtleWJvYXJkLm9uKCdpbml0Jywgb25Jbml0KTtcblxuICAgICAgICBpZiAob25zLnNvZnR3YXJlS2V5Ym9hcmQuX3Zpc2libGUpIHtcbiAgICAgICAgICBvblNob3coKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBvbkhpZGUoKTtcbiAgICAgICAgfVxuXG4gICAgICAgICRvbnNlbi5jbGVhbmVyLm9uRGVzdHJveShzY29wZSwgZnVuY3Rpb24oKSB7XG4gICAgICAgICAgb25zLnNvZnR3YXJlS2V5Ym9hcmQub2ZmKCdzaG93Jywgb25TaG93KTtcbiAgICAgICAgICBvbnMuc29mdHdhcmVLZXlib2FyZC5vZmYoJ2hpZGUnLCBvbkhpZGUpO1xuICAgICAgICAgIG9ucy5zb2Z0d2FyZU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lvbiAoKSB7XG4gICd1c2Ugc3RyaWN0JztcblxuICBhbmd1bGFyLm1vZHVsZSgnb25zZW4nKVxuICAuZGlyZWN0aXZlKCdvbnNTZWxlY3QnLCBbJyRwYXJzZScsICckb25zZW4nLCAnR2VuZXJpY1ZpZXcnLCBmdW5jdGlvbiAoJHBhcnNlLCAkb25zZW4sIEdlbmVyaWNWaWV3KSB7XG4gICAgcmV0dXJuIHtcbiAgICAgIHJlc3RyaWN0OiAnRScsXG4gICAgICByZXBsYWNlOiBmYWxzZSxcbiAgICAgIHNjb3BlOiBmYWxzZSxcblxuICAgICAgbGluazogZnVuY3Rpb24gKHNjb3BlLCBlbGVtZW50LCBhdHRycykge1xuICAgICAgICBjb25zdCBvbklucHV0ID0gKCkgPT4ge1xuICAgICAgICAgIGNvbnN0IHNldCA9ICRwYXJzZShhdHRycy5uZ01vZGVsKS5hc3NpZ247XG5cbiAgICAgICAgICBzZXQoc2NvcGUsIGVsZW1lbnRbMF0udmFsdWUpO1xuICAgICAgICAgIGlmIChhdHRycy5uZ0NoYW5nZSkge1xuICAgICAgICAgICAgc2NvcGUuJGV2YWwoYXR0cnMubmdDaGFuZ2UpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBzY29wZS4kcGFyZW50LiRldmFsQXN5bmMoKTtcbiAgICAgICAgfTtcblxuICAgICAgICBpZiAoYXR0cnMubmdNb2RlbCkge1xuICAgICAgICAgIHNjb3BlLiR3YXRjaChhdHRycy5uZ01vZGVsLCAodmFsdWUpID0+IHtcbiAgICAgICAgICAgIGVsZW1lbnRbMF0udmFsdWUgPSB2YWx1ZTtcbiAgICAgICAgICB9KTtcblxuICAgICAgICAgIGVsZW1lbnQub24oJ2lucHV0Jywgb25JbnB1dCk7XG4gICAgICAgIH1cblxuICAgICAgICBzY29wZS4kb24oJyRkZXN0cm95JywgKCkgPT4ge1xuICAgICAgICAgIGVsZW1lbnQub2ZmKCdpbnB1dCcsIG9uSW5wdXQpO1xuICAgICAgICAgIHNjb3B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pO1xuXG4gICAgZm9yICh2YXIgaSA9IDA7IGkgPCB0ZW1wbGF0ZXMubGVuZ3RoOyBpKyspIHtcbiAgICAgIHZhciB0ZW1wbGF0ZSA9IGFuZ3VsYXIuZWxlbWVudCh0ZW1wbGF0ZXNbaV0pO1xuICAgICAgdmFyIGlkID0gdGVtcGxhdGUuYXR0cignaWQnKTtcbiAgICAgIGlmICh0eXBlb2YgaWQgPT09ICdzdHJpbmcnKSB7XG4gICAgICAgICR0ZW1wbGF0ZUNhY2hlLnB1dChpZCwgdGVtcGxhdGUudGV4dCgpKTtcbiAgICAgIH1cbiAgICB9XG4gIH1dKTtcblxufSkoKTtcbiJdfQ==
|
cm19/ReactJS/your-first-react-app-exercises-master/exercise-12/friends/Friends.entry.js | Brandon-J-Campbell/codemash | import React from 'react';
import myFriends from '../data/friends';
import Friends from './Friends';
export default function FriendsEntry() {
return <Friends friends={myFriends} />
}
|
examples/with-apollo/components/PostUpvoter.js | callumlocke/next.js | import React from 'react'
import { graphql } from 'react-apollo'
import gql from 'graphql-tag'
function PostUpvoter ({ upvote, votes, id }) {
return (
<button onClick={() => upvote(id, votes + 1)}>
{votes}
<style jsx>{`
button {
background-color: transparent;
border: 1px solid #e4e4e4;
color: #000;
}
button:active {
background-color: transparent;
}
button:before {
align-self: center;
border-color: transparent transparent #000000 transparent;
border-style: solid;
border-width: 0 4px 6px 4px;
content: "";
height: 0;
margin-right: 5px;
width: 0;
}
`}</style>
</button>
)
}
const upvotePost = gql`
mutation updatePost($id: ID!, $votes: Int) {
updatePost(id: $id, votes: $votes) {
id
__typename
votes
}
}
`
export default graphql(upvotePost, {
props: ({ ownProps, mutate }) => ({
upvote: (id, votes) => mutate({
variables: { id, votes },
optimisticResponse: {
__typename: 'Mutation',
updatePost: {
__typename: 'Post',
id: ownProps.id,
votes: ownProps.votes + 1
}
}
})
})
})(PostUpvoter)
|
test/components/ComicList.spec.js | rickychien/comiz | import expect from 'expect'
import { shallow } from 'enzyme'
import React from 'react'
import { ComicList } from '../../src/components/ComicList'
describe('<ComicList />', () => {
let props
beforeEach(() => {
props = {
comics: undefined,
isFetching: undefined,
fetchError: undefined,
onComicItemClick: undefined,
}
})
it('should render correctly', () => {
const wrapper = shallow(<ComicList { ...props } />)
expect(wrapper.is('div')).toBe(true)
expect(wrapper.find('AppBar').length).toBe(1)
expect(wrapper.find('ComicItem').length).toBe(0)
})
it('should render correctly with comics', () => {
props.comics = [{ id: 1 }, { id: 2 }, { id: 3 }]
const wrapper = shallow(<ComicList { ...props } />)
expect(wrapper.find('div.comicList').length).toBe(1)
expect(wrapper.find('ComicItem').length).toBe(props.comics.length)
})
it('should render correctly with isFetching', () => {
props.isFetching = true
const wrapper = shallow(<ComicList { ...props } />)
expect(wrapper.find('i.loading-spinner').length).toBe(1)
})
it('should render correctly with isFetching and many comics', () => {
props.fetchError = true
props.comics = [{ id: 1 }, { id: 2 }, { id: 3 }]
const wrapper = shallow(<ComicList { ...props } />)
expect(wrapper.find('div.comicList').length).toBe(1)
expect(wrapper.find('ComicItem').length).toBe(props.comics.length)
})
it('should render correctly with fetchError', () => {
props.fetchError = true
const wrapper = shallow(<ComicList { ...props } />)
expect(wrapper.find('.statusPage h2').text()).toBe('Unable to find comics')
})
it('should render correctly with fetchError and comics', () => {
props.fetchError = true
props.comics = [{ id: 1 }, { id: 2 }, { id: 3 }]
const wrapper = shallow(<ComicList { ...props } />)
expect(wrapper.find('div.comicList').length).toBe(1)
expect(wrapper.find('ComicItem').length).toBe(props.comics.length)
})
})
|
node_modules/redux-devtools-log-monitor/src/LogMonitorButtonBar.js | jotamaggi/react-calendar-app | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import shouldPureComponentUpdate from 'react-pure-render/function';
import { ActionCreators } from 'redux-devtools';
import LogMonitorButton from './LogMonitorButton';
const { reset, rollback, commit, sweep } = ActionCreators;
const style = {
textAlign: 'center',
borderBottomWidth: 1,
borderBottomStyle: 'solid',
borderColor: 'transparent',
zIndex: 1,
display: 'flex',
flexDirection: 'row'
};
export default class LogMonitorButtonBar extends Component {
static propTypes = {
dispatch: PropTypes.func,
theme: PropTypes.object
};
shouldComponentUpdate = shouldPureComponentUpdate;
constructor(props) {
super(props);
this.handleReset = this.handleReset.bind(this);
this.handleRollback = this.handleRollback.bind(this);
this.handleSweep = this.handleSweep.bind(this);
this.handleCommit = this.handleCommit.bind(this);
}
handleRollback() {
this.props.dispatch(rollback());
}
handleSweep() {
this.props.dispatch(sweep());
}
handleCommit() {
this.props.dispatch(commit());
}
handleReset() {
this.props.dispatch(reset());
}
render() {
const { theme, hasStates, hasSkippedActions } = this.props;
return (
<div style={{...style, borderColor: theme.base02}}>
<LogMonitorButton
theme={theme}
onClick={this.handleReset}
enabled>
Reset
</LogMonitorButton>
<LogMonitorButton
theme={theme}
onClick={this.handleRollback}
enabled={hasStates}>
Revert
</LogMonitorButton>
<LogMonitorButton
theme={theme}
onClick={this.handleSweep}
enabled={hasSkippedActions}>
Sweep
</LogMonitorButton>
<LogMonitorButton
theme={theme}
onClick={this.handleCommit}
enabled={hasStates}>
Commit
</LogMonitorButton>
</div>
);
}
}
|
ajax/libs/forerunnerdb/1.3.763/fdb-core+views.js | dc-js/cdnjs | (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){
var Core = _dereq_('./core'),
View = _dereq_('../lib/View');
if (typeof window !== 'undefined') {
window.ForerunnerDB = Core;
}
module.exports = Core;
},{"../lib/View":33,"./core":2}],2:[function(_dereq_,module,exports){
var Core = _dereq_('../lib/Core'),
ShimIE8 = _dereq_('../lib/Shim.IE8');
if (typeof window !== 'undefined') {
window.ForerunnerDB = Core;
}
module.exports = Core;
},{"../lib/Core":8,"../lib/Shim.IE8":32}],3:[function(_dereq_,module,exports){
"use strict";
var Shared = _dereq_('./Shared'),
Path = _dereq_('./Path'),
sharedPathSolver;
/**
* Creates an always-sorted multi-key bucket that allows ForerunnerDB to
* know the index that a document will occupy in an array with minimal
* processing, speeding up things like sorted views.
* @param {object} orderBy An order object.
* @constructor
*/
var ActiveBucket = function (orderBy) {
this._primaryKey = '_id';
this._keyArr = [];
this._data = [];
this._objLookup = {};
this._count = 0;
this._keyArr = sharedPathSolver.parse(orderBy, true);
};
Shared.addModule('ActiveBucket', ActiveBucket);
Shared.mixin(ActiveBucket.prototype, 'Mixin.Sorting');
sharedPathSolver = new Path();
/**
* Gets / sets the primary key used by the active bucket.
* @returns {String} The current primary key.
*/
Shared.synthesize(ActiveBucket.prototype, 'primaryKey');
/**
* Quicksorts a single document into the passed array and
* returns the index that the document should occupy.
* @param {object} obj The document to calculate index for.
* @param {array} arr The array the document index will be
* calculated for.
* @param {string} item The string key representation of the
* document whose index is being calculated.
* @param {function} fn The comparison function that is used
* to determine if a document is sorted below or above the
* document we are calculating the index for.
* @returns {number} The index the document should occupy.
*/
ActiveBucket.prototype.qs = function (obj, arr, item, fn) {
// If the array is empty then return index zero
if (!arr.length) {
return 0;
}
var lastMidwayIndex = -1,
midwayIndex,
lookupItem,
result,
start = 0,
end = arr.length - 1;
// Loop the data until our range overlaps
while (end >= start) {
// Calculate the midway point (divide and conquer)
midwayIndex = Math.floor((start + end) / 2);
if (lastMidwayIndex === midwayIndex) {
// No more items to scan
break;
}
// Get the item to compare against
lookupItem = arr[midwayIndex];
if (lookupItem !== undefined) {
// Compare items
result = fn(this, obj, item, lookupItem);
if (result > 0) {
start = midwayIndex + 1;
}
if (result < 0) {
end = midwayIndex - 1;
}
}
lastMidwayIndex = midwayIndex;
}
if (result > 0) {
return midwayIndex + 1;
} else {
return midwayIndex;
}
};
/**
* Calculates the sort position of an item against another item.
* @param {object} sorter An object or instance that contains
* sortAsc and sortDesc methods.
* @param {object} obj The document to compare.
* @param {string} a The first key to compare.
* @param {string} b The second key to compare.
* @returns {number} Either 1 for sort a after b or -1 to sort
* a before b.
* @private
*/
ActiveBucket.prototype._sortFunc = function (sorter, obj, a, b) {
var aVals = a.split('.:.'),
bVals = b.split('.:.'),
arr = sorter._keyArr,
count = arr.length,
index,
sortType,
castType;
for (index = 0; index < count; index++) {
sortType = arr[index];
castType = typeof sharedPathSolver.get(obj, sortType.path);
if (castType === 'number') {
aVals[index] = Number(aVals[index]);
bVals[index] = Number(bVals[index]);
}
// Check for non-equal items
if (aVals[index] !== bVals[index]) {
// Return the sorted items
if (sortType.value === 1) {
return sorter.sortAsc(aVals[index], bVals[index]);
}
if (sortType.value === -1) {
return sorter.sortDesc(aVals[index], bVals[index]);
}
}
}
};
/**
* Inserts a document into the active bucket.
* @param {object} obj The document to insert.
* @returns {number} The index the document now occupies.
*/
ActiveBucket.prototype.insert = function (obj) {
var key,
keyIndex;
key = this.documentKey(obj);
keyIndex = this._data.indexOf(key);
if (keyIndex === -1) {
// Insert key
keyIndex = this.qs(obj, this._data, key, this._sortFunc);
this._data.splice(keyIndex, 0, key);
} else {
this._data.splice(keyIndex, 0, key);
}
this._objLookup[obj[this._primaryKey]] = key;
this._count++;
return keyIndex;
};
/**
* Removes a document from the active bucket.
* @param {object} obj The document to remove.
* @returns {boolean} True if the document was removed
* successfully or false if it wasn't found in the active
* bucket.
*/
ActiveBucket.prototype.remove = function (obj) {
var key,
keyIndex;
key = this._objLookup[obj[this._primaryKey]];
if (key) {
keyIndex = this._data.indexOf(key);
if (keyIndex > -1) {
this._data.splice(keyIndex, 1);
delete this._objLookup[obj[this._primaryKey]];
this._count--;
return true;
} else {
return false;
}
}
return false;
};
/**
* Get the index that the passed document currently occupies
* or the index it will occupy if added to the active bucket.
* @param {object} obj The document to get the index for.
* @returns {number} The index.
*/
ActiveBucket.prototype.index = function (obj) {
var key,
keyIndex;
key = this.documentKey(obj);
keyIndex = this._data.indexOf(key);
if (keyIndex === -1) {
// Get key index
keyIndex = this.qs(obj, this._data, key, this._sortFunc);
}
return keyIndex;
};
/**
* The key that represents the passed document.
* @param {object} obj The document to get the key for.
* @returns {string} The document key.
*/
ActiveBucket.prototype.documentKey = function (obj) {
var key = '',
arr = this._keyArr,
count = arr.length,
index,
sortType;
for (index = 0; index < count; index++) {
sortType = arr[index];
if (key) {
key += '.:.';
}
key += sharedPathSolver.get(obj, sortType.path);
}
// Add the unique identifier on the end of the key
key += '.:.' + obj[this._primaryKey];
return key;
};
/**
* Get the number of documents currently indexed in the active
* bucket instance.
* @returns {number} The number of documents.
*/
ActiveBucket.prototype.count = function () {
return this._count;
};
Shared.finishModule('ActiveBucket');
module.exports = ActiveBucket;
},{"./Path":28,"./Shared":31}],4:[function(_dereq_,module,exports){
"use strict";
var Shared = _dereq_('./Shared'),
Path = _dereq_('./Path'),
sharedPathSolver = new Path();
var BinaryTree = function (data, compareFunc, hashFunc) {
this.init.apply(this, arguments);
};
BinaryTree.prototype.init = function (data, index, primaryKey, compareFunc, hashFunc) {
this._store = [];
this._keys = [];
if (primaryKey !== undefined) { this.primaryKey(primaryKey); }
if (index !== undefined) { this.index(index); }
if (compareFunc !== undefined) { this.compareFunc(compareFunc); }
if (hashFunc !== undefined) { this.hashFunc(hashFunc); }
if (data !== undefined) { this.data(data); }
};
Shared.addModule('BinaryTree', BinaryTree);
Shared.mixin(BinaryTree.prototype, 'Mixin.ChainReactor');
Shared.mixin(BinaryTree.prototype, 'Mixin.Sorting');
Shared.mixin(BinaryTree.prototype, 'Mixin.Common');
Shared.synthesize(BinaryTree.prototype, 'compareFunc');
Shared.synthesize(BinaryTree.prototype, 'hashFunc');
Shared.synthesize(BinaryTree.prototype, 'indexDir');
Shared.synthesize(BinaryTree.prototype, 'primaryKey');
Shared.synthesize(BinaryTree.prototype, 'keys');
Shared.synthesize(BinaryTree.prototype, 'index', function (index) {
if (index !== undefined) {
if (this.debug()) {
console.log('Setting index', index, sharedPathSolver.parse(index, true));
}
// Convert the index object to an array of key val objects
this.keys(sharedPathSolver.parse(index, true));
}
return this.$super.call(this, index);
});
/**
* Remove all data from the binary tree.
*/
BinaryTree.prototype.clear = function () {
delete this._data;
delete this._left;
delete this._right;
this._store = [];
};
/**
* Sets this node's data object. All further inserted documents that
* match this node's key and value will be pushed via the push()
* method into the this._store array. When deciding if a new data
* should be created left, right or middle (pushed) of this node the
* new data is checked against the data set via this method.
* @param val
* @returns {*}
*/
BinaryTree.prototype.data = function (val) {
if (val !== undefined) {
this._data = val;
if (this._hashFunc) { this._hash = this._hashFunc(val); }
return this;
}
return this._data;
};
/**
* Pushes an item to the binary tree node's store array.
* @param {*} val The item to add to the store.
* @returns {*}
*/
BinaryTree.prototype.push = function (val) {
if (val !== undefined) {
this._store.push(val);
return this;
}
return false;
};
/**
* Pulls an item from the binary tree node's store array.
* @param {*} val The item to remove from the store.
* @returns {*}
*/
BinaryTree.prototype.pull = function (val) {
if (val !== undefined) {
var index = this._store.indexOf(val);
if (index > -1) {
this._store.splice(index, 1);
return this;
}
}
return false;
};
/**
* Default compare method. Can be overridden.
* @param a
* @param b
* @returns {number}
* @private
*/
BinaryTree.prototype._compareFunc = function (a, b) {
// Loop the index array
var i,
indexData,
result = 0;
for (i = 0; i < this._keys.length; i++) {
indexData = this._keys[i];
if (indexData.value === 1) {
result = this.sortAsc(sharedPathSolver.get(a, indexData.path), sharedPathSolver.get(b, indexData.path));
} else if (indexData.value === -1) {
result = this.sortDesc(sharedPathSolver.get(a, indexData.path), sharedPathSolver.get(b, indexData.path));
}
if (this.debug()) {
console.log('Compared %s with %s order %d in path %s and result was %d', sharedPathSolver.get(a, indexData.path), sharedPathSolver.get(b, indexData.path), indexData.value, indexData.path, result);
}
if (result !== 0) {
if (this.debug()) {
console.log('Retuning result %d', result);
}
return result;
}
}
if (this.debug()) {
console.log('Retuning result %d', result);
}
return result;
};
/**
* Default hash function. Can be overridden.
* @param obj
* @private
*/
BinaryTree.prototype._hashFunc = function (obj) {
/*var i,
indexData,
hash = '';
for (i = 0; i < this._keys.length; i++) {
indexData = this._keys[i];
if (hash) { hash += '_'; }
hash += obj[indexData.path];
}
return hash;*/
return obj[this._keys[0].path];
};
/**
* Removes (deletes reference to) either left or right child if the passed
* node matches one of them.
* @param {BinaryTree} node The node to remove.
*/
BinaryTree.prototype.removeChildNode = function (node) {
if (this._left === node) {
// Remove left
delete this._left;
} else if (this._right === node) {
// Remove right
delete this._right;
}
};
/**
* Returns the branch this node matches (left or right).
* @param node
* @returns {String}
*/
BinaryTree.prototype.nodeBranch = function (node) {
if (this._left === node) {
return 'left';
} else if (this._right === node) {
return 'right';
}
};
/**
* Inserts a document into the binary tree.
* @param data
* @returns {*}
*/
BinaryTree.prototype.insert = function (data) {
var result,
inserted,
failed,
i;
if (data instanceof Array) {
// Insert array of data
inserted = [];
failed = [];
for (i = 0; i < data.length; i++) {
if (this.insert(data[i])) {
inserted.push(data[i]);
} else {
failed.push(data[i]);
}
}
return {
inserted: inserted,
failed: failed
};
}
if (this.debug()) {
console.log('Inserting', data);
}
if (!this._data) {
if (this.debug()) {
console.log('Node has no data, setting data', data);
}
// Insert into this node (overwrite) as there is no data
this.data(data);
//this.push(data);
return true;
}
result = this._compareFunc(this._data, data);
if (result === 0) {
if (this.debug()) {
console.log('Data is equal (currrent, new)', this._data, data);
}
//this.push(data);
// Less than this node
if (this._left) {
// Propagate down the left branch
this._left.insert(data);
} else {
// Assign to left branch
this._left = new BinaryTree(data, this._index, this._binaryTree, this._compareFunc, this._hashFunc);
this._left._parent = this;
}
return true;
}
if (result === -1) {
if (this.debug()) {
console.log('Data is greater (currrent, new)', this._data, data);
}
// Greater than this node
if (this._right) {
// Propagate down the right branch
this._right.insert(data);
} else {
// Assign to right branch
this._right = new BinaryTree(data, this._index, this._binaryTree, this._compareFunc, this._hashFunc);
this._right._parent = this;
}
return true;
}
if (result === 1) {
if (this.debug()) {
console.log('Data is less (currrent, new)', this._data, data);
}
// Less than this node
if (this._left) {
// Propagate down the left branch
this._left.insert(data);
} else {
// Assign to left branch
this._left = new BinaryTree(data, this._index, this._binaryTree, this._compareFunc, this._hashFunc);
this._left._parent = this;
}
return true;
}
return false;
};
BinaryTree.prototype.remove = function (data) {
var pk = this.primaryKey(),
result,
removed,
i;
if (data instanceof Array) {
// Insert array of data
removed = [];
for (i = 0; i < data.length; i++) {
if (this.remove(data[i])) {
removed.push(data[i]);
}
}
return removed;
}
if (this.debug()) {
console.log('Removing', data);
}
if (this._data[pk] === data[pk]) {
// Remove this node
return this._remove(this);
}
// Compare the data to work out which branch to send the remove command down
result = this._compareFunc(this._data, data);
if (result === -1 && this._right) {
return this._right.remove(data);
}
if (result === 1 && this._left) {
return this._left.remove(data);
}
return false;
};
BinaryTree.prototype._remove = function (node) {
var leftNode,
rightNode;
if (this._left) {
// Backup branch data
leftNode = this._left;
rightNode = this._right;
// Copy data from left node
this._left = leftNode._left;
this._right = leftNode._right;
this._data = leftNode._data;
this._store = leftNode._store;
if (rightNode) {
// Attach the rightNode data to the right-most node
// of the leftNode
leftNode.rightMost()._right = rightNode;
}
} else if (this._right) {
// Backup branch data
rightNode = this._right;
// Copy data from right node
this._left = rightNode._left;
this._right = rightNode._right;
this._data = rightNode._data;
this._store = rightNode._store;
} else {
this.clear();
}
return true;
};
BinaryTree.prototype.leftMost = function () {
if (!this._left) {
return this;
} else {
return this._left.leftMost();
}
};
BinaryTree.prototype.rightMost = function () {
if (!this._right) {
return this;
} else {
return this._right.rightMost();
}
};
/**
* Searches the binary tree for all matching documents based on the data
* passed (query).
* @param data
* @param options
* @param {Array=} resultArr The results passed between recursive calls.
* Do not pass anything into this argument when calling externally.
* @returns {*|Array}
*/
BinaryTree.prototype.lookup = function (data, options, resultArr) {
var result = this._compareFunc(this._data, data);
resultArr = resultArr || [];
if (result === 0) {
if (this._left) { this._left.lookup(data, options, resultArr); }
resultArr.push(this._data);
if (this._right) { this._right.lookup(data, options, resultArr); }
}
if (result === -1) {
if (this._right) { this._right.lookup(data, options, resultArr); }
}
if (result === 1) {
if (this._left) { this._left.lookup(data, options, resultArr); }
}
return resultArr;
};
/**
* Returns the entire binary tree ordered.
* @param {String} type
* @param resultArr
* @returns {*|Array}
*/
BinaryTree.prototype.inOrder = function (type, resultArr) {
resultArr = resultArr || [];
if (this._left) {
this._left.inOrder(type, resultArr);
}
switch (type) {
case 'hash':
resultArr.push(this._hash);
break;
case 'data':
resultArr.push(this._data);
break;
default:
resultArr.push({
key: this._data,
arr: this._store
});
break;
}
if (this._right) {
this._right.inOrder(type, resultArr);
}
return resultArr;
};
/**
* Searches the binary tree for all matching documents based on the regular
* expression passed.
* @param path
* @param val
* @param regex
* @param {Array=} resultArr The results passed between recursive calls.
* Do not pass anything into this argument when calling externally.
* @returns {*|Array}
*/
BinaryTree.prototype.startsWith = function (path, val, regex, resultArr) {
var reTest,
thisDataPathVal = sharedPathSolver.get(this._data, path),
thisDataPathValSubStr = thisDataPathVal.substr(0, val.length),
result;
regex = regex || new RegExp('^' + val);
resultArr = resultArr || [];
if (resultArr._visited === undefined) { resultArr._visited = 0; }
resultArr._visited++;
result = this.sortAsc(thisDataPathVal, val);
reTest = thisDataPathValSubStr === val;
if (result === 0) {
if (this._left) { this._left.startsWith(path, val, regex, resultArr); }
if (reTest) { resultArr.push(this._data); }
if (this._right) { this._right.startsWith(path, val, regex, resultArr); }
}
if (result === -1) {
if (reTest) { resultArr.push(this._data); }
if (this._right) { this._right.startsWith(path, val, regex, resultArr); }
}
if (result === 1) {
if (this._left) { this._left.startsWith(path, val, regex, resultArr); }
if (reTest) { resultArr.push(this._data); }
}
return resultArr;
};
/*BinaryTree.prototype.find = function (type, search, resultArr) {
resultArr = resultArr || [];
if (this._left) {
this._left.find(type, search, resultArr);
}
// Check if this node's data is greater or less than the from value
var fromResult = this.sortAsc(this._data[key], from),
toResult = this.sortAsc(this._data[key], to);
if ((fromResult === 0 || fromResult === 1) && (toResult === 0 || toResult === -1)) {
// This data node is greater than or equal to the from value,
// and less than or equal to the to value so include it
switch (type) {
case 'hash':
resultArr.push(this._hash);
break;
case 'data':
resultArr.push(this._data);
break;
default:
resultArr.push({
key: this._data,
arr: this._store
});
break;
}
}
if (this._right) {
this._right.find(type, search, resultArr);
}
return resultArr;
};*/
/**
*
* @param {String} type
* @param {String} key The data key / path to range search against.
* @param {Number} from Range search from this value (inclusive)
* @param {Number} to Range search to this value (inclusive)
* @param {Array=} resultArr Leave undefined when calling (internal use),
* passes the result array between recursive calls to be returned when
* the recursion chain completes.
* @param {Path=} pathResolver Leave undefined when calling (internal use),
* caches the path resolver instance for performance.
* @returns {Array} Array of matching document objects
*/
BinaryTree.prototype.findRange = function (type, key, from, to, resultArr, pathResolver) {
resultArr = resultArr || [];
pathResolver = pathResolver || new Path(key);
if (this._left) {
this._left.findRange(type, key, from, to, resultArr, pathResolver);
}
// Check if this node's data is greater or less than the from value
var pathVal = pathResolver.value(this._data),
fromResult = this.sortAsc(pathVal, from),
toResult = this.sortAsc(pathVal, to);
if ((fromResult === 0 || fromResult === 1) && (toResult === 0 || toResult === -1)) {
// This data node is greater than or equal to the from value,
// and less than or equal to the to value so include it
switch (type) {
case 'hash':
resultArr.push(this._hash);
break;
case 'data':
resultArr.push(this._data);
break;
default:
resultArr.push({
key: this._data,
arr: this._store
});
break;
}
}
if (this._right) {
this._right.findRange(type, key, from, to, resultArr, pathResolver);
}
return resultArr;
};
/*BinaryTree.prototype.findRegExp = function (type, key, pattern, resultArr) {
resultArr = resultArr || [];
if (this._left) {
this._left.findRegExp(type, key, pattern, resultArr);
}
// Check if this node's data is greater or less than the from value
var fromResult = this.sortAsc(this._data[key], from),
toResult = this.sortAsc(this._data[key], to);
if ((fromResult === 0 || fromResult === 1) && (toResult === 0 || toResult === -1)) {
// This data node is greater than or equal to the from value,
// and less than or equal to the to value so include it
switch (type) {
case 'hash':
resultArr.push(this._hash);
break;
case 'data':
resultArr.push(this._data);
break;
default:
resultArr.push({
key: this._data,
arr: this._store
});
break;
}
}
if (this._right) {
this._right.findRegExp(type, key, pattern, resultArr);
}
return resultArr;
};*/
/**
* Determines if the passed query and options object will be served
* by this index successfully or not and gives a score so that the
* DB search system can determine how useful this index is in comparison
* to other indexes on the same collection.
* @param query
* @param queryOptions
* @param matchOptions
* @returns {{matchedKeys: Array, totalKeyCount: Number, score: number}}
*/
BinaryTree.prototype.match = function (query, queryOptions, matchOptions) {
// Check if the passed query has data in the keys our index
// operates on and if so, is the query sort matching our order
var indexKeyArr,
queryArr,
matchedKeys = [],
matchedKeyCount = 0,
i;
indexKeyArr = sharedPathSolver.parseArr(this._index, {
verbose: true
});
queryArr = sharedPathSolver.parseArr(query, matchOptions && matchOptions.pathOptions ? matchOptions.pathOptions : {
ignore:/\$/,
verbose: true
});
// Loop the query array and check the order of keys against the
// index key array to see if this index can be used
for (i = 0; i < indexKeyArr.length; i++) {
if (queryArr[i] === indexKeyArr[i]) {
matchedKeyCount++;
matchedKeys.push(queryArr[i]);
}
}
return {
matchedKeys: matchedKeys,
totalKeyCount: queryArr.length,
score: matchedKeyCount
};
//return sharedPathSolver.countObjectPaths(this._keys, query);
};
Shared.finishModule('BinaryTree');
module.exports = BinaryTree;
},{"./Path":28,"./Shared":31}],5:[function(_dereq_,module,exports){
"use strict";
var crcTable,
checksum;
crcTable = (function () {
var crcTable = [],
c, n, k;
for (n = 0; n < 256; n++) {
c = n;
for (k = 0; k < 8; k++) {
c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); // jshint ignore:line
}
crcTable[n] = c;
}
return crcTable;
}());
/**
* Returns a checksum of a string.
* @param {String} str The string to checksum.
* @return {Number} The checksum generated.
*/
checksum = function(str) {
var crc = 0 ^ (-1), // jshint ignore:line
i;
for (i = 0; i < str.length; i++) {
crc = (crc >>> 8) ^ crcTable[(crc ^ str.charCodeAt(i)) & 0xFF]; // jshint ignore:line
}
return (crc ^ (-1)) >>> 0; // jshint ignore:line
};
module.exports = checksum;
},{}],6:[function(_dereq_,module,exports){
"use strict";
var Shared,
Db,
Metrics,
KeyValueStore,
Path,
IndexHashMap,
IndexBinaryTree,
Index2d,
Overload,
ReactorIO,
sharedPathSolver;
Shared = _dereq_('./Shared');
/**
* Creates a new collection. Collections store multiple documents and
* handle CRUD against those documents.
* @constructor
*/
var Collection = function (name, options) {
this.init.apply(this, arguments);
};
Collection.prototype.init = function (name, options) {
this.sharedPathSolver = sharedPathSolver;
this._primaryKey = '_id';
this._primaryIndex = new KeyValueStore('primary');
this._primaryCrc = new KeyValueStore('primaryCrc');
this._crcLookup = new KeyValueStore('crcLookup');
this._name = name;
this._data = [];
this._metrics = new Metrics();
this._options = options || {
changeTimestamp: false
};
if (this._options.db) {
this.db(this._options.db);
}
// Create an object to store internal protected data
this._metaData = {};
this._deferQueue = {
insert: [],
update: [],
remove: [],
upsert: [],
async: []
};
this._deferThreshold = {
insert: 100,
update: 100,
remove: 100,
upsert: 100
};
this._deferTime = {
insert: 1,
update: 1,
remove: 1,
upsert: 1
};
this._deferredCalls = true;
// Set the subset to itself since it is the root collection
this.subsetOf(this);
};
Shared.addModule('Collection', Collection);
Shared.mixin(Collection.prototype, 'Mixin.Common');
Shared.mixin(Collection.prototype, 'Mixin.Events');
Shared.mixin(Collection.prototype, 'Mixin.ChainReactor');
Shared.mixin(Collection.prototype, 'Mixin.CRUD');
Shared.mixin(Collection.prototype, 'Mixin.Constants');
Shared.mixin(Collection.prototype, 'Mixin.Triggers');
Shared.mixin(Collection.prototype, 'Mixin.Sorting');
Shared.mixin(Collection.prototype, 'Mixin.Matching');
Shared.mixin(Collection.prototype, 'Mixin.Updating');
Shared.mixin(Collection.prototype, 'Mixin.Tags');
Metrics = _dereq_('./Metrics');
KeyValueStore = _dereq_('./KeyValueStore');
Path = _dereq_('./Path');
IndexHashMap = _dereq_('./IndexHashMap');
IndexBinaryTree = _dereq_('./IndexBinaryTree');
Index2d = _dereq_('./Index2d');
Db = Shared.modules.Db;
Overload = _dereq_('./Overload');
ReactorIO = _dereq_('./ReactorIO');
sharedPathSolver = new Path();
/**
* Gets / sets the deferred calls flag. If set to true (default)
* then operations on large data sets can be broken up and done
* over multiple CPU cycles (creating an async state). For purely
* synchronous behaviour set this to false.
* @param {Boolean=} val The value to set.
* @returns {Boolean}
*/
Shared.synthesize(Collection.prototype, 'deferredCalls');
/**
* Gets / sets the current state.
* @param {String=} val The name of the state to set.
* @returns {*}
*/
Shared.synthesize(Collection.prototype, 'state');
/**
* Gets / sets the name of the collection.
* @param {String=} val The name of the collection to set.
* @returns {*}
*/
Shared.synthesize(Collection.prototype, 'name');
/**
* Gets / sets the metadata stored in the collection.
*/
Shared.synthesize(Collection.prototype, 'metaData');
/**
* Gets / sets boolean to determine if the collection should be
* capped or not.
*/
Shared.synthesize(Collection.prototype, 'capped');
/**
* Gets / sets capped collection size. This is the maximum number
* of records that the capped collection will store.
*/
Shared.synthesize(Collection.prototype, 'cappedSize');
Collection.prototype._asyncPending = function (key) {
this._deferQueue.async.push(key);
};
Collection.prototype._asyncComplete = function (key) {
// Remove async flag for this type
var index = this._deferQueue.async.indexOf(key);
while (index > -1) {
this._deferQueue.async.splice(index, 1);
index = this._deferQueue.async.indexOf(key);
}
if (this._deferQueue.async.length === 0) {
this.deferEmit('ready');
}
};
/**
* Get the data array that represents the collection's data.
* This data is returned by reference and should not be altered outside
* of the provided CRUD functionality of the collection as doing so
* may cause unstable index behaviour within the collection.
* @returns {Array}
*/
Collection.prototype.data = function () {
return this._data;
};
/**
* Drops a collection and all it's stored data from the database.
* @returns {boolean} True on success, false on failure.
*/
Collection.prototype.drop = function (callback) {
var key;
if (!this.isDropped()) {
if (this._db && this._db._collection && this._name) {
if (this.debug()) {
console.log(this.logIdentifier() + ' Dropping');
}
this._state = 'dropped';
this.emit('drop', this);
delete this._db._collection[this._name];
// Remove any reactor IO chain links
if (this._collate) {
for (key in this._collate) {
if (this._collate.hasOwnProperty(key)) {
this.collateRemove(key);
}
}
}
delete this._primaryKey;
delete this._primaryIndex;
delete this._primaryCrc;
delete this._crcLookup;
delete this._data;
delete this._metrics;
delete this._listeners;
if (callback) { callback.call(this, false, true); }
return true;
}
} else {
if (callback) { callback.call(this, false, true); }
return true;
}
if (callback) { callback.call(this, false, true); }
return false;
};
/**
* Gets / sets the primary key for this collection.
* @param {String=} keyName The name of the primary key.
* @returns {*}
*/
Collection.prototype.primaryKey = function (keyName) {
if (keyName !== undefined) {
if (this._primaryKey !== keyName) {
var oldKey = this._primaryKey;
this._primaryKey = keyName;
// Set the primary key index primary key
this._primaryIndex.primaryKey(keyName);
// Rebuild the primary key index
this.rebuildPrimaryKeyIndex();
// Propagate change down the chain
this.chainSend('primaryKey', {
keyName: keyName,
oldData: oldKey
});
}
return this;
}
return this._primaryKey;
};
/**
* Handles insert events and routes changes to binds and views as required.
* @param {Array} inserted An array of inserted documents.
* @param {Array} failed An array of documents that failed to insert.
* @private
*/
Collection.prototype._onInsert = function (inserted, failed) {
this.emit('insert', inserted, failed);
};
/**
* Handles update events and routes changes to binds and views as required.
* @param {Array} items An array of updated documents.
* @private
*/
Collection.prototype._onUpdate = function (items) {
this.emit('update', items);
};
/**
* Handles remove events and routes changes to binds and views as required.
* @param {Array} items An array of removed documents.
* @private
*/
Collection.prototype._onRemove = function (items) {
this.emit('remove', items);
};
/**
* Handles any change to the collection.
* @private
*/
Collection.prototype._onChange = function () {
if (this._options.changeTimestamp) {
// Record the last change timestamp
this._metaData.lastChange = this.serialiser.convert(new Date());
}
};
/**
* Gets / sets the db instance this class instance belongs to.
* @param {Db=} db The db instance.
* @returns {*}
*/
Shared.synthesize(Collection.prototype, 'db', function (db) {
if (db) {
if (this.primaryKey() === '_id') {
// Set primary key to the db's key by default
this.primaryKey(db.primaryKey());
// Apply the same debug settings
this.debug(db.debug());
}
}
return this.$super.apply(this, arguments);
});
/**
* Gets / sets mongodb emulation mode.
* @param {Boolean=} val True to enable, false to disable.
* @returns {*}
*/
Shared.synthesize(Collection.prototype, 'mongoEmulation');
/**
* Sets the collection's data to the array / documents passed. If any
* data already exists in the collection it will be removed before the
* new data is set.
* @param {Array|Object} data The array of documents or a single document
* that will be set as the collections data.
* @param options Optional options object.
* @param callback Optional callback function.
*/
Collection.prototype.setData = new Overload('Collection.prototype.setData', {
'*': function (data) {
return this.$main.call(this, data, {});
},
'*, object': function (data, options) {
return this.$main.call(this, data, options);
},
'*, function': function (data, callback) {
return this.$main.call(this, data, {}, callback);
},
'*, *, function': function (data, options, callback) {
return this.$main.call(this, data, options, callback);
},
'*, *, *': function (data, options, callback) {
return this.$main.call(this, data, options, callback);
},
'$main': function (data, options, callback) {
if (this.isDropped()) {
throw(this.logIdentifier() + ' Cannot operate in a dropped state!');
}
if (data) {
var deferredSetting = this.deferredCalls(),
oldData = [].concat(this._data);
// Switch off deferred calls since setData should be
// a synchronous call
this.deferredCalls(false);
options = this.options(options);
if (options.$decouple) {
data = this.decouple(data);
}
if (!(data instanceof Array)) {
data = [data];
}
// Remove all items from the collection
this.remove({});
// Insert the new data
this.insert(data);
// Switch deferred calls back to previous settings
this.deferredCalls(deferredSetting);
this._onChange();
this.emit('setData', this._data, oldData);
}
if (callback) { callback.call(this); }
return this;
}
});
/**
* Drops and rebuilds the primary key index for all documents in the collection.
* @param {Object=} options An optional options object.
* @private
*/
Collection.prototype.rebuildPrimaryKeyIndex = function (options) {
options = options || {
$ensureKeys: undefined,
$violationCheck: undefined
};
var ensureKeys = options && options.$ensureKeys !== undefined ? options.$ensureKeys : true,
violationCheck = options && options.$violationCheck !== undefined ? options.$violationCheck : true,
arr,
arrCount,
arrItem,
pIndex = this._primaryIndex,
crcIndex = this._primaryCrc,
crcLookup = this._crcLookup,
pKey = this._primaryKey,
jString;
// Drop the existing primary index
pIndex.truncate();
crcIndex.truncate();
crcLookup.truncate();
// Loop the data and check for a primary key in each object
arr = this._data;
arrCount = arr.length;
while (arrCount--) {
arrItem = arr[arrCount];
if (ensureKeys) {
// Make sure the item has a primary key
this.ensurePrimaryKey(arrItem);
}
if (violationCheck) {
// Check for primary key violation
if (!pIndex.uniqueSet(arrItem[pKey], arrItem)) {
// Primary key violation
throw(this.logIdentifier() + ' Call to setData on collection failed because your data violates the primary key unique constraint. One or more documents are using the same primary key: ' + arrItem[this._primaryKey]);
}
} else {
pIndex.set(arrItem[pKey], arrItem);
}
// Generate a hash string
jString = this.hash(arrItem);
crcIndex.set(arrItem[pKey], jString);
crcLookup.set(jString, arrItem);
}
};
/**
* Checks for a primary key on the document and assigns one if none
* currently exists.
* @param {Object} obj The object to check a primary key against.
* @private
*/
Collection.prototype.ensurePrimaryKey = function (obj) {
if (obj[this._primaryKey] === undefined) {
// Assign a primary key automatically
obj[this._primaryKey] = this.objectId();
}
};
/**
* Clears all data from the collection.
* @returns {Collection}
*/
Collection.prototype.truncate = function () {
if (this.isDropped()) {
throw(this.logIdentifier() + ' Cannot operate in a dropped state!');
}
// TODO: This should use remove so that chain reactor events are properly
// TODO: handled, but ensure that chunking is switched off
this.emit('truncate', this._data);
// Clear all the data from the collection
this._data.length = 0;
// Re-create the primary index data
this._primaryIndex = new KeyValueStore('primary');
this._primaryCrc = new KeyValueStore('primaryCrc');
this._crcLookup = new KeyValueStore('crcLookup');
this._onChange();
this.emit('immediateChange', {type: 'truncate'});
this.deferEmit('change', {type: 'truncate'});
return this;
};
/**
* Modifies an existing document or documents in a collection. This will update
* all matches for 'query' with the data held in 'update'. It will not overwrite
* the matched documents with the update document.
*
* @param {Object} obj The document object to upsert or an array containing
* documents to upsert.
*
* If the document contains a primary key field (based on the collections's primary
* key) then the database will search for an existing document with a matching id.
* If a matching document is found, the document will be updated. Any keys that
* match keys on the existing document will be overwritten with new data. Any keys
* that do not currently exist on the document will be added to the document.
*
* If the document does not contain an id or the id passed does not match an existing
* document, an insert is performed instead. If no id is present a new primary key
* id is provided for the item.
*
* @param {Function=} callback Optional callback method.
* @returns {Object} An object containing two keys, "op" contains either "insert" or
* "update" depending on the type of operation that was performed and "result"
* contains the return data from the operation used.
*/
Collection.prototype.upsert = function (obj, callback) {
if (this.isDropped()) {
throw(this.logIdentifier() + ' Cannot operate in a dropped state!');
}
if (obj) {
var queue = this._deferQueue.upsert,
deferThreshold = this._deferThreshold.upsert,
returnData = {},
query,
i;
// Determine if the object passed is an array or not
if (obj instanceof Array) {
if (this._deferredCalls && obj.length > deferThreshold) {
// Break up upsert into blocks
this._deferQueue.upsert = queue.concat(obj);
this._asyncPending('upsert');
// Fire off the insert queue handler
this.processQueue('upsert', callback);
return {};
} else {
// Loop the array and upsert each item
returnData = [];
for (i = 0; i < obj.length; i++) {
returnData.push(this.upsert(obj[i]));
}
if (callback) { callback.call(this); }
return returnData;
}
}
// Determine if the operation is an insert or an update
if (obj[this._primaryKey]) {
// Check if an object with this primary key already exists
query = {};
query[this._primaryKey] = obj[this._primaryKey];
if (this._primaryIndex.lookup(query)[0]) {
// The document already exists with this id, this operation is an update
returnData.op = 'update';
} else {
// No document with this id exists, this operation is an insert
returnData.op = 'insert';
}
} else {
// The document passed does not contain an id, this operation is an insert
returnData.op = 'insert';
}
switch (returnData.op) {
case 'insert':
returnData.result = this.insert(obj, callback);
break;
case 'update':
returnData.result = this.update(query, obj, {}, callback);
break;
default:
break;
}
return returnData;
} else {
if (callback) { callback.call(this); }
}
return {};
};
/**
* Executes a method against each document that matches query and returns an
* array of documents that may have been modified by the method.
* @param {Object} query The query object.
* @param {Function} func The method that each document is passed to. If this method
* returns false for a particular document it is excluded from the results.
* @param {Object=} options Optional options object.
* @returns {Array}
*/
Collection.prototype.filter = function (query, func, options) {
return (this.find(query, options)).filter(func);
};
/**
* Executes a method against each document that matches query and then executes
* an update based on the return data of the method.
* @param {Object} query The query object.
* @param {Function} func The method that each document is passed to. If this method
* returns false for a particular document it is excluded from the update.
* @param {Object=} options Optional options object passed to the initial find call.
* @returns {Array}
*/
Collection.prototype.filterUpdate = function (query, func, options) {
var items = this.find(query, options),
results = [],
singleItem,
singleQuery,
singleUpdate,
pk = this.primaryKey(),
i;
for (i = 0; i < items.length; i++) {
singleItem = items[i];
singleUpdate = func(singleItem);
if (singleUpdate) {
singleQuery = {};
singleQuery[pk] = singleItem[pk];
results.push(this.update(singleQuery, singleUpdate));
}
}
return results;
};
/**
* Modifies an existing document or documents in a collection. This will update
* all matches for 'query' with the data held in 'update'. It will not overwrite
* the matched documents with the update document.
*
* @param {Object} query The query that must be matched for a document to be
* operated on.
* @param {Object} update The object containing updated key/values. Any keys that
* match keys on the existing document will be overwritten with this data. Any
* keys that do not currently exist on the document will be added to the document.
* @param {Object=} options An options object.
* @param {Function=} callback The callback method to call when the update is
* complete.
* @returns {Array} The items that were updated.
*/
Collection.prototype.update = function (query, update, options, callback) {
if (this.isDropped()) {
throw(this.logIdentifier() + ' Cannot operate in a dropped state!');
}
// Convert queries from mongo dot notation to forerunner queries
if (this.mongoEmulation()) {
this.convertToFdb(query);
this.convertToFdb(update);
} else {
// Decouple the update data
update = this.decouple(update);
}
// Handle transform
update = this.transformIn(update);
return this._handleUpdate(query, update, options, callback);
};
Collection.prototype._handleUpdate = function (query, update, options, callback) {
var self = this,
op = this._metrics.create('update'),
dataSet,
updated,
updateCall = function (referencedDoc) {
var oldDoc = self.decouple(referencedDoc),
newDoc,
triggerOperation,
result;
if (self.willTrigger(self.TYPE_UPDATE, self.PHASE_BEFORE) || self.willTrigger(self.TYPE_UPDATE, self.PHASE_AFTER)) {
newDoc = self.decouple(referencedDoc);
triggerOperation = {
type: 'update',
query: self.decouple(query),
update: self.decouple(update),
options: self.decouple(options),
op: op
};
// Update newDoc with the update criteria so we know what the data will look
// like AFTER the update is processed
result = self.updateObject(newDoc, triggerOperation.update, triggerOperation.query, triggerOperation.options, '');
if (self.processTrigger(triggerOperation, self.TYPE_UPDATE, self.PHASE_BEFORE, referencedDoc, newDoc) !== false) {
// No triggers complained so let's execute the replacement of the existing
// object with the new one
result = self.updateObject(referencedDoc, newDoc, triggerOperation.query, triggerOperation.options, '');
// NOTE: If for some reason we would only like to fire this event if changes are actually going
// to occur on the object from the proposed update then we can add "result &&" to the if
self.processTrigger(triggerOperation, self.TYPE_UPDATE, self.PHASE_AFTER, oldDoc, newDoc);
} else {
// Trigger cancelled operation so tell result that it was not updated
result = false;
}
} else {
// No triggers complained so let's execute the replacement of the existing
// object with the new one
result = self.updateObject(referencedDoc, update, query, options, '');
}
// Inform indexes of the change
self._updateIndexes(oldDoc, referencedDoc);
return result;
};
op.start();
op.time('Retrieve documents to update');
dataSet = this.find(query, {$decouple: false});
op.time('Retrieve documents to update');
if (dataSet.length) {
op.time('Update documents');
updated = dataSet.filter(updateCall);
op.time('Update documents');
if (updated.length) {
if (this.debug()) {
console.log(this.logIdentifier() + ' Updated some data');
}
op.time('Resolve chains');
if (this.chainWillSend()) {
this.chainSend('update', {
query: query,
update: update,
dataSet: this.decouple(updated)
}, options);
}
op.time('Resolve chains');
this._onUpdate(updated);
this._onChange();
if (callback) { callback.call(this); }
this.emit('immediateChange', {type: 'update', data: updated});
this.deferEmit('change', {type: 'update', data: updated});
}
}
op.stop();
// TODO: Should we decouple the updated array before return by default?
return updated || [];
};
/**
* Replaces an existing object with data from the new object without
* breaking data references.
* @param {Object} currentObj The object to alter.
* @param {Object} newObj The new object to overwrite the existing one with.
* @returns {*} Chain.
* @private
*/
Collection.prototype._replaceObj = function (currentObj, newObj) {
var i;
// Check if the new document has a different primary key value from the existing one
// Remove item from indexes
this._removeFromIndexes(currentObj);
// Remove existing keys from current object
for (i in currentObj) {
if (currentObj.hasOwnProperty(i)) {
delete currentObj[i];
}
}
// Add new keys to current object
for (i in newObj) {
if (newObj.hasOwnProperty(i)) {
currentObj[i] = newObj[i];
}
}
// Update the item in the primary index
if (!this._insertIntoIndexes(currentObj)) {
throw(this.logIdentifier() + ' Primary key violation in update! Key violated: ' + currentObj[this._primaryKey]);
}
// Update the object in the collection data
//this._data.splice(this._data.indexOf(currentObj), 1, newObj);
return this;
};
/**
* Helper method to update a document from it's id.
* @param {String} id The id of the document.
* @param {Object} update The object containing the key/values to update to.
* @returns {Object} The document that was updated or undefined
* if no document was updated.
*/
Collection.prototype.updateById = function (id, update) {
var searchObj = {};
searchObj[this._primaryKey] = id;
return this.update(searchObj, update)[0];
};
/**
* Internal method for document updating.
* @param {Object} doc The document to update.
* @param {Object} update The object with key/value pairs to update the document with.
* @param {Object} query The query object that we need to match to perform an update.
* @param {Object} options An options object.
* @param {String} path The current recursive path.
* @param {String} opType The type of update operation to perform, if none is specified
* default is to set new data against matching fields.
* @returns {Boolean} True if the document was updated with new / changed data or
* false if it was not updated because the data was the same.
* @private
*/
Collection.prototype.updateObject = function (doc, update, query, options, path, opType) {
// TODO: This method is long, try to break it into smaller pieces
update = this.decouple(update);
// Clear leading dots from path
path = path || '';
if (path.substr(0, 1) === '.') { path = path.substr(1, path.length -1); }
//var oldDoc = this.decouple(doc),
var updated = false,
recurseUpdated = false,
operation,
tmpArray,
tmpIndex,
tmpCount,
tempIndex,
tempKey,
replaceObj,
pk,
pathInstance,
sourceIsArray,
updateIsArray,
i;
// Loop each key in the update object
for (i in update) {
if (update.hasOwnProperty(i)) {
// Reset operation flag
operation = false;
// Check if the property starts with a dollar (function)
if (i.substr(0, 1) === '$') {
// Check for commands
switch (i) {
case '$key':
case '$index':
case '$data':
case '$min':
case '$max':
// Ignore some operators
operation = true;
break;
case '$each':
operation = true;
// Loop over the array of updates and run each one
tmpCount = update.$each.length;
for (tmpIndex = 0; tmpIndex < tmpCount; tmpIndex++) {
recurseUpdated = this.updateObject(doc, update.$each[tmpIndex], query, options, path);
if (recurseUpdated) {
updated = true;
}
}
updated = updated || recurseUpdated;
break;
case '$replace':
operation = true;
replaceObj = update.$replace;
pk = this.primaryKey();
// Loop the existing item properties and compare with
// the replacement (never remove primary key)
for (tempKey in doc) {
if (doc.hasOwnProperty(tempKey) && tempKey !== pk) {
if (replaceObj[tempKey] === undefined) {
// The new document doesn't have this field, remove it from the doc
this._updateUnset(doc, tempKey);
updated = true;
}
}
}
// Loop the new item props and update the doc
for (tempKey in replaceObj) {
if (replaceObj.hasOwnProperty(tempKey) && tempKey !== pk) {
this._updateOverwrite(doc, tempKey, replaceObj[tempKey]);
updated = true;
}
}
break;
default:
operation = true;
// Now run the operation
recurseUpdated = this.updateObject(doc, update[i], query, options, path, i);
updated = updated || recurseUpdated;
break;
}
}
// Check if the key has a .$ at the end, denoting an array lookup
if (this._isPositionalKey(i)) {
operation = true;
// Modify i to be the name of the field
i = i.substr(0, i.length - 2);
pathInstance = new Path(path + '.' + i);
// Check if the key is an array and has items
if (doc[i] && doc[i] instanceof Array && doc[i].length) {
tmpArray = [];
// Loop the array and find matches to our search
for (tmpIndex = 0; tmpIndex < doc[i].length; tmpIndex++) {
if (this._match(doc[i][tmpIndex], pathInstance.value(query)[0], options, '', {})) {
tmpArray.push(tmpIndex);
}
}
// Loop the items that matched and update them
for (tmpIndex = 0; tmpIndex < tmpArray.length; tmpIndex++) {
recurseUpdated = this.updateObject(doc[i][tmpArray[tmpIndex]], update[i + '.$'], query, options, path + '.' + i, opType);
updated = updated || recurseUpdated;
}
}
}
if (!operation) {
if (!opType && typeof(update[i]) === 'object') {
if (doc[i] !== null && typeof(doc[i]) === 'object') {
// Check if we are dealing with arrays
sourceIsArray = doc[i] instanceof Array;
updateIsArray = update[i] instanceof Array;
if (sourceIsArray || updateIsArray) {
// Check if the update is an object and the doc is an array
if (!updateIsArray && sourceIsArray) {
// Update is an object, source is an array so match the array items
// with our query object to find the one to update inside this array
// Loop the array and find matches to our search
for (tmpIndex = 0; tmpIndex < doc[i].length; tmpIndex++) {
recurseUpdated = this.updateObject(doc[i][tmpIndex], update[i], query, options, path + '.' + i, opType);
updated = updated || recurseUpdated;
}
} else {
// Either both source and update are arrays or the update is
// an array and the source is not, so set source to update
if (doc[i] !== update[i]) {
this._updateProperty(doc, i, update[i]);
updated = true;
}
}
} else {
// The doc key is an object so traverse the
// update further
recurseUpdated = this.updateObject(doc[i], update[i], query, options, path + '.' + i, opType);
updated = updated || recurseUpdated;
}
} else {
if (doc[i] !== update[i]) {
this._updateProperty(doc, i, update[i]);
updated = true;
}
}
} else {
switch (opType) {
case '$inc':
var doUpdate = true;
// Check for a $min / $max operator
if (update[i] > 0) {
if (update.$max) {
// Check current value
if (doc[i] >= update.$max) {
// Don't update
doUpdate = false;
}
}
} else if (update[i] < 0) {
if (update.$min) {
// Check current value
if (doc[i] <= update.$min) {
// Don't update
doUpdate = false;
}
}
}
if (doUpdate) {
this._updateIncrement(doc, i, update[i]);
updated = true;
}
break;
case '$cast':
// Casts a property to the type specified if it is not already
// that type. If the cast is an array or an object and the property
// is not already that type a new array or object is created and
// set to the property, overwriting the previous value
switch (update[i]) {
case 'array':
if (!(doc[i] instanceof Array)) {
// Cast to an array
this._updateProperty(doc, i, update.$data || []);
updated = true;
}
break;
case 'object':
if (!(doc[i] instanceof Object) || (doc[i] instanceof Array)) {
// Cast to an object
this._updateProperty(doc, i, update.$data || {});
updated = true;
}
break;
case 'number':
if (typeof doc[i] !== 'number') {
// Cast to a number
this._updateProperty(doc, i, Number(doc[i]));
updated = true;
}
break;
case 'string':
if (typeof doc[i] !== 'string') {
// Cast to a string
this._updateProperty(doc, i, String(doc[i]));
updated = true;
}
break;
default:
throw(this.logIdentifier() + ' Cannot update cast to unknown type: ' + update[i]);
}
break;
case '$push':
// Check if the target key is undefined and if so, create an array
if (doc[i] === undefined) {
// Initialise a new array
this._updateProperty(doc, i, []);
}
// Check that the target key is an array
if (doc[i] instanceof Array) {
// Check for a $position modifier with an $each
if (update[i].$position !== undefined && update[i].$each instanceof Array) {
// Grab the position to insert at
tempIndex = update[i].$position;
// Loop the each array and push each item
tmpCount = update[i].$each.length;
for (tmpIndex = 0; tmpIndex < tmpCount; tmpIndex++) {
this._updateSplicePush(doc[i], tempIndex + tmpIndex, update[i].$each[tmpIndex]);
}
} else if (update[i].$each instanceof Array) {
// Do a loop over the each to push multiple items
tmpCount = update[i].$each.length;
for (tmpIndex = 0; tmpIndex < tmpCount; tmpIndex++) {
this._updatePush(doc[i], update[i].$each[tmpIndex]);
}
} else {
// Do a standard push
this._updatePush(doc[i], update[i]);
}
updated = true;
} else {
throw(this.logIdentifier() + ' Cannot push to a key that is not an array! (' + i + ')');
}
break;
case '$pull':
if (doc[i] instanceof Array) {
tmpArray = [];
// Loop the array and find matches to our search
for (tmpIndex = 0; tmpIndex < doc[i].length; tmpIndex++) {
if (this._match(doc[i][tmpIndex], update[i], options, '', {})) {
tmpArray.push(tmpIndex);
}
}
tmpCount = tmpArray.length;
// Now loop the pull array and remove items to be pulled
while (tmpCount--) {
this._updatePull(doc[i], tmpArray[tmpCount]);
updated = true;
}
}
break;
case '$pullAll':
if (doc[i] instanceof Array) {
if (update[i] instanceof Array) {
tmpArray = doc[i];
tmpCount = tmpArray.length;
if (tmpCount > 0) {
// Now loop the pull array and remove items to be pulled
while (tmpCount--) {
for (tempIndex = 0; tempIndex < update[i].length; tempIndex++) {
if (tmpArray[tmpCount] === update[i][tempIndex]) {
this._updatePull(doc[i], tmpCount);
tmpCount--;
updated = true;
}
}
if (tmpCount < 0) {
break;
}
}
}
} else {
throw(this.logIdentifier() + ' Cannot pullAll without being given an array of values to pull! (' + i + ')');
}
}
break;
case '$addToSet':
// Check if the target key is undefined and if so, create an array
if (doc[i] === undefined) {
// Initialise a new array
this._updateProperty(doc, i, []);
}
// Check that the target key is an array
if (doc[i] instanceof Array) {
// Loop the target array and check for existence of item
var targetArr = doc[i],
targetArrIndex,
targetArrCount = targetArr.length,
objHash,
addObj = true,
optionObj = (options && options.$addToSet),
hashMode,
pathSolver;
// Check if we have an options object for our operation
if (update[i].$key) {
hashMode = false;
pathSolver = new Path(update[i].$key);
objHash = pathSolver.value(update[i])[0];
// Remove the key from the object before we add it
delete update[i].$key;
} else if (optionObj && optionObj.key) {
hashMode = false;
pathSolver = new Path(optionObj.key);
objHash = pathSolver.value(update[i])[0];
} else {
objHash = this.jStringify(update[i]);
hashMode = true;
}
for (targetArrIndex = 0; targetArrIndex < targetArrCount; targetArrIndex++) {
if (hashMode) {
// Check if objects match via a string hash (JSON)
if (this.jStringify(targetArr[targetArrIndex]) === objHash) {
// The object already exists, don't add it
addObj = false;
break;
}
} else {
// Check if objects match based on the path
if (objHash === pathSolver.value(targetArr[targetArrIndex])[0]) {
// The object already exists, don't add it
addObj = false;
break;
}
}
}
if (addObj) {
this._updatePush(doc[i], update[i]);
updated = true;
}
} else {
throw(this.logIdentifier() + ' Cannot addToSet on a key that is not an array! (' + i + ')');
}
break;
case '$splicePush':
// Check if the target key is undefined and if so, create an array
if (doc[i] === undefined) {
// Initialise a new array
this._updateProperty(doc, i, []);
}
// Check that the target key is an array
if (doc[i] instanceof Array) {
tempIndex = update.$index;
if (tempIndex !== undefined) {
delete update.$index;
// Check for out of bounds index
if (tempIndex > doc[i].length) {
tempIndex = doc[i].length;
}
this._updateSplicePush(doc[i], tempIndex, update[i]);
updated = true;
} else {
throw(this.logIdentifier() + ' Cannot splicePush without a $index integer value!');
}
} else {
throw(this.logIdentifier() + ' Cannot splicePush with a key that is not an array! (' + i + ')');
}
break;
case '$move':
if (doc[i] instanceof Array) {
// Loop the array and find matches to our search
for (tmpIndex = 0; tmpIndex < doc[i].length; tmpIndex++) {
if (this._match(doc[i][tmpIndex], update[i], options, '', {})) {
var moveToIndex = update.$index;
if (moveToIndex !== undefined) {
delete update.$index;
this._updateSpliceMove(doc[i], tmpIndex, moveToIndex);
updated = true;
} else {
throw(this.logIdentifier() + ' Cannot move without a $index integer value!');
}
break;
}
}
} else {
throw(this.logIdentifier() + ' Cannot move on a key that is not an array! (' + i + ')');
}
break;
case '$mul':
this._updateMultiply(doc, i, update[i]);
updated = true;
break;
case '$rename':
this._updateRename(doc, i, update[i]);
updated = true;
break;
case '$overwrite':
this._updateOverwrite(doc, i, update[i]);
updated = true;
break;
case '$unset':
this._updateUnset(doc, i);
updated = true;
break;
case '$clear':
this._updateClear(doc, i);
updated = true;
break;
case '$pop':
if (doc[i] instanceof Array) {
if (this._updatePop(doc[i], update[i])) {
updated = true;
}
} else {
throw(this.logIdentifier() + ' Cannot pop from a key that is not an array! (' + i + ')');
}
break;
case '$toggle':
// Toggle the boolean property between true and false
this._updateProperty(doc, i, !doc[i]);
updated = true;
break;
default:
if (doc[i] !== update[i]) {
this._updateProperty(doc, i, update[i]);
updated = true;
}
break;
}
}
}
}
}
return updated;
};
/**
* Determines if the passed key has an array positional mark (a dollar at the end
* of its name).
* @param {String} key The key to check.
* @returns {Boolean} True if it is a positional or false if not.
* @private
*/
Collection.prototype._isPositionalKey = function (key) {
return key.substr(key.length - 2, 2) === '.$';
};
/**
* Removes any documents from the collection that match the search query
* key/values.
* @param {Object} query The query object.
* @param {Object=} options An options object.
* @param {Function=} callback A callback method.
* @returns {Array} An array of the documents that were removed.
*/
Collection.prototype.remove = function (query, options, callback) {
if (this.isDropped()) {
throw(this.logIdentifier() + ' Cannot operate in a dropped state!');
}
var self = this,
dataSet,
index,
arrIndex,
returnArr,
removeMethod,
triggerOperation,
doc,
newDoc;
if (typeof(options) === 'function') {
callback = options;
options = {};
}
// Convert queries from mongo dot notation to forerunner queries
if (this.mongoEmulation()) {
this.convertToFdb(query);
}
if (query instanceof Array) {
returnArr = [];
for (arrIndex = 0; arrIndex < query.length; arrIndex++) {
returnArr.push(this.remove(query[arrIndex], {noEmit: true}));
}
if (!options || (options && !options.noEmit)) {
this._onRemove(returnArr);
}
if (callback) { callback.call(this, false, returnArr); }
return returnArr;
} else {
returnArr = [];
dataSet = this.find(query, {$decouple: false});
if (dataSet.length) {
removeMethod = function (dataItem) {
// Remove the item from the collection's indexes
self._removeFromIndexes(dataItem);
// Remove data from internal stores
index = self._data.indexOf(dataItem);
self._dataRemoveAtIndex(index);
returnArr.push(dataItem);
};
// Remove the data from the collection
for (var i = 0; i < dataSet.length; i++) {
doc = dataSet[i];
if (self.willTrigger(self.TYPE_REMOVE, self.PHASE_BEFORE) || self.willTrigger(self.TYPE_REMOVE, self.PHASE_AFTER)) {
triggerOperation = {
type: 'remove'
};
newDoc = self.decouple(doc);
if (self.processTrigger(triggerOperation, self.TYPE_REMOVE, self.PHASE_BEFORE, newDoc, newDoc) !== false) {
// The trigger didn't ask to cancel so execute the removal method
removeMethod(doc);
self.processTrigger(triggerOperation, self.TYPE_REMOVE, self.PHASE_AFTER, newDoc, newDoc);
}
} else {
// No triggers to execute
removeMethod(doc);
}
}
if (returnArr.length) {
//op.time('Resolve chains');
self.chainSend('remove', {
query: query,
dataSet: returnArr
}, options);
//op.time('Resolve chains');
if (!options || (options && !options.noEmit)) {
this._onRemove(returnArr);
}
this._onChange();
this.emit('immediateChange', {type: 'remove', data: returnArr});
this.deferEmit('change', {type: 'remove', data: returnArr});
}
}
if (callback) { callback.call(this, false, returnArr); }
return returnArr;
}
};
/**
* Helper method that removes a document that matches the given id.
* @param {String} id The id of the document to remove.
* @returns {Object} The document that was removed or undefined if
* nothing was removed.
*/
Collection.prototype.removeById = function (id) {
var searchObj = {};
searchObj[this._primaryKey] = id;
return this.remove(searchObj)[0];
};
/**
* Processes a deferred action queue.
* @param {String} type The queue name to process.
* @param {Function} callback A method to call when the queue has processed.
* @param {Object=} resultObj A temp object to hold results in.
*/
Collection.prototype.processQueue = function (type, callback, resultObj) {
var self = this,
queue = this._deferQueue[type],
deferThreshold = this._deferThreshold[type],
deferTime = this._deferTime[type],
dataArr,
result;
resultObj = resultObj || {
deferred: true
};
if (queue.length) {
// Process items up to the threshold
if (queue.length > deferThreshold) {
// Grab items up to the threshold value
dataArr = queue.splice(0, deferThreshold);
} else {
// Grab all the remaining items
dataArr = queue.splice(0, queue.length);
}
result = self[type](dataArr);
switch (type) {
case 'insert':
resultObj.inserted = resultObj.inserted || [];
resultObj.failed = resultObj.failed || [];
resultObj.inserted = resultObj.inserted.concat(result.inserted);
resultObj.failed = resultObj.failed.concat(result.failed);
break;
}
// Queue another process
setTimeout(function () {
self.processQueue.call(self, type, callback, resultObj);
}, deferTime);
} else {
if (callback) { callback.call(this, resultObj); }
this._asyncComplete(type);
}
// Check if all queues are complete
if (!this.isProcessingQueue()) {
this.deferEmit('queuesComplete');
}
};
/**
* Checks if any CRUD operations have been deferred and are still waiting to
* be processed.
* @returns {Boolean} True if there are still deferred CRUD operations to process
* or false if all queues are clear.
*/
Collection.prototype.isProcessingQueue = function () {
var i;
for (i in this._deferQueue) {
if (this._deferQueue.hasOwnProperty(i)) {
if (this._deferQueue[i].length) {
return true;
}
}
}
return false;
};
/**
* Inserts a document or array of documents into the collection.
* @param {Object|Array} data Either a document object or array of document
* @param {Number=} index Optional index to insert the record at.
* @param {Collection~insertCallback=} callback Optional callback called
* once the insert is complete.
*/
Collection.prototype.insert = function (data, index, callback) {
if (this.isDropped()) {
throw(this.logIdentifier() + ' Cannot operate in a dropped state!');
}
if (typeof(index) === 'function') {
callback = index;
index = this._data.length;
} else if (index === undefined) {
index = this._data.length;
}
data = this.transformIn(data);
return this._insertHandle(data, index, callback);
};
/**
* The insert operation's callback.
* @callback Collection~insertCallback
* @param {Object} result The result object will contain two arrays (inserted
* and failed) which represent the documents that did get inserted and those
* that didn't for some reason (usually index violation). Failed items also
* contain a reason. Inspect the failed array for further information.
*
* A third field called "deferred" is a boolean value to indicate if the
* insert operation was deferred across more than one CPU cycle (to avoid
* blocking the main thread).
*/
/**
* Inserts a document or array of documents into the collection.
* @param {Object|Array} data Either a document object or array of document
* @param {Number=} index Optional index to insert the record at.
* @param {Collection~insertCallback=} callback Optional callback called
* once the insert is complete.
*/
Collection.prototype._insertHandle = function (data, index, callback) {
var //self = this,
queue = this._deferQueue.insert,
deferThreshold = this._deferThreshold.insert,
//deferTime = this._deferTime.insert,
inserted = [],
failed = [],
insertResult,
resultObj,
i;
if (data instanceof Array) {
// Check if there are more insert items than the insert defer
// threshold, if so, break up inserts so we don't tie up the
// ui or thread
if (this._deferredCalls && data.length > deferThreshold) {
// Break up insert into blocks
this._deferQueue.insert = queue.concat(data);
this._asyncPending('insert');
// Fire off the insert queue handler
this.processQueue('insert', callback);
return;
} else {
// Loop the array and add items
for (i = 0; i < data.length; i++) {
insertResult = this._insert(data[i], index + i);
if (insertResult === true) {
inserted.push(data[i]);
} else {
failed.push({
doc: data[i],
reason: insertResult
});
}
}
}
} else {
// Store the data item
insertResult = this._insert(data, index);
if (insertResult === true) {
inserted.push(data);
} else {
failed.push({
doc: data,
reason: insertResult
});
}
}
resultObj = {
deferred: false,
inserted: inserted,
failed: failed
};
this._onInsert(inserted, failed);
if (callback) { callback.call(this, resultObj); }
this._onChange();
this.emit('immediateChange', {type: 'insert', data: inserted});
this.deferEmit('change', {type: 'insert', data: inserted});
return resultObj;
};
/**
* Internal method to insert a document into the collection. Will
* check for index violations before allowing the document to be inserted.
* @param {Object} doc The document to insert after passing index violation
* tests.
* @param {Number=} index Optional index to insert the document at.
* @returns {Boolean|Object} True on success, false if no document passed,
* or an object containing details about an index violation if one occurred.
* @private
*/
Collection.prototype._insert = function (doc, index) {
if (doc) {
var self = this,
indexViolation,
triggerOperation,
insertMethod,
newDoc,
capped = this.capped(),
cappedSize = this.cappedSize();
this.ensurePrimaryKey(doc);
// Check indexes are not going to be broken by the document
indexViolation = this.insertIndexViolation(doc);
insertMethod = function (doc) {
// Add the item to the collection's indexes
self._insertIntoIndexes(doc);
// Check index overflow
if (index > self._data.length) {
index = self._data.length;
}
// Insert the document
self._dataInsertAtIndex(index, doc);
// Check capped collection status and remove first record
// if we are over the threshold
if (capped && self._data.length > cappedSize) {
// Remove the first item in the data array
self.removeById(self._data[0][self._primaryKey]);
}
//op.time('Resolve chains');
if (self.chainWillSend()) {
self.chainSend('insert', {
dataSet: self.decouple([doc])
}, {
index: index
});
}
//op.time('Resolve chains');
};
if (!indexViolation) {
if (self.willTrigger(self.TYPE_INSERT, self.PHASE_BEFORE) || self.willTrigger(self.TYPE_INSERT, self.PHASE_AFTER)) {
triggerOperation = {
type: 'insert'
};
if (self.processTrigger(triggerOperation, self.TYPE_INSERT, self.PHASE_BEFORE, {}, doc) !== false) {
insertMethod(doc);
if (self.willTrigger(self.TYPE_INSERT, self.PHASE_AFTER)) {
// Clone the doc so that the programmer cannot update the internal document
// on the "after" phase trigger
newDoc = self.decouple(doc);
self.processTrigger(triggerOperation, self.TYPE_INSERT, self.PHASE_AFTER, {}, newDoc);
}
} else {
// The trigger just wants to cancel the operation
return 'Trigger cancelled operation';
}
} else {
// No triggers to execute
insertMethod(doc);
}
return true;
} else {
return 'Index violation in index: ' + indexViolation;
}
}
return 'No document passed to insert';
};
/**
* Inserts a document into the internal collection data array at
* Inserts a document into the internal collection data array at
* the specified index.
* @param {number} index The index to insert at.
* @param {object} doc The document to insert.
* @private
*/
Collection.prototype._dataInsertAtIndex = function (index, doc) {
this._data.splice(index, 0, doc);
};
/**
* Removes a document from the internal collection data array at
* the specified index.
* @param {number} index The index to remove from.
* @private
*/
Collection.prototype._dataRemoveAtIndex = function (index) {
this._data.splice(index, 1);
};
/**
* Replaces all data in the collection's internal data array with
* the passed array of data.
* @param {array} data The array of data to replace existing data with.
* @private
*/
Collection.prototype._dataReplace = function (data) {
// Clear the array - using a while loop with pop is by far the
// fastest way to clear an array currently
while (this._data.length) {
this._data.pop();
}
// Append new items to the array
this._data = this._data.concat(data);
};
/**
* Inserts a document into the collection indexes.
* @param {Object} doc The document to insert.
* @private
*/
Collection.prototype._insertIntoIndexes = function (doc) {
var arr = this._indexByName,
arrIndex,
violated,
hash = this.hash(doc),
pk = this._primaryKey;
// Insert to primary key index
violated = this._primaryIndex.uniqueSet(doc[pk], doc);
this._primaryCrc.uniqueSet(doc[pk], hash);
this._crcLookup.uniqueSet(hash, doc);
// Insert into other indexes
for (arrIndex in arr) {
if (arr.hasOwnProperty(arrIndex)) {
arr[arrIndex].insert(doc);
}
}
return violated;
};
/**
* Removes a document from the collection indexes.
* @param {Object} doc The document to remove.
* @private
*/
Collection.prototype._removeFromIndexes = function (doc) {
var arr = this._indexByName,
arrIndex,
hash = this.hash(doc),
pk = this._primaryKey;
// Remove from primary key index
this._primaryIndex.unSet(doc[pk]);
this._primaryCrc.unSet(doc[pk]);
this._crcLookup.unSet(hash);
// Remove from other indexes
for (arrIndex in arr) {
if (arr.hasOwnProperty(arrIndex)) {
arr[arrIndex].remove(doc);
}
}
};
/**
* Updates collection index data for the passed document.
* @param {Object} oldDoc The old document as it was before the update.
* @param {Object} newDoc The document as it now is after the update.
* @private
*/
Collection.prototype._updateIndexes = function (oldDoc, newDoc) {
this._removeFromIndexes(oldDoc);
this._insertIntoIndexes(newDoc);
};
/**
* Rebuild collection indexes.
* @private
*/
Collection.prototype._rebuildIndexes = function () {
var arr = this._indexByName,
arrIndex;
// Remove from other indexes
for (arrIndex in arr) {
if (arr.hasOwnProperty(arrIndex)) {
arr[arrIndex].rebuild();
}
}
};
/**
* Uses the passed query to generate a new collection with results
* matching the query parameters.
*
* @param {Object} query The query object to generate the subset with.
* @param {Object=} options An options object.
* @returns {*}
*/
Collection.prototype.subset = function (query, options) {
var result = this.find(query, options),
coll;
coll = new Collection();
coll.db(this._db);
coll.subsetOf(this)
.primaryKey(this._primaryKey)
.setData(result);
return coll;
};
/**
* Gets / sets the collection that this collection is a subset of.
* @param {Collection=} collection The collection to set as the parent of this subset.
* @returns {Collection}
*/
Shared.synthesize(Collection.prototype, 'subsetOf');
/**
* Checks if the collection is a subset of the passed collection.
* @param {Collection} collection The collection to test against.
* @returns {Boolean} True if the passed collection is the parent of
* the current collection.
*/
Collection.prototype.isSubsetOf = function (collection) {
return this._subsetOf === collection;
};
/**
* Find the distinct values for a specified field across a single collection and
* returns the results in an array.
* @param {String} key The field path to return distinct values for e.g. "person.name".
* @param {Object=} query The query to use to filter the documents used to return values from.
* @param {Object=} options The query options to use when running the query.
* @returns {Array}
*/
Collection.prototype.distinct = function (key, query, options) {
if (this.isDropped()) {
throw(this.logIdentifier() + ' Cannot operate in a dropped state!');
}
var data = this.find(query, options),
pathSolver = new Path(key),
valueUsed = {},
distinctValues = [],
value,
i;
// Loop the data and build array of distinct values
for (i = 0; i < data.length; i++) {
value = pathSolver.value(data[i])[0];
if (value && !valueUsed[value]) {
valueUsed[value] = true;
distinctValues.push(value);
}
}
return distinctValues;
};
/**
* Helper method to find a document by it's id.
* @param {String} id The id of the document.
* @param {Object=} options The options object, allowed keys are sort and limit.
* @returns {Array} The items that were updated.
*/
Collection.prototype.findById = function (id, options) {
var searchObj = {};
searchObj[this._primaryKey] = id;
return this.find(searchObj, options)[0];
};
/**
* Finds all documents that contain the passed string or search object
* regardless of where the string might occur within the document. This
* will match strings from the start, middle or end of the document's
* string (partial match).
* @param search The string to search for. Case sensitive.
* @param options A standard find() options object.
* @returns {Array} An array of documents that matched the search string.
*/
Collection.prototype.peek = function (search, options) {
// Loop all items
var arr = this._data,
arrCount = arr.length,
arrIndex,
arrItem,
tempColl = new Collection(),
typeOfSearch = typeof search;
if (typeOfSearch === 'string') {
for (arrIndex = 0; arrIndex < arrCount; arrIndex++) {
// Get json representation of object
arrItem = this.jStringify(arr[arrIndex]);
// Check if string exists in object json
if (arrItem.indexOf(search) > -1) {
// Add this item to the temp collection
tempColl.insert(arr[arrIndex]);
}
}
return tempColl.find({}, options);
} else {
return this.find(search, options);
}
};
/**
* Provides a query plan / operations log for a query.
* @param {Object} query The query to execute.
* @param {Object=} options Optional options object.
* @returns {Object} The query plan.
*/
Collection.prototype.explain = function (query, options) {
var result = this.find(query, options);
return result.__fdbOp._data;
};
/**
* Generates an options object with default values or adds default
* values to a passed object if those values are not currently set
* to anything.
* @param {object=} obj Optional options object to modify.
* @returns {object} The options object.
*/
Collection.prototype.options = function (obj) {
obj = obj || {};
obj.$decouple = obj.$decouple !== undefined ? obj.$decouple : true;
obj.$explain = obj.$explain !== undefined ? obj.$explain : false;
return obj;
};
/**
* Queries the collection based on the query object passed.
* @param {Object} query The query key/values that a document must match in
* order for it to be returned in the result array.
* @param {Object=} options An optional options object.
* @param {Function=} callback !! DO NOT USE, THIS IS NON-OPERATIONAL !!
* Optional callback. If specified the find process
* will not return a value and will assume that you wish to operate under an
* async mode. This will break up large find requests into smaller chunks and
* process them in a non-blocking fashion allowing large datasets to be queried
* without causing the browser UI to pause. Results from this type of operation
* will be passed back to the callback once completed.
*
* @returns {Array} The results array from the find operation, containing all
* documents that matched the query.
*/
Collection.prototype.find = function (query, options, callback) {
// Convert queries from mongo dot notation to forerunner queries
if (this.mongoEmulation()) {
this.convertToFdb(query);
}
if (callback) {
// Check the size of the collection's data array
// Split operation into smaller tasks and callback when complete
callback.call(this, 'Callbacks for the find() operation are not yet implemented!', []);
return [];
}
return this._find.call(this, query, options, callback);
};
Collection.prototype._find = function (query, options) {
if (this.isDropped()) {
throw(this.logIdentifier() + ' Cannot operate in a dropped state!');
}
// TODO: This method is quite long, break into smaller pieces
query = query || {};
var op = this._metrics.create('find'),
pk = this.primaryKey(),
self = this,
analysis,
scanLength,
requiresTableScan = true,
resultArr,
joinIndex,
joinSource = {},
joinQuery,
joinPath,
joinSourceKey,
joinSourceType,
joinSourceIdentifier,
joinSourceData,
resultRemove = [],
i, j, k,
fieldListOn = [],
fieldListOff = [],
elemMatchPathSolver,
elemMatchSubArr,
elemMatchSpliceArr,
matcherTmpOptions = {},
result,
cursor = {},
pathSolver,
waterfallCollection,
matcher;
if (!(options instanceof Array)) {
options = this.options(options);
}
matcher = function (doc) {
return self._match(doc, query, options, 'and', matcherTmpOptions);
};
op.start();
if (query) {
// Check if the query is an array (multi-operation waterfall query)
if (query instanceof Array) {
waterfallCollection = this;
// Loop the query operations
for (i = 0; i < query.length; i++) {
// Execute each operation and pass the result into the next
// query operation
waterfallCollection = waterfallCollection.subset(query[i], options && options[i] ? options[i] : {});
}
return waterfallCollection.find();
}
// Pre-process any data-changing query operators first
if (query.$findSub) {
// Check we have all the parts we need
if (!query.$findSub.$path) {
throw('$findSub missing $path property!');
}
return this.findSub(
query.$findSub.$query,
query.$findSub.$path,
query.$findSub.$subQuery,
query.$findSub.$subOptions
);
}
if (query.$findSubOne) {
// Check we have all the parts we need
if (!query.$findSubOne.$path) {
throw('$findSubOne missing $path property!');
}
return this.findSubOne(
query.$findSubOne.$query,
query.$findSubOne.$path,
query.$findSubOne.$subQuery,
query.$findSubOne.$subOptions
);
}
// Get query analysis to execute best optimised code path
op.time('analyseQuery');
analysis = this._analyseQuery(self.decouple(query), options, op);
op.time('analyseQuery');
op.data('analysis', analysis);
// Check if the query tries to limit by data that would only exist after
// the join operation has been completed
if (analysis.hasJoin && analysis.queriesJoin) {
// The query has a join and tries to limit by it's joined data
// Get references to the join sources
op.time('joinReferences');
for (joinIndex = 0; joinIndex < analysis.joinsOn.length; joinIndex++) {
joinSourceData = analysis.joinsOn[joinIndex];
joinSourceKey = joinSourceData.key;
joinSourceType = joinSourceData.type;
joinSourceIdentifier = joinSourceData.id;
joinPath = new Path(analysis.joinQueries[joinSourceKey]);
joinQuery = joinPath.value(query)[0];
joinSource[joinSourceIdentifier] = this._db[joinSourceType](joinSourceKey).subset(joinQuery);
// Remove join clause from main query
delete query[analysis.joinQueries[joinSourceKey]];
}
op.time('joinReferences');
}
// Check if an index lookup can be used to return this result
if (analysis.indexMatch.length && (!options || (options && !options.$skipIndex))) {
op.data('index.potential', analysis.indexMatch);
op.data('index.used', analysis.indexMatch[0].index);
// Get the data from the index
op.time('indexLookup');
resultArr = analysis.indexMatch[0].lookup || [];
op.time('indexLookup');
// Check if the index coverage is all keys, if not we still need to table scan it
if (analysis.indexMatch[0].keyData.totalKeyCount === analysis.indexMatch[0].keyData.score) {
// Don't require a table scan to find relevant documents
requiresTableScan = false;
}
} else {
op.flag('usedIndex', false);
}
if (requiresTableScan) {
if (resultArr && resultArr.length) {
scanLength = resultArr.length;
op.time('tableScan: ' + scanLength);
// Filter the source data and return the result
resultArr = resultArr.filter(matcher);
} else {
// Filter the source data and return the result
scanLength = this._data.length;
op.time('tableScan: ' + scanLength);
resultArr = this._data.filter(matcher);
}
op.time('tableScan: ' + scanLength);
}
// Order the array if we were passed a sort clause
if (options.$orderBy) {
op.time('sort');
resultArr = this.sort(options.$orderBy, resultArr);
op.time('sort');
}
if (options.$page !== undefined && options.$limit !== undefined) {
// Record paging data
cursor.page = options.$page;
cursor.pages = Math.ceil(resultArr.length / options.$limit);
cursor.records = resultArr.length;
// Check if we actually need to apply the paging logic
if (options.$page && options.$limit > 0) {
op.data('cursor', cursor);
// Skip to the page specified based on limit
resultArr.splice(0, options.$page * options.$limit);
}
}
if (options.$skip) {
cursor.skip = options.$skip;
// Skip past the number of records specified
resultArr.splice(0, options.$skip);
op.data('skip', options.$skip);
}
if (options.$limit && resultArr && resultArr.length > options.$limit) {
cursor.limit = options.$limit;
resultArr.length = options.$limit;
op.data('limit', options.$limit);
}
if (options.$decouple) {
// Now decouple the data from the original objects
op.time('decouple');
resultArr = this.decouple(resultArr);
op.time('decouple');
op.data('flag.decouple', true);
}
// Now process any joins on the final data
if (options.$join) {
resultRemove = resultRemove.concat(this.applyJoin(resultArr, options.$join, joinSource));
op.data('flag.join', true);
}
// Process removal queue
if (resultRemove.length) {
op.time('removalQueue');
this.spliceArrayByIndexList(resultArr, resultRemove);
op.time('removalQueue');
}
if (options.$transform) {
op.time('transform');
for (i = 0; i < resultArr.length; i++) {
resultArr.splice(i, 1, options.$transform(resultArr[i]));
}
op.time('transform');
op.data('flag.transform', true);
}
// Process transforms
if (this._transformEnabled && this._transformOut) {
op.time('transformOut');
resultArr = this.transformOut(resultArr);
op.time('transformOut');
}
op.data('results', resultArr.length);
} else {
resultArr = [];
}
// Check for an $as operator in the options object and if it exists
// iterate over the fields and generate a rename function that will
// operate over the entire returned data array and rename each object's
// fields to their new names
// TODO: Enable $as in collection find to allow renaming fields
/*if (options.$as) {
renameFieldPath = new Path();
renameFieldMethod = function (obj, oldFieldPath, newFieldName) {
renameFieldPath.path(oldFieldPath);
renameFieldPath.rename(newFieldName);
};
for (i in options.$as) {
if (options.$as.hasOwnProperty(i)) {
}
}
}*/
if (!options.$aggregate) {
// Generate a list of fields to limit data by
// Each property starts off being enabled by default (= 1) then
// if any property is explicitly specified as 1 then all switch to
// zero except _id.
//
// Any that are explicitly set to zero are switched off.
op.time('scanFields');
for (i in options) {
if (options.hasOwnProperty(i) && i.indexOf('$') !== 0) {
if (options[i] === 1) {
fieldListOn.push(i);
} else if (options[i] === 0) {
fieldListOff.push(i);
}
}
}
op.time('scanFields');
// Limit returned fields by the options data
if (fieldListOn.length || fieldListOff.length) {
op.data('flag.limitFields', true);
op.data('limitFields.on', fieldListOn);
op.data('limitFields.off', fieldListOff);
op.time('limitFields');
// We have explicit fields switched on or off
for (i = 0; i < resultArr.length; i++) {
result = resultArr[i];
for (j in result) {
if (result.hasOwnProperty(j)) {
if (fieldListOn.length) {
// We have explicit fields switched on so remove all fields
// that are not explicitly switched on
// Check if the field name is not the primary key
if (j !== pk) {
if (fieldListOn.indexOf(j) === -1) {
// This field is not in the on list, remove it
delete result[j];
}
}
}
if (fieldListOff.length) {
// We have explicit fields switched off so remove fields
// that are explicitly switched off
if (fieldListOff.indexOf(j) > -1) {
// This field is in the off list, remove it
delete result[j];
}
}
}
}
}
op.time('limitFields');
}
// Now run any projections on the data required
if (options.$elemMatch) {
op.data('flag.elemMatch', true);
op.time('projection-elemMatch');
for (i in options.$elemMatch) {
if (options.$elemMatch.hasOwnProperty(i)) {
elemMatchPathSolver = new Path(i);
// Loop the results array
for (j = 0; j < resultArr.length; j++) {
elemMatchSubArr = elemMatchPathSolver.value(resultArr[j])[0];
// Check we have a sub-array to loop
if (elemMatchSubArr && elemMatchSubArr.length) {
// Loop the sub-array and check for projection query matches
for (k = 0; k < elemMatchSubArr.length; k++) {
// Check if the current item in the sub-array matches the projection query
if (self._match(elemMatchSubArr[k], options.$elemMatch[i], options, '', {})) {
// The item matches the projection query so set the sub-array
// to an array that ONLY contains the matching item and then
// exit the loop since we only want to match the first item
elemMatchPathSolver.set(resultArr[j], i, [elemMatchSubArr[k]]);
break;
}
}
}
}
}
}
op.time('projection-elemMatch');
}
if (options.$elemsMatch) {
op.data('flag.elemsMatch', true);
op.time('projection-elemsMatch');
for (i in options.$elemsMatch) {
if (options.$elemsMatch.hasOwnProperty(i)) {
elemMatchPathSolver = new Path(i);
// Loop the results array
for (j = 0; j < resultArr.length; j++) {
elemMatchSubArr = elemMatchPathSolver.value(resultArr[j])[0];
// Check we have a sub-array to loop
if (elemMatchSubArr && elemMatchSubArr.length) {
elemMatchSpliceArr = [];
// Loop the sub-array and check for projection query matches
for (k = 0; k < elemMatchSubArr.length; k++) {
// Check if the current item in the sub-array matches the projection query
if (self._match(elemMatchSubArr[k], options.$elemsMatch[i], options, '', {})) {
// The item matches the projection query so add it to the final array
elemMatchSpliceArr.push(elemMatchSubArr[k]);
}
}
// Now set the final sub-array to the matched items
elemMatchPathSolver.set(resultArr[j], i, elemMatchSpliceArr);
}
}
}
}
op.time('projection-elemsMatch');
}
}
// Process aggregation
if (options.$aggregate) {
op.data('flag.aggregate', true);
op.time('aggregate');
pathSolver = new Path(options.$aggregate);
resultArr = pathSolver.value(resultArr);
op.time('aggregate');
}
// Now process any $groupBy clause
if (options.$groupBy) {
op.data('flag.group', true);
op.time('group');
resultArr = this.group(options.$groupBy, resultArr);
op.time('group');
}
op.stop();
resultArr.__fdbOp = op;
resultArr.$cursor = cursor;
return resultArr;
};
/**
* Returns one document that satisfies the specified query criteria. If multiple
* documents satisfy the query, this method returns the first document to match
* the query.
* @returns {*}
*/
Collection.prototype.findOne = function () {
return (this.find.apply(this, arguments))[0];
};
/**
* Gets the index in the collection data array of the first item matched by
* the passed query object.
* @param {Object} query The query to run to find the item to return the index of.
* @param {Object=} options An options object.
* @returns {Number}
*/
Collection.prototype.indexOf = function (query, options) {
var item = this.find(query, {$decouple: false})[0],
sortedData;
if (item) {
if (!options || options && !options.$orderBy) {
// Basic lookup from order of insert
return this._data.indexOf(item);
} else {
// Trying to locate index based on query with sort order
options.$decouple = false;
sortedData = this.find(query, options);
return sortedData.indexOf(item);
}
}
return -1;
};
/**
* Returns the index of the document identified by the passed item's primary key.
* @param {*} itemLookup The document whose primary key should be used to lookup
* or the id to lookup.
* @param {Object=} options An options object.
* @returns {Number} The index the item with the matching primary key is occupying.
*/
Collection.prototype.indexOfDocById = function (itemLookup, options) {
var item,
sortedData;
if (typeof itemLookup !== 'object') {
item = this._primaryIndex.get(itemLookup);
} else {
item = this._primaryIndex.get(itemLookup[this._primaryKey]);
}
if (item) {
if (!options || options && !options.$orderBy) {
// Basic lookup
return this._data.indexOf(item);
} else {
// Sorted lookup
options.$decouple = false;
sortedData = this.find({}, options);
return sortedData.indexOf(item);
}
}
return -1;
};
/**
* Removes a document from the collection by it's index in the collection's
* data array.
* @param {Number} index The index of the document to remove.
* @returns {Object} The document that has been removed or false if none was
* removed.
*/
Collection.prototype.removeByIndex = function (index) {
var doc,
docId;
doc = this._data[index];
if (doc !== undefined) {
doc = this.decouple(doc);
docId = doc[this.primaryKey()];
return this.removeById(docId);
}
return false;
};
/**
* Gets / sets the collection transform options.
* @param {Object} obj A collection transform options object.
* @returns {*}
*/
Collection.prototype.transform = function (obj) {
if (obj !== undefined) {
if (typeof obj === "object") {
if (obj.enabled !== undefined) {
this._transformEnabled = obj.enabled;
}
if (obj.dataIn !== undefined) {
this._transformIn = obj.dataIn;
}
if (obj.dataOut !== undefined) {
this._transformOut = obj.dataOut;
}
} else {
this._transformEnabled = obj !== false;
}
return this;
}
return {
enabled: this._transformEnabled,
dataIn: this._transformIn,
dataOut: this._transformOut
};
};
/**
* Transforms data using the set transformIn method.
* @param {Object} data The data to transform.
* @returns {*}
*/
Collection.prototype.transformIn = function (data) {
if (this._transformEnabled && this._transformIn) {
if (data instanceof Array) {
var finalArr = [],
transformResult,
i;
for (i = 0; i < data.length; i++) {
transformResult = this._transformIn(data[i]);
// Support transforms returning multiple items
if (transformResult instanceof Array) {
finalArr = finalArr.concat(transformResult);
} else {
finalArr.push(transformResult);
}
}
return finalArr;
} else {
return this._transformIn(data);
}
}
return data;
};
/**
* Transforms data using the set transformOut method.
* @param {Object} data The data to transform.
* @returns {*}
*/
Collection.prototype.transformOut = function (data) {
if (this._transformEnabled && this._transformOut) {
if (data instanceof Array) {
var finalArr = [],
transformResult,
i;
for (i = 0; i < data.length; i++) {
transformResult = this._transformOut(data[i]);
// Support transforms returning multiple items
if (transformResult instanceof Array) {
finalArr = finalArr.concat(transformResult);
} else {
finalArr.push(transformResult);
}
}
return finalArr;
} else {
return this._transformOut(data);
}
}
return data;
};
/**
* Sorts an array of documents by the given sort path.
* @param {*} sortObj The keys and orders the array objects should be sorted by.
* @param {Array} arr The array of documents to sort.
* @returns {Array}
*/
Collection.prototype.sort = function (sortObj, arr) {
// Convert the index object to an array of key val objects
var self = this,
keys = sharedPathSolver.parse(sortObj, true);
if (keys.length) {
// Execute sort
arr.sort(function (a, b) {
// Loop the index array
var i,
indexData,
result = 0;
for (i = 0; i < keys.length; i++) {
indexData = keys[i];
if (indexData.value === 1) {
result = self.sortAsc(sharedPathSolver.get(a, indexData.path), sharedPathSolver.get(b, indexData.path));
} else if (indexData.value === -1) {
result = self.sortDesc(sharedPathSolver.get(a, indexData.path), sharedPathSolver.get(b, indexData.path));
}
if (result !== 0) {
return result;
}
}
return result;
});
}
return arr;
};
/**
* Groups an array of documents into multiple array fields, named by the value
* of the given group path.
* @param {*} groupObj The key path the array objects should be grouped by.
* @param {Array} arr The array of documents to group.
* @returns {Object}
*/
Collection.prototype.group = function (groupObj, arr) {
// Convert the index object to an array of key val objects
var keys = sharedPathSolver.parse(groupObj, true),
groupPathSolver = new Path(),
groupValue,
groupResult = {},
keyIndex,
i;
if (keys.length) {
for (keyIndex = 0; keyIndex < keys.length; keyIndex++) {
groupPathSolver.path(keys[keyIndex].path);
// Execute group
for (i = 0; i < arr.length; i++) {
groupValue = groupPathSolver.get(arr[i]);
groupResult[groupValue] = groupResult[groupValue] || [];
groupResult[groupValue].push(arr[i]);
}
}
}
return groupResult;
};
// Commented as we have a new method that was originally implemented for binary trees.
// This old method actually has problems with nested sort objects
/*Collection.prototype.sortold = function (sortObj, arr) {
// Make sure we have an array object
arr = arr || [];
var sortArr = [],
sortKey,
sortSingleObj;
for (sortKey in sortObj) {
if (sortObj.hasOwnProperty(sortKey)) {
sortSingleObj = {};
sortSingleObj[sortKey] = sortObj[sortKey];
sortSingleObj.___fdbKey = String(sortKey);
sortArr.push(sortSingleObj);
}
}
if (sortArr.length < 2) {
// There is only one sort criteria, do a simple sort and return it
return this._sort(sortObj, arr);
} else {
return this._bucketSort(sortArr, arr);
}
};*/
/**
* Takes array of sort paths and sorts them into buckets before returning final
* array fully sorted by multi-keys.
* @param keyArr
* @param arr
* @returns {*}
* @private
*/
/*Collection.prototype._bucketSort = function (keyArr, arr) {
var keyObj = keyArr.shift(),
arrCopy,
bucketData,
bucketOrder,
bucketKey,
buckets,
i,
finalArr = [];
if (keyArr.length > 0) {
// Sort array by bucket key
arr = this._sort(keyObj, arr);
// Split items into buckets
bucketData = this.bucket(keyObj.___fdbKey, arr);
bucketOrder = bucketData.order;
buckets = bucketData.buckets;
// Loop buckets and sort contents
for (i = 0; i < bucketOrder.length; i++) {
bucketKey = bucketOrder[i];
arrCopy = [].concat(keyArr);
finalArr = finalArr.concat(this._bucketSort(arrCopy, buckets[bucketKey]));
}
return finalArr;
} else {
return this._sort(keyObj, arr);
}
};*/
/**
* Takes an array of objects and returns a new object with the array items
* split into buckets by the passed key.
* @param {String} key The key to split the array into buckets by.
* @param {Array} arr An array of objects.
* @returns {Object}
*/
/*Collection.prototype.bucket = function (key, arr) {
var i,
oldField,
field,
fieldArr = [],
buckets = {};
for (i = 0; i < arr.length; i++) {
field = String(arr[i][key]);
if (oldField !== field) {
fieldArr.push(field);
oldField = field;
}
buckets[field] = buckets[field] || [];
buckets[field].push(arr[i]);
}
return {
buckets: buckets,
order: fieldArr
};
};*/
/**
* Sorts array by individual sort path.
* @param key
* @param arr
* @returns {Array|*}
* @private
*/
Collection.prototype._sort = function (key, arr) {
var self = this,
sorterMethod,
pathSolver = new Path(),
dataPath = pathSolver.parse(key, true)[0];
pathSolver.path(dataPath.path);
if (dataPath.value === 1) {
// Sort ascending
sorterMethod = function (a, b) {
var valA = pathSolver.value(a)[0],
valB = pathSolver.value(b)[0];
return self.sortAsc(valA, valB);
};
} else if (dataPath.value === -1) {
// Sort descending
sorterMethod = function (a, b) {
var valA = pathSolver.value(a)[0],
valB = pathSolver.value(b)[0];
return self.sortDesc(valA, valB);
};
} else {
throw(this.logIdentifier() + ' $orderBy clause has invalid direction: ' + dataPath.value + ', accepted values are 1 or -1 for ascending or descending!');
}
return arr.sort(sorterMethod);
};
/**
* Internal method that takes a search query and options and returns an object
* containing details about the query which can be used to optimise the search.
*
* @param query
* @param options
* @param op
* @returns {Object}
* @private
*/
Collection.prototype._analyseQuery = function (query, options, op) {
var analysis = {
queriesOn: [{id: '$collection.' + this._name, type: 'colletion', key: this._name}],
indexMatch: [],
hasJoin: false,
queriesJoin: false,
joinQueries: {},
query: query,
options: options
},
joinSourceIndex,
joinSourceKey,
joinSourceType,
joinSourceIdentifier,
joinMatch,
joinSources = [],
joinSourceReferences = [],
queryPath,
index,
indexMatchData,
indexRef,
indexRefName,
indexLookup,
pathSolver,
queryKeyCount,
pkQueryType,
lookupResult,
i;
// Check if the query is a primary key lookup
op.time('checkIndexes');
pathSolver = new Path();
queryKeyCount = pathSolver.parseArr(query, {
ignore:/\$/,
verbose: true
}).length;
if (queryKeyCount) {
if (query[this._primaryKey] !== undefined) {
// Check suitability of querying key value index
pkQueryType = typeof query[this._primaryKey];
if (pkQueryType === 'string' || pkQueryType === 'number' || query[this._primaryKey] instanceof Array) {
// Return item via primary key possible
op.time('checkIndexMatch: Primary Key');
lookupResult = this._primaryIndex.lookup(query, options);
analysis.indexMatch.push({
lookup: lookupResult,
keyData: {
matchedKeys: [this._primaryKey],
totalKeyCount: queryKeyCount,
score: 1
},
index: this._primaryIndex
});
op.time('checkIndexMatch: Primary Key');
}
}
// Check if an index can speed up the query
for (i in this._indexById) {
if (this._indexById.hasOwnProperty(i)) {
indexRef = this._indexById[i];
indexRefName = indexRef.name();
op.time('checkIndexMatch: ' + indexRefName);
indexMatchData = indexRef.match(query, options);
if (indexMatchData.score > 0) {
// This index can be used, store it
indexLookup = indexRef.lookup(query, options);
analysis.indexMatch.push({
lookup: indexLookup,
keyData: indexMatchData,
index: indexRef
});
}
op.time('checkIndexMatch: ' + indexRefName);
if (indexMatchData.score === queryKeyCount) {
// Found an optimal index, do not check for any more
break;
}
}
}
op.time('checkIndexes');
// Sort array descending on index key count (effectively a measure of relevance to the query)
if (analysis.indexMatch.length > 1) {
op.time('findOptimalIndex');
analysis.indexMatch.sort(function (a, b) {
if (a.keyData.score > b.keyData.score) {
// This index has a higher score than the other
return -1;
}
if (a.keyData.score < b.keyData.score) {
// This index has a lower score than the other
return 1;
}
// The indexes have the same score but can still be compared by the number of records
// they return from the query. The fewer records they return the better so order by
// record count
if (a.keyData.score === b.keyData.score) {
return a.lookup.length - b.lookup.length;
}
});
op.time('findOptimalIndex');
}
}
// Check for join data
if (options.$join) {
analysis.hasJoin = true;
// Loop all join operations
for (joinSourceIndex = 0; joinSourceIndex < options.$join.length; joinSourceIndex++) {
// Loop the join sources and keep a reference to them
for (joinSourceKey in options.$join[joinSourceIndex]) {
if (options.$join[joinSourceIndex].hasOwnProperty(joinSourceKey)) {
joinMatch = options.$join[joinSourceIndex][joinSourceKey];
joinSourceType = joinMatch.$sourceType || 'collection';
joinSourceIdentifier = '$' + joinSourceType + '.' + joinSourceKey;
joinSources.push({
id: joinSourceIdentifier,
type: joinSourceType,
key: joinSourceKey
});
// Check if the join uses an $as operator
if (options.$join[joinSourceIndex][joinSourceKey].$as !== undefined) {
joinSourceReferences.push(options.$join[joinSourceIndex][joinSourceKey].$as);
} else {
joinSourceReferences.push(joinSourceKey);
}
}
}
}
// Loop the join source references and determine if the query references
// any of the sources that are used in the join. If there no queries against
// joined sources the find method can use a code path optimised for this.
// Queries against joined sources requires the joined sources to be filtered
// first and then joined so requires a little more work.
for (index = 0; index < joinSourceReferences.length; index++) {
// Check if the query references any source data that the join will create
queryPath = this._queryReferencesSource(query, joinSourceReferences[index], '');
if (queryPath) {
analysis.joinQueries[joinSources[index].key] = queryPath;
analysis.queriesJoin = true;
}
}
analysis.joinsOn = joinSources;
analysis.queriesOn = analysis.queriesOn.concat(joinSources);
}
return analysis;
};
/**
* Checks if the passed query references a source object (such
* as a collection) by name.
* @param {Object} query The query object to scan.
* @param {String} sourceName The source name to scan for in the query.
* @param {String=} path The path to scan from.
* @returns {*}
* @private
*/
Collection.prototype._queryReferencesSource = function (query, sourceName, path) {
var i;
for (i in query) {
if (query.hasOwnProperty(i)) {
// Check if this key is a reference match
if (i === sourceName) {
if (path) { path += '.'; }
return path + i;
} else {
if (typeof(query[i]) === 'object') {
// Recurse
if (path) { path += '.'; }
path += i;
return this._queryReferencesSource(query[i], sourceName, path);
}
}
}
}
return false;
};
/**
* Returns the number of documents currently in the collection.
* @returns {Number}
*/
Collection.prototype.count = function (query, options) {
if (!query) {
return this._data.length;
} else {
// Run query and return count
return this.find(query, options).length;
}
};
/**
* Finds sub-documents from the collection's documents.
* @param {Object} match The query object to use when matching parent documents
* from which the sub-documents are queried.
* @param {String} path The path string used to identify the key in which
* sub-documents are stored in parent documents.
* @param {Object=} subDocQuery The query to use when matching which sub-documents
* to return.
* @param {Object=} subDocOptions The options object to use when querying for
* sub-documents.
* @returns {*}
*/
Collection.prototype.findSub = function (match, path, subDocQuery, subDocOptions) {
return this._findSub(this.find(match), path, subDocQuery, subDocOptions);
};
Collection.prototype._findSub = function (docArr, path, subDocQuery, subDocOptions) {
var pathHandler = new Path(path),
docCount = docArr.length,
docIndex,
subDocArr,
subDocCollection = new Collection('__FDB_temp_' + this.objectId()).db(this._db),
subDocResults,
resultObj = {
parents: docCount,
subDocTotal: 0,
subDocs: [],
pathFound: false,
err: ''
};
subDocOptions = subDocOptions || {};
for (docIndex = 0; docIndex < docCount; docIndex++) {
subDocArr = pathHandler.value(docArr[docIndex])[0];
if (subDocArr) {
subDocCollection.setData(subDocArr);
subDocResults = subDocCollection.find(subDocQuery, subDocOptions);
if (subDocOptions.returnFirst && subDocResults.length) {
return subDocResults[0];
}
if (subDocOptions.$split) {
resultObj.subDocs.push(subDocResults);
} else {
resultObj.subDocs = resultObj.subDocs.concat(subDocResults);
}
resultObj.subDocTotal += subDocResults.length;
resultObj.pathFound = true;
}
}
// Drop the sub-document collection
subDocCollection.drop();
if (!resultObj.pathFound) {
resultObj.err = 'No objects found in the parent documents with a matching path of: ' + path;
}
// Check if the call should not return stats, if so return only subDocs array
if (subDocOptions.$stats) {
return resultObj;
} else {
return resultObj.subDocs;
}
};
/**
* Finds the first sub-document from the collection's documents that matches
* the subDocQuery parameter.
* @param {Object} match The query object to use when matching parent documents
* from which the sub-documents are queried.
* @param {String} path The path string used to identify the key in which
* sub-documents are stored in parent documents.
* @param {Object=} subDocQuery The query to use when matching which sub-documents
* to return.
* @param {Object=} subDocOptions The options object to use when querying for
* sub-documents.
* @returns {Object}
*/
Collection.prototype.findSubOne = function (match, path, subDocQuery, subDocOptions) {
return this.findSub(match, path, subDocQuery, subDocOptions)[0];
};
/**
* Checks that the passed document will not violate any index rules if
* inserted into the collection.
* @param {Object} doc The document to check indexes against.
* @returns {Boolean} Either false (no violation occurred) or true if
* a violation was detected.
*/
Collection.prototype.insertIndexViolation = function (doc) {
var indexViolated,
arr = this._indexByName,
arrIndex,
arrItem;
// Check the item's primary key is not already in use
if (this._primaryIndex.get(doc[this._primaryKey])) {
indexViolated = this._primaryIndex;
} else {
// Check violations of other indexes
for (arrIndex in arr) {
if (arr.hasOwnProperty(arrIndex)) {
arrItem = arr[arrIndex];
if (arrItem.unique()) {
if (arrItem.violation(doc)) {
indexViolated = arrItem;
break;
}
}
}
}
}
return indexViolated ? indexViolated.name() : false;
};
/**
* Creates an index on the specified keys.
* @param {Object} keys The object containing keys to index.
* @param {Object} options An options object.
* @returns {*}
*/
Collection.prototype.ensureIndex = function (keys, options) {
if (this.isDropped()) {
throw(this.logIdentifier() + ' Cannot operate in a dropped state!');
}
this._indexByName = this._indexByName || {};
this._indexById = this._indexById || {};
var index,
time = {
start: new Date().getTime()
};
if (options) {
if (options.type) {
// Check if the specified type is available
if (Shared.index[options.type]) {
// We found the type, generate it
index = new Shared.index[options.type](keys, options, this);
} else {
throw(this.logIdentifier() + ' Cannot create index of type "' + options.type + '", type not found in the index type register (Shared.index)');
}
} else {
// Create default index type
index = new IndexHashMap(keys, options, this);
}
} else {
// Default
index = new IndexHashMap(keys, options, this);
}
// Check the index does not already exist
if (this._indexByName[index.name()]) {
// Index already exists
return {
err: 'Index with that name already exists'
};
}
/*if (this._indexById[index.id()]) {
// Index already exists
return {
err: 'Index with those keys already exists'
};
}*/
// Create the index
index.rebuild();
// Add the index
this._indexByName[index.name()] = index;
this._indexById[index.id()] = index;
time.end = new Date().getTime();
time.total = time.end - time.start;
this._lastOp = {
type: 'ensureIndex',
stats: {
time: time
}
};
return {
index: index,
id: index.id(),
name: index.name(),
state: index.state()
};
};
/**
* Gets an index by it's name.
* @param {String} name The name of the index to retreive.
* @returns {*}
*/
Collection.prototype.index = function (name) {
if (this._indexByName) {
return this._indexByName[name];
}
};
/**
* Gets the last reporting operation's details such as run time.
* @returns {Object}
*/
Collection.prototype.lastOp = function () {
return this._metrics.list();
};
/**
* Generates a difference object that contains insert, update and remove arrays
* representing the operations to execute to make this collection have the same
* data as the one passed.
* @param {Collection} collection The collection to diff against.
* @returns {{}}
*/
Collection.prototype.diff = function (collection) {
var diff = {
insert: [],
update: [],
remove: []
};
var pk = this.primaryKey(),
arr,
arrIndex,
arrItem,
arrCount;
// Check if the primary key index of each collection can be utilised
if (pk !== collection.primaryKey()) {
throw(this.logIdentifier() + ' Diffing requires that both collections have the same primary key!');
}
// Use the collection primary key index to do the diff (super-fast)
arr = collection._data;
// Check if we have an array or another collection
while (arr && !(arr instanceof Array)) {
// We don't have an array, assign collection and get data
collection = arr;
arr = collection._data;
}
arrCount = arr.length;
// Loop the collection's data array and check for matching items
for (arrIndex = 0; arrIndex < arrCount; arrIndex++) {
arrItem = arr[arrIndex];
// Check for a matching item in this collection
if (this._primaryIndex.get(arrItem[pk])) {
// Matching item exists, check if the data is the same
if (this._primaryCrc.get(arrItem[pk]) !== collection._primaryCrc.get(arrItem[pk])) {
// The documents exist in both collections but data differs, update required
diff.update.push(arrItem);
}
} else {
// The document is missing from this collection, insert required
diff.insert.push(arrItem);
}
}
// Now loop this collection's data and check for matching items
arr = this._data;
arrCount = arr.length;
for (arrIndex = 0; arrIndex < arrCount; arrIndex++) {
arrItem = arr[arrIndex];
if (!collection._primaryIndex.get(arrItem[pk])) {
// The document does not exist in the other collection, remove required
diff.remove.push(arrItem);
}
}
return diff;
};
Collection.prototype.collateAdd = new Overload('Collection.prototype.collateAdd', {
/**
* Adds a data source to collate data from and specifies the
* key name to collate data to.
* @func collateAdd
* @memberof Collection
* @param {Collection} collection The collection to collate data from.
* @param {String=} keyName Optional name of the key to collate data to.
* If none is provided the record CRUD is operated on the root collection
* data.
*/
'object, string': function (collection, keyName) {
var self = this;
self.collateAdd(collection, function (packet) {
var obj1,
obj2;
switch (packet.type) {
case 'insert':
if (keyName) {
obj1 = {
$push: {}
};
obj1.$push[keyName] = self.decouple(packet.data.dataSet);
self.update({}, obj1);
} else {
self.insert(packet.data.dataSet);
}
break;
case 'update':
if (keyName) {
obj1 = {};
obj2 = {};
obj1[keyName] = packet.data.query;
obj2[keyName + '.$'] = packet.data.update;
self.update(obj1, obj2);
} else {
self.update(packet.data.query, packet.data.update);
}
break;
case 'remove':
if (keyName) {
obj1 = {
$pull: {}
};
obj1.$pull[keyName] = {};
obj1.$pull[keyName][self.primaryKey()] = packet.data.dataSet[0][collection.primaryKey()];
self.update({}, obj1);
} else {
self.remove(packet.data.dataSet);
}
break;
default:
}
});
},
/**
* Adds a data source to collate data from and specifies a process
* method that will handle the collation functionality (for custom
* collation).
* @func collateAdd
* @memberof Collection
* @param {Collection} collection The collection to collate data from.
* @param {Function} process The process method.
*/
'object, function': function (collection, process) {
if (typeof collection === 'string') {
// The collection passed is a name, not a reference so get
// the reference from the name
collection = this._db.collection(collection, {
autoCreate: false,
throwError: false
});
}
if (collection) {
this._collate = this._collate || {};
this._collate[collection.name()] = new ReactorIO(collection, this, process);
return this;
} else {
throw('Cannot collate from a non-existent collection!');
}
}
});
Collection.prototype.collateRemove = function (collection) {
if (typeof collection === 'object') {
// We need to have the name of the collection to remove it
collection = collection.name();
}
if (collection) {
// Drop the reactor IO chain node
this._collate[collection].drop();
// Remove the collection data from the collate object
delete this._collate[collection];
return this;
} else {
throw('No collection name passed to collateRemove() or collection not found!');
}
};
Db.prototype.collection = new Overload('Db.prototype.collection', {
/**
* Get a collection with no name (generates a random name). If the
* collection does not already exist then one is created for that
* name automatically.
* @func collection
* @memberof Db
* @returns {Collection}
*/
'': function () {
return this.$main.call(this, {
name: this.objectId()
});
},
/**
* Get a collection by name. If the collection does not already exist
* then one is created for that name automatically.
* @func collection
* @memberof Db
* @param {Object} data An options object or a collection instance.
* @returns {Collection}
*/
'object': function (data) {
// Handle being passed an instance
if (data instanceof Collection) {
if (data.state() !== 'droppped') {
return data;
} else {
return this.$main.call(this, {
name: data.name()
});
}
}
return this.$main.call(this, data);
},
/**
* Get a collection by name. If the collection does not already exist
* then one is created for that name automatically.
* @func collection
* @memberof Db
* @param {String} collectionName The name of the collection.
* @returns {Collection}
*/
'string': function (collectionName) {
return this.$main.call(this, {
name: collectionName
});
},
/**
* Get a collection by name. If the collection does not already exist
* then one is created for that name automatically.
* @func collection
* @memberof Db
* @param {String} collectionName The name of the collection.
* @param {String} primaryKey Optional primary key to specify the primary key field on the collection
* objects. Defaults to "_id".
* @returns {Collection}
*/
'string, string': function (collectionName, primaryKey) {
return this.$main.call(this, {
name: collectionName,
primaryKey: primaryKey
});
},
/**
* Get a collection by name. If the collection does not already exist
* then one is created for that name automatically.
* @func collection
* @memberof Db
* @param {String} collectionName The name of the collection.
* @param {Object} options An options object.
* @returns {Collection}
*/
'string, object': function (collectionName, options) {
options.name = collectionName;
return this.$main.call(this, options);
},
/**
* Get a collection by name. If the collection does not already exist
* then one is created for that name automatically.
* @func collection
* @memberof Db
* @param {String} collectionName The name of the collection.
* @param {String} primaryKey Optional primary key to specify the primary key field on the collection
* objects. Defaults to "_id".
* @param {Object} options An options object.
* @returns {Collection}
*/
'string, string, object': function (collectionName, primaryKey, options) {
options.name = collectionName;
options.primaryKey = primaryKey;
return this.$main.call(this, options);
},
/**
* The main handler method. This gets called by all the other variants and
* handles the actual logic of the overloaded method.
* @func collection
* @memberof Db
* @param {Object} options An options object.
* @returns {*}
*/
'$main': function (options) {
var self = this,
name = options.name;
if (name) {
if (this._collection[name]) {
return this._collection[name];
} else {
if (options && options.autoCreate === false) {
if (options && options.throwError !== false) {
throw(this.logIdentifier() + ' Cannot get collection ' + name + ' because it does not exist and auto-create has been disabled!');
}
return undefined;
}
if (this.debug()) {
console.log(this.logIdentifier() + ' Creating collection ' + name);
}
}
this._collection[name] = this._collection[name] || new Collection(name, options).db(this);
this._collection[name].mongoEmulation(this.mongoEmulation());
if (options.primaryKey !== undefined) {
this._collection[name].primaryKey(options.primaryKey);
}
if (options.capped !== undefined) {
// Check we have a size
if (options.size !== undefined) {
this._collection[name].capped(options.capped);
this._collection[name].cappedSize(options.size);
} else {
throw(this.logIdentifier() + ' Cannot create a capped collection without specifying a size!');
}
}
// Listen for events on this collection so we can fire global events
// on the database in response to it
self._collection[name].on('change', function () {
self.emit('change', self._collection[name], 'collection', name);
});
self.emit('create', self._collection[name], 'collection', name);
return this._collection[name];
} else {
if (!options || (options && options.throwError !== false)) {
throw(this.logIdentifier() + ' Cannot get collection with undefined name!');
}
}
}
});
/**
* Determine if a collection with the passed name already exists.
* @memberof Db
* @param {String} viewName The name of the collection to check for.
* @returns {boolean}
*/
Db.prototype.collectionExists = function (viewName) {
return Boolean(this._collection[viewName]);
};
/**
* Returns an array of collections the DB currently has.
* @memberof Db
* @param {String|RegExp=} search The optional search string or regular expression to use
* to match collection names against.
* @returns {Array} An array of objects containing details of each collection
* the database is currently managing.
*/
Db.prototype.collections = function (search) {
var arr = [],
collections = this._collection,
collection,
i;
if (search) {
if (!(search instanceof RegExp)) {
// Turn the search into a regular expression
search = new RegExp(search);
}
}
for (i in collections) {
if (collections.hasOwnProperty(i)) {
collection = collections[i];
if (search) {
if (search.exec(i)) {
arr.push({
name: i,
count: collection.count(),
linked: collection.isLinked !== undefined ? collection.isLinked() : false
});
}
} else {
arr.push({
name: i,
count: collection.count(),
linked: collection.isLinked !== undefined ? collection.isLinked() : false
});
}
}
}
arr.sort(function (a, b) {
return a.name.localeCompare(b.name);
});
return arr;
};
Shared.finishModule('Collection');
module.exports = Collection;
},{"./Index2d":11,"./IndexBinaryTree":12,"./IndexHashMap":13,"./KeyValueStore":14,"./Metrics":15,"./Overload":27,"./Path":28,"./ReactorIO":29,"./Shared":31}],7:[function(_dereq_,module,exports){
"use strict";
// Import external names locally
var Shared,
Db,
DbInit,
Collection;
Shared = _dereq_('./Shared');
/**
* Creates a new collection group. Collection groups allow single operations to be
* propagated to multiple collections at once. CRUD operations against a collection
* group are in fed to the group's collections. Useful when separating out slightly
* different data into multiple collections but querying as one collection.
* @constructor
*/
var CollectionGroup = function () {
this.init.apply(this, arguments);
};
CollectionGroup.prototype.init = function (name) {
var self = this;
self._name = name;
self._data = new Collection('__FDB__cg_data_' + self._name);
self._collections = [];
self._view = [];
};
Shared.addModule('CollectionGroup', CollectionGroup);
Shared.mixin(CollectionGroup.prototype, 'Mixin.Common');
Shared.mixin(CollectionGroup.prototype, 'Mixin.ChainReactor');
Shared.mixin(CollectionGroup.prototype, 'Mixin.Constants');
Shared.mixin(CollectionGroup.prototype, 'Mixin.Triggers');
Shared.mixin(CollectionGroup.prototype, 'Mixin.Tags');
Shared.mixin(CollectionGroup.prototype, 'Mixin.Events');
Collection = _dereq_('./Collection');
Db = Shared.modules.Db;
DbInit = Shared.modules.Db.prototype.init;
CollectionGroup.prototype.on = function () {
this._data.on.apply(this._data, arguments);
};
CollectionGroup.prototype.off = function () {
this._data.off.apply(this._data, arguments);
};
CollectionGroup.prototype.emit = function () {
this._data.emit.apply(this._data, arguments);
};
/**
* Gets / sets the primary key for this collection group.
* @param {String=} keyName The name of the primary key.
* @returns {*}
*/
CollectionGroup.prototype.primaryKey = function (keyName) {
if (keyName !== undefined) {
this._primaryKey = keyName;
return this;
}
return this._primaryKey;
};
/**
* Gets / sets the current state.
* @param {String=} val The name of the state to set.
* @returns {*}
*/
Shared.synthesize(CollectionGroup.prototype, 'state');
/**
* Gets / sets the db instance the collection group belongs to.
* @param {Db=} db The db instance.
* @returns {*}
*/
Shared.synthesize(CollectionGroup.prototype, 'db');
/**
* Gets / sets the instance name.
* @param {String=} name The new name to set.
* @returns {*}
*/
Shared.synthesize(CollectionGroup.prototype, 'name');
CollectionGroup.prototype.addCollection = function (collection) {
if (collection) {
if (this._collections.indexOf(collection) === -1) {
//var self = this;
// Check for compatible primary keys
if (this._collections.length) {
if (this._primaryKey !== collection.primaryKey()) {
throw(this.logIdentifier() + ' All collections in a collection group must have the same primary key!');
}
} else {
// Set the primary key to the first collection added
this.primaryKey(collection.primaryKey());
}
// Add the collection
this._collections.push(collection);
collection._groups = collection._groups || [];
collection._groups.push(this);
collection.chain(this);
// Hook the collection's drop event to destroy group data
collection.on('drop', function () {
// Remove collection from any group associations
if (collection._groups && collection._groups.length) {
var groupArr = [],
i;
// Copy the group array because if we call removeCollection on a group
// it will alter the groups array of this collection mid-loop!
for (i = 0; i < collection._groups.length; i++) {
groupArr.push(collection._groups[i]);
}
// Loop any groups we are part of and remove ourselves from them
for (i = 0; i < groupArr.length; i++) {
collection._groups[i].removeCollection(collection);
}
}
delete collection._groups;
});
// Add collection's data
this._data.insert(collection.find());
}
}
return this;
};
CollectionGroup.prototype.removeCollection = function (collection) {
if (collection) {
var collectionIndex = this._collections.indexOf(collection),
groupIndex;
if (collectionIndex !== -1) {
collection.unChain(this);
this._collections.splice(collectionIndex, 1);
collection._groups = collection._groups || [];
groupIndex = collection._groups.indexOf(this);
if (groupIndex !== -1) {
collection._groups.splice(groupIndex, 1);
}
collection.off('drop');
}
if (this._collections.length === 0) {
// Wipe the primary key
delete this._primaryKey;
}
}
return this;
};
CollectionGroup.prototype._chainHandler = function (chainPacket) {
//sender = chainPacket.sender;
switch (chainPacket.type) {
case 'setData':
// Decouple the data to ensure we are working with our own copy
chainPacket.data.dataSet = this.decouple(chainPacket.data.dataSet);
// Remove old data
this._data.remove(chainPacket.data.oldData);
// Add new data
this._data.insert(chainPacket.data.dataSet);
break;
case 'insert':
// Decouple the data to ensure we are working with our own copy
chainPacket.data.dataSet = this.decouple(chainPacket.data.dataSet);
// Add new data
this._data.insert(chainPacket.data.dataSet);
break;
case 'update':
// Update data
this._data.update(chainPacket.data.query, chainPacket.data.update, chainPacket.options);
break;
case 'remove':
this._data.remove(chainPacket.data.query, chainPacket.options);
break;
default:
break;
}
};
CollectionGroup.prototype.insert = function () {
this._collectionsRun('insert', arguments);
};
CollectionGroup.prototype.update = function () {
this._collectionsRun('update', arguments);
};
CollectionGroup.prototype.updateById = function () {
this._collectionsRun('updateById', arguments);
};
CollectionGroup.prototype.remove = function () {
this._collectionsRun('remove', arguments);
};
CollectionGroup.prototype._collectionsRun = function (type, args) {
for (var i = 0; i < this._collections.length; i++) {
this._collections[i][type].apply(this._collections[i], args);
}
};
CollectionGroup.prototype.find = function (query, options) {
return this._data.find(query, options);
};
/**
* Helper method that removes a document that matches the given id.
* @param {String} id The id of the document to remove.
*/
CollectionGroup.prototype.removeById = function (id) {
// Loop the collections in this group and apply the remove
for (var i = 0; i < this._collections.length; i++) {
this._collections[i].removeById(id);
}
};
/**
* Uses the passed query to generate a new collection with results
* matching the query parameters.
*
* @param query
* @param options
* @returns {*}
*/
CollectionGroup.prototype.subset = function (query, options) {
var result = this.find(query, options);
return new Collection()
.subsetOf(this)
.primaryKey(this._primaryKey)
.setData(result);
};
/**
* Drops a collection group from the database.
* @returns {boolean} True on success, false on failure.
*/
CollectionGroup.prototype.drop = function (callback) {
if (!this.isDropped()) {
var i,
collArr,
viewArr;
if (this._debug) {
console.log(this.logIdentifier() + ' Dropping');
}
this._state = 'dropped';
if (this._collections && this._collections.length) {
collArr = [].concat(this._collections);
for (i = 0; i < collArr.length; i++) {
this.removeCollection(collArr[i]);
}
}
if (this._view && this._view.length) {
viewArr = [].concat(this._view);
for (i = 0; i < viewArr.length; i++) {
this._removeView(viewArr[i]);
}
}
this.emit('drop', this);
delete this._listeners;
if (callback) { callback(false, true); }
}
return true;
};
// Extend DB to include collection groups
Db.prototype.init = function () {
this._collectionGroup = {};
DbInit.apply(this, arguments);
};
/**
* Creates a new collectionGroup instance or returns an existing
* instance if one already exists with the passed name.
* @func collectionGroup
* @memberOf Db
* @param {String} name The name of the instance.
* @returns {*}
*/
Db.prototype.collectionGroup = function (name) {
var self = this;
if (name) {
// Handle being passed an instance
if (name instanceof CollectionGroup) {
return name;
}
if (this._collectionGroup && this._collectionGroup[name]) {
return this._collectionGroup[name];
}
this._collectionGroup[name] = new CollectionGroup(name).db(this);
self.emit('create', self._collectionGroup[name], 'collectionGroup', name);
return this._collectionGroup[name];
} else {
// Return an object of collection data
return this._collectionGroup;
}
};
/**
* Returns an array of collection groups the DB currently has.
* @returns {Array} An array of objects containing details of each collection group
* the database is currently managing.
*/
Db.prototype.collectionGroups = function () {
var arr = [],
i;
for (i in this._collectionGroup) {
if (this._collectionGroup.hasOwnProperty(i)) {
arr.push({
name: i
});
}
}
return arr;
};
module.exports = CollectionGroup;
},{"./Collection":6,"./Shared":31}],8:[function(_dereq_,module,exports){
/*
License
Copyright (c) 2015 Irrelon Software Limited
http://www.irrelon.com
http://www.forerunnerdb.com
Please visit the license page to see latest license information:
http://www.forerunnerdb.com/licensing.html
*/
"use strict";
var Shared,
Db,
Metrics,
Overload,
_instances = [];
Shared = _dereq_('./Shared');
Overload = _dereq_('./Overload');
/**
* Creates a new ForerunnerDB instance. Core instances handle the lifecycle of
* multiple database instances.
* @constructor
*/
var Core = function (val) {
this.init.apply(this, arguments);
};
Core.prototype.init = function (name) {
this._db = {};
this._debug = {};
this._name = name || 'ForerunnerDB';
_instances.push(this);
};
/**
* Returns the number of instantiated ForerunnerDB objects.
* @returns {Number} The number of instantiated instances.
*/
Core.prototype.instantiatedCount = function () {
return _instances.length;
};
/**
* Get all instances as an array or a single ForerunnerDB instance
* by it's array index.
* @param {Number=} index Optional index of instance to get.
* @returns {Array|Object} Array of instances or a single instance.
*/
Core.prototype.instances = function (index) {
if (index !== undefined) {
return _instances[index];
}
return _instances;
};
/**
* Get all instances as an array of instance names or a single ForerunnerDB
* instance by it's name.
* @param {String=} name Optional name of instance to get.
* @returns {Array|Object} Array of instance names or a single instance.
*/
Core.prototype.namedInstances = function (name) {
var i,
instArr;
if (name !== undefined) {
for (i = 0; i < _instances.length; i++) {
if (_instances[i].name === name) {
return _instances[i];
}
}
return undefined;
}
instArr = [];
for (i = 0; i < _instances.length; i++) {
instArr.push(_instances[i].name);
}
return instArr;
};
Core.prototype.moduleLoaded = new Overload({
/**
* Checks if a module has been loaded into the database.
* @func moduleLoaded
* @memberof Core
* @param {String} moduleName The name of the module to check for.
* @returns {Boolean} True if the module is loaded, false if not.
*/
'string': function (moduleName) {
if (moduleName !== undefined) {
moduleName = moduleName.replace(/ /g, '');
var modules = moduleName.split(','),
index;
for (index = 0; index < modules.length; index++) {
if (!Shared.modules[modules[index]]) {
return false;
}
}
return true;
}
return false;
},
/**
* Checks if a module is loaded and if so calls the passed
* callback method.
* @func moduleLoaded
* @memberof Core
* @param {String} moduleName The name of the module to check for.
* @param {Function} callback The callback method to call if module is loaded.
*/
'string, function': function (moduleName, callback) {
if (moduleName !== undefined) {
moduleName = moduleName.replace(/ /g, '');
var modules = moduleName.split(','),
index;
for (index = 0; index < modules.length; index++) {
if (!Shared.modules[modules[index]]) {
return false;
}
}
if (callback) { callback(); }
}
},
/**
* Checks if an array of named modules are loaded and if so
* calls the passed callback method.
* @func moduleLoaded
* @memberof Core
* @param {Array} moduleName The array of module names to check for.
* @param {Function} callback The callback method to call if modules are loaded.
*/
'array, function': function (moduleNameArr, callback) {
var moduleName,
i;
for (i = 0; i < moduleNameArr.length; i++) {
moduleName = moduleNameArr[i];
if (moduleName !== undefined) {
moduleName = moduleName.replace(/ /g, '');
var modules = moduleName.split(','),
index;
for (index = 0; index < modules.length; index++) {
if (!Shared.modules[modules[index]]) {
return false;
}
}
}
}
if (callback) { callback(); }
},
/**
* Checks if a module is loaded and if so calls the passed
* success method, otherwise calls the failure method.
* @func moduleLoaded
* @memberof Core
* @param {String} moduleName The name of the module to check for.
* @param {Function} success The callback method to call if module is loaded.
* @param {Function} failure The callback method to call if module not loaded.
*/
'string, function, function': function (moduleName, success, failure) {
if (moduleName !== undefined) {
moduleName = moduleName.replace(/ /g, '');
var modules = moduleName.split(','),
index;
for (index = 0; index < modules.length; index++) {
if (!Shared.modules[modules[index]]) {
failure();
return false;
}
}
success();
}
}
});
/**
* Checks version against the string passed and if it matches (or partially matches)
* then the callback is called.
* @param {String} val The version to check against.
* @param {Function} callback The callback to call if match is true.
* @returns {Boolean}
*/
Core.prototype.version = function (val, callback) {
if (val !== undefined) {
if (Shared.version.indexOf(val) === 0) {
if (callback) { callback(); }
return true;
}
return false;
}
return Shared.version;
};
// Expose moduleLoaded() method to non-instantiated object ForerunnerDB
Core.moduleLoaded = Core.prototype.moduleLoaded;
// Expose version() method to non-instantiated object ForerunnerDB
Core.version = Core.prototype.version;
// Expose instances() method to non-instantiated object ForerunnerDB
Core.instances = Core.prototype.instances;
// Expose instantiatedCount() method to non-instantiated object ForerunnerDB
Core.instantiatedCount = Core.prototype.instantiatedCount;
// Provide public access to the Shared object
Core.shared = Shared;
Core.prototype.shared = Shared;
Shared.addModule('Core', Core);
Shared.mixin(Core.prototype, 'Mixin.Common');
Shared.mixin(Core.prototype, 'Mixin.Constants');
Db = _dereq_('./Db.js');
Metrics = _dereq_('./Metrics.js');
/**
* Gets / sets the name of the instance. This is primarily used for
* name-spacing persistent storage.
* @param {String=} val The name of the instance to set.
* @returns {*}
*/
Shared.synthesize(Core.prototype, 'name');
/**
* Gets / sets mongodb emulation mode.
* @param {Boolean=} val True to enable, false to disable.
* @returns {*}
*/
Shared.synthesize(Core.prototype, 'mongoEmulation');
// Set a flag to determine environment
Core.prototype._isServer = false;
/**
* Checks if the database is running on a client (browser) or
* a server (node.js).
* @returns {Boolean} Returns true if running on a browser.
*/
Core.prototype.isClient = function () {
return !this._isServer;
};
/**
* Checks if the database is running on a client (browser) or
* a server (node.js).
* @returns {Boolean} Returns true if running on a server.
*/
Core.prototype.isServer = function () {
return this._isServer;
};
/**
* Added to provide an error message for users who have not seen
* the new instantiation breaking change warning and try to get
* a collection directly from the core instance.
*/
Core.prototype.collection = function () {
throw("ForerunnerDB's instantiation has changed since version 1.3.36 to support multiple database instances. Please see the readme.md file for the minor change you have to make to get your project back up and running, or see the issue related to this change at https://github.com/Irrelon/ForerunnerDB/issues/44");
};
module.exports = Core;
},{"./Db.js":9,"./Metrics.js":15,"./Overload":27,"./Shared":31}],9:[function(_dereq_,module,exports){
"use strict";
var Shared,
Core,
Collection,
Metrics,
Checksum,
Overload;
Shared = _dereq_('./Shared');
Overload = _dereq_('./Overload');
/**
* Creates a new ForerunnerDB database instance.
* @constructor
*/
var Db = function (name, core) {
this.init.apply(this, arguments);
};
Db.prototype.init = function (name, core) {
this.core(core);
this._primaryKey = '_id';
this._name = name;
this._collection = {};
this._debug = {};
};
Shared.addModule('Db', Db);
Db.prototype.moduleLoaded = new Overload({
/**
* Checks if a module has been loaded into the database.
* @func moduleLoaded
* @memberof Db
* @param {String} moduleName The name of the module to check for.
* @returns {Boolean} True if the module is loaded, false if not.
*/
'string': function (moduleName) {
if (moduleName !== undefined) {
moduleName = moduleName.replace(/ /g, '');
var modules = moduleName.split(','),
index;
for (index = 0; index < modules.length; index++) {
if (!Shared.modules[modules[index]]) {
return false;
}
}
return true;
}
return false;
},
/**
* Checks if a module is loaded and if so calls the passed
* callback method.
* @func moduleLoaded
* @memberof Db
* @param {String} moduleName The name of the module to check for.
* @param {Function} callback The callback method to call if module is loaded.
*/
'string, function': function (moduleName, callback) {
if (moduleName !== undefined) {
moduleName = moduleName.replace(/ /g, '');
var modules = moduleName.split(','),
index;
for (index = 0; index < modules.length; index++) {
if (!Shared.modules[modules[index]]) {
return false;
}
}
if (callback) { callback(); }
}
},
/**
* Checks if a module is loaded and if so calls the passed
* success method, otherwise calls the failure method.
* @func moduleLoaded
* @memberof Db
* @param {String} moduleName The name of the module to check for.
* @param {Function} success The callback method to call if module is loaded.
* @param {Function} failure The callback method to call if module not loaded.
*/
'string, function, function': function (moduleName, success, failure) {
if (moduleName !== undefined) {
moduleName = moduleName.replace(/ /g, '');
var modules = moduleName.split(','),
index;
for (index = 0; index < modules.length; index++) {
if (!Shared.modules[modules[index]]) {
failure();
return false;
}
}
success();
}
}
});
/**
* Checks version against the string passed and if it matches (or partially matches)
* then the callback is called.
* @param {String} val The version to check against.
* @param {Function} callback The callback to call if match is true.
* @returns {Boolean}
*/
Db.prototype.version = function (val, callback) {
if (val !== undefined) {
if (Shared.version.indexOf(val) === 0) {
if (callback) { callback(); }
return true;
}
return false;
}
return Shared.version;
};
// Expose moduleLoaded method to non-instantiated object ForerunnerDB
Db.moduleLoaded = Db.prototype.moduleLoaded;
// Expose version method to non-instantiated object ForerunnerDB
Db.version = Db.prototype.version;
// Provide public access to the Shared object
Db.shared = Shared;
Db.prototype.shared = Shared;
Shared.addModule('Db', Db);
Shared.mixin(Db.prototype, 'Mixin.Common');
Shared.mixin(Db.prototype, 'Mixin.ChainReactor');
Shared.mixin(Db.prototype, 'Mixin.Constants');
Shared.mixin(Db.prototype, 'Mixin.Tags');
Core = Shared.modules.Core;
Collection = _dereq_('./Collection.js');
Metrics = _dereq_('./Metrics.js');
Checksum = _dereq_('./Checksum.js');
Db.prototype._isServer = false;
/**
* Gets / sets the core object this database belongs to.
*/
Shared.synthesize(Db.prototype, 'core');
/**
* Gets / sets the default primary key for new collections.
* @param {String=} val The name of the primary key to set.
* @returns {*}
*/
Shared.synthesize(Db.prototype, 'primaryKey');
/**
* Gets / sets the current state.
* @param {String=} val The name of the state to set.
* @returns {*}
*/
Shared.synthesize(Db.prototype, 'state');
/**
* Gets / sets the name of the database.
* @param {String=} val The name of the database to set.
* @returns {*}
*/
Shared.synthesize(Db.prototype, 'name');
/**
* Gets / sets mongodb emulation mode.
* @param {Boolean=} val True to enable, false to disable.
* @returns {*}
*/
Shared.synthesize(Db.prototype, 'mongoEmulation');
/**
* Returns true if ForerunnerDB is running on a client browser.
* @returns {boolean}
*/
Db.prototype.isClient = function () {
return !this._isServer;
};
/**
* Returns true if ForerunnerDB is running on a server.
* @returns {boolean}
*/
Db.prototype.isServer = function () {
return this._isServer;
};
/**
* Returns a checksum of a string.
* @param {String} string The string to checksum.
* @return {String} The checksum generated.
*/
Db.prototype.Checksum = Checksum;
/**
* Checks if the database is running on a client (browser) or
* a server (node.js).
* @returns {Boolean} Returns true if running on a browser.
*/
Db.prototype.isClient = function () {
return !this._isServer;
};
/**
* Checks if the database is running on a client (browser) or
* a server (node.js).
* @returns {Boolean} Returns true if running on a server.
*/
Db.prototype.isServer = function () {
return this._isServer;
};
/**
* Converts a normal javascript array of objects into a DB collection.
* @param {Array} arr An array of objects.
* @returns {Collection} A new collection instance with the data set to the
* array passed.
*/
Db.prototype.arrayToCollection = function (arr) {
return new Collection().setData(arr);
};
/**
* Registers an event listener against an event name.
* @param {String} event The name of the event to listen for.
* @param {Function} listener The listener method to call when
* the event is fired.
* @returns {*}
*/
Db.prototype.on = function(event, listener) {
this._listeners = this._listeners || {};
this._listeners[event] = this._listeners[event] || [];
this._listeners[event].push(listener);
return this;
};
/**
* De-registers an event listener from an event name.
* @param {String} event The name of the event to stop listening for.
* @param {Function} listener The listener method passed to on() when
* registering the event listener.
* @returns {*}
*/
Db.prototype.off = function(event, listener) {
if (event in this._listeners) {
var arr = this._listeners[event],
index = arr.indexOf(listener);
if (index > -1) {
arr.splice(index, 1);
}
}
return this;
};
/**
* Emits an event by name with the given data.
* @param {String} event The name of the event to emit.
* @param {*=} data The data to emit with the event.
* @returns {*}
*/
Db.prototype.emit = function(event, data) {
this._listeners = this._listeners || {};
if (event in this._listeners) {
var arr = this._listeners[event],
arrCount = arr.length,
arrIndex;
for (arrIndex = 0; arrIndex < arrCount; arrIndex++) {
arr[arrIndex].apply(this, Array.prototype.slice.call(arguments, 1));
}
}
return this;
};
Db.prototype.peek = function (search) {
var i,
coll,
arr = [],
typeOfSearch = typeof search;
// Loop collections
for (i in this._collection) {
if (this._collection.hasOwnProperty(i)) {
coll = this._collection[i];
if (typeOfSearch === 'string') {
arr = arr.concat(coll.peek(search));
} else {
arr = arr.concat(coll.find(search));
}
}
}
return arr;
};
/**
* Find all documents across all collections in the database that match the passed
* string or search object.
* @param search String or search object.
* @returns {Array}
*/
Db.prototype.peek = function (search) {
var i,
coll,
arr = [],
typeOfSearch = typeof search;
// Loop collections
for (i in this._collection) {
if (this._collection.hasOwnProperty(i)) {
coll = this._collection[i];
if (typeOfSearch === 'string') {
arr = arr.concat(coll.peek(search));
} else {
arr = arr.concat(coll.find(search));
}
}
}
return arr;
};
/**
* Find all documents across all collections in the database that match the passed
* string or search object and return them in an object where each key is the name
* of the collection that the document was matched in.
* @param search String or search object.
* @returns {object}
*/
Db.prototype.peekCat = function (search) {
var i,
coll,
cat = {},
arr,
typeOfSearch = typeof search;
// Loop collections
for (i in this._collection) {
if (this._collection.hasOwnProperty(i)) {
coll = this._collection[i];
if (typeOfSearch === 'string') {
arr = coll.peek(search);
if (arr && arr.length) {
cat[coll.name()] = arr;
}
} else {
arr = coll.find(search);
if (arr && arr.length) {
cat[coll.name()] = arr;
}
}
}
}
return cat;
};
Db.prototype.drop = new Overload({
/**
* Drops the database.
* @func drop
* @memberof Db
*/
'': function () {
if (!this.isDropped()) {
var arr = this.collections(),
arrCount = arr.length,
arrIndex;
this._state = 'dropped';
for (arrIndex = 0; arrIndex < arrCount; arrIndex++) {
this.collection(arr[arrIndex].name).drop();
delete this._collection[arr[arrIndex].name];
}
this.emit('drop', this);
delete this._listeners;
delete this._core._db[this._name];
}
return true;
},
/**
* Drops the database with optional callback method.
* @func drop
* @memberof Db
* @param {Function} callback Optional callback method.
*/
'function': function (callback) {
if (!this.isDropped()) {
var arr = this.collections(),
arrCount = arr.length,
arrIndex,
finishCount = 0,
afterDrop = function () {
finishCount++;
if (finishCount === arrCount) {
if (callback) { callback(); }
}
};
this._state = 'dropped';
for (arrIndex = 0; arrIndex < arrCount; arrIndex++) {
this.collection(arr[arrIndex].name).drop(afterDrop);
delete this._collection[arr[arrIndex].name];
}
this.emit('drop', this);
delete this._listeners;
delete this._core._db[this._name];
}
return true;
},
/**
* Drops the database with optional persistent storage drop. Persistent
* storage is dropped by default if no preference is provided.
* @func drop
* @memberof Db
* @param {Boolean} removePersist Drop persistent storage for this database.
*/
'boolean': function (removePersist) {
if (!this.isDropped()) {
var arr = this.collections(),
arrCount = arr.length,
arrIndex;
this._state = 'dropped';
for (arrIndex = 0; arrIndex < arrCount; arrIndex++) {
this.collection(arr[arrIndex].name).drop(removePersist);
delete this._collection[arr[arrIndex].name];
}
this.emit('drop', this);
delete this._listeners;
delete this._core._db[this._name];
}
return true;
},
/**
* Drops the database and optionally controls dropping persistent storage
* and callback method.
* @func drop
* @memberof Db
* @param {Boolean} removePersist Drop persistent storage for this database.
* @param {Function} callback Optional callback method.
*/
'boolean, function': function (removePersist, callback) {
if (!this.isDropped()) {
var arr = this.collections(),
arrCount = arr.length,
arrIndex,
finishCount = 0,
afterDrop = function () {
finishCount++;
if (finishCount === arrCount) {
if (callback) { callback(); }
}
};
this._state = 'dropped';
for (arrIndex = 0; arrIndex < arrCount; arrIndex++) {
this.collection(arr[arrIndex].name).drop(removePersist, afterDrop);
delete this._collection[arr[arrIndex].name];
}
this.emit('drop', this);
delete this._listeners;
delete this._core._db[this._name];
}
return true;
}
});
/**
* Gets a database instance by name.
* @memberof Core
* @param {String=} name Optional name of the database. If none is provided
* a random name is assigned.
* @returns {Db}
*/
Core.prototype.db = function (name) {
// Handle being passed an instance
if (name instanceof Db) {
return name;
}
if (!name) {
name = this.objectId();
}
this._db[name] = this._db[name] || new Db(name, this);
this._db[name].mongoEmulation(this.mongoEmulation());
return this._db[name];
};
/**
* Returns an array of databases that ForerunnerDB currently has.
* @memberof Core
* @param {String|RegExp=} search The optional search string or regular expression to use
* to match collection names against.
* @returns {Array} An array of objects containing details of each database
* that ForerunnerDB is currently managing and it's child entities.
*/
Core.prototype.databases = function (search) {
var arr = [],
tmpObj,
addDb,
i;
if (search) {
if (!(search instanceof RegExp)) {
// Turn the search into a regular expression
search = new RegExp(search);
}
}
for (i in this._db) {
if (this._db.hasOwnProperty(i)) {
addDb = true;
if (search) {
if (!search.exec(i)) {
addDb = false;
}
}
if (addDb) {
tmpObj = {
name: i,
children: []
};
if (this.shared.moduleExists('Collection')) {
tmpObj.children.push({
module: 'collection',
moduleName: 'Collections',
count: this._db[i].collections().length
});
}
if (this.shared.moduleExists('CollectionGroup')) {
tmpObj.children.push({
module: 'collectionGroup',
moduleName: 'Collection Groups',
count: this._db[i].collectionGroups().length
});
}
if (this.shared.moduleExists('Document')) {
tmpObj.children.push({
module: 'document',
moduleName: 'Documents',
count: this._db[i].documents().length
});
}
if (this.shared.moduleExists('Grid')) {
tmpObj.children.push({
module: 'grid',
moduleName: 'Grids',
count: this._db[i].grids().length
});
}
if (this.shared.moduleExists('Overview')) {
tmpObj.children.push({
module: 'overview',
moduleName: 'Overviews',
count: this._db[i].overviews().length
});
}
if (this.shared.moduleExists('View')) {
tmpObj.children.push({
module: 'view',
moduleName: 'Views',
count: this._db[i].views().length
});
}
arr.push(tmpObj);
}
}
}
arr.sort(function (a, b) {
return a.name.localeCompare(b.name);
});
return arr;
};
Shared.finishModule('Db');
module.exports = Db;
},{"./Checksum.js":5,"./Collection.js":6,"./Metrics.js":15,"./Overload":27,"./Shared":31}],10:[function(_dereq_,module,exports){
// geohash.js
// Geohash library for Javascript
// (c) 2008 David Troy
// Distributed under the MIT License
// Original at: https://github.com/davetroy/geohash-js
// Modified by Irrelon Software Limited (http://www.irrelon.com)
// to clean up and modularise the code using Node.js-style exports
// and add a few helper methods.
// @by Rob Evans - [email protected]
"use strict";
/*
Define some shared constants that will be used by all instances
of the module.
*/
var bits,
base32,
neighbors,
borders;
bits = [16, 8, 4, 2, 1];
base32 = "0123456789bcdefghjkmnpqrstuvwxyz";
neighbors = {
right: {even: "bc01fg45238967deuvhjyznpkmstqrwx"},
left: {even: "238967debc01fg45kmstqrwxuvhjyznp"},
top: {even: "p0r21436x8zb9dcf5h7kjnmqesgutwvy"},
bottom: {even: "14365h7k9dcfesgujnmqp0r2twvyx8zb"}
};
borders = {
right: {even: "bcfguvyz"},
left: {even: "0145hjnp"},
top: {even: "prxz"},
bottom: {even: "028b"}
};
neighbors.bottom.odd = neighbors.left.even;
neighbors.top.odd = neighbors.right.even;
neighbors.left.odd = neighbors.bottom.even;
neighbors.right.odd = neighbors.top.even;
borders.bottom.odd = borders.left.even;
borders.top.odd = borders.right.even;
borders.left.odd = borders.bottom.even;
borders.right.odd = borders.top.even;
var GeoHash = function () {};
GeoHash.prototype.refineInterval = function (interval, cd, mask) {
if (cd & mask) { //jshint ignore: line
interval[0] = (interval[0] + interval[1]) / 2;
} else {
interval[1] = (interval[0] + interval[1]) / 2;
}
};
/**
* Calculates all surrounding neighbours of a hash and returns them.
* @param {String} centerHash The hash at the center of the grid.
* @param options
* @returns {*}
*/
GeoHash.prototype.calculateNeighbours = function (centerHash, options) {
var response;
if (!options || options.type === 'object') {
response = {
center: centerHash,
left: this.calculateAdjacent(centerHash, 'left'),
right: this.calculateAdjacent(centerHash, 'right'),
top: this.calculateAdjacent(centerHash, 'top'),
bottom: this.calculateAdjacent(centerHash, 'bottom')
};
response.topLeft = this.calculateAdjacent(response.left, 'top');
response.topRight = this.calculateAdjacent(response.right, 'top');
response.bottomLeft = this.calculateAdjacent(response.left, 'bottom');
response.bottomRight = this.calculateAdjacent(response.right, 'bottom');
} else {
response = [];
response[4] = centerHash;
response[3] = this.calculateAdjacent(centerHash, 'left');
response[5] = this.calculateAdjacent(centerHash, 'right');
response[1] = this.calculateAdjacent(centerHash, 'top');
response[7] = this.calculateAdjacent(centerHash, 'bottom');
response[0] = this.calculateAdjacent(response[3], 'top');
response[2] = this.calculateAdjacent(response[5], 'top');
response[6] = this.calculateAdjacent(response[3], 'bottom');
response[8] = this.calculateAdjacent(response[5], 'bottom');
}
return response;
};
/**
* Calculates an adjacent hash to the hash passed, in the direction
* specified.
* @param {String} srcHash The hash to calculate adjacent to.
* @param {String} dir Either "top", "left", "bottom" or "right".
* @returns {String} The resulting geohash.
*/
GeoHash.prototype.calculateAdjacent = function (srcHash, dir) {
srcHash = srcHash.toLowerCase();
var lastChr = srcHash.charAt(srcHash.length - 1),
type = (srcHash.length % 2) ? 'odd' : 'even',
base = srcHash.substring(0, srcHash.length - 1);
if (borders[dir][type].indexOf(lastChr) !== -1) {
base = this.calculateAdjacent(base, dir);
}
return base + base32[neighbors[dir][type].indexOf(lastChr)];
};
/**
* Decodes a string geohash back to longitude/latitude.
* @param {String} geohash The hash to decode.
* @returns {Object}
*/
GeoHash.prototype.decode = function (geohash) {
var isEven = 1,
lat = [],
lon = [],
i, c, cd, j, mask,
latErr,
lonErr;
lat[0] = -90.0;
lat[1] = 90.0;
lon[0] = -180.0;
lon[1] = 180.0;
latErr = 90.0;
lonErr = 180.0;
for (i = 0; i < geohash.length; i++) {
c = geohash[i];
cd = base32.indexOf(c);
for (j = 0; j < 5; j++) {
mask = bits[j];
if (isEven) {
lonErr /= 2;
this.refineInterval(lon, cd, mask);
} else {
latErr /= 2;
this.refineInterval(lat, cd, mask);
}
isEven = !isEven;
}
}
lat[2] = (lat[0] + lat[1]) / 2;
lon[2] = (lon[0] + lon[1]) / 2;
return {
latitude: lat,
longitude: lon
};
};
/**
* Encodes a longitude/latitude to geohash string.
* @param latitude
* @param longitude
* @param {Number=} precision Length of the geohash string. Defaults to 12.
* @returns {String}
*/
GeoHash.prototype.encode = function (latitude, longitude, precision) {
var isEven = 1,
mid,
lat = [],
lon = [],
bit = 0,
ch = 0,
geoHash = "";
if (!precision) { precision = 12; }
lat[0] = -90.0;
lat[1] = 90.0;
lon[0] = -180.0;
lon[1] = 180.0;
while (geoHash.length < precision) {
if (isEven) {
mid = (lon[0] + lon[1]) / 2;
if (longitude > mid) {
ch |= bits[bit]; //jshint ignore: line
lon[0] = mid;
} else {
lon[1] = mid;
}
} else {
mid = (lat[0] + lat[1]) / 2;
if (latitude > mid) {
ch |= bits[bit]; //jshint ignore: line
lat[0] = mid;
} else {
lat[1] = mid;
}
}
isEven = !isEven;
if (bit < 4) {
bit++;
} else {
geoHash += base32[ch];
bit = 0;
ch = 0;
}
}
return geoHash;
};
module.exports = GeoHash;
},{}],11:[function(_dereq_,module,exports){
"use strict";
/*
name(string)
id(string)
rebuild(null)
state ?? needed?
match(query, options)
lookup(query, options)
insert(doc)
remove(doc)
primaryKey(string)
collection(collection)
*/
var Shared = _dereq_('./Shared'),
Path = _dereq_('./Path'),
BinaryTree = _dereq_('./BinaryTree'),
GeoHash = _dereq_('./GeoHash'),
sharedPathSolver = new Path(),
sharedGeoHashSolver = new GeoHash(),
// GeoHash Distances in Kilometers
geoHashDistance = [
5000,
1250,
156,
39.1,
4.89,
1.22,
0.153,
0.0382,
0.00477,
0.00119,
0.000149,
0.0000372
];
/**
* The index class used to instantiate 2d indexes that the database can
* use to handle high-performance geospatial queries.
* @constructor
*/
var Index2d = function () {
this.init.apply(this, arguments);
};
/**
* Create the index.
* @param {Object} keys The object with the keys that the user wishes the index
* to operate on.
* @param {Object} options Can be undefined, if passed is an object with arbitrary
* options keys and values.
* @param {Collection} collection The collection the index should be created for.
*/
Index2d.prototype.init = function (keys, options, collection) {
this._btree = new BinaryTree();
this._btree.index(keys);
this._size = 0;
this._id = this._itemKeyHash(keys, keys);
this._debug = options && options.debug ? options.debug : false;
this.unique(options && options.unique ? options.unique : false);
if (keys !== undefined) {
this.keys(keys);
}
if (collection !== undefined) {
this.collection(collection);
this._btree.primaryKey(collection.primaryKey());
}
this.name(options && options.name ? options.name : this._id);
this._btree.debug(this._debug);
};
Shared.addModule('Index2d', Index2d);
Shared.mixin(Index2d.prototype, 'Mixin.Common');
Shared.mixin(Index2d.prototype, 'Mixin.ChainReactor');
Shared.mixin(Index2d.prototype, 'Mixin.Sorting');
Index2d.prototype.id = function () {
return this._id;
};
Index2d.prototype.state = function () {
return this._state;
};
Index2d.prototype.size = function () {
return this._size;
};
Shared.synthesize(Index2d.prototype, 'data');
Shared.synthesize(Index2d.prototype, 'name');
Shared.synthesize(Index2d.prototype, 'collection');
Shared.synthesize(Index2d.prototype, 'type');
Shared.synthesize(Index2d.prototype, 'unique');
Index2d.prototype.keys = function (val) {
if (val !== undefined) {
this._keys = val;
// Count the keys
this._keyCount = sharedPathSolver.parse(this._keys).length;
return this;
}
return this._keys;
};
Index2d.prototype.rebuild = function () {
// Do we have a collection?
if (this._collection) {
// Get sorted data
var collection = this._collection.subset({}, {
$decouple: false,
$orderBy: this._keys
}),
collectionData = collection.find(),
dataIndex,
dataCount = collectionData.length;
// Clear the index data for the index
this._btree.clear();
this._size = 0;
if (this._unique) {
this._uniqueLookup = {};
}
// Loop the collection data
for (dataIndex = 0; dataIndex < dataCount; dataIndex++) {
this.insert(collectionData[dataIndex]);
}
}
this._state = {
name: this._name,
keys: this._keys,
indexSize: this._size,
built: new Date(),
updated: new Date(),
ok: true
};
};
Index2d.prototype.insert = function (dataItem, options) {
var uniqueFlag = this._unique,
uniqueHash;
dataItem = this.decouple(dataItem);
if (uniqueFlag) {
uniqueHash = this._itemHash(dataItem, this._keys);
this._uniqueLookup[uniqueHash] = dataItem;
}
// Convert 2d indexed values to geohashes
var keys = this._btree.keys(),
pathVal,
geoHash,
lng,
lat,
i;
for (i = 0; i < keys.length; i++) {
pathVal = sharedPathSolver.get(dataItem, keys[i].path);
if (pathVal instanceof Array) {
lng = pathVal[0];
lat = pathVal[1];
geoHash = sharedGeoHashSolver.encode(lng, lat);
sharedPathSolver.set(dataItem, keys[i].path, geoHash);
}
}
if (this._btree.insert(dataItem)) {
this._size++;
return true;
}
return false;
};
Index2d.prototype.remove = function (dataItem, options) {
var uniqueFlag = this._unique,
uniqueHash;
if (uniqueFlag) {
uniqueHash = this._itemHash(dataItem, this._keys);
delete this._uniqueLookup[uniqueHash];
}
if (this._btree.remove(dataItem)) {
this._size--;
return true;
}
return false;
};
Index2d.prototype.violation = function (dataItem) {
// Generate item hash
var uniqueHash = this._itemHash(dataItem, this._keys);
// Check if the item breaks the unique constraint
return Boolean(this._uniqueLookup[uniqueHash]);
};
Index2d.prototype.hashViolation = function (uniqueHash) {
// Check if the item breaks the unique constraint
return Boolean(this._uniqueLookup[uniqueHash]);
};
Index2d.prototype.lookup = function (query, options) {
// Loop the indexed keys and determine if the query has any operators
// that we want to handle differently from a standard lookup
var keys = this._btree.keys(),
pathStr,
pathVal,
results,
i;
for (i = 0; i < keys.length; i++) {
pathStr = keys[i].path;
pathVal = sharedPathSolver.get(query, pathStr);
if (typeof pathVal === 'object') {
if (pathVal.$near) {
results = [];
// Do a near point lookup
results = results.concat(this.near(pathStr, pathVal.$near, options));
}
if (pathVal.$geoWithin) {
results = [];
// Do a geoWithin shape lookup
results = results.concat(this.geoWithin(pathStr, pathVal.$geoWithin, options));
}
return results;
}
}
return this._btree.lookup(query, options);
};
Index2d.prototype.near = function (pathStr, query, options) {
var self = this,
geoHash,
neighbours,
visited,
search,
results,
finalResults = [],
precision,
maxDistanceKm,
distance,
distCache,
latLng,
pk = this._collection.primaryKey(),
i;
// Calculate the required precision to encapsulate the distance
// TODO: Instead of opting for the "one size larger" than the distance boxes,
// TODO: we should calculate closest divisible box size as a multiple and then
// TODO: scan neighbours until we have covered the area otherwise we risk
// TODO: opening the results up to vastly more information as the box size
// TODO: increases dramatically between the geohash precisions
if (query.$distanceUnits === 'km') {
maxDistanceKm = query.$maxDistance;
for (i = 0; i < geoHashDistance.length; i++) {
if (maxDistanceKm > geoHashDistance[i]) {
precision = i;
break;
}
}
if (precision === 0) {
precision = 1;
}
} else if (query.$distanceUnits === 'miles') {
maxDistanceKm = query.$maxDistance * 1.60934;
for (i = 0; i < geoHashDistance.length; i++) {
if (maxDistanceKm > geoHashDistance[i]) {
precision = i;
break;
}
}
if (precision === 0) {
precision = 1;
}
}
// Get the lngLat geohash from the query
geoHash = sharedGeoHashSolver.encode(query.$point[0], query.$point[1], precision);
// Calculate 9 box geohashes
neighbours = sharedGeoHashSolver.calculateNeighbours(geoHash, {type: 'array'});
// Lookup all matching co-ordinates from the btree
results = [];
visited = 0;
for (i = 0; i < 9; i++) {
search = this._btree.startsWith(pathStr, neighbours[i]);
visited += search._visited;
results = results.concat(search);
}
// Work with original data
results = this._collection._primaryIndex.lookup(results);
if (results.length) {
distance = {};
// Loop the results and calculate distance
for (i = 0; i < results.length; i++) {
latLng = sharedPathSolver.get(results[i], pathStr);
distCache = distance[results[i][pk]] = this.distanceBetweenPoints(query.$point[0], query.$point[1], latLng[0], latLng[1]);
if (distCache <= maxDistanceKm) {
// Add item inside radius distance
finalResults.push(results[i]);
}
}
// Sort by distance from center
finalResults.sort(function (a, b) {
return self.sortAsc(distance[a[pk]], distance[b[pk]]);
});
}
// Return data
return finalResults;
};
Index2d.prototype.geoWithin = function (pathStr, query, options) {
return [];
};
Index2d.prototype.distanceBetweenPoints = function (lat1, lng1, lat2, lng2) {
var R = 6371; // kilometres
var lat1Rad = this.toRadians(lat1);
var lat2Rad = this.toRadians(lat2);
var lat2MinusLat1Rad = this.toRadians(lat2-lat1);
var lng2MinusLng1Rad = this.toRadians(lng2-lng1);
var a = Math.sin(lat2MinusLat1Rad/2) * Math.sin(lat2MinusLat1Rad/2) +
Math.cos(lat1Rad) * Math.cos(lat2Rad) *
Math.sin(lng2MinusLng1Rad/2) * Math.sin(lng2MinusLng1Rad/2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
return R * c;
};
Index2d.prototype.toRadians = function (degrees) {
return degrees * 0.01747722222222;
};
Index2d.prototype.match = function (query, options) {
// TODO: work out how to represent that this is a better match if the query has $near than
// TODO: a basic btree index which will not be able to resolve a $near operator
return this._btree.match(query, options);
};
Index2d.prototype._itemHash = function (item, keys) {
var path = new Path(),
pathData,
hash = '',
k;
pathData = path.parse(keys);
for (k = 0; k < pathData.length; k++) {
if (hash) { hash += '_'; }
hash += path.value(item, pathData[k].path).join(':');
}
return hash;
};
Index2d.prototype._itemKeyHash = function (item, keys) {
var path = new Path(),
pathData,
hash = '',
k;
pathData = path.parse(keys);
for (k = 0; k < pathData.length; k++) {
if (hash) { hash += '_'; }
hash += path.keyValue(item, pathData[k].path);
}
return hash;
};
Index2d.prototype._itemHashArr = function (item, keys) {
var path = new Path(),
pathData,
//hash = '',
hashArr = [],
valArr,
i, k, j;
pathData = path.parse(keys);
for (k = 0; k < pathData.length; k++) {
valArr = path.value(item, pathData[k].path);
for (i = 0; i < valArr.length; i++) {
if (k === 0) {
// Setup the initial hash array
hashArr.push(valArr[i]);
} else {
// Loop the hash array and concat the value to it
for (j = 0; j < hashArr.length; j++) {
hashArr[j] = hashArr[j] + '_' + valArr[i];
}
}
}
}
return hashArr;
};
// Register this index on the shared object
Shared.index['2d'] = Index2d;
Shared.finishModule('Index2d');
module.exports = Index2d;
},{"./BinaryTree":4,"./GeoHash":10,"./Path":28,"./Shared":31}],12:[function(_dereq_,module,exports){
"use strict";
/*
name(string)
id(string)
rebuild(null)
state ?? needed?
match(query, options)
lookup(query, options)
insert(doc)
remove(doc)
primaryKey(string)
collection(collection)
*/
var Shared = _dereq_('./Shared'),
Path = _dereq_('./Path'),
BinaryTree = _dereq_('./BinaryTree');
/**
* The index class used to instantiate btree indexes that the database can
* use to speed up queries on collections and views.
* @constructor
*/
var IndexBinaryTree = function () {
this.init.apply(this, arguments);
};
IndexBinaryTree.prototype.init = function (keys, options, collection) {
this._btree = new BinaryTree();
this._btree.index(keys);
this._size = 0;
this._id = this._itemKeyHash(keys, keys);
this._debug = options && options.debug ? options.debug : false;
this.unique(options && options.unique ? options.unique : false);
if (keys !== undefined) {
this.keys(keys);
}
if (collection !== undefined) {
this.collection(collection);
this._btree.primaryKey(collection.primaryKey());
}
this.name(options && options.name ? options.name : this._id);
this._btree.debug(this._debug);
};
Shared.addModule('IndexBinaryTree', IndexBinaryTree);
Shared.mixin(IndexBinaryTree.prototype, 'Mixin.ChainReactor');
Shared.mixin(IndexBinaryTree.prototype, 'Mixin.Sorting');
IndexBinaryTree.prototype.id = function () {
return this._id;
};
IndexBinaryTree.prototype.state = function () {
return this._state;
};
IndexBinaryTree.prototype.size = function () {
return this._size;
};
Shared.synthesize(IndexBinaryTree.prototype, 'data');
Shared.synthesize(IndexBinaryTree.prototype, 'name');
Shared.synthesize(IndexBinaryTree.prototype, 'collection');
Shared.synthesize(IndexBinaryTree.prototype, 'type');
Shared.synthesize(IndexBinaryTree.prototype, 'unique');
IndexBinaryTree.prototype.keys = function (val) {
if (val !== undefined) {
this._keys = val;
// Count the keys
this._keyCount = (new Path()).parse(this._keys).length;
return this;
}
return this._keys;
};
IndexBinaryTree.prototype.rebuild = function () {
// Do we have a collection?
if (this._collection) {
// Get sorted data
var collection = this._collection.subset({}, {
$decouple: false,
$orderBy: this._keys
}),
collectionData = collection.find(),
dataIndex,
dataCount = collectionData.length;
// Clear the index data for the index
this._btree.clear();
this._size = 0;
if (this._unique) {
this._uniqueLookup = {};
}
// Loop the collection data
for (dataIndex = 0; dataIndex < dataCount; dataIndex++) {
this.insert(collectionData[dataIndex]);
}
}
this._state = {
name: this._name,
keys: this._keys,
indexSize: this._size,
built: new Date(),
updated: new Date(),
ok: true
};
};
IndexBinaryTree.prototype.insert = function (dataItem, options) {
var uniqueFlag = this._unique,
uniqueHash;
if (uniqueFlag) {
uniqueHash = this._itemHash(dataItem, this._keys);
this._uniqueLookup[uniqueHash] = dataItem;
}
if (this._btree.insert(dataItem)) {
this._size++;
return true;
}
return false;
};
IndexBinaryTree.prototype.remove = function (dataItem, options) {
var uniqueFlag = this._unique,
uniqueHash;
if (uniqueFlag) {
uniqueHash = this._itemHash(dataItem, this._keys);
delete this._uniqueLookup[uniqueHash];
}
if (this._btree.remove(dataItem)) {
this._size--;
return true;
}
return false;
};
IndexBinaryTree.prototype.violation = function (dataItem) {
// Generate item hash
var uniqueHash = this._itemHash(dataItem, this._keys);
// Check if the item breaks the unique constraint
return Boolean(this._uniqueLookup[uniqueHash]);
};
IndexBinaryTree.prototype.hashViolation = function (uniqueHash) {
// Check if the item breaks the unique constraint
return Boolean(this._uniqueLookup[uniqueHash]);
};
IndexBinaryTree.prototype.lookup = function (query, options) {
return this._btree.lookup(query, options);
};
IndexBinaryTree.prototype.match = function (query, options) {
return this._btree.match(query, options);
};
IndexBinaryTree.prototype._itemHash = function (item, keys) {
var path = new Path(),
pathData,
hash = '',
k;
pathData = path.parse(keys);
for (k = 0; k < pathData.length; k++) {
if (hash) { hash += '_'; }
hash += path.value(item, pathData[k].path).join(':');
}
return hash;
};
IndexBinaryTree.prototype._itemKeyHash = function (item, keys) {
var path = new Path(),
pathData,
hash = '',
k;
pathData = path.parse(keys);
for (k = 0; k < pathData.length; k++) {
if (hash) { hash += '_'; }
hash += path.keyValue(item, pathData[k].path);
}
return hash;
};
IndexBinaryTree.prototype._itemHashArr = function (item, keys) {
var path = new Path(),
pathData,
//hash = '',
hashArr = [],
valArr,
i, k, j;
pathData = path.parse(keys);
for (k = 0; k < pathData.length; k++) {
valArr = path.value(item, pathData[k].path);
for (i = 0; i < valArr.length; i++) {
if (k === 0) {
// Setup the initial hash array
hashArr.push(valArr[i]);
} else {
// Loop the hash array and concat the value to it
for (j = 0; j < hashArr.length; j++) {
hashArr[j] = hashArr[j] + '_' + valArr[i];
}
}
}
}
return hashArr;
};
// Register this index on the shared object
Shared.index.btree = IndexBinaryTree;
Shared.finishModule('IndexBinaryTree');
module.exports = IndexBinaryTree;
},{"./BinaryTree":4,"./Path":28,"./Shared":31}],13:[function(_dereq_,module,exports){
"use strict";
var Shared = _dereq_('./Shared'),
Path = _dereq_('./Path');
/**
* The index class used to instantiate hash map indexes that the database can
* use to speed up queries on collections and views.
* @constructor
*/
var IndexHashMap = function () {
this.init.apply(this, arguments);
};
IndexHashMap.prototype.init = function (keys, options, collection) {
this._crossRef = {};
this._size = 0;
this._id = this._itemKeyHash(keys, keys);
this.data({});
this.unique(options && options.unique ? options.unique : false);
if (keys !== undefined) {
this.keys(keys);
}
if (collection !== undefined) {
this.collection(collection);
}
this.name(options && options.name ? options.name : this._id);
};
Shared.addModule('IndexHashMap', IndexHashMap);
Shared.mixin(IndexHashMap.prototype, 'Mixin.ChainReactor');
IndexHashMap.prototype.id = function () {
return this._id;
};
IndexHashMap.prototype.state = function () {
return this._state;
};
IndexHashMap.prototype.size = function () {
return this._size;
};
Shared.synthesize(IndexHashMap.prototype, 'data');
Shared.synthesize(IndexHashMap.prototype, 'name');
Shared.synthesize(IndexHashMap.prototype, 'collection');
Shared.synthesize(IndexHashMap.prototype, 'type');
Shared.synthesize(IndexHashMap.prototype, 'unique');
IndexHashMap.prototype.keys = function (val) {
if (val !== undefined) {
this._keys = val;
// Count the keys
this._keyCount = (new Path()).parse(this._keys).length;
return this;
}
return this._keys;
};
IndexHashMap.prototype.rebuild = function () {
// Do we have a collection?
if (this._collection) {
// Get sorted data
var collection = this._collection.subset({}, {
$decouple: false,
$orderBy: this._keys
}),
collectionData = collection.find(),
dataIndex,
dataCount = collectionData.length;
// Clear the index data for the index
this._data = {};
this._size = 0;
if (this._unique) {
this._uniqueLookup = {};
}
// Loop the collection data
for (dataIndex = 0; dataIndex < dataCount; dataIndex++) {
this.insert(collectionData[dataIndex]);
}
}
this._state = {
name: this._name,
keys: this._keys,
indexSize: this._size,
built: new Date(),
updated: new Date(),
ok: true
};
};
IndexHashMap.prototype.insert = function (dataItem, options) {
var uniqueFlag = this._unique,
uniqueHash,
itemHashArr,
hashIndex;
if (uniqueFlag) {
uniqueHash = this._itemHash(dataItem, this._keys);
this._uniqueLookup[uniqueHash] = dataItem;
}
// Generate item hash
itemHashArr = this._itemHashArr(dataItem, this._keys);
// Get the path search results and store them
for (hashIndex = 0; hashIndex < itemHashArr.length; hashIndex++) {
this.pushToPathValue(itemHashArr[hashIndex], dataItem);
}
};
IndexHashMap.prototype.update = function (dataItem, options) {
// TODO: Write updates to work
// 1: Get uniqueHash for the dataItem primary key value (may need to generate a store for this)
// 2: Remove the uniqueHash as it currently stands
// 3: Generate a new uniqueHash for dataItem
// 4: Insert the new uniqueHash
};
IndexHashMap.prototype.remove = function (dataItem, options) {
var uniqueFlag = this._unique,
uniqueHash,
itemHashArr,
hashIndex;
if (uniqueFlag) {
uniqueHash = this._itemHash(dataItem, this._keys);
delete this._uniqueLookup[uniqueHash];
}
// Generate item hash
itemHashArr = this._itemHashArr(dataItem, this._keys);
// Get the path search results and store them
for (hashIndex = 0; hashIndex < itemHashArr.length; hashIndex++) {
this.pullFromPathValue(itemHashArr[hashIndex], dataItem);
}
};
IndexHashMap.prototype.violation = function (dataItem) {
// Generate item hash
var uniqueHash = this._itemHash(dataItem, this._keys);
// Check if the item breaks the unique constraint
return Boolean(this._uniqueLookup[uniqueHash]);
};
IndexHashMap.prototype.hashViolation = function (uniqueHash) {
// Check if the item breaks the unique constraint
return Boolean(this._uniqueLookup[uniqueHash]);
};
IndexHashMap.prototype.pushToPathValue = function (hash, obj) {
var pathValArr = this._data[hash] = this._data[hash] || [];
// Make sure we have not already indexed this object at this path/value
if (pathValArr.indexOf(obj) === -1) {
// Index the object
pathValArr.push(obj);
// Record the reference to this object in our index size
this._size++;
// Cross-reference this association for later lookup
this.pushToCrossRef(obj, pathValArr);
}
};
IndexHashMap.prototype.pullFromPathValue = function (hash, obj) {
var pathValArr = this._data[hash],
indexOfObject;
// Make sure we have already indexed this object at this path/value
indexOfObject = pathValArr.indexOf(obj);
if (indexOfObject > -1) {
// Un-index the object
pathValArr.splice(indexOfObject, 1);
// Record the reference to this object in our index size
this._size--;
// Remove object cross-reference
this.pullFromCrossRef(obj, pathValArr);
}
// Check if we should remove the path value array
if (!pathValArr.length) {
// Remove the array
delete this._data[hash];
}
};
IndexHashMap.prototype.pull = function (obj) {
// Get all places the object has been used and remove them
var id = obj[this._collection.primaryKey()],
crossRefArr = this._crossRef[id],
arrIndex,
arrCount = crossRefArr.length,
arrItem;
for (arrIndex = 0; arrIndex < arrCount; arrIndex++) {
arrItem = crossRefArr[arrIndex];
// Remove item from this index lookup array
this._pullFromArray(arrItem, obj);
}
// Record the reference to this object in our index size
this._size--;
// Now remove the cross-reference entry for this object
delete this._crossRef[id];
};
IndexHashMap.prototype._pullFromArray = function (arr, obj) {
var arrCount = arr.length;
while (arrCount--) {
if (arr[arrCount] === obj) {
arr.splice(arrCount, 1);
}
}
};
IndexHashMap.prototype.pushToCrossRef = function (obj, pathValArr) {
var id = obj[this._collection.primaryKey()],
crObj;
this._crossRef[id] = this._crossRef[id] || [];
// Check if the cross-reference to the pathVal array already exists
crObj = this._crossRef[id];
if (crObj.indexOf(pathValArr) === -1) {
// Add the cross-reference
crObj.push(pathValArr);
}
};
IndexHashMap.prototype.pullFromCrossRef = function (obj, pathValArr) {
var id = obj[this._collection.primaryKey()];
delete this._crossRef[id];
};
IndexHashMap.prototype.lookup = function (query) {
return this._data[this._itemHash(query, this._keys)] || [];
};
IndexHashMap.prototype.match = function (query, options) {
// Check if the passed query has data in the keys our index
// operates on and if so, is the query sort matching our order
var pathSolver = new Path();
var indexKeyArr = pathSolver.parseArr(this._keys),
queryArr = pathSolver.parseArr(query),
matchedKeys = [],
matchedKeyCount = 0,
i;
// Loop the query array and check the order of keys against the
// index key array to see if this index can be used
for (i = 0; i < indexKeyArr.length; i++) {
if (queryArr[i] === indexKeyArr[i]) {
matchedKeyCount++;
matchedKeys.push(queryArr[i]);
} else {
// Query match failed - this is a hash map index so partial key match won't work
return {
matchedKeys: [],
totalKeyCount: queryArr.length,
score: 0
};
}
}
return {
matchedKeys: matchedKeys,
totalKeyCount: queryArr.length,
score: matchedKeyCount
};
//return pathSolver.countObjectPaths(this._keys, query);
};
IndexHashMap.prototype._itemHash = function (item, keys) {
var path = new Path(),
pathData,
hash = '',
k;
pathData = path.parse(keys);
for (k = 0; k < pathData.length; k++) {
if (hash) { hash += '_'; }
hash += path.value(item, pathData[k].path).join(':');
}
return hash;
};
IndexHashMap.prototype._itemKeyHash = function (item, keys) {
var path = new Path(),
pathData,
hash = '',
k;
pathData = path.parse(keys);
for (k = 0; k < pathData.length; k++) {
if (hash) { hash += '_'; }
hash += path.keyValue(item, pathData[k].path);
}
return hash;
};
IndexHashMap.prototype._itemHashArr = function (item, keys) {
var path = new Path(),
pathData,
//hash = '',
hashArr = [],
valArr,
i, k, j;
pathData = path.parse(keys);
for (k = 0; k < pathData.length; k++) {
valArr = path.value(item, pathData[k].path);
for (i = 0; i < valArr.length; i++) {
if (k === 0) {
// Setup the initial hash array
hashArr.push(valArr[i]);
} else {
// Loop the hash array and concat the value to it
for (j = 0; j < hashArr.length; j++) {
hashArr[j] = hashArr[j] + '_' + valArr[i];
}
}
}
}
return hashArr;
};
// Register this index on the shared object
Shared.index.hashed = IndexHashMap;
Shared.finishModule('IndexHashMap');
module.exports = IndexHashMap;
},{"./Path":28,"./Shared":31}],14:[function(_dereq_,module,exports){
"use strict";
var Shared = _dereq_('./Shared');
/**
* The key value store class used when storing basic in-memory KV data,
* and can be queried for quick retrieval. Mostly used for collection
* primary key indexes and lookups.
* @param {String=} name Optional KV store name.
* @constructor
*/
var KeyValueStore = function (name) {
this.init.apply(this, arguments);
};
KeyValueStore.prototype.init = function (name) {
this._name = name;
this._data = {};
this._primaryKey = '_id';
};
Shared.addModule('KeyValueStore', KeyValueStore);
Shared.mixin(KeyValueStore.prototype, 'Mixin.ChainReactor');
/**
* Get / set the name of the key/value store.
* @param {String} val The name to set.
* @returns {*}
*/
Shared.synthesize(KeyValueStore.prototype, 'name');
/**
* Get / set the primary key.
* @param {String} key The key to set.
* @returns {*}
*/
KeyValueStore.prototype.primaryKey = function (key) {
if (key !== undefined) {
this._primaryKey = key;
return this;
}
return this._primaryKey;
};
/**
* Removes all data from the store.
* @returns {*}
*/
KeyValueStore.prototype.truncate = function () {
this._data = {};
return this;
};
/**
* Sets data against a key in the store.
* @param {String} key The key to set data for.
* @param {*} value The value to assign to the key.
* @returns {*}
*/
KeyValueStore.prototype.set = function (key, value) {
this._data[key] = value ? value : true;
return this;
};
/**
* Gets data stored for the passed key.
* @param {String} key The key to get data for.
* @returns {*}
*/
KeyValueStore.prototype.get = function (key) {
return this._data[key];
};
/**
* Get / set the primary key.
* @param {*} val A lookup query.
* @returns {*}
*/
KeyValueStore.prototype.lookup = function (val) {
var pk = this._primaryKey,
valType = typeof val,
arrIndex,
arrCount,
lookupItem,
result = [];
// Check for early exit conditions
if (valType === 'string' || valType === 'number') {
lookupItem = this.get(val);
if (lookupItem !== undefined) {
return [lookupItem];
} else {
return [];
}
} else if (valType === 'object') {
if (val instanceof Array) {
// An array of primary keys, find all matches
arrCount = val.length;
result = [];
for (arrIndex = 0; arrIndex < arrCount; arrIndex++) {
lookupItem = this.lookup(val[arrIndex]);
if (lookupItem) {
if (lookupItem instanceof Array) {
result = result.concat(lookupItem);
} else {
result.push(lookupItem);
}
}
}
return result;
} else if (val[pk]) {
return this.lookup(val[pk]);
}
}
// COMMENTED AS CODE WILL NEVER BE REACHED
// Complex lookup
/*lookupData = this._lookupKeys(val);
keys = lookupData.keys;
negate = lookupData.negate;
if (!negate) {
// Loop keys and return values
for (arrIndex = 0; arrIndex < keys.length; arrIndex++) {
result.push(this.get(keys[arrIndex]));
}
} else {
// Loop data and return non-matching keys
for (arrIndex in this._data) {
if (this._data.hasOwnProperty(arrIndex)) {
if (keys.indexOf(arrIndex) === -1) {
result.push(this.get(arrIndex));
}
}
}
}
return result;*/
};
// COMMENTED AS WE ARE NOT CURRENTLY PASSING COMPLEX QUERIES TO KEYVALUESTORE INDEXES
/*KeyValueStore.prototype._lookupKeys = function (val) {
var pk = this._primaryKey,
valType = typeof val,
arrIndex,
arrCount,
lookupItem,
bool,
result;
if (valType === 'string' || valType === 'number') {
return {
keys: [val],
negate: false
};
} else if (valType === 'object') {
if (val instanceof RegExp) {
// Create new data
result = [];
for (arrIndex in this._data) {
if (this._data.hasOwnProperty(arrIndex)) {
if (val.test(arrIndex)) {
result.push(arrIndex);
}
}
}
return {
keys: result,
negate: false
};
} else if (val instanceof Array) {
// An array of primary keys, find all matches
arrCount = val.length;
result = [];
for (arrIndex = 0; arrIndex < arrCount; arrIndex++) {
result = result.concat(this._lookupKeys(val[arrIndex]).keys);
}
return {
keys: result,
negate: false
};
} else if (val.$in && (val.$in instanceof Array)) {
return {
keys: this._lookupKeys(val.$in).keys,
negate: false
};
} else if (val.$nin && (val.$nin instanceof Array)) {
return {
keys: this._lookupKeys(val.$nin).keys,
negate: true
};
} else if (val.$ne) {
return {
keys: this._lookupKeys(val.$ne, true).keys,
negate: true
};
} else if (val.$or && (val.$or instanceof Array)) {
// Create new data
result = [];
for (arrIndex = 0; arrIndex < val.$or.length; arrIndex++) {
result = result.concat(this._lookupKeys(val.$or[arrIndex]).keys);
}
return {
keys: result,
negate: false
};
} else if (val[pk]) {
return this._lookupKeys(val[pk]);
}
}
};*/
/**
* Removes data for the given key from the store.
* @param {String} key The key to un-set.
* @returns {*}
*/
KeyValueStore.prototype.unSet = function (key) {
delete this._data[key];
return this;
};
/**
* Sets data for the give key in the store only where the given key
* does not already have a value in the store.
* @param {String} key The key to set data for.
* @param {*} value The value to assign to the key.
* @returns {Boolean} True if data was set or false if data already
* exists for the key.
*/
KeyValueStore.prototype.uniqueSet = function (key, value) {
if (this._data[key] === undefined) {
this._data[key] = value;
return true;
}
return false;
};
Shared.finishModule('KeyValueStore');
module.exports = KeyValueStore;
},{"./Shared":31}],15:[function(_dereq_,module,exports){
"use strict";
var Shared = _dereq_('./Shared'),
Operation = _dereq_('./Operation');
/**
* The metrics class used to store details about operations.
* @constructor
*/
var Metrics = function () {
this.init.apply(this, arguments);
};
Metrics.prototype.init = function () {
this._data = [];
};
Shared.addModule('Metrics', Metrics);
Shared.mixin(Metrics.prototype, 'Mixin.ChainReactor');
/**
* Creates an operation within the metrics instance and if metrics
* are currently enabled (by calling the start() method) the operation
* is also stored in the metrics log.
* @param {String} name The name of the operation.
* @returns {Operation}
*/
Metrics.prototype.create = function (name) {
var op = new Operation(name);
if (this._enabled) {
this._data.push(op);
}
return op;
};
/**
* Starts logging operations.
* @returns {Metrics}
*/
Metrics.prototype.start = function () {
this._enabled = true;
return this;
};
/**
* Stops logging operations.
* @returns {Metrics}
*/
Metrics.prototype.stop = function () {
this._enabled = false;
return this;
};
/**
* Clears all logged operations.
* @returns {Metrics}
*/
Metrics.prototype.clear = function () {
this._data = [];
return this;
};
/**
* Returns an array of all logged operations.
* @returns {Array}
*/
Metrics.prototype.list = function () {
return this._data;
};
Shared.finishModule('Metrics');
module.exports = Metrics;
},{"./Operation":26,"./Shared":31}],16:[function(_dereq_,module,exports){
"use strict";
var CRUD = {
preSetData: function () {
},
postSetData: function () {
}
};
module.exports = CRUD;
},{}],17:[function(_dereq_,module,exports){
"use strict";
/**
* The chain reactor mixin, provides methods to the target object that allow chain
* reaction events to propagate to the target and be handled, processed and passed
* on down the chain.
* @mixin
*/
var ChainReactor = {
/**
* Creates a chain link between the current reactor node and the passed
* reactor node. Chain packets that are send by this reactor node will
* then be propagated to the passed node for subsequent packets.
* @param {*} obj The chain reactor node to link to.
*/
chain: function (obj) {
if (this.debug && this.debug()) {
if (obj._reactorIn && obj._reactorOut) {
console.log(obj._reactorIn.logIdentifier() + ' Adding target "' + obj._reactorOut.instanceIdentifier() + '" to the chain reactor target list');
} else {
console.log(this.logIdentifier() + ' Adding target "' + obj.instanceIdentifier() + '" to the chain reactor target list');
}
}
this._chain = this._chain || [];
var index = this._chain.indexOf(obj);
if (index === -1) {
this._chain.push(obj);
}
},
/**
* Removes a chain link between the current reactor node and the passed
* reactor node. Chain packets sent from this reactor node will no longer
* be received by the passed node.
* @param {*} obj The chain reactor node to unlink from.
*/
unChain: function (obj) {
if (this.debug && this.debug()) {
if (obj._reactorIn && obj._reactorOut) {
console.log(obj._reactorIn.logIdentifier() + ' Removing target "' + obj._reactorOut.instanceIdentifier() + '" from the chain reactor target list');
} else {
console.log(this.logIdentifier() + ' Removing target "' + obj.instanceIdentifier() + '" from the chain reactor target list');
}
}
if (this._chain) {
var index = this._chain.indexOf(obj);
if (index > -1) {
this._chain.splice(index, 1);
}
}
},
/**
* Determines if this chain reactor node has any listeners downstream.
* @returns {Boolean} True if there are nodes downstream of this node.
*/
chainWillSend: function () {
return Boolean(this._chain);
},
/**
* Sends a chain reactor packet downstream from this node to any of its
* chained targets that were linked to this node via a call to chain().
* @param {String} type The type of chain reactor packet to send. This
* can be any string but the receiving reactor nodes will not react to
* it unless they recognise the string. Built-in strings include: "insert",
* "update", "remove", "setData" and "debug".
* @param {Object} data A data object that usually contains a key called
* "dataSet" which is an array of items to work on, and can contain other
* custom keys that help describe the operation.
* @param {Object=} options An options object. Can also contain custom
* key/value pairs that your custom chain reactor code can operate on.
*/
chainSend: function (type, data, options) {
if (this._chain) {
var arr = this._chain,
arrItem,
count = arr.length,
index,
dataCopy = this.decouple(data, count);
for (index = 0; index < count; index++) {
arrItem = arr[index];
if (!arrItem._state || (arrItem._state && !arrItem.isDropped())) {
if (this.debug && this.debug()) {
if (arrItem._reactorIn && arrItem._reactorOut) {
console.log(arrItem._reactorIn.logIdentifier() + ' Sending data down the chain reactor pipe to "' + arrItem._reactorOut.instanceIdentifier() + '"');
} else {
console.log(this.logIdentifier() + ' Sending data down the chain reactor pipe to "' + arrItem.instanceIdentifier() + '"');
}
}
if (arrItem.chainReceive) {
arrItem.chainReceive(this, type, dataCopy[index], options);
}
} else {
console.log('Reactor Data:', type, data, options);
console.log('Reactor Node:', arrItem);
throw('Chain reactor attempting to send data to target reactor node that is in a dropped state!');
}
}
}
},
/**
* Handles receiving a chain reactor message that was sent via the chainSend()
* method. Creates the chain packet object and then allows it to be processed.
* @param {Object} sender The node that is sending the packet.
* @param {String} type The type of packet.
* @param {Object} data The data related to the packet.
* @param {Object=} options An options object.
*/
chainReceive: function (sender, type, data, options) {
var chainPacket = {
sender: sender,
type: type,
data: data,
options: options
},
cancelPropagate = false;
if (this.debug && this.debug()) {
console.log(this.logIdentifier() + ' Received data from parent reactor node');
}
// Check if we have a chain handler method
if (this._chainHandler) {
// Fire our internal handler
cancelPropagate = this._chainHandler(chainPacket);
}
// Check if we were told to cancel further propagation
if (!cancelPropagate) {
// Propagate the message down the chain
this.chainSend(chainPacket.type, chainPacket.data, chainPacket.options);
}
}
};
module.exports = ChainReactor;
},{}],18:[function(_dereq_,module,exports){
"use strict";
var idCounter = 0,
Overload = _dereq_('./Overload'),
Serialiser = _dereq_('./Serialiser'),
Common,
serialiser = new Serialiser();
/**
* Provides commonly used methods to most classes in ForerunnerDB.
* @mixin
*/
Common = {
// Expose the serialiser object so it can be extended with new data handlers.
serialiser: serialiser,
/**
* Generates a JSON serialisation-compatible object instance. After the
* instance has been passed through this method, it will be able to survive
* a JSON.stringify() and JSON.parse() cycle and still end up as an
* instance at the end. Further information about this process can be found
* in the ForerunnerDB wiki at: https://github.com/Irrelon/ForerunnerDB/wiki/Serialiser-&-Performance-Benchmarks
* @param {*} val The object instance such as "new Date()" or "new RegExp()".
*/
make: function (val) {
// This is a conversion request, hand over to serialiser
return serialiser.convert(val);
},
/**
* Gets / sets data in the item store. The store can be used to set and
* retrieve data against a key. Useful for adding arbitrary key/value data
* to a collection / view etc and retrieving it later.
* @param {String|*} key The key under which to store the passed value or
* retrieve the existing stored value.
* @param {*=} val Optional value. If passed will overwrite the existing value
* stored against the specified key if one currently exists.
* @returns {*}
*/
store: function (key, val) {
if (key !== undefined) {
if (val !== undefined) {
// Store the data
this._store = this._store || {};
this._store[key] = val;
return this;
}
if (this._store) {
return this._store[key];
}
}
return undefined;
},
/**
* Removes a previously stored key/value pair from the item store, set previously
* by using the store() method.
* @param {String|*} key The key of the key/value pair to remove;
* @returns {Common} Returns this for chaining.
*/
unStore: function (key) {
if (key !== undefined) {
delete this._store[key];
}
return this;
},
/**
* Returns a non-referenced version of the passed object / array.
* @param {Object} data The object or array to return as a non-referenced version.
* @param {Number=} copies Optional number of copies to produce. If specified, the return
* value will be an array of decoupled objects, each distinct from the other.
* @returns {*}
*/
decouple: function (data, copies) {
if (data !== undefined && data !== "") {
if (!copies) {
return this.jParse(this.jStringify(data));
} else {
var i,
json = this.jStringify(data),
copyArr = [];
for (i = 0; i < copies; i++) {
copyArr.push(this.jParse(json));
}
return copyArr;
}
}
return undefined;
},
/**
* Parses and returns data from stringified version.
* @param {String} data The stringified version of data to parse.
* @returns {Object} The parsed JSON object from the data.
*/
jParse: function (data) {
return JSON.parse(data, serialiser.reviver());
},
/**
* Converts a JSON object into a stringified version.
* @param {Object} data The data to stringify.
* @returns {String} The stringified data.
*/
jStringify: function (data) {
//return serialiser.stringify(data);
return JSON.stringify(data);
},
/**
* Generates a new 16-character hexadecimal unique ID or
* generates a new 16-character hexadecimal ID based on
* the passed string. Will always generate the same ID
* for the same string.
* @param {String=} str A string to generate the ID from.
* @return {String}
*/
objectId: function (str) {
var id,
pow = Math.pow(10, 17);
if (!str) {
idCounter++;
id = (idCounter + (
Math.random() * pow +
Math.random() * pow +
Math.random() * pow +
Math.random() * pow
)).toString(16);
} else {
var val = 0,
count = str.length,
i;
for (i = 0; i < count; i++) {
val += str.charCodeAt(i) * pow;
}
id = val.toString(16);
}
return id;
},
/**
* Generates a unique hash for the passed object.
* @param {Object} obj The object to generate a hash for.
* @returns {String}
*/
hash: function (obj) {
return JSON.stringify(obj);
},
/**
* Gets / sets debug flag that can enable debug message output to the
* console if required.
* @param {Boolean} val The value to set debug flag to.
* @return {Boolean} True if enabled, false otherwise.
*/
/**
* Sets debug flag for a particular type that can enable debug message
* output to the console if required.
* @param {String} type The name of the debug type to set flag for.
* @param {Boolean} val The value to set debug flag to.
* @return {Boolean} True if enabled, false otherwise.
*/
debug: new Overload([
function () {
return this._debug && this._debug.all;
},
function (val) {
if (val !== undefined) {
if (typeof val === 'boolean') {
this._debug = this._debug || {};
this._debug.all = val;
this.chainSend('debug', this._debug);
return this;
} else {
return (this._debug && this._debug[val]) || (this._db && this._db._debug && this._db._debug[val]) || (this._debug && this._debug.all);
}
}
return this._debug && this._debug.all;
},
function (type, val) {
if (type !== undefined) {
if (val !== undefined) {
this._debug = this._debug || {};
this._debug[type] = val;
this.chainSend('debug', this._debug);
return this;
}
return (this._debug && this._debug[val]) || (this._db && this._db._debug && this._db._debug[type]);
}
return this._debug && this._debug.all;
}
]),
/**
* Returns a string describing the class this instance is derived from.
* @returns {string}
*/
classIdentifier: function () {
return 'ForerunnerDB.' + this.className;
},
/**
* Returns a string describing the instance by it's class name and instance
* object name.
* @returns {String} The instance identifier.
*/
instanceIdentifier: function () {
return '[' + this.className + ']' + this.name();
},
/**
* Returns a string used to denote a console log against this instance,
* consisting of the class identifier and instance identifier.
* @returns {string} The log identifier.
*/
logIdentifier: function () {
return 'ForerunnerDB ' + this.instanceIdentifier();
},
/**
* Converts a query object with MongoDB dot notation syntax
* to Forerunner's object notation syntax.
* @param {Object} obj The object to convert.
*/
convertToFdb: function (obj) {
var varName,
splitArr,
objCopy,
i;
for (i in obj) {
if (obj.hasOwnProperty(i)) {
objCopy = obj;
if (i.indexOf('.') > -1) {
// Replace .$ with a placeholder before splitting by . char
i = i.replace('.$', '[|$|]');
splitArr = i.split('.');
while ((varName = splitArr.shift())) {
// Replace placeholder back to original .$
varName = varName.replace('[|$|]', '.$');
if (splitArr.length) {
objCopy[varName] = {};
} else {
objCopy[varName] = obj[i];
}
objCopy = objCopy[varName];
}
delete obj[i];
}
}
}
},
/**
* Checks if the state is dropped.
* @returns {boolean} True when dropped, false otherwise.
*/
isDropped: function () {
return this._state === 'dropped';
},
/**
* Registers a timed callback that will overwrite itself if
* the same id is used within the timeout period. Useful
* for de-bouncing fast-calls.
* @param {String} id An ID for the call (use the same one
* to debounce the same calls).
* @param {Function} callback The callback method to call on
* timeout.
* @param {Number} timeout The timeout in milliseconds before
* the callback is called.
*/
debounce: function (id, callback, timeout) {
var self = this,
newData;
self._debounce = self._debounce || {};
if (self._debounce[id]) {
// Clear timeout for this item
clearTimeout(self._debounce[id].timeout);
}
newData = {
callback: callback,
timeout: setTimeout(function () {
// Delete existing reference
delete self._debounce[id];
// Call the callback
callback();
}, timeout)
};
// Save current data
self._debounce[id] = newData;
}
};
module.exports = Common;
},{"./Overload":27,"./Serialiser":30}],19:[function(_dereq_,module,exports){
"use strict";
/**
* Provides some database constants.
* @mixin
*/
var Constants = {
TYPE_INSERT: 0,
TYPE_UPDATE: 1,
TYPE_REMOVE: 2,
PHASE_BEFORE: 0,
PHASE_AFTER: 1
};
module.exports = Constants;
},{}],20:[function(_dereq_,module,exports){
"use strict";
var Overload = _dereq_('./Overload');
/**
* Provides event emitter functionality including the methods: on, off, once, emit, deferEmit.
* @mixin
*/
var Events = {
on: new Overload({
/**
* Attach an event listener to the passed event.
* @param {String} event The name of the event to listen for.
* @param {Function} listener The method to call when the event is fired.
*/
'string, function': function (event, listener) {
this._listeners = this._listeners || {};
this._listeners[event] = this._listeners[event] || {};
this._listeners[event]['*'] = this._listeners[event]['*'] || [];
this._listeners[event]['*'].push(listener);
return this;
},
/**
* Attach an event listener to the passed event only if the passed
* id matches the document id for the event being fired.
* @param {String} event The name of the event to listen for.
* @param {*} id The document id to match against.
* @param {Function} listener The method to call when the event is fired.
*/
'string, *, function': function (event, id, listener) {
this._listeners = this._listeners || {};
this._listeners[event] = this._listeners[event] || {};
this._listeners[event][id] = this._listeners[event][id] || [];
this._listeners[event][id].push(listener);
return this;
}
}),
once: new Overload({
'string, function': function (eventName, callback) {
var self = this,
internalCallback = function () {
self.off(eventName, internalCallback);
callback.apply(self, arguments);
};
return this.on(eventName, internalCallback);
},
'string, *, function': function (eventName, id, callback) {
var self = this,
internalCallback = function () {
self.off(eventName, id, internalCallback);
callback.apply(self, arguments);
};
return this.on(eventName, id, internalCallback);
}
}),
off: new Overload({
'string': function (event) {
if (this._listeners && this._listeners[event] && event in this._listeners) {
delete this._listeners[event];
}
return this;
},
'string, function': function (event, listener) {
var arr,
index;
if (typeof(listener) === 'string') {
if (this._listeners && this._listeners[event] && this._listeners[event][listener]) {
delete this._listeners[event][listener];
}
} else {
if (this._listeners && event in this._listeners) {
arr = this._listeners[event]['*'];
index = arr.indexOf(listener);
if (index > -1) {
arr.splice(index, 1);
}
}
}
return this;
},
'string, *, function': function (event, id, listener) {
if (this._listeners && event in this._listeners && id in this.listeners[event]) {
var arr = this._listeners[event][id],
index = arr.indexOf(listener);
if (index > -1) {
arr.splice(index, 1);
}
}
},
'string, *': function (event, id) {
if (this._listeners && event in this._listeners && id in this._listeners[event]) {
// Kill all listeners for this event id
delete this._listeners[event][id];
}
}
}),
emit: function (event, data) {
this._listeners = this._listeners || {};
if (event in this._listeners) {
var arrIndex,
arrCount,
tmpFunc,
arr,
listenerIdArr,
listenerIdCount,
listenerIdIndex;
// Handle global emit
if (this._listeners[event]['*']) {
arr = this._listeners[event]['*'];
arrCount = arr.length;
for (arrIndex = 0; arrIndex < arrCount; arrIndex++) {
// Check we have a function to execute
tmpFunc = arr[arrIndex];
if (typeof tmpFunc === 'function') {
tmpFunc.apply(this, Array.prototype.slice.call(arguments, 1));
}
}
}
// Handle individual emit
if (data instanceof Array) {
// Check if the array is an array of objects in the collection
if (data[0] && data[0][this._primaryKey]) {
// Loop the array and check for listeners against the primary key
listenerIdArr = this._listeners[event];
arrCount = data.length;
for (arrIndex = 0; arrIndex < arrCount; arrIndex++) {
if (listenerIdArr[data[arrIndex][this._primaryKey]]) {
// Emit for this id
listenerIdCount = listenerIdArr[data[arrIndex][this._primaryKey]].length;
for (listenerIdIndex = 0; listenerIdIndex < listenerIdCount; listenerIdIndex++) {
tmpFunc = listenerIdArr[data[arrIndex][this._primaryKey]][listenerIdIndex];
if (typeof tmpFunc === 'function') {
listenerIdArr[data[arrIndex][this._primaryKey]][listenerIdIndex].apply(this, Array.prototype.slice.call(arguments, 1));
}
}
}
}
}
}
}
return this;
},
/**
* Queues an event to be fired. This has automatic de-bouncing so that any
* events of the same type that occur within 100 milliseconds of a previous
* one will all be wrapped into a single emit rather than emitting tons of
* events for lots of chained inserts etc. Only the data from the last
* de-bounced event will be emitted.
* @param {String} eventName The name of the event to emit.
* @param {*=} data Optional data to emit with the event.
*/
deferEmit: function (eventName, data) {
var self = this,
args;
if (!this._noEmitDefer && (!this._db || (this._db && !this._db._noEmitDefer))) {
args = arguments;
// Check for an existing timeout
this._deferTimeout = this._deferTimeout || {};
if (this._deferTimeout[eventName]) {
clearTimeout(this._deferTimeout[eventName]);
}
// Set a timeout
this._deferTimeout[eventName] = setTimeout(function () {
if (self.debug()) {
console.log(self.logIdentifier() + ' Emitting ' + args[0]);
}
self.emit.apply(self, args);
}, 1);
} else {
this.emit.apply(this, arguments);
}
return this;
}
};
module.exports = Events;
},{"./Overload":27}],21:[function(_dereq_,module,exports){
"use strict";
/**
* Provides object matching algorithm methods.
* @mixin
*/
var Matching = {
/**
* Internal method that checks a document against a test object.
* @param {*} source The source object or value to test against.
* @param {*} test The test object or value to test with.
* @param {Object} queryOptions The options the query was passed with.
* @param {String=} opToApply The special operation to apply to the test such
* as 'and' or an 'or' operator.
* @param {Object=} options An object containing options to apply to the
* operation such as limiting the fields returned etc.
* @returns {Boolean} True if the test was positive, false on negative.
* @private
*/
_match: function (source, test, queryOptions, opToApply, options) {
// TODO: This method is quite long, break into smaller pieces
var operation,
applyOp = opToApply,
recurseVal,
tmpIndex,
sourceType = typeof source,
testType = typeof test,
matchedAll = true,
opResult,
substringCache,
i;
if (sourceType === 'object' && source === null) {
sourceType = 'null';
}
if (testType === 'object' && test === null) {
testType = 'null';
}
options = options || {};
queryOptions = queryOptions || {};
// Check if options currently holds a root query object
if (!options.$rootQuery) {
// Root query not assigned, hold the root query
options.$rootQuery = test;
}
// Check if options currently holds a root source object
if (!options.$rootSource) {
// Root query not assigned, hold the root query
options.$rootSource = source;
}
// Assign current query data
options.$currentQuery = test;
options.$rootData = options.$rootData || {};
// Check if the comparison data are both strings or numbers
if ((sourceType === 'string' || sourceType === 'number' || sourceType === 'null') && (testType === 'string' || testType === 'number' || testType === 'null')) {
// The source and test data are flat types that do not require recursive searches,
// so just compare them and return the result
if (sourceType === 'number' || sourceType === 'null' || testType === 'null') {
// Number or null comparison
if (source !== test) {
matchedAll = false;
}
} else {
// String comparison
// TODO: We can probably use a queryOptions.$locale as a second parameter here
// TODO: to satisfy https://github.com/Irrelon/ForerunnerDB/issues/35
if (source.localeCompare(test)) {
matchedAll = false;
}
}
} else if ((sourceType === 'string' || sourceType === 'number') && (testType === 'object' && test instanceof RegExp)) {
if (!test.test(source)) {
matchedAll = false;
}
} else {
for (i in test) {
if (test.hasOwnProperty(i)) {
// Assign previous query data
options.$previousQuery = options.$parent;
// Assign parent query data
options.$parent = {
query: test[i],
key: i,
parent: options.$previousQuery
};
// Reset operation flag
operation = false;
// Grab first two chars of the key name to check for $
substringCache = i.substr(0, 2);
// Check if the property is a comment (ignorable)
if (substringCache === '//') {
// Skip this property
continue;
}
// Check if the property starts with a dollar (function)
if (substringCache.indexOf('$') === 0) {
// Ask the _matchOp method to handle the operation
opResult = this._matchOp(i, source, test[i], queryOptions, options);
// Check the result of the matchOp operation
// If the result is -1 then no operation took place, otherwise the result
// will be a boolean denoting a match (true) or no match (false)
if (opResult > -1) {
if (opResult) {
if (opToApply === 'or') {
return true;
}
} else {
// Set the matchedAll flag to the result of the operation
// because the operation did not return true
matchedAll = opResult;
}
// Record that an operation was handled
operation = true;
}
}
// Check for regex
if (!operation && test[i] instanceof RegExp) {
operation = true;
if (sourceType === 'object' && source[i] !== undefined && test[i].test(source[i])) {
if (opToApply === 'or') {
return true;
}
} else {
matchedAll = false;
}
}
if (!operation) {
// Check if our query is an object
if (typeof(test[i]) === 'object') {
// Because test[i] is an object, source must also be an object
// Check if our source data we are checking the test query against
// is an object or an array
if (source[i] !== undefined) {
if (source[i] instanceof Array && !(test[i] instanceof Array)) {
// The source data is an array, so check each item until a
// match is found
recurseVal = false;
for (tmpIndex = 0; tmpIndex < source[i].length; tmpIndex++) {
recurseVal = this._match(source[i][tmpIndex], test[i], queryOptions, applyOp, options);
if (recurseVal) {
// One of the array items matched the query so we can
// include this item in the results, so break now
break;
}
}
if (recurseVal) {
if (opToApply === 'or') {
return true;
}
} else {
matchedAll = false;
}
} else if (!(source[i] instanceof Array) && test[i] instanceof Array) {
// The test key data is an array and the source key data is not so check
// each item in the test key data to see if the source item matches one
// of them. This is effectively an $in search.
recurseVal = false;
for (tmpIndex = 0; tmpIndex < test[i].length; tmpIndex++) {
recurseVal = this._match(source[i], test[i][tmpIndex], queryOptions, applyOp, options);
if (recurseVal) {
// One of the array items matched the query so we can
// include this item in the results, so break now
break;
}
}
if (recurseVal) {
if (opToApply === 'or') {
return true;
}
} else {
matchedAll = false;
}
} else if (typeof(source) === 'object') {
// Recurse down the object tree
recurseVal = this._match(source[i], test[i], queryOptions, applyOp, options);
if (recurseVal) {
if (opToApply === 'or') {
return true;
}
} else {
matchedAll = false;
}
} else {
recurseVal = this._match(undefined, test[i], queryOptions, applyOp, options);
if (recurseVal) {
if (opToApply === 'or') {
return true;
}
} else {
matchedAll = false;
}
}
} else {
// First check if the test match is an $exists
if (test[i] && test[i].$exists !== undefined) {
// Push the item through another match recurse
recurseVal = this._match(undefined, test[i], queryOptions, applyOp, options);
if (recurseVal) {
if (opToApply === 'or') {
return true;
}
} else {
matchedAll = false;
}
} else {
matchedAll = false;
}
}
} else {
// Check if the prop matches our test value
if (source && source[i] === test[i]) {
if (opToApply === 'or') {
return true;
}
} else if (source && source[i] && source[i] instanceof Array && test[i] && typeof(test[i]) !== "object") {
// We are looking for a value inside an array
// The source data is an array, so check each item until a
// match is found
recurseVal = false;
for (tmpIndex = 0; tmpIndex < source[i].length; tmpIndex++) {
recurseVal = this._match(source[i][tmpIndex], test[i], queryOptions, applyOp, options);
if (recurseVal) {
// One of the array items matched the query so we can
// include this item in the results, so break now
break;
}
}
if (recurseVal) {
if (opToApply === 'or') {
return true;
}
} else {
matchedAll = false;
}
} else {
matchedAll = false;
}
}
}
if (opToApply === 'and' && !matchedAll) {
return false;
}
}
}
}
return matchedAll;
},
/**
* Internal method, performs a matching process against a query operator such as $gt or $nin.
* @param {String} key The property name in the test that matches the operator to perform
* matching against.
* @param {*} source The source data to match the query against.
* @param {*} test The query to match the source against.
* @param {Object} queryOptions The options the query was passed with.
* @param {Object=} options An options object.
* @returns {*}
* @private
*/
_matchOp: function (key, source, test, queryOptions, options) {
// Check for commands
switch (key) {
case '$gt':
// Greater than
return source > test;
case '$gte':
// Greater than or equal
return source >= test;
case '$lt':
// Less than
return source < test;
case '$lte':
// Less than or equal
return source <= test;
case '$exists':
// Property exists
return (source === undefined) !== test;
case '$eq': // Equals
return source == test; // jshint ignore:line
case '$eeq': // Equals equals
return source === test;
case '$ne': // Not equals
return source != test; // jshint ignore:line
case '$nee': // Not equals equals
return source !== test;
case '$or':
// Match true on ANY check to pass
for (var orIndex = 0; orIndex < test.length; orIndex++) {
if (this._match(source, test[orIndex], queryOptions, 'and', options)) {
return true;
}
}
return false;
case '$and':
// Match true on ALL checks to pass
for (var andIndex = 0; andIndex < test.length; andIndex++) {
if (!this._match(source, test[andIndex], queryOptions, 'and', options)) {
return false;
}
}
return true;
case '$in': // In
// Check that the in test is an array
if (test instanceof Array) {
var inArr = test,
inArrCount = inArr.length,
inArrIndex;
for (inArrIndex = 0; inArrIndex < inArrCount; inArrIndex++) {
if (this._match(source, inArr[inArrIndex], queryOptions, 'and', options)) {
return true;
}
}
return false;
} else if (typeof test === 'object') {
return this._match(source, test, queryOptions, 'and', options);
} else {
console.log(this.logIdentifier() + ' Cannot use an $in operator on a non-array key: ' + key, options.$rootQuery);
return false;
}
break;
case '$nin': // Not in
// Check that the not-in test is an array
if (test instanceof Array) {
var notInArr = test,
notInArrCount = notInArr.length,
notInArrIndex;
for (notInArrIndex = 0; notInArrIndex < notInArrCount; notInArrIndex++) {
if (this._match(source, notInArr[notInArrIndex], queryOptions, 'and', options)) {
return false;
}
}
return true;
} else if (typeof test === 'object') {
return this._match(source, test, queryOptions, 'and', options);
} else {
console.log(this.logIdentifier() + ' Cannot use a $nin operator on a non-array key: ' + key, options.$rootQuery);
return false;
}
break;
case '$distinct':
// Ensure options holds a distinct lookup
options.$rootData['//distinctLookup'] = options.$rootData['//distinctLookup'] || {};
for (var distinctProp in test) {
if (test.hasOwnProperty(distinctProp)) {
options.$rootData['//distinctLookup'][distinctProp] = options.$rootData['//distinctLookup'][distinctProp] || {};
// Check if the options distinct lookup has this field's value
if (options.$rootData['//distinctLookup'][distinctProp][source[distinctProp]]) {
// Value is already in use
return false;
} else {
// Set the value in the lookup
options.$rootData['//distinctLookup'][distinctProp][source[distinctProp]] = true;
// Allow the item in the results
return true;
}
}
}
break;
case '$count':
var countKey,
countArr,
countVal;
// Iterate the count object's keys
for (countKey in test) {
if (test.hasOwnProperty(countKey)) {
// Check the property exists and is an array. If the property being counted is not
// an array (or doesn't exist) then use a value of zero in any further count logic
countArr = source[countKey];
if (typeof countArr === 'object' && countArr instanceof Array) {
countVal = countArr.length;
} else {
countVal = 0;
}
// Now recurse down the query chain further to satisfy the query for this key (countKey)
if (!this._match(countVal, test[countKey], queryOptions, 'and', options)) {
return false;
}
}
}
// Allow the item in the results
return true;
case '$find':
case '$findOne':
case '$findSub':
var fromType = 'collection',
findQuery,
findOptions,
subQuery,
subOptions,
subPath,
result,
operation = {};
// Check all parts of the $find operation exist
if (!test.$from) {
throw(key + ' missing $from property!');
}
if (test.$fromType) {
fromType = test.$fromType;
// Check the fromType exists as a method
if (!this.db()[fromType] || typeof this.db()[fromType] !== 'function') {
throw(key + ' cannot operate against $fromType "' + fromType + '" because the database does not recognise this type of object!');
}
}
// Perform the find operation
findQuery = test.$query || {};
findOptions = test.$options || {};
if (key === '$findSub') {
if (!test.$path) {
throw(key + ' missing $path property!');
}
subPath = test.$path;
subQuery = test.$subQuery || {};
subOptions = test.$subOptions || {};
if (options.$parent && options.$parent.parent && options.$parent.parent.key) {
result = this.db()[fromType](test.$from).findSub(findQuery, subPath, subQuery, subOptions);
} else {
// This is a root $find* query
// Test the source against the main findQuery
if (this._match(source, findQuery, {}, 'and', options)) {
result = this._findSub([source], subPath, subQuery, subOptions);
}
return result && result.length > 0;
}
} else {
result = this.db()[fromType](test.$from)[key.substr(1)](findQuery, findOptions);
}
operation[options.$parent.parent.key] = result;
return this._match(source, operation, queryOptions, 'and', options);
}
return -1;
},
/**
*
* @param {Array | Object} docArr An array of objects to run the join
* operation against or a single object.
* @param {Array} joinClause The join clause object array (the array in
* the $join key of a normal join options object).
* @param {Object} joinSource An object containing join source reference
* data or a blank object if you are doing a bespoke join operation.
* @param {Object} options An options object or blank object if no options.
* @returns {Array}
* @private
*/
applyJoin: function (docArr, joinClause, joinSource, options) {
var self = this,
joinSourceIndex,
joinSourceKey,
joinMatch,
joinSourceType,
joinSourceIdentifier,
resultKeyName,
joinSourceInstance,
resultIndex,
joinSearchQuery,
joinMulti,
joinRequire,
joinPrefix,
joinMatchIndex,
joinMatchData,
joinSearchOptions,
joinFindResults,
joinFindResult,
joinItem,
resultRemove = [],
l;
if (!(docArr instanceof Array)) {
// Turn the document into an array
docArr = [docArr];
}
for (joinSourceIndex = 0; joinSourceIndex < joinClause.length; joinSourceIndex++) {
for (joinSourceKey in joinClause[joinSourceIndex]) {
if (joinClause[joinSourceIndex].hasOwnProperty(joinSourceKey)) {
// Get the match data for the join
joinMatch = joinClause[joinSourceIndex][joinSourceKey];
// Check if the join is to a collection (default) or a specified source type
// e.g 'view' or 'collection'
joinSourceType = joinMatch.$sourceType || 'collection';
joinSourceIdentifier = '$' + joinSourceType + '.' + joinSourceKey;
// Set the key to store the join result in to the collection name by default
// can be overridden by the '$as' clause in the join object
resultKeyName = joinSourceKey;
// Get the join collection instance from the DB
if (joinSource[joinSourceIdentifier]) {
// We have a joinSource for this identifier already (given to us by
// an index when we analysed the query earlier on) and we can use
// that source instead.
joinSourceInstance = joinSource[joinSourceIdentifier];
} else {
// We do not already have a joinSource so grab the instance from the db
if (this._db[joinSourceType] && typeof this._db[joinSourceType] === 'function') {
joinSourceInstance = this._db[joinSourceType](joinSourceKey);
}
}
// Loop our result data array
for (resultIndex = 0; resultIndex < docArr.length; resultIndex++) {
// Loop the join conditions and build a search object from them
joinSearchQuery = {};
joinMulti = false;
joinRequire = false;
joinPrefix = '';
for (joinMatchIndex in joinMatch) {
if (joinMatch.hasOwnProperty(joinMatchIndex)) {
joinMatchData = joinMatch[joinMatchIndex];
// Check the join condition name for a special command operator
if (joinMatchIndex.substr(0, 1) === '$') {
// Special command
switch (joinMatchIndex) {
case '$where':
if (joinMatchData.$query || joinMatchData.$options) {
if (joinMatchData.$query) {
// Commented old code here, new one does dynamic reverse lookups
//joinSearchQuery = joinMatchData.query;
joinSearchQuery = self.resolveDynamicQuery(joinMatchData.$query, docArr[resultIndex]);
}
if (joinMatchData.$options) {
joinSearchOptions = joinMatchData.$options;
}
} else {
throw('$join $where clause requires "$query" and / or "$options" keys to work!');
}
break;
case '$as':
// Rename the collection when stored in the result document
resultKeyName = joinMatchData;
break;
case '$multi':
// Return an array of documents instead of a single matching document
joinMulti = joinMatchData;
break;
case '$require':
// Remove the result item if no matching join data is found
joinRequire = joinMatchData;
break;
case '$prefix':
// Add a prefix to properties mixed in
joinPrefix = joinMatchData;
break;
default:
break;
}
} else {
// Get the data to match against and store in the search object
// Resolve complex referenced query
joinSearchQuery[joinMatchIndex] = self.resolveDynamicQuery(joinMatchData, docArr[resultIndex]);
}
}
}
// Do a find on the target collection against the match data
joinFindResults = joinSourceInstance.find(joinSearchQuery, joinSearchOptions);
// Check if we require a joined row to allow the result item
if (!joinRequire || (joinRequire && joinFindResults[0])) {
// Join is not required or condition is met
if (resultKeyName === '$root') {
// The property name to store the join results in is $root
// which means we need to mixin the results but this only
// works if joinMulti is disabled
if (joinMulti !== false) {
// Throw an exception here as this join is not physically possible!
throw(this.logIdentifier() + ' Cannot combine [$as: "$root"] with [$multi: true] in $join clause!');
}
// Mixin the result
joinFindResult = joinFindResults[0];
joinItem = docArr[resultIndex];
for (l in joinFindResult) {
if (joinFindResult.hasOwnProperty(l) && joinItem[joinPrefix + l] === undefined) {
// Properties are only mixed in if they do not already exist
// in the target item (are undefined). Using a prefix denoted via
// $prefix is a good way to prevent property name conflicts
joinItem[joinPrefix + l] = joinFindResult[l];
}
}
} else {
docArr[resultIndex][resultKeyName] = joinMulti === false ? joinFindResults[0] : joinFindResults;
}
} else {
// Join required but condition not met, add item to removal queue
resultRemove.push(resultIndex);
}
}
}
}
}
return resultRemove;
},
/**
* Takes a query object with dynamic references and converts the references
* into actual values from the references source.
* @param {Object} query The query object with dynamic references.
* @param {Object} item The document to apply the references to.
* @returns {*}
* @private
*/
resolveDynamicQuery: function (query, item) {
var self = this,
newQuery,
propType,
propVal,
pathResult,
i;
// Check for early exit conditions
if (typeof query === 'string') {
// Check if the property name starts with a back-reference
if (query.substr(0, 3) === '$$.') {
// Fill the query with a back-referenced value
pathResult = this.sharedPathSolver.value(item, query.substr(3, query.length - 3));
} else {
pathResult = this.sharedPathSolver.value(item, query);
}
if (pathResult.length > 1) {
return {$in: pathResult};
} else {
return pathResult[0];
}
}
newQuery = {};
for (i in query) {
if (query.hasOwnProperty(i)) {
propType = typeof query[i];
propVal = query[i];
switch (propType) {
case 'string':
// Check if the property name starts with a back-reference
if (propVal.substr(0, 3) === '$$.') {
// Fill the query with a back-referenced value
newQuery[i] = this.sharedPathSolver.value(item, propVal.substr(3, propVal.length - 3))[0];
} else {
newQuery[i] = propVal;
}
break;
case 'object':
newQuery[i] = self.resolveDynamicQuery(propVal, item);
break;
default:
newQuery[i] = propVal;
break;
}
}
}
return newQuery;
},
spliceArrayByIndexList: function (arr, list) {
var i;
for (i = list.length - 1; i >= 0; i--) {
arr.splice(list[i], 1);
}
}
};
module.exports = Matching;
},{}],22:[function(_dereq_,module,exports){
"use strict";
/**
* Provides sorting methods.
* @mixin
*/
var Sorting = {
/**
* Sorts the passed value a against the passed value b ascending.
* @param {*} a The first value to compare.
* @param {*} b The second value to compare.
* @returns {*} 1 if a is sorted after b, -1 if a is sorted before b.
*/
sortAsc: function (a, b) {
if (typeof(a) === 'string' && typeof(b) === 'string') {
return a.localeCompare(b);
} else {
if (a > b) {
return 1;
} else if (a < b) {
return -1;
}
}
return 0;
},
/**
* Sorts the passed value a against the passed value b descending.
* @param {*} a The first value to compare.
* @param {*} b The second value to compare.
* @returns {*} 1 if a is sorted after b, -1 if a is sorted before b.
*/
sortDesc: function (a, b) {
if (typeof(a) === 'string' && typeof(b) === 'string') {
return b.localeCompare(a);
} else {
if (a > b) {
return -1;
} else if (a < b) {
return 1;
}
}
return 0;
}
};
module.exports = Sorting;
},{}],23:[function(_dereq_,module,exports){
"use strict";
var Tags,
tagMap = {};
/**
* Provides class instance tagging and tag operation methods.
* @mixin
*/
Tags = {
/**
* Tags a class instance for later lookup.
* @param {String} name The tag to add.
* @returns {boolean}
*/
tagAdd: function (name) {
var i,
self = this,
mapArr = tagMap[name] = tagMap[name] || [];
for (i = 0; i < mapArr.length; i++) {
if (mapArr[i] === self) {
return true;
}
}
mapArr.push(self);
// Hook the drop event for this so we can react
if (self.on) {
self.on('drop', function () {
// We've been dropped so remove ourselves from the tag map
self.tagRemove(name);
});
}
return true;
},
/**
* Removes a tag from a class instance.
* @param {String} name The tag to remove.
* @returns {boolean}
*/
tagRemove: function (name) {
var i,
mapArr = tagMap[name];
if (mapArr) {
for (i = 0; i < mapArr.length; i++) {
if (mapArr[i] === this) {
mapArr.splice(i, 1);
return true;
}
}
}
return false;
},
/**
* Gets an array of all instances tagged with the passed tag name.
* @param {String} name The tag to lookup.
* @returns {Array} The array of instances that have the passed tag.
*/
tagLookup: function (name) {
return tagMap[name] || [];
},
/**
* Drops all instances that are tagged with the passed tag name.
* @param {String} name The tag to lookup.
* @param {Function} callback Callback once dropping has completed
* for all instances that match the passed tag name.
* @returns {boolean}
*/
tagDrop: function (name, callback) {
var arr = this.tagLookup(name),
dropCb,
dropCount,
i;
dropCb = function () {
dropCount--;
if (callback && dropCount === 0) {
callback(false);
}
};
if (arr.length) {
dropCount = arr.length;
// Loop the array and drop all items
for (i = arr.length - 1; i >= 0; i--) {
arr[i].drop(dropCb);
}
}
return true;
}
};
module.exports = Tags;
},{}],24:[function(_dereq_,module,exports){
"use strict";
var Overload = _dereq_('./Overload');
/**
* Provides trigger functionality methods.
* @mixin
*/
var Triggers = {
/**
* When called in a before phase the newDoc object can be directly altered
* to modify the data in it before the operation is carried out.
* @callback addTriggerCallback
* @param {Object} operation The details about the operation.
* @param {Object} oldDoc The document before the operation.
* @param {Object} newDoc The document after the operation.
*/
/**
* Add a trigger by id.
* @param {String} id The id of the trigger. This must be unique to the type and
* phase of the trigger. Only one trigger may be added with this id per type and
* phase.
* @param {Constants} type The type of operation to apply the trigger to. See
* Mixin.Constants for constants to use.
* @param {Constants} phase The phase of an operation to fire the trigger on. See
* Mixin.Constants for constants to use.
* @param {addTriggerCallback} method The method to call when the trigger is fired.
* @returns {boolean} True if the trigger was added successfully, false if not.
*/
addTrigger: function (id, type, phase, method) {
var self = this,
triggerIndex;
// Check if the trigger already exists
triggerIndex = self._triggerIndexOf(id, type, phase);
if (triggerIndex === -1) {
self.triggerStack = {};
// The trigger does not exist, create it
self._trigger = self._trigger || {};
self._trigger[type] = self._trigger[type] || {};
self._trigger[type][phase] = self._trigger[type][phase] || [];
self._trigger[type][phase].push({
id: id,
method: method,
enabled: true
});
return true;
}
return false;
},
/**
*
* @param {String} id The id of the trigger to remove.
* @param {Number} type The type of operation to remove the trigger from. See
* Mixin.Constants for constants to use.
* @param {Number} phase The phase of the operation to remove the trigger from.
* See Mixin.Constants for constants to use.
* @returns {boolean} True if removed successfully, false if not.
*/
removeTrigger: function (id, type, phase) {
var self = this,
triggerIndex;
// Check if the trigger already exists
triggerIndex = self._triggerIndexOf(id, type, phase);
if (triggerIndex > -1) {
// The trigger exists, remove it
self._trigger[type][phase].splice(triggerIndex, 1);
}
return false;
},
/**
* Tells the current instance to fire or ignore all triggers whether they
* are enabled or not.
* @param {Boolean} val Set to true to ignore triggers or false to not
* ignore them.
* @returns {*}
*/
ignoreTriggers: function (val) {
if (val !== undefined) {
this._ignoreTriggers = val;
return this;
}
return this._ignoreTriggers;
},
/**
* Generates triggers that fire in the after phase for all CRUD ops
* that automatically transform data back and forth and keep both
* import and export collections in sync with each other.
* @param {String} id The unique id for this link IO.
* @param {Object} ioData The settings for the link IO.
*/
addLinkIO: function (id, ioData) {
var self = this,
matchAll,
exportData,
importData,
exportTriggerMethod,
importTriggerMethod,
exportTo,
importFrom,
allTypes,
i;
// Store the linkIO
self._linkIO = self._linkIO || {};
self._linkIO[id] = ioData;
exportData = ioData['export'];
importData = ioData['import'];
if (exportData) {
exportTo = self.db().collection(exportData.to);
}
if (importData) {
importFrom = self.db().collection(importData.from);
}
allTypes = [
self.TYPE_INSERT,
self.TYPE_UPDATE,
self.TYPE_REMOVE
];
matchAll = function (data, callback) {
// Match all
callback(false, true);
};
if (exportData) {
// Check for export match method
if (!exportData.match) {
// No match method found, use the match all method
exportData.match = matchAll;
}
// Check for export types
if (!exportData.types) {
exportData.types = allTypes;
}
exportTriggerMethod = function (operation, oldDoc, newDoc) {
// Check if we should execute against this data
exportData.match(newDoc, function (err, doExport) {
if (!err && doExport) {
// Get data to upsert (if any)
exportData.data(newDoc, operation.type, function (err, data, callback) {
if (!err && data) {
// Disable all currently enabled triggers so that we
// don't go into a trigger loop
exportTo.ignoreTriggers(true);
if (operation.type !== 'remove') {
// Do upsert
exportTo.upsert(data, callback);
} else {
// Do remove
exportTo.remove(data, callback);
}
// Re-enable the previous triggers
exportTo.ignoreTriggers(false);
}
});
}
});
};
}
if (importData) {
// Check for import match method
if (!importData.match) {
// No match method found, use the match all method
importData.match = matchAll;
}
// Check for import types
if (!importData.types) {
importData.types = allTypes;
}
importTriggerMethod = function (operation, oldDoc, newDoc) {
// Check if we should execute against this data
importData.match(newDoc, function (err, doExport) {
if (!err && doExport) {
// Get data to upsert (if any)
importData.data(newDoc, operation.type, function (err, data, callback) {
if (!err && data) {
// Disable all currently enabled triggers so that we
// don't go into a trigger loop
exportTo.ignoreTriggers(true);
if (operation.type !== 'remove') {
// Do upsert
self.upsert(data, callback);
} else {
// Do remove
self.remove(data, callback);
}
// Re-enable the previous triggers
exportTo.ignoreTriggers(false);
}
});
}
});
};
}
if (exportData) {
for (i = 0; i < exportData.types.length; i++) {
self.addTrigger(id + 'export' + exportData.types[i], exportData.types[i], self.PHASE_AFTER, exportTriggerMethod);
}
}
if (importData) {
for (i = 0; i < importData.types.length; i++) {
importFrom.addTrigger(id + 'import' + importData.types[i], importData.types[i], self.PHASE_AFTER, importTriggerMethod);
}
}
},
/**
* Removes a previously added link IO via it's ID.
* @param {String} id The id of the link IO to remove.
* @returns {boolean} True if successful, false if the link IO
* was not found.
*/
removeLinkIO: function (id) {
var self = this,
linkIO = self._linkIO[id],
exportData,
importData,
importFrom,
i;
if (linkIO) {
exportData = linkIO['export'];
importData = linkIO['import'];
if (exportData) {
for (i = 0; i < exportData.types.length; i++) {
self.removeTrigger(id + 'export' + exportData.types[i], exportData.types[i], self.db.PHASE_AFTER);
}
}
if (importData) {
importFrom = self.db().collection(importData.from);
for (i = 0; i < importData.types.length; i++) {
importFrom.removeTrigger(id + 'import' + importData.types[i], importData.types[i], self.db.PHASE_AFTER);
}
}
delete self._linkIO[id];
return true;
}
return false;
},
enableTrigger: new Overload({
'string': function (id) {
// Alter all triggers of this type
var self = this,
types = self._trigger,
phases,
triggers,
result = false,
i, k, j;
if (types) {
for (j in types) {
if (types.hasOwnProperty(j)) {
phases = types[j];
if (phases) {
for (i in phases) {
if (phases.hasOwnProperty(i)) {
triggers = phases[i];
// Loop triggers and set enabled flag
for (k = 0; k < triggers.length; k++) {
if (triggers[k].id === id) {
triggers[k].enabled = true;
result = true;
}
}
}
}
}
}
}
}
return result;
},
'number': function (type) {
// Alter all triggers of this type
var self = this,
phases = self._trigger[type],
triggers,
result = false,
i, k;
if (phases) {
for (i in phases) {
if (phases.hasOwnProperty(i)) {
triggers = phases[i];
// Loop triggers and set to enabled
for (k = 0; k < triggers.length; k++) {
triggers[k].enabled = true;
result = true;
}
}
}
}
return result;
},
'number, number': function (type, phase) {
// Alter all triggers of this type and phase
var self = this,
phases = self._trigger[type],
triggers,
result = false,
k;
if (phases) {
triggers = phases[phase];
if (triggers) {
// Loop triggers and set to enabled
for (k = 0; k < triggers.length; k++) {
triggers[k].enabled = true;
result = true;
}
}
}
return result;
},
'string, number, number': function (id, type, phase) {
// Check if the trigger already exists
var self = this,
triggerIndex = self._triggerIndexOf(id, type, phase);
if (triggerIndex > -1) {
// Update the trigger
self._trigger[type][phase][triggerIndex].enabled = true;
return true;
}
return false;
}
}),
disableTrigger: new Overload({
'string': function (id) {
// Alter all triggers of this type
var self = this,
types = self._trigger,
phases,
triggers,
result = false,
i, k, j;
if (types) {
for (j in types) {
if (types.hasOwnProperty(j)) {
phases = types[j];
if (phases) {
for (i in phases) {
if (phases.hasOwnProperty(i)) {
triggers = phases[i];
// Loop triggers and set enabled flag
for (k = 0; k < triggers.length; k++) {
if (triggers[k].id === id) {
triggers[k].enabled = false;
result = true;
}
}
}
}
}
}
}
}
return result;
},
'number': function (type) {
// Alter all triggers of this type
var self = this,
phases = self._trigger[type],
triggers,
result = false,
i, k;
if (phases) {
for (i in phases) {
if (phases.hasOwnProperty(i)) {
triggers = phases[i];
// Loop triggers and set to disabled
for (k = 0; k < triggers.length; k++) {
triggers[k].enabled = false;
result = true;
}
}
}
}
return result;
},
'number, number': function (type, phase) {
// Alter all triggers of this type and phase
var self = this,
phases = self._trigger[type],
triggers,
result = false,
k;
if (phases) {
triggers = phases[phase];
if (triggers) {
// Loop triggers and set to disabled
for (k = 0; k < triggers.length; k++) {
triggers[k].enabled = false;
result = true;
}
}
}
return result;
},
'string, number, number': function (id, type, phase) {
// Check if the trigger already exists
var self = this,
triggerIndex = self._triggerIndexOf(id, type, phase);
if (triggerIndex > -1) {
// Update the trigger
self._trigger[type][phase][triggerIndex].enabled = false;
return true;
}
return false;
}
}),
/**
* Checks if a trigger will fire based on the type and phase provided.
* @param {Number} type The type of operation. See Mixin.Constants for
* constants to use.
* @param {Number} phase The phase of the operation. See Mixin.Constants
* for constants to use.
* @returns {Boolean} True if the trigger will fire, false otherwise.
*/
willTrigger: function (type, phase) {
if (!this._ignoreTriggers && this._trigger && this._trigger[type] && this._trigger[type][phase] && this._trigger[type][phase].length) {
// Check if a trigger in this array is enabled
var arr = this._trigger[type][phase],
i;
for (i = 0; i < arr.length; i++) {
if (arr[i].enabled) {
return true;
}
}
}
return false;
},
/**
* Processes trigger actions based on the operation, type and phase.
* @param {Object} operation Operation data to pass to the trigger.
* @param {Number} type The type of operation. See Mixin.Constants for
* constants to use.
* @param {Number} phase The phase of the operation. See Mixin.Constants
* for constants to use.
* @param {Object} oldDoc The document snapshot before operations are
* carried out against the data.
* @param {Object} newDoc The document snapshot after operations are
* carried out against the data.
* @returns {boolean}
*/
processTrigger: function (operation, type, phase, oldDoc, newDoc) {
var self = this,
triggerArr,
triggerIndex,
triggerCount,
triggerItem,
response,
typeName,
phaseName;
if (!self._ignoreTriggers && self._trigger && self._trigger[type] && self._trigger[type][phase]) {
triggerArr = self._trigger[type][phase];
triggerCount = triggerArr.length;
for (triggerIndex = 0; triggerIndex < triggerCount; triggerIndex++) {
triggerItem = triggerArr[triggerIndex];
// Check if the trigger is enabled
if (triggerItem.enabled) {
if (self.debug()) {
switch (type) {
case this.TYPE_INSERT:
typeName = 'insert';
break;
case this.TYPE_UPDATE:
typeName = 'update';
break;
case this.TYPE_REMOVE:
typeName = 'remove';
break;
default:
typeName = '';
break;
}
switch (phase) {
case this.PHASE_BEFORE:
phaseName = 'before';
break;
case this.PHASE_AFTER:
phaseName = 'after';
break;
default:
phaseName = '';
break;
}
console.log('Triggers: Processing trigger "' + triggerItem.id + '" for ' + typeName + ' in phase "' + phaseName + '"');
}
// Check if the trigger is already in the stack, if it is,
// don't fire it again (this is so we avoid infinite loops
// where a trigger triggers another trigger which calls this
// one and so on)
if (self.triggerStack && self.triggerStack[type] && self.triggerStack[type][phase] && self.triggerStack[type][phase][triggerItem.id]) {
// The trigger is already in the stack, do not fire the trigger again
if (self.debug()) {
console.log('Triggers: Will not run trigger "' + triggerItem.id + '" for ' + typeName + ' in phase "' + phaseName + '" as it is already in the stack!');
}
continue;
}
// Add the trigger to the stack so we don't go down an endless
// trigger loop
self.triggerStack = self.triggerStack || {};
self.triggerStack[type] = {};
self.triggerStack[type][phase] = {};
self.triggerStack[type][phase][triggerItem.id] = true;
// Run the trigger's method and store the response
response = triggerItem.method.call(self, operation, oldDoc, newDoc);
// Remove the trigger from the stack
self.triggerStack = self.triggerStack || {};
self.triggerStack[type] = {};
self.triggerStack[type][phase] = {};
self.triggerStack[type][phase][triggerItem.id] = false;
// Check the response for a non-expected result (anything other than
// [undefined, true or false] is considered a throwable error)
if (response === false) {
// The trigger wants us to cancel operations
return false;
}
if (response !== undefined && response !== true && response !== false) {
// Trigger responded with error, throw the error
throw('ForerunnerDB.Mixin.Triggers: Trigger error: ' + response);
}
}
}
// Triggers all ran without issue, return a success (true)
return true;
}
},
/**
* Returns the index of a trigger by id based on type and phase.
* @param {String} id The id of the trigger to find the index of.
* @param {Number} type The type of operation. See Mixin.Constants for
* constants to use.
* @param {Number} phase The phase of the operation. See Mixin.Constants
* for constants to use.
* @returns {number}
* @private
*/
_triggerIndexOf: function (id, type, phase) {
var self = this,
triggerArr,
triggerCount,
triggerIndex;
if (self._trigger && self._trigger[type] && self._trigger[type][phase]) {
triggerArr = self._trigger[type][phase];
triggerCount = triggerArr.length;
for (triggerIndex = 0; triggerIndex < triggerCount; triggerIndex++) {
if (triggerArr[triggerIndex].id === id) {
return triggerIndex;
}
}
}
return -1;
}
};
module.exports = Triggers;
},{"./Overload":27}],25:[function(_dereq_,module,exports){
"use strict";
/**
* Provides methods to handle object update operations.
* @mixin
*/
var Updating = {
/**
* Updates a property on an object.
* @param {Object} doc The object whose property is to be updated.
* @param {String} prop The property to update.
* @param {*} val The new value of the property.
* @private
*/
_updateProperty: function (doc, prop, val) {
doc[prop] = val;
if (this.debug()) {
console.log(this.logIdentifier() + ' Setting non-data-bound document property "' + prop + '" to val "' + val + '"');
}
},
/**
* Increments a value for a property on a document by the passed number.
* @param {Object} doc The document to modify.
* @param {String} prop The property to modify.
* @param {Number} val The amount to increment by.
* @private
*/
_updateIncrement: function (doc, prop, val) {
doc[prop] += val;
},
/**
* Changes the index of an item in the passed array.
* @param {Array} arr The array to modify.
* @param {Number} indexFrom The index to move the item from.
* @param {Number} indexTo The index to move the item to.
* @private
*/
_updateSpliceMove: function (arr, indexFrom, indexTo) {
arr.splice(indexTo, 0, arr.splice(indexFrom, 1)[0]);
if (this.debug()) {
console.log(this.logIdentifier() + ' Moving non-data-bound document array index from "' + indexFrom + '" to "' + indexTo + '"');
}
},
/**
* Inserts an item into the passed array at the specified index.
* @param {Array} arr The array to insert into.
* @param {Number} index The index to insert at.
* @param {Object} doc The document to insert.
* @private
*/
_updateSplicePush: function (arr, index, doc) {
if (arr.length > index) {
arr.splice(index, 0, doc);
} else {
arr.push(doc);
}
},
/**
* Inserts an item at the end of an array.
* @param {Array} arr The array to insert the item into.
* @param {Object} doc The document to insert.
* @private
*/
_updatePush: function (arr, doc) {
arr.push(doc);
},
/**
* Removes an item from the passed array.
* @param {Array} arr The array to modify.
* @param {Number} index The index of the item in the array to remove.
* @private
*/
_updatePull: function (arr, index) {
arr.splice(index, 1);
},
/**
* Multiplies a value for a property on a document by the passed number.
* @param {Object} doc The document to modify.
* @param {String} prop The property to modify.
* @param {Number} val The amount to multiply by.
* @private
*/
_updateMultiply: function (doc, prop, val) {
doc[prop] *= val;
},
/**
* Renames a property on a document to the passed property.
* @param {Object} doc The document to modify.
* @param {String} prop The property to rename.
* @param {Number} val The new property name.
* @private
*/
_updateRename: function (doc, prop, val) {
doc[val] = doc[prop];
delete doc[prop];
},
/**
* Sets a property on a document to the passed value.
* @param {Object} doc The document to modify.
* @param {String} prop The property to set.
* @param {*} val The new property value.
* @private
*/
_updateOverwrite: function (doc, prop, val) {
doc[prop] = val;
},
/**
* Deletes a property on a document.
* @param {Object} doc The document to modify.
* @param {String} prop The property to delete.
* @private
*/
_updateUnset: function (doc, prop) {
delete doc[prop];
},
/**
* Removes all properties from an object without destroying
* the object instance, thereby maintaining data-bound linking.
* @param {Object} doc The parent object to modify.
* @param {String} prop The name of the child object to clear.
* @private
*/
_updateClear: function (doc, prop) {
var obj = doc[prop],
i;
if (obj && typeof obj === 'object') {
for (i in obj) {
if (obj.hasOwnProperty(i)) {
this._updateUnset(obj, i);
}
}
}
},
/**
* Pops an item or items from the array stack.
* @param {Object} doc The document to modify.
* @param {Number} val If set to a positive integer, will pop the number specified
* from the stack, if set to a negative integer will shift the number specified
* from the stack.
* @return {Boolean}
* @private
*/
_updatePop: function (doc, val) {
var updated = false,
i;
if (doc.length > 0) {
if (val > 0) {
for (i = 0; i < val; i++) {
doc.pop();
}
updated = true;
} else if (val < 0) {
for (i = 0; i > val; i--) {
doc.shift();
}
updated = true;
}
}
return updated;
}
};
module.exports = Updating;
},{}],26:[function(_dereq_,module,exports){
"use strict";
var Shared = _dereq_('./Shared'),
Path = _dereq_('./Path');
/**
* The operation class, used to store details about an operation being
* performed by the database.
* @param {String} name The name of the operation.
* @constructor
*/
var Operation = function (name) {
this.pathSolver = new Path();
this.counter = 0;
this.init.apply(this, arguments);
};
Operation.prototype.init = function (name) {
this._data = {
operation: name, // The name of the operation executed such as "find", "update" etc
index: {
potential: [], // Indexes that could have potentially been used
used: false // The index that was picked to use
},
steps: [], // The steps taken to generate the query results,
time: {
startMs: 0,
stopMs: 0,
totalMs: 0,
process: {}
},
flag: {}, // An object with flags that denote certain execution paths
log: [] // Any extra data that might be useful such as warnings or helpful hints
};
};
Shared.addModule('Operation', Operation);
Shared.mixin(Operation.prototype, 'Mixin.ChainReactor');
/**
* Starts the operation timer.
*/
Operation.prototype.start = function () {
this._data.time.startMs = new Date().getTime();
};
/**
* Adds an item to the operation log.
* @param {String} event The item to log.
* @returns {*}
*/
Operation.prototype.log = function (event) {
if (event) {
var lastLogTime = this._log.length > 0 ? this._data.log[this._data.log.length - 1].time : 0,
logObj = {
event: event,
time: new Date().getTime(),
delta: 0
};
this._data.log.push(logObj);
if (lastLogTime) {
logObj.delta = logObj.time - lastLogTime;
}
return this;
}
return this._data.log;
};
/**
* Called when starting and ending a timed operation, used to time
* internal calls within an operation's execution.
* @param {String} section An operation name.
* @returns {*}
*/
Operation.prototype.time = function (section) {
if (section !== undefined) {
var process = this._data.time.process,
processObj = process[section] = process[section] || {};
if (!processObj.startMs) {
// Timer started
processObj.startMs = new Date().getTime();
processObj.stepObj = {
name: section
};
this._data.steps.push(processObj.stepObj);
} else {
processObj.stopMs = new Date().getTime();
processObj.totalMs = processObj.stopMs - processObj.startMs;
processObj.stepObj.totalMs = processObj.totalMs;
delete processObj.stepObj;
}
return this;
}
return this._data.time;
};
/**
* Used to set key/value flags during operation execution.
* @param {String} key
* @param {String} val
* @returns {*}
*/
Operation.prototype.flag = function (key, val) {
if (key !== undefined && val !== undefined) {
this._data.flag[key] = val;
} else if (key !== undefined) {
return this._data.flag[key];
} else {
return this._data.flag;
}
};
Operation.prototype.data = function (path, val, noTime) {
if (val !== undefined) {
// Assign value to object path
this.pathSolver.set(this._data, path, val);
return this;
}
return this.pathSolver.get(this._data, path);
};
Operation.prototype.pushData = function (path, val, noTime) {
// Assign value to object path
this.pathSolver.push(this._data, path, val);
};
/**
* Stops the operation timer.
*/
Operation.prototype.stop = function () {
this._data.time.stopMs = new Date().getTime();
this._data.time.totalMs = this._data.time.stopMs - this._data.time.startMs;
};
Shared.finishModule('Operation');
module.exports = Operation;
},{"./Path":28,"./Shared":31}],27:[function(_dereq_,module,exports){
"use strict";
/**
* Allows a method to accept overloaded calls with different parameters controlling
* which passed overload function is called.
* @param {String=} name A name to provide this overload to help identify
* it if any errors occur during the resolving phase of the overload. This
* is purely for debug purposes and serves no functional purpose.
* @param {Object} def The overload definition.
* @returns {Function}
* @constructor
*/
var Overload = function (name, def) {
if (!def) {
def = name;
name = undefined;
}
if (def) {
var self = this,
index,
count,
tmpDef,
defNewKey,
sigIndex,
signatures;
if (!(def instanceof Array)) {
tmpDef = {};
// Def is an object, make sure all prop names are devoid of spaces
for (index in def) {
if (def.hasOwnProperty(index)) {
defNewKey = index.replace(/ /g, '');
// Check if the definition array has a * string in it
if (defNewKey.indexOf('*') === -1) {
// No * found
tmpDef[defNewKey] = def[index];
} else {
// A * was found, generate the different signatures that this
// definition could represent
signatures = this.generateSignaturePermutations(defNewKey);
for (sigIndex = 0; sigIndex < signatures.length; sigIndex++) {
if (!tmpDef[signatures[sigIndex]]) {
tmpDef[signatures[sigIndex]] = def[index];
}
}
}
}
}
def = tmpDef;
}
return function () {
var arr = [],
lookup,
type,
overloadName;
// Check if we are being passed a key/function object or an array of functions
if (def instanceof Array) {
// We were passed an array of functions
count = def.length;
for (index = 0; index < count; index++) {
if (def[index].length === arguments.length) {
return self.callExtend(this, '$main', def, def[index], arguments);
}
}
} else {
// Generate lookup key from arguments
// Copy arguments to an array
for (index = 0; index < arguments.length; index++) {
type = typeof arguments[index];
// Handle detecting arrays
if (type === 'object' && arguments[index] instanceof Array) {
type = 'array';
}
// Handle been presented with a single undefined argument
if (arguments.length === 1 && type === 'undefined') {
break;
}
// Add the type to the argument types array
arr.push(type);
}
lookup = arr.join(',');
// Check for an exact lookup match
if (def[lookup]) {
return self.callExtend(this, '$main', def, def[lookup], arguments);
} else {
for (index = arr.length; index >= 0; index--) {
// Get the closest match
lookup = arr.slice(0, index).join(',');
if (def[lookup + ',...']) {
// Matched against arguments + "any other"
return self.callExtend(this, '$main', def, def[lookup + ',...'], arguments);
}
}
}
}
overloadName = name !== undefined ? name : typeof this.name === 'function' ? this.name() : 'Unknown';
console.log('Overload Definition:', def);
throw('ForerunnerDB.Overload "' + overloadName + '": Overloaded method does not have a matching signature "' + lookup + '" for the passed arguments: ' + this.jStringify(arr));
};
}
return function () {};
};
/**
* Generates an array of all the different definition signatures that can be
* created from the passed string with a catch-all wildcard *. E.g. it will
* convert the signature: string,*,string to all potentials:
* string,string,string
* string,number,string
* string,object,string,
* string,function,string,
* string,undefined,string
*
* @param {String} str Signature string with a wildcard in it.
* @returns {Array} An array of signature strings that are generated.
*/
Overload.prototype.generateSignaturePermutations = function (str) {
var signatures = [],
newSignature,
types = ['array', 'string', 'object', 'number', 'function', 'undefined'],
index;
if (str.indexOf('*') > -1) {
// There is at least one "any" type, break out into multiple keys
// We could do this at query time with regular expressions but
// would be significantly slower
for (index = 0; index < types.length; index++) {
newSignature = str.replace('*', types[index]);
signatures = signatures.concat(this.generateSignaturePermutations(newSignature));
}
} else {
signatures.push(str);
}
return signatures;
};
Overload.prototype.callExtend = function (context, prop, propContext, func, args) {
var tmp,
ret;
if (context && propContext[prop]) {
tmp = context[prop];
context[prop] = propContext[prop];
ret = func.apply(context, args);
context[prop] = tmp;
return ret;
} else {
return func.apply(context, args);
}
};
module.exports = Overload;
},{}],28:[function(_dereq_,module,exports){
"use strict";
var Shared = _dereq_('./Shared');
/**
* Path object used to resolve object paths and retrieve data from
* objects by using paths.
* @param {String=} path The path to assign.
* @constructor
*/
var Path = function (path) {
this.init.apply(this, arguments);
};
Path.prototype.init = function (path) {
if (path) {
this.path(path);
}
};
Shared.addModule('Path', Path);
Shared.mixin(Path.prototype, 'Mixin.Common');
Shared.mixin(Path.prototype, 'Mixin.ChainReactor');
/**
* Gets / sets the given path for the Path instance.
* @param {String=} path The path to assign.
*/
Path.prototype.path = function (path) {
if (path !== undefined) {
this._path = this.clean(path);
this._pathParts = this._path.split('.');
return this;
}
return this._path;
};
/**
* Tests if the passed object has the paths that are specified and that
* a value exists in those paths.
* @param {Object} testKeys The object describing the paths to test for.
* @param {Object} testObj The object to test paths against.
* @returns {Boolean} True if the object paths exist.
*/
Path.prototype.hasObjectPaths = function (testKeys, testObj) {
var result = true,
i;
for (i in testKeys) {
if (testKeys.hasOwnProperty(i)) {
if (testObj[i] === undefined) {
return false;
}
if (typeof testKeys[i] === 'object') {
// Recurse object
result = this.hasObjectPaths(testKeys[i], testObj[i]);
// Should we exit early?
if (!result) {
return false;
}
}
}
}
return result;
};
/**
* Counts the total number of key endpoints in the passed object.
* @param {Object} testObj The object to count key endpoints for.
* @returns {Number} The number of endpoints.
*/
Path.prototype.countKeys = function (testObj) {
var totalKeys = 0,
i;
for (i in testObj) {
if (testObj.hasOwnProperty(i)) {
if (testObj[i] !== undefined) {
if (typeof testObj[i] !== 'object') {
totalKeys++;
} else {
totalKeys += this.countKeys(testObj[i]);
}
}
}
}
return totalKeys;
};
/**
* Tests if the passed object has the paths that are specified and that
* a value exists in those paths and if so returns the number matched.
* @param {Object} testKeys The object describing the paths to test for.
* @param {Object} testObj The object to test paths against.
* @returns {Object} Stats on the matched keys
*/
Path.prototype.countObjectPaths = function (testKeys, testObj) {
var matchData,
matchedKeys = {},
matchedKeyCount = 0,
totalKeyCount = 0,
i;
for (i in testObj) {
if (testObj.hasOwnProperty(i)) {
if (typeof testObj[i] === 'object') {
// The test / query object key is an object, recurse
matchData = this.countObjectPaths(testKeys[i], testObj[i]);
matchedKeys[i] = matchData.matchedKeys;
totalKeyCount += matchData.totalKeyCount;
matchedKeyCount += matchData.matchedKeyCount;
} else {
// The test / query object has a property that is not an object so add it as a key
totalKeyCount++;
// Check if the test keys also have this key and it is also not an object
if (testKeys && testKeys[i] && typeof testKeys[i] !== 'object') {
matchedKeys[i] = true;
matchedKeyCount++;
} else {
matchedKeys[i] = false;
}
}
}
}
return {
matchedKeys: matchedKeys,
matchedKeyCount: matchedKeyCount,
totalKeyCount: totalKeyCount
};
};
/**
* Takes a non-recursive object and converts the object hierarchy into
* a path string.
* @param {Object} obj The object to parse.
* @param {Boolean=} withValue If true will include a 'value' key in the returned
* object that represents the value the object path points to.
* @returns {Object}
*/
Path.prototype.parse = function (obj, withValue) {
var paths = [],
path = '',
resultData,
i, k;
for (i in obj) {
if (obj.hasOwnProperty(i)) {
// Set the path to the key
path = i;
if (typeof(obj[i]) === 'object') {
if (withValue) {
resultData = this.parse(obj[i], withValue);
for (k = 0; k < resultData.length; k++) {
paths.push({
path: path + '.' + resultData[k].path,
value: resultData[k].value
});
}
} else {
resultData = this.parse(obj[i]);
for (k = 0; k < resultData.length; k++) {
paths.push({
path: path + '.' + resultData[k].path
});
}
}
} else {
if (withValue) {
paths.push({
path: path,
value: obj[i]
});
} else {
paths.push({
path: path
});
}
}
}
}
return paths;
};
/**
* Takes a non-recursive object and converts the object hierarchy into
* an array of path strings that allow you to target all possible paths
* in an object.
*
* The options object accepts an "ignore" field with a regular expression
* as the value. If any key matches the expression it is not included in
* the results.
*
* The options object accepts a boolean "verbose" field. If set to true
* the results will include all paths leading up to endpoints as well as
* they endpoints themselves.
*
* @returns {Array}
*/
Path.prototype.parseArr = function (obj, options) {
options = options || {};
return this._parseArr(obj, '', [], options);
};
Path.prototype._parseArr = function (obj, path, paths, options) {
var i,
newPath = '';
path = path || '';
paths = paths || [];
for (i in obj) {
if (obj.hasOwnProperty(i)) {
if (!options.ignore || (options.ignore && !options.ignore.test(i))) {
if (path) {
newPath = path + '.' + i;
} else {
newPath = i;
}
if (typeof(obj[i]) === 'object') {
if (options.verbose) {
paths.push(newPath);
}
this._parseArr(obj[i], newPath, paths, options);
} else {
paths.push(newPath);
}
}
}
}
return paths;
};
/**
* Sets a value on an object for the specified path.
* @param {Object} obj The object to update.
* @param {String} path The path to update.
* @param {*} val The value to set the object path to.
* @returns {*}
*/
Path.prototype.set = function (obj, path, val) {
if (obj !== undefined && path !== undefined) {
var pathParts,
part;
path = this.clean(path);
pathParts = path.split('.');
part = pathParts.shift();
if (pathParts.length) {
// Generate the path part in the object if it does not already exist
obj[part] = obj[part] || {};
// Recurse
this.set(obj[part], pathParts.join('.'), val);
} else {
// Set the value
obj[part] = val;
}
}
return obj;
};
/**
* Gets a single value from the passed object and given path.
* @param {Object} obj The object to inspect.
* @param {String} path The path to retrieve data from.
* @returns {*}
*/
Path.prototype.get = function (obj, path) {
return this.value(obj, path)[0];
};
/**
* Gets the value(s) that the object contains for the currently assigned path string.
* @param {Object} obj The object to evaluate the path against.
* @param {String=} path A path to use instead of the existing one passed in path().
* @param {Object=} options An optional options object.
* @returns {Array} An array of values for the given path.
*/
Path.prototype.value = function (obj, path, options) {
var pathParts,
arr,
arrCount,
objPart,
objPartParent,
valuesArr,
returnArr,
i, k;
// Detect early exit
if (path && path.indexOf('.') === -1) {
return [obj[path]];
}
if (obj !== undefined && typeof obj === 'object') {
if (!options || options && !options.skipArrCheck) {
// Check if we were passed an array of objects and if so,
// iterate over the array and return the value from each
// array item
if (obj instanceof Array) {
returnArr = [];
for (i = 0; i < obj.length; i++) {
returnArr.push(this.get(obj[i], path));
}
return returnArr;
}
}
valuesArr = [];
if (path !== undefined) {
path = this.clean(path);
pathParts = path.split('.');
}
arr = pathParts || this._pathParts;
arrCount = arr.length;
objPart = obj;
for (i = 0; i < arrCount; i++) {
objPart = objPart[arr[i]];
if (objPartParent instanceof Array) {
// Search inside the array for the next key
for (k = 0; k < objPartParent.length; k++) {
valuesArr = valuesArr.concat(this.value(objPartParent, k + '.' + arr[i], {skipArrCheck: true}));
}
return valuesArr;
} else {
if (!objPart || typeof(objPart) !== 'object') {
break;
}
}
objPartParent = objPart;
}
return [objPart];
} else {
return [];
}
};
/**
* Push a value to an array on an object for the specified path.
* @param {Object} obj The object to update.
* @param {String} path The path to the array to push to.
* @param {*} val The value to push to the array at the object path.
* @returns {*}
*/
Path.prototype.push = function (obj, path, val) {
if (obj !== undefined && path !== undefined) {
var pathParts,
part;
path = this.clean(path);
pathParts = path.split('.');
part = pathParts.shift();
if (pathParts.length) {
// Generate the path part in the object if it does not already exist
obj[part] = obj[part] || {};
// Recurse
this.set(obj[part], pathParts.join('.'), val);
} else {
// Set the value
obj[part] = obj[part] || [];
if (obj[part] instanceof Array) {
obj[part].push(val);
} else {
throw('ForerunnerDB.Path: Cannot push to a path whose endpoint is not an array!');
}
}
}
return obj;
};
/**
* Gets the value(s) that the object contains for the currently assigned path string
* with their associated keys.
* @param {Object} obj The object to evaluate the path against.
* @param {String=} path A path to use instead of the existing one passed in path().
* @returns {Array} An array of values for the given path with the associated key.
*/
Path.prototype.keyValue = function (obj, path) {
var pathParts,
arr,
arrCount,
objPart,
objPartParent,
objPartHash,
i;
if (path !== undefined) {
path = this.clean(path);
pathParts = path.split('.');
}
arr = pathParts || this._pathParts;
arrCount = arr.length;
objPart = obj;
for (i = 0; i < arrCount; i++) {
objPart = objPart[arr[i]];
if (!objPart || typeof(objPart) !== 'object') {
objPartHash = arr[i] + ':' + objPart;
break;
}
objPartParent = objPart;
}
return objPartHash;
};
/**
* Sets a value on an object for the specified path.
* @param {Object} obj The object to update.
* @param {String} path The path to update.
* @param {*} val The value to set the object path to.
* @returns {*}
*/
Path.prototype.set = function (obj, path, val) {
if (obj !== undefined && path !== undefined) {
var pathParts,
part;
path = this.clean(path);
pathParts = path.split('.');
part = pathParts.shift();
if (pathParts.length) {
// Generate the path part in the object if it does not already exist
obj[part] = obj[part] || {};
// Recurse
this.set(obj[part], pathParts.join('.'), val);
} else {
// Set the value
obj[part] = val;
}
}
return obj;
};
/**
* Removes leading period (.) from string and returns it.
* @param {String} str The string to clean.
* @returns {*}
*/
Path.prototype.clean = function (str) {
if (str.substr(0, 1) === '.') {
str = str.substr(1, str.length -1);
}
return str;
};
Shared.finishModule('Path');
module.exports = Path;
},{"./Shared":31}],29:[function(_dereq_,module,exports){
"use strict";
var Shared = _dereq_('./Shared');
/**
* Provides chain reactor node linking so that a chain reaction can propagate
* down a node tree. Effectively creates a chain link between the reactorIn and
* reactorOut objects where a chain reaction from the reactorIn is passed through
* the reactorProcess before being passed to the reactorOut object. Reactor
* packets are only passed through to the reactorOut if the reactor IO method
* chainSend is used.
* @param {*} reactorIn An object that has the Mixin.ChainReactor methods mixed
* in to it. Chain reactions that occur inside this object will be passed through
* to the reactorOut object.
* @param {*} reactorOut An object that has the Mixin.ChainReactor methods mixed
* in to it. Chain reactions that occur in the reactorIn object will be passed
* through to this object.
* @param {Function} reactorProcess The processing method to use when chain
* reactions occur.
* @constructor
*/
var ReactorIO = function (reactorIn, reactorOut, reactorProcess) {
if (reactorIn && reactorOut && reactorProcess) {
this._reactorIn = reactorIn;
this._reactorOut = reactorOut;
this._chainHandler = reactorProcess;
if (!reactorIn.chain) {
throw('ForerunnerDB.ReactorIO: ReactorIO requires passed in and out objects to implement the ChainReactor mixin!');
}
// Register the reactorIO with the input
reactorIn.chain(this);
// Register the output with the reactorIO
this.chain(reactorOut);
} else {
throw('ForerunnerDB.ReactorIO: ReactorIO requires in, out and process arguments to instantiate!');
}
};
Shared.addModule('ReactorIO', ReactorIO);
/**
* Drop a reactor IO object, breaking the reactor link between the in and out
* reactor nodes.
* @returns {boolean}
*/
ReactorIO.prototype.drop = function () {
if (!this.isDropped()) {
this._state = 'dropped';
// Remove links
if (this._reactorIn) {
this._reactorIn.unChain(this);
}
if (this._reactorOut) {
this.unChain(this._reactorOut);
}
delete this._reactorIn;
delete this._reactorOut;
delete this._chainHandler;
this.emit('drop', this);
delete this._listeners;
}
return true;
};
/**
* Gets / sets the current state.
* @param {String=} val The name of the state to set.
* @returns {*}
*/
Shared.synthesize(ReactorIO.prototype, 'state');
Shared.mixin(ReactorIO.prototype, 'Mixin.Common');
Shared.mixin(ReactorIO.prototype, 'Mixin.ChainReactor');
Shared.mixin(ReactorIO.prototype, 'Mixin.Events');
Shared.finishModule('ReactorIO');
module.exports = ReactorIO;
},{"./Shared":31}],30:[function(_dereq_,module,exports){
"use strict";
/**
* Provides functionality to encode and decode JavaScript objects to strings
* and back again. This differs from JSON.stringify and JSON.parse in that
* special objects such as dates can be encoded to strings and back again
* so that the reconstituted version of the string still contains a JavaScript
* date object.
* @constructor
*/
var Serialiser = function () {
this.init.apply(this, arguments);
};
Serialiser.prototype.init = function () {
var self = this;
this._encoder = [];
this._decoder = [];
// Handler for Date() objects
this.registerHandler('$date', function (objInstance) {
if (objInstance instanceof Date) {
// Augment this date object with a new toJSON method
objInstance.toJSON = function () {
return "$date:" + this.toISOString();
};
// Tell the converter we have matched this object
return true;
}
// Tell converter to keep looking, we didn't match this object
return false;
}, function (data) {
if (typeof data === 'string' && data.indexOf('$date:') === 0) {
return self.convert(new Date(data.substr(6)));
}
return undefined;
});
// Handler for RegExp() objects
this.registerHandler('$regexp', function (objInstance) {
if (objInstance instanceof RegExp) {
objInstance.toJSON = function () {
return "$regexp:" + this.source.length + ":" + this.source + ":" + (this.global ? 'g' : '') + (this.ignoreCase ? 'i' : '');
/*return {
source: this.source,
params: '' + (this.global ? 'g' : '') + (this.ignoreCase ? 'i' : '')
};*/
};
// Tell the converter we have matched this object
return true;
}
// Tell converter to keep looking, we didn't match this object
return false;
}, function (data) {
if (typeof data === 'string' && data.indexOf('$regexp:') === 0) {
var dataStr = data.substr(8),//±
lengthEnd = dataStr.indexOf(':'),
sourceLength = Number(dataStr.substr(0, lengthEnd)),
source = dataStr.substr(lengthEnd + 1, sourceLength),
params = dataStr.substr(lengthEnd + sourceLength + 2);
return self.convert(new RegExp(source, params));
}
return undefined;
});
};
Serialiser.prototype.registerHandler = function (handles, encoder, decoder) {
if (handles !== undefined) {
// Register encoder
this._encoder.push(encoder);
// Register decoder
this._decoder.push(decoder);
}
};
Serialiser.prototype.convert = function (data) {
// Run through converters and check for match
var arr = this._encoder,
i;
for (i = 0; i < arr.length; i++) {
if (arr[i](data)) {
// The converter we called matched the object and converted it
// so let's return it now.
return data;
}
}
// No converter matched the object, return the unaltered one
return data;
};
Serialiser.prototype.reviver = function () {
var arr = this._decoder;
return function (key, value) {
// Check if we have a decoder method for this key
var decodedData,
i;
for (i = 0; i < arr.length; i++) {
decodedData = arr[i](value);
if (decodedData !== undefined) {
// The decoder we called matched the object and decoded it
// so let's return it now.
return decodedData;
}
}
// No decoder, return basic value
return value;
};
};
module.exports = Serialiser;
},{}],31:[function(_dereq_,module,exports){
"use strict";
var Overload = _dereq_('./Overload');
/**
* A shared object that can be used to store arbitrary data between class
* instances, and access helper methods.
* @mixin
*/
var Shared = {
version: '1.3.763',
modules: {},
plugins: {},
index: {},
_synth: {},
/**
* Adds a module to ForerunnerDB.
* @memberof Shared
* @param {String} name The name of the module.
* @param {Function} module The module class.
*/
addModule: function (name, module) {
// Store the module in the module registry
this.modules[name] = module;
// Tell the universe we are loading this module
this.emit('moduleLoad', [name, module]);
},
/**
* Called by the module once all processing has been completed. Used to determine
* if the module is ready for use by other modules.
* @memberof Shared
* @param {String} name The name of the module.
*/
finishModule: function (name) {
if (this.modules[name]) {
// Set the finished loading flag to true
this.modules[name]._fdbFinished = true;
// Assign the module name to itself so it knows what it
// is called
if (this.modules[name].prototype) {
this.modules[name].prototype.className = name;
} else {
this.modules[name].className = name;
}
this.emit('moduleFinished', [name, this.modules[name]]);
} else {
throw('ForerunnerDB.Shared: finishModule called on a module that has not been registered with addModule(): ' + name);
}
},
/**
* Will call your callback method when the specified module has loaded. If the module
* is already loaded the callback is called immediately.
* @memberof Shared
* @param {String} name The name of the module.
* @param {Function} callback The callback method to call when the module is loaded.
*/
moduleFinished: function (name, callback) {
if (this.modules[name] && this.modules[name]._fdbFinished) {
if (callback) { callback(name, this.modules[name]); }
} else {
this.on('moduleFinished', callback);
}
},
/**
* Determines if a module has been added to ForerunnerDB or not.
* @memberof Shared
* @param {String} name The name of the module.
* @returns {Boolean} True if the module exists or false if not.
*/
moduleExists: function (name) {
return Boolean(this.modules[name]);
},
mixin: new Overload({
/**
* Adds the properties and methods defined in the mixin to the passed
* object.
* @memberof Shared
* @name mixin
* @param {Object} obj The target object to add mixin key/values to.
* @param {String} mixinName The name of the mixin to add to the object.
*/
'object, string': function (obj, mixinName) {
var mixinObj;
if (typeof mixinName === 'string') {
mixinObj = this.mixins[mixinName];
if (!mixinObj) {
throw('ForerunnerDB.Shared: Cannot find mixin named: ' + mixinName);
}
}
return this.$main.call(this, obj, mixinObj);
},
/**
* Adds the properties and methods defined in the mixin to the passed
* object.
* @memberof Shared
* @name mixin
* @param {Object} obj The target object to add mixin key/values to.
* @param {Object} mixinObj The object containing the keys to mix into
* the target object.
*/
'object, *': function (obj, mixinObj) {
return this.$main.call(this, obj, mixinObj);
},
'$main': function (obj, mixinObj) {
if (mixinObj && typeof mixinObj === 'object') {
for (var i in mixinObj) {
if (mixinObj.hasOwnProperty(i)) {
obj[i] = mixinObj[i];
}
}
}
return obj;
}
}),
/**
* Generates a generic getter/setter method for the passed method name.
* @memberof Shared
* @param {Object} obj The object to add the getter/setter to.
* @param {String} name The name of the getter/setter to generate.
* @param {Function=} extend A method to call before executing the getter/setter.
* The existing getter/setter can be accessed from the extend method via the
* $super e.g. this.$super();
*/
synthesize: function (obj, name, extend) {
this._synth[name] = this._synth[name] || function (val) {
if (val !== undefined) {
this['_' + name] = val;
return this;
}
return this['_' + name];
};
if (extend) {
var self = this;
obj[name] = function () {
var tmp = this.$super,
ret;
this.$super = self._synth[name];
ret = extend.apply(this, arguments);
this.$super = tmp;
return ret;
};
} else {
obj[name] = this._synth[name];
}
},
/**
* Allows a method to be overloaded.
* @memberof Shared
* @param arr
* @returns {Function}
* @constructor
*/
overload: Overload,
/**
* Define the mixins that other modules can use as required.
* @memberof Shared
*/
mixins: {
'Mixin.Common': _dereq_('./Mixin.Common'),
'Mixin.Events': _dereq_('./Mixin.Events'),
'Mixin.ChainReactor': _dereq_('./Mixin.ChainReactor'),
'Mixin.CRUD': _dereq_('./Mixin.CRUD'),
'Mixin.Constants': _dereq_('./Mixin.Constants'),
'Mixin.Triggers': _dereq_('./Mixin.Triggers'),
'Mixin.Sorting': _dereq_('./Mixin.Sorting'),
'Mixin.Matching': _dereq_('./Mixin.Matching'),
'Mixin.Updating': _dereq_('./Mixin.Updating'),
'Mixin.Tags': _dereq_('./Mixin.Tags')
}
};
// Add event handling to shared
Shared.mixin(Shared, 'Mixin.Events');
module.exports = Shared;
},{"./Mixin.CRUD":16,"./Mixin.ChainReactor":17,"./Mixin.Common":18,"./Mixin.Constants":19,"./Mixin.Events":20,"./Mixin.Matching":21,"./Mixin.Sorting":22,"./Mixin.Tags":23,"./Mixin.Triggers":24,"./Mixin.Updating":25,"./Overload":27}],32:[function(_dereq_,module,exports){
/* jshint strict:false */
if (!Array.prototype.filter) {
Array.prototype.filter = function(fun/*, thisArg*/) {
if (this === void 0 || this === null) {
throw new TypeError();
}
var t = Object(this);
var len = t.length >>> 0; // jshint ignore:line
if (typeof fun !== 'function') {
throw new TypeError();
}
var res = [];
var thisArg = arguments.length >= 2 ? arguments[1] : void 0;
for (var i = 0; i < len; i++) {
if (i in t) {
var val = t[i];
// NOTE: Technically this should Object.defineProperty at
// the next index, as push can be affected by
// properties on Object.prototype and Array.prototype.
// But that method's new, and collisions should be
// rare, so use the more-compatible alternative.
if (fun.call(thisArg, val, i, t)) {
res.push(val);
}
}
}
return res;
};
}
if (typeof Object.create !== 'function') {
Object.create = (function() {
var Temp = 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');
}
Temp.prototype = prototype;
var result = new Temp();
Temp.prototype = null;
return result;
};
})();
}
// Production steps of ECMA-262, Edition 5, 15.4.4.14
// Reference: http://es5.github.io/#x15.4.4.14e
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(searchElement, fromIndex) {
var k;
// 1. Let O be the result of calling ToObject passing
// the this value as the argument.
if (this === null) {
throw new TypeError('"this" is null or not defined');
}
var O = Object(this);
// 2. Let lenValue be the result of calling the Get
// internal method of O with the argument "length".
// 3. Let len be ToUint32(lenValue).
var len = O.length >>> 0; // jshint ignore:line
// 4. If len is 0, return -1.
if (len === 0) {
return -1;
}
// 5. If argument fromIndex was passed let n be
// ToInteger(fromIndex); else let n be 0.
var n = +fromIndex || 0;
if (Math.abs(n) === Infinity) {
n = 0;
}
// 6. If n >= len, return -1.
if (n >= len) {
return -1;
}
// 7. If n >= 0, then Let k be n.
// 8. Else, n<0, Let k be len - abs(n).
// If k is less than 0, then let k be 0.
k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
// 9. Repeat, while k < len
while (k < len) {
// a. Let Pk be ToString(k).
// This is implicit for LHS operands of the in operator
// b. Let kPresent be the result of calling the
// HasProperty internal method of O with argument Pk.
// This step can be combined with c
// c. If kPresent is true, then
// i. Let elementK be the result of calling the Get
// internal method of O with the argument ToString(k).
// ii. Let same be the result of applying the
// Strict Equality Comparison Algorithm to
// searchElement and elementK.
// iii. If same is true, return k.
if (k in O && O[k] === searchElement) {
return k;
}
k++;
}
return -1;
};
}
module.exports = {};
},{}],33:[function(_dereq_,module,exports){
"use strict";
// Import external names locally
var Shared,
Db,
Collection,
CollectionGroup,
CollectionInit,
DbInit,
ReactorIO,
ActiveBucket,
Overload = _dereq_('./Overload'),
Path,
sharedPathSolver;
Shared = _dereq_('./Shared');
/**
* Creates a new view instance.
* @param {String} name The name of the view.
* @param {Object=} query The view's query.
* @param {Object=} options An options object.
* @constructor
*/
var View = function (name, query, options) {
this.init.apply(this, arguments);
};
Shared.addModule('View', View);
Shared.mixin(View.prototype, 'Mixin.Common');
Shared.mixin(View.prototype, 'Mixin.Matching');
Shared.mixin(View.prototype, 'Mixin.ChainReactor');
Shared.mixin(View.prototype, 'Mixin.Constants');
Shared.mixin(View.prototype, 'Mixin.Triggers');
Shared.mixin(View.prototype, 'Mixin.Tags');
Collection = _dereq_('./Collection');
CollectionGroup = _dereq_('./CollectionGroup');
ActiveBucket = _dereq_('./ActiveBucket');
ReactorIO = _dereq_('./ReactorIO');
CollectionInit = Collection.prototype.init;
Db = Shared.modules.Db;
DbInit = Db.prototype.init;
Path = Shared.modules.Path;
sharedPathSolver = new Path();
View.prototype.init = function (name, query, options) {
var self = this;
this.sharedPathSolver = sharedPathSolver;
this._name = name;
this._listeners = {};
this._querySettings = {};
this._debug = {};
this.query(query, options, false);
this._collectionDroppedWrap = function () {
self._collectionDropped.apply(self, arguments);
};
this._data = new Collection(this.name() + '_internal');
};
/**
* This reactor IO node is given data changes from source data and
* then acts as a firewall process between the source and view data.
* Data needs to meet the requirements this IO node imposes before
* the data is passed down the reactor chain (to the view). This
* allows us to intercept data changes from the data source and act
* on them such as applying transforms, checking the data matches
* the view's query, applying joins to the data etc before sending it
* down the reactor chain via the this.chainSend() calls.
*
* Update packets are especially complex to handle because an update
* on the underlying source data could translate into an insert,
* update or remove call on the view. Take a scenario where the view's
* query limits the data see from the source. If the source data is
* updated and the data now falls inside the view's query limitations
* the data is technically now an insert on the view, not an update.
* The same is true in reverse where the update becomes a remove. If
* the updated data already exists in the view and will still exist
* after the update operation then the update can remain an update.
* @param {Object} chainPacket The chain reactor packet representing the
* data operation that has just been processed on the source data.
* @param {View} self The reference to the view we are operating for.
* @private
*/
View.prototype._handleChainIO = function (chainPacket, self) {
var type = chainPacket.type,
hasActiveJoin,
hasActiveQuery,
hasTransformIn,
sharedData;
// NOTE: "self" in this context is the view instance.
// NOTE: "this" in this context is the ReactorIO node sitting in
// between the source (sender) and the destination (listener) and
// in this case the source is the view's "from" data source and the
// destination is the view's _data collection. This means
// that "this.chainSend()" is asking the ReactorIO node to send the
// packet on to the destination listener.
// EARLY EXIT: Check that the packet is not a CRUD operation
if (type !== 'setData' && type !== 'insert' && type !== 'update' && type !== 'remove') {
// This packet is NOT a CRUD operation packet so exit early!
// Returning false informs the chain reactor to continue propagation
// of the chain packet down the graph tree
return false;
}
// We only need to check packets under three conditions
// 1) We have a limiting query on the view "active query",
// 2) We have a query options with a $join clause on the view "active join"
// 3) We have a transformIn operation registered on the view.
// If none of these conditions exist we can just allow the chain
// packet to proceed as normal
hasActiveJoin = Boolean(self._querySettings.options && self._querySettings.options.$join);
hasActiveQuery = Boolean(self._querySettings.query);
hasTransformIn = self._data._transformIn !== undefined;
// EARLY EXIT: Check for any complex operation flags and if none
// exist, send the packet on and exit early
if (!hasActiveJoin && !hasActiveQuery && !hasTransformIn) {
// We don't have any complex operation flags so exit early!
// Returning false informs the chain reactor to continue propagation
// of the chain packet down the graph tree
return false;
}
// We have either an active query, active join or a transformIn
// function registered on the view
// We create a shared data object here so that the disparate method
// calls can share data with each other via this object whilst
// still remaining separate methods to keep code relatively clean.
sharedData = {
dataArr: [],
removeArr: []
};
// Check the packet type to get the data arrays to work on
if (chainPacket.type === 'insert') {
// Check if the insert data is an array
if (chainPacket.data.dataSet instanceof Array) {
// Use the insert data array
sharedData.dataArr = chainPacket.data.dataSet;
} else {
// Generate an array from the single insert object
sharedData.dataArr = [chainPacket.data.dataSet];
}
} else if (chainPacket.type === 'update') {
// Use the dataSet array
sharedData.dataArr = chainPacket.data.dataSet;
} else if (chainPacket.type === 'remove') {
if (chainPacket.data.dataSet instanceof Array) {
// Use the remove data array
sharedData.removeArr = chainPacket.data.dataSet;
} else {
// Generate an array from the single remove object
sharedData.removeArr = [chainPacket.data.dataSet];
}
}
// Safety check
if (!(sharedData.dataArr instanceof Array)) {
// This shouldn't happen, let's log it
console.warn('WARNING: dataArr being processed by chain reactor in View class is inconsistent!');
sharedData.dataArr = [];
}
if (!(sharedData.removeArr instanceof Array)) {
// This shouldn't happen, let's log it
console.warn('WARNING: removeArr being processed by chain reactor in View class is inconsistent!');
sharedData.removeArr = [];
}
// We need to operate in this order:
// 1) Check if there is an active join - active joins are operated
// against the SOURCE data. The joined data can potentially be
// utilised by any active query or transformIn so we do this step first.
// 2) Check if there is an active query - this is a query that is run
// against the SOURCE data after any active joins have been resolved
// on the source data. This allows an active query to operate on data
// that would only exist after an active join has been executed.
// If the source data does not fall inside the limiting factors of the
// active query then we add it to a removal array. If it does fall
// inside the limiting factors when we add it to an upsert array. This
// is because data that falls inside the query could end up being
// either new data or updated data after a transformIn operation.
// 3) Check if there is a transformIn function. If a transformIn function
// exist we run it against the data after doing any active join and
// active query.
if (hasActiveJoin) {
if (this.debug()) {
console.time(this.logIdentifier() + ' :: _handleChainIO_ActiveJoin');
}
self._handleChainIO_ActiveJoin(chainPacket, sharedData);
if (this.debug()) {
console.timeEnd(this.logIdentifier() + ' :: _handleChainIO_ActiveJoin');
}
}
if (hasActiveQuery) {
if (this.debug()) {
console.time(this.logIdentifier() + ' :: _handleChainIO_ActiveQuery');
}
self._handleChainIO_ActiveQuery(chainPacket, sharedData);
if (this.debug()) {
console.timeEnd(this.logIdentifier() + ' :: _handleChainIO_ActiveQuery');
}
}
if (hasTransformIn) {
if (this.debug()) {
console.time(this.logIdentifier() + ' :: _handleChainIO_TransformIn');
}
self._handleChainIO_TransformIn(chainPacket, sharedData);
if (this.debug()) {
console.timeEnd(this.logIdentifier() + ' :: _handleChainIO_TransformIn');
}
}
// Check if we still have data to operate on and exit
// if there is none left
if (!sharedData.dataArr.length && !sharedData.removeArr.length) {
// There is no more data to operate on, exit without
// sending any data down the chain reactor (return true
// will tell reactor to exit without continuing)!
return true;
}
// Grab the public data collection's primary key
sharedData.pk = self._data.primaryKey();
// We still have data left, let's work out how to handle it
// first let's loop through the removals as these are easy
if (sharedData.removeArr.length) {
if (this.debug()) {
console.time(this.logIdentifier() + ' :: _handleChainIO_RemovePackets');
}
self._handleChainIO_RemovePackets(this, chainPacket, sharedData);
if (this.debug()) {
console.timeEnd(this.logIdentifier() + ' :: _handleChainIO_RemovePackets');
}
}
if (sharedData.dataArr.length) {
if (this.debug()) {
console.time(this.logIdentifier() + ' :: _handleChainIO_UpsertPackets');
}
self._handleChainIO_UpsertPackets(this, chainPacket, sharedData);
if (this.debug()) {
console.timeEnd(this.logIdentifier() + ' :: _handleChainIO_UpsertPackets');
}
}
// Now return true to tell the chain reactor not to propagate
// the data itself as we have done all that work here
return true;
};
View.prototype._handleChainIO_ActiveJoin = function (chainPacket, sharedData) {
var dataArr = sharedData.dataArr,
removeArr;
// Since we have an active join, all we need to do is operate
// the join clause on each item in the packet's data array.
removeArr = this.applyJoin(dataArr, this._querySettings.options.$join, {}, {});
// Now that we've run our join keep in mind that joins can exclude data
// if there is no matching joined data and the require: true clause in
// the join options is enabled. This means we have to store a removal
// array that tells us which items from the original data we sent to
// join did not match the join data and were set with a require flag.
// Now that we have our array of items to remove, let's run through the
// original data and remove them from there.
this.spliceArrayByIndexList(dataArr, removeArr);
// Make sure we add any items we removed to the shared removeArr
sharedData.removeArr = sharedData.removeArr.concat(removeArr);
};
View.prototype._handleChainIO_ActiveQuery = function (chainPacket, sharedData) {
var self = this,
dataArr = sharedData.dataArr,
i;
// Now we need to run the data against the active query to
// see if the data should be in the final data list or not,
// so we use the _match method.
// Loop backwards so we can safely splice from the array
// while we are looping
for (i = dataArr.length - 1; i >= 0; i--) {
if (!self._match(dataArr[i], self._querySettings.query, self._querySettings.options, 'and', {})) {
// The data didn't match the active query, add it
// to the shared removeArr
sharedData.removeArr.push(dataArr[i]);
// Now remove it from the shared dataArr
dataArr.splice(i, 1);
}
}
};
View.prototype._handleChainIO_TransformIn = function (chainPacket, sharedData) {
var self = this,
dataArr = sharedData.dataArr,
removeArr = sharedData.removeArr,
dataIn = self._data._transformIn,
i;
// At this stage we take the remaining items still left in the data
// array and run our transformIn method on each one, modifying it
// from what it was to what it should be on the view. We also have
// to run this on items we want to remove too because transforms can
// affect primary keys and therefore stop us from identifying the
// correct items to run removal operations on.
// It is important that these are transformed BEFORE they are passed
// to the CRUD methods because we use the CU data to check the position
// of the item in the array and that can only happen if it is already
// pre-transformed. The removal stuff also needs pre-transformed
// because ids can be modified by a transform.
for (i = 0; i < dataArr.length; i++) {
// Assign the new value
dataArr[i] = dataIn(dataArr[i]);
}
for (i = 0; i < removeArr.length; i++) {
// Assign the new value
removeArr[i] = dataIn(removeArr[i]);
}
};
View.prototype._handleChainIO_RemovePackets = function (ioObj, chainPacket, sharedData) {
var $or = [],
pk = sharedData.pk,
removeArr = sharedData.removeArr,
packet = {
dataSet: removeArr,
query: {
$or: $or
}
},
orObj,
i;
for (i = 0; i < removeArr.length; i++) {
orObj = {};
orObj[pk] = removeArr[i][pk];
$or.push(orObj);
}
ioObj.chainSend('remove', packet);
};
View.prototype._handleChainIO_UpsertPackets = function (ioObj, chainPacket, sharedData) {
var data = this._data,
primaryIndex = data._primaryIndex,
primaryCrc = data._primaryCrc,
pk = sharedData.pk,
dataArr = sharedData.dataArr,
arrItem,
insertArr = [],
updateArr = [],
query,
i;
// Let's work out what type of operation this data should
// generate between an insert or an update.
for (i = 0; i < dataArr.length; i++) {
arrItem = dataArr[i];
// Check if the data already exists in the data
if (primaryIndex.get(arrItem[pk])) {
// Matching item exists, check if the data is the same
if (primaryCrc.get(arrItem[pk]) !== this.hash(arrItem[pk])) {
// The document exists in the data collection but data differs, update required
updateArr.push(arrItem);
}
} else {
// The document is missing from this collection, insert required
insertArr.push(arrItem);
}
}
if (insertArr.length) {
ioObj.chainSend('insert', {
dataSet: insertArr
});
}
if (updateArr.length) {
for (i = 0; i < updateArr.length; i++) {
arrItem = updateArr[i];
query = {};
query[pk] = arrItem[pk];
ioObj.chainSend('update', {
query: query,
update: arrItem,
dataSet: [arrItem]
});
}
}
};
/**
* Executes an insert against the view's underlying data-source.
* @see Collection::insert()
*/
View.prototype.insert = function () {
this._from.insert.apply(this._from, arguments);
};
/**
* Executes an update against the view's underlying data-source.
* @see Collection::update()
*/
View.prototype.update = function () {
this._from.update.apply(this._from, arguments);
};
/**
* Executes an updateById against the view's underlying data-source.
* @see Collection::updateById()
*/
View.prototype.updateById = function () {
this._from.updateById.apply(this._from, arguments);
};
/**
* Executes a remove against the view's underlying data-source.
* @see Collection::remove()
*/
View.prototype.remove = function () {
this._from.remove.apply(this._from, arguments);
};
/**
* Queries the view data.
* @see Collection::find()
* @returns {Array} The result of the find query.
*/
View.prototype.find = function (query, options) {
return this._data.find(query, options);
};
/**
* Queries the view data for a single document.
* @see Collection::findOne()
* @returns {Object} The result of the find query.
*/
View.prototype.findOne = function (query, options) {
return this._data.findOne(query, options);
};
/**
* Queries the view data by specific id.
* @see Collection::findById()
* @returns {Array} The result of the find query.
*/
View.prototype.findById = function (id, options) {
return this._data.findById(id, options);
};
/**
* Queries the view data in a sub-array.
* @see Collection::findSub()
* @returns {Array} The result of the find query.
*/
View.prototype.findSub = function (match, path, subDocQuery, subDocOptions) {
return this._data.findSub(match, path, subDocQuery, subDocOptions);
};
/**
* Queries the view data in a sub-array and returns first match.
* @see Collection::findSubOne()
* @returns {Object} The result of the find query.
*/
View.prototype.findSubOne = function (match, path, subDocQuery, subDocOptions) {
return this._data.findSubOne(match, path, subDocQuery, subDocOptions);
};
/**
* Gets the module's internal data collection.
* @returns {Collection}
*/
View.prototype.data = function () {
return this._data;
};
/**
* Sets the source from which the view will assemble its data.
* @param {Collection|View} source The source to use to assemble view data.
* @param {Function=} callback A callback method.
* @returns {*} If no argument is passed, returns the current value of from,
* otherwise returns itself for chaining.
*/
View.prototype.from = function (source, callback) {
var self = this;
if (source !== undefined) {
// Check if we have an existing from
if (this._from) {
// Remove the listener to the drop event
this._from.off('drop', this._collectionDroppedWrap);
// Remove the current reference to the _from since we
// are about to replace it with a new one
delete this._from;
}
// Check if we have an existing reactor io that links the
// previous _from source to the view's internal data
if (this._io) {
// Drop the io and remove it
this._io.drop();
delete this._io;
}
// Check if we were passed a source name rather than a
// reference to a source object
if (typeof(source) === 'string') {
// We were passed a name, assume it is a collection and
// get the reference to the collection of that name
source = this._db.collection(source);
}
// Check if we were passed a reference to a view rather than
// a collection. Views need to be handled slightly differently
// since their data is stored in an internal data collection
// rather than actually being a direct data source themselves.
if (source.className === 'View') {
// The source is a view so IO to the internal data collection
// instead of the view proper
source = source._data;
if (this.debug()) {
console.log(this.logIdentifier() + ' Using internal data "' + source.instanceIdentifier() + '" for IO graph linking');
}
}
// Assign the new data source as the view's _from
this._from = source;
// Hook the new data source's drop event so we can unhook
// it as a data source if it gets dropped. This is important
// so that we don't run into problems using a dropped source
// for active data.
this._from.on('drop', this._collectionDroppedWrap);
// Create a new reactor IO graph node that intercepts chain packets from the
// view's _from source and determines how they should be interpreted by
// this view. See the _handleChainIO() method which does all the chain packet
// processing for the view.
this._io = new ReactorIO(this._from, this, function (chainPacket) { return self._handleChainIO.call(this, chainPacket, self); });
// Set the view's internal data primary key to the same as the
// current active _from data source
this._data.primaryKey(source.primaryKey());
// Do the initial data lookup and populate the view's internal data
// since at this point we don't actually have any data in the view
// yet.
var collData = source.find(this._querySettings.query, this._querySettings.options);
this._data.setData(collData, {}, callback);
// If we have an active query and that query has an $orderBy clause,
// update our active bucket which allows us to keep track of where
// data should be placed in our internal data array. This is about
// ordering of data and making sure that we maintain an ordered array
// so that if we have data-binding we can place an item in the data-
// bound view at the correct location. Active buckets use quick-sort
// algorithms to quickly determine the position of an item inside an
// existing array based on a sort protocol.
if (this._querySettings.options && this._querySettings.options.$orderBy) {
this.rebuildActiveBucket(this._querySettings.options.$orderBy);
} else {
this.rebuildActiveBucket();
}
return this;
}
return this._from;
};
/**
* The chain reaction handler method for the view.
* @param {Object} chainPacket The chain reaction packet to handle.
* @private
*/
View.prototype._chainHandler = function (chainPacket) {
var //self = this,
arr,
count,
index,
insertIndex,
updates,
primaryKey,
item,
currentIndex;
if (this.debug()) {
console.log(this.logIdentifier() + ' Received chain reactor data: ' + chainPacket.type);
}
switch (chainPacket.type) {
case 'setData':
if (this.debug()) {
console.log(this.logIdentifier() + ' Setting data in underlying (internal) view collection "' + this._data.name() + '"');
}
// Get the new data from our underlying data source sorted as we want
var collData = this._from.find(this._querySettings.query, this._querySettings.options);
this._data.setData(collData);
// Rebuild active bucket as well
this.rebuildActiveBucket(this._querySettings.options);
break;
case 'insert':
if (this.debug()) {
console.log(this.logIdentifier() + ' Inserting some data into underlying (internal) view collection "' + this._data.name() + '"');
}
// Decouple the data to ensure we are working with our own copy
chainPacket.data.dataSet = this.decouple(chainPacket.data.dataSet);
// Make sure we are working with an array
if (!(chainPacket.data.dataSet instanceof Array)) {
chainPacket.data.dataSet = [chainPacket.data.dataSet];
}
if (this._querySettings.options && this._querySettings.options.$orderBy) {
// Loop the insert data and find each item's index
arr = chainPacket.data.dataSet;
count = arr.length;
for (index = 0; index < count; index++) {
insertIndex = this._activeBucket.insert(arr[index]);
this._data._insertHandle(arr[index], insertIndex);
}
} else {
// Set the insert index to the passed index, or if none, the end of the view data array
insertIndex = this._data._data.length;
this._data._insertHandle(chainPacket.data.dataSet, insertIndex);
}
break;
case 'update':
if (this.debug()) {
console.log(this.logIdentifier() + ' Updating some data in underlying (internal) view collection "' + this._data.name() + '"');
}
primaryKey = this._data.primaryKey();
// Do the update
updates = this._data._handleUpdate(
chainPacket.data.query,
chainPacket.data.update,
chainPacket.data.options
);
if (this._querySettings.options && this._querySettings.options.$orderBy) {
// TODO: This would be a good place to improve performance by somehow
// TODO: inspecting the change that occurred when update was performed
// TODO: above and determining if it affected the order clause keys
// TODO: and if not, skipping the active bucket updates here
// Loop the updated items and work out their new sort locations
count = updates.length;
for (index = 0; index < count; index++) {
item = updates[index];
// Remove the item from the active bucket (via it's id)
this._activeBucket.remove(item);
// Get the current location of the item
currentIndex = this._data._data.indexOf(item);
// Add the item back in to the active bucket
insertIndex = this._activeBucket.insert(item);
if (currentIndex !== insertIndex) {
// Move the updated item to the new index
this._data._updateSpliceMove(this._data._data, currentIndex, insertIndex);
}
}
}
break;
case 'remove':
if (this.debug()) {
console.log(this.logIdentifier() + ' Removing some data from underlying (internal) view collection "' + this._data.name() + '"');
}
this._data.remove(chainPacket.data.query, chainPacket.options);
if (this._querySettings.options && this._querySettings.options.$orderBy) {
// Loop the dataSet and remove the objects from the ActiveBucket
arr = chainPacket.data.dataSet;
count = arr.length;
for (index = 0; index < count; index++) {
this._activeBucket.remove(arr[index]);
}
}
break;
default:
break;
}
};
/**
* Handles when an underlying collection the view is using as a data
* source is dropped.
* @param {Collection} collection The collection that has been dropped.
* @private
*/
View.prototype._collectionDropped = function (collection) {
if (collection) {
// Collection was dropped, remove from view
delete this._from;
}
};
/**
* Creates an index on the view.
* @see Collection::ensureIndex()
* @returns {*}
*/
View.prototype.ensureIndex = function () {
return this._data.ensureIndex.apply(this._data, arguments);
};
/**
/**
* Listens for an event.
* @see Mixin.Events::on()
*/
View.prototype.on = function () {
return this._data.on.apply(this._data, arguments);
};
/**
* Cancels an event listener.
* @see Mixin.Events::off()
*/
View.prototype.off = function () {
return this._data.off.apply(this._data, arguments);
};
/**
* Emits an event.
* @see Mixin.Events::emit()
*/
View.prototype.emit = function () {
return this._data.emit.apply(this._data, arguments);
};
/**
* Emits an event.
* @see Mixin.Events::deferEmit()
*/
View.prototype.deferEmit = function () {
return this._data.deferEmit.apply(this._data, arguments);
};
/**
* Find the distinct values for a specified field across a single collection and
* returns the results in an array.
* @param {String} key The field path to return distinct values for e.g. "person.name".
* @param {Object=} query The query to use to filter the documents used to return values from.
* @param {Object=} options The query options to use when running the query.
* @returns {Array}
*/
View.prototype.distinct = function (key, query, options) {
return this._data.distinct(key, query, options);
};
/**
* Gets the primary key for this view from the assigned collection.
* @see Collection::primaryKey()
* @returns {String}
*/
View.prototype.primaryKey = function () {
return this._data.primaryKey();
};
/**
* Drops a view and all it's stored data from the database.
* @returns {boolean} True on success, false on failure.
*/
View.prototype.drop = function (callback) {
if (!this.isDropped()) {
if (this._from) {
this._from.off('drop', this._collectionDroppedWrap);
this._from._removeView(this);
}
if (this.debug() || (this._db && this._db.debug())) {
console.log(this.logIdentifier() + ' Dropping');
}
this._state = 'dropped';
// Clear io and chains
if (this._io) {
this._io.drop();
}
// Drop the view's internal collection
if (this._data) {
this._data.drop();
}
if (this._db && this._name) {
delete this._db._view[this._name];
}
this.emit('drop', this);
if (callback) { callback(false, true); }
delete this._chain;
delete this._from;
delete this._data;
delete this._io;
delete this._listeners;
delete this._querySettings;
delete this._db;
return true;
}
return false;
};
/**
* Gets / sets the query object and query options that the view uses
* to build it's data set. This call modifies both the query and
* query options at the same time.
* @param {Object=} query The query to set.
* @param {Boolean=} options The query options object.
* @param {Boolean=} refresh Whether to refresh the view data after
* this operation. Defaults to true.
* @returns {*}
* @deprecated Use query(<query>, <options>, <refresh>) instead. Query
* now supports being presented with multiple different variations of
* arguments.
*/
View.prototype.queryData = function (query, options, refresh) {
if (query !== undefined) {
this._querySettings.query = query;
if (query.$findSub && !query.$findSub.$from) {
query.$findSub.$from = this._data.name();
}
if (query.$findSubOne && !query.$findSubOne.$from) {
query.$findSubOne.$from = this._data.name();
}
}
if (options !== undefined) {
this._querySettings.options = options;
}
if (query !== undefined || options !== undefined) {
if (refresh === undefined || refresh === true) {
this.refresh();
}
}
if (query !== undefined) {
this.emit('queryChange', query);
}
if (options !== undefined) {
this.emit('queryOptionsChange', options);
}
if (query !== undefined || options !== undefined) {
return this;
}
return this._querySettings;
};
/**
* Add data to the existing query.
* @param {Object} obj The data whose keys will be added to the existing
* query object.
* @param {Boolean} overwrite Whether or not to overwrite data that already
* exists in the query object. Defaults to true.
* @param {Boolean=} refresh Whether or not to refresh the view data set
* once the operation is complete. Defaults to true.
*/
View.prototype.queryAdd = function (obj, overwrite, refresh) {
this._querySettings.query = this._querySettings.query || {};
var query = this._querySettings.query,
i;
if (obj !== undefined) {
// Loop object properties and add to existing query
for (i in obj) {
if (obj.hasOwnProperty(i)) {
if (query[i] === undefined || (query[i] !== undefined && overwrite !== false)) {
query[i] = obj[i];
}
}
}
}
if (refresh === undefined || refresh === true) {
this.refresh();
}
if (query !== undefined) {
this.emit('queryChange', query);
}
};
/**
* Remove data from the existing query.
* @param {Object} obj The data whose keys will be removed from the existing
* query object.
* @param {Boolean=} refresh Whether or not to refresh the view data set
* once the operation is complete. Defaults to true.
*/
View.prototype.queryRemove = function (obj, refresh) {
var query = this._querySettings.query,
i;
if (query) {
if (obj !== undefined) {
// Loop object properties and add to existing query
for (i in obj) {
if (obj.hasOwnProperty(i)) {
delete query[i];
}
}
}
if (refresh === undefined || refresh === true) {
this.refresh();
}
if (query !== undefined) {
this.emit('queryChange', query);
}
}
};
/**
* Gets / sets the query being used to generate the view data. It
* does not change or modify the view's query options.
* @param {Object=} query The query to set.
* @param {Boolean=} refresh Whether to refresh the view data after
* this operation. Defaults to true.
* @returns {*}
*/
View.prototype.query = new Overload({
'': function () {
return this._querySettings.query;
},
'object': function (query) {
return this.$main.call(this, query, undefined, true);
},
'*, boolean': function (query, refresh) {
return this.$main.call(this, query, undefined, refresh);
},
'object, object': function (query, options) {
return this.$main.call(this, query, options, true);
},
'*, *, boolean': function (query, options, refresh) {
return this.$main.call(this, query, options, refresh);
},
'$main': function (query, options, refresh) {
if (query !== undefined) {
this._querySettings.query = query;
if (query.$findSub && !query.$findSub.$from) {
query.$findSub.$from = this._data.name();
}
if (query.$findSubOne && !query.$findSubOne.$from) {
query.$findSubOne.$from = this._data.name();
}
}
if (options !== undefined) {
this._querySettings.options = options;
}
if (query !== undefined || options !== undefined) {
if (refresh === undefined || refresh === true) {
this.refresh();
}
}
if (query !== undefined) {
this.emit('queryChange', query);
}
if (options !== undefined) {
this.emit('queryOptionsChange', options);
}
if (query !== undefined || options !== undefined) {
return this;
}
return this._querySettings;
}
});
/**
* Gets / sets the orderBy clause in the query options for the view.
* @param {Object=} val The order object.
* @returns {*}
*/
View.prototype.orderBy = function (val) {
if (val !== undefined) {
var queryOptions = this.queryOptions() || {};
queryOptions.$orderBy = val;
this.queryOptions(queryOptions);
return this;
}
return (this.queryOptions() || {}).$orderBy;
};
/**
* Gets / sets the page clause in the query options for the view.
* @param {Number=} val The page number to change to (zero index).
* @returns {*}
*/
View.prototype.page = function (val) {
if (val !== undefined) {
var queryOptions = this.queryOptions() || {};
// Only execute a query options update if page has changed
if (val !== queryOptions.$page) {
queryOptions.$page = val;
this.queryOptions(queryOptions);
}
return this;
}
return (this.queryOptions() || {}).$page;
};
/**
* Jump to the first page in the data set.
* @returns {*}
*/
View.prototype.pageFirst = function () {
return this.page(0);
};
/**
* Jump to the last page in the data set.
* @returns {*}
*/
View.prototype.pageLast = function () {
var pages = this.cursor().pages,
lastPage = pages !== undefined ? pages : 0;
return this.page(lastPage - 1);
};
/**
* Move forward or backwards in the data set pages by passing a positive
* or negative integer of the number of pages to move.
* @param {Number} val The number of pages to move.
* @returns {*}
*/
View.prototype.pageScan = function (val) {
if (val !== undefined) {
var pages = this.cursor().pages,
queryOptions = this.queryOptions() || {},
currentPage = queryOptions.$page !== undefined ? queryOptions.$page : 0;
currentPage += val;
if (currentPage < 0) {
currentPage = 0;
}
if (currentPage >= pages) {
currentPage = pages - 1;
}
return this.page(currentPage);
}
};
/**
* Gets / sets the query options used when applying sorting etc to the
* view data set.
* @param {Object=} options An options object.
* @param {Boolean=} refresh Whether to refresh the view data after
* this operation. Defaults to true.
* @returns {*}
*/
View.prototype.queryOptions = function (options, refresh) {
if (options !== undefined) {
this._querySettings.options = options;
if (options.$decouple === undefined) { options.$decouple = true; }
if (refresh === undefined || refresh === true) {
this.refresh();
} else {
// TODO: This could be wasteful if the previous options $orderBy was identical, do a hash and check first!
this.rebuildActiveBucket(options.$orderBy);
}
if (options !== undefined) {
this.emit('queryOptionsChange', options);
}
return this;
}
return this._querySettings.options;
};
/**
* Clears the existing active bucket and builds a new one based
* on the passed orderBy object (if one is passed).
* @param {Object=} orderBy The orderBy object describing how to
* order any data.
*/
View.prototype.rebuildActiveBucket = function (orderBy) {
if (orderBy) {
var arr = this._data._data,
arrCount = arr.length;
// Build a new active bucket
this._activeBucket = new ActiveBucket(orderBy);
this._activeBucket.primaryKey(this._data.primaryKey());
// Loop the current view data and add each item
for (var i = 0; i < arrCount; i++) {
this._activeBucket.insert(arr[i]);
}
} else {
// Remove any existing active bucket
delete this._activeBucket;
}
};
/**
* Refreshes the view data such as ordering etc.
*/
View.prototype.refresh = function () {
var self = this,
refreshResults,
joinArr,
i, k;
if (this._from) {
// Clear the private data collection which will propagate to the public data
// collection automatically via the chain reactor node between them
this._data.remove();
// Grab all the data from the underlying data source
refreshResults = this._from.find(this._querySettings.query, this._querySettings.options);
this.cursor(refreshResults.$cursor);
// Insert the underlying data into the private data collection
this._data.insert(refreshResults);
// Store the current cursor data
this._data._data.$cursor = refreshResults.$cursor;
this._data._data.$cursor = refreshResults.$cursor;
}
if (this._querySettings && this._querySettings.options && this._querySettings.options.$join && this._querySettings.options.$join.length) {
// Define the change handler method
self.__joinChange = self.__joinChange || function () {
self._joinChange();
};
// Check for existing join collections
if (this._joinCollections && this._joinCollections.length) {
// Loop the join collections and remove change listeners
// Loop the collections and hook change events
for (i = 0; i < this._joinCollections.length; i++) {
this._db.collection(this._joinCollections[i]).off('immediateChange', self.__joinChange);
}
}
// Now start hooking any new / existing joins
joinArr = this._querySettings.options.$join;
this._joinCollections = [];
// Loop the joined collections and hook change events
for (i = 0; i < joinArr.length; i++) {
for (k in joinArr[i]) {
if (joinArr[i].hasOwnProperty(k)) {
this._joinCollections.push(k);
}
}
}
if (this._joinCollections.length) {
// Loop the collections and hook change events
for (i = 0; i < this._joinCollections.length; i++) {
this._db.collection(this._joinCollections[i]).on('immediateChange', self.__joinChange);
}
}
}
if (this._querySettings.options && this._querySettings.options.$orderBy) {
this.rebuildActiveBucket(this._querySettings.options.$orderBy);
} else {
this.rebuildActiveBucket();
}
return this;
};
/**
* Handles when a change has occurred on a collection that is joined
* by query to this view.
* @param objName
* @param objType
* @private
*/
View.prototype._joinChange = function (objName, objType) {
this.emit('joinChange');
// TODO: This is a really dirty solution because it will require a complete
// TODO: rebuild of the view data. We need to implement an IO handler to
// TODO: selectively update the data of the view based on the joined
// TODO: collection data operation.
// FIXME: This isnt working, major performance killer, invest in some IO from chain reactor to make this a targeted call
this.refresh();
};
/**
* Returns the number of documents currently in the view.
* @returns {Number}
*/
View.prototype.count = function () {
return this._data.count.apply(this._data, arguments);
};
// Call underlying
View.prototype.subset = function () {
return this._data.subset.apply(this._data, arguments);
};
/**
* Takes the passed data and uses it to set transform methods and globally
* enable or disable the transform system for the view.
* @param {Object} obj The new transform system settings "enabled", "dataIn"
* and "dataOut":
* {
* "enabled": true,
* "dataIn": function (data) { return data; },
* "dataOut": function (data) { return data; }
* }
* @returns {*}
*/
View.prototype.transform = function (obj) {
var currentSettings,
newSettings;
currentSettings = this._data.transform();
this._data.transform(obj);
newSettings = this._data.transform();
// Check if transforms are enabled, a dataIn method is set and these
// settings did not match the previous transform settings
if (newSettings.enabled && newSettings.dataIn && (currentSettings.enabled !== newSettings.enabled || currentSettings.dataIn !== newSettings.dataIn)) {
// The data in the view is now stale, refresh it
this.refresh();
}
return newSettings;
};
/**
* Executes a method against each document that matches query and returns an
* array of documents that may have been modified by the method.
* @param {Object} query The query object.
* @param {Function} func The method that each document is passed to. If this method
* returns false for a particular document it is excluded from the results.
* @param {Object=} options Optional options object.
* @returns {Array}
*/
View.prototype.filter = function (query, func, options) {
return this._data.filter(query, func, options);
};
/**
* Returns the non-transformed data the view holds as a collection
* reference.
* @return {Collection} The non-transformed collection reference.
*/
View.prototype.data = function () {
return this._data;
};
/**
* @see Collection.indexOf
* @returns {*}
*/
View.prototype.indexOf = function () {
return this._data.indexOf.apply(this._data, arguments);
};
/**
* Gets / sets the db instance this class instance belongs to.
* @param {Db=} db The db instance.
* @memberof View
* @returns {*}
*/
Shared.synthesize(View.prototype, 'db', function (db) {
if (db) {
this._data.db(db);
// Apply the same debug settings
this.debug(db.debug());
this._data.debug(db.debug());
}
return this.$super.apply(this, arguments);
});
/**
* Gets / sets the current state.
* @param {String=} val The name of the state to set.
* @returns {*}
*/
Shared.synthesize(View.prototype, 'state');
/**
* Gets / sets the current name.
* @param {String=} val The new name to set.
* @returns {*}
*/
Shared.synthesize(View.prototype, 'name');
/**
* Gets / sets the current cursor.
* @param {String=} val The new cursor to set.
* @returns {*}
*/
Shared.synthesize(View.prototype, 'cursor', function (val) {
if (val === undefined) {
return this._cursor || {};
}
this.$super.apply(this, arguments);
});
// Extend collection with view init
Collection.prototype.init = function () {
this._view = [];
CollectionInit.apply(this, arguments);
};
/**
* Creates a view and assigns the collection as its data source.
* @param {String} name The name of the new view.
* @param {Object} query The query to apply to the new view.
* @param {Object} options The options object to apply to the view.
* @returns {*}
*/
Collection.prototype.view = function (name, query, options) {
if (this._db && this._db._view ) {
if (!this._db._view[name]) {
var view = new View(name, query, options)
.db(this._db)
.from(this);
this._view = this._view || [];
this._view.push(view);
return view;
} else {
throw(this.logIdentifier() + ' Cannot create a view using this collection because a view with this name already exists: ' + name);
}
}
};
/**
* Adds a view to the internal view lookup.
* @param {View} view The view to add.
* @returns {Collection}
* @private
*/
Collection.prototype._addView = CollectionGroup.prototype._addView = function (view) {
if (view !== undefined) {
this._view.push(view);
}
return this;
};
/**
* Removes a view from the internal view lookup.
* @param {View} view The view to remove.
* @returns {Collection}
* @private
*/
Collection.prototype._removeView = CollectionGroup.prototype._removeView = function (view) {
if (view !== undefined) {
var index = this._view.indexOf(view);
if (index > -1) {
this._view.splice(index, 1);
}
}
return this;
};
// Extend DB with views init
Db.prototype.init = function () {
this._view = {};
DbInit.apply(this, arguments);
};
/**
* Gets a view by it's name.
* @param {String} name The name of the view to retrieve.
* @returns {*}
*/
Db.prototype.view = function (name) {
var self = this;
// Handle being passed an instance
if (name instanceof View) {
return name;
}
if (this._view[name]) {
return this._view[name];
}
if (this.debug() || (this._db && this._db.debug())) {
console.log(this.logIdentifier() + ' Creating view ' + name);
}
this._view[name] = new View(name).db(this);
self.emit('create', self._view[name], 'view', name);
return this._view[name];
};
/**
* Determine if a view with the passed name already exists.
* @param {String} name The name of the view to check for.
* @returns {boolean}
*/
Db.prototype.viewExists = function (name) {
return Boolean(this._view[name]);
};
/**
* Returns an array of views the DB currently has.
* @returns {Array} An array of objects containing details of each view
* the database is currently managing.
*/
Db.prototype.views = function () {
var arr = [],
view,
i;
for (i in this._view) {
if (this._view.hasOwnProperty(i)) {
view = this._view[i];
arr.push({
name: i,
count: view.count(),
linked: view.isLinked !== undefined ? view.isLinked() : false
});
}
}
return arr;
};
Shared.finishModule('View');
module.exports = View;
},{"./ActiveBucket":3,"./Collection":6,"./CollectionGroup":7,"./Overload":27,"./ReactorIO":29,"./Shared":31}]},{},[1]);
|
app/containers/DevTools.js | thomasantony/BudgetFirst | import React from 'react';
import { createDevTools } from 'redux-devtools';
import LogMonitor from 'redux-devtools-log-monitor';
import DockMonitor from 'redux-devtools-dock-monitor';
export default createDevTools(
<DockMonitor
toggleVisibilityKey="ctrl-h"
changePositionKey="ctrl-q"
defaultIsVisible={false}
>
<LogMonitor />
</DockMonitor>
);
|
src/ControlLabel/test/ControlLabelStylesSpec.js | suitejs/suite | import React from 'react';
import ReactDOM from 'react-dom';
import ControlLabel from '../index';
import { createTestContainer, getDOMNode, getStyle } from '@test/testUtils';
import '../styles/index';
describe('ControlLabel styles', () => {
it('Should render the correct styles', () => {
const instanceRef = React.createRef();
ReactDOM.render(<ControlLabel ref={instanceRef}>Title</ControlLabel>, createTestContainer());
assert.equal(getStyle(getDOMNode(instanceRef.current), 'marginBottom'), '4px');
});
});
|
packages/react-scripts/fixtures/kitchensink/src/features/syntax/ObjectSpread.js | TryKickoff/create-kickoff-app | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
function load(baseUser) {
return [
{ id: 1, name: '1', ...baseUser },
{ id: 2, name: '2', ...baseUser },
{ id: 3, name: '3', ...baseUser },
{ id: 4, name: '4', ...baseUser },
];
}
export default class extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = { users: [] };
}
async componentDidMount() {
const users = load({ age: 42 });
this.setState({ users });
}
componentDidUpdate() {
this.props.onReady();
}
render() {
return (
<div id="feature-object-spread">
{this.state.users.map(user => (
<div key={user.id}>
{user.name}: {user.age}
</div>
))}
</div>
);
}
}
|
SQL/client/src/components/smart/Posts/List.js | thebillkidy/MERGE-Stack | import React from 'react'
import Link from 'next/link'
import { graphql, gql } from 'react-apollo'
import Post from './Post'
import Container from '../../dumb/Container'
import Header from '../Header'
class List extends React.Component {
static propTypes = {
data: React.PropTypes.object,
}
render() {
if (this.props.data.loading) {
return (<div className='List'>
<div>
Loading
</div>
</div>)
}
return (
<div>
<Container width={600} isCentered={true}>
<style jsx>{`
.Add-Post {
position: absolute;
top: 10px;
left: 10px;
background-color: white;
border: 1px solid #e6e6e6;
border-radius: 3px;
padding: 10px 10px;
display: flex;
justify-content: center;
text-decoration: none;
color: black;
align-items: center;
}
.Add-Post img {
display: block;
width: 24px;
margin-right: 7px;
}
.Add-Post div {
text-decoration: none;
}
`}</style>
<Link href="/create">
<a className="Add-Post">
<img src="/static/plus.svg" role='presentation' />
<div>New Post</div>
</a>
</Link>
{this.props.data.allPosts.map(post => <Post key={post.id} post={post} />)}
{this.props.children}
</Container>
</div>
)
}
}
const FeedQuery = gql`query allPosts {
allPosts(orderBy: DESC) {
id
imageUrl
description,
author {
id,
name
}
}
}`
// TODO: Should find a way to auto refresh when new data is available (subscriptions or redux?)
const withData = graphql(FeedQuery);
export default withData(List)
|
docs/src/app/components/pages/components/Badge/ExampleSimple.js | owencm/material-ui | import React from 'react';
import Badge from 'material-ui/Badge';
import IconButton from 'material-ui/IconButton';
import NotificationsIcon from 'material-ui/svg-icons/social/notifications';
const BadgeExampleSimple = () => (
<div>
<Badge
badgeContent={4}
primary={true}
>
<NotificationsIcon />
</Badge>
<Badge
badgeContent={10}
secondary={true}
badgeStyle={{top: 12, right: 12}}
>
<IconButton tooltip="Notifications">
<NotificationsIcon />
</IconButton>
</Badge>
</div>
);
export default BadgeExampleSimple;
|
local-cli/link/__tests__/android/applyPatch.spec.js | skevy/react-native | /**
* Copyright (c) 2013-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.
*/
'use strict';
jest.autoMockOff();
const applyParams = require('../../android/patches/applyParams');
describe('applyParams', () => {
it('apply params to the string', () => {
expect(
applyParams('${foo}', {foo: 'foo'}, 'react-native')
).toEqual('getResources().getString(R.string.reactNative_foo)');
});
it('use null if no params provided', () => {
expect(
applyParams('${foo}', {}, 'react-native')
).toEqual('null');
});
});
|
ajax/libs/yui/3.2.0/loader/loader-base-debug.js | noraesae/cdnjs | YUI.add('loader-base', function(Y) {
/**
* The YUI loader core
* @module loader
* @submodule loader-base
*/
if (!YUI.Env[Y.version]) {
(function() {
var VERSION = Y.version,
// CONFIG = Y.config,
BUILD = '/build/',
ROOT = VERSION + BUILD,
CDN_BASE = Y.Env.base,
GALLERY_VERSION = 'gallery-2010.09.01-19-12',
// GALLERY_ROOT = GALLERY_VERSION + BUILD,
TNT = '2in3',
TNT_VERSION = '3',
YUI2_VERSION = '2.8.1',
// YUI2_ROOT = TNT + '.' + TNT_VERSION + '/' + YUI2_VERSION + BUILD,
COMBO_BASE = CDN_BASE + 'combo?',
META = { version: VERSION,
root: ROOT,
base: Y.Env.base,
comboBase: COMBO_BASE,
skin: { defaultSkin: 'sam',
base: 'assets/skins/',
path: 'skin.css',
after: [ 'cssreset',
'cssfonts',
'cssgrids',
'cssbase',
'cssreset-context',
'cssfonts-context' ] },
groups: {},
// modules: { / METAGEN / },
patterns: {} },
groups = META.groups,
yui2Update = function(tnt, yui2) {
var root = TNT + '.' +
(tnt || TNT_VERSION) + '/' + (yui2 || YUI2_VERSION) + BUILD;
groups.yui2.base = CDN_BASE + root;
groups.yui2.root = root;
},
galleryUpdate = function(tag) {
var root = (tag || GALLERY_VERSION) + BUILD;
groups.gallery.base = CDN_BASE + root;
groups.gallery.root = root;
};
groups[VERSION] = {};
groups.gallery = {
// base: CDN_BASE + GALLERY_ROOT,
ext: false,
combine: true,
// root: GALLERY_ROOT,
comboBase: COMBO_BASE,
update: galleryUpdate,
patterns: { 'gallery-': { },
'gallerycss-': { type: 'css' } }
};
groups.yui2 = {
// base: CDN_BASE + YUI2_ROOT,
combine: true,
ext: false,
// root: YUI2_ROOT,
comboBase: COMBO_BASE,
update: yui2Update,
patterns: {
'yui2-': {
configFn: function(me) {
if(/-skin|reset|fonts|grids|base/.test(me.name)) {
me.type = 'css';
me.path = me.path.replace(/\.js/, '.css');
// this makes skins in builds earlier than 2.6.0 work as long as combine is false
me.path = me.path.replace(/\/yui2-skin/, '/assets/skins/sam/yui2-skin');
}
}
}
}
};
galleryUpdate();
yui2Update();
YUI.Env[VERSION] = META;
}());
}
/**
* Loader dynamically loads script and css files. It includes the dependency
* info for the version of the library in use, and will automatically pull in
* dependencies for the modules requested. It supports rollup files and will
* automatically use these when appropriate in order to minimize the number of
* http connections required to load all of the dependencies. It can load the
* files from the Yahoo! CDN, and it can utilize the combo service provided on
* this network to reduce the number of http connections required to download
* YUI files.
*
* @module loader
* @submodule loader-base
*/
/**
* Loader dynamically loads script and css files. It includes the dependency
* info for the version of the library in use, and will automatically pull in
* dependencies for the modules requested. It supports rollup files and will
* automatically use these when appropriate in order to minimize the number of
* http connections required to load all of the dependencies. It can load the
* files from the Yahoo! CDN, and it can utilize the combo service provided on
* this network to reduce the number of http connections required to download
* YUI files.
*
* While the loader can be instantiated by the end user, it normally is not.
* @see YUI.use for the normal use case. The use function automatically will
* pull in missing dependencies.
*
* @class Loader
* @constructor
* @param o an optional set of configuration options. Valid options:
* <ul>
* <li>base:
* The base dir</li>
* <li>comboBase:
* The YUI combo service base dir. Ex: http://yui.yahooapis.com/combo?</li>
* <li>root:
* The root path to prepend to module names for the combo service. Ex: 2.5.2/build/</li>
* <li>filter:
*
* A filter to apply to result urls. This filter will modify the default
* path for all modules. The default path for the YUI library is the
* minified version of the files (e.g., event-min.js). The filter property
* can be a predefined filter or a custom filter. The valid predefined
* filters are:
* <dl>
* <dt>DEBUG</dt>
* <dd>Selects the debug versions of the library (e.g., event-debug.js).
* This option will automatically include the Logger widget</dd>
* <dt>RAW</dt>
* <dd>Selects the non-minified version of the library (e.g., event.js).</dd>
* </dl>
* You can also define a custom filter, which must be an object literal
* containing a search expression and a replace string:
* <pre>
* myFilter: {
* 'searchExp': "-min\\.js",
* 'replaceStr': "-debug.js"
* }
* </pre>
*
* </li>
* <li>filters: per-component filter specification. If specified for a given component, this overrides the filter config</li>
* <li>combine:
* Use the YUI combo service to reduce the number of http connections required to load your dependencies</li>
* <li>ignore:
* A list of modules that should never be dynamically loaded</li>
* <li>force:
* A list of modules that should always be loaded when required, even if already present on the page</li>
* <li>insertBefore:
* Node or id for a node that should be used as the insertion point for new nodes</li>
* <li>charset:
* charset for dynamic nodes (deprecated, use jsAttributes or cssAttributes)</li>
* <li>jsAttributes: object literal containing attributes to add to script nodes</li>
* <li>cssAttributes: object literal containing attributes to add to link nodes</li>
* <li>timeout:
* The number of milliseconds before a timeout occurs when dynamically loading nodes. If
* not set, there is no timeout</li>
* <li>context:
* execution context for all callbacks</li>
* <li>onSuccess:
* callback for the 'success' event</li>
* <li>onFailure: callback for the 'failure' event</li>
* <li>onCSS: callback for the 'CSSComplete' event. When loading YUI components with CSS
* the CSS is loaded first, then the script. This provides a moment you can tie into to improve
* the presentation of the page while the script is loading.</li>
* <li>onTimeout:
* callback for the 'timeout' event</li>
* <li>onProgress:
* callback executed each time a script or css file is loaded</li>
* <li>modules:
* A list of module definitions. See Loader.addModule for the supported module metadata</li>
* <li>groups:
* A list of group definitions. Each group can contain specific definitions for base, comboBase,
* combine, and accepts a list of modules. See above for the description of these properties.</li>
* <li>2in3: the version of the YUI 2 in 3 wrapper to use. The intrinsic support for YUI 2 modules
* in YUI 3 relies on versions of the YUI 2 components inside YUI 3 module wrappers. These wrappers
* change over time to accomodate the issues that arise from running YUI 2 in a YUI 3 sandbox.</li>
* <li>yui2: when using the 2in3 project, you can select the version of YUI 2 to use. Valid values
* are 2.2.2, 2.3.1, 2.4.1, 2.5.2, 2.6.0, 2.7.0, 2.8.0, and 2.8.1 [default] -- plus all versions
* of YUI 2 going forward.</li>
* </ul>
*/
var NOT_FOUND = {},
NO_REQUIREMENTS = [],
MAX_URL_LENGTH = (Y.UA.ie) ? 2048 : 8192,
GLOBAL_ENV = YUI.Env,
GLOBAL_LOADED = GLOBAL_ENV._loaded,
CSS = 'css',
JS = 'js',
INTL = 'intl',
VERSION = Y.version,
ROOT_LANG = "",
YObject = Y.Object,
oeach = YObject.each,
YArray = Y.Array,
_queue = GLOBAL_ENV._loaderQueue,
META = GLOBAL_ENV[VERSION],
SKIN_PREFIX = "skin-",
L = Y.Lang,
ON_PAGE = GLOBAL_ENV.mods,
modulekey,
cache,
_path = function(dir, file, type, nomin) {
var path = dir + '/' + file;
if (!nomin) {
path += '-min';
}
path += '.' + (type || CSS);
return path;
};
Y.Env.meta = META;
Y.Loader = function(o) {
var defaults = META.modules,
self = this;
modulekey = META.md5;
/**
* Internal callback to handle multiple internal insert() calls
* so that css is inserted prior to js
* @property _internalCallback
* @private
*/
// self._internalCallback = null;
/**
* Callback that will be executed when the loader is finished
* with an insert
* @method onSuccess
* @type function
*/
// self.onSuccess = null;
/**
* Callback that will be executed if there is a failure
* @method onFailure
* @type function
*/
// self.onFailure = null;
/**
* Callback for the 'CSSComplete' event. When loading YUI components with CSS
* the CSS is loaded first, then the script. This provides a moment you can tie into to improve
* the presentation of the page while the script is loading.
* @method onCSS
* @type function
*/
// self.onCSS = null;
/**
* Callback executed each time a script or css file is loaded
* @method onProgress
* @type function
*/
// self.onProgress = null;
/**
* Callback that will be executed if a timeout occurs
* @method onTimeout
* @type function
*/
// self.onTimeout = null;
/**
* The execution context for all callbacks
* @property context
* @default {YUI} the YUI instance
*/
self.context = Y;
/**
* Data that is passed to all callbacks
* @property data
*/
// self.data = null;
/**
* Node reference or id where new nodes should be inserted before
* @property insertBefore
* @type string|HTMLElement
*/
// self.insertBefore = null;
/**
* The charset attribute for inserted nodes
* @property charset
* @type string
* @deprecated, use cssAttributes or jsAttributes
*/
// self.charset = null;
/**
* An object literal containing attributes to add to link nodes
* @property cssAttributes
* @type object
*/
// self.cssAttributes = null;
/**
* An object literal containing attributes to add to script nodes
* @property jsAttributes
* @type object
*/
// self.jsAttributes = null;
/**
* The base directory.
* @property base
* @type string
* @default http://yui.yahooapis.com/[YUI VERSION]/build/
*/
self.base = Y.Env.meta.base;
/**
* Base path for the combo service
* @property comboBase
* @type string
* @default http://yui.yahooapis.com/combo?
*/
self.comboBase = Y.Env.meta.comboBase;
/*
* Base path for language packs.
*/
// self.langBase = Y.Env.meta.langBase;
// self.lang = "";
/**
* If configured, the loader will attempt to use the combo
* service for YUI resources and configured external resources.
* @property combine
* @type boolean
* @default true if a base dir isn't in the config
*/
self.combine = o.base && (o.base.indexOf( self.comboBase.substr(0, 20)) > -1);
/**
* Max url length for combo urls. The default is 2048 for
* internet explorer, and 8192 otherwise. This is the URL
* limit for the Yahoo! hosted combo servers. If consuming
* a different combo service that has a different URL limit
* it is possible to override this default by supplying
* the maxURLLength config option. The config option will
* only take effect if lower than the default.
*
* Browsers:
* IE: 2048
* Other A-Grade Browsers: Higher that what is typically supported
* 'capable' mobile browsers: @TODO
*
* Servers:
* Apache: 8192
*
* @property maxURLLength
* @type int
*/
self.maxURLLength = MAX_URL_LENGTH;
/**
* Ignore modules registered on the YUI global
* @property ignoreRegistered
* @default false
*/
// self.ignoreRegistered = false;
/**
* Root path to prepend to module path for the combo
* service
* @property root
* @type string
* @default [YUI VERSION]/build/
*/
self.root = Y.Env.meta.root;
/**
* Timeout value in milliseconds. If set, self value will be used by
* the get utility. the timeout event will fire if
* a timeout occurs.
* @property timeout
* @type int
*/
self.timeout = 0;
/**
* A list of modules that should not be loaded, even if
* they turn up in the dependency tree
* @property ignore
* @type string[]
*/
// self.ignore = null;
/**
* A list of modules that should always be loaded, even
* if they have already been inserted into the page.
* @property force
* @type string[]
*/
// self.force = null;
self.forceMap = {};
/**
* Should we allow rollups
* @property allowRollup
* @type boolean
* @default true
*/
self.allowRollup = true;
/**
* A filter to apply to result urls. This filter will modify the default
* path for all modules. The default path for the YUI library is the
* minified version of the files (e.g., event-min.js). The filter property
* can be a predefined filter or a custom filter. The valid predefined
* filters are:
* <dl>
* <dt>DEBUG</dt>
* <dd>Selects the debug versions of the library (e.g., event-debug.js).
* This option will automatically include the Logger widget</dd>
* <dt>RAW</dt>
* <dd>Selects the non-minified version of the library (e.g., event.js).</dd>
* </dl>
* You can also define a custom filter, which must be an object literal
* containing a search expression and a replace string:
* <pre>
* myFilter: {
* 'searchExp': "-min\\.js",
* 'replaceStr': "-debug.js"
* }
* </pre>
* @property filter
* @type string|{searchExp: string, replaceStr: string}
*/
// self.filter = null;
/**
* per-component filter specification. If specified for a given component, this
* overrides the filter config.
* @property filters
* @type object
*/
self.filters = {};
/**
* The list of requested modules
* @property required
* @type {string: boolean}
*/
self.required = {};
/**
* If a module name is predefined when requested, it is checked againsts
* the patterns provided in this property. If there is a match, the
* module is added with the default configuration.
*
* At the moment only supporting module prefixes, but anticipate supporting
* at least regular expressions.
* @property patterns
* @type Object
*/
// self.patterns = Y.merge(Y.Env.meta.patterns);
self.patterns = {};
/**
* The library metadata
* @property moduleInfo
*/
// self.moduleInfo = Y.merge(Y.Env.meta.moduleInfo);
self.moduleInfo = {};
self.groups = Y.merge(Y.Env.meta.groups);
/**
* Provides the information used to skin the skinnable components.
* The following skin definition would result in 'skin1' and 'skin2'
* being loaded for calendar (if calendar was requested), and
* 'sam' for all other skinnable components:
*
* <code>
* skin: {
*
* // The default skin, which is automatically applied if not
* // overriden by a component-specific skin definition.
* // Change this in to apply a different skin globally
* defaultSkin: 'sam',
*
* // This is combined with the loader base property to get
* // the default root directory for a skin. ex:
* // http://yui.yahooapis.com/2.3.0/build/assets/skins/sam/
* base: 'assets/skins/',
*
* // Any component-specific overrides can be specified here,
* // making it possible to load different skins for different
* // components. It is possible to load more than one skin
* // for a given component as well.
* overrides: {
* calendar: ['skin1', 'skin2']
* }
* }
* </code>
* @property skin
*/
self.skin = Y.merge(Y.Env.meta.skin);
/*
* Map of conditional modules
* @since 3.2.0
*/
self.conditions = {};
// map of modules with a hash of modules that meet the requirement
// self.provides = {};
self.config = o;
self._internal = true;
cache = GLOBAL_ENV._renderedMods;
if (cache) {
oeach(cache, function(v, k) {
self.moduleInfo[k] = Y.merge(v);
});
cache = GLOBAL_ENV._conditions;
oeach(cache, function(v, k) {
self.conditions[k] = Y.merge(v);
});
} else {
oeach(defaults, self.addModule, self);
}
if (!GLOBAL_ENV._renderedMods) {
GLOBAL_ENV._renderedMods = Y.merge(self.moduleInfo);
GLOBAL_ENV._conditions = Y.merge(self.conditions);
}
self._inspectPage();
self._internal = false;
self._config(o);
/**
* List of rollup files found in the library metadata
* @property rollups
*/
// self.rollups = null;
/**
* Whether or not to load optional dependencies for
* the requested modules
* @property loadOptional
* @type boolean
* @default false
*/
// self.loadOptional = false;
/**
* All of the derived dependencies in sorted order, which
* will be populated when either calculate() or insert()
* is called
* @property sorted
* @type string[]
*/
self.sorted = [];
/**
* Set when beginning to compute the dependency tree.
* Composed of what YUI reports to be loaded combined
* with what has been loaded by any instance on the page
* with the version number specified in the metadata.
* @propery loaded
* @type {string: boolean}
*/
self.loaded = GLOBAL_LOADED[VERSION];
/*
* A list of modules to attach to the YUI instance when complete.
* If not supplied, the sorted list of dependencies are applied.
* @property attaching
*/
// self.attaching = null;
/**
* Flag to indicate the dependency tree needs to be recomputed
* if insert is called again.
* @property dirty
* @type boolean
* @default true
*/
self.dirty = true;
/**
* List of modules inserted by the utility
* @property inserted
* @type {string: boolean}
*/
self.inserted = {};
/**
* List of skipped modules during insert() because the module
* was not defined
* @property skipped
*/
self.skipped = {};
// Y.on('yui:load', self.loadNext, self);
/*
* Cached sorted calculate results
* @property results
* @since 3.2.0
*/
//self.results = {};
};
Y.Loader.prototype = {
FILTER_DEFS: {
RAW: {
'searchExp': "-min\\.js",
'replaceStr': ".js"
},
DEBUG: {
'searchExp': "-min\\.js",
'replaceStr': "-debug.js"
}
},
_inspectPage: function() {
oeach(ON_PAGE, function(v, k) {
if (v.details) {
var m = this.moduleInfo[k],
req = v.details.requires,
mr = m && m.requires;
if (m) {
if (!m._inspected && req && mr.length != req.length) {
delete m.expanded;
}
} else {
m = this.addModule(v.details, k);
}
m._inspected = true;
}
}, this);
},
// returns true if b is not loaded, and is required
// directly or by means of modules it supersedes.
_requires: function(mod1, mod2) {
var i, rm, after, after_map, s,
info = this.moduleInfo,
m = info[mod1],
other = info[mod2];
// if (loaded[mod2] || !m || !other) {
if (!m || !other) {
return false;
}
rm = m.expanded_map;
after = m.after;
after_map = m.after_map;
// check if this module requires the other directly
// if (r && YArray.indexOf(r, mod2) > -1) {
if (rm && (mod2 in rm)) {
return true;
}
// check if this module should be sorted after the other
if (after_map && (mod2 in after_map)) {
return true;
} else if (after && YArray.indexOf(after, mod2) > -1) {
return true;
}
// check if this module requires one the other supersedes
s = info[mod2] && info[mod2].supersedes;
if (s) {
for (i=0; i<s.length; i++) {
if (this._requires(mod1, s[i])) {
return true;
}
}
}
// external css files should be sorted below yui css
if (m.ext && m.type == CSS && !other.ext && other.type == CSS) {
return true;
}
return false;
},
_config: function(o) {
var i, j, val, f, group, groupName, self = this;
// apply config values
if (o) {
for (i in o) {
if (o.hasOwnProperty(i)) {
val = o[i];
if (i == 'require') {
self.require(val);
} else if (i == 'skin') {
Y.mix(self.skin, o[i], true);
} else if (i == 'groups') {
for (j in val) {
if (val.hasOwnProperty(j)) {
// Y.log('group: ' + j);
groupName = j;
group = val[j];
self.addGroup(group, groupName);
}
}
} else if (i == 'modules') {
// add a hash of module definitions
oeach(val, self.addModule, self);
} else if (i == 'gallery') {
this.groups.gallery.update(val);
} else if (i == 'yui2' || i == '2in3') {
this.groups.yui2.update(o['2in3'], o.yui2);
} else if (i == 'maxURLLength') {
self[i] = Math.min(MAX_URL_LENGTH, val);
} else {
self[i] = val;
}
}
}
}
// fix filter
f = self.filter;
if (L.isString(f)) {
f = f.toUpperCase();
self.filterName = f;
self.filter = self.FILTER_DEFS[f];
if (f == 'DEBUG') {
self.require('yui-log', 'dump');
}
}
},
/**
* Returns the skin module name for the specified skin name. If a
* module name is supplied, the returned skin module name is
* specific to the module passed in.
* @method formatSkin
* @param skin {string} the name of the skin
* @param mod {string} optional: the name of a module to skin
* @return {string} the full skin module name
*/
formatSkin: function(skin, mod) {
var s = SKIN_PREFIX + skin;
if (mod) {
s = s + "-" + mod;
}
return s;
},
/**
* Adds the skin def to the module info
* @method _addSkin
* @param skin {string} the name of the skin
* @param mod {string} the name of the module
* @param parent {string} parent module if this is a skin of a
* submodule or plugin
* @return {string} the module name for the skin
* @private
*/
_addSkin: function(skin, mod, parent) {
var mdef, pkg, name,
info = this.moduleInfo,
sinf = this.skin,
ext = info[mod] && info[mod].ext;
// Add a module definition for the module-specific skin css
if (mod) {
name = this.formatSkin(skin, mod);
if (!info[name]) {
mdef = info[mod];
pkg = mdef.pkg || mod;
this.addModule({
name: name,
group: mdef.group,
type: 'css',
after: sinf.after,
after_map: YArray.hash(sinf.after),
path: (parent || pkg) + '/' + sinf.base + skin + '/' + mod + '.css',
ext: ext
});
// Y.log('adding skin ' + name + ', ' + parent + ', ' + pkg + ', ' + info[name].path);
}
}
return name;
},
/** Add a new module group
* <dl>
* <dt>name:</dt> <dd>required, the group name</dd>
* <dt>base:</dt> <dd>The base dir for this module group</dd>
* <dt>root:</dt> <dd>The root path to add to each combo resource path</dd>
* <dt>combine:</dt> <dd>combo handle</dd>
* <dt>comboBase:</dt> <dd>combo service base path</dd>
* <dt>modules:</dt> <dd>the group of modules</dd>
* </dl>
* @method addGroup
* @param o An object containing the module data
* @param name the module name (optional), required if not in the module data
* @return {boolean} true if the module was added, false if
* the object passed in did not provide all required attributes
*/
addGroup: function(o, name) {
var mods = o.modules,
self = this;
name = name || o.name;
o.name = name;
self.groups[name] = o;
if (o.patterns) {
oeach(o.patterns, function(v, k) {
v.group = name;
self.patterns[k] = v;
});
}
if (mods) {
oeach(mods, function(v, k) {
v.group = name;
self.addModule(v, k);
}, self);
}
},
/** Add a new module to the component metadata.
* <dl>
* <dt>name:</dt> <dd>required, the component name</dd>
* <dt>type:</dt> <dd>required, the component type (js or css)</dd>
* <dt>path:</dt> <dd>required, the path to the script from "base"</dd>
* <dt>requires:</dt> <dd>array of modules required by this component</dd>
* <dt>optional:</dt> <dd>array of optional modules for this component</dd>
* <dt>supersedes:</dt> <dd>array of the modules this component replaces</dd>
* <dt>after:</dt> <dd>array of modules the components which, if present, should be sorted above this one</dd>
* <dt>after_map:</dt> <dd>faster alternative to 'after' -- supply a hash instead of an array</dd>
* <dt>rollup:</dt> <dd>the number of superseded modules required for automatic rollup</dd>
* <dt>fullpath:</dt> <dd>If fullpath is specified, this is used instead of the configured base + path</dd>
* <dt>skinnable:</dt> <dd>flag to determine if skin assets should automatically be pulled in</dd>
* <dt>submodules:</dt> <dd>a hash of submodules</dd>
* <dt>group:</dt> <dd>The group the module belongs to -- this is set automatically when
* it is added as part of a group configuration.</dd>
* <dt>lang:</dt> <dd>array of BCP 47 language tags of
* languages for which this module has localized resource bundles,
* e.g., ["en-GB","zh-Hans-CN"]</dd>
* <dt>condition:</dt> <dd>Specifies that the module should be loaded automatically if
* a condition is met. This is an object with two fields:
* [trigger] - the name of a module that can trigger the auto-load
* [test] - a function that returns true when the module is to be loaded
* </dd>
* </dl>
* @method addModule
* @param o An object containing the module data
* @param name the module name (optional), required if not in the module data
* @return the module definition or null if
* the object passed in did not provide all required attributes
*/
addModule: function(o, name) {
name = name || o.name;
o.name = name;
if (!o || !o.name) {
return null;
}
if (!o.type) {
o.type = JS;
}
if (!o.path && !o.fullpath) {
o.path = _path(name, name, o.type);
}
o.ext = ('ext' in o) ? o.ext : (this._internal) ? false : true;
o.requires = o.requires || [];
// Handle submodule logic
var subs = o.submodules, i, l, sup, s, smod, plugins, plug,
j, langs, packName, supName, flatSup, flatLang, lang, ret,
overrides, skinname,
conditions = this.conditions, condmod;
// , existing = this.moduleInfo[name], newr;
this.moduleInfo[name] = o;
if (!o.langPack && o.lang) {
langs = YArray(o.lang);
for (j=0; j < langs.length; j++) {
lang = langs[j];
packName = this.getLangPackName(lang, name);
smod = this.moduleInfo[packName];
if (!smod) {
smod = this._addLangPack(lang, o, packName);
}
}
}
if (subs) {
sup = o.supersedes || [];
l = 0;
for (i in subs) {
if (subs.hasOwnProperty(i)) {
s = subs[i];
s.path = s.path || _path(name, i, o.type);
s.pkg = name;
s.group = o.group;
if (s.supersedes) {
sup = sup.concat(s.supersedes);
}
smod = this.addModule(s, i);
sup.push(i);
if (smod.skinnable) {
o.skinnable = true;
overrides = this.skin.overrides;
if (overrides && overrides[i]) {
for (j=0; j<overrides[i].length; j++) {
skinname = this._addSkin(overrides[i][j], i, name);
sup.push(skinname);
}
}
skinname = this._addSkin(this.skin.defaultSkin, i, name);
sup.push(skinname);
}
// looks like we are expected to work out the metadata
// for the parent module language packs from what is
// specified in the child modules.
if (s.lang && s.lang.length) {
langs = YArray(s.lang);
for (j=0; j < langs.length; j++) {
lang = langs[j];
packName = this.getLangPackName(lang, name);
supName = this.getLangPackName(lang, i);
smod = this.moduleInfo[packName];
if (!smod) {
smod = this._addLangPack(lang, o, packName);
}
flatSup = flatSup || YArray.hash(smod.supersedes);
if (!(supName in flatSup)) {
smod.supersedes.push(supName);
}
o.lang = o.lang || [];
flatLang = flatLang || YArray.hash(o.lang);
if (!(lang in flatLang)) {
o.lang.push(lang);
}
// Y.log('pack ' + packName + ' should supersede ' + supName);
// Add rollup file, need to add to supersedes list too
}
}
l++;
}
}
o.supersedes = YObject.keys(YArray.hash(sup));
o.rollup = (l<4) ? l : Math.min(l-1, 4);
}
plugins = o.plugins;
if (plugins) {
for (i in plugins) {
if (plugins.hasOwnProperty(i)) {
plug = plugins[i];
plug.pkg = name;
plug.path = plug.path || _path(name, i, o.type);
plug.requires = plug.requires || [];
plug.group = o.group;
// plug.requires.push(name);
this.addModule(plug, i);
if (o.skinnable) {
this._addSkin(this.skin.defaultSkin, i, name);
}
}
}
}
if (o.condition) {
condmod = o.condition.trigger;
conditions[condmod] = conditions[condmod] || {};
conditions[condmod][name] = o.condition;
}
// this.dirty = true;
if (o.configFn) {
ret = o.configFn(o);
if (ret === false) {
delete this.moduleInfo[name];
o = null;
}
}
return o;
},
/**
* Add a requirement for one or more module
* @method require
* @param what {string[] | string*} the modules to load
*/
require: function(what) {
var a = (typeof what === "string") ? arguments : what;
this.dirty = true;
Y.mix(this.required, YArray.hash(a));
},
/**
* Returns an object containing properties for all modules required
* in order to load the requested module
* @method getRequires
* @param mod The module definition from moduleInfo
*/
getRequires: function(mod) {
if (!mod || mod._parsed) {
return NO_REQUIREMENTS;
}
var i, m, j, add, packName, lang,
name = mod.name, cond, go,
adddef = ON_PAGE[name] && ON_PAGE[name].details,
d = [],
r, old_mod,
o, skinmod, skindef,
intl = mod.lang || mod.intl,
info = this.moduleInfo,
hash = {};
// pattern match leaves module stub that needs to be filled out
if (mod.temp && adddef) {
old_mod = mod;
mod = this.addModule(adddef, name);
mod.group = old_mod.group;
mod.pkg = old_mod.pkg;
delete mod.expanded;
// console.log('TEMP MOD: ' + name + ', ' + mod.requires);
// console.log(Y.dump(mod));
}
// if (!this.dirty && mod.expanded && (!mod.langCache || mod.langCache == this.lang)) {
if (mod.expanded && (!mod.langCache || mod.langCache == this.lang)) {
// Y.log('already expanded ' + name + ', ' + mod.expanded);
return mod.expanded;
}
r = mod.requires;
o = mod.optional;
// Y.log("getRequires: " + name + " (dirty:" + this.dirty + ", expanded:" + mod.expanded + ")");
mod._parsed = true;
// Create skin modules
if (mod.skinnable) {
skindef = this.skin.overrides;
if (skindef && skindef[name]) {
for (i=0; i<skindef[name].length; i++) {
skinmod = this._addSkin(skindef[name][i], name);
d.push(skinmod);
}
} else {
skinmod = this._addSkin(this.skin.defaultSkin, name);
d.push(skinmod);
}
}
for (i=0; i<r.length; i++) {
// Y.log(name + ' requiring ' + r[i]);
if (!hash[r[i]]) {
d.push(r[i]);
hash[r[i]] = true;
m = this.getModule(r[i]);
if (m) {
add = this.getRequires(m);
intl = intl || (m.expanded_map && (INTL in m.expanded_map));
for (j=0; j<add.length; j++) {
d.push(add[j]);
}
}
}
}
// get the requirements from superseded modules, if any
r=mod.supersedes;
if (r) {
for (i=0; i<r.length; i++) {
if (!hash[r[i]]) {
// if this module has submodules, the requirements list is
// expanded to include the submodules. This is so we can
// prevent dups when a submodule is already loaded and the
// parent is requested.
if (mod.submodules) {
d.push(r[i]);
}
hash[r[i]] = true;
m = this.getModule(r[i]);
if (m) {
add = this.getRequires(m);
intl = intl || (m.expanded_map && (INTL in m.expanded_map));
for (j=0; j<add.length; j++) {
d.push(add[j]);
}
}
}
}
}
if (o && this.loadOptional) {
for (i=0; i<o.length; i++) {
if (!hash[o[i]]) {
d.push(o[i]);
hash[o[i]] = true;
m = info[o[i]];
if (m) {
add = this.getRequires(m);
intl = intl || (m.expanded_map && (INTL in m.expanded_map));
for (j=0; j<add.length; j++) {
d.push(add[j]);
}
}
}
}
}
cond = this.conditions[name];
if (cond) {
oeach(cond, function(def, condmod) {
if (!hash[condmod]) {
go = def && ((def.ua && Y.UA[def.ua]) ||
(def.test && def.test(Y, r)));
if (go) {
hash[condmod] = true;
d.push(condmod);
m = this.getModule(condmod);
if (m) {
add = this.getRequires(m);
for (j=0; j<add.length; j++) {
d.push(add[j]);
}
}
}
}
}, this);
}
mod._parsed = false;
if (intl) {
if (mod.lang && !mod.langPack && Y.Intl) {
lang = Y.Intl.lookupBestLang(this.lang || ROOT_LANG, mod.lang);
// Y.log('Best lang: ' + lang + ', this.lang: ' + this.lang + ', mod.lang: ' + mod.lang);
mod.langCache = this.lang;
packName = this.getLangPackName(lang, name);
if (packName) {
d.unshift(packName);
}
}
d.unshift(INTL);
}
mod.expanded_map = YArray.hash(d);
mod.expanded = YObject.keys(mod.expanded_map);
return mod.expanded;
},
/**
* Returns a hash of module names the supplied module satisfies.
* @method getProvides
* @param name {string} The name of the module
* @return what this module provides
*/
getProvides: function(name) {
var m = this.getModule(name), o, s;
// supmap = this.provides;
if (!m) {
return NOT_FOUND;
}
if (m && !m.provides) {
o = {};
s = m.supersedes;
if (s) {
YArray.each(s, function(v) {
Y.mix(o, this.getProvides(v));
}, this);
}
o[name] = true;
m.provides = o;
}
return m.provides;
},
/**
* Calculates the dependency tree, the result is stored in the sorted
* property
* @method calculate
* @param o optional options object
* @param type optional argument to prune modules
*/
calculate: function(o, type) {
if (o || type || this.dirty) {
if (o) {
this._config(o);
}
if (!this._init) {
this._setup();
}
this._explode();
if (this.allowRollup) {
this._rollup();
}
this._reduce();
this._sort();
}
},
_addLangPack: function(lang, m, packName) {
var name = m.name,
packPath,
existing = this.moduleInfo[packName];
if (!existing) {
packPath = _path((m.pkg || name), packName, JS, true);
this.addModule({ path: packPath,
intl: true,
langPack: true,
ext: m.ext,
group: m.group,
supersedes: [] }, packName, true);
if (lang) {
Y.Env.lang = Y.Env.lang || {};
Y.Env.lang[lang] = Y.Env.lang[lang] || {};
Y.Env.lang[lang][name] = true;
}
}
return this.moduleInfo[packName];
},
/**
* Investigates the current YUI configuration on the page. By default,
* modules already detected will not be loaded again unless a force
* option is encountered. Called by calculate()
* @method _setup
* @private
*/
_setup: function() {
var info = this.moduleInfo, name, i, j, m, l,
packName;
for (name in info) {
if (info.hasOwnProperty(name)) {
m = info[name];
if (m) {
// remove dups
m.requires = YObject.keys(YArray.hash(m.requires));
// Create lang pack modules
if (m.lang && m.lang.length) {
// Setup root package if the module has lang defined,
// it needs to provide a root language pack
packName = this.getLangPackName(ROOT_LANG, name);
this._addLangPack(null, m, packName);
}
}
}
}
//l = Y.merge(this.inserted);
l = {};
// available modules
if (!this.ignoreRegistered) {
Y.mix(l, GLOBAL_ENV.mods);
}
// add the ignore list to the list of loaded packages
if (this.ignore) {
Y.mix(l, YArray.hash(this.ignore));
}
// expand the list to include superseded modules
for (j in l) {
if (l.hasOwnProperty(j)) {
Y.mix(l, this.getProvides(j));
}
}
// remove modules on the force list from the loaded list
if (this.force) {
for (i=0; i<this.force.length; i++) {
if (this.force[i] in l) {
delete l[this.force[i]];
}
}
}
Y.mix(this.loaded, l);
this._init = true;
},
/**
* Builds a module name for a language pack
* @function getLangPackName
* @param lang {string} the language code
* @param mname {string} the module to build it for
* @return {string} the language pack module name
*/
getLangPackName: function(lang, mname) {
return ('lang/' + mname + ((lang) ? '_' + lang : ''));
},
/**
* Inspects the required modules list looking for additional
* dependencies. Expands the required list to include all
* required modules. Called by calculate()
* @method _explode
* @private
*/
_explode: function() {
var r = this.required, m, reqs, done = {},
self = this;
// the setup phase is over, all modules have been created
self.dirty = false;
oeach(r, function(v, name) {
if (!done[name]) {
done[name] = true;
m = self.getModule(name);
if (m) {
var expound = m.expound;
if (expound) {
r[expound] = self.getModule(expound);
reqs = self.getRequires(r[expound]);
Y.mix(r, YArray.hash(reqs));
}
reqs = self.getRequires(m);
Y.mix(r, YArray.hash(reqs));
// sups = m.supersedes;
// if (sups) {
// YArray.each(sups, function(sup) {
// if (sup in self.loaded) {
// delete r[name];
// }
// // if (sup in self.conditions) {
// r[sup] = true;
// //}
// });
// }
// remove the definition for a rollup with
// submodules -- getRequires() includes the
// submodules. Removing the parent makes
// it possible to prevent submodule duplication
// if the parent is requested after a submodule
// has been loaded.
// if (m.submodules) {
// delete r[name];
// }
}
}
});
// Y.log('After explode: ' + YObject.keys(r));
},
getModule: function(mname) {
//TODO: Remove name check - it's a quick hack to fix pattern WIP
if (!mname) {
return null;
}
var p, found, pname,
m = this.moduleInfo[mname],
patterns = this.patterns;
// check the patterns library to see if we should automatically add
// the module with defaults
if (!m) {
// Y.log('testing patterns ' + YObject.keys(patterns));
for (pname in patterns) {
if (patterns.hasOwnProperty(pname)) {
// Y.log('testing pattern ' + i);
p = patterns[pname];
// use the metadata supplied for the pattern
// as the module definition.
if (mname.indexOf(pname) > -1) {
found = p;
break;
}
}
}
if (found) {
if (p.action) {
// Y.log('executing pattern action: ' + pname);
p.action.call(this, mname, pname);
} else {
Y.log('Undefined module: ' + mname + ', matched a pattern: ' + pname, 'info', 'loader');
// ext true or false?
m = this.addModule(Y.merge(found), mname);
m.temp = true;
}
}
}
return m;
},
// impl in rollup submodule
_rollup: function() { },
/**
* Remove superceded modules and loaded modules. Called by
* calculate() after we have the mega list of all dependencies
* @method _reduce
* @private
*/
_reduce: function(r) {
r = r || this.required;
var i, j, s, m, type = this.loadType;
for (i in r) {
if (r.hasOwnProperty(i)) {
m = this.getModule(i);
// remove if already loaded
if (((this.loaded[i] || ON_PAGE[i]) && !this.forceMap[i] && !this.ignoreRegistered) || (type && m && m.type != type)) {
delete r[i];
}
// remove anything this module supersedes
s = m && m.supersedes;
if (s) {
for (j=0; j<s.length; j++) {
if (s[j] in r) {
delete r[s[j]];
}
}
}
}
}
// Y.log('required now: ' + YObject.keys(r));
return r;
},
_finish: function(msg, success) {
Y.log('loader finishing: ' + msg + ', ' + Y.id + ', ' + this.data, "info", "loader");
_queue.running = false;
var onEnd = this.onEnd;
if (onEnd) {
onEnd.call(this.context, {
msg: msg,
data: this.data,
success: success
});
}
this._continue();
},
_onSuccess: function() {
// Y.log('loader _onSuccess, skipping: ' + Y.Object.keys(this.skipped), "info", "loader");
var skipped = Y.merge(this.skipped), fn;
oeach(skipped, function(k) {
delete this.inserted[k];
}, this);
this.skipped = {};
// Y.mix(this.loaded, this.inserted);
oeach(this.inserted, function(v, k) {
Y.mix(this.loaded, this.getProvides(k));
}, this);
fn = this.onSuccess;
if (fn) {
fn.call(this.context, {
msg: 'success',
data: this.data,
success: true,
skipped: skipped
});
}
this._finish('success', true);
},
_onFailure: function(o) {
Y.log('load error: ' + o.msg + ', ' + Y.id, "error", "loader");
var f = this.onFailure, msg = 'failure: ' + o.msg;
if (f) {
f.call(this.context, {
msg: msg,
data: this.data,
success: false
});
}
this._finish(msg, false);
},
_onTimeout: function() {
Y.log('loader timeout: ' + Y.id, "error", "loader");
var f = this.onTimeout;
if (f) {
f.call(this.context, {
msg: 'timeout',
data: this.data,
success: false
});
}
this._finish('timeout', false);
},
/**
* Sorts the dependency tree. The last step of calculate()
* @method _sort
* @private
*/
_sort: function() {
// create an indexed list
var s = YObject.keys(this.required),
// loaded = this.loaded,
done = {},
p=0, l, a, b, j, k, moved, doneKey;
// keep going until we make a pass without moving anything
for (;;) {
l = s.length;
moved = false;
// start the loop after items that are already sorted
for (j=p; j<l; j++) {
// check the next module on the list to see if its
// dependencies have been met
a = s[j];
// check everything below current item and move if we
// find a requirement for the current item
for (k=j+1; k<l; k++) {
doneKey = a + s[k];
if (!done[doneKey] && this._requires(a, s[k])) {
// extract the dependency so we can move it up
b = s.splice(k, 1);
// insert the dependency above the item that
// requires it
s.splice(j, 0, b[0]);
// only swap two dependencies once to short circut
// circular dependencies
done[doneKey] = true;
// keep working
moved = true;
break;
}
}
// jump out of loop if we moved something
if (moved) {
break;
// this item is sorted, move our pointer and keep going
} else {
p++;
}
}
// when we make it here and moved is false, we are
// finished sorting
if (!moved) {
break;
}
}
this.sorted = s;
},
_insert: function(source, o, type) {
// Y.log('private _insert() ' + (type || '') + ', ' + Y.id, "info", "loader");
// restore the state at the time of the request
if (source) {
this._config(source);
}
// build the dependency list
this.calculate(o); // don't include type so we can process CSS and script in
// one pass when the type is not specified.
this.loadType = type;
if (!type) {
var self = this;
// Y.log("trying to load css first");
this._internalCallback = function() {
var f = self.onCSS, n, p, sib;
// IE hack for style overrides that are not being applied
if (this.insertBefore && Y.UA.ie) {
n = Y.config.doc.getElementById(this.insertBefore);
p = n.parentNode;
sib = n.nextSibling;
p.removeChild(n);
if (sib) {
p.insertBefore(n, sib);
} else {
p.appendChild(n);
}
}
if (f) {
f.call(self.context, Y);
}
self._internalCallback = null;
self._insert(null, null, JS);
};
this._insert(null, null, CSS);
return;
}
// set a flag to indicate the load has started
this._loading = true;
// flag to indicate we are done with the combo service
// and any additional files will need to be loaded
// individually
this._combineComplete = {};
// start the load
this.loadNext();
},
// Once a loader operation is completely finished, process
// any additional queued items.
_continue: function() {
if (!(_queue.running) && _queue.size() > 0) {
_queue.running = true;
_queue.next()();
}
},
/**
* inserts the requested modules and their dependencies.
* <code>type</code> can be "js" or "css". Both script and
* css are inserted if type is not provided.
* @method insert
* @param o optional options object
* @param type {string} the type of dependency to insert
*/
insert: function(o, type) {
// Y.log('public insert() ' + (type || '') + ', ' + Y.Object.keys(this.required), "info", "loader");
var self = this, copy = Y.merge(this, true);
delete copy.require;
delete copy.dirty;
_queue.add(function() {
self._insert(copy, o, type);
});
this._continue();
},
/**
* Executed every time a module is loaded, and if we are in a load
* cycle, we attempt to load the next script. Public so that it
* is possible to call this if using a method other than
* Y.register to determine when scripts are fully loaded
* @method loadNext
* @param mname {string} optional the name of the module that has
* been loaded (which is usually why it is time to load the next
* one)
*/
loadNext: function(mname) {
// It is possible that this function is executed due to something
// else one the page loading a YUI module. Only react when we
// are actively loading something
if (!this._loading) {
return;
}
var s, len, i, m, url, fn, msg, attr, group, groupName, j, frag,
comboSource, comboSources, mods, combining, urls, comboBase,
// provided,
type = this.loadType,
self = this,
handleSuccess = function(o) {
self.loadNext(o.data);
},
handleCombo = function(o) {
self._combineComplete[type] = true;
var i, len = combining.length;
for (i=0; i<len; i++) {
// self.loaded[combining[i]] = true;
self.inserted[combining[i]] = true;
// provided = this.getProvides(combining[i]);
// Y.mix(self.loaded, provided);
// Y.mix(self.inserted, provided);
}
handleSuccess(o);
};
if (this.combine && (!this._combineComplete[type])) {
combining = [];
this._combining = combining;
s = this.sorted;
len = s.length;
// the default combo base
comboBase = this.comboBase;
url = comboBase;
urls = [];
comboSources = {};
for (i=0; i<len; i++) {
comboSource = comboBase;
m = this.getModule(s[i]);
groupName = m && m.group;
if (groupName) {
group = this.groups[groupName];
if (!group.combine) {
m.combine = false;
continue;
}
m.combine = true;
if (group.comboBase) {
comboSource = group.comboBase;
}
if (group.root) {
m.root = group.root;
}
}
comboSources[comboSource] = comboSources[comboSource] || [];
comboSources[comboSource].push(m);
}
for (j in comboSources) {
if (comboSources.hasOwnProperty(j)) {
url = j;
mods = comboSources[j];
len = mods.length;
for (i=0; i<len; i++) {
// m = this.getModule(s[i]);
m = mods[i];
// Do not try to combine non-yui JS unless combo def is found
if (m && (m.type === type) && (m.combine || !m.ext)) {
frag = (m.root || this.root) + m.path;
if ((url !== j) && (i < (len - 1)) && ((frag.length + url.length) > this.maxURLLength)) {
urls.push(this._filter(url));
url = j;
}
url += frag;
if (i < (len - 1)) {
url += '&';
}
combining.push(m.name);
}
}
if (combining.length && (url != j)) {
urls.push(this._filter(url));
}
}
}
if (combining.length) {
Y.log('Attempting to use combo: ' + combining, "info", "loader");
// if (m.type === CSS) {
if (type === CSS) {
fn = Y.Get.css;
attr = this.cssAttributes;
} else {
fn = Y.Get.script;
attr = this.jsAttributes;
}
fn(urls, {
data: this._loading,
onSuccess: handleCombo,
onFailure: this._onFailure,
onTimeout: this._onTimeout,
insertBefore: this.insertBefore,
charset: this.charset,
attributes: attr,
timeout: this.timeout,
autopurge: false,
context: this
});
return;
} else {
this._combineComplete[type] = true;
}
}
if (mname) {
// if the module that was just loaded isn't what we were expecting,
// continue to wait
if (mname !== this._loading) {
return;
}
// Y.log("loadNext executing, just loaded " + mname + ", " + Y.id, "info", "loader");
// The global handler that is called when each module is loaded
// will pass that module name to this function. Storing this
// data to avoid loading the same module multiple times
// centralize this in the callback
this.inserted[mname] = true;
// this.loaded[mname] = true;
// provided = this.getProvides(mname);
// Y.mix(this.loaded, provided);
// Y.mix(this.inserted, provided);
if (this.onProgress) {
this.onProgress.call(this.context, {
name: mname,
data: this.data
});
}
}
s = this.sorted;
len = s.length;
for (i=0; i<len; i=i+1) {
// this.inserted keeps track of what the loader has loaded.
// move on if this item is done.
if (s[i] in this.inserted) {
continue;
}
// Because rollups will cause multiple load notifications
// from Y, loadNext may be called multiple times for
// the same module when loading a rollup. We can safely
// skip the subsequent requests
if (s[i] === this._loading) {
Y.log("still loading " + s[i] + ", waiting", "info", "loader");
return;
}
// log("inserting " + s[i]);
m = this.getModule(s[i]);
if (!m) {
msg = "Undefined module " + s[i] + " skipped";
Y.log(msg, 'warn', 'loader');
// this.inserted[s[i]] = true;
this.skipped[s[i]] = true;
continue;
}
group = (m.group && this.groups[m.group]) || NOT_FOUND;
// The load type is stored to offer the possibility to load
// the css separately from the script.
if (!type || type === m.type) {
this._loading = s[i];
Y.log("attempting to load " + s[i] + ", " + this.base, "info", "loader");
if (m.type === CSS) {
fn = Y.Get.css;
attr = this.cssAttributes;
} else {
fn = Y.Get.script;
attr = this.jsAttributes;
}
url = (m.fullpath) ? this._filter(m.fullpath, s[i]) : this._url(m.path, s[i], group.base || m.base);
fn(url, {
data: s[i],
onSuccess: handleSuccess,
insertBefore: this.insertBefore,
charset: this.charset,
attributes: attr,
onFailure: this._onFailure,
onTimeout: this._onTimeout,
timeout: this.timeout,
autopurge: false,
context: self
});
return;
}
}
// we are finished
this._loading = null;
fn = this._internalCallback;
// internal callback for loading css first
if (fn) {
// Y.log('loader internal');
this._internalCallback = null;
fn.call(this);
} else {
// Y.log('loader complete');
this._onSuccess();
}
},
/**
* Apply filter defined for this instance to a url/path
* method _filter
* @param u {string} the string to filter
* @param name {string} the name of the module, if we are processing
* a single module as opposed to a combined url
* @return {string} the filtered string
* @private
*/
_filter: function(u, name) {
var f = this.filter,
hasFilter = name && (name in this.filters),
modFilter = hasFilter && this.filters[name];
if (u) {
if (hasFilter) {
f = (L.isString(modFilter)) ?
this.FILTER_DEFS[modFilter.toUpperCase()] || null :
modFilter;
}
if (f) {
u = u.replace(new RegExp(f.searchExp, 'g'), f.replaceStr);
}
}
return u;
},
/**
* Generates the full url for a module
* method _url
* @param path {string} the path fragment
* @return {string} the full url
* @private
*/
_url: function(path, name, base) {
return this._filter((base || this.base || "") + path, name);
}
};
}, '@VERSION@' ,{requires:['get']});
|
pages/customization/themes.js | cherniavskii/material-ui | import React from 'react';
import withRoot from 'docs/src/modules/components/withRoot';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import markdown from 'docs/src/pages/customization/themes/themes.md';
function Page() {
return (
<MarkdownDocs
markdown={markdown}
demos={{
'pages/customization/themes/Palette.js': {
js: require('docs/src/pages/customization/themes/Palette').default,
raw: preval`
module.exports = require('fs')
.readFileSync(require.resolve('docs/src/pages/customization/themes/Palette'), 'utf8')
`,
},
'pages/customization/themes/TypographyTheme.js': {
js: require('docs/src/pages/customization/themes/TypographyTheme').default,
raw: preval`
module.exports = require('fs')
.readFileSync(require.resolve('docs/src/pages/customization/themes/TypographyTheme'), 'utf8')
`,
},
'pages/customization/themes/FontSizeTheme.js': {
js: require('docs/src/pages/customization/themes/FontSizeTheme').default,
raw: preval`
module.exports = require('fs')
.readFileSync(require.resolve('docs/src/pages/customization/themes/FontSizeTheme'), 'utf8')
`,
},
'pages/customization/themes/DarkTheme.js': {
js: require('docs/src/pages/customization/themes/DarkTheme').default,
raw: preval`
module.exports = require('fs')
.readFileSync(require.resolve('docs/src/pages/customization/themes/DarkTheme'), 'utf8')
`,
},
'pages/customization/themes/CustomStyles.js': {
js: require('docs/src/pages/customization/themes/CustomStyles').default,
raw: preval`
module.exports = require('fs')
.readFileSync(require.resolve('docs/src/pages/customization/themes/CustomStyles'), 'utf8')
`,
},
'pages/customization/themes/OverridesTheme.js': {
js: require('docs/src/pages/customization/themes/OverridesTheme').default,
raw: preval`
module.exports = require('fs')
.readFileSync(require.resolve('docs/src/pages/customization/themes/OverridesTheme'), 'utf8')
`,
},
'pages/customization/themes/WithTheme.js': {
js: require('docs/src/pages/customization/themes/WithTheme').default,
raw: preval`
module.exports = require('fs')
.readFileSync(require.resolve('docs/src/pages/customization/themes/WithTheme'), 'utf8')
`,
},
'pages/customization/themes/Nested.js': {
js: require('docs/src/pages/customization/themes/Nested').default,
raw: preval`
module.exports = require('fs')
.readFileSync(require.resolve('docs/src/pages/customization/themes/Nested'), 'utf8')
`,
},
}}
/>
);
}
export default withRoot(Page);
|
ajax/libs/backbone.js/1.0.0/backbone.js | wil93/cdnjs | // Backbone.js 1.0.0
// (c) 2010-2013 Jeremy Ashkenas, DocumentCloud Inc.
// Backbone may be freely distributed under the MIT license.
// For all details and documentation:
// http://backbonejs.org
(function(){
// Initial Setup
// -------------
// Save a reference to the global object (`window` in the browser, `exports`
// on the server).
var root = this;
// Save the previous value of the `Backbone` variable, so that it can be
// restored later on, if `noConflict` is used.
var previousBackbone = root.Backbone;
// Create local references to array methods we'll want to use later.
var array = [];
var push = array.push;
var slice = array.slice;
var splice = array.splice;
// The top-level namespace. All public Backbone classes and modules will
// be attached to this. Exported for both the browser and the server.
var Backbone;
if (typeof exports !== 'undefined') {
Backbone = exports;
} else {
Backbone = root.Backbone = {};
}
// Current version of the library. Keep in sync with `package.json`.
Backbone.VERSION = '1.0.0';
// Require Underscore, if we're on the server, and it's not already present.
var _ = root._;
if (!_ && (typeof require !== 'undefined')) _ = require('underscore');
// For Backbone's purposes, jQuery, Zepto, Ender, or My Library (kidding) owns
// the `$` variable.
Backbone.$ = root.jQuery || root.Zepto || root.ender || root.$;
// Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable
// to its previous owner. Returns a reference to this Backbone object.
Backbone.noConflict = function() {
root.Backbone = previousBackbone;
return this;
};
// Turn on `emulateHTTP` to support legacy HTTP servers. Setting this option
// will fake `"PUT"` and `"DELETE"` requests via the `_method` parameter and
// set a `X-Http-Method-Override` header.
Backbone.emulateHTTP = false;
// Turn on `emulateJSON` to support legacy servers that can't deal with direct
// `application/json` requests ... will encode the body as
// `application/x-www-form-urlencoded` instead and will send the model in a
// form param named `model`.
Backbone.emulateJSON = false;
// Backbone.Events
// ---------------
// A module that can be mixed in to *any object* in order to provide it with
// custom events. You may bind with `on` or remove with `off` callback
// functions to an event; `trigger`-ing an event fires all callbacks in
// succession.
//
// var object = {};
// _.extend(object, Backbone.Events);
// object.on('expand', function(){ alert('expanded'); });
// object.trigger('expand');
//
var Events = Backbone.Events = {
// Bind an event to a `callback` function. Passing `"all"` will bind
// the callback to all events fired.
on: function(name, callback, context) {
if (!eventsApi(this, 'on', name, [callback, context]) || !callback) return this;
this._events || (this._events = {});
var events = this._events[name] || (this._events[name] = []);
events.push({callback: callback, context: context, ctx: context || this});
return this;
},
// Bind an event to only be triggered a single time. After the first time
// the callback is invoked, it will be removed.
once: function(name, callback, context) {
if (!eventsApi(this, 'once', name, [callback, context]) || !callback) return this;
var self = this;
var once = _.once(function() {
self.off(name, once);
callback.apply(this, arguments);
});
once._callback = callback;
return this.on(name, once, context);
},
// Remove one or many callbacks. If `context` is null, removes all
// callbacks with that function. If `callback` is null, removes all
// callbacks for the event. If `name` is null, removes all bound
// callbacks for all events.
off: function(name, callback, context) {
var retain, ev, events, names, i, l, j, k;
if (!this._events || !eventsApi(this, 'off', name, [callback, context])) return this;
if (!name && !callback && !context) {
this._events = {};
return this;
}
names = name ? [name] : _.keys(this._events);
for (i = 0, l = names.length; i < l; i++) {
name = names[i];
if (events = this._events[name]) {
this._events[name] = retain = [];
if (callback || context) {
for (j = 0, k = events.length; j < k; j++) {
ev = events[j];
if ((callback && callback !== ev.callback && callback !== ev.callback._callback) ||
(context && context !== ev.context)) {
retain.push(ev);
}
}
}
if (!retain.length) delete this._events[name];
}
}
return this;
},
// Trigger one or many events, firing all bound callbacks. Callbacks are
// passed the same arguments as `trigger` is, apart from the event name
// (unless you're listening on `"all"`, which will cause your callback to
// receive the true name of the event as the first argument).
trigger: function(name) {
if (!this._events) return this;
var args = slice.call(arguments, 1);
if (!eventsApi(this, 'trigger', name, args)) return this;
var events = this._events[name];
var allEvents = this._events.all;
if (events) triggerEvents(events, args);
if (allEvents) triggerEvents(allEvents, arguments);
return this;
},
// Tell this object to stop listening to either specific events ... or
// to every object it's currently listening to.
stopListening: function(obj, name, callback) {
var listeners = this._listeners;
if (!listeners) return this;
var deleteListener = !name && !callback;
if (typeof name === 'object') callback = this;
if (obj) (listeners = {})[obj._listenerId] = obj;
for (var id in listeners) {
listeners[id].off(name, callback, this);
if (deleteListener) delete this._listeners[id];
}
return this;
}
};
// Regular expression used to split event strings.
var eventSplitter = /\s+/;
// Implement fancy features of the Events API such as multiple event
// names `"change blur"` and jQuery-style event maps `{change: action}`
// in terms of the existing API.
var eventsApi = function(obj, action, name, rest) {
if (!name) return true;
// Handle event maps.
if (typeof name === 'object') {
for (var key in name) {
obj[action].apply(obj, [key, name[key]].concat(rest));
}
return false;
}
// Handle space separated event names.
if (eventSplitter.test(name)) {
var names = name.split(eventSplitter);
for (var i = 0, l = names.length; i < l; i++) {
obj[action].apply(obj, [names[i]].concat(rest));
}
return false;
}
return true;
};
// A difficult-to-believe, but optimized internal dispatch function for
// triggering events. Tries to keep the usual cases speedy (most internal
// Backbone events have 3 arguments).
var triggerEvents = function(events, args) {
var ev, i = -1, l = events.length, a1 = args[0], a2 = args[1], a3 = args[2];
switch (args.length) {
case 0: while (++i < l) (ev = events[i]).callback.call(ev.ctx); return;
case 1: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1); return;
case 2: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2); return;
case 3: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2, a3); return;
default: while (++i < l) (ev = events[i]).callback.apply(ev.ctx, args);
}
};
var listenMethods = {listenTo: 'on', listenToOnce: 'once'};
// Inversion-of-control versions of `on` and `once`. Tell *this* object to
// listen to an event in another object ... keeping track of what it's
// listening to.
_.each(listenMethods, function(implementation, method) {
Events[method] = function(obj, name, callback) {
var listeners = this._listeners || (this._listeners = {});
var id = obj._listenerId || (obj._listenerId = _.uniqueId('l'));
listeners[id] = obj;
if (typeof name === 'object') callback = this;
obj[implementation](name, callback, this);
return this;
};
});
// Aliases for backwards compatibility.
Events.bind = Events.on;
Events.unbind = Events.off;
// Allow the `Backbone` object to serve as a global event bus, for folks who
// want global "pubsub" in a convenient place.
_.extend(Backbone, Events);
// Backbone.Model
// --------------
// Backbone **Models** are the basic data object in the framework --
// frequently representing a row in a table in a database on your server.
// A discrete chunk of data and a bunch of useful, related methods for
// performing computations and transformations on that data.
// Create a new model with the specified attributes. A client id (`cid`)
// is automatically generated and assigned for you.
var Model = Backbone.Model = function(attributes, options) {
var defaults;
var attrs = attributes || {};
options || (options = {});
this.cid = _.uniqueId('c');
this.attributes = {};
_.extend(this, _.pick(options, modelOptions));
if (options.parse) attrs = this.parse(attrs, options) || {};
if (defaults = _.result(this, 'defaults')) {
attrs = _.defaults({}, attrs, defaults);
}
this.set(attrs, options);
this.changed = {};
this.initialize.apply(this, arguments);
};
// A list of options to be attached directly to the model, if provided.
var modelOptions = ['url', 'urlRoot', 'collection'];
// Attach all inheritable methods to the Model prototype.
_.extend(Model.prototype, Events, {
// A hash of attributes whose current and previous value differ.
changed: null,
// The value returned during the last failed validation.
validationError: null,
// The default name for the JSON `id` attribute is `"id"`. MongoDB and
// CouchDB users may want to set this to `"_id"`.
idAttribute: 'id',
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize: function(){},
// Return a copy of the model's `attributes` object.
toJSON: function(options) {
return _.clone(this.attributes);
},
// Proxy `Backbone.sync` by default -- but override this if you need
// custom syncing semantics for *this* particular model.
sync: function() {
return Backbone.sync.apply(this, arguments);
},
// Get the value of an attribute.
get: function(attr) {
return this.attributes[attr];
},
// Get the HTML-escaped value of an attribute.
escape: function(attr) {
return _.escape(this.get(attr));
},
// Returns `true` if the attribute contains a value that is not null
// or undefined.
has: function(attr) {
return this.get(attr) != null;
},
// Set a hash of model attributes on the object, firing `"change"`. This is
// the core primitive operation of a model, updating the data and notifying
// anyone who needs to know about the change in state. The heart of the beast.
set: function(key, val, options) {
var attr, attrs, unset, changes, silent, changing, prev, current;
if (key == null) return this;
// Handle both `"key", value` and `{key: value}` -style arguments.
if (typeof key === 'object') {
attrs = key;
options = val;
} else {
(attrs = {})[key] = val;
}
options || (options = {});
// Run validation.
if (!this._validate(attrs, options)) return false;
// Extract attributes and options.
unset = options.unset;
silent = options.silent;
changes = [];
changing = this._changing;
this._changing = true;
if (!changing) {
this._previousAttributes = _.clone(this.attributes);
this.changed = {};
}
current = this.attributes, prev = this._previousAttributes;
// Check for changes of `id`.
if (this.idAttribute in attrs) this.id = attrs[this.idAttribute];
// For each `set` attribute, update or delete the current value.
for (attr in attrs) {
val = attrs[attr];
if (!_.isEqual(current[attr], val)) changes.push(attr);
if (!_.isEqual(prev[attr], val)) {
this.changed[attr] = val;
} else {
delete this.changed[attr];
}
unset ? delete current[attr] : current[attr] = val;
}
// Trigger all relevant attribute changes.
if (!silent) {
if (changes.length) this._pending = true;
for (var i = 0, l = changes.length; i < l; i++) {
this.trigger('change:' + changes[i], this, current[changes[i]], options);
}
}
// You might be wondering why there's a `while` loop here. Changes can
// be recursively nested within `"change"` events.
if (changing) return this;
if (!silent) {
while (this._pending) {
this._pending = false;
this.trigger('change', this, options);
}
}
this._pending = false;
this._changing = false;
return this;
},
// Remove an attribute from the model, firing `"change"`. `unset` is a noop
// if the attribute doesn't exist.
unset: function(attr, options) {
return this.set(attr, void 0, _.extend({}, options, {unset: true}));
},
// Clear all attributes on the model, firing `"change"`.
clear: function(options) {
var attrs = {};
for (var key in this.attributes) attrs[key] = void 0;
return this.set(attrs, _.extend({}, options, {unset: true}));
},
// Determine if the model has changed since the last `"change"` event.
// If you specify an attribute name, determine if that attribute has changed.
hasChanged: function(attr) {
if (attr == null) return !_.isEmpty(this.changed);
return _.has(this.changed, attr);
},
// Return an object containing all the attributes that have changed, or
// false if there are no changed attributes. Useful for determining what
// parts of a view need to be updated and/or what attributes need to be
// persisted to the server. Unset attributes will be set to undefined.
// You can also pass an attributes object to diff against the model,
// determining if there *would be* a change.
changedAttributes: function(diff) {
if (!diff) return this.hasChanged() ? _.clone(this.changed) : false;
var val, changed = false;
var old = this._changing ? this._previousAttributes : this.attributes;
for (var attr in diff) {
if (_.isEqual(old[attr], (val = diff[attr]))) continue;
(changed || (changed = {}))[attr] = val;
}
return changed;
},
// Get the previous value of an attribute, recorded at the time the last
// `"change"` event was fired.
previous: function(attr) {
if (attr == null || !this._previousAttributes) return null;
return this._previousAttributes[attr];
},
// Get all of the attributes of the model at the time of the previous
// `"change"` event.
previousAttributes: function() {
return _.clone(this._previousAttributes);
},
// Fetch the model from the server. If the server's representation of the
// model differs from its current attributes, they will be overridden,
// triggering a `"change"` event.
fetch: function(options) {
options = options ? _.clone(options) : {};
if (options.parse === void 0) options.parse = true;
var model = this;
var success = options.success;
options.success = function(resp) {
if (!model.set(model.parse(resp, options), options)) return false;
if (success) success(model, resp, options);
model.trigger('sync', model, resp, options);
};
wrapError(this, options);
return this.sync('read', this, options);
},
// Set a hash of model attributes, and sync the model to the server.
// If the server returns an attributes hash that differs, the model's
// state will be `set` again.
save: function(key, val, options) {
var attrs, method, xhr, attributes = this.attributes;
// Handle both `"key", value` and `{key: value}` -style arguments.
if (key == null || typeof key === 'object') {
attrs = key;
options = val;
} else {
(attrs = {})[key] = val;
}
// If we're not waiting and attributes exist, save acts as `set(attr).save(null, opts)`.
if (attrs && (!options || !options.wait) && !this.set(attrs, options)) return false;
options = _.extend({validate: true}, options);
// Do not persist invalid models.
if (!this._validate(attrs, options)) return false;
// Set temporary attributes if `{wait: true}`.
if (attrs && options.wait) {
this.attributes = _.extend({}, attributes, attrs);
}
// After a successful server-side save, the client is (optionally)
// updated with the server-side state.
if (options.parse === void 0) options.parse = true;
var model = this;
var success = options.success;
options.success = function(resp) {
// Ensure attributes are restored during synchronous saves.
model.attributes = attributes;
var serverAttrs = model.parse(resp, options);
if (options.wait) serverAttrs = _.extend(attrs || {}, serverAttrs);
if (_.isObject(serverAttrs) && !model.set(serverAttrs, options)) {
return false;
}
if (success) success(model, resp, options);
model.trigger('sync', model, resp, options);
};
wrapError(this, options);
method = this.isNew() ? 'create' : (options.patch ? 'patch' : 'update');
if (method === 'patch') options.attrs = attrs;
xhr = this.sync(method, this, options);
// Restore attributes.
if (attrs && options.wait) this.attributes = attributes;
return xhr;
},
// Destroy this model on the server if it was already persisted.
// Optimistically removes the model from its collection, if it has one.
// If `wait: true` is passed, waits for the server to respond before removal.
destroy: function(options) {
options = options ? _.clone(options) : {};
var model = this;
var success = options.success;
var destroy = function() {
model.trigger('destroy', model, model.collection, options);
};
options.success = function(resp) {
if (options.wait || model.isNew()) destroy();
if (success) success(model, resp, options);
if (!model.isNew()) model.trigger('sync', model, resp, options);
};
if (this.isNew()) {
options.success();
return false;
}
wrapError(this, options);
var xhr = this.sync('delete', this, options);
if (!options.wait) destroy();
return xhr;
},
// Default URL for the model's representation on the server -- if you're
// using Backbone's restful methods, override this to change the endpoint
// that will be called.
url: function() {
var base = _.result(this, 'urlRoot') || _.result(this.collection, 'url') || urlError();
if (this.isNew()) return base;
return base + (base.charAt(base.length - 1) === '/' ? '' : '/') + encodeURIComponent(this.id);
},
// **parse** converts a response into the hash of attributes to be `set` on
// the model. The default implementation is just to pass the response along.
parse: function(resp, options) {
return resp;
},
// Create a new model with identical attributes to this one.
clone: function() {
return new this.constructor(this.attributes);
},
// A model is new if it has never been saved to the server, and lacks an id.
isNew: function() {
return this.id == null;
},
// Check if the model is currently in a valid state.
isValid: function(options) {
return this._validate({}, _.extend(options || {}, { validate: true }));
},
// Run validation against the next complete set of model attributes,
// returning `true` if all is well. Otherwise, fire an `"invalid"` event.
_validate: function(attrs, options) {
if (!options.validate || !this.validate) return true;
attrs = _.extend({}, this.attributes, attrs);
var error = this.validationError = this.validate(attrs, options) || null;
if (!error) return true;
this.trigger('invalid', this, error, _.extend(options || {}, {validationError: error}));
return false;
}
});
// Underscore methods that we want to implement on the Model.
var modelMethods = ['keys', 'values', 'pairs', 'invert', 'pick', 'omit'];
// Mix in each Underscore method as a proxy to `Model#attributes`.
_.each(modelMethods, function(method) {
Model.prototype[method] = function() {
var args = slice.call(arguments);
args.unshift(this.attributes);
return _[method].apply(_, args);
};
});
// Backbone.Collection
// -------------------
// If models tend to represent a single row of data, a Backbone Collection is
// more analagous to a table full of data ... or a small slice or page of that
// table, or a collection of rows that belong together for a particular reason
// -- all of the messages in this particular folder, all of the documents
// belonging to this particular author, and so on. Collections maintain
// indexes of their models, both in order, and for lookup by `id`.
// Create a new **Collection**, perhaps to contain a specific type of `model`.
// If a `comparator` is specified, the Collection will maintain
// its models in sort order, as they're added and removed.
var Collection = Backbone.Collection = function(models, options) {
options || (options = {});
if (options.url) this.url = options.url;
if (options.model) this.model = options.model;
if (options.comparator !== void 0) this.comparator = options.comparator;
this._reset();
this.initialize.apply(this, arguments);
if (models) this.reset(models, _.extend({silent: true}, options));
};
// Default options for `Collection#set`.
var setOptions = {add: true, remove: true, merge: true};
var addOptions = {add: true, merge: false, remove: false};
// Define the Collection's inheritable methods.
_.extend(Collection.prototype, Events, {
// The default model for a collection is just a **Backbone.Model**.
// This should be overridden in most cases.
model: Model,
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize: function(){},
// The JSON representation of a Collection is an array of the
// models' attributes.
toJSON: function(options) {
return this.map(function(model){ return model.toJSON(options); });
},
// Proxy `Backbone.sync` by default.
sync: function() {
return Backbone.sync.apply(this, arguments);
},
// Add a model, or list of models to the set.
add: function(models, options) {
return this.set(models, _.defaults(options || {}, addOptions));
},
// Remove a model, or a list of models from the set.
remove: function(models, options) {
models = _.isArray(models) ? models.slice() : [models];
options || (options = {});
var i, l, index, model;
for (i = 0, l = models.length; i < l; i++) {
model = this.get(models[i]);
if (!model) continue;
delete this._byId[model.id];
delete this._byId[model.cid];
index = this.indexOf(model);
this.models.splice(index, 1);
this.length--;
if (!options.silent) {
options.index = index;
model.trigger('remove', model, this, options);
}
this._removeReference(model);
}
return this;
},
// Update a collection by `set`-ing a new list of models, adding new ones,
// removing models that are no longer present, and merging models that
// already exist in the collection, as necessary. Similar to **Model#set**,
// the core operation for updating the data contained by the collection.
set: function(models, options) {
options = _.defaults(options || {}, setOptions);
if (options.parse) models = this.parse(models, options);
if (!_.isArray(models)) models = models ? [models] : [];
var i, l, model, attrs, existing, sort;
var at = options.at;
var sortable = this.comparator && (at == null) && options.sort !== false;
var sortAttr = _.isString(this.comparator) ? this.comparator : null;
var toAdd = [], toRemove = [], modelMap = {};
// Turn bare objects into model references, and prevent invalid models
// from being added.
for (i = 0, l = models.length; i < l; i++) {
if (!(model = this._prepareModel(models[i], options))) continue;
// If a duplicate is found, prevent it from being added and
// optionally merge it into the existing model.
if (existing = this.get(model)) {
if (options.remove) modelMap[existing.cid] = true;
if (options.merge) {
existing.set(model.attributes, options);
if (sortable && !sort && existing.hasChanged(sortAttr)) sort = true;
}
// This is a new model, push it to the `toAdd` list.
} else if (options.add) {
toAdd.push(model);
// Listen to added models' events, and index models for lookup by
// `id` and by `cid`.
model.on('all', this._onModelEvent, this);
this._byId[model.cid] = model;
if (model.id != null) this._byId[model.id] = model;
}
}
// Remove nonexistent models if appropriate.
if (options.remove) {
for (i = 0, l = this.length; i < l; ++i) {
if (!modelMap[(model = this.models[i]).cid]) toRemove.push(model);
}
if (toRemove.length) this.remove(toRemove, options);
}
// See if sorting is needed, update `length` and splice in new models.
if (toAdd.length) {
if (sortable) sort = true;
this.length += toAdd.length;
if (at != null) {
splice.apply(this.models, [at, 0].concat(toAdd));
} else {
push.apply(this.models, toAdd);
}
}
// Silently sort the collection if appropriate.
if (sort) this.sort({silent: true});
if (options.silent) return this;
// Trigger `add` events.
for (i = 0, l = toAdd.length; i < l; i++) {
(model = toAdd[i]).trigger('add', model, this, options);
}
// Trigger `sort` if the collection was sorted.
if (sort) this.trigger('sort', this, options);
return this;
},
// When you have more items than you want to add or remove individually,
// you can reset the entire set with a new list of models, without firing
// any granular `add` or `remove` events. Fires `reset` when finished.
// Useful for bulk operations and optimizations.
reset: function(models, options) {
options || (options = {});
for (var i = 0, l = this.models.length; i < l; i++) {
this._removeReference(this.models[i]);
}
options.previousModels = this.models;
this._reset();
this.add(models, _.extend({silent: true}, options));
if (!options.silent) this.trigger('reset', this, options);
return this;
},
// Add a model to the end of the collection.
push: function(model, options) {
model = this._prepareModel(model, options);
this.add(model, _.extend({at: this.length}, options));
return model;
},
// Remove a model from the end of the collection.
pop: function(options) {
var model = this.at(this.length - 1);
this.remove(model, options);
return model;
},
// Add a model to the beginning of the collection.
unshift: function(model, options) {
model = this._prepareModel(model, options);
this.add(model, _.extend({at: 0}, options));
return model;
},
// Remove a model from the beginning of the collection.
shift: function(options) {
var model = this.at(0);
this.remove(model, options);
return model;
},
// Slice out a sub-array of models from the collection.
slice: function(begin, end) {
return this.models.slice(begin, end);
},
// Get a model from the set by id.
get: function(obj) {
if (obj == null) return void 0;
return this._byId[obj.id != null ? obj.id : obj.cid || obj];
},
// Get the model at the given index.
at: function(index) {
return this.models[index];
},
// Return models with matching attributes. Useful for simple cases of
// `filter`.
where: function(attrs, first) {
if (_.isEmpty(attrs)) return first ? void 0 : [];
return this[first ? 'find' : 'filter'](function(model) {
for (var key in attrs) {
if (attrs[key] !== model.get(key)) return false;
}
return true;
});
},
// Return the first model with matching attributes. Useful for simple cases
// of `find`.
findWhere: function(attrs) {
return this.where(attrs, true);
},
// Force the collection to re-sort itself. You don't need to call this under
// normal circumstances, as the set will maintain sort order as each item
// is added.
sort: function(options) {
if (!this.comparator) throw new Error('Cannot sort a set without a comparator');
options || (options = {});
// Run sort based on type of `comparator`.
if (_.isString(this.comparator) || this.comparator.length === 1) {
this.models = this.sortBy(this.comparator, this);
} else {
this.models.sort(_.bind(this.comparator, this));
}
if (!options.silent) this.trigger('sort', this, options);
return this;
},
// Figure out the smallest index at which a model should be inserted so as
// to maintain order.
sortedIndex: function(model, value, context) {
value || (value = this.comparator);
var iterator = _.isFunction(value) ? value : function(model) {
return model.get(value);
};
return _.sortedIndex(this.models, model, iterator, context);
},
// Pluck an attribute from each model in the collection.
pluck: function(attr) {
return _.invoke(this.models, 'get', attr);
},
// Fetch the default set of models for this collection, resetting the
// collection when they arrive. If `reset: true` is passed, the response
// data will be passed through the `reset` method instead of `set`.
fetch: function(options) {
options = options ? _.clone(options) : {};
if (options.parse === void 0) options.parse = true;
var success = options.success;
var collection = this;
options.success = function(resp) {
var method = options.reset ? 'reset' : 'set';
collection[method](resp, options);
if (success) success(collection, resp, options);
collection.trigger('sync', collection, resp, options);
};
wrapError(this, options);
return this.sync('read', this, options);
},
// Create a new instance of a model in this collection. Add the model to the
// collection immediately, unless `wait: true` is passed, in which case we
// wait for the server to agree.
create: function(model, options) {
options = options ? _.clone(options) : {};
if (!(model = this._prepareModel(model, options))) return false;
if (!options.wait) this.add(model, options);
var collection = this;
var success = options.success;
options.success = function(resp) {
if (options.wait) collection.add(model, options);
if (success) success(model, resp, options);
};
model.save(null, options);
return model;
},
// **parse** converts a response into a list of models to be added to the
// collection. The default implementation is just to pass it through.
parse: function(resp, options) {
return resp;
},
// Create a new collection with an identical list of models as this one.
clone: function() {
return new this.constructor(this.models);
},
// Private method to reset all internal state. Called when the collection
// is first initialized or reset.
_reset: function() {
this.length = 0;
this.models = [];
this._byId = {};
},
// Prepare a hash of attributes (or other model) to be added to this
// collection.
_prepareModel: function(attrs, options) {
if (attrs instanceof Model) {
if (!attrs.collection) attrs.collection = this;
return attrs;
}
options || (options = {});
options.collection = this;
var model = new this.model(attrs, options);
if (!model._validate(attrs, options)) {
this.trigger('invalid', this, attrs, options);
return false;
}
return model;
},
// Internal method to sever a model's ties to a collection.
_removeReference: function(model) {
if (this === model.collection) delete model.collection;
model.off('all', this._onModelEvent, this);
},
// Internal method called every time a model in the set fires an event.
// Sets need to update their indexes when models change ids. All other
// events simply proxy through. "add" and "remove" events that originate
// in other collections are ignored.
_onModelEvent: function(event, model, collection, options) {
if ((event === 'add' || event === 'remove') && collection !== this) return;
if (event === 'destroy') this.remove(model, options);
if (model && event === 'change:' + model.idAttribute) {
delete this._byId[model.previous(model.idAttribute)];
if (model.id != null) this._byId[model.id] = model;
}
this.trigger.apply(this, arguments);
}
});
// Underscore methods that we want to implement on the Collection.
// 90% of the core usefulness of Backbone Collections is actually implemented
// right here:
var methods = ['forEach', 'each', 'map', 'collect', 'reduce', 'foldl',
'inject', 'reduceRight', 'foldr', 'find', 'detect', 'filter', 'select',
'reject', 'every', 'all', 'some', 'any', 'include', 'contains', 'invoke',
'max', 'min', 'toArray', 'size', 'first', 'head', 'take', 'initial', 'rest',
'tail', 'drop', 'last', 'without', 'indexOf', 'shuffle', 'lastIndexOf',
'isEmpty', 'chain'];
// Mix in each Underscore method as a proxy to `Collection#models`.
_.each(methods, function(method) {
Collection.prototype[method] = function() {
var args = slice.call(arguments);
args.unshift(this.models);
return _[method].apply(_, args);
};
});
// Underscore methods that take a property name as an argument.
var attributeMethods = ['groupBy', 'countBy', 'sortBy'];
// Use attributes instead of properties.
_.each(attributeMethods, function(method) {
Collection.prototype[method] = function(value, context) {
var iterator = _.isFunction(value) ? value : function(model) {
return model.get(value);
};
return _[method](this.models, iterator, context);
};
});
// Backbone.View
// -------------
// Backbone Views are almost more convention than they are actual code. A View
// is simply a JavaScript object that represents a logical chunk of UI in the
// DOM. This might be a single item, an entire list, a sidebar or panel, or
// even the surrounding frame which wraps your whole app. Defining a chunk of
// UI as a **View** allows you to define your DOM events declaratively, without
// having to worry about render order ... and makes it easy for the view to
// react to specific changes in the state of your models.
// Creating a Backbone.View creates its initial element outside of the DOM,
// if an existing element is not provided...
var View = Backbone.View = function(options) {
this.cid = _.uniqueId('view');
this._configure(options || {});
this._ensureElement();
this.initialize.apply(this, arguments);
this.delegateEvents();
};
// Cached regex to split keys for `delegate`.
var delegateEventSplitter = /^(\S+)\s*(.*)$/;
// List of view options to be merged as properties.
var viewOptions = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName', 'events'];
// Set up all inheritable **Backbone.View** properties and methods.
_.extend(View.prototype, Events, {
// The default `tagName` of a View's element is `"div"`.
tagName: 'div',
// jQuery delegate for element lookup, scoped to DOM elements within the
// current view. This should be prefered to global lookups where possible.
$: function(selector) {
return this.$el.find(selector);
},
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize: function(){},
// **render** is the core function that your view should override, in order
// to populate its element (`this.el`), with the appropriate HTML. The
// convention is for **render** to always return `this`.
render: function() {
return this;
},
// Remove this view by taking the element out of the DOM, and removing any
// applicable Backbone.Events listeners.
remove: function() {
this.$el.remove();
this.stopListening();
return this;
},
// Change the view's element (`this.el` property), including event
// re-delegation.
setElement: function(element, delegate) {
if (this.$el) this.undelegateEvents();
this.$el = element instanceof Backbone.$ ? element : Backbone.$(element);
this.el = this.$el[0];
if (delegate !== false) this.delegateEvents();
return this;
},
// Set callbacks, where `this.events` is a hash of
//
// *{"event selector": "callback"}*
//
// {
// 'mousedown .title': 'edit',
// 'click .button': 'save'
// 'click .open': function(e) { ... }
// }
//
// pairs. Callbacks will be bound to the view, with `this` set properly.
// Uses event delegation for efficiency.
// Omitting the selector binds the event to `this.el`.
// This only works for delegate-able events: not `focus`, `blur`, and
// not `change`, `submit`, and `reset` in Internet Explorer.
delegateEvents: function(events) {
if (!(events || (events = _.result(this, 'events')))) return this;
this.undelegateEvents();
for (var key in events) {
var method = events[key];
if (!_.isFunction(method)) method = this[events[key]];
if (!method) continue;
var match = key.match(delegateEventSplitter);
var eventName = match[1], selector = match[2];
method = _.bind(method, this);
eventName += '.delegateEvents' + this.cid;
if (selector === '') {
this.$el.on(eventName, method);
} else {
this.$el.on(eventName, selector, method);
}
}
return this;
},
// Clears all callbacks previously bound to the view with `delegateEvents`.
// You usually don't need to use this, but may wish to if you have multiple
// Backbone views attached to the same DOM element.
undelegateEvents: function() {
this.$el.off('.delegateEvents' + this.cid);
return this;
},
// Performs the initial configuration of a View with a set of options.
// Keys with special meaning *(e.g. model, collection, id, className)* are
// attached directly to the view. See `viewOptions` for an exhaustive
// list.
_configure: function(options) {
if (this.options) options = _.extend({}, _.result(this, 'options'), options);
_.extend(this, _.pick(options, viewOptions));
this.options = options;
},
// Ensure that the View has a DOM element to render into.
// If `this.el` is a string, pass it through `$()`, take the first
// matching element, and re-assign it to `el`. Otherwise, create
// an element from the `id`, `className` and `tagName` properties.
_ensureElement: function() {
if (!this.el) {
var attrs = _.extend({}, _.result(this, 'attributes'));
if (this.id) attrs.id = _.result(this, 'id');
if (this.className) attrs['class'] = _.result(this, 'className');
var $el = Backbone.$('<' + _.result(this, 'tagName') + '>').attr(attrs);
this.setElement($el, false);
} else {
this.setElement(_.result(this, 'el'), false);
}
}
});
// Backbone.sync
// -------------
// Override this function to change the manner in which Backbone persists
// models to the server. You will be passed the type of request, and the
// model in question. By default, makes a RESTful Ajax request
// to the model's `url()`. Some possible customizations could be:
//
// * Use `setTimeout` to batch rapid-fire updates into a single request.
// * Send up the models as XML instead of JSON.
// * Persist models via WebSockets instead of Ajax.
//
// Turn on `Backbone.emulateHTTP` in order to send `PUT` and `DELETE` requests
// as `POST`, with a `_method` parameter containing the true HTTP method,
// as well as all requests with the body as `application/x-www-form-urlencoded`
// instead of `application/json` with the model in a param named `model`.
// Useful when interfacing with server-side languages like **PHP** that make
// it difficult to read the body of `PUT` requests.
Backbone.sync = function(method, model, options) {
var type = methodMap[method];
// Default options, unless specified.
_.defaults(options || (options = {}), {
emulateHTTP: Backbone.emulateHTTP,
emulateJSON: Backbone.emulateJSON
});
// Default JSON-request options.
var params = {type: type, dataType: 'json'};
// Ensure that we have a URL.
if (!options.url) {
params.url = _.result(model, 'url') || urlError();
}
// Ensure that we have the appropriate request data.
if (options.data == null && model && (method === 'create' || method === 'update' || method === 'patch')) {
params.contentType = 'application/json';
params.data = JSON.stringify(options.attrs || model.toJSON(options));
}
// For older servers, emulate JSON by encoding the request into an HTML-form.
if (options.emulateJSON) {
params.contentType = 'application/x-www-form-urlencoded';
params.data = params.data ? {model: params.data} : {};
}
// For older servers, emulate HTTP by mimicking the HTTP method with `_method`
// And an `X-HTTP-Method-Override` header.
if (options.emulateHTTP && (type === 'PUT' || type === 'DELETE' || type === 'PATCH')) {
params.type = 'POST';
if (options.emulateJSON) params.data._method = type;
var beforeSend = options.beforeSend;
options.beforeSend = function(xhr) {
xhr.setRequestHeader('X-HTTP-Method-Override', type);
if (beforeSend) return beforeSend.apply(this, arguments);
};
}
// Don't process data on a non-GET request.
if (params.type !== 'GET' && !options.emulateJSON) {
params.processData = false;
}
// If we're sending a `PATCH` request, and we're in an old Internet Explorer
// that still has ActiveX enabled by default, override jQuery to use that
// for XHR instead. Remove this line when jQuery supports `PATCH` on IE8.
if (params.type === 'PATCH' && window.ActiveXObject &&
!(window.external && window.external.msActiveXFilteringEnabled)) {
params.xhr = function() {
return new ActiveXObject("Microsoft.XMLHTTP");
};
}
// Make the request, allowing the user to override any Ajax options.
var xhr = options.xhr = Backbone.ajax(_.extend(params, options));
model.trigger('request', model, xhr, options);
return xhr;
};
// Map from CRUD to HTTP for our default `Backbone.sync` implementation.
var methodMap = {
'create': 'POST',
'update': 'PUT',
'patch': 'PATCH',
'delete': 'DELETE',
'read': 'GET'
};
// Set the default implementation of `Backbone.ajax` to proxy through to `$`.
// Override this if you'd like to use a different library.
Backbone.ajax = function() {
return Backbone.$.ajax.apply(Backbone.$, arguments);
};
// Backbone.Router
// ---------------
// Routers map faux-URLs to actions, and fire events when routes are
// matched. Creating a new one sets its `routes` hash, if not set statically.
var Router = Backbone.Router = function(options) {
options || (options = {});
if (options.routes) this.routes = options.routes;
this._bindRoutes();
this.initialize.apply(this, arguments);
};
// Cached regular expressions for matching named param parts and splatted
// parts of route strings.
var optionalParam = /\((.*?)\)/g;
var namedParam = /(\(\?)?:\w+/g;
var splatParam = /\*\w+/g;
var escapeRegExp = /[\-{}\[\]+?.,\\\^$|#\s]/g;
// Set up all inheritable **Backbone.Router** properties and methods.
_.extend(Router.prototype, Events, {
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize: function(){},
// Manually bind a single named route to a callback. For example:
//
// this.route('search/:query/p:num', 'search', function(query, num) {
// ...
// });
//
route: function(route, name, callback) {
if (!_.isRegExp(route)) route = this._routeToRegExp(route);
if (_.isFunction(name)) {
callback = name;
name = '';
}
if (!callback) callback = this[name];
var router = this;
Backbone.history.route(route, function(fragment) {
var args = router._extractParameters(route, fragment);
callback && callback.apply(router, args);
router.trigger.apply(router, ['route:' + name].concat(args));
router.trigger('route', name, args);
Backbone.history.trigger('route', router, name, args);
});
return this;
},
// Simple proxy to `Backbone.history` to save a fragment into the history.
navigate: function(fragment, options) {
Backbone.history.navigate(fragment, options);
return this;
},
// Bind all defined routes to `Backbone.history`. We have to reverse the
// order of the routes here to support behavior where the most general
// routes can be defined at the bottom of the route map.
_bindRoutes: function() {
if (!this.routes) return;
this.routes = _.result(this, 'routes');
var route, routes = _.keys(this.routes);
while ((route = routes.pop()) != null) {
this.route(route, this.routes[route]);
}
},
// Convert a route string into a regular expression, suitable for matching
// against the current location hash.
_routeToRegExp: function(route) {
route = route.replace(escapeRegExp, '\\$&')
.replace(optionalParam, '(?:$1)?')
.replace(namedParam, function(match, optional){
return optional ? match : '([^\/]+)';
})
.replace(splatParam, '(.*?)');
return new RegExp('^' + route + '$');
},
// Given a route, and a URL fragment that it matches, return the array of
// extracted decoded parameters. Empty or unmatched parameters will be
// treated as `null` to normalize cross-browser behavior.
_extractParameters: function(route, fragment) {
var params = route.exec(fragment).slice(1);
return _.map(params, function(param) {
return param ? decodeURIComponent(param) : null;
});
}
});
// Backbone.History
// ----------------
// Handles cross-browser history management, based on either
// [pushState](http://diveintohtml5.info/history.html) and real URLs, or
// [onhashchange](https://developer.mozilla.org/en-US/docs/DOM/window.onhashchange)
// and URL fragments. If the browser supports neither (old IE, natch),
// falls back to polling.
var History = Backbone.History = function() {
this.handlers = [];
_.bindAll(this, 'checkUrl');
// Ensure that `History` can be used outside of the browser.
if (typeof window !== 'undefined') {
this.location = window.location;
this.history = window.history;
}
};
// Cached regex for stripping a leading hash/slash and trailing space.
var routeStripper = /^[#\/]|\s+$/g;
// Cached regex for stripping leading and trailing slashes.
var rootStripper = /^\/+|\/+$/g;
// Cached regex for detecting MSIE.
var isExplorer = /msie [\w.]+/;
// Cached regex for removing a trailing slash.
var trailingSlash = /\/$/;
// Has the history handling already been started?
History.started = false;
// Set up all inheritable **Backbone.History** properties and methods.
_.extend(History.prototype, Events, {
// The default interval to poll for hash changes, if necessary, is
// twenty times a second.
interval: 50,
// Gets the true hash value. Cannot use location.hash directly due to bug
// in Firefox where location.hash will always be decoded.
getHash: function(window) {
var match = (window || this).location.href.match(/#(.*)$/);
return match ? match[1] : '';
},
// Get the cross-browser normalized URL fragment, either from the URL,
// the hash, or the override.
getFragment: function(fragment, forcePushState) {
if (fragment == null) {
if (this._hasPushState || !this._wantsHashChange || forcePushState) {
fragment = this.location.pathname;
var root = this.root.replace(trailingSlash, '');
if (!fragment.indexOf(root)) fragment = fragment.substr(root.length);
} else {
fragment = this.getHash();
}
}
return fragment.replace(routeStripper, '');
},
// Start the hash change handling, returning `true` if the current URL matches
// an existing route, and `false` otherwise.
start: function(options) {
if (History.started) throw new Error("Backbone.history has already been started");
History.started = true;
// Figure out the initial configuration. Do we need an iframe?
// Is pushState desired ... is it available?
this.options = _.extend({}, {root: '/'}, this.options, options);
this.root = this.options.root;
this._wantsHashChange = this.options.hashChange !== false;
this._wantsPushState = !!this.options.pushState;
this._hasPushState = !!(this.options.pushState && this.history && this.history.pushState);
var fragment = this.getFragment();
var docMode = document.documentMode;
var oldIE = (isExplorer.exec(navigator.userAgent.toLowerCase()) && (!docMode || docMode <= 7));
// Normalize root to always include a leading and trailing slash.
this.root = ('/' + this.root + '/').replace(rootStripper, '/');
if (oldIE && this._wantsHashChange) {
this.iframe = Backbone.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo('body')[0].contentWindow;
this.navigate(fragment);
}
// Depending on whether we're using pushState or hashes, and whether
// 'onhashchange' is supported, determine how we check the URL state.
if (this._hasPushState) {
Backbone.$(window).on('popstate', this.checkUrl);
} else if (this._wantsHashChange && ('onhashchange' in window) && !oldIE) {
Backbone.$(window).on('hashchange', this.checkUrl);
} else if (this._wantsHashChange) {
this._checkUrlInterval = setInterval(this.checkUrl, this.interval);
}
// Determine if we need to change the base url, for a pushState link
// opened by a non-pushState browser.
this.fragment = fragment;
var loc = this.location;
var atRoot = loc.pathname.replace(/[^\/]$/, '$&/') === this.root;
// If we've started off with a route from a `pushState`-enabled browser,
// but we're currently in a browser that doesn't support it...
if (this._wantsHashChange && this._wantsPushState && !this._hasPushState && !atRoot) {
this.fragment = this.getFragment(null, true);
this.location.replace(this.root + this.location.search + '#' + this.fragment);
// Return immediately as browser will do redirect to new url
return true;
// Or if we've started out with a hash-based route, but we're currently
// in a browser where it could be `pushState`-based instead...
} else if (this._wantsPushState && this._hasPushState && atRoot && loc.hash) {
this.fragment = this.getHash().replace(routeStripper, '');
this.history.replaceState({}, document.title, this.root + this.fragment + loc.search);
}
if (!this.options.silent) return this.loadUrl();
},
// Disable Backbone.history, perhaps temporarily. Not useful in a real app,
// but possibly useful for unit testing Routers.
stop: function() {
Backbone.$(window).off('popstate', this.checkUrl).off('hashchange', this.checkUrl);
clearInterval(this._checkUrlInterval);
History.started = false;
},
// Add a route to be tested when the fragment changes. Routes added later
// may override previous routes.
route: function(route, callback) {
this.handlers.unshift({route: route, callback: callback});
},
// Checks the current URL to see if it has changed, and if it has,
// calls `loadUrl`, normalizing across the hidden iframe.
checkUrl: function(e) {
var current = this.getFragment();
if (current === this.fragment && this.iframe) {
current = this.getFragment(this.getHash(this.iframe));
}
if (current === this.fragment) return false;
if (this.iframe) this.navigate(current);
this.loadUrl() || this.loadUrl(this.getHash());
},
// Attempt to load the current URL fragment. If a route succeeds with a
// match, returns `true`. If no defined routes matches the fragment,
// returns `false`.
loadUrl: function(fragmentOverride) {
var fragment = this.fragment = this.getFragment(fragmentOverride);
var matched = _.any(this.handlers, function(handler) {
if (handler.route.test(fragment)) {
handler.callback(fragment);
return true;
}
});
return matched;
},
// Save a fragment into the hash history, or replace the URL state if the
// 'replace' option is passed. You are responsible for properly URL-encoding
// the fragment in advance.
//
// The options object can contain `trigger: true` if you wish to have the
// route callback be fired (not usually desirable), or `replace: true`, if
// you wish to modify the current URL without adding an entry to the history.
navigate: function(fragment, options) {
if (!History.started) return false;
if (!options || options === true) options = {trigger: options};
fragment = this.getFragment(fragment || '');
if (this.fragment === fragment) return;
this.fragment = fragment;
var url = this.root + fragment;
// If pushState is available, we use it to set the fragment as a real URL.
if (this._hasPushState) {
this.history[options.replace ? 'replaceState' : 'pushState']({}, document.title, url);
// If hash changes haven't been explicitly disabled, update the hash
// fragment to store history.
} else if (this._wantsHashChange) {
this._updateHash(this.location, fragment, options.replace);
if (this.iframe && (fragment !== this.getFragment(this.getHash(this.iframe)))) {
// Opening and closing the iframe tricks IE7 and earlier to push a
// history entry on hash-tag change. When replace is true, we don't
// want this.
if(!options.replace) this.iframe.document.open().close();
this._updateHash(this.iframe.location, fragment, options.replace);
}
// If you've told us that you explicitly don't want fallback hashchange-
// based history, then `navigate` becomes a page refresh.
} else {
return this.location.assign(url);
}
if (options.trigger) this.loadUrl(fragment);
},
// Update the hash location, either replacing the current entry, or adding
// a new one to the browser history.
_updateHash: function(location, fragment, replace) {
if (replace) {
var href = location.href.replace(/(javascript:|#).*$/, '');
location.replace(href + '#' + fragment);
} else {
// Some browsers require that `hash` contains a leading #.
location.hash = '#' + fragment;
}
}
});
// Create the default Backbone.history.
Backbone.history = new History;
// Helpers
// -------
// Helper function to correctly set up the prototype chain, for subclasses.
// Similar to `goog.inherits`, but uses a hash of prototype properties and
// class properties to be extended.
var extend = function(protoProps, staticProps) {
var parent = this;
var child;
// The constructor function for the new subclass is either defined by you
// (the "constructor" property in your `extend` definition), or defaulted
// by us to simply call the parent's constructor.
if (protoProps && _.has(protoProps, 'constructor')) {
child = protoProps.constructor;
} else {
child = function(){ return parent.apply(this, arguments); };
}
// Add static properties to the constructor function, if supplied.
_.extend(child, parent, staticProps);
// Set the prototype chain to inherit from `parent`, without calling
// `parent`'s constructor function.
var Surrogate = function(){ this.constructor = child; };
Surrogate.prototype = parent.prototype;
child.prototype = new Surrogate;
// Add prototype properties (instance properties) to the subclass,
// if supplied.
if (protoProps) _.extend(child.prototype, protoProps);
// Set a convenience property in case the parent's prototype is needed
// later.
child.__super__ = parent.prototype;
return child;
};
// Set up inheritance for the model, collection, router, view and history.
Model.extend = Collection.extend = Router.extend = View.extend = History.extend = extend;
// Throw an error when a URL is needed, and none is supplied.
var urlError = function() {
throw new Error('A "url" property or function must be specified');
};
// Wrap an optional error callback with a fallback error event.
var wrapError = function (model, options) {
var error = options.error;
options.error = function(resp) {
if (error) error(model, resp, options);
model.trigger('error', model, resp, options);
};
};
}).call(this);
|
index.android.js | ontappl/rn | import React from 'react';
import {AppRegistry,} from 'react-native';
import {Provider,} from 'react-redux';
import * as storage from 'redux-storage';
import createStorageEngine from 'redux-storage-engine-reactnativeasyncstorage';
import {initCrashlytics,} from './src/analytics';
import {configureStore,} from './src/configureStore';
import {RootNavigator,} from './src/containers';
import {SplashScreen,} from './src/components';
initCrashlytics();
const store = configureStore();
const storageEngine = createStorageEngine('persistent-storage');
const load = storage.createLoader(storageEngine);
class App extends React.Component {
constructor() {
super();
this.state = {stateIsLoaded: false,};
}
componentDidMount() {
load(store).then(() => this.setState({stateIsLoaded: true,}));
}
render() {
if (!this.state.stateIsLoaded) {
return <SplashScreen/>;
} else {
return (
<Provider store={store}>
<RootNavigator/>
</Provider>
);
}
}
}
AppRegistry.registerComponent('ontaprn', () => App);
|
wisewit_front_end/node_modules/react-router/modules/IndexRedirect.js | emineKoc/WiseWit | import React from 'react'
import warning from './routerWarning'
import invariant from 'invariant'
import Redirect from './Redirect'
import { falsy } from './PropTypes'
const { string, object } = React.PropTypes
/**
* An <IndexRedirect> is used to redirect from an indexRoute.
*/
const IndexRedirect = React.createClass({
statics: {
createRouteFromReactElement(element, parentRoute) {
/* istanbul ignore else: sanity check */
if (parentRoute) {
parentRoute.indexRoute = Redirect.createRouteFromReactElement(element)
} else {
warning(
false,
'An <IndexRedirect> does not make sense at the root of your route config'
)
}
}
},
propTypes: {
to: string.isRequired,
query: object,
state: object,
onEnter: falsy,
children: falsy
},
/* istanbul ignore next: sanity check */
render() {
invariant(
false,
'<IndexRedirect> elements are for router configuration only and should not be rendered'
)
}
})
export default IndexRedirect
|
frontend/src/components/Filters.js | OwenRay/Remote-MediaServer | import React, { Component } from 'react';
/* global $ */
import { Button, Col, Input, Row, SideNav, Autocomplete } from 'react-materialize';
import { Handle, Range } from 'rc-slider';
import 'rc-slider/assets/index.css';
let genres = [];
class ButtonMenu extends Component {
constructor() {
super();
if (!genres.length) { $.getJSON('/api/tmdb/genres', this.genresLoaded.bind(this)); }
this.onChange = this.onChange.bind(this);
this.onValueChange = this.onValueChange.bind(this);
this.hideSideNav = this.hideSideNav.bind(this);
this.resetFilters = this.resetFilters.bind(this);
this.state = { filters: {}, genres };
}
genresLoaded(o) {
genres = o;
this.setState({ genres });
}
componentWillReceiveProps(props) {
const f = {};
Object.keys(props.filters).forEach((key) => {
if (['false', 'true'].includes(props.filters[key])) {
f[key] = props.filters[key] === 'true';
} else {
f[key] = props.filters[key];
}
});
this.setState({ filters: f});
}
onValueChange(name, value) {
const o = this.state;
if (name === 'fileduration') {
value = value.map(v => v * 60);
}
o.filters[name] = Array.isArray(value) ? value.join('><') : value;
this.setState(o);
if (this.props.onChange) {
this.props.onChange(o.filters);
}
}
onChange(e) {
const o = this.state;
o.filters[e.target.name] = e.target.value;
if (o.filters[e.target.name] === '') {
delete o.filters[e.target.name];
}
this.setState(o);
if (this.props.onChange) {
this.props.onChange(o.filters);
}
}
hideSideNav() {
$(this.sideNav).sideNav('hide');
}
handle(props) {
props.dragging += '';
return (
<Handle key={`handle${props.className}`} {...props} >
{props.dragging !== 'false' ? <span>{props.value}</span> : ''}
</Handle>
);
}
resetFilters() {
this.setState({ filters: {} });
this.props.onChange(null);
this.hideSideNav();
}
content() {
const f = this.state.filters;
const fv = this.props.filterValues;
if (!f || !fv) {
return null;
}
const rangeValue = f['vote-average'] ?
f['vote-average'].split('><').map(v => parseFloat(v)) :
[1, 10];
const timeValue = f.fileduration ?
f.fileduration.split('><').map(v => parseInt(v, 10) / 60) :
[0, 300];
const yearValue = f.year ?
f.year.split('><').map(v => parseInt(v, 10)) :
[1900, new Date().getFullYear()];
const actorsData = {};
fv.actors.forEach((actor) => { actorsData[actor] = null; });
return (
<div>
<div className="top">
<Row>
<Input
value={`${f['play-position.watched']}`}
type="select"
label="Watched"
name="play-position.watched"
onChange={this.onChange}
>
<option value="">Watched & unwatched</option>
<option value="true">Watched only</option>
<option value="false">Unwatched only</option>
</Input>
</Row>
<Row>
<Input
value={f['genre-ids']}
name="genre-ids"
type="select"
label="Genre"
onChange={this.onChange}
>
<option value="">All</option>
{this.state.genres.map(genre => <option key={genre.id} value={genre.id}>{genre.name}</option>)}
</Input>
</Row>
<Row>
<Input
value={f.mpaa}
name="mpaa"
type="select"
label="Age rating"
onChange={this.onChange}
>
<option value="">All</option>
{fv.mpaa.map(rating => <option key={rating} value={rating}>{rating}</option>)}
</Input>
</Row>
<Row>
<Autocomplete
value={f.actors}
name="actors"
type="select"
title="Actors"
onAutocomplete={val => this.onValueChange('actors', val)}
data={actorsData}
/>
</Row>
<Row>
<label>Rating</label>
<Range
handle={this.handle}
step={0.1}
onChange={v => this.onValueChange('vote-average', v)}
value={rangeValue}
min={1}
max={10}
/>
</Row>
<Row>
<label>Runtime</label>
<Range
handle={this.handle}
step={1}
onChange={v => this.onValueChange('fileduration', v)}
value={timeValue}
min={0}
max={300}
/>
</Row>
<Row>
<label>Year</label>
<Range
handle={this.handle}
step={1}
onChange={v => this.onValueChange('year', v)}
value={yearValue}
min={1900}
max={new Date().getFullYear()}
/>
</Row>
</div>
<Row>
<Col s={6}>
<Button onClick={this.hideSideNav}>Close</Button>
</Col>
<Col s={6}>
<Button onClick={this.resetFilters}>Reset</Button>
</Col>
</Row>
</div>
);
}
render() {
return (
<SideNav
ref={(ref) => { this.sideNav = ref; }}
trigger={<Button className="bottom-right-fab" floating icon="tune" />}
options={{
edge: 'right',
draggable: true,
}}
>
{this.content()}
</SideNav>
);
}
}
export default ButtonMenu;
|
src/components/Header/Header.js | jifeon/react-starter-kit | /*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */
import React from 'react';
import styles from './Header.css';
import withStyles from '../../decorators/withStyles';
import Link from '../../utils/Link';
import Navigation from '../Navigation';
@withStyles(styles)
class Header {
render() {
return (
<div className="Header">
<div className="Header-container">
<a className="Header-brand" href="/" onClick={Link.handleClick}>
<img className="Header-brandImg" src={require('./logo-small.png')} width="38" height="38" alt="React" />
<span className="Header-brandTxt">Your Company</span>
</a>
<Navigation className="Header-nav" />
<div className="Header-banner">
<h1 className="Header-bannerTitle">React</h1>
<p className="Header-bannerDesc">Complex web apps made easy</p>
</div>
</div>
</div>
);
}
}
export default Header;
|
app/src/components/FeedListItem.js | GetStream/Winds | import React from 'react';
import PropTypes from 'prop-types';
import { Img } from 'react-image';
import { Link } from 'react-router-dom';
import TimeAgo from './TimeAgo';
import getPlaceholderImageURL from '../util/getPlaceholderImageURL';
import { ReactComponent as NoteIcon } from '../images/icons/note.svg';
import { ReactComponent as BookmarkIcon } from '../images/icons/bookmark.svg';
import { ReactComponent as BookmarkedIcon } from '../images/icons/bookmarked.svg';
import { ReactComponent as PenIcon } from '../images/icons/pen.svg';
import { ReactComponent as TagIcon } from '../images/icons/tag-simple.svg';
import { ReactComponent as PauseIcon } from '../images/icons/pause.svg';
import { ReactComponent as PlayIcon } from '../images/icons/play.svg';
class FeedListItem extends React.Component {
render() {
const {
_id,
title,
images,
link,
description,
feedTitle,
publicationDate,
pinID,
pin,
unpin,
onNavigation,
notes,
highlights,
tags,
recent,
} = this.props;
const { inPlayer, isPlaying, playable, playOrPauseEpisode } = this.props;
return (
<Link
className="feed-list-item"
onClick={() => onNavigation && onNavigation()}
to={link}
>
<div
className="left"
onClick={(e) => {
if (playable) {
e.stopPropagation();
e.preventDefault();
playOrPauseEpisode();
}
}}
>
<Img
height="100"
loader={<div className="placeholder" />}
src={[images.og, getPlaceholderImageURL(_id)]}
width="100"
/>
{playable && (
<div className={inPlayer ? 'pause-icon' : 'play-icon'}>
<div className="icon-container">
{inPlayer && isPlaying ? <PauseIcon /> : <PlayIcon />}
</div>
</div>
)}
{recent && <div className="recent-indicator" />}
</div>
<div className="right">
<h2>{title}</h2>
<div className="item-action">
<span
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
pinID ? unpin() : pin();
}}
>
{pinID ? <BookmarkedIcon /> : <BookmarkIcon />}
</span>
<span>
<NoteIcon /> {notes} Note
{notes > 1 && 's'}
</span>
<span>
<PenIcon /> {highlights} Highlight
{highlights > 1 && 's'}
</span>
<span>
<TagIcon /> {tags} Tag
{tags > 1 && 's'}
</span>
</div>
<div className="item-info">
<span>{feedTitle}</span>
<span className="muted">
{'Posted '}
<TimeAgo timestamp={publicationDate} />
</span>
</div>
<div className="description">{description}</div>
</div>
</Link>
);
}
}
FeedListItem.defaultProps = {
images: {},
};
FeedListItem.propTypes = {
_id: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
description: PropTypes.string,
publicationDate: PropTypes.string,
feedTitle: PropTypes.string,
link: PropTypes.string,
images: PropTypes.shape({ og: PropTypes.string }),
onNavigation: PropTypes.func,
pin: PropTypes.func,
unpin: PropTypes.func,
pinID: PropTypes.string,
recent: PropTypes.bool,
notes: PropTypes.number,
highlights: PropTypes.number,
tags: PropTypes.number,
playOrPauseEpisode: PropTypes.func,
playable: PropTypes.bool,
inPlayer: PropTypes.bool,
isPlaying: PropTypes.bool,
};
export default FeedListItem;
|
donate/src/app.js | Interaktivtechnology/sfdemo-node | import ReactDOM from 'react-dom';
import React from 'react';
import { Provider } from 'react-redux';
import { persistStore } from 'redux-persist';
import App from './components/app';
import configureStore from './configureStore';
import './app.css';
import './static/style.scss';
const store = configureStore({});
persistStore(store, {
}, () => {
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('react'),
);
});
|
files/yasqe/2.1.0/yasqe.bundled.min.js | jonataswalker/jsdelivr | !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.YASQE=e()}}(function(){var e;return function t(e,r,i){function n(s,a){if(!r[s]){if(!e[s]){var l="function"==typeof require&&require;if(!a&&l)return l(s,!0);if(o)return o(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var p=r[s]={exports:{}};e[s][0].call(p.exports,function(t){var r=e[s][1][t];return n(r?r:t)},p,p.exports,t,e,r,i)}return r[s].exports}for(var o="function"==typeof require&&require,s=0;s<i.length;s++)n(i[s]);return n}({1:[function(e,t){"use strict";window.console=window.console||{log:function(){}};var r=e("jquery"),i=e("codemirror"),n=(e("./sparql.js"),e("./utils.js")),o=e("yasgui-utils"),s=e("./imgs.js");e("../lib/deparam.js"),e("codemirror/addon/hint/show-hint.js"),e("codemirror/addon/search/searchcursor.js"),e("codemirror/addon/edit/matchbrackets.js"),e("codemirror/addon/runmode/runmode.js"),e("codemirror/addon/display/fullscreen.js"),e("../lib/flint.js");var a=t.exports=function(e,t){t=l(t);var r=u(i(e,t));return d(r),r},l=function(e){var t=r.extend(!0,{},a.defaults,e);return t},u=function(t){return r(t.getWrapperElement()).addClass("yasqe"),t.autocompleters=e("./autocompleters/autocompleterBase.js")(t),t.options.autocompleters&&t.options.autocompleters.forEach(function(e){YASQE.Autocompleters[e]&&t.autocompleters.init(e,YASQE.Autocompleters[e])}),t.getCompleteToken=function(r,i){return e("./tokenUtils.js").getCompleteToken(t,r,i)},t.getPreviousNonWsToken=function(r,i){return e("./tokenUtils.js").getPreviousNonWsToken(t,r,i)},t.getNextNonWsToken=function(r,i){return e("./tokenUtils.js").getNextNonWsToken(t,r,i)},t.query=function(e){a.executeQuery(t,e)},t.getPrefixesFromQuery=function(){return e("./prefixUtils.js").getPrefixesFromQuery(t)},t.addPrefixes=function(r){return e("./prefixUtils.js").addPrefixes(t,r)},t.removePrefixes=function(r){return e("./prefixUtils.js").removePrefixes(t,r)},t.getQueryType=function(){return t.queryType},t.getQueryMode=function(){var e=t.getQueryType();return"INSERT"==e||"DELETE"==e||"LOAD"==e||"CLEAR"==e||"CREATE"==e||"DROP"==e||"COPY"==e||"MOVE"==e||"ADD"==e?"update":"query"},t.setCheckSyntaxErrors=function(e){t.options.syntaxErrorCheck=e,f(t)},t.enableCompleter=function(e){p(t.options,e)},t.disableCompleter=function(e){c(t.options,e)},t},p=function(e,t){e.autocompleters||(e.autocompleters=[]),e.autocompleters.push(t)},c=function(e,t){if("object"==typeof e.autocompleters){var i=r.inArray(t,e.autocompleters);i>=0&&(e.autocompleters.splice(i,1),c(e,t))}},d=function(e){var t=n.getPersistencyId(e,e.options.persistent);if(t){var i=o.storage.get(t);i&&e.setValue(i)}if(a.drawButtons(e),e.on("blur",function(e){a.storeQuery(e)}),e.on("change",function(e){f(e),a.updateQueryButton(e),a.positionButtons(e)}),e.on("cursorActivity",function(e){h(e)}),e.prevQueryValid=!1,f(e),a.positionButtons(e),e.options.consumeShareLink){var s=r.deparam(window.location.search.substring(1));e.options.consumeShareLink(e,s)}},h=function(e){e.cursor=r(".CodeMirror-cursor"),e.buttons&&e.buttons.is(":visible")&&e.cursor.length>0&&(n.elementsOverlap(e.cursor,e.buttons)?e.buttons.find("svg").attr("opacity","0.2"):e.buttons.find("svg").attr("opacity","1.0"))},E=null,f=function(t,i){t.queryValid=!0,E&&(E(),E=null),t.clearGutter("gutterErrorBar");for(var n=null,a=0;a<t.lineCount();++a){var l=!1;t.prevQueryValid||(l=!0);var u=t.getTokenAt({line:a,ch:t.getLine(a).length},l),n=u.state;if(t.queryType=n.queryType,0==n.OK){if(!t.options.syntaxErrorCheck)return void r(t.getWrapperElement).find(".sp-error").css("color","black");var p=o.svg.getElement(s.warning,{width:"15px",height:"15px"});n.possibleCurrent&&n.possibleCurrent.length>0&&(p.style.zIndex="99999999",e("./tooltip")(t,p,function(){var e=[];return n.possibleCurrent.forEach(function(t){e.push("<strong style='text-decoration:underline'>"+r("<div/>").text(t).html()+"</strong>")}),"This line is invalid. Expected: "+e.join(", ")})),p.style.marginTop="2px",p.style.marginLeft="2px",t.setGutterMarker(a,"gutterErrorBar",p),E=function(){t.markText({line:a,ch:n.errorStartPos},{line:a,ch:n.errorEndPos},"sp-error")},t.queryValid=!1;break}}if(t.prevQueryValid=t.queryValid,i&&null!=n&&void 0!=n.stack){var c=n.stack,d=n.stack.length;d>1?t.queryValid=!1:1==d&&"solutionModifier"!=c[0]&&"?limitOffsetClauses"!=c[0]&&"?offsetClause"!=c[0]&&(t.queryValid=!1)}};r.extend(a,i),e("./defaults.js").use(a),a.Autocompleters={},a.registerAutocompleter=function(e,t){a.Autocompleters[e]=t,p(a.defaults,e)},a.autoComplete=function(e){e.autocompleters.autoComplete(!1)},a.registerAutocompleter("prefixes",e("./autocompleters/prefixes.js")),a.registerAutocompleter("properties",e("./autocompleters/properties.js")),a.registerAutocompleter("classes",e("./autocompleters/classes.js")),a.registerAutocompleter("variables",e("./autocompleters/variables.js")),a.positionButtons=function(e){var t=r(e.getWrapperElement()).find(".CodeMirror-vscrollbar"),i=0;t.is(":visible")&&(i=t.outerWidth()),e.buttons.is(":visible")&&e.buttons.css("right",i)},a.createShareLink=function(e){return{query:e.getValue()}},a.consumeShareLink=function(e,t){t.query&&e.setValue(t.query)},a.drawButtons=function(e){if(e.buttons=r("<div class='yasqe_buttons'></div>").appendTo(r(e.getWrapperElement())),e.options.createShareLink){var t=r(o.svg.getElement(s.share,{width:"30px",height:"30px"}));t.click(function(i){i.stopPropagation();var n=r("<div class='yasqe_sharePopup'></div>").appendTo(e.buttons);r("html").click(function(){n&&n.remove()}),n.click(function(e){e.stopPropagation()});var o=r("<textarea></textarea>").val(location.protocol+"//"+location.host+location.pathname+"?"+r.param(e.options.createShareLink(e)));o.focus(function(){var e=r(this);e.select(),e.mouseup(function(){return e.unbind("mouseup"),!1})}),n.empty().append(o);var s=t.position();n.css("top",s.top+t.outerHeight()+"px").css("left",s.left+t.outerWidth()-n.outerWidth()+"px")}).addClass("yasqe_share").attr("title","Share your query").appendTo(e.buttons)}if(e.options.sparql.showQueryButton){var i=40,n=40;r("<div class='yasqe_queryButton'></div>").click(function(){r(this).hasClass("query_busy")?(e.xhr&&e.xhr.abort(),a.updateQueryButton(e)):e.query()}).height(i).width(n).appendTo(e.buttons),a.updateQueryButton(e)}};var m={busy:"loader",valid:"query",error:"queryInvalid"};a.updateQueryButton=function(e,t){var i=r(e.getWrapperElement()).find(".yasqe_queryButton");0!=i.length&&(t||(t="valid",e.queryValid===!1&&(t="error")),t==e.queryStatus||"busy"!=t&&"valid"!=t&&"error"!=t||(i.empty().removeClass(function(e,t){return t.split(" ").filter(function(e){return 0==e.indexOf("query_")}).join(" ")}).addClass("query_"+t).append(o.svg.getElement(s[m[t]],{width:"100%",height:"100%"})),e.queryStatus=t))},a.fromTextArea=function(e,t){t=l(t);var r=u(i.fromTextArea(e,t));return d(r),r},a.storeQuery=function(e){var t=n.getPersistencyId(e,e.options.persistent);t&&o.storage.set(t,e.getValue(),"month")},a.commentLines=function(e){for(var t=e.getCursor(!0).line,r=e.getCursor(!1).line,i=Math.min(t,r),n=Math.max(t,r),o=!0,s=i;n>=s;s++){var a=e.getLine(s);if(0==a.length||"#"!=a.substring(0,1)){o=!1;break}}for(var s=i;n>=s;s++)o?e.replaceRange("",{line:s,ch:0},{line:s,ch:1}):e.replaceRange("#",{line:s,ch:0})},a.copyLineUp=function(e){var t=e.getCursor(),r=e.lineCount();e.replaceRange("\n",{line:r-1,ch:e.getLine(r-1).length});for(var i=r;i>t.line;i--){var n=e.getLine(i-1);e.replaceRange(n,{line:i,ch:0},{line:i,ch:e.getLine(i).length})}},a.copyLineDown=function(e){a.copyLineUp(e);var t=e.getCursor();t.line++,e.setCursor(t)},a.doAutoFormat=function(e){if(e.somethingSelected()){var t={line:e.getCursor(!1).line,ch:e.getSelection().length};g(e,e.getCursor(!0),t)}else{var r=e.lineCount(),i=e.getTextArea().value.length;g(e,{line:0,ch:0},{line:r,ch:i})}};var g=function(e,t,r){var i=e.indexFromPos(t),n=e.indexFromPos(r),o=v(e.getValue(),i,n);e.operation(function(){e.replaceRange(o,t,r);for(var n=e.posFromIndex(i).line,s=e.posFromIndex(i+o.length).line,a=n;s>=a;a++)e.indentLine(a,"smart")})},v=function(e,t,n){e=e.substring(t,n);var o=[["keyword","ws","prefixed","ws","uri"],["keyword","ws","uri"]],s=["{",".",";"],a=["}"],l=function(e){for(var t=0;t<o.length;t++)if(c.valueOf().toString()==o[t].valueOf().toString())return 1;for(var t=0;t<s.length;t++)if(e==s[t])return 1;for(var t=0;t<a.length;t++)if(""!=r.trim(p)&&e==a[t])return-1;return 0},u="",p="",c=[];return i.runMode(e,"sparql11",function(e,t){c.push(t);var r=l(e,t);0!=r?(1==r?(u+=e+"\n",p=""):(u+="\n"+e,p=e),c=[]):(p+=e,u+=e),1==c.length&&"sp-ws"==c[0]&&(c=[])}),r.trim(u.replace(/\n\s*\n/g,"\n"))};e("./sparql.js").use(a),a.version={CodeMirror:i.version,YASQE:e("../package.json").version,jquery:r.fn.jquery,"yasgui-utils":o.version}},{"../lib/deparam.js":2,"../lib/flint.js":3,"../package.json":17,"./autocompleters/autocompleterBase.js":18,"./autocompleters/classes.js":19,"./autocompleters/prefixes.js":20,"./autocompleters/properties.js":21,"./autocompleters/variables.js":23,"./defaults.js":24,"./imgs.js":25,"./prefixUtils.js":26,"./sparql.js":27,"./tokenUtils.js":28,"./tooltip":29,"./utils.js":30,codemirror:10,"codemirror/addon/display/fullscreen.js":5,"codemirror/addon/edit/matchbrackets.js":6,"codemirror/addon/hint/show-hint.js":7,"codemirror/addon/runmode/runmode.js":8,"codemirror/addon/search/searchcursor.js":9,jquery:11,"yasgui-utils":14}],2:[function(e){var t=e("jquery");t.deparam=function(e,r){var i={},n={"true":!0,"false":!1,"null":null};return t.each(e.replace(/\+/g," ").split("&"),function(e,o){var s,a=o.split("="),l=decodeURIComponent(a[0]),u=i,p=0,c=l.split("]["),d=c.length-1;if(/\[/.test(c[0])&&/\]$/.test(c[d])?(c[d]=c[d].replace(/\]$/,""),c=c.shift().split("[").concat(c),d=c.length-1):d=0,2===a.length)if(s=decodeURIComponent(a[1]),r&&(s=s&&!isNaN(s)?+s:"undefined"===s?void 0:void 0!==n[s]?n[s]:s),d)for(;d>=p;p++)l=""===c[p]?u.length:c[p],u=u[l]=d>p?u[l]||(c[p+1]&&isNaN(c[p+1])?{}:[]):s;else t.isArray(i[l])?i[l].push(s):i[l]=void 0!==i[l]?[i[l],s]:s;else l&&(i[l]=r?void 0:"")}),i}},{jquery:11}],3:[function(t,r,i){!function(n){"object"==typeof i&&"object"==typeof r?n(t("codemirror")):"function"==typeof e&&e.amd?e(["codemirror"],n):n(CodeMirror)}(function(e){"use strict";e.defineMode("sparql11",function(e){function t(){var e,t,r="<[^<>\"'|{}^\\\x00- ]*>",i="[A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]",n=i+"|_",o="("+n+"|-|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040])",s="("+n+"|[0-9])("+n+"|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040])*",a="\\?"+s,l="\\$"+s,p="("+i+")((("+o+")|\\.)*("+o+"))?",c="[0-9A-Fa-f]",d="(%"+c+c+")",h="(\\\\[_~\\.\\-!\\$&'\\(\\)\\*\\+,;=/\\?#@%])",E="("+d+"|"+h+")";"sparql11"==u?(e="("+n+"|:|[0-9]|"+E+")(("+o+"|\\.|:|"+E+")*("+o+"|:|"+E+"))?",t="_:("+n+"|[0-9])(("+o+"|\\.)*"+o+")?"):(e="("+n+"|[0-9])((("+o+")|\\.)*("+o+"))?",t="_:"+e);var f="("+p+")?:",m=f+e,g="@[a-zA-Z]+(-[a-zA-Z0-9]+)*",v="[eE][\\+-]?[0-9]+",x="[0-9]+",N="(([0-9]+\\.[0-9]*)|(\\.[0-9]+))",L="(([0-9]+\\.[0-9]*"+v+")|(\\.[0-9]+"+v+")|([0-9]+"+v+"))",T="\\+"+x,I="\\+"+N,y="\\+"+L,A="-"+x,S="-"+N,C="-"+L,R="\\\\[tbnrf\\\\\"']",b="'(([^\\x27\\x5C\\x0A\\x0D])|"+R+")*'",O='"(([^\\x22\\x5C\\x0A\\x0D])|'+R+')*"',P="'''(('|'')?([^'\\\\]|"+R+"))*'''",D='"""(("|"")?([^"\\\\]|'+R+'))*"""',_="[\\x20\\x09\\x0D\\x0A]",M="#([^\\n\\r]*[\\n\\r]|[^\\n\\r]*$)",w="("+_+"|("+M+"))*",G="\\("+w+"\\)",k="\\["+w+"\\]",B={terminal:[{name:"WS",regex:new RegExp("^"+_+"+"),style:"ws"},{name:"COMMENT",regex:new RegExp("^"+M),style:"comment"},{name:"IRI_REF",regex:new RegExp("^"+r),style:"variable-3"},{name:"VAR1",regex:new RegExp("^"+a),style:"atom"},{name:"VAR2",regex:new RegExp("^"+l),style:"atom"},{name:"LANGTAG",regex:new RegExp("^"+g),style:"meta"},{name:"DOUBLE",regex:new RegExp("^"+L),style:"number"},{name:"DECIMAL",regex:new RegExp("^"+N),style:"number"},{name:"INTEGER",regex:new RegExp("^"+x),style:"number"},{name:"DOUBLE_POSITIVE",regex:new RegExp("^"+y),style:"number"},{name:"DECIMAL_POSITIVE",regex:new RegExp("^"+I),style:"number"},{name:"INTEGER_POSITIVE",regex:new RegExp("^"+T),style:"number"},{name:"DOUBLE_NEGATIVE",regex:new RegExp("^"+C),style:"number"},{name:"DECIMAL_NEGATIVE",regex:new RegExp("^"+S),style:"number"},{name:"INTEGER_NEGATIVE",regex:new RegExp("^"+A),style:"number"},{name:"STRING_LITERAL_LONG1",regex:new RegExp("^"+P),style:"string"},{name:"STRING_LITERAL_LONG2",regex:new RegExp("^"+D),style:"string"},{name:"STRING_LITERAL1",regex:new RegExp("^"+b),style:"string"},{name:"STRING_LITERAL2",regex:new RegExp("^"+O),style:"string"},{name:"NIL",regex:new RegExp("^"+G),style:"punc"},{name:"ANON",regex:new RegExp("^"+k),style:"punc"},{name:"PNAME_LN",regex:new RegExp("^"+m),style:"string-2"},{name:"PNAME_NS",regex:new RegExp("^"+f),style:"string-2"},{name:"BLANK_NODE_LABEL",regex:new RegExp("^"+t),style:"string-2"}]};return B}function r(e){var t=[],r=o[e];if(void 0!=r)for(var i in r)t.push(i.toString());else t.push(e);return t}function i(e,t){function i(){for(var t=null,r=0;r<h.length;++r)if(t=e.match(h[r].regex,!0,!1))return{cat:h[r].name,style:h[r].style,text:t[0]};return(t=e.match(s,!0,!1))?{cat:e.current().toUpperCase(),style:"keyword",text:t[0]}:(t=e.match(a,!0,!1))?{cat:e.current(),style:"punc",text:t[0]}:(t=e.match(/^.[A-Za-z0-9]*/,!0,!1),{cat:"<invalid_token>",style:"error",text:t[0]})}function n(){var r=e.column();t.errorStartPos=r,t.errorEndPos=r+c.text.length}function l(e){null==t.queryType&&("SELECT"==e||"CONSTRUCT"==e||"ASK"==e||"DESCRIBE"==e||"INSERT"==e||"DELETE"==e||"LOAD"==e||"CLEAR"==e||"CREATE"==e||"DROP"==e||"COPY"==e||"MOVE"==e||"ADD"==e)&&(t.queryType=e)}function u(e){"disallowVars"==e?t.allowVars=!1:"allowVars"==e?t.allowVars=!0:"disallowBnodes"==e?t.allowBnodes=!1:"allowBnodes"==e?t.allowBnodes=!0:"storeProperty"==e&&(t.storeProperty=!0)}function p(e){return(t.allowVars||"var"!=e)&&(t.allowBnodes||"blankNode"!=e&&"blankNodePropertyList"!=e&&"blankNodePropertyListPath"!=e)}0==e.pos&&(t.possibleCurrent=t.possibleNext);var c=i();if("<invalid_token>"==c.cat)return 1==t.OK&&(t.OK=!1,n()),t.complete=!1,c.style;if("WS"==c.cat||"COMMENT"==c.cat)return t.possibleCurrent=t.possibleNext,c.style;for(var d,E=!1,f=c.cat;t.stack.length>0&&f&&t.OK&&!E;)if(d=t.stack.pop(),o[d]){var m=o[d][f];if(void 0!=m&&p(d)){for(var g=m.length-1;g>=0;--g)t.stack.push(m[g]);u(d)}else t.OK=!1,t.complete=!1,n(),t.stack.push(d)}else if(d==f){E=!0,l(d);for(var v=!0,x=t.stack.length;x>0;--x){var N=o[t.stack[x-1]];N&&N.$||(v=!1)}t.complete=v,t.storeProperty&&"punc"!=f.cat&&(t.lastProperty=c.text,t.storeProperty=!1)}else t.OK=!1,t.complete=!1,n();return!E&&t.OK&&(t.OK=!1,t.complete=!1,n()),t.possibleCurrent=t.possibleNext,t.possibleNext=r(t.stack[t.stack.length-1]),c.style}function n(t,r){var i=0,n=t.stack.length-1;if(/^[\}\]\)]/.test(r)){for(var o=r.substr(0,1);n>=0;--n)if(t.stack[n]==o){--n;break}}else{var s=E[t.stack[n]];s&&(i+=s,--n)}for(;n>=0;--n){var s=f[t.stack[n]];s&&(i+=s)}return i*e.indentUnit}var o=(e.indentUnit,{"*[&&,valueLogical]":{"&&":["[&&,valueLogical]","*[&&,valueLogical]"],AS:[],")":[],",":[],"||":[],";":[]},"*[,,expression]":{",":["[,,expression]","*[,,expression]"],")":[]},"*[,,objectPath]":{",":["[,,objectPath]","*[,,objectPath]"],".":[],";":[],"]":[],"{":[],OPTIONAL:[],MINUS:[],GRAPH:[],SERVICE:[],FILTER:[],BIND:[],VALUES:[],"}":[]},"*[,,object]":{",":["[,,object]","*[,,object]"],".":[],";":[],"]":[],"}":[],GRAPH:[],"{":[],OPTIONAL:[],MINUS:[],SERVICE:[],FILTER:[],BIND:[],VALUES:[]},"*[/,pathEltOrInverse]":{"/":["[/,pathEltOrInverse]","*[/,pathEltOrInverse]"],"|":[],")":[],"(":[],"[":[],VAR1:[],VAR2:[],NIL:[],IRI_REF:[],TRUE:[],FALSE:[],BLANK_NODE_LABEL:[],ANON:[],PNAME_LN:[],PNAME_NS:[],STRING_LITERAL1:[],STRING_LITERAL2:[],STRING_LITERAL_LONG1:[],STRING_LITERAL_LONG2:[],INTEGER:[],DECIMAL:[],DOUBLE:[],INTEGER_POSITIVE:[],DECIMAL_POSITIVE:[],DOUBLE_POSITIVE:[],INTEGER_NEGATIVE:[],DECIMAL_NEGATIVE:[],DOUBLE_NEGATIVE:[]},"*[;,?[or([verbPath,verbSimple]),objectList]]":{";":["[;,?[or([verbPath,verbSimple]),objectList]]","*[;,?[or([verbPath,verbSimple]),objectList]]"],".":[],"]":[],"{":[],OPTIONAL:[],MINUS:[],GRAPH:[],SERVICE:[],FILTER:[],BIND:[],VALUES:[],"}":[]},"*[;,?[verb,objectList]]":{";":["[;,?[verb,objectList]]","*[;,?[verb,objectList]]"],".":[],"]":[],"}":[],GRAPH:[],"{":[],OPTIONAL:[],MINUS:[],SERVICE:[],FILTER:[],BIND:[],VALUES:[]},"*[UNION,groupGraphPattern]":{UNION:["[UNION,groupGraphPattern]","*[UNION,groupGraphPattern]"],VAR1:[],VAR2:[],NIL:[],"(":[],"[":[],IRI_REF:[],TRUE:[],FALSE:[],BLANK_NODE_LABEL:[],ANON:[],PNAME_LN:[],PNAME_NS:[],STRING_LITERAL1:[],STRING_LITERAL2:[],STRING_LITERAL_LONG1:[],STRING_LITERAL_LONG2:[],INTEGER:[],DECIMAL:[],DOUBLE:[],INTEGER_POSITIVE:[],DECIMAL_POSITIVE:[],DOUBLE_POSITIVE:[],INTEGER_NEGATIVE:[],DECIMAL_NEGATIVE:[],DOUBLE_NEGATIVE:[],".":[],"{":[],OPTIONAL:[],MINUS:[],GRAPH:[],SERVICE:[],FILTER:[],BIND:[],VALUES:[],"}":[]},"*[graphPatternNotTriples,?.,?triplesBlock]":{"{":["[graphPatternNotTriples,?.,?triplesBlock]","*[graphPatternNotTriples,?.,?triplesBlock]"],OPTIONAL:["[graphPatternNotTriples,?.,?triplesBlock]","*[graphPatternNotTriples,?.,?triplesBlock]"],MINUS:["[graphPatternNotTriples,?.,?triplesBlock]","*[graphPatternNotTriples,?.,?triplesBlock]"],GRAPH:["[graphPatternNotTriples,?.,?triplesBlock]","*[graphPatternNotTriples,?.,?triplesBlock]"],SERVICE:["[graphPatternNotTriples,?.,?triplesBlock]","*[graphPatternNotTriples,?.,?triplesBlock]"],FILTER:["[graphPatternNotTriples,?.,?triplesBlock]","*[graphPatternNotTriples,?.,?triplesBlock]"],BIND:["[graphPatternNotTriples,?.,?triplesBlock]","*[graphPatternNotTriples,?.,?triplesBlock]"],VALUES:["[graphPatternNotTriples,?.,?triplesBlock]","*[graphPatternNotTriples,?.,?triplesBlock]"],"}":[]},"*[quadsNotTriples,?.,?triplesTemplate]":{GRAPH:["[quadsNotTriples,?.,?triplesTemplate]","*[quadsNotTriples,?.,?triplesTemplate]"],"}":[]},"*[|,pathOneInPropertySet]":{"|":["[|,pathOneInPropertySet]","*[|,pathOneInPropertySet]"],")":[]},"*[|,pathSequence]":{"|":["[|,pathSequence]","*[|,pathSequence]"],")":[],"(":[],"[":[],VAR1:[],VAR2:[],NIL:[],IRI_REF:[],TRUE:[],FALSE:[],BLANK_NODE_LABEL:[],ANON:[],PNAME_LN:[],PNAME_NS:[],STRING_LITERAL1:[],STRING_LITERAL2:[],STRING_LITERAL_LONG1:[],STRING_LITERAL_LONG2:[],INTEGER:[],DECIMAL:[],DOUBLE:[],INTEGER_POSITIVE:[],DECIMAL_POSITIVE:[],DOUBLE_POSITIVE:[],INTEGER_NEGATIVE:[],DECIMAL_NEGATIVE:[],DOUBLE_NEGATIVE:[]},"*[||,conditionalAndExpression]":{"||":["[||,conditionalAndExpression]","*[||,conditionalAndExpression]"],AS:[],")":[],",":[],";":[]},"*dataBlockValue":{UNDEF:["dataBlockValue","*dataBlockValue"],IRI_REF:["dataBlockValue","*dataBlockValue"],TRUE:["dataBlockValue","*dataBlockValue"],FALSE:["dataBlockValue","*dataBlockValue"],PNAME_LN:["dataBlockValue","*dataBlockValue"],PNAME_NS:["dataBlockValue","*dataBlockValue"],STRING_LITERAL1:["dataBlockValue","*dataBlockValue"],STRING_LITERAL2:["dataBlockValue","*dataBlockValue"],STRING_LITERAL_LONG1:["dataBlockValue","*dataBlockValue"],STRING_LITERAL_LONG2:["dataBlockValue","*dataBlockValue"],INTEGER:["dataBlockValue","*dataBlockValue"],DECIMAL:["dataBlockValue","*dataBlockValue"],DOUBLE:["dataBlockValue","*dataBlockValue"],INTEGER_POSITIVE:["dataBlockValue","*dataBlockValue"],DECIMAL_POSITIVE:["dataBlockValue","*dataBlockValue"],DOUBLE_POSITIVE:["dataBlockValue","*dataBlockValue"],INTEGER_NEGATIVE:["dataBlockValue","*dataBlockValue"],DECIMAL_NEGATIVE:["dataBlockValue","*dataBlockValue"],DOUBLE_NEGATIVE:["dataBlockValue","*dataBlockValue"],"}":[],")":[]},"*datasetClause":{FROM:["datasetClause","*datasetClause"],WHERE:[],"{":[]},"*describeDatasetClause":{FROM:["describeDatasetClause","*describeDatasetClause"],ORDER:[],HAVING:[],GROUP:[],LIMIT:[],OFFSET:[],WHERE:[],"{":[],VALUES:[],$:[]},"*graphNode":{"(":["graphNode","*graphNode"],"[":["graphNode","*graphNode"],VAR1:["graphNode","*graphNode"],VAR2:["graphNode","*graphNode"],NIL:["graphNode","*graphNode"],IRI_REF:["graphNode","*graphNode"],TRUE:["graphNode","*graphNode"],FALSE:["graphNode","*graphNode"],BLANK_NODE_LABEL:["graphNode","*graphNode"],ANON:["graphNode","*graphNode"],PNAME_LN:["graphNode","*graphNode"],PNAME_NS:["graphNode","*graphNode"],STRING_LITERAL1:["graphNode","*graphNode"],STRING_LITERAL2:["graphNode","*graphNode"],STRING_LITERAL_LONG1:["graphNode","*graphNode"],STRING_LITERAL_LONG2:["graphNode","*graphNode"],INTEGER:["graphNode","*graphNode"],DECIMAL:["graphNode","*graphNode"],DOUBLE:["graphNode","*graphNode"],INTEGER_POSITIVE:["graphNode","*graphNode"],DECIMAL_POSITIVE:["graphNode","*graphNode"],DOUBLE_POSITIVE:["graphNode","*graphNode"],INTEGER_NEGATIVE:["graphNode","*graphNode"],DECIMAL_NEGATIVE:["graphNode","*graphNode"],DOUBLE_NEGATIVE:["graphNode","*graphNode"],")":[]},"*graphNodePath":{"(":["graphNodePath","*graphNodePath"],"[":["graphNodePath","*graphNodePath"],VAR1:["graphNodePath","*graphNodePath"],VAR2:["graphNodePath","*graphNodePath"],NIL:["graphNodePath","*graphNodePath"],IRI_REF:["graphNodePath","*graphNodePath"],TRUE:["graphNodePath","*graphNodePath"],FALSE:["graphNodePath","*graphNodePath"],BLANK_NODE_LABEL:["graphNodePath","*graphNodePath"],ANON:["graphNodePath","*graphNodePath"],PNAME_LN:["graphNodePath","*graphNodePath"],PNAME_NS:["graphNodePath","*graphNodePath"],STRING_LITERAL1:["graphNodePath","*graphNodePath"],STRING_LITERAL2:["graphNodePath","*graphNodePath"],STRING_LITERAL_LONG1:["graphNodePath","*graphNodePath"],STRING_LITERAL_LONG2:["graphNodePath","*graphNodePath"],INTEGER:["graphNodePath","*graphNodePath"],DECIMAL:["graphNodePath","*graphNodePath"],DOUBLE:["graphNodePath","*graphNodePath"],INTEGER_POSITIVE:["graphNodePath","*graphNodePath"],DECIMAL_POSITIVE:["graphNodePath","*graphNodePath"],DOUBLE_POSITIVE:["graphNodePath","*graphNodePath"],INTEGER_NEGATIVE:["graphNodePath","*graphNodePath"],DECIMAL_NEGATIVE:["graphNodePath","*graphNodePath"],DOUBLE_NEGATIVE:["graphNodePath","*graphNodePath"],")":[]},"*groupCondition":{"(":["groupCondition","*groupCondition"],STR:["groupCondition","*groupCondition"],LANG:["groupCondition","*groupCondition"],LANGMATCHES:["groupCondition","*groupCondition"],DATATYPE:["groupCondition","*groupCondition"],BOUND:["groupCondition","*groupCondition"],IRI:["groupCondition","*groupCondition"],URI:["groupCondition","*groupCondition"],BNODE:["groupCondition","*groupCondition"],RAND:["groupCondition","*groupCondition"],ABS:["groupCondition","*groupCondition"],CEIL:["groupCondition","*groupCondition"],FLOOR:["groupCondition","*groupCondition"],ROUND:["groupCondition","*groupCondition"],CONCAT:["groupCondition","*groupCondition"],STRLEN:["groupCondition","*groupCondition"],UCASE:["groupCondition","*groupCondition"],LCASE:["groupCondition","*groupCondition"],ENCODE_FOR_URI:["groupCondition","*groupCondition"],CONTAINS:["groupCondition","*groupCondition"],STRSTARTS:["groupCondition","*groupCondition"],STRENDS:["groupCondition","*groupCondition"],STRBEFORE:["groupCondition","*groupCondition"],STRAFTER:["groupCondition","*groupCondition"],YEAR:["groupCondition","*groupCondition"],MONTH:["groupCondition","*groupCondition"],DAY:["groupCondition","*groupCondition"],HOURS:["groupCondition","*groupCondition"],MINUTES:["groupCondition","*groupCondition"],SECONDS:["groupCondition","*groupCondition"],TIMEZONE:["groupCondition","*groupCondition"],TZ:["groupCondition","*groupCondition"],NOW:["groupCondition","*groupCondition"],UUID:["groupCondition","*groupCondition"],STRUUID:["groupCondition","*groupCondition"],MD5:["groupCondition","*groupCondition"],SHA1:["groupCondition","*groupCondition"],SHA256:["groupCondition","*groupCondition"],SHA384:["groupCondition","*groupCondition"],SHA512:["groupCondition","*groupCondition"],COALESCE:["groupCondition","*groupCondition"],IF:["groupCondition","*groupCondition"],STRLANG:["groupCondition","*groupCondition"],STRDT:["groupCondition","*groupCondition"],SAMETERM:["groupCondition","*groupCondition"],ISIRI:["groupCondition","*groupCondition"],ISURI:["groupCondition","*groupCondition"],ISBLANK:["groupCondition","*groupCondition"],ISLITERAL:["groupCondition","*groupCondition"],ISNUMERIC:["groupCondition","*groupCondition"],VAR1:["groupCondition","*groupCondition"],VAR2:["groupCondition","*groupCondition"],SUBSTR:["groupCondition","*groupCondition"],REPLACE:["groupCondition","*groupCondition"],REGEX:["groupCondition","*groupCondition"],EXISTS:["groupCondition","*groupCondition"],NOT:["groupCondition","*groupCondition"],IRI_REF:["groupCondition","*groupCondition"],PNAME_LN:["groupCondition","*groupCondition"],PNAME_NS:["groupCondition","*groupCondition"],VALUES:[],LIMIT:[],OFFSET:[],ORDER:[],HAVING:[],$:[],"}":[]},"*havingCondition":{"(":["havingCondition","*havingCondition"],STR:["havingCondition","*havingCondition"],LANG:["havingCondition","*havingCondition"],LANGMATCHES:["havingCondition","*havingCondition"],DATATYPE:["havingCondition","*havingCondition"],BOUND:["havingCondition","*havingCondition"],IRI:["havingCondition","*havingCondition"],URI:["havingCondition","*havingCondition"],BNODE:["havingCondition","*havingCondition"],RAND:["havingCondition","*havingCondition"],ABS:["havingCondition","*havingCondition"],CEIL:["havingCondition","*havingCondition"],FLOOR:["havingCondition","*havingCondition"],ROUND:["havingCondition","*havingCondition"],CONCAT:["havingCondition","*havingCondition"],STRLEN:["havingCondition","*havingCondition"],UCASE:["havingCondition","*havingCondition"],LCASE:["havingCondition","*havingCondition"],ENCODE_FOR_URI:["havingCondition","*havingCondition"],CONTAINS:["havingCondition","*havingCondition"],STRSTARTS:["havingCondition","*havingCondition"],STRENDS:["havingCondition","*havingCondition"],STRBEFORE:["havingCondition","*havingCondition"],STRAFTER:["havingCondition","*havingCondition"],YEAR:["havingCondition","*havingCondition"],MONTH:["havingCondition","*havingCondition"],DAY:["havingCondition","*havingCondition"],HOURS:["havingCondition","*havingCondition"],MINUTES:["havingCondition","*havingCondition"],SECONDS:["havingCondition","*havingCondition"],TIMEZONE:["havingCondition","*havingCondition"],TZ:["havingCondition","*havingCondition"],NOW:["havingCondition","*havingCondition"],UUID:["havingCondition","*havingCondition"],STRUUID:["havingCondition","*havingCondition"],MD5:["havingCondition","*havingCondition"],SHA1:["havingCondition","*havingCondition"],SHA256:["havingCondition","*havingCondition"],SHA384:["havingCondition","*havingCondition"],SHA512:["havingCondition","*havingCondition"],COALESCE:["havingCondition","*havingCondition"],IF:["havingCondition","*havingCondition"],STRLANG:["havingCondition","*havingCondition"],STRDT:["havingCondition","*havingCondition"],SAMETERM:["havingCondition","*havingCondition"],ISIRI:["havingCondition","*havingCondition"],ISURI:["havingCondition","*havingCondition"],ISBLANK:["havingCondition","*havingCondition"],ISLITERAL:["havingCondition","*havingCondition"],ISNUMERIC:["havingCondition","*havingCondition"],SUBSTR:["havingCondition","*havingCondition"],REPLACE:["havingCondition","*havingCondition"],REGEX:["havingCondition","*havingCondition"],EXISTS:["havingCondition","*havingCondition"],NOT:["havingCondition","*havingCondition"],IRI_REF:["havingCondition","*havingCondition"],PNAME_LN:["havingCondition","*havingCondition"],PNAME_NS:["havingCondition","*havingCondition"],VALUES:[],LIMIT:[],OFFSET:[],ORDER:[],$:[],"}":[]},"*or([[ (,*dataBlockValue,)],NIL])":{"(":["or([[ (,*dataBlockValue,)],NIL])","*or([[ (,*dataBlockValue,)],NIL])"],NIL:["or([[ (,*dataBlockValue,)],NIL])","*or([[ (,*dataBlockValue,)],NIL])"],"}":[]},"*or([[*,unaryExpression],[/,unaryExpression]])":{"*":["or([[*,unaryExpression],[/,unaryExpression]])","*or([[*,unaryExpression],[/,unaryExpression]])"],"/":["or([[*,unaryExpression],[/,unaryExpression]])","*or([[*,unaryExpression],[/,unaryExpression]])"],AS:[],")":[],",":[],"||":[],"&&":[],"=":[],"!=":[],"<":[],">":[],"<=":[],">=":[],IN:[],NOT:[],"+":[],"-":[],INTEGER_POSITIVE:[],DECIMAL_POSITIVE:[],DOUBLE_POSITIVE:[],INTEGER_NEGATIVE:[],DECIMAL_NEGATIVE:[],DOUBLE_NEGATIVE:[],";":[]},"*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])":{"+":["or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],"-":["or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],INTEGER_POSITIVE:["or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],DECIMAL_POSITIVE:["or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],DOUBLE_POSITIVE:["or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],INTEGER_NEGATIVE:["or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],DECIMAL_NEGATIVE:["or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],DOUBLE_NEGATIVE:["or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],AS:[],")":[],",":[],"||":[],"&&":[],"=":[],"!=":[],"<":[],">":[],"<=":[],">=":[],IN:[],NOT:[],";":[]},"*or([var,[ (,expression,AS,var,)]])":{"(":["or([var,[ (,expression,AS,var,)]])","*or([var,[ (,expression,AS,var,)]])"],VAR1:["or([var,[ (,expression,AS,var,)]])","*or([var,[ (,expression,AS,var,)]])"],VAR2:["or([var,[ (,expression,AS,var,)]])","*or([var,[ (,expression,AS,var,)]])"],WHERE:[],"{":[],FROM:[]},"*orderCondition":{ASC:["orderCondition","*orderCondition"],DESC:["orderCondition","*orderCondition"],VAR1:["orderCondition","*orderCondition"],VAR2:["orderCondition","*orderCondition"],"(":["orderCondition","*orderCondition"],STR:["orderCondition","*orderCondition"],LANG:["orderCondition","*orderCondition"],LANGMATCHES:["orderCondition","*orderCondition"],DATATYPE:["orderCondition","*orderCondition"],BOUND:["orderCondition","*orderCondition"],IRI:["orderCondition","*orderCondition"],URI:["orderCondition","*orderCondition"],BNODE:["orderCondition","*orderCondition"],RAND:["orderCondition","*orderCondition"],ABS:["orderCondition","*orderCondition"],CEIL:["orderCondition","*orderCondition"],FLOOR:["orderCondition","*orderCondition"],ROUND:["orderCondition","*orderCondition"],CONCAT:["orderCondition","*orderCondition"],STRLEN:["orderCondition","*orderCondition"],UCASE:["orderCondition","*orderCondition"],LCASE:["orderCondition","*orderCondition"],ENCODE_FOR_URI:["orderCondition","*orderCondition"],CONTAINS:["orderCondition","*orderCondition"],STRSTARTS:["orderCondition","*orderCondition"],STRENDS:["orderCondition","*orderCondition"],STRBEFORE:["orderCondition","*orderCondition"],STRAFTER:["orderCondition","*orderCondition"],YEAR:["orderCondition","*orderCondition"],MONTH:["orderCondition","*orderCondition"],DAY:["orderCondition","*orderCondition"],HOURS:["orderCondition","*orderCondition"],MINUTES:["orderCondition","*orderCondition"],SECONDS:["orderCondition","*orderCondition"],TIMEZONE:["orderCondition","*orderCondition"],TZ:["orderCondition","*orderCondition"],NOW:["orderCondition","*orderCondition"],UUID:["orderCondition","*orderCondition"],STRUUID:["orderCondition","*orderCondition"],MD5:["orderCondition","*orderCondition"],SHA1:["orderCondition","*orderCondition"],SHA256:["orderCondition","*orderCondition"],SHA384:["orderCondition","*orderCondition"],SHA512:["orderCondition","*orderCondition"],COALESCE:["orderCondition","*orderCondition"],IF:["orderCondition","*orderCondition"],STRLANG:["orderCondition","*orderCondition"],STRDT:["orderCondition","*orderCondition"],SAMETERM:["orderCondition","*orderCondition"],ISIRI:["orderCondition","*orderCondition"],ISURI:["orderCondition","*orderCondition"],ISBLANK:["orderCondition","*orderCondition"],ISLITERAL:["orderCondition","*orderCondition"],ISNUMERIC:["orderCondition","*orderCondition"],SUBSTR:["orderCondition","*orderCondition"],REPLACE:["orderCondition","*orderCondition"],REGEX:["orderCondition","*orderCondition"],EXISTS:["orderCondition","*orderCondition"],NOT:["orderCondition","*orderCondition"],IRI_REF:["orderCondition","*orderCondition"],PNAME_LN:["orderCondition","*orderCondition"],PNAME_NS:["orderCondition","*orderCondition"],VALUES:[],LIMIT:[],OFFSET:[],$:[],"}":[]},"*prefixDecl":{PREFIX:["prefixDecl","*prefixDecl"],$:[],CONSTRUCT:[],DESCRIBE:[],ASK:[],INSERT:[],DELETE:[],SELECT:[],LOAD:[],CLEAR:[],DROP:[],ADD:[],MOVE:[],COPY:[],CREATE:[],WITH:[]},"*usingClause":{USING:["usingClause","*usingClause"],WHERE:[]},"*var":{VAR1:["var","*var"],VAR2:["var","*var"],")":[]},"*varOrIRIref":{VAR1:["varOrIRIref","*varOrIRIref"],VAR2:["varOrIRIref","*varOrIRIref"],IRI_REF:["varOrIRIref","*varOrIRIref"],PNAME_LN:["varOrIRIref","*varOrIRIref"],PNAME_NS:["varOrIRIref","*varOrIRIref"],ORDER:[],HAVING:[],GROUP:[],LIMIT:[],OFFSET:[],WHERE:[],"{":[],FROM:[],VALUES:[],$:[]},"+graphNode":{"(":["graphNode","*graphNode"],"[":["graphNode","*graphNode"],VAR1:["graphNode","*graphNode"],VAR2:["graphNode","*graphNode"],NIL:["graphNode","*graphNode"],IRI_REF:["graphNode","*graphNode"],TRUE:["graphNode","*graphNode"],FALSE:["graphNode","*graphNode"],BLANK_NODE_LABEL:["graphNode","*graphNode"],ANON:["graphNode","*graphNode"],PNAME_LN:["graphNode","*graphNode"],PNAME_NS:["graphNode","*graphNode"],STRING_LITERAL1:["graphNode","*graphNode"],STRING_LITERAL2:["graphNode","*graphNode"],STRING_LITERAL_LONG1:["graphNode","*graphNode"],STRING_LITERAL_LONG2:["graphNode","*graphNode"],INTEGER:["graphNode","*graphNode"],DECIMAL:["graphNode","*graphNode"],DOUBLE:["graphNode","*graphNode"],INTEGER_POSITIVE:["graphNode","*graphNode"],DECIMAL_POSITIVE:["graphNode","*graphNode"],DOUBLE_POSITIVE:["graphNode","*graphNode"],INTEGER_NEGATIVE:["graphNode","*graphNode"],DECIMAL_NEGATIVE:["graphNode","*graphNode"],DOUBLE_NEGATIVE:["graphNode","*graphNode"]},"+graphNodePath":{"(":["graphNodePath","*graphNodePath"],"[":["graphNodePath","*graphNodePath"],VAR1:["graphNodePath","*graphNodePath"],VAR2:["graphNodePath","*graphNodePath"],NIL:["graphNodePath","*graphNodePath"],IRI_REF:["graphNodePath","*graphNodePath"],TRUE:["graphNodePath","*graphNodePath"],FALSE:["graphNodePath","*graphNodePath"],BLANK_NODE_LABEL:["graphNodePath","*graphNodePath"],ANON:["graphNodePath","*graphNodePath"],PNAME_LN:["graphNodePath","*graphNodePath"],PNAME_NS:["graphNodePath","*graphNodePath"],STRING_LITERAL1:["graphNodePath","*graphNodePath"],STRING_LITERAL2:["graphNodePath","*graphNodePath"],STRING_LITERAL_LONG1:["graphNodePath","*graphNodePath"],STRING_LITERAL_LONG2:["graphNodePath","*graphNodePath"],INTEGER:["graphNodePath","*graphNodePath"],DECIMAL:["graphNodePath","*graphNodePath"],DOUBLE:["graphNodePath","*graphNodePath"],INTEGER_POSITIVE:["graphNodePath","*graphNodePath"],DECIMAL_POSITIVE:["graphNodePath","*graphNodePath"],DOUBLE_POSITIVE:["graphNodePath","*graphNodePath"],INTEGER_NEGATIVE:["graphNodePath","*graphNodePath"],DECIMAL_NEGATIVE:["graphNodePath","*graphNodePath"],DOUBLE_NEGATIVE:["graphNodePath","*graphNodePath"]},"+groupCondition":{"(":["groupCondition","*groupCondition"],STR:["groupCondition","*groupCondition"],LANG:["groupCondition","*groupCondition"],LANGMATCHES:["groupCondition","*groupCondition"],DATATYPE:["groupCondition","*groupCondition"],BOUND:["groupCondition","*groupCondition"],IRI:["groupCondition","*groupCondition"],URI:["groupCondition","*groupCondition"],BNODE:["groupCondition","*groupCondition"],RAND:["groupCondition","*groupCondition"],ABS:["groupCondition","*groupCondition"],CEIL:["groupCondition","*groupCondition"],FLOOR:["groupCondition","*groupCondition"],ROUND:["groupCondition","*groupCondition"],CONCAT:["groupCondition","*groupCondition"],STRLEN:["groupCondition","*groupCondition"],UCASE:["groupCondition","*groupCondition"],LCASE:["groupCondition","*groupCondition"],ENCODE_FOR_URI:["groupCondition","*groupCondition"],CONTAINS:["groupCondition","*groupCondition"],STRSTARTS:["groupCondition","*groupCondition"],STRENDS:["groupCondition","*groupCondition"],STRBEFORE:["groupCondition","*groupCondition"],STRAFTER:["groupCondition","*groupCondition"],YEAR:["groupCondition","*groupCondition"],MONTH:["groupCondition","*groupCondition"],DAY:["groupCondition","*groupCondition"],HOURS:["groupCondition","*groupCondition"],MINUTES:["groupCondition","*groupCondition"],SECONDS:["groupCondition","*groupCondition"],TIMEZONE:["groupCondition","*groupCondition"],TZ:["groupCondition","*groupCondition"],NOW:["groupCondition","*groupCondition"],UUID:["groupCondition","*groupCondition"],STRUUID:["groupCondition","*groupCondition"],MD5:["groupCondition","*groupCondition"],SHA1:["groupCondition","*groupCondition"],SHA256:["groupCondition","*groupCondition"],SHA384:["groupCondition","*groupCondition"],SHA512:["groupCondition","*groupCondition"],COALESCE:["groupCondition","*groupCondition"],IF:["groupCondition","*groupCondition"],STRLANG:["groupCondition","*groupCondition"],STRDT:["groupCondition","*groupCondition"],SAMETERM:["groupCondition","*groupCondition"],ISIRI:["groupCondition","*groupCondition"],ISURI:["groupCondition","*groupCondition"],ISBLANK:["groupCondition","*groupCondition"],ISLITERAL:["groupCondition","*groupCondition"],ISNUMERIC:["groupCondition","*groupCondition"],VAR1:["groupCondition","*groupCondition"],VAR2:["groupCondition","*groupCondition"],SUBSTR:["groupCondition","*groupCondition"],REPLACE:["groupCondition","*groupCondition"],REGEX:["groupCondition","*groupCondition"],EXISTS:["groupCondition","*groupCondition"],NOT:["groupCondition","*groupCondition"],IRI_REF:["groupCondition","*groupCondition"],PNAME_LN:["groupCondition","*groupCondition"],PNAME_NS:["groupCondition","*groupCondition"]},"+havingCondition":{"(":["havingCondition","*havingCondition"],STR:["havingCondition","*havingCondition"],LANG:["havingCondition","*havingCondition"],LANGMATCHES:["havingCondition","*havingCondition"],DATATYPE:["havingCondition","*havingCondition"],BOUND:["havingCondition","*havingCondition"],IRI:["havingCondition","*havingCondition"],URI:["havingCondition","*havingCondition"],BNODE:["havingCondition","*havingCondition"],RAND:["havingCondition","*havingCondition"],ABS:["havingCondition","*havingCondition"],CEIL:["havingCondition","*havingCondition"],FLOOR:["havingCondition","*havingCondition"],ROUND:["havingCondition","*havingCondition"],CONCAT:["havingCondition","*havingCondition"],STRLEN:["havingCondition","*havingCondition"],UCASE:["havingCondition","*havingCondition"],LCASE:["havingCondition","*havingCondition"],ENCODE_FOR_URI:["havingCondition","*havingCondition"],CONTAINS:["havingCondition","*havingCondition"],STRSTARTS:["havingCondition","*havingCondition"],STRENDS:["havingCondition","*havingCondition"],STRBEFORE:["havingCondition","*havingCondition"],STRAFTER:["havingCondition","*havingCondition"],YEAR:["havingCondition","*havingCondition"],MONTH:["havingCondition","*havingCondition"],DAY:["havingCondition","*havingCondition"],HOURS:["havingCondition","*havingCondition"],MINUTES:["havingCondition","*havingCondition"],SECONDS:["havingCondition","*havingCondition"],TIMEZONE:["havingCondition","*havingCondition"],TZ:["havingCondition","*havingCondition"],NOW:["havingCondition","*havingCondition"],UUID:["havingCondition","*havingCondition"],STRUUID:["havingCondition","*havingCondition"],MD5:["havingCondition","*havingCondition"],SHA1:["havingCondition","*havingCondition"],SHA256:["havingCondition","*havingCondition"],SHA384:["havingCondition","*havingCondition"],SHA512:["havingCondition","*havingCondition"],COALESCE:["havingCondition","*havingCondition"],IF:["havingCondition","*havingCondition"],STRLANG:["havingCondition","*havingCondition"],STRDT:["havingCondition","*havingCondition"],SAMETERM:["havingCondition","*havingCondition"],ISIRI:["havingCondition","*havingCondition"],ISURI:["havingCondition","*havingCondition"],ISBLANK:["havingCondition","*havingCondition"],ISLITERAL:["havingCondition","*havingCondition"],ISNUMERIC:["havingCondition","*havingCondition"],SUBSTR:["havingCondition","*havingCondition"],REPLACE:["havingCondition","*havingCondition"],REGEX:["havingCondition","*havingCondition"],EXISTS:["havingCondition","*havingCondition"],NOT:["havingCondition","*havingCondition"],IRI_REF:["havingCondition","*havingCondition"],PNAME_LN:["havingCondition","*havingCondition"],PNAME_NS:["havingCondition","*havingCondition"]},"+or([var,[ (,expression,AS,var,)]])":{"(":["or([var,[ (,expression,AS,var,)]])","*or([var,[ (,expression,AS,var,)]])"],VAR1:["or([var,[ (,expression,AS,var,)]])","*or([var,[ (,expression,AS,var,)]])"],VAR2:["or([var,[ (,expression,AS,var,)]])","*or([var,[ (,expression,AS,var,)]])"]},"+orderCondition":{ASC:["orderCondition","*orderCondition"],DESC:["orderCondition","*orderCondition"],VAR1:["orderCondition","*orderCondition"],VAR2:["orderCondition","*orderCondition"],"(":["orderCondition","*orderCondition"],STR:["orderCondition","*orderCondition"],LANG:["orderCondition","*orderCondition"],LANGMATCHES:["orderCondition","*orderCondition"],DATATYPE:["orderCondition","*orderCondition"],BOUND:["orderCondition","*orderCondition"],IRI:["orderCondition","*orderCondition"],URI:["orderCondition","*orderCondition"],BNODE:["orderCondition","*orderCondition"],RAND:["orderCondition","*orderCondition"],ABS:["orderCondition","*orderCondition"],CEIL:["orderCondition","*orderCondition"],FLOOR:["orderCondition","*orderCondition"],ROUND:["orderCondition","*orderCondition"],CONCAT:["orderCondition","*orderCondition"],STRLEN:["orderCondition","*orderCondition"],UCASE:["orderCondition","*orderCondition"],LCASE:["orderCondition","*orderCondition"],ENCODE_FOR_URI:["orderCondition","*orderCondition"],CONTAINS:["orderCondition","*orderCondition"],STRSTARTS:["orderCondition","*orderCondition"],STRENDS:["orderCondition","*orderCondition"],STRBEFORE:["orderCondition","*orderCondition"],STRAFTER:["orderCondition","*orderCondition"],YEAR:["orderCondition","*orderCondition"],MONTH:["orderCondition","*orderCondition"],DAY:["orderCondition","*orderCondition"],HOURS:["orderCondition","*orderCondition"],MINUTES:["orderCondition","*orderCondition"],SECONDS:["orderCondition","*orderCondition"],TIMEZONE:["orderCondition","*orderCondition"],TZ:["orderCondition","*orderCondition"],NOW:["orderCondition","*orderCondition"],UUID:["orderCondition","*orderCondition"],STRUUID:["orderCondition","*orderCondition"],MD5:["orderCondition","*orderCondition"],SHA1:["orderCondition","*orderCondition"],SHA256:["orderCondition","*orderCondition"],SHA384:["orderCondition","*orderCondition"],SHA512:["orderCondition","*orderCondition"],COALESCE:["orderCondition","*orderCondition"],IF:["orderCondition","*orderCondition"],STRLANG:["orderCondition","*orderCondition"],STRDT:["orderCondition","*orderCondition"],SAMETERM:["orderCondition","*orderCondition"],ISIRI:["orderCondition","*orderCondition"],ISURI:["orderCondition","*orderCondition"],ISBLANK:["orderCondition","*orderCondition"],ISLITERAL:["orderCondition","*orderCondition"],ISNUMERIC:["orderCondition","*orderCondition"],SUBSTR:["orderCondition","*orderCondition"],REPLACE:["orderCondition","*orderCondition"],REGEX:["orderCondition","*orderCondition"],EXISTS:["orderCondition","*orderCondition"],NOT:["orderCondition","*orderCondition"],IRI_REF:["orderCondition","*orderCondition"],PNAME_LN:["orderCondition","*orderCondition"],PNAME_NS:["orderCondition","*orderCondition"]},"+varOrIRIref":{VAR1:["varOrIRIref","*varOrIRIref"],VAR2:["varOrIRIref","*varOrIRIref"],IRI_REF:["varOrIRIref","*varOrIRIref"],PNAME_LN:["varOrIRIref","*varOrIRIref"],PNAME_NS:["varOrIRIref","*varOrIRIref"]},"?.":{".":["."],VAR1:[],VAR2:[],NIL:[],"(":[],"[":[],IRI_REF:[],TRUE:[],FALSE:[],BLANK_NODE_LABEL:[],ANON:[],PNAME_LN:[],PNAME_NS:[],STRING_LITERAL1:[],STRING_LITERAL2:[],STRING_LITERAL_LONG1:[],STRING_LITERAL_LONG2:[],INTEGER:[],DECIMAL:[],DOUBLE:[],INTEGER_POSITIVE:[],DECIMAL_POSITIVE:[],DOUBLE_POSITIVE:[],INTEGER_NEGATIVE:[],DECIMAL_NEGATIVE:[],DOUBLE_NEGATIVE:[],GRAPH:[],"{":[],OPTIONAL:[],MINUS:[],SERVICE:[],FILTER:[],BIND:[],VALUES:[],"}":[]},"?DISTINCT":{DISTINCT:["DISTINCT"],"!":[],"+":[],"-":[],VAR1:[],VAR2:[],"(":[],STR:[],LANG:[],LANGMATCHES:[],DATATYPE:[],BOUND:[],IRI:[],URI:[],BNODE:[],RAND:[],ABS:[],CEIL:[],FLOOR:[],ROUND:[],CONCAT:[],STRLEN:[],UCASE:[],LCASE:[],ENCODE_FOR_URI:[],CONTAINS:[],STRSTARTS:[],STRENDS:[],STRBEFORE:[],STRAFTER:[],YEAR:[],MONTH:[],DAY:[],HOURS:[],MINUTES:[],SECONDS:[],TIMEZONE:[],TZ:[],NOW:[],UUID:[],STRUUID:[],MD5:[],SHA1:[],SHA256:[],SHA384:[],SHA512:[],COALESCE:[],IF:[],STRLANG:[],STRDT:[],SAMETERM:[],ISIRI:[],ISURI:[],ISBLANK:[],ISLITERAL:[],ISNUMERIC:[],TRUE:[],FALSE:[],COUNT:[],SUM:[],MIN:[],MAX:[],AVG:[],SAMPLE:[],GROUP_CONCAT:[],SUBSTR:[],REPLACE:[],REGEX:[],EXISTS:[],NOT:[],IRI_REF:[],STRING_LITERAL1:[],STRING_LITERAL2:[],STRING_LITERAL_LONG1:[],STRING_LITERAL_LONG2:[],INTEGER:[],DECIMAL:[],DOUBLE:[],INTEGER_POSITIVE:[],DECIMAL_POSITIVE:[],DOUBLE_POSITIVE:[],INTEGER_NEGATIVE:[],DECIMAL_NEGATIVE:[],DOUBLE_NEGATIVE:[],PNAME_LN:[],PNAME_NS:[],"*":[]},"?GRAPH":{GRAPH:["GRAPH"],IRI_REF:[],PNAME_LN:[],PNAME_NS:[]},"?SILENT":{SILENT:["SILENT"],VAR1:[],VAR2:[],IRI_REF:[],PNAME_LN:[],PNAME_NS:[]},"?SILENT_1":{SILENT:["SILENT"],IRI_REF:[],PNAME_LN:[],PNAME_NS:[]},"?SILENT_2":{SILENT:["SILENT"],GRAPH:[],DEFAULT:[],NAMED:[],ALL:[]},"?SILENT_3":{SILENT:["SILENT"],GRAPH:[]},"?SILENT_4":{SILENT:["SILENT"],DEFAULT:[],GRAPH:[],IRI_REF:[],PNAME_LN:[],PNAME_NS:[]},"?WHERE":{WHERE:["WHERE"],"{":[]},"?[,,expression]":{",":["[,,expression]"],")":[]},"?[.,?constructTriples]":{".":["[.,?constructTriples]"],"}":[]},"?[.,?triplesBlock]":{".":["[.,?triplesBlock]"],"{":[],OPTIONAL:[],MINUS:[],GRAPH:[],SERVICE:[],FILTER:[],BIND:[],VALUES:[],"}":[]},"?[.,?triplesTemplate]":{".":["[.,?triplesTemplate]"],"}":[],GRAPH:[]},"?[;,SEPARATOR,=,string]":{";":["[;,SEPARATOR,=,string]"],")":[]},"?[;,update]":{";":["[;,update]"],$:[]},"?[AS,var]":{AS:["[AS,var]"],")":[]},"?[INTO,graphRef]":{INTO:["[INTO,graphRef]"],";":[],$:[]},"?[or([verbPath,verbSimple]),objectList]":{VAR1:["[or([verbPath,verbSimple]),objectList]"],VAR2:["[or([verbPath,verbSimple]),objectList]"],"^":["[or([verbPath,verbSimple]),objectList]"],a:["[or([verbPath,verbSimple]),objectList]"],"!":["[or([verbPath,verbSimple]),objectList]"],"(":["[or([verbPath,verbSimple]),objectList]"],IRI_REF:["[or([verbPath,verbSimple]),objectList]"],PNAME_LN:["[or([verbPath,verbSimple]),objectList]"],PNAME_NS:["[or([verbPath,verbSimple]),objectList]"],";":[],".":[],"]":[],"{":[],OPTIONAL:[],MINUS:[],GRAPH:[],SERVICE:[],FILTER:[],BIND:[],VALUES:[],"}":[]},"?[pathOneInPropertySet,*[|,pathOneInPropertySet]]":{a:["[pathOneInPropertySet,*[|,pathOneInPropertySet]]"],"^":["[pathOneInPropertySet,*[|,pathOneInPropertySet]]"],IRI_REF:["[pathOneInPropertySet,*[|,pathOneInPropertySet]]"],PNAME_LN:["[pathOneInPropertySet,*[|,pathOneInPropertySet]]"],PNAME_NS:["[pathOneInPropertySet,*[|,pathOneInPropertySet]]"],")":[]},"?[update1,?[;,update]]":{INSERT:["[update1,?[;,update]]"],DELETE:["[update1,?[;,update]]"],LOAD:["[update1,?[;,update]]"],CLEAR:["[update1,?[;,update]]"],DROP:["[update1,?[;,update]]"],ADD:["[update1,?[;,update]]"],MOVE:["[update1,?[;,update]]"],COPY:["[update1,?[;,update]]"],CREATE:["[update1,?[;,update]]"],WITH:["[update1,?[;,update]]"],$:[]},"?[verb,objectList]":{a:["[verb,objectList]"],VAR1:["[verb,objectList]"],VAR2:["[verb,objectList]"],IRI_REF:["[verb,objectList]"],PNAME_LN:["[verb,objectList]"],PNAME_NS:["[verb,objectList]"],";":[],".":[],"]":[],"}":[],GRAPH:[],"{":[],OPTIONAL:[],MINUS:[],SERVICE:[],FILTER:[],BIND:[],VALUES:[]},"?argList":{NIL:["argList"],"(":["argList"],AS:[],")":[],",":[],"||":[],"&&":[],"=":[],"!=":[],"<":[],">":[],"<=":[],">=":[],IN:[],NOT:[],"+":[],"-":[],INTEGER_POSITIVE:[],DECIMAL_POSITIVE:[],DOUBLE_POSITIVE:[],INTEGER_NEGATIVE:[],DECIMAL_NEGATIVE:[],DOUBLE_NEGATIVE:[],"*":[],"/":[],";":[]},"?baseDecl":{BASE:["baseDecl"],$:[],CONSTRUCT:[],DESCRIBE:[],ASK:[],INSERT:[],DELETE:[],SELECT:[],LOAD:[],CLEAR:[],DROP:[],ADD:[],MOVE:[],COPY:[],CREATE:[],WITH:[],PREFIX:[]},"?constructTriples":{VAR1:["constructTriples"],VAR2:["constructTriples"],NIL:["constructTriples"],"(":["constructTriples"],"[":["constructTriples"],IRI_REF:["constructTriples"],TRUE:["constructTriples"],FALSE:["constructTriples"],BLANK_NODE_LABEL:["constructTriples"],ANON:["constructTriples"],PNAME_LN:["constructTriples"],PNAME_NS:["constructTriples"],STRING_LITERAL1:["constructTriples"],STRING_LITERAL2:["constructTriples"],STRING_LITERAL_LONG1:["constructTriples"],STRING_LITERAL_LONG2:["constructTriples"],INTEGER:["constructTriples"],DECIMAL:["constructTriples"],DOUBLE:["constructTriples"],INTEGER_POSITIVE:["constructTriples"],DECIMAL_POSITIVE:["constructTriples"],DOUBLE_POSITIVE:["constructTriples"],INTEGER_NEGATIVE:["constructTriples"],DECIMAL_NEGATIVE:["constructTriples"],DOUBLE_NEGATIVE:["constructTriples"],"}":[]},"?groupClause":{GROUP:["groupClause"],VALUES:[],LIMIT:[],OFFSET:[],ORDER:[],HAVING:[],$:[],"}":[]},"?havingClause":{HAVING:["havingClause"],VALUES:[],LIMIT:[],OFFSET:[],ORDER:[],$:[],"}":[]},"?insertClause":{INSERT:["insertClause"],WHERE:[],USING:[]},"?limitClause":{LIMIT:["limitClause"],VALUES:[],$:[],"}":[]},"?limitOffsetClauses":{LIMIT:["limitOffsetClauses"],OFFSET:["limitOffsetClauses"],VALUES:[],$:[],"}":[]},"?offsetClause":{OFFSET:["offsetClause"],VALUES:[],$:[],"}":[]},"?or([DISTINCT,REDUCED])":{DISTINCT:["or([DISTINCT,REDUCED])"],REDUCED:["or([DISTINCT,REDUCED])"],"*":[],"(":[],VAR1:[],VAR2:[]},"?or([LANGTAG,[^^,iriRef]])":{LANGTAG:["or([LANGTAG,[^^,iriRef]])"],"^^":["or([LANGTAG,[^^,iriRef]])"],UNDEF:[],IRI_REF:[],TRUE:[],FALSE:[],PNAME_LN:[],PNAME_NS:[],STRING_LITERAL1:[],STRING_LITERAL2:[],STRING_LITERAL_LONG1:[],STRING_LITERAL_LONG2:[],INTEGER:[],DECIMAL:[],DOUBLE:[],INTEGER_POSITIVE:[],DECIMAL_POSITIVE:[],DOUBLE_POSITIVE:[],INTEGER_NEGATIVE:[],DECIMAL_NEGATIVE:[],DOUBLE_NEGATIVE:[],a:[],VAR1:[],VAR2:[],"^":[],"!":[],"(":[],".":[],";":[],",":[],AS:[],")":[],"||":[],"&&":[],"=":[],"!=":[],"<":[],">":[],"<=":[],">=":[],IN:[],NOT:[],"+":[],"-":[],"*":[],"/":[],"}":[],"[":[],NIL:[],BLANK_NODE_LABEL:[],ANON:[],"]":[],GRAPH:[],"{":[],OPTIONAL:[],MINUS:[],SERVICE:[],FILTER:[],BIND:[],VALUES:[]},"?or([[*,unaryExpression],[/,unaryExpression]])":{"*":["or([[*,unaryExpression],[/,unaryExpression]])"],"/":["or([[*,unaryExpression],[/,unaryExpression]])"],"+":[],"-":[],INTEGER_POSITIVE:[],DECIMAL_POSITIVE:[],DOUBLE_POSITIVE:[],INTEGER_NEGATIVE:[],DECIMAL_NEGATIVE:[],DOUBLE_NEGATIVE:[],AS:[],")":[],",":[],"||":[],"&&":[],"=":[],"!=":[],"<":[],">":[],"<=":[],">=":[],IN:[],NOT:[],";":[]},"?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])":{"=":["or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],"!=":["or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],"<":["or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],">":["or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],"<=":["or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],">=":["or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],IN:["or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],NOT:["or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],AS:[],")":[],",":[],"||":[],"&&":[],";":[]},"?orderClause":{ORDER:["orderClause"],VALUES:[],LIMIT:[],OFFSET:[],$:[],"}":[]},"?pathMod":{"*":["pathMod"],"?":["pathMod"],"+":["pathMod"],"{":["pathMod"],"|":[],"/":[],")":[],"(":[],"[":[],VAR1:[],VAR2:[],NIL:[],IRI_REF:[],TRUE:[],FALSE:[],BLANK_NODE_LABEL:[],ANON:[],PNAME_LN:[],PNAME_NS:[],STRING_LITERAL1:[],STRING_LITERAL2:[],STRING_LITERAL_LONG1:[],STRING_LITERAL_LONG2:[],INTEGER:[],DECIMAL:[],DOUBLE:[],INTEGER_POSITIVE:[],DECIMAL_POSITIVE:[],DOUBLE_POSITIVE:[],INTEGER_NEGATIVE:[],DECIMAL_NEGATIVE:[],DOUBLE_NEGATIVE:[]},"?triplesBlock":{VAR1:["triplesBlock"],VAR2:["triplesBlock"],NIL:["triplesBlock"],"(":["triplesBlock"],"[":["triplesBlock"],IRI_REF:["triplesBlock"],TRUE:["triplesBlock"],FALSE:["triplesBlock"],BLANK_NODE_LABEL:["triplesBlock"],ANON:["triplesBlock"],PNAME_LN:["triplesBlock"],PNAME_NS:["triplesBlock"],STRING_LITERAL1:["triplesBlock"],STRING_LITERAL2:["triplesBlock"],STRING_LITERAL_LONG1:["triplesBlock"],STRING_LITERAL_LONG2:["triplesBlock"],INTEGER:["triplesBlock"],DECIMAL:["triplesBlock"],DOUBLE:["triplesBlock"],INTEGER_POSITIVE:["triplesBlock"],DECIMAL_POSITIVE:["triplesBlock"],DOUBLE_POSITIVE:["triplesBlock"],INTEGER_NEGATIVE:["triplesBlock"],DECIMAL_NEGATIVE:["triplesBlock"],DOUBLE_NEGATIVE:["triplesBlock"],"{":[],OPTIONAL:[],MINUS:[],GRAPH:[],SERVICE:[],FILTER:[],BIND:[],VALUES:[],"}":[]},"?triplesTemplate":{VAR1:["triplesTemplate"],VAR2:["triplesTemplate"],NIL:["triplesTemplate"],"(":["triplesTemplate"],"[":["triplesTemplate"],IRI_REF:["triplesTemplate"],TRUE:["triplesTemplate"],FALSE:["triplesTemplate"],BLANK_NODE_LABEL:["triplesTemplate"],ANON:["triplesTemplate"],PNAME_LN:["triplesTemplate"],PNAME_NS:["triplesTemplate"],STRING_LITERAL1:["triplesTemplate"],STRING_LITERAL2:["triplesTemplate"],STRING_LITERAL_LONG1:["triplesTemplate"],STRING_LITERAL_LONG2:["triplesTemplate"],INTEGER:["triplesTemplate"],DECIMAL:["triplesTemplate"],DOUBLE:["triplesTemplate"],INTEGER_POSITIVE:["triplesTemplate"],DECIMAL_POSITIVE:["triplesTemplate"],DOUBLE_POSITIVE:["triplesTemplate"],INTEGER_NEGATIVE:["triplesTemplate"],DECIMAL_NEGATIVE:["triplesTemplate"],DOUBLE_NEGATIVE:["triplesTemplate"],"}":[],GRAPH:[]},"?whereClause":{WHERE:["whereClause"],"{":["whereClause"],ORDER:[],HAVING:[],GROUP:[],LIMIT:[],OFFSET:[],VALUES:[],$:[]},"[ (,*dataBlockValue,)]":{"(":["(","*dataBlockValue",")"]},"[ (,*var,)]":{"(":["(","*var",")"]},"[ (,expression,)]":{"(":["(","expression",")"]},"[ (,expression,AS,var,)]":{"(":["(","expression","AS","var",")"]},"[!=,numericExpression]":{"!=":["!=","numericExpression"]},"[&&,valueLogical]":{"&&":["&&","valueLogical"]},"[*,unaryExpression]":{"*":["*","unaryExpression"]},"[*datasetClause,WHERE,{,?triplesTemplate,},solutionModifier]":{WHERE:["*datasetClause","WHERE","{","?triplesTemplate","}","solutionModifier"],FROM:["*datasetClause","WHERE","{","?triplesTemplate","}","solutionModifier"]},"[+,multiplicativeExpression]":{"+":["+","multiplicativeExpression"]},"[,,expression]":{",":[",","expression"]},"[,,integer,}]":{",":[",","integer","}"]},"[,,objectPath]":{",":[",","objectPath"]},"[,,object]":{",":[",","object"]},"[,,or([},[integer,}]])]":{",":[",","or([},[integer,}]])"]},"[-,multiplicativeExpression]":{"-":["-","multiplicativeExpression"]},"[.,?constructTriples]":{".":[".","?constructTriples"]},"[.,?triplesBlock]":{".":[".","?triplesBlock"]},"[.,?triplesTemplate]":{".":[".","?triplesTemplate"]},"[/,pathEltOrInverse]":{"/":["/","pathEltOrInverse"]},"[/,unaryExpression]":{"/":["/","unaryExpression"]},"[;,?[or([verbPath,verbSimple]),objectList]]":{";":[";","?[or([verbPath,verbSimple]),objectList]"]},"[;,?[verb,objectList]]":{";":[";","?[verb,objectList]"]},"[;,SEPARATOR,=,string]":{";":[";","SEPARATOR","=","string"]},"[;,update]":{";":[";","update"]},"[<,numericExpression]":{"<":["<","numericExpression"]},"[<=,numericExpression]":{"<=":["<=","numericExpression"]},"[=,numericExpression]":{"=":["=","numericExpression"]},"[>,numericExpression]":{">":[">","numericExpression"]},"[>=,numericExpression]":{">=":[">=","numericExpression"]},"[AS,var]":{AS:["AS","var"]},"[IN,expressionList]":{IN:["IN","expressionList"]},"[INTO,graphRef]":{INTO:["INTO","graphRef"]},"[NAMED,iriRef]":{NAMED:["NAMED","iriRef"]},"[NOT,IN,expressionList]":{NOT:["NOT","IN","expressionList"]},"[UNION,groupGraphPattern]":{UNION:["UNION","groupGraphPattern"]},"[^^,iriRef]":{"^^":["^^","iriRef"]},"[constructTemplate,*datasetClause,whereClause,solutionModifier]":{"{":["constructTemplate","*datasetClause","whereClause","solutionModifier"]},"[deleteClause,?insertClause]":{DELETE:["deleteClause","?insertClause"]},"[graphPatternNotTriples,?.,?triplesBlock]":{"{":["graphPatternNotTriples","?.","?triplesBlock"],OPTIONAL:["graphPatternNotTriples","?.","?triplesBlock"],MINUS:["graphPatternNotTriples","?.","?triplesBlock"],GRAPH:["graphPatternNotTriples","?.","?triplesBlock"],SERVICE:["graphPatternNotTriples","?.","?triplesBlock"],FILTER:["graphPatternNotTriples","?.","?triplesBlock"],BIND:["graphPatternNotTriples","?.","?triplesBlock"],VALUES:["graphPatternNotTriples","?.","?triplesBlock"]},"[integer,or([[,,or([},[integer,}]])],}])]":{INTEGER:["integer","or([[,,or([},[integer,}]])],}])"]},"[integer,}]":{INTEGER:["integer","}"]},"[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]":{INTEGER_POSITIVE:["or([numericLiteralPositive,numericLiteralNegative])","?or([[*,unaryExpression],[/,unaryExpression]])"],DECIMAL_POSITIVE:["or([numericLiteralPositive,numericLiteralNegative])","?or([[*,unaryExpression],[/,unaryExpression]])"],DOUBLE_POSITIVE:["or([numericLiteralPositive,numericLiteralNegative])","?or([[*,unaryExpression],[/,unaryExpression]])"],INTEGER_NEGATIVE:["or([numericLiteralPositive,numericLiteralNegative])","?or([[*,unaryExpression],[/,unaryExpression]])"],DECIMAL_NEGATIVE:["or([numericLiteralPositive,numericLiteralNegative])","?or([[*,unaryExpression],[/,unaryExpression]])"],DOUBLE_NEGATIVE:["or([numericLiteralPositive,numericLiteralNegative])","?or([[*,unaryExpression],[/,unaryExpression]])"]},"[or([verbPath,verbSimple]),objectList]":{VAR1:["or([verbPath,verbSimple])","objectList"],VAR2:["or([verbPath,verbSimple])","objectList"],"^":["or([verbPath,verbSimple])","objectList"],a:["or([verbPath,verbSimple])","objectList"],"!":["or([verbPath,verbSimple])","objectList"],"(":["or([verbPath,verbSimple])","objectList"],IRI_REF:["or([verbPath,verbSimple])","objectList"],PNAME_LN:["or([verbPath,verbSimple])","objectList"],PNAME_NS:["or([verbPath,verbSimple])","objectList"]},"[pathOneInPropertySet,*[|,pathOneInPropertySet]]":{a:["pathOneInPropertySet","*[|,pathOneInPropertySet]"],"^":["pathOneInPropertySet","*[|,pathOneInPropertySet]"],IRI_REF:["pathOneInPropertySet","*[|,pathOneInPropertySet]"],PNAME_LN:["pathOneInPropertySet","*[|,pathOneInPropertySet]"],PNAME_NS:["pathOneInPropertySet","*[|,pathOneInPropertySet]"]},"[quadsNotTriples,?.,?triplesTemplate]":{GRAPH:["quadsNotTriples","?.","?triplesTemplate"]},"[update1,?[;,update]]":{INSERT:["update1","?[;,update]"],DELETE:["update1","?[;,update]"],LOAD:["update1","?[;,update]"],CLEAR:["update1","?[;,update]"],DROP:["update1","?[;,update]"],ADD:["update1","?[;,update]"],MOVE:["update1","?[;,update]"],COPY:["update1","?[;,update]"],CREATE:["update1","?[;,update]"],WITH:["update1","?[;,update]"]},"[verb,objectList]":{a:["verb","objectList"],VAR1:["verb","objectList"],VAR2:["verb","objectList"],IRI_REF:["verb","objectList"],PNAME_LN:["verb","objectList"],PNAME_NS:["verb","objectList"]},"[|,pathOneInPropertySet]":{"|":["|","pathOneInPropertySet"]},"[|,pathSequence]":{"|":["|","pathSequence"]},"[||,conditionalAndExpression]":{"||":["||","conditionalAndExpression"]},add:{ADD:["ADD","?SILENT_4","graphOrDefault","TO","graphOrDefault"]},additiveExpression:{"!":["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],"+":["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],"-":["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],VAR1:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],VAR2:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],"(":["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STR:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],LANG:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],LANGMATCHES:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],DATATYPE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],BOUND:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],IRI:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],URI:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],BNODE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],RAND:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],ABS:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],CEIL:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],FLOOR:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],ROUND:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],CONCAT:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STRLEN:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],UCASE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],LCASE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],ENCODE_FOR_URI:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],CONTAINS:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STRSTARTS:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STRENDS:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STRBEFORE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STRAFTER:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],YEAR:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],MONTH:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],DAY:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],HOURS:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],MINUTES:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],SECONDS:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],TIMEZONE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],TZ:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],NOW:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],UUID:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STRUUID:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],MD5:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],SHA1:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],SHA256:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],SHA384:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],SHA512:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],COALESCE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],IF:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STRLANG:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STRDT:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],SAMETERM:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],ISIRI:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],ISURI:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],ISBLANK:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],ISLITERAL:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],ISNUMERIC:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],TRUE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],FALSE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],COUNT:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],SUM:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],MIN:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],MAX:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],AVG:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],SAMPLE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],GROUP_CONCAT:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],SUBSTR:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],REPLACE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],REGEX:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],EXISTS:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],NOT:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],IRI_REF:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STRING_LITERAL1:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STRING_LITERAL2:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STRING_LITERAL_LONG1:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STRING_LITERAL_LONG2:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],INTEGER:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],DECIMAL:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],DOUBLE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],INTEGER_POSITIVE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],DECIMAL_POSITIVE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],DOUBLE_POSITIVE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],INTEGER_NEGATIVE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],DECIMAL_NEGATIVE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],DOUBLE_NEGATIVE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],PNAME_LN:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],PNAME_NS:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"]},aggregate:{COUNT:["COUNT","(","?DISTINCT","or([*,expression])",")"],SUM:["SUM","(","?DISTINCT","expression",")"],MIN:["MIN","(","?DISTINCT","expression",")"],MAX:["MAX","(","?DISTINCT","expression",")"],AVG:["AVG","(","?DISTINCT","expression",")"],SAMPLE:["SAMPLE","(","?DISTINCT","expression",")"],GROUP_CONCAT:["GROUP_CONCAT","(","?DISTINCT","expression","?[;,SEPARATOR,=,string]",")"]},allowBnodes:{"}":[]},allowVars:{"}":[]},argList:{NIL:["NIL"],"(":["(","?DISTINCT","expression","*[,,expression]",")"]},askQuery:{ASK:["ASK","*datasetClause","whereClause","solutionModifier"]},baseDecl:{BASE:["BASE","IRI_REF"]},bind:{BIND:["BIND","(","expression","AS","var",")"]},blankNode:{BLANK_NODE_LABEL:["BLANK_NODE_LABEL"],ANON:["ANON"]},blankNodePropertyList:{"[":["[","propertyListNotEmpty","]"]},blankNodePropertyListPath:{"[":["[","propertyListPathNotEmpty","]"]},booleanLiteral:{TRUE:["TRUE"],FALSE:["FALSE"]},brackettedExpression:{"(":["(","expression",")"]},builtInCall:{STR:["STR","(","expression",")"],LANG:["LANG","(","expression",")"],LANGMATCHES:["LANGMATCHES","(","expression",",","expression",")"],DATATYPE:["DATATYPE","(","expression",")"],BOUND:["BOUND","(","var",")"],IRI:["IRI","(","expression",")"],URI:["URI","(","expression",")"],BNODE:["BNODE","or([[ (,expression,)],NIL])"],RAND:["RAND","NIL"],ABS:["ABS","(","expression",")"],CEIL:["CEIL","(","expression",")"],FLOOR:["FLOOR","(","expression",")"],ROUND:["ROUND","(","expression",")"],CONCAT:["CONCAT","expressionList"],SUBSTR:["substringExpression"],STRLEN:["STRLEN","(","expression",")"],REPLACE:["strReplaceExpression"],UCASE:["UCASE","(","expression",")"],LCASE:["LCASE","(","expression",")"],ENCODE_FOR_URI:["ENCODE_FOR_URI","(","expression",")"],CONTAINS:["CONTAINS","(","expression",",","expression",")"],STRSTARTS:["STRSTARTS","(","expression",",","expression",")"],STRENDS:["STRENDS","(","expression",",","expression",")"],STRBEFORE:["STRBEFORE","(","expression",",","expression",")"],STRAFTER:["STRAFTER","(","expression",",","expression",")"],YEAR:["YEAR","(","expression",")"],MONTH:["MONTH","(","expression",")"],DAY:["DAY","(","expression",")"],HOURS:["HOURS","(","expression",")"],MINUTES:["MINUTES","(","expression",")"],SECONDS:["SECONDS","(","expression",")"],TIMEZONE:["TIMEZONE","(","expression",")"],TZ:["TZ","(","expression",")"],NOW:["NOW","NIL"],UUID:["UUID","NIL"],STRUUID:["STRUUID","NIL"],MD5:["MD5","(","expression",")"],SHA1:["SHA1","(","expression",")"],SHA256:["SHA256","(","expression",")"],SHA384:["SHA384","(","expression",")"],SHA512:["SHA512","(","expression",")"],COALESCE:["COALESCE","expressionList"],IF:["IF","(","expression",",","expression",",","expression",")"],STRLANG:["STRLANG","(","expression",",","expression",")"],STRDT:["STRDT","(","expression",",","expression",")"],SAMETERM:["SAMETERM","(","expression",",","expression",")"],ISIRI:["ISIRI","(","expression",")"],ISURI:["ISURI","(","expression",")"],ISBLANK:["ISBLANK","(","expression",")"],ISLITERAL:["ISLITERAL","(","expression",")"],ISNUMERIC:["ISNUMERIC","(","expression",")"],REGEX:["regexExpression"],EXISTS:["existsFunc"],NOT:["notExistsFunc"]},clear:{CLEAR:["CLEAR","?SILENT_2","graphRefAll"]},collection:{"(":["(","+graphNode",")"]},collectionPath:{"(":["(","+graphNodePath",")"]},conditionalAndExpression:{"!":["valueLogical","*[&&,valueLogical]"],"+":["valueLogical","*[&&,valueLogical]"],"-":["valueLogical","*[&&,valueLogical]"],VAR1:["valueLogical","*[&&,valueLogical]"],VAR2:["valueLogical","*[&&,valueLogical]"],"(":["valueLogical","*[&&,valueLogical]"],STR:["valueLogical","*[&&,valueLogical]"],LANG:["valueLogical","*[&&,valueLogical]"],LANGMATCHES:["valueLogical","*[&&,valueLogical]"],DATATYPE:["valueLogical","*[&&,valueLogical]"],BOUND:["valueLogical","*[&&,valueLogical]"],IRI:["valueLogical","*[&&,valueLogical]"],URI:["valueLogical","*[&&,valueLogical]"],BNODE:["valueLogical","*[&&,valueLogical]"],RAND:["valueLogical","*[&&,valueLogical]"],ABS:["valueLogical","*[&&,valueLogical]"],CEIL:["valueLogical","*[&&,valueLogical]"],FLOOR:["valueLogical","*[&&,valueLogical]"],ROUND:["valueLogical","*[&&,valueLogical]"],CONCAT:["valueLogical","*[&&,valueLogical]"],STRLEN:["valueLogical","*[&&,valueLogical]"],UCASE:["valueLogical","*[&&,valueLogical]"],LCASE:["valueLogical","*[&&,valueLogical]"],ENCODE_FOR_URI:["valueLogical","*[&&,valueLogical]"],CONTAINS:["valueLogical","*[&&,valueLogical]"],STRSTARTS:["valueLogical","*[&&,valueLogical]"],STRENDS:["valueLogical","*[&&,valueLogical]"],STRBEFORE:["valueLogical","*[&&,valueLogical]"],STRAFTER:["valueLogical","*[&&,valueLogical]"],YEAR:["valueLogical","*[&&,valueLogical]"],MONTH:["valueLogical","*[&&,valueLogical]"],DAY:["valueLogical","*[&&,valueLogical]"],HOURS:["valueLogical","*[&&,valueLogical]"],MINUTES:["valueLogical","*[&&,valueLogical]"],SECONDS:["valueLogical","*[&&,valueLogical]"],TIMEZONE:["valueLogical","*[&&,valueLogical]"],TZ:["valueLogical","*[&&,valueLogical]"],NOW:["valueLogical","*[&&,valueLogical]"],UUID:["valueLogical","*[&&,valueLogical]"],STRUUID:["valueLogical","*[&&,valueLogical]"],MD5:["valueLogical","*[&&,valueLogical]"],SHA1:["valueLogical","*[&&,valueLogical]"],SHA256:["valueLogical","*[&&,valueLogical]"],SHA384:["valueLogical","*[&&,valueLogical]"],SHA512:["valueLogical","*[&&,valueLogical]"],COALESCE:["valueLogical","*[&&,valueLogical]"],IF:["valueLogical","*[&&,valueLogical]"],STRLANG:["valueLogical","*[&&,valueLogical]"],STRDT:["valueLogical","*[&&,valueLogical]"],SAMETERM:["valueLogical","*[&&,valueLogical]"],ISIRI:["valueLogical","*[&&,valueLogical]"],ISURI:["valueLogical","*[&&,valueLogical]"],ISBLANK:["valueLogical","*[&&,valueLogical]"],ISLITERAL:["valueLogical","*[&&,valueLogical]"],ISNUMERIC:["valueLogical","*[&&,valueLogical]"],TRUE:["valueLogical","*[&&,valueLogical]"],FALSE:["valueLogical","*[&&,valueLogical]"],COUNT:["valueLogical","*[&&,valueLogical]"],SUM:["valueLogical","*[&&,valueLogical]"],MIN:["valueLogical","*[&&,valueLogical]"],MAX:["valueLogical","*[&&,valueLogical]"],AVG:["valueLogical","*[&&,valueLogical]"],SAMPLE:["valueLogical","*[&&,valueLogical]"],GROUP_CONCAT:["valueLogical","*[&&,valueLogical]"],SUBSTR:["valueLogical","*[&&,valueLogical]"],REPLACE:["valueLogical","*[&&,valueLogical]"],REGEX:["valueLogical","*[&&,valueLogical]"],EXISTS:["valueLogical","*[&&,valueLogical]"],NOT:["valueLogical","*[&&,valueLogical]"],IRI_REF:["valueLogical","*[&&,valueLogical]"],STRING_LITERAL1:["valueLogical","*[&&,valueLogical]"],STRING_LITERAL2:["valueLogical","*[&&,valueLogical]"],STRING_LITERAL_LONG1:["valueLogical","*[&&,valueLogical]"],STRING_LITERAL_LONG2:["valueLogical","*[&&,valueLogical]"],INTEGER:["valueLogical","*[&&,valueLogical]"],DECIMAL:["valueLogical","*[&&,valueLogical]"],DOUBLE:["valueLogical","*[&&,valueLogical]"],INTEGER_POSITIVE:["valueLogical","*[&&,valueLogical]"],DECIMAL_POSITIVE:["valueLogical","*[&&,valueLogical]"],DOUBLE_POSITIVE:["valueLogical","*[&&,valueLogical]"],INTEGER_NEGATIVE:["valueLogical","*[&&,valueLogical]"],DECIMAL_NEGATIVE:["valueLogical","*[&&,valueLogical]"],DOUBLE_NEGATIVE:["valueLogical","*[&&,valueLogical]"],PNAME_LN:["valueLogical","*[&&,valueLogical]"],PNAME_NS:["valueLogical","*[&&,valueLogical]"]},conditionalOrExpression:{"!":["conditionalAndExpression","*[||,conditionalAndExpression]"],"+":["conditionalAndExpression","*[||,conditionalAndExpression]"],"-":["conditionalAndExpression","*[||,conditionalAndExpression]"],VAR1:["conditionalAndExpression","*[||,conditionalAndExpression]"],VAR2:["conditionalAndExpression","*[||,conditionalAndExpression]"],"(":["conditionalAndExpression","*[||,conditionalAndExpression]"],STR:["conditionalAndExpression","*[||,conditionalAndExpression]"],LANG:["conditionalAndExpression","*[||,conditionalAndExpression]"],LANGMATCHES:["conditionalAndExpression","*[||,conditionalAndExpression]"],DATATYPE:["conditionalAndExpression","*[||,conditionalAndExpression]"],BOUND:["conditionalAndExpression","*[||,conditionalAndExpression]"],IRI:["conditionalAndExpression","*[||,conditionalAndExpression]"],URI:["conditionalAndExpression","*[||,conditionalAndExpression]"],BNODE:["conditionalAndExpression","*[||,conditionalAndExpression]"],RAND:["conditionalAndExpression","*[||,conditionalAndExpression]"],ABS:["conditionalAndExpression","*[||,conditionalAndExpression]"],CEIL:["conditionalAndExpression","*[||,conditionalAndExpression]"],FLOOR:["conditionalAndExpression","*[||,conditionalAndExpression]"],ROUND:["conditionalAndExpression","*[||,conditionalAndExpression]"],CONCAT:["conditionalAndExpression","*[||,conditionalAndExpression]"],STRLEN:["conditionalAndExpression","*[||,conditionalAndExpression]"],UCASE:["conditionalAndExpression","*[||,conditionalAndExpression]"],LCASE:["conditionalAndExpression","*[||,conditionalAndExpression]"],ENCODE_FOR_URI:["conditionalAndExpression","*[||,conditionalAndExpression]"],CONTAINS:["conditionalAndExpression","*[||,conditionalAndExpression]"],STRSTARTS:["conditionalAndExpression","*[||,conditionalAndExpression]"],STRENDS:["conditionalAndExpression","*[||,conditionalAndExpression]"],STRBEFORE:["conditionalAndExpression","*[||,conditionalAndExpression]"],STRAFTER:["conditionalAndExpression","*[||,conditionalAndExpression]"],YEAR:["conditionalAndExpression","*[||,conditionalAndExpression]"],MONTH:["conditionalAndExpression","*[||,conditionalAndExpression]"],DAY:["conditionalAndExpression","*[||,conditionalAndExpression]"],HOURS:["conditionalAndExpression","*[||,conditionalAndExpression]"],MINUTES:["conditionalAndExpression","*[||,conditionalAndExpression]"],SECONDS:["conditionalAndExpression","*[||,conditionalAndExpression]"],TIMEZONE:["conditionalAndExpression","*[||,conditionalAndExpression]"],TZ:["conditionalAndExpression","*[||,conditionalAndExpression]"],NOW:["conditionalAndExpression","*[||,conditionalAndExpression]"],UUID:["conditionalAndExpression","*[||,conditionalAndExpression]"],STRUUID:["conditionalAndExpression","*[||,conditionalAndExpression]"],MD5:["conditionalAndExpression","*[||,conditionalAndExpression]"],SHA1:["conditionalAndExpression","*[||,conditionalAndExpression]"],SHA256:["conditionalAndExpression","*[||,conditionalAndExpression]"],SHA384:["conditionalAndExpression","*[||,conditionalAndExpression]"],SHA512:["conditionalAndExpression","*[||,conditionalAndExpression]"],COALESCE:["conditionalAndExpression","*[||,conditionalAndExpression]"],IF:["conditionalAndExpression","*[||,conditionalAndExpression]"],STRLANG:["conditionalAndExpression","*[||,conditionalAndExpression]"],STRDT:["conditionalAndExpression","*[||,conditionalAndExpression]"],SAMETERM:["conditionalAndExpression","*[||,conditionalAndExpression]"],ISIRI:["conditionalAndExpression","*[||,conditionalAndExpression]"],ISURI:["conditionalAndExpression","*[||,conditionalAndExpression]"],ISBLANK:["conditionalAndExpression","*[||,conditionalAndExpression]"],ISLITERAL:["conditionalAndExpression","*[||,conditionalAndExpression]"],ISNUMERIC:["conditionalAndExpression","*[||,conditionalAndExpression]"],TRUE:["conditionalAndExpression","*[||,conditionalAndExpression]"],FALSE:["conditionalAndExpression","*[||,conditionalAndExpression]"],COUNT:["conditionalAndExpression","*[||,conditionalAndExpression]"],SUM:["conditionalAndExpression","*[||,conditionalAndExpression]"],MIN:["conditionalAndExpression","*[||,conditionalAndExpression]"],MAX:["conditionalAndExpression","*[||,conditionalAndExpression]"],AVG:["conditionalAndExpression","*[||,conditionalAndExpression]"],SAMPLE:["conditionalAndExpression","*[||,conditionalAndExpression]"],GROUP_CONCAT:["conditionalAndExpression","*[||,conditionalAndExpression]"],SUBSTR:["conditionalAndExpression","*[||,conditionalAndExpression]"],REPLACE:["conditionalAndExpression","*[||,conditionalAndExpression]"],REGEX:["conditionalAndExpression","*[||,conditionalAndExpression]"],EXISTS:["conditionalAndExpression","*[||,conditionalAndExpression]"],NOT:["conditionalAndExpression","*[||,conditionalAndExpression]"],IRI_REF:["conditionalAndExpression","*[||,conditionalAndExpression]"],STRING_LITERAL1:["conditionalAndExpression","*[||,conditionalAndExpression]"],STRING_LITERAL2:["conditionalAndExpression","*[||,conditionalAndExpression]"],STRING_LITERAL_LONG1:["conditionalAndExpression","*[||,conditionalAndExpression]"],STRING_LITERAL_LONG2:["conditionalAndExpression","*[||,conditionalAndExpression]"],INTEGER:["conditionalAndExpression","*[||,conditionalAndExpression]"],DECIMAL:["conditionalAndExpression","*[||,conditionalAndExpression]"],DOUBLE:["conditionalAndExpression","*[||,conditionalAndExpression]"],INTEGER_POSITIVE:["conditionalAndExpression","*[||,conditionalAndExpression]"],DECIMAL_POSITIVE:["conditionalAndExpression","*[||,conditionalAndExpression]"],DOUBLE_POSITIVE:["conditionalAndExpression","*[||,conditionalAndExpression]"],INTEGER_NEGATIVE:["conditionalAndExpression","*[||,conditionalAndExpression]"],DECIMAL_NEGATIVE:["conditionalAndExpression","*[||,conditionalAndExpression]"],DOUBLE_NEGATIVE:["conditionalAndExpression","*[||,conditionalAndExpression]"],PNAME_LN:["conditionalAndExpression","*[||,conditionalAndExpression]"],PNAME_NS:["conditionalAndExpression","*[||,conditionalAndExpression]"]},constraint:{"(":["brackettedExpression"],STR:["builtInCall"],LANG:["builtInCall"],LANGMATCHES:["builtInCall"],DATATYPE:["builtInCall"],BOUND:["builtInCall"],IRI:["builtInCall"],URI:["builtInCall"],BNODE:["builtInCall"],RAND:["builtInCall"],ABS:["builtInCall"],CEIL:["builtInCall"],FLOOR:["builtInCall"],ROUND:["builtInCall"],CONCAT:["builtInCall"],STRLEN:["builtInCall"],UCASE:["builtInCall"],LCASE:["builtInCall"],ENCODE_FOR_URI:["builtInCall"],CONTAINS:["builtInCall"],STRSTARTS:["builtInCall"],STRENDS:["builtInCall"],STRBEFORE:["builtInCall"],STRAFTER:["builtInCall"],YEAR:["builtInCall"],MONTH:["builtInCall"],DAY:["builtInCall"],HOURS:["builtInCall"],MINUTES:["builtInCall"],SECONDS:["builtInCall"],TIMEZONE:["builtInCall"],TZ:["builtInCall"],NOW:["builtInCall"],UUID:["builtInCall"],STRUUID:["builtInCall"],MD5:["builtInCall"],SHA1:["builtInCall"],SHA256:["builtInCall"],SHA384:["builtInCall"],SHA512:["builtInCall"],COALESCE:["builtInCall"],IF:["builtInCall"],STRLANG:["builtInCall"],STRDT:["builtInCall"],SAMETERM:["builtInCall"],ISIRI:["builtInCall"],ISURI:["builtInCall"],ISBLANK:["builtInCall"],ISLITERAL:["builtInCall"],ISNUMERIC:["builtInCall"],SUBSTR:["builtInCall"],REPLACE:["builtInCall"],REGEX:["builtInCall"],EXISTS:["builtInCall"],NOT:["builtInCall"],IRI_REF:["functionCall"],PNAME_LN:["functionCall"],PNAME_NS:["functionCall"]},constructQuery:{CONSTRUCT:["CONSTRUCT","or([[constructTemplate,*datasetClause,whereClause,solutionModifier],[*datasetClause,WHERE,{,?triplesTemplate,},solutionModifier]])"]},constructTemplate:{"{":["{","?constructTriples","}"]},constructTriples:{VAR1:["triplesSameSubject","?[.,?constructTriples]"],VAR2:["triplesSameSubject","?[.,?constructTriples]"],NIL:["triplesSameSubject","?[.,?constructTriples]"],"(":["triplesSameSubject","?[.,?constructTriples]"],"[":["triplesSameSubject","?[.,?constructTriples]"],IRI_REF:["triplesSameSubject","?[.,?constructTriples]"],TRUE:["triplesSameSubject","?[.,?constructTriples]"],FALSE:["triplesSameSubject","?[.,?constructTriples]"],BLANK_NODE_LABEL:["triplesSameSubject","?[.,?constructTriples]"],ANON:["triplesSameSubject","?[.,?constructTriples]"],PNAME_LN:["triplesSameSubject","?[.,?constructTriples]"],PNAME_NS:["triplesSameSubject","?[.,?constructTriples]"],STRING_LITERAL1:["triplesSameSubject","?[.,?constructTriples]"],STRING_LITERAL2:["triplesSameSubject","?[.,?constructTriples]"],STRING_LITERAL_LONG1:["triplesSameSubject","?[.,?constructTriples]"],STRING_LITERAL_LONG2:["triplesSameSubject","?[.,?constructTriples]"],INTEGER:["triplesSameSubject","?[.,?constructTriples]"],DECIMAL:["triplesSameSubject","?[.,?constructTriples]"],DOUBLE:["triplesSameSubject","?[.,?constructTriples]"],INTEGER_POSITIVE:["triplesSameSubject","?[.,?constructTriples]"],DECIMAL_POSITIVE:["triplesSameSubject","?[.,?constructTriples]"],DOUBLE_POSITIVE:["triplesSameSubject","?[.,?constructTriples]"],INTEGER_NEGATIVE:["triplesSameSubject","?[.,?constructTriples]"],DECIMAL_NEGATIVE:["triplesSameSubject","?[.,?constructTriples]"],DOUBLE_NEGATIVE:["triplesSameSubject","?[.,?constructTriples]"]},copy:{COPY:["COPY","?SILENT_4","graphOrDefault","TO","graphOrDefault"]},create:{CREATE:["CREATE","?SILENT_3","graphRef"]},dataBlock:{NIL:["or([inlineDataOneVar,inlineDataFull])"],"(":["or([inlineDataOneVar,inlineDataFull])"],VAR1:["or([inlineDataOneVar,inlineDataFull])"],VAR2:["or([inlineDataOneVar,inlineDataFull])"]},dataBlockValue:{IRI_REF:["iriRef"],PNAME_LN:["iriRef"],PNAME_NS:["iriRef"],STRING_LITERAL1:["rdfLiteral"],STRING_LITERAL2:["rdfLiteral"],STRING_LITERAL_LONG1:["rdfLiteral"],STRING_LITERAL_LONG2:["rdfLiteral"],INTEGER:["numericLiteral"],DECIMAL:["numericLiteral"],DOUBLE:["numericLiteral"],INTEGER_POSITIVE:["numericLiteral"],DECIMAL_POSITIVE:["numericLiteral"],DOUBLE_POSITIVE:["numericLiteral"],INTEGER_NEGATIVE:["numericLiteral"],DECIMAL_NEGATIVE:["numericLiteral"],DOUBLE_NEGATIVE:["numericLiteral"],TRUE:["booleanLiteral"],FALSE:["booleanLiteral"],UNDEF:["UNDEF"]},datasetClause:{FROM:["FROM","or([defaultGraphClause,namedGraphClause])"]},defaultGraphClause:{IRI_REF:["sourceSelector"],PNAME_LN:["sourceSelector"],PNAME_NS:["sourceSelector"]},delete1:{DATA:["DATA","quadDataNoBnodes"],WHERE:["WHERE","quadPatternNoBnodes"],"{":["quadPatternNoBnodes","?insertClause","*usingClause","WHERE","groupGraphPattern"]},deleteClause:{DELETE:["DELETE","quadPattern"]},describeDatasetClause:{FROM:["FROM","or([defaultGraphClause,namedGraphClause])"]},describeQuery:{DESCRIBE:["DESCRIBE","or([+varOrIRIref,*])","*describeDatasetClause","?whereClause","solutionModifier"]},disallowBnodes:{"}":[],GRAPH:[],VAR1:[],VAR2:[],NIL:[],"(":[],"[":[],IRI_REF:[],TRUE:[],FALSE:[],BLANK_NODE_LABEL:[],ANON:[],PNAME_LN:[],PNAME_NS:[],STRING_LITERAL1:[],STRING_LITERAL2:[],STRING_LITERAL_LONG1:[],STRING_LITERAL_LONG2:[],INTEGER:[],DECIMAL:[],DOUBLE:[],INTEGER_POSITIVE:[],DECIMAL_POSITIVE:[],DOUBLE_POSITIVE:[],INTEGER_NEGATIVE:[],DECIMAL_NEGATIVE:[],DOUBLE_NEGATIVE:[]},disallowVars:{"}":[],GRAPH:[],VAR1:[],VAR2:[],NIL:[],"(":[],"[":[],IRI_REF:[],TRUE:[],FALSE:[],BLANK_NODE_LABEL:[],ANON:[],PNAME_LN:[],PNAME_NS:[],STRING_LITERAL1:[],STRING_LITERAL2:[],STRING_LITERAL_LONG1:[],STRING_LITERAL_LONG2:[],INTEGER:[],DECIMAL:[],DOUBLE:[],INTEGER_POSITIVE:[],DECIMAL_POSITIVE:[],DOUBLE_POSITIVE:[],INTEGER_NEGATIVE:[],DECIMAL_NEGATIVE:[],DOUBLE_NEGATIVE:[]},drop:{DROP:["DROP","?SILENT_2","graphRefAll"]},existsFunc:{EXISTS:["EXISTS","groupGraphPattern"]},expression:{"!":["conditionalOrExpression"],"+":["conditionalOrExpression"],"-":["conditionalOrExpression"],VAR1:["conditionalOrExpression"],VAR2:["conditionalOrExpression"],"(":["conditionalOrExpression"],STR:["conditionalOrExpression"],LANG:["conditionalOrExpression"],LANGMATCHES:["conditionalOrExpression"],DATATYPE:["conditionalOrExpression"],BOUND:["conditionalOrExpression"],IRI:["conditionalOrExpression"],URI:["conditionalOrExpression"],BNODE:["conditionalOrExpression"],RAND:["conditionalOrExpression"],ABS:["conditionalOrExpression"],CEIL:["conditionalOrExpression"],FLOOR:["conditionalOrExpression"],ROUND:["conditionalOrExpression"],CONCAT:["conditionalOrExpression"],STRLEN:["conditionalOrExpression"],UCASE:["conditionalOrExpression"],LCASE:["conditionalOrExpression"],ENCODE_FOR_URI:["conditionalOrExpression"],CONTAINS:["conditionalOrExpression"],STRSTARTS:["conditionalOrExpression"],STRENDS:["conditionalOrExpression"],STRBEFORE:["conditionalOrExpression"],STRAFTER:["conditionalOrExpression"],YEAR:["conditionalOrExpression"],MONTH:["conditionalOrExpression"],DAY:["conditionalOrExpression"],HOURS:["conditionalOrExpression"],MINUTES:["conditionalOrExpression"],SECONDS:["conditionalOrExpression"],TIMEZONE:["conditionalOrExpression"],TZ:["conditionalOrExpression"],NOW:["conditionalOrExpression"],UUID:["conditionalOrExpression"],STRUUID:["conditionalOrExpression"],MD5:["conditionalOrExpression"],SHA1:["conditionalOrExpression"],SHA256:["conditionalOrExpression"],SHA384:["conditionalOrExpression"],SHA512:["conditionalOrExpression"],COALESCE:["conditionalOrExpression"],IF:["conditionalOrExpression"],STRLANG:["conditionalOrExpression"],STRDT:["conditionalOrExpression"],SAMETERM:["conditionalOrExpression"],ISIRI:["conditionalOrExpression"],ISURI:["conditionalOrExpression"],ISBLANK:["conditionalOrExpression"],ISLITERAL:["conditionalOrExpression"],ISNUMERIC:["conditionalOrExpression"],TRUE:["conditionalOrExpression"],FALSE:["conditionalOrExpression"],COUNT:["conditionalOrExpression"],SUM:["conditionalOrExpression"],MIN:["conditionalOrExpression"],MAX:["conditionalOrExpression"],AVG:["conditionalOrExpression"],SAMPLE:["conditionalOrExpression"],GROUP_CONCAT:["conditionalOrExpression"],SUBSTR:["conditionalOrExpression"],REPLACE:["conditionalOrExpression"],REGEX:["conditionalOrExpression"],EXISTS:["conditionalOrExpression"],NOT:["conditionalOrExpression"],IRI_REF:["conditionalOrExpression"],STRING_LITERAL1:["conditionalOrExpression"],STRING_LITERAL2:["conditionalOrExpression"],STRING_LITERAL_LONG1:["conditionalOrExpression"],STRING_LITERAL_LONG2:["conditionalOrExpression"],INTEGER:["conditionalOrExpression"],DECIMAL:["conditionalOrExpression"],DOUBLE:["conditionalOrExpression"],INTEGER_POSITIVE:["conditionalOrExpression"],DECIMAL_POSITIVE:["conditionalOrExpression"],DOUBLE_POSITIVE:["conditionalOrExpression"],INTEGER_NEGATIVE:["conditionalOrExpression"],DECIMAL_NEGATIVE:["conditionalOrExpression"],DOUBLE_NEGATIVE:["conditionalOrExpression"],PNAME_LN:["conditionalOrExpression"],PNAME_NS:["conditionalOrExpression"]},expressionList:{NIL:["NIL"],"(":["(","expression","*[,,expression]",")"]},filter:{FILTER:["FILTER","constraint"]},functionCall:{IRI_REF:["iriRef","argList"],PNAME_LN:["iriRef","argList"],PNAME_NS:["iriRef","argList"]},graphGraphPattern:{GRAPH:["GRAPH","varOrIRIref","groupGraphPattern"]},graphNode:{VAR1:["varOrTerm"],VAR2:["varOrTerm"],NIL:["varOrTerm"],IRI_REF:["varOrTerm"],TRUE:["varOrTerm"],FALSE:["varOrTerm"],BLANK_NODE_LABEL:["varOrTerm"],ANON:["varOrTerm"],PNAME_LN:["varOrTerm"],PNAME_NS:["varOrTerm"],STRING_LITERAL1:["varOrTerm"],STRING_LITERAL2:["varOrTerm"],STRING_LITERAL_LONG1:["varOrTerm"],STRING_LITERAL_LONG2:["varOrTerm"],INTEGER:["varOrTerm"],DECIMAL:["varOrTerm"],DOUBLE:["varOrTerm"],INTEGER_POSITIVE:["varOrTerm"],DECIMAL_POSITIVE:["varOrTerm"],DOUBLE_POSITIVE:["varOrTerm"],INTEGER_NEGATIVE:["varOrTerm"],DECIMAL_NEGATIVE:["varOrTerm"],DOUBLE_NEGATIVE:["varOrTerm"],"(":["triplesNode"],"[":["triplesNode"]},graphNodePath:{VAR1:["varOrTerm"],VAR2:["varOrTerm"],NIL:["varOrTerm"],IRI_REF:["varOrTerm"],TRUE:["varOrTerm"],FALSE:["varOrTerm"],BLANK_NODE_LABEL:["varOrTerm"],ANON:["varOrTerm"],PNAME_LN:["varOrTerm"],PNAME_NS:["varOrTerm"],STRING_LITERAL1:["varOrTerm"],STRING_LITERAL2:["varOrTerm"],STRING_LITERAL_LONG1:["varOrTerm"],STRING_LITERAL_LONG2:["varOrTerm"],INTEGER:["varOrTerm"],DECIMAL:["varOrTerm"],DOUBLE:["varOrTerm"],INTEGER_POSITIVE:["varOrTerm"],DECIMAL_POSITIVE:["varOrTerm"],DOUBLE_POSITIVE:["varOrTerm"],INTEGER_NEGATIVE:["varOrTerm"],DECIMAL_NEGATIVE:["varOrTerm"],DOUBLE_NEGATIVE:["varOrTerm"],"(":["triplesNodePath"],"[":["triplesNodePath"]},graphOrDefault:{DEFAULT:["DEFAULT"],IRI_REF:["?GRAPH","iriRef"],PNAME_LN:["?GRAPH","iriRef"],PNAME_NS:["?GRAPH","iriRef"],GRAPH:["?GRAPH","iriRef"]},graphPatternNotTriples:{"{":["groupOrUnionGraphPattern"],OPTIONAL:["optionalGraphPattern"],MINUS:["minusGraphPattern"],GRAPH:["graphGraphPattern"],SERVICE:["serviceGraphPattern"],FILTER:["filter"],BIND:["bind"],VALUES:["inlineData"]},graphRef:{GRAPH:["GRAPH","iriRef"]},graphRefAll:{GRAPH:["graphRef"],DEFAULT:["DEFAULT"],NAMED:["NAMED"],ALL:["ALL"]},graphTerm:{IRI_REF:["iriRef"],PNAME_LN:["iriRef"],PNAME_NS:["iriRef"],STRING_LITERAL1:["rdfLiteral"],STRING_LITERAL2:["rdfLiteral"],STRING_LITERAL_LONG1:["rdfLiteral"],STRING_LITERAL_LONG2:["rdfLiteral"],INTEGER:["numericLiteral"],DECIMAL:["numericLiteral"],DOUBLE:["numericLiteral"],INTEGER_POSITIVE:["numericLiteral"],DECIMAL_POSITIVE:["numericLiteral"],DOUBLE_POSITIVE:["numericLiteral"],INTEGER_NEGATIVE:["numericLiteral"],DECIMAL_NEGATIVE:["numericLiteral"],DOUBLE_NEGATIVE:["numericLiteral"],TRUE:["booleanLiteral"],FALSE:["booleanLiteral"],BLANK_NODE_LABEL:["blankNode"],ANON:["blankNode"],NIL:["NIL"]},groupClause:{GROUP:["GROUP","BY","+groupCondition"]},groupCondition:{STR:["builtInCall"],LANG:["builtInCall"],LANGMATCHES:["builtInCall"],DATATYPE:["builtInCall"],BOUND:["builtInCall"],IRI:["builtInCall"],URI:["builtInCall"],BNODE:["builtInCall"],RAND:["builtInCall"],ABS:["builtInCall"],CEIL:["builtInCall"],FLOOR:["builtInCall"],ROUND:["builtInCall"],CONCAT:["builtInCall"],STRLEN:["builtInCall"],UCASE:["builtInCall"],LCASE:["builtInCall"],ENCODE_FOR_URI:["builtInCall"],CONTAINS:["builtInCall"],STRSTARTS:["builtInCall"],STRENDS:["builtInCall"],STRBEFORE:["builtInCall"],STRAFTER:["builtInCall"],YEAR:["builtInCall"],MONTH:["builtInCall"],DAY:["builtInCall"],HOURS:["builtInCall"],MINUTES:["builtInCall"],SECONDS:["builtInCall"],TIMEZONE:["builtInCall"],TZ:["builtInCall"],NOW:["builtInCall"],UUID:["builtInCall"],STRUUID:["builtInCall"],MD5:["builtInCall"],SHA1:["builtInCall"],SHA256:["builtInCall"],SHA384:["builtInCall"],SHA512:["builtInCall"],COALESCE:["builtInCall"],IF:["builtInCall"],STRLANG:["builtInCall"],STRDT:["builtInCall"],SAMETERM:["builtInCall"],ISIRI:["builtInCall"],ISURI:["builtInCall"],ISBLANK:["builtInCall"],ISLITERAL:["builtInCall"],ISNUMERIC:["builtInCall"],SUBSTR:["builtInCall"],REPLACE:["builtInCall"],REGEX:["builtInCall"],EXISTS:["builtInCall"],NOT:["builtInCall"],IRI_REF:["functionCall"],PNAME_LN:["functionCall"],PNAME_NS:["functionCall"],"(":["(","expression","?[AS,var]",")"],VAR1:["var"],VAR2:["var"]},groupGraphPattern:{"{":["{","or([subSelect,groupGraphPatternSub])","}"]},groupGraphPatternSub:{"{":["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],OPTIONAL:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],MINUS:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],GRAPH:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],SERVICE:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],FILTER:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],BIND:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],VALUES:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],VAR1:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],VAR2:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],NIL:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],"(":["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],"[":["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],IRI_REF:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],TRUE:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],FALSE:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],BLANK_NODE_LABEL:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],ANON:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],PNAME_LN:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],PNAME_NS:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],STRING_LITERAL1:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],STRING_LITERAL2:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],STRING_LITERAL_LONG1:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],STRING_LITERAL_LONG2:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],INTEGER:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],DECIMAL:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],DOUBLE:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],INTEGER_POSITIVE:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],DECIMAL_POSITIVE:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],DOUBLE_POSITIVE:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],INTEGER_NEGATIVE:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],DECIMAL_NEGATIVE:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],DOUBLE_NEGATIVE:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],"}":["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"]},groupOrUnionGraphPattern:{"{":["groupGraphPattern","*[UNION,groupGraphPattern]"]},havingClause:{HAVING:["HAVING","+havingCondition"]},havingCondition:{"(":["constraint"],STR:["constraint"],LANG:["constraint"],LANGMATCHES:["constraint"],DATATYPE:["constraint"],BOUND:["constraint"],IRI:["constraint"],URI:["constraint"],BNODE:["constraint"],RAND:["constraint"],ABS:["constraint"],CEIL:["constraint"],FLOOR:["constraint"],ROUND:["constraint"],CONCAT:["constraint"],STRLEN:["constraint"],UCASE:["constraint"],LCASE:["constraint"],ENCODE_FOR_URI:["constraint"],CONTAINS:["constraint"],STRSTARTS:["constraint"],STRENDS:["constraint"],STRBEFORE:["constraint"],STRAFTER:["constraint"],YEAR:["constraint"],MONTH:["constraint"],DAY:["constraint"],HOURS:["constraint"],MINUTES:["constraint"],SECONDS:["constraint"],TIMEZONE:["constraint"],TZ:["constraint"],NOW:["constraint"],UUID:["constraint"],STRUUID:["constraint"],MD5:["constraint"],SHA1:["constraint"],SHA256:["constraint"],SHA384:["constraint"],SHA512:["constraint"],COALESCE:["constraint"],IF:["constraint"],STRLANG:["constraint"],STRDT:["constraint"],SAMETERM:["constraint"],ISIRI:["constraint"],ISURI:["constraint"],ISBLANK:["constraint"],ISLITERAL:["constraint"],ISNUMERIC:["constraint"],SUBSTR:["constraint"],REPLACE:["constraint"],REGEX:["constraint"],EXISTS:["constraint"],NOT:["constraint"],IRI_REF:["constraint"],PNAME_LN:["constraint"],PNAME_NS:["constraint"]},inlineData:{VALUES:["VALUES","dataBlock"]},inlineDataFull:{NIL:["or([NIL,[ (,*var,)]])","{","*or([[ (,*dataBlockValue,)],NIL])","}"],"(":["or([NIL,[ (,*var,)]])","{","*or([[ (,*dataBlockValue,)],NIL])","}"]},inlineDataOneVar:{VAR1:["var","{","*dataBlockValue","}"],VAR2:["var","{","*dataBlockValue","}"]},insert1:{DATA:["DATA","quadData"],"{":["quadPattern","*usingClause","WHERE","groupGraphPattern"]},insertClause:{INSERT:["INSERT","quadPattern"]},integer:{INTEGER:["INTEGER"]},iriRef:{IRI_REF:["IRI_REF"],PNAME_LN:["prefixedName"],PNAME_NS:["prefixedName"]},iriRefOrFunction:{IRI_REF:["iriRef","?argList"],PNAME_LN:["iriRef","?argList"],PNAME_NS:["iriRef","?argList"]},limitClause:{LIMIT:["LIMIT","INTEGER"]},limitOffsetClauses:{LIMIT:["limitClause","?offsetClause"],OFFSET:["offsetClause","?limitClause"]},load:{LOAD:["LOAD","?SILENT_1","iriRef","?[INTO,graphRef]"]},minusGraphPattern:{MINUS:["MINUS","groupGraphPattern"]},modify:{WITH:["WITH","iriRef","or([[deleteClause,?insertClause],insertClause])","*usingClause","WHERE","groupGraphPattern"]},move:{MOVE:["MOVE","?SILENT_4","graphOrDefault","TO","graphOrDefault"]},multiplicativeExpression:{"!":["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],"+":["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],"-":["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],VAR1:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],VAR2:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],"(":["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STR:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],LANG:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],LANGMATCHES:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],DATATYPE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],BOUND:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],IRI:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],URI:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],BNODE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],RAND:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],ABS:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],CEIL:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],FLOOR:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],ROUND:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],CONCAT:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STRLEN:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],UCASE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],LCASE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],ENCODE_FOR_URI:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],CONTAINS:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STRSTARTS:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STRENDS:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STRBEFORE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STRAFTER:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],YEAR:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],MONTH:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],DAY:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],HOURS:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],MINUTES:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],SECONDS:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],TIMEZONE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],TZ:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],NOW:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],UUID:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STRUUID:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],MD5:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],SHA1:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],SHA256:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],SHA384:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],SHA512:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],COALESCE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],IF:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STRLANG:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STRDT:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],SAMETERM:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],ISIRI:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],ISURI:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],ISBLANK:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],ISLITERAL:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],ISNUMERIC:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],TRUE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],FALSE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],COUNT:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],SUM:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],MIN:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],MAX:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],AVG:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],SAMPLE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],GROUP_CONCAT:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],SUBSTR:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],REPLACE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],REGEX:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],EXISTS:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],NOT:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],IRI_REF:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STRING_LITERAL1:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STRING_LITERAL2:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STRING_LITERAL_LONG1:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STRING_LITERAL_LONG2:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],INTEGER:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],DECIMAL:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],DOUBLE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],INTEGER_POSITIVE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],DECIMAL_POSITIVE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],DOUBLE_POSITIVE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],INTEGER_NEGATIVE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],DECIMAL_NEGATIVE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],DOUBLE_NEGATIVE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],PNAME_LN:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],PNAME_NS:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"]},namedGraphClause:{NAMED:["NAMED","sourceSelector"]},notExistsFunc:{NOT:["NOT","EXISTS","groupGraphPattern"]},numericExpression:{"!":["additiveExpression"],"+":["additiveExpression"],"-":["additiveExpression"],VAR1:["additiveExpression"],VAR2:["additiveExpression"],"(":["additiveExpression"],STR:["additiveExpression"],LANG:["additiveExpression"],LANGMATCHES:["additiveExpression"],DATATYPE:["additiveExpression"],BOUND:["additiveExpression"],IRI:["additiveExpression"],URI:["additiveExpression"],BNODE:["additiveExpression"],RAND:["additiveExpression"],ABS:["additiveExpression"],CEIL:["additiveExpression"],FLOOR:["additiveExpression"],ROUND:["additiveExpression"],CONCAT:["additiveExpression"],STRLEN:["additiveExpression"],UCASE:["additiveExpression"],LCASE:["additiveExpression"],ENCODE_FOR_URI:["additiveExpression"],CONTAINS:["additiveExpression"],STRSTARTS:["additiveExpression"],STRENDS:["additiveExpression"],STRBEFORE:["additiveExpression"],STRAFTER:["additiveExpression"],YEAR:["additiveExpression"],MONTH:["additiveExpression"],DAY:["additiveExpression"],HOURS:["additiveExpression"],MINUTES:["additiveExpression"],SECONDS:["additiveExpression"],TIMEZONE:["additiveExpression"],TZ:["additiveExpression"],NOW:["additiveExpression"],UUID:["additiveExpression"],STRUUID:["additiveExpression"],MD5:["additiveExpression"],SHA1:["additiveExpression"],SHA256:["additiveExpression"],SHA384:["additiveExpression"],SHA512:["additiveExpression"],COALESCE:["additiveExpression"],IF:["additiveExpression"],STRLANG:["additiveExpression"],STRDT:["additiveExpression"],SAMETERM:["additiveExpression"],ISIRI:["additiveExpression"],ISURI:["additiveExpression"],ISBLANK:["additiveExpression"],ISLITERAL:["additiveExpression"],ISNUMERIC:["additiveExpression"],TRUE:["additiveExpression"],FALSE:["additiveExpression"],COUNT:["additiveExpression"],SUM:["additiveExpression"],MIN:["additiveExpression"],MAX:["additiveExpression"],AVG:["additiveExpression"],SAMPLE:["additiveExpression"],GROUP_CONCAT:["additiveExpression"],SUBSTR:["additiveExpression"],REPLACE:["additiveExpression"],REGEX:["additiveExpression"],EXISTS:["additiveExpression"],NOT:["additiveExpression"],IRI_REF:["additiveExpression"],STRING_LITERAL1:["additiveExpression"],STRING_LITERAL2:["additiveExpression"],STRING_LITERAL_LONG1:["additiveExpression"],STRING_LITERAL_LONG2:["additiveExpression"],INTEGER:["additiveExpression"],DECIMAL:["additiveExpression"],DOUBLE:["additiveExpression"],INTEGER_POSITIVE:["additiveExpression"],DECIMAL_POSITIVE:["additiveExpression"],DOUBLE_POSITIVE:["additiveExpression"],INTEGER_NEGATIVE:["additiveExpression"],DECIMAL_NEGATIVE:["additiveExpression"],DOUBLE_NEGATIVE:["additiveExpression"],PNAME_LN:["additiveExpression"],PNAME_NS:["additiveExpression"]},numericLiteral:{INTEGER:["numericLiteralUnsigned"],DECIMAL:["numericLiteralUnsigned"],DOUBLE:["numericLiteralUnsigned"],INTEGER_POSITIVE:["numericLiteralPositive"],DECIMAL_POSITIVE:["numericLiteralPositive"],DOUBLE_POSITIVE:["numericLiteralPositive"],INTEGER_NEGATIVE:["numericLiteralNegative"],DECIMAL_NEGATIVE:["numericLiteralNegative"],DOUBLE_NEGATIVE:["numericLiteralNegative"]},numericLiteralNegative:{INTEGER_NEGATIVE:["INTEGER_NEGATIVE"],DECIMAL_NEGATIVE:["DECIMAL_NEGATIVE"],DOUBLE_NEGATIVE:["DOUBLE_NEGATIVE"]},numericLiteralPositive:{INTEGER_POSITIVE:["INTEGER_POSITIVE"],DECIMAL_POSITIVE:["DECIMAL_POSITIVE"],DOUBLE_POSITIVE:["DOUBLE_POSITIVE"]},numericLiteralUnsigned:{INTEGER:["INTEGER"],DECIMAL:["DECIMAL"],DOUBLE:["DOUBLE"]},object:{"(":["graphNode"],"[":["graphNode"],VAR1:["graphNode"],VAR2:["graphNode"],NIL:["graphNode"],IRI_REF:["graphNode"],TRUE:["graphNode"],FALSE:["graphNode"],BLANK_NODE_LABEL:["graphNode"],ANON:["graphNode"],PNAME_LN:["graphNode"],PNAME_NS:["graphNode"],STRING_LITERAL1:["graphNode"],STRING_LITERAL2:["graphNode"],STRING_LITERAL_LONG1:["graphNode"],STRING_LITERAL_LONG2:["graphNode"],INTEGER:["graphNode"],DECIMAL:["graphNode"],DOUBLE:["graphNode"],INTEGER_POSITIVE:["graphNode"],DECIMAL_POSITIVE:["graphNode"],DOUBLE_POSITIVE:["graphNode"],INTEGER_NEGATIVE:["graphNode"],DECIMAL_NEGATIVE:["graphNode"],DOUBLE_NEGATIVE:["graphNode"]},objectList:{"(":["object","*[,,object]"],"[":["object","*[,,object]"],VAR1:["object","*[,,object]"],VAR2:["object","*[,,object]"],NIL:["object","*[,,object]"],IRI_REF:["object","*[,,object]"],TRUE:["object","*[,,object]"],FALSE:["object","*[,,object]"],BLANK_NODE_LABEL:["object","*[,,object]"],ANON:["object","*[,,object]"],PNAME_LN:["object","*[,,object]"],PNAME_NS:["object","*[,,object]"],STRING_LITERAL1:["object","*[,,object]"],STRING_LITERAL2:["object","*[,,object]"],STRING_LITERAL_LONG1:["object","*[,,object]"],STRING_LITERAL_LONG2:["object","*[,,object]"],INTEGER:["object","*[,,object]"],DECIMAL:["object","*[,,object]"],DOUBLE:["object","*[,,object]"],INTEGER_POSITIVE:["object","*[,,object]"],DECIMAL_POSITIVE:["object","*[,,object]"],DOUBLE_POSITIVE:["object","*[,,object]"],INTEGER_NEGATIVE:["object","*[,,object]"],DECIMAL_NEGATIVE:["object","*[,,object]"],DOUBLE_NEGATIVE:["object","*[,,object]"]},objectListPath:{"(":["objectPath","*[,,objectPath]"],"[":["objectPath","*[,,objectPath]"],VAR1:["objectPath","*[,,objectPath]"],VAR2:["objectPath","*[,,objectPath]"],NIL:["objectPath","*[,,objectPath]"],IRI_REF:["objectPath","*[,,objectPath]"],TRUE:["objectPath","*[,,objectPath]"],FALSE:["objectPath","*[,,objectPath]"],BLANK_NODE_LABEL:["objectPath","*[,,objectPath]"],ANON:["objectPath","*[,,objectPath]"],PNAME_LN:["objectPath","*[,,objectPath]"],PNAME_NS:["objectPath","*[,,objectPath]"],STRING_LITERAL1:["objectPath","*[,,objectPath]"],STRING_LITERAL2:["objectPath","*[,,objectPath]"],STRING_LITERAL_LONG1:["objectPath","*[,,objectPath]"],STRING_LITERAL_LONG2:["objectPath","*[,,objectPath]"],INTEGER:["objectPath","*[,,objectPath]"],DECIMAL:["objectPath","*[,,objectPath]"],DOUBLE:["objectPath","*[,,objectPath]"],INTEGER_POSITIVE:["objectPath","*[,,objectPath]"],DECIMAL_POSITIVE:["objectPath","*[,,objectPath]"],DOUBLE_POSITIVE:["objectPath","*[,,objectPath]"],INTEGER_NEGATIVE:["objectPath","*[,,objectPath]"],DECIMAL_NEGATIVE:["objectPath","*[,,objectPath]"],DOUBLE_NEGATIVE:["objectPath","*[,,objectPath]"]},objectPath:{"(":["graphNodePath"],"[":["graphNodePath"],VAR1:["graphNodePath"],VAR2:["graphNodePath"],NIL:["graphNodePath"],IRI_REF:["graphNodePath"],TRUE:["graphNodePath"],FALSE:["graphNodePath"],BLANK_NODE_LABEL:["graphNodePath"],ANON:["graphNodePath"],PNAME_LN:["graphNodePath"],PNAME_NS:["graphNodePath"],STRING_LITERAL1:["graphNodePath"],STRING_LITERAL2:["graphNodePath"],STRING_LITERAL_LONG1:["graphNodePath"],STRING_LITERAL_LONG2:["graphNodePath"],INTEGER:["graphNodePath"],DECIMAL:["graphNodePath"],DOUBLE:["graphNodePath"],INTEGER_POSITIVE:["graphNodePath"],DECIMAL_POSITIVE:["graphNodePath"],DOUBLE_POSITIVE:["graphNodePath"],INTEGER_NEGATIVE:["graphNodePath"],DECIMAL_NEGATIVE:["graphNodePath"],DOUBLE_NEGATIVE:["graphNodePath"]},offsetClause:{OFFSET:["OFFSET","INTEGER"]},optionalGraphPattern:{OPTIONAL:["OPTIONAL","groupGraphPattern"]},"or([*,expression])":{"*":["*"],"!":["expression"],"+":["expression"],"-":["expression"],VAR1:["expression"],VAR2:["expression"],"(":["expression"],STR:["expression"],LANG:["expression"],LANGMATCHES:["expression"],DATATYPE:["expression"],BOUND:["expression"],IRI:["expression"],URI:["expression"],BNODE:["expression"],RAND:["expression"],ABS:["expression"],CEIL:["expression"],FLOOR:["expression"],ROUND:["expression"],CONCAT:["expression"],STRLEN:["expression"],UCASE:["expression"],LCASE:["expression"],ENCODE_FOR_URI:["expression"],CONTAINS:["expression"],STRSTARTS:["expression"],STRENDS:["expression"],STRBEFORE:["expression"],STRAFTER:["expression"],YEAR:["expression"],MONTH:["expression"],DAY:["expression"],HOURS:["expression"],MINUTES:["expression"],SECONDS:["expression"],TIMEZONE:["expression"],TZ:["expression"],NOW:["expression"],UUID:["expression"],STRUUID:["expression"],MD5:["expression"],SHA1:["expression"],SHA256:["expression"],SHA384:["expression"],SHA512:["expression"],COALESCE:["expression"],IF:["expression"],STRLANG:["expression"],STRDT:["expression"],SAMETERM:["expression"],ISIRI:["expression"],ISURI:["expression"],ISBLANK:["expression"],ISLITERAL:["expression"],ISNUMERIC:["expression"],TRUE:["expression"],FALSE:["expression"],COUNT:["expression"],SUM:["expression"],MIN:["expression"],MAX:["expression"],AVG:["expression"],SAMPLE:["expression"],GROUP_CONCAT:["expression"],SUBSTR:["expression"],REPLACE:["expression"],REGEX:["expression"],EXISTS:["expression"],NOT:["expression"],IRI_REF:["expression"],STRING_LITERAL1:["expression"],STRING_LITERAL2:["expression"],STRING_LITERAL_LONG1:["expression"],STRING_LITERAL_LONG2:["expression"],INTEGER:["expression"],DECIMAL:["expression"],DOUBLE:["expression"],INTEGER_POSITIVE:["expression"],DECIMAL_POSITIVE:["expression"],DOUBLE_POSITIVE:["expression"],INTEGER_NEGATIVE:["expression"],DECIMAL_NEGATIVE:["expression"],DOUBLE_NEGATIVE:["expression"],PNAME_LN:["expression"],PNAME_NS:["expression"]},"or([+or([var,[ (,expression,AS,var,)]]),*])":{"(":["+or([var,[ (,expression,AS,var,)]])"],VAR1:["+or([var,[ (,expression,AS,var,)]])"],VAR2:["+or([var,[ (,expression,AS,var,)]])"],"*":["*"]},"or([+varOrIRIref,*])":{VAR1:["+varOrIRIref"],VAR2:["+varOrIRIref"],IRI_REF:["+varOrIRIref"],PNAME_LN:["+varOrIRIref"],PNAME_NS:["+varOrIRIref"],"*":["*"]},"or([ASC,DESC])":{ASC:["ASC"],DESC:["DESC"]},"or([DISTINCT,REDUCED])":{DISTINCT:["DISTINCT"],REDUCED:["REDUCED"]},"or([LANGTAG,[^^,iriRef]])":{LANGTAG:["LANGTAG"],"^^":["[^^,iriRef]"]},"or([NIL,[ (,*var,)]])":{NIL:["NIL"],"(":["[ (,*var,)]"]},"or([[ (,*dataBlockValue,)],NIL])":{"(":["[ (,*dataBlockValue,)]"],NIL:["NIL"]},"or([[ (,expression,)],NIL])":{"(":["[ (,expression,)]"],NIL:["NIL"]},"or([[*,unaryExpression],[/,unaryExpression]])":{"*":["[*,unaryExpression]"],"/":["[/,unaryExpression]"]},"or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])":{"+":["[+,multiplicativeExpression]"],"-":["[-,multiplicativeExpression]"],INTEGER_POSITIVE:["[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]"],DECIMAL_POSITIVE:["[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]"],DOUBLE_POSITIVE:["[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]"],INTEGER_NEGATIVE:["[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]"],DECIMAL_NEGATIVE:["[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]"],DOUBLE_NEGATIVE:["[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]"]},"or([[,,or([},[integer,}]])],}])":{",":["[,,or([},[integer,}]])]"],"}":["}"]},"or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])":{"=":["[=,numericExpression]"],"!=":["[!=,numericExpression]"],"<":["[<,numericExpression]"],">":["[>,numericExpression]"],"<=":["[<=,numericExpression]"],">=":["[>=,numericExpression]"],IN:["[IN,expressionList]"],NOT:["[NOT,IN,expressionList]"]},"or([[constructTemplate,*datasetClause,whereClause,solutionModifier],[*datasetClause,WHERE,{,?triplesTemplate,},solutionModifier]])":{"{":["[constructTemplate,*datasetClause,whereClause,solutionModifier]"],WHERE:["[*datasetClause,WHERE,{,?triplesTemplate,},solutionModifier]"],FROM:["[*datasetClause,WHERE,{,?triplesTemplate,},solutionModifier]"]},"or([[deleteClause,?insertClause],insertClause])":{DELETE:["[deleteClause,?insertClause]"],INSERT:["insertClause"]},"or([[integer,or([[,,or([},[integer,}]])],}])],[,,integer,}]])":{INTEGER:["[integer,or([[,,or([},[integer,}]])],}])]"],",":["[,,integer,}]"]},"or([defaultGraphClause,namedGraphClause])":{IRI_REF:["defaultGraphClause"],PNAME_LN:["defaultGraphClause"],PNAME_NS:["defaultGraphClause"],NAMED:["namedGraphClause"]},"or([inlineDataOneVar,inlineDataFull])":{VAR1:["inlineDataOneVar"],VAR2:["inlineDataOneVar"],NIL:["inlineDataFull"],"(":["inlineDataFull"]},"or([iriRef,[NAMED,iriRef]])":{IRI_REF:["iriRef"],PNAME_LN:["iriRef"],PNAME_NS:["iriRef"],NAMED:["[NAMED,iriRef]"]},"or([iriRef,a])":{IRI_REF:["iriRef"],PNAME_LN:["iriRef"],PNAME_NS:["iriRef"],a:["a"]},"or([numericLiteralPositive,numericLiteralNegative])":{INTEGER_POSITIVE:["numericLiteralPositive"],DECIMAL_POSITIVE:["numericLiteralPositive"],DOUBLE_POSITIVE:["numericLiteralPositive"],INTEGER_NEGATIVE:["numericLiteralNegative"],DECIMAL_NEGATIVE:["numericLiteralNegative"],DOUBLE_NEGATIVE:["numericLiteralNegative"]},"or([queryAll,updateAll])":{CONSTRUCT:["queryAll"],DESCRIBE:["queryAll"],ASK:["queryAll"],SELECT:["queryAll"],INSERT:["updateAll"],DELETE:["updateAll"],LOAD:["updateAll"],CLEAR:["updateAll"],DROP:["updateAll"],ADD:["updateAll"],MOVE:["updateAll"],COPY:["updateAll"],CREATE:["updateAll"],WITH:["updateAll"],$:["updateAll"]},"or([selectQuery,constructQuery,describeQuery,askQuery])":{SELECT:["selectQuery"],CONSTRUCT:["constructQuery"],DESCRIBE:["describeQuery"],ASK:["askQuery"]},"or([subSelect,groupGraphPatternSub])":{SELECT:["subSelect"],"{":["groupGraphPatternSub"],OPTIONAL:["groupGraphPatternSub"],MINUS:["groupGraphPatternSub"],GRAPH:["groupGraphPatternSub"],SERVICE:["groupGraphPatternSub"],FILTER:["groupGraphPatternSub"],BIND:["groupGraphPatternSub"],VALUES:["groupGraphPatternSub"],VAR1:["groupGraphPatternSub"],VAR2:["groupGraphPatternSub"],NIL:["groupGraphPatternSub"],"(":["groupGraphPatternSub"],"[":["groupGraphPatternSub"],IRI_REF:["groupGraphPatternSub"],TRUE:["groupGraphPatternSub"],FALSE:["groupGraphPatternSub"],BLANK_NODE_LABEL:["groupGraphPatternSub"],ANON:["groupGraphPatternSub"],PNAME_LN:["groupGraphPatternSub"],PNAME_NS:["groupGraphPatternSub"],STRING_LITERAL1:["groupGraphPatternSub"],STRING_LITERAL2:["groupGraphPatternSub"],STRING_LITERAL_LONG1:["groupGraphPatternSub"],STRING_LITERAL_LONG2:["groupGraphPatternSub"],INTEGER:["groupGraphPatternSub"],DECIMAL:["groupGraphPatternSub"],DOUBLE:["groupGraphPatternSub"],INTEGER_POSITIVE:["groupGraphPatternSub"],DECIMAL_POSITIVE:["groupGraphPatternSub"],DOUBLE_POSITIVE:["groupGraphPatternSub"],INTEGER_NEGATIVE:["groupGraphPatternSub"],DECIMAL_NEGATIVE:["groupGraphPatternSub"],DOUBLE_NEGATIVE:["groupGraphPatternSub"],"}":["groupGraphPatternSub"]},"or([var,[ (,expression,AS,var,)]])":{VAR1:["var"],VAR2:["var"],"(":["[ (,expression,AS,var,)]"]},"or([verbPath,verbSimple])":{"^":["verbPath"],a:["verbPath"],"!":["verbPath"],"(":["verbPath"],IRI_REF:["verbPath"],PNAME_LN:["verbPath"],PNAME_NS:["verbPath"],VAR1:["verbSimple"],VAR2:["verbSimple"]},"or([},[integer,}]])":{"}":["}"],INTEGER:["[integer,}]"]},orderClause:{ORDER:["ORDER","BY","+orderCondition"]},orderCondition:{ASC:["or([ASC,DESC])","brackettedExpression"],DESC:["or([ASC,DESC])","brackettedExpression"],"(":["constraint"],STR:["constraint"],LANG:["constraint"],LANGMATCHES:["constraint"],DATATYPE:["constraint"],BOUND:["constraint"],IRI:["constraint"],URI:["constraint"],BNODE:["constraint"],RAND:["constraint"],ABS:["constraint"],CEIL:["constraint"],FLOOR:["constraint"],ROUND:["constraint"],CONCAT:["constraint"],STRLEN:["constraint"],UCASE:["constraint"],LCASE:["constraint"],ENCODE_FOR_URI:["constraint"],CONTAINS:["constraint"],STRSTARTS:["constraint"],STRENDS:["constraint"],STRBEFORE:["constraint"],STRAFTER:["constraint"],YEAR:["constraint"],MONTH:["constraint"],DAY:["constraint"],HOURS:["constraint"],MINUTES:["constraint"],SECONDS:["constraint"],TIMEZONE:["constraint"],TZ:["constraint"],NOW:["constraint"],UUID:["constraint"],STRUUID:["constraint"],MD5:["constraint"],SHA1:["constraint"],SHA256:["constraint"],SHA384:["constraint"],SHA512:["constraint"],COALESCE:["constraint"],IF:["constraint"],STRLANG:["constraint"],STRDT:["constraint"],SAMETERM:["constraint"],ISIRI:["constraint"],ISURI:["constraint"],ISBLANK:["constraint"],ISLITERAL:["constraint"],ISNUMERIC:["constraint"],SUBSTR:["constraint"],REPLACE:["constraint"],REGEX:["constraint"],EXISTS:["constraint"],NOT:["constraint"],IRI_REF:["constraint"],PNAME_LN:["constraint"],PNAME_NS:["constraint"],VAR1:["var"],VAR2:["var"]},path:{"^":["pathAlternative"],a:["pathAlternative"],"!":["pathAlternative"],"(":["pathAlternative"],IRI_REF:["pathAlternative"],PNAME_LN:["pathAlternative"],PNAME_NS:["pathAlternative"]},pathAlternative:{"^":["pathSequence","*[|,pathSequence]"],a:["pathSequence","*[|,pathSequence]"],"!":["pathSequence","*[|,pathSequence]"],"(":["pathSequence","*[|,pathSequence]"],IRI_REF:["pathSequence","*[|,pathSequence]"],PNAME_LN:["pathSequence","*[|,pathSequence]"],PNAME_NS:["pathSequence","*[|,pathSequence]"]},pathElt:{a:["pathPrimary","?pathMod"],"!":["pathPrimary","?pathMod"],"(":["pathPrimary","?pathMod"],IRI_REF:["pathPrimary","?pathMod"],PNAME_LN:["pathPrimary","?pathMod"],PNAME_NS:["pathPrimary","?pathMod"]},pathEltOrInverse:{a:["pathElt"],"!":["pathElt"],"(":["pathElt"],IRI_REF:["pathElt"],PNAME_LN:["pathElt"],PNAME_NS:["pathElt"],"^":["^","pathElt"]},pathMod:{"*":["*"],"?":["?"],"+":["+"],"{":["{","or([[integer,or([[,,or([},[integer,}]])],}])],[,,integer,}]])"]},pathNegatedPropertySet:{a:["pathOneInPropertySet"],"^":["pathOneInPropertySet"],IRI_REF:["pathOneInPropertySet"],PNAME_LN:["pathOneInPropertySet"],PNAME_NS:["pathOneInPropertySet"],"(":["(","?[pathOneInPropertySet,*[|,pathOneInPropertySet]]",")"]},pathOneInPropertySet:{IRI_REF:["iriRef"],PNAME_LN:["iriRef"],PNAME_NS:["iriRef"],a:["a"],"^":["^","or([iriRef,a])"]},pathPrimary:{IRI_REF:["storeProperty","iriRef"],PNAME_LN:["storeProperty","iriRef"],PNAME_NS:["storeProperty","iriRef"],a:["storeProperty","a"],"!":["!","pathNegatedPropertySet"],"(":["(","path",")"]},pathSequence:{"^":["pathEltOrInverse","*[/,pathEltOrInverse]"],a:["pathEltOrInverse","*[/,pathEltOrInverse]"],"!":["pathEltOrInverse","*[/,pathEltOrInverse]"],"(":["pathEltOrInverse","*[/,pathEltOrInverse]"],IRI_REF:["pathEltOrInverse","*[/,pathEltOrInverse]"],PNAME_LN:["pathEltOrInverse","*[/,pathEltOrInverse]"],PNAME_NS:["pathEltOrInverse","*[/,pathEltOrInverse]"]},prefixDecl:{PREFIX:["PREFIX","PNAME_NS","IRI_REF"]},prefixedName:{PNAME_LN:["PNAME_LN"],PNAME_NS:["PNAME_NS"]},primaryExpression:{"(":["brackettedExpression"],STR:["builtInCall"],LANG:["builtInCall"],LANGMATCHES:["builtInCall"],DATATYPE:["builtInCall"],BOUND:["builtInCall"],IRI:["builtInCall"],URI:["builtInCall"],BNODE:["builtInCall"],RAND:["builtInCall"],ABS:["builtInCall"],CEIL:["builtInCall"],FLOOR:["builtInCall"],ROUND:["builtInCall"],CONCAT:["builtInCall"],STRLEN:["builtInCall"],UCASE:["builtInCall"],LCASE:["builtInCall"],ENCODE_FOR_URI:["builtInCall"],CONTAINS:["builtInCall"],STRSTARTS:["builtInCall"],STRENDS:["builtInCall"],STRBEFORE:["builtInCall"],STRAFTER:["builtInCall"],YEAR:["builtInCall"],MONTH:["builtInCall"],DAY:["builtInCall"],HOURS:["builtInCall"],MINUTES:["builtInCall"],SECONDS:["builtInCall"],TIMEZONE:["builtInCall"],TZ:["builtInCall"],NOW:["builtInCall"],UUID:["builtInCall"],STRUUID:["builtInCall"],MD5:["builtInCall"],SHA1:["builtInCall"],SHA256:["builtInCall"],SHA384:["builtInCall"],SHA512:["builtInCall"],COALESCE:["builtInCall"],IF:["builtInCall"],STRLANG:["builtInCall"],STRDT:["builtInCall"],SAMETERM:["builtInCall"],ISIRI:["builtInCall"],ISURI:["builtInCall"],ISBLANK:["builtInCall"],ISLITERAL:["builtInCall"],ISNUMERIC:["builtInCall"],SUBSTR:["builtInCall"],REPLACE:["builtInCall"],REGEX:["builtInCall"],EXISTS:["builtInCall"],NOT:["builtInCall"],IRI_REF:["iriRefOrFunction"],PNAME_LN:["iriRefOrFunction"],PNAME_NS:["iriRefOrFunction"],STRING_LITERAL1:["rdfLiteral"],STRING_LITERAL2:["rdfLiteral"],STRING_LITERAL_LONG1:["rdfLiteral"],STRING_LITERAL_LONG2:["rdfLiteral"],INTEGER:["numericLiteral"],DECIMAL:["numericLiteral"],DOUBLE:["numericLiteral"],INTEGER_POSITIVE:["numericLiteral"],DECIMAL_POSITIVE:["numericLiteral"],DOUBLE_POSITIVE:["numericLiteral"],INTEGER_NEGATIVE:["numericLiteral"],DECIMAL_NEGATIVE:["numericLiteral"],DOUBLE_NEGATIVE:["numericLiteral"],TRUE:["booleanLiteral"],FALSE:["booleanLiteral"],VAR1:["var"],VAR2:["var"],COUNT:["aggregate"],SUM:["aggregate"],MIN:["aggregate"],MAX:["aggregate"],AVG:["aggregate"],SAMPLE:["aggregate"],GROUP_CONCAT:["aggregate"]},prologue:{PREFIX:["?baseDecl","*prefixDecl"],BASE:["?baseDecl","*prefixDecl"],$:["?baseDecl","*prefixDecl"],CONSTRUCT:["?baseDecl","*prefixDecl"],DESCRIBE:["?baseDecl","*prefixDecl"],ASK:["?baseDecl","*prefixDecl"],INSERT:["?baseDecl","*prefixDecl"],DELETE:["?baseDecl","*prefixDecl"],SELECT:["?baseDecl","*prefixDecl"],LOAD:["?baseDecl","*prefixDecl"],CLEAR:["?baseDecl","*prefixDecl"],DROP:["?baseDecl","*prefixDecl"],ADD:["?baseDecl","*prefixDecl"],MOVE:["?baseDecl","*prefixDecl"],COPY:["?baseDecl","*prefixDecl"],CREATE:["?baseDecl","*prefixDecl"],WITH:["?baseDecl","*prefixDecl"]},propertyList:{a:["propertyListNotEmpty"],VAR1:["propertyListNotEmpty"],VAR2:["propertyListNotEmpty"],IRI_REF:["propertyListNotEmpty"],PNAME_LN:["propertyListNotEmpty"],PNAME_NS:["propertyListNotEmpty"],".":[],"}":[],GRAPH:[]},propertyListNotEmpty:{a:["verb","objectList","*[;,?[verb,objectList]]"],VAR1:["verb","objectList","*[;,?[verb,objectList]]"],VAR2:["verb","objectList","*[;,?[verb,objectList]]"],IRI_REF:["verb","objectList","*[;,?[verb,objectList]]"],PNAME_LN:["verb","objectList","*[;,?[verb,objectList]]"],PNAME_NS:["verb","objectList","*[;,?[verb,objectList]]"]},propertyListPath:{a:["propertyListNotEmpty"],VAR1:["propertyListNotEmpty"],VAR2:["propertyListNotEmpty"],IRI_REF:["propertyListNotEmpty"],PNAME_LN:["propertyListNotEmpty"],PNAME_NS:["propertyListNotEmpty"],".":[],"{":[],OPTIONAL:[],MINUS:[],GRAPH:[],SERVICE:[],FILTER:[],BIND:[],VALUES:[],"}":[]},propertyListPathNotEmpty:{VAR1:["or([verbPath,verbSimple])","objectListPath","*[;,?[or([verbPath,verbSimple]),objectList]]"],VAR2:["or([verbPath,verbSimple])","objectListPath","*[;,?[or([verbPath,verbSimple]),objectList]]"],"^":["or([verbPath,verbSimple])","objectListPath","*[;,?[or([verbPath,verbSimple]),objectList]]"],a:["or([verbPath,verbSimple])","objectListPath","*[;,?[or([verbPath,verbSimple]),objectList]]"],"!":["or([verbPath,verbSimple])","objectListPath","*[;,?[or([verbPath,verbSimple]),objectList]]"],"(":["or([verbPath,verbSimple])","objectListPath","*[;,?[or([verbPath,verbSimple]),objectList]]"],IRI_REF:["or([verbPath,verbSimple])","objectListPath","*[;,?[or([verbPath,verbSimple]),objectList]]"],PNAME_LN:["or([verbPath,verbSimple])","objectListPath","*[;,?[or([verbPath,verbSimple]),objectList]]"],PNAME_NS:["or([verbPath,verbSimple])","objectListPath","*[;,?[or([verbPath,verbSimple]),objectList]]"]},quadData:{"{":["{","disallowVars","quads","allowVars","}"]},quadDataNoBnodes:{"{":["{","disallowBnodes","disallowVars","quads","allowVars","allowBnodes","}"]},quadPattern:{"{":["{","quads","}"]},quadPatternNoBnodes:{"{":["{","disallowBnodes","quads","allowBnodes","}"]},quads:{GRAPH:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],VAR1:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],VAR2:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],NIL:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],"(":["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],"[":["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],IRI_REF:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],TRUE:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],FALSE:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],BLANK_NODE_LABEL:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],ANON:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],PNAME_LN:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],PNAME_NS:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],STRING_LITERAL1:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],STRING_LITERAL2:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],STRING_LITERAL_LONG1:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],STRING_LITERAL_LONG2:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],INTEGER:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],DECIMAL:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],DOUBLE:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],INTEGER_POSITIVE:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],DECIMAL_POSITIVE:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],DOUBLE_POSITIVE:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],INTEGER_NEGATIVE:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],DECIMAL_NEGATIVE:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],DOUBLE_NEGATIVE:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],"}":["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"]},quadsNotTriples:{GRAPH:["GRAPH","varOrIRIref","{","?triplesTemplate","}"]},queryAll:{CONSTRUCT:["or([selectQuery,constructQuery,describeQuery,askQuery])","valuesClause"],DESCRIBE:["or([selectQuery,constructQuery,describeQuery,askQuery])","valuesClause"],ASK:["or([selectQuery,constructQuery,describeQuery,askQuery])","valuesClause"],SELECT:["or([selectQuery,constructQuery,describeQuery,askQuery])","valuesClause"]},rdfLiteral:{STRING_LITERAL1:["string","?or([LANGTAG,[^^,iriRef]])"],STRING_LITERAL2:["string","?or([LANGTAG,[^^,iriRef]])"],STRING_LITERAL_LONG1:["string","?or([LANGTAG,[^^,iriRef]])"],STRING_LITERAL_LONG2:["string","?or([LANGTAG,[^^,iriRef]])"]},regexExpression:{REGEX:["REGEX","(","expression",",","expression","?[,,expression]",")"]},relationalExpression:{"!":["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],"+":["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],"-":["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],VAR1:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],VAR2:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],"(":["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STR:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],LANG:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],LANGMATCHES:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],DATATYPE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],BOUND:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],IRI:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],URI:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],BNODE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],RAND:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],ABS:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],CEIL:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],FLOOR:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],ROUND:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],CONCAT:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STRLEN:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],UCASE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],LCASE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],ENCODE_FOR_URI:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],CONTAINS:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STRSTARTS:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STRENDS:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STRBEFORE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STRAFTER:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],YEAR:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],MONTH:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],DAY:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],HOURS:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],MINUTES:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],SECONDS:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],TIMEZONE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],TZ:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],NOW:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],UUID:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STRUUID:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],MD5:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],SHA1:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],SHA256:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],SHA384:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],SHA512:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],COALESCE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],IF:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STRLANG:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STRDT:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],SAMETERM:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],ISIRI:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],ISURI:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],ISBLANK:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],ISLITERAL:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],ISNUMERIC:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],TRUE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],FALSE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],COUNT:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],SUM:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],MIN:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],MAX:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],AVG:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],SAMPLE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],GROUP_CONCAT:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],SUBSTR:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],REPLACE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],REGEX:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],EXISTS:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],NOT:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],IRI_REF:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STRING_LITERAL1:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STRING_LITERAL2:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STRING_LITERAL_LONG1:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STRING_LITERAL_LONG2:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],INTEGER:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],DECIMAL:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],DOUBLE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],INTEGER_POSITIVE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],DECIMAL_POSITIVE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],DOUBLE_POSITIVE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],INTEGER_NEGATIVE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],DECIMAL_NEGATIVE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],DOUBLE_NEGATIVE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],PNAME_LN:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],PNAME_NS:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"]},selectClause:{SELECT:["SELECT","?or([DISTINCT,REDUCED])","or([+or([var,[ (,expression,AS,var,)]]),*])"]},selectQuery:{SELECT:["selectClause","*datasetClause","whereClause","solutionModifier"]},serviceGraphPattern:{SERVICE:["SERVICE","?SILENT","varOrIRIref","groupGraphPattern"]},solutionModifier:{LIMIT:["?groupClause","?havingClause","?orderClause","?limitOffsetClauses"],OFFSET:["?groupClause","?havingClause","?orderClause","?limitOffsetClauses"],ORDER:["?groupClause","?havingClause","?orderClause","?limitOffsetClauses"],HAVING:["?groupClause","?havingClause","?orderClause","?limitOffsetClauses"],GROUP:["?groupClause","?havingClause","?orderClause","?limitOffsetClauses"],VALUES:["?groupClause","?havingClause","?orderClause","?limitOffsetClauses"],$:["?groupClause","?havingClause","?orderClause","?limitOffsetClauses"],"}":["?groupClause","?havingClause","?orderClause","?limitOffsetClauses"]},sourceSelector:{IRI_REF:["iriRef"],PNAME_LN:["iriRef"],PNAME_NS:["iriRef"]},sparql11:{$:["prologue","or([queryAll,updateAll])","$"],CONSTRUCT:["prologue","or([queryAll,updateAll])","$"],DESCRIBE:["prologue","or([queryAll,updateAll])","$"],ASK:["prologue","or([queryAll,updateAll])","$"],INSERT:["prologue","or([queryAll,updateAll])","$"],DELETE:["prologue","or([queryAll,updateAll])","$"],SELECT:["prologue","or([queryAll,updateAll])","$"],LOAD:["prologue","or([queryAll,updateAll])","$"],CLEAR:["prologue","or([queryAll,updateAll])","$"],DROP:["prologue","or([queryAll,updateAll])","$"],ADD:["prologue","or([queryAll,updateAll])","$"],MOVE:["prologue","or([queryAll,updateAll])","$"],COPY:["prologue","or([queryAll,updateAll])","$"],CREATE:["prologue","or([queryAll,updateAll])","$"],WITH:["prologue","or([queryAll,updateAll])","$"],PREFIX:["prologue","or([queryAll,updateAll])","$"],BASE:["prologue","or([queryAll,updateAll])","$"]},storeProperty:{VAR1:[],VAR2:[],IRI_REF:[],PNAME_LN:[],PNAME_NS:[],a:[]},strReplaceExpression:{REPLACE:["REPLACE","(","expression",",","expression",",","expression","?[,,expression]",")"]},string:{STRING_LITERAL1:["STRING_LITERAL1"],STRING_LITERAL2:["STRING_LITERAL2"],STRING_LITERAL_LONG1:["STRING_LITERAL_LONG1"],STRING_LITERAL_LONG2:["STRING_LITERAL_LONG2"]},subSelect:{SELECT:["selectClause","whereClause","solutionModifier","valuesClause"]},substringExpression:{SUBSTR:["SUBSTR","(","expression",",","expression","?[,,expression]",")"]},triplesBlock:{VAR1:["triplesSameSubjectPath","?[.,?triplesBlock]"],VAR2:["triplesSameSubjectPath","?[.,?triplesBlock]"],NIL:["triplesSameSubjectPath","?[.,?triplesBlock]"],"(":["triplesSameSubjectPath","?[.,?triplesBlock]"],"[":["triplesSameSubjectPath","?[.,?triplesBlock]"],IRI_REF:["triplesSameSubjectPath","?[.,?triplesBlock]"],TRUE:["triplesSameSubjectPath","?[.,?triplesBlock]"],FALSE:["triplesSameSubjectPath","?[.,?triplesBlock]"],BLANK_NODE_LABEL:["triplesSameSubjectPath","?[.,?triplesBlock]"],ANON:["triplesSameSubjectPath","?[.,?triplesBlock]"],PNAME_LN:["triplesSameSubjectPath","?[.,?triplesBlock]"],PNAME_NS:["triplesSameSubjectPath","?[.,?triplesBlock]"],STRING_LITERAL1:["triplesSameSubjectPath","?[.,?triplesBlock]"],STRING_LITERAL2:["triplesSameSubjectPath","?[.,?triplesBlock]"],STRING_LITERAL_LONG1:["triplesSameSubjectPath","?[.,?triplesBlock]"],STRING_LITERAL_LONG2:["triplesSameSubjectPath","?[.,?triplesBlock]"],INTEGER:["triplesSameSubjectPath","?[.,?triplesBlock]"],DECIMAL:["triplesSameSubjectPath","?[.,?triplesBlock]"],DOUBLE:["triplesSameSubjectPath","?[.,?triplesBlock]"],INTEGER_POSITIVE:["triplesSameSubjectPath","?[.,?triplesBlock]"],DECIMAL_POSITIVE:["triplesSameSubjectPath","?[.,?triplesBlock]"],DOUBLE_POSITIVE:["triplesSameSubjectPath","?[.,?triplesBlock]"],INTEGER_NEGATIVE:["triplesSameSubjectPath","?[.,?triplesBlock]"],DECIMAL_NEGATIVE:["triplesSameSubjectPath","?[.,?triplesBlock]"],DOUBLE_NEGATIVE:["triplesSameSubjectPath","?[.,?triplesBlock]"]},triplesNode:{"(":["collection"],"[":["blankNodePropertyList"]},triplesNodePath:{"(":["collectionPath"],"[":["blankNodePropertyListPath"]},triplesSameSubject:{VAR1:["varOrTerm","propertyListNotEmpty"],VAR2:["varOrTerm","propertyListNotEmpty"],NIL:["varOrTerm","propertyListNotEmpty"],IRI_REF:["varOrTerm","propertyListNotEmpty"],TRUE:["varOrTerm","propertyListNotEmpty"],FALSE:["varOrTerm","propertyListNotEmpty"],BLANK_NODE_LABEL:["varOrTerm","propertyListNotEmpty"],ANON:["varOrTerm","propertyListNotEmpty"],PNAME_LN:["varOrTerm","propertyListNotEmpty"],PNAME_NS:["varOrTerm","propertyListNotEmpty"],STRING_LITERAL1:["varOrTerm","propertyListNotEmpty"],STRING_LITERAL2:["varOrTerm","propertyListNotEmpty"],STRING_LITERAL_LONG1:["varOrTerm","propertyListNotEmpty"],STRING_LITERAL_LONG2:["varOrTerm","propertyListNotEmpty"],INTEGER:["varOrTerm","propertyListNotEmpty"],DECIMAL:["varOrTerm","propertyListNotEmpty"],DOUBLE:["varOrTerm","propertyListNotEmpty"],INTEGER_POSITIVE:["varOrTerm","propertyListNotEmpty"],DECIMAL_POSITIVE:["varOrTerm","propertyListNotEmpty"],DOUBLE_POSITIVE:["varOrTerm","propertyListNotEmpty"],INTEGER_NEGATIVE:["varOrTerm","propertyListNotEmpty"],DECIMAL_NEGATIVE:["varOrTerm","propertyListNotEmpty"],DOUBLE_NEGATIVE:["varOrTerm","propertyListNotEmpty"],"(":["triplesNode","propertyList"],"[":["triplesNode","propertyList"]},triplesSameSubjectPath:{VAR1:["varOrTerm","propertyListPathNotEmpty"],VAR2:["varOrTerm","propertyListPathNotEmpty"],NIL:["varOrTerm","propertyListPathNotEmpty"],IRI_REF:["varOrTerm","propertyListPathNotEmpty"],TRUE:["varOrTerm","propertyListPathNotEmpty"],FALSE:["varOrTerm","propertyListPathNotEmpty"],BLANK_NODE_LABEL:["varOrTerm","propertyListPathNotEmpty"],ANON:["varOrTerm","propertyListPathNotEmpty"],PNAME_LN:["varOrTerm","propertyListPathNotEmpty"],PNAME_NS:["varOrTerm","propertyListPathNotEmpty"],STRING_LITERAL1:["varOrTerm","propertyListPathNotEmpty"],STRING_LITERAL2:["varOrTerm","propertyListPathNotEmpty"],STRING_LITERAL_LONG1:["varOrTerm","propertyListPathNotEmpty"],STRING_LITERAL_LONG2:["varOrTerm","propertyListPathNotEmpty"],INTEGER:["varOrTerm","propertyListPathNotEmpty"],DECIMAL:["varOrTerm","propertyListPathNotEmpty"],DOUBLE:["varOrTerm","propertyListPathNotEmpty"],INTEGER_POSITIVE:["varOrTerm","propertyListPathNotEmpty"],DECIMAL_POSITIVE:["varOrTerm","propertyListPathNotEmpty"],DOUBLE_POSITIVE:["varOrTerm","propertyListPathNotEmpty"],INTEGER_NEGATIVE:["varOrTerm","propertyListPathNotEmpty"],DECIMAL_NEGATIVE:["varOrTerm","propertyListPathNotEmpty"],DOUBLE_NEGATIVE:["varOrTerm","propertyListPathNotEmpty"],"(":["triplesNodePath","propertyListPath"],"[":["triplesNodePath","propertyListPath"]},triplesTemplate:{VAR1:["triplesSameSubject","?[.,?triplesTemplate]"],VAR2:["triplesSameSubject","?[.,?triplesTemplate]"],NIL:["triplesSameSubject","?[.,?triplesTemplate]"],"(":["triplesSameSubject","?[.,?triplesTemplate]"],"[":["triplesSameSubject","?[.,?triplesTemplate]"],IRI_REF:["triplesSameSubject","?[.,?triplesTemplate]"],TRUE:["triplesSameSubject","?[.,?triplesTemplate]"],FALSE:["triplesSameSubject","?[.,?triplesTemplate]"],BLANK_NODE_LABEL:["triplesSameSubject","?[.,?triplesTemplate]"],ANON:["triplesSameSubject","?[.,?triplesTemplate]"],PNAME_LN:["triplesSameSubject","?[.,?triplesTemplate]"],PNAME_NS:["triplesSameSubject","?[.,?triplesTemplate]"],STRING_LITERAL1:["triplesSameSubject","?[.,?triplesTemplate]"],STRING_LITERAL2:["triplesSameSubject","?[.,?triplesTemplate]"],STRING_LITERAL_LONG1:["triplesSameSubject","?[.,?triplesTemplate]"],STRING_LITERAL_LONG2:["triplesSameSubject","?[.,?triplesTemplate]"],INTEGER:["triplesSameSubject","?[.,?triplesTemplate]"],DECIMAL:["triplesSameSubject","?[.,?triplesTemplate]"],DOUBLE:["triplesSameSubject","?[.,?triplesTemplate]"],INTEGER_POSITIVE:["triplesSameSubject","?[.,?triplesTemplate]"],DECIMAL_POSITIVE:["triplesSameSubject","?[.,?triplesTemplate]"],DOUBLE_POSITIVE:["triplesSameSubject","?[.,?triplesTemplate]"],INTEGER_NEGATIVE:["triplesSameSubject","?[.,?triplesTemplate]"],DECIMAL_NEGATIVE:["triplesSameSubject","?[.,?triplesTemplate]"],DOUBLE_NEGATIVE:["triplesSameSubject","?[.,?triplesTemplate]"]},unaryExpression:{"!":["!","primaryExpression"],"+":["+","primaryExpression"],"-":["-","primaryExpression"],VAR1:["primaryExpression"],VAR2:["primaryExpression"],"(":["primaryExpression"],STR:["primaryExpression"],LANG:["primaryExpression"],LANGMATCHES:["primaryExpression"],DATATYPE:["primaryExpression"],BOUND:["primaryExpression"],IRI:["primaryExpression"],URI:["primaryExpression"],BNODE:["primaryExpression"],RAND:["primaryExpression"],ABS:["primaryExpression"],CEIL:["primaryExpression"],FLOOR:["primaryExpression"],ROUND:["primaryExpression"],CONCAT:["primaryExpression"],STRLEN:["primaryExpression"],UCASE:["primaryExpression"],LCASE:["primaryExpression"],ENCODE_FOR_URI:["primaryExpression"],CONTAINS:["primaryExpression"],STRSTARTS:["primaryExpression"],STRENDS:["primaryExpression"],STRBEFORE:["primaryExpression"],STRAFTER:["primaryExpression"],YEAR:["primaryExpression"],MONTH:["primaryExpression"],DAY:["primaryExpression"],HOURS:["primaryExpression"],MINUTES:["primaryExpression"],SECONDS:["primaryExpression"],TIMEZONE:["primaryExpression"],TZ:["primaryExpression"],NOW:["primaryExpression"],UUID:["primaryExpression"],STRUUID:["primaryExpression"],MD5:["primaryExpression"],SHA1:["primaryExpression"],SHA256:["primaryExpression"],SHA384:["primaryExpression"],SHA512:["primaryExpression"],COALESCE:["primaryExpression"],IF:["primaryExpression"],STRLANG:["primaryExpression"],STRDT:["primaryExpression"],SAMETERM:["primaryExpression"],ISIRI:["primaryExpression"],ISURI:["primaryExpression"],ISBLANK:["primaryExpression"],ISLITERAL:["primaryExpression"],ISNUMERIC:["primaryExpression"],TRUE:["primaryExpression"],FALSE:["primaryExpression"],COUNT:["primaryExpression"],SUM:["primaryExpression"],MIN:["primaryExpression"],MAX:["primaryExpression"],AVG:["primaryExpression"],SAMPLE:["primaryExpression"],GROUP_CONCAT:["primaryExpression"],SUBSTR:["primaryExpression"],REPLACE:["primaryExpression"],REGEX:["primaryExpression"],EXISTS:["primaryExpression"],NOT:["primaryExpression"],IRI_REF:["primaryExpression"],STRING_LITERAL1:["primaryExpression"],STRING_LITERAL2:["primaryExpression"],STRING_LITERAL_LONG1:["primaryExpression"],STRING_LITERAL_LONG2:["primaryExpression"],INTEGER:["primaryExpression"],DECIMAL:["primaryExpression"],DOUBLE:["primaryExpression"],INTEGER_POSITIVE:["primaryExpression"],DECIMAL_POSITIVE:["primaryExpression"],DOUBLE_POSITIVE:["primaryExpression"],INTEGER_NEGATIVE:["primaryExpression"],DECIMAL_NEGATIVE:["primaryExpression"],DOUBLE_NEGATIVE:["primaryExpression"],PNAME_LN:["primaryExpression"],PNAME_NS:["primaryExpression"]},update:{INSERT:["prologue","?[update1,?[;,update]]"],DELETE:["prologue","?[update1,?[;,update]]"],LOAD:["prologue","?[update1,?[;,update]]"],CLEAR:["prologue","?[update1,?[;,update]]"],DROP:["prologue","?[update1,?[;,update]]"],ADD:["prologue","?[update1,?[;,update]]"],MOVE:["prologue","?[update1,?[;,update]]"],COPY:["prologue","?[update1,?[;,update]]"],CREATE:["prologue","?[update1,?[;,update]]"],WITH:["prologue","?[update1,?[;,update]]"],PREFIX:["prologue","?[update1,?[;,update]]"],BASE:["prologue","?[update1,?[;,update]]"],$:["prologue","?[update1,?[;,update]]"]},update1:{LOAD:["load"],CLEAR:["clear"],DROP:["drop"],ADD:["add"],MOVE:["move"],COPY:["copy"],CREATE:["create"],INSERT:["INSERT","insert1"],DELETE:["DELETE","delete1"],WITH:["modify"]},updateAll:{INSERT:["?[update1,?[;,update]]"],DELETE:["?[update1,?[;,update]]"],LOAD:["?[update1,?[;,update]]"],CLEAR:["?[update1,?[;,update]]"],DROP:["?[update1,?[;,update]]"],ADD:["?[update1,?[;,update]]"],MOVE:["?[update1,?[;,update]]"],COPY:["?[update1,?[;,update]]"],CREATE:["?[update1,?[;,update]]"],WITH:["?[update1,?[;,update]]"],$:["?[update1,?[;,update]]"]},usingClause:{USING:["USING","or([iriRef,[NAMED,iriRef]])"]},valueLogical:{"!":["relationalExpression"],"+":["relationalExpression"],"-":["relationalExpression"],VAR1:["relationalExpression"],VAR2:["relationalExpression"],"(":["relationalExpression"],STR:["relationalExpression"],LANG:["relationalExpression"],LANGMATCHES:["relationalExpression"],DATATYPE:["relationalExpression"],BOUND:["relationalExpression"],IRI:["relationalExpression"],URI:["relationalExpression"],BNODE:["relationalExpression"],RAND:["relationalExpression"],ABS:["relationalExpression"],CEIL:["relationalExpression"],FLOOR:["relationalExpression"],ROUND:["relationalExpression"],CONCAT:["relationalExpression"],STRLEN:["relationalExpression"],UCASE:["relationalExpression"],LCASE:["relationalExpression"],ENCODE_FOR_URI:["relationalExpression"],CONTAINS:["relationalExpression"],STRSTARTS:["relationalExpression"],STRENDS:["relationalExpression"],STRBEFORE:["relationalExpression"],STRAFTER:["relationalExpression"],YEAR:["relationalExpression"],MONTH:["relationalExpression"],DAY:["relationalExpression"],HOURS:["relationalExpression"],MINUTES:["relationalExpression"],SECONDS:["relationalExpression"],TIMEZONE:["relationalExpression"],TZ:["relationalExpression"],NOW:["relationalExpression"],UUID:["relationalExpression"],STRUUID:["relationalExpression"],MD5:["relationalExpression"],SHA1:["relationalExpression"],SHA256:["relationalExpression"],SHA384:["relationalExpression"],SHA512:["relationalExpression"],COALESCE:["relationalExpression"],IF:["relationalExpression"],STRLANG:["relationalExpression"],STRDT:["relationalExpression"],SAMETERM:["relationalExpression"],ISIRI:["relationalExpression"],ISURI:["relationalExpression"],ISBLANK:["relationalExpression"],ISLITERAL:["relationalExpression"],ISNUMERIC:["relationalExpression"],TRUE:["relationalExpression"],FALSE:["relationalExpression"],COUNT:["relationalExpression"],SUM:["relationalExpression"],MIN:["relationalExpression"],MAX:["relationalExpression"],AVG:["relationalExpression"],SAMPLE:["relationalExpression"],GROUP_CONCAT:["relationalExpression"],SUBSTR:["relationalExpression"],REPLACE:["relationalExpression"],REGEX:["relationalExpression"],EXISTS:["relationalExpression"],NOT:["relationalExpression"],IRI_REF:["relationalExpression"],STRING_LITERAL1:["relationalExpression"],STRING_LITERAL2:["relationalExpression"],STRING_LITERAL_LONG1:["relationalExpression"],STRING_LITERAL_LONG2:["relationalExpression"],INTEGER:["relationalExpression"],DECIMAL:["relationalExpression"],DOUBLE:["relationalExpression"],INTEGER_POSITIVE:["relationalExpression"],DECIMAL_POSITIVE:["relationalExpression"],DOUBLE_POSITIVE:["relationalExpression"],INTEGER_NEGATIVE:["relationalExpression"],DECIMAL_NEGATIVE:["relationalExpression"],DOUBLE_NEGATIVE:["relationalExpression"],PNAME_LN:["relationalExpression"],PNAME_NS:["relationalExpression"]},valuesClause:{VALUES:["VALUES","dataBlock"],$:[],"}":[]},"var":{VAR1:["VAR1"],VAR2:["VAR2"]},varOrIRIref:{VAR1:["var"],VAR2:["var"],IRI_REF:["iriRef"],PNAME_LN:["iriRef"],PNAME_NS:["iriRef"]},varOrTerm:{VAR1:["var"],VAR2:["var"],NIL:["graphTerm"],IRI_REF:["graphTerm"],TRUE:["graphTerm"],FALSE:["graphTerm"],BLANK_NODE_LABEL:["graphTerm"],ANON:["graphTerm"],PNAME_LN:["graphTerm"],PNAME_NS:["graphTerm"],STRING_LITERAL1:["graphTerm"],STRING_LITERAL2:["graphTerm"],STRING_LITERAL_LONG1:["graphTerm"],STRING_LITERAL_LONG2:["graphTerm"],INTEGER:["graphTerm"],DECIMAL:["graphTerm"],DOUBLE:["graphTerm"],INTEGER_POSITIVE:["graphTerm"],DECIMAL_POSITIVE:["graphTerm"],DOUBLE_POSITIVE:["graphTerm"],INTEGER_NEGATIVE:["graphTerm"],DECIMAL_NEGATIVE:["graphTerm"],DOUBLE_NEGATIVE:["graphTerm"]},verb:{VAR1:["storeProperty","varOrIRIref"],VAR2:["storeProperty","varOrIRIref"],IRI_REF:["storeProperty","varOrIRIref"],PNAME_LN:["storeProperty","varOrIRIref"],PNAME_NS:["storeProperty","varOrIRIref"],a:["storeProperty","a"]},verbPath:{"^":["path"],a:["path"],"!":["path"],"(":["path"],IRI_REF:["path"],PNAME_LN:["path"],PNAME_NS:["path"]},verbSimple:{VAR1:["var"],VAR2:["var"]},whereClause:{"{":["?WHERE","groupGraphPattern"],WHERE:["?WHERE","groupGraphPattern"]}}),s=/^(GROUP_CONCAT|DATATYPE|BASE|PREFIX|SELECT|CONSTRUCT|DESCRIBE|ASK|FROM|NAMED|ORDER|BY|LIMIT|ASC|DESC|OFFSET|DISTINCT|REDUCED|WHERE|GRAPH|OPTIONAL|UNION|FILTER|GROUP|HAVING|AS|VALUES|LOAD|CLEAR|DROP|CREATE|MOVE|COPY|SILENT|INSERT|DELETE|DATA|WITH|TO|USING|NAMED|MINUS|BIND|LANGMATCHES|LANG|BOUND|SAMETERM|ISIRI|ISURI|ISBLANK|ISLITERAL|REGEX|TRUE|FALSE|UNDEF|ADD|DEFAULT|ALL|SERVICE|INTO|IN|NOT|IRI|URI|BNODE|RAND|ABS|CEIL|FLOOR|ROUND|CONCAT|STRLEN|UCASE|LCASE|ENCODE_FOR_URI|CONTAINS|STRSTARTS|STRENDS|STRBEFORE|STRAFTER|YEAR|MONTH|DAY|HOURS|MINUTES|SECONDS|TIMEZONE|TZ|NOW|UUID|STRUUID|MD5|SHA1|SHA256|SHA384|SHA512|COALESCE|IF|STRLANG|STRDT|ISNUMERIC|SUBSTR|REPLACE|EXISTS|COUNT|SUM|MIN|MAX|AVG|SAMPLE|SEPARATOR|STR)/i,a=/^(\*|a|\.|\{|\}|,|\(|\)|;|\[|\]|\|\||&&|=|!=|!|<=|>=|<|>|\+|-|\/|\^\^|\?|\||\^)/,l=null,u="sparql11",p="sparql11",c=!0,d=t(),h=d.terminal,E={"*[,, object]":3,"*[(,),object]":3,"*[(,),objectPath]":3,"*[/,pathEltOrInverse]":2,object:2,objectPath:2,objectList:2,objectListPath:2,storeProperty:2,pathMod:2,"?pathMod":2,propertyListNotEmpty:1,propertyList:1,propertyListPath:1,propertyListPathNotEmpty:1,"?[verb,objectList]":1,"?[or([verbPath, verbSimple]),objectList]":1},f={"}":1,"]":0,")":1,"{":-1,"(":-1,"*[;,?[or([verbPath,verbSimple]),objectList]]":1};
return{token:i,startState:function(){return{tokenize:i,OK:!0,complete:c,errorStartPos:null,errorEndPos:null,queryType:l,possibleCurrent:r(p),possibleNext:r(p),allowVars:!0,allowBnodes:!0,storeProperty:!1,lastProperty:"",stack:[p]}},indent:n,electricChars:"}])"}}),e.defineMIME("application/x-sparql-query","sparql11")})},{codemirror:10}],4:[function(e,t){t.exports=Trie=function(){this.words=0,this.prefixes=0,this.children=[]},Trie.prototype={insert:function(e,t){if(0!=e.length){var r,i,n=this;if(void 0===t&&(t=0),t===e.length)return void n.words++;n.prefixes++,r=e[t],void 0===n.children[r]&&(n.children[r]=new Trie),i=n.children[r],i.insert(e,t+1)}},remove:function(e,t){if(0!=e.length){var r,i,n=this;if(void 0===t&&(t=0),void 0!==n){if(t===e.length)return void n.words--;n.prefixes--,r=e[t],i=n.children[r],i.remove(e,t+1)}}},update:function(e,t){0!=e.length&&0!=t.length&&(this.remove(e),this.insert(t))},countWord:function(e,t){if(0==e.length)return 0;var r,i,n=this,o=0;return void 0===t&&(t=0),t===e.length?n.words:(r=e[t],i=n.children[r],void 0!==i&&(o=i.countWord(e,t+1)),o)},countPrefix:function(e,t){if(0==e.length)return 0;var r,i,n=this,o=0;if(void 0===t&&(t=0),t===e.length)return n.prefixes;var r=e[t];return i=n.children[r],void 0!==i&&(o=i.countPrefix(e,t+1)),o},find:function(e){return 0==e.length?!1:this.countWord(e)>0?!0:!1},getAllWords:function(e){var t,r,i=this,n=[];if(void 0===e&&(e=""),void 0===i)return[];i.words>0&&n.push(e);for(t in i.children)r=i.children[t],n=n.concat(r.getAllWords(e+t));return n},autoComplete:function(e,t){var r,i,n=this;return 0==e.length?void 0===t?n.getAllWords(e):[]:(void 0===t&&(t=0),r=e[t],i=n.children[r],void 0===i?[]:t===e.length-1?i.getAllWords(e):i.autoComplete(e,t+1))}}},{}],5:[function(t,r,i){!function(n){"object"==typeof i&&"object"==typeof r?n(t("../../lib/codemirror")):"function"==typeof e&&e.amd?e(["../../lib/codemirror"],n):n(CodeMirror)}(function(e){"use strict";function t(e){var t=e.getWrapperElement();e.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:t.style.width,height:t.style.height},t.style.width="",t.style.height="auto",t.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",e.refresh()}function r(e){var t=e.getWrapperElement();t.className=t.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var r=e.state.fullScreenRestore;t.style.width=r.width,t.style.height=r.height,window.scrollTo(r.scrollLeft,r.scrollTop),e.refresh()}e.defineOption("fullScreen",!1,function(i,n,o){o==e.Init&&(o=!1),!o!=!n&&(n?t(i):r(i))})})},{"../../lib/codemirror":10}],6:[function(t,r,i){!function(n){"object"==typeof i&&"object"==typeof r?n(t("../../lib/codemirror")):"function"==typeof e&&e.amd?e(["../../lib/codemirror"],n):n(CodeMirror)}(function(e){function t(e,t,i,n){var o=e.getLineHandle(t.line),l=t.ch-1,u=l>=0&&a[o.text.charAt(l)]||a[o.text.charAt(++l)];if(!u)return null;var p=">"==u.charAt(1)?1:-1;if(i&&p>0!=(l==t.ch))return null;var c=e.getTokenTypeAt(s(t.line,l+1)),d=r(e,s(t.line,l+(p>0?1:0)),p,c||null,n);return null==d?null:{from:s(t.line,l),to:d&&d.pos,match:d&&d.ch==u.charAt(0),forward:p>0}}function r(e,t,r,i,n){for(var o=n&&n.maxScanLineLength||1e4,l=n&&n.maxScanLines||1e3,u=[],p=n&&n.bracketRegex?n.bracketRegex:/[(){}[\]]/,c=r>0?Math.min(t.line+l,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-l),d=t.line;d!=c;d+=r){var h=e.getLine(d);if(h){var E=r>0?0:h.length-1,f=r>0?h.length:-1;if(!(h.length>o))for(d==t.line&&(E=t.ch-(0>r?1:0));E!=f;E+=r){var m=h.charAt(E);if(p.test(m)&&(void 0===i||e.getTokenTypeAt(s(d,E+1))==i)){var g=a[m];if(">"==g.charAt(1)==r>0)u.push(m);else{if(!u.length)return{pos:s(d,E),ch:m};u.pop()}}}}}return d-r==(r>0?e.lastLine():e.firstLine())?!1:null}function i(e,r,i){for(var n=e.state.matchBrackets.maxHighlightLineLength||1e3,a=[],l=e.listSelections(),u=0;u<l.length;u++){var p=l[u].empty()&&t(e,l[u].head,!1,i);if(p&&e.getLine(p.from.line).length<=n){var c=p.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";a.push(e.markText(p.from,s(p.from.line,p.from.ch+1),{className:c})),p.to&&e.getLine(p.to.line).length<=n&&a.push(e.markText(p.to,s(p.to.line,p.to.ch+1),{className:c}))}}if(a.length){o&&e.state.focused&&e.display.input.focus();var d=function(){e.operation(function(){for(var e=0;e<a.length;e++)a[e].clear()})};if(!r)return d;setTimeout(d,800)}}function n(e){e.operation(function(){l&&(l(),l=null),l=i(e,!1,e.state.matchBrackets)})}var o=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),s=e.Pos,a={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},l=null;e.defineOption("matchBrackets",!1,function(t,r,i){i&&i!=e.Init&&t.off("cursorActivity",n),r&&(t.state.matchBrackets="object"==typeof r?r:{},t.on("cursorActivity",n))}),e.defineExtension("matchBrackets",function(){i(this,!0)}),e.defineExtension("findMatchingBracket",function(e,r,i){return t(this,e,r,i)}),e.defineExtension("scanForBracket",function(e,t,i,n){return r(this,e,t,i,n)})})},{"../../lib/codemirror":10}],7:[function(t,r,i){!function(n){"object"==typeof i&&"object"==typeof r?n(t("../../lib/codemirror")):"function"==typeof e&&e.amd?e(["../../lib/codemirror"],n):n(CodeMirror)}(function(e){"use strict";function t(e,t){this.cm=e,this.options=this.buildOptions(t),this.widget=this.onClose=null}function r(e){return"string"==typeof e?e:e.text}function i(e,t){function r(e,r){var n;n="string"!=typeof r?function(e){return r(e,t)}:i.hasOwnProperty(r)?i[r]:r,o[e]=n}var i={Up:function(){t.moveFocus(-1)},Down:function(){t.moveFocus(1)},PageUp:function(){t.moveFocus(-t.menuSize()+1,!0)},PageDown:function(){t.moveFocus(t.menuSize()-1,!0)},Home:function(){t.setFocus(0)},End:function(){t.setFocus(t.length-1)},Enter:t.pick,Tab:t.pick,Esc:t.close},n=e.options.customKeys,o=n?{}:i;if(n)for(var s in n)n.hasOwnProperty(s)&&r(s,n[s]);var a=e.options.extraKeys;if(a)for(var s in a)a.hasOwnProperty(s)&&r(s,a[s]);return o}function n(e,t){for(;t&&t!=e;){if("LI"===t.nodeName.toUpperCase()&&t.parentNode==e)return t;t=t.parentNode}}function o(t,o){this.completion=t,this.data=o;var l=this,u=t.cm,p=this.hints=document.createElement("ul");p.className="CodeMirror-hints",this.selectedHint=o.selectedHint||0;for(var c=o.list,d=0;d<c.length;++d){var h=p.appendChild(document.createElement("li")),E=c[d],f=s+(d!=this.selectedHint?"":" "+a);null!=E.className&&(f=E.className+" "+f),h.className=f,E.render?E.render(h,o,E):h.appendChild(document.createTextNode(E.displayText||r(E))),h.hintId=d}var m=u.cursorCoords(t.options.alignWithWord?o.from:null),g=m.left,v=m.bottom,x=!0;p.style.left=g+"px",p.style.top=v+"px";var N=window.innerWidth||Math.max(document.body.offsetWidth,document.documentElement.offsetWidth),L=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(t.options.container||document.body).appendChild(p);var T=p.getBoundingClientRect(),I=T.bottom-L;if(I>0){var y=T.bottom-T.top,A=m.top-(m.bottom-T.top);if(A-y>0)p.style.top=(v=m.top-y)+"px",x=!1;else if(y>L){p.style.height=L-5+"px",p.style.top=(v=m.bottom-T.top)+"px";var S=u.getCursor();o.from.ch!=S.ch&&(m=u.cursorCoords(S),p.style.left=(g=m.left)+"px",T=p.getBoundingClientRect())}}var C=T.left-N;if(C>0&&(T.right-T.left>N&&(p.style.width=N-5+"px",C-=T.right-T.left-N),p.style.left=(g=m.left-C)+"px"),u.addKeyMap(this.keyMap=i(t,{moveFocus:function(e,t){l.changeActive(l.selectedHint+e,t)},setFocus:function(e){l.changeActive(e)},menuSize:function(){return l.screenAmount()},length:c.length,close:function(){t.close()},pick:function(){l.pick()},data:o})),t.options.closeOnUnfocus){var R;u.on("blur",this.onBlur=function(){R=setTimeout(function(){t.close()},100)}),u.on("focus",this.onFocus=function(){clearTimeout(R)})}var b=u.getScrollInfo();return u.on("scroll",this.onScroll=function(){var e=u.getScrollInfo(),r=u.getWrapperElement().getBoundingClientRect(),i=v+b.top-e.top,n=i-(window.pageYOffset||(document.documentElement||document.body).scrollTop);return x||(n+=p.offsetHeight),n<=r.top||n>=r.bottom?t.close():(p.style.top=i+"px",void(p.style.left=g+b.left-e.left+"px"))}),e.on(p,"dblclick",function(e){var t=n(p,e.target||e.srcElement);t&&null!=t.hintId&&(l.changeActive(t.hintId),l.pick())}),e.on(p,"click",function(e){var r=n(p,e.target||e.srcElement);r&&null!=r.hintId&&(l.changeActive(r.hintId),t.options.completeOnSingleClick&&l.pick())}),e.on(p,"mousedown",function(){setTimeout(function(){u.focus()},20)}),e.signal(o,"select",c[0],p.firstChild),!0}var s="CodeMirror-hint",a="CodeMirror-hint-active";e.showHint=function(e,t,r){if(!t)return e.showHint(r);r&&r.async&&(t.async=!0);var i={hint:t};if(r)for(var n in r)i[n]=r[n];return e.showHint(i)},e.defineExtension("showHint",function(r){if(!(this.listSelections().length>1||this.somethingSelected())){this.state.completionActive&&this.state.completionActive.close();var i=this.state.completionActive=new t(this,r),n=i.options.hint;if(n)return e.signal(this,"startCompletion",this),n.async?void n(this,function(e){i.showHints(e)},i.options):i.showHints(n(this,i.options))}}),t.prototype={close:function(){this.active()&&(this.cm.state.completionActive=null,this.widget&&this.widget.close(),this.onClose&&this.onClose(),e.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(t,i){var n=t.list[i];n.hint?n.hint(this.cm,t,n):this.cm.replaceRange(r(n),n.from||t.from,n.to||t.to,"complete"),e.signal(t,"pick",n),this.close()},showHints:function(e){return e&&e.list.length&&this.active()?void(this.options.completeSingle&&1==e.list.length?this.pick(e,0):this.showWidget(e)):this.close()},showWidget:function(t){function r(){l||(l=!0,p.close(),p.cm.off("cursorActivity",a),t&&e.signal(t,"close"))}function i(){if(!l){e.signal(t,"update");var r=p.options.hint;r.async?r(p.cm,n,p.options):n(r(p.cm,p.options))}}function n(e){if(t=e,!l){if(!t||!t.list.length)return r();p.widget&&p.widget.close(),p.widget=new o(p,t)}}function s(){u&&(f(u),u=0)}function a(){s();var e=p.cm.getCursor(),t=p.cm.getLine(e.line);e.line!=d.line||t.length-e.ch!=h-d.ch||e.ch<d.ch||p.cm.somethingSelected()||e.ch&&c.test(t.charAt(e.ch-1))?p.close():(u=E(i),p.widget&&p.widget.close())}this.widget=new o(this,t),e.signal(t,"shown");var l,u=0,p=this,c=this.options.closeCharacters,d=this.cm.getCursor(),h=this.cm.getLine(d.line).length,E=window.requestAnimationFrame||function(e){return setTimeout(e,1e3/60)},f=window.cancelAnimationFrame||clearTimeout;this.cm.on("cursorActivity",a),this.onClose=r},buildOptions:function(e){var t=this.cm.options.hintOptions,r={};for(var i in l)r[i]=l[i];if(t)for(var i in t)void 0!==t[i]&&(r[i]=t[i]);if(e)for(var i in e)void 0!==e[i]&&(r[i]=e[i]);return r}},o.prototype={close:function(){if(this.completion.widget==this){this.completion.widget=null,this.hints.parentNode.removeChild(this.hints),this.completion.cm.removeKeyMap(this.keyMap);var e=this.completion.cm;this.completion.options.closeOnUnfocus&&(e.off("blur",this.onBlur),e.off("focus",this.onFocus)),e.off("scroll",this.onScroll)}},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(t,r){if(t>=this.data.list.length?t=r?this.data.list.length-1:0:0>t&&(t=r?0:this.data.list.length-1),this.selectedHint!=t){var i=this.hints.childNodes[this.selectedHint];i.className=i.className.replace(" "+a,""),i=this.hints.childNodes[this.selectedHint=t],i.className+=" "+a,i.offsetTop<this.hints.scrollTop?this.hints.scrollTop=i.offsetTop-3:i.offsetTop+i.offsetHeight>this.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=i.offsetTop+i.offsetHeight-this.hints.clientHeight+3),e.signal(this.data,"select",this.data.list[this.selectedHint],i)}},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},e.registerHelper("hint","auto",function(t,r){var i,n=t.getHelpers(t.getCursor(),"hint");if(n.length)for(var o=0;o<n.length;o++){var s=n[o](t,r);if(s&&s.list.length)return s}else if(i=t.getHelper(t.getCursor(),"hintWords")){if(i)return e.hint.fromList(t,{words:i})}else if(e.hint.anyword)return e.hint.anyword(t,r)}),e.registerHelper("hint","fromList",function(t,r){for(var i=t.getCursor(),n=t.getTokenAt(i),o=[],s=0;s<r.words.length;s++){var a=r.words[s];a.slice(0,n.string.length)==n.string&&o.push(a)}return o.length?{list:o,from:e.Pos(i.line,n.start),to:e.Pos(i.line,n.end)}:void 0}),e.commands.autocomplete=e.showHint;var l={hint:e.hint.auto,completeSingle:!0,alignWithWord:!0,closeCharacters:/[\s()\[\]{};:>,]/,closeOnUnfocus:!0,completeOnSingleClick:!1,container:null,customKeys:null,extraKeys:null};e.defineOption("hintOptions",null)})},{"../../lib/codemirror":10}],8:[function(t,r,i){!function(n){"object"==typeof i&&"object"==typeof r?n(t("../../lib/codemirror")):"function"==typeof e&&e.amd?e(["../../lib/codemirror"],n):n(CodeMirror)}(function(e){"use strict";e.runMode=function(t,r,i,n){var o=e.getMode(e.defaults,r),s=/MSIE \d/.test(navigator.userAgent),a=s&&(null==document.documentMode||document.documentMode<9);if(1==i.nodeType){var l=n&&n.tabSize||e.defaults.tabSize,u=i,p=0;u.innerHTML="",i=function(e,t){if("\n"==e)return u.appendChild(document.createTextNode(a?"\r":e)),void(p=0);for(var r="",i=0;;){var n=e.indexOf(" ",i);if(-1==n){r+=e.slice(i),p+=e.length-i;break}p+=n-i,r+=e.slice(i,n);var o=l-p%l;p+=o;for(var s=0;o>s;++s)r+=" ";i=n+1}if(t){var c=u.appendChild(document.createElement("span"));c.className="cm-"+t.replace(/ +/g," cm-"),c.appendChild(document.createTextNode(r))}else u.appendChild(document.createTextNode(r))}}for(var c=e.splitLines(t),d=n&&n.state||e.startState(o),h=0,E=c.length;E>h;++h){h&&i("\n");var f=new e.StringStream(c[h]);for(!f.string&&o.blankLine&&o.blankLine(d);!f.eol();){var m=o.token(f,d);i(f.current(),m,h,f.start,d),f.start=f.pos}}}})},{"../../lib/codemirror":10}],9:[function(t,r,i){!function(n){"object"==typeof i&&"object"==typeof r?n(t("../../lib/codemirror")):"function"==typeof e&&e.amd?e(["../../lib/codemirror"],n):n(CodeMirror)}(function(e){"use strict";function t(e,t,n,o){if(this.atOccurrence=!1,this.doc=e,null==o&&"string"==typeof t&&(o=!1),n=n?e.clipPos(n):i(0,0),this.pos={from:n,to:n},"string"!=typeof t)t.global||(t=new RegExp(t.source,t.ignoreCase?"ig":"g")),this.matches=function(r,n){if(r){t.lastIndex=0;for(var o,s,a=e.getLine(n.line).slice(0,n.ch),l=0;;){t.lastIndex=l;var u=t.exec(a);if(!u)break;if(o=u,s=o.index,l=o.index+(o[0].length||1),l==a.length)break}var p=o&&o[0].length||0;p||(0==s&&0==a.length?o=void 0:s!=e.getLine(n.line).length&&p++)}else{t.lastIndex=n.ch;var a=e.getLine(n.line),o=t.exec(a),p=o&&o[0].length||0,s=o&&o.index;s+p==a.length||p||(p=1)}return o&&p?{from:i(n.line,s),to:i(n.line,s+p),match:o}:void 0};else{var s=t;o&&(t=t.toLowerCase());var a=o?function(e){return e.toLowerCase()}:function(e){return e},l=t.split("\n");if(1==l.length)this.matches=t.length?function(n,o){if(n){var l=e.getLine(o.line).slice(0,o.ch),u=a(l),p=u.lastIndexOf(t);if(p>-1)return p=r(l,u,p),{from:i(o.line,p),to:i(o.line,p+s.length)}}else{var l=e.getLine(o.line).slice(o.ch),u=a(l),p=u.indexOf(t);if(p>-1)return p=r(l,u,p)+o.ch,{from:i(o.line,p),to:i(o.line,p+s.length)}}}:function(){};else{var u=s.split("\n");this.matches=function(t,r){var n=l.length-1;if(t){if(r.line-(l.length-1)<e.firstLine())return;if(a(e.getLine(r.line).slice(0,u[n].length))!=l[l.length-1])return;for(var o=i(r.line,u[n].length),s=r.line-1,p=n-1;p>=1;--p,--s)if(l[p]!=a(e.getLine(s)))return;var c=e.getLine(s),d=c.length-u[0].length;if(a(c.slice(d))!=l[0])return;return{from:i(s,d),to:o}}if(!(r.line+(l.length-1)>e.lastLine())){var c=e.getLine(r.line),d=c.length-u[0].length;if(a(c.slice(d))==l[0]){for(var h=i(r.line,d),s=r.line+1,p=1;n>p;++p,++s)if(l[p]!=a(e.getLine(s)))return;if(a(e.getLine(s).slice(0,u[n].length))==l[n])return{from:h,to:i(s,u[n].length)}}}}}}}function r(e,t,r){if(e.length==t.length)return r;for(var i=Math.min(r,e.length);;){var n=e.slice(0,i).toLowerCase().length;if(r>n)++i;else{if(!(n>r))return i;--i}}}var i=e.Pos;t.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){function t(e){var t=i(e,0);return r.pos={from:t,to:t},r.atOccurrence=!1,!1}for(var r=this,n=this.doc.clipPos(e?this.pos.from:this.pos.to);;){if(this.pos=this.matches(e,n))return this.atOccurrence=!0,this.pos.match||!0;if(e){if(!n.line)return t(0);n=i(n.line-1,this.doc.getLine(n.line-1).length)}else{var o=this.doc.lineCount();if(n.line==o-1)return t(o);n=i(n.line+1,0)}}},from:function(){return this.atOccurrence?this.pos.from:void 0},to:function(){return this.atOccurrence?this.pos.to:void 0},replace:function(t){if(this.atOccurrence){var r=e.splitLines(t);this.doc.replaceRange(r,this.pos.from,this.pos.to),this.pos.to=i(this.pos.from.line+r.length-1,r[r.length-1].length+(1==r.length?this.pos.from.ch:0))}}},e.defineExtension("getSearchCursor",function(e,r,i){return new t(this.doc,e,r,i)}),e.defineDocExtension("getSearchCursor",function(e,r,i){return new t(this,e,r,i)}),e.defineExtension("selectMatches",function(t,r){for(var i,n=[],o=this.getSearchCursor(t,this.getCursor("from"),r);(i=o.findNext())&&!(e.cmpPos(o.to(),this.getCursor("to"))>0);)n.push({anchor:o.from(),head:o.to()});n.length&&this.setSelections(n,0)})})},{"../../lib/codemirror":10}],10:[function(t,r,i){!function(t){if("object"==typeof i&&"object"==typeof r)r.exports=t();else{if("function"==typeof e&&e.amd)return e([],t);this.CodeMirror=t()}}(function(){"use strict";function e(r,i){if(!(this instanceof e))return new e(r,i);this.options=i=i?mo(i):{},mo(_s,i,!1),E(i);var n=i.value;"string"==typeof n&&(n=new ia(n,i.mode)),this.doc=n;var o=this.display=new t(r,n);o.wrapper.CodeMirror=this,p(this),l(this),i.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),i.autofocus&&!ps&&Ar(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new lo},Jo&&11>es&&setTimeout(go(yr,this,!0),20),Rr(this),Po(),Jt(this),this.curOp.forceUpdate=!0,bn(this,n),i.autofocus&&!ps||Ao()==o.input?setTimeout(go(Qr,this),20):Zr(this);for(var s in Ms)Ms.hasOwnProperty(s)&&Ms[s](this,i[s],ws);N(this);for(var a=0;a<Us.length;++a)Us[a](this);tr(this)}function t(e,t){var r=this,i=r.input=Lo("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none");ts?i.style.width="1000px":i.setAttribute("wrap","off"),us&&(i.style.border="1px solid black"),i.setAttribute("autocorrect","off"),i.setAttribute("autocapitalize","off"),i.setAttribute("spellcheck","false"),r.inputDiv=Lo("div",[i],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),r.scrollbarH=Lo("div",[Lo("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar"),r.scrollbarV=Lo("div",[Lo("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),r.scrollbarFiller=Lo("div",null,"CodeMirror-scrollbar-filler"),r.gutterFiller=Lo("div",null,"CodeMirror-gutter-filler"),r.lineDiv=Lo("div",null,"CodeMirror-code"),r.selectionDiv=Lo("div",null,null,"position: relative; z-index: 1"),r.cursorDiv=Lo("div",null,"CodeMirror-cursors"),r.measure=Lo("div",null,"CodeMirror-measure"),r.lineMeasure=Lo("div",null,"CodeMirror-measure"),r.lineSpace=Lo("div",[r.measure,r.lineMeasure,r.selectionDiv,r.cursorDiv,r.lineDiv],null,"position: relative; outline: none"),r.mover=Lo("div",[Lo("div",[r.lineSpace],"CodeMirror-lines")],null,"position: relative"),r.sizer=Lo("div",[r.mover],"CodeMirror-sizer"),r.heightForcer=Lo("div",null,null,"position: absolute; height: "+ha+"px; width: 1px;"),r.gutters=Lo("div",null,"CodeMirror-gutters"),r.lineGutter=null,r.scroller=Lo("div",[r.sizer,r.heightForcer,r.gutters],"CodeMirror-scroll"),r.scroller.setAttribute("tabIndex","-1"),r.wrapper=Lo("div",[r.inputDiv,r.scrollbarH,r.scrollbarV,r.scrollbarFiller,r.gutterFiller,r.scroller],"CodeMirror"),Jo&&8>es&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),us&&(i.style.width="0px"),ts||(r.scroller.draggable=!0),ss&&(r.inputDiv.style.height="1px",r.inputDiv.style.position="absolute"),Jo&&8>es&&(r.scrollbarH.style.minHeight=r.scrollbarV.style.minWidth="18px"),e.appendChild?e.appendChild(r.wrapper):e(r.wrapper),r.viewFrom=r.viewTo=t.first,r.view=[],r.externalMeasured=null,r.viewOffset=0,r.lastSizeC=0,r.updateLineNumbers=null,r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null,r.prevInput="",r.alignWidgets=!1,r.pollingFast=!1,r.poll=new lo,r.cachedCharWidth=r.cachedTextHeight=r.cachedPaddingH=null,r.inaccurateSelection=!1,r.maxLine=null,r.maxLineLength=0,r.maxLineChanged=!1,r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null,r.shift=!1,r.selForContextMenu=null}function r(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),i(t)}function i(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,Tt(e,100),e.state.modeGen++,e.curOp&&Er(e)}function n(e){e.options.lineWrapping?(Ro(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth=""):(Co(e.display.wrapper,"CodeMirror-wrap"),h(e)),s(e),Er(e),Vt(e),setTimeout(function(){g(e)},100)}function o(e){var t=Qt(e.display),r=e.options.lineWrapping,i=r&&Math.max(5,e.display.scroller.clientWidth/Zt(e.display)-3);return function(n){if(tn(e.doc,n))return 0;var o=0;if(n.widgets)for(var s=0;s<n.widgets.length;s++)n.widgets[s].height&&(o+=n.widgets[s].height);return r?o+(Math.ceil(n.text.length/i)||1)*t:o+t}}function s(e){var t=e.doc,r=o(e);t.iter(function(e){var t=r(e);t!=e.height&&_n(e,t)})}function a(e){var t=Ws[e.options.keyMap],r=t.style;e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(r?" cm-keymap-"+r:"")}function l(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Vt(e)}function u(e){p(e),Er(e),setTimeout(function(){x(e)},20)}function p(e){var t=e.display.gutters,r=e.options.gutters;To(t);for(var i=0;i<r.length;++i){var n=r[i],o=t.appendChild(Lo("div",null,"CodeMirror-gutter "+n));"CodeMirror-linenumbers"==n&&(e.display.lineGutter=o,o.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=i?"":"none",c(e)}function c(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px",e.display.scrollbarH.style.left=e.options.fixedGutter?t+"px":0}function d(e){if(0==e.height)return 0;for(var t,r=e.text.length,i=e;t=Yi(i);){var n=t.find(0,!0);i=n.from.line,r+=n.from.ch-n.to.ch}for(i=e;t=Ki(i);){var n=t.find(0,!0);r-=i.text.length-n.from.ch,i=n.to.line,r+=i.text.length-n.to.ch}return r}function h(e){var t=e.display,r=e.doc;t.maxLine=On(r,r.first),t.maxLineLength=d(t.maxLine),t.maxLineChanged=!0,r.iter(function(e){var r=d(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}function E(e){var t=ho(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function f(e){return e.display.scroller.clientHeight-e.display.wrapper.clientHeight<ha-3}function m(e){var t=e.display.scroller;return{clientHeight:t.clientHeight,barHeight:e.display.scrollbarV.clientHeight,scrollWidth:t.scrollWidth,clientWidth:t.clientWidth,hScrollbarTakesSpace:f(e),barWidth:e.display.scrollbarH.clientWidth,docHeight:Math.round(e.doc.height+Ct(e.display))}}function g(e,t){t||(t=m(e));var r=e.display,i=_o(r.measure),n=t.docHeight+ha,o=t.scrollWidth>t.clientWidth;o&&t.scrollWidth<=t.clientWidth+1&&i>0&&!t.hScrollbarTakesSpace&&(o=!1);var s=n>t.clientHeight;if(s?(r.scrollbarV.style.display="block",r.scrollbarV.style.bottom=o?i+"px":"0",r.scrollbarV.firstChild.style.height=Math.max(0,n-t.clientHeight+(t.barHeight||r.scrollbarV.clientHeight))+"px"):(r.scrollbarV.style.display="",r.scrollbarV.firstChild.style.height="0"),o?(r.scrollbarH.style.display="block",r.scrollbarH.style.right=s?i+"px":"0",r.scrollbarH.firstChild.style.width=t.scrollWidth-t.clientWidth+(t.barWidth||r.scrollbarH.clientWidth)+"px"):(r.scrollbarH.style.display="",r.scrollbarH.firstChild.style.width="0"),o&&s?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=r.scrollbarFiller.style.width=i+"px"):r.scrollbarFiller.style.display="",o&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=i+"px",r.gutterFiller.style.width=r.gutters.offsetWidth+"px"):r.gutterFiller.style.display="",!e.state.checkedOverlayScrollbar&&t.clientHeight>0){if(0===i){var a=cs&&!as?"12px":"18px";r.scrollbarV.style.minWidth=r.scrollbarH.style.minHeight=a;var l=function(t){eo(t)!=r.scrollbarV&&eo(t)!=r.scrollbarH&&ur(e,Dr)(t)};ua(r.scrollbarV,"mousedown",l),ua(r.scrollbarH,"mousedown",l)}e.state.checkedOverlayScrollbar=!0}}function v(e,t,r){var i=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;i=Math.floor(i-St(e));var n=r&&null!=r.bottom?r.bottom:i+e.wrapper.clientHeight,o=wn(t,i),s=wn(t,n);if(r&&r.ensure){var a=r.ensure.from.line,l=r.ensure.to.line;if(o>a)return{from:a,to:wn(t,Gn(On(t,a))+e.wrapper.clientHeight)};if(Math.min(l,t.lastLine())>=s)return{from:wn(t,Gn(On(t,l))-e.wrapper.clientHeight),to:l}}return{from:o,to:Math.max(s,o+1)}}function x(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var i=T(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,o=i+"px",s=0;s<r.length;s++)if(!r[s].hidden){e.options.fixedGutter&&r[s].gutter&&(r[s].gutter.style.left=o);var a=r[s].alignable;if(a)for(var l=0;l<a.length;l++)a[l].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=i+n+"px")}}function N(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=L(e.options,t.first+t.size-1),i=e.display;if(r.length!=i.lineNumChars){var n=i.measure.appendChild(Lo("div",[Lo("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=n.firstChild.offsetWidth,s=n.offsetWidth-o;return i.lineGutter.style.width="",i.lineNumInnerWidth=Math.max(o,i.lineGutter.offsetWidth-s),i.lineNumWidth=i.lineNumInnerWidth+s,i.lineNumChars=i.lineNumInnerWidth?r.length:-1,i.lineGutter.style.width=i.lineNumWidth+"px",c(e),!0}return!1}function L(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function T(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function I(e,t,r){var i=e.display;this.viewport=t,this.visible=v(i,e.doc,t),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.oldViewFrom=i.viewFrom,this.oldViewTo=i.viewTo,this.oldScrollerWidth=i.scroller.clientWidth,this.force=r,this.dims=P(e)}function y(e,t){var r=e.display,i=e.doc;if(t.editorIsHidden)return mr(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&0==Nr(e))return!1;N(e)&&(mr(e),t.dims=P(e));var n=i.first+i.size,o=Math.max(t.visible.from-e.options.viewportMargin,i.first),s=Math.min(n,t.visible.to+e.options.viewportMargin);r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(i.first,r.viewFrom)),r.viewTo>s&&r.viewTo-s<20&&(s=Math.min(n,r.viewTo)),gs&&(o=Ji(e.doc,o),s=en(e.doc,s));var a=o!=r.viewFrom||s!=r.viewTo||r.lastSizeC!=t.wrapperHeight;xr(e,o,s),r.viewOffset=Gn(On(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var l=Nr(e);if(!a&&0==l&&!t.force&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var u=Ao();return l>4&&(r.lineDiv.style.display="none"),D(e,r.updateLineNumbers,t.dims),l>4&&(r.lineDiv.style.display=""),u&&Ao()!=u&&u.offsetHeight&&u.focus(),To(r.cursorDiv),To(r.selectionDiv),a&&(r.lastSizeC=t.wrapperHeight,Tt(e,400)),r.updateLineNumbers=null,!0}function A(e,t){for(var r=t.force,i=t.viewport,n=!0;;n=!1){if(n&&e.options.lineWrapping&&t.oldScrollerWidth!=e.display.scroller.clientWidth)r=!0;else if(r=!1,i&&null!=i.top&&(i={top:Math.min(e.doc.height+Ct(e.display)-ha-e.display.scroller.clientHeight,i.top)}),t.visible=v(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!y(e,t))break;b(e);var o=m(e);vt(e),C(e,o),g(e,o)}ro(e,"update",e),(e.display.viewFrom!=t.oldViewFrom||e.display.viewTo!=t.oldViewTo)&&ro(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo)}function S(e,t){var r=new I(e,t);if(y(e,r)){b(e),A(e,r);var i=m(e);vt(e),C(e,i),g(e,i)}}function C(e,t){e.display.sizer.style.minHeight=e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=Math.max(t.docHeight,t.clientHeight-ha)+"px"}function R(e,t){e.display.sizer.offsetWidth+e.display.gutters.offsetWidth<e.display.scroller.clientWidth-1&&(e.display.sizer.style.minHeight=e.display.heightForcer.style.top="0px",e.display.gutters.style.height=t.docHeight+"px")}function b(e){for(var t=e.display,r=t.lineDiv.offsetTop,i=0;i<t.view.length;i++){var n,o=t.view[i];if(!o.hidden){if(Jo&&8>es){var s=o.node.offsetTop+o.node.offsetHeight;n=s-r,r=s}else{var a=o.node.getBoundingClientRect();n=a.bottom-a.top}var l=o.line.height-n;if(2>n&&(n=Qt(t)),(l>.001||-.001>l)&&(_n(o.line,n),O(o.line),o.rest))for(var u=0;u<o.rest.length;u++)O(o.rest[u])}}}function O(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t)e.widgets[t].height=e.widgets[t].node.offsetHeight}function P(e){for(var t=e.display,r={},i={},n=t.gutters.clientLeft,o=t.gutters.firstChild,s=0;o;o=o.nextSibling,++s)r[e.options.gutters[s]]=o.offsetLeft+o.clientLeft+n,i[e.options.gutters[s]]=o.clientWidth;return{fixedPos:T(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function D(e,t,r){function i(t){var r=t.nextSibling;return ts&&cs&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var n=e.display,o=e.options.lineNumbers,s=n.lineDiv,a=s.firstChild,l=n.view,u=n.viewFrom,p=0;p<l.length;p++){var c=l[p];if(c.hidden);else if(c.node){for(;a!=c.node;)a=i(a);var d=o&&null!=t&&u>=t&&c.lineNumber;c.changes&&(ho(c.changes,"gutter")>-1&&(d=!1),_(e,c,u,r)),d&&(To(c.lineNumber),c.lineNumber.appendChild(document.createTextNode(L(e.options,u)))),a=c.node.nextSibling}else{var h=H(e,c,u,r);s.insertBefore(h,a)}u+=c.size}for(;a;)a=i(a)}function _(e,t,r,i){for(var n=0;n<t.changes.length;n++){var o=t.changes[n];"text"==o?k(e,t):"gutter"==o?U(e,t,r,i):"class"==o?B(t):"widget"==o&&V(t,i)}t.changes=null}function M(e){return e.node==e.text&&(e.node=Lo("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),Jo&&8>es&&(e.node.style.zIndex=2)),e.node}function w(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var r=M(e);e.background=r.insertBefore(Lo("div",null,t),r.firstChild)}}function G(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):gn(e,t)}function k(e,t){var r=t.text.className,i=G(e,t);t.text==t.node&&(t.node=i.pre),t.text.parentNode.replaceChild(i.pre,t.text),t.text=i.pre,i.bgClass!=t.bgClass||i.textClass!=t.textClass?(t.bgClass=i.bgClass,t.textClass=i.textClass,B(t)):r&&(t.text.className=r)}function B(e){w(e),e.line.wrapClass?M(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function U(e,t,r,i){t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null);var n=t.line.gutterMarkers;if(e.options.lineNumbers||n){var o=M(t),s=t.gutter=o.insertBefore(Lo("div",null,"CodeMirror-gutter-wrapper","position: absolute; left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px"),t.text);if(!e.options.lineNumbers||n&&n["CodeMirror-linenumbers"]||(t.lineNumber=s.appendChild(Lo("div",L(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),n)for(var a=0;a<e.options.gutters.length;++a){var l=e.options.gutters[a],u=n.hasOwnProperty(l)&&n[l];
u&&s.appendChild(Lo("div",[u],"CodeMirror-gutter-elt","left: "+i.gutterLeft[l]+"px; width: "+i.gutterWidth[l]+"px"))}}}function V(e,t){e.alignable&&(e.alignable=null);for(var r,i=e.node.firstChild;i;i=r){var r=i.nextSibling;"CodeMirror-linewidget"==i.className&&e.node.removeChild(i)}F(e,t)}function H(e,t,r,i){var n=G(e,t);return t.text=t.node=n.pre,n.bgClass&&(t.bgClass=n.bgClass),n.textClass&&(t.textClass=n.textClass),B(t),U(e,t,r,i),F(t,i),t.node}function F(e,t){if(j(e.line,e,t,!0),e.rest)for(var r=0;r<e.rest.length;r++)j(e.rest[r],e,t,!1)}function j(e,t,r,i){if(e.widgets)for(var n=M(t),o=0,s=e.widgets;o<s.length;++o){var a=s[o],l=Lo("div",[a.node],"CodeMirror-linewidget");a.handleMouseEvents||(l.ignoreEvents=!0),W(a,l,t,r),i&&a.above?n.insertBefore(l,t.gutter||t.text):n.appendChild(l),ro(a,"redraw")}}function W(e,t,r,i){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var n=i.wrapperWidth;t.style.left=i.fixedPos+"px",e.coverGutter||(n-=i.gutterTotalWidth,t.style.paddingLeft=i.gutterTotalWidth+"px"),t.style.width=n+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-i.gutterTotalWidth+"px"))}function q(e){return vs(e.line,e.ch)}function z(e,t){return xs(e,t)<0?t:e}function X(e,t){return xs(e,t)<0?e:t}function Y(e,t){this.ranges=e,this.primIndex=t}function K(e,t){this.anchor=e,this.head=t}function $(e,t){var r=e[t];e.sort(function(e,t){return xs(e.from(),t.from())}),t=ho(e,r);for(var i=1;i<e.length;i++){var n=e[i],o=e[i-1];if(xs(o.to(),n.from())>=0){var s=X(o.from(),n.from()),a=z(o.to(),n.to()),l=o.empty()?n.from()==n.head:o.from()==o.head;t>=i&&--t,e.splice(--i,2,new K(l?a:s,l?s:a))}}return new Y(e,t)}function Q(e,t){return new Y([new K(e,t||e)],0)}function Z(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function J(e,t){if(t.line<e.first)return vs(e.first,0);var r=e.first+e.size-1;return t.line>r?vs(r,On(e,r).text.length):et(t,On(e,t.line).text.length)}function et(e,t){var r=e.ch;return null==r||r>t?vs(e.line,t):0>r?vs(e.line,0):e}function tt(e,t){return t>=e.first&&t<e.first+e.size}function rt(e,t){for(var r=[],i=0;i<t.length;i++)r[i]=J(e,t[i]);return r}function it(e,t,r,i){if(e.cm&&e.cm.display.shift||e.extend){var n=t.anchor;if(i){var o=xs(r,n)<0;o!=xs(i,n)<0?(n=r,r=i):o!=xs(r,i)<0&&(r=i)}return new K(n,r)}return new K(i||r,r)}function nt(e,t,r,i){pt(e,new Y([it(e,e.sel.primary(),t,r)],0),i)}function ot(e,t,r){for(var i=[],n=0;n<e.sel.ranges.length;n++)i[n]=it(e,e.sel.ranges[n],t[n],null);var o=$(i,e.sel.primIndex);pt(e,o,r)}function st(e,t,r,i){var n=e.sel.ranges.slice(0);n[t]=r,pt(e,$(n,e.sel.primIndex),i)}function at(e,t,r,i){pt(e,Q(t,r),i)}function lt(e,t){var r={ranges:t.ranges,update:function(t){this.ranges=[];for(var r=0;r<t.length;r++)this.ranges[r]=new K(J(e,t[r].anchor),J(e,t[r].head))}};return ca(e,"beforeSelectionChange",e,r),e.cm&&ca(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?$(r.ranges,r.ranges.length-1):t}function ut(e,t,r){var i=e.history.done,n=co(i);n&&n.ranges?(i[i.length-1]=t,ct(e,t,r)):pt(e,t,r)}function pt(e,t,r){ct(e,t,r),Wn(e,e.sel,e.cm?e.cm.curOp.id:0/0,r)}function ct(e,t,r){(so(e,"beforeSelectionChange")||e.cm&&so(e.cm,"beforeSelectionChange"))&&(t=lt(e,t));var i=r&&r.bias||(xs(t.primary().head,e.sel.primary().head)<0?-1:1);dt(e,Et(e,t,i,!0)),r&&r.scroll===!1||!e.cm||vi(e.cm)}function dt(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,oo(e.cm)),ro(e,"cursorActivity",e))}function ht(e){dt(e,Et(e,e.sel,null,!1),fa)}function Et(e,t,r,i){for(var n,o=0;o<t.ranges.length;o++){var s=t.ranges[o],a=ft(e,s.anchor,r,i),l=ft(e,s.head,r,i);(n||a!=s.anchor||l!=s.head)&&(n||(n=t.ranges.slice(0,o)),n[o]=new K(a,l))}return n?$(n,t.primIndex):t}function ft(e,t,r,i){var n=!1,o=t,s=r||1;e.cantEdit=!1;e:for(;;){var a=On(e,o.line);if(a.markedSpans)for(var l=0;l<a.markedSpans.length;++l){var u=a.markedSpans[l],p=u.marker;if((null==u.from||(p.inclusiveLeft?u.from<=o.ch:u.from<o.ch))&&(null==u.to||(p.inclusiveRight?u.to>=o.ch:u.to>o.ch))){if(i&&(ca(p,"beforeCursorEnter"),p.explicitlyCleared)){if(a.markedSpans){--l;continue}break}if(!p.atomic)continue;var c=p.find(0>s?-1:1);if(0==xs(c,o)&&(c.ch+=s,c.ch<0?c=c.line>e.first?J(e,vs(c.line-1)):null:c.ch>a.text.length&&(c=c.line<e.first+e.size-1?vs(c.line+1,0):null),!c)){if(n)return i?(e.cantEdit=!0,vs(e.first,0)):ft(e,t,r,!0);n=!0,c=t,s=-s}o=c;continue e}}return o}}function mt(e){for(var t=e.display,r=e.doc,i={},n=i.cursors=document.createDocumentFragment(),o=i.selection=document.createDocumentFragment(),s=0;s<r.sel.ranges.length;s++){var a=r.sel.ranges[s],l=a.empty();(l||e.options.showCursorWhenSelecting)&&xt(e,a,n),l||Nt(e,a,o)}if(e.options.moveInputWithCursor){var u=zt(e,r.sel.primary().head,"div"),p=t.wrapper.getBoundingClientRect(),c=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,u.top+c.top-p.top)),i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,u.left+c.left-p.left))}return i}function gt(e,t){Io(e.display.cursorDiv,t.cursors),Io(e.display.selectionDiv,t.selection),null!=t.teTop&&(e.display.inputDiv.style.top=t.teTop+"px",e.display.inputDiv.style.left=t.teLeft+"px")}function vt(e){gt(e,mt(e))}function xt(e,t,r){var i=zt(e,t.head,"div",null,null,!e.options.singleCursorHeightPerLine),n=r.appendChild(Lo("div"," ","CodeMirror-cursor"));if(n.style.left=i.left+"px",n.style.top=i.top+"px",n.style.height=Math.max(0,i.bottom-i.top)*e.options.cursorHeight+"px",i.other){var o=r.appendChild(Lo("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=i.other.left+"px",o.style.top=i.other.top+"px",o.style.height=.85*(i.other.bottom-i.other.top)+"px"}}function Nt(e,t,r){function i(e,t,r,i){0>t&&(t=0),t=Math.round(t),i=Math.round(i),a.appendChild(Lo("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==r?p-e:r)+"px; height: "+(i-t)+"px"))}function n(t,r,n){function o(r,i){return qt(e,vs(t,r),"div",c,i)}var a,l,c=On(s,t),d=c.text.length;return ko(kn(c),r||0,null==n?d:n,function(e,t,s){var c,h,E,f=o(e,"left");if(e==t)c=f,h=E=f.left;else{if(c=o(t-1,"right"),"rtl"==s){var m=f;f=c,c=m}h=f.left,E=c.right}null==r&&0==e&&(h=u),c.top-f.top>3&&(i(h,f.top,null,f.bottom),h=u,f.bottom<c.top&&i(h,f.bottom,null,c.top)),null==n&&t==d&&(E=p),(!a||f.top<a.top||f.top==a.top&&f.left<a.left)&&(a=f),(!l||c.bottom>l.bottom||c.bottom==l.bottom&&c.right>l.right)&&(l=c),u+1>h&&(h=u),i(h,c.top,E-h,c.bottom)}),{start:a,end:l}}var o=e.display,s=e.doc,a=document.createDocumentFragment(),l=Rt(e.display),u=l.left,p=o.lineSpace.offsetWidth-l.right,c=t.from(),d=t.to();if(c.line==d.line)n(c.line,c.ch,d.ch);else{var h=On(s,c.line),E=On(s,d.line),f=Qi(h)==Qi(E),m=n(c.line,c.ch,f?h.text.length+1:null).end,g=n(d.line,f?0:null,d.ch).start;f&&(m.top<g.top-2?(i(m.right,m.top,null,m.bottom),i(u,g.top,g.left,g.bottom)):i(m.right,m.top,g.left-m.right,m.bottom)),m.bottom<g.top&&i(u,m.bottom,null,g.top)}r.appendChild(a)}function Lt(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Tt(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.viewTo&&e.state.highlight.set(t,go(It,e))}function It(e){var t=e.doc;if(t.frontier<t.first&&(t.frontier=t.first),!(t.frontier>=e.display.viewTo)){var r=+new Date+e.options.workTime,i=Hs(t.mode,At(e,t.frontier)),n=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(t.frontier>=e.display.viewFrom){var s=o.styles,a=hn(e,o,i,!0);o.styles=a.styles;var l=o.styleClasses,u=a.classes;u?o.styleClasses=u:l&&(o.styleClasses=null);for(var p=!s||s.length!=o.styles.length||l!=u&&(!l||!u||l.bgClass!=u.bgClass||l.textClass!=u.textClass),c=0;!p&&c<s.length;++c)p=s[c]!=o.styles[c];p&&n.push(t.frontier),o.stateAfter=Hs(t.mode,i)}else fn(e,o.text,i),o.stateAfter=t.frontier%5==0?Hs(t.mode,i):null;return++t.frontier,+new Date>r?(Tt(e,e.options.workDelay),!0):void 0}),n.length&&lr(e,function(){for(var t=0;t<n.length;t++)fr(e,n[t],"text")})}}function yt(e,t,r){for(var i,n,o=e.doc,s=r?-1:t-(e.doc.mode.innerMode?1e3:100),a=t;a>s;--a){if(a<=o.first)return o.first;var l=On(o,a-1);if(l.stateAfter&&(!r||a<=o.frontier))return a;var u=va(l.text,null,e.options.tabSize);(null==n||i>u)&&(n=a-1,i=u)}return n}function At(e,t,r){var i=e.doc,n=e.display;if(!i.mode.startState)return!0;var o=yt(e,t,r),s=o>i.first&&On(i,o-1).stateAfter;return s=s?Hs(i.mode,s):Fs(i.mode),i.iter(o,t,function(r){fn(e,r.text,s);var a=o==t-1||o%5==0||o>=n.viewFrom&&o<n.viewTo;r.stateAfter=a?Hs(i.mode,s):null,++o}),r&&(i.frontier=o),s}function St(e){return e.lineSpace.offsetTop}function Ct(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Rt(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=Io(e.measure,Lo("pre","x")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,i={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(i.left)||isNaN(i.right)||(e.cachedPaddingH=i),i}function bt(e,t,r){var i=e.options.lineWrapping,n=i&&e.display.scroller.clientWidth;if(!t.measure.heights||i&&t.measure.width!=n){var o=t.measure.heights=[];if(i){t.measure.width=n;for(var s=t.text.firstChild.getClientRects(),a=0;a<s.length-1;a++){var l=s[a],u=s[a+1];Math.abs(l.bottom-u.bottom)>2&&o.push((l.bottom+u.top)/2-r.top)}}o.push(r.bottom-r.top)}}function Ot(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var i=0;i<e.rest.length;i++)if(e.rest[i]==t)return{map:e.measure.maps[i],cache:e.measure.caches[i]};for(var i=0;i<e.rest.length;i++)if(Mn(e.rest[i])>r)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Pt(e,t){t=Qi(t);var r=Mn(t),i=e.display.externalMeasured=new dr(e.doc,t,r);i.lineN=r;var n=i.built=gn(e,i);return i.text=n.pre,Io(e.display.lineMeasure,n.pre),i}function Dt(e,t,r,i){return wt(e,Mt(e,t),r,i)}function _t(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[gr(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function Mt(e,t){var r=Mn(t),i=_t(e,r);i&&!i.text?i=null:i&&i.changes&&_(e,i,r,P(e)),i||(i=Pt(e,t));var n=Ot(i,t,r);return{line:t,view:i,rect:null,map:n.map,cache:n.cache,before:n.before,hasHeights:!1}}function wt(e,t,r,i,n){t.before&&(r=-1);var o,s=r+(i||"");return t.cache.hasOwnProperty(s)?o=t.cache[s]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(bt(e,t.view,t.rect),t.hasHeights=!0),o=Gt(e,t,r,i),o.bogus||(t.cache[s]=o)),{left:o.left,right:o.right,top:n?o.rtop:o.top,bottom:n?o.rbottom:o.bottom}}function Gt(e,t,r,i){for(var n,o,s,a,l=t.map,u=0;u<l.length;u+=3){var p=l[u],c=l[u+1];if(p>r?(o=0,s=1,a="left"):c>r?(o=r-p,s=o+1):(u==l.length-3||r==c&&l[u+3]>r)&&(s=c-p,o=s-1,r>=c&&(a="right")),null!=o){if(n=l[u+2],p==c&&i==(n.insertLeft?"left":"right")&&(a=i),"left"==i&&0==o)for(;u&&l[u-2]==l[u-3]&&l[u-1].insertLeft;)n=l[(u-=3)+2],a="left";if("right"==i&&o==c-p)for(;u<l.length-3&&l[u+3]==l[u+4]&&!l[u+5].insertLeft;)n=l[(u+=3)+2],a="right";break}}var d;if(3==n.nodeType){for(var u=0;4>u;u++){for(;o&&No(t.line.text.charAt(p+o));)--o;for(;c>p+s&&No(t.line.text.charAt(p+s));)++s;if(Jo&&9>es&&0==o&&s==c-p)d=n.parentNode.getBoundingClientRect();else if(Jo&&e.options.lineWrapping){var h=La(n,o,s).getClientRects();d=h.length?h["right"==i?h.length-1:0]:Is}else d=La(n,o,s).getBoundingClientRect()||Is;if(d.left||d.right||0==o)break;s=o,o-=1,a="right"}Jo&&11>es&&(d=kt(e.display.measure,d))}else{o>0&&(a=i="right");var h;d=e.options.lineWrapping&&(h=n.getClientRects()).length>1?h["right"==i?h.length-1:0]:n.getBoundingClientRect()}if(Jo&&9>es&&!o&&(!d||!d.left&&!d.right)){var E=n.parentNode.getClientRects()[0];d=E?{left:E.left,right:E.left+Zt(e.display),top:E.top,bottom:E.bottom}:Is}for(var f=d.top-t.rect.top,m=d.bottom-t.rect.top,g=(f+m)/2,v=t.view.measure.heights,u=0;u<v.length-1&&!(g<v[u]);u++);var x=u?v[u-1]:0,N=v[u],L={left:("right"==a?d.right:d.left)-t.rect.left,right:("left"==a?d.left:d.right)-t.rect.left,top:x,bottom:N};return d.left||d.right||(L.bogus=!0),e.options.singleCursorHeightPerLine||(L.rtop=f,L.rbottom=m),L}function kt(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Go(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*i,bottom:t.bottom*i}}function Bt(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function Ut(e){e.display.externalMeasure=null,To(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Bt(e.display.view[t])}function Vt(e){Ut(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Ht(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Ft(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function jt(e,t,r,i){if(t.widgets)for(var n=0;n<t.widgets.length;++n)if(t.widgets[n].above){var o=on(t.widgets[n]);r.top+=o,r.bottom+=o}if("line"==i)return r;i||(i="local");var s=Gn(t);if("local"==i?s+=St(e.display):s-=e.display.viewOffset,"page"==i||"window"==i){var a=e.display.lineSpace.getBoundingClientRect();s+=a.top+("window"==i?0:Ft());var l=a.left+("window"==i?0:Ht());r.left+=l,r.right+=l}return r.top+=s,r.bottom+=s,r}function Wt(e,t,r){if("div"==r)return t;var i=t.left,n=t.top;if("page"==r)i-=Ht(),n-=Ft();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();i+=o.left,n+=o.top}var s=e.display.lineSpace.getBoundingClientRect();return{left:i-s.left,top:n-s.top}}function qt(e,t,r,i,n){return i||(i=On(e.doc,t.line)),jt(e,i,Dt(e,i,t.ch,n),r)}function zt(e,t,r,i,n,o){function s(t,s){var a=wt(e,n,t,s?"right":"left",o);return s?a.left=a.right:a.right=a.left,jt(e,i,a,r)}function a(e,t){var r=l[t],i=r.level%2;return e==Bo(r)&&t&&r.level<l[t-1].level?(r=l[--t],e=Uo(r)-(r.level%2?0:1),i=!0):e==Uo(r)&&t<l.length-1&&r.level<l[t+1].level&&(r=l[++t],e=Bo(r)-r.level%2,i=!1),i&&e==r.to&&e>r.from?s(e-1):s(e,i)}i=i||On(e.doc,t.line),n||(n=Mt(e,i));var l=kn(i),u=t.ch;if(!l)return s(u);var p=zo(l,u),c=a(u,p);return null!=wa&&(c.other=a(u,wa)),c}function Xt(e,t){var r=0,t=J(e.doc,t);e.options.lineWrapping||(r=Zt(e.display)*t.ch);var i=On(e.doc,t.line),n=Gn(i)+St(e.display);return{left:r,right:r,top:n,bottom:n+i.height}}function Yt(e,t,r,i){var n=vs(e,t);return n.xRel=i,r&&(n.outside=!0),n}function Kt(e,t,r){var i=e.doc;if(r+=e.display.viewOffset,0>r)return Yt(i.first,0,!0,-1);var n=wn(i,r),o=i.first+i.size-1;if(n>o)return Yt(i.first+i.size-1,On(i,o).text.length,!0,1);0>t&&(t=0);for(var s=On(i,n);;){var a=$t(e,s,n,t,r),l=Ki(s),u=l&&l.find(0,!0);if(!l||!(a.ch>u.from.ch||a.ch==u.from.ch&&a.xRel>0))return a;n=Mn(s=u.to.line)}}function $t(e,t,r,i,n){function o(i){var n=zt(e,vs(r,i),"line",t,u);return a=!0,s>n.bottom?n.left-l:s<n.top?n.left+l:(a=!1,n.left)}var s=n-Gn(t),a=!1,l=2*e.display.wrapper.clientWidth,u=Mt(e,t),p=kn(t),c=t.text.length,d=Vo(t),h=Ho(t),E=o(d),f=a,m=o(h),g=a;if(i>m)return Yt(r,h,g,1);for(;;){if(p?h==d||h==Yo(t,d,1):1>=h-d){for(var v=E>i||m-i>=i-E?d:h,x=i-(v==d?E:m);No(t.text.charAt(v));)++v;var N=Yt(r,v,v==d?f:g,-1>x?-1:x>1?1:0);return N}var L=Math.ceil(c/2),T=d+L;if(p){T=d;for(var I=0;L>I;++I)T=Yo(t,T,1)}var y=o(T);y>i?(h=T,m=y,(g=a)&&(m+=1e3),c=L):(d=T,E=y,f=a,c-=L)}}function Qt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Ns){Ns=Lo("pre");for(var t=0;49>t;++t)Ns.appendChild(document.createTextNode("x")),Ns.appendChild(Lo("br"));Ns.appendChild(document.createTextNode("x"))}Io(e.measure,Ns);var r=Ns.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),To(e.measure),r||1}function Zt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=Lo("span","xxxxxxxxxx"),r=Lo("pre",[t]);Io(e.measure,r);var i=t.getBoundingClientRect(),n=(i.right-i.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function Jt(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,id:++As},ys?ys.ops.push(e.curOp):e.curOp.ownsGroup=ys={ops:[e.curOp],delayedCallbacks:[]}}function er(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r]();for(var i=0;i<e.ops.length;i++){var n=e.ops[i];if(n.cursorActivityHandlers)for(;n.cursorActivityCalled<n.cursorActivityHandlers.length;)n.cursorActivityHandlers[n.cursorActivityCalled++](n.cm)}}while(r<t.length)}function tr(e){var t=e.curOp,r=t.ownsGroup;if(r)try{er(r)}finally{ys=null;for(var i=0;i<r.ops.length;i++)r.ops[i].cm.curOp=null;rr(r)}}function rr(e){for(var t=e.ops,r=0;r<t.length;r++)ir(t[r]);for(var r=0;r<t.length;r++)nr(t[r]);for(var r=0;r<t.length;r++)or(t[r]);for(var r=0;r<t.length;r++)sr(t[r]);for(var r=0;r<t.length;r++)ar(t[r])}function ir(e){var t=e.cm,r=t.display;e.updateMaxLine&&h(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new I(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function nr(e){e.updatedDisplay=e.mustUpdate&&y(e.cm,e.update)}function or(e){var t=e.cm,r=t.display;e.updatedDisplay&&b(t),e.barMeasure=m(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Dt(t,r.maxLine,r.maxLine.text.length).left+3,e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo+ha-r.scroller.clientWidth)),(e.updatedDisplay||e.selectionChanged)&&(e.newSelectionNodes=mt(t))}function sr(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Hr(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1),e.newSelectionNodes&>(t,e.newSelectionNodes),e.updatedDisplay&&C(t,e.barMeasure),(e.updatedDisplay||e.startHeight!=t.doc.height)&&g(t,e.barMeasure),e.selectionChanged&&Lt(t),t.state.focused&&e.updateInput&&yr(t,e.typing)}function ar(e){var t=e.cm,r=t.display,i=t.doc;if(null!=e.adjustWidthTo&&Math.abs(e.barMeasure.scrollWidth-t.display.scroller.scrollWidth)>1&&g(t),e.updatedDisplay&&A(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null!=e.scrollTop&&(r.scroller.scrollTop!=e.scrollTop||e.forceScroll)){var n=Math.max(0,Math.min(r.scroller.scrollHeight-r.scroller.clientHeight,e.scrollTop));r.scroller.scrollTop=r.scrollbarV.scrollTop=i.scrollTop=n}if(null!=e.scrollLeft&&(r.scroller.scrollLeft!=e.scrollLeft||e.forceScroll)){var o=Math.max(0,Math.min(r.scroller.scrollWidth-r.scroller.clientWidth,e.scrollLeft));r.scroller.scrollLeft=r.scrollbarH.scrollLeft=i.scrollLeft=o,x(t)}if(e.scrollToPos){var s=Ei(t,J(i,e.scrollToPos.from),J(i,e.scrollToPos.to),e.scrollToPos.margin);e.scrollToPos.isCursor&&t.state.focused&&hi(t,s)}var a=e.maybeHiddenMarkers,l=e.maybeUnhiddenMarkers;if(a)for(var u=0;u<a.length;++u)a[u].lines.length||ca(a[u],"hide");if(l)for(var u=0;u<l.length;++u)l[u].lines.length&&ca(l[u],"unhide");r.wrapper.offsetHeight&&(i.scrollTop=t.display.scroller.scrollTop),e.updatedDisplay&&ts&&(t.options.lineWrapping&&R(t,e.barMeasure),e.barMeasure.scrollWidth>e.barMeasure.clientWidth&&e.barMeasure.scrollWidth<e.barMeasure.clientWidth+1&&!f(t)&&g(t)),e.changeObjs&&ca(t,"changes",t,e.changeObjs)}function lr(e,t){if(e.curOp)return t();Jt(e);try{return t()}finally{tr(e)}}function ur(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Jt(e);try{return t.apply(e,arguments)}finally{tr(e)}}}function pr(e){return function(){if(this.curOp)return e.apply(this,arguments);Jt(this);try{return e.apply(this,arguments)}finally{tr(this)}}}function cr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Jt(t);try{return e.apply(this,arguments)}finally{tr(t)}}}function dr(e,t,r){this.line=t,this.rest=Zi(t),this.size=this.rest?Mn(co(this.rest))-r+1:1,this.node=this.text=null,this.hidden=tn(e,t)}function hr(e,t,r){for(var i,n=[],o=t;r>o;o=i){var s=new dr(e.doc,On(e.doc,o),o);i=o+s.size,n.push(s)}return n}function Er(e,t,r,i){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),i||(i=0);var n=e.display;if(i&&r<n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>t)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)gs&&Ji(e.doc,t)<n.viewTo&&mr(e);else if(r<=n.viewFrom)gs&&en(e.doc,r+i)>n.viewFrom?mr(e):(n.viewFrom+=i,n.viewTo+=i);else if(t<=n.viewFrom&&r>=n.viewTo)mr(e);else if(t<=n.viewFrom){var o=vr(e,r,r+i,1);o?(n.view=n.view.slice(o.index),n.viewFrom=o.lineN,n.viewTo+=i):mr(e)}else if(r>=n.viewTo){var o=vr(e,t,t,-1);o?(n.view=n.view.slice(0,o.index),n.viewTo=o.lineN):mr(e)}else{var s=vr(e,t,t,-1),a=vr(e,r,r+i,1);s&&a?(n.view=n.view.slice(0,s.index).concat(hr(e,s.lineN,a.lineN)).concat(n.view.slice(a.index)),n.viewTo+=i):mr(e)}var l=n.externalMeasured;l&&(r<l.lineN?l.lineN+=i:t<l.lineN+l.size&&(n.externalMeasured=null))}function fr(e,t,r){e.curOp.viewChanged=!0;var i=e.display,n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size&&(i.externalMeasured=null),!(t<i.viewFrom||t>=i.viewTo)){var o=i.view[gr(e,t)];if(null!=o.node){var s=o.changes||(o.changes=[]);-1==ho(s,r)&&s.push(r)}}}function mr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function gr(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,0>t)return null;for(var r=e.display.view,i=0;i<r.length;i++)if(t-=r[i].size,0>t)return i}function vr(e,t,r,i){var n,o=gr(e,t),s=e.display.view;if(!gs||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var a=0,l=e.display.viewFrom;o>a;a++)l+=s[a].size;if(l!=t){if(i>0){if(o==s.length-1)return null;n=l+s[o].size-t,o++}else n=l-t;t+=n,r+=n}for(;Ji(e.doc,r)!=r;){if(o==(0>i?0:s.length-1))return null;r+=i*s[o-(0>i?1:0)].size,o+=i}return{index:o,lineN:r}}function xr(e,t,r){var i=e.display,n=i.view;0==n.length||t>=i.viewTo||r<=i.viewFrom?(i.view=hr(e,t,r),i.viewFrom=t):(i.viewFrom>t?i.view=hr(e,t,i.viewFrom).concat(i.view):i.viewFrom<t&&(i.view=i.view.slice(gr(e,t))),i.viewFrom=t,i.viewTo<r?i.view=i.view.concat(hr(e,i.viewTo,r)):i.viewTo>r&&(i.view=i.view.slice(0,gr(e,r)))),i.viewTo=r}function Nr(e){for(var t=e.display.view,r=0,i=0;i<t.length;i++){var n=t[i];n.hidden||n.node&&!n.changes||++r}return r}function Lr(e){e.display.pollingFast||e.display.poll.set(e.options.pollInterval,function(){Ir(e),e.state.focused&&Lr(e)})}function Tr(e){function t(){var i=Ir(e);i||r?(e.display.pollingFast=!1,Lr(e)):(r=!0,e.display.poll.set(60,t))}var r=!1;e.display.pollingFast=!0,e.display.poll.set(20,t)}function Ir(e){var t=e.display.input,r=e.display.prevInput,i=e.doc;if(!e.state.focused||Pa(t)&&!r||Cr(e)||e.options.disableInput)return!1;e.state.pasteIncoming&&e.state.fakedLastChar&&(t.value=t.value.substring(0,t.value.length-1),e.state.fakedLastChar=!1);var n=t.value;if(n==r&&!e.somethingSelected())return!1;if(Jo&&es>=9&&e.display.inputHasSelection===n||cs&&/[\uf700-\uf7ff]/.test(n))return yr(e),!1;var o=!e.curOp;o&&Jt(e),e.display.shift=!1,8203!=n.charCodeAt(0)||i.sel!=e.display.selForContextMenu||r||(r="");for(var s=0,a=Math.min(r.length,n.length);a>s&&r.charCodeAt(s)==n.charCodeAt(s);)++s;var l=n.slice(s),u=Oa(l),p=null;e.state.pasteIncoming&&i.sel.ranges.length>1&&(Ss&&Ss.join("\n")==l?p=i.sel.ranges.length%Ss.length==0&&Eo(Ss,Oa):u.length==i.sel.ranges.length&&(p=Eo(u,function(e){return[e]})));for(var c=i.sel.ranges.length-1;c>=0;c--){var d=i.sel.ranges[c],h=d.from(),E=d.to();s<r.length?h=vs(h.line,h.ch-(r.length-s)):e.state.overwrite&&d.empty()&&!e.state.pasteIncoming&&(E=vs(E.line,Math.min(On(i,E.line).text.length,E.ch+co(u).length)));var f=e.curOp.updateInput,m={from:h,to:E,text:p?p[c%p.length]:u,origin:e.state.pasteIncoming?"paste":e.state.cutIncoming?"cut":"+input"};if(si(e.doc,m),ro(e,"inputRead",e,m),l&&!e.state.pasteIncoming&&e.options.electricChars&&e.options.smartIndent&&d.head.ch<100&&(!c||i.sel.ranges[c-1].head.line!=d.head.line)){var g=e.getModeAt(d.head),v=Ds(m);if(g.electricChars){for(var x=0;x<g.electricChars.length;x++)if(l.indexOf(g.electricChars.charAt(x))>-1){Ni(e,v.line,"smart");break}}else g.electricInput&&g.electricInput.test(On(i,v.line).text.slice(0,v.ch))&&Ni(e,v.line,"smart")}}return vi(e),e.curOp.updateInput=f,e.curOp.typing=!0,n.length>1e3||n.indexOf("\n")>-1?t.value=e.display.prevInput="":e.display.prevInput=n,o&&tr(e),e.state.pasteIncoming=e.state.cutIncoming=!1,!0}function yr(e,t){var r,i,n=e.doc;if(e.somethingSelected()){e.display.prevInput="";var o=n.sel.primary();r=Da&&(o.to().line-o.from().line>100||(i=e.getSelection()).length>1e3);var s=r?"-":i||e.getSelection();e.display.input.value=s,e.state.focused&&Na(e.display.input),Jo&&es>=9&&(e.display.inputHasSelection=s)}else t||(e.display.prevInput=e.display.input.value="",Jo&&es>=9&&(e.display.inputHasSelection=null));e.display.inaccurateSelection=r}function Ar(e){"nocursor"==e.options.readOnly||ps&&Ao()==e.display.input||e.display.input.focus()}function Sr(e){e.state.focused||(Ar(e),Qr(e))}function Cr(e){return e.options.readOnly||e.doc.cantEdit}function Rr(e){function t(){e.state.focused&&setTimeout(go(Ar,e),0)}function r(t){no(e,t)||la(t)}function i(t){if(e.somethingSelected())Ss=e.getSelections(),n.inaccurateSelection&&(n.prevInput="",n.inaccurateSelection=!1,n.input.value=Ss.join("\n"),Na(n.input));else{for(var r=[],i=[],o=0;o<e.doc.sel.ranges.length;o++){var s=e.doc.sel.ranges[o].head.line,a={anchor:vs(s,0),head:vs(s+1,0)};i.push(a),r.push(e.getRange(a.anchor,a.head))}"cut"==t.type?e.setSelections(i,null,fa):(n.prevInput="",n.input.value=r.join("\n"),Na(n.input)),Ss=r}"cut"==t.type&&(e.state.cutIncoming=!0)}var n=e.display;ua(n.scroller,"mousedown",ur(e,Dr)),Jo&&11>es?ua(n.scroller,"dblclick",ur(e,function(t){if(!no(e,t)){var r=Pr(e,t);if(r&&!kr(e,t)&&!Or(e.display,t)){sa(t);var i=e.findWordAt(r);nt(e.doc,i.anchor,i.head)}}})):ua(n.scroller,"dblclick",function(t){no(e,t)||sa(t)}),ua(n.lineSpace,"selectstart",function(e){Or(n,e)||sa(e)}),fs||ua(n.scroller,"contextmenu",function(t){Jr(e,t)}),ua(n.scroller,"scroll",function(){n.scroller.clientHeight&&(Vr(e,n.scroller.scrollTop),Hr(e,n.scroller.scrollLeft,!0),ca(e,"scroll",e))}),ua(n.scrollbarV,"scroll",function(){n.scroller.clientHeight&&Vr(e,n.scrollbarV.scrollTop)}),ua(n.scrollbarH,"scroll",function(){n.scroller.clientHeight&&Hr(e,n.scrollbarH.scrollLeft)}),ua(n.scroller,"mousewheel",function(t){Fr(e,t)}),ua(n.scroller,"DOMMouseScroll",function(t){Fr(e,t)}),ua(n.scrollbarH,"mousedown",t),ua(n.scrollbarV,"mousedown",t),ua(n.wrapper,"scroll",function(){n.wrapper.scrollTop=n.wrapper.scrollLeft=0}),ua(n.input,"keyup",function(t){Kr.call(e,t)}),ua(n.input,"input",function(){Jo&&es>=9&&e.display.inputHasSelection&&(e.display.inputHasSelection=null),Tr(e)}),ua(n.input,"keydown",ur(e,Xr)),ua(n.input,"keypress",ur(e,$r)),ua(n.input,"focus",go(Qr,e)),ua(n.input,"blur",go(Zr,e)),e.options.dragDrop&&(ua(n.scroller,"dragstart",function(t){Ur(e,t)}),ua(n.scroller,"dragenter",r),ua(n.scroller,"dragover",r),ua(n.scroller,"drop",ur(e,Br))),ua(n.scroller,"paste",function(t){Or(n,t)||(e.state.pasteIncoming=!0,Ar(e),Tr(e))}),ua(n.input,"paste",function(){if(ts&&!e.state.fakedLastChar&&!(new Date-e.state.lastMiddleDown<200)){var t=n.input.selectionStart,r=n.input.selectionEnd;n.input.value+="$",n.input.selectionEnd=r,n.input.selectionStart=t,e.state.fakedLastChar=!0}e.state.pasteIncoming=!0,Tr(e)}),ua(n.input,"cut",i),ua(n.input,"copy",i),ss&&ua(n.sizer,"mouseup",function(){Ao()==n.input&&n.input.blur(),Ar(e)})}function br(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,e.setSize()}function Or(e,t){for(var r=eo(t);r!=e.wrapper;r=r.parentNode)if(!r||r.ignoreEvents||r.parentNode==e.sizer&&r!=e.mover)return!0}function Pr(e,t,r,i){var n=e.display;if(!r){var o=eo(t);if(o==n.scrollbarH||o==n.scrollbarV||o==n.scrollbarFiller||o==n.gutterFiller)return null}var s,a,l=n.lineSpace.getBoundingClientRect();try{s=t.clientX-l.left,a=t.clientY-l.top}catch(t){return null}var u,p=Kt(e,s,a);if(i&&1==p.xRel&&(u=On(e.doc,p.line).text).length==p.ch){var c=va(u,u.length,e.options.tabSize)-u.length;p=vs(p.line,Math.max(0,Math.round((s-Rt(e.display).left)/Zt(e.display))-c))}return p}function Dr(e){if(!no(this,e)){var t=this,r=t.display;if(r.shift=e.shiftKey,Or(r,e))return void(ts||(r.scroller.draggable=!1,setTimeout(function(){r.scroller.draggable=!0},100)));if(!kr(t,e)){var i=Pr(t,e);switch(window.focus(),to(e)){case 1:i?_r(t,e,i):eo(e)==r.scroller&&sa(e);break;case 2:ts&&(t.state.lastMiddleDown=+new Date),i&&nt(t.doc,i),setTimeout(go(Ar,t),20),sa(e);break;case 3:fs&&Jr(t,e)}}}}function _r(e,t,r){setTimeout(go(Sr,e),0);var i,n=+new Date;Ts&&Ts.time>n-400&&0==xs(Ts.pos,r)?i="triple":Ls&&Ls.time>n-400&&0==xs(Ls.pos,r)?(i="double",Ts={time:n,pos:r}):(i="single",Ls={time:n,pos:r});var o=e.doc.sel,s=cs?t.metaKey:t.ctrlKey;e.options.dragDrop&&ba&&!Cr(e)&&"single"==i&&o.contains(r)>-1&&o.somethingSelected()?Mr(e,t,r,s):wr(e,t,r,i,s)}function Mr(e,t,r,i){var n=e.display,o=ur(e,function(s){ts&&(n.scroller.draggable=!1),e.state.draggingText=!1,pa(document,"mouseup",o),pa(n.scroller,"drop",o),Math.abs(t.clientX-s.clientX)+Math.abs(t.clientY-s.clientY)<10&&(sa(s),i||nt(e.doc,r),Ar(e),Jo&&9==es&&setTimeout(function(){document.body.focus(),Ar(e)},20))});ts&&(n.scroller.draggable=!0),e.state.draggingText=o,n.scroller.dragDrop&&n.scroller.dragDrop(),ua(document,"mouseup",o),ua(n.scroller,"drop",o)}function wr(e,t,r,i,n){function o(t){if(0!=xs(f,t))if(f=t,"rect"==i){for(var n=[],o=e.options.tabSize,s=va(On(u,r.line).text,r.ch,o),a=va(On(u,t.line).text,t.ch,o),l=Math.min(s,a),h=Math.max(s,a),E=Math.min(r.line,t.line),m=Math.min(e.lastLine(),Math.max(r.line,t.line));m>=E;E++){var g=On(u,E).text,v=uo(g,l,o);l==h?n.push(new K(vs(E,v),vs(E,v))):g.length>v&&n.push(new K(vs(E,v),vs(E,uo(g,h,o))))}n.length||n.push(new K(r,r)),pt(u,$(d.ranges.slice(0,c).concat(n),c),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var x=p,N=x.anchor,L=t;if("single"!=i){if("double"==i)var T=e.findWordAt(t);else var T=new K(vs(t.line,0),J(u,vs(t.line+1,0)));xs(T.anchor,N)>0?(L=T.head,N=X(x.from(),T.anchor)):(L=T.anchor,N=z(x.to(),T.head))}var n=d.ranges.slice(0);n[c]=new K(J(u,N),L),pt(u,$(n,c),ma)}}function s(t){var r=++g,n=Pr(e,t,!0,"rect"==i);if(n)if(0!=xs(n,f)){Sr(e),o(n);var a=v(l,u);(n.line>=a.to||n.line<a.from)&&setTimeout(ur(e,function(){g==r&&s(t)}),150)}else{var p=t.clientY<m.top?-20:t.clientY>m.bottom?20:0;p&&setTimeout(ur(e,function(){g==r&&(l.scroller.scrollTop+=p,s(t))}),50)}}function a(t){g=1/0,sa(t),Ar(e),pa(document,"mousemove",x),pa(document,"mouseup",N),u.history.lastSelOrigin=null}var l=e.display,u=e.doc;sa(t);var p,c,d=u.sel;if(n&&!t.shiftKey?(c=u.sel.contains(r),p=c>-1?u.sel.ranges[c]:new K(r,r)):p=u.sel.primary(),t.altKey)i="rect",n||(p=new K(r,r)),r=Pr(e,t,!0,!0),c=-1;else if("double"==i){var h=e.findWordAt(r);p=e.display.shift||u.extend?it(u,p,h.anchor,h.head):h}else if("triple"==i){var E=new K(vs(r.line,0),J(u,vs(r.line+1,0)));p=e.display.shift||u.extend?it(u,p,E.anchor,E.head):E}else p=it(u,p,r);n?c>-1?st(u,c,p,ma):(c=u.sel.ranges.length,pt(u,$(u.sel.ranges.concat([p]),c),{scroll:!1,origin:"*mouse"})):(c=0,pt(u,new Y([p],0),ma),d=u.sel);var f=r,m=l.wrapper.getBoundingClientRect(),g=0,x=ur(e,function(e){to(e)?s(e):a(e)}),N=ur(e,a);ua(document,"mousemove",x),ua(document,"mouseup",N)}function Gr(e,t,r,i,n){try{var o=t.clientX,s=t.clientY}catch(t){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&sa(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(s>l.bottom||!so(e,r))return Jn(t);
s-=l.top-a.viewOffset;for(var u=0;u<e.options.gutters.length;++u){var p=a.gutters.childNodes[u];if(p&&p.getBoundingClientRect().right>=o){var c=wn(e.doc,s),d=e.options.gutters[u];return n(e,r,e,c,d,t),Jn(t)}}}function kr(e,t){return Gr(e,t,"gutterClick",!0,ro)}function Br(e){var t=this;if(!no(t,e)&&!Or(t.display,e)){sa(e),Jo&&(Cs=+new Date);var r=Pr(t,e,!0),i=e.dataTransfer.files;if(r&&!Cr(t))if(i&&i.length&&window.FileReader&&window.File)for(var n=i.length,o=Array(n),s=0,a=function(e,i){var a=new FileReader;a.onload=ur(t,function(){if(o[i]=a.result,++s==n){r=J(t.doc,r);var e={from:r,to:r,text:Oa(o.join("\n")),origin:"paste"};si(t.doc,e),ut(t.doc,Q(r,Ds(e)))}}),a.readAsText(e)},l=0;n>l;++l)a(i[l],l);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout(go(Ar,t),20);try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&!(cs?e.metaKey:e.ctrlKey))var u=t.listSelections();if(ct(t.doc,Q(r,r)),u)for(var l=0;l<u.length;++l)di(t.doc,"",u[l].anchor,u[l].head,"drag");t.replaceSelection(o,"around","paste"),Ar(t)}}catch(e){}}}}function Ur(e,t){if(Jo&&(!e.state.draggingText||+new Date-Cs<100))return void la(t);if(!no(e,t)&&!Or(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.setDragImage&&!os)){var r=Lo("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",ns&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),ns&&r.parentNode.removeChild(r)}}function Vr(e,t){Math.abs(e.doc.scrollTop-t)<2||(e.doc.scrollTop=t,$o||S(e,{top:t}),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t),e.display.scrollbarV.scrollTop!=t&&(e.display.scrollbarV.scrollTop=t),$o&&S(e),Tt(e,100))}function Hr(e,t,r){(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)||(t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),e.doc.scrollLeft=t,x(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbarH.scrollLeft!=t&&(e.display.scrollbarH.scrollLeft=t))}function Fr(e,t){var r=t.wheelDeltaX,i=t.wheelDeltaY;null==r&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(r=t.detail),null==i&&t.detail&&t.axis==t.VERTICAL_AXIS?i=t.detail:null==i&&(i=t.wheelDelta);var n=e.display,o=n.scroller;if(r&&o.scrollWidth>o.clientWidth||i&&o.scrollHeight>o.clientHeight){if(i&&cs&&ts)e:for(var s=t.target,a=n.view;s!=o;s=s.parentNode)for(var l=0;l<a.length;l++)if(a[l].node==s){e.display.currentWheelTarget=s;break e}if(r&&!$o&&!ns&&null!=bs)return i&&Vr(e,Math.max(0,Math.min(o.scrollTop+i*bs,o.scrollHeight-o.clientHeight))),Hr(e,Math.max(0,Math.min(o.scrollLeft+r*bs,o.scrollWidth-o.clientWidth))),sa(t),void(n.wheelStartX=null);if(i&&null!=bs){var u=i*bs,p=e.doc.scrollTop,c=p+n.wrapper.clientHeight;0>u?p=Math.max(0,p+u-50):c=Math.min(e.doc.height,c+u+50),S(e,{top:p,bottom:c})}20>Rs&&(null==n.wheelStartX?(n.wheelStartX=o.scrollLeft,n.wheelStartY=o.scrollTop,n.wheelDX=r,n.wheelDY=i,setTimeout(function(){if(null!=n.wheelStartX){var e=o.scrollLeft-n.wheelStartX,t=o.scrollTop-n.wheelStartY,r=t&&n.wheelDY&&t/n.wheelDY||e&&n.wheelDX&&e/n.wheelDX;n.wheelStartX=n.wheelStartY=null,r&&(bs=(bs*Rs+r)/(Rs+1),++Rs)}},200)):(n.wheelDX+=r,n.wheelDY+=i))}}function jr(e,t,r){if("string"==typeof t&&(t=js[t],!t))return!1;e.display.pollingFast&&Ir(e)&&(e.display.pollingFast=!1);var i=e.display.shift,n=!1;try{Cr(e)&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),n=t(e)!=Ea}finally{e.display.shift=i,e.state.suppressEdits=!1}return n}function Wr(e){var t=e.state.keyMaps.slice(0);return e.options.extraKeys&&t.push(e.options.extraKeys),t.push(e.options.keyMap),t}function qr(e,t){var r=Si(e.options.keyMap),i=r.auto;clearTimeout(Os),i&&!zs(t)&&(Os=setTimeout(function(){Si(e.options.keyMap)==r&&(e.options.keyMap=i.call?i.call(null,e):i,a(e))},50));var n=Xs(t,!0),o=!1;if(!n)return!1;var s=Wr(e);return o=t.shiftKey?qs("Shift-"+n,s,function(t){return jr(e,t,!0)})||qs(n,s,function(t){return("string"==typeof t?/^go[A-Z]/.test(t):t.motion)?jr(e,t):void 0}):qs(n,s,function(t){return jr(e,t)}),o&&(sa(t),Lt(e),ro(e,"keyHandled",e,n,t)),o}function zr(e,t,r){var i=qs("'"+r+"'",Wr(e),function(t){return jr(e,t,!0)});return i&&(sa(t),Lt(e),ro(e,"keyHandled",e,"'"+r+"'",t)),i}function Xr(e){var t=this;if(Sr(t),!no(t,e)){Jo&&11>es&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var i=qr(t,e);ns&&(Ps=i?r:null,!i&&88==r&&!Da&&(cs?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||Yr(t)}}function Yr(e){function t(e){18!=e.keyCode&&e.altKey||(Co(r,"CodeMirror-crosshair"),pa(document,"keyup",t),pa(document,"mouseover",t))}var r=e.display.lineDiv;Ro(r,"CodeMirror-crosshair"),ua(document,"keyup",t),ua(document,"mouseover",t)}function Kr(e){16==e.keyCode&&(this.doc.sel.shift=!1),no(this,e)}function $r(e){var t=this;if(!(no(t,e)||e.ctrlKey&&!e.altKey||cs&&e.metaKey)){var r=e.keyCode,i=e.charCode;if(ns&&r==Ps)return Ps=null,void sa(e);if(!(ns&&(!e.which||e.which<10)||ss)||!qr(t,e)){var n=String.fromCharCode(null==i?r:i);zr(t,e,n)||(Jo&&es>=9&&(t.display.inputHasSelection=null),Tr(t))}}}function Qr(e){"nocursor"!=e.options.readOnly&&(e.state.focused||(ca(e,"focus",e),e.state.focused=!0,Ro(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(yr(e),ts&&setTimeout(go(yr,e,!0),0))),Lr(e),Lt(e))}function Zr(e){e.state.focused&&(ca(e,"blur",e),e.state.focused=!1,Co(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Jr(e,t){function r(){if(null!=n.input.selectionStart){var t=e.somethingSelected(),r=n.input.value=""+(t?n.input.value:"");n.prevInput=t?"":"",n.input.selectionStart=1,n.input.selectionEnd=r.length,n.selForContextMenu=e.doc.sel}}function i(){if(n.inputDiv.style.position="relative",n.input.style.cssText=l,Jo&&9>es&&(n.scrollbarV.scrollTop=n.scroller.scrollTop=s),Lr(e),null!=n.input.selectionStart){(!Jo||Jo&&9>es)&&r();var t=0,i=function(){n.selForContextMenu==e.doc.sel&&0==n.input.selectionStart?ur(e,js.selectAll)(e):t++<10?n.detectingSelectAll=setTimeout(i,500):yr(e)};n.detectingSelectAll=setTimeout(i,200)}}if(!no(e,t,"contextmenu")){var n=e.display;if(!Or(n,t)&&!ei(e,t)){var o=Pr(e,t),s=n.scroller.scrollTop;if(o&&!ns){var a=e.options.resetSelectionOnContextMenu;a&&-1==e.doc.sel.contains(o)&&ur(e,pt)(e.doc,Q(o),fa);var l=n.input.style.cssText;if(n.inputDiv.style.position="absolute",n.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(t.clientY-5)+"px; left: "+(t.clientX-5)+"px; z-index: 1000; background: "+(Jo?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",ts)var u=window.scrollY;if(Ar(e),ts&&window.scrollTo(null,u),yr(e),e.somethingSelected()||(n.input.value=n.prevInput=" "),n.selForContextMenu=e.doc.sel,clearTimeout(n.detectingSelectAll),Jo&&es>=9&&r(),fs){la(t);var p=function(){pa(window,"mouseup",p),setTimeout(i,20)};ua(window,"mouseup",p)}else setTimeout(i,50)}}}}function ei(e,t){return so(e,"gutterContextMenu")?Gr(e,t,"gutterContextMenu",!1,ca):!1}function ti(e,t){if(xs(e,t.from)<0)return e;if(xs(e,t.to)<=0)return Ds(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=Ds(t).ch-t.to.ch),vs(r,i)}function ri(e,t){for(var r=[],i=0;i<e.sel.ranges.length;i++){var n=e.sel.ranges[i];r.push(new K(ti(n.anchor,t),ti(n.head,t)))}return $(r,e.sel.primIndex)}function ii(e,t,r){return e.line==t.line?vs(r.line,e.ch-t.ch+r.ch):vs(r.line+(e.line-t.line),e.ch)}function ni(e,t,r){for(var i=[],n=vs(e.first,0),o=n,s=0;s<t.length;s++){var a=t[s],l=ii(a.from,n,o),u=ii(Ds(a),n,o);if(n=a.to,o=u,"around"==r){var p=e.sel.ranges[s],c=xs(p.head,p.anchor)<0;i[s]=new K(c?u:l,c?l:u)}else i[s]=new K(l,l)}return new Y(i,e.sel.primIndex)}function oi(e,t,r){var i={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){this.canceled=!0}};return r&&(i.update=function(t,r,i,n){t&&(this.from=J(e,t)),r&&(this.to=J(e,r)),i&&(this.text=i),void 0!==n&&(this.origin=n)}),ca(e,"beforeChange",e,i),e.cm&&ca(e.cm,"beforeChange",e.cm,i),i.canceled?null:{from:i.from,to:i.to,text:i.text,origin:i.origin}}function si(e,t,r){if(e.cm){if(!e.cm.curOp)return ur(e.cm,si)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(so(e,"beforeChange")||e.cm&&so(e.cm,"beforeChange"))||(t=oi(e,t,!0))){var i=ms&&!r&&Hi(e,t.from,t.to);if(i)for(var n=i.length-1;n>=0;--n)ai(e,{from:i[n].from,to:i[n].to,text:n?[""]:t.text});else ai(e,t)}}function ai(e,t){if(1!=t.text.length||""!=t.text[0]||0!=xs(t.from,t.to)){var r=ri(e,t);Fn(e,t,r,e.cm?e.cm.curOp.id:0/0),pi(e,t,r,Bi(e,t));var i=[];Rn(e,function(e,r){r||-1!=ho(i,e.history)||(Zn(e.history,t),i.push(e.history)),pi(e,t,null,Bi(e,t))})}}function li(e,t,r){if(!e.cm||!e.cm.state.suppressEdits){for(var i,n=e.history,o=e.sel,s="undo"==t?n.done:n.undone,a="undo"==t?n.undone:n.done,l=0;l<s.length&&(i=s[l],r?!i.ranges||i.equals(e.sel):i.ranges);l++);if(l!=s.length){for(n.lastOrigin=n.lastSelOrigin=null;i=s.pop(),i.ranges;){if(qn(i,a),r&&!i.equals(e.sel))return void pt(e,i,{clearRedo:!1});o=i}var u=[];qn(o,a),a.push({changes:u,generation:n.generation}),n.generation=i.generation||++n.maxGeneration;for(var p=so(e,"beforeChange")||e.cm&&so(e.cm,"beforeChange"),l=i.changes.length-1;l>=0;--l){var c=i.changes[l];if(c.origin=t,p&&!oi(e,c,!1))return void(s.length=0);u.push(Un(e,c));var d=l?ri(e,c):co(s);pi(e,c,d,Vi(e,c)),!l&&e.cm&&e.cm.scrollIntoView({from:c.from,to:Ds(c)});var h=[];Rn(e,function(e,t){t||-1!=ho(h,e.history)||(Zn(e.history,c),h.push(e.history)),pi(e,c,null,Vi(e,c))})}}}}function ui(e,t){if(0!=t&&(e.first+=t,e.sel=new Y(Eo(e.sel.ranges,function(e){return new K(vs(e.anchor.line+t,e.anchor.ch),vs(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Er(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,i=r.viewFrom;i<r.viewTo;i++)fr(e.cm,i,"gutter")}}function pi(e,t,r,i){if(e.cm&&!e.cm.curOp)return ur(e.cm,pi)(e,t,r,i);if(t.to.line<e.first)return void ui(e,t.text.length-1-(t.to.line-t.from.line));if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var n=t.text.length-1-(e.first-t.from.line);ui(e,n),t={from:vs(e.first,0),to:vs(t.to.line+n,t.to.ch),text:[co(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:vs(o,On(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Pn(e,t.from,t.to),r||(r=ri(e,t)),e.cm?ci(e.cm,t,i):An(e,t,i),ct(e,r,fa)}}function ci(e,t,r){var i=e.doc,n=e.display,s=t.from,a=t.to,l=!1,u=s.line;e.options.lineWrapping||(u=Mn(Qi(On(i,s.line))),i.iter(u,a.line+1,function(e){return e==n.maxLine?(l=!0,!0):void 0})),i.sel.contains(t.from,t.to)>-1&&oo(e),An(i,t,r,o(e)),e.options.lineWrapping||(i.iter(u,s.line+t.text.length,function(e){var t=d(e);t>n.maxLineLength&&(n.maxLine=e,n.maxLineLength=t,n.maxLineChanged=!0,l=!1)}),l&&(e.curOp.updateMaxLine=!0)),i.frontier=Math.min(i.frontier,s.line),Tt(e,400);var p=t.text.length-(a.line-s.line)-1;s.line!=a.line||1!=t.text.length||yn(e.doc,t)?Er(e,s.line,a.line+1,p):fr(e,s.line,"text");var c=so(e,"changes"),h=so(e,"change");if(h||c){var E={from:s,to:a,text:t.text,removed:t.removed,origin:t.origin};h&&ro(e,"change",e,E),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(E)}e.display.selForContextMenu=null}function di(e,t,r,i,n){if(i||(i=r),xs(i,r)<0){var o=i;i=r,r=o}"string"==typeof t&&(t=Oa(t)),si(e,{from:r,to:i,text:t,origin:n})}function hi(e,t){var r=e.display,i=r.sizer.getBoundingClientRect(),n=null;if(t.top+i.top<0?n=!0:t.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight)&&(n=!1),null!=n&&!ls){var o=Lo("div","",null,"position: absolute; top: "+(t.top-r.viewOffset-St(e.display))+"px; height: "+(t.bottom-t.top+ha)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(n),e.display.lineSpace.removeChild(o)}}function Ei(e,t,r,i){null==i&&(i=0);for(var n=0;5>n;n++){var o=!1,s=zt(e,t),a=r&&r!=t?zt(e,r):s,l=mi(e,Math.min(s.left,a.left),Math.min(s.top,a.top)-i,Math.max(s.left,a.left),Math.max(s.bottom,a.bottom)+i),u=e.doc.scrollTop,p=e.doc.scrollLeft;if(null!=l.scrollTop&&(Vr(e,l.scrollTop),Math.abs(e.doc.scrollTop-u)>1&&(o=!0)),null!=l.scrollLeft&&(Hr(e,l.scrollLeft),Math.abs(e.doc.scrollLeft-p)>1&&(o=!0)),!o)return s}}function fi(e,t,r,i,n){var o=mi(e,t,r,i,n);null!=o.scrollTop&&Vr(e,o.scrollTop),null!=o.scrollLeft&&Hr(e,o.scrollLeft)}function mi(e,t,r,i,n){var o=e.display,s=Qt(e.display);0>r&&(r=0);var a=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,l=o.scroller.clientHeight-ha,u={};n-r>l&&(n=r+l);var p=e.doc.height+Ct(o),c=s>r,d=n>p-s;if(a>r)u.scrollTop=c?0:r;else if(n>a+l){var h=Math.min(r,(d?p:n)-l);h!=a&&(u.scrollTop=h)}var E=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,f=o.scroller.clientWidth-ha-o.gutters.offsetWidth,m=i-t>f;return m&&(i=t+f),10>t?u.scrollLeft=0:E>t?u.scrollLeft=Math.max(0,t-(m?0:10)):i>f+E-3&&(u.scrollLeft=i+(m?0:10)-f),u}function gi(e,t,r){(null!=t||null!=r)&&xi(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=r&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+r)}function vi(e){xi(e);var t=e.getCursor(),r=t,i=t;e.options.lineWrapping||(r=t.ch?vs(t.line,t.ch-1):t,i=vs(t.line,t.ch+1)),e.curOp.scrollToPos={from:r,to:i,margin:e.options.cursorScrollMargin,isCursor:!0}}function xi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=Xt(e,t.from),i=Xt(e,t.to),n=mi(e,Math.min(r.left,i.left),Math.min(r.top,i.top)-t.margin,Math.max(r.right,i.right),Math.max(r.bottom,i.bottom)+t.margin);e.scrollTo(n.scrollLeft,n.scrollTop)}}function Ni(e,t,r,i){var n,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?n=At(e,t):r="prev");var s=e.options.tabSize,a=On(o,t),l=va(a.text,null,s);a.stateAfter&&(a.stateAfter=null);var u,p=a.text.match(/^\s*/)[0];if(i||/\S/.test(a.text)){if("smart"==r&&(u=o.mode.indent(n,a.text.slice(p.length),a.text),u==Ea||u>150)){if(!i)return;r="prev"}}else u=0,r="not";"prev"==r?u=t>o.first?va(On(o,t-1).text,null,s):0:"add"==r?u=l+e.options.indentUnit:"subtract"==r?u=l-e.options.indentUnit:"number"==typeof r&&(u=l+r),u=Math.max(0,u);var c="",d=0;if(e.options.indentWithTabs)for(var h=Math.floor(u/s);h;--h)d+=s,c+=" ";if(u>d&&(c+=po(u-d)),c!=p)di(o,c,vs(t,0),vs(t,p.length),"+input");else for(var h=0;h<o.sel.ranges.length;h++){var E=o.sel.ranges[h];if(E.head.line==t&&E.head.ch<p.length){var d=vs(t,p.length);st(o,h,new K(d,d));break}}a.stateAfter=null}function Li(e,t,r,i){var n=t,o=t;return"number"==typeof t?o=On(e,Z(e,t)):n=Mn(t),null==n?null:(i(o,n)&&e.cm&&fr(e.cm,n,r),o)}function Ti(e,t){for(var r=e.doc.sel.ranges,i=[],n=0;n<r.length;n++){for(var o=t(r[n]);i.length&&xs(o.from,co(i).to)<=0;){var s=i.pop();if(xs(s.from,o.from)<0){o.from=s.from;break}}i.push(o)}lr(e,function(){for(var t=i.length-1;t>=0;t--)di(e.doc,"",i[t].from,i[t].to,"+delete");vi(e)})}function Ii(e,t,r,i,n){function o(){var t=a+r;return t<e.first||t>=e.first+e.size?c=!1:(a=t,p=On(e,t))}function s(e){var t=(n?Yo:Ko)(p,l,r,!0);if(null==t){if(e||!o())return c=!1;l=n?(0>r?Ho:Vo)(p):0>r?p.text.length:0}else l=t;return!0}var a=t.line,l=t.ch,u=r,p=On(e,a),c=!0;if("char"==i)s();else if("column"==i)s(!0);else if("word"==i||"group"==i)for(var d=null,h="group"==i,E=e.cm&&e.cm.getHelper(t,"wordChars"),f=!0;!(0>r)||s(!f);f=!1){var m=p.text.charAt(l)||"\n",g=vo(m,E)?"w":h&&"\n"==m?"n":!h||/\s/.test(m)?null:"p";if(!h||f||g||(g="s"),d&&d!=g){0>r&&(r=1,s());break}if(g&&(d=g),r>0&&!s(!f))break}var v=ft(e,vs(a,l),u,!0);return c||(v.hitSide=!0),v}function yi(e,t,r,i){var n,o=e.doc,s=t.left;if("page"==i){var a=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);n=t.top+r*(a-(0>r?1.5:.5)*Qt(e.display))}else"line"==i&&(n=r>0?t.bottom+3:t.top-3);for(;;){var l=Kt(e,s,n);if(!l.outside)break;if(0>r?0>=n:n>=o.height){l.hitSide=!0;break}n+=5*r}return l}function Ai(t,r,i,n){e.defaults[t]=r,i&&(Ms[t]=n?function(e,t,r){r!=ws&&i(e,t,r)}:i)}function Si(e){return"string"==typeof e?Ws[e]:e}function Ci(e,t,r,i,n){if(i&&i.shared)return Ri(e,t,r,i,n);if(e.cm&&!e.cm.curOp)return ur(e.cm,Ci)(e,t,r,i,n);var o=new Ks(e,n),s=xs(t,r);if(i&&mo(i,o,!1),s>0||0==s&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=Lo("span",[o.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||(o.widgetNode.ignoreEvents=!0),i.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if($i(e,t.line,t,r,o)||t.line!=r.line&&$i(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");gs=!0}o.addToHistory&&Fn(e,{from:t,to:r,origin:"markText"},e.sel,0/0);var a,l=t.line,u=e.cm;if(e.iter(l,r.line+1,function(e){u&&o.collapsed&&!u.options.lineWrapping&&Qi(e)==u.display.maxLine&&(a=!0),o.collapsed&&l!=t.line&&_n(e,0),wi(e,new Di(o,l==t.line?t.ch:null,l==r.line?r.ch:null)),++l}),o.collapsed&&e.iter(t.line,r.line+1,function(t){tn(e,t)&&_n(t,0)}),o.clearOnEnter&&ua(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(ms=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++$s,o.atomic=!0),u){if(a&&(u.curOp.updateMaxLine=!0),o.collapsed)Er(u,t.line,r.line+1);else if(o.className||o.title||o.startStyle||o.endStyle)for(var p=t.line;p<=r.line;p++)fr(u,p,"text");o.atomic&&ht(u.doc),ro(u,"markerAdded",u,o)}return o}function Ri(e,t,r,i,n){i=mo(i),i.shared=!1;var o=[Ci(e,t,r,i,n)],s=o[0],a=i.widgetNode;return Rn(e,function(e){a&&(i.widgetNode=a.cloneNode(!0)),o.push(Ci(e,J(e,t),J(e,r),i,n));for(var l=0;l<e.linked.length;++l)if(e.linked[l].isParent)return;s=co(o)}),new Qs(o,s)}function bi(e){return e.findMarks(vs(e.first,0),e.clipPos(vs(e.lastLine())),function(e){return e.parent})}function Oi(e,t){for(var r=0;r<t.length;r++){var i=t[r],n=i.find(),o=e.clipPos(n.from),s=e.clipPos(n.to);if(xs(o,s)){var a=Ci(e,o,s,i.primary,i.primary.type);i.markers.push(a),a.parent=i}}}function Pi(e){for(var t=0;t<e.length;t++){var r=e[t],i=[r.primary.doc];Rn(r.primary.doc,function(e){i.push(e)});for(var n=0;n<r.markers.length;n++){var o=r.markers[n];-1==ho(i,o.doc)&&(o.parent=null,r.markers.splice(n--,1))}}}function Di(e,t,r){this.marker=e,this.from=t,this.to=r}function _i(e,t){if(e)for(var r=0;r<e.length;++r){var i=e[r];if(i.marker==t)return i}}function Mi(e,t){for(var r,i=0;i<e.length;++i)e[i]!=t&&(r||(r=[])).push(e[i]);return r}function wi(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Gi(e,t,r){if(e)for(var i,n=0;n<e.length;++n){var o=e[n],s=o.marker,a=null==o.from||(s.inclusiveLeft?o.from<=t:o.from<t);if(a||o.from==t&&"bookmark"==s.type&&(!r||!o.marker.insertLeft)){var l=null==o.to||(s.inclusiveRight?o.to>=t:o.to>t);(i||(i=[])).push(new Di(s,o.from,l?null:o.to))}}return i}function ki(e,t,r){if(e)for(var i,n=0;n<e.length;++n){var o=e[n],s=o.marker,a=null==o.to||(s.inclusiveRight?o.to>=t:o.to>t);if(a||o.from==t&&"bookmark"==s.type&&(!r||o.marker.insertLeft)){var l=null==o.from||(s.inclusiveLeft?o.from<=t:o.from<t);(i||(i=[])).push(new Di(s,l?null:o.from-t,null==o.to?null:o.to-t))}}return i}function Bi(e,t){var r=tt(e,t.from.line)&&On(e,t.from.line).markedSpans,i=tt(e,t.to.line)&&On(e,t.to.line).markedSpans;if(!r&&!i)return null;var n=t.from.ch,o=t.to.ch,s=0==xs(t.from,t.to),a=Gi(r,n,s),l=ki(i,o,s),u=1==t.text.length,p=co(t.text).length+(u?n:0);if(a)for(var c=0;c<a.length;++c){var d=a[c];if(null==d.to){var h=_i(l,d.marker);h?u&&(d.to=null==h.to?null:h.to+p):d.to=n}}if(l)for(var c=0;c<l.length;++c){var d=l[c];if(null!=d.to&&(d.to+=p),null==d.from){var h=_i(a,d.marker);h||(d.from=p,u&&(a||(a=[])).push(d))}else d.from+=p,u&&(a||(a=[])).push(d)}a&&(a=Ui(a)),l&&l!=a&&(l=Ui(l));var E=[a];if(!u){var f,m=t.text.length-2;if(m>0&&a)for(var c=0;c<a.length;++c)null==a[c].to&&(f||(f=[])).push(new Di(a[c].marker,null,null));for(var c=0;m>c;++c)E.push(f);E.push(l)}return E}function Ui(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&r.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Vi(e,t){var r=Yn(e,t),i=Bi(e,t);if(!r)return i;if(!i)return r;for(var n=0;n<r.length;++n){var o=r[n],s=i[n];if(o&&s)e:for(var a=0;a<s.length;++a){for(var l=s[a],u=0;u<o.length;++u)if(o[u].marker==l.marker)continue e;o.push(l)}else s&&(r[n]=s)}return r}function Hi(e,t,r){var i=null;if(e.iter(t.line,r.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||i&&-1!=ho(i,r)||(i||(i=[])).push(r)}}),!i)return null;for(var n=[{from:t,to:r}],o=0;o<i.length;++o)for(var s=i[o],a=s.find(0),l=0;l<n.length;++l){var u=n[l];if(!(xs(u.to,a.from)<0||xs(u.from,a.to)>0)){var p=[l,1],c=xs(u.from,a.from),d=xs(u.to,a.to);(0>c||!s.inclusiveLeft&&!c)&&p.push({from:u.from,to:a.from}),(d>0||!s.inclusiveRight&&!d)&&p.push({from:a.to,to:u.to}),n.splice.apply(n,p),l+=p.length-1}}return n}function Fi(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function ji(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function Wi(e){return e.inclusiveLeft?-1:0}function qi(e){return e.inclusiveRight?1:0}function zi(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var i=e.find(),n=t.find(),o=xs(i.from,n.from)||Wi(e)-Wi(t);if(o)return-o;var s=xs(i.to,n.to)||qi(e)-qi(t);return s?s:t.id-e.id}function Xi(e,t){var r,i=gs&&e.markedSpans;if(i)for(var n,o=0;o<i.length;++o)n=i[o],n.marker.collapsed&&null==(t?n.from:n.to)&&(!r||zi(r,n.marker)<0)&&(r=n.marker);return r}function Yi(e){return Xi(e,!0)}function Ki(e){return Xi(e,!1)}function $i(e,t,r,i,n){var o=On(e,t),s=gs&&o.markedSpans;if(s)for(var a=0;a<s.length;++a){var l=s[a];if(l.marker.collapsed){var u=l.marker.find(0),p=xs(u.from,r)||Wi(l.marker)-Wi(n),c=xs(u.to,i)||qi(l.marker)-qi(n);if(!(p>=0&&0>=c||0>=p&&c>=0)&&(0>=p&&(xs(u.to,r)>0||l.marker.inclusiveRight&&n.inclusiveLeft)||p>=0&&(xs(u.from,i)<0||l.marker.inclusiveLeft&&n.inclusiveRight)))return!0}}}function Qi(e){for(var t;t=Yi(e);)e=t.find(-1,!0).line;return e}function Zi(e){for(var t,r;t=Ki(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function Ji(e,t){var r=On(e,t),i=Qi(r);return r==i?t:Mn(i)}function en(e,t){if(t>e.lastLine())return t;var r,i=On(e,t);if(!tn(e,i))return t;for(;r=Ki(i);)i=r.find(1,!0).line;return Mn(i)+1}function tn(e,t){var r=gs&&t.markedSpans;if(r)for(var i,n=0;n<r.length;++n)if(i=r[n],i.marker.collapsed){if(null==i.from)return!0;if(!i.marker.widgetNode&&0==i.from&&i.marker.inclusiveLeft&&rn(e,t,i))return!0}}function rn(e,t,r){if(null==r.to){var i=r.marker.find(1,!0);return rn(e,i.line,_i(i.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var n,o=0;o<t.markedSpans.length;++o)if(n=t.markedSpans[o],n.marker.collapsed&&!n.marker.widgetNode&&n.from==r.to&&(null==n.to||n.to!=r.from)&&(n.marker.inclusiveLeft||r.marker.inclusiveRight)&&rn(e,t,n))return!0}function nn(e,t,r){Gn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&gi(e,null,r)}function on(e){if(null!=e.height)return e.height;if(!yo(document.body,e.node)){var t="position: relative;";e.coverGutter&&(t+="margin-left: -"+e.cm.getGutterElement().offsetWidth+"px;"),Io(e.cm.display.measure,Lo("div",[e.node],null,t))}return e.height=e.node.offsetHeight}function sn(e,t,r,i){var n=new Zs(e,r,i);return n.noHScroll&&(e.display.alignWidgets=!0),Li(e.doc,t,"widget",function(t){var r=t.widgets||(t.widgets=[]);if(null==n.insertAt?r.push(n):r.splice(Math.min(r.length-1,Math.max(0,n.insertAt)),0,n),n.line=t,!tn(e.doc,t)){var i=Gn(t)<e.doc.scrollTop;_n(t,t.height+on(n)),i&&gi(e,null,n.height),e.curOp.forceUpdate=!0}return!0}),n}function an(e,t,r,i){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Fi(e),ji(e,r);var n=i?i(e):1;n!=e.height&&_n(e,n)}function ln(e){e.parent=null,Fi(e)}function un(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var i=r[1]?"bgClass":"textClass";null==t[i]?t[i]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[i])||(t[i]+=" "+r[2])}return e}function pn(t,r){if(t.blankLine)return t.blankLine(r);if(t.innerMode){var i=e.innerMode(t,r);return i.mode.blankLine?i.mode.blankLine(i.state):void 0}}function cn(e,t,r){for(var i=0;10>i;i++){var n=e.token(t,r);if(t.pos>t.start)return n}throw new Error("Mode "+e.name+" failed to advance stream.")}function dn(t,r,i,n,o,s,a){var l=i.flattenSpans;null==l&&(l=t.options.flattenSpans);var u,p=0,c=null,d=new Ys(r,t.options.tabSize);for(""==r&&un(pn(i,n),s);!d.eol();){if(d.pos>t.options.maxHighlightLength?(l=!1,a&&fn(t,r,n,d.pos),d.pos=r.length,u=null):u=un(cn(i,d,n),s),t.options.addModeClass){var h=e.innerMode(i,n).mode.name;h&&(u="m-"+(u?h+" "+u:h))}l&&c==u||(p<d.start&&o(d.start,c),p=d.start,c=u),d.start=d.pos}for(;p<d.pos;){var E=Math.min(d.pos,p+5e4);o(E,c),p=E}}function hn(e,t,r,i){var n=[e.state.modeGen],o={};dn(e,t.text,e.doc.mode,r,function(e,t){n.push(e,t)},o,i);for(var s=0;s<e.state.overlays.length;++s){var a=e.state.overlays[s],l=1,u=0;dn(e,t.text,a.mode,!0,function(e,t){for(var r=l;e>u;){var i=n[l];i>e&&n.splice(l,1,e,n[l+1],i),l+=2,u=Math.min(e,i)}if(t)if(a.opaque)n.splice(r,l-r,e,"cm-overlay "+t),l=r+2;else for(;l>r;r+=2){var o=n[r+1];n[r+1]=(o?o+" ":"")+"cm-overlay "+t}},o)}return{styles:n,classes:o.bgClass||o.textClass?o:null}}function En(e,t){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=hn(e,t,t.stateAfter=At(e,Mn(t)));t.styles=r.styles,r.classes?t.styleClasses=r.classes:t.styleClasses&&(t.styleClasses=null)}return t.styles}function fn(e,t,r,i){var n=e.doc.mode,o=new Ys(t,e.options.tabSize);for(o.start=o.pos=i||0,""==t&&pn(n,r);!o.eol()&&o.pos<=e.options.maxHighlightLength;)cn(n,o,r),o.start=o.pos}function mn(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?ta:ea;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function gn(e,t){var r=Lo("span",null,null,ts?"padding-right: .1px":null),i={pre:Lo("pre",[r]),content:r,col:0,pos:0,cm:e};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var o,s=n?t.rest[n-1]:t.line;i.pos=0,i.addToken=xn,(Jo||ts)&&e.getOption("lineWrapping")&&(i.addToken=Nn(i.addToken)),wo(e.display.measure)&&(o=kn(s))&&(i.addToken=Ln(i.addToken,o)),i.map=[],In(s,i,En(e,s)),s.styleClasses&&(s.styleClasses.bgClass&&(i.bgClass=bo(s.styleClasses.bgClass,i.bgClass||"")),s.styleClasses.textClass&&(i.textClass=bo(s.styleClasses.textClass,i.textClass||""))),0==i.map.length&&i.map.push(0,0,i.content.appendChild(Mo(e.display.measure))),0==n?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return ca(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=bo(i.pre.className,i.textClass||"")),i}function vn(e){var t=Lo("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t}function xn(e,t,r,i,n,o){if(t){var s=e.cm.options.specialChars,a=!1;if(s.test(t))for(var l=document.createDocumentFragment(),u=0;;){s.lastIndex=u;var p=s.exec(t),c=p?p.index-u:t.length-u;if(c){var d=document.createTextNode(t.slice(u,u+c));l.appendChild(Jo&&9>es?Lo("span",[d]):d),e.map.push(e.pos,e.pos+c,d),e.col+=c,e.pos+=c}if(!p)break;if(u+=c+1," "==p[0]){var h=e.cm.options.tabSize,E=h-e.col%h,d=l.appendChild(Lo("span",po(E),"cm-tab"));e.col+=E}else{var d=e.cm.options.specialCharPlaceholder(p[0]);l.appendChild(Jo&&9>es?Lo("span",[d]):d),e.col+=1}e.map.push(e.pos,e.pos+1,d),e.pos++}else{e.col+=t.length;var l=document.createTextNode(t);e.map.push(e.pos,e.pos+t.length,l),Jo&&9>es&&(a=!0),e.pos+=t.length}if(r||i||n||a){var f=r||"";i&&(f+=i),n&&(f+=n);var m=Lo("span",[l],f);return o&&(m.title=o),e.content.appendChild(m)}e.content.appendChild(l)}}function Nn(e){function t(e){for(var t=" ",r=0;r<e.length-2;++r)t+=r%2?" ":" ";return t+=" "}return function(r,i,n,o,s,a){e(r,i.replace(/ {3,}/g,t),n,o,s,a)}}function Ln(e,t){return function(r,i,n,o,s,a){n=n?n+" cm-force-border":"cm-force-border";for(var l=r.pos,u=l+i.length;;){for(var p=0;p<t.length;p++){var c=t[p];if(c.to>l&&c.from<=l)break}if(c.to>=u)return e(r,i,n,o,s,a);e(r,i.slice(0,c.to-l),n,o,null,a),o=null,i=i.slice(c.to-l),l=c.to}}}function Tn(e,t,r,i){var n=!i&&r.widgetNode;n&&(e.map.push(e.pos,e.pos+t,n),e.content.appendChild(n)),e.pos+=t}function In(e,t,r){var i=e.markedSpans,n=e.text,o=0;if(i)for(var s,a,l,u,p,c,d=n.length,h=0,E=1,f="",m=0;;){if(m==h){a=l=u=p="",c=null,m=1/0;for(var g=[],v=0;v<i.length;++v){var x=i[v],N=x.marker;x.from<=h&&(null==x.to||x.to>h)?(null!=x.to&&m>x.to&&(m=x.to,l=""),N.className&&(a+=" "+N.className),N.startStyle&&x.from==h&&(u+=" "+N.startStyle),N.endStyle&&x.to==m&&(l+=" "+N.endStyle),N.title&&!p&&(p=N.title),N.collapsed&&(!c||zi(c.marker,N)<0)&&(c=x)):x.from>h&&m>x.from&&(m=x.from),"bookmark"==N.type&&x.from==h&&N.widgetNode&&g.push(N)}if(c&&(c.from||0)==h&&(Tn(t,(null==c.to?d+1:c.to)-h,c.marker,null==c.from),null==c.to))return;if(!c&&g.length)for(var v=0;v<g.length;++v)Tn(t,0,g[v])}if(h>=d)break;for(var L=Math.min(d,m);;){if(f){var T=h+f.length;if(!c){var I=T>L?f.slice(0,L-h):f;t.addToken(t,I,s?s+a:a,u,h+I.length==m?l:"",p)}if(T>=L){f=f.slice(L-h),h=L;break}h=T,u=""}f=n.slice(o,o=r[E++]),s=mn(r[E++],t.cm.options)}}else for(var E=1;E<r.length;E+=2)t.addToken(t,n.slice(o,o=r[E]),mn(r[E+1],t.cm.options))}function yn(e,t){return 0==t.from.ch&&0==t.to.ch&&""==co(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function An(e,t,r,i){function n(e){return r?r[e]:null}function o(e,r,n){an(e,r,n,i),ro(e,"change",e,t)}var s=t.from,a=t.to,l=t.text,u=On(e,s.line),p=On(e,a.line),c=co(l),d=n(l.length-1),h=a.line-s.line;if(yn(e,t)){for(var E=0,f=[];E<l.length-1;++E)f.push(new Js(l[E],n(E),i));o(p,p.text,d),h&&e.remove(s.line,h),f.length&&e.insert(s.line,f)}else if(u==p)if(1==l.length)o(u,u.text.slice(0,s.ch)+c+u.text.slice(a.ch),d);else{for(var f=[],E=1;E<l.length-1;++E)f.push(new Js(l[E],n(E),i));f.push(new Js(c+u.text.slice(a.ch),d,i)),o(u,u.text.slice(0,s.ch)+l[0],n(0)),e.insert(s.line+1,f)}else if(1==l.length)o(u,u.text.slice(0,s.ch)+l[0]+p.text.slice(a.ch),n(0)),e.remove(s.line+1,h);else{o(u,u.text.slice(0,s.ch)+l[0],n(0)),o(p,c+p.text.slice(a.ch),d);for(var E=1,f=[];E<l.length-1;++E)f.push(new Js(l[E],n(E),i));h>1&&e.remove(s.line+1,h-1),e.insert(s.line+1,f)}ro(e,"change",e,t)}function Sn(e){this.lines=e,this.parent=null;for(var t=0,r=0;t<e.length;++t)e[t].parent=this,r+=e[t].height;this.height=r}function Cn(e){this.children=e;for(var t=0,r=0,i=0;i<e.length;++i){var n=e[i];t+=n.chunkSize(),r+=n.height,n.parent=this}this.size=t,this.height=r,this.parent=null}function Rn(e,t,r){function i(e,n,o){if(e.linked)for(var s=0;s<e.linked.length;++s){var a=e.linked[s];if(a.doc!=n){var l=o&&a.sharedHist;(!r||l)&&(t(a.doc,l),i(a.doc,e,l))}}}i(e,null,!0)}function bn(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,s(e),r(e),e.options.lineWrapping||h(e),e.options.mode=t.modeOption,Er(e)}function On(e,t){if(t-=e.first,0>t||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var i=0;;++i){var n=r.children[i],o=n.chunkSize();if(o>t){r=n;break}t-=o}return r.lines[t]}function Pn(e,t,r){var i=[],n=t.line;return e.iter(t.line,r.line+1,function(e){var o=e.text;n==r.line&&(o=o.slice(0,r.ch)),n==t.line&&(o=o.slice(t.ch)),i.push(o),++n}),i}function Dn(e,t,r){var i=[];return e.iter(t,r,function(e){i.push(e.text)}),i}function _n(e,t){var r=t-e.height;if(r)for(var i=e;i;i=i.parent)i.height+=r}function Mn(e){if(null==e.parent)return null;for(var t=e.parent,r=ho(t.lines,e),i=t.parent;i;t=i,i=i.parent)for(var n=0;i.children[n]!=t;++n)r+=i.children[n].chunkSize();return r+t.first}function wn(e,t){var r=e.first;e:do{for(var i=0;i<e.children.length;++i){var n=e.children[i],o=n.height;
if(o>t){e=n;continue e}t-=o,r+=n.chunkSize()}return r}while(!e.lines);for(var i=0;i<e.lines.length;++i){var s=e.lines[i],a=s.height;if(a>t)break;t-=a}return r+i}function Gn(e){e=Qi(e);for(var t=0,r=e.parent,i=0;i<r.lines.length;++i){var n=r.lines[i];if(n==e)break;t+=n.height}for(var o=r.parent;o;r=o,o=r.parent)for(var i=0;i<o.children.length;++i){var s=o.children[i];if(s==r)break;t+=s.height}return t}function kn(e){var t=e.order;return null==t&&(t=e.order=Ga(e.text)),t}function Bn(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Un(e,t){var r={from:q(t.from),to:Ds(t),text:Pn(e,t.from,t.to)};return zn(e,r,t.from.line,t.to.line+1),Rn(e,function(e){zn(e,r,t.from.line,t.to.line+1)},!0),r}function Vn(e){for(;e.length;){var t=co(e);if(!t.ranges)break;e.pop()}}function Hn(e,t){return t?(Vn(e.done),co(e.done)):e.done.length&&!co(e.done).ranges?co(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),co(e.done)):void 0}function Fn(e,t,r,i){var n=e.history;n.undone.length=0;var o,s=+new Date;if((n.lastOp==i||n.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&n.lastModTime>s-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=Hn(n,n.lastOp==i))){var a=co(o.changes);0==xs(t.from,t.to)&&0==xs(t.from,a.to)?a.to=Ds(t):o.changes.push(Un(e,t))}else{var l=co(n.done);for(l&&l.ranges||qn(e.sel,n.done),o={changes:[Un(e,t)],generation:n.generation},n.done.push(o);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(r),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=s,n.lastOp=n.lastSelOp=i,n.lastOrigin=n.lastSelOrigin=t.origin,a||ca(e,"historyAdded")}function jn(e,t,r,i){var n=t.charAt(0);return"*"==n||"+"==n&&r.ranges.length==i.ranges.length&&r.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function Wn(e,t,r,i){var n=e.history,o=i&&i.origin;r==n.lastSelOp||o&&n.lastSelOrigin==o&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==o||jn(e,o,co(n.done),t))?n.done[n.done.length-1]=t:qn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=o,n.lastSelOp=r,i&&i.clearRedo!==!1&&Vn(n.undone)}function qn(e,t){var r=co(t);r&&r.ranges&&r.equals(e)||t.push(e)}function zn(e,t,r,i){var n=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,i),function(r){r.markedSpans&&((n||(n=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function Xn(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function Yn(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var i=0,n=[];i<t.text.length;++i)n.push(Xn(r[i]));return n}function Kn(e,t,r){for(var i=0,n=[];i<e.length;++i){var o=e[i];if(o.ranges)n.push(r?Y.prototype.deepCopy.call(o):o);else{var s=o.changes,a=[];n.push({changes:a});for(var l=0;l<s.length;++l){var u,p=s[l];if(a.push({from:p.from,to:p.to,text:p.text}),t)for(var c in p)(u=c.match(/^spans_(\d+)$/))&&ho(t,Number(u[1]))>-1&&(co(a)[c]=p[c],delete p[c])}}}return n}function $n(e,t,r,i){r<e.line?e.line+=i:t<e.line&&(e.line=t,e.ch=0)}function Qn(e,t,r,i){for(var n=0;n<e.length;++n){var o=e[n],s=!0;if(o.ranges){o.copied||(o=e[n]=o.deepCopy(),o.copied=!0);for(var a=0;a<o.ranges.length;a++)$n(o.ranges[a].anchor,t,r,i),$n(o.ranges[a].head,t,r,i)}else{for(var a=0;a<o.changes.length;++a){var l=o.changes[a];if(r<l.from.line)l.from=vs(l.from.line+i,l.from.ch),l.to=vs(l.to.line+i,l.to.ch);else if(t<=l.to.line){s=!1;break}}s||(e.splice(0,n+1),n=0)}}}function Zn(e,t){var r=t.from.line,i=t.to.line,n=t.text.length-(i-r)-1;Qn(e.done,r,i,n),Qn(e.undone,r,i,n)}function Jn(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function eo(e){return e.target||e.srcElement}function to(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),cs&&e.ctrlKey&&1==t&&(t=3),t}function ro(e,t){function r(e){return function(){e.apply(null,o)}}var i=e._handlers&&e._handlers[t];if(i){var n,o=Array.prototype.slice.call(arguments,2);ys?n=ys.delayedCallbacks:da?n=da:(n=da=[],setTimeout(io,0));for(var s=0;s<i.length;++s)n.push(r(i[s]))}}function io(){var e=da;da=null;for(var t=0;t<e.length;++t)e[t]()}function no(e,t,r){return ca(e,r||t.type,e,t),Jn(t)||t.codemirrorIgnore}function oo(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),i=0;i<t.length;++i)-1==ho(r,t[i])&&r.push(t[i])}function so(e,t){var r=e._handlers&&e._handlers[t];return r&&r.length>0}function ao(e){e.prototype.on=function(e,t){ua(this,e,t)},e.prototype.off=function(e,t){pa(this,e,t)}}function lo(){this.id=null}function uo(e,t,r){for(var i=0,n=0;;){var o=e.indexOf(" ",i);-1==o&&(o=e.length);var s=o-i;if(o==e.length||n+s>=t)return i+Math.min(s,t-n);if(n+=o-i,n+=r-n%r,i=o+1,n>=t)return i}}function po(e){for(;xa.length<=e;)xa.push(co(xa)+" ");return xa[e]}function co(e){return e[e.length-1]}function ho(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}function Eo(e,t){for(var r=[],i=0;i<e.length;i++)r[i]=t(e[i],i);return r}function fo(e,t){var r;if(Object.create)r=Object.create(e);else{var i=function(){};i.prototype=e,r=new i}return t&&mo(t,r),r}function mo(e,t,r){t||(t={});for(var i in e)!e.hasOwnProperty(i)||r===!1&&t.hasOwnProperty(i)||(t[i]=e[i]);return t}function go(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function vo(e,t){return t?t.source.indexOf("\\w")>-1&&Ia(e)?!0:t.test(e):Ia(e)}function xo(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function No(e){return e.charCodeAt(0)>=768&&ya.test(e)}function Lo(e,t,r,i){var n=document.createElement(e);if(r&&(n.className=r),i&&(n.style.cssText=i),"string"==typeof t)n.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)n.appendChild(t[o]);return n}function To(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Io(e,t){return To(e).appendChild(t)}function yo(e,t){if(e.contains)return e.contains(t);for(;t=t.parentNode;)if(t==e)return!0}function Ao(){return document.activeElement}function So(e){return new RegExp("\\b"+e+"\\b\\s*")}function Co(e,t){var r=So(t);r.test(e.className)&&(e.className=e.className.replace(r,""))}function Ro(e,t){So(t).test(e.className)||(e.className+=" "+t)}function bo(e,t){for(var r=e.split(" "),i=0;i<r.length;i++)r[i]&&!So(r[i]).test(t)&&(t+=" "+r[i]);return t}function Oo(e){if(document.body.getElementsByClassName)for(var t=document.body.getElementsByClassName("CodeMirror"),r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&e(i)}}function Po(){Ra||(Do(),Ra=!0)}function Do(){var e;ua(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,Aa=null,Oo(br)},100))}),ua(window,"blur",function(){Oo(Zr)})}function _o(e){if(null!=Aa)return Aa;var t=Lo("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return Io(e,t),t.offsetWidth&&(Aa=t.offsetHeight-t.clientHeight),Aa||0}function Mo(e){if(null==Sa){var t=Lo("span","");Io(e,Lo("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Sa=t.offsetWidth<=1&&t.offsetHeight>2&&!(Jo&&8>es))}return Sa?Lo("span",""):Lo("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function wo(e){if(null!=Ca)return Ca;var t=Io(e,document.createTextNode("AخA")),r=La(t,0,1).getBoundingClientRect();if(!r||r.left==r.right)return!1;var i=La(t,1,2).getBoundingClientRect();return Ca=i.right-r.right<3}function Go(e){if(null!=_a)return _a;var t=Io(e,Lo("span","x")),r=t.getBoundingClientRect(),i=La(t,0,1).getBoundingClientRect();return _a=Math.abs(r.left-i.left)>1}function ko(e,t,r,i){if(!e)return i(t,r,"ltr");for(var n=!1,o=0;o<e.length;++o){var s=e[o];(s.from<r&&s.to>t||t==r&&s.to==t)&&(i(Math.max(s.from,t),Math.min(s.to,r),1==s.level?"rtl":"ltr"),n=!0)}n||i(t,r,"ltr")}function Bo(e){return e.level%2?e.to:e.from}function Uo(e){return e.level%2?e.from:e.to}function Vo(e){var t=kn(e);return t?Bo(t[0]):0}function Ho(e){var t=kn(e);return t?Uo(co(t)):e.text.length}function Fo(e,t){var r=On(e.doc,t),i=Qi(r);i!=r&&(t=Mn(i));var n=kn(i),o=n?n[0].level%2?Ho(i):Vo(i):0;return vs(t,o)}function jo(e,t){for(var r,i=On(e.doc,t);r=Ki(i);)i=r.find(1,!0).line,t=null;var n=kn(i),o=n?n[0].level%2?Vo(i):Ho(i):i.text.length;return vs(null==t?Mn(i):t,o)}function Wo(e,t){var r=Fo(e,t.line),i=On(e.doc,r.line),n=kn(i);if(!n||0==n[0].level){var o=Math.max(0,i.text.search(/\S/)),s=t.line==r.line&&t.ch<=o&&t.ch;return vs(r.line,s?0:o)}return r}function qo(e,t,r){var i=e[0].level;return t==i?!0:r==i?!1:r>t}function zo(e,t){wa=null;for(var r,i=0;i<e.length;++i){var n=e[i];if(n.from<t&&n.to>t)return i;if(n.from==t||n.to==t){if(null!=r)return qo(e,n.level,e[r].level)?(n.from!=n.to&&(wa=r),i):(n.from!=n.to&&(wa=i),r);r=i}}return r}function Xo(e,t,r,i){if(!i)return t+r;do t+=r;while(t>0&&No(e.text.charAt(t)));return t}function Yo(e,t,r,i){var n=kn(e);if(!n)return Ko(e,t,r,i);for(var o=zo(n,t),s=n[o],a=Xo(e,t,s.level%2?-r:r,i);;){if(a>s.from&&a<s.to)return a;if(a==s.from||a==s.to)return zo(n,a)==o?a:(s=n[o+=r],r>0==s.level%2?s.to:s.from);if(s=n[o+=r],!s)return null;a=r>0==s.level%2?Xo(e,s.to,-1,i):Xo(e,s.from,1,i)}}function Ko(e,t,r,i){var n=t+r;if(i)for(;n>0&&No(e.text.charAt(n));)n+=r;return 0>n||n>e.text.length?null:n}var $o=/gecko\/\d/i.test(navigator.userAgent),Qo=/MSIE \d/.test(navigator.userAgent),Zo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Jo=Qo||Zo,es=Jo&&(Qo?document.documentMode||6:Zo[1]),ts=/WebKit\//.test(navigator.userAgent),rs=ts&&/Qt\/\d+\.\d+/.test(navigator.userAgent),is=/Chrome\//.test(navigator.userAgent),ns=/Opera\//.test(navigator.userAgent),os=/Apple Computer/.test(navigator.vendor),ss=/KHTML\//.test(navigator.userAgent),as=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),ls=/PhantomJS/.test(navigator.userAgent),us=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),ps=us||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),cs=us||/Mac/.test(navigator.platform),ds=/win/i.test(navigator.platform),hs=ns&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);hs&&(hs=Number(hs[1])),hs&&hs>=15&&(ns=!1,ts=!0);var Es=cs&&(rs||ns&&(null==hs||12.11>hs)),fs=$o||Jo&&es>=9,ms=!1,gs=!1,vs=e.Pos=function(e,t){return this instanceof vs?(this.line=e,void(this.ch=t)):new vs(e,t)},xs=e.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch};Y.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var r=this.ranges[t],i=e.ranges[t];if(0!=xs(r.anchor,i.anchor)||0!=xs(r.head,i.head))return!1}return!0},deepCopy:function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new K(q(this.ranges[t].anchor),q(this.ranges[t].head));return new Y(e,this.primIndex)},somethingSelected:function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},contains:function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var i=this.ranges[r];if(xs(t,i.from())>=0&&xs(e,i.to())<=0)return r}return-1}},K.prototype={from:function(){return X(this.anchor,this.head)},to:function(){return z(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Ns,Ls,Ts,Is={left:0,right:0,top:0,bottom:0},ys=null,As=0,Ss=null,Cs=0,Rs=0,bs=null;Jo?bs=-.53:$o?bs=15:is?bs=-.7:os&&(bs=-1/3);var Os,Ps=null,Ds=e.changeEnd=function(e){return e.text?vs(e.from.line+e.text.length-1,co(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.prototype={constructor:e,focus:function(){window.focus(),Ar(this),Tr(this)},setOption:function(e,t){var r=this.options,i=r[e];(r[e]!=t||"mode"==e)&&(r[e]=t,Ms.hasOwnProperty(e)&&ur(this,Ms[e])(this,t,i))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](e)},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||"string"!=typeof t[r]&&t[r].name==e)return t.splice(r,1),!0},addOverlay:pr(function(t,r){var i=t.token?t:e.getMode(this.options,t);if(i.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:i,modeSpec:t,opaque:r&&r.opaque}),this.state.modeGen++,Er(this)}),removeOverlay:pr(function(e){for(var t=this.state.overlays,r=0;r<t.length;++r){var i=t[r].modeSpec;if(i==e||"string"==typeof e&&i.name==e)return t.splice(r,1),this.state.modeGen++,void Er(this)}}),indentLine:pr(function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),tt(this.doc,e)&&Ni(this,e,t,r)}),indentSelection:pr(function(e){for(var t=this.doc.sel.ranges,r=-1,i=0;i<t.length;i++){var n=t[i];if(n.empty())n.head.line>r&&(Ni(this,n.head.line,e,!0),r=n.head.line,i==this.doc.sel.primIndex&&vi(this));else{var o=n.from(),s=n.to(),a=Math.max(r,o.line);r=Math.min(this.lastLine(),s.line-(s.ch?0:1))+1;for(var l=a;r>l;++l)Ni(this,l,e);var u=this.doc.sel.ranges;0==o.ch&&t.length==u.length&&u[i].from().ch>0&&st(this.doc,i,new K(o,u[i].to()),fa)}}}),getTokenAt:function(e,t){var r=this.doc;e=J(r,e);for(var i=At(this,e.line,t),n=this.doc.mode,o=On(r,e.line),s=new Ys(o.text,this.options.tabSize);s.pos<e.ch&&!s.eol();){s.start=s.pos;var a=cn(n,s,i)}return{start:s.start,end:s.pos,string:s.current(),type:a||null,state:i}},getTokenTypeAt:function(e){e=J(this.doc,e);var t,r=En(this,On(this.doc,e.line)),i=0,n=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var s=i+n>>1;if((s?r[2*s-1]:0)>=o)n=s;else{if(!(r[2*s+1]<o)){t=r[2*s+2];break}i=s+1}}var a=t?t.indexOf("cm-overlay "):-1;return 0>a?t:0==a?null:t.slice(0,a-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!Vs.hasOwnProperty(t))return Vs;var i=Vs[t],n=this.getModeAt(e);if("string"==typeof n[t])i[n[t]]&&r.push(i[n[t]]);else if(n[t])for(var o=0;o<n[t].length;o++){var s=i[n[t][o]];s&&r.push(s)}else n.helperType&&i[n.helperType]?r.push(i[n.helperType]):i[n.name]&&r.push(i[n.name]);for(var o=0;o<i._global.length;o++){var a=i._global[o];a.pred(n,this)&&-1==ho(r,a.val)&&r.push(a.val)}return r},getStateAfter:function(e,t){var r=this.doc;return e=Z(r,null==e?r.first+r.size-1:e),At(this,e+1,t)},cursorCoords:function(e,t){var r,i=this.doc.sel.primary();return r=null==e?i.head:"object"==typeof e?J(this.doc,e):e?i.from():i.to(),zt(this,r,t||"page")},charCoords:function(e,t){return qt(this,J(this.doc,e),t||"page")},coordsChar:function(e,t){return e=Wt(this,e,t||"page"),Kt(this,e.left,e.top)},lineAtHeight:function(e,t){return e=Wt(this,{top:e,left:0},t||"page").top,wn(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t){var r=!1,i=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>i&&(e=i,r=!0);var n=On(this.doc,e);return jt(this,n,{top:0,left:0},t||"page").top+(r?this.doc.height-Gn(n):0)},defaultTextHeight:function(){return Qt(this.display)},defaultCharWidth:function(){return Zt(this.display)},setGutterMarker:pr(function(e,t,r){return Li(this.doc,e,"gutter",function(e){var i=e.gutterMarkers||(e.gutterMarkers={});return i[t]=r,!r&&xo(i)&&(e.gutterMarkers=null),!0})}),clearGutter:pr(function(e){var t=this,r=t.doc,i=r.first;r.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&(r.gutterMarkers[e]=null,fr(t,i,"gutter"),xo(r.gutterMarkers)&&(r.gutterMarkers=null)),++i})}),addLineWidget:pr(function(e,t,r){return sn(this,e,t,r)}),removeLineWidget:function(e){e.clear()},lineInfo:function(e){if("number"==typeof e){if(!tt(this.doc,e))return null;var t=e;if(e=On(this.doc,e),!e)return null}else{var t=Mn(e);if(null==t)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,i,n){var o=this.display;e=zt(this,J(this.doc,e));var s=e.bottom,a=e.left;if(t.style.position="absolute",o.sizer.appendChild(t),"over"==i)s=e.top;else if("above"==i||"near"==i){var l=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==i||e.bottom+t.offsetHeight>l)&&e.top>t.offsetHeight?s=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=l&&(s=e.bottom),a+t.offsetWidth>u&&(a=u-t.offsetWidth)}t.style.top=s+"px",t.style.left=t.style.right="","right"==n?(a=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==n?a=0:"middle"==n&&(a=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=a+"px"),r&&fi(this,a,s,a+t.offsetWidth,s+t.offsetHeight)},triggerOnKeyDown:pr(Xr),triggerOnKeyPress:pr($r),triggerOnKeyUp:Kr,execCommand:function(e){return js.hasOwnProperty(e)?js[e](this):void 0},findPosH:function(e,t,r,i){var n=1;0>t&&(n=-1,t=-t);for(var o=0,s=J(this.doc,e);t>o&&(s=Ii(this.doc,s,n,r,i),!s.hitSide);++o);return s},moveH:pr(function(e,t){var r=this;r.extendSelectionsBy(function(i){return r.display.shift||r.doc.extend||i.empty()?Ii(r.doc,i.head,e,t,r.options.rtlMoveVisually):0>e?i.from():i.to()},ga)}),deleteH:pr(function(e,t){var r=this.doc.sel,i=this.doc;r.somethingSelected()?i.replaceSelection("",null,"+delete"):Ti(this,function(r){var n=Ii(i,r.head,e,t,!1);return 0>e?{from:n,to:r.head}:{from:r.head,to:n}})}),findPosV:function(e,t,r,i){var n=1,o=i;0>t&&(n=-1,t=-t);for(var s=0,a=J(this.doc,e);t>s;++s){var l=zt(this,a,"div");if(null==o?o=l.left:l.left=o,a=yi(this,l,n,r),a.hitSide)break}return a},moveV:pr(function(e,t){var r=this,i=this.doc,n=[],o=!r.display.shift&&!i.extend&&i.sel.somethingSelected();if(i.extendSelectionsBy(function(s){if(o)return 0>e?s.from():s.to();var a=zt(r,s.head,"div");null!=s.goalColumn&&(a.left=s.goalColumn),n.push(a.left);var l=yi(r,a,e,t);return"page"==t&&s==i.sel.primary()&&gi(r,null,qt(r,l,"div").top-a.top),l},ga),n.length)for(var s=0;s<i.sel.ranges.length;s++)i.sel.ranges[s].goalColumn=n[s]}),findWordAt:function(e){var t=this.doc,r=On(t,e.line).text,i=e.ch,n=e.ch;if(r){var o=this.getHelper(e,"wordChars");(e.xRel<0||n==r.length)&&i?--i:++n;for(var s=r.charAt(i),a=vo(s,o)?function(e){return vo(e,o)}:/\s/.test(s)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!vo(e)};i>0&&a(r.charAt(i-1));)--i;for(;n<r.length&&a(r.charAt(n));)++n}return new K(vs(e.line,i),vs(e.line,n))},toggleOverwrite:function(e){(null==e||e!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?Ro(this.display.cursorDiv,"CodeMirror-overwrite"):Co(this.display.cursorDiv,"CodeMirror-overwrite"),ca(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return Ao()==this.display.input},scrollTo:pr(function(e,t){(null!=e||null!=t)&&xi(this),null!=e&&(this.curOp.scrollLeft=e),null!=t&&(this.curOp.scrollTop=t)}),getScrollInfo:function(){var e=this.display.scroller,t=ha;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-t,width:e.scrollWidth-t,clientHeight:e.clientHeight-t,clientWidth:e.clientWidth-t}},scrollIntoView:pr(function(e,t){if(null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:vs(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line)xi(this),this.curOp.scrollToPos=e;else{var r=mi(this,Math.min(e.from.left,e.to.left),Math.min(e.from.top,e.to.top)-e.margin,Math.max(e.from.right,e.to.right),Math.max(e.from.bottom,e.to.bottom)+e.margin);this.scrollTo(r.scrollLeft,r.scrollTop)}}),setSize:pr(function(e,t){function r(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}var i=this;null!=e&&(i.display.wrapper.style.width=r(e)),null!=t&&(i.display.wrapper.style.height=r(t)),i.options.lineWrapping&&Ut(this);var n=i.display.viewFrom;i.doc.iter(n,i.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){fr(i,n,"widget");break}++n}),i.curOp.forceUpdate=!0,ca(i,"refresh",this)}),operation:function(e){return lr(this,e)},refresh:pr(function(){var e=this.display.cachedTextHeight;Er(this),this.curOp.forceUpdate=!0,Vt(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),c(this),(null==e||Math.abs(e-Qt(this.display))>.5)&&s(this),ca(this,"refresh",this)}),swapDoc:pr(function(e){var t=this.doc;return t.cm=null,bn(this,e),Vt(this),yr(this),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,ro(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ao(e);var _s=e.defaults={},Ms=e.optionHandlers={},ws=e.Init={toString:function(){return"CodeMirror.Init"}};Ai("value","",function(e,t){e.setValue(t)},!0),Ai("mode",null,function(e,t){e.doc.modeOption=t,r(e)},!0),Ai("indentUnit",2,r,!0),Ai("indentWithTabs",!1),Ai("smartIndent",!0),Ai("tabSize",4,function(e){i(e),Vt(e),Er(e)},!0),Ai("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t){e.options.specialChars=new RegExp(t.source+(t.test(" ")?"":"| "),"g"),e.refresh()},!0),Ai("specialCharPlaceholder",vn,function(e){e.refresh()},!0),Ai("electricChars",!0),Ai("rtlMoveVisually",!ds),Ai("wholeLineUpdateBefore",!0),Ai("theme","default",function(e){l(e),u(e)},!0),Ai("keyMap","default",a),Ai("extraKeys",null),Ai("lineWrapping",!1,n,!0),Ai("gutters",[],function(e){E(e.options),u(e)},!0),Ai("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?T(e.display)+"px":"0",e.refresh()},!0),Ai("coverGutterNextToScrollbar",!1,g,!0),Ai("lineNumbers",!1,function(e){E(e.options),u(e)},!0),Ai("firstLineNumber",1,u,!0),Ai("lineNumberFormatter",function(e){return e},u,!0),Ai("showCursorWhenSelecting",!1,vt,!0),Ai("resetSelectionOnContextMenu",!0),Ai("readOnly",!1,function(e,t){"nocursor"==t?(Zr(e),e.display.input.blur(),e.display.disabled=!0):(e.display.disabled=!1,t||yr(e))}),Ai("disableInput",!1,function(e,t){t||yr(e)},!0),Ai("dragDrop",!0),Ai("cursorBlinkRate",530),Ai("cursorScrollMargin",0),Ai("cursorHeight",1,vt,!0),Ai("singleCursorHeightPerLine",!0,vt,!0),Ai("workTime",100),Ai("workDelay",100),Ai("flattenSpans",!0,i,!0),Ai("addModeClass",!1,i,!0),Ai("pollInterval",100),Ai("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),Ai("historyEventDelay",1250),Ai("viewportMargin",10,function(e){e.refresh()},!0),Ai("maxHighlightLength",1e4,i,!0),Ai("moveInputWithCursor",!0,function(e,t){t||(e.display.inputDiv.style.top=e.display.inputDiv.style.left=0)}),Ai("tabindex",null,function(e,t){e.display.input.tabIndex=t||""}),Ai("autofocus",null);var Gs=e.modes={},ks=e.mimeModes={};e.defineMode=function(t,r){e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2&&(r.dependencies=Array.prototype.slice.call(arguments,2)),Gs[t]=r},e.defineMIME=function(e,t){ks[e]=t},e.resolveMode=function(t){if("string"==typeof t&&ks.hasOwnProperty(t))t=ks[t];else if(t&&"string"==typeof t.name&&ks.hasOwnProperty(t.name)){var r=ks[t.name];"string"==typeof r&&(r={name:r}),t=fo(r,t),t.name=r.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,r){var r=e.resolveMode(r),i=Gs[r.name];if(!i)return e.getMode(t,"text/plain");var n=i(t,r);if(Bs.hasOwnProperty(r.name)){var o=Bs[r.name];for(var s in o)o.hasOwnProperty(s)&&(n.hasOwnProperty(s)&&(n["_"+s]=n[s]),n[s]=o[s])}if(n.name=r.name,r.helperType&&(n.helperType=r.helperType),r.modeProps)for(var s in r.modeProps)n[s]=r.modeProps[s];return n},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var Bs=e.modeExtensions={};e.extendMode=function(e,t){var r=Bs.hasOwnProperty(e)?Bs[e]:Bs[e]={};mo(t,r)},e.defineExtension=function(t,r){e.prototype[t]=r},e.defineDocExtension=function(e,t){ia.prototype[e]=t},e.defineOption=Ai;var Us=[];e.defineInitHook=function(e){Us.push(e)};var Vs=e.helpers={};e.registerHelper=function(t,r,i){Vs.hasOwnProperty(t)||(Vs[t]=e[t]={_global:[]}),Vs[t][r]=i},e.registerGlobalHelper=function(t,r,i,n){e.registerHelper(t,r,n),Vs[t]._global.push({pred:i,val:n})};var Hs=e.copyState=function(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var i in t){var n=t[i];n instanceof Array&&(n=n.concat([])),r[i]=n}return r},Fs=e.startState=function(e,t,r){return e.startState?e.startState(t,r):!0};e.innerMode=function(e,t){for(;e.innerMode;){var r=e.innerMode(t);if(!r||r.mode==e)break;t=r.state,e=r.mode}return r||{mode:e,state:t}};var js=e.commands={selectAll:function(e){e.setSelection(vs(e.firstLine(),0),vs(e.lastLine()),fa)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),fa)},killLine:function(e){Ti(e,function(t){if(t.empty()){var r=On(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:vs(t.head.line+1,0)}:{from:t.head,to:vs(t.head.line,r)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){Ti(e,function(t){return{from:vs(t.from().line,0),to:J(e.doc,vs(t.to().line+1,0))}})},delLineLeft:function(e){Ti(e,function(e){return{from:vs(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){Ti(e,function(t){var r=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:r},"div");return{from:i,to:t.from()}})},delWrappedLineRight:function(e){Ti(e,function(t){var r=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:i}})},undo:function(e){e.undo()},redo:function(e){e.redo()},undoSelection:function(e){e.undoSelection()},redoSelection:function(e){e.redoSelection()},goDocStart:function(e){e.extendSelection(vs(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(vs(e.lastLine()))},goLineStart:function(e){e.extendSelectionsBy(function(t){return Fo(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){e.extendSelectionsBy(function(t){return Wo(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){e.extendSelectionsBy(function(t){return jo(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},ga)},goLineLeft:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},ga)},goLineLeftSmart:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:r},"div");return i.ch<e.getLine(i.line).search(/\S/)?Wo(e,t.head):i},ga)},goLineUp:function(e){e.moveV(-1,"line")},goLineDown:function(e){e.moveV(1,"line")},goPageUp:function(e){e.moveV(-1,"page")},goPageDown:function(e){e.moveV(1,"page")},goCharLeft:function(e){e.moveH(-1,"char")},goCharRight:function(e){e.moveH(1,"char")},goColumnLeft:function(e){e.moveH(-1,"column")},goColumnRight:function(e){e.moveH(1,"column")},goWordLeft:function(e){e.moveH(-1,"word")},goGroupRight:function(e){e.moveH(1,"group")},goGroupLeft:function(e){e.moveH(-1,"group")},goWordRight:function(e){e.moveH(1,"word")},delCharBefore:function(e){e.deleteH(-1,"char")},delCharAfter:function(e){e.deleteH(1,"char")},delWordBefore:function(e){e.deleteH(-1,"word")},delWordAfter:function(e){e.deleteH(1,"word")},delGroupBefore:function(e){e.deleteH(-1,"group")},delGroupAfter:function(e){e.deleteH(1,"group")},indentAuto:function(e){e.indentSelection("smart")},indentMore:function(e){e.indentSelection("add")},indentLess:function(e){e.indentSelection("subtract")},insertTab:function(e){e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),i=e.options.tabSize,n=0;n<r.length;n++){var o=r[n].from(),s=va(e.getLine(o.line),o.ch,i);t.push(new Array(i-s%i+1).join(" "))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){lr(e,function(){for(var t=e.listSelections(),r=[],i=0;i<t.length;i++){var n=t[i].head,o=On(e.doc,n.line).text;if(o)if(n.ch==o.length&&(n=new vs(n.line,n.ch-1)),n.ch>0)n=new vs(n.line,n.ch+1),e.replaceRange(o.charAt(n.ch-1)+o.charAt(n.ch-2),vs(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var s=On(e.doc,n.line-1).text;s&&e.replaceRange(o.charAt(0)+"\n"+s.charAt(s.length-1),vs(n.line-1,s.length-1),vs(n.line,1),"+transpose")}r.push(new K(n,n))}e.setSelections(r)})},newlineAndIndent:function(e){lr(e,function(){for(var t=e.listSelections().length,r=0;t>r;r++){var i=e.listSelections()[r];e.replaceRange("\n",i.anchor,i.head,"+input"),e.indentLine(i.from().line+1,null,!0),vi(e)}})},toggleOverwrite:function(e){e.toggleOverwrite()}},Ws=e.keyMap={};Ws.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Ws.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Ws.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Ws.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},Ws["default"]=cs?Ws.macDefault:Ws.pcDefault;var qs=e.lookupKey=function(e,t,r){function i(t){t=Si(t);var n=t[e];if(n===!1)return"stop";if(null!=n&&r(n))return!0;if(t.nofallthrough)return"stop";var o=t.fallthrough;if(null==o)return!1;if("[object Array]"!=Object.prototype.toString.call(o))return i(o);for(var s=0;s<o.length;++s){var a=i(o[s]);if(a)return a}return!1}for(var n=0;n<t.length;++n){var o=i(t[n]);if(o)return"stop"!=o}},zs=e.isModifierKey=function(e){var t=Ma[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t},Xs=e.keyName=function(e,t){if(ns&&34==e.keyCode&&e["char"])return!1;var r=Ma[e.keyCode];return null==r||e.altGraphKey?!1:(e.altKey&&(r="Alt-"+r),(Es?e.metaKey:e.ctrlKey)&&(r="Ctrl-"+r),(Es?e.ctrlKey:e.metaKey)&&(r="Cmd-"+r),!t&&e.shiftKey&&(r="Shift-"+r),r)
};e.fromTextArea=function(t,r){function i(){t.value=u.getValue()}if(r||(r={}),r.value=t.value,!r.tabindex&&t.tabindex&&(r.tabindex=t.tabindex),!r.placeholder&&t.placeholder&&(r.placeholder=t.placeholder),null==r.autofocus){var n=Ao();r.autofocus=n==t||null!=t.getAttribute("autofocus")&&n==document.body}if(t.form&&(ua(t.form,"submit",i),!r.leaveSubmitMethodAlone)){var o=t.form,s=o.submit;try{var a=o.submit=function(){i(),o.submit=s,o.submit(),o.submit=a}}catch(l){}}t.style.display="none";var u=e(function(e){t.parentNode.insertBefore(e,t.nextSibling)},r);return u.save=i,u.getTextArea=function(){return t},u.toTextArea=function(){u.toTextArea=isNaN,i(),t.parentNode.removeChild(u.getWrapperElement()),t.style.display="",t.form&&(pa(t.form,"submit",i),"function"==typeof t.form.submit&&(t.form.submit=s))},u};var Ys=e.StringStream=function(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};Ys.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(e){var t=this.string.charAt(this.pos);if("string"==typeof e)var r=t==e;else var r=t&&(e.test?e.test(t):e(t));return r?(++this.pos,t):void 0},eatWhile:function(e){for(var t=this.pos;this.eat(e););return this.pos>t},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);return t>-1?(this.pos=t,!0):void 0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=va(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?va(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return va(this.string,null,this.tabSize)-(this.lineStart?va(this.string,this.lineStart,this.tabSize):0)},match:function(e,t,r){if("string"!=typeof e){var i=this.string.slice(this.pos).match(e);return i&&i.index>0?null:(i&&t!==!1&&(this.pos+=i[0].length),i)}var n=function(e){return r?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);return n(o)==n(e)?(t!==!1&&(this.pos+=e.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var Ks=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e};ao(Ks),Ks.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Jt(e),so(this,"clear")){var r=this.find();r&&ro(this,"clear",r.from,r.to)}for(var i=null,n=null,o=0;o<this.lines.length;++o){var s=this.lines[o],a=_i(s.markedSpans,this);e&&!this.collapsed?fr(e,Mn(s),"text"):e&&(null!=a.to&&(n=Mn(s)),null!=a.from&&(i=Mn(s))),s.markedSpans=Mi(s.markedSpans,a),null==a.from&&this.collapsed&&!tn(this.doc,s)&&e&&_n(s,Qt(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var o=0;o<this.lines.length;++o){var l=Qi(this.lines[o]),u=d(l);u>e.display.maxLineLength&&(e.display.maxLine=l,e.display.maxLineLength=u,e.display.maxLineChanged=!0)}null!=i&&e&&this.collapsed&&Er(e,i,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&ht(e.doc)),e&&ro(e,"markerCleared",e,this),t&&tr(e),this.parent&&this.parent.clear()}},Ks.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var r,i,n=0;n<this.lines.length;++n){var o=this.lines[n],s=_i(o.markedSpans,this);if(null!=s.from&&(r=vs(t?o:Mn(o),s.from),-1==e))return r;if(null!=s.to&&(i=vs(t?o:Mn(o),s.to),1==e))return i}return r&&{from:r,to:i}},Ks.prototype.changed=function(){var e=this.find(-1,!0),t=this,r=this.doc.cm;e&&r&&lr(r,function(){var i=e.line,n=Mn(e.line),o=_t(r,n);if(o&&(Bt(o),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!tn(t.doc,i)&&null!=t.height){var s=t.height;t.height=null;var a=on(t)-s;a&&_n(i,i.height+a)}})},Ks.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=ho(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Ks.prototype.detachLine=function(e){if(this.lines.splice(ho(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};var $s=0,Qs=e.SharedTextMarker=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};ao(Qs),Qs.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();ro(this,"clear")}},Qs.prototype.find=function(e,t){return this.primary.find(e,t)};var Zs=e.LineWidget=function(e,t,r){if(r)for(var i in r)r.hasOwnProperty(i)&&(this[i]=r[i]);this.cm=e,this.node=t};ao(Zs),Zs.prototype.clear=function(){var e=this.cm,t=this.line.widgets,r=this.line,i=Mn(r);if(null!=i&&t){for(var n=0;n<t.length;++n)t[n]==this&&t.splice(n--,1);t.length||(r.widgets=null);var o=on(this);lr(e,function(){nn(e,r,-o),fr(e,i,"widget"),_n(r,Math.max(0,r.height-o))})}},Zs.prototype.changed=function(){var e=this.height,t=this.cm,r=this.line;this.height=null;var i=on(this)-e;i&&lr(t,function(){t.curOp.forceUpdate=!0,nn(t,r,i),_n(r,r.height+i)})};var Js=e.Line=function(e,t,r){this.text=e,ji(this,t),this.height=r?r(this):1};ao(Js),Js.prototype.lineNo=function(){return Mn(this)};var ea={},ta={};Sn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,i=e+t;i>r;++r){var n=this.lines[r];this.height-=n.height,ln(n),ro(n,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var i=0;i<t.length;++i)t[i].parent=this},iterN:function(e,t,r){for(var i=e+t;i>e;++e)if(r(this.lines[e]))return!0}},Cn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var i=this.children[r],n=i.chunkSize();if(n>e){var o=Math.min(t,n-e),s=i.height;if(i.removeInner(e,o),this.height-=s-i.height,n==o&&(this.children.splice(r--,1),i.parent=null),0==(t-=o))break;e=0}else e-=n}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Sn))){var a=[];this.collapse(a),this.children=[new Sn(a)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var i=0;i<this.children.length;++i){var n=this.children[i],o=n.chunkSize();if(o>=e){if(n.insertInner(e,t,r),n.lines&&n.lines.length>50){for(;n.lines.length>50;){var s=n.lines.splice(n.lines.length-25,25),a=new Sn(s);n.height-=a.height,this.children.splice(i+1,0,a),a.parent=this}this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new Cn(t);if(e.parent){e.size-=r.size,e.height-=r.height;var i=ho(e.parent.children,e);e.parent.children.splice(i+1,0,r)}else{var n=new Cn(e.children);n.parent=e,e.children=[n,r],e=n}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var i=0;i<this.children.length;++i){var n=this.children[i],o=n.chunkSize();if(o>e){var s=Math.min(t,o-e);if(n.iterN(e,s,r))return!0;if(0==(t-=s))break;e=0}else e-=o}}};var ra=0,ia=e.Doc=function(e,t,r){if(!(this instanceof ia))return new ia(e,t,r);null==r&&(r=0),Cn.call(this,[new Sn([new Js("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=r;var i=vs(r,0);this.sel=Q(i),this.history=new Bn(null),this.id=++ra,this.modeOption=t,"string"==typeof e&&(e=Oa(e)),An(this,{from:i,to:i,text:e}),pt(this,Q(i),fa)};ia.prototype=fo(Cn.prototype,{constructor:ia,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,i=0;i<t.length;++i)r+=t[i].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Dn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||"\n")},setValue:cr(function(e){var t=vs(this.first,0),r=this.first+this.size-1;si(this,{from:t,to:vs(r,On(this,r).text.length),text:Oa(e),origin:"setValue"},!0),pt(this,Q(t))}),replaceRange:function(e,t,r,i){t=J(this,t),r=r?J(this,r):t,di(this,e,t,r,i)},getRange:function(e,t,r){var i=Pn(this,J(this,e),J(this,t));return r===!1?i:i.join(r||"\n")},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){return tt(this,e)?On(this,e):void 0},getLineNumber:function(e){return Mn(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=On(this,e)),Qi(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return J(this,e)},getCursor:function(e){var t,r=this.sel.primary();return t=null==e||"head"==e?r.head:"anchor"==e?r.anchor:"end"==e||"to"==e||e===!1?r.to():r.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:cr(function(e,t,r){at(this,J(this,"number"==typeof e?vs(e,t||0):e),null,r)}),setSelection:cr(function(e,t,r){at(this,J(this,e),J(this,t||e),r)}),extendSelection:cr(function(e,t,r){nt(this,J(this,e),t&&J(this,t),r)}),extendSelections:cr(function(e,t){ot(this,rt(this,e,t))}),extendSelectionsBy:cr(function(e,t){ot(this,Eo(this.sel.ranges,e),t)}),setSelections:cr(function(e,t,r){if(e.length){for(var i=0,n=[];i<e.length;i++)n[i]=new K(J(this,e[i].anchor),J(this,e[i].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),pt(this,$(n,t),r)}}),addSelection:cr(function(e,t,r){var i=this.sel.ranges.slice(0);i.push(new K(J(this,e),J(this,t||e))),pt(this,$(i,i.length-1),r)}),getSelection:function(e){for(var t,r=this.sel.ranges,i=0;i<r.length;i++){var n=Pn(this,r[i].from(),r[i].to());t=t?t.concat(n):n}return e===!1?t:t.join(e||"\n")},getSelections:function(e){for(var t=[],r=this.sel.ranges,i=0;i<r.length;i++){var n=Pn(this,r[i].from(),r[i].to());e!==!1&&(n=n.join(e||"\n")),t[i]=n}return t},replaceSelection:function(e,t,r){for(var i=[],n=0;n<this.sel.ranges.length;n++)i[n]=e;this.replaceSelections(i,t,r||"+input")},replaceSelections:cr(function(e,t,r){for(var i=[],n=this.sel,o=0;o<n.ranges.length;o++){var s=n.ranges[o];i[o]={from:s.from(),to:s.to(),text:Oa(e[o]),origin:r}}for(var a=t&&"end"!=t&&ni(this,i,t),o=i.length-1;o>=0;o--)si(this,i[o]);a?ut(this,a):this.cm&&vi(this.cm)}),undo:cr(function(){li(this,"undo")}),redo:cr(function(){li(this,"redo")}),undoSelection:cr(function(){li(this,"undo",!0)}),redoSelection:cr(function(){li(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,i=0;i<e.done.length;i++)e.done[i].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){this.history=new Bn(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Kn(this.history.done),undone:Kn(this.history.undone)}},setHistory:function(e){var t=this.history=new Bn(this.history.maxGeneration);t.done=Kn(e.done.slice(0),null,!0),t.undone=Kn(e.undone.slice(0),null,!0)},addLineClass:cr(function(e,t,r){return Li(this,e,"class",function(e){var i="text"==t?"textClass":"background"==t?"bgClass":"wrapClass";if(e[i]){if(new RegExp("(?:^|\\s)"+r+"(?:$|\\s)").test(e[i]))return!1;e[i]+=" "+r}else e[i]=r;return!0})}),removeLineClass:cr(function(e,t,r){return Li(this,e,"class",function(e){var i="text"==t?"textClass":"background"==t?"bgClass":"wrapClass",n=e[i];if(!n)return!1;if(null==r)e[i]=null;else{var o=n.match(new RegExp("(?:^|\\s+)"+r+"(?:$|\\s+)"));if(!o)return!1;var s=o.index+o[0].length;e[i]=n.slice(0,o.index)+(o.index&&s!=n.length?" ":"")+n.slice(s)||null}return!0})}),markText:function(e,t,r){return Ci(this,J(this,e),J(this,t),r,"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared};return e=J(this,e),Ci(this,e,e,r,"bookmark")},findMarksAt:function(e){e=J(this,e);var t=[],r=On(this,e.line).markedSpans;if(r)for(var i=0;i<r.length;++i){var n=r[i];(null==n.from||n.from<=e.ch)&&(null==n.to||n.to>=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,r){e=J(this,e),t=J(this,t);var i=[],n=e.line;return this.iter(e.line,t.line+1,function(o){var s=o.markedSpans;if(s)for(var a=0;a<s.length;a++){var l=s[a];n==e.line&&e.ch>l.to||null==l.from&&n!=e.line||n==t.line&&l.from>t.ch||r&&!r(l.marker)||i.push(l.marker.parent||l.marker)}++n}),i},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var i=0;i<r.length;++i)null!=r[i].from&&e.push(r[i].marker)}),e},posFromIndex:function(e){var t,r=this.first;return this.iter(function(i){var n=i.text.length+1;return n>e?(t=e,!0):(e-=n,void++r)}),J(this,vs(r,t))},indexFromPos:function(e){e=J(this,e);var t=e.ch;return e.line<this.first||e.ch<0?0:(this.iter(this.first,e.line,function(e){t+=e.text.length+1}),t)},copy:function(e){var t=new ia(Dn(this,this.first,this.first+this.size),this.modeOption,this.first);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);var i=new ia(Dn(this,t,r),e.mode||this.modeOption,t);return e.sharedHist&&(i.history=this.history),(this.linked||(this.linked=[])).push({doc:i,sharedHist:e.sharedHist}),i.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Oi(i,bi(this)),i},unlinkDoc:function(t){if(t instanceof e&&(t=t.doc),this.linked)for(var r=0;r<this.linked.length;++r){var i=this.linked[r];if(i.doc==t){this.linked.splice(r,1),t.unlinkDoc(this),Pi(bi(this));break}}if(t.history==this.history){var n=[t.id];Rn(t,function(e){n.push(e.id)},!0),t.history=new Bn(null),t.history.done=Kn(this.history.done,n),t.history.undone=Kn(this.history.undone,n)}},iterLinkedDocs:function(e){Rn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),ia.prototype.eachLine=ia.prototype.iter;var na="iter insert remove copy getEditor".split(" ");for(var oa in ia.prototype)ia.prototype.hasOwnProperty(oa)&&ho(na,oa)<0&&(e.prototype[oa]=function(e){return function(){return e.apply(this.doc,arguments)}}(ia.prototype[oa]));ao(ia);var sa=e.e_preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},aa=e.e_stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},la=e.e_stop=function(e){sa(e),aa(e)},ua=e.on=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var i=e._handlers||(e._handlers={}),n=i[t]||(i[t]=[]);n.push(r)}},pa=e.off=function(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var i=e._handlers&&e._handlers[t];if(!i)return;for(var n=0;n<i.length;++n)if(i[n]==r){i.splice(n,1);break}}},ca=e.signal=function(e,t){var r=e._handlers&&e._handlers[t];if(r)for(var i=Array.prototype.slice.call(arguments,2),n=0;n<r.length;++n)r[n].apply(null,i)},da=null,ha=30,Ea=e.Pass={toString:function(){return"CodeMirror.Pass"}},fa={scroll:!1},ma={origin:"*mouse"},ga={origin:"+move"};lo.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var va=e.countColumn=function(e,t,r,i,n){null==t&&(t=e.search(/[^\s\u00a0]/),-1==t&&(t=e.length));for(var o=i||0,s=n||0;;){var a=e.indexOf(" ",o);if(0>a||a>=t)return s+(t-o);s+=a-o,s+=r-s%r,o=a+1}},xa=[""],Na=function(e){e.select()};us?Na=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:Jo&&(Na=function(e){try{e.select()}catch(t){}}),[].indexOf&&(ho=function(e,t){return e.indexOf(t)}),[].map&&(Eo=function(e,t){return e.map(t)});var La,Ta=/[\u00df\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Ia=e.isWordChar=function(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||Ta.test(e))},ya=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;La=document.createRange?function(e,t,r){var i=document.createRange();return i.setEnd(e,r),i.setStart(e,t),i}:function(e,t,r){var i=document.body.createTextRange();return i.moveToElementText(e.parentNode),i.collapse(!0),i.moveEnd("character",r),i.moveStart("character",t),i},Jo&&11>es&&(Ao=function(){try{return document.activeElement}catch(e){return document.body}});var Aa,Sa,Ca,Ra=!1,ba=function(){if(Jo&&9>es)return!1;var e=Lo("div");return"draggable"in e||"dragDrop"in e}(),Oa=e.splitLines=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],i=e.length;i>=t;){var n=e.indexOf("\n",t);-1==n&&(n=e.length);var o=e.slice(t,"\r"==e.charAt(n-1)?n-1:n),s=o.indexOf("\r");-1!=s?(r.push(o.slice(0,s)),t+=s+1):(r.push(o),t=n+1)}return r}:function(e){return e.split(/\r\n?|\n/)},Pa=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(r){}return t&&t.parentElement()==e?0!=t.compareEndPoints("StartToEnd",t):!1},Da=function(){var e=Lo("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),_a=null,Ma={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};e.keyNames=Ma,function(){for(var e=0;10>e;e++)Ma[e+48]=Ma[e+96]=String(e);for(var e=65;90>=e;e++)Ma[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)Ma[e+111]=Ma[e+63235]="F"+e}();var wa,Ga=function(){function e(e){return 247>=e?r.charAt(e):e>=1424&&1524>=e?"R":e>=1536&&1773>=e?i.charAt(e-1536):e>=1774&&2220>=e?"r":e>=8192&&8203>=e?"w":8204==e?"b":"L"}function t(e,t,r){this.level=e,this.from=t,this.to=r}var r="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",i="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,s=/[LRr]/,a=/[Lb1n]/,l=/[1n]/,u="L";return function(r){if(!n.test(r))return!1;for(var i,p=r.length,c=[],d=0;p>d;++d)c.push(i=e(r.charCodeAt(d)));for(var d=0,h=u;p>d;++d){var i=c[d];"m"==i?c[d]=h:h=i}for(var d=0,E=u;p>d;++d){var i=c[d];"1"==i&&"r"==E?c[d]="n":s.test(i)&&(E=i,"r"==i&&(c[d]="R"))}for(var d=1,h=c[0];p-1>d;++d){var i=c[d];"+"==i&&"1"==h&&"1"==c[d+1]?c[d]="1":","!=i||h!=c[d+1]||"1"!=h&&"n"!=h||(c[d]=h),h=i}for(var d=0;p>d;++d){var i=c[d];if(","==i)c[d]="N";else if("%"==i){for(var f=d+1;p>f&&"%"==c[f];++f);for(var m=d&&"!"==c[d-1]||p>f&&"1"==c[f]?"1":"N",g=d;f>g;++g)c[g]=m;d=f-1}}for(var d=0,E=u;p>d;++d){var i=c[d];"L"==E&&"1"==i?c[d]="L":s.test(i)&&(E=i)}for(var d=0;p>d;++d)if(o.test(c[d])){for(var f=d+1;p>f&&o.test(c[f]);++f);for(var v="L"==(d?c[d-1]:u),x="L"==(p>f?c[f]:u),m=v||x?"L":"R",g=d;f>g;++g)c[g]=m;d=f-1}for(var N,L=[],d=0;p>d;)if(a.test(c[d])){var T=d;for(++d;p>d&&a.test(c[d]);++d);L.push(new t(0,T,d))}else{var I=d,y=L.length;for(++d;p>d&&"L"!=c[d];++d);for(var g=I;d>g;)if(l.test(c[g])){g>I&&L.splice(y,0,new t(1,I,g));var A=g;for(++g;d>g&&l.test(c[g]);++g);L.splice(y,0,new t(2,A,g)),I=g}else++g;d>I&&L.splice(y,0,new t(1,I,d))}return 1==L[0].level&&(N=r.match(/^\s+/))&&(L[0].from=N[0].length,L.unshift(new t(0,0,N[0].length))),1==co(L).level&&(N=r.match(/\s+$/))&&(co(L).to-=N[0].length,L.push(new t(0,p-N[0].length,p))),L[0].level!=co(L).level&&L.push(new t(L[0].level,p,p)),L}}();return e.version="4.7.0",e})},{}],11:[function(t,r){!function(e,t){"object"==typeof r&&"object"==typeof r.exports?r.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(t,r){function i(e){var t=e.length,r=ot.type(e);return"function"===r||ot.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===r||0===t||"number"==typeof t&&t>0&&t-1 in e}function n(e,t,r){if(ot.isFunction(t))return ot.grep(e,function(e,i){return!!t.call(e,i,e)!==r});if(t.nodeType)return ot.grep(e,function(e){return e===t!==r});if("string"==typeof t){if(ht.test(t))return ot.filter(t,e,r);t=ot.filter(t,e)}return ot.grep(e,function(e){return ot.inArray(e,t)>=0!==r})}function o(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function s(e){var t=Lt[e]={};return ot.each(e.match(Nt)||[],function(e,r){t[r]=!0}),t}function a(){ft.addEventListener?(ft.removeEventListener("DOMContentLoaded",l,!1),t.removeEventListener("load",l,!1)):(ft.detachEvent("onreadystatechange",l),t.detachEvent("onload",l))}function l(){(ft.addEventListener||"load"===event.type||"complete"===ft.readyState)&&(a(),ot.ready())}function u(e,t,r){if(void 0===r&&1===e.nodeType){var i="data-"+t.replace(St,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:At.test(r)?ot.parseJSON(r):r}catch(n){}ot.data(e,t,r)}else r=void 0}return r}function p(e){var t;for(t in e)if(("data"!==t||!ot.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function c(e,t,r,i){if(ot.acceptData(e)){var n,o,s=ot.expando,a=e.nodeType,l=a?ot.cache:e,u=a?e[s]:e[s]&&s;if(u&&l[u]&&(i||l[u].data)||void 0!==r||"string"!=typeof t)return u||(u=a?e[s]=K.pop()||ot.guid++:s),l[u]||(l[u]=a?{}:{toJSON:ot.noop}),("object"==typeof t||"function"==typeof t)&&(i?l[u]=ot.extend(l[u],t):l[u].data=ot.extend(l[u].data,t)),o=l[u],i||(o.data||(o.data={}),o=o.data),void 0!==r&&(o[ot.camelCase(t)]=r),"string"==typeof t?(n=o[t],null==n&&(n=o[ot.camelCase(t)])):n=o,n}}function d(e,t,r){if(ot.acceptData(e)){var i,n,o=e.nodeType,s=o?ot.cache:e,a=o?e[ot.expando]:ot.expando;if(s[a]){if(t&&(i=r?s[a]:s[a].data)){ot.isArray(t)?t=t.concat(ot.map(t,ot.camelCase)):t in i?t=[t]:(t=ot.camelCase(t),t=t in i?[t]:t.split(" ")),n=t.length;for(;n--;)delete i[t[n]];if(r?!p(i):!ot.isEmptyObject(i))return}(r||(delete s[a].data,p(s[a])))&&(o?ot.cleanData([e],!0):it.deleteExpando||s!=s.window?delete s[a]:s[a]=null)}}}function h(){return!0}function E(){return!1}function f(){try{return ft.activeElement}catch(e){}}function m(e){var t=kt.split("|"),r=e.createDocumentFragment();if(r.createElement)for(;t.length;)r.createElement(t.pop());return r}function g(e,t){var r,i,n=0,o=typeof e.getElementsByTagName!==yt?e.getElementsByTagName(t||"*"):typeof e.querySelectorAll!==yt?e.querySelectorAll(t||"*"):void 0;if(!o)for(o=[],r=e.childNodes||e;null!=(i=r[n]);n++)!t||ot.nodeName(i,t)?o.push(i):ot.merge(o,g(i,t));return void 0===t||t&&ot.nodeName(e,t)?ot.merge([e],o):o}function v(e){Pt.test(e.type)&&(e.defaultChecked=e.checked)}function x(e,t){return ot.nodeName(e,"table")&&ot.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function N(e){return e.type=(null!==ot.find.attr(e,"type"))+"/"+e.type,e}function L(e){var t=Yt.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function T(e,t){for(var r,i=0;null!=(r=e[i]);i++)ot._data(r,"globalEval",!t||ot._data(t[i],"globalEval"))}function I(e,t){if(1===t.nodeType&&ot.hasData(e)){var r,i,n,o=ot._data(e),s=ot._data(t,o),a=o.events;if(a){delete s.handle,s.events={};for(r in a)for(i=0,n=a[r].length;n>i;i++)ot.event.add(t,r,a[r][i])}s.data&&(s.data=ot.extend({},s.data))}}function y(e,t){var r,i,n;if(1===t.nodeType){if(r=t.nodeName.toLowerCase(),!it.noCloneEvent&&t[ot.expando]){n=ot._data(t);for(i in n.events)ot.removeEvent(t,i,n.handle);t.removeAttribute(ot.expando)}"script"===r&&t.text!==e.text?(N(t).text=e.text,L(t)):"object"===r?(t.parentNode&&(t.outerHTML=e.outerHTML),it.html5Clone&&e.innerHTML&&!ot.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===r&&Pt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===r?t.defaultSelected=t.selected=e.defaultSelected:("input"===r||"textarea"===r)&&(t.defaultValue=e.defaultValue)}}function A(e,r){var i,n=ot(r.createElement(e)).appendTo(r.body),o=t.getDefaultComputedStyle&&(i=t.getDefaultComputedStyle(n[0]))?i.display:ot.css(n[0],"display");return n.detach(),o}function S(e){var t=ft,r=er[e];return r||(r=A(e,t),"none"!==r&&r||(Jt=(Jt||ot("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement),t=(Jt[0].contentWindow||Jt[0].contentDocument).document,t.write(),t.close(),r=A(e,t),Jt.detach()),er[e]=r),r}function C(e,t){return{get:function(){var r=e();if(null!=r)return r?void delete this.get:(this.get=t).apply(this,arguments)}}}function R(e,t){if(t in e)return t;for(var r=t.charAt(0).toUpperCase()+t.slice(1),i=t,n=hr.length;n--;)if(t=hr[n]+r,t in e)return t;return i}function b(e,t){for(var r,i,n,o=[],s=0,a=e.length;a>s;s++)i=e[s],i.style&&(o[s]=ot._data(i,"olddisplay"),r=i.style.display,t?(o[s]||"none"!==r||(i.style.display=""),""===i.style.display&&bt(i)&&(o[s]=ot._data(i,"olddisplay",S(i.nodeName)))):(n=bt(i),(r&&"none"!==r||!n)&&ot._data(i,"olddisplay",n?r:ot.css(i,"display"))));for(s=0;a>s;s++)i=e[s],i.style&&(t&&"none"!==i.style.display&&""!==i.style.display||(i.style.display=t?o[s]||"":"none"));return e}function O(e,t,r){var i=ur.exec(t);return i?Math.max(0,i[1]-(r||0))+(i[2]||"px"):t}function P(e,t,r,i,n){for(var o=r===(i?"border":"content")?4:"width"===t?1:0,s=0;4>o;o+=2)"margin"===r&&(s+=ot.css(e,r+Rt[o],!0,n)),i?("content"===r&&(s-=ot.css(e,"padding"+Rt[o],!0,n)),"margin"!==r&&(s-=ot.css(e,"border"+Rt[o]+"Width",!0,n))):(s+=ot.css(e,"padding"+Rt[o],!0,n),"padding"!==r&&(s+=ot.css(e,"border"+Rt[o]+"Width",!0,n)));return s}function D(e,t,r){var i=!0,n="width"===t?e.offsetWidth:e.offsetHeight,o=tr(e),s=it.boxSizing&&"border-box"===ot.css(e,"boxSizing",!1,o);if(0>=n||null==n){if(n=rr(e,t,o),(0>n||null==n)&&(n=e.style[t]),nr.test(n))return n;i=s&&(it.boxSizingReliable()||n===e.style[t]),n=parseFloat(n)||0}return n+P(e,t,r||(s?"border":"content"),i,o)+"px"}function _(e,t,r,i,n){return new _.prototype.init(e,t,r,i,n)}function M(){return setTimeout(function(){Er=void 0}),Er=ot.now()}function w(e,t){var r,i={height:e},n=0;for(t=t?1:0;4>n;n+=2-t)r=Rt[n],i["margin"+r]=i["padding"+r]=e;return t&&(i.opacity=i.width=e),i}function G(e,t,r){for(var i,n=(Nr[t]||[]).concat(Nr["*"]),o=0,s=n.length;s>o;o++)if(i=n[o].call(r,t,e))return i}function k(e,t,r){var i,n,o,s,a,l,u,p,c=this,d={},h=e.style,E=e.nodeType&&bt(e),f=ot._data(e,"fxshow");r.queue||(a=ot._queueHooks(e,"fx"),null==a.unqueued&&(a.unqueued=0,l=a.empty.fire,a.empty.fire=function(){a.unqueued||l()}),a.unqueued++,c.always(function(){c.always(function(){a.unqueued--,ot.queue(e,"fx").length||a.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(r.overflow=[h.overflow,h.overflowX,h.overflowY],u=ot.css(e,"display"),p="none"===u?ot._data(e,"olddisplay")||S(e.nodeName):u,"inline"===p&&"none"===ot.css(e,"float")&&(it.inlineBlockNeedsLayout&&"inline"!==S(e.nodeName)?h.zoom=1:h.display="inline-block")),r.overflow&&(h.overflow="hidden",it.shrinkWrapBlocks()||c.always(function(){h.overflow=r.overflow[0],h.overflowX=r.overflow[1],h.overflowY=r.overflow[2]}));for(i in t)if(n=t[i],mr.exec(n)){if(delete t[i],o=o||"toggle"===n,n===(E?"hide":"show")){if("show"!==n||!f||void 0===f[i])continue;E=!0}d[i]=f&&f[i]||ot.style(e,i)}else u=void 0;if(ot.isEmptyObject(d))"inline"===("none"===u?S(e.nodeName):u)&&(h.display=u);else{f?"hidden"in f&&(E=f.hidden):f=ot._data(e,"fxshow",{}),o&&(f.hidden=!E),E?ot(e).show():c.done(function(){ot(e).hide()}),c.done(function(){var t;ot._removeData(e,"fxshow");for(t in d)ot.style(e,t,d[t])});for(i in d)s=G(E?f[i]:0,i,c),i in f||(f[i]=s.start,E&&(s.end=s.start,s.start="width"===i||"height"===i?1:0))}}function B(e,t){var r,i,n,o,s;for(r in e)if(i=ot.camelCase(r),n=t[i],o=e[r],ot.isArray(o)&&(n=o[1],o=e[r]=o[0]),r!==i&&(e[i]=o,delete e[r]),s=ot.cssHooks[i],s&&"expand"in s){o=s.expand(o),delete e[i];for(r in o)r in e||(e[r]=o[r],t[r]=n)}else t[i]=n}function U(e,t,r){var i,n,o=0,s=xr.length,a=ot.Deferred().always(function(){delete l.elem}),l=function(){if(n)return!1;for(var t=Er||M(),r=Math.max(0,u.startTime+u.duration-t),i=r/u.duration||0,o=1-i,s=0,l=u.tweens.length;l>s;s++)u.tweens[s].run(o);return a.notifyWith(e,[u,o,r]),1>o&&l?r:(a.resolveWith(e,[u]),!1)},u=a.promise({elem:e,props:ot.extend({},t),opts:ot.extend(!0,{specialEasing:{}},r),originalProperties:t,originalOptions:r,startTime:Er||M(),duration:r.duration,tweens:[],createTween:function(t,r){var i=ot.Tween(e,u.opts,t,r,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(i),i},stop:function(t){var r=0,i=t?u.tweens.length:0;if(n)return this;for(n=!0;i>r;r++)u.tweens[r].run(1);
return t?a.resolveWith(e,[u,t]):a.rejectWith(e,[u,t]),this}}),p=u.props;for(B(p,u.opts.specialEasing);s>o;o++)if(i=xr[o].call(u,e,p,u.opts))return i;return ot.map(p,G,u),ot.isFunction(u.opts.start)&&u.opts.start.call(e,u),ot.fx.timer(ot.extend(l,{elem:e,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function V(e){return function(t,r){"string"!=typeof t&&(r=t,t="*");var i,n=0,o=t.toLowerCase().match(Nt)||[];if(ot.isFunction(r))for(;i=o[n++];)"+"===i.charAt(0)?(i=i.slice(1)||"*",(e[i]=e[i]||[]).unshift(r)):(e[i]=e[i]||[]).push(r)}}function H(e,t,r,i){function n(a){var l;return o[a]=!0,ot.each(e[a]||[],function(e,a){var u=a(t,r,i);return"string"!=typeof u||s||o[u]?s?!(l=u):void 0:(t.dataTypes.unshift(u),n(u),!1)}),l}var o={},s=e===Wr;return n(t.dataTypes[0])||!o["*"]&&n("*")}function F(e,t){var r,i,n=ot.ajaxSettings.flatOptions||{};for(i in t)void 0!==t[i]&&((n[i]?e:r||(r={}))[i]=t[i]);return r&&ot.extend(!0,e,r),e}function j(e,t,r){for(var i,n,o,s,a=e.contents,l=e.dataTypes;"*"===l[0];)l.shift(),void 0===n&&(n=e.mimeType||t.getResponseHeader("Content-Type"));if(n)for(s in a)if(a[s]&&a[s].test(n)){l.unshift(s);break}if(l[0]in r)o=l[0];else{for(s in r){if(!l[0]||e.converters[s+" "+l[0]]){o=s;break}i||(i=s)}o=o||i}return o?(o!==l[0]&&l.unshift(o),r[o]):void 0}function W(e,t,r,i){var n,o,s,a,l,u={},p=e.dataTypes.slice();if(p[1])for(s in e.converters)u[s.toLowerCase()]=e.converters[s];for(o=p.shift();o;)if(e.responseFields[o]&&(r[e.responseFields[o]]=t),!l&&i&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=p.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(s=u[l+" "+o]||u["* "+o],!s)for(n in u)if(a=n.split(" "),a[1]===o&&(s=u[l+" "+a[0]]||u["* "+a[0]])){s===!0?s=u[n]:u[n]!==!0&&(o=a[0],p.unshift(a[1]));break}if(s!==!0)if(s&&e["throws"])t=s(t);else try{t=s(t)}catch(c){return{state:"parsererror",error:s?c:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}function q(e,t,r,i){var n;if(ot.isArray(t))ot.each(t,function(t,n){r||Yr.test(e)?i(e,n):q(e+"["+("object"==typeof n?t:"")+"]",n,r,i)});else if(r||"object"!==ot.type(t))i(e,t);else for(n in t)q(e+"["+n+"]",t[n],r,i)}function z(){try{return new t.XMLHttpRequest}catch(e){}}function X(){try{return new t.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}function Y(e){return ot.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}var K=[],$=K.slice,Q=K.concat,Z=K.push,J=K.indexOf,et={},tt=et.toString,rt=et.hasOwnProperty,it={},nt="1.11.1",ot=function(e,t){return new ot.fn.init(e,t)},st=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,at=/^-ms-/,lt=/-([\da-z])/gi,ut=function(e,t){return t.toUpperCase()};ot.fn=ot.prototype={jquery:nt,constructor:ot,selector:"",length:0,toArray:function(){return $.call(this)},get:function(e){return null!=e?0>e?this[e+this.length]:this[e]:$.call(this)},pushStack:function(e){var t=ot.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return ot.each(this,e,t)},map:function(e){return this.pushStack(ot.map(this,function(t,r){return e.call(t,r,t)}))},slice:function(){return this.pushStack($.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,r=+e+(0>e?t:0);return this.pushStack(r>=0&&t>r?[this[r]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:Z,sort:K.sort,splice:K.splice},ot.extend=ot.fn.extend=function(){var e,t,r,i,n,o,s=arguments[0]||{},a=1,l=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[a]||{},a++),"object"==typeof s||ot.isFunction(s)||(s={}),a===l&&(s=this,a--);l>a;a++)if(null!=(n=arguments[a]))for(i in n)e=s[i],r=n[i],s!==r&&(u&&r&&(ot.isPlainObject(r)||(t=ot.isArray(r)))?(t?(t=!1,o=e&&ot.isArray(e)?e:[]):o=e&&ot.isPlainObject(e)?e:{},s[i]=ot.extend(u,o,r)):void 0!==r&&(s[i]=r));return s},ot.extend({expando:"jQuery"+(nt+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isFunction:function(e){return"function"===ot.type(e)},isArray:Array.isArray||function(e){return"array"===ot.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!ot.isArray(e)&&e-parseFloat(e)>=0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},isPlainObject:function(e){var t;if(!e||"object"!==ot.type(e)||e.nodeType||ot.isWindow(e))return!1;try{if(e.constructor&&!rt.call(e,"constructor")&&!rt.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}if(it.ownLast)for(t in e)return rt.call(e,t);for(t in e);return void 0===t||rt.call(e,t)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?et[tt.call(e)]||"object":typeof e},globalEval:function(e){e&&ot.trim(e)&&(t.execScript||function(e){t.eval.call(t,e)})(e)},camelCase:function(e){return e.replace(at,"ms-").replace(lt,ut)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,r){var n,o=0,s=e.length,a=i(e);if(r){if(a)for(;s>o&&(n=t.apply(e[o],r),n!==!1);o++);else for(o in e)if(n=t.apply(e[o],r),n===!1)break}else if(a)for(;s>o&&(n=t.call(e[o],o,e[o]),n!==!1);o++);else for(o in e)if(n=t.call(e[o],o,e[o]),n===!1)break;return e},trim:function(e){return null==e?"":(e+"").replace(st,"")},makeArray:function(e,t){var r=t||[];return null!=e&&(i(Object(e))?ot.merge(r,"string"==typeof e?[e]:e):Z.call(r,e)),r},inArray:function(e,t,r){var i;if(t){if(J)return J.call(t,e,r);for(i=t.length,r=r?0>r?Math.max(0,i+r):r:0;i>r;r++)if(r in t&&t[r]===e)return r}return-1},merge:function(e,t){for(var r=+t.length,i=0,n=e.length;r>i;)e[n++]=t[i++];if(r!==r)for(;void 0!==t[i];)e[n++]=t[i++];return e.length=n,e},grep:function(e,t,r){for(var i,n=[],o=0,s=e.length,a=!r;s>o;o++)i=!t(e[o],o),i!==a&&n.push(e[o]);return n},map:function(e,t,r){var n,o=0,s=e.length,a=i(e),l=[];if(a)for(;s>o;o++)n=t(e[o],o,r),null!=n&&l.push(n);else for(o in e)n=t(e[o],o,r),null!=n&&l.push(n);return Q.apply([],l)},guid:1,proxy:function(e,t){var r,i,n;return"string"==typeof t&&(n=e[t],t=e,e=n),ot.isFunction(e)?(r=$.call(arguments,2),i=function(){return e.apply(t||this,r.concat($.call(arguments)))},i.guid=e.guid=e.guid||ot.guid++,i):void 0},now:function(){return+new Date},support:it}),ot.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){et["[object "+t+"]"]=t.toLowerCase()});var pt=function(e){function t(e,t,r,i){var n,o,s,a,l,u,c,h,E,f;if((t?t.ownerDocument||t:V)!==D&&P(t),t=t||D,r=r||[],!e||"string"!=typeof e)return r;if(1!==(a=t.nodeType)&&9!==a)return[];if(M&&!i){if(n=vt.exec(e))if(s=n[1]){if(9===a){if(o=t.getElementById(s),!o||!o.parentNode)return r;if(o.id===s)return r.push(o),r}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(s))&&B(t,o)&&o.id===s)return r.push(o),r}else{if(n[2])return J.apply(r,t.getElementsByTagName(e)),r;if((s=n[3])&&L.getElementsByClassName&&t.getElementsByClassName)return J.apply(r,t.getElementsByClassName(s)),r}if(L.qsa&&(!w||!w.test(e))){if(h=c=U,E=t,f=9===a&&e,1===a&&"object"!==t.nodeName.toLowerCase()){for(u=A(e),(c=t.getAttribute("id"))?h=c.replace(Nt,"\\$&"):t.setAttribute("id",h),h="[id='"+h+"'] ",l=u.length;l--;)u[l]=h+d(u[l]);E=xt.test(e)&&p(t.parentNode)||t,f=u.join(",")}if(f)try{return J.apply(r,E.querySelectorAll(f)),r}catch(m){}finally{c||t.removeAttribute("id")}}}return C(e.replace(lt,"$1"),t,r,i)}function r(){function e(r,i){return t.push(r+" ")>T.cacheLength&&delete e[t.shift()],e[r+" "]=i}var t=[];return e}function i(e){return e[U]=!0,e}function n(e){var t=D.createElement("div");try{return!!e(t)}catch(r){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function o(e,t){for(var r=e.split("|"),i=e.length;i--;)T.attrHandle[r[i]]=t}function s(e,t){var r=t&&e,i=r&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||Y)-(~e.sourceIndex||Y);if(i)return i;if(r)for(;r=r.nextSibling;)if(r===t)return-1;return e?1:-1}function a(e){return function(t){var r=t.nodeName.toLowerCase();return"input"===r&&t.type===e}}function l(e){return function(t){var r=t.nodeName.toLowerCase();return("input"===r||"button"===r)&&t.type===e}}function u(e){return i(function(t){return t=+t,i(function(r,i){for(var n,o=e([],r.length,t),s=o.length;s--;)r[n=o[s]]&&(r[n]=!(i[n]=r[n]))})})}function p(e){return e&&typeof e.getElementsByTagName!==X&&e}function c(){}function d(e){for(var t=0,r=e.length,i="";r>t;t++)i+=e[t].value;return i}function h(e,t,r){var i=t.dir,n=r&&"parentNode"===i,o=F++;return t.first?function(t,r,o){for(;t=t[i];)if(1===t.nodeType||n)return e(t,r,o)}:function(t,r,s){var a,l,u=[H,o];if(s){for(;t=t[i];)if((1===t.nodeType||n)&&e(t,r,s))return!0}else for(;t=t[i];)if(1===t.nodeType||n){if(l=t[U]||(t[U]={}),(a=l[i])&&a[0]===H&&a[1]===o)return u[2]=a[2];if(l[i]=u,u[2]=e(t,r,s))return!0}}}function E(e){return e.length>1?function(t,r,i){for(var n=e.length;n--;)if(!e[n](t,r,i))return!1;return!0}:e[0]}function f(e,r,i){for(var n=0,o=r.length;o>n;n++)t(e,r[n],i);return i}function m(e,t,r,i,n){for(var o,s=[],a=0,l=e.length,u=null!=t;l>a;a++)(o=e[a])&&(!r||r(o,i,n))&&(s.push(o),u&&t.push(a));return s}function g(e,t,r,n,o,s){return n&&!n[U]&&(n=g(n)),o&&!o[U]&&(o=g(o,s)),i(function(i,s,a,l){var u,p,c,d=[],h=[],E=s.length,g=i||f(t||"*",a.nodeType?[a]:a,[]),v=!e||!i&&t?g:m(g,d,e,a,l),x=r?o||(i?e:E||n)?[]:s:v;if(r&&r(v,x,a,l),n)for(u=m(x,h),n(u,[],a,l),p=u.length;p--;)(c=u[p])&&(x[h[p]]=!(v[h[p]]=c));if(i){if(o||e){if(o){for(u=[],p=x.length;p--;)(c=x[p])&&u.push(v[p]=c);o(null,x=[],u,l)}for(p=x.length;p--;)(c=x[p])&&(u=o?tt.call(i,c):d[p])>-1&&(i[u]=!(s[u]=c))}}else x=m(x===s?x.splice(E,x.length):x),o?o(null,s,x,l):J.apply(s,x)})}function v(e){for(var t,r,i,n=e.length,o=T.relative[e[0].type],s=o||T.relative[" "],a=o?1:0,l=h(function(e){return e===t},s,!0),u=h(function(e){return tt.call(t,e)>-1},s,!0),p=[function(e,r,i){return!o&&(i||r!==R)||((t=r).nodeType?l(e,r,i):u(e,r,i))}];n>a;a++)if(r=T.relative[e[a].type])p=[h(E(p),r)];else{if(r=T.filter[e[a].type].apply(null,e[a].matches),r[U]){for(i=++a;n>i&&!T.relative[e[i].type];i++);return g(a>1&&E(p),a>1&&d(e.slice(0,a-1).concat({value:" "===e[a-2].type?"*":""})).replace(lt,"$1"),r,i>a&&v(e.slice(a,i)),n>i&&v(e=e.slice(i)),n>i&&d(e))}p.push(r)}return E(p)}function x(e,r){var n=r.length>0,o=e.length>0,s=function(i,s,a,l,u){var p,c,d,h=0,E="0",f=i&&[],g=[],v=R,x=i||o&&T.find.TAG("*",u),N=H+=null==v?1:Math.random()||.1,L=x.length;for(u&&(R=s!==D&&s);E!==L&&null!=(p=x[E]);E++){if(o&&p){for(c=0;d=e[c++];)if(d(p,s,a)){l.push(p);break}u&&(H=N)}n&&((p=!d&&p)&&h--,i&&f.push(p))}if(h+=E,n&&E!==h){for(c=0;d=r[c++];)d(f,g,s,a);if(i){if(h>0)for(;E--;)f[E]||g[E]||(g[E]=Q.call(l));g=m(g)}J.apply(l,g),u&&!i&&g.length>0&&h+r.length>1&&t.uniqueSort(l)}return u&&(H=N,R=v),f};return n?i(s):s}var N,L,T,I,y,A,S,C,R,b,O,P,D,_,M,w,G,k,B,U="sizzle"+-new Date,V=e.document,H=0,F=0,j=r(),W=r(),q=r(),z=function(e,t){return e===t&&(O=!0),0},X="undefined",Y=1<<31,K={}.hasOwnProperty,$=[],Q=$.pop,Z=$.push,J=$.push,et=$.slice,tt=$.indexOf||function(e){for(var t=0,r=this.length;r>t;t++)if(this[t]===e)return t;return-1},rt="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",it="[\\x20\\t\\r\\n\\f]",nt="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",ot=nt.replace("w","w#"),st="\\["+it+"*("+nt+")(?:"+it+"*([*^$|!~]?=)"+it+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+ot+"))|)"+it+"*\\]",at=":("+nt+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+st+")*)|.*)\\)|)",lt=new RegExp("^"+it+"+|((?:^|[^\\\\])(?:\\\\.)*)"+it+"+$","g"),ut=new RegExp("^"+it+"*,"+it+"*"),pt=new RegExp("^"+it+"*([>+~]|"+it+")"+it+"*"),ct=new RegExp("="+it+"*([^\\]'\"]*?)"+it+"*\\]","g"),dt=new RegExp(at),ht=new RegExp("^"+ot+"$"),Et={ID:new RegExp("^#("+nt+")"),CLASS:new RegExp("^\\.("+nt+")"),TAG:new RegExp("^("+nt.replace("w","w*")+")"),ATTR:new RegExp("^"+st),PSEUDO:new RegExp("^"+at),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+it+"*(even|odd|(([+-]|)(\\d*)n|)"+it+"*(?:([+-]|)"+it+"*(\\d+)|))"+it+"*\\)|)","i"),bool:new RegExp("^(?:"+rt+")$","i"),needsContext:new RegExp("^"+it+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+it+"*((?:-\\d)?\\d*)"+it+"*\\)|)(?=[^-]|$)","i")},ft=/^(?:input|select|textarea|button)$/i,mt=/^h\d$/i,gt=/^[^{]+\{\s*\[native \w/,vt=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,xt=/[+~]/,Nt=/'|\\/g,Lt=new RegExp("\\\\([\\da-f]{1,6}"+it+"?|("+it+")|.)","ig"),Tt=function(e,t,r){var i="0x"+t-65536;return i!==i||r?t:0>i?String.fromCharCode(i+65536):String.fromCharCode(i>>10|55296,1023&i|56320)};try{J.apply($=et.call(V.childNodes),V.childNodes),$[V.childNodes.length].nodeType}catch(It){J={apply:$.length?function(e,t){Z.apply(e,et.call(t))}:function(e,t){for(var r=e.length,i=0;e[r++]=t[i++];);e.length=r-1}}}L=t.support={},y=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},P=t.setDocument=function(e){var t,r=e?e.ownerDocument||e:V,i=r.defaultView;return r!==D&&9===r.nodeType&&r.documentElement?(D=r,_=r.documentElement,M=!y(r),i&&i!==i.top&&(i.addEventListener?i.addEventListener("unload",function(){P()},!1):i.attachEvent&&i.attachEvent("onunload",function(){P()})),L.attributes=n(function(e){return e.className="i",!e.getAttribute("className")}),L.getElementsByTagName=n(function(e){return e.appendChild(r.createComment("")),!e.getElementsByTagName("*").length}),L.getElementsByClassName=gt.test(r.getElementsByClassName)&&n(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),L.getById=n(function(e){return _.appendChild(e).id=U,!r.getElementsByName||!r.getElementsByName(U).length}),L.getById?(T.find.ID=function(e,t){if(typeof t.getElementById!==X&&M){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}},T.filter.ID=function(e){var t=e.replace(Lt,Tt);return function(e){return e.getAttribute("id")===t}}):(delete T.find.ID,T.filter.ID=function(e){var t=e.replace(Lt,Tt);return function(e){var r=typeof e.getAttributeNode!==X&&e.getAttributeNode("id");return r&&r.value===t}}),T.find.TAG=L.getElementsByTagName?function(e,t){return typeof t.getElementsByTagName!==X?t.getElementsByTagName(e):void 0}:function(e,t){var r,i=[],n=0,o=t.getElementsByTagName(e);if("*"===e){for(;r=o[n++];)1===r.nodeType&&i.push(r);return i}return o},T.find.CLASS=L.getElementsByClassName&&function(e,t){return typeof t.getElementsByClassName!==X&&M?t.getElementsByClassName(e):void 0},G=[],w=[],(L.qsa=gt.test(r.querySelectorAll))&&(n(function(e){e.innerHTML="<select msallowclip=''><option selected=''></option></select>",e.querySelectorAll("[msallowclip^='']").length&&w.push("[*^$]="+it+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||w.push("\\["+it+"*(?:value|"+rt+")"),e.querySelectorAll(":checked").length||w.push(":checked")}),n(function(e){var t=r.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&w.push("name"+it+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||w.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),w.push(",.*:")})),(L.matchesSelector=gt.test(k=_.matches||_.webkitMatchesSelector||_.mozMatchesSelector||_.oMatchesSelector||_.msMatchesSelector))&&n(function(e){L.disconnectedMatch=k.call(e,"div"),k.call(e,"[s!='']:x"),G.push("!=",at)}),w=w.length&&new RegExp(w.join("|")),G=G.length&&new RegExp(G.join("|")),t=gt.test(_.compareDocumentPosition),B=t||gt.test(_.contains)?function(e,t){var r=9===e.nodeType?e.documentElement:e,i=t&&t.parentNode;return e===i||!(!i||1!==i.nodeType||!(r.contains?r.contains(i):e.compareDocumentPosition&&16&e.compareDocumentPosition(i)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},z=t?function(e,t){if(e===t)return O=!0,0;var i=!e.compareDocumentPosition-!t.compareDocumentPosition;return i?i:(i=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&i||!L.sortDetached&&t.compareDocumentPosition(e)===i?e===r||e.ownerDocument===V&&B(V,e)?-1:t===r||t.ownerDocument===V&&B(V,t)?1:b?tt.call(b,e)-tt.call(b,t):0:4&i?-1:1)}:function(e,t){if(e===t)return O=!0,0;var i,n=0,o=e.parentNode,a=t.parentNode,l=[e],u=[t];if(!o||!a)return e===r?-1:t===r?1:o?-1:a?1:b?tt.call(b,e)-tt.call(b,t):0;if(o===a)return s(e,t);for(i=e;i=i.parentNode;)l.unshift(i);for(i=t;i=i.parentNode;)u.unshift(i);for(;l[n]===u[n];)n++;return n?s(l[n],u[n]):l[n]===V?-1:u[n]===V?1:0},r):D},t.matches=function(e,r){return t(e,null,null,r)},t.matchesSelector=function(e,r){if((e.ownerDocument||e)!==D&&P(e),r=r.replace(ct,"='$1']"),!(!L.matchesSelector||!M||G&&G.test(r)||w&&w.test(r)))try{var i=k.call(e,r);if(i||L.disconnectedMatch||e.document&&11!==e.document.nodeType)return i}catch(n){}return t(r,D,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==D&&P(e),B(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==D&&P(e);var r=T.attrHandle[t.toLowerCase()],i=r&&K.call(T.attrHandle,t.toLowerCase())?r(e,t,!M):void 0;return void 0!==i?i:L.attributes||!M?e.getAttribute(t):(i=e.getAttributeNode(t))&&i.specified?i.value:null},t.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,r=[],i=0,n=0;if(O=!L.detectDuplicates,b=!L.sortStable&&e.slice(0),e.sort(z),O){for(;t=e[n++];)t===e[n]&&(i=r.push(n));for(;i--;)e.splice(r[i],1)}return b=null,e},I=t.getText=function(e){var t,r="",i=0,n=e.nodeType;if(n){if(1===n||9===n||11===n){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)r+=I(e)}else if(3===n||4===n)return e.nodeValue}else for(;t=e[i++];)r+=I(t);return r},T=t.selectors={cacheLength:50,createPseudo:i,match:Et,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Lt,Tt),e[3]=(e[3]||e[4]||e[5]||"").replace(Lt,Tt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||t.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&t.error(e[0]),e},PSEUDO:function(e){var t,r=!e[6]&&e[2];return Et.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":r&&dt.test(r)&&(t=A(r,!0))&&(t=r.indexOf(")",r.length-t)-r.length)&&(e[0]=e[0].slice(0,t),e[2]=r.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Lt,Tt).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=j[e+" "];return t||(t=new RegExp("(^|"+it+")"+e+"("+it+"|$)"))&&j(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==X&&e.getAttribute("class")||"")})},ATTR:function(e,r,i){return function(n){var o=t.attr(n,e);return null==o?"!="===r:r?(o+="","="===r?o===i:"!="===r?o!==i:"^="===r?i&&0===o.indexOf(i):"*="===r?i&&o.indexOf(i)>-1:"$="===r?i&&o.slice(-i.length)===i:"~="===r?(" "+o+" ").indexOf(i)>-1:"|="===r?o===i||o.slice(0,i.length+1)===i+"-":!1):!0}},CHILD:function(e,t,r,i,n){var o="nth"!==e.slice(0,3),s="last"!==e.slice(-4),a="of-type"===t;return 1===i&&0===n?function(e){return!!e.parentNode}:function(t,r,l){var u,p,c,d,h,E,f=o!==s?"nextSibling":"previousSibling",m=t.parentNode,g=a&&t.nodeName.toLowerCase(),v=!l&&!a;if(m){if(o){for(;f;){for(c=t;c=c[f];)if(a?c.nodeName.toLowerCase()===g:1===c.nodeType)return!1;E=f="only"===e&&!E&&"nextSibling"}return!0}if(E=[s?m.firstChild:m.lastChild],s&&v){for(p=m[U]||(m[U]={}),u=p[e]||[],h=u[0]===H&&u[1],d=u[0]===H&&u[2],c=h&&m.childNodes[h];c=++h&&c&&c[f]||(d=h=0)||E.pop();)if(1===c.nodeType&&++d&&c===t){p[e]=[H,h,d];break}}else if(v&&(u=(t[U]||(t[U]={}))[e])&&u[0]===H)d=u[1];else for(;(c=++h&&c&&c[f]||(d=h=0)||E.pop())&&((a?c.nodeName.toLowerCase()!==g:1!==c.nodeType)||!++d||(v&&((c[U]||(c[U]={}))[e]=[H,d]),c!==t)););return d-=n,d===i||d%i===0&&d/i>=0}}},PSEUDO:function(e,r){var n,o=T.pseudos[e]||T.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return o[U]?o(r):o.length>1?(n=[e,e,"",r],T.setFilters.hasOwnProperty(e.toLowerCase())?i(function(e,t){for(var i,n=o(e,r),s=n.length;s--;)i=tt.call(e,n[s]),e[i]=!(t[i]=n[s])}):function(e){return o(e,0,n)}):o}},pseudos:{not:i(function(e){var t=[],r=[],n=S(e.replace(lt,"$1"));return n[U]?i(function(e,t,r,i){for(var o,s=n(e,null,i,[]),a=e.length;a--;)(o=s[a])&&(e[a]=!(t[a]=o))}):function(e,i,o){return t[0]=e,n(t,null,o,r),!r.pop()}}),has:i(function(e){return function(r){return t(e,r).length>0}}),contains:i(function(e){return function(t){return(t.textContent||t.innerText||I(t)).indexOf(e)>-1}}),lang:i(function(e){return ht.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(Lt,Tt).toLowerCase(),function(t){var r;do if(r=M?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return r=r.toLowerCase(),r===e||0===r.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var r=e.location&&e.location.hash;return r&&r.slice(1)===t.id},root:function(e){return e===_},focus:function(e){return e===D.activeElement&&(!D.hasFocus||D.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!T.pseudos.empty(e)},header:function(e){return mt.test(e.nodeName)},input:function(e){return ft.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:u(function(){return[0]}),last:u(function(e,t){return[t-1]}),eq:u(function(e,t,r){return[0>r?r+t:r]}),even:u(function(e,t){for(var r=0;t>r;r+=2)e.push(r);return e}),odd:u(function(e,t){for(var r=1;t>r;r+=2)e.push(r);return e}),lt:u(function(e,t,r){for(var i=0>r?r+t:r;--i>=0;)e.push(i);return e}),gt:u(function(e,t,r){for(var i=0>r?r+t:r;++i<t;)e.push(i);return e})}},T.pseudos.nth=T.pseudos.eq;for(N in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})T.pseudos[N]=a(N);for(N in{submit:!0,reset:!0})T.pseudos[N]=l(N);return c.prototype=T.filters=T.pseudos,T.setFilters=new c,A=t.tokenize=function(e,r){var i,n,o,s,a,l,u,p=W[e+" "];if(p)return r?0:p.slice(0);for(a=e,l=[],u=T.preFilter;a;){(!i||(n=ut.exec(a)))&&(n&&(a=a.slice(n[0].length)||a),l.push(o=[])),i=!1,(n=pt.exec(a))&&(i=n.shift(),o.push({value:i,type:n[0].replace(lt," ")}),a=a.slice(i.length));for(s in T.filter)!(n=Et[s].exec(a))||u[s]&&!(n=u[s](n))||(i=n.shift(),o.push({value:i,type:s,matches:n}),a=a.slice(i.length));if(!i)break}return r?a.length:a?t.error(e):W(e,l).slice(0)},S=t.compile=function(e,t){var r,i=[],n=[],o=q[e+" "];if(!o){for(t||(t=A(e)),r=t.length;r--;)o=v(t[r]),o[U]?i.push(o):n.push(o);o=q(e,x(n,i)),o.selector=e}return o},C=t.select=function(e,t,r,i){var n,o,s,a,l,u="function"==typeof e&&e,c=!i&&A(e=u.selector||e);if(r=r||[],1===c.length){if(o=c[0]=c[0].slice(0),o.length>2&&"ID"===(s=o[0]).type&&L.getById&&9===t.nodeType&&M&&T.relative[o[1].type]){if(t=(T.find.ID(s.matches[0].replace(Lt,Tt),t)||[])[0],!t)return r;u&&(t=t.parentNode),e=e.slice(o.shift().value.length)}for(n=Et.needsContext.test(e)?0:o.length;n--&&(s=o[n],!T.relative[a=s.type]);)if((l=T.find[a])&&(i=l(s.matches[0].replace(Lt,Tt),xt.test(o[0].type)&&p(t.parentNode)||t))){if(o.splice(n,1),e=i.length&&d(o),!e)return J.apply(r,i),r;break}}return(u||S(e,c))(i,t,!M,r,xt.test(e)&&p(t.parentNode)||t),r},L.sortStable=U.split("").sort(z).join("")===U,L.detectDuplicates=!!O,P(),L.sortDetached=n(function(e){return 1&e.compareDocumentPosition(D.createElement("div"))}),n(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||o("type|href|height|width",function(e,t,r){return r?void 0:e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),L.attributes&&n(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||o("value",function(e,t,r){return r||"input"!==e.nodeName.toLowerCase()?void 0:e.defaultValue}),n(function(e){return null==e.getAttribute("disabled")})||o(rt,function(e,t,r){var i;return r?void 0:e[t]===!0?t.toLowerCase():(i=e.getAttributeNode(t))&&i.specified?i.value:null}),t}(t);ot.find=pt,ot.expr=pt.selectors,ot.expr[":"]=ot.expr.pseudos,ot.unique=pt.uniqueSort,ot.text=pt.getText,ot.isXMLDoc=pt.isXML,ot.contains=pt.contains;var ct=ot.expr.match.needsContext,dt=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,ht=/^.[^:#\[\.,]*$/;ot.filter=function(e,t,r){var i=t[0];return r&&(e=":not("+e+")"),1===t.length&&1===i.nodeType?ot.find.matchesSelector(i,e)?[i]:[]:ot.find.matches(e,ot.grep(t,function(e){return 1===e.nodeType}))},ot.fn.extend({find:function(e){var t,r=[],i=this,n=i.length;if("string"!=typeof e)return this.pushStack(ot(e).filter(function(){for(t=0;n>t;t++)if(ot.contains(i[t],this))return!0}));for(t=0;n>t;t++)ot.find(e,i[t],r);return r=this.pushStack(n>1?ot.unique(r):r),r.selector=this.selector?this.selector+" "+e:e,r},filter:function(e){return this.pushStack(n(this,e||[],!1))},not:function(e){return this.pushStack(n(this,e||[],!0))},is:function(e){return!!n(this,"string"==typeof e&&ct.test(e)?ot(e):e||[],!1).length}});var Et,ft=t.document,mt=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,gt=ot.fn.init=function(e,t){var r,i;if(!e)return this;if("string"==typeof e){if(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:mt.exec(e),!r||!r[1]&&t)return!t||t.jquery?(t||Et).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof ot?t[0]:t,ot.merge(this,ot.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:ft,!0)),dt.test(r[1])&&ot.isPlainObject(t))for(r in t)ot.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}if(i=ft.getElementById(r[2]),i&&i.parentNode){if(i.id!==r[2])return Et.find(e);this.length=1,this[0]=i}return this.context=ft,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):ot.isFunction(e)?"undefined"!=typeof Et.ready?Et.ready(e):e(ot):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),ot.makeArray(e,this))};gt.prototype=ot.fn,Et=ot(ft);var vt=/^(?:parents|prev(?:Until|All))/,xt={children:!0,contents:!0,next:!0,prev:!0};ot.extend({dir:function(e,t,r){for(var i=[],n=e[t];n&&9!==n.nodeType&&(void 0===r||1!==n.nodeType||!ot(n).is(r));)1===n.nodeType&&i.push(n),n=n[t];return i},sibling:function(e,t){for(var r=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&r.push(e);return r}}),ot.fn.extend({has:function(e){var t,r=ot(e,this),i=r.length;return this.filter(function(){for(t=0;i>t;t++)if(ot.contains(this,r[t]))return!0})},closest:function(e,t){for(var r,i=0,n=this.length,o=[],s=ct.test(e)||"string"!=typeof e?ot(e,t||this.context):0;n>i;i++)for(r=this[i];r&&r!==t;r=r.parentNode)if(r.nodeType<11&&(s?s.index(r)>-1:1===r.nodeType&&ot.find.matchesSelector(r,e))){o.push(r);break}return this.pushStack(o.length>1?ot.unique(o):o)},index:function(e){return e?"string"==typeof e?ot.inArray(this[0],ot(e)):ot.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(ot.unique(ot.merge(this.get(),ot(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),ot.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return ot.dir(e,"parentNode")},parentsUntil:function(e,t,r){return ot.dir(e,"parentNode",r)},next:function(e){return o(e,"nextSibling")},prev:function(e){return o(e,"previousSibling")},nextAll:function(e){return ot.dir(e,"nextSibling")},prevAll:function(e){return ot.dir(e,"previousSibling")},nextUntil:function(e,t,r){return ot.dir(e,"nextSibling",r)},prevUntil:function(e,t,r){return ot.dir(e,"previousSibling",r)},siblings:function(e){return ot.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return ot.sibling(e.firstChild)},contents:function(e){return ot.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:ot.merge([],e.childNodes)}},function(e,t){ot.fn[e]=function(r,i){var n=ot.map(this,t,r);return"Until"!==e.slice(-5)&&(i=r),i&&"string"==typeof i&&(n=ot.filter(i,n)),this.length>1&&(xt[e]||(n=ot.unique(n)),vt.test(e)&&(n=n.reverse())),this.pushStack(n)}});var Nt=/\S+/g,Lt={};ot.Callbacks=function(e){e="string"==typeof e?Lt[e]||s(e):ot.extend({},e);var t,r,i,n,o,a,l=[],u=!e.once&&[],p=function(s){for(r=e.memory&&s,i=!0,o=a||0,a=0,n=l.length,t=!0;l&&n>o;o++)if(l[o].apply(s[0],s[1])===!1&&e.stopOnFalse){r=!1;break}t=!1,l&&(u?u.length&&p(u.shift()):r?l=[]:c.disable())},c={add:function(){if(l){var i=l.length;!function o(t){ot.each(t,function(t,r){var i=ot.type(r);"function"===i?e.unique&&c.has(r)||l.push(r):r&&r.length&&"string"!==i&&o(r)})}(arguments),t?n=l.length:r&&(a=i,p(r))}return this},remove:function(){return l&&ot.each(arguments,function(e,r){for(var i;(i=ot.inArray(r,l,i))>-1;)l.splice(i,1),t&&(n>=i&&n--,o>=i&&o--)}),this},has:function(e){return e?ot.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],n=0,this},disable:function(){return l=u=r=void 0,this},disabled:function(){return!l},lock:function(){return u=void 0,r||c.disable(),this},locked:function(){return!u},fireWith:function(e,r){return!l||i&&!u||(r=r||[],r=[e,r.slice?r.slice():r],t?u.push(r):p(r)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!i}};return c},ot.extend({Deferred:function(e){var t=[["resolve","done",ot.Callbacks("once memory"),"resolved"],["reject","fail",ot.Callbacks("once memory"),"rejected"],["notify","progress",ot.Callbacks("memory")]],r="pending",i={state:function(){return r},always:function(){return n.done(arguments).fail(arguments),this},then:function(){var e=arguments;return ot.Deferred(function(r){ot.each(t,function(t,o){var s=ot.isFunction(e[t])&&e[t];n[o[1]](function(){var e=s&&s.apply(this,arguments);e&&ot.isFunction(e.promise)?e.promise().done(r.resolve).fail(r.reject).progress(r.notify):r[o[0]+"With"](this===i?r.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?ot.extend(e,i):i}},n={};return i.pipe=i.then,ot.each(t,function(e,o){var s=o[2],a=o[3];i[o[1]]=s.add,a&&s.add(function(){r=a},t[1^e][2].disable,t[2][2].lock),n[o[0]]=function(){return n[o[0]+"With"](this===n?i:this,arguments),this},n[o[0]+"With"]=s.fireWith}),i.promise(n),e&&e.call(n,n),n},when:function(e){var t,r,i,n=0,o=$.call(arguments),s=o.length,a=1!==s||e&&ot.isFunction(e.promise)?s:0,l=1===a?e:ot.Deferred(),u=function(e,r,i){return function(n){r[e]=this,i[e]=arguments.length>1?$.call(arguments):n,i===t?l.notifyWith(r,i):--a||l.resolveWith(r,i)}};if(s>1)for(t=new Array(s),r=new Array(s),i=new Array(s);s>n;n++)o[n]&&ot.isFunction(o[n].promise)?o[n].promise().done(u(n,i,o)).fail(l.reject).progress(u(n,r,t)):--a;return a||l.resolveWith(i,o),l.promise()}});var Tt;ot.fn.ready=function(e){return ot.ready.promise().done(e),this},ot.extend({isReady:!1,readyWait:1,holdReady:function(e){e?ot.readyWait++:ot.ready(!0)},ready:function(e){if(e===!0?!--ot.readyWait:!ot.isReady){if(!ft.body)return setTimeout(ot.ready);ot.isReady=!0,e!==!0&&--ot.readyWait>0||(Tt.resolveWith(ft,[ot]),ot.fn.triggerHandler&&(ot(ft).triggerHandler("ready"),ot(ft).off("ready")))}}}),ot.ready.promise=function(e){if(!Tt)if(Tt=ot.Deferred(),"complete"===ft.readyState)setTimeout(ot.ready);else if(ft.addEventListener)ft.addEventListener("DOMContentLoaded",l,!1),t.addEventListener("load",l,!1);else{ft.attachEvent("onreadystatechange",l),t.attachEvent("onload",l);var r=!1;try{r=null==t.frameElement&&ft.documentElement}catch(i){}r&&r.doScroll&&!function n(){if(!ot.isReady){try{r.doScroll("left")
}catch(e){return setTimeout(n,50)}a(),ot.ready()}}()}return Tt.promise(e)};var It,yt="undefined";for(It in ot(it))break;it.ownLast="0"!==It,it.inlineBlockNeedsLayout=!1,ot(function(){var e,t,r,i;r=ft.getElementsByTagName("body")[0],r&&r.style&&(t=ft.createElement("div"),i=ft.createElement("div"),i.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",r.appendChild(i).appendChild(t),typeof t.style.zoom!==yt&&(t.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",it.inlineBlockNeedsLayout=e=3===t.offsetWidth,e&&(r.style.zoom=1)),r.removeChild(i))}),function(){var e=ft.createElement("div");if(null==it.deleteExpando){it.deleteExpando=!0;try{delete e.test}catch(t){it.deleteExpando=!1}}e=null}(),ot.acceptData=function(e){var t=ot.noData[(e.nodeName+" ").toLowerCase()],r=+e.nodeType||1;return 1!==r&&9!==r?!1:!t||t!==!0&&e.getAttribute("classid")===t};var At=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,St=/([A-Z])/g;ot.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?ot.cache[e[ot.expando]]:e[ot.expando],!!e&&!p(e)},data:function(e,t,r){return c(e,t,r)},removeData:function(e,t){return d(e,t)},_data:function(e,t,r){return c(e,t,r,!0)},_removeData:function(e,t){return d(e,t,!0)}}),ot.fn.extend({data:function(e,t){var r,i,n,o=this[0],s=o&&o.attributes;if(void 0===e){if(this.length&&(n=ot.data(o),1===o.nodeType&&!ot._data(o,"parsedAttrs"))){for(r=s.length;r--;)s[r]&&(i=s[r].name,0===i.indexOf("data-")&&(i=ot.camelCase(i.slice(5)),u(o,i,n[i])));ot._data(o,"parsedAttrs",!0)}return n}return"object"==typeof e?this.each(function(){ot.data(this,e)}):arguments.length>1?this.each(function(){ot.data(this,e,t)}):o?u(o,e,ot.data(o,e)):void 0},removeData:function(e){return this.each(function(){ot.removeData(this,e)})}}),ot.extend({queue:function(e,t,r){var i;return e?(t=(t||"fx")+"queue",i=ot._data(e,t),r&&(!i||ot.isArray(r)?i=ot._data(e,t,ot.makeArray(r)):i.push(r)),i||[]):void 0},dequeue:function(e,t){t=t||"fx";var r=ot.queue(e,t),i=r.length,n=r.shift(),o=ot._queueHooks(e,t),s=function(){ot.dequeue(e,t)};"inprogress"===n&&(n=r.shift(),i--),n&&("fx"===t&&r.unshift("inprogress"),delete o.stop,n.call(e,s,o)),!i&&o&&o.empty.fire()},_queueHooks:function(e,t){var r=t+"queueHooks";return ot._data(e,r)||ot._data(e,r,{empty:ot.Callbacks("once memory").add(function(){ot._removeData(e,t+"queue"),ot._removeData(e,r)})})}}),ot.fn.extend({queue:function(e,t){var r=2;return"string"!=typeof e&&(t=e,e="fx",r--),arguments.length<r?ot.queue(this[0],e):void 0===t?this:this.each(function(){var r=ot.queue(this,e,t);ot._queueHooks(this,e),"fx"===e&&"inprogress"!==r[0]&&ot.dequeue(this,e)})},dequeue:function(e){return this.each(function(){ot.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var r,i=1,n=ot.Deferred(),o=this,s=this.length,a=function(){--i||n.resolveWith(o,[o])};for("string"!=typeof e&&(t=e,e=void 0),e=e||"fx";s--;)r=ot._data(o[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(a));return a(),n.promise(t)}});var Ct=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,Rt=["Top","Right","Bottom","Left"],bt=function(e,t){return e=t||e,"none"===ot.css(e,"display")||!ot.contains(e.ownerDocument,e)},Ot=ot.access=function(e,t,r,i,n,o,s){var a=0,l=e.length,u=null==r;if("object"===ot.type(r)){n=!0;for(a in r)ot.access(e,t,a,r[a],!0,o,s)}else if(void 0!==i&&(n=!0,ot.isFunction(i)||(s=!0),u&&(s?(t.call(e,i),t=null):(u=t,t=function(e,t,r){return u.call(ot(e),r)})),t))for(;l>a;a++)t(e[a],r,s?i:i.call(e[a],a,t(e[a],r)));return n?e:u?t.call(e):l?t(e[0],r):o},Pt=/^(?:checkbox|radio)$/i;!function(){var e=ft.createElement("input"),t=ft.createElement("div"),r=ft.createDocumentFragment();if(t.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",it.leadingWhitespace=3===t.firstChild.nodeType,it.tbody=!t.getElementsByTagName("tbody").length,it.htmlSerialize=!!t.getElementsByTagName("link").length,it.html5Clone="<:nav></:nav>"!==ft.createElement("nav").cloneNode(!0).outerHTML,e.type="checkbox",e.checked=!0,r.appendChild(e),it.appendChecked=e.checked,t.innerHTML="<textarea>x</textarea>",it.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue,r.appendChild(t),t.innerHTML="<input type='radio' checked='checked' name='t'/>",it.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,it.noCloneEvent=!0,t.attachEvent&&(t.attachEvent("onclick",function(){it.noCloneEvent=!1}),t.cloneNode(!0).click()),null==it.deleteExpando){it.deleteExpando=!0;try{delete t.test}catch(i){it.deleteExpando=!1}}}(),function(){var e,r,i=ft.createElement("div");for(e in{submit:!0,change:!0,focusin:!0})r="on"+e,(it[e+"Bubbles"]=r in t)||(i.setAttribute(r,"t"),it[e+"Bubbles"]=i.attributes[r].expando===!1);i=null}();var Dt=/^(?:input|select|textarea)$/i,_t=/^key/,Mt=/^(?:mouse|pointer|contextmenu)|click/,wt=/^(?:focusinfocus|focusoutblur)$/,Gt=/^([^.]*)(?:\.(.+)|)$/;ot.event={global:{},add:function(e,t,r,i,n){var o,s,a,l,u,p,c,d,h,E,f,m=ot._data(e);if(m){for(r.handler&&(l=r,r=l.handler,n=l.selector),r.guid||(r.guid=ot.guid++),(s=m.events)||(s=m.events={}),(p=m.handle)||(p=m.handle=function(e){return typeof ot===yt||e&&ot.event.triggered===e.type?void 0:ot.event.dispatch.apply(p.elem,arguments)},p.elem=e),t=(t||"").match(Nt)||[""],a=t.length;a--;)o=Gt.exec(t[a])||[],h=f=o[1],E=(o[2]||"").split(".").sort(),h&&(u=ot.event.special[h]||{},h=(n?u.delegateType:u.bindType)||h,u=ot.event.special[h]||{},c=ot.extend({type:h,origType:f,data:i,handler:r,guid:r.guid,selector:n,needsContext:n&&ot.expr.match.needsContext.test(n),namespace:E.join(".")},l),(d=s[h])||(d=s[h]=[],d.delegateCount=0,u.setup&&u.setup.call(e,i,E,p)!==!1||(e.addEventListener?e.addEventListener(h,p,!1):e.attachEvent&&e.attachEvent("on"+h,p))),u.add&&(u.add.call(e,c),c.handler.guid||(c.handler.guid=r.guid)),n?d.splice(d.delegateCount++,0,c):d.push(c),ot.event.global[h]=!0);e=null}},remove:function(e,t,r,i,n){var o,s,a,l,u,p,c,d,h,E,f,m=ot.hasData(e)&&ot._data(e);if(m&&(p=m.events)){for(t=(t||"").match(Nt)||[""],u=t.length;u--;)if(a=Gt.exec(t[u])||[],h=f=a[1],E=(a[2]||"").split(".").sort(),h){for(c=ot.event.special[h]||{},h=(i?c.delegateType:c.bindType)||h,d=p[h]||[],a=a[2]&&new RegExp("(^|\\.)"+E.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=d.length;o--;)s=d[o],!n&&f!==s.origType||r&&r.guid!==s.guid||a&&!a.test(s.namespace)||i&&i!==s.selector&&("**"!==i||!s.selector)||(d.splice(o,1),s.selector&&d.delegateCount--,c.remove&&c.remove.call(e,s));l&&!d.length&&(c.teardown&&c.teardown.call(e,E,m.handle)!==!1||ot.removeEvent(e,h,m.handle),delete p[h])}else for(h in p)ot.event.remove(e,h+t[u],r,i,!0);ot.isEmptyObject(p)&&(delete m.handle,ot._removeData(e,"events"))}},trigger:function(e,r,i,n){var o,s,a,l,u,p,c,d=[i||ft],h=rt.call(e,"type")?e.type:e,E=rt.call(e,"namespace")?e.namespace.split("."):[];if(a=p=i=i||ft,3!==i.nodeType&&8!==i.nodeType&&!wt.test(h+ot.event.triggered)&&(h.indexOf(".")>=0&&(E=h.split("."),h=E.shift(),E.sort()),s=h.indexOf(":")<0&&"on"+h,e=e[ot.expando]?e:new ot.Event(h,"object"==typeof e&&e),e.isTrigger=n?2:3,e.namespace=E.join("."),e.namespace_re=e.namespace?new RegExp("(^|\\.)"+E.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=i),r=null==r?[e]:ot.makeArray(r,[e]),u=ot.event.special[h]||{},n||!u.trigger||u.trigger.apply(i,r)!==!1)){if(!n&&!u.noBubble&&!ot.isWindow(i)){for(l=u.delegateType||h,wt.test(l+h)||(a=a.parentNode);a;a=a.parentNode)d.push(a),p=a;p===(i.ownerDocument||ft)&&d.push(p.defaultView||p.parentWindow||t)}for(c=0;(a=d[c++])&&!e.isPropagationStopped();)e.type=c>1?l:u.bindType||h,o=(ot._data(a,"events")||{})[e.type]&&ot._data(a,"handle"),o&&o.apply(a,r),o=s&&a[s],o&&o.apply&&ot.acceptData(a)&&(e.result=o.apply(a,r),e.result===!1&&e.preventDefault());if(e.type=h,!n&&!e.isDefaultPrevented()&&(!u._default||u._default.apply(d.pop(),r)===!1)&&ot.acceptData(i)&&s&&i[h]&&!ot.isWindow(i)){p=i[s],p&&(i[s]=null),ot.event.triggered=h;try{i[h]()}catch(f){}ot.event.triggered=void 0,p&&(i[s]=p)}return e.result}},dispatch:function(e){e=ot.event.fix(e);var t,r,i,n,o,s=[],a=$.call(arguments),l=(ot._data(this,"events")||{})[e.type]||[],u=ot.event.special[e.type]||{};if(a[0]=e,e.delegateTarget=this,!u.preDispatch||u.preDispatch.call(this,e)!==!1){for(s=ot.event.handlers.call(this,e,l),t=0;(n=s[t++])&&!e.isPropagationStopped();)for(e.currentTarget=n.elem,o=0;(i=n.handlers[o++])&&!e.isImmediatePropagationStopped();)(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((ot.event.special[i.origType]||{}).handle||i.handler).apply(n.elem,a),void 0!==r&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()));return u.postDispatch&&u.postDispatch.call(this,e),e.result}},handlers:function(e,t){var r,i,n,o,s=[],a=t.delegateCount,l=e.target;if(a&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(n=[],o=0;a>o;o++)i=t[o],r=i.selector+" ",void 0===n[r]&&(n[r]=i.needsContext?ot(r,this).index(l)>=0:ot.find(r,this,null,[l]).length),n[r]&&n.push(i);n.length&&s.push({elem:l,handlers:n})}return a<t.length&&s.push({elem:this,handlers:t.slice(a)}),s},fix:function(e){if(e[ot.expando])return e;var t,r,i,n=e.type,o=e,s=this.fixHooks[n];for(s||(this.fixHooks[n]=s=Mt.test(n)?this.mouseHooks:_t.test(n)?this.keyHooks:{}),i=s.props?this.props.concat(s.props):this.props,e=new ot.Event(o),t=i.length;t--;)r=i[t],e[r]=o[r];return e.target||(e.target=o.srcElement||ft),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,o):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,t){var r,i,n,o=t.button,s=t.fromElement;return null==e.pageX&&null!=t.clientX&&(i=e.target.ownerDocument||ft,n=i.documentElement,r=i.body,e.pageX=t.clientX+(n&&n.scrollLeft||r&&r.scrollLeft||0)-(n&&n.clientLeft||r&&r.clientLeft||0),e.pageY=t.clientY+(n&&n.scrollTop||r&&r.scrollTop||0)-(n&&n.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&s&&(e.relatedTarget=s===e.target?t.toElement:s),e.which||void 0===o||(e.which=1&o?1:2&o?3:4&o?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==f()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===f()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return ot.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(e){return ot.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,r,i){var n=ot.extend(new ot.Event,r,{type:e,isSimulated:!0,originalEvent:{}});i?ot.event.trigger(n,null,t):ot.event.dispatch.call(t,n),n.isDefaultPrevented()&&r.preventDefault()}},ot.removeEvent=ft.removeEventListener?function(e,t,r){e.removeEventListener&&e.removeEventListener(t,r,!1)}:function(e,t,r){var i="on"+t;e.detachEvent&&(typeof e[i]===yt&&(e[i]=null),e.detachEvent(i,r))},ot.Event=function(e,t){return this instanceof ot.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&e.returnValue===!1?h:E):this.type=e,t&&ot.extend(this,t),this.timeStamp=e&&e.timeStamp||ot.now(),void(this[ot.expando]=!0)):new ot.Event(e,t)},ot.Event.prototype={isDefaultPrevented:E,isPropagationStopped:E,isImmediatePropagationStopped:E,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=h,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=h,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=h,e&&e.stopImmediatePropagation&&e.stopImmediatePropagation(),this.stopPropagation()}},ot.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){ot.event.special[e]={delegateType:t,bindType:t,handle:function(e){var r,i=this,n=e.relatedTarget,o=e.handleObj;return(!n||n!==i&&!ot.contains(i,n))&&(e.type=o.origType,r=o.handler.apply(this,arguments),e.type=t),r}}}),it.submitBubbles||(ot.event.special.submit={setup:function(){return ot.nodeName(this,"form")?!1:void ot.event.add(this,"click._submit keypress._submit",function(e){var t=e.target,r=ot.nodeName(t,"input")||ot.nodeName(t,"button")?t.form:void 0;r&&!ot._data(r,"submitBubbles")&&(ot.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),ot._data(r,"submitBubbles",!0))})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&ot.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return ot.nodeName(this,"form")?!1:void ot.event.remove(this,"._submit")}}),it.changeBubbles||(ot.event.special.change={setup:function(){return Dt.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(ot.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),ot.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),ot.event.simulate("change",this,e,!0)})),!1):void ot.event.add(this,"beforeactivate._change",function(e){var t=e.target;Dt.test(t.nodeName)&&!ot._data(t,"changeBubbles")&&(ot.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||ot.event.simulate("change",this.parentNode,e,!0)}),ot._data(t,"changeBubbles",!0))})},handle:function(e){var t=e.target;return this!==t||e.isSimulated||e.isTrigger||"radio"!==t.type&&"checkbox"!==t.type?e.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return ot.event.remove(this,"._change"),!Dt.test(this.nodeName)}}),it.focusinBubbles||ot.each({focus:"focusin",blur:"focusout"},function(e,t){var r=function(e){ot.event.simulate(t,e.target,ot.event.fix(e),!0)};ot.event.special[t]={setup:function(){var i=this.ownerDocument||this,n=ot._data(i,t);n||i.addEventListener(e,r,!0),ot._data(i,t,(n||0)+1)},teardown:function(){var i=this.ownerDocument||this,n=ot._data(i,t)-1;n?ot._data(i,t,n):(i.removeEventListener(e,r,!0),ot._removeData(i,t))}}}),ot.fn.extend({on:function(e,t,r,i,n){var o,s;if("object"==typeof e){"string"!=typeof t&&(r=r||t,t=void 0);for(o in e)this.on(o,t,r,e[o],n);return this}if(null==r&&null==i?(i=t,r=t=void 0):null==i&&("string"==typeof t?(i=r,r=void 0):(i=r,r=t,t=void 0)),i===!1)i=E;else if(!i)return this;return 1===n&&(s=i,i=function(e){return ot().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=ot.guid++)),this.each(function(){ot.event.add(this,e,i,r,t)})},one:function(e,t,r,i){return this.on(e,t,r,i,1)},off:function(e,t,r){var i,n;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,ot(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(n in e)this.off(n,t,e[n]);return this}return(t===!1||"function"==typeof t)&&(r=t,t=void 0),r===!1&&(r=E),this.each(function(){ot.event.remove(this,e,r,t)})},trigger:function(e,t){return this.each(function(){ot.event.trigger(e,t,this)})},triggerHandler:function(e,t){var r=this[0];return r?ot.event.trigger(e,t,r,!0):void 0}});var kt="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",Bt=/ jQuery\d+="(?:null|\d+)"/g,Ut=new RegExp("<(?:"+kt+")[\\s/>]","i"),Vt=/^\s+/,Ht=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Ft=/<([\w:]+)/,jt=/<tbody/i,Wt=/<|&#?\w+;/,qt=/<(?:script|style|link)/i,zt=/checked\s*(?:[^=]|=\s*.checked.)/i,Xt=/^$|\/(?:java|ecma)script/i,Yt=/^true\/(.*)/,Kt=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,$t={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:it.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},Qt=m(ft),Zt=Qt.appendChild(ft.createElement("div"));$t.optgroup=$t.option,$t.tbody=$t.tfoot=$t.colgroup=$t.caption=$t.thead,$t.th=$t.td,ot.extend({clone:function(e,t,r){var i,n,o,s,a,l=ot.contains(e.ownerDocument,e);if(it.html5Clone||ot.isXMLDoc(e)||!Ut.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Zt.innerHTML=e.outerHTML,Zt.removeChild(o=Zt.firstChild)),!(it.noCloneEvent&&it.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||ot.isXMLDoc(e)))for(i=g(o),a=g(e),s=0;null!=(n=a[s]);++s)i[s]&&y(n,i[s]);if(t)if(r)for(a=a||g(e),i=i||g(o),s=0;null!=(n=a[s]);s++)I(n,i[s]);else I(e,o);return i=g(o,"script"),i.length>0&&T(i,!l&&g(e,"script")),i=a=n=null,o},buildFragment:function(e,t,r,i){for(var n,o,s,a,l,u,p,c=e.length,d=m(t),h=[],E=0;c>E;E++)if(o=e[E],o||0===o)if("object"===ot.type(o))ot.merge(h,o.nodeType?[o]:o);else if(Wt.test(o)){for(a=a||d.appendChild(t.createElement("div")),l=(Ft.exec(o)||["",""])[1].toLowerCase(),p=$t[l]||$t._default,a.innerHTML=p[1]+o.replace(Ht,"<$1></$2>")+p[2],n=p[0];n--;)a=a.lastChild;if(!it.leadingWhitespace&&Vt.test(o)&&h.push(t.createTextNode(Vt.exec(o)[0])),!it.tbody)for(o="table"!==l||jt.test(o)?"<table>"!==p[1]||jt.test(o)?0:a:a.firstChild,n=o&&o.childNodes.length;n--;)ot.nodeName(u=o.childNodes[n],"tbody")&&!u.childNodes.length&&o.removeChild(u);for(ot.merge(h,a.childNodes),a.textContent="";a.firstChild;)a.removeChild(a.firstChild);a=d.lastChild}else h.push(t.createTextNode(o));for(a&&d.removeChild(a),it.appendChecked||ot.grep(g(h,"input"),v),E=0;o=h[E++];)if((!i||-1===ot.inArray(o,i))&&(s=ot.contains(o.ownerDocument,o),a=g(d.appendChild(o),"script"),s&&T(a),r))for(n=0;o=a[n++];)Xt.test(o.type||"")&&r.push(o);return a=null,d},cleanData:function(e,t){for(var r,i,n,o,s=0,a=ot.expando,l=ot.cache,u=it.deleteExpando,p=ot.event.special;null!=(r=e[s]);s++)if((t||ot.acceptData(r))&&(n=r[a],o=n&&l[n])){if(o.events)for(i in o.events)p[i]?ot.event.remove(r,i):ot.removeEvent(r,i,o.handle);l[n]&&(delete l[n],u?delete r[a]:typeof r.removeAttribute!==yt?r.removeAttribute(a):r[a]=null,K.push(n))}}}),ot.fn.extend({text:function(e){return Ot(this,function(e){return void 0===e?ot.text(this):this.empty().append((this[0]&&this[0].ownerDocument||ft).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=x(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=x(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){for(var r,i=e?ot.filter(e,this):this,n=0;null!=(r=i[n]);n++)t||1!==r.nodeType||ot.cleanData(g(r)),r.parentNode&&(t&&ot.contains(r.ownerDocument,r)&&T(g(r,"script")),r.parentNode.removeChild(r));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++){for(1===e.nodeType&&ot.cleanData(g(e,!1));e.firstChild;)e.removeChild(e.firstChild);e.options&&ot.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return ot.clone(this,e,t)})},html:function(e){return Ot(this,function(e){var t=this[0]||{},r=0,i=this.length;if(void 0===e)return 1===t.nodeType?t.innerHTML.replace(Bt,""):void 0;if(!("string"!=typeof e||qt.test(e)||!it.htmlSerialize&&Ut.test(e)||!it.leadingWhitespace&&Vt.test(e)||$t[(Ft.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(Ht,"<$1></$2>");try{for(;i>r;r++)t=this[r]||{},1===t.nodeType&&(ot.cleanData(g(t,!1)),t.innerHTML=e);t=0}catch(n){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=arguments[0];return this.domManip(arguments,function(t){e=this.parentNode,ot.cleanData(g(this)),e&&e.replaceChild(t,this)}),e&&(e.length||e.nodeType)?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t){e=Q.apply([],e);var r,i,n,o,s,a,l=0,u=this.length,p=this,c=u-1,d=e[0],h=ot.isFunction(d);if(h||u>1&&"string"==typeof d&&!it.checkClone&&zt.test(d))return this.each(function(r){var i=p.eq(r);h&&(e[0]=d.call(this,r,i.html())),i.domManip(e,t)});if(u&&(a=ot.buildFragment(e,this[0].ownerDocument,!1,this),r=a.firstChild,1===a.childNodes.length&&(a=r),r)){for(o=ot.map(g(a,"script"),N),n=o.length;u>l;l++)i=a,l!==c&&(i=ot.clone(i,!0,!0),n&&ot.merge(o,g(i,"script"))),t.call(this[l],i,l);if(n)for(s=o[o.length-1].ownerDocument,ot.map(o,L),l=0;n>l;l++)i=o[l],Xt.test(i.type||"")&&!ot._data(i,"globalEval")&&ot.contains(s,i)&&(i.src?ot._evalUrl&&ot._evalUrl(i.src):ot.globalEval((i.text||i.textContent||i.innerHTML||"").replace(Kt,"")));a=r=null}return this}}),ot.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){ot.fn[e]=function(e){for(var r,i=0,n=[],o=ot(e),s=o.length-1;s>=i;i++)r=i===s?this:this.clone(!0),ot(o[i])[t](r),Z.apply(n,r.get());return this.pushStack(n)}});var Jt,er={};!function(){var e;it.shrinkWrapBlocks=function(){if(null!=e)return e;e=!1;var t,r,i;return r=ft.getElementsByTagName("body")[0],r&&r.style?(t=ft.createElement("div"),i=ft.createElement("div"),i.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",r.appendChild(i).appendChild(t),typeof t.style.zoom!==yt&&(t.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",t.appendChild(ft.createElement("div")).style.width="5px",e=3!==t.offsetWidth),r.removeChild(i),e):void 0}}();var tr,rr,ir=/^margin/,nr=new RegExp("^("+Ct+")(?!px)[a-z%]+$","i"),or=/^(top|right|bottom|left)$/;t.getComputedStyle?(tr=function(e){return e.ownerDocument.defaultView.getComputedStyle(e,null)},rr=function(e,t,r){var i,n,o,s,a=e.style;return r=r||tr(e),s=r?r.getPropertyValue(t)||r[t]:void 0,r&&(""!==s||ot.contains(e.ownerDocument,e)||(s=ot.style(e,t)),nr.test(s)&&ir.test(t)&&(i=a.width,n=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=s,s=r.width,a.width=i,a.minWidth=n,a.maxWidth=o)),void 0===s?s:s+""}):ft.documentElement.currentStyle&&(tr=function(e){return e.currentStyle},rr=function(e,t,r){var i,n,o,s,a=e.style;return r=r||tr(e),s=r?r[t]:void 0,null==s&&a&&a[t]&&(s=a[t]),nr.test(s)&&!or.test(t)&&(i=a.left,n=e.runtimeStyle,o=n&&n.left,o&&(n.left=e.currentStyle.left),a.left="fontSize"===t?"1em":s,s=a.pixelLeft+"px",a.left=i,o&&(n.left=o)),void 0===s?s:s+""||"auto"}),function(){function e(){var e,r,i,n;r=ft.getElementsByTagName("body")[0],r&&r.style&&(e=ft.createElement("div"),i=ft.createElement("div"),i.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",r.appendChild(i).appendChild(e),e.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",o=s=!1,l=!0,t.getComputedStyle&&(o="1%"!==(t.getComputedStyle(e,null)||{}).top,s="4px"===(t.getComputedStyle(e,null)||{width:"4px"}).width,n=e.appendChild(ft.createElement("div")),n.style.cssText=e.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",n.style.marginRight=n.style.width="0",e.style.width="1px",l=!parseFloat((t.getComputedStyle(n,null)||{}).marginRight)),e.innerHTML="<table><tr><td></td><td>t</td></tr></table>",n=e.getElementsByTagName("td"),n[0].style.cssText="margin:0;border:0;padding:0;display:none",a=0===n[0].offsetHeight,a&&(n[0].style.display="",n[1].style.display="none",a=0===n[0].offsetHeight),r.removeChild(i))}var r,i,n,o,s,a,l;r=ft.createElement("div"),r.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=r.getElementsByTagName("a")[0],i=n&&n.style,i&&(i.cssText="float:left;opacity:.5",it.opacity="0.5"===i.opacity,it.cssFloat=!!i.cssFloat,r.style.backgroundClip="content-box",r.cloneNode(!0).style.backgroundClip="",it.clearCloneStyle="content-box"===r.style.backgroundClip,it.boxSizing=""===i.boxSizing||""===i.MozBoxSizing||""===i.WebkitBoxSizing,ot.extend(it,{reliableHiddenOffsets:function(){return null==a&&e(),a},boxSizingReliable:function(){return null==s&&e(),s},pixelPosition:function(){return null==o&&e(),o},reliableMarginRight:function(){return null==l&&e(),l}}))}(),ot.swap=function(e,t,r,i){var n,o,s={};for(o in t)s[o]=e.style[o],e.style[o]=t[o];n=r.apply(e,i||[]);for(o in t)e.style[o]=s[o];return n};var sr=/alpha\([^)]*\)/i,ar=/opacity\s*=\s*([^)]*)/,lr=/^(none|table(?!-c[ea]).+)/,ur=new RegExp("^("+Ct+")(.*)$","i"),pr=new RegExp("^([+-])=("+Ct+")","i"),cr={position:"absolute",visibility:"hidden",display:"block"},dr={letterSpacing:"0",fontWeight:"400"},hr=["Webkit","O","Moz","ms"];ot.extend({cssHooks:{opacity:{get:function(e,t){if(t){var r=rr(e,"opacity");return""===r?"1":r}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":it.cssFloat?"cssFloat":"styleFloat"},style:function(e,t,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var n,o,s,a=ot.camelCase(t),l=e.style;if(t=ot.cssProps[a]||(ot.cssProps[a]=R(l,a)),s=ot.cssHooks[t]||ot.cssHooks[a],void 0===r)return s&&"get"in s&&void 0!==(n=s.get(e,!1,i))?n:l[t];if(o=typeof r,"string"===o&&(n=pr.exec(r))&&(r=(n[1]+1)*n[2]+parseFloat(ot.css(e,t)),o="number"),null!=r&&r===r&&("number"!==o||ot.cssNumber[a]||(r+="px"),it.clearCloneStyle||""!==r||0!==t.indexOf("background")||(l[t]="inherit"),!(s&&"set"in s&&void 0===(r=s.set(e,r,i)))))try{l[t]=r}catch(u){}}},css:function(e,t,r,i){var n,o,s,a=ot.camelCase(t);return t=ot.cssProps[a]||(ot.cssProps[a]=R(e.style,a)),s=ot.cssHooks[t]||ot.cssHooks[a],s&&"get"in s&&(o=s.get(e,!0,r)),void 0===o&&(o=rr(e,t,i)),"normal"===o&&t in dr&&(o=dr[t]),""===r||r?(n=parseFloat(o),r===!0||ot.isNumeric(n)?n||0:o):o}}),ot.each(["height","width"],function(e,t){ot.cssHooks[t]={get:function(e,r,i){return r?lr.test(ot.css(e,"display"))&&0===e.offsetWidth?ot.swap(e,cr,function(){return D(e,t,i)}):D(e,t,i):void 0},set:function(e,r,i){var n=i&&tr(e);return O(e,r,i?P(e,t,i,it.boxSizing&&"border-box"===ot.css(e,"boxSizing",!1,n),n):0)}}}),it.opacity||(ot.cssHooks.opacity={get:function(e,t){return ar.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var r=e.style,i=e.currentStyle,n=ot.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=i&&i.filter||r.filter||"";r.zoom=1,(t>=1||""===t)&&""===ot.trim(o.replace(sr,""))&&r.removeAttribute&&(r.removeAttribute("filter"),""===t||i&&!i.filter)||(r.filter=sr.test(o)?o.replace(sr,n):o+" "+n)}}),ot.cssHooks.marginRight=C(it.reliableMarginRight,function(e,t){return t?ot.swap(e,{display:"inline-block"},rr,[e,"marginRight"]):void 0}),ot.each({margin:"",padding:"",border:"Width"},function(e,t){ot.cssHooks[e+t]={expand:function(r){for(var i=0,n={},o="string"==typeof r?r.split(" "):[r];4>i;i++)n[e+Rt[i]+t]=o[i]||o[i-2]||o[0];return n}},ir.test(e)||(ot.cssHooks[e+t].set=O)}),ot.fn.extend({css:function(e,t){return Ot(this,function(e,t,r){var i,n,o={},s=0;if(ot.isArray(t)){for(i=tr(e),n=t.length;n>s;s++)o[t[s]]=ot.css(e,t[s],!1,i);return o}return void 0!==r?ot.style(e,t,r):ot.css(e,t)},e,t,arguments.length>1)},show:function(){return b(this,!0)},hide:function(){return b(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){bt(this)?ot(this).show():ot(this).hide()})}}),ot.Tween=_,_.prototype={constructor:_,init:function(e,t,r,i,n,o){this.elem=e,this.prop=r,this.easing=n||"swing",this.options=t,this.start=this.now=this.cur(),this.end=i,this.unit=o||(ot.cssNumber[r]?"":"px")},cur:function(){var e=_.propHooks[this.prop];return e&&e.get?e.get(this):_.propHooks._default.get(this)},run:function(e){var t,r=_.propHooks[this.prop];return this.pos=t=this.options.duration?ot.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),r&&r.set?r.set(this):_.propHooks._default.set(this),this}},_.prototype.init.prototype=_.prototype,_.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=ot.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){ot.fx.step[e.prop]?ot.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[ot.cssProps[e.prop]]||ot.cssHooks[e.prop])?ot.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},_.propHooks.scrollTop=_.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},ot.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},ot.fx=_.prototype.init,ot.fx.step={};var Er,fr,mr=/^(?:toggle|show|hide)$/,gr=new RegExp("^(?:([+-])=|)("+Ct+")([a-z%]*)$","i"),vr=/queueHooks$/,xr=[k],Nr={"*":[function(e,t){var r=this.createTween(e,t),i=r.cur(),n=gr.exec(t),o=n&&n[3]||(ot.cssNumber[e]?"":"px"),s=(ot.cssNumber[e]||"px"!==o&&+i)&&gr.exec(ot.css(r.elem,e)),a=1,l=20;if(s&&s[3]!==o){o=o||s[3],n=n||[],s=+i||1;do a=a||".5",s/=a,ot.style(r.elem,e,s+o);while(a!==(a=r.cur()/i)&&1!==a&&--l)}return n&&(s=r.start=+s||+i||0,r.unit=o,r.end=n[1]?s+(n[1]+1)*n[2]:+n[2]),r}]};ot.Animation=ot.extend(U,{tweener:function(e,t){ot.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var r,i=0,n=e.length;n>i;i++)r=e[i],Nr[r]=Nr[r]||[],Nr[r].unshift(t)},prefilter:function(e,t){t?xr.unshift(e):xr.push(e)}}),ot.speed=function(e,t,r){var i=e&&"object"==typeof e?ot.extend({},e):{complete:r||!r&&t||ot.isFunction(e)&&e,duration:e,easing:r&&t||t&&!ot.isFunction(t)&&t};return i.duration=ot.fx.off?0:"number"==typeof i.duration?i.duration:i.duration in ot.fx.speeds?ot.fx.speeds[i.duration]:ot.fx.speeds._default,(null==i.queue||i.queue===!0)&&(i.queue="fx"),i.old=i.complete,i.complete=function(){ot.isFunction(i.old)&&i.old.call(this),i.queue&&ot.dequeue(this,i.queue)},i},ot.fn.extend({fadeTo:function(e,t,r,i){return this.filter(bt).css("opacity",0).show().end().animate({opacity:t},e,r,i)},animate:function(e,t,r,i){var n=ot.isEmptyObject(e),o=ot.speed(t,r,i),s=function(){var t=U(this,ot.extend({},e),o);(n||ot._data(this,"finish"))&&t.stop(!0)};return s.finish=s,n||o.queue===!1?this.each(s):this.queue(o.queue,s)},stop:function(e,t,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=t,t=e,e=void 0),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=ot.timers,s=ot._data(this);if(n)s[n]&&s[n].stop&&i(s[n]);else for(n in s)s[n]&&s[n].stop&&vr.test(n)&&i(s[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&ot.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,r=ot._data(this),i=r[e+"queue"],n=r[e+"queueHooks"],o=ot.timers,s=i?i.length:0;for(r.finish=!0,ot.queue(this,e,[]),n&&n.stop&&n.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;s>t;t++)i[t]&&i[t].finish&&i[t].finish.call(this);
delete r.finish})}}),ot.each(["toggle","show","hide"],function(e,t){var r=ot.fn[t];ot.fn[t]=function(e,i,n){return null==e||"boolean"==typeof e?r.apply(this,arguments):this.animate(w(t,!0),e,i,n)}}),ot.each({slideDown:w("show"),slideUp:w("hide"),slideToggle:w("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){ot.fn[e]=function(e,r,i){return this.animate(t,e,r,i)}}),ot.timers=[],ot.fx.tick=function(){var e,t=ot.timers,r=0;for(Er=ot.now();r<t.length;r++)e=t[r],e()||t[r]!==e||t.splice(r--,1);t.length||ot.fx.stop(),Er=void 0},ot.fx.timer=function(e){ot.timers.push(e),e()?ot.fx.start():ot.timers.pop()},ot.fx.interval=13,ot.fx.start=function(){fr||(fr=setInterval(ot.fx.tick,ot.fx.interval))},ot.fx.stop=function(){clearInterval(fr),fr=null},ot.fx.speeds={slow:600,fast:200,_default:400},ot.fn.delay=function(e,t){return e=ot.fx?ot.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,r){var i=setTimeout(t,e);r.stop=function(){clearTimeout(i)}})},function(){var e,t,r,i,n;t=ft.createElement("div"),t.setAttribute("className","t"),t.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",i=t.getElementsByTagName("a")[0],r=ft.createElement("select"),n=r.appendChild(ft.createElement("option")),e=t.getElementsByTagName("input")[0],i.style.cssText="top:1px",it.getSetAttribute="t"!==t.className,it.style=/top/.test(i.getAttribute("style")),it.hrefNormalized="/a"===i.getAttribute("href"),it.checkOn=!!e.value,it.optSelected=n.selected,it.enctype=!!ft.createElement("form").enctype,r.disabled=!0,it.optDisabled=!n.disabled,e=ft.createElement("input"),e.setAttribute("value",""),it.input=""===e.getAttribute("value"),e.value="t",e.setAttribute("type","radio"),it.radioValue="t"===e.value}();var Lr=/\r/g;ot.fn.extend({val:function(e){var t,r,i,n=this[0];{if(arguments.length)return i=ot.isFunction(e),this.each(function(r){var n;1===this.nodeType&&(n=i?e.call(this,r,ot(this).val()):e,null==n?n="":"number"==typeof n?n+="":ot.isArray(n)&&(n=ot.map(n,function(e){return null==e?"":e+""})),t=ot.valHooks[this.type]||ot.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&void 0!==t.set(this,n,"value")||(this.value=n))});if(n)return t=ot.valHooks[n.type]||ot.valHooks[n.nodeName.toLowerCase()],t&&"get"in t&&void 0!==(r=t.get(n,"value"))?r:(r=n.value,"string"==typeof r?r.replace(Lr,""):null==r?"":r)}}}),ot.extend({valHooks:{option:{get:function(e){var t=ot.find.attr(e,"value");return null!=t?t:ot.trim(ot.text(e))}},select:{get:function(e){for(var t,r,i=e.options,n=e.selectedIndex,o="select-one"===e.type||0>n,s=o?null:[],a=o?n+1:i.length,l=0>n?a:o?n:0;a>l;l++)if(r=i[l],!(!r.selected&&l!==n||(it.optDisabled?r.disabled:null!==r.getAttribute("disabled"))||r.parentNode.disabled&&ot.nodeName(r.parentNode,"optgroup"))){if(t=ot(r).val(),o)return t;s.push(t)}return s},set:function(e,t){for(var r,i,n=e.options,o=ot.makeArray(t),s=n.length;s--;)if(i=n[s],ot.inArray(ot.valHooks.option.get(i),o)>=0)try{i.selected=r=!0}catch(a){i.scrollHeight}else i.selected=!1;return r||(e.selectedIndex=-1),n}}}}),ot.each(["radio","checkbox"],function(){ot.valHooks[this]={set:function(e,t){return ot.isArray(t)?e.checked=ot.inArray(ot(e).val(),t)>=0:void 0}},it.checkOn||(ot.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Tr,Ir,yr=ot.expr.attrHandle,Ar=/^(?:checked|selected)$/i,Sr=it.getSetAttribute,Cr=it.input;ot.fn.extend({attr:function(e,t){return Ot(this,ot.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){ot.removeAttr(this,e)})}}),ot.extend({attr:function(e,t,r){var i,n,o=e.nodeType;if(e&&3!==o&&8!==o&&2!==o)return typeof e.getAttribute===yt?ot.prop(e,t,r):(1===o&&ot.isXMLDoc(e)||(t=t.toLowerCase(),i=ot.attrHooks[t]||(ot.expr.match.bool.test(t)?Ir:Tr)),void 0===r?i&&"get"in i&&null!==(n=i.get(e,t))?n:(n=ot.find.attr(e,t),null==n?void 0:n):null!==r?i&&"set"in i&&void 0!==(n=i.set(e,r,t))?n:(e.setAttribute(t,r+""),r):void ot.removeAttr(e,t))},removeAttr:function(e,t){var r,i,n=0,o=t&&t.match(Nt);if(o&&1===e.nodeType)for(;r=o[n++];)i=ot.propFix[r]||r,ot.expr.match.bool.test(r)?Cr&&Sr||!Ar.test(r)?e[i]=!1:e[ot.camelCase("default-"+r)]=e[i]=!1:ot.attr(e,r,""),e.removeAttribute(Sr?r:i)},attrHooks:{type:{set:function(e,t){if(!it.radioValue&&"radio"===t&&ot.nodeName(e,"input")){var r=e.value;return e.setAttribute("type",t),r&&(e.value=r),t}}}}}),Ir={set:function(e,t,r){return t===!1?ot.removeAttr(e,r):Cr&&Sr||!Ar.test(r)?e.setAttribute(!Sr&&ot.propFix[r]||r,r):e[ot.camelCase("default-"+r)]=e[r]=!0,r}},ot.each(ot.expr.match.bool.source.match(/\w+/g),function(e,t){var r=yr[t]||ot.find.attr;yr[t]=Cr&&Sr||!Ar.test(t)?function(e,t,i){var n,o;return i||(o=yr[t],yr[t]=n,n=null!=r(e,t,i)?t.toLowerCase():null,yr[t]=o),n}:function(e,t,r){return r?void 0:e[ot.camelCase("default-"+t)]?t.toLowerCase():null}}),Cr&&Sr||(ot.attrHooks.value={set:function(e,t,r){return ot.nodeName(e,"input")?void(e.defaultValue=t):Tr&&Tr.set(e,t,r)}}),Sr||(Tr={set:function(e,t,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=t+="","value"===r||t===e.getAttribute(r)?t:void 0}},yr.id=yr.name=yr.coords=function(e,t,r){var i;return r?void 0:(i=e.getAttributeNode(t))&&""!==i.value?i.value:null},ot.valHooks.button={get:function(e,t){var r=e.getAttributeNode(t);return r&&r.specified?r.value:void 0},set:Tr.set},ot.attrHooks.contenteditable={set:function(e,t,r){Tr.set(e,""===t?!1:t,r)}},ot.each(["width","height"],function(e,t){ot.attrHooks[t]={set:function(e,r){return""===r?(e.setAttribute(t,"auto"),r):void 0}}})),it.style||(ot.attrHooks.style={get:function(e){return e.style.cssText||void 0},set:function(e,t){return e.style.cssText=t+""}});var Rr=/^(?:input|select|textarea|button|object)$/i,br=/^(?:a|area)$/i;ot.fn.extend({prop:function(e,t){return Ot(this,ot.prop,e,t,arguments.length>1)},removeProp:function(e){return e=ot.propFix[e]||e,this.each(function(){try{this[e]=void 0,delete this[e]}catch(t){}})}}),ot.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(e,t,r){var i,n,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return o=1!==s||!ot.isXMLDoc(e),o&&(t=ot.propFix[t]||t,n=ot.propHooks[t]),void 0!==r?n&&"set"in n&&void 0!==(i=n.set(e,r,t))?i:e[t]=r:n&&"get"in n&&null!==(i=n.get(e,t))?i:e[t]},propHooks:{tabIndex:{get:function(e){var t=ot.find.attr(e,"tabindex");return t?parseInt(t,10):Rr.test(e.nodeName)||br.test(e.nodeName)&&e.href?0:-1}}}}),it.hrefNormalized||ot.each(["href","src"],function(e,t){ot.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),it.optSelected||(ot.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),ot.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){ot.propFix[this.toLowerCase()]=this}),it.enctype||(ot.propFix.enctype="encoding");var Or=/[\t\r\n\f]/g;ot.fn.extend({addClass:function(e){var t,r,i,n,o,s,a=0,l=this.length,u="string"==typeof e&&e;if(ot.isFunction(e))return this.each(function(t){ot(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(Nt)||[];l>a;a++)if(r=this[a],i=1===r.nodeType&&(r.className?(" "+r.className+" ").replace(Or," "):" ")){for(o=0;n=t[o++];)i.indexOf(" "+n+" ")<0&&(i+=n+" ");s=ot.trim(i),r.className!==s&&(r.className=s)}return this},removeClass:function(e){var t,r,i,n,o,s,a=0,l=this.length,u=0===arguments.length||"string"==typeof e&&e;if(ot.isFunction(e))return this.each(function(t){ot(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(Nt)||[];l>a;a++)if(r=this[a],i=1===r.nodeType&&(r.className?(" "+r.className+" ").replace(Or," "):"")){for(o=0;n=t[o++];)for(;i.indexOf(" "+n+" ")>=0;)i=i.replace(" "+n+" "," ");s=e?ot.trim(i):"",r.className!==s&&(r.className=s)}return this},toggleClass:function(e,t){var r=typeof e;return"boolean"==typeof t&&"string"===r?t?this.addClass(e):this.removeClass(e):this.each(ot.isFunction(e)?function(r){ot(this).toggleClass(e.call(this,r,this.className,t),t)}:function(){if("string"===r)for(var t,i=0,n=ot(this),o=e.match(Nt)||[];t=o[i++];)n.hasClass(t)?n.removeClass(t):n.addClass(t);else(r===yt||"boolean"===r)&&(this.className&&ot._data(this,"__className__",this.className),this.className=this.className||e===!1?"":ot._data(this,"__className__")||"")})},hasClass:function(e){for(var t=" "+e+" ",r=0,i=this.length;i>r;r++)if(1===this[r].nodeType&&(" "+this[r].className+" ").replace(Or," ").indexOf(t)>=0)return!0;return!1}}),ot.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(e,t){ot.fn[t]=function(e,r){return arguments.length>0?this.on(t,null,e,r):this.trigger(t)}}),ot.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,r){return this.on(e,null,t,r)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,r,i){return this.on(t,e,r,i)},undelegate:function(e,t,r){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",r)}});var Pr=ot.now(),Dr=/\?/,_r=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;ot.parseJSON=function(e){if(t.JSON&&t.JSON.parse)return t.JSON.parse(e+"");var r,i=null,n=ot.trim(e+"");return n&&!ot.trim(n.replace(_r,function(e,t,n,o){return r&&t&&(i=0),0===i?e:(r=n||t,i+=!o-!n,"")}))?Function("return "+n)():ot.error("Invalid JSON: "+e)},ot.parseXML=function(e){var r,i;if(!e||"string"!=typeof e)return null;try{t.DOMParser?(i=new DOMParser,r=i.parseFromString(e,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(e))}catch(n){r=void 0}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||ot.error("Invalid XML: "+e),r};var Mr,wr,Gr=/#.*$/,kr=/([?&])_=[^&]*/,Br=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Ur=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Vr=/^(?:GET|HEAD)$/,Hr=/^\/\//,Fr=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,jr={},Wr={},qr="*/".concat("*");try{wr=location.href}catch(zr){wr=ft.createElement("a"),wr.href="",wr=wr.href}Mr=Fr.exec(wr.toLowerCase())||[],ot.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:wr,type:"GET",isLocal:Ur.test(Mr[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":qr,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":ot.parseJSON,"text xml":ot.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?F(F(e,ot.ajaxSettings),t):F(ot.ajaxSettings,e)},ajaxPrefilter:V(jr),ajaxTransport:V(Wr),ajax:function(e,t){function r(e,t,r,i){var n,p,g,v,N,T=t;2!==x&&(x=2,a&&clearTimeout(a),u=void 0,s=i||"",L.readyState=e>0?4:0,n=e>=200&&300>e||304===e,r&&(v=j(c,L,r)),v=W(c,v,L,n),n?(c.ifModified&&(N=L.getResponseHeader("Last-Modified"),N&&(ot.lastModified[o]=N),N=L.getResponseHeader("etag"),N&&(ot.etag[o]=N)),204===e||"HEAD"===c.type?T="nocontent":304===e?T="notmodified":(T=v.state,p=v.data,g=v.error,n=!g)):(g=T,(e||!T)&&(T="error",0>e&&(e=0))),L.status=e,L.statusText=(t||T)+"",n?E.resolveWith(d,[p,T,L]):E.rejectWith(d,[L,T,g]),L.statusCode(m),m=void 0,l&&h.trigger(n?"ajaxSuccess":"ajaxError",[L,c,n?p:g]),f.fireWith(d,[L,T]),l&&(h.trigger("ajaxComplete",[L,c]),--ot.active||ot.event.trigger("ajaxStop")))}"object"==typeof e&&(t=e,e=void 0),t=t||{};var i,n,o,s,a,l,u,p,c=ot.ajaxSetup({},t),d=c.context||c,h=c.context&&(d.nodeType||d.jquery)?ot(d):ot.event,E=ot.Deferred(),f=ot.Callbacks("once memory"),m=c.statusCode||{},g={},v={},x=0,N="canceled",L={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!p)for(p={};t=Br.exec(s);)p[t[1].toLowerCase()]=t[2];t=p[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?s:null},setRequestHeader:function(e,t){var r=e.toLowerCase();return x||(e=v[r]=v[r]||e,g[e]=t),this},overrideMimeType:function(e){return x||(c.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)m[t]=[m[t],e[t]];else L.always(e[L.status]);return this},abort:function(e){var t=e||N;return u&&u.abort(t),r(0,t),this}};if(E.promise(L).complete=f.add,L.success=L.done,L.error=L.fail,c.url=((e||c.url||wr)+"").replace(Gr,"").replace(Hr,Mr[1]+"//"),c.type=t.method||t.type||c.method||c.type,c.dataTypes=ot.trim(c.dataType||"*").toLowerCase().match(Nt)||[""],null==c.crossDomain&&(i=Fr.exec(c.url.toLowerCase()),c.crossDomain=!(!i||i[1]===Mr[1]&&i[2]===Mr[2]&&(i[3]||("http:"===i[1]?"80":"443"))===(Mr[3]||("http:"===Mr[1]?"80":"443")))),c.data&&c.processData&&"string"!=typeof c.data&&(c.data=ot.param(c.data,c.traditional)),H(jr,c,t,L),2===x)return L;l=c.global,l&&0===ot.active++&&ot.event.trigger("ajaxStart"),c.type=c.type.toUpperCase(),c.hasContent=!Vr.test(c.type),o=c.url,c.hasContent||(c.data&&(o=c.url+=(Dr.test(o)?"&":"?")+c.data,delete c.data),c.cache===!1&&(c.url=kr.test(o)?o.replace(kr,"$1_="+Pr++):o+(Dr.test(o)?"&":"?")+"_="+Pr++)),c.ifModified&&(ot.lastModified[o]&&L.setRequestHeader("If-Modified-Since",ot.lastModified[o]),ot.etag[o]&&L.setRequestHeader("If-None-Match",ot.etag[o])),(c.data&&c.hasContent&&c.contentType!==!1||t.contentType)&&L.setRequestHeader("Content-Type",c.contentType),L.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+("*"!==c.dataTypes[0]?", "+qr+"; q=0.01":""):c.accepts["*"]);for(n in c.headers)L.setRequestHeader(n,c.headers[n]);if(c.beforeSend&&(c.beforeSend.call(d,L,c)===!1||2===x))return L.abort();N="abort";for(n in{success:1,error:1,complete:1})L[n](c[n]);if(u=H(Wr,c,t,L)){L.readyState=1,l&&h.trigger("ajaxSend",[L,c]),c.async&&c.timeout>0&&(a=setTimeout(function(){L.abort("timeout")},c.timeout));try{x=1,u.send(g,r)}catch(T){if(!(2>x))throw T;r(-1,T)}}else r(-1,"No Transport");return L},getJSON:function(e,t,r){return ot.get(e,t,r,"json")},getScript:function(e,t){return ot.get(e,void 0,t,"script")}}),ot.each(["get","post"],function(e,t){ot[t]=function(e,r,i,n){return ot.isFunction(r)&&(n=n||i,i=r,r=void 0),ot.ajax({url:e,type:t,dataType:n,data:r,success:i})}}),ot.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){ot.fn[t]=function(e){return this.on(t,e)}}),ot._evalUrl=function(e){return ot.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},ot.fn.extend({wrapAll:function(e){if(ot.isFunction(e))return this.each(function(t){ot(this).wrapAll(e.call(this,t))});if(this[0]){var t=ot(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return this.each(ot.isFunction(e)?function(t){ot(this).wrapInner(e.call(this,t))}:function(){var t=ot(this),r=t.contents();r.length?r.wrapAll(e):t.append(e)})},wrap:function(e){var t=ot.isFunction(e);return this.each(function(r){ot(this).wrapAll(t?e.call(this,r):e)})},unwrap:function(){return this.parent().each(function(){ot.nodeName(this,"body")||ot(this).replaceWith(this.childNodes)}).end()}}),ot.expr.filters.hidden=function(e){return e.offsetWidth<=0&&e.offsetHeight<=0||!it.reliableHiddenOffsets()&&"none"===(e.style&&e.style.display||ot.css(e,"display"))},ot.expr.filters.visible=function(e){return!ot.expr.filters.hidden(e)};var Xr=/%20/g,Yr=/\[\]$/,Kr=/\r?\n/g,$r=/^(?:submit|button|image|reset|file)$/i,Qr=/^(?:input|select|textarea|keygen)/i;ot.param=function(e,t){var r,i=[],n=function(e,t){t=ot.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=ot.ajaxSettings&&ot.ajaxSettings.traditional),ot.isArray(e)||e.jquery&&!ot.isPlainObject(e))ot.each(e,function(){n(this.name,this.value)});else for(r in e)q(r,e[r],t,n);return i.join("&").replace(Xr,"+")},ot.fn.extend({serialize:function(){return ot.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=ot.prop(this,"elements");return e?ot.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!ot(this).is(":disabled")&&Qr.test(this.nodeName)&&!$r.test(e)&&(this.checked||!Pt.test(e))}).map(function(e,t){var r=ot(this).val();return null==r?null:ot.isArray(r)?ot.map(r,function(e){return{name:t.name,value:e.replace(Kr,"\r\n")}}):{name:t.name,value:r.replace(Kr,"\r\n")}}).get()}}),ot.ajaxSettings.xhr=void 0!==t.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&z()||X()}:z;var Zr=0,Jr={},ei=ot.ajaxSettings.xhr();t.ActiveXObject&&ot(t).on("unload",function(){for(var e in Jr)Jr[e](void 0,!0)}),it.cors=!!ei&&"withCredentials"in ei,ei=it.ajax=!!ei,ei&&ot.ajaxTransport(function(e){if(!e.crossDomain||it.cors){var t;return{send:function(r,i){var n,o=e.xhr(),s=++Zr;if(o.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(n in e.xhrFields)o[n]=e.xhrFields[n];e.mimeType&&o.overrideMimeType&&o.overrideMimeType(e.mimeType),e.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest");for(n in r)void 0!==r[n]&&o.setRequestHeader(n,r[n]+"");o.send(e.hasContent&&e.data||null),t=function(r,n){var a,l,u;if(t&&(n||4===o.readyState))if(delete Jr[s],t=void 0,o.onreadystatechange=ot.noop,n)4!==o.readyState&&o.abort();else{u={},a=o.status,"string"==typeof o.responseText&&(u.text=o.responseText);try{l=o.statusText}catch(p){l=""}a||!e.isLocal||e.crossDomain?1223===a&&(a=204):a=u.text?200:404}u&&i(a,l,u,o.getAllResponseHeaders())},e.async?4===o.readyState?setTimeout(t):o.onreadystatechange=Jr[s]=t:t()},abort:function(){t&&t(void 0,!0)}}}}),ot.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return ot.globalEval(e),e}}}),ot.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),ot.ajaxTransport("script",function(e){if(e.crossDomain){var t,r=ft.head||ot("head")[0]||ft.documentElement;return{send:function(i,n){t=ft.createElement("script"),t.async=!0,e.scriptCharset&&(t.charset=e.scriptCharset),t.src=e.url,t.onload=t.onreadystatechange=function(e,r){(r||!t.readyState||/loaded|complete/.test(t.readyState))&&(t.onload=t.onreadystatechange=null,t.parentNode&&t.parentNode.removeChild(t),t=null,r||n(200,"success"))},r.insertBefore(t,r.firstChild)},abort:function(){t&&t.onload(void 0,!0)}}}});var ti=[],ri=/(=)\?(?=&|$)|\?\?/;ot.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=ti.pop()||ot.expando+"_"+Pr++;return this[e]=!0,e}}),ot.ajaxPrefilter("json jsonp",function(e,r,i){var n,o,s,a=e.jsonp!==!1&&(ri.test(e.url)?"url":"string"==typeof e.data&&!(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&ri.test(e.data)&&"data");return a||"jsonp"===e.dataTypes[0]?(n=e.jsonpCallback=ot.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(ri,"$1"+n):e.jsonp!==!1&&(e.url+=(Dr.test(e.url)?"&":"?")+e.jsonp+"="+n),e.converters["script json"]=function(){return s||ot.error(n+" was not called"),s[0]},e.dataTypes[0]="json",o=t[n],t[n]=function(){s=arguments},i.always(function(){t[n]=o,e[n]&&(e.jsonpCallback=r.jsonpCallback,ti.push(n)),s&&ot.isFunction(o)&&o(s[0]),s=o=void 0}),"script"):void 0}),ot.parseHTML=function(e,t,r){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(r=t,t=!1),t=t||ft;var i=dt.exec(e),n=!r&&[];return i?[t.createElement(i[1])]:(i=ot.buildFragment([e],t,n),n&&n.length&&ot(n).remove(),ot.merge([],i.childNodes))};var ii=ot.fn.load;ot.fn.load=function(e,t,r){if("string"!=typeof e&&ii)return ii.apply(this,arguments);var i,n,o,s=this,a=e.indexOf(" ");return a>=0&&(i=ot.trim(e.slice(a,e.length)),e=e.slice(0,a)),ot.isFunction(t)?(r=t,t=void 0):t&&"object"==typeof t&&(o="POST"),s.length>0&&ot.ajax({url:e,type:o,dataType:"html",data:t}).done(function(e){n=arguments,s.html(i?ot("<div>").append(ot.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,n||[e.responseText,t,e])}),this},ot.expr.filters.animated=function(e){return ot.grep(ot.timers,function(t){return e===t.elem}).length};var ni=t.document.documentElement;ot.offset={setOffset:function(e,t,r){var i,n,o,s,a,l,u,p=ot.css(e,"position"),c=ot(e),d={};"static"===p&&(e.style.position="relative"),a=c.offset(),o=ot.css(e,"top"),l=ot.css(e,"left"),u=("absolute"===p||"fixed"===p)&&ot.inArray("auto",[o,l])>-1,u?(i=c.position(),s=i.top,n=i.left):(s=parseFloat(o)||0,n=parseFloat(l)||0),ot.isFunction(t)&&(t=t.call(e,r,a)),null!=t.top&&(d.top=t.top-a.top+s),null!=t.left&&(d.left=t.left-a.left+n),"using"in t?t.using.call(e,d):c.css(d)}},ot.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){ot.offset.setOffset(this,e,t)});var t,r,i={top:0,left:0},n=this[0],o=n&&n.ownerDocument;if(o)return t=o.documentElement,ot.contains(t,n)?(typeof n.getBoundingClientRect!==yt&&(i=n.getBoundingClientRect()),r=Y(o),{top:i.top+(r.pageYOffset||t.scrollTop)-(t.clientTop||0),left:i.left+(r.pageXOffset||t.scrollLeft)-(t.clientLeft||0)}):i},position:function(){if(this[0]){var e,t,r={top:0,left:0},i=this[0];return"fixed"===ot.css(i,"position")?t=i.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),ot.nodeName(e[0],"html")||(r=e.offset()),r.top+=ot.css(e[0],"borderTopWidth",!0),r.left+=ot.css(e[0],"borderLeftWidth",!0)),{top:t.top-r.top-ot.css(i,"marginTop",!0),left:t.left-r.left-ot.css(i,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent||ni;e&&!ot.nodeName(e,"html")&&"static"===ot.css(e,"position");)e=e.offsetParent;return e||ni})}}),ot.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var r=/Y/.test(t);ot.fn[e]=function(i){return Ot(this,function(e,i,n){var o=Y(e);return void 0===n?o?t in o?o[t]:o.document.documentElement[i]:e[i]:void(o?o.scrollTo(r?ot(o).scrollLeft():n,r?n:ot(o).scrollTop()):e[i]=n)},e,i,arguments.length,null)}}),ot.each(["top","left"],function(e,t){ot.cssHooks[t]=C(it.pixelPosition,function(e,r){return r?(r=rr(e,t),nr.test(r)?ot(e).position()[t]+"px":r):void 0})}),ot.each({Height:"height",Width:"width"},function(e,t){ot.each({padding:"inner"+e,content:t,"":"outer"+e},function(r,i){ot.fn[i]=function(i,n){var o=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||n===!0?"margin":"border");return Ot(this,function(t,r,i){var n;return ot.isWindow(t)?t.document.documentElement["client"+e]:9===t.nodeType?(n=t.documentElement,Math.max(t.body["scroll"+e],n["scroll"+e],t.body["offset"+e],n["offset"+e],n["client"+e])):void 0===i?ot.css(t,r,s):ot.style(t,r,i,s)},t,o?i:void 0,o,null)}})}),ot.fn.size=function(){return this.length},ot.fn.andSelf=ot.fn.addBack,"function"==typeof e&&e.amd&&e("jquery",[],function(){return ot});var oi=t.jQuery,si=t.$;return ot.noConflict=function(e){return t.$===ot&&(t.$=si),e&&t.jQuery===ot&&(t.jQuery=oi),ot},typeof r===yt&&(t.jQuery=t.$=ot),ot})},{}],12:[function(t,r){!function(t){function i(){try{return u in t&&t[u]}catch(e){return!1}}function n(e){return function(){var t=Array.prototype.slice.call(arguments,0);t.unshift(s),c.appendChild(s),s.addBehavior("#default#userData"),s.load(u);var r=e.apply(a,t);return c.removeChild(s),r}}function o(e){return e.replace(/^d/,"___$&").replace(E,"___")}var s,a={},l=t.document,u="localStorage",p="script";if(a.disabled=!1,a.set=function(){},a.get=function(){},a.remove=function(){},a.clear=function(){},a.transact=function(e,t,r){var i=a.get(e);null==r&&(r=t,t=null),"undefined"==typeof i&&(i=t||{}),r(i),a.set(e,i)},a.getAll=function(){},a.forEach=function(){},a.serialize=function(e){return JSON.stringify(e)},a.deserialize=function(e){if("string"!=typeof e)return void 0;try{return JSON.parse(e)}catch(t){return e||void 0}},i())s=t[u],a.set=function(e,t){return void 0===t?a.remove(e):(s.setItem(e,a.serialize(t)),t)},a.get=function(e){return a.deserialize(s.getItem(e))},a.remove=function(e){s.removeItem(e)},a.clear=function(){s.clear()},a.getAll=function(){var e={};return a.forEach(function(t,r){e[t]=r}),e},a.forEach=function(e){for(var t=0;t<s.length;t++){var r=s.key(t);e(r,a.get(r))}};else if(l.documentElement.addBehavior){var c,d;try{d=new ActiveXObject("htmlfile"),d.open(),d.write("<"+p+">document.w=window</"+p+'><iframe src="/favicon.ico"></iframe>'),d.close(),c=d.w.frames[0].document,s=c.createElement("div")}catch(h){s=l.createElement("div"),c=l.body}var E=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");a.set=n(function(e,t,r){return t=o(t),void 0===r?a.remove(t):(e.setAttribute(t,a.serialize(r)),e.save(u),r)}),a.get=n(function(e,t){return t=o(t),a.deserialize(e.getAttribute(t))}),a.remove=n(function(e,t){t=o(t),e.removeAttribute(t),e.save(u)}),a.clear=n(function(e){var t=e.XMLDocument.documentElement.attributes;e.load(u);for(var r,i=0;r=t[i];i++)e.removeAttribute(r.name);e.save(u)}),a.getAll=function(){var e={};return a.forEach(function(t,r){e[t]=r}),e},a.forEach=n(function(e,t){for(var r,i=e.XMLDocument.documentElement.attributes,n=0;r=i[n];++n)t(r.name,a.deserialize(e.getAttribute(r.name)))})}try{var f="__storejs__";a.set(f,f),a.get(f)!=f&&(a.disabled=!0),a.remove(f)}catch(h){a.disabled=!0}a.enabled=!a.disabled,"undefined"!=typeof r&&r.exports&&this.module!==r?r.exports=a:"function"==typeof e&&e.amd?e(a):t.store=a}(Function("return this")())},{}],13:[function(e,t){t.exports={name:"yasgui-utils",version:"1.4.1",description:"Utils for YASGUI libs",main:"src/main.js",repository:{type:"git",url:"git://github.com/YASGUI/Utils.git"},licenses:[{type:"MIT",url:"http://yasgui.github.io/license.txt"}],author:"Laurens Rietveld",maintainers:[{name:"Laurens Rietveld",email:"[email protected]",web:"http://laurensrietveld.nl"}],bugs:{url:"https://github.com/YASGUI/Utils/issues"},homepage:"https://github.com/YASGUI/Utils",dependencies:{store:"^1.3.14"}}},{}],14:[function(e,t){window.console=window.console||{log:function(){}},t.exports={storage:e("./storage.js"),svg:e("./svg.js"),version:{"yasgui-utils":e("../package.json").version}}},{"../package.json":13,"./storage.js":15,"./svg.js":16}],15:[function(e,t){{var r=e("store"),i={day:function(){return 864e5},month:function(){30*i.day()},year:function(){12*i.month()}};t.exports={set:function(e,t,n){"string"==typeof n&&(n=i[n]()),t.documentElement&&(t=(new XMLSerializer).serializeToString(t.documentElement)),r.set(e,{val:t,exp:n,time:(new Date).getTime()})},get:function(e){var t=r.get(e);return t?t.exp&&(new Date).getTime()-t.time>t.exp?null:t.val:null}}}},{store:12}],16:[function(e,t){t.exports={draw:function(e,r,i){if(e){var n=t.exports.getElement(r,i);n&&(e.append?e.append(n):e.appendChild(n))}},getElement:function(e,t){if(e&&0==e.indexOf("<svg")){t.width||(t.width="100%"),t.height||(t.height="100%");var r=new DOMParser,i=r.parseFromString(e,"text/xml"),n=i.documentElement,o=document.createElement("div");return o.style.display="inline-block",o.style.width=t.width,o.style.height=t.height,o.appendChild(n),o}return!1}}},{}],17:[function(e,t){t.exports={name:"yasgui-yasqe",description:"Yet Another SPARQL Query Editor",version:"2.1.0",main:"src/main.js",licenses:[{type:"MIT",url:"http://yasqe.yasgui.org/license.txt"}],author:"Laurens Rietveld",homepage:"http://yasqe.yasgui.org",devDependencies:{browserify:"^6.1.0",gulp:"~3.6.0","gulp-bump":"^0.1.11","gulp-concat":"^2.4.1","gulp-connect":"^2.0.5","gulp-embedlr":"^0.5.2","gulp-filter":"^1.0.2","gulp-git":"^0.5.2","gulp-jsvalidate":"^0.2.0","gulp-livereload":"^1.3.1","gulp-minify-css":"^0.3.0","gulp-notify":"^1.2.5","gulp-rename":"^1.2.0","gulp-streamify":"0.0.5","gulp-tag-version":"^1.1.0","gulp-uglify":"^0.2.1","require-dir":"^0.1.0","run-sequence":"^1.0.1","vinyl-buffer":"^1.0.0","vinyl-source-stream":"~0.1.1",watchify:"^0.6.4","browserify-shim":"^3.8.0","gulp-sourcemaps":"^1.2.4",exorcist:"^0.1.6","vinyl-transform":"0.0.1","gulp-sass":"^1.2.2"},bugs:"https://github.com/YASGUI/YASQE/issues/",keywords:["JavaScript","SPARQL","Editor","Semantic Web","Linked Data"],maintainers:[{name:"Laurens Rietveld",email:"[email protected]",web:"http://laurensrietveld.nl"}],repository:{type:"git",url:"https://github.com/YASGUI/YASQE.git"},dependencies:{jquery:"~ 1.11.0",codemirror:"^4.2.0","twitter-bootstrap-3.0.0":"^3.0.0","yasgui-utils":"^1.4.1","gulp-minify-css":"^0.3.11"},"browserify-shim":{jquery:"global:jQuery",codemirror:"global:CodeMirror","../../lib/codemirror":"global:CodeMirror"}}},{}],18:[function(e,t){var r=e("jquery"),i=e("../utils.js"),n=e("yasgui-utils"),o=e("../../lib/trie.js");t.exports=function(e){var t={},a={},l={};e.on("cursorActivity",function(){c(!0)}),e.on("change",function(){var i=[];for(var n in t)t[n].is(":visible")&&i.push(t[n]);if(i.length>0){var o=r(e.getWrapperElement()).find(".CodeMirror-vscrollbar"),s=0;o.is(":visible")&&(s=o.outerWidth()),i.forEach(function(e){e.css("right",s)})}});var u=function(t,r){l[t.name]=new o;for(var s=0;s<r.length;s++)l[t.name].insert(r[s]);var a=i.getPersistencyId(e,t.persistent);a&&n.storage.set(a,r,"month")},p=function(t,r){var o=a[t]=new r(e);if(o.name=t,o.bulk){var s=function(e){e&&e instanceof Array&&e.length>0&&u(o,e)};if(o.get instanceof Array)s(o.get);else{var l=null,p=i.getPersistencyId(e,o.persistent);p&&(l=n.storage.get(p)),l&&l.length>0?s(l):o.get instanceof Function&&(o.async?o.get(null,s):s(o.get()))}}},c=function(t){if(!e.somethingSelected()){var i=function(r){if(t&&(!r.autoShow||!r.bulk&&r.async))return!1;var i={closeCharacters:/(?=a)b/,completeSingle:!1};!r.bulk&&r.async&&(i.async=!0);{var n=function(e,t){return d(r,t)};YASQE.showHint(e,n,i)}return!0};for(var n in a)if(-1!=r.inArray(n,e.options.autocompleters)){var o=a[n];if(o.isValidCompletionPosition)if(o.isValidCompletionPosition()){if(!o.callbacks||!o.callbacks.validPosition||o.callbacks.validPosition(e,o)!==!1){var s=i(o);if(s)break}}else o.callbacks&&o.callbacks.invalidPosition&&o.callbacks.invalidPosition(e,o)}}},d=function(t,r){var i=function(e){var r=e.autocompletionString||e.string,i=[];if(l[t.name])i=l[t.name].autoComplete(r);else if("function"==typeof t.get&&0==t.async)i=t.get(r);else if("object"==typeof t.get)for(var n=r.length,o=0;o<t.get.length;o++){var s=t.get[o];s.slice(0,n)==r&&i.push(s)}return h(i,t,e)},n=e.getCompleteToken();if(t.preProcessToken&&(n=t.preProcessToken(n)),n){if(t.bulk||!t.async)return i(n);var o=function(e){r(h(e,t,n))};t.get(n,o)}},h=function(t,r,i){for(var n=[],o=0;o<t.length;o++){var a=t[o];r.postProcessToken&&(a=r.postProcessToken(i,a)),n.push({text:a,displayText:a,hint:s})}var l=e.getCursor(),u={completionToken:i.string,list:n,from:{line:l.line,ch:i.start},to:{line:l.line,ch:i.end}};if(r.callbacks)for(var p in r.callbacks)r.callbacks[p]&&e.on(u,p,r.callbacks[p]);return u};return{init:p,completers:a,notifications:{getEl:function(e){return r(t[e.name])},show:function(e,i){i.autoshow||(t[i.name]||(t[i.name]=r("<div class='completionNotification'></div>")),t[i.name].show().text("Press "+(-1!=navigator.userAgent.indexOf("Mac OS X")?"CMD":"CTRL")+" - <spacebar> to autocomplete").appendTo(r(e.getWrapperElement())))},hide:function(e,r){t[r.name]&&t[r.name].hide()}},autoComplete:c,getTrie:function(e){return"string"==typeof e?l[e]:l[e.name]}}};var s=function(e,t,r){r.text!=e.getTokenAt(e.getCursor()).string&&e.replaceRange(r.text,t.from,t.to)}},{"../../lib/trie.js":4,"../utils.js":30,jquery:11,"yasgui-utils":14}],19:[function(e,t){t.exports=function(t){return{isValidCompletionPosition:function(){var e=t.getCompleteToken();if(0==e.string.indexOf("?"))return!1;var r=t.getCursor(),i=t.getPreviousNonWsToken(r.line,e);return"a"==i.string?!0:"rdf:type"==i.string?!0:"rdfs:domain"==i.string?!0:"rdfs:range"==i.string?!0:!1
},get:function(r,i){return e("./utils").fetchFromLov(t,this,r,i)},preProcessToken:function(r){return e("./utils.js").preprocessResourceTokenForCompletion(t,r)},postProcessToken:function(r,i){return e("./utils.js").postprocessResourceTokenForCompletion(t,r,i)},async:!0,bulk:!1,autoShow:!1,persistent:"classes",callbacks:{validPosition:t.autocompleters.notifications.show,invalidPosition:t.autocompleters.notifications.hide}}}},{"./utils":22,"./utils.js":22}],20:[function(e,t){var r=e("jquery"),i={"string-2":"prefixed",atom:"var"};t.exports=function(e){e.on("change",function(){n()});var t=function(t){var r=e.getPreviousNonWsToken(e.getCursor().line,t);return r&&r.string&&":"==r.string.slice(-1)&&(t={start:r.start,end:t.end,string:r.string+" "+t.string,state:t.state}),t},n=function(){if(e.autocompleters.getTrie("prefixes")){var t=e.getCursor(),r=e.getTokenAt(t);if("prefixed"==i[r.type]){var n=r.string.indexOf(":");if(-1!==n){var o=e.getPreviousNonWsToken(t.line,r).string.toUpperCase(),s=e.getTokenAt({line:t.line,ch:r.start});if("PREFIX"!=o&&("ws"==s.type||null==s.type)){var a=r.string.substring(0,n+1),l=e.getPrefixesFromQuery();if(null==l[a]){var u=e.autocompleters.getTrie("prefixes").autoComplete(a);u.length>0&&e.addPrefixes(u[0])}}}}}};return{isValidCompletionPosition:function(){var t=e.getCursor(),i=e.getTokenAt(t);if(e.getLine(t.line).length>t.ch)return!1;if("ws"!=i.type&&(i=e.getCompleteToken()),0==!i.string.indexOf("a")&&-1==r.inArray("PNAME_NS",i.state.possibleCurrent))return!1;var n=e.getPreviousNonWsToken(t.line,i);return n&&"PREFIX"==n.string.toUpperCase()?!0:!1},get:function(e,t){r.get("http://prefix.cc/popular/all.file.json",function(e){var r=[];for(var i in e)if("bif"!=i){var n=i+": <"+e[i]+">";r.push(n)}r.sort(),t(r)})},preProcessToken:t,async:!0,bulk:!0,autoShow:!0,autoAddDeclaration:!0,persistent:"prefixes"}}},{jquery:11}],21:[function(e,t){var r=e("jquery");t.exports=function(t){return{isValidCompletionPosition:function(){var e=t.getCompleteToken();if(0==e.string.length)return!1;if(0==e.string.indexOf("?"))return!1;if(r.inArray("a",e.state.possibleCurrent)>=0)return!0;var i=t.getCursor(),n=t.getPreviousNonWsToken(i.line,e);return"rdfs:subPropertyOf"==n.string?!0:!1},get:function(r,i){return e("./utils").fetchFromLov(t,this,r,i)},preProcessToken:function(r){return e("./utils.js").preprocessResourceTokenForCompletion(t,r)},postProcessToken:function(r,i){return e("./utils.js").postprocessResourceTokenForCompletion(t,r,i)},async:!0,bulk:!1,autoShow:!1,persistent:"properties",callbacks:{validPosition:t.autocompleters.notifications.show,invalidPosition:t.autocompleters.notifications.hide}}}},{"./utils":22,"./utils.js":22,jquery:11}],22:[function(e,t){var r=e("jquery"),i=(e("./utils.js"),e("yasgui-utils")),n=function(e,t){var r=e.getPrefixesFromQuery();if(0==!t.string.indexOf("<")&&(t.tokenPrefix=t.string.substring(0,t.string.indexOf(":")+1),null!=r[t.tokenPrefix]&&(t.tokenPrefixUri=r[t.tokenPrefix])),t.autocompletionString=t.string.trim(),0==!t.string.indexOf("<")&&t.string.indexOf(":")>-1)for(var i in r)if(r.hasOwnProperty(i)&&0==t.string.indexOf(i)){t.autocompletionString=r[i],t.autocompletionString+=t.string.substring(i.length);break}return 0==t.autocompletionString.indexOf("<")&&(t.autocompletionString=t.autocompletionString.substring(1)),-1!==t.autocompletionString.indexOf(">",t.length-1)&&(t.autocompletionString=t.autocompletionString.substring(0,t.autocompletionString.length-1)),t},o=function(e,t,r){return r=t.tokenPrefix&&t.autocompletionString&&t.tokenPrefixUri?t.tokenPrefix+r.substring(t.tokenPrefixUri.length):"<"+r+">"},s=function(t,n,o,s){if(!o||!o.string||0==o.string.trim().length)return t.autocompleters.notifications.getEl(n).empty().append("Nothing to autocomplete yet!"),!1;var a=50,l={q:o.autocompletionString,page:1};l.type="classes"==n.name?"class":"property";var u=[],p="",c=function(){p="http://lov.okfn.org/dataset/lov/api/v2/autocomplete/terms?"+r.param(l)};c();var d=function(){l.page++,c()},h=function(){r.get(p,function(e){for(var i=0;i<e.results.length;i++)u.push(r.isArray(e.results[i].uri)&&e.results[i].uri.length>0?e.results[i].uri[0]:e.results[i].uri);u.length<e.total_results&&u.length<a?(d(),h()):(u.length>0?t.autocompleters.notifications.hide(t,n):t.autocompleters.notifications.getEl(n).text("0 matches found..."),s(u))}).fail(function(){t.autocompleters.notifications.getEl(n).empty().append("Failed fetching suggestions..")})};t.autocompleters.notifications.getEl(n).empty().append(r("<span>Fetchting autocompletions </span>")).append(r(i.svg.getElement(e("../imgs.js").loader,{width:"18px",height:"18px"})).css("vertical-align","middle")),h()};t.exports={fetchFromLov:s,preprocessResourceTokenForCompletion:n,postprocessResourceTokenForCompletion:o}},{"../imgs.js":25,"./utils.js":22,jquery:11,"yasgui-utils":14}],23:[function(e,t){var r=e("jquery");t.exports=function(e){return{isValidCompletionPosition:function(){var t=e.getTokenAt(e.getCursor());return"ws"!=t.type&&(t=e.getCompleteToken(t),t&&0==t.string.indexOf("?"))?!0:!1},get:function(t){if(0==t.trim().length)return[];var i={};r(e.getWrapperElement()).find(".yasqe-atom").each(function(){var e=this.innerHTML;if(0==e.indexOf("?")){var n=r(this).next(),o=n.attr("class");if(o&&n.attr("class").indexOf("yasqe-atom")>=0&&(e+=n.text()),e.length<=1)return;if(0!==e.indexOf(t))return;if(e==t)return;i[e]=!0}});var n=[];for(var o in i)n.push(o);return n.sort(),n},async:!1,bulk:!1,autoShow:!0}}},{jquery:11}],24:[function(e,t){var r=e("jquery"),i=e("./sparql.js");t.exports={use:function(e){e.defaults=r.extend(e.defaults,{mode:"sparql11",value:"SELECT * WHERE {\n ?sub ?pred ?obj .\n} \nLIMIT 10",highlightSelectionMatches:{showToken:/\w/},tabMode:"indent",lineNumbers:!0,gutters:["gutterErrorBar","CodeMirror-linenumbers"],matchBrackets:!0,fixedGutter:!0,syntaxErrorCheck:!0,extraKeys:{"Ctrl-Space":e.autoComplete,"Cmd-Space":e.autoComplete,"Ctrl-D":e.deleteLine,"Ctrl-K":e.deleteLine,"Cmd-D":e.deleteLine,"Cmd-K":e.deleteLine,"Ctrl-/":e.commentLines,"Cmd-/":e.commentLines,"Ctrl-Alt-Down":e.copyLineDown,"Ctrl-Alt-Up":e.copyLineUp,"Cmd-Alt-Down":e.copyLineDown,"Cmd-Alt-Up":e.copyLineUp,"Shift-Ctrl-F":e.doAutoFormat,"Shift-Cmd-F":e.doAutoFormat,"Ctrl-]":e.indentMore,"Cmd-]":e.indentMore,"Ctrl-[":e.indentLess,"Cmd-[":e.indentLess,"Ctrl-S":e.storeQuery,"Cmd-S":e.storeQuery,"Ctrl-Enter":i.executeQuery,"Cmd-Enter":i.executeQuery,F11:function(e){e.setOption("fullScreen",!e.getOption("fullScreen"))},Esc:function(e){e.getOption("fullScreen")&&e.setOption("fullScreen",!1)}},cursorHeight:.9,createShareLink:e.createShareLink,consumeShareLink:e.consumeShareLink,persistent:function(e){return"queryVal_"+r(e.getWrapperElement()).closest("[id]").attr("id")},sparql:{showQueryButton:!1,endpoint:"http://dbpedia.org/sparql",requestMethod:"POST",acceptHeaderGraph:"text/turtle,*/*;q=0.9",acceptHeaderSelect:"application/sparql-results+json,*/*;q=0.9",acceptHeaderUpdate:"text/plain,*/*;q=0.9",namedGraphs:[],defaultGraphs:[],args:[],headers:{},callbacks:{beforeSend:null,complete:null,error:null,success:null},handlers:{}}})}}},{"./sparql.js":27,jquery:11}],25:[function(e,t){t.exports={loader:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="100%" height="100%" fill="black"> <circle cx="16" cy="3" r="0"> <animate attributeName="r" values="0;3;0;0" dur="1s" repeatCount="indefinite" begin="0" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" calcMode="spline" /> </circle> <circle transform="rotate(45 16 16)" cx="16" cy="3" r="0"> <animate attributeName="r" values="0;3;0;0" dur="1s" repeatCount="indefinite" begin="0.125s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" calcMode="spline" /> </circle> <circle transform="rotate(90 16 16)" cx="16" cy="3" r="0"> <animate attributeName="r" values="0;3;0;0" dur="1s" repeatCount="indefinite" begin="0.25s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" calcMode="spline" /> </circle> <circle transform="rotate(135 16 16)" cx="16" cy="3" r="0"> <animate attributeName="r" values="0;3;0;0" dur="1s" repeatCount="indefinite" begin="0.375s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" calcMode="spline" /> </circle> <circle transform="rotate(180 16 16)" cx="16" cy="3" r="0"> <animate attributeName="r" values="0;3;0;0" dur="1s" repeatCount="indefinite" begin="0.5s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" calcMode="spline" /> </circle> <circle transform="rotate(225 16 16)" cx="16" cy="3" r="0"> <animate attributeName="r" values="0;3;0;0" dur="1s" repeatCount="indefinite" begin="0.625s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" calcMode="spline" /> </circle> <circle transform="rotate(270 16 16)" cx="16" cy="3" r="0"> <animate attributeName="r" values="0;3;0;0" dur="1s" repeatCount="indefinite" begin="0.75s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" calcMode="spline" /> </circle> <circle transform="rotate(315 16 16)" cx="16" cy="3" r="0"> <animate attributeName="r" values="0;3;0;0" dur="1s" repeatCount="indefinite" begin="0.875s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" calcMode="spline" /> </circle> <circle transform="rotate(180 16 16)" cx="16" cy="3" r="0"> <animate attributeName="r" values="0;3;0;0" dur="1s" repeatCount="indefinite" begin="0.5s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" calcMode="spline" /> </circle></svg>',query:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" width="100%" height="100%" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve"><g id="Layer_1"></g><g id="Layer_2"> <path d="M64.622,2.411H14.995c-6.627,0-12,5.373-12,12v49.897c0,6.627,5.373,12,12,12h49.627c6.627,0,12-5.373,12-12V14.411 C76.622,7.783,71.249,2.411,64.622,2.411z M24.125,63.906V15.093L61,39.168L24.125,63.906z"/></g></svg>',queryInvalid:'<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" x="0px" y="0px" width="100%" height="100%" viewBox="0 0 73.627 73.897" enable-background="new 0 0 80 80" xml:space="preserve" ><g id="Layer_1" transform="translate(-2.995,-2.411)" /><g id="Layer_2" transform="translate(-2.995,-2.411)"><path d="M 64.622,2.411 H 14.995 c -6.627,0 -12,5.373 -12,12 v 49.897 c 0,6.627 5.373,12 12,12 h 49.627 c 6.627,0 12,-5.373 12,-12 V 14.411 c 0,-6.628 -5.373,-12 -12,-12 z M 24.125,63.906 V 15.093 L 61,39.168 24.125,63.906 z" id="path6" inkscape:connector-curvature="0" /></g><g transform="matrix(0.76805408,0,0,0.76805408,-0.90231954,-2.0060895)" id="g3"><path style="fill:#c02608;fill-opacity:1" inkscape:connector-curvature="0" d="m 88.184,81.468 c 1.167,1.167 1.167,3.075 0,4.242 l -2.475,2.475 c -1.167,1.167 -3.076,1.167 -4.242,0 l -69.65,-69.65 c -1.167,-1.167 -1.167,-3.076 0,-4.242 l 2.476,-2.476 c 1.167,-1.167 3.076,-1.167 4.242,0 l 69.649,69.651 z" id="path5" /></g><g transform="matrix(0.76805408,0,0,0.76805408,-0.90231954,-2.0060895)" id="g7"><path style="fill:#c02608;fill-opacity:1" inkscape:connector-curvature="0" d="m 18.532,88.184 c -1.167,1.166 -3.076,1.166 -4.242,0 l -2.475,-2.475 c -1.167,-1.166 -1.167,-3.076 0,-4.242 l 69.65,-69.651 c 1.167,-1.167 3.075,-1.167 4.242,0 l 2.476,2.476 c 1.166,1.167 1.166,3.076 0,4.242 l -69.651,69.65 z" id="path9" /></g></svg>',download:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="tiny" x="0px" y="0px" width="100%" height="100%" viewBox="0 0 100 100" xml:space="preserve"><g id="Captions"></g><g id="Your_Icon"> <path fill-rule="evenodd" fill="#000000" d="M88,84v-2c0-2.961-0.859-4-4-4H16c-2.961,0-4,0.98-4,4v2c0,3.102,1.039,4,4,4h68 C87.02,88,88,87.039,88,84z M58,12H42c-5,0-6,0.941-6,6v22H16l34,34l34-34H64V18C64,12.941,62.939,12,58,12z"/></g></svg>',share:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Icons" x="0px" y="0px" width="100%" height="100%" viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve"><path id="ShareThis" d="M36.764,50c0,0.308-0.07,0.598-0.088,0.905l32.247,16.119c2.76-2.338,6.293-3.797,10.195-3.797 C87.89,63.228,95,70.338,95,79.109C95,87.89,87.89,95,79.118,95c-8.78,0-15.882-7.11-15.882-15.891c0-0.316,0.07-0.598,0.088-0.905 L31.077,62.085c-2.769,2.329-6.293,3.788-10.195,3.788C12.11,65.873,5,58.771,5,50c0-8.78,7.11-15.891,15.882-15.891 c3.902,0,7.427,1.468,10.195,3.797l32.247-16.119c-0.018-0.308-0.088-0.598-0.088-0.914C63.236,12.11,70.338,5,79.118,5 C87.89,5,95,12.11,95,20.873c0,8.78-7.11,15.891-15.882,15.891c-3.911,0-7.436-1.468-10.195-3.806L36.676,49.086 C36.693,49.394,36.764,49.684,36.764,50z"/></svg>',warning:'<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" x="0px" y="0px" viewBox="0 0 66.399998 66.399998" enable-background="new 0 0 69.3 69.3" xml:space="preserve" height="100%" width="100%" inkscape:version="0.48.4 r9939" ><g id="g3" transform="translate(-1.5,-1.5)" style="fill:#ff0000"><path d="M 34.7,1.5 C 16.4,1.5 1.5,16.4 1.5,34.7 1.5,53 16.4,67.9 34.7,67.9 53,67.9 67.9,53 67.9,34.7 67.9,16.4 53,1.5 34.7,1.5 z m 0,59.4 C 20.2,60.9 8.5,49.1 8.5,34.7 8.5,20.2 20.3,8.5 34.7,8.5 c 14.4,0 26.2,11.8 26.2,26.2 0,14.4 -11.8,26.2 -26.2,26.2 z" id="path5" inkscape:connector-curvature="0" style="fill:#ff0000" /><path d="m 34.6,47.1 c -1.4,0 -2.5,0.5 -3.5,1.5 -0.9,1 -1.4,2.2 -1.4,3.6 0,1.6 0.5,2.8 1.5,3.8 1,0.9 2.1,1.3 3.4,1.3 1.3,0 2.4,-0.5 3.4,-1.4 1,-0.9 1.5,-2.2 1.5,-3.7 0,-1.4 -0.5,-2.6 -1.4,-3.6 -0.9,-1 -2.1,-1.5 -3.5,-1.5 z" id="path7" inkscape:connector-curvature="0" style="fill:#ff0000" /><path d="m 34.8,13.9 c -1.5,0 -2.8,0.5 -3.7,1.6 -0.9,1 -1.4,2.4 -1.4,4.2 0,1.1 0.1,2.9 0.2,5.6 l 0.8,13.1 c 0.2,1.8 0.4,3.2 0.9,4.1 0.5,1.2 1.5,1.8 2.9,1.8 1.3,0 2.3,-0.7 2.9,-1.9 0.5,-1 0.7,-2.3 0.9,-4 L 39.4,25 c 0.1,-1.3 0.2,-2.5 0.2,-3.8 0,-2.2 -0.3,-3.9 -0.8,-5.1 -0.5,-1 -1.6,-2.2 -4,-2.2 z" id="path9" inkscape:connector-curvature="0" style="fill:#ff0000" /></g></svg>'}},{}],26:[function(e,t){var r=function(e,t){if("string"==typeof t)i(e,t);else for(var r in t)i(r+" "+t)},i=function(e,t){for(var r=null,i=0,n=e.lineCount(),o=0;n>o;o++){var a=e.getNextNonWsToken(o);null==a||"PREFIX"!=a.string&&"BASE"!=a.string||(r=a,i=o)}if(null==r)e.replaceRange("PREFIX "+t+"\n",{line:0,ch:0});else{var l=s(e,i);e.replaceRange("\n"+l+"PREFIX "+t,{line:i})}},n=function(e,t){var r=function(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")};for(var i in t)e.setValue(e.getValue().replace(new RegExp("PREFIX\\s*"+i+"\\s*"+r(t[i])+"\\s*","ig"),""))},o=function(e){for(var t={},r=!0,i=function(n,s){if(r){s||(s=1);var a=e.getNextNonWsToken(o,s);if(a)if(-1==a.state.possibleCurrent.indexOf("PREFIX")&&-1==a.state.possibleNext.indexOf("PREFIX")&&(r=!1),"PREFIX"==a.string.toUpperCase()){var l=e.getNextNonWsToken(o,a.end+1);if(l){var u=e.getNextNonWsToken(o,l.end+1);if(u){var p=u.string;0==p.indexOf("<")&&(p=p.substring(1)),">"==p.slice(-1)&&(p=p.substring(0,p.length-1)),t[l.string]=p,i(n,u.end+1)}else i(n,l.end+1)}else i(n,a.end+1)}else i(n,a.end+1)}},n=e.lineCount(),o=0;n>o&&r;o++)i(o);return t},s=function(e,t,r){void 0==r&&(r=1);var i=e.getTokenAt({line:t,ch:r});return null==i||void 0==i||"ws"!=i.type?"":i.string+s(e,t,i.end+1)};t.exports={addPrefixes:r,getPrefixesFromQuery:o,removePrefixes:n}},{}],27:[function(e,t){var r=e("jquery");t.exports={use:function(e){e.executeQuery=function(t,n){var o="function"==typeof n?n:null,s="object"==typeof n?n:{},a=t.getQueryMode();if(t.options.sparql&&(s=r.extend({},t.options.sparql,s)),s.handlers&&r.extend(!0,s.callbacks,s.handlers),s.endpoint&&0!=s.endpoint.length){var l={url:"function"==typeof s.endpoint?s.endpoint(t):s.endpoint,type:"function"==typeof s.requestMethod?s.requestMethod(t):s.requestMethod,data:[{name:a,value:t.getValue()}],headers:{Accept:i(t,s)}},u=!1;if(s.callbacks)for(var p in s.callbacks)s.callbacks[p]&&(u=!0,l[p]=s.callbacks[p]);if(u||o){if(o&&(l.complete=o),s.namedGraphs&&s.namedGraphs.length>0)for(var c="query"==a?"named-graph-uri":"using-named-graph-uri ",d=0;d<s.namedGraphs.length;d++)l.data.push({name:c,value:s.namedGraphs[d]});if(s.defaultGraphs&&s.defaultGraphs.length>0)for(var c="query"==a?"default-graph-uri":"using-graph-uri ",d=0;d<s.defaultGraphs.length;d++)l.data.push({name:c,value:s.defaultGraphs[d]});s.headers&&!r.isEmptyObject(s.headers)&&r.extend(l.headers,s.headers),s.args&&s.args.length>0&&r.merge(l.data,s.args),e.updateQueryButton(t,"busy");var h=function(){e.updateQueryButton(t)};if(l.complete){var E=l.complete;l.complete=function(e,t){E(e,t),h()}}else l.complete=h;t.xhr=r.ajax(l)}}}}};var i=function(e,t){var r=null;if(!t.acceptHeader||t.acceptHeaderGraph||t.acceptHeaderSelect||t.acceptHeaderUpdate)if("update"==e.getQueryMode())r="function"==typeof t.acceptHeader?t.acceptHeaderUpdate(e):t.acceptHeaderUpdate;else{var i=e.getQueryType();r="DESCRIBE"==i||"CONSTRUCT"==i?"function"==typeof t.acceptHeaderGraph?t.acceptHeaderGraph(e):t.acceptHeaderGraph:"function"==typeof t.acceptHeaderSelect?t.acceptHeaderSelect(e):t.acceptHeaderSelect}else r="function"==typeof t.acceptHeader?t.acceptHeader(e):t.acceptHeader;return r}},{jquery:11}],28:[function(e,t){var r=function(e,t,i){i||(i=e.getCursor()),t||(t=e.getTokenAt(i));var n=e.getTokenAt({line:i.line,ch:t.start});return null!=n.type&&"ws"!=n.type&&null!=t.type&&"ws"!=t.type?(t.start=n.start,t.string=n.string+t.string,r(e,t,{line:i.line,ch:n.start})):null!=t.type&&"ws"==t.type?(t.start=t.start+1,t.string=t.string.substring(1),t):t},i=function(e,t,r){var n=e.getTokenAt({line:t,ch:r.start});return null!=n&&"ws"==n.type&&(n=i(e,t,n)),n},n=function(e,t,r){void 0==r&&(r=1);var i=e.getTokenAt({line:t,ch:r});return null==i||void 0==i||i.end<r?null:"ws"==i.type?n(e,t,i.end+1):i};t.exports={getPreviousNonWsToken:i,getCompleteToken:r,getNextNonWsToken:n}},{}],29:[function(e,t){{var r=e("jquery");e("./utils.js")}t.exports=function(e,t,i){var n,t=r(t);t.hover(function(){"function"==typeof i&&(i=i()),n=r("<div>").addClass("yasqe_tooltip").html(i).appendTo(t),o()},function(){r(".yasqe_tooltip").remove()});var o=function(){r(e.getWrapperElement()).offset().top>=n.offset().top&&(n.css("bottom","auto"),n.css("top","26px"))}}},{"./utils.js":30,jquery:11}],30:[function(e,t){var r=e("jquery"),i=function(e,t){var r=!1;try{void 0!==e[t]&&(r=!0)}catch(i){}return r},n=function(e,t){var r=null;return t&&(r="string"==typeof t?t:t(e)),r},o=function(){function e(e){var t,i,n;return t=r(e).offset(),i=r(e).width(),n=r(e).height(),[[t.left,t.left+i],[t.top,t.top+n]]}function t(e,t){var r,i;return r=e[0]<t[0]?e:t,i=e[0]<t[0]?t:e,r[1]>i[0]||r[0]===i[0]}return function(r,i){var n=e(r),o=e(i);return t(n[0],o[0])&&t(n[1],o[1])}}();t.exports={keyExists:i,getPersistencyId:n,elementsOverlap:o}},{jquery:11}]},{},[1])(1)});
//# sourceMappingURL=yasqe.bundled.min.js.map |
packages/material-ui-icons/src/Gavel.js | allanalexandre/material-ui | import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><defs><path id="a" d="M0 0h24v24H0V0z" /></defs><path d="M1 21h12v2H1zM5.245 8.07l2.83-2.827 14.14 14.142-2.828 2.828zM12.317 1l5.657 5.656-2.83 2.83-5.654-5.66zM3.825 9.485l5.657 5.657-2.828 2.828-5.657-5.657z" /></React.Fragment>
, 'Gavel');
|
src/index.js | chasenlehara/react-chat | import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import './index.css';
import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap/dist/css/bootstrap-theme.css';
ReactDOM.render(
<App />,
document.getElementById('root')
);
|
client/src/components/courses/CourseSave.js | yegor-sytnyk/contoso-express | import React from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {Modal, Button} from 'react-bootstrap';
import _ from 'lodash';
import helper from '../../helpers/uiHelper';
import * as courseActions from '../../actions/courseActions';
import {departmentSelectListItem} from '../../formatters/entityFromatter';
import CourseForm from './CourseForm';
class CourseSave extends React.Component {
constructor(props) {
super(props);
this.state = {
course: _.assign({}, props.course),
errors: {},
saving: false,
visible: props.visible,
close: props.close
};
this.updateCourseState = this.updateCourseState.bind(this);
this.saveCourse = this.saveCourse.bind(this);
}
componentWillReceiveProps(nextProps) {
this.setState({course: _.assign({}, nextProps.course)});
}
updateCourseState(event) {
let course = this.state.course;
const field = event.target.name;
course[field] = event.target.value;
return this.setState({course: course});
}
courseFormIsValid() {
let formIsValid = true;
let errors = {};
if (!this.state.course.number) {
errors.number = 'The Number field is required.';
formIsValid = false;
}
if (!this.state.course.title) {
errors.title = 'The Title field is required.';
formIsValid = false;
}
if (!this.state.course.credits) {
errors.credits = 'The Credits field is required.';
formIsValid = false;
}
if (!_.inRange(this.state.course.credits, 0, 6)) {
errors.credits = 'The field Credits must be between 0 and 5.';
formIsValid = false;
}
if (!this.state.course.departmentId) {
errors.departmentId = 'Department is required.';
formIsValid = false;
}
this.setState({errors: errors});
return formIsValid;
}
saveCourse(event) {
event.preventDefault();
if (!this.courseFormIsValid()) {
return;
}
this.setState({saving: true});
this.props.actions.saveCourse(this.state.course)
.then(() => {
this.props.close();
let message = this.state.course.id ? 'Course updated' : 'Course added';
helper.showMessage(message);
})
.catch(err => {
this.setState({saving: false});
});
}
render() {
let header = this.props.course.id ? 'Edit Course' : 'Create Course';
return (
<div>
<Modal show={this.props.visible} onHide={this.props.close}>
<Modal.Header closeButton onClick={this.props.close}>
<Modal.Title>{header}</Modal.Title>
</Modal.Header>
<Modal.Body>
<CourseForm
course={this.state.course}
allDepartments={this.props.departments}
onChange={this.updateCourseState}
errors={this.state.errors}
/>
</Modal.Body>
<Modal.Footer>
<Button onClick={this.saveCourse}>
{this.props.saving ? 'Saving...' : 'Save'}
</Button>
<Button onClick={this.props.close}>Close</Button>
</Modal.Footer>
</Modal>
</div>
);
}
}
CourseSave.propTypes = {
course: React.PropTypes.object.isRequired,
actions: React.PropTypes.object.isRequired,
visible: React.PropTypes.bool.isRequired,
close: React.PropTypes.func.isRequired
};
function mapStateToProps(state) {
return {
course: _.cloneDeep(state.course.current),
departments: departmentSelectListItem(state.department.list)
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators(courseActions, dispatch)
};
}
export default connect(mapStateToProps, mapDispatchToProps)(CourseSave); |
src/svg-icons/navigation/last-page.js | mtsandeep/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let NavigationLastPage = (props) => (
<SvgIcon {...props}>
<path d="M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"/>
</SvgIcon>
);
NavigationLastPage = pure(NavigationLastPage);
NavigationLastPage.displayName = 'NavigationLastPage';
NavigationLastPage.muiName = 'SvgIcon';
export default NavigationLastPage;
|
src/components/Login/SignUpComponent.js | bibleexchange/be-front-new | import React from 'react';
import {
createFragmentContainer,
graphql,
} from 'react-relay/compat';
import './Login.scss';
class SignUpComponent extends React.Component {
render() {
let messageStyle = { color: 'red', height: '20px' };
if (this.props.signup.message === 'passwords match :)') { messageStyle.color = 'green'; }
return (
<div id='login-form' onMouseLeave={this.props.handleStatus} >
<form >
<input value={this.props.signup.email} type='text' onChange={this.props.handleEditSignUpEmail} placeholder='email' ref='email' />
<input value={this.props.signup.password} type='password' onChange={this.props.handleEditSignUpPassword} placeholder='password' ref='password' />
<input id='message' style={messageStyle} value={this.props.signup.message} type='text' disabled='disabled' />
<input value={this.props.signup.password_confirmation} type='password' onChange={this.props.handleEditSignUpPasswordConfirm} placeholder='password confirmation' ref='password_confirmation' />
<hr />
<input type='button' value='Sign Up' onClick={this.props.handleSignUp} />
</form>
</div>
);
}
}
export default createFragmentContainer(SignUpComponent, {
user: graphql`
fragment SignUpComponent_user on User {
id
token
email
name
authenticated
}
`,
});
|
src/components/Table/TableHeader/TableHeader.stories.js | auth0-extensions/auth0-extension-ui | import React from 'react';
import { storiesOf } from '@kadira/storybook';
import TableHeader from './';
storiesOf('TableHeader', module)
.add('default view', () => (
<TableHeader>
This is the TableHeader children.
</TableHeader>
));
|
tests/components/Counter/Counter.spec.js | thanhiro/tuha-ui-tpl | import React from 'react'
import { bindActionCreators } from 'redux'
import { Counter } from 'components/Counter/Counter'
import { shallow } from 'enzyme'
describe('(Component) Counter', () => {
let _props, _spies, _wrapper
beforeEach(() => {
_spies = {}
_props = {
counter: 5,
...bindActionCreators({
doubleAsync: (_spies.doubleAsync = sinon.spy()),
increment: (_spies.increment = sinon.spy())
}, _spies.dispatch = sinon.spy())
}
_wrapper = shallow(<Counter {..._props} />)
})
it('Should render as a <div>.', () => {
expect(_wrapper.is('div')).to.equal(true)
})
it('Should render with an <h2> that includes Sample Counter text.', () => {
expect(_wrapper.find('h2').text()).to.match(/Counter:/)
})
it('Should render props.counter at the end of the sample counter <h2>.', () => {
expect(_wrapper.find('h2').text()).to.match(/5$/)
_wrapper.setProps({ counter: 8 })
expect(_wrapper.find('h2').text()).to.match(/8$/)
})
it('Should render exactly two buttons.', () => {
expect(_wrapper).to.have.descendants('.btn')
})
//
describe('An increment button...', () => {
let _button
beforeEach(() => {
_button = _wrapper.find('button').filterWhere(a => a.text() === 'Increment')
})
it('has bootstrap classes', () => {
expect(_button.hasClass('btn btn-default')).to.be.true
})
it('Should dispatch a `increment` action when clicked', () => {
_spies.dispatch.should.have.not.been.called
_button.simulate('click')
_spies.dispatch.should.have.been.called
_spies.increment.should.have.been.called
});
})
describe('A Double (Async) button...', () => {
let _button
beforeEach(() => {
_button = _wrapper.find('button').filterWhere(a => a.text() === 'Double (Async)')
})
it('has bootstrap classes', () => {
expect(_button.hasClass('btn btn-default')).to.be.true
})
it('Should dispatch a `doubleAsync` action when clicked', () => {
_spies.dispatch.should.have.not.been.called
_button.simulate('click')
_spies.dispatch.should.have.been.called
_spies.doubleAsync.should.have.been.called
});
})
})
|
src/components/Score.js | calesce/tab-editor | import React, { PureComponent } from 'react';
import { connect } from 'react-redux';
import { StyleSheet, css } from 'aphrodite';
import { makeMapStateToProps } from '../util/selectors';
import { makeScoreSelector } from '../util/selectors/layout';
import { getScoreSectionWidth, calcScoreHeight } from '../util/scoreLayout';
import { setSelectRange } from '../actions/cursor';
import Measure from './measure/Measure';
import SelectBox from './SelectBox';
const SVG_LEFT = 270;
const SVG_TOP = 5;
const SELECT_ERROR = 6;
// Give some room for user error when selecting a range of notes
const styles = StyleSheet.create({
scoreContainer: {
overflow: 'scroll',
height: '100vh',
'margin-left': 15
},
score: {
position: 'relative',
display: 'flex',
flexWrap: 'wrap',
flex: 1,
'margin-top': 5
}
});
class Score extends PureComponent {
constructor(props) {
super(props);
this.state = {
dragStart: undefined,
dragEnd: undefined,
sectionWidth: getScoreSectionWidth()
};
}
componentWillMount() {
window.addEventListener('resize', this.handleResize);
}
componentWillUnmount() {
window.removeEventListener('resize', this.handleResize);
}
handleResize = () => {
this.setState({
sectionWidth: getScoreSectionWidth()
});
};
getNoteRangeForMeasure(measure, xStart, xEnd) {
const notes = measure.notes.map((note, i) => {
const noteX = note.x + measure.xOfMeasure;
return noteX + SELECT_ERROR > xStart && noteX + SELECT_ERROR < xEnd
? i
: null;
});
const filteredNotes = notes.filter(note => note !== null);
return filteredNotes.length === notes.length ? 'all' : filteredNotes;
}
getSelectedRangeForSingleRow(measure, xStart, xEnd) {
if (
xStart > measure.xOfMeasure &&
xEnd < measure.xOfMeasure + measure.width
) {
return this.getNoteRangeForMeasure(measure, xStart, xEnd);
} else if (
(xStart < measure.xOfMeasure && xEnd > measure.xOfMeasure) ||
(xStart > measure.xOfMeasure &&
xStart < measure.xOfMeasure + measure.width)
) {
if (measure.xOfMeasure < xStart) {
return this.getNoteRangeForMeasure(
measure,
xStart,
measure.xOfMeasure + measure.width
);
} else if (xEnd < measure.xOfMeasure + measure.width) {
return this.getNoteRangeForMeasure(measure, measure.xOfMeasure, xEnd);
} else {
return 'all';
}
} else {
return undefined;
}
}
getSelectedRange(measure, xStart, xEnd, selectedRows) {
if (!selectedRows) {
return undefined;
}
const selectedRowIndex = selectedRows.indexOf(measure.rowIndex);
if (selectedRowIndex === -1) {
return undefined;
}
if (selectedRows.length === 1) {
return this.getSelectedRangeForSingleRow(measure, xStart, xEnd);
} else if (selectedRowIndex === 0) {
if (measure.xOfMeasure + measure.width > xStart) {
if (measure.xOfMeasure < xStart) {
// starting measure, need note index
return this.getNoteRangeForMeasure(
measure,
xStart,
measure.xOfMeasure + measure.width
);
} else {
return 'all';
}
}
} else if (selectedRowIndex === selectedRows.length - 1) {
if (xEnd > measure.xOfMeasure) {
if (xEnd < measure.xOfMeasure + measure.width) {
// last measure
return this.getNoteRangeForMeasure(measure, measure.xOfMeasure, xEnd);
} else {
return 'all';
}
}
} else {
return 'all';
}
}
rowFromY(dragY, measures, tuning) {
const rowHeights = measures.reduce((accum, measure) => {
if (!accum[measure.rowIndex]) {
return accum.concat(
(accum.length > 0 ? accum[accum.length - 1] : 0) +
measure.yTop +
measure.yBottom +
75 +
tuning.length * 20
);
}
return accum;
}, []);
return rowHeights
? rowHeights.reduce(
(accum, row, i) => (accum === -1 && dragY < row ? i : accum),
-1
)
: 0;
}
onMouseDown = e => {
e.preventDefault();
const dragX = e.pageX - SVG_LEFT;
const dragY = e.pageY - SVG_TOP;
this.setState({ dragStart: { dragX, dragY }, dragX, dragY });
};
onMouseUp = () => {
const { dragX, dragY, dragHeight, dragWidth } = this.state;
let selectedRows;
if (dragWidth > 5 && dragHeight > 5) {
const startRow = this.rowFromY(
dragY,
this.props.measures,
this.props.tuning
);
const endRow = this.rowFromY(
dragY + dragHeight,
this.props.measures,
this.props.tuning
);
selectedRows = Array.from(
{ length: endRow - startRow + 1 },
(_, k) => k + startRow
);
}
const selectRange = this.props.measures.reduce((accum, measure, i) => {
const measureRange = this.getSelectedRange(
measure,
dragX,
dragX + dragWidth,
selectedRows
);
if (Array.isArray(measureRange)) {
if (measureRange.length === 0) {
return accum;
}
}
const obj = {};
obj[i] = measureRange;
return measureRange ? Object.assign({}, accum, obj) : accum;
}, {});
if (Object.keys(selectRange).length > 0) {
this.props.setSelectRange(selectRange);
} else {
this.props.setSelectRange(undefined);
}
this.setState({
dragStart: undefined,
dragX: undefined,
dragY: undefined,
dragWidth: undefined,
dragHeight: undefined
});
};
onMouseMove = e => {
if (this.state.dragStart) {
e.preventDefault();
const x = e.pageX - SVG_LEFT;
const y = e.pageY - SVG_TOP;
this.setState({
dragX: Math.min(this.state.dragStart.dragX, x),
dragY: Math.min(this.state.dragStart.dragY, y),
dragWidth: Math.abs(this.state.dragStart.dragX - x),
dragHeight: Math.abs(this.state.dragStart.dragY - y)
});
}
};
calcLinearWidth(measures) {
return measures.reduce((width, measure) => {
return measure.width + width;
}, 20);
}
render() {
const { measures, layout, tuning } = this.props;
const { dragX, dragY, dragWidth, dragHeight, sectionWidth } = this.state;
const width =
layout === 'linear' ? this.calcLinearWidth(measures) : sectionWidth;
const height =
layout === 'linear' ? 'auto' : calcScoreHeight(measures, tuning);
return (
<div className={css(styles.scoreContainer)} ref={this.props.scrollRef}>
<div
className={css(styles.score)}
style={{ height, width }}
onMouseDown={this.onMouseDown}
onMouseUp={this.onMouseUp}
onMouseMove={this.onMouseMove}
ref={el => {
this.scoreRef = el;
}}
>
{measures.map((_, i) => <Measure key={i} measureIndex={i} />)}
<SelectBox
height={height}
width={width}
x={dragX}
y={dragY}
dragWidth={dragWidth}
dragHeight={dragHeight}
/>
</div>
</div>
);
}
}
export default connect(makeMapStateToProps(makeScoreSelector), {
setSelectRange
})(Score);
|
packages/strapi-admin/files/public/app/components/LeftMenuFooter/index.js | evian42/starpies | /**
*
* LeftMenuFooter
*
*/
import React from 'react';
import { FormattedMessage } from 'react-intl';
import styles from './styles.scss';
import LocaleToggle from 'containers/LocaleToggle';
import messages from './messages.json';
import { define } from '../../i18n';
define(messages);
class LeftMenuFooter extends React.Component { // eslint-disable-line react/prefer-stateless-function
render() {
return (
<div className={styles.leftMenuFooter}>
<FormattedMessage {...messages.poweredBy} /> <a href="http://strapi.io" target="_blank">Strapi</a>
<LocaleToggle />
</div>
);
}
}
export default LeftMenuFooter;
|
app/javascript/mastodon/features/follow_requests/index.js | ikuradon/mastodon | import React from 'react';
import { connect } from 'react-redux';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { debounce } from 'lodash';
import LoadingIndicator from '../../components/loading_indicator';
import Column from '../ui/components/column';
import ColumnBackButtonSlim from '../../components/column_back_button_slim';
import AccountAuthorizeContainer from './containers/account_authorize_container';
import { fetchFollowRequests, expandFollowRequests } from '../../actions/accounts';
import ScrollableList from '../../components/scrollable_list';
import { me } from '../../initial_state';
const messages = defineMessages({
heading: { id: 'column.follow_requests', defaultMessage: 'Follow requests' },
});
const mapStateToProps = state => ({
accountIds: state.getIn(['user_lists', 'follow_requests', 'items']),
isLoading: state.getIn(['user_lists', 'follow_requests', 'isLoading'], true),
hasMore: !!state.getIn(['user_lists', 'follow_requests', 'next']),
locked: !!state.getIn(['accounts', me, 'locked']),
domain: state.getIn(['meta', 'domain']),
});
export default @connect(mapStateToProps)
@injectIntl
class FollowRequests extends ImmutablePureComponent {
static propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
hasMore: PropTypes.bool,
isLoading: PropTypes.bool,
accountIds: ImmutablePropTypes.list,
locked: PropTypes.bool,
domain: PropTypes.string,
intl: PropTypes.object.isRequired,
multiColumn: PropTypes.bool,
};
componentWillMount () {
this.props.dispatch(fetchFollowRequests());
}
handleLoadMore = debounce(() => {
this.props.dispatch(expandFollowRequests());
}, 300, { leading: true });
render () {
const { intl, accountIds, hasMore, multiColumn, locked, domain, isLoading } = this.props;
if (!accountIds) {
return (
<Column>
<LoadingIndicator />
</Column>
);
}
const emptyMessage = <FormattedMessage id='empty_column.follow_requests' defaultMessage="You don't have any follow requests yet. When you receive one, it will show up here." />;
const unlockedPrependMessage = locked ? null : (
<div className='follow_requests-unlocked_explanation'>
<FormattedMessage
id='follow_requests.unlocked_explanation'
defaultMessage='Even though your account is not locked, the {domain} staff thought you might want to review follow requests from these accounts manually.'
values={{ domain: domain }}
/>
</div>
);
return (
<Column bindToDocument={!multiColumn} icon='user-plus' heading={intl.formatMessage(messages.heading)}>
<ColumnBackButtonSlim />
<ScrollableList
scrollKey='follow_requests'
onLoadMore={this.handleLoadMore}
hasMore={hasMore}
isLoading={isLoading}
emptyMessage={emptyMessage}
bindToDocument={!multiColumn}
prepend={unlockedPrependMessage}
>
{accountIds.map(id =>
<AccountAuthorizeContainer key={id} id={id} />,
)}
</ScrollableList>
</Column>
);
}
}
|
app/index.js | adamsome/electron-nav | import React from 'react'
import { render } from 'react-dom'
import { AppContainer } from 'react-hot-loader'
import Root from './containers/Root'
import { configureStore, history } from './store/configureStore'
import './app.global.scss'
// const initialTestState = {
// }
const store = configureStore()
// TODO: Actually store the last place user left off
history.push('/step/0000000001')
render(
<AppContainer>
<Root store={store} history={history} />
</AppContainer>,
document.getElementById('root')
)
if (module.hot) {
module.hot.accept('./containers/Root', () => {
const NextRoot = require('./containers/Root') // eslint-disable-line global-require
render(
<AppContainer>
<NextRoot store={store} history={history} />
</AppContainer>,
document.getElementById('root')
)
})
}
|
src/components/ErrorOverlay.js | GrooshBene/shellscripts | import './style/ErrorOverlay.scss';
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { errorDismiss } from '../actions/load.js';
import Dialog from './Dialog.js';
import Alert from './Alert.js';
class ErrorOverlay extends Component {
handleDismiss() {
this.props.errorDismiss();
}
componentDidMount() {
this.handleFocus();
}
componentDidUpdate() {
this.handleFocus();
}
handleFocus() {
const { load: { error } } = this.props;
if (!error) return;
this.refs.dismiss.getDOMNode().focus();
}
render() {
const { load: { error } } = this.props;
if (!error) return false;
return (
<div id='errorCover'>
<div className='middle'>
<Dialog title='Error'>
<div>{`An error occurred. This might be a network problem, or
the server's problem. If the problem persists, please contact
us.`}</div>
<Alert>{`${error.error} while processing ${error.type}`}</Alert>
<div className='footer'>
<button onClick={this.handleDismiss.bind(this)}
ref='dismiss'>Dismiss</button>
</div>
</Dialog>
</div>
</div>
);
}
}
ErrorOverlay.propTypes = {
load: PropTypes.object.isRequired,
errorDismiss: PropTypes.func.isRequired
};
export default connect(
(state) => ({load: state.load}),
{ errorDismiss }
)(ErrorOverlay);
|
actor-apps/app-web/src/app/components/modals/invite-user/InviteByLink.react.js | cnbin/actor-platform | import React from 'react';
import Modal from 'react-modal';
import addons from 'react/addons';
import ReactMixin from 'react-mixin';
import { IntlMixin, FormattedMessage } from 'react-intl';
import { Styles, FlatButton, Snackbar } from 'material-ui';
import ReactZeroClipboard from 'react-zeroclipboard';
import { KeyCodes } from 'constants/ActorAppConstants';
import ActorTheme from 'constants/ActorTheme';
import InviteUserByLinkActions from 'actions/InviteUserByLinkActions';
import InviteUserActions from 'actions/InviteUserActions';
import InviteUserStore from 'stores/InviteUserStore';
const ThemeManager = new Styles.ThemeManager();
const appElement = document.getElementById('actor-web-app');
Modal.setAppElement(appElement);
const {addons: { PureRenderMixin }} = addons;
const getStateFromStores = () => {
return {
isShown: InviteUserStore.isInviteWithLinkModalOpen(),
group: InviteUserStore.getGroup(),
inviteUrl: InviteUserStore.getInviteUrl()
};
};
@ReactMixin.decorate(IntlMixin)
@ReactMixin.decorate(PureRenderMixin)
class InviteByLink extends React.Component {
static childContextTypes = {
muiTheme: React.PropTypes.object
};
getChildContext() {
return {
muiTheme: ThemeManager.getCurrentTheme()
};
}
constructor(props) {
super(props);
this.state = getStateFromStores();
ThemeManager.setTheme(ActorTheme);
ThemeManager.setComponentThemes({
button: {
minWidth: 60
}
});
InviteUserStore.addChangeListener(this.onChange);
document.addEventListener('keydown', this.onKeyDown, false);
}
componentWillUnmount() {
InviteUserStore.removeChangeListener(this.onChange);
document.removeEventListener('keydown', this.onKeyDown, false);
}
render() {
const group = this.state.group;
const inviteUrl = this.state.inviteUrl;
const isShown = this.state.isShown;
const snackbarStyles = ActorTheme.getSnackbarStyles();
let groupName;
if (group !== null) {
groupName = <b>{group.name}</b>;
}
return (
<Modal className="modal-new modal-new--invite-by-link"
closeTimeoutMS={150}
isOpen={isShown}
style={{width: 400}}>
<header className="modal-new__header">
<svg className="modal-new__header__icon icon icon--blue"
dangerouslySetInnerHTML={{__html: '<use xlink:href="assets/sprite/icons.svg#back"/>'}}
onClick={this.onBackClick}/>
<h3 className="modal-new__header__title">
<FormattedMessage message={this.getIntlMessage('inviteByLinkModalTitle')}/>
</h3>
<div className="pull-right">
<FlatButton hoverColor="rgba(81,145,219,.17)"
label="Done"
labelStyle={{padding: '0 8px'}}
onClick={this.onClose}
secondary={true}
style={{marginTop: -6}}/>
</div>
</header>
<div className="modal-new__body">
<FormattedMessage groupName={groupName} message={this.getIntlMessage('inviteByLinkModalDescription')}/>
<textarea className="invite-url" onClick={this.onInviteLinkClick} readOnly row="3" value={inviteUrl}/>
</div>
<footer className="modal-new__footer">
<button className="button button--light-blue pull-left hide">
<FormattedMessage message={this.getIntlMessage('inviteByLinkModalRevokeButton')}/>
</button>
<ReactZeroClipboard onCopy={this.onInviteLinkCopied} text={inviteUrl}>
<button className="button button--blue pull-right">
<FormattedMessage message={this.getIntlMessage('inviteByLinkModalCopyButton')}/>
</button>
</ReactZeroClipboard>
</footer>
<Snackbar autoHideDuration={3000}
message={this.getIntlMessage('integrationTokenCopied')}
ref="inviteLinkCopied"
style={snackbarStyles}/>
</Modal>
);
}
onClose = () => {
InviteUserByLinkActions.hide();
};
onBackClick = () => {
this.onClose();
InviteUserActions.show(this.state.group);
};
onInviteLinkClick = event => {
event.target.select();
};
onChange = () => {
this.setState(getStateFromStores());
};
onKeyDown = (event) => {
if (event.keyCode === KeyCodes.ESC) {
event.preventDefault();
this.onClose();
}
};
onInviteLinkCopied = () => {
this.refs.inviteLinkCopied.show();
};
}
export default InviteByLink;
|
frontend/src/components/account/sign-up/SignUp.js | googleinterns/step-2020-recipe-finder | // Copyright 2020 Google LLC
// 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
// https://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.
import React, { Component } from "react";
import Form from "react-bootstrap/Form";
import "./SignUp.css";
import Button from "react-bootstrap/Button";
import { getDietaryRequirements } from "../../../utils/DietaryRequirements";
import { backButton } from "../../utils/Utilities";
import Walkthrough from "../../login/Walkthrough";
import Toast from "react-bootstrap/Toast";
import AccountHeader from "../../header/AccountHeader";
class SignUp extends Component {
constructor(properties) {
super(properties);
const propertiesState = properties.location.state;
const isSignUp = propertiesState === undefined;
this.state = {
name: isSignUp ? "" : propertiesState.name,
diets: isSignUp ? [] : propertiesState.diets,
allergies: isSignUp ? [] : propertiesState.allergies,
isSignUp: isSignUp,
showModal: false,
showToast: true,
};
this.addAllergy = this.addAllergy.bind(this);
this.removeAllergy = this.removeAllergy.bind(this);
this.handleNameChange = this.handleNameChange.bind(this);
this.handleDietChange = this.handleDietChange.bind(this);
this.handleAllergyChange = this.handleAllergyChange.bind(this);
this.setShowModal = this.setShowModal.bind(this);
this.closeModalAndToast = this.closeModalAndToast.bind(this);
this.closeToast = this.closeToast.bind(this);
}
render() {
const title = this.state.isSignUp ? "Sign Up" : "Change account details";
const redirectLink = this.state.isSignUp ? "/home" : "/account";
return (
<div>
{this.getBackButtonIfChangeAccountDetails()}
{this.getWalkthroughIfSignUp()}
{this.state.isSignUp ? "" : <AccountHeader />}
<div className="centered-container">
<h1>{title}</h1>
<Form action="/api/account" method="POST">
<Form.Control
type="hidden"
name="redirectLink"
value={redirectLink}
/>
<Form.Group>
<Form.Label>Name/Nickname</Form.Label>
<Form.Control
required
type="text"
name="name"
placeholder="Enter your name/nickname"
value={this.state.name}
onChange={this.handleNameChange}
/>
</Form.Group>
<Form.Group>
<Form.Label>Dietary Requirements</Form.Label>
{getDietaryRequirements().map((item, index) => (
<Form.Check
key={index}
type="checkbox"
name="diets"
checked={this.state.diets.includes(item.value)}
onChange={this.handleDietChange}
value={item.value}
label={item.label}
/>
))}
{this.state.allergies.map((item, index) => (
<div key={index} className="custom-diet-div">
<Form.Control
className="custom-diet-input"
type="text"
name="allergies"
placeholder="Enter allergy/food you can't eat"
value={item}
onChange={(event) => this.handleAllergyChange(event, index)}
></Form.Control>
<Button
className="custom-diet-remove-btn"
onClick={() => this.removeAllergy(index)}
variant="outline-danger"
>
Remove
</Button>
</div>
))}
<Button
className="add-diet-btn w-100"
variant="outline-primary"
onClick={this.addAllergy}
>
Add allergy/food I can't eat
</Button>
</Form.Group>
<Button className="w-100" variant="primary" type="submit">
Submit
</Button>
</Form>
</div>
</div>
);
}
getBackButtonIfChangeAccountDetails() {
if (!this.state.isSignUp) {
return backButton();
}
}
getWalkthroughIfSignUp() {
if (this.state.isSignUp) {
return (
<div>
<Walkthrough
handleClose={this.closeModalAndToast}
showModal={this.state.showModal}
/>
<div className="text-center">
<Toast show={this.state.showToast}>
<Toast.Header>
Do you want to see how Recipe Finder works?
</Toast.Header>
<Toast.Body>
<Button variant="link" onClick={this.setShowModal}>
Yes
</Button>
<Button variant="" onClick={this.closeToast}>
No
</Button>
</Toast.Body>
</Toast>
</div>
</div>
);
}
}
closeToast() {
this.setState({ showToast: false });
}
closeModalAndToast() {
this.setState({ showModal: false, showToast: false });
}
setShowModal() {
this.setState({ showModal: true });
}
addAllergy() {
const previousAllergies = this.state.allergies;
previousAllergies.push("");
this.setState({ allergies: previousAllergies });
}
removeAllergy(index) {
const previousAllergies = this.state.allergies;
previousAllergies.splice(index, 1);
this.setState({ allergies: previousAllergies });
}
handleNameChange(event) {
const newName = event.target.value;
this.setState({ name: newName });
}
handleDietChange(event) {
const isChecked = event.target.checked;
const value = event.target.value;
const diets = this.state.diets;
if (isChecked) {
diets.push(value);
} else {
diets.pop(value);
}
this.setState({ diets: diets });
}
handleAllergyChange(event, index) {
const diet = event.target.value;
const diets = this.state.allergies;
diets[index] = diet;
this.setState({ allergies: diets });
}
}
export default SignUp;
|
lib/Container.js | hhhonzik/react-createjs | import React from 'react';
export default class Container extends React.Component{
static isEaselJSComponent = true;
draw () {
console.log('draw element');
}
render() {
throw new Error('Do not render CreateJS component outside of <Stage>');
}
}
|
redux-weather-forecast/src/containers/search-bar.js | andreassiegel/react-redux | import React, { Component } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { fetchWeather } from '../actions/index';
class SearchBar extends Component {
constructor(props) {
super(props);
this.state = { term: '' };
this.onInputChange = this.onInputChange.bind(this);
this.onFormSubmit = this.onFormSubmit.bind(this);
}
onInputChange(event) {
this.setState({ term: event.target.value });
}
onFormSubmit(event) {
event.preventDefault();
// We need to go and fetch weather data
this.props.fetchWeather(this.state.term);
this.setState({ term: '' });
}
render() {
return (
<form onSubmit={ this.onFormSubmit } className="input-group">
<input
placeholder="Get a five-day forecast in your favorite cities"
className="form-control"
value={ this.state.term }
onChange={ this.onInputChange }
/>
<span className="input-group-btn">
<button type="submit" className="btn btn-secondary">Submit</button>
</span>
</form>
);
}
}
function mapDispatchToProps(dispatch) {
return bindActionCreators({ fetchWeather }, dispatch);
}
export default connect(null, mapDispatchToProps)(SearchBar);
|
ajax/libs/yui/3.7.0/event-focus/event-focus.js | Eruant/cdnjs | YUI.add('event-focus', function (Y, NAME) {
/**
* Adds bubbling and delegation support to DOM events focus and blur.
*
* @module event
* @submodule event-focus
*/
var Event = Y.Event,
YLang = Y.Lang,
isString = YLang.isString,
arrayIndex = Y.Array.indexOf,
useActivate = YLang.isFunction(
Y.DOM.create('<p onbeforeactivate=";"/>').onbeforeactivate);
function define(type, proxy, directEvent) {
var nodeDataKey = '_' + type + 'Notifiers';
Y.Event.define(type, {
_attach: function (el, notifier, delegate) {
if (Y.DOM.isWindow(el)) {
return Event._attach([type, function (e) {
notifier.fire(e);
}, el]);
} else {
return Event._attach(
[proxy, this._proxy, el, this, notifier, delegate],
{ capture: true });
}
},
_proxy: function (e, notifier, delegate) {
var target = e.target,
currentTarget = e.currentTarget,
notifiers = target.getData(nodeDataKey),
yuid = Y.stamp(currentTarget._node),
defer = (useActivate || target !== currentTarget),
directSub;
notifier.currentTarget = (delegate) ? target : currentTarget;
notifier.container = (delegate) ? currentTarget : null;
// Maintain a list to handle subscriptions from nested
// containers div#a>div#b>input #a.on(focus..) #b.on(focus..),
// use one focus or blur subscription that fires notifiers from
// #b then #a to emulate bubble sequence.
if (!notifiers) {
notifiers = {};
target.setData(nodeDataKey, notifiers);
// only subscribe to the element's focus if the target is
// not the current target (
if (defer) {
directSub = Event._attach(
[directEvent, this._notify, target._node]).sub;
directSub.once = true;
}
} else {
// In old IE, defer is always true. In capture-phase browsers,
// The delegate subscriptions will be encountered first, which
// will establish the notifiers data and direct subscription
// on the node. If there is also a direct subscription to the
// node's focus/blur, it should not call _notify because the
// direct subscription from the delegate sub(s) exists, which
// will call _notify. So this avoids _notify being called
// twice, unnecessarily.
defer = true;
}
if (!notifiers[yuid]) {
notifiers[yuid] = [];
}
notifiers[yuid].push(notifier);
if (!defer) {
this._notify(e);
}
},
_notify: function (e, container) {
var currentTarget = e.currentTarget,
notifierData = currentTarget.getData(nodeDataKey),
axisNodes = currentTarget.ancestors(),
doc = currentTarget.get('ownerDocument'),
delegates = [],
// Used to escape loops when there are no more
// notifiers to consider
count = notifierData ?
Y.Object.keys(notifierData).length :
0,
target, notifiers, notifier, yuid, match, tmp, i, len, sub, ret;
// clear the notifications list (mainly for delegation)
currentTarget.clearData(nodeDataKey);
// Order the delegate subs by their placement in the parent axis
axisNodes.push(currentTarget);
// document.get('ownerDocument') returns null
// which we'll use to prevent having duplicate Nodes in the list
if (doc) {
axisNodes.unshift(doc);
}
// ancestors() returns the Nodes from top to bottom
axisNodes._nodes.reverse();
if (count) {
// Store the count for step 2
tmp = count;
axisNodes.some(function (node) {
var yuid = Y.stamp(node),
notifiers = notifierData[yuid],
i, len;
if (notifiers) {
count--;
for (i = 0, len = notifiers.length; i < len; ++i) {
if (notifiers[i].handle.sub.filter) {
delegates.push(notifiers[i]);
}
}
}
return !count;
});
count = tmp;
}
// Walk up the parent axis, notifying direct subscriptions and
// testing delegate filters.
while (count && (target = axisNodes.shift())) {
yuid = Y.stamp(target);
notifiers = notifierData[yuid];
if (notifiers) {
for (i = 0, len = notifiers.length; i < len; ++i) {
notifier = notifiers[i];
sub = notifier.handle.sub;
match = true;
e.currentTarget = target;
if (sub.filter) {
match = sub.filter.apply(target,
[target, e].concat(sub.args || []));
// No longer necessary to test against this
// delegate subscription for the nodes along
// the parent axis.
delegates.splice(
arrayIndex(delegates, notifier), 1);
}
if (match) {
// undefined for direct subs
e.container = notifier.container;
ret = notifier.fire(e);
}
if (ret === false || e.stopped === 2) {
break;
}
}
delete notifiers[yuid];
count--;
}
if (e.stopped !== 2) {
// delegates come after subs targeting this specific node
// because they would not normally report until they'd
// bubbled to the container node.
for (i = 0, len = delegates.length; i < len; ++i) {
notifier = delegates[i];
sub = notifier.handle.sub;
if (sub.filter.apply(target,
[target, e].concat(sub.args || []))) {
e.container = notifier.container;
e.currentTarget = target;
ret = notifier.fire(e);
}
if (ret === false || e.stopped === 2) {
break;
}
}
}
if (e.stopped) {
break;
}
}
},
on: function (node, sub, notifier) {
sub.handle = this._attach(node._node, notifier);
},
detach: function (node, sub) {
sub.handle.detach();
},
delegate: function (node, sub, notifier, filter) {
if (isString(filter)) {
sub.filter = function (target) {
return Y.Selector.test(target._node, filter,
node === target ? null : node._node);
};
}
sub.handle = this._attach(node._node, notifier, true);
},
detachDelegate: function (node, sub) {
sub.handle.detach();
}
}, true);
}
// For IE, we need to defer to focusin rather than focus because
// `el.focus(); doSomething();` executes el.onbeforeactivate, el.onactivate,
// el.onfocusin, doSomething, then el.onfocus. All others support capture
// phase focus, which executes before doSomething. To guarantee consistent
// behavior for this use case, IE's direct subscriptions are made against
// focusin so subscribers will be notified before js following el.focus() is
// executed.
if (useActivate) {
// name capture phase direct subscription
define("focus", "beforeactivate", "focusin");
define("blur", "beforedeactivate", "focusout");
} else {
define("focus", "focus", "focus");
define("blur", "blur", "blur");
}
}, '@VERSION@', {"requires": ["event-synthetic"]});
|
Week02-RestBasics-old/client/src/index.js | bmeansjd/ISIT320_means2017 | import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();
|
src/App.js | spectralliaisons/multimap | import React from 'react';
import Map from './Map';
function App() {
return (
<div>
<Map />
</div>
);
}
export default App;
|
node_modules/react-bootstrap/es/FormGroup.js | NathanBWaters/jb_club | import _extends from 'babel-runtime/helpers/extends';
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
import classNames from 'classnames';
import React from 'react';
import { bsClass, bsSizes, getClassSet, splitBsPropsAndOmit } from './utils/bootstrapUtils';
import { Size } from './utils/StyleConfig';
import ValidComponentChildren from './utils/ValidComponentChildren';
var propTypes = {
/**
* Sets `id` on `<FormControl>` and `htmlFor` on `<FormGroup.Label>`.
*/
controlId: React.PropTypes.string,
validationState: React.PropTypes.oneOf(['success', 'warning', 'error'])
};
var childContextTypes = {
$bs_formGroup: React.PropTypes.object.isRequired
};
var FormGroup = function (_React$Component) {
_inherits(FormGroup, _React$Component);
function FormGroup() {
_classCallCheck(this, FormGroup);
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
}
FormGroup.prototype.getChildContext = function getChildContext() {
var _props = this.props,
controlId = _props.controlId,
validationState = _props.validationState;
return {
$bs_formGroup: {
controlId: controlId,
validationState: validationState
}
};
};
FormGroup.prototype.hasFeedback = function hasFeedback(children) {
var _this2 = this;
return ValidComponentChildren.some(children, function (child) {
return child.props.bsRole === 'feedback' || child.props.children && _this2.hasFeedback(child.props.children);
});
};
FormGroup.prototype.render = function render() {
var _props2 = this.props,
validationState = _props2.validationState,
className = _props2.className,
children = _props2.children,
props = _objectWithoutProperties(_props2, ['validationState', 'className', 'children']);
var _splitBsPropsAndOmit = splitBsPropsAndOmit(props, ['controlId']),
bsProps = _splitBsPropsAndOmit[0],
elementProps = _splitBsPropsAndOmit[1];
var classes = _extends({}, getClassSet(bsProps), {
'has-feedback': this.hasFeedback(children)
});
if (validationState) {
classes['has-' + validationState] = true;
}
return React.createElement(
'div',
_extends({}, elementProps, {
className: classNames(className, classes)
}),
children
);
};
return FormGroup;
}(React.Component);
FormGroup.propTypes = propTypes;
FormGroup.childContextTypes = childContextTypes;
export default bsClass('form-group', bsSizes([Size.LARGE, Size.SMALL], FormGroup)); |
src/components/MessageView.js | saas-plat/saas-plat-native | import React from 'react';
import {
View,
Text,
Platform,
StatusBar,
TouchableOpacity
} from 'react-native';
import {autobind} from 'core-decorators';
import {connectStyle} from '../core/Theme';
import {translate} from '../core/I18n';
import { tx } from '../utils/internal';
// 消息提示
@translate('core.MessageView')
@connectStyle('core.MessageView')
export default class MessageView extends React.Component {
@autobind
onPressFeed() {
this.props.history.goBack();
}
getTipMsg() {
let tipMsg = this.props.msg || tx('迷路了吗?返回上一页。');
switch (this.props.code) {
case 'ModuleNotExists':
tipMsg = tx('导航页面不存在啦~~~戳我返回上一页。');
break;
case 'AuthenticationFailed':
tipMsg = tx('尚未登录无法访问当前页面哦~戳我返回上一页。');
break;
case 'ServerAddressNotLoaded':
tipMsg = tx('服务器地址尚未加载成功,点我可以尝试退出重新登录试试。');
break;
case 'ServerLoadFailed':
tipMsg = tx('门户页配置错误,无法打开啦,点我进入管理控制台调整~。');
break;
case 'BaseLoadFailed':
tipMsg = tx('平台组件加载失败,请进入社区http://community.saas-plat.com查找解决方案~。');
break;
}
return tipMsg;
}
renderToolbar() {
return (<ToolbarAndroid onIconClicked={this.onPressFeed} style={this.props.style.toolbar} title={this.props.t('MessageTitle')}/>);
}
render() {
return (
<View style={this.props.style.page}>
{(Platform.OS === 'android' || Platform.OS === 'ios')?<StatusBar hidden={false} barStyle='default'/>:null}
<View style={this.props.style.container}>
<TouchableOpacity onPress={this.onPressFeed}>
<View>
<Text style={this.props.style.error}>{this.getTipMsg()}</Text>
</View>
</TouchableOpacity>
</View>
</View>
);
}
}
|
app/javascript/mastodon/features/getting_started/index.js | mosaxiv/mastodon | import React from 'react';
import Column from '../ui/components/column';
import ColumnLink from '../ui/components/column_link';
import ColumnSubheading from '../ui/components/column_subheading';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { me, invitesEnabled, version } from '../../initial_state';
import { fetchFollowRequests } from '../../actions/accounts';
import { List as ImmutableList } from 'immutable';
import { Link } from 'react-router-dom';
import NavigationBar from '../compose/components/navigation_bar';
const messages = defineMessages({
home_timeline: { id: 'tabs_bar.home', defaultMessage: 'Home' },
notifications: { id: 'tabs_bar.notifications', defaultMessage: 'Notifications' },
public_timeline: { id: 'navigation_bar.public_timeline', defaultMessage: 'Federated timeline' },
settings_subheading: { id: 'column_subheading.settings', defaultMessage: 'Settings' },
community_timeline: { id: 'navigation_bar.community_timeline', defaultMessage: 'Local timeline' },
direct: { id: 'navigation_bar.direct', defaultMessage: 'Direct messages' },
preferences: { id: 'navigation_bar.preferences', defaultMessage: 'Preferences' },
follow_requests: { id: 'navigation_bar.follow_requests', defaultMessage: 'Follow requests' },
favourites: { id: 'navigation_bar.favourites', defaultMessage: 'Favourites' },
blocks: { id: 'navigation_bar.blocks', defaultMessage: 'Blocked users' },
domain_blocks: { id: 'navigation_bar.domain_blocks', defaultMessage: 'Hidden domains' },
mutes: { id: 'navigation_bar.mutes', defaultMessage: 'Muted users' },
pins: { id: 'navigation_bar.pins', defaultMessage: 'Pinned toots' },
lists: { id: 'navigation_bar.lists', defaultMessage: 'Lists' },
discover: { id: 'navigation_bar.discover', defaultMessage: 'Discover' },
personal: { id: 'navigation_bar.personal', defaultMessage: 'Personal' },
security: { id: 'navigation_bar.security', defaultMessage: 'Security' },
menu: { id: 'getting_started.heading', defaultMessage: 'Getting started' },
});
const mapStateToProps = state => ({
myAccount: state.getIn(['accounts', me]),
unreadFollowRequests: state.getIn(['user_lists', 'follow_requests', 'items'], ImmutableList()).size,
});
const mapDispatchToProps = dispatch => ({
fetchFollowRequests: () => dispatch(fetchFollowRequests()),
});
const badgeDisplay = (number, limit) => {
if (number === 0) {
return undefined;
} else if (limit && number >= limit) {
return `${limit}+`;
} else {
return number;
}
};
@connect(mapStateToProps, mapDispatchToProps)
@injectIntl
export default class GettingStarted extends ImmutablePureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
myAccount: ImmutablePropTypes.map.isRequired,
columns: ImmutablePropTypes.list,
multiColumn: PropTypes.bool,
fetchFollowRequests: PropTypes.func.isRequired,
unreadFollowRequests: PropTypes.number,
unreadNotifications: PropTypes.number,
};
componentDidMount () {
const { myAccount, fetchFollowRequests } = this.props;
if (myAccount.get('locked')) {
fetchFollowRequests();
}
}
render () {
const { intl, myAccount, multiColumn, unreadFollowRequests } = this.props;
const navItems = [];
let i = 1;
let height = (multiColumn) ? 0 : 60;
if (multiColumn) {
navItems.push(
<ColumnSubheading key={i++} text={intl.formatMessage(messages.discover)} />,
<ColumnLink key={i++} icon='users' text={intl.formatMessage(messages.community_timeline)} to='/timelines/public/local' />,
<ColumnLink key={i++} icon='globe' text={intl.formatMessage(messages.public_timeline)} to='/timelines/public' />,
<ColumnSubheading key={i++} text={intl.formatMessage(messages.personal)} />
);
height += 34*2 + 48*2;
}
navItems.push(
<ColumnLink key={i++} icon='envelope' text={intl.formatMessage(messages.direct)} to='/timelines/direct' />,
<ColumnLink key={i++} icon='star' text={intl.formatMessage(messages.favourites)} to='/favourites' />,
<ColumnLink key={i++} icon='list-ul' text={intl.formatMessage(messages.lists)} to='/lists' />
);
height += 48*3;
if (myAccount.get('locked')) {
navItems.push(<ColumnLink key={i++} icon='users' text={intl.formatMessage(messages.follow_requests)} badge={badgeDisplay(unreadFollowRequests, 40)} to='/follow_requests' />);
height += 48;
}
if (!multiColumn) {
navItems.push(
<ColumnSubheading key={i++} text={intl.formatMessage(messages.settings_subheading)} />,
<ColumnLink key={i++} icon='gears' text={intl.formatMessage(messages.preferences)} href='/settings/preferences' />,
);
height += 34 + 48;
}
return (
<Column label={intl.formatMessage(messages.menu)}>
{multiColumn && <div className='column-header__wrapper'>
<h1 className='column-header'>
<button>
<i className='fa fa-bars fa-fw column-header__icon' />
<FormattedMessage id='getting_started.heading' defaultMessage='Getting started' />
</button>
</h1>
</div>}
<div className='getting-started'>
<div className='getting-started__wrapper' style={{ height }}>
{!multiColumn && <NavigationBar account={myAccount} />}
{navItems}
</div>
{!multiColumn && <div className='flex-spacer' />}
<div className='getting-started__footer'>
<ul>
<li><a href='https://bridge.joinmastodon.org/' target='_blank'><FormattedMessage id='getting_started.find_friends' defaultMessage='Find friends from Twitter' /></a> · </li>
{invitesEnabled && <li><a href='/invites' target='_blank'><FormattedMessage id='getting_started.invite' defaultMessage='Invite people' /></a> · </li>}
{multiColumn && <li><Link to='/keyboard-shortcuts'><FormattedMessage id='navigation_bar.keyboard_shortcuts' defaultMessage='Hotkeys' /></Link> · </li>}
<li><a href='/auth/edit'><FormattedMessage id='getting_started.security' defaultMessage='Security' /></a> · </li>
<li><a href='/about/more' target='_blank'><FormattedMessage id='navigation_bar.info' defaultMessage='About this instance' /></a> · </li>
<li><a href='https://joinmastodon.org/apps' target='_blank'><FormattedMessage id='navigation_bar.apps' defaultMessage='Mobile apps' /></a> · </li>
<li><a href='/terms' target='_blank'><FormattedMessage id='getting_started.terms' defaultMessage='Terms of service' /></a> · </li>
<li><a href='/settings/applications' target='_blank'><FormattedMessage id='getting_started.developers' defaultMessage='Developers' /></a> · </li>
<li><a href='https://github.com/tootsuite/documentation#documentation' target='_blank'><FormattedMessage id='getting_started.documentation' defaultMessage='Documentation' /></a> · </li>
<li><a href='/auth/sign_out' data-method='delete'><FormattedMessage id='navigation_bar.logout' defaultMessage='Logout' /></a></li>
</ul>
<p>
<FormattedMessage
id='getting_started.open_source_notice'
defaultMessage='Mastodon is open source software. You can contribute or report issues on GitHub at {github}.'
values={{ github: <span><a href='https://github.com/tootsuite/mastodon' rel='noopener' target='_blank'>tootsuite/mastodon</a> (v{version})</span> }}
/>
</p>
</div>
</div>
</Column>
);
}
}
|
public/bower_components/backbone.marionette/public/javascripts/jquery.js | shamelessly/website | /*!
* jQuery JavaScript Library v1.10.2
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2013-07-03T13:48Z
*/
(function( window, undefined ) {
// Can't do this because several apps including ASP.NET trace
// the stack via arguments.caller.callee and Firefox dies if
// you try to trace through "use strict" call chains. (#13335)
// Support: Firefox 18+
//"use strict";
var
// The deferred used on DOM ready
readyList,
// A central reference to the root jQuery(document)
rootjQuery,
// Support: IE<10
// For `typeof xmlNode.method` instead of `xmlNode.method !== undefined`
core_strundefined = typeof undefined,
// Use the correct document accordingly with window argument (sandbox)
location = window.location,
document = window.document,
docElem = document.documentElement,
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
// [[Class]] -> type pairs
class2type = {},
// List of deleted data cache ids, so we can reuse them
core_deletedIds = [],
core_version = "1.10.2",
// Save a reference to some core methods
core_concat = core_deletedIds.concat,
core_push = core_deletedIds.push,
core_slice = core_deletedIds.slice,
core_indexOf = core_deletedIds.indexOf,
core_toString = class2type.toString,
core_hasOwn = class2type.hasOwnProperty,
core_trim = core_version.trim,
// Define a local copy of jQuery
jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
},
// Used for matching numbers
core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
// Used for splitting on whitespace
core_rnotwhite = /\S+/g,
// Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
// A simple way to check for HTML strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
// Strict HTML recognition (#11290: must start with <)
rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
// Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
// JSON RegExp
rvalidchars = /^[\],:{}\s]*$/,
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
// Matches dashed string for camelizing
rmsPrefix = /^-ms-/,
rdashAlpha = /-([\da-z])/gi,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
return letter.toUpperCase();
},
// The ready event handler
completed = function( event ) {
// readyState === "complete" is good enough for us to call the dom ready in oldIE
if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
detach();
jQuery.ready();
}
},
// Clean-up method for dom ready events
detach = function() {
if ( document.addEventListener ) {
document.removeEventListener( "DOMContentLoaded", completed, false );
window.removeEventListener( "load", completed, false );
} else {
document.detachEvent( "onreadystatechange", completed );
window.detachEvent( "onload", completed );
}
};
jQuery.fn = jQuery.prototype = {
// The current version of jQuery being used
jquery: core_version,
constructor: jQuery,
init: function( selector, context, rootjQuery ) {
var match, elem;
// HANDLE: $(""), $(null), $(undefined), $(false)
if ( !selector ) {
return this;
}
// Handle HTML strings
if ( typeof selector === "string" ) {
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 = rquickExpr.exec( selector );
}
// Match html or make sure no context is specified for #id
if ( match && (match[1] || !context) ) {
// HANDLE: $(html) -> $(array)
if ( match[1] ) {
context = context instanceof jQuery ? context[0] : context;
// scripts is true for back-compat
jQuery.merge( this, jQuery.parseHTML(
match[1],
context && context.nodeType ? context.ownerDocument || context : document,
true
) );
// HANDLE: $(html, props)
if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
for ( match in context ) {
// Properties of context are called as methods if possible
if ( jQuery.isFunction( this[ match ] ) ) {
this[ match ]( context[ match ] );
// ...and otherwise set as attributes
} else {
this.attr( match, context[ match ] );
}
}
}
return this;
// 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: $(DOMElement)
} else if ( selector.nodeType ) {
this.context = this[0] = selector;
this.length = 1;
return this;
// 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 default length of a jQuery object is 0
length: 0,
toArray: function() {
return core_slice.call( this );
},
// 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 ) {
// Build a new jQuery matched element set
var ret = jQuery.merge( this.constructor(), elems );
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
// 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 ) {
// Add the callback
jQuery.ready.promise().done( fn );
return this;
},
slice: function() {
return this.pushStack( core_slice.apply( this, arguments ) );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
eq: function( i ) {
var len = this.length,
j = +i + ( i < 0 ? len : 0 );
return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
},
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: core_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 src, copyIsArray, copy, name, options, 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({
// Unique for each copy of jQuery on the page
// Non-digits removed to match rinlinejQuery
expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
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 ) {
// Abort if there are pending holds or we're already ready
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
return;
}
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( !document.body ) {
return setTimeout( jQuery.ready );
}
// 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.resolveWith( document, [ jQuery ] );
// Trigger any bound ready events
if ( jQuery.fn.trigger ) {
jQuery( document ).trigger("ready").off("ready");
}
},
// 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";
},
isWindow: function( obj ) {
/* jshint eqeqeq: false */
return obj != null && obj == obj.window;
},
isNumeric: function( obj ) {
return !isNaN( parseFloat(obj) ) && isFinite( obj );
},
type: function( obj ) {
if ( obj == null ) {
return String( obj );
}
return typeof obj === "object" || typeof obj === "function" ?
class2type[ core_toString.call(obj) ] || "object" :
typeof obj;
},
isPlainObject: function( obj ) {
var key;
// 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 &&
!core_hasOwn.call(obj, "constructor") &&
!core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
return false;
}
} catch ( e ) {
// IE8,9 Will throw exceptions on certain host objects #9897
return false;
}
// Support: IE<9
// Handle iteration over inherited properties before own properties.
if ( jQuery.support.ownLast ) {
for ( key in obj ) {
return core_hasOwn.call( obj, key );
}
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
for ( key in obj ) {}
return key === undefined || core_hasOwn.call( obj, key );
},
isEmptyObject: function( obj ) {
var name;
for ( name in obj ) {
return false;
}
return true;
},
error: function( msg ) {
throw new Error( msg );
},
// data: string of html
// context (optional): If specified, the fragment will be created in this context, defaults to document
// keepScripts (optional): If true, will include scripts passed in the html string
parseHTML: function( data, context, keepScripts ) {
if ( !data || typeof data !== "string" ) {
return null;
}
if ( typeof context === "boolean" ) {
keepScripts = context;
context = false;
}
context = context || document;
var parsed = rsingleTag.exec( data ),
scripts = !keepScripts && [];
// Single tag
if ( parsed ) {
return [ context.createElement( parsed[1] ) ];
}
parsed = jQuery.buildFragment( [ data ], context, scripts );
if ( scripts ) {
jQuery( scripts ).remove();
}
return jQuery.merge( [], parsed.childNodes );
},
parseJSON: function( data ) {
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data );
}
if ( data === null ) {
return data;
}
if ( typeof data === "string" ) {
// Make sure leading/trailing whitespace is removed (IE can't handle it)
data = jQuery.trim( data );
if ( 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;
if ( !data || typeof data !== "string" ) {
return null;
}
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 && jQuery.trim( 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.toLowerCase() === name.toLowerCase();
},
// args is for internal usage only
each: function( obj, callback, args ) {
var value,
i = 0,
length = obj.length,
isArray = isArraylike( obj );
if ( args ) {
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback.apply( obj[ i ], args );
if ( value === false ) {
break;
}
}
} else {
for ( i in obj ) {
value = callback.apply( obj[ i ], args );
if ( value === false ) {
break;
}
}
}
// A special, fast, case for the most common use of each
} else {
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback.call( obj[ i ], i, obj[ i ] );
if ( value === false ) {
break;
}
}
} else {
for ( i in obj ) {
value = callback.call( obj[ i ], i, obj[ i ] );
if ( value === false ) {
break;
}
}
}
}
return obj;
},
// Use native String.trim function wherever possible
trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
function( text ) {
return text == null ?
"" :
core_trim.call( text );
} :
// Otherwise use our own trimming functionality
function( text ) {
return text == null ?
"" :
( text + "" ).replace( rtrim, "" );
},
// results is for internal usage only
makeArray: function( arr, results ) {
var ret = results || [];
if ( arr != null ) {
if ( isArraylike( Object(arr) ) ) {
jQuery.merge( ret,
typeof arr === "string" ?
[ arr ] : arr
);
} else {
core_push.call( ret, arr );
}
}
return ret;
},
inArray: function( elem, arr, i ) {
var len;
if ( arr ) {
if ( core_indexOf ) {
return core_indexOf.call( arr, elem, i );
}
len = arr.length;
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
for ( ; i < len; i++ ) {
// Skip accessing in sparse arrays
if ( i in arr && arr[ i ] === elem ) {
return i;
}
}
}
return -1;
},
merge: function( first, second ) {
var l = second.length,
i = first.length,
j = 0;
if ( typeof l === "number" ) {
for ( ; 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 retVal,
ret = [],
i = 0,
length = elems.length;
inv = !!inv;
// Go through the array, only saving the items
// that pass the validator function
for ( ; 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,
i = 0,
length = elems.length,
isArray = isArraylike( elems ),
ret = [];
// 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 ( i in elems ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
}
// Flatten any nested arrays
return core_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 ) {
var args, proxy, tmp;
if ( typeof context === "string" ) {
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
args = core_slice.call( arguments, 2 );
proxy = function() {
return fn.apply( context || this, args.concat( core_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 || jQuery.guid++;
return proxy;
},
// Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function
access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
var i = 0,
length = elems.length,
bulk = key == null;
// Sets many values
if ( jQuery.type( key ) === "object" ) {
chainable = true;
for ( i in key ) {
jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
}
// Sets one value
} else if ( value !== undefined ) {
chainable = true;
if ( !jQuery.isFunction( value ) ) {
raw = true;
}
if ( bulk ) {
// Bulk operations run against the entire set
if ( raw ) {
fn.call( elems, value );
fn = null;
// ...except when executing function values
} else {
bulk = fn;
fn = function( elem, key, value ) {
return bulk.call( jQuery( elem ), value );
};
}
}
if ( fn ) {
for ( ; i < length; i++ ) {
fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
}
}
}
return chainable ?
elems :
// Gets
bulk ?
fn.call( elems ) :
length ? fn( elems[0], key ) : emptyGet;
},
now: function() {
return ( new Date() ).getTime();
},
// A method for quickly swapping in/out CSS properties to get correct calculations.
// Note: this method belongs to the css module but it's needed here for the support module.
// If support gets modularized, this method should be moved back to the css module.
swap: function( elem, options, callback, args ) {
var ret, name,
old = {};
// Remember the old values, and insert the new ones
for ( name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
ret = callback.apply( elem, args || [] );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
return ret;
}
});
jQuery.ready.promise = function( obj ) {
if ( !readyList ) {
readyList = jQuery.Deferred();
// Catch cases where $(document).ready() is called after the browser event has already occurred.
// we once tried to use readyState "interactive" here, but it caused issues like the one
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
if ( document.readyState === "complete" ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
setTimeout( jQuery.ready );
// Standards-based browsers support DOMContentLoaded
} else if ( document.addEventListener ) {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", completed, false );
// A fallback to window.onload, that will always work
window.addEventListener( "load", completed, false );
// If IE event model is used
} else {
// Ensure firing before onload, maybe late but safe also for iframes
document.attachEvent( "onreadystatechange", completed );
// A fallback to window.onload, that will always work
window.attachEvent( "onload", completed );
// If IE and not a frame
// continually check to see if the document is ready
var top = false;
try {
top = window.frameElement == null && document.documentElement;
} catch(e) {}
if ( top && top.doScroll ) {
(function doScrollCheck() {
if ( !jQuery.isReady ) {
try {
// Use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
top.doScroll("left");
} catch(e) {
return setTimeout( doScrollCheck, 50 );
}
// detach all dom ready events
detach();
// and execute any waiting functions
jQuery.ready();
}
})();
}
}
}
return readyList.promise( obj );
};
// Populate the class2type map
jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
});
function isArraylike( obj ) {
var length = obj.length,
type = jQuery.type( obj );
if ( jQuery.isWindow( obj ) ) {
return false;
}
if ( obj.nodeType === 1 && length ) {
return true;
}
return type === "array" || type !== "function" &&
( length === 0 ||
typeof length === "number" && length > 0 && ( length - 1 ) in obj );
}
// All jQuery objects should point back to these
rootjQuery = jQuery(document);
/*!
* Sizzle CSS Selector Engine v1.10.2
* http://sizzlejs.com/
*
* Copyright 2013 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2013-07-03
*/
(function( window, undefined ) {
var i,
support,
cachedruns,
Expr,
getText,
isXML,
compile,
outermostContext,
sortInput,
// Local document vars
setDocument,
document,
docElem,
documentIsHTML,
rbuggyQSA,
rbuggyMatches,
matches,
contains,
// Instance-specific data
expando = "sizzle" + -(new Date()),
preferredDoc = window.document,
dirruns = 0,
done = 0,
classCache = createCache(),
tokenCache = createCache(),
compilerCache = createCache(),
hasDuplicate = false,
sortOrder = function( a, b ) {
if ( a === b ) {
hasDuplicate = true;
return 0;
}
return 0;
},
// General-purpose constants
strundefined = typeof undefined,
MAX_NEGATIVE = 1 << 31,
// Instance methods
hasOwn = ({}).hasOwnProperty,
arr = [],
pop = arr.pop,
push_native = arr.push,
push = arr.push,
slice = arr.slice,
// Use a stripped-down indexOf if we can't use a native one
indexOf = arr.indexOf || function( elem ) {
var i = 0,
len = this.length;
for ( ; i < len; i++ ) {
if ( this[i] === elem ) {
return i;
}
}
return -1;
},
booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
// Regular expressions
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
whitespace = "[\\x20\\t\\r\\n\\f]",
// http://www.w3.org/TR/css3-syntax/#characters
characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
// Loosely modeled on CSS identifier characters
// An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
identifier = characterEncoding.replace( "w", "w#" ),
// Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
"*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
// Prefer arguments quoted,
// then not containing pseudos/brackets,
// then attribute selectors/non-parenthetical expressions,
// then anything else
// These preferences are here to reduce the number of selectors
// needing tokenize in the PSEUDO preFilter
pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
rsibling = new RegExp( whitespace + "*[+~]" ),
rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*)" + whitespace + "*\\]", "g" ),
rpseudo = new RegExp( pseudos ),
ridentifier = new RegExp( "^" + identifier + "$" ),
matchExpr = {
"ID": new RegExp( "^#(" + characterEncoding + ")" ),
"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
"TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
"ATTR": new RegExp( "^" + attributes ),
"PSEUDO": new RegExp( "^" + pseudos ),
"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
"bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
// For use in libraries implementing .is()
// We use this for POS matching in `select`
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
},
rnative = /^[^{]+\{\s*\[native \w/,
// Easily-parseable/retrievable ID or TAG or CLASS selectors
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
rinputs = /^(?:input|select|textarea|button)$/i,
rheader = /^h\d$/i,
rescape = /'|\\/g,
// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
funescape = function( _, escaped, escapedWhitespace ) {
var high = "0x" + escaped - 0x10000;
// NaN means non-codepoint
// Support: Firefox
// Workaround erroneous numeric interpretation of +"0x"
return high !== high || escapedWhitespace ?
escaped :
// BMP codepoint
high < 0 ?
String.fromCharCode( high + 0x10000 ) :
// Supplemental Plane codepoint (surrogate pair)
String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
};
// Optimize for push.apply( _, NodeList )
try {
push.apply(
(arr = slice.call( preferredDoc.childNodes )),
preferredDoc.childNodes
);
// Support: Android<4.0
// Detect silently failing push.apply
arr[ preferredDoc.childNodes.length ].nodeType;
} catch ( e ) {
push = { apply: arr.length ?
// Leverage slice if possible
function( target, els ) {
push_native.apply( target, slice.call(els) );
} :
// Support: IE<9
// Otherwise append directly
function( target, els ) {
var j = target.length,
i = 0;
// Can't trust NodeList.length
while ( (target[j++] = els[i++]) ) {}
target.length = j - 1;
}
};
}
function Sizzle( selector, context, results, seed ) {
var match, elem, m, nodeType,
// QSA vars
i, groups, old, nid, newContext, newSelector;
if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
setDocument( context );
}
context = context || document;
results = results || [];
if ( !selector || typeof selector !== "string" ) {
return results;
}
if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
return [];
}
if ( documentIsHTML && !seed ) {
// Shortcuts
if ( (match = rquickExpr.exec( selector )) ) {
// Speed-up: Sizzle("#ID")
if ( (m = match[1]) ) {
if ( nodeType === 9 ) {
elem = context.getElementById( m );
// 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, Opera, and Webkit return items
// by name instead of ID
if ( elem.id === m ) {
results.push( elem );
return results;
}
} else {
return results;
}
} else {
// Context is not a document
if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
contains( context, elem ) && elem.id === m ) {
results.push( elem );
return results;
}
}
// Speed-up: Sizzle("TAG")
} else if ( match[2] ) {
push.apply( results, context.getElementsByTagName( selector ) );
return results;
// Speed-up: Sizzle(".CLASS")
} else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {
push.apply( results, context.getElementsByClassName( m ) );
return results;
}
}
// QSA path
if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
nid = old = expando;
newContext = context;
newSelector = nodeType === 9 && selector;
// 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
if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
groups = tokenize( selector );
if ( (old = context.getAttribute("id")) ) {
nid = old.replace( rescape, "\\$&" );
} else {
context.setAttribute( "id", nid );
}
nid = "[id='" + nid + "'] ";
i = groups.length;
while ( i-- ) {
groups[i] = nid + toSelector( groups[i] );
}
newContext = rsibling.test( selector ) && context.parentNode || context;
newSelector = groups.join(",");
}
if ( newSelector ) {
try {
push.apply( results,
newContext.querySelectorAll( newSelector )
);
return results;
} catch(qsaError) {
} finally {
if ( !old ) {
context.removeAttribute("id");
}
}
}
}
}
// All others
return select( selector.replace( rtrim, "$1" ), context, results, seed );
}
/**
* Create key-value caches of limited size
* @returns {Function(string, Object)} Returns the Object data after storing it on itself with
* property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
* deleting the oldest entry
*/
function createCache() {
var keys = [];
function cache( key, value ) {
// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
if ( keys.push( key += " " ) > Expr.cacheLength ) {
// Only keep the most recent entries
delete cache[ keys.shift() ];
}
return (cache[ key ] = value);
}
return cache;
}
/**
* Mark a function for special use by Sizzle
* @param {Function} fn The function to mark
*/
function markFunction( fn ) {
fn[ expando ] = true;
return fn;
}
/**
* Support testing using an element
* @param {Function} fn Passed the created div and expects a boolean result
*/
function assert( fn ) {
var div = document.createElement("div");
try {
return !!fn( div );
} catch (e) {
return false;
} finally {
// Remove from its parent by default
if ( div.parentNode ) {
div.parentNode.removeChild( div );
}
// release memory in IE
div = null;
}
}
/**
* Adds the same handler for all of the specified attrs
* @param {String} attrs Pipe-separated list of attributes
* @param {Function} handler The method that will be applied
*/
function addHandle( attrs, handler ) {
var arr = attrs.split("|"),
i = attrs.length;
while ( i-- ) {
Expr.attrHandle[ arr[i] ] = handler;
}
}
/**
* Checks document order of two siblings
* @param {Element} a
* @param {Element} b
* @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
*/
function siblingCheck( a, b ) {
var cur = b && a,
diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
( ~b.sourceIndex || MAX_NEGATIVE ) -
( ~a.sourceIndex || MAX_NEGATIVE );
// Use IE sourceIndex if available on both nodes
if ( diff ) {
return diff;
}
// Check if b follows a
if ( cur ) {
while ( (cur = cur.nextSibling) ) {
if ( cur === b ) {
return -1;
}
}
}
return a ? 1 : -1;
}
/**
* Returns a function to use in pseudos for input types
* @param {String} type
*/
function createInputPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === type;
};
}
/**
* Returns a function to use in pseudos for buttons
* @param {String} type
*/
function createButtonPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && elem.type === type;
};
}
/**
* Returns a function to use in pseudos for positionals
* @param {Function} fn
*/
function createPositionalPseudo( fn ) {
return markFunction(function( argument ) {
argument = +argument;
return markFunction(function( seed, matches ) {
var j,
matchIndexes = fn( [], seed.length, argument ),
i = matchIndexes.length;
// Match elements found at the specified indexes
while ( i-- ) {
if ( seed[ (j = matchIndexes[i]) ] ) {
seed[j] = !(matches[j] = seed[j]);
}
}
});
});
}
/**
* Detect xml
* @param {Element|Object} elem An element or a document
*/
isXML = 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).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
// Expose support vars for convenience
support = Sizzle.support = {};
/**
* Sets document-related variables once based on the current document
* @param {Element|Object} [doc] An element or document object to use to set the document
* @returns {Object} Returns the current document
*/
setDocument = Sizzle.setDocument = function( node ) {
var doc = node ? node.ownerDocument || node : preferredDoc,
parent = doc.defaultView;
// If no document and documentElement is available, return
if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
return document;
}
// Set our document
document = doc;
docElem = doc.documentElement;
// Support tests
documentIsHTML = !isXML( doc );
// Support: IE>8
// If iframe document is assigned to "document" variable and if iframe has been reloaded,
// IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
// IE6-8 do not support the defaultView property so parent will be undefined
if ( parent && parent.attachEvent && parent !== parent.top ) {
parent.attachEvent( "onbeforeunload", function() {
setDocument();
});
}
/* Attributes
---------------------------------------------------------------------- */
// Support: IE<8
// Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)
support.attributes = assert(function( div ) {
div.className = "i";
return !div.getAttribute("className");
});
/* getElement(s)By*
---------------------------------------------------------------------- */
// Check if getElementsByTagName("*") returns only elements
support.getElementsByTagName = assert(function( div ) {
div.appendChild( doc.createComment("") );
return !div.getElementsByTagName("*").length;
});
// Check if getElementsByClassName can be trusted
support.getElementsByClassName = assert(function( div ) {
div.innerHTML = "<div class='a'></div><div class='a i'></div>";
// Support: Safari<4
// Catch class over-caching
div.firstChild.className = "i";
// Support: Opera<10
// Catch gEBCN failure to find non-leading classes
return div.getElementsByClassName("i").length === 2;
});
// Support: IE<10
// Check if getElementById returns elements by name
// The broken getElementById methods don't pick up programatically-set names,
// so use a roundabout getElementsByName test
support.getById = assert(function( div ) {
docElem.appendChild( div ).id = expando;
return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
});
// ID find and filter
if ( support.getById ) {
Expr.find["ID"] = function( id, context ) {
if ( typeof context.getElementById !== strundefined && documentIsHTML ) {
var m = context.getElementById( id );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
return m && m.parentNode ? [m] : [];
}
};
Expr.filter["ID"] = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
return elem.getAttribute("id") === attrId;
};
};
} else {
// Support: IE6/7
// getElementById is not reliable as a find shortcut
delete Expr.find["ID"];
Expr.filter["ID"] = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
return node && node.value === attrId;
};
};
}
// Tag
Expr.find["TAG"] = support.getElementsByTagName ?
function( tag, context ) {
if ( typeof context.getElementsByTagName !== strundefined ) {
return context.getElementsByTagName( tag );
}
} :
function( tag, context ) {
var elem,
tmp = [],
i = 0,
results = context.getElementsByTagName( tag );
// Filter out possible comments
if ( tag === "*" ) {
while ( (elem = results[i++]) ) {
if ( elem.nodeType === 1 ) {
tmp.push( elem );
}
}
return tmp;
}
return results;
};
// Class
Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) {
return context.getElementsByClassName( className );
}
};
/* QSA/matchesSelector
---------------------------------------------------------------------- */
// QSA and matchesSelector support
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
rbuggyMatches = [];
// qSa(:focus) reports false when true (Chrome 21)
// We allow this because of a bug in IE8/9 that throws an error
// whenever `document.activeElement` is accessed on an iframe
// So, we allow :focus to pass through QSA all the time to avoid the IE error
// See http://bugs.jquery.com/ticket/13378
rbuggyQSA = [];
if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
// Build QSA regex
// Regex strategy adopted from Diego Perini
assert(function( div ) {
// Select is set to empty string on purpose
// This is to test IE's treatment of not explicitly
// setting a boolean content attribute,
// since its presence should be enough
// http://bugs.jquery.com/ticket/12359
div.innerHTML = "<select><option selected=''></option></select>";
// Support: IE8
// Boolean attributes and "value" are not treated correctly
if ( !div.querySelectorAll("[selected]").length ) {
rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
}
// Webkit/Opera - :checked should return selected option elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
// IE8 throws error here and will not see later tests
if ( !div.querySelectorAll(":checked").length ) {
rbuggyQSA.push(":checked");
}
});
assert(function( div ) {
// Support: Opera 10-12/IE8
// ^= $= *= and empty values
// Should not select anything
// Support: Windows 8 Native Apps
// The type attribute is restricted during .innerHTML assignment
var input = doc.createElement("input");
input.setAttribute( "type", "hidden" );
div.appendChild( input ).setAttribute( "t", "" );
if ( div.querySelectorAll("[t^='']").length ) {
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
}
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
// IE8 throws error here and will not see later tests
if ( !div.querySelectorAll(":enabled").length ) {
rbuggyQSA.push( ":enabled", ":disabled" );
}
// Opera 10-11 does not throw on post-comma invalid pseudos
div.querySelectorAll("*,:x");
rbuggyQSA.push(",.*:");
});
}
if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector ||
docElem.mozMatchesSelector ||
docElem.oMatchesSelector ||
docElem.msMatchesSelector) )) ) {
assert(function( div ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9)
support.disconnectedMatch = matches.call( div, "div" );
// This should fail with an exception
// Gecko does not error, returns false instead
matches.call( div, "[s!='']:x" );
rbuggyMatches.push( "!=", pseudos );
});
}
rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
/* Contains
---------------------------------------------------------------------- */
// Element contains another
// Purposefully does not implement inclusive descendent
// As in, an element does not contain itself
contains = rnative.test( docElem.contains ) || docElem.compareDocumentPosition ?
function( a, b ) {
var adown = a.nodeType === 9 ? a.documentElement : a,
bup = b && b.parentNode;
return a === bup || !!( bup && bup.nodeType === 1 && (
adown.contains ?
adown.contains( bup ) :
a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
));
} :
function( a, b ) {
if ( b ) {
while ( (b = b.parentNode) ) {
if ( b === a ) {
return true;
}
}
}
return false;
};
/* Sorting
---------------------------------------------------------------------- */
// Document order sorting
sortOrder = docElem.compareDocumentPosition ?
function( a, b ) {
// Flag for duplicate removal
if ( a === b ) {
hasDuplicate = true;
return 0;
}
var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b );
if ( compare ) {
// Disconnected nodes
if ( compare & 1 ||
(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
// Choose the first element that is related to our preferred document
if ( a === doc || contains(preferredDoc, a) ) {
return -1;
}
if ( b === doc || contains(preferredDoc, b) ) {
return 1;
}
// Maintain original order
return sortInput ?
( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
0;
}
return compare & 4 ? -1 : 1;
}
// Not directly comparable, sort on existence of method
return a.compareDocumentPosition ? -1 : 1;
} :
function( a, b ) {
var cur,
i = 0,
aup = a.parentNode,
bup = b.parentNode,
ap = [ a ],
bp = [ b ];
// Exit early if the nodes are identical
if ( a === b ) {
hasDuplicate = true;
return 0;
// Parentless nodes are either documents or disconnected
} else if ( !aup || !bup ) {
return a === doc ? -1 :
b === doc ? 1 :
aup ? -1 :
bup ? 1 :
sortInput ?
( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
0;
// If the nodes are siblings, we can do a quick check
} else if ( aup === bup ) {
return siblingCheck( a, b );
}
// Otherwise we need full lists of their ancestors for comparison
cur = a;
while ( (cur = cur.parentNode) ) {
ap.unshift( cur );
}
cur = b;
while ( (cur = cur.parentNode) ) {
bp.unshift( cur );
}
// Walk down the tree looking for a discrepancy
while ( ap[i] === bp[i] ) {
i++;
}
return i ?
// Do a sibling check if the nodes have a common ancestor
siblingCheck( ap[i], bp[i] ) :
// Otherwise nodes in our document sort first
ap[i] === preferredDoc ? -1 :
bp[i] === preferredDoc ? 1 :
0;
};
return doc;
};
Sizzle.matches = function( expr, elements ) {
return Sizzle( expr, null, null, elements );
};
Sizzle.matchesSelector = function( elem, expr ) {
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
// Make sure that attribute selectors are quoted
expr = expr.replace( rattributeQuotes, "='$1']" );
if ( support.matchesSelector && documentIsHTML &&
( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
try {
var ret = matches.call( elem, expr );
// IE 9's matchesSelector returns false on disconnected nodes
if ( ret || support.disconnectedMatch ||
// As well, disconnected nodes are said to be in a document
// fragment in IE 9
elem.document && elem.document.nodeType !== 11 ) {
return ret;
}
} catch(e) {}
}
return Sizzle( expr, document, null, [elem] ).length > 0;
};
Sizzle.contains = function( context, elem ) {
// Set document vars if needed
if ( ( context.ownerDocument || context ) !== document ) {
setDocument( context );
}
return contains( context, elem );
};
Sizzle.attr = function( elem, name ) {
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
var fn = Expr.attrHandle[ name.toLowerCase() ],
// Don't get fooled by Object.prototype properties (jQuery #13807)
val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
fn( elem, name, !documentIsHTML ) :
undefined;
return val === undefined ?
support.attributes || !documentIsHTML ?
elem.getAttribute( name ) :
(val = elem.getAttributeNode(name)) && val.specified ?
val.value :
null :
val;
};
Sizzle.error = function( msg ) {
throw new Error( "Syntax error, unrecognized expression: " + msg );
};
/**
* Document sorting and removing duplicates
* @param {ArrayLike} results
*/
Sizzle.uniqueSort = function( results ) {
var elem,
duplicates = [],
j = 0,
i = 0;
// Unless we *know* we can detect duplicates, assume their presence
hasDuplicate = !support.detectDuplicates;
sortInput = !support.sortStable && results.slice( 0 );
results.sort( sortOrder );
if ( hasDuplicate ) {
while ( (elem = results[i++]) ) {
if ( elem === results[ i ] ) {
j = duplicates.push( i );
}
}
while ( j-- ) {
results.splice( duplicates[ j ], 1 );
}
}
return results;
};
/**
* Utility function for retrieving the text value of an array of DOM nodes
* @param {Array|Element} elem
*/
getText = Sizzle.getText = function( elem ) {
var node,
ret = "",
i = 0,
nodeType = elem.nodeType;
if ( !nodeType ) {
// If no nodeType, this is expected to be an array
for ( ; (node = elem[i]); i++ ) {
// Do not traverse comment nodes
ret += getText( node );
}
} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
// Use textContent for elements
// innerText usage removed for consistency of new lines (see #11153)
if ( typeof elem.textContent === "string" ) {
return elem.textContent;
} else {
// Traverse its children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
ret += getText( elem );
}
}
} else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}
// Do not include comment or processing instruction nodes
return ret;
};
Expr = Sizzle.selectors = {
// Can be adjusted by the user
cacheLength: 50,
createPseudo: markFunction,
match: matchExpr,
attrHandle: {},
find: {},
relative: {
">": { dir: "parentNode", first: true },
" ": { dir: "parentNode" },
"+": { dir: "previousSibling", first: true },
"~": { dir: "previousSibling" }
},
preFilter: {
"ATTR": function( match ) {
match[1] = match[1].replace( runescape, funescape );
// Move the given value to match[3] whether quoted or unquoted
match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
if ( match[2] === "~=" ) {
match[3] = " " + match[3] + " ";
}
return match.slice( 0, 4 );
},
"CHILD": function( match ) {
/* matches from matchExpr["CHILD"]
1 type (only|nth|...)
2 what (child|of-type)
3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
4 xn-component of xn+y argument ([+-]?\d*n|)
5 sign of xn-component
6 x of xn-component
7 sign of y-component
8 y of y-component
*/
match[1] = match[1].toLowerCase();
if ( match[1].slice( 0, 3 ) === "nth" ) {
// nth-* requires argument
if ( !match[3] ) {
Sizzle.error( match[0] );
}
// numeric x and y parameters for Expr.filter.CHILD
// remember that false/true cast respectively to 0/1
match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
// other types prohibit arguments
} else if ( match[3] ) {
Sizzle.error( match[0] );
}
return match;
},
"PSEUDO": function( match ) {
var excess,
unquoted = !match[5] && match[2];
if ( matchExpr["CHILD"].test( match[0] ) ) {
return null;
}
// Accept quoted arguments as-is
if ( match[3] && match[4] !== undefined ) {
match[2] = match[4];
// Strip excess characters from unquoted arguments
} else if ( unquoted && rpseudo.test( unquoted ) &&
// Get excess from tokenize (recursively)
(excess = tokenize( unquoted, true )) &&
// advance to the next closing parenthesis
(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
// excess is a negative index
match[0] = match[0].slice( 0, excess );
match[2] = unquoted.slice( 0, excess );
}
// Return only captures needed by the pseudo filter method (type and argument)
return match.slice( 0, 3 );
}
},
filter: {
"TAG": function( nodeNameSelector ) {
var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
return nodeNameSelector === "*" ?
function() { return true; } :
function( elem ) {
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
};
},
"CLASS": function( className ) {
var pattern = classCache[ className + " " ];
return pattern ||
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
classCache( className, function( elem ) {
return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" );
});
},
"ATTR": function( name, operator, check ) {
return function( elem ) {
var result = Sizzle.attr( elem, name );
if ( result == null ) {
return operator === "!=";
}
if ( !operator ) {
return true;
}
result += "";
return operator === "=" ? result === check :
operator === "!=" ? result !== check :
operator === "^=" ? check && result.indexOf( check ) === 0 :
operator === "*=" ? check && result.indexOf( check ) > -1 :
operator === "$=" ? check && result.slice( -check.length ) === check :
operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
false;
};
},
"CHILD": function( type, what, argument, first, last ) {
var simple = type.slice( 0, 3 ) !== "nth",
forward = type.slice( -4 ) !== "last",
ofType = what === "of-type";
return first === 1 && last === 0 ?
// Shortcut for :nth-*(n)
function( elem ) {
return !!elem.parentNode;
} :
function( elem, context, xml ) {
var cache, outerCache, node, diff, nodeIndex, start,
dir = simple !== forward ? "nextSibling" : "previousSibling",
parent = elem.parentNode,
name = ofType && elem.nodeName.toLowerCase(),
useCache = !xml && !ofType;
if ( parent ) {
// :(first|last|only)-(child|of-type)
if ( simple ) {
while ( dir ) {
node = elem;
while ( (node = node[ dir ]) ) {
if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
return false;
}
}
// Reverse direction for :only-* (if we haven't yet done so)
start = dir = type === "only" && !start && "nextSibling";
}
return true;
}
start = [ forward ? parent.firstChild : parent.lastChild ];
// non-xml :nth-child(...) stores cache data on `parent`
if ( forward && useCache ) {
// Seek `elem` from a previously-cached index
outerCache = parent[ expando ] || (parent[ expando ] = {});
cache = outerCache[ type ] || [];
nodeIndex = cache[0] === dirruns && cache[1];
diff = cache[0] === dirruns && cache[2];
node = nodeIndex && parent.childNodes[ nodeIndex ];
while ( (node = ++nodeIndex && node && node[ dir ] ||
// Fallback to seeking `elem` from the start
(diff = nodeIndex = 0) || start.pop()) ) {
// When found, cache indexes on `parent` and break
if ( node.nodeType === 1 && ++diff && node === elem ) {
outerCache[ type ] = [ dirruns, nodeIndex, diff ];
break;
}
}
// Use previously-cached element index if available
} else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
diff = cache[1];
// xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
} else {
// Use the same loop as above to seek `elem` from the start
while ( (node = ++nodeIndex && node && node[ dir ] ||
(diff = nodeIndex = 0) || start.pop()) ) {
if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
// Cache the index of each encountered element
if ( useCache ) {
(node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
}
if ( node === elem ) {
break;
}
}
}
}
// Incorporate the offset, then check against cycle size
diff -= last;
return diff === first || ( diff % first === 0 && diff / first >= 0 );
}
};
},
"PSEUDO": function( pseudo, argument ) {
// pseudo-class names are case-insensitive
// http://www.w3.org/TR/selectors/#pseudo-classes
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
// Remember that setFilters inherits from pseudos
var args,
fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
Sizzle.error( "unsupported pseudo: " + pseudo );
// The user may use createPseudo to indicate that
// arguments are needed to create the filter function
// just as Sizzle does
if ( fn[ expando ] ) {
return fn( argument );
}
// But maintain support for old signatures
if ( fn.length > 1 ) {
args = [ pseudo, pseudo, "", argument ];
return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
markFunction(function( seed, matches ) {
var idx,
matched = fn( seed, argument ),
i = matched.length;
while ( i-- ) {
idx = indexOf.call( seed, matched[i] );
seed[ idx ] = !( matches[ idx ] = matched[i] );
}
}) :
function( elem ) {
return fn( elem, 0, args );
};
}
return fn;
}
},
pseudos: {
// Potentially complex pseudos
"not": markFunction(function( selector ) {
// Trim the selector passed to compile
// to avoid treating leading and trailing
// spaces as combinators
var input = [],
results = [],
matcher = compile( selector.replace( rtrim, "$1" ) );
return matcher[ expando ] ?
markFunction(function( seed, matches, context, xml ) {
var elem,
unmatched = matcher( seed, null, xml, [] ),
i = seed.length;
// Match elements unmatched by `matcher`
while ( i-- ) {
if ( (elem = unmatched[i]) ) {
seed[i] = !(matches[i] = elem);
}
}
}) :
function( elem, context, xml ) {
input[0] = elem;
matcher( input, null, xml, results );
return !results.pop();
};
}),
"has": markFunction(function( selector ) {
return function( elem ) {
return Sizzle( selector, elem ).length > 0;
};
}),
"contains": markFunction(function( text ) {
return function( elem ) {
return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
};
}),
// "Whether an element is represented by a :lang() selector
// is based solely on the element's language value
// being equal to the identifier C,
// or beginning with the identifier C immediately followed by "-".
// The matching of C against the element's language value is performed case-insensitively.
// The identifier C does not have to be a valid language name."
// http://www.w3.org/TR/selectors/#lang-pseudo
"lang": markFunction( function( lang ) {
// lang value must be a valid identifier
if ( !ridentifier.test(lang || "") ) {
Sizzle.error( "unsupported lang: " + lang );
}
lang = lang.replace( runescape, funescape ).toLowerCase();
return function( elem ) {
var elemLang;
do {
if ( (elemLang = documentIsHTML ?
elem.lang :
elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
elemLang = elemLang.toLowerCase();
return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
}
} while ( (elem = elem.parentNode) && elem.nodeType === 1 );
return false;
};
}),
// Miscellaneous
"target": function( elem ) {
var hash = window.location && window.location.hash;
return hash && hash.slice( 1 ) === elem.id;
},
"root": function( elem ) {
return elem === docElem;
},
"focus": function( elem ) {
return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
},
// Boolean properties
"enabled": function( elem ) {
return elem.disabled === false;
},
"disabled": function( elem ) {
return elem.disabled === true;
},
"checked": function( elem ) {
// In CSS3, :checked should return both checked and selected elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
var nodeName = elem.nodeName.toLowerCase();
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
},
"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;
},
// Contents
"empty": function( elem ) {
// http://www.w3.org/TR/selectors/#empty-pseudo
// :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
// not comment, processing instructions, or others
// Thanks to Diego Perini for the nodeName shortcut
// Greater than "@" means alpha characters (specifically not starting with "#" or "?")
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) {
return false;
}
}
return true;
},
"parent": function( elem ) {
return !Expr.pseudos["empty"]( elem );
},
// Element/input types
"header": function( elem ) {
return rheader.test( elem.nodeName );
},
"input": function( elem ) {
return rinputs.test( elem.nodeName );
},
"button": function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === "button" || name === "button";
},
"text": function( elem ) {
var attr;
// 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" &&
elem.type === "text" &&
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type );
},
// Position-in-collection
"first": createPositionalPseudo(function() {
return [ 0 ];
}),
"last": createPositionalPseudo(function( matchIndexes, length ) {
return [ length - 1 ];
}),
"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
return [ argument < 0 ? argument + length : argument ];
}),
"even": createPositionalPseudo(function( matchIndexes, length ) {
var i = 0;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"odd": createPositionalPseudo(function( matchIndexes, length ) {
var i = 1;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; --i >= 0; ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; ++i < length; ) {
matchIndexes.push( i );
}
return matchIndexes;
})
}
};
Expr.pseudos["nth"] = Expr.pseudos["eq"];
// Add button/input type pseudos
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
Expr.pseudos[ i ] = createInputPseudo( i );
}
for ( i in { submit: true, reset: true } ) {
Expr.pseudos[ i ] = createButtonPseudo( i );
}
// Easy API for creating new setFilters
function setFilters() {}
setFilters.prototype = Expr.filters = Expr.pseudos;
Expr.setFilters = new setFilters();
function tokenize( selector, parseOnly ) {
var matched, match, tokens, type,
soFar, groups, preFilters,
cached = tokenCache[ selector + " " ];
if ( cached ) {
return parseOnly ? 0 : cached.slice( 0 );
}
soFar = selector;
groups = [];
preFilters = Expr.preFilter;
while ( soFar ) {
// Comma and first run
if ( !matched || (match = rcomma.exec( soFar )) ) {
if ( match ) {
// Don't consume trailing commas as valid
soFar = soFar.slice( match[0].length ) || soFar;
}
groups.push( tokens = [] );
}
matched = false;
// Combinators
if ( (match = rcombinators.exec( soFar )) ) {
matched = match.shift();
tokens.push({
value: matched,
// Cast descendant combinators to space
type: match[0].replace( rtrim, " " )
});
soFar = soFar.slice( matched.length );
}
// Filters
for ( type in Expr.filter ) {
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
(match = preFilters[ type ]( match ))) ) {
matched = match.shift();
tokens.push({
value: matched,
type: type,
matches: match
});
soFar = soFar.slice( matched.length );
}
}
if ( !matched ) {
break;
}
}
// Return the length of the invalid excess
// if we're just parsing
// Otherwise, throw an error or return tokens
return parseOnly ?
soFar.length :
soFar ?
Sizzle.error( selector ) :
// Cache the tokens
tokenCache( selector, groups ).slice( 0 );
}
function toSelector( tokens ) {
var i = 0,
len = tokens.length,
selector = "";
for ( ; i < len; i++ ) {
selector += tokens[i].value;
}
return selector;
}
function addCombinator( matcher, combinator, base ) {
var dir = combinator.dir,
checkNonElements = base && dir === "parentNode",
doneName = done++;
return combinator.first ?
// Check against closest ancestor/preceding element
function( elem, context, xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
return matcher( elem, context, xml );
}
}
} :
// Check against all ancestor/preceding elements
function( elem, context, xml ) {
var data, cache, outerCache,
dirkey = dirruns + " " + doneName;
// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
if ( xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
if ( matcher( elem, context, xml ) ) {
return true;
}
}
}
} else {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
outerCache = elem[ expando ] || (elem[ expando ] = {});
if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {
if ( (data = cache[1]) === true || data === cachedruns ) {
return data === true;
}
} else {
cache = outerCache[ dir ] = [ dirkey ];
cache[1] = matcher( elem, context, xml ) || cachedruns;
if ( cache[1] === true ) {
return true;
}
}
}
}
}
};
}
function elementMatcher( matchers ) {
return matchers.length > 1 ?
function( elem, context, xml ) {
var i = matchers.length;
while ( i-- ) {
if ( !matchers[i]( elem, context, xml ) ) {
return false;
}
}
return true;
} :
matchers[0];
}
function condense( unmatched, map, filter, context, xml ) {
var elem,
newUnmatched = [],
i = 0,
len = unmatched.length,
mapped = map != null;
for ( ; i < len; i++ ) {
if ( (elem = unmatched[i]) ) {
if ( !filter || filter( elem, context, xml ) ) {
newUnmatched.push( elem );
if ( mapped ) {
map.push( i );
}
}
}
}
return newUnmatched;
}
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
if ( postFilter && !postFilter[ expando ] ) {
postFilter = setMatcher( postFilter );
}
if ( postFinder && !postFinder[ expando ] ) {
postFinder = setMatcher( postFinder, postSelector );
}
return markFunction(function( seed, results, context, xml ) {
var temp, i, elem,
preMap = [],
postMap = [],
preexisting = results.length,
// Get initial elements from seed or context
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
// Prefilter to get matcher input, preserving a map for seed-results synchronization
matcherIn = preFilter && ( seed || !selector ) ?
condense( elems, preMap, preFilter, context, xml ) :
elems,
matcherOut = matcher ?
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
// ...intermediate processing is necessary
[] :
// ...otherwise use results directly
results :
matcherIn;
// Find primary matches
if ( matcher ) {
matcher( matcherIn, matcherOut, context, xml );
}
// Apply postFilter
if ( postFilter ) {
temp = condense( matcherOut, postMap );
postFilter( temp, [], context, xml );
// Un-match failing elements by moving them back to matcherIn
i = temp.length;
while ( i-- ) {
if ( (elem = temp[i]) ) {
matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
}
}
}
if ( seed ) {
if ( postFinder || preFilter ) {
if ( postFinder ) {
// Get the final matcherOut by condensing this intermediate into postFinder contexts
temp = [];
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) ) {
// Restore matcherIn since elem is not yet a final match
temp.push( (matcherIn[i] = elem) );
}
}
postFinder( null, (matcherOut = []), temp, xml );
}
// Move matched elements from seed to results to keep them synchronized
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) &&
(temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
seed[temp] = !(results[temp] = elem);
}
}
}
// Add elements to results, through postFinder if defined
} else {
matcherOut = condense(
matcherOut === results ?
matcherOut.splice( preexisting, matcherOut.length ) :
matcherOut
);
if ( postFinder ) {
postFinder( null, results, matcherOut, xml );
} else {
push.apply( results, matcherOut );
}
}
});
}
function matcherFromTokens( tokens ) {
var checkContext, matcher, j,
len = tokens.length,
leadingRelative = Expr.relative[ tokens[0].type ],
implicitRelative = leadingRelative || Expr.relative[" "],
i = leadingRelative ? 1 : 0,
// The foundational matcher ensures that elements are reachable from top-level context(s)
matchContext = addCombinator( function( elem ) {
return elem === checkContext;
}, implicitRelative, true ),
matchAnyContext = addCombinator( function( elem ) {
return indexOf.call( checkContext, elem ) > -1;
}, implicitRelative, true ),
matchers = [ function( elem, context, xml ) {
return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
(checkContext = context).nodeType ?
matchContext( elem, context, xml ) :
matchAnyContext( elem, context, xml ) );
} ];
for ( ; i < len; i++ ) {
if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
} else {
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
// Return special upon seeing a positional matcher
if ( matcher[ expando ] ) {
// Find the next relative operator (if any) for proper handling
j = ++i;
for ( ; j < len; j++ ) {
if ( Expr.relative[ tokens[j].type ] ) {
break;
}
}
return setMatcher(
i > 1 && elementMatcher( matchers ),
i > 1 && toSelector(
// If the preceding token was a descendant combinator, insert an implicit any-element `*`
tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
).replace( rtrim, "$1" ),
matcher,
i < j && matcherFromTokens( tokens.slice( i, j ) ),
j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
j < len && toSelector( tokens )
);
}
matchers.push( matcher );
}
}
return elementMatcher( matchers );
}
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
// A counter to specify which element is currently being matched
var matcherCachedRuns = 0,
bySet = setMatchers.length > 0,
byElement = elementMatchers.length > 0,
superMatcher = function( seed, context, xml, results, expandContext ) {
var elem, j, matcher,
setMatched = [],
matchedCount = 0,
i = "0",
unmatched = seed && [],
outermost = expandContext != null,
contextBackup = outermostContext,
// We must always have either seed elements or context
elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
// Use integer dirruns iff this is the outermost matcher
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1);
if ( outermost ) {
outermostContext = context !== document && context;
cachedruns = matcherCachedRuns;
}
// Add elements passing elementMatchers directly to results
// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
for ( ; (elem = elems[i]) != null; i++ ) {
if ( byElement && elem ) {
j = 0;
while ( (matcher = elementMatchers[j++]) ) {
if ( matcher( elem, context, xml ) ) {
results.push( elem );
break;
}
}
if ( outermost ) {
dirruns = dirrunsUnique;
cachedruns = ++matcherCachedRuns;
}
}
// Track unmatched elements for set filters
if ( bySet ) {
// They will have gone through all possible matchers
if ( (elem = !matcher && elem) ) {
matchedCount--;
}
// Lengthen the array for every element, matched or not
if ( seed ) {
unmatched.push( elem );
}
}
}
// Apply set filters to unmatched elements
matchedCount += i;
if ( bySet && i !== matchedCount ) {
j = 0;
while ( (matcher = setMatchers[j++]) ) {
matcher( unmatched, setMatched, context, xml );
}
if ( seed ) {
// Reintegrate element matches to eliminate the need for sorting
if ( matchedCount > 0 ) {
while ( i-- ) {
if ( !(unmatched[i] || setMatched[i]) ) {
setMatched[i] = pop.call( results );
}
}
}
// Discard index placeholder values to get only actual matches
setMatched = condense( setMatched );
}
// Add matches to results
push.apply( results, setMatched );
// Seedless set matches succeeding multiple successful matchers stipulate sorting
if ( outermost && !seed && setMatched.length > 0 &&
( matchedCount + setMatchers.length ) > 1 ) {
Sizzle.uniqueSort( results );
}
}
// Override manipulation of globals by nested matchers
if ( outermost ) {
dirruns = dirrunsUnique;
outermostContext = contextBackup;
}
return unmatched;
};
return bySet ?
markFunction( superMatcher ) :
superMatcher;
}
compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
var i,
setMatchers = [],
elementMatchers = [],
cached = compilerCache[ selector + " " ];
if ( !cached ) {
// Generate a function of recursive functions that can be used to check each element
if ( !group ) {
group = tokenize( selector );
}
i = group.length;
while ( i-- ) {
cached = matcherFromTokens( group[i] );
if ( cached[ expando ] ) {
setMatchers.push( cached );
} else {
elementMatchers.push( cached );
}
}
// Cache the compiled function
cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
}
return cached;
};
function multipleContexts( selector, contexts, results ) {
var i = 0,
len = contexts.length;
for ( ; i < len; i++ ) {
Sizzle( selector, contexts[i], results );
}
return results;
}
function select( selector, context, results, seed ) {
var i, tokens, token, type, find,
match = tokenize( selector );
if ( !seed ) {
// Try to minimize operations if there is only one group
if ( match.length === 1 ) {
// Take a shortcut and set the context if the root selector is an ID
tokens = match[0] = match[0].slice( 0 );
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
support.getById && context.nodeType === 9 && documentIsHTML &&
Expr.relative[ tokens[1].type ] ) {
context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
if ( !context ) {
return results;
}
selector = selector.slice( tokens.shift().value.length );
}
// Fetch a seed set for right-to-left matching
i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
while ( i-- ) {
token = tokens[i];
// Abort if we hit a combinator
if ( Expr.relative[ (type = token.type) ] ) {
break;
}
if ( (find = Expr.find[ type ]) ) {
// Search, expanding context for leading sibling combinators
if ( (seed = find(
token.matches[0].replace( runescape, funescape ),
rsibling.test( tokens[0].type ) && context.parentNode || context
)) ) {
// If seed is empty or no tokens remain, we can return early
tokens.splice( i, 1 );
selector = seed.length && toSelector( tokens );
if ( !selector ) {
push.apply( results, seed );
return results;
}
break;
}
}
}
}
}
// Compile and execute a filtering function
// Provide `match` to avoid retokenization if we modified the selector above
compile( selector, match )(
seed,
context,
!documentIsHTML,
results,
rsibling.test( selector )
);
return results;
}
// One-time assignments
// Sort stability
support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
// Support: Chrome<14
// Always assume duplicates if they aren't passed to the comparison function
support.detectDuplicates = hasDuplicate;
// Initialize against the default document
setDocument();
// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
// Detached nodes confoundingly follow *each other*
support.sortDetached = assert(function( div1 ) {
// Should return 1, but returns 4 (following)
return div1.compareDocumentPosition( document.createElement("div") ) & 1;
});
// Support: IE<8
// Prevent attribute/property "interpolation"
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !assert(function( div ) {
div.innerHTML = "<a href='#'></a>";
return div.firstChild.getAttribute("href") === "#" ;
}) ) {
addHandle( "type|href|height|width", function( elem, name, isXML ) {
if ( !isXML ) {
return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
}
});
}
// Support: IE<9
// Use defaultValue in place of getAttribute("value")
if ( !support.attributes || !assert(function( div ) {
div.innerHTML = "<input/>";
div.firstChild.setAttribute( "value", "" );
return div.firstChild.getAttribute( "value" ) === "";
}) ) {
addHandle( "value", function( elem, name, isXML ) {
if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
return elem.defaultValue;
}
});
}
// Support: IE<9
// Use getAttributeNode to fetch booleans when getAttribute lies
if ( !assert(function( div ) {
return div.getAttribute("disabled") == null;
}) ) {
addHandle( booleans, function( elem, name, isXML ) {
var val;
if ( !isXML ) {
return (val = elem.getAttributeNode( name )) && val.specified ?
val.value :
elem[ name ] === true ? name.toLowerCase() : null;
}
});
}
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.pseudos;
jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
})( window );
// String to Object options format cache
var optionsCache = {};
// Convert String-formatted options into Object-formatted ones and store in cache
function createOptions( options ) {
var object = optionsCache[ options ] = {};
jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {
object[ flag ] = true;
});
return object;
}
/*
* Create a callback list using the following parameters:
*
* options: an optional list of space-separated options that will change how
* the callback list behaves or a more traditional option object
*
* By default a callback list will act like an event callback list and can be
* "fired" multiple times.
*
* Possible options:
*
* 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( options ) {
// Convert options from String-formatted to Object-formatted if needed
// (we check in cache first)
options = typeof options === "string" ?
( optionsCache[ options ] || createOptions( options ) ) :
jQuery.extend( {}, options );
var // Flag to know if list is currently firing
firing,
// Last fire value (for non-forgettable lists)
memory,
// Flag to know if list was already fired
fired,
// End of the loop when firing
firingLength,
// Index of currently firing callback (modified by remove if needed)
firingIndex,
// First callback to fire (used internally by add and fireWith)
firingStart,
// Actual callback list
list = [],
// Stack of fire calls for repeatable lists
stack = !options.once && [],
// Fire callbacks
fire = function( data ) {
memory = options.memory && data;
fired = true;
firingIndex = firingStart || 0;
firingStart = 0;
firingLength = list.length;
firing = true;
for ( ; list && firingIndex < firingLength; firingIndex++ ) {
if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
memory = false; // To prevent further calls using add
break;
}
}
firing = false;
if ( list ) {
if ( stack ) {
if ( stack.length ) {
fire( stack.shift() );
}
} else if ( memory ) {
list = [];
} else {
self.disable();
}
}
},
// Actual Callbacks object
self = {
// Add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
// First, we save the current length
var start = list.length;
(function add( args ) {
jQuery.each( args, function( _, arg ) {
var type = jQuery.type( arg );
if ( type === "function" ) {
if ( !options.unique || !self.has( arg ) ) {
list.push( arg );
}
} else if ( arg && arg.length && type !== "string" ) {
// Inspect recursively
add( arg );
}
});
})( 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
} else if ( memory ) {
firingStart = start;
fire( memory );
}
}
return this;
},
// Remove a callback from the list
remove: function() {
if ( list ) {
jQuery.each( arguments, function( _, arg ) {
var index;
while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
list.splice( index, 1 );
// Handle firing indexes
if ( firing ) {
if ( index <= firingLength ) {
firingLength--;
}
if ( index <= firingIndex ) {
firingIndex--;
}
}
}
});
}
return this;
},
// Check if a given callback is in the list.
// If no argument is given, return whether or not list has callbacks attached.
has: function( fn ) {
return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
},
// Remove all callbacks from the list
empty: function() {
list = [];
firingLength = 0;
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 ) {
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 ( list && ( !fired || stack ) ) {
args = args || [];
args = [ context, args.slice ? args.slice() : args ];
if ( firing ) {
stack.push( args );
} else {
fire( 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 !!fired;
}
};
return self;
};
jQuery.extend({
Deferred: function( func ) {
var tuples = [
// action, add listener, listener list, final state
[ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
[ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
[ "notify", "progress", jQuery.Callbacks("memory") ]
],
state = "pending",
promise = {
state: function() {
return state;
},
always: function() {
deferred.done( arguments ).fail( arguments );
return this;
},
then: function( /* fnDone, fnFail, fnProgress */ ) {
var fns = arguments;
return jQuery.Deferred(function( newDefer ) {
jQuery.each( tuples, function( i, tuple ) {
var action = tuple[ 0 ],
fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
// deferred[ done | fail | progress ] for forwarding actions to newDefer
deferred[ tuple[1] ](function() {
var returned = fn && fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise()
.done( newDefer.resolve )
.fail( newDefer.reject )
.progress( newDefer.notify );
} else {
newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
}
});
});
fns = null;
}).promise();
},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj ) {
return obj != null ? jQuery.extend( obj, promise ) : promise;
}
},
deferred = {};
// Keep pipe for back-compat
promise.pipe = promise.then;
// Add list-specific methods
jQuery.each( tuples, function( i, tuple ) {
var list = tuple[ 2 ],
stateString = tuple[ 3 ];
// promise[ done | fail | progress ] = list.add
promise[ tuple[1] ] = list.add;
// Handle state
if ( stateString ) {
list.add(function() {
// state = [ resolved | rejected ]
state = stateString;
// [ reject_list | resolve_list ].disable; progress_list.lock
}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
}
// deferred[ resolve | reject | notify ]
deferred[ tuple[0] ] = function() {
deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
return this;
};
deferred[ tuple[0] + "With" ] = list.fireWith;
});
// Make the deferred a promise
promise.promise( deferred );
// Call given func if any
if ( func ) {
func.call( deferred, deferred );
}
// All done!
return deferred;
},
// Deferred helper
when: function( subordinate /* , ..., subordinateN */ ) {
var i = 0,
resolveValues = core_slice.call( arguments ),
length = resolveValues.length,
// the count of uncompleted subordinates
remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
// the master Deferred. If resolveValues consist of only a single Deferred, just use that.
deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
// Update function for both resolve and progress values
updateFunc = function( i, contexts, values ) {
return function( value ) {
contexts[ i ] = this;
values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
if( values === progressValues ) {
deferred.notifyWith( contexts, values );
} else if ( !( --remaining ) ) {
deferred.resolveWith( contexts, values );
}
};
},
progressValues, progressContexts, resolveContexts;
// add listeners to Deferred subordinates; treat others as resolved
if ( length > 1 ) {
progressValues = new Array( length );
progressContexts = new Array( length );
resolveContexts = new Array( length );
for ( ; i < length; i++ ) {
if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
resolveValues[ i ].promise()
.done( updateFunc( i, resolveContexts, resolveValues ) )
.fail( deferred.reject )
.progress( updateFunc( i, progressContexts, progressValues ) );
} else {
--remaining;
}
}
}
// if we're not waiting on anything, resolve the master
if ( !remaining ) {
deferred.resolveWith( resolveContexts, resolveValues );
}
return deferred.promise();
}
});
jQuery.support = (function( support ) {
var all, a, input, select, fragment, opt, eventName, isSupported, i,
div = document.createElement("div");
// Setup
div.setAttribute( "className", "t" );
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
// Finish early in limited (non-browser) environments
all = div.getElementsByTagName("*") || [];
a = div.getElementsByTagName("a")[ 0 ];
if ( !a || !a.style || !all.length ) {
return support;
}
// First batch of tests
select = document.createElement("select");
opt = select.appendChild( document.createElement("option") );
input = div.getElementsByTagName("input")[ 0 ];
a.style.cssText = "top:1px;float:left;opacity:.5";
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
support.getSetAttribute = div.className !== "t";
// IE strips leading whitespace when .innerHTML is used
support.leadingWhitespace = div.firstChild.nodeType === 3;
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
support.tbody = !div.getElementsByTagName("tbody").length;
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
support.htmlSerialize = !!div.getElementsByTagName("link").length;
// Get the style information from getAttribute
// (IE uses .cssText instead)
support.style = /top/.test( a.getAttribute("style") );
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
support.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
support.opacity = /^0.5/.test( a.style.opacity );
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
support.cssFloat = !!a.style.cssFloat;
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
support.checkOn = !!input.value;
// 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)
support.optSelected = opt.selected;
// Tests for enctype support on a form (#6743)
support.enctype = !!document.createElement("form").enctype;
// Makes sure cloning an html5 element does not cause problems
// Where outerHTML is undefined, this still works
support.html5Clone = document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>";
// Will be defined later
support.inlineBlockNeedsLayout = false;
support.shrinkWrapBlocks = false;
support.pixelPosition = false;
support.deleteExpando = true;
support.noCloneEvent = true;
support.reliableMarginRight = true;
support.boxSizingReliable = 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;
// Support: IE<9
try {
delete div.test;
} catch( e ) {
support.deleteExpando = false;
}
// Check if we can trust getAttribute("value")
input = document.createElement("input");
input.setAttribute( "value", "" );
support.input = input.getAttribute( "value" ) === "";
// Check if an input maintains its value after becoming a radio
input.value = "t";
input.setAttribute( "type", "radio" );
support.radioValue = input.value === "t";
// #11217 - WebKit loses check when the name is after the checked attribute
input.setAttribute( "checked", "t" );
input.setAttribute( "name", "t" );
fragment = document.createDocumentFragment();
fragment.appendChild( input );
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
support.appendChecked = input.checked;
// WebKit doesn't clone checked state correctly in fragments
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
// Support: IE<9
// Opera does not clone events (and typeof div.attachEvent === undefined).
// IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
if ( div.attachEvent ) {
div.attachEvent( "onclick", function() {
support.noCloneEvent = false;
});
div.cloneNode( true ).click();
}
// Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
for ( i in { submit: true, change: true, focusin: true }) {
div.setAttribute( eventName = "on" + i, "t" );
support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
}
div.style.backgroundClip = "content-box";
div.cloneNode( true ).style.backgroundClip = "";
support.clearCloneStyle = div.style.backgroundClip === "content-box";
// Support: IE<9
// Iteration over object's inherited properties before its own.
for ( i in jQuery( support ) ) {
break;
}
support.ownLast = i !== "0";
// Run tests that need a body at doc ready
jQuery(function() {
var container, marginDiv, tds,
divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
body = document.getElementsByTagName("body")[0];
if ( !body ) {
// Return for frameset docs that don't have a body
return;
}
container = document.createElement("div");
container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
body.appendChild( container ).appendChild( div );
// Support: IE8
// 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).
div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
tds = div.getElementsByTagName("td");
tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
isSupported = ( tds[ 0 ].offsetHeight === 0 );
tds[ 0 ].style.display = "";
tds[ 1 ].style.display = "none";
// Support: IE8
// Check if empty table cells still have offsetWidth/Height
support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
// Check box-sizing and margin behavior.
div.innerHTML = "";
div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
// Workaround failing boxSizing test due to offsetWidth returning wrong value
// with some non-1 values of body zoom, ticket #13543
jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() {
support.boxSizing = div.offsetWidth === 4;
});
// Use window.getComputedStyle because jsdom on node.js will break without it.
if ( window.getComputedStyle ) {
support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
// Check if div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container. (#3333)
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
marginDiv = div.appendChild( document.createElement("div") );
marginDiv.style.cssText = div.style.cssText = divReset;
marginDiv.style.marginRight = marginDiv.style.width = "0";
div.style.width = "1px";
support.reliableMarginRight =
!parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
}
if ( typeof div.style.zoom !== core_strundefined ) {
// Support: IE<8
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layout
div.innerHTML = "";
div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
// Support: IE6
// Check if elements with layout shrink-wrap their children
div.style.display = "block";
div.innerHTML = "<div></div>";
div.firstChild.style.width = "5px";
support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
if ( support.inlineBlockNeedsLayout ) {
// Prevent IE 6 from affecting layout for positioned elements #11048
// Prevent IE from shrinking the body in IE 7 mode #12869
// Support: IE<8
body.style.zoom = 1;
}
}
body.removeChild( container );
// Null elements to avoid leaks in IE
container = div = tds = marginDiv = null;
});
// Null elements to avoid leaks in IE
all = select = fragment = opt = a = input = null;
return support;
})({});
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
rmultiDash = /([A-Z])/g;
function internalData( elem, name, data, pvt /* Internal Use Only */ ){
if ( !jQuery.acceptData( elem ) ) {
return;
}
var ret, thisCache,
internalKey = jQuery.expando,
// 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;
// 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] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {
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 ) {
id = elem[ internalKey ] = core_deletedIds.pop() || jQuery.guid++;
} else {
id = internalKey;
}
}
if ( !cache[ id ] ) {
// Avoid exposing jQuery metadata on plain JS objects when the object
// is serialized using JSON.stringify
cache[ id ] = isNode ? {} : { 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 );
}
}
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;
}
// Check for both converted-to-camel and non-converted data property names
// If a data property was specified
if ( typeof name === "string" ) {
// 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;
}
function internalRemoveData( elem, name, pvt ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache, i,
isNode = elem.nodeType,
// See jQuery.data for more information
cache = isNode ? jQuery.cache : elem,
id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
// 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(" ");
}
}
} else {
// If "name" is an array of keys...
// When data is initially created, via ("key", "val") signature,
// keys will be converted to camelCase.
// Since there is no way to tell _how_ a key was added, remove
// both plain key and camelCase key. #12786
// This will only penalize the array argument path.
name = name.concat( jQuery.map( name, jQuery.camelCase ) );
}
i = name.length;
while ( 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(thisCache) : !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;
}
}
// Destroy the cache
if ( isNode ) {
jQuery.cleanData( [ elem ], true );
// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
/* jshint eqeqeq: false */
} else if ( jQuery.support.deleteExpando || cache != cache.window ) {
/* jshint eqeqeq: true */
delete cache[ id ];
// When all else fails, null
} else {
cache[ id ] = null;
}
}
jQuery.extend({
cache: {},
// The following elements throw uncatchable exceptions if you
// attempt to add expando properties to them.
noData: {
"applet": true,
"embed": true,
// Ban all objects except for Flash (which handle expandos)
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
},
hasData: function( elem ) {
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
return !!elem && !isEmptyDataObject( elem );
},
data: function( elem, name, data ) {
return internalData( elem, name, data );
},
removeData: function( elem, name ) {
return internalRemoveData( elem, name );
},
// For internal use only.
_data: function( elem, name, data ) {
return internalData( elem, name, data, true );
},
_removeData: function( elem, name ) {
return internalRemoveData( elem, name, true );
},
// A method for determining if a DOM node can handle the data expando
acceptData: function( elem ) {
// Do not set data on non-element because it will not be cleared (#8335).
if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {
return false;
}
var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
// nodes accept data unless otherwise specified; rejection can be conditional
return !noData || noData !== true && elem.getAttribute("classid") === noData;
}
});
jQuery.fn.extend({
data: function( key, value ) {
var attrs, name,
data = null,
i = 0,
elem = this[0];
// Special expections of .data basically thwart jQuery.access,
// so implement the relevant behavior ourselves
// Gets all values
if ( key === undefined ) {
if ( this.length ) {
data = jQuery.data( elem );
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
attrs = elem.attributes;
for ( ; i < attrs.length; i++ ) {
name = attrs[i].name;
if ( name.indexOf("data-") === 0 ) {
name = jQuery.camelCase( name.slice(5) );
dataAttr( elem, name, data[ name ] );
}
}
jQuery._data( elem, "parsedAttrs", true );
}
}
return data;
}
// Sets multiple values
if ( typeof key === "object" ) {
return this.each(function() {
jQuery.data( this, key );
});
}
return arguments.length > 1 ?
// Sets one value
this.each(function() {
jQuery.data( this, key, value );
}) :
// Gets one value
// Try to fetch any internally stored data first
elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
},
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 :
// Only convert to a number if it doesn't change the string
+data + "" === data ? +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 ) {
var name;
for ( 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;
}
jQuery.extend({
queue: function( elem, type, data ) {
var queue;
if ( elem ) {
type = ( type || "fx" ) + "queue";
queue = jQuery._data( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !queue || jQuery.isArray(data) ) {
queue = jQuery._data( elem, type, jQuery.makeArray(data) );
} else {
queue.push( data );
}
}
return queue || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
startLength = queue.length,
fn = queue.shift(),
hooks = jQuery._queueHooks( elem, type ),
next = function() {
jQuery.dequeue( elem, type );
};
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
startLength--;
}
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift( "inprogress" );
}
// clear up the last queue stop function
delete hooks.stop;
fn.call( elem, next, hooks );
}
if ( !startLength && hooks ) {
hooks.empty.fire();
}
},
// not intended for public consumption - generates a queueHooks object, or returns the current one
_queueHooks: function( elem, type ) {
var key = type + "queueHooks";
return jQuery._data( elem, key ) || jQuery._data( elem, key, {
empty: jQuery.Callbacks("once memory").add(function() {
jQuery._removeData( elem, type + "queue" );
jQuery._removeData( elem, key );
})
});
}
});
jQuery.fn.extend({
queue: function( type, data ) {
var setter = 2;
if ( typeof type !== "string" ) {
data = type;
type = "fx";
setter--;
}
if ( arguments.length < setter ) {
return jQuery.queue( this[0], type );
}
return data === undefined ?
this :
this.each(function() {
var queue = jQuery.queue( this, type, data );
// ensure a hooks for this queue
jQuery._queueHooks( this, type );
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, obj ) {
var tmp,
count = 1,
defer = jQuery.Deferred(),
elements = this,
i = this.length,
resolve = function() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
};
if ( typeof type !== "string" ) {
obj = type;
type = undefined;
}
type = type || "fx";
while( i-- ) {
tmp = jQuery._data( elements[ i ], type + "queueHooks" );
if ( tmp && tmp.empty ) {
count++;
tmp.empty.add( resolve );
}
}
resolve();
return defer.promise( obj );
}
});
var nodeHook, boolHook,
rclass = /[\t\r\n\f]/g,
rreturn = /\r/g,
rfocusable = /^(?:input|select|textarea|button|object)$/i,
rclickable = /^(?:a|area)$/i,
ruseDefault = /^(?:checked|selected)$/i,
getSetAttribute = jQuery.support.getSetAttribute,
getSetInput = jQuery.support.input;
jQuery.fn.extend({
attr: function( name, value ) {
return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
},
removeAttr: function( name ) {
return this.each(function() {
jQuery.removeAttr( this, name );
});
},
prop: function( name, value ) {
return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
},
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 classes, elem, cur, clazz, j,
i = 0,
len = this.length,
proceed = typeof value === "string" && value;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).addClass( value.call( this, j, this.className ) );
});
}
if ( proceed ) {
// The disjunction here is for better compressibility (see removeClass)
classes = ( value || "" ).match( core_rnotwhite ) || [];
for ( ; i < len; i++ ) {
elem = this[ i ];
cur = elem.nodeType === 1 && ( elem.className ?
( " " + elem.className + " " ).replace( rclass, " " ) :
" "
);
if ( cur ) {
j = 0;
while ( (clazz = classes[j++]) ) {
if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
cur += clazz + " ";
}
}
elem.className = jQuery.trim( cur );
}
}
}
return this;
},
removeClass: function( value ) {
var classes, elem, cur, clazz, j,
i = 0,
len = this.length,
proceed = arguments.length === 0 || typeof value === "string" && value;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).removeClass( value.call( this, j, this.className ) );
});
}
if ( proceed ) {
classes = ( value || "" ).match( core_rnotwhite ) || [];
for ( ; i < len; i++ ) {
elem = this[ i ];
// This expression is here for better compressibility (see addClass)
cur = elem.nodeType === 1 && ( elem.className ?
( " " + elem.className + " " ).replace( rclass, " " ) :
""
);
if ( cur ) {
j = 0;
while ( (clazz = classes[j++]) ) {
// Remove *all* instances
while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
cur = cur.replace( " " + clazz + " ", " " );
}
}
elem.className = value ? jQuery.trim( cur ) : "";
}
}
}
return this;
},
toggleClass: function( value, stateVal ) {
var type = typeof value;
if ( typeof stateVal === "boolean" && type === "string" ) {
return stateVal ? this.addClass( value ) : this.removeClass( value );
}
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 ),
classNames = value.match( core_rnotwhite ) || [];
while ( (className = classNames[ i++ ]) ) {
// check each className given, space separated list
if ( self.hasClass( className ) ) {
self.removeClass( className );
} else {
self.addClass( className );
}
}
// Toggle whole class name
} else if ( type === core_strundefined || type === "boolean" ) {
if ( this.className ) {
// store className if set
jQuery._data( this, "__className__", this.className );
}
// If the element has a class name or if we're passed "false",
// then remove the whole classname (if there was one, the above saved it).
// Otherwise bring back whatever was previously saved (if anything),
// falling back to the empty string if nothing was stored.
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 ) >= 0 ) {
return true;
}
}
return false;
},
val: function( value ) {
var ret, hooks, isFunction,
elem = this[0];
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
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 val;
if ( this.nodeType !== 1 ) {
return;
}
if ( isFunction ) {
val = value.call( this, i, jQuery( this ).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.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
// 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 ) {
// Use proper attribute retrieval(#6932, #12072)
var val = jQuery.find.attr( elem, "value" );
return val != null ?
val :
elem.text;
}
},
select: {
get: function( elem ) {
var value, option,
options = elem.options,
index = elem.selectedIndex,
one = elem.type === "select-one" || index < 0,
values = one ? null : [],
max = one ? index + 1 : options.length,
i = index < 0 ?
max :
one ? index : 0;
// Loop through all the selected options
for ( ; i < max; i++ ) {
option = options[ i ];
// oldIE doesn't update selected after form reset (#2551)
if ( ( option.selected || i === index ) &&
// Don't return options that are disabled or in a disabled optgroup
( 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 );
}
}
return values;
},
set: function( elem, value ) {
var optionSet, option,
options = elem.options,
values = jQuery.makeArray( value ),
i = options.length;
while ( i-- ) {
option = options[ i ];
if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) {
optionSet = true;
}
}
// force browsers to behave consistently when non-matching value is set
if ( !optionSet ) {
elem.selectedIndex = -1;
}
return values;
}
}
},
attr: function( elem, name, value ) {
var hooks, ret,
nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
// Fallback to prop when attributes are not supported
if ( typeof elem.getAttribute === core_strundefined ) {
return jQuery.prop( elem, name, value );
}
// All attributes are lowercase
// Grab necessary hook if one is defined
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
name = name.toLowerCase();
hooks = jQuery.attrHooks[ name ] ||
( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
}
if ( value !== undefined ) {
if ( value === null ) {
jQuery.removeAttr( elem, name );
} else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
elem.setAttribute( name, value + "" );
return value;
}
} else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
ret = jQuery.find.attr( elem, name );
// Non-existent attributes return null, we normalize to undefined
return ret == null ?
undefined :
ret;
}
},
removeAttr: function( elem, value ) {
var name, propName,
i = 0,
attrNames = value && value.match( core_rnotwhite );
if ( attrNames && elem.nodeType === 1 ) {
while ( (name = attrNames[i++]) ) {
propName = jQuery.propFix[ name ] || name;
// Boolean attributes get special treatment (#10870)
if ( jQuery.expr.match.bool.test( name ) ) {
// Set corresponding property to false
if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
elem[ propName ] = false;
// Support: IE<9
// Also clear defaultChecked/defaultSelected (if appropriate)
} else {
elem[ jQuery.camelCase( "default-" + name ) ] =
elem[ propName ] = false;
}
// See #9699 for explanation of this approach (setting first, then removal)
} else {
jQuery.attr( elem, name, "" );
}
elem.removeAttribute( getSetAttribute ? name : propName );
}
}
},
attrHooks: {
type: {
set: function( elem, value ) {
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 default in case type is set after value during creation
var val = elem.value;
elem.setAttribute( "type", value );
if ( val ) {
elem.value = val;
}
return value;
}
}
}
},
propFix: {
"for": "htmlFor",
"class": "className"
},
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 ) {
return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
ret :
( elem[ name ] = value );
} else {
return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
ret :
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/
// Use proper attribute retrieval(#12072)
var tabindex = jQuery.find.attr( elem, "tabindex" );
return tabindex ?
parseInt( tabindex, 10 ) :
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
0 :
-1;
}
}
}
});
// Hooks for boolean attributes
boolHook = {
set: function( elem, value, name ) {
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
// IE<8 needs the *property* name
elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
// Use defaultChecked and defaultSelected for oldIE
} else {
elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
}
return name;
}
};
jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
var getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr;
jQuery.expr.attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ?
function( elem, name, isXML ) {
var fn = jQuery.expr.attrHandle[ name ],
ret = isXML ?
undefined :
/* jshint eqeqeq: false */
(jQuery.expr.attrHandle[ name ] = undefined) !=
getter( elem, name, isXML ) ?
name.toLowerCase() :
null;
jQuery.expr.attrHandle[ name ] = fn;
return ret;
} :
function( elem, name, isXML ) {
return isXML ?
undefined :
elem[ jQuery.camelCase( "default-" + name ) ] ?
name.toLowerCase() :
null;
};
});
// fix oldIE attroperties
if ( !getSetInput || !getSetAttribute ) {
jQuery.attrHooks.value = {
set: function( elem, value, name ) {
if ( jQuery.nodeName( elem, "input" ) ) {
// Does not return so that setAttribute is also used
elem.defaultValue = value;
} else {
// Use nodeHook if defined (#1954); otherwise setAttribute is fine
return nodeHook && nodeHook.set( elem, value, name );
}
}
};
}
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !getSetAttribute ) {
// Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue
nodeHook = {
set: function( elem, value, name ) {
// Set the existing or create a new attribute node
var ret = elem.getAttributeNode( name );
if ( !ret ) {
elem.setAttributeNode(
(ret = elem.ownerDocument.createAttribute( name ))
);
}
ret.value = value += "";
// Break association with cloned elements by also using setAttribute (#9646)
return name === "value" || value === elem.getAttribute( name ) ?
value :
undefined;
}
};
jQuery.expr.attrHandle.id = jQuery.expr.attrHandle.name = jQuery.expr.attrHandle.coords =
// Some attributes are constructed with empty-string values when not defined
function( elem, name, isXML ) {
var ret;
return isXML ?
undefined :
(ret = elem.getAttributeNode( name )) && ret.value !== "" ?
ret.value :
null;
};
jQuery.valHooks.button = {
get: function( elem, name ) {
var ret = elem.getAttributeNode( name );
return ret && ret.specified ?
ret.value :
undefined;
},
set: nodeHook.set
};
// Set contenteditable to false on removals(#10429)
// Setting to empty string throws an error as an invalid value
jQuery.attrHooks.contenteditable = {
set: function( elem, value, name ) {
nodeHook.set( elem, value === "" ? false : value, name );
}
};
// 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 ] = {
set: function( elem, value ) {
if ( value === "" ) {
elem.setAttribute( name, "auto" );
return value;
}
}
};
});
}
// Some attributes require a special call on IE
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !jQuery.support.hrefNormalized ) {
// href/src property should get the full normalized URL (#10299/#12915)
jQuery.each([ "href", "src" ], function( i, name ) {
jQuery.propHooks[ name ] = {
get: function( elem ) {
return elem.getAttribute( name, 4 );
}
};
});
}
if ( !jQuery.support.style ) {
jQuery.attrHooks.style = {
get: function( elem ) {
// Return undefined in the case of empty string
// Note: IE uppercases css property names, but if we were to .toLowerCase()
// .cssText, that would destroy case senstitivity in URL's, like in "background"
return elem.style.cssText || 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 = {
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;
}
};
}
jQuery.each([
"tabIndex",
"readOnly",
"maxLength",
"cellSpacing",
"cellPadding",
"rowSpan",
"colSpan",
"useMap",
"frameBorder",
"contentEditable"
], function() {
jQuery.propFix[ this.toLowerCase() ] = this;
});
// IE6/7 call enctype encoding
if ( !jQuery.support.enctype ) {
jQuery.propFix.enctype = "encoding";
}
// Radios and checkboxes getter/setter
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
set: function( elem, value ) {
if ( jQuery.isArray( value ) ) {
return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
}
}
};
if ( !jQuery.support.checkOn ) {
jQuery.valHooks[ this ].get = function( elem ) {
// Support: Webkit
// "" is returned instead of "on" if a value isn't specified
return elem.getAttribute("value") === null ? "on" : elem.value;
};
}
});
var rformElems = /^(?:input|select|textarea)$/i,
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|contextmenu)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
function returnTrue() {
return true;
}
function returnFalse() {
return false;
}
function safeActiveElement() {
try {
return document.activeElement;
} catch ( err ) { }
}
/*
* Helper functions for managing events -- not part of the public interface.
* Props to Dean Edwards' addEvent library for many of the ideas.
*/
jQuery.event = {
global: {},
add: function( elem, types, handler, data, selector ) {
var tmp, events, t, handleObjIn,
special, eventHandle, handleObj,
handlers, type, namespaces, origType,
elemData = jQuery._data( elem );
// Don't attach events to noData or text/comment nodes (but allow plain objects)
if ( !elemData ) {
return;
}
// Caller can pass in an object of custom data in lieu of the handler
if ( handler.handler ) {
handleObjIn = handler;
handler = handleObjIn.handler;
selector = handleObjIn.selector;
}
// 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
if ( !(events = elemData.events) ) {
events = elemData.events = {};
}
if ( !(eventHandle = elemData.handle) ) {
eventHandle = elemData.handle = 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 !== core_strundefined && (!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
types = ( types || "" ).match( core_rnotwhite ) || [""];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[t] ) || [];
type = origType = tmp[1];
namespaces = ( tmp[2] || "" ).split( "." ).sort();
// There *must* be a type, no attaching namespace-only handlers
if ( !type ) {
continue;
}
// 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: origType,
data: data,
handler: handler,
guid: handler.guid,
selector: selector,
needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
namespace: namespaces.join(".")
}, handleObjIn );
// Init the event handler queue if we're the first
if ( !(handlers = events[ type ]) ) {
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;
},
// Detach an event or set of events from an element
remove: function( elem, types, handler, selector, mappedTypes ) {
var j, handleObj, tmp,
origCount, t, events,
special, handlers, type,
namespaces, origType,
elemData = jQuery.hasData( elem ) && jQuery._data( elem );
if ( !elemData || !(events = elemData.events) ) {
return;
}
// Once for each type.namespace in types; type may be omitted
types = ( types || "" ).match( core_rnotwhite ) || [""];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[t] ) || [];
type = origType = tmp[1];
namespaces = ( tmp[2] || "" ).split( "." ).sort();
// 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;
handlers = events[ type ] || [];
tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
// Remove matching events
origCount = j = handlers.length;
while ( j-- ) {
handleObj = handlers[ j ];
if ( ( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) &&
( !tmp || tmp.test( handleObj.namespace ) ) &&
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
handlers.splice( j, 1 );
if ( handleObj.selector ) {
handlers.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 ( origCount && !handlers.length ) {
if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
jQuery.removeEvent( elem, type, elemData.handle );
}
delete events[ type ];
}
}
// Remove the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) {
delete elemData.handle;
// removeData also checks for emptiness and clears the expando if empty
// so use it instead of delete
jQuery._removeData( elem, "events" );
}
},
trigger: function( event, data, elem, onlyHandlers ) {
var handle, ontype, cur,
bubbleType, special, tmp, i,
eventPath = [ elem || document ],
type = core_hasOwn.call( event, "type" ) ? event.type : event,
namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
cur = tmp = elem = elem || document;
// Don't do events on text and comment nodes
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
return;
}
// 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 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split(".");
type = namespaces.shift();
namespaces.sort();
}
ontype = type.indexOf(":") < 0 && "on" + type;
// Caller can pass in a jQuery.Event object, Object, or just an event type string
event = event[ jQuery.expando ] ?
event :
new jQuery.Event( type, typeof event === "object" && event );
// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
event.isTrigger = onlyHandlers ? 2 : 3;
event.namespace = namespaces.join(".");
event.namespace_re = event.namespace ?
new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
null;
// 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 ?
[ event ] :
jQuery.makeArray( data, [ event ] );
// Allow special events to draw outside the lines
special = jQuery.event.special[ type ] || {};
if ( !onlyHandlers && 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)
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
bubbleType = special.delegateType || type;
if ( !rfocusMorph.test( bubbleType + type ) ) {
cur = cur.parentNode;
}
for ( ; cur; cur = cur.parentNode ) {
eventPath.push( cur );
tmp = cur;
}
// Only add window if we got to document (e.g., not plain obj or detached DOM)
if ( tmp === (elem.ownerDocument || document) ) {
eventPath.push( tmp.defaultView || tmp.parentWindow || window );
}
}
// Fire handlers on the event path
i = 0;
while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
event.type = i > 1 ?
bubbleType :
special.bindType || type;
// jQuery handler
handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
}
// Native handler
handle = ontype && cur[ ontype ];
if ( handle && jQuery.acceptData( cur ) && handle.apply && 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( eventPath.pop(), data ) === false) &&
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)
if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method
tmp = elem[ ontype ];
if ( tmp ) {
elem[ ontype ] = null;
}
// Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type;
try {
elem[ type ]();
} catch ( e ) {
// IE<9 dies on focus/blur to hidden element (#1486,#12518)
// only reproducible on winXP IE8 native, not IE9 in IE8 mode
}
jQuery.event.triggered = undefined;
if ( tmp ) {
elem[ ontype ] = tmp;
}
}
}
}
return event.result;
},
dispatch: function( event ) {
// Make a writable jQuery.Event from the native event object
event = jQuery.event.fix( event );
var i, ret, handleObj, matched, j,
handlerQueue = [],
args = core_slice.call( arguments ),
handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
special = jQuery.event.special[ event.type ] || {};
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args[0] = event;
event.delegateTarget = this;
// Call the preDispatch hook for the mapped type, and let it bail if desired
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
return;
}
// Determine handlers
handlerQueue = jQuery.event.handlers.call( this, event, handlers );
// Run delegates first; they may want to stop propagation beneath us
i = 0;
while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
event.currentTarget = matched.elem;
j = 0;
while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
// Triggered event must either 1) have no namespace, or
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
event.handleObj = handleObj;
event.data = handleObj.data;
ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
.apply( matched.elem, args );
if ( ret !== undefined ) {
if ( (event.result = ret) === false ) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}
// Call the postDispatch hook for the mapped type
if ( special.postDispatch ) {
special.postDispatch.call( this, event );
}
return event.result;
},
handlers: function( event, handlers ) {
var sel, handleObj, matches, i,
handlerQueue = [],
delegateCount = handlers.delegateCount,
cur = event.target;
// Find delegate handlers
// Black-hole SVG <use> instance trees (#13180)
// Avoid non-left-click bubbling in Firefox (#3861)
if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
/* jshint eqeqeq: false */
for ( ; cur != this; cur = cur.parentNode || this ) {
/* jshint eqeqeq: true */
// Don't check non-elements (#13208)
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) {
matches = [];
for ( i = 0; i < delegateCount; i++ ) {
handleObj = handlers[ i ];
// Don't conflict with Object.prototype properties (#13203)
sel = handleObj.selector + " ";
if ( matches[ sel ] === undefined ) {
matches[ sel ] = handleObj.needsContext ?
jQuery( sel, this ).index( cur ) >= 0 :
jQuery.find( sel, this, null, [ cur ] ).length;
}
if ( matches[ sel ] ) {
matches.push( handleObj );
}
}
if ( matches.length ) {
handlerQueue.push({ elem: cur, handlers: matches });
}
}
}
}
// Add the remaining (directly-bound) handlers
if ( delegateCount < handlers.length ) {
handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
}
return handlerQueue;
},
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
// Create a writable copy of the event object and normalize some properties
var i, prop, copy,
type = event.type,
originalEvent = event,
fixHook = this.fixHooks[ type ];
if ( !fixHook ) {
this.fixHooks[ type ] = fixHook =
rmouseEvent.test( type ) ? this.mouseHooks :
rkeyEvent.test( type ) ? this.keyHooks :
{};
}
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
event = new jQuery.Event( originalEvent );
i = copy.length;
while ( i-- ) {
prop = copy[ i ];
event[ prop ] = originalEvent[ prop ];
}
// Support: IE<9
// Fix target property (#1925)
if ( !event.target ) {
event.target = originalEvent.srcElement || document;
}
// Support: Chrome 23+, Safari?
// Target should not be a text node (#504, #13143)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;
}
// Support: IE<9
// For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
event.metaKey = !!event.metaKey;
return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
},
// Includes some event props shared by KeyEvent and MouseEvent
props: "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 body, eventDoc, doc,
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;
}
},
special: {
load: {
// Prevent triggered image.load events from bubbling to window.load
noBubble: true
},
focus: {
// Fire native event if possible so blur/focus sequence is correct
trigger: function() {
if ( this !== safeActiveElement() && this.focus ) {
try {
this.focus();
return false;
} catch ( e ) {
// Support: IE<9
// If we error on focus to hidden element (#1486, #12518),
// let .trigger() run the handlers
}
}
},
delegateType: "focusin"
},
blur: {
trigger: function() {
if ( this === safeActiveElement() && this.blur ) {
this.blur();
return false;
}
},
delegateType: "focusout"
},
click: {
// For checkbox, fire native event so checked state will be right
trigger: function() {
if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
this.click();
return false;
}
},
// For cross-browser consistency, don't fire native .click() on links
_default: function( event ) {
return jQuery.nodeName( event.target, "a" );
}
},
beforeunload: {
postDispatch: function( event ) {
// Even when returnValue equals to undefined Firefox will still show alert
if ( event.result !== undefined ) {
event.originalEvent.returnValue = event.result;
}
}
}
},
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();
}
}
};
jQuery.removeEvent = document.removeEventListener ?
function( elem, type, handle ) {
if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle, false );
}
} :
function( elem, type, handle ) {
var name = "on" + type;
if ( elem.detachEvent ) {
// #8545, #7054, preventing memory leaks for custom events in IE6-8
// detachEvent needed property on element, by name of that event, to properly expose it to GC
if ( typeof elem[ name ] === core_strundefined ) {
elem[ name ] = null;
}
elem.detachEvent( name, 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;
};
// 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 = {
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse,
preventDefault: function() {
var e = this.originalEvent;
this.isDefaultPrevented = returnTrue;
if ( !e ) {
return;
}
// If preventDefault exists, run it on the original event
if ( e.preventDefault ) {
e.preventDefault();
// Support: IE
// Otherwise set the returnValue property of the original event to false
} else {
e.returnValue = false;
}
},
stopPropagation: function() {
var e = this.originalEvent;
this.isPropagationStopped = returnTrue;
if ( !e ) {
return;
}
// If stopPropagation exists, run it on the original event
if ( e.stopPropagation ) {
e.stopPropagation();
}
// Support: IE
// Set the cancelBubble property of the original event to true
e.cancelBubble = true;
},
stopImmediatePropagation: function() {
this.isImmediatePropagationStopped = returnTrue;
this.stopPropagation();
}
};
// 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 ret,
target = this,
related = event.relatedTarget,
handleObj = event.handleObj;
// 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 && !jQuery._data( form, "submitBubbles" ) ) {
jQuery.event.add( form, "submit._submit", function( event ) {
event._submit_bubble = true;
});
jQuery._data( form, "submitBubbles", true );
}
});
// return undefined since we don't need an event listener
},
postDispatch: function( event ) {
// If form was submitted by the user, bubble the event up the tree
if ( event._submit_bubble ) {
delete event._submit_bubble;
if ( this.parentNode && !event.isTrigger ) {
jQuery.event.simulate( "submit", this.parentNode, event, true );
}
}
},
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;
}
// Allow triggered, simulated change events (#11500)
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 ) && !jQuery._data( elem, "changeBubbles" ) ) {
jQuery.event.add( elem, "change._change", function( event ) {
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
jQuery.event.simulate( "change", this.parentNode, event, true );
}
});
jQuery._data( elem, "changeBubbles", 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 type, origFn;
// Types can be a map of types/handlers
if ( typeof types === "object" ) {
// ( types-Object, selector, data )
if ( typeof selector !== "string" ) {
// ( types-Object, data )
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( types, selector, data, fn, 1 );
},
off: function( types, selector, fn ) {
var handleObj, type;
if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event
handleObj = types.handleObj;
jQuery( types.delegateTarget ).off(
handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
handleObj.selector,
handleObj.handler
);
return this;
}
if ( typeof types === "object" ) {
// ( types-object [, selector] )
for ( 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 );
});
},
trigger: function( type, data ) {
return this.each(function() {
jQuery.event.trigger( type, data, this );
});
},
triggerHandler: function( type, data ) {
var elem = this[0];
if ( elem ) {
return jQuery.event.trigger( type, data, elem, true );
}
}
});
var isSimple = /^.[^:#\[\.,]*$/,
rparentsprev = /^(?:parents|prev(?:Until|All))/,
rneedsContext = jQuery.expr.match.needsContext,
// 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 i,
ret = [],
self = this,
len = self.length;
if ( typeof selector !== "string" ) {
return this.pushStack( jQuery( selector ).filter(function() {
for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( self[ i ], this ) ) {
return true;
}
}
}) );
}
for ( i = 0; i < len; i++ ) {
jQuery.find( selector, self[ i ], ret );
}
// Needed because $( selector, context ) becomes $( context ).find( selector )
ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
ret.selector = this.selector ? this.selector + " " + selector : selector;
return ret;
},
has: function( target ) {
var i,
targets = jQuery( target, this ),
len = targets.length;
return this.filter(function() {
for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( this, targets[i] ) ) {
return true;
}
}
});
},
not: function( selector ) {
return this.pushStack( winnow(this, selector || [], true) );
},
filter: function( selector ) {
return this.pushStack( winnow(this, selector || [], false) );
},
is: function( selector ) {
return !!winnow(
this,
// If this is a positional/relative selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
typeof selector === "string" && rneedsContext.test( selector ) ?
jQuery( selector ) :
selector || [],
false
).length;
},
closest: function( selectors, context ) {
var cur,
i = 0,
l = this.length,
ret = [],
pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
jQuery( selectors, context || this.context ) :
0;
for ( ; i < l; i++ ) {
for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
// Always skip document fragments
if ( cur.nodeType < 11 && (pos ?
pos.index(cur) > -1 :
// Don't pass non-elements to Sizzle
cur.nodeType === 1 &&
jQuery.find.matchesSelector(cur, selectors)) ) {
cur = ret.push( cur );
break;
}
}
}
return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret );
},
// 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.first().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( jQuery.unique(all) );
},
addBack: function( selector ) {
return this.add( selector == null ?
this.prevObject : this.prevObject.filter(selector)
);
}
});
function sibling( cur, dir ) {
do {
cur = cur[ dir ];
} while ( cur && cur.nodeType !== 1 );
return cur;
}
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 sibling( elem, "nextSibling" );
},
prev: function( elem ) {
return sibling( elem, "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.merge( [], elem.childNodes );
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
var ret = jQuery.map( this, fn, until );
if ( name.slice( -5 ) !== "Until" ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
if ( this.length > 1 ) {
// Remove duplicates
if ( !guaranteedUnique[ name ] ) {
ret = jQuery.unique( ret );
}
// Reverse order for parents* and prev-derivatives
if ( rparentsprev.test( name ) ) {
ret = ret.reverse();
}
}
return this.pushStack( ret );
};
});
jQuery.extend({
filter: function( expr, elems, not ) {
var elem = elems[ 0 ];
if ( not ) {
expr = ":not(" + expr + ")";
}
return elems.length === 1 && elem.nodeType === 1 ?
jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
return elem.nodeType === 1;
}));
},
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;
},
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, not ) {
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep( elements, function( elem, i ) {
/* jshint -W018 */
return !!qualifier.call( elem, i, elem ) !== not;
});
}
if ( qualifier.nodeType ) {
return jQuery.grep( elements, function( elem ) {
return ( elem === qualifier ) !== not;
});
}
if ( typeof qualifier === "string" ) {
if ( isSimple.test( qualifier ) ) {
return jQuery.filter( qualifier, elements, not );
}
qualifier = jQuery.filter( qualifier, elements );
}
return jQuery.grep( elements, function( elem ) {
return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not;
});
}
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|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
rnoInnerhtml = /<(?:script|style|link)/i,
manipulation_rcheckableType = /^(?:checkbox|radio)$/i,
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /^$|\/(?:java|ecma)script/i,
rscriptTypeMasked = /^true\/(.*)/,
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
// We have to close these tags to support XHTML (#13200)
wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
area: [ 1, "<map>", "</map>" ],
param: [ 1, "<object>", "</object>" ],
thead: [ 1, "<table>", "</table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
// unless wrapped in a div with non-breaking characters in front of it.
_default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
},
safeFragment = createSafeFragment( document ),
fragmentDiv = safeFragment.appendChild( document.createElement("div") );
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
jQuery.fn.extend({
text: function( value ) {
return jQuery.access( this, function( value ) {
return value === undefined ?
jQuery.text( this ) :
this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
}, null, value, arguments.length );
},
append: function() {
return this.domManip( arguments, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
var target = manipulationTarget( this, elem );
target.appendChild( elem );
}
});
},
prepend: function() {
return this.domManip( arguments, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
var target = manipulationTarget( this, elem );
target.insertBefore( elem, target.firstChild );
}
});
},
before: function() {
return this.domManip( arguments, function( elem ) {
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this );
}
});
},
after: function() {
return this.domManip( arguments, function( elem ) {
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this.nextSibling );
}
});
},
// keepData is for internal use only--do not document
remove: function( selector, keepData ) {
var elem,
elems = selector ? jQuery.filter( selector, this ) : this,
i = 0;
for ( ; (elem = elems[i]) != null; i++ ) {
if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem ) );
}
if ( elem.parentNode ) {
if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
setGlobalEval( getAll( elem, "script" ) );
}
elem.parentNode.removeChild( elem );
}
}
return this;
},
empty: function() {
var elem,
i = 0;
for ( ; (elem = this[i]) != null; i++ ) {
// Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem, false ) );
}
// Remove any remaining nodes
while ( elem.firstChild ) {
elem.removeChild( elem.firstChild );
}
// If this is a select, ensure that it displays empty (#12336)
// Support: IE<9
if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
elem.options.length = 0;
}
}
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 ) {
return jQuery.access( this, function( value ) {
var elem = this[0] || {},
i = 0,
l = this.length;
if ( value === undefined ) {
return elem.nodeType === 1 ?
elem.innerHTML.replace( rinlinejQuery, "" ) :
undefined;
}
// See if we can take a shortcut and just use innerHTML
if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
!wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
value = value.replace( rxhtmlTag, "<$1></$2>" );
try {
for (; i < l; i++ ) {
// Remove element nodes and prevent memory leaks
elem = this[i] || {};
if ( elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem, false ) );
elem.innerHTML = value;
}
}
elem = 0;
// If using innerHTML throws an exception, use the fallback method
} catch(e) {}
}
if ( elem ) {
this.empty().append( value );
}
}, null, value, arguments.length );
},
replaceWith: function() {
var
// Snapshot the DOM in case .domManip sweeps something relevant into its fragment
args = jQuery.map( this, function( elem ) {
return [ elem.nextSibling, elem.parentNode ];
}),
i = 0;
// Make the changes, replacing each context element with the new content
this.domManip( arguments, function( elem ) {
var next = args[ i++ ],
parent = args[ i++ ];
if ( parent ) {
// Don't use the snapshot next if it has moved (#13810)
if ( next && next.parentNode !== parent ) {
next = this.nextSibling;
}
jQuery( this ).remove();
parent.insertBefore( elem, next );
}
// Allow new content to include elements from the context set
}, true );
// Force removal if there was no new content (e.g., from empty arguments)
return i ? this : this.remove();
},
detach: function( selector ) {
return this.remove( selector, true );
},
domManip: function( args, callback, allowIntersection ) {
// Flatten any nested arrays
args = core_concat.apply( [], args );
var first, node, hasScripts,
scripts, doc, fragment,
i = 0,
l = this.length,
set = this,
iNoClone = l - 1,
value = args[0],
isFunction = jQuery.isFunction( value );
// We can't cloneNode fragments that contain checked, in WebKit
if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {
return this.each(function( index ) {
var self = set.eq( index );
if ( isFunction ) {
args[0] = value.call( this, index, self.html() );
}
self.domManip( args, callback, allowIntersection );
});
}
if ( l ) {
fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, !allowIntersection && this );
first = fragment.firstChild;
if ( fragment.childNodes.length === 1 ) {
fragment = first;
}
if ( first ) {
scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
hasScripts = scripts.length;
// Use the original fragment for the last item instead of the first because it can end up
// being emptied incorrectly in certain situations (#8070).
for ( ; i < l; i++ ) {
node = fragment;
if ( i !== iNoClone ) {
node = jQuery.clone( node, true, true );
// Keep references to cloned scripts for later restoration
if ( hasScripts ) {
jQuery.merge( scripts, getAll( node, "script" ) );
}
}
callback.call( this[i], node, i );
}
if ( hasScripts ) {
doc = scripts[ scripts.length - 1 ].ownerDocument;
// Reenable scripts
jQuery.map( scripts, restoreScript );
// Evaluate executable scripts on first document insertion
for ( i = 0; i < hasScripts; i++ ) {
node = scripts[ i ];
if ( rscriptType.test( node.type || "" ) &&
!jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
if ( node.src ) {
// Hope ajax is available...
jQuery._evalUrl( node.src );
} else {
jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );
}
}
}
}
// Fix #11809: Avoid leaking memory
fragment = first = null;
}
}
return this;
}
});
// Support: IE<8
// Manipulating tables requires a tbody
function manipulationTarget( elem, content ) {
return jQuery.nodeName( elem, "table" ) &&
jQuery.nodeName( content.nodeType === 1 ? content : content.firstChild, "tr" ) ?
elem.getElementsByTagName("tbody")[0] ||
elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
elem;
}
// Replace/restore the type attribute of script elements for safe DOM manipulation
function disableScript( elem ) {
elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type;
return elem;
}
function restoreScript( elem ) {
var match = rscriptTypeMasked.exec( elem.type );
if ( match ) {
elem.type = match[1];
} else {
elem.removeAttribute("type");
}
return elem;
}
// Mark scripts as having already been evaluated
function setGlobalEval( elems, refElements ) {
var elem,
i = 0;
for ( ; (elem = elems[i]) != null; i++ ) {
jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
}
}
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 ] );
}
}
}
// make the cloned public data object a copy from the original
if ( curData.data ) {
curData.data = jQuery.extend( {}, curData.data );
}
}
function fixCloneNodeIssues( src, dest ) {
var nodeName, e, data;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
return;
}
nodeName = dest.nodeName.toLowerCase();
// IE6-8 copies events bound via attachEvent when using cloneNode.
if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) {
data = jQuery._data( dest );
for ( e in data.events ) {
jQuery.removeEvent( dest, e, data.handle );
}
// Event data gets referenced instead of copied if the expando gets copied too
dest.removeAttribute( jQuery.expando );
}
// IE blanks contents when cloning scripts, and tries to evaluate newly-set text
if ( nodeName === "script" && dest.text !== src.text ) {
disableScript( dest ).text = src.text;
restoreScript( dest );
// IE6-10 improperly clones children of object elements using classid.
// IE10 throws NoModificationAllowedError if parent is null, #12132.
} else if ( nodeName === "object" ) {
if ( dest.parentNode ) {
dest.outerHTML = src.outerHTML;
}
// This path appears unavoidable for IE9. When cloning an object
// element in IE9, the outerHTML strategy above is not sufficient.
// If the src has innerHTML and the destination does not,
// copy the src.innerHTML into the dest.innerHTML. #10324
if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
dest.innerHTML = src.innerHTML;
}
} else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
// 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
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.defaultSelected = 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;
}
}
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function( name, original ) {
jQuery.fn[ name ] = function( selector ) {
var elems,
i = 0,
ret = [],
insert = jQuery( selector ),
last = insert.length - 1;
for ( ; i <= last; i++ ) {
elems = i === last ? this : this.clone(true);
jQuery( insert[i] )[ original ]( elems );
// Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
core_push.apply( ret, elems.get() );
}
return this.pushStack( ret );
};
});
function getAll( context, tag ) {
var elems, elem,
i = 0,
found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) :
typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) :
undefined;
if ( !found ) {
for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
if ( !tag || jQuery.nodeName( elem, tag ) ) {
found.push( elem );
} else {
jQuery.merge( found, getAll( elem, tag ) );
}
}
}
return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
jQuery.merge( [ context ], found ) :
found;
}
// Used in buildFragment, fixes the defaultChecked property
function fixDefaultChecked( elem ) {
if ( manipulation_rcheckableType.test( elem.type ) ) {
elem.defaultChecked = elem.checked;
}
}
jQuery.extend({
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var destElements, node, clone, i, srcElements,
inPage = jQuery.contains( elem.ownerDocument, elem );
if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
clone = elem.cloneNode( true );
// IE<=8 does not properly clone detached, unknown element nodes
} else {
fragmentDiv.innerHTML = elem.outerHTML;
fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
}
if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
(elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
destElements = getAll( clone );
srcElements = getAll( elem );
// Fix all IE cloning issues
for ( i = 0; (node = srcElements[i]) != null; ++i ) {
// Ensure that the destination node is not null; Fixes #9587
if ( destElements[i] ) {
fixCloneNodeIssues( node, destElements[i] );
}
}
}
// Copy the events from the original to the clone
if ( dataAndEvents ) {
if ( deepDataAndEvents ) {
srcElements = srcElements || getAll( elem );
destElements = destElements || getAll( clone );
for ( i = 0; (node = srcElements[i]) != null; i++ ) {
cloneCopyEvent( node, destElements[i] );
}
} else {
cloneCopyEvent( elem, clone );
}
}
// Preserve script evaluation history
destElements = getAll( clone, "script" );
if ( destElements.length > 0 ) {
setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
}
destElements = srcElements = node = null;
// Return the cloned set
return clone;
},
buildFragment: function( elems, context, scripts, selection ) {
var j, elem, contains,
tmp, tag, tbody, wrap,
l = elems.length,
// Ensure a safe fragment
safe = createSafeFragment( context ),
nodes = [],
i = 0;
for ( ; i < l; i++ ) {
elem = elems[ i ];
if ( elem || elem === 0 ) {
// Add nodes directly
if ( jQuery.type( elem ) === "object" ) {
jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
// Convert non-html into a text node
} else if ( !rhtml.test( elem ) ) {
nodes.push( context.createTextNode( elem ) );
// Convert html into DOM nodes
} else {
tmp = tmp || safe.appendChild( context.createElement("div") );
// Deserialize a standard representation
tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
wrap = wrapMap[ tag ] || wrapMap._default;
tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
// Descend through wrappers to the right content
j = wrap[0];
while ( j-- ) {
tmp = tmp.lastChild;
}
// Manually add leading whitespace removed by IE
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
}
// Remove IE's autoinserted <tbody> from table fragments
if ( !jQuery.support.tbody ) {
// String was a <table>, *may* have spurious <tbody>
elem = tag === "table" && !rtbody.test( elem ) ?
tmp.firstChild :
// String was a bare <thead> or <tfoot>
wrap[1] === "<table>" && !rtbody.test( elem ) ?
tmp :
0;
j = elem && elem.childNodes.length;
while ( j-- ) {
if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
elem.removeChild( tbody );
}
}
}
jQuery.merge( nodes, tmp.childNodes );
// Fix #12392 for WebKit and IE > 9
tmp.textContent = "";
// Fix #12392 for oldIE
while ( tmp.firstChild ) {
tmp.removeChild( tmp.firstChild );
}
// Remember the top-level container for proper cleanup
tmp = safe.lastChild;
}
}
}
// Fix #11356: Clear elements from fragment
if ( tmp ) {
safe.removeChild( tmp );
}
// Reset defaultChecked for any radios and checkboxes
// about to be appended to the DOM in IE 6/7 (#8060)
if ( !jQuery.support.appendChecked ) {
jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
}
i = 0;
while ( (elem = nodes[ i++ ]) ) {
// #4087 - If origin and destination elements are the same, and this is
// that element, do not do anything
if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
continue;
}
contains = jQuery.contains( elem.ownerDocument, elem );
// Append to fragment
tmp = getAll( safe.appendChild( elem ), "script" );
// Preserve script evaluation history
if ( contains ) {
setGlobalEval( tmp );
}
// Capture executables
if ( scripts ) {
j = 0;
while ( (elem = tmp[ j++ ]) ) {
if ( rscriptType.test( elem.type || "" ) ) {
scripts.push( elem );
}
}
}
}
tmp = null;
return safe;
},
cleanData: function( elems, /* internal */ acceptData ) {
var elem, type, id, data,
i = 0,
internalKey = jQuery.expando,
cache = jQuery.cache,
deleteExpando = jQuery.support.deleteExpando,
special = jQuery.event.special;
for ( ; (elem = elems[i]) != null; i++ ) {
if ( acceptData || jQuery.acceptData( elem ) ) {
id = elem[ internalKey ];
data = id && cache[ id ];
if ( data ) {
if ( data.events ) {
for ( 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 );
}
}
}
// Remove cache only if it was not already removed by jQuery.event.remove
if ( cache[ id ] ) {
delete cache[ id ];
// 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 ( deleteExpando ) {
delete elem[ internalKey ];
} else if ( typeof elem.removeAttribute !== core_strundefined ) {
elem.removeAttribute( internalKey );
} else {
elem[ internalKey ] = null;
}
core_deletedIds.push( id );
}
}
}
}
},
_evalUrl: function( url ) {
return jQuery.ajax({
url: url,
type: "GET",
dataType: "script",
async: false,
global: false,
"throws": true
});
}
});
jQuery.fn.extend({
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();
}
});
var iframe, getStyles, curCSS,
ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity\s*=\s*([^)]*)/,
rposition = /^(top|right|bottom|left)$/,
// swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
// see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
rdisplayswap = /^(none|table(?!-c[ea]).+)/,
rmargin = /^margin/,
rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ),
elemdisplay = { BODY: "block" },
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssNormalTransform = {
letterSpacing: 0,
fontWeight: 400
},
cssExpand = [ "Top", "Right", "Bottom", "Left" ],
cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
// return a css property mapped to a potentially vendor prefixed property
function vendorPropName( style, name ) {
// shortcut for names that are not vendor prefixed
if ( name in style ) {
return name;
}
// check for vendor prefixed names
var capName = name.charAt(0).toUpperCase() + name.slice(1),
origName = name,
i = cssPrefixes.length;
while ( i-- ) {
name = cssPrefixes[ i ] + capName;
if ( name in style ) {
return name;
}
}
return origName;
}
function isHidden( elem, el ) {
// isHidden might be called from jQuery#filter function;
// in that case, element will be second argument
elem = el || elem;
return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
}
function showHide( elements, show ) {
var display, elem, hidden,
values = [],
index = 0,
length = elements.length;
for ( ; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
values[ index ] = jQuery._data( elem, "olddisplay" );
display = elem.style.display;
if ( show ) {
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !values[ index ] && display === "none" ) {
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 ( elem.style.display === "" && isHidden( elem ) ) {
values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
}
} else {
if ( !values[ index ] ) {
hidden = isHidden( elem );
if ( display && display !== "none" || !hidden ) {
jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
}
}
}
}
// Set the display of most of the elements in a second loop
// to avoid the constant reflow
for ( index = 0; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
elem.style.display = show ? values[ index ] || "" : "none";
}
}
return elements;
}
jQuery.fn.extend({
css: function( name, value ) {
return jQuery.access( this, function( elem, name, value ) {
var len, styles,
map = {},
i = 0;
if ( jQuery.isArray( name ) ) {
styles = getStyles( elem );
len = name.length;
for ( ; i < len; i++ ) {
map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
}
return map;
}
return value !== undefined ?
jQuery.style( elem, name, value ) :
jQuery.css( elem, name );
}, name, value, arguments.length > 1 );
},
show: function() {
return showHide( this, true );
},
hide: function() {
return showHide( this );
},
toggle: function( state ) {
if ( typeof state === "boolean" ) {
return state ? this.show() : this.hide();
}
return this.each(function() {
if ( isHidden( this ) ) {
jQuery( this ).show();
} else {
jQuery( this ).hide();
}
});
}
});
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" );
return ret === "" ? "1" : ret;
}
}
}
},
// Don't automatically add "px" to these possibly-unitless properties
cssNumber: {
"columnCount": true,
"fillOpacity": true,
"fontWeight": true,
"lineHeight": true,
"opacity": true,
"order": 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, hooks,
origName = jQuery.camelCase( name ),
style = elem.style;
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
// gets hook for the prefixed version
// followed by the unprefixed version
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ 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";
}
// Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
// but it would mean to define eight (for every problematic property) identical functions
if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
style[ name ] = "inherit";
}
// If a hook was provided, use that value, otherwise just set the specified value
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== 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, styles ) {
var num, val, hooks,
origName = jQuery.camelCase( name );
// Make sure that we're working with the right name
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
// gets hook for the prefixed version
// followed by the unprefixed version
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
// If a hook was provided get the computed value from there
if ( hooks && "get" in hooks ) {
val = hooks.get( elem, true, extra );
}
// Otherwise, if a way to get the computed value exists, use that
if ( val === undefined ) {
val = curCSS( elem, name, styles );
}
//convert "normal" to computed value
if ( val === "normal" && name in cssNormalTransform ) {
val = cssNormalTransform[ name ];
}
// Return, converting to number if forced or a qualifier was provided and val looks numeric
if ( extra === "" || extra ) {
num = parseFloat( val );
return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
}
return val;
}
});
// NOTE: we've included the "window" in window.getComputedStyle
// because jsdom on node.js will break without it.
if ( window.getComputedStyle ) {
getStyles = function( elem ) {
return window.getComputedStyle( elem, null );
};
curCSS = function( elem, name, _computed ) {
var width, minWidth, maxWidth,
computed = _computed || getStyles( elem ),
// getPropertyValue is only needed for .css('filter') in IE9, see #12537
ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined,
style = elem.style;
if ( computed ) {
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
ret = jQuery.style( elem, name );
}
// A tribute to the "awesome hack by Dean Edwards"
// Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
// Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
// Remember the original values
width = style.width;
minWidth = style.minWidth;
maxWidth = style.maxWidth;
// Put in the new values to get a computed value out
style.minWidth = style.maxWidth = style.width = ret;
ret = computed.width;
// Revert the changed values
style.width = width;
style.minWidth = minWidth;
style.maxWidth = maxWidth;
}
}
return ret;
};
} else if ( document.documentElement.currentStyle ) {
getStyles = function( elem ) {
return elem.currentStyle;
};
curCSS = function( elem, name, _computed ) {
var left, rs, rsLeft,
computed = _computed || getStyles( elem ),
ret = computed ? computed[ name ] : undefined,
style = elem.style;
// Avoid setting ret to empty string here
// so we don't default to auto
if ( ret == null && style && style[ name ] ) {
ret = style[ name ];
}
// 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
// but not position css attributes, as those are proportional to the parent element instead
// and we can't measure the parent instead because it might trigger a "stacking dolls" problem
if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
// Remember the original values
left = style.left;
rs = elem.runtimeStyle;
rsLeft = rs && rs.left;
// Put in the new values to get a computed value out
if ( rsLeft ) {
rs.left = elem.currentStyle.left;
}
style.left = name === "fontSize" ? "1em" : ret;
ret = style.pixelLeft + "px";
// Revert the changed values
style.left = left;
if ( rsLeft ) {
rs.left = rsLeft;
}
}
return ret === "" ? "auto" : ret;
};
}
function setPositiveNumber( elem, value, subtract ) {
var matches = rnumsplit.exec( value );
return matches ?
// Guard against undefined "subtract", e.g., when used as in cssHooks
Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
value;
}
function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
var i = extra === ( isBorderBox ? "border" : "content" ) ?
// If we already have the right measurement, avoid augmentation
4 :
// Otherwise initialize for horizontal or vertical properties
name === "width" ? 1 : 0,
val = 0;
for ( ; i < 4; i += 2 ) {
// both box models exclude margin, so add it if we want it
if ( extra === "margin" ) {
val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
}
if ( isBorderBox ) {
// border-box includes padding, so remove it if we want content
if ( extra === "content" ) {
val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
}
// at this point, extra isn't border nor margin, so remove border
if ( extra !== "margin" ) {
val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
}
} else {
// at this point, extra isn't content, so add padding
val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
// at this point, extra isn't content nor padding, so add border
if ( extra !== "padding" ) {
val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
}
}
}
return val;
}
function getWidthOrHeight( elem, name, extra ) {
// Start with offset property, which is equivalent to the border-box value
var valueIsBorderBox = true,
val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
styles = getStyles( elem ),
isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
// some non-html elements return undefined for offsetWidth, so check for null/undefined
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
if ( val <= 0 || val == null ) {
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name, styles );
if ( val < 0 || val == null ) {
val = elem.style[ name ];
}
// Computed unit is not pixels. Stop here and return.
if ( rnumnonpx.test(val) ) {
return val;
}
// we need the check for style in case a browser which returns unreliable values
// for getComputedStyle silently falls back to the reliable elem.style
valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
}
// use the active box-sizing model to add/subtract irrelevant styles
return ( val +
augmentWidthOrHeight(
elem,
name,
extra || ( isBorderBox ? "border" : "content" ),
valueIsBorderBox,
styles
)
) + "px";
}
// Try to determine the default display value of an element
function css_defaultDisplay( nodeName ) {
var doc = document,
display = elemdisplay[ nodeName ];
if ( !display ) {
display = actualDisplay( nodeName, doc );
// If the simple way fails, read from inside an iframe
if ( display === "none" || !display ) {
// Use the already-created iframe if possible
iframe = ( iframe ||
jQuery("<iframe frameborder='0' width='0' height='0'/>")
.css( "cssText", "display:block !important" )
).appendTo( doc.documentElement );
// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
doc.write("<!doctype html><html><body>");
doc.close();
display = actualDisplay( nodeName, doc );
iframe.detach();
}
// Store the correct default display
elemdisplay[ nodeName ] = display;
}
return display;
}
// Called ONLY from within css_defaultDisplay
function actualDisplay( name, doc ) {
var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
display = jQuery.css( elem[0], "display" );
elem.remove();
return display;
}
jQuery.each([ "height", "width" ], function( i, name ) {
jQuery.cssHooks[ name ] = {
get: function( elem, computed, extra ) {
if ( computed ) {
// certain elements can have dimension info if we invisibly show them
// however, it must have a current display style that would benefit from this
return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ?
jQuery.swap( elem, cssShow, function() {
return getWidthOrHeight( elem, name, extra );
}) :
getWidthOrHeight( elem, name, extra );
}
},
set: function( elem, value, extra ) {
var styles = extra && getStyles( elem );
return setPositiveNumber( elem, value, extra ?
augmentWidthOrHeight(
elem,
name,
extra,
jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
styles
) : 0
);
}
};
});
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) || "" ) ?
( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
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 === "", then remove inline opacity #12685
if ( ( value >= 1 || value === "" ) &&
jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
style.removeAttribute ) {
// 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 is no filter style applied in a css rule or unset inline opacity, we are done
if ( value === "" || currentStyle && !currentStyle.filter ) {
return;
}
}
// otherwise, set new filter values
style.filter = ralpha.test( filter ) ?
filter.replace( ralpha, opacity ) :
filter + " " + opacity;
}
};
}
// These hooks cannot be added until DOM ready because the support test
// for it is not run until after DOM ready
jQuery(function() {
if ( !jQuery.support.reliableMarginRight ) {
jQuery.cssHooks.marginRight = {
get: function( elem, computed ) {
if ( computed ) {
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// Work around by temporarily setting element display to inline-block
return jQuery.swap( elem, { "display": "inline-block" },
curCSS, [ elem, "marginRight" ] );
}
}
};
}
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
// getComputedStyle returns percent when specified for top/left/bottom/right
// rather than make the css module depend on the offset module, we just check for it here
if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
jQuery.each( [ "top", "left" ], function( i, prop ) {
jQuery.cssHooks[ prop ] = {
get: function( elem, computed ) {
if ( computed ) {
computed = curCSS( elem, prop );
// if curCSS returns percentage, fallback to offset
return rnumnonpx.test( computed ) ?
jQuery( elem ).position()[ prop ] + "px" :
computed;
}
}
};
});
}
});
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
// Support: Opera <= 12.12
// Opera reports offsetWidths and offsetHeights less than zero on some elements
return elem.offsetWidth <= 0 && elem.offsetHeight <= 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 );
};
}
// These hooks are used by animate to expand properties
jQuery.each({
margin: "",
padding: "",
border: "Width"
}, function( prefix, suffix ) {
jQuery.cssHooks[ prefix + suffix ] = {
expand: function( value ) {
var i = 0,
expanded = {},
// assumes a single number if not a string
parts = typeof value === "string" ? value.split(" ") : [ value ];
for ( ; i < 4; i++ ) {
expanded[ prefix + cssExpand[ i ] + suffix ] =
parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
}
return expanded;
}
};
if ( !rmargin.test( prefix ) ) {
jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
}
});
var r20 = /%20/g,
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
rsubmittable = /^(?:input|select|textarea|keygen)/i;
jQuery.fn.extend({
serialize: function() {
return jQuery.param( this.serializeArray() );
},
serializeArray: function() {
return this.map(function(){
// Can add propHook for "elements" to filter or add form elements
var elements = jQuery.prop( this, "elements" );
return elements ? jQuery.makeArray( elements ) : this;
})
.filter(function(){
var type = this.type;
// Use .is(":disabled") so that fieldset[disabled] works
return this.name && !jQuery( this ).is( ":disabled" ) &&
rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
( this.checked || !manipulation_rcheckableType.test( type ) );
})
.map(function( i, elem ){
var val = jQuery( this ).val();
return val == null ?
null :
jQuery.isArray( val ) ?
jQuery.map( val, function( val ){
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}) :
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}).get();
}
});
//Serialize an array of form elements or a set of
//key/values into a query string
jQuery.param = function( a, traditional ) {
var prefix,
s = [],
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
};
// Set traditional to true for jQuery <= 1.3.2 behavior.
if ( traditional === undefined ) {
traditional = jQuery.ajaxSettings && 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 ( prefix in a ) {
buildParams( prefix, a[ prefix ], traditional, add );
}
}
// Return the resulting serialization
return s.join( "&" ).replace( r20, "+" );
};
function buildParams( prefix, obj, traditional, add ) {
var name;
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 {
// Item is non-scalar (array or object), encode its numeric index.
buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
}
});
} else if ( !traditional && jQuery.type( obj ) === "object" ) {
// Serialize object item.
for ( name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
}
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 ) {
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
});
jQuery.fn.extend({
hover: function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
},
bind: function( types, data, fn ) {
return this.on( types, null, data, fn );
},
unbind: function( types, fn ) {
return this.off( types, null, fn );
},
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 );
}
});
var
// Document location
ajaxLocParts,
ajaxLocation,
ajax_nonce = jQuery.now(),
ajax_rquery = /\?/,
rhash = /#.*$/,
rts = /([?&])_=[^&]*/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
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 = {},
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = "*/".concat("*");
// #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 = "*";
}
var dataType,
i = 0,
dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
if ( jQuery.isFunction( func ) ) {
// For each dataType in the dataTypeExpression
while ( (dataType = dataTypes[i++]) ) {
// Prepend if requested
if ( dataType[0] === "+" ) {
dataType = dataType.slice( 1 ) || "*";
(structure[ dataType ] = structure[ dataType ] || []).unshift( func );
// Otherwise append
} else {
(structure[ dataType ] = structure[ dataType ] || []).push( func );
}
}
}
};
}
// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
var inspected = {},
seekingTransport = ( structure === transports );
function inspect( dataType ) {
var selected;
inspected[ dataType ] = true;
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
options.dataTypes.unshift( dataTypeOrTransport );
inspect( dataTypeOrTransport );
return false;
} else if ( seekingTransport ) {
return !( selected = dataTypeOrTransport );
}
});
return selected;
}
return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
}
// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend( target, src ) {
var deep, key,
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 );
}
return target;
}
jQuery.fn.load = function( url, params, callback ) {
if ( typeof url !== "string" && _load ) {
return _load.apply( this, arguments );
}
var selector, response, type,
self = this,
off = url.indexOf(" ");
if ( off >= 0 ) {
selector = url.slice( off, url.length );
url = url.slice( 0, off );
}
// 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 ( params && typeof params === "object" ) {
type = "POST";
}
// If we have elements to modify, make the request
if ( self.length > 0 ) {
jQuery.ajax({
url: url,
// if "type" variable is undefined, then "GET" method will be used
type: type,
dataType: "html",
data: params
}).done(function( responseText ) {
// Save response for use in complete callback
response = arguments;
self.html( selector ?
// If a selector was specified, locate the right elements in a dummy div
// Exclude scripts to avoid IE 'Permission Denied' errors
jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
// Otherwise use the full result
responseText );
}).complete( callback && function( jqXHR, status ) {
self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
});
}
return this;
};
// Attach a bunch of functions for handling common AJAX events
jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
jQuery.fn[ type ] = function( fn ){
return this.on( type, fn );
};
});
jQuery.extend({
// Counter for holding the number of active queries
active: 0,
// Last-Modified header cache for next request
lastModified: {},
etag: {},
ajaxSettings: {
url: ajaxLocation,
type: "GET",
isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
global: true,
processData: true,
async: true,
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
/*
timeout: 0,
data: null,
dataType: null,
username: null,
password: null,
cache: null,
throws: false,
traditional: false,
headers: {},
*/
accepts: {
"*": allTypes,
text: "text/plain",
html: "text/html",
xml: "application/xml, text/xml",
json: "application/json, text/javascript"
},
contents: {
xml: /xml/,
html: /html/,
json: /json/
},
responseFields: {
xml: "responseXML",
text: "responseText",
json: "responseJSON"
},
// Data converters
// Keys separate source (or catchall "*") and destination types with a single space
converters: {
// Convert anything to text
"* text": 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: {
url: true,
context: true
}
},
// 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 ) {
return settings ?
// Building a settings object
ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
// Extending ajaxSettings
ajaxExtend( jQuery.ajaxSettings, target );
},
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 // Cross-domain detection vars
parts,
// Loop variable
i,
// URL without anti-cache param
cacheURL,
// Response headers as string
responseHeadersString,
// timeout handle
timeoutTimer,
// To know if global events are to be dispatched
fireGlobals,
transport,
// Response headers
responseHeaders,
// Create the final options object
s = jQuery.ajaxSetup( {}, options ),
// Callbacks context
callbackContext = s.context || s,
// Context for global events is callbackContext if it is a DOM node or jQuery collection
globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
jQuery( callbackContext ) :
jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery.Callbacks("once memory"),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// The jqXHR state
state = 0,
// Default abort message
strAbort = "canceled",
// Fake xhr
jqXHR = {
readyState: 0,
// 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 == null ? null : match;
},
// Raw string
getAllResponseHeaders: function() {
return state === 2 ? responseHeadersString : null;
},
// Caches the header
setRequestHeader: function( name, value ) {
var lname = name.toLowerCase();
if ( !state ) {
name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
requestHeaders[ name ] = value;
}
return this;
},
// Overrides response content-type header
overrideMimeType: function( type ) {
if ( !state ) {
s.mimeType = type;
}
return this;
},
// Status-dependent callbacks
statusCode: function( map ) {
var code;
if ( map ) {
if ( state < 2 ) {
for ( code in map ) {
// Lazy-add the new callback in a way that preserves old ones
statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
}
} else {
// Execute the appropriate callbacks
jqXHR.always( map[ jqXHR.status ] );
}
}
return this;
},
// Cancel the request
abort: function( statusText ) {
var finalText = statusText || strAbort;
if ( transport ) {
transport.abort( finalText );
}
done( 0, finalText );
return this;
}
};
// Attach deferreds
deferred.promise( jqXHR ).complete = completeDeferred.add;
jqXHR.success = jqXHR.done;
jqXHR.error = jqXHR.fail;
// Remove hash character (#7531: and string promotion)
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
// Handle falsy url in the settings object (#10093: consistency with old signature)
// We also use the url parameter if available
s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
// Alias method option to type as per ticket #12004
s.type = options.method || options.type || s.method || s.type;
// Extract dataTypes list
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
// A cross-domain request is in order when we have a protocol:host:port mismatch
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 prefilter, stop there
if ( state === 2 ) {
return jqXHR;
}
// We can fire global events as of now if asked to
fireGlobals = s.global;
// Watch for a new set of requests
if ( fireGlobals && jQuery.active++ === 0 ) {
jQuery.event.trigger("ajaxStart");
}
// Uppercase the type
s.type = s.type.toUpperCase();
// Determine if request has content
s.hasContent = !rnoContent.test( s.type );
// Save the URL in case we're toying with the If-Modified-Since
// and/or If-None-Match header later on
cacheURL = s.url;
// More options handling for requests with no content
if ( !s.hasContent ) {
// If data is available, append data to url
if ( s.data ) {
cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Add anti-cache in url if needed
if ( s.cache === false ) {
s.url = rts.test( cacheURL ) ?
// If there is already a '_' parameter, set its value
cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) :
// Otherwise add one to the end
cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++;
}
}
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
if ( jQuery.lastModified[ cacheURL ] ) {
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
}
if ( jQuery.etag[ cacheURL ] ) {
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
}
}
// 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 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 and return
return jqXHR.abort();
}
// aborting is no longer a cancellation
strAbort = "abort";
// 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;
}
}
}
// Callback for when everything is done
function done( status, nativeStatusText, responses, headers ) {
var isSuccess, success, error, response, modified,
statusText = nativeStatusText;
// 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;
// Determine if successful
isSuccess = status >= 200 && status < 300 || status === 304;
// Get response data
if ( responses ) {
response = ajaxHandleResponses( s, jqXHR, responses );
}
// Convert no matter what (that way responseXXX fields are always set)
response = ajaxConvert( s, response, jqXHR, isSuccess );
// If successful, handle type chaining
if ( isSuccess ) {
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
modified = jqXHR.getResponseHeader("Last-Modified");
if ( modified ) {
jQuery.lastModified[ cacheURL ] = modified;
}
modified = jqXHR.getResponseHeader("etag");
if ( modified ) {
jQuery.etag[ cacheURL ] = modified;
}
}
// if no content
if ( status === 204 || s.type === "HEAD" ) {
statusText = "nocontent";
// if not modified
} else if ( status === 304 ) {
statusText = "notmodified";
// If we have data, let's convert it
} else {
statusText = response.state;
success = response.data;
error = response.error;
isSuccess = !error;
}
} else {
// We extract error from statusText
// then normalize statusText and status for non-aborts
error = statusText;
if ( status || !statusText ) {
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( isSuccess ? "ajaxSuccess" : "ajaxError",
[ 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");
}
}
}
return jqXHR;
},
getJSON: function( url, data, callback ) {
return jQuery.get( url, data, callback, "json" );
},
getScript: function( url, callback ) {
return jQuery.get( url, undefined, callback, "script" );
}
});
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({
url: url,
type: method,
dataType: type,
data: data,
success: callback
});
};
});
/* Handles responses to an ajax request:
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
*/
function ajaxHandleResponses( s, jqXHR, responses ) {
var firstDataType, ct, finalDataType, type,
contents = s.contents,
dataTypes = s.dataTypes;
// 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
* Also sets the responseXXX fields on the jqXHR instance
*/
function ajaxConvert( s, response, jqXHR, isSuccess ) {
var conv2, current, conv, tmp, prev,
converters = {},
// Work with a copy of dataTypes in case we need to modify it for conversion
dataTypes = s.dataTypes.slice();
// Create converters map with lowercased keys
if ( dataTypes[ 1 ] ) {
for ( conv in s.converters ) {
converters[ conv.toLowerCase() ] = s.converters[ conv ];
}
}
current = dataTypes.shift();
// Convert to each sequential dataType
while ( current ) {
if ( s.responseFields[ current ] ) {
jqXHR[ s.responseFields[ current ] ] = response;
}
// Apply the dataFilter if provided
if ( !prev && isSuccess && s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
}
prev = current;
current = dataTypes.shift();
if ( current ) {
// There's only work to do if current dataType is non-auto
if ( current === "*" ) {
current = prev;
// Convert response if prev dataType is non-auto and differs from current
} else if ( prev !== "*" && prev !== current ) {
// Seek a direct converter
conv = converters[ prev + " " + current ] || converters[ "* " + current ];
// If none found, seek a pair
if ( !conv ) {
for ( conv2 in converters ) {
// If conv2 outputs current
tmp = conv2.split( " " );
if ( tmp[ 1 ] === current ) {
// If prev can be converted to accepted input
conv = converters[ prev + " " + tmp[ 0 ] ] ||
converters[ "* " + tmp[ 0 ] ];
if ( conv ) {
// Condense equivalence converters
if ( conv === true ) {
conv = converters[ conv2 ];
// Otherwise, insert the intermediate dataType
} else if ( converters[ conv2 ] !== true ) {
current = tmp[ 0 ];
dataTypes.unshift( tmp[ 1 ] );
}
break;
}
}
}
}
// Apply converter (if not an equivalence)
if ( conv !== true ) {
// Unless errors are allowed to bubble, catch and return them
if ( conv && s[ "throws" ] ) {
response = conv( response );
} else {
try {
response = conv( response );
} catch ( e ) {
return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
}
}
}
}
}
}
return { state: "success", data: response };
}
// Install script dataType
jQuery.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
contents: {
script: /(?:java|ecma)script/
},
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 || jQuery("head")[0] || document.documentElement;
return {
send: function( _, callback ) {
script = document.createElement("script");
script.async = true;
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 ( script.parentNode ) {
script.parentNode.removeChild( script );
}
// Dereference the script
script = null;
// Callback if not abort
if ( !isAbort ) {
callback( 200, "success" );
}
}
};
// Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
// Use native DOM manipulation to avoid our domManip AJAX trickery
head.insertBefore( script, head.firstChild );
},
abort: function() {
if ( script ) {
script.onload( undefined, true );
}
}
};
}
});
var oldCallbacks = [],
rjsonp = /(=)\?(?=&|$)|\?\?/;
// Default jsonp settings
jQuery.ajaxSetup({
jsonp: "callback",
jsonpCallback: function() {
var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );
this[ callback ] = true;
return callback;
}
});
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var callbackName, overwritten, responseContainer,
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
"url" :
typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
);
// Handle iff the expected data type is "jsonp" or we have a parameter to set
if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
// Get callback name, remembering preexisting value associated with it
callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
s.jsonpCallback() :
s.jsonpCallback;
// Insert callback into url or form data
if ( jsonProp ) {
s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
} else if ( s.jsonp !== false ) {
s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
}
// Use data converter to retrieve json after script execution
s.converters["script json"] = function() {
if ( !responseContainer ) {
jQuery.error( callbackName + " was not called" );
}
return responseContainer[ 0 ];
};
// force json dataType
s.dataTypes[ 0 ] = "json";
// Install callback
overwritten = window[ callbackName ];
window[ callbackName ] = function() {
responseContainer = arguments;
};
// Clean-up function (fires after converters)
jqXHR.always(function() {
// Restore preexisting value
window[ callbackName ] = overwritten;
// Save back as free
if ( s[ callbackName ] ) {
// make sure that re-using the options doesn't screw things around
s.jsonpCallback = originalSettings.jsonpCallback;
// save the callback name for future use
oldCallbacks.push( callbackName );
}
// Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( overwritten ) ) {
overwritten( responseContainer[ 0 ] );
}
responseContainer = overwritten = undefined;
});
// Delegate to script
return "script";
}
});
var xhrCallbacks, xhrSupported,
xhrId = 0,
// #5280: Internet Explorer will keep connections alive if we don't abort on unload
xhrOnUnloadAbort = window.ActiveXObject && function() {
// Abort all pending requests
var key;
for ( key in xhrCallbacks ) {
xhrCallbacks[ key ]( undefined, true );
}
};
// 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
xhrSupported = jQuery.ajaxSettings.xhr();
jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
xhrSupported = jQuery.support.ajax = !!xhrSupported;
// Create transport if the browser can provide an xhr
if ( xhrSupported ) {
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 handle, i,
xhr = s.xhr();
// 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( err ) {}
// 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, responseHeaders, statusText, responses;
// Firefox throws exceptions when accessing properties
// of an xhr when a network error occurred
// 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 {
responses = {};
status = xhr.status;
responseHeaders = xhr.getAllResponseHeaders();
// When requesting binary data, IE6-9 will throw an exception
// on any attempt to access responseText (#11426)
if ( typeof xhr.responseText === "string" ) {
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 ( !s.async ) {
// if we're in sync mode we fire the callback
callback();
} else if ( xhr.readyState === 4 ) {
// (IE6 & IE7) if it's in cache and has been
// retrieved directly we need to fire the callback
setTimeout( 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( undefined, true );
}
}
};
}
});
}
var fxNow, timerId,
rfxtypes = /^(?:toggle|show|hide)$/,
rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
rrun = /queueHooks$/,
animationPrefilters = [ defaultPrefilter ],
tweeners = {
"*": [function( prop, value ) {
var tween = this.createTween( prop, value ),
target = tween.cur(),
parts = rfxnum.exec( value ),
unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
// Starting value computation is required for potential unit mismatches
start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
rfxnum.exec( jQuery.css( tween.elem, prop ) ),
scale = 1,
maxIterations = 20;
if ( start && start[ 3 ] !== unit ) {
// Trust units reported by jQuery.css
unit = unit || start[ 3 ];
// Make sure we update the tween properties later on
parts = parts || [];
// Iteratively approximate from a nonzero starting point
start = +target || 1;
do {
// If previous iteration zeroed out, double until we get *something*
// Use a string for doubling factor so we don't accidentally see scale as unchanged below
scale = scale || ".5";
// Adjust and apply
start = start / scale;
jQuery.style( tween.elem, prop, start + unit );
// Update scale, tolerating zero or NaN from tween.cur()
// And breaking the loop if scale is unchanged or perfect, or if we've just had enough
} while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
}
// Update tween properties
if ( parts ) {
start = tween.start = +start || +target || 0;
tween.unit = unit;
// If a +=/-= token was provided, we're doing a relative animation
tween.end = parts[ 1 ] ?
start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
+parts[ 2 ];
}
return tween;
}]
};
// Animations created synchronously will run synchronously
function createFxNow() {
setTimeout(function() {
fxNow = undefined;
});
return ( fxNow = jQuery.now() );
}
function createTween( value, prop, animation ) {
var tween,
collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
index = 0,
length = collection.length;
for ( ; index < length; index++ ) {
if ( (tween = collection[ index ].call( animation, prop, value )) ) {
// we're done with this property
return tween;
}
}
}
function Animation( elem, properties, options ) {
var result,
stopped,
index = 0,
length = animationPrefilters.length,
deferred = jQuery.Deferred().always( function() {
// don't match elem in the :animated selector
delete tick.elem;
}),
tick = function() {
if ( stopped ) {
return false;
}
var currentTime = fxNow || createFxNow(),
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
// archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
temp = remaining / animation.duration || 0,
percent = 1 - temp,
index = 0,
length = animation.tweens.length;
for ( ; index < length ; index++ ) {
animation.tweens[ index ].run( percent );
}
deferred.notifyWith( elem, [ animation, percent, remaining ]);
if ( percent < 1 && length ) {
return remaining;
} else {
deferred.resolveWith( elem, [ animation ] );
return false;
}
},
animation = deferred.promise({
elem: elem,
props: jQuery.extend( {}, properties ),
opts: jQuery.extend( true, { specialEasing: {} }, options ),
originalProperties: properties,
originalOptions: options,
startTime: fxNow || createFxNow(),
duration: options.duration,
tweens: [],
createTween: function( prop, end ) {
var tween = jQuery.Tween( elem, animation.opts, prop, end,
animation.opts.specialEasing[ prop ] || animation.opts.easing );
animation.tweens.push( tween );
return tween;
},
stop: function( gotoEnd ) {
var index = 0,
// if we are going to the end, we want to run all the tweens
// otherwise we skip this part
length = gotoEnd ? animation.tweens.length : 0;
if ( stopped ) {
return this;
}
stopped = true;
for ( ; index < length ; index++ ) {
animation.tweens[ index ].run( 1 );
}
// resolve when we played the last frame
// otherwise, reject
if ( gotoEnd ) {
deferred.resolveWith( elem, [ animation, gotoEnd ] );
} else {
deferred.rejectWith( elem, [ animation, gotoEnd ] );
}
return this;
}
}),
props = animation.props;
propFilter( props, animation.opts.specialEasing );
for ( ; index < length ; index++ ) {
result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
if ( result ) {
return result;
}
}
jQuery.map( props, createTween, animation );
if ( jQuery.isFunction( animation.opts.start ) ) {
animation.opts.start.call( elem, animation );
}
jQuery.fx.timer(
jQuery.extend( tick, {
elem: elem,
anim: animation,
queue: animation.opts.queue
})
);
// attach callbacks from options
return animation.progress( animation.opts.progress )
.done( animation.opts.done, animation.opts.complete )
.fail( animation.opts.fail )
.always( animation.opts.always );
}
function propFilter( props, specialEasing ) {
var index, name, easing, value, hooks;
// camelCase, specialEasing and expand cssHook pass
for ( index in props ) {
name = jQuery.camelCase( index );
easing = specialEasing[ name ];
value = props[ index ];
if ( jQuery.isArray( value ) ) {
easing = value[ 1 ];
value = props[ index ] = value[ 0 ];
}
if ( index !== name ) {
props[ name ] = value;
delete props[ index ];
}
hooks = jQuery.cssHooks[ name ];
if ( hooks && "expand" in hooks ) {
value = hooks.expand( value );
delete props[ name ];
// not quite $.extend, this wont overwrite keys already present.
// also - reusing 'index' from above because we have the correct "name"
for ( index in value ) {
if ( !( index in props ) ) {
props[ index ] = value[ index ];
specialEasing[ index ] = easing;
}
}
} else {
specialEasing[ name ] = easing;
}
}
}
jQuery.Animation = jQuery.extend( Animation, {
tweener: function( props, callback ) {
if ( jQuery.isFunction( props ) ) {
callback = props;
props = [ "*" ];
} else {
props = props.split(" ");
}
var prop,
index = 0,
length = props.length;
for ( ; index < length ; index++ ) {
prop = props[ index ];
tweeners[ prop ] = tweeners[ prop ] || [];
tweeners[ prop ].unshift( callback );
}
},
prefilter: function( callback, prepend ) {
if ( prepend ) {
animationPrefilters.unshift( callback );
} else {
animationPrefilters.push( callback );
}
}
});
function defaultPrefilter( elem, props, opts ) {
/* jshint validthis: true */
var prop, value, toggle, tween, hooks, oldfire,
anim = this,
orig = {},
style = elem.style,
hidden = elem.nodeType && isHidden( elem ),
dataShow = jQuery._data( elem, "fxshow" );
// handle queue: false promises
if ( !opts.queue ) {
hooks = jQuery._queueHooks( elem, "fx" );
if ( hooks.unqueued == null ) {
hooks.unqueued = 0;
oldfire = hooks.empty.fire;
hooks.empty.fire = function() {
if ( !hooks.unqueued ) {
oldfire();
}
};
}
hooks.unqueued++;
anim.always(function() {
// doing this makes sure that the complete handler will be called
// before this completes
anim.always(function() {
hooks.unqueued--;
if ( !jQuery.queue( elem, "fx" ).length ) {
hooks.empty.fire();
}
});
});
}
// height/width overflow pass
if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
// 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
opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
// Set display property to inline-block for height/width
// animations on inline elements that are having width/height animated
if ( jQuery.css( elem, "display" ) === "inline" &&
jQuery.css( elem, "float" ) === "none" ) {
// inline-level elements accept inline-block;
// block-level elements need to be inline with layout
if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
style.display = "inline-block";
} else {
style.zoom = 1;
}
}
}
if ( opts.overflow ) {
style.overflow = "hidden";
if ( !jQuery.support.shrinkWrapBlocks ) {
anim.always(function() {
style.overflow = opts.overflow[ 0 ];
style.overflowX = opts.overflow[ 1 ];
style.overflowY = opts.overflow[ 2 ];
});
}
}
// show/hide pass
for ( prop in props ) {
value = props[ prop ];
if ( rfxtypes.exec( value ) ) {
delete props[ prop ];
toggle = toggle || value === "toggle";
if ( value === ( hidden ? "hide" : "show" ) ) {
continue;
}
orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
}
}
if ( !jQuery.isEmptyObject( orig ) ) {
if ( dataShow ) {
if ( "hidden" in dataShow ) {
hidden = dataShow.hidden;
}
} else {
dataShow = jQuery._data( elem, "fxshow", {} );
}
// store state if its toggle - enables .stop().toggle() to "reverse"
if ( toggle ) {
dataShow.hidden = !hidden;
}
if ( hidden ) {
jQuery( elem ).show();
} else {
anim.done(function() {
jQuery( elem ).hide();
});
}
anim.done(function() {
var prop;
jQuery._removeData( elem, "fxshow" );
for ( prop in orig ) {
jQuery.style( elem, prop, orig[ prop ] );
}
});
for ( prop in orig ) {
tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
if ( !( prop in dataShow ) ) {
dataShow[ prop ] = tween.start;
if ( hidden ) {
tween.end = tween.start;
tween.start = prop === "width" || prop === "height" ? 1 : 0;
}
}
}
}
}
function Tween( elem, options, prop, end, easing ) {
return new Tween.prototype.init( elem, options, prop, end, easing );
}
jQuery.Tween = Tween;
Tween.prototype = {
constructor: Tween,
init: function( elem, options, prop, end, easing, unit ) {
this.elem = elem;
this.prop = prop;
this.easing = easing || "swing";
this.options = options;
this.start = this.now = this.cur();
this.end = end;
this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
},
cur: function() {
var hooks = Tween.propHooks[ this.prop ];
return hooks && hooks.get ?
hooks.get( this ) :
Tween.propHooks._default.get( this );
},
run: function( percent ) {
var eased,
hooks = Tween.propHooks[ this.prop ];
if ( this.options.duration ) {
this.pos = eased = jQuery.easing[ this.easing ](
percent, this.options.duration * percent, 0, 1, this.options.duration
);
} else {
this.pos = eased = percent;
}
this.now = ( this.end - this.start ) * eased + this.start;
if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this );
}
if ( hooks && hooks.set ) {
hooks.set( this );
} else {
Tween.propHooks._default.set( this );
}
return this;
}
};
Tween.prototype.init.prototype = Tween.prototype;
Tween.propHooks = {
_default: {
get: function( tween ) {
var result;
if ( tween.elem[ tween.prop ] != null &&
(!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
return tween.elem[ tween.prop ];
}
// passing an empty string as a 3rd parameter to .css will automatically
// attempt a parseFloat and fallback to a string if the parse fails
// so, simple values such as "10px" are parsed to Float.
// complex values such as "rotate(1rad)" are returned as is.
result = jQuery.css( tween.elem, tween.prop, "" );
// Empty strings, null, undefined and "auto" are converted to 0.
return !result || result === "auto" ? 0 : result;
},
set: function( tween ) {
// use step hook for back compat - use cssHook if its there - use .style if its
// available and use plain properties where available
if ( jQuery.fx.step[ tween.prop ] ) {
jQuery.fx.step[ tween.prop ]( tween );
} else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
} else {
tween.elem[ tween.prop ] = tween.now;
}
}
}
};
// Support: IE <=9
// Panic based approach to setting things on disconnected nodes
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
set: function( tween ) {
if ( tween.elem.nodeType && tween.elem.parentNode ) {
tween.elem[ tween.prop ] = tween.now;
}
}
};
jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
var cssFn = jQuery.fn[ name ];
jQuery.fn[ name ] = function( speed, easing, callback ) {
return speed == null || typeof speed === "boolean" ?
cssFn.apply( this, arguments ) :
this.animate( genFx( name, true ), speed, easing, callback );
};
});
jQuery.fn.extend({
fadeTo: function( speed, to, easing, callback ) {
// show any hidden elements after setting opacity to 0
return this.filter( isHidden ).css( "opacity", 0 ).show()
// animate to the value specified
.end().animate({ opacity: to }, speed, easing, callback );
},
animate: function( prop, speed, easing, callback ) {
var empty = jQuery.isEmptyObject( prop ),
optall = jQuery.speed( speed, easing, callback ),
doAnimation = function() {
// Operate on a copy of prop so per-property easing won't be lost
var anim = Animation( this, jQuery.extend( {}, prop ), optall );
// Empty animations, or finishing resolves immediately
if ( empty || jQuery._data( this, "finish" ) ) {
anim.stop( true );
}
};
doAnimation.finish = doAnimation;
return empty || optall.queue === false ?
this.each( doAnimation ) :
this.queue( optall.queue, doAnimation );
},
stop: function( type, clearQueue, gotoEnd ) {
var stopQueue = function( hooks ) {
var stop = hooks.stop;
delete hooks.stop;
stop( gotoEnd );
};
if ( typeof type !== "string" ) {
gotoEnd = clearQueue;
clearQueue = type;
type = undefined;
}
if ( clearQueue && type !== false ) {
this.queue( type || "fx", [] );
}
return this.each(function() {
var dequeue = true,
index = type != null && type + "queueHooks",
timers = jQuery.timers,
data = jQuery._data( this );
if ( index ) {
if ( data[ index ] && data[ index ].stop ) {
stopQueue( data[ index ] );
}
} else {
for ( index in data ) {
if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
stopQueue( data[ index ] );
}
}
}
for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
timers[ index ].anim.stop( gotoEnd );
dequeue = false;
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 ( dequeue || !gotoEnd ) {
jQuery.dequeue( this, type );
}
});
},
finish: function( type ) {
if ( type !== false ) {
type = type || "fx";
}
return this.each(function() {
var index,
data = jQuery._data( this ),
queue = data[ type + "queue" ],
hooks = data[ type + "queueHooks" ],
timers = jQuery.timers,
length = queue ? queue.length : 0;
// enable finishing flag on private data
data.finish = true;
// empty the queue first
jQuery.queue( this, type, [] );
if ( hooks && hooks.stop ) {
hooks.stop.call( this, true );
}
// look for any active animations, and finish them
for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
timers[ index ].anim.stop( true );
timers.splice( index, 1 );
}
}
// look for any animations in the old queue and finish them
for ( index = 0; index < length; index++ ) {
if ( queue[ index ] && queue[ index ].finish ) {
queue[ index ].finish.call( this );
}
}
// turn off finishing flag
delete data.finish;
});
}
});
// Generate parameters to create a standard animation
function genFx( type, includeWidth ) {
var which,
attrs = { height: type },
i = 0;
// if we include width, step value is 1 to do all cssExpand values,
// if we don't include width, step value is 2 to skip over Left and Right
includeWidth = includeWidth? 1 : 0;
for( ; i < 4 ; i += 2 - includeWidth ) {
which = cssExpand[ i ];
attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
}
if ( includeWidth ) {
attrs.opacity = attrs.width = type;
}
return attrs;
}
// Generate shortcuts for custom animations
jQuery.each({
slideDown: genFx("show"),
slideUp: genFx("hide"),
slideToggle: genFx("toggle"),
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.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() {
if ( jQuery.isFunction( opt.old ) ) {
opt.old.call( this );
}
if ( opt.queue ) {
jQuery.dequeue( this, opt.queue );
}
};
return opt;
};
jQuery.easing = {
linear: function( p ) {
return p;
},
swing: function( p ) {
return 0.5 - Math.cos( p*Math.PI ) / 2;
}
};
jQuery.timers = [];
jQuery.fx = Tween.prototype.init;
jQuery.fx.tick = function() {
var timer,
timers = jQuery.timers,
i = 0;
fxNow = jQuery.now();
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();
}
fxNow = undefined;
};
jQuery.fx.timer = function( timer ) {
if ( timer() && jQuery.timers.push( timer ) ) {
jQuery.fx.start();
}
};
jQuery.fx.interval = 13;
jQuery.fx.start = function() {
if ( !timerId ) {
timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
}
};
jQuery.fx.stop = function() {
clearInterval( timerId );
timerId = null;
};
jQuery.fx.speeds = {
slow: 600,
fast: 200,
// Default speed
_default: 400
};
// Back Compat <1.8 extension point
jQuery.fx.step = {};
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.animated = function( elem ) {
return jQuery.grep(jQuery.timers, function( fn ) {
return elem === fn.elem;
}).length;
};
}
jQuery.fn.offset = function( options ) {
if ( arguments.length ) {
return options === undefined ?
this :
this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
var docElem, win,
box = { top: 0, left: 0 },
elem = this[ 0 ],
doc = elem && elem.ownerDocument;
if ( !doc ) {
return;
}
docElem = doc.documentElement;
// Make sure it's not a disconnected DOM node
if ( !jQuery.contains( docElem, elem ) ) {
return box;
}
// If we don't have gBCR, just use 0,0 rather than error
// BlackBerry 5, iOS 3 (original iPhone)
if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
box = elem.getBoundingClientRect();
}
win = getWindow( doc );
return {
top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
};
};
jQuery.offset = {
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;
}
var offsetParent, offset,
parentOffset = { top: 0, left: 0 },
elem = this[ 0 ];
// fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent
if ( jQuery.css( elem, "position" ) === "fixed" ) {
// we assume that getBoundingClientRect is available when computed position is fixed
offset = elem.getBoundingClientRect();
} else {
// Get *real* offsetParent
offsetParent = this.offsetParent();
// Get correct offsets
offset = this.offset();
if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
parentOffset = offsetParent.offset();
}
// Add offsetParent borders
parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
}
// Subtract parent offsets and 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
return {
top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
};
},
offsetParent: function() {
return this.map(function() {
var offsetParent = this.offsetParent || docElem;
while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent || docElem;
});
}
});
// Create scrollLeft and scrollTop methods
jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
var top = /Y/.test( prop );
jQuery.fn[ method ] = function( val ) {
return jQuery.access( this, function( elem, method, val ) {
var win = getWindow( elem );
if ( val === undefined ) {
return win ? (prop in win) ? win[ prop ] :
win.document.documentElement[ method ] :
elem[ method ];
}
if ( win ) {
win.scrollTo(
!top ? val : jQuery( win ).scrollLeft(),
top ? val : jQuery( win ).scrollTop()
);
} else {
elem[ method ] = val;
}
}, method, val, arguments.length, null );
};
});
function getWindow( elem ) {
return jQuery.isWindow( elem ) ?
elem :
elem.nodeType === 9 ?
elem.defaultView || elem.parentWindow :
false;
}
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
// margin is only for outerHeight, outerWidth
jQuery.fn[ funcName ] = function( margin, value ) {
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
return jQuery.access( this, function( elem, type, value ) {
var doc;
if ( jQuery.isWindow( elem ) ) {
// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
// isn't a whole lot we can do. See pull request at this URL for discussion:
// https://github.com/jquery/jquery/pull/764
return elem.document.documentElement[ "client" + name ];
}
// Get document width or height
if ( elem.nodeType === 9 ) {
doc = elem.documentElement;
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
// unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
return Math.max(
elem.body[ "scroll" + name ], doc[ "scroll" + name ],
elem.body[ "offset" + name ], doc[ "offset" + name ],
doc[ "client" + name ]
);
}
return value === undefined ?
// Get width or height on the element, requesting but not forcing parseFloat
jQuery.css( elem, type, extra ) :
// Set width or height on the element
jQuery.style( elem, type, value, extra );
}, type, chainable ? margin : undefined, chainable, null );
};
});
});
// Limit scope pollution from any deprecated API
// (function() {
// The number of elements contained in the matched element set
jQuery.fn.size = function() {
return this.length;
};
jQuery.fn.andSelf = jQuery.fn.addBack;
// })();
if ( typeof module === "object" && module && typeof module.exports === "object" ) {
// Expose jQuery as module.exports in loaders that implement the Node
// module pattern (including browserify). Do not create the global, since
// the user will be storing it themselves locally, and globals are frowned
// upon in the Node module world.
module.exports = jQuery;
} else {
// Otherwise expose jQuery to the global object as usual
window.jQuery = window.$ = jQuery;
// Register as a named AMD module, since jQuery can be concatenated with other
// files that may use define, but not via 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( "jquery", [], function () { return jQuery; } );
}
}
})( window );
|
ajax/libs/yui/3.7.0/scrollview-base/scrollview-base-coverage.js | nolsherry/cdnjs | if (typeof _yuitest_coverage == "undefined"){
_yuitest_coverage = {};
_yuitest_coverline = function(src, line){
var coverage = _yuitest_coverage[src];
if (!coverage.lines[line]){
coverage.calledLines++;
}
coverage.lines[line]++;
};
_yuitest_coverfunc = function(src, name, line){
var coverage = _yuitest_coverage[src],
funcId = name + ":" + line;
if (!coverage.functions[funcId]){
coverage.calledFunctions++;
}
coverage.functions[funcId]++;
};
}
_yuitest_coverage["build/scrollview-base/scrollview-base.js"] = {
lines: {},
functions: {},
coveredLines: 0,
calledLines: 0,
coveredFunctions: 0,
calledFunctions: 0,
path: "build/scrollview-base/scrollview-base.js",
code: []
};
_yuitest_coverage["build/scrollview-base/scrollview-base.js"].code=["YUI.add('scrollview-base', function (Y, NAME) {","","/**"," * The scrollview-base module provides a basic ScrollView Widget, without scrollbar indicators"," *"," * @module scrollview"," * @submodule scrollview-base"," */","var getClassName = Y.ClassNameManager.getClassName,"," DOCUMENT = Y.config.doc,"," WINDOW = Y.config.win,"," IE = Y.UA.ie,"," NATIVE_TRANSITIONS = Y.Transition.useNative,"," SCROLLVIEW = 'scrollview',"," CLASS_NAMES = {"," vertical: getClassName(SCROLLVIEW, 'vert'),"," horizontal: getClassName(SCROLLVIEW, 'horiz')"," },"," EV_SCROLL_END = 'scrollEnd',"," FLICK = 'flick',"," DRAG = 'drag',"," MOUSEWHEEL = 'mousewheel',"," UI = 'ui',"," TOP = 'top',"," RIGHT = 'right',"," BOTTOM = 'bottom',"," LEFT = 'left',"," PX = 'px',"," AXIS = 'axis',"," SCROLL_Y = 'scrollY',"," SCROLL_X = 'scrollX',"," BOUNCE = 'bounce',"," DISABLED = 'disabled',"," DECELERATION = 'deceleration',"," DIM_X = 'x',"," DIM_Y = 'y',"," BOUNDING_BOX = 'boundingBox',"," CONTENT_BOX = 'contentBox',"," GESTURE_MOVE = 'gesturemove',"," START = 'start',"," END = 'end',"," EMPTY = '',"," ZERO = '0s',"," SNAP_DURATION = 'snapDuration',"," SNAP_EASING = 'snapEasing', "," EASING = 'easing', "," FRAME_DURATION = 'frameDuration', "," BOUNCE_RANGE = 'bounceRange',"," "," _constrain = function (val, min, max) {"," return Math.min(Math.max(val, min), max);"," };","","/**"," * ScrollView provides a scrollable widget, supporting flick gestures,"," * across both touch and mouse based devices."," *"," * @class ScrollView"," * @param config {Object} Object literal with initial attribute values"," * @extends Widget"," * @constructor"," */","function ScrollView() {"," ScrollView.superclass.constructor.apply(this, arguments);","}","","Y.ScrollView = Y.extend(ScrollView, Y.Widget, {",""," // *** Y.ScrollView prototype",""," /**"," * Flag driving whether or not we should try and force H/W acceleration when transforming. Currently enabled by default for Webkit."," * Used by the _transform method."," *"," * @property _forceHWTransforms"," * @type boolean"," * @protected"," */"," _forceHWTransforms: Y.UA.webkit ? true : false,",""," /**"," * <p>Used to control whether or not ScrollView's internal"," * gesturemovestart, gesturemove and gesturemoveend"," * event listeners should preventDefault. The value is an"," * object, with \"start\", \"move\" and \"end\" properties used to"," * specify which events should preventDefault and which shouldn't:</p>"," *"," * <pre>"," * {"," * start: false,"," * move: true,"," * end: false"," * }"," * </pre>"," *"," * <p>The default values are set up in order to prevent panning,"," * on touch devices, while allowing click listeners on elements inside"," * the ScrollView to be notified as expected.</p>"," *"," * @property _prevent"," * @type Object"," * @protected"," */"," _prevent: {"," start: false,"," move: true,"," end: false"," },",""," /**"," * Contains the distance (postive or negative) in pixels by which "," * the scrollview was last scrolled. This is useful when setting up "," * click listeners on the scrollview content, which on mouse based "," * devices are always fired, even after a drag/flick. "," * "," * <p>Touch based devices don't currently fire a click event, "," * if the finger has been moved (beyond a threshold) so this "," * check isn't required, if working in a purely touch based environment</p>"," * "," * @property lastScrolledAmt"," * @type Number"," * @public"," * @default 0"," */"," lastScrolledAmt: 0,",""," /**"," * Designated initializer"," *"," * @method initializer"," * @param {config} Configuration object for the plugin"," */"," initializer: function (config) {"," var sv = this;",""," // Cache these values, since they aren't going to change."," sv._bb = sv.get(BOUNDING_BOX);"," sv._cb = sv.get(CONTENT_BOX);",""," // Cache some attributes"," sv._cAxis = sv.get(AXIS);"," sv._cBounce = sv.get(BOUNCE);"," sv._cBounceRange = sv.get(BOUNCE_RANGE);"," sv._cDeceleration = sv.get(DECELERATION);"," sv._cFrameDuration = sv.get(FRAME_DURATION);"," },",""," /**"," * bindUI implementation"," *"," * Hooks up events for the widget"," * @method bindUI"," */"," bindUI: function () {"," var sv = this;",""," // Bind interaction listers"," sv._bindFlick(sv.get(FLICK));"," sv._bindDrag(sv.get(DRAG));"," sv._bindMousewheel(true);"," "," // Bind change events"," sv._bindAttrs();",""," // IE SELECT HACK. See if we can do this non-natively and in the gesture for a future release."," if (IE) {"," sv._fixIESelect(sv._bb, sv._cb);"," }",""," // Set any deprecated static properties"," if (ScrollView.SNAP_DURATION) {"," sv.set(SNAP_DURATION, ScrollView.SNAP_DURATION);"," }",""," if (ScrollView.SNAP_EASING) {"," sv.set(SNAP_EASING, ScrollView.SNAP_EASING);"," }",""," if (ScrollView.EASING) {"," sv.set(EASING, ScrollView.EASING);"," }",""," if (ScrollView.FRAME_STEP) {"," sv.set(FRAME_DURATION, ScrollView.FRAME_STEP);"," }",""," if (ScrollView.BOUNCE_RANGE) {"," sv.set(BOUNCE_RANGE, ScrollView.BOUNCE_RANGE);"," }",""," // Recalculate dimension properties"," // TODO: This should be throttled."," // Y.one(WINDOW).after('resize', sv._afterDimChange, sv);"," },",""," /**"," * Bind event listeners"," *"," * @method _bindAttrs"," * @private"," */"," _bindAttrs: function () {"," var sv = this,"," scrollChangeHandler = sv._afterScrollChange,"," dimChangeHandler = sv._afterDimChange;",""," // Bind any change event listeners"," sv.after({"," 'scrollEnd': sv._afterScrollEnd,"," 'disabledChange': sv._afterDisabledChange,"," 'flickChange': sv._afterFlickChange,"," 'dragChange': sv._afterDragChange,"," 'axisChange': sv._afterAxisChange,"," 'scrollYChange': scrollChangeHandler,"," 'scrollXChange': scrollChangeHandler,"," 'heightChange': dimChangeHandler,"," 'widthChange': dimChangeHandler"," });"," },",""," /**"," * Bind (or unbind) gesture move listeners required for drag support"," *"," * @method _bindDrag"," * @param drag {boolean} If true, the method binds listener to enable drag (gesturemovestart). If false, the method unbinds gesturemove listeners for drag support."," * @private"," */"," _bindDrag: function (drag) {"," var sv = this,"," bb = sv._bb;",""," // Unbind any previous 'drag' listeners"," bb.detach(DRAG + '|*');",""," if (drag) {"," bb.on(DRAG + '|' + GESTURE_MOVE + START, Y.bind(sv._onGestureMoveStart, sv));"," }"," },",""," /**"," * Bind (or unbind) flick listeners."," *"," * @method _bindFlick"," * @param flick {Object|boolean} If truthy, the method binds listeners for flick support. If false, the method unbinds flick listeners."," * @private"," */"," _bindFlick: function (flick) {"," var sv = this,"," bb = sv._bb;",""," // Unbind any previous 'flick' listeners"," bb.detach(FLICK + '|*');",""," if (flick) {"," bb.on(FLICK + '|' + FLICK, Y.bind(sv._flick, sv), flick);",""," // Rebind Drag, becuase _onGestureMoveEnd always has to fire -after- _flick"," sv._bindDrag(sv.get(DRAG));"," }"," },",""," /**"," * Bind (or unbind) mousewheel listeners."," *"," * @method _bindMousewheel"," * @param mousewheel {Object|boolean} If truthy, the method binds listeners for mousewheel support. If false, the method unbinds mousewheel listeners."," * @private"," */"," _bindMousewheel: function (mousewheel) {"," var sv = this,"," bb = sv._bb;",""," // Unbind any previous 'mousewheel' listeners"," bb.detach(MOUSEWHEEL + '|*');",""," // Only enable for vertical scrollviews"," if (mousewheel) {"," // Bound to document, because that's where mousewheel events fire off of."," Y.one(DOCUMENT).on(MOUSEWHEEL, Y.bind(sv._mousewheel, sv));"," }"," },",""," /**"," * syncUI implementation."," *"," * Update the scroll position, based on the current value of scrollX/scrollY."," *"," * @method syncUI"," */"," syncUI: function () {"," var sv = this,"," scrollDims = sv._getScrollDims(),"," width = scrollDims.offsetWidth,"," height = scrollDims.offsetHeight,"," scrollWidth = scrollDims.scrollWidth,"," scrollHeight = scrollDims.scrollHeight;",""," // If the axis is undefined, auto-calculate it"," if (sv._cAxis === undefined) {"," // This should only ever be run once (for now)."," // In the future SV might post-load axis changes"," sv._cAxis = {"," x: (scrollWidth > width),"," y: (scrollHeight > height)"," };",""," sv._set(AXIS, sv._cAxis);"," }"," "," // get text direction on or inherited by scrollview node"," sv.rtl = (sv._cb.getComputedStyle('direction') === 'rtl');",""," // Cache the disabled value"," sv._cDisabled = sv.get(DISABLED);",""," // Run this to set initial values"," sv._uiDimensionsChange();",""," // If we're out-of-bounds, snap back."," if (sv._isOutOfBounds()) {"," sv._snapBack();"," }"," },",""," /**"," * Utility method to obtain widget dimensions"," * "," * @method _getScrollDims"," * @returns {Object} The offsetWidth, offsetHeight, scrollWidth and scrollHeight as an array: [offsetWidth, offsetHeight, scrollWidth, scrollHeight]"," * @private"," */"," _getScrollDims: function () {"," var sv = this,"," cb = sv._cb,"," bb = sv._bb,"," TRANS = ScrollView._TRANSITION,"," // Ideally using CSSMatrix - don't think we have it normalized yet though."," // origX = (new WebKitCSSMatrix(cb.getComputedStyle(\"transform\"))).e,"," // origY = (new WebKitCSSMatrix(cb.getComputedStyle(\"transform\"))).f,"," origX = sv.get(SCROLL_X),"," origY = sv.get(SCROLL_Y),"," origHWTransform,"," dims;",""," // TODO: Is this OK? Just in case it's called 'during' a transition."," if (NATIVE_TRANSITIONS) {"," cb.setStyle(TRANS.DURATION, ZERO);"," cb.setStyle(TRANS.PROPERTY, EMPTY);"," }",""," origHWTransform = sv._forceHWTransforms;"," sv._forceHWTransforms = false; // the z translation was causing issues with picking up accurate scrollWidths in Chrome/Mac.",""," sv._moveTo(cb, 0, 0);"," dims = {"," 'offsetWidth': bb.get('offsetWidth'),"," 'offsetHeight': bb.get('offsetHeight'),"," 'scrollWidth': bb.get('scrollWidth'),"," 'scrollHeight': bb.get('scrollHeight')"," };"," sv._moveTo(cb, -(origX), -(origY));",""," sv._forceHWTransforms = origHWTransform;",""," return dims;"," },",""," /**"," * This method gets invoked whenever the height or width attributes change,"," * allowing us to determine which scrolling axes need to be enabled."," *"," * @method _uiDimensionsChange"," * @protected"," */"," _uiDimensionsChange: function () {"," var sv = this,"," bb = sv._bb,"," scrollDims = sv._getScrollDims(),"," width = scrollDims.offsetWidth,"," height = scrollDims.offsetHeight,"," scrollWidth = scrollDims.scrollWidth,"," scrollHeight = scrollDims.scrollHeight,"," rtl = sv.rtl,"," svAxis = sv._cAxis;"," "," if (svAxis && svAxis.x) {"," bb.addClass(CLASS_NAMES.horizontal);"," }",""," if (svAxis && svAxis.y) {"," bb.addClass(CLASS_NAMES.vertical);"," }",""," /**"," * Internal state, defines the minimum amount that the scrollview can be scrolled along the X axis"," *"," * @property _minScrollX"," * @type number"," * @protected"," */"," sv._minScrollX = (rtl) ? Math.min(0, -(scrollWidth - width)) : 0;",""," /**"," * Internal state, defines the maximum amount that the scrollview can be scrolled along the X axis"," *"," * @property _maxScrollX"," * @type number"," * @protected"," */"," sv._maxScrollX = (rtl) ? 0 : Math.max(0, scrollWidth - width);",""," /**"," * Internal state, defines the minimum amount that the scrollview can be scrolled along the Y axis"," *"," * @property _minScrollY"," * @type number"," * @protected"," */"," sv._minScrollY = 0;",""," /**"," * Internal state, defines the maximum amount that the scrollview can be scrolled along the Y axis"," *"," * @property _maxScrollY"," * @type number"," * @protected"," */"," sv._maxScrollY = Math.max(0, scrollHeight - height);"," },",""," /**"," * Scroll the element to a given xy coordinate"," *"," * @method scrollTo"," * @param x {Number} The x-position to scroll to. (null for no movement)"," * @param y {Number} The y-position to scroll to. (null for no movement)"," * @param {Number} [duration] ms of the scroll animation. (default is 0)"," * @param {String} [easing] An easing equation if duration is set. (default is `easing` attribute)"," * @param {String} [node] The node to transform. Setting this can be useful in dual-axis paginated instances. (default is the instance's contentBox)"," */"," scrollTo: function (x, y, duration, easing, node) {"," // Check to see if widget is disabled"," if (this._cDisabled) {"," return;"," }",""," var sv = this,"," cb = sv._cb,"," TRANS = ScrollView._TRANSITION,"," callback = Y.bind(sv._onTransEnd, sv), // @Todo : cache this"," newX = 0,"," newY = 0,"," transition = {},"," transform;",""," // default the optional arguments"," duration = duration || 0;"," easing = easing || sv.get(EASING); // @TODO: Cache this"," node = node || cb;",""," if (x !== null) {"," sv.set(SCROLL_X, x, {src:UI});"," newX = -(x);"," }",""," if (y !== null) {"," sv.set(SCROLL_Y, y, {src:UI});"," newY = -(y);"," }",""," transform = sv._transform(newX, newY);",""," if (NATIVE_TRANSITIONS) {"," // ANDROID WORKAROUND - try and stop existing transition, before kicking off new one."," node.setStyle(TRANS.DURATION, ZERO).setStyle(TRANS.PROPERTY, EMPTY);"," }",""," // Move"," if (duration === 0) {"," if (NATIVE_TRANSITIONS) {"," node.setStyle('transform', transform);"," }"," else {"," // TODO: If both set, batch them in the same update"," // Update: Nope, setStyles() just loops through each property and applies it."," if (x !== null) {"," node.setStyle(LEFT, newX + PX);"," }"," if (y !== null) {"," node.setStyle(TOP, newY + PX);"," }"," }"," }",""," // Animate"," else {"," transition.easing = easing;"," transition.duration = duration / 1000;",""," if (NATIVE_TRANSITIONS) {"," transition.transform = transform;"," }"," else {"," transition.left = newX + PX;"," transition.top = newY + PX;"," }",""," node.transition(transition, callback);"," }"," },",""," /**"," * Utility method, to create the translate transform string with the"," * x, y translation amounts provided."," *"," * @method _transform"," * @param {Number} x Number of pixels to translate along the x axis"," * @param {Number} y Number of pixels to translate along the y axis"," * @private"," */"," _transform: function (x, y) {"," // TODO: Would we be better off using a Matrix for this?"," var prop = 'translate(' + x + 'px, ' + y + 'px)';",""," if (this._forceHWTransforms) {"," prop += ' translateZ(0)';"," }",""," return prop;"," },",""," /**"," * Utility method, to move the given element to the given xy position"," *"," * @method _moveTo"," * @param node {Node} The node to move"," * @param x {Number} The x-position to move to"," * @param y {Number} The y-position to move to"," * @private"," */"," _moveTo : function(node, x, y) {"," if (NATIVE_TRANSITIONS) {"," node.setStyle('transform', this._transform(x, y));"," } else {"," node.setStyle(LEFT, x + PX);"," node.setStyle(TOP, y + PX);"," }"," },","",""," /**"," * Content box transition callback"," *"," * @method _onTransEnd"," * @param {Event.Facade} e The event facade"," * @private"," */"," _onTransEnd: function (e) {"," var sv = this;",""," /**"," * Notification event fired at the end of a scroll transition"," *"," * @event scrollEnd"," * @param e {EventFacade} The default event facade."," */"," sv.fire(EV_SCROLL_END);"," },",""," /**"," * gesturemovestart event handler"," *"," * @method _onGestureMoveStart"," * @param e {Event.Facade} The gesturemovestart event facade"," * @private"," */"," _onGestureMoveStart: function (e) {",""," if (this._cDisabled) {"," return false;"," }",""," var sv = this,"," bb = sv._bb,"," currentX = sv.get(SCROLL_X),"," currentY = sv.get(SCROLL_Y),"," clientX = e.clientX,"," clientY = e.clientY;",""," if (sv._prevent.start) {"," e.preventDefault();"," }",""," // if a flick animation is in progress, cancel it"," if (sv._flickAnim) {"," // Cancel and delete sv._flickAnim"," sv._flickAnim.cancel();"," delete sv._flickAnim;"," sv._onTransEnd();"," }",""," // TODO: Review if neccesary (#2530129)"," e.stopPropagation();",""," // Reset lastScrolledAmt"," sv.lastScrolledAmt = 0;",""," // Stores data for this gesture cycle. Cleaned up later"," sv._gesture = {",""," // Will hold the axis value"," axis: null,",""," // The current attribute values"," startX: currentX,"," startY: currentY,",""," // The X/Y coordinates where the event began"," startClientX: clientX,"," startClientY: clientY,",""," // The X/Y coordinates where the event will end"," endClientX: null,"," endClientY: null,",""," // The current delta of the event"," deltaX: null,"," deltaY: null,",""," // Will be populated for flicks"," flick: null,",""," // Create some listeners for the rest of the gesture cycle"," onGestureMove: bb.on(DRAG + '|' + GESTURE_MOVE, Y.bind(sv._onGestureMove, sv)),"," "," // @TODO: Don't bind gestureMoveEnd if it's a Flick?"," onGestureMoveEnd: bb.on(DRAG + '|' + GESTURE_MOVE + END, Y.bind(sv._onGestureMoveEnd, sv))"," };"," },",""," /**"," * gesturemove event handler"," *"," * @method _onGestureMove"," * @param e {Event.Facade} The gesturemove event facade"," * @private"," */"," _onGestureMove: function (e) {"," var sv = this,"," gesture = sv._gesture,"," svAxis = sv._cAxis,"," svAxisX = svAxis.x,"," svAxisY = svAxis.y,"," startX = gesture.startX,"," startY = gesture.startY,"," startClientX = gesture.startClientX,"," startClientY = gesture.startClientY,"," clientX = e.clientX,"," clientY = e.clientY;",""," if (sv._prevent.move) {"," e.preventDefault();"," }",""," gesture.deltaX = startClientX - clientX;"," gesture.deltaY = startClientY - clientY;",""," // Determine if this is a vertical or horizontal movement"," // @TODO: This is crude, but it works. Investigate more intelligent ways to detect intent"," if (gesture.axis === null) {"," gesture.axis = (Math.abs(gesture.deltaX) > Math.abs(gesture.deltaY)) ? DIM_X : DIM_Y;"," }",""," // Move X or Y. @TODO: Move both if dualaxis. "," if (gesture.axis === DIM_X && svAxisX) {"," sv.set(SCROLL_X, startX + gesture.deltaX);"," }"," else if (gesture.axis === DIM_Y && svAxisY) {"," sv.set(SCROLL_Y, startY + gesture.deltaY);"," }"," },",""," /**"," * gesturemoveend event handler"," *"," * @method _onGestureMoveEnd"," * @param e {Event.Facade} The gesturemoveend event facade"," * @private"," */"," _onGestureMoveEnd: function (e) {"," var sv = this,"," gesture = sv._gesture,"," flick = gesture.flick,"," clientX = e.clientX,"," clientY = e.clientY;",""," if (sv._prevent.end) {"," e.preventDefault();"," }",""," // Store the end X/Y coordinates"," gesture.endClientX = clientX;"," gesture.endClientY = clientY;",""," // Cleanup the event handlers"," gesture.onGestureMove.detach();"," gesture.onGestureMoveEnd.detach();",""," // If this wasn't a flick, wrap up the gesture cycle"," if (!flick) {"," // @TODO: Be more intelligent about this. Look at the Flick attribute to see "," // if it is safe to assume _flick did or didn't fire. "," // Then, the order _flick and _onGestureMoveEnd fire doesn't matter?",""," // If there was movement (_onGestureMove fired)"," if (gesture.deltaX !== null && gesture.deltaY !== null) {",""," // If we're out-out-bounds, then snapback"," if (sv._isOutOfBounds()) {"," sv._snapBack();"," }",""," // Inbounds"," else {"," // Don't fire scrollEnd on the gesture axis is the same as paginator's"," // Not totally confident this is ideal to access a plugin's properties from a host, @TODO revisit"," if (sv.pages && !sv.pages.get(AXIS)[gesture.axis]) {"," sv._onTransEnd();"," }"," }"," }"," }"," },",""," /**"," * Execute a flick at the end of a scroll action"," *"," * @method _flick"," * @param e {Event.Facade} The Flick event facade"," * @private"," */"," _flick: function (e) {"," if (this._cDisabled) {"," return false;"," }",""," var sv = this,"," svAxis = sv._cAxis,"," flick = e.flick,"," flickAxis = flick.axis,"," flickVelocity = flick.velocity,"," axisAttr = flickAxis === DIM_X ? SCROLL_X : SCROLL_Y,"," startPosition = sv.get(axisAttr);",""," // Sometimes flick is enabled, but drag is disabled"," if (sv._gesture) {"," sv._gesture.flick = flick;"," }",""," // Prevent unneccesary firing of _flickFrame if we can't scroll on the flick axis"," if (svAxis[flickAxis]) {"," sv._flickFrame(flickVelocity, flickAxis, startPosition);"," }"," },",""," /**"," * Execute a single frame in the flick animation"," *"," * @method _flickFrame"," * @param velocity {Number} The velocity of this animated frame"," * @param flickAxis {String} The axis on which to animate"," * @param startPosition {Number} The starting X/Y point to flick from"," * @protected"," */"," _flickFrame: function (velocity, flickAxis, startPosition) {",""," var sv = this,"," axisAttr = flickAxis === DIM_X ? SCROLL_X : SCROLL_Y,",""," // Localize cached values"," bounce = sv._cBounce,"," bounceRange = sv._cBounceRange,"," deceleration = sv._cDeceleration,"," frameDuration = sv._cFrameDuration,",""," // Calculate"," newVelocity = velocity * deceleration,"," newPosition = startPosition - (frameDuration * newVelocity),",""," // Some convinience conditions"," min = flickAxis === DIM_X ? sv._minScrollX : sv._minScrollY,"," max = flickAxis === DIM_X ? sv._maxScrollX : sv._maxScrollY,"," belowMin = (newPosition < min),"," belowMax = (newPosition < max),"," aboveMin = (newPosition > min),"," aboveMax = (newPosition > max),"," belowMinRange = (newPosition < (min - bounceRange)),"," belowMaxRange = (newPosition < (max + bounceRange)),"," withinMinRange = (belowMin && (newPosition > (min - bounceRange))),"," withinMaxRange = (aboveMax && (newPosition < (max + bounceRange))),"," aboveMinRange = (newPosition > (min - bounceRange)),"," aboveMaxRange = (newPosition > (max + bounceRange)),"," tooSlow;",""," // If we're within the range but outside min/max, dampen the velocity"," if (withinMinRange || withinMaxRange) {"," newVelocity *= bounce;"," }",""," // Is the velocity too slow to bother?"," tooSlow = (Math.abs(newVelocity).toFixed(4) < 0.015);",""," // If the velocity is too slow or we're outside the range"," if (tooSlow || belowMinRange || aboveMaxRange) {"," // Cancel and delete sv._flickAnim"," if (sv._flickAnim) {"," sv._flickAnim.cancel();"," delete sv._flickAnim;"," }",""," // If we're inside the scroll area, just end"," if (aboveMin && belowMax) {"," sv._onTransEnd();"," }",""," // We're outside the scroll area, so we need to snap back"," else {"," sv._snapBack();"," }"," }",""," // Otherwise, animate to the next frame"," else {"," // @TODO: maybe use requestAnimationFrame instead"," sv._flickAnim = Y.later(frameDuration, sv, '_flickFrame', [newVelocity, flickAxis, newPosition]);"," sv.set(axisAttr, newPosition);"," }"," },",""," /**"," * Handle mousewheel events on the widget"," *"," * @method _mousewheel"," * @param e {Event.Facade} The mousewheel event facade"," * @private"," */"," _mousewheel: function (e) {"," var sv = this,"," scrollY = sv.get(SCROLL_Y),"," bb = sv._bb,"," scrollOffset = 10, // 10px"," isForward = (e.wheelDelta > 0),"," scrollToY = scrollY - ((isForward ? 1 : -1) * scrollOffset);",""," scrollToY = _constrain(scrollToY, sv._minScrollY, sv._maxScrollY);",""," // Because Mousewheel events fire off 'document', every ScrollView widget will react"," // to any mousewheel anywhere on the page. This check will ensure that the mouse is currently"," // over this specific ScrollView. Also, only allow mousewheel scrolling on Y-axis, "," // becuase otherwise the 'prevent' will block page scrolling."," if (bb.contains(e.target) && sv._cAxis[DIM_Y]) {",""," // Reset lastScrolledAmt"," sv.lastScrolledAmt = 0;",""," // Jump to the new offset"," sv.set(SCROLL_Y, scrollToY);",""," // if we have scrollbars plugin, update & set the flash timer on the scrollbar"," // @TODO: This probably shouldn't be in this module"," if (sv.scrollbars) {"," // @TODO: The scrollbars should handle this themselves"," sv.scrollbars._update();"," sv.scrollbars.flash();"," // or just this"," // sv.scrollbars._hostDimensionsChange();"," }",""," // Fire the 'scrollEnd' event"," sv._onTransEnd();",""," // prevent browser default behavior on mouse scroll"," e.preventDefault();"," }"," },",""," /**"," * Checks to see the current scrollX/scrollY position beyond the min/max boundary"," *"," * @method _isOutOfBounds"," * @param x {Number} [optional] The X position to check"," * @param y {Number} [optional] The Y position to check"," * @returns {boolen} Whether the current X/Y position is out of bounds (true) or not (false)"," * @private"," */"," _isOutOfBounds: function (x, y) {"," var sv = this,"," svAxis = sv._cAxis,"," svAxisX = svAxis.x,"," svAxisY = svAxis.y,"," currentX = x || sv.get(SCROLL_X),"," currentY = y || sv.get(SCROLL_Y),"," minX = sv._minScrollX,"," minY = sv._minScrollY,"," maxX = sv._maxScrollX,"," maxY = sv._maxScrollY;",""," return (svAxisX && (currentX < minX || currentX > maxX)) || (svAxisY && (currentY < minY || currentY > maxY));"," },",""," /**"," * Bounces back"," * @TODO: Should be more generalized and support both X and Y detection"," *"," * @method _snapBack"," * @private"," */"," _snapBack: function () {"," var sv = this,"," currentX = sv.get(SCROLL_X),"," currentY = sv.get(SCROLL_Y),"," minX = sv._minScrollX,"," minY = sv._minScrollY,"," maxX = sv._maxScrollX,"," maxY = sv._maxScrollY,"," newY = _constrain(currentY, minY, maxY),"," newX = _constrain(currentX, minX, maxX),"," duration = sv.get(SNAP_DURATION),"," easing = sv.get(SNAP_EASING);",""," if (newX !== currentX) {"," sv.set(SCROLL_X, newX, {duration:duration, easing:easing});"," }"," else if (newY !== currentY) {"," sv.set(SCROLL_Y, newY, {duration:duration, easing:easing});"," }"," else {"," // It shouldn't ever get here, but in case it does, fire scrollEnd"," sv._onTransEnd();"," }"," },",""," /**"," * After listener for changes to the scrollX or scrollY attribute"," *"," * @method _afterScrollChange"," * @param e {Event.Facade} The event facade"," * @protected"," */"," _afterScrollChange: function (e) {",""," if (e.src === ScrollView.UI_SRC) {"," return false;"," }",""," var sv = this,"," duration = e.duration,"," easing = e.easing,"," val = e.newVal,"," scrollToArgs = [];",""," // Set the scrolled value"," sv.lastScrolledAmt = sv.lastScrolledAmt + (e.newVal - e.prevVal);",""," // Generate the array of args to pass to scrollTo()"," if (e.attrName === SCROLL_X) {"," scrollToArgs.push(val);"," scrollToArgs.push(sv.get(SCROLL_Y));"," }"," else {"," scrollToArgs.push(sv.get(SCROLL_X));"," scrollToArgs.push(val);"," }",""," scrollToArgs.push(duration);"," scrollToArgs.push(easing);",""," sv.scrollTo.apply(sv, scrollToArgs);"," },",""," /**"," * After listener for changes to the flick attribute"," *"," * @method _afterFlickChange"," * @param e {Event.Facade} The event facade"," * @protected"," */"," _afterFlickChange: function (e) {"," this._bindFlick(e.newVal);"," },",""," /**"," * After listener for changes to the disabled attribute"," *"," * @method _afterDisabledChange"," * @param e {Event.Facade} The event facade"," * @protected"," */"," _afterDisabledChange: function (e) {"," // Cache for performance - we check during move"," this._cDisabled = e.newVal;"," },",""," /**"," * After listener for the axis attribute"," *"," * @method _afterAxisChange"," * @param e {Event.Facade} The event facade"," * @protected"," */"," _afterAxisChange: function (e) {"," this._cAxis = e.newVal;"," },",""," /**"," * After listener for changes to the drag attribute"," *"," * @method _afterDragChange"," * @param e {Event.Facade} The event facade"," * @protected"," */"," _afterDragChange: function (e) {"," this._bindDrag(e.newVal);"," },",""," /**"," * After listener for the height or width attribute"," *"," * @method _afterDimChange"," * @param e {Event.Facade} The event facade"," * @protected"," */"," _afterDimChange: function () {"," this._uiDimensionsChange();"," },",""," /**"," * After listener for scrollEnd, for cleanup"," *"," * @method _afterScrollEnd"," * @param e {Event.Facade} The event facade"," * @protected"," */"," _afterScrollEnd: function (e) {"," var sv = this;",""," // @TODO: Move to sv._cancelFlick()"," if (sv._flickAnim) {"," // Cancel the flick (if it exists)"," sv._flickAnim.cancel();",""," // Also delete it, otherwise _onGestureMoveStart will think we're still flicking"," delete sv._flickAnim;"," }",""," // If for some reason we're OOB, snapback"," if (sv._isOutOfBounds()) {"," sv._snapBack();"," }",""," // Ideally this should be removed, but doing so causing some JS errors with fast swiping "," // because _gesture is being deleted after the previous one has been overwritten"," // delete sv._gesture; // TODO: Move to sv.prevGesture?"," },",""," /**"," * Setter for 'axis' attribute"," *"," * @method _axisSetter"," * @param val {Mixed} A string ('x', 'y', 'xy') to specify which axis/axes to allow scrolling on"," * @param name {String} The attribute name"," * @return {Object} An object to specify scrollability on the x & y axes"," * "," * @protected"," */"," _axisSetter: function (val, name) {",""," // Turn a string into an axis object"," if (Y.Lang.isString(val)) {"," return {"," x: val.match(/x/i) ? true : false,"," y: val.match(/y/i) ? true : false"," };"," }"," },"," "," /**"," * The scrollX, scrollY setter implementation"," *"," * @method _setScroll"," * @private"," * @param {Number} val"," * @param {String} dim"," *"," * @return {Number} The value"," */"," _setScroll : function(val, dim) {",""," // Just ensure the widget is not disabled"," if (this._cDisabled) {"," val = Y.Attribute.INVALID_VALUE;"," } ",""," return val;"," },",""," /**"," * Setter for the scrollX attribute"," *"," * @method _setScrollX"," * @param val {Number} The new scrollX value"," * @return {Number} The normalized value"," * @protected"," */"," _setScrollX: function(val) {"," return this._setScroll(val, DIM_X);"," },",""," /**"," * Setter for the scrollY ATTR"," *"," * @method _setScrollY"," * @param val {Number} The new scrollY value"," * @return {Number} The normalized value"," * @protected"," */"," _setScrollY: function(val) {"," return this._setScroll(val, DIM_Y);"," }",""," // End prototype properties","","}, {",""," // Static properties",""," /**"," * The identity of the widget."," *"," * @property NAME"," * @type String"," * @default 'scrollview'"," * @readOnly"," * @protected"," * @static"," */"," NAME: 'scrollview',",""," /**"," * Static property used to define the default attribute configuration of"," * the Widget."," *"," * @property ATTRS"," * @type {Object}"," * @protected"," * @static"," */"," ATTRS: {",""," /**"," * Specifies ability to scroll on x, y, or x and y axis/axes."," *"," * @attribute axis"," * @type String"," */"," axis: {"," setter: '_axisSetter',"," writeOnce: 'initOnly'"," },",""," /**"," * The current scroll position in the x-axis"," *"," * @attribute scrollX"," * @type Number"," * @default 0"," */"," scrollX: {"," value: 0,"," setter: '_setScrollX'"," },",""," /**"," * The current scroll position in the y-axis"," *"," * @attribute scrollY"," * @type Number"," * @default 0"," */"," scrollY: {"," value: 0,"," setter: '_setScrollY'"," },",""," /**"," * Drag coefficent for inertial scrolling. The closer to 1 this"," * value is, the less friction during scrolling."," *"," * @attribute deceleration"," * @default 0.93"," */"," deceleration: {"," value: 0.93"," },",""," /**"," * Drag coefficient for intertial scrolling at the upper"," * and lower boundaries of the scrollview. Set to 0 to"," * disable \"rubber-banding\"."," *"," * @attribute bounce"," * @type Number"," * @default 0.1"," */"," bounce: {"," value: 0.1"," },",""," /**"," * The minimum distance and/or velocity which define a flick. Can be set to false,"," * to disable flick support (note: drag support is enabled/disabled separately)"," *"," * @attribute flick"," * @type Object"," * @default Object with properties minDistance = 10, minVelocity = 0.3."," */"," flick: {"," value: {"," minDistance: 10,"," minVelocity: 0.3"," }"," },",""," /**"," * Enable/Disable dragging the ScrollView content (note: flick support is enabled/disabled separately)"," * @attribute drag"," * @type boolean"," * @default true"," */"," drag: {"," value: true"," },",""," /**"," * The default duration to use when animating the bounce snap back."," *"," * @attribute snapDuration"," * @type Number"," * @default 400"," */"," snapDuration: {"," value: 400"," },",""," /**"," * The default easing to use when animating the bounce snap back."," *"," * @attribute snapEasing"," * @type String"," * @default 'ease-out'"," */"," snapEasing: {"," value: 'ease-out'"," },",""," /**"," * The default easing used when animating the flick"," *"," * @attribute easing"," * @type String"," * @default 'cubic-bezier(0, 0.1, 0, 1.0)'"," */"," easing: {"," value: 'cubic-bezier(0, 0.1, 0, 1.0)'"," },",""," /**"," * The interval (ms) used when animating the flick for JS-timer animations"," *"," * @attribute frameDuration"," * @type Number"," * @default 15"," */"," frameDuration: {"," value: 15"," },",""," /**"," * The default bounce distance in pixels"," *"," * @attribute bounceRange"," * @type Number"," * @default 150"," */"," bounceRange: {"," value: 150"," }"," },",""," /**"," * List of class names used in the scrollview's DOM"," *"," * @property CLASS_NAMES"," * @type Object"," * @static"," */"," CLASS_NAMES: CLASS_NAMES,",""," /**"," * Flag used to source property changes initiated from the DOM"," *"," * @property UI_SRC"," * @type String"," * @static"," * @default 'ui'"," */"," UI_SRC: UI,",""," /**"," * Object map of style property names used to set transition properties."," * Defaults to the vendor prefix established by the Transition module."," * The configured property names are `_TRANSITION.DURATION` (e.g. \"WebkitTransitionDuration\") and"," * `_TRANSITION.PROPERTY (e.g. \"WebkitTransitionProperty\")."," *"," * @property _TRANSITION"," * @private"," */"," _TRANSITION: {"," DURATION: Y.Transition._VENDOR_PREFIX + 'TransitionDuration',"," PROPERTY: Y.Transition._VENDOR_PREFIX + 'TransitionProperty'"," },",""," /**"," * The default bounce distance in pixels"," *"," * @property BOUNCE_RANGE"," * @type Number"," * @static"," * @default false"," * @deprecated (in 3.7.0)"," */"," BOUNCE_RANGE: false,",""," /**"," * The interval (ms) used when animating the flick"," *"," * @property FRAME_STEP"," * @type Number"," * @static"," * @default false"," * @deprecated (in 3.7.0)"," */"," FRAME_STEP: false,",""," /**"," * The default easing used when animating the flick"," *"," * @property EASING"," * @type String"," * @static"," * @default false"," * @deprecated (in 3.7.0)"," */"," EASING: false,",""," /**"," * The default easing to use when animating the bounce snap back."," *"," * @property SNAP_EASING"," * @type String"," * @static"," * @default false"," * @deprecated (in 3.7.0)"," */"," SNAP_EASING: false,",""," /**"," * The default duration to use when animating the bounce snap back."," *"," * @property SNAP_DURATION"," * @type Number"," * @static"," * @default false"," * @deprecated (in 3.7.0)"," */"," SNAP_DURATION: false",""," // End static properties","","});","","}, '@VERSION@', {\"requires\": [\"widget\", \"event-gestures\", \"event-mousewheel\", \"transition\"], \"skinnable\": true});"];
_yuitest_coverage["build/scrollview-base/scrollview-base.js"].lines = {"1":0,"9":0,"51":0,"63":0,"64":0,"67":0,"134":0,"137":0,"138":0,"141":0,"142":0,"143":0,"144":0,"145":0,"155":0,"158":0,"159":0,"160":0,"163":0,"166":0,"167":0,"171":0,"172":0,"175":0,"176":0,"179":0,"180":0,"183":0,"184":0,"187":0,"188":0,"203":0,"208":0,"229":0,"233":0,"235":0,"236":0,"248":0,"252":0,"254":0,"255":0,"258":0,"270":0,"274":0,"277":0,"279":0,"291":0,"299":0,"302":0,"307":0,"311":0,"314":0,"317":0,"320":0,"321":0,"333":0,"346":0,"347":0,"348":0,"351":0,"352":0,"354":0,"355":0,"361":0,"363":0,"365":0,"376":0,"386":0,"387":0,"390":0,"391":0,"401":0,"410":0,"419":0,"428":0,"443":0,"444":0,"447":0,"457":0,"458":0,"459":0,"461":0,"462":0,"463":0,"466":0,"467":0,"468":0,"471":0,"473":0,"475":0,"479":0,"480":0,"481":0,"486":0,"487":0,"489":0,"490":0,"497":0,"498":0,"500":0,"501":0,"504":0,"505":0,"508":0,"523":0,"525":0,"526":0,"529":0,"542":0,"543":0,"545":0,"546":0,"559":0,"567":0,"579":0,"580":0,"583":0,"590":0,"591":0,"595":0,"597":0,"598":0,"599":0,"603":0,"606":0,"609":0,"649":0,"661":0,"662":0,"665":0,"666":0,"670":0,"671":0,"675":0,"676":0,"678":0,"679":0,"691":0,"697":0,"698":0,"702":0,"703":0,"706":0,"707":0,"710":0,"716":0,"719":0,"720":0,"727":0,"728":0,"743":0,"744":0,"747":0,"756":0,"757":0,"761":0,"762":0,"777":0,"806":0,"807":0,"811":0,"814":0,"816":0,"817":0,"818":0,"822":0,"823":0,"828":0,"835":0,"836":0,"848":0,"855":0,"861":0,"864":0,"867":0,"871":0,"873":0,"874":0,"880":0,"883":0,"897":0,"908":0,"919":0,"931":0,"932":0,"934":0,"935":0,"939":0,"952":0,"953":0,"956":0,"963":0,"966":0,"967":0,"968":0,"971":0,"972":0,"975":0,"976":0,"978":0,"989":0,"1001":0,"1012":0,"1023":0,"1034":0,"1045":0,"1048":0,"1050":0,"1053":0,"1057":0,"1058":0,"1079":0,"1080":0,"1100":0,"1101":0,"1104":0,"1116":0,"1128":0};
_yuitest_coverage["build/scrollview-base/scrollview-base.js"].functions = {"_constrain:50":0,"ScrollView:63":0,"initializer:133":0,"bindUI:154":0,"_bindAttrs:202":0,"_bindDrag:228":0,"_bindFlick:247":0,"_bindMousewheel:269":0,"syncUI:290":0,"_getScrollDims:332":0,"_uiDimensionsChange:375":0,"scrollTo:441":0,"_transform:521":0,"_moveTo:541":0,"_onTransEnd:558":0,"_onGestureMoveStart:577":0,"_onGestureMove:648":0,"_onGestureMoveEnd:690":0,"_flick:742":0,"_flickFrame:775":0,"_mousewheel:847":0,"_isOutOfBounds:896":0,"_snapBack:918":0,"_afterScrollChange:950":0,"_afterFlickChange:988":0,"_afterDisabledChange:999":0,"_afterAxisChange:1011":0,"_afterDragChange:1022":0,"_afterDimChange:1033":0,"_afterScrollEnd:1044":0,"_axisSetter:1076":0,"_setScroll:1097":0,"_setScrollX:1115":0,"_setScrollY:1127":0,"(anonymous 1):1":0};
_yuitest_coverage["build/scrollview-base/scrollview-base.js"].coveredLines = 218;
_yuitest_coverage["build/scrollview-base/scrollview-base.js"].coveredFunctions = 35;
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 1);
YUI.add('scrollview-base', function (Y, NAME) {
/**
* The scrollview-base module provides a basic ScrollView Widget, without scrollbar indicators
*
* @module scrollview
* @submodule scrollview-base
*/
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "(anonymous 1)", 1);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 9);
var getClassName = Y.ClassNameManager.getClassName,
DOCUMENT = Y.config.doc,
WINDOW = Y.config.win,
IE = Y.UA.ie,
NATIVE_TRANSITIONS = Y.Transition.useNative,
SCROLLVIEW = 'scrollview',
CLASS_NAMES = {
vertical: getClassName(SCROLLVIEW, 'vert'),
horizontal: getClassName(SCROLLVIEW, 'horiz')
},
EV_SCROLL_END = 'scrollEnd',
FLICK = 'flick',
DRAG = 'drag',
MOUSEWHEEL = 'mousewheel',
UI = 'ui',
TOP = 'top',
RIGHT = 'right',
BOTTOM = 'bottom',
LEFT = 'left',
PX = 'px',
AXIS = 'axis',
SCROLL_Y = 'scrollY',
SCROLL_X = 'scrollX',
BOUNCE = 'bounce',
DISABLED = 'disabled',
DECELERATION = 'deceleration',
DIM_X = 'x',
DIM_Y = 'y',
BOUNDING_BOX = 'boundingBox',
CONTENT_BOX = 'contentBox',
GESTURE_MOVE = 'gesturemove',
START = 'start',
END = 'end',
EMPTY = '',
ZERO = '0s',
SNAP_DURATION = 'snapDuration',
SNAP_EASING = 'snapEasing',
EASING = 'easing',
FRAME_DURATION = 'frameDuration',
BOUNCE_RANGE = 'bounceRange',
_constrain = function (val, min, max) {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_constrain", 50);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 51);
return Math.min(Math.max(val, min), max);
};
/**
* ScrollView provides a scrollable widget, supporting flick gestures,
* across both touch and mouse based devices.
*
* @class ScrollView
* @param config {Object} Object literal with initial attribute values
* @extends Widget
* @constructor
*/
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 63);
function ScrollView() {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "ScrollView", 63);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 64);
ScrollView.superclass.constructor.apply(this, arguments);
}
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 67);
Y.ScrollView = Y.extend(ScrollView, Y.Widget, {
// *** Y.ScrollView prototype
/**
* Flag driving whether or not we should try and force H/W acceleration when transforming. Currently enabled by default for Webkit.
* Used by the _transform method.
*
* @property _forceHWTransforms
* @type boolean
* @protected
*/
_forceHWTransforms: Y.UA.webkit ? true : false,
/**
* <p>Used to control whether or not ScrollView's internal
* gesturemovestart, gesturemove and gesturemoveend
* event listeners should preventDefault. The value is an
* object, with "start", "move" and "end" properties used to
* specify which events should preventDefault and which shouldn't:</p>
*
* <pre>
* {
* start: false,
* move: true,
* end: false
* }
* </pre>
*
* <p>The default values are set up in order to prevent panning,
* on touch devices, while allowing click listeners on elements inside
* the ScrollView to be notified as expected.</p>
*
* @property _prevent
* @type Object
* @protected
*/
_prevent: {
start: false,
move: true,
end: false
},
/**
* Contains the distance (postive or negative) in pixels by which
* the scrollview was last scrolled. This is useful when setting up
* click listeners on the scrollview content, which on mouse based
* devices are always fired, even after a drag/flick.
*
* <p>Touch based devices don't currently fire a click event,
* if the finger has been moved (beyond a threshold) so this
* check isn't required, if working in a purely touch based environment</p>
*
* @property lastScrolledAmt
* @type Number
* @public
* @default 0
*/
lastScrolledAmt: 0,
/**
* Designated initializer
*
* @method initializer
* @param {config} Configuration object for the plugin
*/
initializer: function (config) {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "initializer", 133);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 134);
var sv = this;
// Cache these values, since they aren't going to change.
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 137);
sv._bb = sv.get(BOUNDING_BOX);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 138);
sv._cb = sv.get(CONTENT_BOX);
// Cache some attributes
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 141);
sv._cAxis = sv.get(AXIS);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 142);
sv._cBounce = sv.get(BOUNCE);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 143);
sv._cBounceRange = sv.get(BOUNCE_RANGE);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 144);
sv._cDeceleration = sv.get(DECELERATION);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 145);
sv._cFrameDuration = sv.get(FRAME_DURATION);
},
/**
* bindUI implementation
*
* Hooks up events for the widget
* @method bindUI
*/
bindUI: function () {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "bindUI", 154);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 155);
var sv = this;
// Bind interaction listers
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 158);
sv._bindFlick(sv.get(FLICK));
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 159);
sv._bindDrag(sv.get(DRAG));
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 160);
sv._bindMousewheel(true);
// Bind change events
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 163);
sv._bindAttrs();
// IE SELECT HACK. See if we can do this non-natively and in the gesture for a future release.
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 166);
if (IE) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 167);
sv._fixIESelect(sv._bb, sv._cb);
}
// Set any deprecated static properties
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 171);
if (ScrollView.SNAP_DURATION) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 172);
sv.set(SNAP_DURATION, ScrollView.SNAP_DURATION);
}
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 175);
if (ScrollView.SNAP_EASING) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 176);
sv.set(SNAP_EASING, ScrollView.SNAP_EASING);
}
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 179);
if (ScrollView.EASING) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 180);
sv.set(EASING, ScrollView.EASING);
}
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 183);
if (ScrollView.FRAME_STEP) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 184);
sv.set(FRAME_DURATION, ScrollView.FRAME_STEP);
}
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 187);
if (ScrollView.BOUNCE_RANGE) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 188);
sv.set(BOUNCE_RANGE, ScrollView.BOUNCE_RANGE);
}
// Recalculate dimension properties
// TODO: This should be throttled.
// Y.one(WINDOW).after('resize', sv._afterDimChange, sv);
},
/**
* Bind event listeners
*
* @method _bindAttrs
* @private
*/
_bindAttrs: function () {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_bindAttrs", 202);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 203);
var sv = this,
scrollChangeHandler = sv._afterScrollChange,
dimChangeHandler = sv._afterDimChange;
// Bind any change event listeners
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 208);
sv.after({
'scrollEnd': sv._afterScrollEnd,
'disabledChange': sv._afterDisabledChange,
'flickChange': sv._afterFlickChange,
'dragChange': sv._afterDragChange,
'axisChange': sv._afterAxisChange,
'scrollYChange': scrollChangeHandler,
'scrollXChange': scrollChangeHandler,
'heightChange': dimChangeHandler,
'widthChange': dimChangeHandler
});
},
/**
* Bind (or unbind) gesture move listeners required for drag support
*
* @method _bindDrag
* @param drag {boolean} If true, the method binds listener to enable drag (gesturemovestart). If false, the method unbinds gesturemove listeners for drag support.
* @private
*/
_bindDrag: function (drag) {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_bindDrag", 228);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 229);
var sv = this,
bb = sv._bb;
// Unbind any previous 'drag' listeners
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 233);
bb.detach(DRAG + '|*');
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 235);
if (drag) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 236);
bb.on(DRAG + '|' + GESTURE_MOVE + START, Y.bind(sv._onGestureMoveStart, sv));
}
},
/**
* Bind (or unbind) flick listeners.
*
* @method _bindFlick
* @param flick {Object|boolean} If truthy, the method binds listeners for flick support. If false, the method unbinds flick listeners.
* @private
*/
_bindFlick: function (flick) {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_bindFlick", 247);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 248);
var sv = this,
bb = sv._bb;
// Unbind any previous 'flick' listeners
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 252);
bb.detach(FLICK + '|*');
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 254);
if (flick) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 255);
bb.on(FLICK + '|' + FLICK, Y.bind(sv._flick, sv), flick);
// Rebind Drag, becuase _onGestureMoveEnd always has to fire -after- _flick
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 258);
sv._bindDrag(sv.get(DRAG));
}
},
/**
* Bind (or unbind) mousewheel listeners.
*
* @method _bindMousewheel
* @param mousewheel {Object|boolean} If truthy, the method binds listeners for mousewheel support. If false, the method unbinds mousewheel listeners.
* @private
*/
_bindMousewheel: function (mousewheel) {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_bindMousewheel", 269);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 270);
var sv = this,
bb = sv._bb;
// Unbind any previous 'mousewheel' listeners
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 274);
bb.detach(MOUSEWHEEL + '|*');
// Only enable for vertical scrollviews
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 277);
if (mousewheel) {
// Bound to document, because that's where mousewheel events fire off of.
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 279);
Y.one(DOCUMENT).on(MOUSEWHEEL, Y.bind(sv._mousewheel, sv));
}
},
/**
* syncUI implementation.
*
* Update the scroll position, based on the current value of scrollX/scrollY.
*
* @method syncUI
*/
syncUI: function () {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "syncUI", 290);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 291);
var sv = this,
scrollDims = sv._getScrollDims(),
width = scrollDims.offsetWidth,
height = scrollDims.offsetHeight,
scrollWidth = scrollDims.scrollWidth,
scrollHeight = scrollDims.scrollHeight;
// If the axis is undefined, auto-calculate it
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 299);
if (sv._cAxis === undefined) {
// This should only ever be run once (for now).
// In the future SV might post-load axis changes
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 302);
sv._cAxis = {
x: (scrollWidth > width),
y: (scrollHeight > height)
};
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 307);
sv._set(AXIS, sv._cAxis);
}
// get text direction on or inherited by scrollview node
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 311);
sv.rtl = (sv._cb.getComputedStyle('direction') === 'rtl');
// Cache the disabled value
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 314);
sv._cDisabled = sv.get(DISABLED);
// Run this to set initial values
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 317);
sv._uiDimensionsChange();
// If we're out-of-bounds, snap back.
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 320);
if (sv._isOutOfBounds()) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 321);
sv._snapBack();
}
},
/**
* Utility method to obtain widget dimensions
*
* @method _getScrollDims
* @returns {Object} The offsetWidth, offsetHeight, scrollWidth and scrollHeight as an array: [offsetWidth, offsetHeight, scrollWidth, scrollHeight]
* @private
*/
_getScrollDims: function () {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_getScrollDims", 332);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 333);
var sv = this,
cb = sv._cb,
bb = sv._bb,
TRANS = ScrollView._TRANSITION,
// Ideally using CSSMatrix - don't think we have it normalized yet though.
// origX = (new WebKitCSSMatrix(cb.getComputedStyle("transform"))).e,
// origY = (new WebKitCSSMatrix(cb.getComputedStyle("transform"))).f,
origX = sv.get(SCROLL_X),
origY = sv.get(SCROLL_Y),
origHWTransform,
dims;
// TODO: Is this OK? Just in case it's called 'during' a transition.
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 346);
if (NATIVE_TRANSITIONS) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 347);
cb.setStyle(TRANS.DURATION, ZERO);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 348);
cb.setStyle(TRANS.PROPERTY, EMPTY);
}
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 351);
origHWTransform = sv._forceHWTransforms;
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 352);
sv._forceHWTransforms = false; // the z translation was causing issues with picking up accurate scrollWidths in Chrome/Mac.
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 354);
sv._moveTo(cb, 0, 0);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 355);
dims = {
'offsetWidth': bb.get('offsetWidth'),
'offsetHeight': bb.get('offsetHeight'),
'scrollWidth': bb.get('scrollWidth'),
'scrollHeight': bb.get('scrollHeight')
};
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 361);
sv._moveTo(cb, -(origX), -(origY));
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 363);
sv._forceHWTransforms = origHWTransform;
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 365);
return dims;
},
/**
* This method gets invoked whenever the height or width attributes change,
* allowing us to determine which scrolling axes need to be enabled.
*
* @method _uiDimensionsChange
* @protected
*/
_uiDimensionsChange: function () {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_uiDimensionsChange", 375);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 376);
var sv = this,
bb = sv._bb,
scrollDims = sv._getScrollDims(),
width = scrollDims.offsetWidth,
height = scrollDims.offsetHeight,
scrollWidth = scrollDims.scrollWidth,
scrollHeight = scrollDims.scrollHeight,
rtl = sv.rtl,
svAxis = sv._cAxis;
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 386);
if (svAxis && svAxis.x) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 387);
bb.addClass(CLASS_NAMES.horizontal);
}
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 390);
if (svAxis && svAxis.y) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 391);
bb.addClass(CLASS_NAMES.vertical);
}
/**
* Internal state, defines the minimum amount that the scrollview can be scrolled along the X axis
*
* @property _minScrollX
* @type number
* @protected
*/
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 401);
sv._minScrollX = (rtl) ? Math.min(0, -(scrollWidth - width)) : 0;
/**
* Internal state, defines the maximum amount that the scrollview can be scrolled along the X axis
*
* @property _maxScrollX
* @type number
* @protected
*/
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 410);
sv._maxScrollX = (rtl) ? 0 : Math.max(0, scrollWidth - width);
/**
* Internal state, defines the minimum amount that the scrollview can be scrolled along the Y axis
*
* @property _minScrollY
* @type number
* @protected
*/
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 419);
sv._minScrollY = 0;
/**
* Internal state, defines the maximum amount that the scrollview can be scrolled along the Y axis
*
* @property _maxScrollY
* @type number
* @protected
*/
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 428);
sv._maxScrollY = Math.max(0, scrollHeight - height);
},
/**
* Scroll the element to a given xy coordinate
*
* @method scrollTo
* @param x {Number} The x-position to scroll to. (null for no movement)
* @param y {Number} The y-position to scroll to. (null for no movement)
* @param {Number} [duration] ms of the scroll animation. (default is 0)
* @param {String} [easing] An easing equation if duration is set. (default is `easing` attribute)
* @param {String} [node] The node to transform. Setting this can be useful in dual-axis paginated instances. (default is the instance's contentBox)
*/
scrollTo: function (x, y, duration, easing, node) {
// Check to see if widget is disabled
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "scrollTo", 441);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 443);
if (this._cDisabled) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 444);
return;
}
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 447);
var sv = this,
cb = sv._cb,
TRANS = ScrollView._TRANSITION,
callback = Y.bind(sv._onTransEnd, sv), // @Todo : cache this
newX = 0,
newY = 0,
transition = {},
transform;
// default the optional arguments
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 457);
duration = duration || 0;
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 458);
easing = easing || sv.get(EASING); // @TODO: Cache this
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 459);
node = node || cb;
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 461);
if (x !== null) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 462);
sv.set(SCROLL_X, x, {src:UI});
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 463);
newX = -(x);
}
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 466);
if (y !== null) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 467);
sv.set(SCROLL_Y, y, {src:UI});
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 468);
newY = -(y);
}
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 471);
transform = sv._transform(newX, newY);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 473);
if (NATIVE_TRANSITIONS) {
// ANDROID WORKAROUND - try and stop existing transition, before kicking off new one.
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 475);
node.setStyle(TRANS.DURATION, ZERO).setStyle(TRANS.PROPERTY, EMPTY);
}
// Move
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 479);
if (duration === 0) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 480);
if (NATIVE_TRANSITIONS) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 481);
node.setStyle('transform', transform);
}
else {
// TODO: If both set, batch them in the same update
// Update: Nope, setStyles() just loops through each property and applies it.
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 486);
if (x !== null) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 487);
node.setStyle(LEFT, newX + PX);
}
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 489);
if (y !== null) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 490);
node.setStyle(TOP, newY + PX);
}
}
}
// Animate
else {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 497);
transition.easing = easing;
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 498);
transition.duration = duration / 1000;
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 500);
if (NATIVE_TRANSITIONS) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 501);
transition.transform = transform;
}
else {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 504);
transition.left = newX + PX;
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 505);
transition.top = newY + PX;
}
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 508);
node.transition(transition, callback);
}
},
/**
* Utility method, to create the translate transform string with the
* x, y translation amounts provided.
*
* @method _transform
* @param {Number} x Number of pixels to translate along the x axis
* @param {Number} y Number of pixels to translate along the y axis
* @private
*/
_transform: function (x, y) {
// TODO: Would we be better off using a Matrix for this?
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_transform", 521);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 523);
var prop = 'translate(' + x + 'px, ' + y + 'px)';
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 525);
if (this._forceHWTransforms) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 526);
prop += ' translateZ(0)';
}
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 529);
return prop;
},
/**
* Utility method, to move the given element to the given xy position
*
* @method _moveTo
* @param node {Node} The node to move
* @param x {Number} The x-position to move to
* @param y {Number} The y-position to move to
* @private
*/
_moveTo : function(node, x, y) {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_moveTo", 541);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 542);
if (NATIVE_TRANSITIONS) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 543);
node.setStyle('transform', this._transform(x, y));
} else {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 545);
node.setStyle(LEFT, x + PX);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 546);
node.setStyle(TOP, y + PX);
}
},
/**
* Content box transition callback
*
* @method _onTransEnd
* @param {Event.Facade} e The event facade
* @private
*/
_onTransEnd: function (e) {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_onTransEnd", 558);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 559);
var sv = this;
/**
* Notification event fired at the end of a scroll transition
*
* @event scrollEnd
* @param e {EventFacade} The default event facade.
*/
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 567);
sv.fire(EV_SCROLL_END);
},
/**
* gesturemovestart event handler
*
* @method _onGestureMoveStart
* @param e {Event.Facade} The gesturemovestart event facade
* @private
*/
_onGestureMoveStart: function (e) {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_onGestureMoveStart", 577);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 579);
if (this._cDisabled) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 580);
return false;
}
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 583);
var sv = this,
bb = sv._bb,
currentX = sv.get(SCROLL_X),
currentY = sv.get(SCROLL_Y),
clientX = e.clientX,
clientY = e.clientY;
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 590);
if (sv._prevent.start) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 591);
e.preventDefault();
}
// if a flick animation is in progress, cancel it
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 595);
if (sv._flickAnim) {
// Cancel and delete sv._flickAnim
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 597);
sv._flickAnim.cancel();
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 598);
delete sv._flickAnim;
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 599);
sv._onTransEnd();
}
// TODO: Review if neccesary (#2530129)
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 603);
e.stopPropagation();
// Reset lastScrolledAmt
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 606);
sv.lastScrolledAmt = 0;
// Stores data for this gesture cycle. Cleaned up later
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 609);
sv._gesture = {
// Will hold the axis value
axis: null,
// The current attribute values
startX: currentX,
startY: currentY,
// The X/Y coordinates where the event began
startClientX: clientX,
startClientY: clientY,
// The X/Y coordinates where the event will end
endClientX: null,
endClientY: null,
// The current delta of the event
deltaX: null,
deltaY: null,
// Will be populated for flicks
flick: null,
// Create some listeners for the rest of the gesture cycle
onGestureMove: bb.on(DRAG + '|' + GESTURE_MOVE, Y.bind(sv._onGestureMove, sv)),
// @TODO: Don't bind gestureMoveEnd if it's a Flick?
onGestureMoveEnd: bb.on(DRAG + '|' + GESTURE_MOVE + END, Y.bind(sv._onGestureMoveEnd, sv))
};
},
/**
* gesturemove event handler
*
* @method _onGestureMove
* @param e {Event.Facade} The gesturemove event facade
* @private
*/
_onGestureMove: function (e) {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_onGestureMove", 648);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 649);
var sv = this,
gesture = sv._gesture,
svAxis = sv._cAxis,
svAxisX = svAxis.x,
svAxisY = svAxis.y,
startX = gesture.startX,
startY = gesture.startY,
startClientX = gesture.startClientX,
startClientY = gesture.startClientY,
clientX = e.clientX,
clientY = e.clientY;
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 661);
if (sv._prevent.move) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 662);
e.preventDefault();
}
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 665);
gesture.deltaX = startClientX - clientX;
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 666);
gesture.deltaY = startClientY - clientY;
// Determine if this is a vertical or horizontal movement
// @TODO: This is crude, but it works. Investigate more intelligent ways to detect intent
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 670);
if (gesture.axis === null) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 671);
gesture.axis = (Math.abs(gesture.deltaX) > Math.abs(gesture.deltaY)) ? DIM_X : DIM_Y;
}
// Move X or Y. @TODO: Move both if dualaxis.
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 675);
if (gesture.axis === DIM_X && svAxisX) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 676);
sv.set(SCROLL_X, startX + gesture.deltaX);
}
else {_yuitest_coverline("build/scrollview-base/scrollview-base.js", 678);
if (gesture.axis === DIM_Y && svAxisY) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 679);
sv.set(SCROLL_Y, startY + gesture.deltaY);
}}
},
/**
* gesturemoveend event handler
*
* @method _onGestureMoveEnd
* @param e {Event.Facade} The gesturemoveend event facade
* @private
*/
_onGestureMoveEnd: function (e) {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_onGestureMoveEnd", 690);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 691);
var sv = this,
gesture = sv._gesture,
flick = gesture.flick,
clientX = e.clientX,
clientY = e.clientY;
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 697);
if (sv._prevent.end) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 698);
e.preventDefault();
}
// Store the end X/Y coordinates
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 702);
gesture.endClientX = clientX;
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 703);
gesture.endClientY = clientY;
// Cleanup the event handlers
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 706);
gesture.onGestureMove.detach();
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 707);
gesture.onGestureMoveEnd.detach();
// If this wasn't a flick, wrap up the gesture cycle
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 710);
if (!flick) {
// @TODO: Be more intelligent about this. Look at the Flick attribute to see
// if it is safe to assume _flick did or didn't fire.
// Then, the order _flick and _onGestureMoveEnd fire doesn't matter?
// If there was movement (_onGestureMove fired)
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 716);
if (gesture.deltaX !== null && gesture.deltaY !== null) {
// If we're out-out-bounds, then snapback
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 719);
if (sv._isOutOfBounds()) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 720);
sv._snapBack();
}
// Inbounds
else {
// Don't fire scrollEnd on the gesture axis is the same as paginator's
// Not totally confident this is ideal to access a plugin's properties from a host, @TODO revisit
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 727);
if (sv.pages && !sv.pages.get(AXIS)[gesture.axis]) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 728);
sv._onTransEnd();
}
}
}
}
},
/**
* Execute a flick at the end of a scroll action
*
* @method _flick
* @param e {Event.Facade} The Flick event facade
* @private
*/
_flick: function (e) {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_flick", 742);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 743);
if (this._cDisabled) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 744);
return false;
}
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 747);
var sv = this,
svAxis = sv._cAxis,
flick = e.flick,
flickAxis = flick.axis,
flickVelocity = flick.velocity,
axisAttr = flickAxis === DIM_X ? SCROLL_X : SCROLL_Y,
startPosition = sv.get(axisAttr);
// Sometimes flick is enabled, but drag is disabled
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 756);
if (sv._gesture) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 757);
sv._gesture.flick = flick;
}
// Prevent unneccesary firing of _flickFrame if we can't scroll on the flick axis
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 761);
if (svAxis[flickAxis]) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 762);
sv._flickFrame(flickVelocity, flickAxis, startPosition);
}
},
/**
* Execute a single frame in the flick animation
*
* @method _flickFrame
* @param velocity {Number} The velocity of this animated frame
* @param flickAxis {String} The axis on which to animate
* @param startPosition {Number} The starting X/Y point to flick from
* @protected
*/
_flickFrame: function (velocity, flickAxis, startPosition) {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_flickFrame", 775);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 777);
var sv = this,
axisAttr = flickAxis === DIM_X ? SCROLL_X : SCROLL_Y,
// Localize cached values
bounce = sv._cBounce,
bounceRange = sv._cBounceRange,
deceleration = sv._cDeceleration,
frameDuration = sv._cFrameDuration,
// Calculate
newVelocity = velocity * deceleration,
newPosition = startPosition - (frameDuration * newVelocity),
// Some convinience conditions
min = flickAxis === DIM_X ? sv._minScrollX : sv._minScrollY,
max = flickAxis === DIM_X ? sv._maxScrollX : sv._maxScrollY,
belowMin = (newPosition < min),
belowMax = (newPosition < max),
aboveMin = (newPosition > min),
aboveMax = (newPosition > max),
belowMinRange = (newPosition < (min - bounceRange)),
belowMaxRange = (newPosition < (max + bounceRange)),
withinMinRange = (belowMin && (newPosition > (min - bounceRange))),
withinMaxRange = (aboveMax && (newPosition < (max + bounceRange))),
aboveMinRange = (newPosition > (min - bounceRange)),
aboveMaxRange = (newPosition > (max + bounceRange)),
tooSlow;
// If we're within the range but outside min/max, dampen the velocity
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 806);
if (withinMinRange || withinMaxRange) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 807);
newVelocity *= bounce;
}
// Is the velocity too slow to bother?
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 811);
tooSlow = (Math.abs(newVelocity).toFixed(4) < 0.015);
// If the velocity is too slow or we're outside the range
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 814);
if (tooSlow || belowMinRange || aboveMaxRange) {
// Cancel and delete sv._flickAnim
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 816);
if (sv._flickAnim) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 817);
sv._flickAnim.cancel();
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 818);
delete sv._flickAnim;
}
// If we're inside the scroll area, just end
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 822);
if (aboveMin && belowMax) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 823);
sv._onTransEnd();
}
// We're outside the scroll area, so we need to snap back
else {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 828);
sv._snapBack();
}
}
// Otherwise, animate to the next frame
else {
// @TODO: maybe use requestAnimationFrame instead
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 835);
sv._flickAnim = Y.later(frameDuration, sv, '_flickFrame', [newVelocity, flickAxis, newPosition]);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 836);
sv.set(axisAttr, newPosition);
}
},
/**
* Handle mousewheel events on the widget
*
* @method _mousewheel
* @param e {Event.Facade} The mousewheel event facade
* @private
*/
_mousewheel: function (e) {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_mousewheel", 847);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 848);
var sv = this,
scrollY = sv.get(SCROLL_Y),
bb = sv._bb,
scrollOffset = 10, // 10px
isForward = (e.wheelDelta > 0),
scrollToY = scrollY - ((isForward ? 1 : -1) * scrollOffset);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 855);
scrollToY = _constrain(scrollToY, sv._minScrollY, sv._maxScrollY);
// Because Mousewheel events fire off 'document', every ScrollView widget will react
// to any mousewheel anywhere on the page. This check will ensure that the mouse is currently
// over this specific ScrollView. Also, only allow mousewheel scrolling on Y-axis,
// becuase otherwise the 'prevent' will block page scrolling.
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 861);
if (bb.contains(e.target) && sv._cAxis[DIM_Y]) {
// Reset lastScrolledAmt
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 864);
sv.lastScrolledAmt = 0;
// Jump to the new offset
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 867);
sv.set(SCROLL_Y, scrollToY);
// if we have scrollbars plugin, update & set the flash timer on the scrollbar
// @TODO: This probably shouldn't be in this module
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 871);
if (sv.scrollbars) {
// @TODO: The scrollbars should handle this themselves
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 873);
sv.scrollbars._update();
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 874);
sv.scrollbars.flash();
// or just this
// sv.scrollbars._hostDimensionsChange();
}
// Fire the 'scrollEnd' event
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 880);
sv._onTransEnd();
// prevent browser default behavior on mouse scroll
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 883);
e.preventDefault();
}
},
/**
* Checks to see the current scrollX/scrollY position beyond the min/max boundary
*
* @method _isOutOfBounds
* @param x {Number} [optional] The X position to check
* @param y {Number} [optional] The Y position to check
* @returns {boolen} Whether the current X/Y position is out of bounds (true) or not (false)
* @private
*/
_isOutOfBounds: function (x, y) {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_isOutOfBounds", 896);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 897);
var sv = this,
svAxis = sv._cAxis,
svAxisX = svAxis.x,
svAxisY = svAxis.y,
currentX = x || sv.get(SCROLL_X),
currentY = y || sv.get(SCROLL_Y),
minX = sv._minScrollX,
minY = sv._minScrollY,
maxX = sv._maxScrollX,
maxY = sv._maxScrollY;
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 908);
return (svAxisX && (currentX < minX || currentX > maxX)) || (svAxisY && (currentY < minY || currentY > maxY));
},
/**
* Bounces back
* @TODO: Should be more generalized and support both X and Y detection
*
* @method _snapBack
* @private
*/
_snapBack: function () {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_snapBack", 918);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 919);
var sv = this,
currentX = sv.get(SCROLL_X),
currentY = sv.get(SCROLL_Y),
minX = sv._minScrollX,
minY = sv._minScrollY,
maxX = sv._maxScrollX,
maxY = sv._maxScrollY,
newY = _constrain(currentY, minY, maxY),
newX = _constrain(currentX, minX, maxX),
duration = sv.get(SNAP_DURATION),
easing = sv.get(SNAP_EASING);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 931);
if (newX !== currentX) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 932);
sv.set(SCROLL_X, newX, {duration:duration, easing:easing});
}
else {_yuitest_coverline("build/scrollview-base/scrollview-base.js", 934);
if (newY !== currentY) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 935);
sv.set(SCROLL_Y, newY, {duration:duration, easing:easing});
}
else {
// It shouldn't ever get here, but in case it does, fire scrollEnd
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 939);
sv._onTransEnd();
}}
},
/**
* After listener for changes to the scrollX or scrollY attribute
*
* @method _afterScrollChange
* @param e {Event.Facade} The event facade
* @protected
*/
_afterScrollChange: function (e) {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_afterScrollChange", 950);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 952);
if (e.src === ScrollView.UI_SRC) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 953);
return false;
}
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 956);
var sv = this,
duration = e.duration,
easing = e.easing,
val = e.newVal,
scrollToArgs = [];
// Set the scrolled value
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 963);
sv.lastScrolledAmt = sv.lastScrolledAmt + (e.newVal - e.prevVal);
// Generate the array of args to pass to scrollTo()
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 966);
if (e.attrName === SCROLL_X) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 967);
scrollToArgs.push(val);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 968);
scrollToArgs.push(sv.get(SCROLL_Y));
}
else {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 971);
scrollToArgs.push(sv.get(SCROLL_X));
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 972);
scrollToArgs.push(val);
}
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 975);
scrollToArgs.push(duration);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 976);
scrollToArgs.push(easing);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 978);
sv.scrollTo.apply(sv, scrollToArgs);
},
/**
* After listener for changes to the flick attribute
*
* @method _afterFlickChange
* @param e {Event.Facade} The event facade
* @protected
*/
_afterFlickChange: function (e) {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_afterFlickChange", 988);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 989);
this._bindFlick(e.newVal);
},
/**
* After listener for changes to the disabled attribute
*
* @method _afterDisabledChange
* @param e {Event.Facade} The event facade
* @protected
*/
_afterDisabledChange: function (e) {
// Cache for performance - we check during move
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_afterDisabledChange", 999);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 1001);
this._cDisabled = e.newVal;
},
/**
* After listener for the axis attribute
*
* @method _afterAxisChange
* @param e {Event.Facade} The event facade
* @protected
*/
_afterAxisChange: function (e) {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_afterAxisChange", 1011);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 1012);
this._cAxis = e.newVal;
},
/**
* After listener for changes to the drag attribute
*
* @method _afterDragChange
* @param e {Event.Facade} The event facade
* @protected
*/
_afterDragChange: function (e) {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_afterDragChange", 1022);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 1023);
this._bindDrag(e.newVal);
},
/**
* After listener for the height or width attribute
*
* @method _afterDimChange
* @param e {Event.Facade} The event facade
* @protected
*/
_afterDimChange: function () {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_afterDimChange", 1033);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 1034);
this._uiDimensionsChange();
},
/**
* After listener for scrollEnd, for cleanup
*
* @method _afterScrollEnd
* @param e {Event.Facade} The event facade
* @protected
*/
_afterScrollEnd: function (e) {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_afterScrollEnd", 1044);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 1045);
var sv = this;
// @TODO: Move to sv._cancelFlick()
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 1048);
if (sv._flickAnim) {
// Cancel the flick (if it exists)
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 1050);
sv._flickAnim.cancel();
// Also delete it, otherwise _onGestureMoveStart will think we're still flicking
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 1053);
delete sv._flickAnim;
}
// If for some reason we're OOB, snapback
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 1057);
if (sv._isOutOfBounds()) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 1058);
sv._snapBack();
}
// Ideally this should be removed, but doing so causing some JS errors with fast swiping
// because _gesture is being deleted after the previous one has been overwritten
// delete sv._gesture; // TODO: Move to sv.prevGesture?
},
/**
* Setter for 'axis' attribute
*
* @method _axisSetter
* @param val {Mixed} A string ('x', 'y', 'xy') to specify which axis/axes to allow scrolling on
* @param name {String} The attribute name
* @return {Object} An object to specify scrollability on the x & y axes
*
* @protected
*/
_axisSetter: function (val, name) {
// Turn a string into an axis object
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_axisSetter", 1076);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 1079);
if (Y.Lang.isString(val)) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 1080);
return {
x: val.match(/x/i) ? true : false,
y: val.match(/y/i) ? true : false
};
}
},
/**
* The scrollX, scrollY setter implementation
*
* @method _setScroll
* @private
* @param {Number} val
* @param {String} dim
*
* @return {Number} The value
*/
_setScroll : function(val, dim) {
// Just ensure the widget is not disabled
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_setScroll", 1097);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 1100);
if (this._cDisabled) {
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 1101);
val = Y.Attribute.INVALID_VALUE;
}
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 1104);
return val;
},
/**
* Setter for the scrollX attribute
*
* @method _setScrollX
* @param val {Number} The new scrollX value
* @return {Number} The normalized value
* @protected
*/
_setScrollX: function(val) {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_setScrollX", 1115);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 1116);
return this._setScroll(val, DIM_X);
},
/**
* Setter for the scrollY ATTR
*
* @method _setScrollY
* @param val {Number} The new scrollY value
* @return {Number} The normalized value
* @protected
*/
_setScrollY: function(val) {
_yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_setScrollY", 1127);
_yuitest_coverline("build/scrollview-base/scrollview-base.js", 1128);
return this._setScroll(val, DIM_Y);
}
// End prototype properties
}, {
// Static properties
/**
* The identity of the widget.
*
* @property NAME
* @type String
* @default 'scrollview'
* @readOnly
* @protected
* @static
*/
NAME: 'scrollview',
/**
* Static property used to define the default attribute configuration of
* the Widget.
*
* @property ATTRS
* @type {Object}
* @protected
* @static
*/
ATTRS: {
/**
* Specifies ability to scroll on x, y, or x and y axis/axes.
*
* @attribute axis
* @type String
*/
axis: {
setter: '_axisSetter',
writeOnce: 'initOnly'
},
/**
* The current scroll position in the x-axis
*
* @attribute scrollX
* @type Number
* @default 0
*/
scrollX: {
value: 0,
setter: '_setScrollX'
},
/**
* The current scroll position in the y-axis
*
* @attribute scrollY
* @type Number
* @default 0
*/
scrollY: {
value: 0,
setter: '_setScrollY'
},
/**
* Drag coefficent for inertial scrolling. The closer to 1 this
* value is, the less friction during scrolling.
*
* @attribute deceleration
* @default 0.93
*/
deceleration: {
value: 0.93
},
/**
* Drag coefficient for intertial scrolling at the upper
* and lower boundaries of the scrollview. Set to 0 to
* disable "rubber-banding".
*
* @attribute bounce
* @type Number
* @default 0.1
*/
bounce: {
value: 0.1
},
/**
* The minimum distance and/or velocity which define a flick. Can be set to false,
* to disable flick support (note: drag support is enabled/disabled separately)
*
* @attribute flick
* @type Object
* @default Object with properties minDistance = 10, minVelocity = 0.3.
*/
flick: {
value: {
minDistance: 10,
minVelocity: 0.3
}
},
/**
* Enable/Disable dragging the ScrollView content (note: flick support is enabled/disabled separately)
* @attribute drag
* @type boolean
* @default true
*/
drag: {
value: true
},
/**
* The default duration to use when animating the bounce snap back.
*
* @attribute snapDuration
* @type Number
* @default 400
*/
snapDuration: {
value: 400
},
/**
* The default easing to use when animating the bounce snap back.
*
* @attribute snapEasing
* @type String
* @default 'ease-out'
*/
snapEasing: {
value: 'ease-out'
},
/**
* The default easing used when animating the flick
*
* @attribute easing
* @type String
* @default 'cubic-bezier(0, 0.1, 0, 1.0)'
*/
easing: {
value: 'cubic-bezier(0, 0.1, 0, 1.0)'
},
/**
* The interval (ms) used when animating the flick for JS-timer animations
*
* @attribute frameDuration
* @type Number
* @default 15
*/
frameDuration: {
value: 15
},
/**
* The default bounce distance in pixels
*
* @attribute bounceRange
* @type Number
* @default 150
*/
bounceRange: {
value: 150
}
},
/**
* List of class names used in the scrollview's DOM
*
* @property CLASS_NAMES
* @type Object
* @static
*/
CLASS_NAMES: CLASS_NAMES,
/**
* Flag used to source property changes initiated from the DOM
*
* @property UI_SRC
* @type String
* @static
* @default 'ui'
*/
UI_SRC: UI,
/**
* Object map of style property names used to set transition properties.
* Defaults to the vendor prefix established by the Transition module.
* The configured property names are `_TRANSITION.DURATION` (e.g. "WebkitTransitionDuration") and
* `_TRANSITION.PROPERTY (e.g. "WebkitTransitionProperty").
*
* @property _TRANSITION
* @private
*/
_TRANSITION: {
DURATION: Y.Transition._VENDOR_PREFIX + 'TransitionDuration',
PROPERTY: Y.Transition._VENDOR_PREFIX + 'TransitionProperty'
},
/**
* The default bounce distance in pixels
*
* @property BOUNCE_RANGE
* @type Number
* @static
* @default false
* @deprecated (in 3.7.0)
*/
BOUNCE_RANGE: false,
/**
* The interval (ms) used when animating the flick
*
* @property FRAME_STEP
* @type Number
* @static
* @default false
* @deprecated (in 3.7.0)
*/
FRAME_STEP: false,
/**
* The default easing used when animating the flick
*
* @property EASING
* @type String
* @static
* @default false
* @deprecated (in 3.7.0)
*/
EASING: false,
/**
* The default easing to use when animating the bounce snap back.
*
* @property SNAP_EASING
* @type String
* @static
* @default false
* @deprecated (in 3.7.0)
*/
SNAP_EASING: false,
/**
* The default duration to use when animating the bounce snap back.
*
* @property SNAP_DURATION
* @type Number
* @static
* @default false
* @deprecated (in 3.7.0)
*/
SNAP_DURATION: false
// End static properties
});
}, '@VERSION@', {"requires": ["widget", "event-gestures", "event-mousewheel", "transition"], "skinnable": true});
|
src/common/Socket/Trigger.js | Syncano/syncano-dashboard | import React from 'react';
import { colors as Colors } from 'material-ui/styles/';
import SocketWrapper from './SocketWrapper';
export default React.createClass({
displayName: 'TriggerSocket',
getDefaultProps() {
return {
tooltip: 'Create a Trigger Socket'
};
},
getStyles() {
return {
iconStyle: {
color: Colors.amberA200
}
};
},
render() {
const styles = this.getStyles();
const {
style,
iconStyle,
...other
} = this.props;
return (
<SocketWrapper
{...other}
iconClassName="synicon-socket-trigger"
style={style}
iconStyle={{ ...styles.iconStyle, ...iconStyle }}
/>
);
}
});
|
app/jsx/canvas_cropper/cropperMaker.js | djbender/canvas-lms | /*
* Copyright (C) 2016 - present Instructure, Inc.
*
* This file is part of Canvas.
*
* Canvas is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation, version 3 of the License.
*
* Canvas 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React from 'react'
import ReactDOM from 'react-dom'
import CanvasCropper from './cropper'
// CanvasCropperMaker is the component you'll create if injecting the cropper
// into existing non-react UI (see UploadFileView.coffee for sample usage)
// let cropper = new Cropper(@$('.avatar-preview')[0], {imgFile: @file, width: @avatarSize.w, height: @avatarSize.h})
// cropper.render()
//
class CanvasCropperMaker {
// @param root: DOM node where I want the cropper created
// @param props: properties
// imgFile: the File object returned from the native file open dialog
// width: desired width in px of the final cropped image
// height: desired height in px of the final cropped image
constructor(root, props) {
this.root = root // DOM node we render into
this.imgFile = props.imgFile
this.onImageLoaded = props.onImageLoaded
this.width = props.width || 128
this.height = props.height || 128
this.cropper = null
}
unmount() {
ReactDOM.unmountComponentAtNode(this.root)
}
render() {
ReactDOM.render(
<CanvasCropper
height={this.height}
imgFile={this.imgFile}
onImageLoaded={this.onImageLoaded}
ref={el => {
this.cropper = el
}}
width={this.width}
/>,
this.root
)
}
// crop the image.
// returns a promise that resolves with the cropped image as a blob
crop() {
return this.cropper ? this.cropper.crop() : null
}
}
export default CanvasCropperMaker
|
packages/react-scripts/fixtures/kitchensink/src/features/syntax/ObjectSpread.js | ro-savage/create-react-app | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
function load(baseUser) {
return [
{ id: 1, name: '1', ...baseUser },
{ id: 2, name: '2', ...baseUser },
{ id: 3, name: '3', ...baseUser },
{ id: 4, name: '4', ...baseUser },
];
}
export default class extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = { users: [] };
}
async componentDidMount() {
const users = load({ age: 42 });
this.setState({ users });
}
componentDidUpdate() {
this.props.onReady();
}
render() {
return (
<div id="feature-object-spread">
{this.state.users.map(user => (
<div key={user.id}>
{user.name}: {user.age}
</div>
))}
</div>
);
}
}
|
app/javascript/mastodon/components/poll.js | yi0713/mastodon | import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import classNames from 'classnames';
import Motion from 'mastodon/features/ui/util/optional_motion';
import spring from 'react-motion/lib/spring';
import escapeTextContentForBrowser from 'escape-html';
import emojify from 'mastodon/features/emoji/emoji';
import RelativeTimestamp from './relative_timestamp';
import Icon from 'mastodon/components/icon';
const messages = defineMessages({
closed: {
id: 'poll.closed',
defaultMessage: 'Closed',
},
voted: {
id: 'poll.voted',
defaultMessage: 'You voted for this answer',
},
votes: {
id: 'poll.votes',
defaultMessage: '{votes, plural, one {# vote} other {# votes}}',
},
});
const makeEmojiMap = record => record.get('emojis').reduce((obj, emoji) => {
obj[`:${emoji.get('shortcode')}:`] = emoji.toJS();
return obj;
}, {});
export default @injectIntl
class Poll extends ImmutablePureComponent {
static propTypes = {
poll: ImmutablePropTypes.map,
intl: PropTypes.object.isRequired,
disabled: PropTypes.bool,
refresh: PropTypes.func,
onVote: PropTypes.func,
};
state = {
selected: {},
expired: null,
};
static getDerivedStateFromProps (props, state) {
const { poll, intl } = props;
const expires_at = poll.get('expires_at');
const expired = poll.get('expired') || expires_at !== null && (new Date(expires_at)).getTime() < intl.now();
return (expired === state.expired) ? null : { expired };
}
componentDidMount () {
this._setupTimer();
}
componentDidUpdate () {
this._setupTimer();
}
componentWillUnmount () {
clearTimeout(this._timer);
}
_setupTimer () {
const { poll, intl } = this.props;
clearTimeout(this._timer);
if (!this.state.expired) {
const delay = (new Date(poll.get('expires_at'))).getTime() - intl.now();
this._timer = setTimeout(() => {
this.setState({ expired: true });
}, delay);
}
}
_toggleOption = value => {
if (this.props.poll.get('multiple')) {
const tmp = { ...this.state.selected };
if (tmp[value]) {
delete tmp[value];
} else {
tmp[value] = true;
}
this.setState({ selected: tmp });
} else {
const tmp = {};
tmp[value] = true;
this.setState({ selected: tmp });
}
}
handleOptionChange = ({ target: { value } }) => {
this._toggleOption(value);
};
handleOptionKeyPress = (e) => {
if (e.key === 'Enter' || e.key === ' ') {
this._toggleOption(e.target.getAttribute('data-index'));
e.stopPropagation();
e.preventDefault();
}
}
handleVote = () => {
if (this.props.disabled) {
return;
}
this.props.onVote(Object.keys(this.state.selected));
};
handleRefresh = () => {
if (this.props.disabled) {
return;
}
this.props.refresh();
};
renderOption (option, optionIndex, showResults) {
const { poll, disabled, intl } = this.props;
const pollVotesCount = poll.get('voters_count') || poll.get('votes_count');
const percent = pollVotesCount === 0 ? 0 : (option.get('votes_count') / pollVotesCount) * 100;
const leading = poll.get('options').filterNot(other => other.get('title') === option.get('title')).every(other => option.get('votes_count') >= other.get('votes_count'));
const active = !!this.state.selected[`${optionIndex}`];
const voted = option.get('voted') || (poll.get('own_votes') && poll.get('own_votes').includes(optionIndex));
let titleEmojified = option.get('title_emojified');
if (!titleEmojified) {
const emojiMap = makeEmojiMap(poll);
titleEmojified = emojify(escapeTextContentForBrowser(option.get('title')), emojiMap);
}
return (
<li key={option.get('title')}>
<label className={classNames('poll__option', { selectable: !showResults })}>
<input
name='vote-options'
type={poll.get('multiple') ? 'checkbox' : 'radio'}
value={optionIndex}
checked={active}
onChange={this.handleOptionChange}
disabled={disabled}
/>
{!showResults && (
<span
className={classNames('poll__input', { checkbox: poll.get('multiple'), active })}
tabIndex='0'
role={poll.get('multiple') ? 'checkbox' : 'radio'}
onKeyPress={this.handleOptionKeyPress}
aria-checked={active}
aria-label={option.get('title')}
data-index={optionIndex}
/>
)}
{showResults && (
<span
className='poll__number'
title={intl.formatMessage(messages.votes, {
votes: option.get('votes_count'),
})}
>
{Math.round(percent)}%
</span>
)}
<span
className='poll__option__text translate'
dangerouslySetInnerHTML={{ __html: titleEmojified }}
/>
{!!voted && <span className='poll__voted'>
<Icon id='check' className='poll__voted__mark' title={intl.formatMessage(messages.voted)} />
</span>}
</label>
{showResults && (
<Motion defaultStyle={{ width: 0 }} style={{ width: spring(percent, { stiffness: 180, damping: 12 }) }}>
{({ width }) =>
<span className={classNames('poll__chart', { leading })} style={{ width: `${width}%` }} />
}
</Motion>
)}
</li>
);
}
render () {
const { poll, intl } = this.props;
const { expired } = this.state;
if (!poll) {
return null;
}
const timeRemaining = expired ? intl.formatMessage(messages.closed) : <RelativeTimestamp timestamp={poll.get('expires_at')} futureDate />;
const showResults = poll.get('voted') || expired;
const disabled = this.props.disabled || Object.entries(this.state.selected).every(item => !item);
let votesCount = null;
if (poll.get('voters_count') !== null && poll.get('voters_count') !== undefined) {
votesCount = <FormattedMessage id='poll.total_people' defaultMessage='{count, plural, one {# person} other {# people}}' values={{ count: poll.get('voters_count') }} />;
} else {
votesCount = <FormattedMessage id='poll.total_votes' defaultMessage='{count, plural, one {# vote} other {# votes}}' values={{ count: poll.get('votes_count') }} />;
}
return (
<div className='poll'>
<ul>
{poll.get('options').map((option, i) => this.renderOption(option, i, showResults))}
</ul>
<div className='poll__footer'>
{!showResults && <button className='button button-secondary' disabled={disabled} onClick={this.handleVote}><FormattedMessage id='poll.vote' defaultMessage='Vote' /></button>}
{showResults && !this.props.disabled && <span><button className='poll__link' onClick={this.handleRefresh}><FormattedMessage id='poll.refresh' defaultMessage='Refresh' /></button> · </span>}
{votesCount}
{poll.get('expires_at') && <span> · {timeRemaining}</span>}
</div>
</div>
);
}
}
|
src/js/components/Fields/AddTunabilityField.js | jaedb/Iris | import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import LinksSentence from '../LinksSentence';
import * as coreActions from '../../services/core/actions';
import * as uiActions from '../../services/ui/actions';
import * as spotifyActions from '../../services/spotify/actions';
import { generateGuid, uriType } from '../../util/helpers';
import { i18n } from '../../locale';
class AddSeedField extends React.Component {
constructor(props) {
super(props);
this.state = {
value: '',
};
this.id = generateGuid();
this.timer = null;
this.handleClick = this.handleClick.bind(this);
}
componentDidMount() {
window.addEventListener('click', this.handleClick, false);
if (!this.props.genres) {
this.props.spotifyActions.getGenres();
}
}
componentWillUnmount() {
window.removeEventListener('click', this.handleClick, false);
}
handleClick(e) {
if ($(e.target).closest('.add-seed-field').length <= 0) {
this.props.spotifyActions.clearAutocompleteResults(this.id);
}
}
handleChange(e, value) {
const self = this;
// update our local state
this.setState({ value });
// start a timer to perform the actual search
// this provides a wee delay between key presses to avoid request spamming
clearTimeout(this.timer);
this.timer = setTimeout(
() => {
self.setState({ searching: true });
self.props.spotifyActions.getAutocompleteResults(self.id, value, ['artist', 'track', 'genre']);
},
500,
);
}
handleSelect = (e, item) => {
const {
onSelect,
spotifyActions: {
clearAutocompleteResults,
},
coreActions: {
itemLoaded,
},
} = this.props;
this.setState({ value: '' });
onSelect(e, item.uri);
clearAutocompleteResults(this.id);
itemLoaded(item);
}
results() {
if (typeof (this.props.results) === 'undefined') {
return null;
} if (typeof (this.props.results[this.id]) === 'undefined') {
return null;
}
return this.props.results[this.id];
}
renderResults(type) {
const results = this.results();
if (!results || typeof (results[type]) === 'undefined' || results[type].length <= 0) return null;
// only show the first 3
const items = results[type].slice(0, 3);
return (
<div className="type">
<h4 className="mid_grey-text">{type}</h4>
{
items.map((item) => (
<div className="result" key={item.uri} onClick={(e) => this.handleSelect(e, item)}>
{item.name}
{type == 'tracks' ? (
<span className="mid_grey-text">
{' '}
<LinksSentence items={item.artists} type="artist" nolinks />
</span>
) : null}
</div>
))
}
</div>
);
}
render() {
let className = 'field autocomplete-field add-seed-field';
if (this.results() && this.results().loading) {
className += ' loading';
}
return (
<div className={className}>
<div className="input">
<input
type="text"
value={this.state.value}
onChange={(e) => this.handleChange(e, e.target.value)}
placeholder={this.props.placeholder || i18n('fields.start_typing')}
/>
</div>
<div className="results">
{this.renderResults('artists')}
{this.renderResults('tracks')}
{this.renderResults('genres')}
</div>
</div>
);
}
}
const mapStateToProps = (state, ownProps) => ({
genres: (state.ui.genres ? state.ui.genres : null),
results: (state.spotify.autocomplete_results ? state.spotify.autocomplete_results : {}),
});
const mapDispatchToProps = (dispatch) => ({
coreActions: bindActionCreators(coreActions, dispatch),
uiActions: bindActionCreators(uiActions, dispatch),
spotifyActions: bindActionCreators(spotifyActions, dispatch),
});
export default connect(mapStateToProps, mapDispatchToProps)(AddSeedField);
|
src/containers/login.js | jeetiss/client | import React from 'react'
import LoginForm from '../components/loginform'
import { connect } from 'react-redux'
function LoginView ({ dispatch }) {
return <LoginForm
onSub={(name, pass) => dispatch(
{ type: 'ws/auth', name, pass }
)}
/>
}
const Login = connect()(LoginView)
export default Login
|
app/imports/ui/client/layouts/Footer/index.js | valcol/ScrumNinja | import React from 'react';
export const Footer = () =>
<footer className="main-footer">
<div className="pull-right hidden-xs">
Made with <span style={{ color: 'red' }}>♥</span>
</div>
Copyright © 2016 <a href="#">ScrumNinja</a>. All rights reserved.
</footer>;
export default Footer;
|
src/index.js | marr/tilt-world | import React from 'react';
import ReactDOM from 'react-dom';
import { App } from './App';
ReactDOM.render(<App />, document.getElementById('root'));
|
src/routes/catalog/index.js | Tori1810/Task3 |
import React from 'react';
import Catalog from './Catalog';
export default {
path: '/catalog',
action() {
return {
title: 'Каталог',
component: <Catalog />,
};
},
}; |
src/sites/constellations.js | cosmowiki/cosmowiki | import React from 'react';
import ConstellationsComponent from '../components/constellations';
export default class Constellations {
static componentWithData(constellations) {
return <ConstellationsComponent constellations={constellations} />;
}
static fromRawData(rawData) {
return rawData.map(raw => Constellation.fromRawData(raw))
}
}
class Constellation {
static fromRawData(raw) {
const item = new Constellation();
item.name = raw.itemname;
item.latinName = raw.itemname2;
item.shortName = raw.itemname4;
item.wikipediaUrl = raw.itemurl;
item.imageSmallUrl = raw.itemimgsmallurl;
item.imageLargeUrl = raw.itemimgurl;
item.imageSrc = raw.itemimgsrc;
item.imageLicence = raw.itemimglicence;
item.imageLicenceUrl = raw.itemimglicenceurl;
item.namedYear = raw.itemdateyear;
item.astronomer = raw.itemparent;
item.astronomerUrl = raw.itemparenturl;
item.rightAscension = raw.itemrightascension;
item.declination = raw.itemdeclination;
item.author = Author.fromRawData(raw);
item.brightestStar = Star.fromRawData(raw);
item.year = raw.itemdateyear;
item.visibility = raw.itemvisibility;
item.visibleFrom = raw.itemvisiblefrom;
item.visibleTo = raw.itemvisibleto;
item.squareDegrees = raw.itemsquaredegrees;
item.starsOver3Mag = raw['itemstarsover3mag'];
item.highestBrightness = raw.itemhighestbrightness;
item.brightestStar = raw.itembrighteststar;
item.brightestStarUrl = raw.itembrighteststarurl;
return item;
}
}
class Author {
static fromRawData(raw) {
const author = new Author();
author.name = raw.itemparent;
author.wikipediaUrl = raw.itemparenturl;
return author;
}
}
class Star {
static fromRawData(raw) {
const star = new Star();
star.name = raw.itemproperty7;
star.wikipediaUrl = raw.itemproperty8;
return star;
}
}
/*
{
"itemname": "Achterdeck des Schiffs",
"itemname2": "Puppis",
"itemname3": "Puppis",
"itemname4": "Pup",
"itemurl": "https://de.wikipedia.org/wiki/Puppis_%28Sternbild%29",
"itemurl2": "https://upload.wikimedia.org/wikipedia/commons/thumb/e/e2/Puppis_IAU.svg/191px-Puppis_IAU.svg.png",
"itemimgurl": "https://upload.wikimedia.org/wikipedia/commons/thumb/e/e2/Puppis_IAU.svg/610px-Puppis_IAU.svg.png",
"itemimgsrc": "IAU and Sky & Telescope magazine (Roger Sinnott & Rick Fienberg)",
"itemimglicence": "CC by-sa 3.0",
"itemimglicenceurl": "https://creativecommons.org/licenses/by-sa/3.0/deed.en",
"itemdateyear": 1763,
"itemparent": "Lacaille",
"itemparenturl": "https://de.wikipedia.org/wiki/Nicolas_Louis_de_Lacaille",
"itemrightascension": "07h 15m 28,8s",
"itemdeclination": "−31° 10' 38,4\"",
"itemproperty": "S",
"itemproperty2": "39° N",
"itemproperty3": "90° S",
"itemproperty4": 673.434,
"itemproperty5": 4,
"itemproperty6": 2.06,
"itemproperty7": "Naos",
"itemproperty8": "https://de.wikipedia.org/wiki/Naos_%28Stern%29"
},
*/
|
definitions/npm/react-redux_v7.x.x/flow_v0.142.x-/test_connectState.js | splodingsocks/FlowTyped | // @flow
import React from "react";
import { connect } from "react-redux";
export let e: Array<any> = []
function sameStateIsOK() {
type Props = {...};
class Com extends React.Component<Props> {}
type State = {|
a: number
|};
const mapStateToProps = (state: State) => {
return {}
};
const Connected = connect<Props, {||}, _,_,State,empty>(mapStateToProps)(Com);
e.push(Connected);
<Connected />;
}
function differentStatesAreNotOK() {
type Props = {...};
class Com extends React.Component<Props> {}
type State = {|
a: number
|};
const mapStateToProps = (state: State) => {
return {}
};
type OtherState = {|
b: number
|};
//$FlowExpectedError[incompatible-call] property `b` is missing in `State` but exists in `OtherState`
const Connected = connect<Props, {||}, _,_,OtherState,empty>(mapStateToProps)(Com);
e.push(Connected);
<Connected />;
}
|
src-rx/src/components/JsonConfigComponent/ConfigCRON.js | ioBroker/ioBroker.admin | import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import InputLabel from '@material-ui/core/InputLabel';
import FormControl from '@material-ui/core/FormControl';
import { Button, TextField } from '@material-ui/core';
import DialogCron from '@iobroker/adapter-react/Dialogs/Cron';
import I18n from '@iobroker/adapter-react/i18n';
import ConfigGeneric from './ConfigGeneric';
const styles = theme => ({
fullWidth: {
width: '100%'
},
flex: {
display: 'flex'
},
button: {
height: 48,
marginLeft: 4,
minWidth: 48,
}
});
class ConfigCRON extends ConfigGeneric {
async componentDidMount() {
super.componentDidMount();
const { data, attr } = this.props;
const value = ConfigGeneric.getValue(data, attr) || '';
this.setState({ value});
}
renderItem(error, disabled, defaultValue) {
const { classes, schema, attr } = this.props;
const { value, showDialog } = this.state;
return <FormControl className={classes.fullWidth}>
<InputLabel shrink>{this.getText(schema.label)}</InputLabel>
<div className={classes.flex}>
<TextField
fullWidth
value={value}
error={!!error}
disabled={disabled}
placeholder={this.getText(schema.placeholder)}
label={this.getText(schema.label)}
helperText={this.renderHelp(schema.help, schema.helpLink, schema.noTranslation)}
onChange={e => {
const value = e.target.value;
this.setState({ value }, () =>
this.onChange(attr, value))
}}
/>
<Button
className={this.props.classes.button}
size="small"
variant="outlined"
onClick={() => this.setState({ showDialog: true })}
>...</Button>
</div>
{showDialog ? <DialogCron
title={I18n.t('Define schedule')}
simple={schema.simple}
complex={schema.complex}
cron={value}
language={I18n.getLanguage()}
onClose={() => this.setState({ showDialog: false })}
cancel={I18n.t('Cancel')}
ok={I18n.t('Ok')}
onOk={value =>
this.setState({ showDialog: false, value }, () =>
this.onChange(attr, value))}
/> : null}
</FormControl>;
}
}
ConfigCRON.propTypes = {
themeType: PropTypes.string,
themeName: PropTypes.string,
style: PropTypes.object,
className: PropTypes.string,
data: PropTypes.object.isRequired,
schema: PropTypes.object,
onError: PropTypes.func,
onChange: PropTypes.func,
dateFormat: PropTypes.string,
isFloatComma: PropTypes.bool,
};
export default withStyles(styles)(ConfigCRON); |
ajax/libs/cyclejs-core/0.21.1/cycle.js | brix/cdnjs | (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.Cycle = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
},{}],2:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = setTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
currentQueue[queueIndex].run();
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
clearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (!draining) {
setTimeout(drainQueue, 0);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
// TODO(shtylman)
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
},{}],3:[function(require,module,exports){
'use strict';
module.exports = require('./is-implemented')() ? Map : require('./polyfill');
},{"./is-implemented":4,"./polyfill":57}],4:[function(require,module,exports){
'use strict';
module.exports = function () {
var map, iterator, result;
if (typeof Map !== 'function') return false;
try {
// WebKit doesn't support arguments and crashes
map = new Map([['raz', 'one'], ['dwa', 'two'], ['trzy', 'three']]);
} catch (e) {
return false;
}
if (map.size !== 3) return false;
if (typeof map.clear !== 'function') return false;
if (typeof map.delete !== 'function') return false;
if (typeof map.entries !== 'function') return false;
if (typeof map.forEach !== 'function') return false;
if (typeof map.get !== 'function') return false;
if (typeof map.has !== 'function') return false;
if (typeof map.keys !== 'function') return false;
if (typeof map.set !== 'function') return false;
if (typeof map.values !== 'function') return false;
iterator = map.entries();
result = iterator.next();
if (result.done !== false) return false;
if (!result.value) return false;
if (result.value[0] !== 'raz') return false;
if (result.value[1] !== 'one') return false;
return true;
};
},{}],5:[function(require,module,exports){
// Exports true if environment provides native `Map` implementation,
// whatever that is.
'use strict';
module.exports = (function () {
if (typeof Map === 'undefined') return false;
return (Object.prototype.toString.call(Map.prototype) === '[object Map]');
}());
},{}],6:[function(require,module,exports){
'use strict';
module.exports = require('es5-ext/object/primitive-set')('key',
'value', 'key+value');
},{"es5-ext/object/primitive-set":31}],7:[function(require,module,exports){
'use strict';
var setPrototypeOf = require('es5-ext/object/set-prototype-of')
, d = require('d')
, Iterator = require('es6-iterator')
, toStringTagSymbol = require('es6-symbol').toStringTag
, kinds = require('./iterator-kinds')
, defineProperties = Object.defineProperties
, unBind = Iterator.prototype._unBind
, MapIterator;
MapIterator = module.exports = function (map, kind) {
if (!(this instanceof MapIterator)) return new MapIterator(map, kind);
Iterator.call(this, map.__mapKeysData__, map);
if (!kind || !kinds[kind]) kind = 'key+value';
defineProperties(this, {
__kind__: d('', kind),
__values__: d('w', map.__mapValuesData__)
});
};
if (setPrototypeOf) setPrototypeOf(MapIterator, Iterator);
MapIterator.prototype = Object.create(Iterator.prototype, {
constructor: d(MapIterator),
_resolve: d(function (i) {
if (this.__kind__ === 'value') return this.__values__[i];
if (this.__kind__ === 'key') return this.__list__[i];
return [this.__list__[i], this.__values__[i]];
}),
_unBind: d(function () {
this.__values__ = null;
unBind.call(this);
}),
toString: d(function () { return '[object Map Iterator]'; })
});
Object.defineProperty(MapIterator.prototype, toStringTagSymbol,
d('c', 'Map Iterator'));
},{"./iterator-kinds":6,"d":9,"es5-ext/object/set-prototype-of":32,"es6-iterator":44,"es6-symbol":53}],8:[function(require,module,exports){
'use strict';
var copy = require('es5-ext/object/copy')
, map = require('es5-ext/object/map')
, callable = require('es5-ext/object/valid-callable')
, validValue = require('es5-ext/object/valid-value')
, bind = Function.prototype.bind, defineProperty = Object.defineProperty
, hasOwnProperty = Object.prototype.hasOwnProperty
, define;
define = function (name, desc, bindTo) {
var value = validValue(desc) && callable(desc.value), dgs;
dgs = copy(desc);
delete dgs.writable;
delete dgs.value;
dgs.get = function () {
if (hasOwnProperty.call(this, name)) return value;
desc.value = bind.call(value, (bindTo == null) ? this : this[bindTo]);
defineProperty(this, name, desc);
return this[name];
};
return dgs;
};
module.exports = function (props/*, bindTo*/) {
var bindTo = arguments[1];
return map(props, function (desc, name) {
return define(name, desc, bindTo);
});
};
},{"es5-ext/object/copy":21,"es5-ext/object/map":29,"es5-ext/object/valid-callable":35,"es5-ext/object/valid-value":36}],9:[function(require,module,exports){
'use strict';
var assign = require('es5-ext/object/assign')
, normalizeOpts = require('es5-ext/object/normalize-options')
, isCallable = require('es5-ext/object/is-callable')
, contains = require('es5-ext/string/#/contains')
, d;
d = module.exports = function (dscr, value/*, options*/) {
var c, e, w, options, desc;
if ((arguments.length < 2) || (typeof dscr !== 'string')) {
options = value;
value = dscr;
dscr = null;
} else {
options = arguments[2];
}
if (dscr == null) {
c = w = true;
e = false;
} else {
c = contains.call(dscr, 'c');
e = contains.call(dscr, 'e');
w = contains.call(dscr, 'w');
}
desc = { value: value, configurable: c, enumerable: e, writable: w };
return !options ? desc : assign(normalizeOpts(options), desc);
};
d.gs = function (dscr, get, set/*, options*/) {
var c, e, options, desc;
if (typeof dscr !== 'string') {
options = set;
set = get;
get = dscr;
dscr = null;
} else {
options = arguments[3];
}
if (get == null) {
get = undefined;
} else if (!isCallable(get)) {
options = get;
get = set = undefined;
} else if (set == null) {
set = undefined;
} else if (!isCallable(set)) {
options = set;
set = undefined;
}
if (dscr == null) {
c = true;
e = false;
} else {
c = contains.call(dscr, 'c');
e = contains.call(dscr, 'e');
}
desc = { get: get, set: set, configurable: c, enumerable: e };
return !options ? desc : assign(normalizeOpts(options), desc);
};
},{"es5-ext/object/assign":18,"es5-ext/object/is-callable":24,"es5-ext/object/normalize-options":30,"es5-ext/string/#/contains":37}],10:[function(require,module,exports){
// Inspired by Google Closure:
// http://closure-library.googlecode.com/svn/docs/
// closure_goog_array_array.js.html#goog.array.clear
'use strict';
var value = require('../../object/valid-value');
module.exports = function () {
value(this).length = 0;
return this;
};
},{"../../object/valid-value":36}],11:[function(require,module,exports){
'use strict';
var toPosInt = require('../../number/to-pos-integer')
, value = require('../../object/valid-value')
, indexOf = Array.prototype.indexOf
, hasOwnProperty = Object.prototype.hasOwnProperty
, abs = Math.abs, floor = Math.floor;
module.exports = function (searchElement/*, fromIndex*/) {
var i, l, fromIndex, val;
if (searchElement === searchElement) { //jslint: ignore
return indexOf.apply(this, arguments);
}
l = toPosInt(value(this).length);
fromIndex = arguments[1];
if (isNaN(fromIndex)) fromIndex = 0;
else if (fromIndex >= 0) fromIndex = floor(fromIndex);
else fromIndex = toPosInt(this.length) - floor(abs(fromIndex));
for (i = fromIndex; i < l; ++i) {
if (hasOwnProperty.call(this, i)) {
val = this[i];
if (val !== val) return i; //jslint: ignore
}
}
return -1;
};
},{"../../number/to-pos-integer":16,"../../object/valid-value":36}],12:[function(require,module,exports){
'use strict';
module.exports = require('./is-implemented')()
? Math.sign
: require('./shim');
},{"./is-implemented":13,"./shim":14}],13:[function(require,module,exports){
'use strict';
module.exports = function () {
var sign = Math.sign;
if (typeof sign !== 'function') return false;
return ((sign(10) === 1) && (sign(-20) === -1));
};
},{}],14:[function(require,module,exports){
'use strict';
module.exports = function (value) {
value = Number(value);
if (isNaN(value) || (value === 0)) return value;
return (value > 0) ? 1 : -1;
};
},{}],15:[function(require,module,exports){
'use strict';
var sign = require('../math/sign')
, abs = Math.abs, floor = Math.floor;
module.exports = function (value) {
if (isNaN(value)) return 0;
value = Number(value);
if ((value === 0) || !isFinite(value)) return value;
return sign(value) * floor(abs(value));
};
},{"../math/sign":12}],16:[function(require,module,exports){
'use strict';
var toInteger = require('./to-integer')
, max = Math.max;
module.exports = function (value) { return max(0, toInteger(value)); };
},{"./to-integer":15}],17:[function(require,module,exports){
// Internal method, used by iteration functions.
// Calls a function for each key-value pair found in object
// Optionally takes compareFn to iterate object in specific order
'use strict';
var isCallable = require('./is-callable')
, callable = require('./valid-callable')
, value = require('./valid-value')
, call = Function.prototype.call, keys = Object.keys
, propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
module.exports = function (method, defVal) {
return function (obj, cb/*, thisArg, compareFn*/) {
var list, thisArg = arguments[2], compareFn = arguments[3];
obj = Object(value(obj));
callable(cb);
list = keys(obj);
if (compareFn) {
list.sort(isCallable(compareFn) ? compareFn.bind(obj) : undefined);
}
return list[method](function (key, index) {
if (!propertyIsEnumerable.call(obj, key)) return defVal;
return call.call(cb, thisArg, obj[key], key, obj, index);
});
};
};
},{"./is-callable":24,"./valid-callable":35,"./valid-value":36}],18:[function(require,module,exports){
'use strict';
module.exports = require('./is-implemented')()
? Object.assign
: require('./shim');
},{"./is-implemented":19,"./shim":20}],19:[function(require,module,exports){
'use strict';
module.exports = function () {
var assign = Object.assign, obj;
if (typeof assign !== 'function') return false;
obj = { foo: 'raz' };
assign(obj, { bar: 'dwa' }, { trzy: 'trzy' });
return (obj.foo + obj.bar + obj.trzy) === 'razdwatrzy';
};
},{}],20:[function(require,module,exports){
'use strict';
var keys = require('../keys')
, value = require('../valid-value')
, max = Math.max;
module.exports = function (dest, src/*, …srcn*/) {
var error, i, l = max(arguments.length, 2), assign;
dest = Object(value(dest));
assign = function (key) {
try { dest[key] = src[key]; } catch (e) {
if (!error) error = e;
}
};
for (i = 1; i < l; ++i) {
src = arguments[i];
keys(src).forEach(assign);
}
if (error !== undefined) throw error;
return dest;
};
},{"../keys":26,"../valid-value":36}],21:[function(require,module,exports){
'use strict';
var assign = require('./assign')
, value = require('./valid-value');
module.exports = function (obj) {
var copy = Object(value(obj));
if (copy !== obj) return copy;
return assign({}, obj);
};
},{"./assign":18,"./valid-value":36}],22:[function(require,module,exports){
// Workaround for http://code.google.com/p/v8/issues/detail?id=2804
'use strict';
var create = Object.create, shim;
if (!require('./set-prototype-of/is-implemented')()) {
shim = require('./set-prototype-of/shim');
}
module.exports = (function () {
var nullObject, props, desc;
if (!shim) return create;
if (shim.level !== 1) return create;
nullObject = {};
props = {};
desc = { configurable: false, enumerable: false, writable: true,
value: undefined };
Object.getOwnPropertyNames(Object.prototype).forEach(function (name) {
if (name === '__proto__') {
props[name] = { configurable: true, enumerable: false, writable: true,
value: undefined };
return;
}
props[name] = desc;
});
Object.defineProperties(nullObject, props);
Object.defineProperty(shim, 'nullPolyfill', { configurable: false,
enumerable: false, writable: false, value: nullObject });
return function (prototype, props) {
return create((prototype === null) ? nullObject : prototype, props);
};
}());
},{"./set-prototype-of/is-implemented":33,"./set-prototype-of/shim":34}],23:[function(require,module,exports){
'use strict';
module.exports = require('./_iterate')('forEach');
},{"./_iterate":17}],24:[function(require,module,exports){
// Deprecated
'use strict';
module.exports = function (obj) { return typeof obj === 'function'; };
},{}],25:[function(require,module,exports){
'use strict';
var map = { function: true, object: true };
module.exports = function (x) {
return ((x != null) && map[typeof x]) || false;
};
},{}],26:[function(require,module,exports){
'use strict';
module.exports = require('./is-implemented')()
? Object.keys
: require('./shim');
},{"./is-implemented":27,"./shim":28}],27:[function(require,module,exports){
'use strict';
module.exports = function () {
try {
Object.keys('primitive');
return true;
} catch (e) { return false; }
};
},{}],28:[function(require,module,exports){
'use strict';
var keys = Object.keys;
module.exports = function (object) {
return keys(object == null ? object : Object(object));
};
},{}],29:[function(require,module,exports){
'use strict';
var callable = require('./valid-callable')
, forEach = require('./for-each')
, call = Function.prototype.call;
module.exports = function (obj, cb/*, thisArg*/) {
var o = {}, thisArg = arguments[2];
callable(cb);
forEach(obj, function (value, key, obj, index) {
o[key] = call.call(cb, thisArg, value, key, obj, index);
});
return o;
};
},{"./for-each":23,"./valid-callable":35}],30:[function(require,module,exports){
'use strict';
var forEach = Array.prototype.forEach, create = Object.create;
var process = function (src, obj) {
var key;
for (key in src) obj[key] = src[key];
};
module.exports = function (options/*, …options*/) {
var result = create(null);
forEach.call(arguments, function (options) {
if (options == null) return;
process(Object(options), result);
});
return result;
};
},{}],31:[function(require,module,exports){
'use strict';
var forEach = Array.prototype.forEach, create = Object.create;
module.exports = function (arg/*, …args*/) {
var set = create(null);
forEach.call(arguments, function (name) { set[name] = true; });
return set;
};
},{}],32:[function(require,module,exports){
'use strict';
module.exports = require('./is-implemented')()
? Object.setPrototypeOf
: require('./shim');
},{"./is-implemented":33,"./shim":34}],33:[function(require,module,exports){
'use strict';
var create = Object.create, getPrototypeOf = Object.getPrototypeOf
, x = {};
module.exports = function (/*customCreate*/) {
var setPrototypeOf = Object.setPrototypeOf
, customCreate = arguments[0] || create;
if (typeof setPrototypeOf !== 'function') return false;
return getPrototypeOf(setPrototypeOf(customCreate(null), x)) === x;
};
},{}],34:[function(require,module,exports){
// Big thanks to @WebReflection for sorting this out
// https://gist.github.com/WebReflection/5593554
'use strict';
var isObject = require('../is-object')
, value = require('../valid-value')
, isPrototypeOf = Object.prototype.isPrototypeOf
, defineProperty = Object.defineProperty
, nullDesc = { configurable: true, enumerable: false, writable: true,
value: undefined }
, validate;
validate = function (obj, prototype) {
value(obj);
if ((prototype === null) || isObject(prototype)) return obj;
throw new TypeError('Prototype must be null or an object');
};
module.exports = (function (status) {
var fn, set;
if (!status) return null;
if (status.level === 2) {
if (status.set) {
set = status.set;
fn = function (obj, prototype) {
set.call(validate(obj, prototype), prototype);
return obj;
};
} else {
fn = function (obj, prototype) {
validate(obj, prototype).__proto__ = prototype;
return obj;
};
}
} else {
fn = function self(obj, prototype) {
var isNullBase;
validate(obj, prototype);
isNullBase = isPrototypeOf.call(self.nullPolyfill, obj);
if (isNullBase) delete self.nullPolyfill.__proto__;
if (prototype === null) prototype = self.nullPolyfill;
obj.__proto__ = prototype;
if (isNullBase) defineProperty(self.nullPolyfill, '__proto__', nullDesc);
return obj;
};
}
return Object.defineProperty(fn, 'level', { configurable: false,
enumerable: false, writable: false, value: status.level });
}((function () {
var x = Object.create(null), y = {}, set
, desc = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__');
if (desc) {
try {
set = desc.set; // Opera crashes at this point
set.call(x, y);
} catch (ignore) { }
if (Object.getPrototypeOf(x) === y) return { set: set, level: 2 };
}
x.__proto__ = y;
if (Object.getPrototypeOf(x) === y) return { level: 2 };
x = {};
x.__proto__ = y;
if (Object.getPrototypeOf(x) === y) return { level: 1 };
return false;
}())));
require('../create');
},{"../create":22,"../is-object":25,"../valid-value":36}],35:[function(require,module,exports){
'use strict';
module.exports = function (fn) {
if (typeof fn !== 'function') throw new TypeError(fn + " is not a function");
return fn;
};
},{}],36:[function(require,module,exports){
'use strict';
module.exports = function (value) {
if (value == null) throw new TypeError("Cannot use null or undefined");
return value;
};
},{}],37:[function(require,module,exports){
'use strict';
module.exports = require('./is-implemented')()
? String.prototype.contains
: require('./shim');
},{"./is-implemented":38,"./shim":39}],38:[function(require,module,exports){
'use strict';
var str = 'razdwatrzy';
module.exports = function () {
if (typeof str.contains !== 'function') return false;
return ((str.contains('dwa') === true) && (str.contains('foo') === false));
};
},{}],39:[function(require,module,exports){
'use strict';
var indexOf = String.prototype.indexOf;
module.exports = function (searchString/*, position*/) {
return indexOf.call(this, searchString, arguments[1]) > -1;
};
},{}],40:[function(require,module,exports){
'use strict';
var toString = Object.prototype.toString
, id = toString.call('');
module.exports = function (x) {
return (typeof x === 'string') || (x && (typeof x === 'object') &&
((x instanceof String) || (toString.call(x) === id))) || false;
};
},{}],41:[function(require,module,exports){
'use strict';
var setPrototypeOf = require('es5-ext/object/set-prototype-of')
, contains = require('es5-ext/string/#/contains')
, d = require('d')
, Iterator = require('./')
, defineProperty = Object.defineProperty
, ArrayIterator;
ArrayIterator = module.exports = function (arr, kind) {
if (!(this instanceof ArrayIterator)) return new ArrayIterator(arr, kind);
Iterator.call(this, arr);
if (!kind) kind = 'value';
else if (contains.call(kind, 'key+value')) kind = 'key+value';
else if (contains.call(kind, 'key')) kind = 'key';
else kind = 'value';
defineProperty(this, '__kind__', d('', kind));
};
if (setPrototypeOf) setPrototypeOf(ArrayIterator, Iterator);
ArrayIterator.prototype = Object.create(Iterator.prototype, {
constructor: d(ArrayIterator),
_resolve: d(function (i) {
if (this.__kind__ === 'value') return this.__list__[i];
if (this.__kind__ === 'key+value') return [i, this.__list__[i]];
return i;
}),
toString: d(function () { return '[object Array Iterator]'; })
});
},{"./":44,"d":9,"es5-ext/object/set-prototype-of":32,"es5-ext/string/#/contains":37}],42:[function(require,module,exports){
'use strict';
var callable = require('es5-ext/object/valid-callable')
, isString = require('es5-ext/string/is-string')
, get = require('./get')
, isArray = Array.isArray, call = Function.prototype.call;
module.exports = function (iterable, cb/*, thisArg*/) {
var mode, thisArg = arguments[2], result, doBreak, broken, i, l, char, code;
if (isArray(iterable)) mode = 'array';
else if (isString(iterable)) mode = 'string';
else iterable = get(iterable);
callable(cb);
doBreak = function () { broken = true; };
if (mode === 'array') {
iterable.some(function (value) {
call.call(cb, thisArg, value, doBreak);
if (broken) return true;
});
return;
}
if (mode === 'string') {
l = iterable.length;
for (i = 0; i < l; ++i) {
char = iterable[i];
if ((i + 1) < l) {
code = char.charCodeAt(0);
if ((code >= 0xD800) && (code <= 0xDBFF)) char += iterable[++i];
}
call.call(cb, thisArg, char, doBreak);
if (broken) break;
}
return;
}
result = iterable.next();
while (!result.done) {
call.call(cb, thisArg, result.value, doBreak);
if (broken) return;
result = iterable.next();
}
};
},{"./get":43,"es5-ext/object/valid-callable":35,"es5-ext/string/is-string":40}],43:[function(require,module,exports){
'use strict';
var isString = require('es5-ext/string/is-string')
, ArrayIterator = require('./array')
, StringIterator = require('./string')
, iterable = require('./valid-iterable')
, iteratorSymbol = require('es6-symbol').iterator;
module.exports = function (obj) {
if (typeof iterable(obj)[iteratorSymbol] === 'function') return obj[iteratorSymbol]();
if (isString(obj)) return new StringIterator(obj);
return new ArrayIterator(obj);
};
},{"./array":41,"./string":51,"./valid-iterable":52,"es5-ext/string/is-string":40,"es6-symbol":46}],44:[function(require,module,exports){
'use strict';
var clear = require('es5-ext/array/#/clear')
, assign = require('es5-ext/object/assign')
, callable = require('es5-ext/object/valid-callable')
, value = require('es5-ext/object/valid-value')
, d = require('d')
, autoBind = require('d/auto-bind')
, Symbol = require('es6-symbol')
, defineProperty = Object.defineProperty
, defineProperties = Object.defineProperties
, Iterator;
module.exports = Iterator = function (list, context) {
if (!(this instanceof Iterator)) return new Iterator(list, context);
defineProperties(this, {
__list__: d('w', value(list)),
__context__: d('w', context),
__nextIndex__: d('w', 0)
});
if (!context) return;
callable(context.on);
context.on('_add', this._onAdd);
context.on('_delete', this._onDelete);
context.on('_clear', this._onClear);
};
defineProperties(Iterator.prototype, assign({
constructor: d(Iterator),
_next: d(function () {
var i;
if (!this.__list__) return;
if (this.__redo__) {
i = this.__redo__.shift();
if (i !== undefined) return i;
}
if (this.__nextIndex__ < this.__list__.length) return this.__nextIndex__++;
this._unBind();
}),
next: d(function () { return this._createResult(this._next()); }),
_createResult: d(function (i) {
if (i === undefined) return { done: true, value: undefined };
return { done: false, value: this._resolve(i) };
}),
_resolve: d(function (i) { return this.__list__[i]; }),
_unBind: d(function () {
this.__list__ = null;
delete this.__redo__;
if (!this.__context__) return;
this.__context__.off('_add', this._onAdd);
this.__context__.off('_delete', this._onDelete);
this.__context__.off('_clear', this._onClear);
this.__context__ = null;
}),
toString: d(function () { return '[object Iterator]'; })
}, autoBind({
_onAdd: d(function (index) {
if (index >= this.__nextIndex__) return;
++this.__nextIndex__;
if (!this.__redo__) {
defineProperty(this, '__redo__', d('c', [index]));
return;
}
this.__redo__.forEach(function (redo, i) {
if (redo >= index) this.__redo__[i] = ++redo;
}, this);
this.__redo__.push(index);
}),
_onDelete: d(function (index) {
var i;
if (index >= this.__nextIndex__) return;
--this.__nextIndex__;
if (!this.__redo__) return;
i = this.__redo__.indexOf(index);
if (i !== -1) this.__redo__.splice(i, 1);
this.__redo__.forEach(function (redo, i) {
if (redo > index) this.__redo__[i] = --redo;
}, this);
}),
_onClear: d(function () {
if (this.__redo__) clear.call(this.__redo__);
this.__nextIndex__ = 0;
})
})));
defineProperty(Iterator.prototype, Symbol.iterator, d(function () {
return this;
}));
defineProperty(Iterator.prototype, Symbol.toStringTag, d('', 'Iterator'));
},{"d":9,"d/auto-bind":8,"es5-ext/array/#/clear":10,"es5-ext/object/assign":18,"es5-ext/object/valid-callable":35,"es5-ext/object/valid-value":36,"es6-symbol":46}],45:[function(require,module,exports){
'use strict';
var isString = require('es5-ext/string/is-string')
, iteratorSymbol = require('es6-symbol').iterator
, isArray = Array.isArray;
module.exports = function (value) {
if (value == null) return false;
if (isArray(value)) return true;
if (isString(value)) return true;
return (typeof value[iteratorSymbol] === 'function');
};
},{"es5-ext/string/is-string":40,"es6-symbol":46}],46:[function(require,module,exports){
'use strict';
module.exports = require('./is-implemented')() ? Symbol : require('./polyfill');
},{"./is-implemented":47,"./polyfill":49}],47:[function(require,module,exports){
'use strict';
module.exports = function () {
var symbol;
if (typeof Symbol !== 'function') return false;
symbol = Symbol('test symbol');
try { String(symbol); } catch (e) { return false; }
if (typeof Symbol.iterator === 'symbol') return true;
// Return 'true' for polyfills
if (typeof Symbol.isConcatSpreadable !== 'object') return false;
if (typeof Symbol.iterator !== 'object') return false;
if (typeof Symbol.toPrimitive !== 'object') return false;
if (typeof Symbol.toStringTag !== 'object') return false;
if (typeof Symbol.unscopables !== 'object') return false;
return true;
};
},{}],48:[function(require,module,exports){
'use strict';
module.exports = function (x) {
return (x && ((typeof x === 'symbol') || (x['@@toStringTag'] === 'Symbol'))) || false;
};
},{}],49:[function(require,module,exports){
'use strict';
var d = require('d')
, validateSymbol = require('./validate-symbol')
, create = Object.create, defineProperties = Object.defineProperties
, defineProperty = Object.defineProperty, objPrototype = Object.prototype
, Symbol, HiddenSymbol, globalSymbols = create(null);
var generateName = (function () {
var created = create(null);
return function (desc) {
var postfix = 0, name;
while (created[desc + (postfix || '')]) ++postfix;
desc += (postfix || '');
created[desc] = true;
name = '@@' + desc;
defineProperty(objPrototype, name, d.gs(null, function (value) {
defineProperty(this, name, d(value));
}));
return name;
};
}());
HiddenSymbol = function Symbol(description) {
if (this instanceof HiddenSymbol) throw new TypeError('TypeError: Symbol is not a constructor');
return Symbol(description);
};
module.exports = Symbol = function Symbol(description) {
var symbol;
if (this instanceof Symbol) throw new TypeError('TypeError: Symbol is not a constructor');
symbol = create(HiddenSymbol.prototype);
description = (description === undefined ? '' : String(description));
return defineProperties(symbol, {
__description__: d('', description),
__name__: d('', generateName(description))
});
};
defineProperties(Symbol, {
for: d(function (key) {
if (globalSymbols[key]) return globalSymbols[key];
return (globalSymbols[key] = Symbol(String(key)));
}),
keyFor: d(function (s) {
var key;
validateSymbol(s);
for (key in globalSymbols) if (globalSymbols[key] === s) return key;
}),
hasInstance: d('', Symbol('hasInstance')),
isConcatSpreadable: d('', Symbol('isConcatSpreadable')),
iterator: d('', Symbol('iterator')),
match: d('', Symbol('match')),
replace: d('', Symbol('replace')),
search: d('', Symbol('search')),
species: d('', Symbol('species')),
split: d('', Symbol('split')),
toPrimitive: d('', Symbol('toPrimitive')),
toStringTag: d('', Symbol('toStringTag')),
unscopables: d('', Symbol('unscopables'))
});
defineProperties(HiddenSymbol.prototype, {
constructor: d(Symbol),
toString: d('', function () { return this.__name__; })
});
defineProperties(Symbol.prototype, {
toString: d(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }),
valueOf: d(function () { return validateSymbol(this); })
});
defineProperty(Symbol.prototype, Symbol.toPrimitive, d('',
function () { return validateSymbol(this); }));
defineProperty(Symbol.prototype, Symbol.toStringTag, d('c', 'Symbol'));
defineProperty(HiddenSymbol.prototype, Symbol.toPrimitive,
d('c', Symbol.prototype[Symbol.toPrimitive]));
defineProperty(HiddenSymbol.prototype, Symbol.toStringTag,
d('c', Symbol.prototype[Symbol.toStringTag]));
},{"./validate-symbol":50,"d":9}],50:[function(require,module,exports){
'use strict';
var isSymbol = require('./is-symbol');
module.exports = function (value) {
if (!isSymbol(value)) throw new TypeError(value + " is not a symbol");
return value;
};
},{"./is-symbol":48}],51:[function(require,module,exports){
// Thanks @mathiasbynens
// http://mathiasbynens.be/notes/javascript-unicode#iterating-over-symbols
'use strict';
var setPrototypeOf = require('es5-ext/object/set-prototype-of')
, d = require('d')
, Iterator = require('./')
, defineProperty = Object.defineProperty
, StringIterator;
StringIterator = module.exports = function (str) {
if (!(this instanceof StringIterator)) return new StringIterator(str);
str = String(str);
Iterator.call(this, str);
defineProperty(this, '__length__', d('', str.length));
};
if (setPrototypeOf) setPrototypeOf(StringIterator, Iterator);
StringIterator.prototype = Object.create(Iterator.prototype, {
constructor: d(StringIterator),
_next: d(function () {
if (!this.__list__) return;
if (this.__nextIndex__ < this.__length__) return this.__nextIndex__++;
this._unBind();
}),
_resolve: d(function (i) {
var char = this.__list__[i], code;
if (this.__nextIndex__ === this.__length__) return char;
code = char.charCodeAt(0);
if ((code >= 0xD800) && (code <= 0xDBFF)) return char + this.__list__[this.__nextIndex__++];
return char;
}),
toString: d(function () { return '[object String Iterator]'; })
});
},{"./":44,"d":9,"es5-ext/object/set-prototype-of":32}],52:[function(require,module,exports){
'use strict';
var isIterable = require('./is-iterable');
module.exports = function (value) {
if (!isIterable(value)) throw new TypeError(value + " is not iterable");
return value;
};
},{"./is-iterable":45}],53:[function(require,module,exports){
arguments[4][46][0].apply(exports,arguments)
},{"./is-implemented":54,"./polyfill":55,"dup":46}],54:[function(require,module,exports){
'use strict';
module.exports = function () {
var symbol;
if (typeof Symbol !== 'function') return false;
symbol = Symbol('test symbol');
try { String(symbol); } catch (e) { return false; }
if (typeof Symbol.iterator === 'symbol') return true;
// Return 'true' for polyfills
if (typeof Symbol.isConcatSpreadable !== 'object') return false;
if (typeof Symbol.isRegExp !== 'object') return false;
if (typeof Symbol.iterator !== 'object') return false;
if (typeof Symbol.toPrimitive !== 'object') return false;
if (typeof Symbol.toStringTag !== 'object') return false;
if (typeof Symbol.unscopables !== 'object') return false;
return true;
};
},{}],55:[function(require,module,exports){
'use strict';
var d = require('d')
, create = Object.create, defineProperties = Object.defineProperties
, generateName, Symbol;
generateName = (function () {
var created = create(null);
return function (desc) {
var postfix = 0;
while (created[desc + (postfix || '')]) ++postfix;
desc += (postfix || '');
created[desc] = true;
return '@@' + desc;
};
}());
module.exports = Symbol = function (description) {
var symbol;
if (this instanceof Symbol) {
throw new TypeError('TypeError: Symbol is not a constructor');
}
symbol = create(Symbol.prototype);
description = (description === undefined ? '' : String(description));
return defineProperties(symbol, {
__description__: d('', description),
__name__: d('', generateName(description))
});
};
Object.defineProperties(Symbol, {
create: d('', Symbol('create')),
hasInstance: d('', Symbol('hasInstance')),
isConcatSpreadable: d('', Symbol('isConcatSpreadable')),
isRegExp: d('', Symbol('isRegExp')),
iterator: d('', Symbol('iterator')),
toPrimitive: d('', Symbol('toPrimitive')),
toStringTag: d('', Symbol('toStringTag')),
unscopables: d('', Symbol('unscopables'))
});
defineProperties(Symbol.prototype, {
properToString: d(function () {
return 'Symbol (' + this.__description__ + ')';
}),
toString: d('', function () { return this.__name__; })
});
Object.defineProperty(Symbol.prototype, Symbol.toPrimitive, d('',
function (hint) {
throw new TypeError("Conversion of symbol objects is not allowed");
}));
Object.defineProperty(Symbol.prototype, Symbol.toStringTag, d('c', 'Symbol'));
},{"d":9}],56:[function(require,module,exports){
'use strict';
var d = require('d')
, callable = require('es5-ext/object/valid-callable')
, apply = Function.prototype.apply, call = Function.prototype.call
, create = Object.create, defineProperty = Object.defineProperty
, defineProperties = Object.defineProperties
, hasOwnProperty = Object.prototype.hasOwnProperty
, descriptor = { configurable: true, enumerable: false, writable: true }
, on, once, off, emit, methods, descriptors, base;
on = function (type, listener) {
var data;
callable(listener);
if (!hasOwnProperty.call(this, '__ee__')) {
data = descriptor.value = create(null);
defineProperty(this, '__ee__', descriptor);
descriptor.value = null;
} else {
data = this.__ee__;
}
if (!data[type]) data[type] = listener;
else if (typeof data[type] === 'object') data[type].push(listener);
else data[type] = [data[type], listener];
return this;
};
once = function (type, listener) {
var once, self;
callable(listener);
self = this;
on.call(this, type, once = function () {
off.call(self, type, once);
apply.call(listener, this, arguments);
});
once.__eeOnceListener__ = listener;
return this;
};
off = function (type, listener) {
var data, listeners, candidate, i;
callable(listener);
if (!hasOwnProperty.call(this, '__ee__')) return this;
data = this.__ee__;
if (!data[type]) return this;
listeners = data[type];
if (typeof listeners === 'object') {
for (i = 0; (candidate = listeners[i]); ++i) {
if ((candidate === listener) ||
(candidate.__eeOnceListener__ === listener)) {
if (listeners.length === 2) data[type] = listeners[i ? 0 : 1];
else listeners.splice(i, 1);
}
}
} else {
if ((listeners === listener) ||
(listeners.__eeOnceListener__ === listener)) {
delete data[type];
}
}
return this;
};
emit = function (type) {
var i, l, listener, listeners, args;
if (!hasOwnProperty.call(this, '__ee__')) return;
listeners = this.__ee__[type];
if (!listeners) return;
if (typeof listeners === 'object') {
l = arguments.length;
args = new Array(l - 1);
for (i = 1; i < l; ++i) args[i - 1] = arguments[i];
listeners = listeners.slice();
for (i = 0; (listener = listeners[i]); ++i) {
apply.call(listener, this, args);
}
} else {
switch (arguments.length) {
case 1:
call.call(listeners, this);
break;
case 2:
call.call(listeners, this, arguments[1]);
break;
case 3:
call.call(listeners, this, arguments[1], arguments[2]);
break;
default:
l = arguments.length;
args = new Array(l - 1);
for (i = 1; i < l; ++i) {
args[i - 1] = arguments[i];
}
apply.call(listeners, this, args);
}
}
};
methods = {
on: on,
once: once,
off: off,
emit: emit
};
descriptors = {
on: d(on),
once: d(once),
off: d(off),
emit: d(emit)
};
base = defineProperties({}, descriptors);
module.exports = exports = function (o) {
return (o == null) ? create(base) : defineProperties(Object(o), descriptors);
};
exports.methods = methods;
},{"d":9,"es5-ext/object/valid-callable":35}],57:[function(require,module,exports){
'use strict';
var clear = require('es5-ext/array/#/clear')
, eIndexOf = require('es5-ext/array/#/e-index-of')
, setPrototypeOf = require('es5-ext/object/set-prototype-of')
, callable = require('es5-ext/object/valid-callable')
, validValue = require('es5-ext/object/valid-value')
, d = require('d')
, ee = require('event-emitter')
, Symbol = require('es6-symbol')
, iterator = require('es6-iterator/valid-iterable')
, forOf = require('es6-iterator/for-of')
, Iterator = require('./lib/iterator')
, isNative = require('./is-native-implemented')
, call = Function.prototype.call, defineProperties = Object.defineProperties
, MapPoly;
module.exports = MapPoly = function (/*iterable*/) {
var iterable = arguments[0], keys, values;
if (!(this instanceof MapPoly)) return new MapPoly(iterable);
if (this.__mapKeysData__ !== undefined) {
throw new TypeError(this + " cannot be reinitialized");
}
if (iterable != null) iterator(iterable);
defineProperties(this, {
__mapKeysData__: d('c', keys = []),
__mapValuesData__: d('c', values = [])
});
if (!iterable) return;
forOf(iterable, function (value) {
var key = validValue(value)[0];
value = value[1];
if (eIndexOf.call(keys, key) !== -1) return;
keys.push(key);
values.push(value);
}, this);
};
if (isNative) {
if (setPrototypeOf) setPrototypeOf(MapPoly, Map);
MapPoly.prototype = Object.create(Map.prototype, {
constructor: d(MapPoly)
});
}
ee(defineProperties(MapPoly.prototype, {
clear: d(function () {
if (!this.__mapKeysData__.length) return;
clear.call(this.__mapKeysData__);
clear.call(this.__mapValuesData__);
this.emit('_clear');
}),
delete: d(function (key) {
var index = eIndexOf.call(this.__mapKeysData__, key);
if (index === -1) return false;
this.__mapKeysData__.splice(index, 1);
this.__mapValuesData__.splice(index, 1);
this.emit('_delete', index, key);
return true;
}),
entries: d(function () { return new Iterator(this, 'key+value'); }),
forEach: d(function (cb/*, thisArg*/) {
var thisArg = arguments[1], iterator, result;
callable(cb);
iterator = this.entries();
result = iterator._next();
while (result !== undefined) {
call.call(cb, thisArg, this.__mapValuesData__[result],
this.__mapKeysData__[result], this);
result = iterator._next();
}
}),
get: d(function (key) {
var index = eIndexOf.call(this.__mapKeysData__, key);
if (index === -1) return;
return this.__mapValuesData__[index];
}),
has: d(function (key) {
return (eIndexOf.call(this.__mapKeysData__, key) !== -1);
}),
keys: d(function () { return new Iterator(this, 'key'); }),
set: d(function (key, value) {
var index = eIndexOf.call(this.__mapKeysData__, key), emit;
if (index === -1) {
index = this.__mapKeysData__.push(key) - 1;
emit = true;
}
this.__mapValuesData__[index] = value;
if (emit) this.emit('_add', index, key);
return this;
}),
size: d.gs(function () { return this.__mapKeysData__.length; }),
values: d(function () { return new Iterator(this, 'value'); }),
toString: d(function () { return '[object Map]'; })
}));
Object.defineProperty(MapPoly.prototype, Symbol.iterator, d(function () {
return this.entries();
}));
Object.defineProperty(MapPoly.prototype, Symbol.toStringTag, d('c', 'Map'));
},{"./is-native-implemented":5,"./lib/iterator":7,"d":9,"es5-ext/array/#/clear":10,"es5-ext/array/#/e-index-of":11,"es5-ext/object/set-prototype-of":32,"es5-ext/object/valid-callable":35,"es5-ext/object/valid-value":36,"es6-iterator/for-of":42,"es6-iterator/valid-iterable":52,"es6-symbol":53,"event-emitter":56}],58:[function(require,module,exports){
(function (process,global){
// 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
},
helpers: { }
};
// Defaults
var noop = Rx.helpers.noop = function () { },
notDefined = Rx.helpers.notDefined = function (x) { return typeof x === 'undefined'; },
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; },
isFunction = Rx.helpers.isFunction = (function () {
var isFn = function (value) {
return typeof value == 'function' || false;
}
// fallback for older versions of Chrome and Safari
if (isFn(/x/)) {
isFn = function(value) {
return typeof value == 'function' && toString.call(value) == '[object Function]';
};
}
return isFn;
}());
function cloneArray(arr) { for(var a = [], i = 0, len = arr.length; i < len; i++) { a.push(arr[i]); } return a;}
Rx.config.longStackSupport = false;
var hasStacks = false;
try {
throw new Error();
} catch (e) {
hasStacks = !!e.stack;
}
// All code after this point will be filtered from stack traces reported by RxJS
var rStartingLine = captureLine(), rFileName;
var STACK_JUMP_SEPARATOR = "From previous event:";
function makeStackTraceLong(error, observable) {
// If possible, transform the error stack trace by removing Node and RxJS
// cruft, then concatenating with the stack trace of `observable`.
if (hasStacks &&
observable.stack &&
typeof error === "object" &&
error !== null &&
error.stack &&
error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1
) {
var stacks = [];
for (var o = observable; !!o; o = o.source) {
if (o.stack) {
stacks.unshift(o.stack);
}
}
stacks.unshift(error.stack);
var concatedStacks = stacks.join("\n" + STACK_JUMP_SEPARATOR + "\n");
error.stack = filterStackString(concatedStacks);
}
}
function filterStackString(stackString) {
var lines = stackString.split("\n"),
desiredLines = [];
for (var i = 0, len = lines.length; i < len; i++) {
var line = lines[i];
if (!isInternalFrame(line) && !isNodeFrame(line) && line) {
desiredLines.push(line);
}
}
return desiredLines.join("\n");
}
function isInternalFrame(stackLine) {
var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine);
if (!fileNameAndLineNumber) {
return false;
}
var fileName = fileNameAndLineNumber[0], lineNumber = fileNameAndLineNumber[1];
return fileName === rFileName &&
lineNumber >= rStartingLine &&
lineNumber <= rEndingLine;
}
function isNodeFrame(stackLine) {
return stackLine.indexOf("(module.js:") !== -1 ||
stackLine.indexOf("(node.js:") !== -1;
}
function captureLine() {
if (!hasStacks) { return; }
try {
throw new Error();
} catch (e) {
var lines = e.stack.split("\n");
var firstLine = lines[0].indexOf("@") > 0 ? lines[1] : lines[2];
var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine);
if (!fileNameAndLineNumber) { return; }
rFileName = fileNameAndLineNumber[0];
return fileNameAndLineNumber[1];
}
}
function getFileNameAndLineNumber(stackLine) {
// Named functions: "at functionName (filename:lineNumber:columnNumber)"
var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine);
if (attempt1) { return [attempt1[1], Number(attempt1[2])]; }
// Anonymous functions: "at filename:lineNumber:columnNumber"
var attempt2 = /at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine);
if (attempt2) { return [attempt2[1], Number(attempt2[2])]; }
// Firefox style: "function@filename:lineNumber or @filename:lineNumber"
var attempt3 = /.*@(.+):(\d+)$/.exec(stackLine);
if (attempt3) { return [attempt3[1], Number(attempt3[2])]; }
}
var EmptyError = Rx.EmptyError = function() {
this.message = 'Sequence contains no elements.';
Error.call(this);
};
EmptyError.prototype = Error.prototype;
var ObjectDisposedError = Rx.ObjectDisposedError = function() {
this.message = 'Object has been disposed';
Error.call(this);
};
ObjectDisposedError.prototype = Error.prototype;
var ArgumentOutOfRangeError = Rx.ArgumentOutOfRangeError = function () {
this.message = 'Argument out of range';
Error.call(this);
};
ArgumentOutOfRangeError.prototype = Error.prototype;
var NotSupportedError = Rx.NotSupportedError = function (message) {
this.message = message || 'This operation is not supported';
Error.call(this);
};
NotSupportedError.prototype = Error.prototype;
var NotImplementedError = Rx.NotImplementedError = function (message) {
this.message = message || 'This operation is not implemented';
Error.call(this);
};
NotImplementedError.prototype = Error.prototype;
var notImplemented = Rx.helpers.notImplemented = function () {
throw new NotImplementedError();
};
var notSupported = Rx.helpers.notSupported = function () {
throw new NotSupportedError();
};
// 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 = Rx.doneEnumerator = { done: true, value: undefined };
var isIterable = Rx.helpers.isIterable = function (o) {
return o[$iterator$] !== undefined;
}
var isArrayLike = Rx.helpers.isArrayLike = function (o) {
return o && o.length !== undefined;
}
Rx.helpers.iterator = $iterator$;
var bindCallback = Rx.internals.bindCallback = function (func, thisArg, argCount) {
if (typeof thisArg === 'undefined') { return func; }
switch(argCount) {
case 0:
return function() {
return func.call(thisArg)
};
case 1:
return function(arg) {
return func.call(thisArg, arg);
}
case 2:
return function(value, index) {
return func.call(thisArg, value, index);
};
case 3:
return function(value, index, collection) {
return func.call(thisArg, value, index, collection);
};
}
return function() {
return func.apply(thisArg, arguments);
};
};
/** Used to determine if values are of the language type Object */
var dontEnums = ['toString',
'toLocaleString',
'valueOf',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'constructor'],
dontEnumsLength = dontEnums.length;
/** `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
supportNodeClass,
errorProto = Error.prototype,
objectProto = Object.prototype,
stringProto = String.prototype,
propertyIsEnumerable = objectProto.propertyIsEnumerable;
try {
supportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
} catch (e) {
supportNodeClass = true;
}
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));
var isObject = Rx.internals.isObject = function(value) {
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 = dontEnumsLength;
if (object === (ctor && ctor.prototype)) {
var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object),
nonEnum = nonEnumProps[className];
}
while (++index < length) {
key = dontEnums[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';
}
var isArguments = function(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;
};
}
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;
var 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 hasProp = {}.hasOwnProperty,
slice = Array.prototype.slice;
var inherits = this.inherits = Rx.internals.inherits = function (child, parent) {
function __() { this.constructor = child; }
__.prototype = parent.prototype;
child.prototype = new __();
};
var addProperties = Rx.internals.addProperties = function (obj) {
for(var sources = [], i = 1, len = arguments.length; i < len; i++) { sources.push(arguments[i]); }
for (var idx = 0, ln = sources.length; idx < ln; idx++) {
var source = sources[idx];
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));
});
};
function arrayInitialize(count, factory) {
var a = new Array(count);
for (var i = 0; i < count; i++) {
a[i] = factory();
}
return a;
}
var errorObj = {e: {}};
var tryCatchTarget;
function tryCatcher() {
try {
return tryCatchTarget.apply(this, arguments);
} catch (e) {
errorObj.e = e;
return errorObj;
}
}
function tryCatch(fn) {
if (!isFunction(fn)) { throw new TypeError('fn must be a function'); }
tryCatchTarget = fn;
return tryCatcher;
}
function thrower(e) {
throw e;
}
// Collections
function IndexedItem(id, value) {
this.id = id;
this.value = value;
}
IndexedItem.prototype.compareTo = function (other) {
var c = this.value.compareTo(other.value);
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) {
+index || (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];
this.items[this.length] = undefined;
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 () {
var args = [], i, len;
if (Array.isArray(arguments[0])) {
args = arguments[0];
len = args.length;
} else {
len = arguments.length;
args = new Array(len);
for(i = 0; i < len; i++) { args[i] = arguments[i]; }
}
for(i = 0; i < len; i++) {
if (!isDisposable(args[i])) { throw new TypeError('Not a disposable'); }
}
this.disposables = args;
this.isDisposed = false;
this.length = args.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 len = this.disposables.length, currentDisposables = new Array(len);
for(var i = 0; i < len; i++) { currentDisposables[i] = this.disposables[i]; }
this.disposables = [];
this.length = 0;
for (i = 0; i < len; i++) {
currentDisposables[i].dispose();
}
}
};
/**
* Provides a set of static methods for creating Disposables.
* @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 };
/**
* Validates whether the given object is a disposable
* @param {Object} Object to test whether it has a dispose method
* @returns {Boolean} true if a disposable object, else false.
*/
var isDisposable = Disposable.isDisposable = function (d) {
return d && isFunction(d.dispose);
};
var checkDisposed = Disposable.checkDisposed = function (disposable) {
if (disposable.isDisposed) { throw new ObjectDisposedError(); }
};
// Single assignment
var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = function () {
this.isDisposed = false;
this.current = null;
};
SingleAssignmentDisposable.prototype.getDisposable = function () {
return this.current;
};
SingleAssignmentDisposable.prototype.setDisposable = function (value) {
if (this.current) { throw new Error('Disposable has already been assigned'); }
var shouldDispose = this.isDisposed;
!shouldDispose && (this.current = value);
shouldDispose && value && value.dispose();
};
SingleAssignmentDisposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var old = this.current;
this.current = null;
}
old && old.dispose();
};
// Multiple assignment disposable
var SerialDisposable = Rx.SerialDisposable = function () {
this.isDisposed = false;
this.current = null;
};
SerialDisposable.prototype.getDisposable = function () {
return this.current;
};
SerialDisposable.prototype.setDisposable = function (value) {
var shouldDispose = this.isDisposed;
if (!shouldDispose) {
var old = this.current;
this.current = value;
}
old && old.dispose();
shouldDispose && value && value.dispose();
};
SerialDisposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var old = this.current;
this.current = null;
}
old && old.dispose();
};
/**
* 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 && !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 && !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;
}
function scheduleItem(s, self) {
if (!self.isDisposed) {
self.isDisposed = true;
self.disposable.dispose();
}
}
ScheduledDisposable.prototype.dispose = function () {
this.scheduler.scheduleWithState(this, scheduleItem);
};
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;
}
/** Determines whether the given object is a scheduler */
Scheduler.isScheduler = function (s) {
return s instanceof Scheduler;
}
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, isScheduler = Scheduler.isScheduler;
(function (schedulerProto) {
function invokeRecImmediate(scheduler, pair) {
var state = pair[0], action = pair[1], group = new CompositeDisposable();
function recursiveAction(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[0], action = pair[1], group = new CompositeDisposable();
function recursiveAction(state1) {
action(state1, function (state2, dueTime1) {
var isAdded = false, isDone = false,
d = scheduler[method](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([state, 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([state, 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([state, 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) {
if (typeof root.setInterval === 'undefined') { throw new NotSupportedError(); }
period = normalizeTime(period);
var s = state, id = root.setInterval(function () { s = action(s); }, period);
return disposableCreate(function () { root.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); }
return new Scheduler(defaultNow, scheduleNow, notSupported, notSupported);
}());
/**
* Gets a scheduler that schedules work as soon as possible on the current thread.
*/
var currentThreadScheduler = Scheduler.currentThread = (function () {
var queue;
function runTrampoline () {
while (queue.length > 0) {
var item = queue.dequeue();
!item.isCancelled() && item.invoke();
}
}
function scheduleNow(state, action) {
var si = new ScheduledItem(this, state, action, this.now());
if (!queue) {
queue = new PriorityQueue(4);
queue.enqueue(si);
var result = tryCatch(runTrampoline)();
queue = null;
if (result === errorObj) { return thrower(result.e); }
} else {
queue.enqueue(si);
}
return si.disposable;
}
var currentScheduler = new Scheduler(defaultNow, scheduleNow, notSupported, notSupported);
currentScheduler.scheduleRequired = function () { return !queue; };
return currentScheduler;
}());
var scheduleMethod, clearMethod;
var localTimer = (function () {
var localSetTimeout, localClearTimeout = noop;
if (!!root.setTimeout) {
localSetTimeout = root.setTimeout;
localClearTimeout = root.clearTimeout;
} else if (!!root.WScript) {
localSetTimeout = function (fn, time) {
root.WScript.Sleep(time);
fn();
};
} else {
throw new NotSupportedError();
}
return {
setTimeout: localSetTimeout,
clearTimeout: localClearTimeout
};
}());
var localSetTimeout = localTimer.setTimeout,
localClearTimeout = localTimer.clearTimeout;
(function () {
var nextHandle = 1, tasksByHandle = {}, currentlyRunning = false;
clearMethod = function (handle) {
delete tasksByHandle[handle];
};
function runTask(handle) {
if (currentlyRunning) {
localSetTimeout(function () { runTask(handle) }, 0);
} else {
var task = tasksByHandle[handle];
if (task) {
currentlyRunning = true;
var result = tryCatch(task)();
clearMethod(handle);
currentlyRunning = false;
if (result === errorObj) { return thrower(result.e); }
}
}
}
var reNative = RegExp('^' +
String(toString)
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
.replace(/toString| for [^\]]+/g, '.*?') + '$'
);
var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' &&
!reNative.test(setImmediate) && setImmediate;
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, setImmediate, nextTick, postMessage, MessageChannel, script readystatechanged, setTimeout
if (isFunction(setImmediate)) {
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
setImmediate(function () { runTask(id); });
return id;
};
} else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
process.nextTick(function () { runTask(id); });
return id;
};
} else if (postMessageSupported()) {
var MSG_PREFIX = 'ms.rx.schedule' + Math.random();
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) {
runTask(event.data.substring(MSG_PREFIX.length));
}
}
if (root.addEventListener) {
root.addEventListener('message', onGlobalPostMessage, false);
} else if (root.attachEvent) {
root.attachEvent('onmessage', onGlobalPostMessage);
} else {
root.onmessage = onGlobalPostMessage;
}
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
root.postMessage(MSG_PREFIX + currentId, '*');
return id;
};
} else if (!!root.MessageChannel) {
var channel = new root.MessageChannel();
channel.port1.onmessage = function (e) { runTask(e.data); };
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
channel.port2.postMessage(id);
return id;
};
} else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) {
scheduleMethod = function (action) {
var scriptElement = root.document.createElement('script');
var id = nextHandle++;
tasksByHandle[id] = action;
scriptElement.onreadystatechange = function () {
runTask(id);
scriptElement.onreadystatechange = null;
scriptElement.parentNode.removeChild(scriptElement);
scriptElement = null;
};
root.document.documentElement.appendChild(scriptElement);
return id;
};
} else {
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
localSetTimeout(function () {
runTask(id);
}, 0);
return id;
};
}
}());
/**
* Gets a scheduler that schedules work via a timed callback based upon platform.
*/
var timeoutScheduler = Scheduler.timeout = Scheduler['default'] = (function () {
function scheduleNow(state, action) {
var scheduler = this, disposable = new SingleAssignmentDisposable();
var id = scheduleMethod(function () {
!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), disposable = new SingleAssignmentDisposable();
if (dt === 0) { return scheduler.scheduleWithState(state, action); }
var id = localSetTimeout(function () {
!disposable.isDisposed && disposable.setDisposable(action(scheduler, state));
}, dt);
return new CompositeDisposable(disposable, disposableCreate(function () {
localClearTimeout(id);
}));
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
})();
var CatchScheduler = (function (__super__) {
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__);
function CatchScheduler(scheduler, handler) {
this._scheduler = scheduler;
this._handler = handler;
this._recursiveOriginal = null;
this._recursiveWrapper = null;
__super__.call(this, this._scheduler.now.bind(this._scheduler), scheduleNow, scheduleRelative, scheduleAbsolute);
}
CatchScheduler.prototype._clone = function (scheduler) {
return new CatchScheduler(scheduler, this._handler);
};
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;
}
};
};
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;
};
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, value, exception, accept, acceptObservable, toString) {
this.kind = kind;
this.value = value;
this.exception = exception;
this._accept = accept;
this._acceptObservable = acceptObservable;
this.toString = toString;
}
/**
* 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 self = this;
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.scheduleWithState(self, function (_, notification) {
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) {
return new Notification('N', value, null, _accept, _acceptObservable, toString);
};
}());
/**
* 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 (e) {
return new Notification('E', null, e, _accept, _acceptObservable, toString);
};
}());
/**
* 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 () {
return new Notification('C', null, null, _accept, _acceptObservable, toString);
};
}());
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 (o) {
var e = sources[$iterator$]();
var isDisposed, subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
if (isDisposed) { return; }
try {
var currentItem = e.next();
} catch (ex) {
return o.onError(ex);
}
if (currentItem.done) {
return o.onCompleted();
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(
function(x) { o.onNext(x); },
function(err) { o.onError(err); },
self)
);
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
Enumerable.prototype.catchError = function () {
var sources = this;
return new AnonymousObservable(function (o) {
var e = sources[$iterator$]();
var isDisposed, subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursiveWithState(null, function (lastException, self) {
if (isDisposed) { return; }
try {
var currentItem = e.next();
} catch (ex) {
return observer.onError(ex);
}
if (currentItem.done) {
if (lastException !== null) {
o.onError(lastException);
} else {
o.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(
function(x) { o.onNext(x); },
self,
function() { o.onCompleted(); }));
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
Enumerable.prototype.catchErrorWhen = function (notificationHandler) {
var sources = this;
return new AnonymousObservable(function (o) {
var exceptions = new Subject(),
notifier = new Subject(),
handled = notificationHandler(exceptions),
notificationDisposable = handled.subscribe(notifier);
var e = sources[$iterator$]();
var isDisposed,
lastException,
subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
if (isDisposed) { return; }
try {
var currentItem = e.next();
} catch (ex) {
return o.onError(ex);
}
if (currentItem.done) {
if (lastException) {
o.onError(lastException);
} else {
o.onCompleted();
}
return;
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var outer = new SingleAssignmentDisposable();
var inner = new SingleAssignmentDisposable();
subscription.setDisposable(new CompositeDisposable(inner, outer));
outer.setDisposable(currentValue.subscribe(
function(x) { o.onNext(x); },
function (exn) {
inner.setDisposable(notifier.subscribe(self, function(ex) {
o.onError(ex);
}, function() {
o.onCompleted();
}));
exceptions.onNext(exn);
},
function() { o.onCompleted(); }));
});
return new CompositeDisposable(notificationDisposable, 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 enumerableOf = Enumerable.of = function (source, selector, thisArg) {
if (selector) {
var selectorFn = bindCallback(selector, thisArg, 3);
}
return new Enumerable(function () {
var index = -1;
return new Enumerator(
function () {
return ++index < source.length ?
{ done: false, value: !selector ? source[index] : selectorFn(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.
* @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.
* @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, thisArg) {
return new AnonymousObserver(function (x) {
return handler.call(thisArg, notificationCreateOnNext(x));
}, function (e) {
return handler.call(thisArg, notificationCreateOnError(e));
}, function () {
return handler.call(thisArg, 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.prototype.notifyOn = function (scheduler) {
return new ObserveOnObserver(scheduler, this);
};
Observer.prototype.makeSafe = function(disposable) {
return new AnonymousSafeObserver(this._onNext, this._onError, this._onCompleted, disposable);
};
/**
* 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.
*/
function AbstractObserver() {
this.isStopped = false;
__super__.call(this);
}
// Must be implemented by other observers
AbstractObserver.prototype.next = notImplemented;
AbstractObserver.prototype.error = notImplemented;
AbstractObserver.prototype.completed = notImplemented;
/**
* Notifies the observer of a new element in the sequence.
* @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.
* @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 (error) {
this._onError(error);
};
/**
* 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();
var res = tryCatch(this._observer.onNext).call(this._observer, value);
this._state = 0;
res === errorObj && thrower(res.e);
};
CheckedObserverPrototype.onError = function (err) {
this.checkAccess();
var res = tryCatch(this._observer.onError).call(this._observer, err);
this._state = 2;
res === errorObj && thrower(res.e);
};
CheckedObserverPrototype.onCompleted = function () {
this.checkAccess();
var res = tryCatch(this._observer.onCompleted).call(this._observer);
this._state = 2;
res === errorObj && thrower(res.e);
};
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 (e) {
var self = this;
this.queue.push(function () { self.observer.onError(e); });
};
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));
var ObserveOnObserver = (function (__super__) {
inherits(ObserveOnObserver, __super__);
function ObserveOnObserver(scheduler, observer, cancel) {
__super__.call(this, scheduler, observer);
this._cancel = cancel;
}
ObserveOnObserver.prototype.next = function (value) {
__super__.prototype.next.call(this, value);
this.ensureActive();
};
ObserveOnObserver.prototype.error = function (e) {
__super__.prototype.error.call(this, e);
this.ensureActive();
};
ObserveOnObserver.prototype.completed = function () {
__super__.prototype.completed.call(this);
this.ensureActive();
};
ObserveOnObserver.prototype.dispose = function () {
__super__.prototype.dispose.call(this);
this._cancel && this._cancel.dispose();
this._cancel = null;
};
return ObserveOnObserver;
})(ScheduledObserver);
var observableProto;
/**
* Represents a push-style collection.
*/
var Observable = Rx.Observable = (function () {
function Observable(subscribe) {
if (Rx.config.longStackSupport && hasStacks) {
try {
throw new Error();
} catch (e) {
this.stack = e.stack.substring(e.stack.indexOf("\n") + 1);
}
var self = this;
this._subscribe = function (observer) {
var oldOnError = observer.onError.bind(observer);
observer.onError = function (err) {
makeStackTraceLong(err, self);
oldOnError(err);
};
return subscribe.call(self, observer);
};
} else {
this._subscribe = subscribe;
}
}
observableProto = Observable.prototype;
/**
* Subscribes an observer to the observable sequence.
* @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} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribe = observableProto.forEach = function (observerOrOnNext, onError, onCompleted) {
return this._subscribe(typeof observerOrOnNext === 'object' ?
observerOrOnNext :
observerCreate(observerOrOnNext, onError, onCompleted));
};
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onNext The function to invoke on each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribeOnNext = function (onNext, thisArg) {
return this._subscribe(observerCreate(typeof thisArg !== 'undefined' ? function(x) { onNext.call(thisArg, x); } : onNext));
};
/**
* Subscribes to an exceptional condition in the sequence with an optional "this" argument.
* @param {Function} onError The function to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribeOnError = function (onError, thisArg) {
return this._subscribe(observerCreate(null, typeof thisArg !== 'undefined' ? function(e) { onError.call(thisArg, e); } : onError));
};
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribeOnCompleted = function (onCompleted, thisArg) {
return this._subscribe(observerCreate(null, null, typeof thisArg !== 'undefined' ? function() { onCompleted.call(thisArg); } : onCompleted));
};
return Observable;
})();
var ObservableBase = Rx.ObservableBase = (function (__super__) {
inherits(ObservableBase, __super__);
function fixSubscriber(subscriber) {
return subscriber && isFunction(subscriber.dispose) ? subscriber :
isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty;
}
function setDisposable(s, state) {
var ado = state[0], self = state[1];
var sub = tryCatch(self.subscribeCore).call(self, ado);
if (sub === errorObj) {
if(!ado.fail(errorObj.e)) { return thrower(errorObj.e); }
}
ado.setDisposable(fixSubscriber(sub));
}
function subscribe(observer) {
var ado = new AutoDetachObserver(observer), state = [ado, this];
if (currentThreadScheduler.scheduleRequired()) {
currentThreadScheduler.scheduleWithState(state, setDisposable);
} else {
setDisposable(null, state);
}
return ado;
}
function ObservableBase() {
__super__.call(this, subscribe);
}
ObservableBase.prototype.subscribeCore = notImplemented;
return ObservableBase;
}(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));
}, source);
};
/**
* 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;
}, source);
};
/**
* 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 observableDefer(function () {
var subject = new Rx.AsyncSubject();
promise.then(
function (value) {
subject.onNext(value);
subject.onCompleted();
},
subject.onError.bind(subject));
return subject;
});
};
/*
* 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 NotSupportedError('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;
}, reject, function () {
hasValue && resolve(value);
});
});
};
var ToArrayObservable = (function(__super__) {
inherits(ToArrayObservable, __super__);
function ToArrayObservable(source) {
this.source = source;
__super__.call(this);
}
ToArrayObservable.prototype.subscribeCore = function(observer) {
return this.source.subscribe(new ToArrayObserver(observer));
};
return ToArrayObservable;
}(ObservableBase));
function ToArrayObserver(observer) {
this.observer = observer;
this.a = [];
this.isStopped = false;
}
ToArrayObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.a.push(x); } };
ToArrayObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
}
};
ToArrayObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onNext(this.a);
this.observer.onCompleted();
}
};
ToArrayObserver.prototype.dispose = function () { this.isStopped = true; }
ToArrayObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
return true;
}
return false;
};
/**
* Creates an array from an observable sequence.
* @returns {Observable} An observable sequence containing a single element with a list containing all the elements of the source sequence.
*/
observableProto.toArray = function () {
return new ToArrayObservable(this);
};
/**
* 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, parent) {
return new AnonymousObservable(subscribe, parent);
};
/**
* 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);
});
};
var EmptyObservable = (function(__super__) {
inherits(EmptyObservable, __super__);
function EmptyObservable(scheduler) {
this.scheduler = scheduler;
__super__.call(this);
}
EmptyObservable.prototype.subscribeCore = function (observer) {
var sink = new EmptySink(observer, this);
return sink.run();
};
function EmptySink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
function scheduleItem(s, state) {
state.onCompleted();
}
EmptySink.prototype.run = function () {
return this.parent.scheduler.scheduleWithState(this.observer, scheduleItem);
};
return EmptyObservable;
}(ObservableBase));
/**
* 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 EmptyObservable(scheduler);
};
var FromObservable = (function(__super__) {
inherits(FromObservable, __super__);
function FromObservable(iterable, mapper, scheduler) {
this.iterable = iterable;
this.mapper = mapper;
this.scheduler = scheduler;
__super__.call(this);
}
FromObservable.prototype.subscribeCore = function (observer) {
var sink = new FromSink(observer, this);
return sink.run();
};
return FromObservable;
}(ObservableBase));
var FromSink = (function () {
function FromSink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
FromSink.prototype.run = function () {
var list = Object(this.parent.iterable),
it = getIterable(list),
observer = this.observer,
mapper = this.parent.mapper;
function loopRecursive(i, recurse) {
try {
var next = it.next();
} catch (e) {
return observer.onError(e);
}
if (next.done) {
return observer.onCompleted();
}
var result = next.value;
if (mapper) {
try {
result = mapper(result, i);
} catch (e) {
return observer.onError(e);
}
}
observer.onNext(result);
recurse(i + 1);
}
return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive);
};
return FromSink;
}());
var maxSafeInteger = Math.pow(2, 53) - 1;
function StringIterable(str) {
this._s = s;
}
StringIterable.prototype[$iterator$] = function () {
return new StringIterator(this._s);
};
function StringIterator(str) {
this._s = s;
this._l = s.length;
this._i = 0;
}
StringIterator.prototype[$iterator$] = function () {
return this;
};
StringIterator.prototype.next = function () {
return this._i < this._l ? { done: false, value: this._s.charAt(this._i++) } : doneEnumerator;
};
function ArrayIterable(a) {
this._a = a;
}
ArrayIterable.prototype[$iterator$] = function () {
return new ArrayIterator(this._a);
};
function ArrayIterator(a) {
this._a = a;
this._l = toLength(a);
this._i = 0;
}
ArrayIterator.prototype[$iterator$] = function () {
return this;
};
ArrayIterator.prototype.next = function () {
return this._i < this._l ? { done: false, value: this._a[this._i++] } : doneEnumerator;
};
function numberIsFinite(value) {
return typeof value === 'number' && root.isFinite(value);
}
function isNan(n) {
return n !== n;
}
function getIterable(o) {
var i = o[$iterator$], it;
if (!i && typeof o === 'string') {
it = new StringIterable(o);
return it[$iterator$]();
}
if (!i && o.length !== undefined) {
it = new ArrayIterable(o);
return it[$iterator$]();
}
if (!i) { throw new TypeError('Object is not iterable'); }
return o[$iterator$]();
}
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;
}
/**
* 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.
*/
var observableFrom = Observable.from = function (iterable, mapFn, thisArg, scheduler) {
if (iterable == null) {
throw new Error('iterable cannot be null.')
}
if (mapFn && !isFunction(mapFn)) {
throw new Error('mapFn when provided must be a function');
}
if (mapFn) {
var mapper = bindCallback(mapFn, thisArg, 2);
}
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new FromObservable(iterable, mapper, scheduler);
}
var FromArrayObservable = (function(__super__) {
inherits(FromArrayObservable, __super__);
function FromArrayObservable(args, scheduler) {
this.args = args;
this.scheduler = scheduler;
__super__.call(this);
}
FromArrayObservable.prototype.subscribeCore = function (observer) {
var sink = new FromArraySink(observer, this);
return sink.run();
};
return FromArrayObservable;
}(ObservableBase));
function FromArraySink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
FromArraySink.prototype.run = function () {
var observer = this.observer, args = this.parent.args, len = args.length;
function loopRecursive(i, recurse) {
if (i < len) {
observer.onNext(args[i]);
recurse(i + 1);
} else {
observer.onCompleted();
}
}
return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive);
};
/**
* Converts an array to an observable sequence, using an optional scheduler to enumerate the array.
* @deprecated use Observable.from or Observable.of
* @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 FromArrayObservable(array, scheduler)
};
/**
* 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 (o) {
var first = true;
return scheduler.scheduleRecursiveWithState(initialState, function (state, self) {
var hasResult, result;
try {
if (first) {
first = false;
} else {
state = iterate(state);
}
hasResult = condition(state);
hasResult && (result = resultSelector(state));
} catch (e) {
return o.onError(e);
}
if (hasResult) {
o.onNext(result);
self(state);
} else {
o.onCompleted();
}
});
});
};
function observableOf (scheduler, array) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new FromArrayObservable(array, scheduler);
}
/**
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
* @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 new FromArrayObservable(args, currentThreadScheduler);
};
/**
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
* @param {Scheduler} scheduler A scheduler to use for scheduling the arguments.
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
*/
Observable.ofWithScheduler = function (scheduler) {
var len = arguments.length, args = new Array(len - 1);
for(var i = 1; i < len; i++) { args[i - 1] = arguments[i]; }
return new FromArrayObservable(args, scheduler);
};
/**
* Creates an Observable sequence from changes to an array using Array.observe.
* @param {Array} array An array to observe changes.
* @returns {Observable} An observable sequence containing changes to an array from Array.observe.
*/
Observable.ofArrayChanges = function(array) {
if (!Array.isArray(array)) { throw new TypeError('Array.observe only accepts arrays.'); }
if (typeof Array.observe !== 'function' && typeof Array.unobserve !== 'function') { throw new TypeError('Array.observe is not supported on your platform') }
return new AnonymousObservable(function(observer) {
function observerFn(changes) {
for(var i = 0, len = changes.length; i < len; i++) {
observer.onNext(changes[i]);
}
}
Array.observe(array, observerFn);
return function () {
Array.unobserve(array, observerFn);
};
});
};
/**
* Creates an Observable sequence from changes to an object using Object.observe.
* @param {Object} obj An object to observe changes.
* @returns {Observable} An observable sequence containing changes to an object from Object.observe.
*/
Observable.ofObjectChanges = function(obj) {
if (obj == null) { throw new TypeError('object must not be null or undefined.'); }
if (typeof Object.observe !== 'function' && typeof Object.unobserve !== 'function') { throw new TypeError('Array.observe is not supported on your platform') }
return new AnonymousObservable(function(observer) {
function observerFn(changes) {
for(var i = 0, len = changes.length; i < len; i++) {
observer.onNext(changes[i]);
}
}
Object.observe(obj, observerFn);
return function () {
Object.unobserve(obj, observerFn);
};
});
};
var NeverObservable = (function(__super__) {
inherits(NeverObservable, __super__);
function NeverObservable() {
__super__.call(this);
}
NeverObservable.prototype.subscribeCore = function (observer) {
return disposableEmpty;
};
return NeverObservable;
}(ObservableBase));
/**
* 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 NeverObservable();
};
var PairsObservable = (function(__super__) {
inherits(PairsObservable, __super__);
function PairsObservable(obj, scheduler) {
this.obj = obj;
this.keys = Object.keys(obj);
this.scheduler = scheduler;
__super__.call(this);
}
PairsObservable.prototype.subscribeCore = function (observer) {
var sink = new PairsSink(observer, this);
return sink.run();
};
return PairsObservable;
}(ObservableBase));
function PairsSink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
PairsSink.prototype.run = function () {
var observer = this.observer, obj = this.parent.obj, keys = this.parent.keys, len = keys.length;
function loopRecursive(i, recurse) {
if (i < len) {
var key = keys[i];
observer.onNext([key, obj[key]]);
recurse(i + 1);
} else {
observer.onCompleted();
}
}
return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive);
};
/**
* Convert an object into an observable sequence of [key, value] pairs.
* @param {Object} obj The object to inspect.
* @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.
* @returns {Observable} An observable sequence of [key, value] pairs from the object.
*/
Observable.pairs = function (obj, scheduler) {
scheduler || (scheduler = currentThreadScheduler);
return new PairsObservable(obj, scheduler);
};
var RangeObservable = (function(__super__) {
inherits(RangeObservable, __super__);
function RangeObservable(start, count, scheduler) {
this.start = start;
this.count = count;
this.scheduler = scheduler;
__super__.call(this);
}
RangeObservable.prototype.subscribeCore = function (observer) {
var sink = new RangeSink(observer, this);
return sink.run();
};
return RangeObservable;
}(ObservableBase));
var RangeSink = (function () {
function RangeSink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
RangeSink.prototype.run = function () {
var start = this.parent.start, count = this.parent.count, observer = this.observer;
function loopRecursive(i, recurse) {
if (i < count) {
observer.onNext(start + i);
recurse(i + 1);
} else {
observer.onCompleted();
}
}
return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive);
};
return RangeSink;
}());
/**
* Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages.
* @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 RangeObservable(start, count, scheduler);
};
var RepeatObservable = (function(__super__) {
inherits(RepeatObservable, __super__);
function RepeatObservable(value, repeatCount, scheduler) {
this.value = value;
this.repeatCount = repeatCount == null ? -1 : repeatCount;
this.scheduler = scheduler;
__super__.call(this);
}
RepeatObservable.prototype.subscribeCore = function (observer) {
var sink = new RepeatSink(observer, this);
return sink.run();
};
return RepeatObservable;
}(ObservableBase));
function RepeatSink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
RepeatSink.prototype.run = function () {
var observer = this.observer, value = this.parent.value;
function loopRecursive(i, recurse) {
if (i === -1 || i > 0) {
observer.onNext(value);
i > 0 && i--;
}
if (i === 0) { return observer.onCompleted(); }
recurse(i);
}
return this.parent.scheduler.scheduleRecursiveWithState(this.parent.repeatCount, loopRecursive);
};
/**
* Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages.
* @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 new RepeatObservable(value, repeatCount, scheduler);
};
var JustObservable = (function(__super__) {
inherits(JustObservable, __super__);
function JustObservable(value, scheduler) {
this.value = value;
this.scheduler = scheduler;
__super__.call(this);
}
JustObservable.prototype.subscribeCore = function (observer) {
var sink = new JustSink(observer, this);
return sink.run();
};
function JustSink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
function scheduleItem(s, state) {
var value = state[0], observer = state[1];
observer.onNext(value);
observer.onCompleted();
}
JustSink.prototype.run = function () {
return this.parent.scheduler.scheduleWithState([this.parent.value, this.observer], scheduleItem);
};
return JustObservable;
}(ObservableBase));
/**
* Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages.
* There is an alias called 'just' or browsers <IE9.
* @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.just = Observable.returnValue = function (value, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new JustObservable(value, scheduler);
};
var ThrowObservable = (function(__super__) {
inherits(ThrowObservable, __super__);
function ThrowObservable(error, scheduler) {
this.error = error;
this.scheduler = scheduler;
__super__.call(this);
}
ThrowObservable.prototype.subscribeCore = function (observer) {
var sink = new ThrowSink(observer, this);
return sink.run();
};
function ThrowSink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
function scheduleItem(s, state) {
var error = state[0], observer = state[1];
observer.onError(error);
}
ThrowSink.prototype.run = function () {
return this.parent.scheduler.scheduleWithState([this.parent.error, this.observer], scheduleItem);
};
return ThrowObservable;
}(ObservableBase));
/**
* 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 'throwError' for browsers <IE9.
* @param {Mixed} error 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.throwError = Observable.throwException = function (error, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new ThrowObservable(error, scheduler);
};
/**
* Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime.
* @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();
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 = [];
if (Array.isArray(arguments[0])) {
items = arguments[0];
} else {
for(var i = 0, len = arguments.length; i < len; i++) { items.push(arguments[i]); }
}
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 (o) {
var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable();
subscription.setDisposable(d1);
d1.setDisposable(source.subscribe(function (x) { o.onNext(x); }, function (e) {
try {
var result = handler(e);
} catch (ex) {
return o.onError(ex);
}
isPromise(result) && (result = observableFromPromise(result));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(result.subscribe(o));
}, function (x) { o.onCompleted(x); }));
return subscription;
}, source);
}
/**
* 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.catchError = 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.
* @param {Array | Arguments} args Arguments or an array to use as the next sequence if an error occurs.
* @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.
*/
var observableCatch = Observable.catchError = Observable['catch'] = Observable.catchException = function () {
var items = [];
if (Array.isArray(arguments[0])) {
items = arguments[0];
} else {
for(var i = 0, len = arguments.length; i < len; i++) { items.push(arguments[i]); }
}
return enumerableOf(items).catchError();
};
/**
* 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 len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
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 len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
var resultSelector = args.pop();
Array.isArray(args[0]) && (args = args[0]);
return new AnonymousObservable(function (o) {
var n = args.length,
falseFactory = function () { return false; },
hasValue = arrayInitialize(n, falseFactory),
hasValueAll = false,
isDone = arrayInitialize(n, falseFactory),
values = new Array(n);
function next(i) {
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
try {
var res = resultSelector.apply(null, values);
} catch (e) {
return o.onError(e);
}
o.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
o.onCompleted();
}
}
function done (i) {
isDone[i] = true;
isDone.every(identity) && o.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);
},
function(e) { o.onError(e); },
function () { done(i); }
));
subscriptions[i] = sad;
}(idx));
}
return new CompositeDisposable(subscriptions);
}, this);
};
/**
* Concatenates all the observable sequences. This takes in either an array or variable arguments to concatenate.
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
observableProto.concat = function () {
for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
args.unshift(this);
return observableConcat.apply(null, args);
};
/**
* Concatenates all the observable sequences.
* @param {Array | Arguments} args Arguments or an array to concat to the observable sequence.
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
var observableConcat = Observable.concat = function () {
var args;
if (Array.isArray(arguments[0])) {
args = arguments[0];
} else {
args = new Array(arguments.length);
for(var i = 0, len = arguments.length; i < len; i++) { args[i] = arguments[i]; }
}
return enumerableOf(args).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.concatAll = observableProto.concatObservable = function () {
return this.merge(1);
};
var MergeObservable = (function (__super__) {
inherits(MergeObservable, __super__);
function MergeObservable(source, maxConcurrent) {
this.source = source;
this.maxConcurrent = maxConcurrent;
__super__.call(this);
}
MergeObservable.prototype.subscribeCore = function(observer) {
var g = new CompositeDisposable();
g.add(this.source.subscribe(new MergeObserver(observer, this.maxConcurrent, g)));
return g;
};
return MergeObservable;
}(ObservableBase));
var MergeObserver = (function () {
function MergeObserver(o, max, g) {
this.o = o;
this.max = max;
this.g = g;
this.done = false;
this.q = [];
this.activeCount = 0;
this.isStopped = false;
}
MergeObserver.prototype.handleSubscribe = function (xs) {
var sad = new SingleAssignmentDisposable();
this.g.add(sad);
isPromise(xs) && (xs = observableFromPromise(xs));
sad.setDisposable(xs.subscribe(new InnerObserver(this, sad)));
};
MergeObserver.prototype.onNext = function (innerSource) {
if (this.isStopped) { return; }
if(this.activeCount < this.max) {
this.activeCount++;
this.handleSubscribe(innerSource);
} else {
this.q.push(innerSource);
}
};
MergeObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
}
};
MergeObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.done = true;
this.activeCount === 0 && this.o.onCompleted();
}
};
MergeObserver.prototype.dispose = function() { this.isStopped = true; };
MergeObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
function InnerObserver(parent, sad) {
this.parent = parent;
this.sad = sad;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.parent.o.onNext(x); } };
InnerObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
}
};
InnerObserver.prototype.onCompleted = function () {
if(!this.isStopped) {
this.isStopped = true;
var parent = this.parent;
parent.g.remove(this.sad);
if (parent.q.length > 0) {
parent.handleSubscribe(parent.q.shift());
} else {
parent.activeCount--;
parent.done && parent.activeCount === 0 && parent.o.onCompleted();
}
}
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
return true;
}
return false;
};
return MergeObserver;
}());
/**
* 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) {
return typeof maxConcurrentOrOther !== 'number' ?
observableMerge(this, maxConcurrentOrOther) :
new MergeObservable(this, maxConcurrentOrOther);
};
/**
* Merges all the observable sequences into a single observable sequence.
* The scheduler is optional and if not specified, the immediate scheduler is used.
* @returns {Observable} The observable sequence that merges the elements of the observable sequences.
*/
var observableMerge = Observable.merge = function () {
var scheduler, sources = [], i, len = arguments.length;
if (!arguments[0]) {
scheduler = immediateScheduler;
for(i = 1; i < len; i++) { sources.push(arguments[i]); }
} else if (isScheduler(arguments[0])) {
scheduler = arguments[0];
for(i = 1; i < len; i++) { sources.push(arguments[i]); }
} else {
scheduler = immediateScheduler;
for(i = 0; i < len; i++) { sources.push(arguments[i]); }
}
if (Array.isArray(sources[0])) {
sources = sources[0];
}
return observableOf(scheduler, sources).mergeAll();
};
var MergeAllObservable = (function (__super__) {
inherits(MergeAllObservable, __super__);
function MergeAllObservable(source) {
this.source = source;
__super__.call(this);
}
MergeAllObservable.prototype.subscribeCore = function (observer) {
var g = new CompositeDisposable(), m = new SingleAssignmentDisposable();
g.add(m);
m.setDisposable(this.source.subscribe(new MergeAllObserver(observer, g)));
return g;
};
return MergeAllObservable;
}(ObservableBase));
var MergeAllObserver = (function() {
function MergeAllObserver(o, g) {
this.o = o;
this.g = g;
this.isStopped = false;
this.done = false;
}
MergeAllObserver.prototype.onNext = function(innerSource) {
if(this.isStopped) { return; }
var sad = new SingleAssignmentDisposable();
this.g.add(sad);
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
sad.setDisposable(innerSource.subscribe(new InnerObserver(this, this.g, sad)));
};
MergeAllObserver.prototype.onError = function (e) {
if(!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
}
};
MergeAllObserver.prototype.onCompleted = function () {
if(!this.isStopped) {
this.isStopped = true;
this.done = true;
this.g.length === 1 && this.o.onCompleted();
}
};
MergeAllObserver.prototype.dispose = function() { this.isStopped = true; };
MergeAllObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
function InnerObserver(parent, g, sad) {
this.parent = parent;
this.g = g;
this.sad = sad;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) { if (!this.isStopped) { this.parent.o.onNext(x); } };
InnerObserver.prototype.onError = function (e) {
if(!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
}
};
InnerObserver.prototype.onCompleted = function () {
if(!this.isStopped) {
var parent = this.parent;
this.isStopped = true;
parent.g.remove(this.sad);
parent.done && parent.g.length === 1 && parent.o.onCompleted();
}
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
return true;
}
return false;
};
return MergeAllObserver;
}());
/**
* 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.mergeAll = observableProto.mergeObservable = function () {
return new MergeAllObservable(this);
};
var CompositeError = Rx.CompositeError = function(errors) {
this.name = "NotImplementedError";
this.innerErrors = errors;
this.message = 'This contains multiple errors. Check the innerErrors';
Error.call(this);
}
CompositeError.prototype = Error.prototype;
/**
* Flattens an Observable that emits Observables into one Observable, in a way that allows an Observer to
* receive all successfully emitted items from all of the source Observables without being interrupted by
* an error notification from one of them.
*
* This behaves like Observable.prototype.mergeAll except that if any of the merged Observables notify of an
* error via the Observer's onError, mergeDelayError will refrain from propagating that
* error notification until all of the merged Observables have finished emitting items.
* @param {Array | Arguments} args Arguments or an array to merge.
* @returns {Observable} an Observable that emits all of the items emitted by the Observables emitted by the Observable
*/
Observable.mergeDelayError = function() {
var args;
if (Array.isArray(arguments[0])) {
args = arguments[0];
} else {
var len = arguments.length;
args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
}
var source = observableOf(null, args);
return new AnonymousObservable(function (o) {
var group = new CompositeDisposable(),
m = new SingleAssignmentDisposable(),
isStopped = false,
errors = [];
function setCompletion() {
if (errors.length === 0) {
o.onCompleted();
} else if (errors.length === 1) {
o.onError(errors[0]);
} else {
o.onError(new CompositeError(errors));
}
}
group.add(m);
m.setDisposable(source.subscribe(
function (innerSource) {
var innerSubscription = new SingleAssignmentDisposable();
group.add(innerSubscription);
// Check for promises support
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
innerSubscription.setDisposable(innerSource.subscribe(
function (x) { o.onNext(x); },
function (e) {
errors.push(e);
group.remove(innerSubscription);
isStopped && group.length === 1 && setCompletion();
},
function () {
group.remove(innerSubscription);
isStopped && group.length === 1 && setCompletion();
}));
},
function (e) {
errors.push(e);
isStopped = true;
group.length === 1 && setCompletion();
},
function () {
isStopped = true;
group.length === 1 && setCompletion();
}));
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 = [];
if (Array.isArray(arguments[0])) {
sources = arguments[0];
} else {
for(var i = 0, len = arguments.length; i < len; i++) { sources.push(arguments[i]); }
}
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), self, 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 (o) {
var isOpen = false;
var disposables = new CompositeDisposable(source.subscribe(function (left) {
isOpen && o.onNext(left);
}, function (e) { o.onError(e); }, function () {
isOpen && o.onCompleted();
}));
isPromise(other) && (other = observableFromPromise(other));
var rightSubscription = new SingleAssignmentDisposable();
disposables.add(rightSubscription);
rightSubscription.setDisposable(other.subscribe(function () {
isOpen = true;
rightSubscription.dispose();
}, function (e) { o.onError(e); }, function () {
rightSubscription.dispose();
}));
return disposables;
}, source);
};
/**
* 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
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
d.setDisposable(innerSource.subscribe(
function (x) { latest === id && observer.onNext(x); },
function (e) { latest === id && observer.onError(e); },
function () {
if (latest === id) {
hasLatest = false;
isStopped && observer.onCompleted();
}
}));
},
function (e) { observer.onError(e); },
function () {
isStopped = true;
!hasLatest && observer.onCompleted();
});
return new CompositeDisposable(subscription, innerSubscription);
}, sources);
};
/**
* 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 (o) {
isPromise(other) && (other = observableFromPromise(other));
return new CompositeDisposable(
source.subscribe(o),
other.subscribe(function () { o.onCompleted(); }, function (e) { o.onError(e); }, noop)
);
}, source);
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function only when the (first) source observable sequence produces an element.
*
* @example
* 1 - obs = obs1.withLatestFrom(obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = obs1.withLatestFrom([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.withLatestFrom = function () {
var len = arguments.length, args = new Array(len)
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
var resultSelector = args.pop(), source = this;
if (typeof source === 'undefined') {
throw new Error('Source observable not found for withLatestFrom().');
}
if (typeof resultSelector !== 'function') {
throw new Error('withLatestFrom() expects a resultSelector function.');
}
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,
values = new Array(n);
var subscriptions = new Array(n + 1);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var other = args[i], sad = new SingleAssignmentDisposable();
isPromise(other) && (other = observableFromPromise(other));
sad.setDisposable(other.subscribe(function (x) {
values[i] = x;
hasValue[i] = true;
hasValueAll = hasValue.every(identity);
}, observer.onError.bind(observer), function () {}));
subscriptions[i] = sad;
}(idx));
}
var sad = new SingleAssignmentDisposable();
sad.setDisposable(source.subscribe(function (x) {
var res;
var allValues = [x].concat(values);
if (!hasValueAll) return;
try {
res = resultSelector.apply(null, allValues);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
}, observer.onError.bind(observer), function () {
observer.onCompleted();
}));
subscriptions[n] = sad;
return new CompositeDisposable(subscriptions);
}, this);
};
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) {
return observer.onError(e);
}
observer.onNext(result);
} else {
observer.onCompleted();
}
}, function (e) { observer.onError(e); }, function () { observer.onCompleted(); });
}, first);
}
function falseFactory() { return false; }
function emptyArrayFactory() { return []; }
/**
* 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 args.
*
* @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 args using the specified result selector function.
*/
observableProto.zip = function () {
if (Array.isArray(arguments[0])) { return zipArray.apply(this, arguments); }
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
var parent = this, resultSelector = args.pop();
args.unshift(parent);
return new AnonymousObservable(function (observer) {
var n = args.length,
queues = arrayInitialize(n, emptyArrayFactory),
isDone = arrayInitialize(n, falseFactory);
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 = args[i], sad = new SingleAssignmentDisposable();
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(function (x) {
queues[i].push(x);
next(i);
}, function (e) { observer.onError(e); }, function () {
done(i);
}));
subscriptions[i] = sad;
})(idx);
}
return new CompositeDisposable(subscriptions);
}, parent);
};
/**
* 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 len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
var 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;
if (Array.isArray(arguments[0])) {
sources = arguments[0];
} else {
var len = arguments.length;
sources = new Array(len);
for(var i = 0; i < len; i++) { sources[i] = arguments[i]; }
}
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);
}, function (e) { observer.onError(e); }, function () {
done(i);
}));
})(idx);
}
return new CompositeDisposable(subscriptions);
});
};
/**
* 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 (o) { return source.subscribe(o); }, this);
};
/**
* 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 (o) {
return source.subscribe(function (x) { return x.accept(o); }, function(e) { o.onError(e); }, function () { o.onCompleted(); });
}, this);
};
/**
* 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;
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (o) {
var hasCurrentKey = false, currentKey;
return source.subscribe(function (value) {
var key = value;
if (keySelector) {
try {
key = keySelector(value);
} catch (e) {
o.onError(e);
return;
}
}
if (hasCurrentKey) {
try {
var comparerEquals = comparer(currentKey, key);
} catch (e) {
o.onError(e);
return;
}
}
if (!hasCurrentKey || !comparerEquals) {
hasCurrentKey = true;
currentKey = key;
o.onNext(value);
}
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, this);
};
/**
* 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.
* @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.tap = observableProto.doAction = function (observerOrOnNext, onError, onCompleted) {
var source = this;
return new AnonymousObservable(function (observer) {
var tapObserver = !observerOrOnNext || isFunction(observerOrOnNext) ?
observerCreate(observerOrOnNext || noop, onError || noop, onCompleted || noop) :
observerOrOnNext;
return source.subscribe(function (x) {
try {
tapObserver.onNext(x);
} catch (e) {
observer.onError(e);
}
observer.onNext(x);
}, function (err) {
try {
tapObserver.onError(err);
} catch (e) {
observer.onError(e);
}
observer.onError(err);
}, function () {
try {
tapObserver.onCompleted();
} catch (e) {
observer.onError(e);
}
observer.onCompleted();
});
}, this);
};
/**
* Invokes an action for each element in 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.
* @param {Function} onNext Action to invoke for each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doOnNext = observableProto.tapOnNext = function (onNext, thisArg) {
return this.tap(typeof thisArg !== 'undefined' ? function (x) { onNext.call(thisArg, x); } : onNext);
};
/**
* Invokes an action upon 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.
* @param {Function} onError Action to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doOnError = observableProto.tapOnError = function (onError, thisArg) {
return this.tap(noop, typeof thisArg !== 'undefined' ? function (e) { onError.call(thisArg, e); } : onError);
};
/**
* Invokes an action upon graceful 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.
* @param {Function} onCompleted Action to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doOnCompleted = observableProto.tapOnCompleted = function (onCompleted, thisArg) {
return this.tap(noop, null, typeof thisArg !== 'undefined' ? function () { onCompleted.call(thisArg); } : onCompleted);
};
/**
* Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.
* @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.ensure = 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();
}
});
}, this);
};
/**
* @deprecated use #finally or #ensure instead.
*/
observableProto.finallyAction = function (action) {
//deprecate('finallyAction', 'finally or ensure');
return this.ensure(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 (o) {
return source.subscribe(noop, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
/**
* 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();
});
}, source);
};
/**
* Repeats the observable sequence a specified number of times. If the repeat count is not specified, the sequence repeats indefinitely.
* @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).catchError();
};
/**
* Repeats the source observable sequence upon error each time the notifier emits or until it successfully terminates.
* if the notifier completes, the observable sequence completes.
*
* @example
* var timer = Observable.timer(500);
* var source = observable.retryWhen(timer);
* @param {Observable} [notifier] An observable that triggers the retries or completes the observable with onNext or onCompleted respectively.
* @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
*/
observableProto.retryWhen = function (notifier) {
return enumerableRepeat(this).catchErrorWhen(notifier);
};
/**
* 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 (o) {
var hasAccumulation, accumulation, hasValue;
return source.subscribe (
function (x) {
!hasValue && (hasValue = true);
try {
if (hasAccumulation) {
accumulation = accumulator(accumulation, x);
} else {
accumulation = hasSeed ? accumulator(seed, x) : x;
hasAccumulation = true;
}
} catch (e) {
o.onError(e);
return;
}
o.onNext(accumulation);
},
function (e) { o.onError(e); },
function () {
!hasValue && hasSeed && o.onNext(seed);
o.onCompleted();
}
);
}, source);
};
/**
* 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) {
if (count < 0) { throw new ArgumentOutOfRangeError(); }
var source = this;
return new AnonymousObservable(function (o) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && o.onNext(q.shift());
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
/**
* Prepends a sequence of values to an observable sequence with an optional scheduler and an argument list of values to prepend.
* @example
* var res = source.startWith(1, 2, 3);
* var res = source.startWith(Rx.Scheduler.timeout, 1, 2, 3);
* @param {Arguments} args The specified values to prepend to the observable sequence
* @returns {Observable} The source sequence prepended with the specified values.
*/
observableProto.startWith = function () {
var values, scheduler, start = 0;
if (!!arguments.length && isScheduler(arguments[0])) {
scheduler = arguments[0];
start = 1;
} else {
scheduler = immediateScheduler;
}
for(var args = [], i = start, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
return enumerableOf([observableFromArray(args, scheduler), this]).concat();
};
/**
* Returns a specified number of contiguous elements from the end of an observable sequence.
* @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) {
if (count < 0) { throw new ArgumentOutOfRangeError(); }
var source = this;
return new AnonymousObservable(function (o) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && q.shift();
}, function (e) { o.onError(e); }, function () {
while (q.length > 0) { o.onNext(q.shift()); }
o.onCompleted();
});
}, source);
};
/**
* 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 (o) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && q.shift();
}, function (e) { o.onError(e); }, function () {
o.onNext(q);
o.onCompleted();
});
}, source);
};
/**
* 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;
+count || (count = 0);
Math.abs(count) === Infinity && (count = 0);
if (count <= 0) { throw new ArgumentOutOfRangeError(); }
skip == null && (skip = count);
+skip || (skip = 0);
Math.abs(skip) === Infinity && (skip = 0);
if (skip <= 0) { throw new ArgumentOutOfRangeError(); }
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(),
refCountDisposable = new RefCountDisposable(m),
n = 0,
q = [];
function createWindow () {
var s = new Subject();
q.push(s);
observer.onNext(addRef(s, refCountDisposable));
}
createWindow();
m.setDisposable(source.subscribe(
function (x) {
for (var i = 0, len = q.length; i < len; i++) { q[i].onNext(x); }
var c = n - count + 1;
c >= 0 && c % skip === 0 && q.shift().onCompleted();
++n % skip === 0 && createWindow();
},
function (e) {
while (q.length > 0) { q.shift().onError(e); }
observer.onError(e);
},
function () {
while (q.length > 0) { q.shift().onCompleted(); }
observer.onCompleted();
}
));
return refCountDisposable;
}, source);
};
function concatMap(source, selector, thisArg) {
var selectorFunc = bindCallback(selector, thisArg, 3);
return source.map(function (x, i) {
var result = selectorFunc(x, i, source);
isPromise(result) && (result = observableFromPromise(result));
(isArrayLike(result) || isIterable(result)) && (result = observableFrom(result));
return 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 {Function} 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 (isFunction(selector) && isFunction(resultSelector)) {
return this.concatMap(function (x, i) {
var selectorResult = selector(x, i);
isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult));
(isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));
return selectorResult.map(function (y, i2) {
return resultSelector(x, y, i, i2);
});
});
}
return isFunction(selector) ?
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,
onNextFunc = bindCallback(onNext, thisArg, 2),
onErrorFunc = bindCallback(onError, thisArg, 1),
onCompletedFunc = bindCallback(onCompleted, thisArg, 0);
return new AnonymousObservable(function (observer) {
var index = 0;
return source.subscribe(
function (x) {
var result;
try {
result = onNextFunc(x, index++);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
},
function (err) {
var result;
try {
result = onErrorFunc(err);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
},
function () {
var result;
try {
result = onCompletedFunc();
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
});
}, this).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;
defaultValue === undefined && (defaultValue = null);
return new AnonymousObservable(function (observer) {
var found = false;
return source.subscribe(function (x) {
found = true;
observer.onNext(x);
},
function (e) { observer.onError(e); },
function () {
!found && observer.onNext(defaultValue);
observer.onCompleted();
});
}, source);
};
// 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 (o) {
var hashSet = new HashSet(comparer);
return source.subscribe(function (x) {
var key = x;
if (keySelector) {
try {
key = keySelector(x);
} catch (e) {
o.onError(e);
return;
}
}
hashSet.push(key) && o.onNext(x);
},
function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, this);
};
/**
* Groups the elements of an observable sequence according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
*
* @example
* var res = observable.groupBy(function (x) { return x.id; });
* 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; });
* 3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function (x) { return x.toString(); });
* @param {Function} keySelector A function to extract the key for each element.
* @param {Function} [elementSelector] A function to map each source element to an element in an observable group.
* @param {Function} [comparer] Used to determine whether the objects are equal.
* @returns {Observable} A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
*/
observableProto.groupBy = function (keySelector, elementSelector, comparer) {
return this.groupByUntil(keySelector, elementSelector, observableNever, comparer);
};
/**
* Groups the elements of an observable sequence according to a specified key selector function.
* A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
* key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
*
* @example
* var res = observable.groupByUntil(function (x) { return x.id; }, null, function () { return Rx.Observable.never(); });
* 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); });
* 3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); }, function (x) { return x.toString(); });
* @param {Function} keySelector A function to extract the key for each element.
* @param {Function} durationSelector A function to signal the expiration of a group.
* @param {Function} [comparer] Used to compare objects. When not specified, the default comparer is used.
* @returns {Observable}
* A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
* If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
*
*/
observableProto.groupByUntil = function (keySelector, elementSelector, durationSelector, comparer) {
var source = this;
elementSelector || (elementSelector = identity);
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (observer) {
function handleError(e) { return function (item) { item.onError(e); }; }
var map = new Dictionary(0, comparer),
groupDisposable = new CompositeDisposable(),
refCountDisposable = new RefCountDisposable(groupDisposable);
groupDisposable.add(source.subscribe(function (x) {
var key;
try {
key = keySelector(x);
} catch (e) {
map.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
var fireNewMapEntry = false,
writer = map.tryGetValue(key);
if (!writer) {
writer = new Subject();
map.set(key, writer);
fireNewMapEntry = true;
}
if (fireNewMapEntry) {
var group = new GroupedObservable(key, writer, refCountDisposable),
durationGroup = new GroupedObservable(key, writer);
try {
duration = durationSelector(durationGroup);
} catch (e) {
map.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
observer.onNext(group);
var md = new SingleAssignmentDisposable();
groupDisposable.add(md);
var expire = function () {
map.remove(key) && writer.onCompleted();
groupDisposable.remove(md);
};
md.setDisposable(duration.take(1).subscribe(
noop,
function (exn) {
map.getValues().forEach(handleError(exn));
observer.onError(exn);
},
expire)
);
}
var element;
try {
element = elementSelector(x);
} catch (e) {
map.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
writer.onNext(element);
}, function (ex) {
map.getValues().forEach(handleError(ex));
observer.onError(ex);
}, function () {
map.getValues().forEach(function (item) { item.onCompleted(); });
observer.onCompleted();
}));
return refCountDisposable;
}, source);
};
var MapObservable = (function (__super__) {
inherits(MapObservable, __super__);
function MapObservable(source, selector, thisArg) {
this.source = source;
this.selector = bindCallback(selector, thisArg, 3);
__super__.call(this);
}
MapObservable.prototype.internalMap = function (selector, thisArg) {
var self = this;
return new MapObservable(this.source, function (x, i, o) { return selector.call(this, self.selector(x, i, o), i, o); }, thisArg)
};
MapObservable.prototype.subscribeCore = function (observer) {
return this.source.subscribe(new MapObserver(observer, this.selector, this));
};
return MapObservable;
}(ObservableBase));
function MapObserver(observer, selector, source) {
this.observer = observer;
this.selector = selector;
this.source = source;
this.i = 0;
this.isStopped = false;
}
MapObserver.prototype.onNext = function(x) {
if (this.isStopped) { return; }
var result = tryCatch(this.selector).call(this, x, this.i++, this.source);
if (result === errorObj) {
return this.observer.onError(result.e);
}
this.observer.onNext(result);
};
MapObserver.prototype.onError = function (e) {
if(!this.isStopped) { this.isStopped = true; this.observer.onError(e); }
};
MapObserver.prototype.onCompleted = function () {
if(!this.isStopped) { this.isStopped = true; this.observer.onCompleted(); }
};
MapObserver.prototype.dispose = function() { this.isStopped = true; };
MapObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
return true;
}
return false;
};
/**
* 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.map = observableProto.select = function (selector, thisArg) {
var selectorFn = typeof selector === 'function' ? selector : function () { return selector; };
return this instanceof MapObservable ?
this.internalMap(selectorFn, thisArg) :
new MapObservable(this, selectorFn, thisArg);
};
/**
* Retrieves the value of a specified nested property from all elements in
* the Observable sequence.
* @param {Arguments} arguments The nested properties to pluck.
* @returns {Observable} Returns a new Observable sequence of property values.
*/
observableProto.pluck = function () {
var args = arguments, len = arguments.length;
if (len === 0) { throw new Error('List of properties cannot be empty.'); }
return this.map(function (x) {
var currentProp = x;
for (var i = 0; i < len; i++) {
var p = currentProp[args[i]];
if (typeof p !== 'undefined') {
currentProp = p;
} else {
return undefined;
}
}
return currentProp;
});
};
function flatMap(source, selector, thisArg) {
var selectorFunc = bindCallback(selector, thisArg, 3);
return source.map(function (x, i) {
var result = selectorFunc(x, i, source);
isPromise(result) && (result = observableFromPromise(result));
(isArrayLike(result) || isIterable(result)) && (result = observableFrom(result));
return result;
}).mergeAll();
}
/**
* 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 {Function} 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 (isFunction(selector) && isFunction(resultSelector)) {
return this.flatMap(function (x, i) {
var selectorResult = selector(x, i);
isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult));
(isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));
return selectorResult.map(function (y, i2) {
return resultSelector(x, y, i, i2);
});
}, thisArg);
}
return isFunction(selector) ?
flatMap(this, selector, thisArg) :
flatMap(this, function () { return selector; });
};
/**
* 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();
});
}, source).mergeAll();
};
/**
* 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 ArgumentOutOfRangeError(); }
var source = this;
return new AnonymousObservable(function (o) {
var remaining = count;
return source.subscribe(function (x) {
if (remaining <= 0) {
o.onNext(x);
} else {
remaining--;
}
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
/**
* 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,
callback = bindCallback(predicate, thisArg, 3);
return new AnonymousObservable(function (o) {
var i = 0, running = false;
return source.subscribe(function (x) {
if (!running) {
try {
running = !callback(x, i++, source);
} catch (e) {
o.onError(e);
return;
}
}
running && o.onNext(x);
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
/**
* 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 ArgumentOutOfRangeError(); }
if (count === 0) { return observableEmpty(scheduler); }
var source = this;
return new AnonymousObservable(function (o) {
var remaining = count;
return source.subscribe(function (x) {
if (remaining-- > 0) {
o.onNext(x);
remaining === 0 && o.onCompleted();
}
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
/**
* 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.
* @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 source = this,
callback = bindCallback(predicate, thisArg, 3);
return new AnonymousObservable(function (o) {
var i = 0, running = true;
return source.subscribe(function (x) {
if (running) {
try {
running = callback(x, i++, source);
} catch (e) {
o.onError(e);
return;
}
if (running) {
o.onNext(x);
} else {
o.onCompleted();
}
}
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
var FilterObservable = (function (__super__) {
inherits(FilterObservable, __super__);
function FilterObservable(source, predicate, thisArg) {
this.source = source;
this.predicate = bindCallback(predicate, thisArg, 3);
__super__.call(this);
}
FilterObservable.prototype.subscribeCore = function (observer) {
return this.source.subscribe(new FilterObserver(observer, this.predicate, this));
};
FilterObservable.prototype.internalFilter = function(predicate, thisArg) {
var self = this;
return new FilterObservable(this.source, function(x, i, o) { return self.predicate(x, i, o) && predicate.call(this, x, i, o); }, thisArg);
};
return FilterObservable;
}(ObservableBase));
function FilterObserver(observer, predicate, source) {
this.observer = observer;
this.predicate = predicate;
this.source = source;
this.i = 0;
this.isStopped = false;
}
FilterObserver.prototype.onNext = function(x) {
if (this.isStopped) { return; }
var shouldYield = tryCatch(this.predicate).call(this, x, this.i++, this.source);
if (shouldYield === errorObj) {
return this.observer.onError(shouldYield.e);
}
shouldYield && this.observer.onNext(x);
};
FilterObserver.prototype.onError = function (e) {
if(!this.isStopped) { this.isStopped = true; this.observer.onError(e); }
};
FilterObserver.prototype.onCompleted = function () {
if(!this.isStopped) { this.isStopped = true; this.observer.onCompleted(); }
};
FilterObserver.prototype.dispose = function() { this.isStopped = true; };
FilterObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
return true;
}
return false;
};
/**
* Filters the elements of an observable sequence based on a predicate by incorporating the element's index.
* @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.filter = observableProto.where = function (predicate, thisArg) {
return this instanceof FilterObservable ? this.internalFilter(predicate, thisArg) :
new FilterObservable(this, predicate, thisArg);
};
function extremaBy(source, keySelector, comparer) {
return new AnonymousObservable(function (o) {
var hasValue = false, lastKey = null, list = [];
return source.subscribe(function (x) {
var comparison, key;
try {
key = keySelector(x);
} catch (ex) {
o.onError(ex);
return;
}
comparison = 0;
if (!hasValue) {
hasValue = true;
lastKey = key;
} else {
try {
comparison = comparer(key, lastKey);
} catch (ex1) {
o.onError(ex1);
return;
}
}
if (comparison > 0) {
lastKey = key;
list = [];
}
if (comparison >= 0) { list.push(x); }
}, function (e) { o.onError(e); }, function () {
o.onNext(list);
o.onCompleted();
});
}, source);
}
function firstOnly(x) {
if (x.length === 0) { throw new EmptyError(); }
return x[0];
}
/**
* Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.
* For aggregation behavior with incremental intermediate results, see Observable.scan.
* @deprecated Use #reduce instead
* @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 a single element with the final accumulator value.
*/
observableProto.aggregate = function () {
var hasSeed = false, accumulator, seed, source = this;
if (arguments.length === 2) {
hasSeed = true;
seed = arguments[0];
accumulator = arguments[1];
} else {
accumulator = arguments[0];
}
return new AnonymousObservable(function (o) {
var hasAccumulation, accumulation, hasValue;
return source.subscribe (
function (x) {
!hasValue && (hasValue = true);
try {
if (hasAccumulation) {
accumulation = accumulator(accumulation, x);
} else {
accumulation = hasSeed ? accumulator(seed, x) : x;
hasAccumulation = true;
}
} catch (e) {
return o.onError(e);
}
},
function (e) { o.onError(e); },
function () {
hasValue && o.onNext(accumulation);
!hasValue && hasSeed && o.onNext(seed);
!hasValue && !hasSeed && o.onError(new EmptyError());
o.onCompleted();
}
);
}, source);
};
/**
* Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.
* For aggregation behavior with incremental intermediate results, see Observable.scan.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @param {Any} [seed] The initial accumulator value.
* @returns {Observable} An observable sequence containing a single element with the final accumulator value.
*/
observableProto.reduce = function (accumulator) {
var hasSeed = false, seed, source = this;
if (arguments.length === 2) {
hasSeed = true;
seed = arguments[1];
}
return new AnonymousObservable(function (o) {
var hasAccumulation, accumulation, hasValue;
return source.subscribe (
function (x) {
!hasValue && (hasValue = true);
try {
if (hasAccumulation) {
accumulation = accumulator(accumulation, x);
} else {
accumulation = hasSeed ? accumulator(seed, x) : x;
hasAccumulation = true;
}
} catch (e) {
return o.onError(e);
}
},
function (e) { o.onError(e); },
function () {
hasValue && o.onNext(accumulation);
!hasValue && hasSeed && o.onNext(seed);
!hasValue && !hasSeed && o.onError(new EmptyError());
o.onCompleted();
}
);
}, source);
};
/**
* Determines whether any element of an observable sequence satisfies a condition if present, else if any items are in the sequence.
* @param {Function} [predicate] A function to test each element for a condition.
* @returns {Observable} An observable sequence containing a single element determining whether any elements in the source sequence pass the test in the specified predicate if given, else if any items are in the sequence.
*/
observableProto.some = function (predicate, thisArg) {
var source = this;
return predicate ?
source.filter(predicate, thisArg).some() :
new AnonymousObservable(function (observer) {
return source.subscribe(function () {
observer.onNext(true);
observer.onCompleted();
}, function (e) { observer.onError(e); }, function () {
observer.onNext(false);
observer.onCompleted();
});
}, source);
};
/** @deprecated use #some instead */
observableProto.any = function () {
//deprecate('any', 'some');
return this.some.apply(this, arguments);
};
/**
* Determines whether an observable sequence is empty.
* @returns {Observable} An observable sequence containing a single element determining whether the source sequence is empty.
*/
observableProto.isEmpty = function () {
return this.any().map(not);
};
/**
* Determines whether all elements of an observable sequence satisfy a condition.
* @param {Function} [predicate] A function to test each element for a condition.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element determining whether all elements in the source sequence pass the test in the specified predicate.
*/
observableProto.every = function (predicate, thisArg) {
return this.filter(function (v) { return !predicate(v); }, thisArg).some().map(not);
};
/** @deprecated use #every instead */
observableProto.all = function () {
//deprecate('all', 'every');
return this.every.apply(this, arguments);
};
/**
* Determines whether an observable sequence includes a specified element with an optional equality comparer.
* @param searchElement The value to locate in the source sequence.
* @param {Number} [fromIndex] An equality comparer to compare elements.
* @returns {Observable} An observable sequence containing a single element determining whether the source sequence includes an element that has the specified value from the given index.
*/
observableProto.includes = function (searchElement, fromIndex) {
var source = this;
function comparer(a, b) {
return (a === 0 && b === 0) || (a === b || (isNaN(a) && isNaN(b)));
}
return new AnonymousObservable(function (o) {
var i = 0, n = +fromIndex || 0;
Math.abs(n) === Infinity && (n = 0);
if (n < 0) {
o.onNext(false);
o.onCompleted();
return disposableEmpty;
}
return source.subscribe(
function (x) {
if (i++ >= n && comparer(x, searchElement)) {
o.onNext(true);
o.onCompleted();
}
},
function (e) { o.onError(e); },
function () {
o.onNext(false);
o.onCompleted();
});
}, this);
};
/**
* @deprecated use #includes instead.
*/
observableProto.contains = function (searchElement, fromIndex) {
//deprecate('contains', 'includes');
observableProto.includes(searchElement, fromIndex);
};
/**
* Returns an observable sequence containing a value that represents how many elements in the specified observable sequence satisfy a condition if provided, else the count of items.
* @example
* res = source.count();
* res = source.count(function (x) { return x > 3; });
* @param {Function} [predicate]A function to test each element for a condition.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element with a number that represents how many elements in the input sequence satisfy the condition in the predicate function if provided, else the count of items in the sequence.
*/
observableProto.count = function (predicate, thisArg) {
return predicate ?
this.filter(predicate, thisArg).count() :
this.reduce(function (count) { return count + 1; }, 0);
};
/**
* Returns the first index at which a given element can be found in the observable sequence, or -1 if it is not present.
* @param {Any} searchElement Element to locate in the array.
* @param {Number} [fromIndex] The index to start the search. If not specified, defaults to 0.
* @returns {Observable} And observable sequence containing the first index at which a given element can be found in the observable sequence, or -1 if it is not present.
*/
observableProto.indexOf = function(searchElement, fromIndex) {
var source = this;
return new AnonymousObservable(function (o) {
var i = 0, n = +fromIndex || 0;
Math.abs(n) === Infinity && (n = 0);
if (n < 0) {
o.onNext(-1);
o.onCompleted();
return disposableEmpty;
}
return source.subscribe(
function (x) {
if (i >= n && x === searchElement) {
o.onNext(i);
o.onCompleted();
}
i++;
},
function (e) { o.onError(e); },
function () {
o.onNext(-1);
o.onCompleted();
});
}, source);
};
/**
* Computes the sum of a sequence of values that are obtained by invoking an optional transform function on each element of the input sequence, else if not specified computes the sum on each item in the sequence.
* @param {Function} [selector] A transform function to apply to each element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element with the sum of the values in the source sequence.
*/
observableProto.sum = function (keySelector, thisArg) {
return keySelector && isFunction(keySelector) ?
this.map(keySelector, thisArg).sum() :
this.reduce(function (prev, curr) { return prev + curr; }, 0);
};
/**
* Returns the elements in an observable sequence with the minimum key value according to the specified comparer.
* @example
* var res = source.minBy(function (x) { return x.value; });
* var res = source.minBy(function (x) { return x.value; }, function (x, y) { return x - y; });
* @param {Function} keySelector Key selector function.
* @param {Function} [comparer] Comparer used to compare key values.
* @returns {Observable} An observable sequence containing a list of zero or more elements that have a minimum key value.
*/
observableProto.minBy = function (keySelector, comparer) {
comparer || (comparer = defaultSubComparer);
return extremaBy(this, keySelector, function (x, y) { return comparer(x, y) * -1; });
};
/**
* Returns the minimum element in an observable sequence according to the optional comparer else a default greater than less than check.
* @example
* var res = source.min();
* var res = source.min(function (x, y) { return x.value - y.value; });
* @param {Function} [comparer] Comparer used to compare elements.
* @returns {Observable} An observable sequence containing a single element with the minimum element in the source sequence.
*/
observableProto.min = function (comparer) {
return this.minBy(identity, comparer).map(function (x) { return firstOnly(x); });
};
/**
* Returns the elements in an observable sequence with the maximum key value according to the specified comparer.
* @example
* var res = source.maxBy(function (x) { return x.value; });
* var res = source.maxBy(function (x) { return x.value; }, function (x, y) { return x - y;; });
* @param {Function} keySelector Key selector function.
* @param {Function} [comparer] Comparer used to compare key values.
* @returns {Observable} An observable sequence containing a list of zero or more elements that have a maximum key value.
*/
observableProto.maxBy = function (keySelector, comparer) {
comparer || (comparer = defaultSubComparer);
return extremaBy(this, keySelector, comparer);
};
/**
* Returns the maximum value in an observable sequence according to the specified comparer.
* @example
* var res = source.max();
* var res = source.max(function (x, y) { return x.value - y.value; });
* @param {Function} [comparer] Comparer used to compare elements.
* @returns {Observable} An observable sequence containing a single element with the maximum element in the source sequence.
*/
observableProto.max = function (comparer) {
return this.maxBy(identity, comparer).map(function (x) { return firstOnly(x); });
};
/**
* Computes the average of an observable sequence of values that are in the sequence or obtained by invoking a transform function on each element of the input sequence if present.
* @param {Function} [selector] A transform function to apply to each element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element with the average of the sequence of values.
*/
observableProto.average = function (keySelector, thisArg) {
return keySelector && isFunction(keySelector) ?
this.map(keySelector, thisArg).average() :
this.reduce(function (prev, cur) {
return {
sum: prev.sum + cur,
count: prev.count + 1
};
}, {sum: 0, count: 0 }).map(function (s) {
if (s.count === 0) { throw new EmptyError(); }
return s.sum / s.count;
});
};
/**
* Determines whether two sequences are equal by comparing the elements pairwise using a specified equality comparer.
*
* @example
* var res = res = source.sequenceEqual([1,2,3]);
* var res = res = source.sequenceEqual([{ value: 42 }], function (x, y) { return x.value === y.value; });
* 3 - res = source.sequenceEqual(Rx.Observable.returnValue(42));
* 4 - res = source.sequenceEqual(Rx.Observable.returnValue({ value: 42 }), function (x, y) { return x.value === y.value; });
* @param {Observable} second Second observable sequence or array to compare.
* @param {Function} [comparer] Comparer used to compare elements of both sequences.
* @returns {Observable} An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the specified equality comparer.
*/
observableProto.sequenceEqual = function (second, comparer) {
var first = this;
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (o) {
var donel = false, doner = false, ql = [], qr = [];
var subscription1 = first.subscribe(function (x) {
var equal, v;
if (qr.length > 0) {
v = qr.shift();
try {
equal = comparer(v, x);
} catch (e) {
o.onError(e);
return;
}
if (!equal) {
o.onNext(false);
o.onCompleted();
}
} else if (doner) {
o.onNext(false);
o.onCompleted();
} else {
ql.push(x);
}
}, function(e) { o.onError(e); }, function () {
donel = true;
if (ql.length === 0) {
if (qr.length > 0) {
o.onNext(false);
o.onCompleted();
} else if (doner) {
o.onNext(true);
o.onCompleted();
}
}
});
(isArrayLike(second) || isIterable(second)) && (second = observableFrom(second));
isPromise(second) && (second = observableFromPromise(second));
var subscription2 = second.subscribe(function (x) {
var equal;
if (ql.length > 0) {
var v = ql.shift();
try {
equal = comparer(v, x);
} catch (exception) {
o.onError(exception);
return;
}
if (!equal) {
o.onNext(false);
o.onCompleted();
}
} else if (donel) {
o.onNext(false);
o.onCompleted();
} else {
qr.push(x);
}
}, function(e) { o.onError(e); }, function () {
doner = true;
if (qr.length === 0) {
if (ql.length > 0) {
o.onNext(false);
o.onCompleted();
} else if (donel) {
o.onNext(true);
o.onCompleted();
}
}
});
return new CompositeDisposable(subscription1, subscription2);
}, first);
};
function elementAtOrDefault(source, index, hasDefault, defaultValue) {
if (index < 0) { throw new ArgumentOutOfRangeError(); }
return new AnonymousObservable(function (o) {
var i = index;
return source.subscribe(function (x) {
if (i-- === 0) {
o.onNext(x);
o.onCompleted();
}
}, function (e) { o.onError(e); }, function () {
if (!hasDefault) {
o.onError(new ArgumentOutOfRangeError());
} else {
o.onNext(defaultValue);
o.onCompleted();
}
});
}, source);
}
/**
* Returns the element at a specified index in a sequence.
* @example
* var res = source.elementAt(5);
* @param {Number} index The zero-based index of the element to retrieve.
* @returns {Observable} An observable sequence that produces the element at the specified position in the source sequence.
*/
observableProto.elementAt = function (index) {
return elementAtOrDefault(this, index, false);
};
/**
* Returns the element at a specified index in a sequence or a default value if the index is out of range.
* @example
* var res = source.elementAtOrDefault(5);
* var res = source.elementAtOrDefault(5, 0);
* @param {Number} index The zero-based index of the element to retrieve.
* @param [defaultValue] The default value if the index is outside the bounds of the source sequence.
* @returns {Observable} An observable sequence that produces the element at the specified position in the source sequence, or a default value if the index is outside the bounds of the source sequence.
*/
observableProto.elementAtOrDefault = function (index, defaultValue) {
return elementAtOrDefault(this, index, true, defaultValue);
};
function singleOrDefaultAsync(source, hasDefault, defaultValue) {
return new AnonymousObservable(function (o) {
var value = defaultValue, seenValue = false;
return source.subscribe(function (x) {
if (seenValue) {
o.onError(new Error('Sequence contains more than one element'));
} else {
value = x;
seenValue = true;
}
}, function (e) { o.onError(e); }, function () {
if (!seenValue && !hasDefault) {
o.onError(new EmptyError());
} else {
o.onNext(value);
o.onCompleted();
}
});
}, source);
}
/**
* Returns the only element of an observable sequence that satisfies the condition in the optional predicate, and reports an exception if there is not exactly one element in the observable sequence.
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the single element in the observable sequence that satisfies the condition in the predicate.
*/
observableProto.single = function (predicate, thisArg) {
return predicate && isFunction(predicate) ?
this.where(predicate, thisArg).single() :
singleOrDefaultAsync(this, false);
};
/**
* Returns the only element of an observable sequence that matches the predicate, or a default value if no such element exists; this method reports an exception if there is more than one element in the observable sequence.
* @example
* var res = res = source.singleOrDefault();
* var res = res = source.singleOrDefault(function (x) { return x === 42; });
* res = source.singleOrDefault(function (x) { return x === 42; }, 0);
* res = source.singleOrDefault(null, 0);
* @memberOf Observable#
* @param {Function} predicate A predicate function to evaluate for elements in the source sequence.
* @param [defaultValue] The default value if the index is outside the bounds of the source sequence.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the single element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
*/
observableProto.singleOrDefault = function (predicate, defaultValue, thisArg) {
return predicate && isFunction(predicate) ?
this.filter(predicate, thisArg).singleOrDefault(null, defaultValue) :
singleOrDefaultAsync(this, true, defaultValue);
};
function firstOrDefaultAsync(source, hasDefault, defaultValue) {
return new AnonymousObservable(function (o) {
return source.subscribe(function (x) {
o.onNext(x);
o.onCompleted();
}, function (e) { o.onError(e); }, function () {
if (!hasDefault) {
o.onError(new EmptyError());
} else {
o.onNext(defaultValue);
o.onCompleted();
}
});
}, source);
}
/**
* Returns the first element of an observable sequence that satisfies the condition in the predicate if present else the first item in the sequence.
* @example
* var res = res = source.first();
* var res = res = source.first(function (x) { return x > 3; });
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the first element in the observable sequence that satisfies the condition in the predicate if provided, else the first item in the sequence.
*/
observableProto.first = function (predicate, thisArg) {
return predicate ?
this.where(predicate, thisArg).first() :
firstOrDefaultAsync(this, false);
};
/**
* Returns the first element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param {Any} [defaultValue] The default value if no such element exists. If not specified, defaults to null.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the first element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
*/
observableProto.firstOrDefault = function (predicate, defaultValue, thisArg) {
return predicate ?
this.where(predicate).firstOrDefault(null, defaultValue) :
firstOrDefaultAsync(this, true, defaultValue);
};
function lastOrDefaultAsync(source, hasDefault, defaultValue) {
return new AnonymousObservable(function (o) {
var value = defaultValue, seenValue = false;
return source.subscribe(function (x) {
value = x;
seenValue = true;
}, function (e) { o.onError(e); }, function () {
if (!seenValue && !hasDefault) {
o.onError(new EmptyError());
} else {
o.onNext(value);
o.onCompleted();
}
});
}, source);
}
/**
* Returns the last element of an observable sequence that satisfies the condition in the predicate if specified, else the last element.
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the last element in the observable sequence that satisfies the condition in the predicate.
*/
observableProto.last = function (predicate, thisArg) {
return predicate ?
this.where(predicate, thisArg).last() :
lastOrDefaultAsync(this, false);
};
/**
* Returns the last element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param [defaultValue] The default value if no such element exists. If not specified, defaults to null.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the last element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
*/
observableProto.lastOrDefault = function (predicate, defaultValue, thisArg) {
return predicate ?
this.where(predicate, thisArg).lastOrDefault(null, defaultValue) :
lastOrDefaultAsync(this, true, defaultValue);
};
function findValue (source, predicate, thisArg, yieldIndex) {
var callback = bindCallback(predicate, thisArg, 3);
return new AnonymousObservable(function (o) {
var i = 0;
return source.subscribe(function (x) {
var shouldRun;
try {
shouldRun = callback(x, i, source);
} catch (e) {
o.onError(e);
return;
}
if (shouldRun) {
o.onNext(yieldIndex ? i : x);
o.onCompleted();
} else {
i++;
}
}, function (e) { o.onError(e); }, function () {
o.onNext(yieldIndex ? -1 : undefined);
o.onCompleted();
});
}, source);
}
/**
* Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire Observable sequence.
* @param {Function} predicate The predicate that defines the conditions of the element to search for.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} An Observable sequence with the first element that matches the conditions defined by the specified predicate, if found; otherwise, undefined.
*/
observableProto.find = function (predicate, thisArg) {
return findValue(this, predicate, thisArg, false);
};
/**
* Searches for an element that matches the conditions defined by the specified predicate, and returns
* an Observable sequence with the zero-based index of the first occurrence within the entire Observable sequence.
* @param {Function} predicate The predicate that defines the conditions of the element to search for.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} An Observable sequence with the zero-based index of the first occurrence of an element that matches the conditions defined by match, if found; otherwise, –1.
*/
observableProto.findIndex = function (predicate, thisArg) {
return findValue(this, predicate, thisArg, true);
};
/**
* Converts the observable sequence to a Set if it exists.
* @returns {Observable} An observable sequence with a single value of a Set containing the values from the observable sequence.
*/
observableProto.toSet = function () {
if (typeof root.Set === 'undefined') { throw new TypeError(); }
var source = this;
return new AnonymousObservable(function (o) {
var s = new root.Set();
return source.subscribe(
function (x) { s.add(x); },
function (e) { o.onError(e); },
function () {
o.onNext(s);
o.onCompleted();
});
}, source);
};
/**
* Converts the observable sequence to a Map if it exists.
* @param {Function} keySelector A function which produces the key for the Map.
* @param {Function} [elementSelector] An optional function which produces the element for the Map. If not present, defaults to the value from the observable sequence.
* @returns {Observable} An observable sequence with a single value of a Map containing the values from the observable sequence.
*/
observableProto.toMap = function (keySelector, elementSelector) {
if (typeof root.Map === 'undefined') { throw new TypeError(); }
var source = this;
return new AnonymousObservable(function (o) {
var m = new root.Map();
return source.subscribe(
function (x) {
var key;
try {
key = keySelector(x);
} catch (e) {
o.onError(e);
return;
}
var element = x;
if (elementSelector) {
try {
element = elementSelector(x);
} catch (e) {
o.onError(e);
return;
}
}
m.set(key, element);
},
function (e) { o.onError(e); },
function () {
o.onNext(m);
o.onCompleted();
});
}, source);
};
var fnString = 'function',
throwString = 'throw',
isObject = Rx.internals.isObject;
function toThunk(obj, ctx) {
if (Array.isArray(obj)) { return objectToThunk.call(ctx, obj); }
if (isGeneratorFunction(obj)) { return observableSpawn(obj.call(ctx)); }
if (isGenerator(obj)) { return observableSpawn(obj); }
if (isObservable(obj)) { return observableToThunk(obj); }
if (isPromise(obj)) { return promiseToThunk(obj); }
if (typeof obj === fnString) { return obj; }
if (isObject(obj) || Array.isArray(obj)) { return objectToThunk.call(ctx, obj); }
return obj;
}
function objectToThunk(obj) {
var ctx = this;
return function (done) {
var keys = Object.keys(obj),
pending = keys.length,
results = new obj.constructor(),
finished;
if (!pending) {
timeoutScheduler.schedule(function () { done(null, results); });
return;
}
for (var i = 0, len = keys.length; i < len; i++) {
run(obj[keys[i]], keys[i]);
}
function run(fn, key) {
if (finished) { return; }
try {
fn = toThunk(fn, ctx);
if (typeof fn !== fnString) {
results[key] = fn;
return --pending || done(null, results);
}
fn.call(ctx, function(err, res) {
if (finished) { return; }
if (err) {
finished = true;
return done(err);
}
results[key] = res;
--pending || done(null, results);
});
} catch (e) {
finished = true;
done(e);
}
}
}
}
function observableToThunk(observable) {
return function (fn) {
var value, hasValue = false;
observable.subscribe(
function (v) {
value = v;
hasValue = true;
},
fn,
function () {
hasValue && fn(null, value);
});
}
}
function promiseToThunk(promise) {
return function(fn) {
promise.then(function(res) {
fn(null, res);
}, fn);
}
}
function isObservable(obj) {
return obj && typeof obj.subscribe === fnString;
}
function isGeneratorFunction(obj) {
return obj && obj.constructor && obj.constructor.name === 'GeneratorFunction';
}
function isGenerator(obj) {
return obj && typeof obj.next === fnString && typeof obj[throwString] === fnString;
}
/*
* Spawns a generator function which allows for Promises, Observable sequences, Arrays, Objects, Generators and functions.
* @param {Function} The spawning function.
* @returns {Function} a function which has a done continuation.
*/
var observableSpawn = Rx.spawn = function (fn) {
var isGenFun = isGeneratorFunction(fn);
return function (done) {
var ctx = this,
gen = fn;
if (isGenFun) {
for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
var len = args.length,
hasCallback = len && typeof args[len - 1] === fnString;
done = hasCallback ? args.pop() : handleError;
gen = fn.apply(this, args);
} else {
done = done || handleError;
}
next();
function exit(err, res) {
timeoutScheduler.schedule(done.bind(ctx, err, res));
}
function next(err, res) {
var ret;
// multiple args
if (arguments.length > 2) {
for(var res = [], i = 1, len = arguments.length; i < len; i++) { res.push(arguments[i]); }
}
if (err) {
try {
ret = gen[throwString](err);
} catch (e) {
return exit(e);
}
}
if (!err) {
try {
ret = gen.next(res);
} catch (e) {
return exit(e);
}
}
if (ret.done) {
return exit(null, ret.value);
}
ret.value = toThunk(ret.value, ctx);
if (typeof ret.value === fnString) {
var called = false;
try {
ret.value.call(ctx, function() {
if (called) {
return;
}
called = true;
next.apply(ctx, arguments);
});
} catch (e) {
timeoutScheduler.schedule(function () {
if (called) {
return;
}
called = true;
next.call(ctx, e);
});
}
return;
}
// Not supported
next(new TypeError('Rx.spawn only supports a function, Promise, Observable, Object or Array.'));
}
}
};
function handleError(err) {
if (!err) { return; }
timeoutScheduler.schedule(function() {
throw err;
});
}
/**
* Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence.
*
* @example
* var res = Rx.Observable.start(function () { console.log('hello'); });
* var res = Rx.Observable.start(function () { console.log('hello'); }, Rx.Scheduler.timeout);
* var res = Rx.Observable.start(function () { this.log('hello'); }, Rx.Scheduler.timeout, console);
*
* @param {Function} func Function to run asynchronously.
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
* @param [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @returns {Observable} An observable sequence exposing the function's result value, or an exception.
*
* Remarks
* * The function is called immediately, not during the subscription of the resulting sequence.
* * Multiple subscriptions to the resulting sequence can observe the function's result.
*/
Observable.start = function (func, context, scheduler) {
return observableToAsync(func, context, scheduler)();
};
/**
* Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
* @param {Function} function Function to convert to an asynchronous function.
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @returns {Function} Asynchronous function.
*/
var observableToAsync = Observable.toAsync = function (func, context, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return function () {
var args = arguments,
subject = new AsyncSubject();
scheduler.schedule(function () {
var result;
try {
result = func.apply(context, args);
} catch (e) {
subject.onError(e);
return;
}
subject.onNext(result);
subject.onCompleted();
});
return subject.asObservable();
};
};
/**
* Converts a callback function to an observable sequence.
*
* @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
* @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array.
*/
Observable.fromCallback = function (func, context, selector) {
return function () {
var len = arguments.length, args = new Array(len)
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return new AnonymousObservable(function (observer) {
function handler() {
var len = arguments.length, results = new Array(len);
for(var i = 0; i < len; i++) { results[i] = arguments[i]; }
if (selector) {
try {
results = selector.apply(context, results);
} catch (e) {
return observer.onError(e);
}
observer.onNext(results);
} else {
if (results.length <= 1) {
observer.onNext.apply(observer, results);
} else {
observer.onNext(results);
}
}
observer.onCompleted();
}
args.push(handler);
func.apply(context, args);
}).publishLast().refCount();
};
};
/**
* Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
* @param {Function} func The function to call
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
* @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
*/
Observable.fromNodeCallback = function (func, context, selector) {
return function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return new AnonymousObservable(function (observer) {
function handler(err) {
if (err) {
observer.onError(err);
return;
}
var len = arguments.length, results = [];
for(var i = 1; i < len; i++) { results[i - 1] = arguments[i]; }
if (selector) {
try {
results = selector.apply(context, results);
} catch (e) {
return observer.onError(e);
}
observer.onNext(results);
} else {
if (results.length <= 1) {
observer.onNext.apply(observer, results);
} else {
observer.onNext(results);
}
}
observer.onCompleted();
}
args.push(handler);
func.apply(context, args);
}).publishLast().refCount();
};
};
function createListener (element, name, handler) {
if (element.addEventListener) {
element.addEventListener(name, handler, false);
return disposableCreate(function () {
element.removeEventListener(name, handler, false);
});
}
throw new Error('No listener found');
}
function createEventListener (el, eventName, handler) {
var disposables = new CompositeDisposable();
// Asume NodeList
if (Object.prototype.toString.call(el) === '[object NodeList]') {
for (var i = 0, len = el.length; i < len; i++) {
disposables.add(createEventListener(el.item(i), eventName, handler));
}
} else if (el) {
disposables.add(createListener(el, eventName, handler));
}
return disposables;
}
/**
* Configuration option to determine whether to use native events only
*/
Rx.config.useNativeEvents = false;
/**
* Creates an observable sequence by adding an event listener to the matching DOMElement or each item in the NodeList.
*
* @example
* var source = Rx.Observable.fromEvent(element, 'mouseup');
*
* @param {Object} element The DOMElement or NodeList to attach a listener.
* @param {String} eventName The event name to attach the observable sequence.
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @returns {Observable} An observable sequence of events from the specified element and the specified event.
*/
Observable.fromEvent = function (element, eventName, selector) {
// Node.js specific
if (element.addListener) {
return fromEventPattern(
function (h) { element.addListener(eventName, h); },
function (h) { element.removeListener(eventName, h); },
selector);
}
// Use only if non-native events are allowed
if (!Rx.config.useNativeEvents) {
// Handles jq, Angular.js, Zepto, Marionette, Ember.js
if (typeof element.on === 'function' && typeof element.off === 'function') {
return fromEventPattern(
function (h) { element.on(eventName, h); },
function (h) { element.off(eventName, h); },
selector);
}
}
return new AnonymousObservable(function (observer) {
return createEventListener(
element,
eventName,
function handler (e) {
var results = e;
if (selector) {
try {
results = selector(arguments);
} catch (err) {
return observer.onError(err);
}
}
observer.onNext(results);
});
}).publish().refCount();
};
/**
* Creates an observable sequence from an event emitter via an addHandler/removeHandler pair.
* @param {Function} addHandler The function to add a handler to the emitter.
* @param {Function} [removeHandler] The optional function to remove a handler from an emitter.
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @returns {Observable} An observable sequence which wraps an event from an event emitter
*/
var fromEventPattern = Observable.fromEventPattern = function (addHandler, removeHandler, selector) {
return new AnonymousObservable(function (observer) {
function innerHandler (e) {
var result = e;
if (selector) {
try {
result = selector(arguments);
} catch (err) {
return observer.onError(err);
}
}
observer.onNext(result);
}
var returnValue = addHandler(innerHandler);
return disposableCreate(function () {
if (removeHandler) {
removeHandler(innerHandler, returnValue);
}
});
}).publish().refCount();
};
/**
* Invokes the asynchronous function, surfacing the result through an observable sequence.
* @param {Function} functionAsync Asynchronous function which returns a Promise to run.
* @returns {Observable} An observable sequence exposing the function's result value, or an exception.
*/
Observable.startAsync = function (functionAsync) {
var promise;
try {
promise = functionAsync();
} catch (e) {
return observableThrow(e);
}
return observableFromPromise(promise);
}
var PausableObservable = (function (__super__) {
inherits(PausableObservable, __super__);
function subscribe(observer) {
var conn = this.source.publish(),
subscription = conn.subscribe(observer),
connection = disposableEmpty;
var pausable = this.pauser.distinctUntilChanged().subscribe(function (b) {
if (b) {
connection = conn.connect();
} else {
connection.dispose();
connection = disposableEmpty;
}
});
return new CompositeDisposable(subscription, connection, pausable);
}
function PausableObservable(source, pauser) {
this.source = source;
this.controller = new Subject();
if (pauser && pauser.subscribe) {
this.pauser = this.controller.merge(pauser);
} else {
this.pauser = this.controller;
}
__super__.call(this, subscribe, source);
}
PausableObservable.prototype.pause = function () {
this.controller.onNext(false);
};
PausableObservable.prototype.resume = function () {
this.controller.onNext(true);
};
return PausableObservable;
}(Observable));
/**
* Pauses the underlying observable sequence based upon the observable sequence which yields true/false.
* @example
* var pauser = new Rx.Subject();
* var source = Rx.Observable.interval(100).pausable(pauser);
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.pausable = function (pauser) {
return new PausableObservable(this, pauser);
};
function combineLatestSource(source, subject, resultSelector) {
return new AnonymousObservable(function (o) {
var hasValue = [false, false],
hasValueAll = false,
isDone = false,
values = new Array(2),
err;
function next(x, i) {
values[i] = x
var res;
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
if (err) {
o.onError(err);
return;
}
try {
res = resultSelector.apply(null, values);
} catch (ex) {
o.onError(ex);
return;
}
o.onNext(res);
}
if (isDone && values[1]) {
o.onCompleted();
}
}
return new CompositeDisposable(
source.subscribe(
function (x) {
next(x, 0);
},
function (e) {
if (values[1]) {
o.onError(e);
} else {
err = e;
}
},
function () {
isDone = true;
values[1] && o.onCompleted();
}),
subject.subscribe(
function (x) {
next(x, 1);
},
function (e) { o.onError(e); },
function () {
isDone = true;
next(true, 1);
})
);
}, source);
}
var PausableBufferedObservable = (function (__super__) {
inherits(PausableBufferedObservable, __super__);
function subscribe(o) {
var q = [], previousShouldFire;
var subscription =
combineLatestSource(
this.source,
this.pauser.distinctUntilChanged().startWith(false),
function (data, shouldFire) {
return { data: data, shouldFire: shouldFire };
})
.subscribe(
function (results) {
if (previousShouldFire !== undefined && results.shouldFire != previousShouldFire) {
previousShouldFire = results.shouldFire;
// change in shouldFire
if (results.shouldFire) {
while (q.length > 0) {
o.onNext(q.shift());
}
}
} else {
previousShouldFire = results.shouldFire;
// new data
if (results.shouldFire) {
o.onNext(results.data);
} else {
q.push(results.data);
}
}
},
function (err) {
// Empty buffer before sending error
while (q.length > 0) {
o.onNext(q.shift());
}
o.onError(err);
},
function () {
// Empty buffer before sending completion
while (q.length > 0) {
o.onNext(q.shift());
}
o.onCompleted();
}
);
return subscription;
}
function PausableBufferedObservable(source, pauser) {
this.source = source;
this.controller = new Subject();
if (pauser && pauser.subscribe) {
this.pauser = this.controller.merge(pauser);
} else {
this.pauser = this.controller;
}
__super__.call(this, subscribe, source);
}
PausableBufferedObservable.prototype.pause = function () {
this.controller.onNext(false);
};
PausableBufferedObservable.prototype.resume = function () {
this.controller.onNext(true);
};
return PausableBufferedObservable;
}(Observable));
/**
* Pauses the underlying observable sequence based upon the observable sequence which yields true/false,
* and yields the values that were buffered while paused.
* @example
* var pauser = new Rx.Subject();
* var source = Rx.Observable.interval(100).pausableBuffered(pauser);
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.pausableBuffered = function (subject) {
return new PausableBufferedObservable(this, subject);
};
var ControlledObservable = (function (__super__) {
inherits(ControlledObservable, __super__);
function subscribe (observer) {
return this.source.subscribe(observer);
}
function ControlledObservable (source, enableQueue, scheduler) {
__super__.call(this, subscribe, source);
this.subject = new ControlledSubject(enableQueue, scheduler);
this.source = source.multicast(this.subject).refCount();
}
ControlledObservable.prototype.request = function (numberOfItems) {
return this.subject.request(numberOfItems == null ? -1 : numberOfItems);
};
return ControlledObservable;
}(Observable));
var ControlledSubject = (function (__super__) {
function subscribe (observer) {
return this.subject.subscribe(observer);
}
inherits(ControlledSubject, __super__);
function ControlledSubject(enableQueue, scheduler) {
enableQueue == null && (enableQueue = true);
__super__.call(this, subscribe);
this.subject = new Subject();
this.enableQueue = enableQueue;
this.queue = enableQueue ? [] : null;
this.requestedCount = 0;
this.requestedDisposable = disposableEmpty;
this.error = null;
this.hasFailed = false;
this.hasCompleted = false;
this.scheduler = scheduler || currentThreadScheduler;
}
addProperties(ControlledSubject.prototype, Observer, {
onCompleted: function () {
this.hasCompleted = true;
if (!this.enableQueue || this.queue.length === 0) {
this.subject.onCompleted();
} else {
this.queue.push(Notification.createOnCompleted());
}
},
onError: function (error) {
this.hasFailed = true;
this.error = error;
if (!this.enableQueue || this.queue.length === 0) {
this.subject.onError(error);
} else {
this.queue.push(Notification.createOnError(error));
}
},
onNext: function (value) {
var hasRequested = false;
if (this.requestedCount === 0) {
this.enableQueue && this.queue.push(Notification.createOnNext(value));
} else {
(this.requestedCount !== -1 && this.requestedCount-- === 0) && this.disposeCurrentRequest();
hasRequested = true;
}
hasRequested && this.subject.onNext(value);
},
_processRequest: function (numberOfItems) {
if (this.enableQueue) {
while ((this.queue.length >= numberOfItems && numberOfItems > 0) ||
(this.queue.length > 0 && this.queue[0].kind !== 'N')) {
var first = this.queue.shift();
first.accept(this.subject);
if (first.kind === 'N') {
numberOfItems--;
} else {
this.disposeCurrentRequest();
this.queue = [];
}
}
return { numberOfItems : numberOfItems, returnValue: this.queue.length !== 0};
}
return { numberOfItems: numberOfItems, returnValue: false };
},
request: function (number) {
this.disposeCurrentRequest();
var self = this;
this.requestedDisposable = this.scheduler.scheduleWithState(number,
function(s, i) {
var r = self._processRequest(i), remaining = r.numberOfItems;
if (!r.returnValue) {
self.requestedCount = remaining;
self.requestedDisposable = disposableCreate(function () {
self.requestedCount = 0;
});
}
});
return this.requestedDisposable;
},
disposeCurrentRequest: function () {
this.requestedDisposable.dispose();
this.requestedDisposable = disposableEmpty;
}
});
return ControlledSubject;
}(Observable));
/**
* Attaches a controller to the observable sequence with the ability to queue.
* @example
* var source = Rx.Observable.interval(100).controlled();
* source.request(3); // Reads 3 values
* @param {bool} enableQueue truthy value to determine if values should be queued pending the next request
* @param {Scheduler} scheduler determines how the requests will be scheduled
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.controlled = function (enableQueue, scheduler) {
if (enableQueue && isScheduler(enableQueue)) {
scheduler = enableQueue;
enableQueue = true;
}
if (enableQueue == null) { enableQueue = true; }
return new ControlledObservable(this, enableQueue, scheduler);
};
var StopAndWaitObservable = (function (__super__) {
function subscribe (observer) {
this.subscription = this.source.subscribe(new StopAndWaitObserver(observer, this, this.subscription));
var self = this;
timeoutScheduler.schedule(function () { self.source.request(1); });
return this.subscription;
}
inherits(StopAndWaitObservable, __super__);
function StopAndWaitObservable (source) {
__super__.call(this, subscribe, source);
this.source = source;
}
var StopAndWaitObserver = (function (__sub__) {
inherits(StopAndWaitObserver, __sub__);
function StopAndWaitObserver (observer, observable, cancel) {
__sub__.call(this);
this.observer = observer;
this.observable = observable;
this.cancel = cancel;
}
var stopAndWaitObserverProto = StopAndWaitObserver.prototype;
stopAndWaitObserverProto.completed = function () {
this.observer.onCompleted();
this.dispose();
};
stopAndWaitObserverProto.error = function (error) {
this.observer.onError(error);
this.dispose();
}
stopAndWaitObserverProto.next = function (value) {
this.observer.onNext(value);
var self = this;
timeoutScheduler.schedule(function () {
self.observable.source.request(1);
});
};
stopAndWaitObserverProto.dispose = function () {
this.observer = null;
if (this.cancel) {
this.cancel.dispose();
this.cancel = null;
}
__sub__.prototype.dispose.call(this);
};
return StopAndWaitObserver;
}(AbstractObserver));
return StopAndWaitObservable;
}(Observable));
/**
* Attaches a stop and wait observable to the current observable.
* @returns {Observable} A stop and wait observable.
*/
ControlledObservable.prototype.stopAndWait = function () {
return new StopAndWaitObservable(this);
};
var WindowedObservable = (function (__super__) {
function subscribe (observer) {
this.subscription = this.source.subscribe(new WindowedObserver(observer, this, this.subscription));
var self = this;
timeoutScheduler.schedule(function () {
self.source.request(self.windowSize);
});
return this.subscription;
}
inherits(WindowedObservable, __super__);
function WindowedObservable(source, windowSize) {
__super__.call(this, subscribe, source);
this.source = source;
this.windowSize = windowSize;
}
var WindowedObserver = (function (__sub__) {
inherits(WindowedObserver, __sub__);
function WindowedObserver(observer, observable, cancel) {
this.observer = observer;
this.observable = observable;
this.cancel = cancel;
this.received = 0;
}
var windowedObserverPrototype = WindowedObserver.prototype;
windowedObserverPrototype.completed = function () {
this.observer.onCompleted();
this.dispose();
};
windowedObserverPrototype.error = function (error) {
this.observer.onError(error);
this.dispose();
};
windowedObserverPrototype.next = function (value) {
this.observer.onNext(value);
this.received = ++this.received % this.observable.windowSize;
if (this.received === 0) {
var self = this;
timeoutScheduler.schedule(function () {
self.observable.source.request(self.observable.windowSize);
});
}
};
windowedObserverPrototype.dispose = function () {
this.observer = null;
if (this.cancel) {
this.cancel.dispose();
this.cancel = null;
}
__sub__.prototype.dispose.call(this);
};
return WindowedObserver;
}(AbstractObserver));
return WindowedObservable;
}(Observable));
/**
* Creates a sliding windowed observable based upon the window size.
* @param {Number} windowSize The number of items in the window
* @returns {Observable} A windowed observable based upon the window size.
*/
ControlledObservable.prototype.windowed = function (windowSize) {
return new WindowedObservable(this, windowSize);
};
/**
* Pipes the existing Observable sequence into a Node.js Stream.
* @param {Stream} dest The destination Node.js stream.
* @returns {Stream} The destination stream.
*/
observableProto.pipe = function (dest) {
var source = this.pausableBuffered();
function onDrain() {
source.resume();
}
dest.addListener('drain', onDrain);
source.subscribe(
function (x) {
!dest.write(String(x)) && source.pause();
},
function (err) {
dest.emit('error', err);
},
function () {
// Hack check because STDIO is not closable
!dest._isStdio && dest.end();
dest.removeListener('drain', onDrain);
});
source.resume();
return dest;
};
/**
* Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. Each
* subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's
* invocation. For specializations with fixed subject types, see Publish, PublishLast, and Replay.
*
* @example
* 1 - res = source.multicast(observable);
* 2 - res = source.multicast(function () { return new Subject(); }, function (x) { return x; });
*
* @param {Function|Subject} subjectOrSubjectSelector
* Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function.
* Or:
* Subject to push source elements into.
*
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. Specified only if <paramref name="subjectOrSubjectSelector" is a factory function.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.multicast = function (subjectOrSubjectSelector, selector) {
var source = this;
return typeof subjectOrSubjectSelector === 'function' ?
new AnonymousObservable(function (observer) {
var connectable = source.multicast(subjectOrSubjectSelector());
return new CompositeDisposable(selector(connectable).subscribe(observer), connectable.connect());
}, source) :
new ConnectableObservable(source, subjectOrSubjectSelector);
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence.
* This operator is a specialization of Multicast using a regular Subject.
*
* @example
* var resres = source.publish();
* var res = source.publish(function (x) { return x; });
*
* @param {Function} [selector] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publish = function (selector) {
return selector && isFunction(selector) ?
this.multicast(function () { return new Subject(); }, selector) :
this.multicast(new Subject());
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence.
* This operator is a specialization of publish which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.share = function () {
return this.publish().refCount();
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification.
* This operator is a specialization of Multicast using a AsyncSubject.
*
* @example
* var res = source.publishLast();
* var res = source.publishLast(function (x) { return x; });
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will only receive the last notification of the source.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publishLast = function (selector) {
return selector && isFunction(selector) ?
this.multicast(function () { return new AsyncSubject(); }, selector) :
this.multicast(new AsyncSubject());
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue.
* This operator is a specialization of Multicast using a BehaviorSubject.
*
* @example
* var res = source.publishValue(42);
* var res = source.publishValue(function (x) { return x.select(function (y) { return y * y; }) }, 42);
*
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on.
* @param {Mixed} initialValue Initial value received by observers upon subscription.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publishValue = function (initialValueOrSelector, initialValue) {
return arguments.length === 2 ?
this.multicast(function () {
return new BehaviorSubject(initialValue);
}, initialValueOrSelector) :
this.multicast(new BehaviorSubject(initialValueOrSelector));
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence and starts with an initialValue.
* This operator is a specialization of publishValue which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
* @param {Mixed} initialValue Initial value received by observers upon subscription.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.shareValue = function (initialValue) {
return this.publishValue(initialValue).refCount();
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
* This operator is a specialization of Multicast using a ReplaySubject.
*
* @example
* var res = source.replay(null, 3);
* var res = source.replay(null, 3, 500);
* var res = source.replay(null, 3, 500, scheduler);
* var res = source.replay(function (x) { return x.take(6).repeat(); }, 3, 500, scheduler);
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.
* @param bufferSize [Optional] Maximum element count of the replay buffer.
* @param windowSize [Optional] Maximum time length of the replay buffer.
* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.replay = function (selector, bufferSize, windowSize, scheduler) {
return selector && isFunction(selector) ?
this.multicast(function () { return new ReplaySubject(bufferSize, windowSize, scheduler); }, selector) :
this.multicast(new ReplaySubject(bufferSize, windowSize, scheduler));
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
* This operator is a specialization of replay which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
*
* @example
* var res = source.shareReplay(3);
* var res = source.shareReplay(3, 500);
* var res = source.shareReplay(3, 500, scheduler);
*
* @param bufferSize [Optional] Maximum element count of the replay buffer.
* @param window [Optional] Maximum time length of the replay buffer.
* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.shareReplay = function (bufferSize, windowSize, scheduler) {
return this.replay(null, bufferSize, windowSize, scheduler).refCount();
};
var InnerSubscription = function (subject, observer) {
this.subject = subject;
this.observer = observer;
};
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 a value that changes over time.
* Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications.
*/
var BehaviorSubject = Rx.BehaviorSubject = (function (__super__) {
function subscribe(observer) {
checkDisposed(this);
if (!this.isStopped) {
this.observers.push(observer);
observer.onNext(this.value);
return new InnerSubscription(this, observer);
}
if (this.hasError) {
observer.onError(this.error);
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(BehaviorSubject, __super__);
/**
* Initializes a new instance of the BehaviorSubject class which creates a subject that caches its last value and starts with the specified value.
* @param {Mixed} value Initial value sent to observers when no other value has been received by the subject yet.
*/
function BehaviorSubject(value) {
__super__.call(this, subscribe);
this.value = value,
this.observers = [],
this.isDisposed = false,
this.isStopped = false,
this.hasError = false;
}
addProperties(BehaviorSubject.prototype, Observer, {
/**
* Gets the current value or throws an exception.
* Value is frozen after onCompleted is called.
* After onError is called always throws the specified exception.
* An exception is always thrown after dispose is called.
* @returns {Mixed} The initial value passed to the constructor until onNext is called; after which, the last value passed to onNext.
*/
getValue: function () {
checkDisposed(this);
if (this.hasError) {
throw this.error;
}
return this.value;
},
/**
* 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(this);
if (this.isStopped) { return; }
this.isStopped = true;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers.length = 0;
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {
checkDisposed(this);
if (this.isStopped) { return; }
this.isStopped = true;
this.hasError = true;
this.error = error;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onError(error);
}
this.observers.length = 0;
},
/**
* 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(this);
if (this.isStopped) { return; }
this.value = value;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onNext(value);
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
this.value = null;
this.exception = null;
}
});
return BehaviorSubject;
}(Observable));
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed and future observers, subject to buffer trimming policies.
*/
var ReplaySubject = Rx.ReplaySubject = (function (__super__) {
var maxSafeInteger = Math.pow(2, 53) - 1;
function createRemovableDisposable(subject, observer) {
return disposableCreate(function () {
observer.dispose();
!subject.isDisposed && subject.observers.splice(subject.observers.indexOf(observer), 1);
});
}
function subscribe(observer) {
var so = new ScheduledObserver(this.scheduler, observer),
subscription = createRemovableDisposable(this, so);
checkDisposed(this);
this._trim(this.scheduler.now());
this.observers.push(so);
for (var i = 0, len = this.q.length; i < len; i++) {
so.onNext(this.q[i].value);
}
if (this.hasError) {
so.onError(this.error);
} else if (this.isStopped) {
so.onCompleted();
}
so.ensureActive();
return subscription;
}
inherits(ReplaySubject, __super__);
/**
* Initializes a new instance of the ReplaySubject class with the specified buffer size, window size and scheduler.
* @param {Number} [bufferSize] Maximum element count of the replay buffer.
* @param {Number} [windowSize] Maximum time length of the replay buffer.
* @param {Scheduler} [scheduler] Scheduler the observers are invoked on.
*/
function ReplaySubject(bufferSize, windowSize, scheduler) {
this.bufferSize = bufferSize == null ? maxSafeInteger : bufferSize;
this.windowSize = windowSize == null ? maxSafeInteger : windowSize;
this.scheduler = scheduler || currentThreadScheduler;
this.q = [];
this.observers = [];
this.isStopped = false;
this.isDisposed = false;
this.hasError = false;
this.error = null;
__super__.call(this, subscribe);
}
addProperties(ReplaySubject.prototype, Observer.prototype, {
/**
* 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;
},
_trim: function (now) {
while (this.q.length > this.bufferSize) {
this.q.shift();
}
while (this.q.length > 0 && (now - this.q[0].interval) > this.windowSize) {
this.q.shift();
}
},
/**
* 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(this);
if (this.isStopped) { return; }
var now = this.scheduler.now();
this.q.push({ interval: now, value: value });
this._trim(now);
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
var observer = os[i];
observer.onNext(value);
observer.ensureActive();
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {
checkDisposed(this);
if (this.isStopped) { return; }
this.isStopped = true;
this.error = error;
this.hasError = true;
var now = this.scheduler.now();
this._trim(now);
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
var observer = os[i];
observer.onError(error);
observer.ensureActive();
}
this.observers.length = 0;
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed(this);
if (this.isStopped) { return; }
this.isStopped = true;
var now = this.scheduler.now();
this._trim(now);
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
var observer = os[i];
observer.onCompleted();
observer.ensureActive();
}
this.observers.length = 0;
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
return ReplaySubject;
}(Observable));
var ConnectableObservable = Rx.ConnectableObservable = (function (__super__) {
inherits(ConnectableObservable, __super__);
function ConnectableObservable(source, subject) {
var hasSubscription = false,
subscription,
sourceObservable = source.asObservable();
this.connect = function () {
if (!hasSubscription) {
hasSubscription = true;
subscription = new CompositeDisposable(sourceObservable.subscribe(subject), disposableCreate(function () {
hasSubscription = false;
}));
}
return subscription;
};
__super__.call(this, function (o) { return subject.subscribe(o); });
}
ConnectableObservable.prototype.refCount = function () {
var connectableSubscription, count = 0, source = this;
return new AnonymousObservable(function (observer) {
var shouldConnect = ++count === 1,
subscription = source.subscribe(observer);
shouldConnect && (connectableSubscription = source.connect());
return function () {
subscription.dispose();
--count === 0 && connectableSubscription.dispose();
};
});
};
return ConnectableObservable;
}(Observable));
var Dictionary = (function () {
var primes = [1, 3, 7, 13, 31, 61, 127, 251, 509, 1021, 2039, 4093, 8191, 16381, 32749, 65521, 131071, 262139, 524287, 1048573, 2097143, 4194301, 8388593, 16777213, 33554393, 67108859, 134217689, 268435399, 536870909, 1073741789, 2147483647],
noSuchkey = "no such key",
duplicatekey = "duplicate key";
function isPrime(candidate) {
if ((candidate & 1) === 0) { return candidate === 2; }
var num1 = Math.sqrt(candidate),
num2 = 3;
while (num2 <= num1) {
if (candidate % num2 === 0) { return false; }
num2 += 2;
}
return true;
}
function getPrime(min) {
var index, num, candidate;
for (index = 0; index < primes.length; ++index) {
num = primes[index];
if (num >= min) { return num; }
}
candidate = min | 1;
while (candidate < primes[primes.length - 1]) {
if (isPrime(candidate)) { return candidate; }
candidate += 2;
}
return min;
}
function stringHashFn(str) {
var hash = 757602046;
if (!str.length) { return hash; }
for (var i = 0, len = str.length; i < len; i++) {
var character = str.charCodeAt(i);
hash = ((hash << 5) - hash) + character;
hash = hash & hash;
}
return hash;
}
function numberHashFn(key) {
var c2 = 0x27d4eb2d;
key = (key ^ 61) ^ (key >>> 16);
key = key + (key << 3);
key = key ^ (key >>> 4);
key = key * c2;
key = key ^ (key >>> 15);
return key;
}
var getHashCode = (function () {
var uniqueIdCounter = 0;
return function (obj) {
if (obj == null) { throw new Error(noSuchkey); }
// Check for built-ins before tacking on our own for any object
if (typeof obj === 'string') { return stringHashFn(obj); }
if (typeof obj === 'number') { return numberHashFn(obj); }
if (typeof obj === 'boolean') { return obj === true ? 1 : 0; }
if (obj instanceof Date) { return numberHashFn(obj.valueOf()); }
if (obj instanceof RegExp) { return stringHashFn(obj.toString()); }
if (typeof obj.valueOf === 'function') {
// Hack check for valueOf
var valueOf = obj.valueOf();
if (typeof valueOf === 'number') { return numberHashFn(valueOf); }
if (typeof valueOf === 'string') { return stringHashFn(valueOf); }
}
if (obj.hashCode) { return obj.hashCode(); }
var id = 17 * uniqueIdCounter++;
obj.hashCode = function () { return id; };
return id;
};
}());
function newEntry() {
return { key: null, value: null, next: 0, hashCode: 0 };
}
function Dictionary(capacity, comparer) {
if (capacity < 0) { throw new ArgumentOutOfRangeError(); }
if (capacity > 0) { this._initialize(capacity); }
this.comparer = comparer || defaultComparer;
this.freeCount = 0;
this.size = 0;
this.freeList = -1;
}
var dictionaryProto = Dictionary.prototype;
dictionaryProto._initialize = function (capacity) {
var prime = getPrime(capacity), i;
this.buckets = new Array(prime);
this.entries = new Array(prime);
for (i = 0; i < prime; i++) {
this.buckets[i] = -1;
this.entries[i] = newEntry();
}
this.freeList = -1;
};
dictionaryProto.add = function (key, value) {
this._insert(key, value, true);
};
dictionaryProto._insert = function (key, value, add) {
if (!this.buckets) { this._initialize(0); }
var index3,
num = getHashCode(key) & 2147483647,
index1 = num % this.buckets.length;
for (var index2 = this.buckets[index1]; index2 >= 0; index2 = this.entries[index2].next) {
if (this.entries[index2].hashCode === num && this.comparer(this.entries[index2].key, key)) {
if (add) { throw new Error(duplicatekey); }
this.entries[index2].value = value;
return;
}
}
if (this.freeCount > 0) {
index3 = this.freeList;
this.freeList = this.entries[index3].next;
--this.freeCount;
} else {
if (this.size === this.entries.length) {
this._resize();
index1 = num % this.buckets.length;
}
index3 = this.size;
++this.size;
}
this.entries[index3].hashCode = num;
this.entries[index3].next = this.buckets[index1];
this.entries[index3].key = key;
this.entries[index3].value = value;
this.buckets[index1] = index3;
};
dictionaryProto._resize = function () {
var prime = getPrime(this.size * 2),
numArray = new Array(prime);
for (index = 0; index < numArray.length; ++index) { numArray[index] = -1; }
var entryArray = new Array(prime);
for (index = 0; index < this.size; ++index) { entryArray[index] = this.entries[index]; }
for (var index = this.size; index < prime; ++index) { entryArray[index] = newEntry(); }
for (var index1 = 0; index1 < this.size; ++index1) {
var index2 = entryArray[index1].hashCode % prime;
entryArray[index1].next = numArray[index2];
numArray[index2] = index1;
}
this.buckets = numArray;
this.entries = entryArray;
};
dictionaryProto.remove = function (key) {
if (this.buckets) {
var num = getHashCode(key) & 2147483647,
index1 = num % this.buckets.length,
index2 = -1;
for (var index3 = this.buckets[index1]; index3 >= 0; index3 = this.entries[index3].next) {
if (this.entries[index3].hashCode === num && this.comparer(this.entries[index3].key, key)) {
if (index2 < 0) {
this.buckets[index1] = this.entries[index3].next;
} else {
this.entries[index2].next = this.entries[index3].next;
}
this.entries[index3].hashCode = -1;
this.entries[index3].next = this.freeList;
this.entries[index3].key = null;
this.entries[index3].value = null;
this.freeList = index3;
++this.freeCount;
return true;
} else {
index2 = index3;
}
}
}
return false;
};
dictionaryProto.clear = function () {
var index, len;
if (this.size <= 0) { return; }
for (index = 0, len = this.buckets.length; index < len; ++index) {
this.buckets[index] = -1;
}
for (index = 0; index < this.size; ++index) {
this.entries[index] = newEntry();
}
this.freeList = -1;
this.size = 0;
};
dictionaryProto._findEntry = function (key) {
if (this.buckets) {
var num = getHashCode(key) & 2147483647;
for (var index = this.buckets[num % this.buckets.length]; index >= 0; index = this.entries[index].next) {
if (this.entries[index].hashCode === num && this.comparer(this.entries[index].key, key)) {
return index;
}
}
}
return -1;
};
dictionaryProto.count = function () {
return this.size - this.freeCount;
};
dictionaryProto.tryGetValue = function (key) {
var entry = this._findEntry(key);
return entry >= 0 ?
this.entries[entry].value :
undefined;
};
dictionaryProto.getValues = function () {
var index = 0, results = [];
if (this.entries) {
for (var index1 = 0; index1 < this.size; index1++) {
if (this.entries[index1].hashCode >= 0) {
results[index++] = this.entries[index1].value;
}
}
}
return results;
};
dictionaryProto.get = function (key) {
var entry = this._findEntry(key);
if (entry >= 0) { return this.entries[entry].value; }
throw new Error(noSuchkey);
};
dictionaryProto.set = function (key, value) {
this._insert(key, value, false);
};
dictionaryProto.containskey = function (key) {
return this._findEntry(key) >= 0;
};
return Dictionary;
}());
/**
* Correlates the elements of two sequences based on overlapping durations.
*
* @param {Observable} right The right observable sequence to join elements for.
* @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.
* @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.
* @param {Function} resultSelector A function invoked to compute a result element for any two overlapping elements of the left and right observable sequences. The parameters passed to the function correspond with the elements from the left and right source sequences for which overlap occurs.
* @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration.
*/
observableProto.join = function (right, leftDurationSelector, rightDurationSelector, resultSelector) {
var left = this;
return new AnonymousObservable(function (observer) {
var group = new CompositeDisposable();
var leftDone = false, rightDone = false;
var leftId = 0, rightId = 0;
var leftMap = new Dictionary(), rightMap = new Dictionary();
group.add(left.subscribe(
function (value) {
var id = leftId++;
var md = new SingleAssignmentDisposable();
leftMap.add(id, value);
group.add(md);
var expire = function () {
leftMap.remove(id) && leftMap.count() === 0 && leftDone && observer.onCompleted();
group.remove(md);
};
var duration;
try {
duration = leftDurationSelector(value);
} catch (e) {
observer.onError(e);
return;
}
md.setDisposable(duration.take(1).subscribe(noop, observer.onError.bind(observer), expire));
rightMap.getValues().forEach(function (v) {
var result;
try {
result = resultSelector(value, v);
} catch (exn) {
observer.onError(exn);
return;
}
observer.onNext(result);
});
},
observer.onError.bind(observer),
function () {
leftDone = true;
(rightDone || leftMap.count() === 0) && observer.onCompleted();
})
);
group.add(right.subscribe(
function (value) {
var id = rightId++;
var md = new SingleAssignmentDisposable();
rightMap.add(id, value);
group.add(md);
var expire = function () {
rightMap.remove(id) && rightMap.count() === 0 && rightDone && observer.onCompleted();
group.remove(md);
};
var duration;
try {
duration = rightDurationSelector(value);
} catch (e) {
observer.onError(e);
return;
}
md.setDisposable(duration.take(1).subscribe(noop, observer.onError.bind(observer), expire));
leftMap.getValues().forEach(function (v) {
var result;
try {
result = resultSelector(v, value);
} catch (exn) {
observer.onError(exn);
return;
}
observer.onNext(result);
});
},
observer.onError.bind(observer),
function () {
rightDone = true;
(leftDone || rightMap.count() === 0) && observer.onCompleted();
})
);
return group;
}, left);
};
/**
* Correlates the elements of two sequences based on overlapping durations, and groups the results.
*
* @param {Observable} right The right observable sequence to join elements for.
* @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.
* @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.
* @param {Function} resultSelector A function invoked to compute a result element for any element of the left sequence with overlapping elements from the right observable sequence. The first parameter passed to the function is an element of the left sequence. The second parameter passed to the function is an observable sequence with elements from the right sequence that overlap with the left sequence's element.
* @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration.
*/
observableProto.groupJoin = function (right, leftDurationSelector, rightDurationSelector, resultSelector) {
var left = this;
return new AnonymousObservable(function (observer) {
var group = new CompositeDisposable();
var r = new RefCountDisposable(group);
var leftMap = new Dictionary(), rightMap = new Dictionary();
var leftId = 0, rightId = 0;
function handleError(e) { return function (v) { v.onError(e); }; };
group.add(left.subscribe(
function (value) {
var s = new Subject();
var id = leftId++;
leftMap.add(id, s);
var result;
try {
result = resultSelector(value, addRef(s, r));
} catch (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
observer.onNext(result);
rightMap.getValues().forEach(function (v) { s.onNext(v); });
var md = new SingleAssignmentDisposable();
group.add(md);
var expire = function () {
leftMap.remove(id) && s.onCompleted();
group.remove(md);
};
var duration;
try {
duration = leftDurationSelector(value);
} catch (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
md.setDisposable(duration.take(1).subscribe(
noop,
function (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
},
expire)
);
},
function (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
},
observer.onCompleted.bind(observer))
);
group.add(right.subscribe(
function (value) {
var id = rightId++;
rightMap.add(id, value);
var md = new SingleAssignmentDisposable();
group.add(md);
var expire = function () {
rightMap.remove(id);
group.remove(md);
};
var duration;
try {
duration = rightDurationSelector(value);
} catch (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
md.setDisposable(duration.take(1).subscribe(
noop,
function (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
},
expire)
);
leftMap.getValues().forEach(function (v) { v.onNext(value); });
},
function (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
})
);
return r;
}, left);
};
/**
* Projects each element of an observable sequence into zero or more buffers.
*
* @param {Mixed} bufferOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
* @param {Function} [bufferClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.buffer = function (bufferOpeningsOrClosingSelector, bufferClosingSelector) {
return this.window.apply(this, arguments).selectMany(function (x) { return x.toArray(); });
};
/**
* Projects each element of an observable sequence into zero or more windows.
*
* @param {Mixed} windowOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
* @param {Function} [windowClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.window = function (windowOpeningsOrClosingSelector, windowClosingSelector) {
if (arguments.length === 1 && typeof arguments[0] !== 'function') {
return observableWindowWithBoundaries.call(this, windowOpeningsOrClosingSelector);
}
return typeof windowOpeningsOrClosingSelector === 'function' ?
observableWindowWithClosingSelector.call(this, windowOpeningsOrClosingSelector) :
observableWindowWithOpenings.call(this, windowOpeningsOrClosingSelector, windowClosingSelector);
};
function observableWindowWithOpenings(windowOpenings, windowClosingSelector) {
return windowOpenings.groupJoin(this, windowClosingSelector, observableEmpty, function (_, win) {
return win;
});
}
function observableWindowWithBoundaries(windowBoundaries) {
var source = this;
return new AnonymousObservable(function (observer) {
var win = new Subject(),
d = new CompositeDisposable(),
r = new RefCountDisposable(d);
observer.onNext(addRef(win, r));
d.add(source.subscribe(function (x) {
win.onNext(x);
}, function (err) {
win.onError(err);
observer.onError(err);
}, function () {
win.onCompleted();
observer.onCompleted();
}));
isPromise(windowBoundaries) && (windowBoundaries = observableFromPromise(windowBoundaries));
d.add(windowBoundaries.subscribe(function (w) {
win.onCompleted();
win = new Subject();
observer.onNext(addRef(win, r));
}, function (err) {
win.onError(err);
observer.onError(err);
}, function () {
win.onCompleted();
observer.onCompleted();
}));
return r;
}, source);
}
function observableWindowWithClosingSelector(windowClosingSelector) {
var source = this;
return new AnonymousObservable(function (observer) {
var m = new SerialDisposable(),
d = new CompositeDisposable(m),
r = new RefCountDisposable(d),
win = new Subject();
observer.onNext(addRef(win, r));
d.add(source.subscribe(function (x) {
win.onNext(x);
}, function (err) {
win.onError(err);
observer.onError(err);
}, function () {
win.onCompleted();
observer.onCompleted();
}));
function createWindowClose () {
var windowClose;
try {
windowClose = windowClosingSelector();
} catch (e) {
observer.onError(e);
return;
}
isPromise(windowClose) && (windowClose = observableFromPromise(windowClose));
var m1 = new SingleAssignmentDisposable();
m.setDisposable(m1);
m1.setDisposable(windowClose.take(1).subscribe(noop, function (err) {
win.onError(err);
observer.onError(err);
}, function () {
win.onCompleted();
win = new Subject();
observer.onNext(addRef(win, r));
createWindowClose();
}));
}
createWindowClose();
return r;
}, source);
}
/**
* Returns a new observable that triggers on the second and subsequent triggerings of the input observable.
* The Nth triggering of the input observable passes the arguments from the N-1th and Nth triggering as a pair.
* The argument passed to the N-1th triggering is held in hidden internal state until the Nth triggering occurs.
* @returns {Observable} An observable that triggers on successive pairs of observations from the input observable as an array.
*/
observableProto.pairwise = function () {
var source = this;
return new AnonymousObservable(function (observer) {
var previous, hasPrevious = false;
return source.subscribe(
function (x) {
if (hasPrevious) {
observer.onNext([previous, x]);
} else {
hasPrevious = true;
}
previous = x;
},
observer.onError.bind(observer),
observer.onCompleted.bind(observer));
}, source);
};
/**
* Returns two observables which partition the observations of the source by the given function.
* The first will trigger observations for those values for which the predicate returns true.
* The second will trigger observations for those values where the predicate returns false.
* The predicate is executed once for each subscribed observer.
* Both also propagate all error observations arising from the source and each completes
* when the source completes.
* @param {Function} predicate
* The function to determine which output Observable will trigger a particular observation.
* @returns {Array}
* An array of observables. The first triggers when the predicate returns true,
* and the second triggers when the predicate returns false.
*/
observableProto.partition = function(predicate, thisArg) {
return [
this.filter(predicate, thisArg),
this.filter(function (x, i, o) { return !predicate.call(thisArg, x, i, o); })
];
};
function enumerableWhile(condition, source) {
return new Enumerable(function () {
return new Enumerator(function () {
return condition() ?
{ done: false, value: source } :
{ done: true, value: undefined };
});
});
}
/**
* Returns an observable sequence that is the result of invoking the selector on the source sequence, without sharing subscriptions.
* This operator allows for a fluent style of writing queries that use the same sequence multiple times.
*
* @param {Function} selector Selector function which can use the source sequence as many times as needed, without sharing subscriptions to the source sequence.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.letBind = observableProto['let'] = function (func) {
return func(this);
};
/**
* Determines whether an observable collection contains values. There is an alias for this method called 'ifThen' for browsers <IE9
*
* @example
* 1 - res = Rx.Observable.if(condition, obs1);
* 2 - res = Rx.Observable.if(condition, obs1, obs2);
* 3 - res = Rx.Observable.if(condition, obs1, scheduler);
* @param {Function} condition The condition which determines if the thenSource or elseSource will be run.
* @param {Observable} thenSource The observable sequence or Promise that will be run if the condition function returns true.
* @param {Observable} [elseSource] The observable sequence or Promise that will be run if the condition function returns false. If this is not provided, it defaults to Rx.Observabe.Empty with the specified scheduler.
* @returns {Observable} An observable sequence which is either the thenSource or elseSource.
*/
Observable['if'] = Observable.ifThen = function (condition, thenSource, elseSourceOrScheduler) {
return observableDefer(function () {
elseSourceOrScheduler || (elseSourceOrScheduler = observableEmpty());
isPromise(thenSource) && (thenSource = observableFromPromise(thenSource));
isPromise(elseSourceOrScheduler) && (elseSourceOrScheduler = observableFromPromise(elseSourceOrScheduler));
// Assume a scheduler for empty only
typeof elseSourceOrScheduler.now === 'function' && (elseSourceOrScheduler = observableEmpty(elseSourceOrScheduler));
return condition() ? thenSource : elseSourceOrScheduler;
});
};
/**
* Concatenates the observable sequences obtained by running the specified result selector for each element in source.
* There is an alias for this method called 'forIn' for browsers <IE9
* @param {Array} sources An array of values to turn into an observable sequence.
* @param {Function} resultSelector A function to apply to each item in the sources array to turn it into an observable sequence.
* @returns {Observable} An observable sequence from the concatenated observable sequences.
*/
Observable['for'] = Observable.forIn = function (sources, resultSelector, thisArg) {
return enumerableOf(sources, resultSelector, thisArg).concat();
};
/**
* Repeats source as long as condition holds emulating a while loop.
* There is an alias for this method called 'whileDo' for browsers <IE9
*
* @param {Function} condition The condition which determines if the source will be repeated.
* @param {Observable} source The observable sequence that will be run if the condition function returns true.
* @returns {Observable} An observable sequence which is repeated as long as the condition holds.
*/
var observableWhileDo = Observable['while'] = Observable.whileDo = function (condition, source) {
isPromise(source) && (source = observableFromPromise(source));
return enumerableWhile(condition, source).concat();
};
/**
* Repeats source as long as condition holds emulating a do while loop.
*
* @param {Function} condition The condition which determines if the source will be repeated.
* @param {Observable} source The observable sequence that will be run if the condition function returns true.
* @returns {Observable} An observable sequence which is repeated as long as the condition holds.
*/
observableProto.doWhile = function (condition) {
return observableConcat([this, observableWhileDo(condition, this)]);
};
/**
* Uses selector to determine which source in sources to use.
* There is an alias 'switchCase' for browsers <IE9.
*
* @example
* 1 - res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 });
* 1 - res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, obs0);
* 1 - res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, scheduler);
*
* @param {Function} selector The function which extracts the value for to test in a case statement.
* @param {Array} sources A object which has keys which correspond to the case statement labels.
* @param {Observable} [elseSource] The observable sequence or Promise that will be run if the sources are not matched. If this is not provided, it defaults to Rx.Observabe.empty with the specified scheduler.
*
* @returns {Observable} An observable sequence which is determined by a case statement.
*/
Observable['case'] = Observable.switchCase = function (selector, sources, defaultSourceOrScheduler) {
return observableDefer(function () {
isPromise(defaultSourceOrScheduler) && (defaultSourceOrScheduler = observableFromPromise(defaultSourceOrScheduler));
defaultSourceOrScheduler || (defaultSourceOrScheduler = observableEmpty());
typeof defaultSourceOrScheduler.now === 'function' && (defaultSourceOrScheduler = observableEmpty(defaultSourceOrScheduler));
var result = sources[selector()];
isPromise(result) && (result = observableFromPromise(result));
return result || defaultSourceOrScheduler;
});
};
/**
* Expands an observable sequence by recursively invoking selector.
*
* @param {Function} selector Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again.
* @param {Scheduler} [scheduler] Scheduler on which to perform the expansion. If not provided, this defaults to the current thread scheduler.
* @returns {Observable} An observable sequence containing all the elements produced by the recursive expansion.
*/
observableProto.expand = function (selector, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
var source = this;
return new AnonymousObservable(function (observer) {
var q = [],
m = new SerialDisposable(),
d = new CompositeDisposable(m),
activeCount = 0,
isAcquired = false;
var ensureActive = function () {
var isOwner = false;
if (q.length > 0) {
isOwner = !isAcquired;
isAcquired = true;
}
if (isOwner) {
m.setDisposable(scheduler.scheduleRecursive(function (self) {
var work;
if (q.length > 0) {
work = q.shift();
} else {
isAcquired = false;
return;
}
var m1 = new SingleAssignmentDisposable();
d.add(m1);
m1.setDisposable(work.subscribe(function (x) {
observer.onNext(x);
var result = null;
try {
result = selector(x);
} catch (e) {
observer.onError(e);
}
q.push(result);
activeCount++;
ensureActive();
}, observer.onError.bind(observer), function () {
d.remove(m1);
activeCount--;
if (activeCount === 0) {
observer.onCompleted();
}
}));
self();
}));
}
};
q.push(source);
activeCount++;
ensureActive();
return d;
}, this);
};
/**
* Runs all observable sequences in parallel and collect their last elements.
*
* @example
* 1 - res = Rx.Observable.forkJoin([obs1, obs2]);
* 1 - res = Rx.Observable.forkJoin(obs1, obs2, ...);
* @returns {Observable} An observable sequence with an array collecting the last elements of all the input sequences.
*/
Observable.forkJoin = function () {
var allSources = [];
if (Array.isArray(arguments[0])) {
allSources = arguments[0];
} else {
for(var i = 0, len = arguments.length; i < len; i++) { allSources.push(arguments[i]); }
}
return new AnonymousObservable(function (subscriber) {
var count = allSources.length;
if (count === 0) {
subscriber.onCompleted();
return disposableEmpty;
}
var group = new CompositeDisposable(),
finished = false,
hasResults = new Array(count),
hasCompleted = new Array(count),
results = new Array(count);
for (var idx = 0; idx < count; idx++) {
(function (i) {
var source = allSources[i];
isPromise(source) && (source = observableFromPromise(source));
group.add(
source.subscribe(
function (value) {
if (!finished) {
hasResults[i] = true;
results[i] = value;
}
},
function (e) {
finished = true;
subscriber.onError(e);
group.dispose();
},
function () {
if (!finished) {
if (!hasResults[i]) {
subscriber.onCompleted();
return;
}
hasCompleted[i] = true;
for (var ix = 0; ix < count; ix++) {
if (!hasCompleted[ix]) { return; }
}
finished = true;
subscriber.onNext(results);
subscriber.onCompleted();
}
}));
})(idx);
}
return group;
});
};
/**
* Runs two observable sequences in parallel and combines their last elemenets.
*
* @param {Observable} second Second observable sequence.
* @param {Function} resultSelector Result selector function to invoke with the last elements of both sequences.
* @returns {Observable} An observable sequence with the result of calling the selector function with the last elements of both input sequences.
*/
observableProto.forkJoin = function (second, resultSelector) {
var first = this;
return new AnonymousObservable(function (observer) {
var leftStopped = false, rightStopped = false,
hasLeft = false, hasRight = false,
lastLeft, lastRight,
leftSubscription = new SingleAssignmentDisposable(), rightSubscription = new SingleAssignmentDisposable();
isPromise(second) && (second = observableFromPromise(second));
leftSubscription.setDisposable(
first.subscribe(function (left) {
hasLeft = true;
lastLeft = left;
}, function (err) {
rightSubscription.dispose();
observer.onError(err);
}, function () {
leftStopped = true;
if (rightStopped) {
if (!hasLeft) {
observer.onCompleted();
} else if (!hasRight) {
observer.onCompleted();
} else {
var result;
try {
result = resultSelector(lastLeft, lastRight);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
observer.onCompleted();
}
}
})
);
rightSubscription.setDisposable(
second.subscribe(function (right) {
hasRight = true;
lastRight = right;
}, function (err) {
leftSubscription.dispose();
observer.onError(err);
}, function () {
rightStopped = true;
if (leftStopped) {
if (!hasLeft) {
observer.onCompleted();
} else if (!hasRight) {
observer.onCompleted();
} else {
var result;
try {
result = resultSelector(lastLeft, lastRight);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
observer.onCompleted();
}
}
})
);
return new CompositeDisposable(leftSubscription, rightSubscription);
}, first);
};
/**
* Comonadic bind operator.
* @param {Function} selector A transform function to apply to each element.
* @param {Object} scheduler Scheduler used to execute the operation. If not specified, defaults to the ImmediateScheduler.
* @returns {Observable} An observable sequence which results from the comonadic bind operation.
*/
observableProto.manySelect = function (selector, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
var source = this;
return observableDefer(function () {
var chain;
return source
.map(function (x) {
var curr = new ChainObservable(x);
chain && chain.onNext(x);
chain = curr;
return curr;
})
.tap(
noop,
function (e) { chain && chain.onError(e); },
function () { chain && chain.onCompleted(); }
)
.observeOn(scheduler)
.map(selector);
}, source);
};
var ChainObservable = (function (__super__) {
function subscribe (observer) {
var self = this, g = new CompositeDisposable();
g.add(currentThreadScheduler.schedule(function () {
observer.onNext(self.head);
g.add(self.tail.mergeAll().subscribe(observer));
}));
return g;
}
inherits(ChainObservable, __super__);
function ChainObservable(head) {
__super__.call(this, subscribe);
this.head = head;
this.tail = new AsyncSubject();
}
addProperties(ChainObservable.prototype, Observer, {
onCompleted: function () {
this.onNext(Observable.empty());
},
onError: function (e) {
this.onNext(Observable.throwError(e));
},
onNext: function (v) {
this.tail.onNext(v);
this.tail.onCompleted();
}
});
return ChainObservable;
}(Observable));
/** @private */
var Map = root.Map || (function () {
function Map() {
this._keys = [];
this._values = [];
}
Map.prototype.get = function (key) {
var i = this._keys.indexOf(key);
return i !== -1 ? this._values[i] : undefined;
};
Map.prototype.set = function (key, value) {
var i = this._keys.indexOf(key);
i !== -1 && (this._values[i] = value);
this._values[this._keys.push(key) - 1] = value;
};
Map.prototype.forEach = function (callback, thisArg) {
for (var i = 0, len = this._keys.length; i < len; i++) {
callback.call(thisArg, this._values[i], this._keys[i]);
}
};
return Map;
}());
/**
* @constructor
* Represents a join pattern over observable sequences.
*/
function Pattern(patterns) {
this.patterns = patterns;
}
/**
* Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value.
* @param other Observable sequence to match in addition to the current pattern.
* @return {Pattern} Pattern object that matches when all observable sequences in the pattern have an available value.
*/
Pattern.prototype.and = function (other) {
return new Pattern(this.patterns.concat(other));
};
/**
* Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.
* @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
* @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
*/
Pattern.prototype.thenDo = function (selector) {
return new Plan(this, selector);
};
function Plan(expression, selector) {
this.expression = expression;
this.selector = selector;
}
Plan.prototype.activate = function (externalSubscriptions, observer, deactivate) {
var self = this;
var joinObservers = [];
for (var i = 0, len = this.expression.patterns.length; i < len; i++) {
joinObservers.push(planCreateObserver(externalSubscriptions, this.expression.patterns[i], observer.onError.bind(observer)));
}
var activePlan = new ActivePlan(joinObservers, function () {
var result;
try {
result = self.selector.apply(self, arguments);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
}, function () {
for (var j = 0, jlen = joinObservers.length; j < jlen; j++) {
joinObservers[j].removeActivePlan(activePlan);
}
deactivate(activePlan);
});
for (i = 0, len = joinObservers.length; i < len; i++) {
joinObservers[i].addActivePlan(activePlan);
}
return activePlan;
};
function planCreateObserver(externalSubscriptions, observable, onError) {
var entry = externalSubscriptions.get(observable);
if (!entry) {
var observer = new JoinObserver(observable, onError);
externalSubscriptions.set(observable, observer);
return observer;
}
return entry;
}
function ActivePlan(joinObserverArray, onNext, onCompleted) {
this.joinObserverArray = joinObserverArray;
this.onNext = onNext;
this.onCompleted = onCompleted;
this.joinObservers = new Map();
for (var i = 0, len = this.joinObserverArray.length; i < len; i++) {
var joinObserver = this.joinObserverArray[i];
this.joinObservers.set(joinObserver, joinObserver);
}
}
ActivePlan.prototype.dequeue = function () {
this.joinObservers.forEach(function (v) { v.queue.shift(); });
};
ActivePlan.prototype.match = function () {
var i, len, hasValues = true;
for (i = 0, len = this.joinObserverArray.length; i < len; i++) {
if (this.joinObserverArray[i].queue.length === 0) {
hasValues = false;
break;
}
}
if (hasValues) {
var firstValues = [],
isCompleted = false;
for (i = 0, len = this.joinObserverArray.length; i < len; i++) {
firstValues.push(this.joinObserverArray[i].queue[0]);
this.joinObserverArray[i].queue[0].kind === 'C' && (isCompleted = true);
}
if (isCompleted) {
this.onCompleted();
} else {
this.dequeue();
var values = [];
for (i = 0, len = firstValues.length; i < firstValues.length; i++) {
values.push(firstValues[i].value);
}
this.onNext.apply(this, values);
}
}
};
var JoinObserver = (function (__super__) {
inherits(JoinObserver, __super__);
function JoinObserver(source, onError) {
__super__.call(this);
this.source = source;
this.onError = onError;
this.queue = [];
this.activePlans = [];
this.subscription = new SingleAssignmentDisposable();
this.isDisposed = false;
}
var JoinObserverPrototype = JoinObserver.prototype;
JoinObserverPrototype.next = function (notification) {
if (!this.isDisposed) {
if (notification.kind === 'E') {
return this.onError(notification.exception);
}
this.queue.push(notification);
var activePlans = this.activePlans.slice(0);
for (var i = 0, len = activePlans.length; i < len; i++) {
activePlans[i].match();
}
}
};
JoinObserverPrototype.error = noop;
JoinObserverPrototype.completed = noop;
JoinObserverPrototype.addActivePlan = function (activePlan) {
this.activePlans.push(activePlan);
};
JoinObserverPrototype.subscribe = function () {
this.subscription.setDisposable(this.source.materialize().subscribe(this));
};
JoinObserverPrototype.removeActivePlan = function (activePlan) {
this.activePlans.splice(this.activePlans.indexOf(activePlan), 1);
this.activePlans.length === 0 && this.dispose();
};
JoinObserverPrototype.dispose = function () {
__super__.prototype.dispose.call(this);
if (!this.isDisposed) {
this.isDisposed = true;
this.subscription.dispose();
}
};
return JoinObserver;
} (AbstractObserver));
/**
* Creates a pattern that matches when both observable sequences have an available value.
*
* @param right Observable sequence to match with the current sequence.
* @return {Pattern} Pattern object that matches when both observable sequences have an available value.
*/
observableProto.and = function (right) {
return new Pattern([this, right]);
};
/**
* Matches when the observable sequence has an available value and projects the value.
*
* @param {Function} selector Selector that will be invoked for values in the source sequence.
* @returns {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
*/
observableProto.thenDo = function (selector) {
return new Pattern([this]).thenDo(selector);
};
/**
* Joins together the results from several patterns.
*
* @param plans A series of plans (specified as an Array of as a series of arguments) created by use of the Then operator on patterns.
* @returns {Observable} Observable sequence with the results form matching several patterns.
*/
Observable.when = function () {
var len = arguments.length, plans;
if (Array.isArray(arguments[0])) {
plans = arguments[0];
} else {
plans = new Array(len);
for(var i = 0; i < len; i++) { plans[i] = arguments[i]; }
}
return new AnonymousObservable(function (o) {
var activePlans = [],
externalSubscriptions = new Map();
var outObserver = observerCreate(
function (x) { o.onNext(x); },
function (err) {
externalSubscriptions.forEach(function (v) { v.onError(err); });
o.onError(err);
},
function (x) { o.onCompleted(); }
);
try {
for (var i = 0, len = plans.length; i < len; i++) {
activePlans.push(plans[i].activate(externalSubscriptions, outObserver, function (activePlan) {
var idx = activePlans.indexOf(activePlan);
activePlans.splice(idx, 1);
activePlans.length === 0 && o.onCompleted();
}));
}
} catch (e) {
observableThrow(e).subscribe(o);
}
var group = new CompositeDisposable();
externalSubscriptions.forEach(function (joinObserver) {
joinObserver.subscribe();
group.add(joinObserver);
});
return group;
});
};
function observableTimerDate(dueTime, scheduler) {
return new AnonymousObservable(function (observer) {
return scheduler.scheduleWithAbsolute(dueTime, function () {
observer.onNext(0);
observer.onCompleted();
});
});
}
function observableTimerDateAndPeriod(dueTime, period, scheduler) {
return new AnonymousObservable(function (observer) {
var d = dueTime, p = normalizeTime(period);
return scheduler.scheduleRecursiveWithAbsoluteAndState(0, d, function (count, self) {
if (p > 0) {
var now = scheduler.now();
d = d + p;
d <= now && (d = now + p);
}
observer.onNext(count);
self(count + 1, d);
});
});
}
function observableTimerTimeSpan(dueTime, scheduler) {
return new AnonymousObservable(function (observer) {
return scheduler.scheduleWithRelative(normalizeTime(dueTime), function () {
observer.onNext(0);
observer.onCompleted();
});
});
}
function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) {
return dueTime === period ?
new AnonymousObservable(function (observer) {
return scheduler.schedulePeriodicWithState(0, period, function (count) {
observer.onNext(count);
return count + 1;
});
}) :
observableDefer(function () {
return observableTimerDateAndPeriod(scheduler.now() + dueTime, period, scheduler);
});
}
/**
* Returns an observable sequence that produces a value after each period.
*
* @example
* 1 - res = Rx.Observable.interval(1000);
* 2 - res = Rx.Observable.interval(1000, Rx.Scheduler.timeout);
*
* @param {Number} period Period for producing the values in the resulting sequence (specified as an integer denoting milliseconds).
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, Rx.Scheduler.timeout is used.
* @returns {Observable} An observable sequence that produces a value after each period.
*/
var observableinterval = Observable.interval = function (period, scheduler) {
return observableTimerTimeSpanAndPeriod(period, period, isScheduler(scheduler) ? scheduler : timeoutScheduler);
};
/**
* Returns an observable sequence that produces a value after dueTime has elapsed and then after each period.
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) at which to produce the first value.
* @param {Mixed} [periodOrScheduler] Period to produce subsequent values (specified as an integer denoting milliseconds), or the scheduler to run the timer on. If not specified, the resulting timer is not recurring.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence that produces a value after due time has elapsed and then each period.
*/
var observableTimer = Observable.timer = function (dueTime, periodOrScheduler, scheduler) {
var period;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
if (periodOrScheduler !== undefined && typeof periodOrScheduler === 'number') {
period = periodOrScheduler;
} else if (isScheduler(periodOrScheduler)) {
scheduler = periodOrScheduler;
}
if (dueTime instanceof Date && period === undefined) {
return observableTimerDate(dueTime.getTime(), scheduler);
}
if (dueTime instanceof Date && period !== undefined) {
period = periodOrScheduler;
return observableTimerDateAndPeriod(dueTime.getTime(), period, scheduler);
}
return period === undefined ?
observableTimerTimeSpan(dueTime, scheduler) :
observableTimerTimeSpanAndPeriod(dueTime, period, scheduler);
};
function observableDelayTimeSpan(source, dueTime, scheduler) {
return new AnonymousObservable(function (observer) {
var active = false,
cancelable = new SerialDisposable(),
exception = null,
q = [],
running = false,
subscription;
subscription = source.materialize().timestamp(scheduler).subscribe(function (notification) {
var d, shouldRun;
if (notification.value.kind === 'E') {
q = [];
q.push(notification);
exception = notification.value.exception;
shouldRun = !running;
} else {
q.push({ value: notification.value, timestamp: notification.timestamp + dueTime });
shouldRun = !active;
active = true;
}
if (shouldRun) {
if (exception !== null) {
observer.onError(exception);
} else {
d = new SingleAssignmentDisposable();
cancelable.setDisposable(d);
d.setDisposable(scheduler.scheduleRecursiveWithRelative(dueTime, function (self) {
var e, recurseDueTime, result, shouldRecurse;
if (exception !== null) {
return;
}
running = true;
do {
result = null;
if (q.length > 0 && q[0].timestamp - scheduler.now() <= 0) {
result = q.shift().value;
}
if (result !== null) {
result.accept(observer);
}
} while (result !== null);
shouldRecurse = false;
recurseDueTime = 0;
if (q.length > 0) {
shouldRecurse = true;
recurseDueTime = Math.max(0, q[0].timestamp - scheduler.now());
} else {
active = false;
}
e = exception;
running = false;
if (e !== null) {
observer.onError(e);
} else if (shouldRecurse) {
self(recurseDueTime);
}
}));
}
}
});
return new CompositeDisposable(subscription, cancelable);
}, source);
}
function observableDelayDate(source, dueTime, scheduler) {
return observableDefer(function () {
return observableDelayTimeSpan(source, dueTime - scheduler.now(), scheduler);
});
}
/**
* Time shifts the observable sequence by dueTime. The relative time intervals between the values are preserved.
*
* @example
* 1 - res = Rx.Observable.delay(new Date());
* 2 - res = Rx.Observable.delay(new Date(), Rx.Scheduler.timeout);
*
* 3 - res = Rx.Observable.delay(5000);
* 4 - res = Rx.Observable.delay(5000, 1000, Rx.Scheduler.timeout);
* @memberOf Observable#
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) by which to shift the observable sequence.
* @param {Scheduler} [scheduler] Scheduler to run the delay timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} Time-shifted sequence.
*/
observableProto.delay = function (dueTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return dueTime instanceof Date ?
observableDelayDate(this, dueTime.getTime(), scheduler) :
observableDelayTimeSpan(this, dueTime, scheduler);
};
/**
* Ignores values from an observable sequence which are followed by another value before dueTime.
* @param {Number} dueTime Duration of the debounce period for each value (specified as an integer denoting milliseconds).
* @param {Scheduler} [scheduler] Scheduler to run the debounce timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} The debounced sequence.
*/
observableProto.debounce = observableProto.throttleWithTimeout = function (dueTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this;
return new AnonymousObservable(function (observer) {
var cancelable = new SerialDisposable(), hasvalue = false, value, id = 0;
var subscription = source.subscribe(
function (x) {
hasvalue = true;
value = x;
id++;
var currentId = id,
d = new SingleAssignmentDisposable();
cancelable.setDisposable(d);
d.setDisposable(scheduler.scheduleWithRelative(dueTime, function () {
hasvalue && id === currentId && observer.onNext(value);
hasvalue = false;
}));
},
function (e) {
cancelable.dispose();
observer.onError(e);
hasvalue = false;
id++;
},
function () {
cancelable.dispose();
hasvalue && observer.onNext(value);
observer.onCompleted();
hasvalue = false;
id++;
});
return new CompositeDisposable(subscription, cancelable);
}, this);
};
/**
* @deprecated use #debounce or #throttleWithTimeout instead.
*/
observableProto.throttle = function(dueTime, scheduler) {
//deprecate('throttle', 'debounce or throttleWithTimeout');
return this.debounce(dueTime, scheduler);
};
/**
* Projects each element of an observable sequence into zero or more windows which are produced based on timing information.
* @param {Number} timeSpan Length of each window (specified as an integer denoting milliseconds).
* @param {Mixed} [timeShiftOrScheduler] Interval between creation of consecutive windows (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent windows.
* @param {Scheduler} [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.windowWithTime = function (timeSpan, timeShiftOrScheduler, scheduler) {
var source = this, timeShift;
timeShiftOrScheduler == null && (timeShift = timeSpan);
isScheduler(scheduler) || (scheduler = timeoutScheduler);
if (typeof timeShiftOrScheduler === 'number') {
timeShift = timeShiftOrScheduler;
} else if (isScheduler(timeShiftOrScheduler)) {
timeShift = timeSpan;
scheduler = timeShiftOrScheduler;
}
return new AnonymousObservable(function (observer) {
var groupDisposable,
nextShift = timeShift,
nextSpan = timeSpan,
q = [],
refCountDisposable,
timerD = new SerialDisposable(),
totalTime = 0;
groupDisposable = new CompositeDisposable(timerD),
refCountDisposable = new RefCountDisposable(groupDisposable);
function createTimer () {
var m = new SingleAssignmentDisposable(),
isSpan = false,
isShift = false;
timerD.setDisposable(m);
if (nextSpan === nextShift) {
isSpan = true;
isShift = true;
} else if (nextSpan < nextShift) {
isSpan = true;
} else {
isShift = true;
}
var newTotalTime = isSpan ? nextSpan : nextShift,
ts = newTotalTime - totalTime;
totalTime = newTotalTime;
if (isSpan) {
nextSpan += timeShift;
}
if (isShift) {
nextShift += timeShift;
}
m.setDisposable(scheduler.scheduleWithRelative(ts, function () {
if (isShift) {
var s = new Subject();
q.push(s);
observer.onNext(addRef(s, refCountDisposable));
}
isSpan && q.shift().onCompleted();
createTimer();
}));
};
q.push(new Subject());
observer.onNext(addRef(q[0], refCountDisposable));
createTimer();
groupDisposable.add(source.subscribe(
function (x) {
for (var i = 0, len = q.length; i < len; i++) { q[i].onNext(x); }
},
function (e) {
for (var i = 0, len = q.length; i < len; i++) { q[i].onError(e); }
observer.onError(e);
},
function () {
for (var i = 0, len = q.length; i < len; i++) { q[i].onCompleted(); }
observer.onCompleted();
}
));
return refCountDisposable;
}, source);
};
/**
* Projects each element of an observable sequence into a window that is completed when either it's full or a given amount of time has elapsed.
* @param {Number} timeSpan Maximum time length of a window.
* @param {Number} count Maximum element count of a window.
* @param {Scheduler} [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.windowWithTimeOrCount = function (timeSpan, count, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var timerD = new SerialDisposable(),
groupDisposable = new CompositeDisposable(timerD),
refCountDisposable = new RefCountDisposable(groupDisposable),
n = 0,
windowId = 0,
s = new Subject();
function createTimer(id) {
var m = new SingleAssignmentDisposable();
timerD.setDisposable(m);
m.setDisposable(scheduler.scheduleWithRelative(timeSpan, function () {
if (id !== windowId) { return; }
n = 0;
var newId = ++windowId;
s.onCompleted();
s = new Subject();
observer.onNext(addRef(s, refCountDisposable));
createTimer(newId);
}));
}
observer.onNext(addRef(s, refCountDisposable));
createTimer(0);
groupDisposable.add(source.subscribe(
function (x) {
var newId = 0, newWindow = false;
s.onNext(x);
if (++n === count) {
newWindow = true;
n = 0;
newId = ++windowId;
s.onCompleted();
s = new Subject();
observer.onNext(addRef(s, refCountDisposable));
}
newWindow && createTimer(newId);
},
function (e) {
s.onError(e);
observer.onError(e);
}, function () {
s.onCompleted();
observer.onCompleted();
}
));
return refCountDisposable;
}, source);
};
/**
* Projects each element of an observable sequence into zero or more buffers which are produced based on timing information.
*
* @example
* 1 - res = xs.bufferWithTime(1000, scheduler); // non-overlapping segments of 1 second
* 2 - res = xs.bufferWithTime(1000, 500, scheduler; // segments of 1 second with time shift 0.5 seconds
*
* @param {Number} timeSpan Length of each buffer (specified as an integer denoting milliseconds).
* @param {Mixed} [timeShiftOrScheduler] Interval between creation of consecutive buffers (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent buffers.
* @param {Scheduler} [scheduler] Scheduler to run buffer timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of buffers.
*/
observableProto.bufferWithTime = function (timeSpan, timeShiftOrScheduler, scheduler) {
return this.windowWithTime.apply(this, arguments).selectMany(function (x) { return x.toArray(); });
};
/**
* Projects each element of an observable sequence into a buffer that is completed when either it's full or a given amount of time has elapsed.
*
* @example
* 1 - res = source.bufferWithTimeOrCount(5000, 50); // 5s or 50 items in an array
* 2 - res = source.bufferWithTimeOrCount(5000, 50, scheduler); // 5s or 50 items in an array
*
* @param {Number} timeSpan Maximum time length of a buffer.
* @param {Number} count Maximum element count of a buffer.
* @param {Scheduler} [scheduler] Scheduler to run bufferin timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of buffers.
*/
observableProto.bufferWithTimeOrCount = function (timeSpan, count, scheduler) {
return this.windowWithTimeOrCount(timeSpan, count, scheduler).selectMany(function (x) {
return x.toArray();
});
};
/**
* Records the time interval between consecutive values in an observable sequence.
*
* @example
* 1 - res = source.timeInterval();
* 2 - res = source.timeInterval(Rx.Scheduler.timeout);
*
* @param [scheduler] Scheduler used to compute time intervals. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence with time interval information on values.
*/
observableProto.timeInterval = function (scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return observableDefer(function () {
var last = scheduler.now();
return source.map(function (x) {
var now = scheduler.now(), span = now - last;
last = now;
return { value: x, interval: span };
});
});
};
/**
* Records the timestamp for each value in an observable sequence.
*
* @example
* 1 - res = source.timestamp(); // produces { value: x, timestamp: ts }
* 2 - res = source.timestamp(Rx.Scheduler.default);
*
* @param {Scheduler} [scheduler] Scheduler used to compute timestamps. If not specified, the default scheduler is used.
* @returns {Observable} An observable sequence with timestamp information on values.
*/
observableProto.timestamp = function (scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return this.map(function (x) {
return { value: x, timestamp: scheduler.now() };
});
};
function sampleObservable(source, sampler) {
return new AnonymousObservable(function (observer) {
var atEnd, value, hasValue;
function sampleSubscribe() {
if (hasValue) {
hasValue = false;
observer.onNext(value);
}
atEnd && observer.onCompleted();
}
return new CompositeDisposable(
source.subscribe(function (newValue) {
hasValue = true;
value = newValue;
}, observer.onError.bind(observer), function () {
atEnd = true;
}),
sampler.subscribe(sampleSubscribe, observer.onError.bind(observer), sampleSubscribe)
);
}, source);
}
/**
* Samples the observable sequence at each interval.
*
* @example
* 1 - res = source.sample(sampleObservable); // Sampler tick sequence
* 2 - res = source.sample(5000); // 5 seconds
* 2 - res = source.sample(5000, Rx.Scheduler.timeout); // 5 seconds
*
* @param {Mixed} intervalOrSampler Interval at which to sample (specified as an integer denoting milliseconds) or Sampler Observable.
* @param {Scheduler} [scheduler] Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} Sampled observable sequence.
*/
observableProto.sample = observableProto.throttleLatest = function (intervalOrSampler, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return typeof intervalOrSampler === 'number' ?
sampleObservable(this, observableinterval(intervalOrSampler, scheduler)) :
sampleObservable(this, intervalOrSampler);
};
/**
* Returns the source observable sequence or the other observable sequence if dueTime elapses.
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) when a timeout occurs.
* @param {Observable} [other] Sequence to return in case of a timeout. If not specified, a timeout error throwing sequence will be used.
* @param {Scheduler} [scheduler] Scheduler to run the timeout timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
*/
observableProto.timeout = function (dueTime, other, scheduler) {
(other == null || typeof other === 'string') && (other = observableThrow(new Error(other || 'Timeout')));
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this, schedulerMethod = dueTime instanceof Date ?
'scheduleWithAbsolute' :
'scheduleWithRelative';
return new AnonymousObservable(function (observer) {
var id = 0,
original = new SingleAssignmentDisposable(),
subscription = new SerialDisposable(),
switched = false,
timer = new SerialDisposable();
subscription.setDisposable(original);
function createTimer() {
var myId = id;
timer.setDisposable(scheduler[schedulerMethod](dueTime, function () {
if (id === myId) {
isPromise(other) && (other = observableFromPromise(other));
subscription.setDisposable(other.subscribe(observer));
}
}));
}
createTimer();
original.setDisposable(source.subscribe(function (x) {
if (!switched) {
id++;
observer.onNext(x);
createTimer();
}
}, function (e) {
if (!switched) {
id++;
observer.onError(e);
}
}, function () {
if (!switched) {
id++;
observer.onCompleted();
}
}));
return new CompositeDisposable(subscription, timer);
}, source);
};
/**
* Generates an observable sequence by iterating a state from an initial state until the condition fails.
*
* @example
* res = source.generateWithAbsoluteTime(0,
* function (x) { return return true; },
* function (x) { return x + 1; },
* function (x) { return x; },
* function (x) { return new Date(); }
* });
*
* @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 {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning Date values.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
* @returns {Observable} The generated sequence.
*/
Observable.generateWithAbsoluteTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var first = true,
hasResult = false,
result,
state = initialState,
time;
return scheduler.scheduleRecursiveWithAbsolute(scheduler.now(), function (self) {
hasResult && observer.onNext(result);
try {
if (first) {
first = false;
} else {
state = iterate(state);
}
hasResult = condition(state);
if (hasResult) {
result = resultSelector(state);
time = timeSelector(state);
}
} catch (e) {
observer.onError(e);
return;
}
if (hasResult) {
self(time);
} else {
observer.onCompleted();
}
});
});
};
/**
* Generates an observable sequence by iterating a state from an initial state until the condition fails.
*
* @example
* res = source.generateWithRelativeTime(0,
* function (x) { return return true; },
* function (x) { return x + 1; },
* function (x) { return x; },
* function (x) { return 500; }
* );
*
* @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 {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning integer values denoting milliseconds.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
* @returns {Observable} The generated sequence.
*/
Observable.generateWithRelativeTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var first = true,
hasResult = false,
result,
state = initialState,
time;
return scheduler.scheduleRecursiveWithRelative(0, function (self) {
hasResult && observer.onNext(result);
try {
if (first) {
first = false;
} else {
state = iterate(state);
}
hasResult = condition(state);
if (hasResult) {
result = resultSelector(state);
time = timeSelector(state);
}
} catch (e) {
observer.onError(e);
return;
}
if (hasResult) {
self(time);
} else {
observer.onCompleted();
}
});
});
};
/**
* Time shifts the observable sequence by delaying the subscription with the specified relative time duration, using the specified scheduler to run timers.
*
* @example
* 1 - res = source.delaySubscription(5000); // 5s
* 2 - res = source.delaySubscription(5000, Rx.Scheduler.default); // 5 seconds
*
* @param {Number} dueTime Relative or absolute time shift of the subscription.
* @param {Scheduler} [scheduler] Scheduler to run the subscription delay timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} Time-shifted sequence.
*/
observableProto.delaySubscription = function (dueTime, scheduler) {
var scheduleMethod = dueTime instanceof Date ? 'scheduleWithAbsolute' : 'scheduleWithRelative';
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (o) {
var d = new SerialDisposable();
d.setDisposable(scheduler[scheduleMethod](dueTime, function() {
d.setDisposable(source.subscribe(o));
}));
return d;
}, this);
};
/**
* Time shifts the observable sequence based on a subscription delay and a delay selector function for each element.
*
* @example
* 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(5000); }); // with selector only
* 1 - res = source.delayWithSelector(Rx.Observable.timer(2000), function (x) { return Rx.Observable.timer(x); }); // with delay and selector
*
* @param {Observable} [subscriptionDelay] Sequence indicating the delay for the subscription to the source.
* @param {Function} delayDurationSelector Selector function to retrieve a sequence indicating the delay for each given element.
* @returns {Observable} Time-shifted sequence.
*/
observableProto.delayWithSelector = function (subscriptionDelay, delayDurationSelector) {
var source = this, subDelay, selector;
if (isFunction(subscriptionDelay)) {
selector = subscriptionDelay;
} else {
subDelay = subscriptionDelay;
selector = delayDurationSelector;
}
return new AnonymousObservable(function (observer) {
var delays = new CompositeDisposable(), atEnd = false, subscription = new SerialDisposable();
function start() {
subscription.setDisposable(source.subscribe(
function (x) {
var delay = tryCatch(selector)(x);
if (delay === errorObj) { return observer.onError(delay.e); }
var d = new SingleAssignmentDisposable();
delays.add(d);
d.setDisposable(delay.subscribe(
function () {
observer.onNext(x);
delays.remove(d);
done();
},
function (e) { observer.onError(e); },
function () {
observer.onNext(x);
delays.remove(d);
done();
}
))
},
function (e) { observer.onError(e); },
function () {
atEnd = true;
subscription.dispose();
done();
}
))
}
function done () {
atEnd && delays.length === 0 && observer.onCompleted();
}
if (!subDelay) {
start();
} else {
subscription.setDisposable(subDelay.subscribe(start, function (e) { observer.onError(e); }, start));
}
return new CompositeDisposable(subscription, delays);
}, this);
};
/**
* Returns the source observable sequence, switching to the other observable sequence if a timeout is signaled.
* @param {Observable} [firstTimeout] Observable sequence that represents the timeout for the first element. If not provided, this defaults to Observable.never().
* @param {Function} timeoutDurationSelector Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.
* @param {Observable} [other] Sequence to return in case of a timeout. If not provided, this is set to Observable.throwException().
* @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
*/
observableProto.timeoutWithSelector = function (firstTimeout, timeoutdurationSelector, other) {
if (arguments.length === 1) {
timeoutdurationSelector = firstTimeout;
firstTimeout = observableNever();
}
other || (other = observableThrow(new Error('Timeout')));
var source = this;
return new AnonymousObservable(function (observer) {
var subscription = new SerialDisposable(), timer = new SerialDisposable(), original = new SingleAssignmentDisposable();
subscription.setDisposable(original);
var id = 0, switched = false;
function setTimer(timeout) {
var myId = id;
function timerWins () {
return id === myId;
}
var d = new SingleAssignmentDisposable();
timer.setDisposable(d);
d.setDisposable(timeout.subscribe(function () {
timerWins() && subscription.setDisposable(other.subscribe(observer));
d.dispose();
}, function (e) {
timerWins() && observer.onError(e);
}, function () {
timerWins() && subscription.setDisposable(other.subscribe(observer));
}));
};
setTimer(firstTimeout);
function observerWins() {
var res = !switched;
if (res) { id++; }
return res;
}
original.setDisposable(source.subscribe(function (x) {
if (observerWins()) {
observer.onNext(x);
var timeout;
try {
timeout = timeoutdurationSelector(x);
} catch (e) {
observer.onError(e);
return;
}
setTimer(isPromise(timeout) ? observableFromPromise(timeout) : timeout);
}
}, function (e) {
observerWins() && observer.onError(e);
}, function () {
observerWins() && observer.onCompleted();
}));
return new CompositeDisposable(subscription, timer);
}, source);
};
/**
* Ignores values from an observable sequence which are followed by another value within a computed throttle duration.
* @param {Function} durationSelector Selector function to retrieve a sequence indicating the throttle duration for each given element.
* @returns {Observable} The debounced sequence.
*/
observableProto.debounceWithSelector = function (durationSelector) {
var source = this;
return new AnonymousObservable(function (observer) {
var value, hasValue = false, cancelable = new SerialDisposable(), id = 0;
var subscription = source.subscribe(function (x) {
var throttle;
try {
throttle = durationSelector(x);
} catch (e) {
observer.onError(e);
return;
}
isPromise(throttle) && (throttle = observableFromPromise(throttle));
hasValue = true;
value = x;
id++;
var currentid = id, d = new SingleAssignmentDisposable();
cancelable.setDisposable(d);
d.setDisposable(throttle.subscribe(function () {
hasValue && id === currentid && observer.onNext(value);
hasValue = false;
d.dispose();
}, observer.onError.bind(observer), function () {
hasValue && id === currentid && observer.onNext(value);
hasValue = false;
d.dispose();
}));
}, function (e) {
cancelable.dispose();
observer.onError(e);
hasValue = false;
id++;
}, function () {
cancelable.dispose();
hasValue && observer.onNext(value);
observer.onCompleted();
hasValue = false;
id++;
});
return new CompositeDisposable(subscription, cancelable);
}, source);
};
/**
* @deprecated use #debounceWithSelector instead.
*/
observableProto.throttleWithSelector = function (durationSelector) {
//deprecate('throttleWithSelector', 'debounceWithSelector');
return this.debounceWithSelector(durationSelector);
};
/**
* Skips elements for the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
*
* 1 - res = source.skipLastWithTime(5000);
* 2 - res = source.skipLastWithTime(5000, scheduler);
*
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for skipping elements from the end of the sequence.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout
* @returns {Observable} An observable sequence with the elements skipped during the specified duration from the end of the source sequence.
*/
observableProto.skipLastWithTime = function (duration, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this;
return new AnonymousObservable(function (o) {
var q = [];
return source.subscribe(function (x) {
var now = scheduler.now();
q.push({ interval: now, value: x });
while (q.length > 0 && now - q[0].interval >= duration) {
o.onNext(q.shift().value);
}
}, function (e) { o.onError(e); }, function () {
var now = scheduler.now();
while (q.length > 0 && now - q[0].interval >= duration) {
o.onNext(q.shift().value);
}
o.onCompleted();
});
}, source);
};
/**
* Returns elements within the specified duration from the end of the observable source sequence, using the specified schedulers to run timers and to drain the collected elements.
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for taking elements from the end of the sequence.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements taken during the specified duration from the end of the source sequence.
*/
observableProto.takeLastWithTime = function (duration, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (o) {
var q = [];
return source.subscribe(function (x) {
var now = scheduler.now();
q.push({ interval: now, value: x });
while (q.length > 0 && now - q[0].interval >= duration) {
q.shift();
}
}, function (e) { o.onError(e); }, function () {
var now = scheduler.now();
while (q.length > 0) {
var next = q.shift();
if (now - next.interval <= duration) { o.onNext(next.value); }
}
o.onCompleted();
});
}, source);
};
/**
* Returns an array with the elements within the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for taking elements from the end of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence containing a single array with the elements taken during the specified duration from the end of the source sequence.
*/
observableProto.takeLastBufferWithTime = function (duration, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (o) {
var q = [];
return source.subscribe(function (x) {
var now = scheduler.now();
q.push({ interval: now, value: x });
while (q.length > 0 && now - q[0].interval >= duration) {
q.shift();
}
}, function (e) { o.onError(e); }, function () {
var now = scheduler.now(), res = [];
while (q.length > 0) {
var next = q.shift();
now - next.interval <= duration && res.push(next.value);
}
o.onNext(res);
o.onCompleted();
});
}, source);
};
/**
* Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
*
* @example
* 1 - res = source.takeWithTime(5000, [optional scheduler]);
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for taking elements from the start of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements taken during the specified duration from the start of the source sequence.
*/
observableProto.takeWithTime = function (duration, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (o) {
return new CompositeDisposable(scheduler.scheduleWithRelative(duration, function () { o.onCompleted(); }), source.subscribe(o));
}, source);
};
/**
* Skips elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
*
* @example
* 1 - res = source.skipWithTime(5000, [optional scheduler]);
*
* @description
* Specifying a zero value for duration doesn't guarantee no elements will be dropped from the start of the source sequence.
* This is a side-effect of the asynchrony introduced by the scheduler, where the action that causes callbacks from the source sequence to be forwarded
* may not execute immediately, despite the zero due time.
*
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the duration.
* @param {Number} duration Duration for skipping elements from the start of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements skipped during the specified duration from the start of the source sequence.
*/
observableProto.skipWithTime = function (duration, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var open = false;
return new CompositeDisposable(
scheduler.scheduleWithRelative(duration, function () { open = true; }),
source.subscribe(function (x) { open && observer.onNext(x); }, observer.onError.bind(observer), observer.onCompleted.bind(observer)));
}, source);
};
/**
* Skips elements from the observable source sequence until the specified start time, using the specified scheduler to run timers.
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the start time.
*
* @examples
* 1 - res = source.skipUntilWithTime(new Date(), [scheduler]);
* 2 - res = source.skipUntilWithTime(5000, [scheduler]);
* @param {Date|Number} startTime Time to start taking elements from the source sequence. If this value is less than or equal to Date(), no elements will be skipped.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements skipped until the specified start time.
*/
observableProto.skipUntilWithTime = function (startTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this, schedulerMethod = startTime instanceof Date ?
'scheduleWithAbsolute' :
'scheduleWithRelative';
return new AnonymousObservable(function (o) {
var open = false;
return new CompositeDisposable(
scheduler[schedulerMethod](startTime, function () { open = true; }),
source.subscribe(
function (x) { open && o.onNext(x); },
function (e) { o.onError(e); }, function () { o.onCompleted(); }));
}, source);
};
/**
* Takes elements for the specified duration until the specified end time, using the specified scheduler to run timers.
* @param {Number | Date} endTime Time to stop taking elements from the source sequence. If this value is less than or equal to new Date(), the result stream will complete immediately.
* @param {Scheduler} [scheduler] Scheduler to run the timer on.
* @returns {Observable} An observable sequence with the elements taken until the specified end time.
*/
observableProto.takeUntilWithTime = function (endTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this, schedulerMethod = endTime instanceof Date ?
'scheduleWithAbsolute' :
'scheduleWithRelative';
return new AnonymousObservable(function (o) {
return new CompositeDisposable(
scheduler[schedulerMethod](endTime, function () { o.onCompleted(); }),
source.subscribe(o));
}, source);
};
/**
* Returns an Observable that emits only the first item emitted by the source Observable during sequential time windows of a specified duration.
* @param {Number} windowDuration time to wait before emitting another item after emitting the last item
* @param {Scheduler} [scheduler] the Scheduler to use internally to manage the timers that handle timeout for each item. If not provided, defaults to Scheduler.timeout.
* @returns {Observable} An Observable that performs the throttle operation.
*/
observableProto.throttleFirst = function (windowDuration, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var duration = +windowDuration || 0;
if (duration <= 0) { throw new RangeError('windowDuration cannot be less or equal zero.'); }
var source = this;
return new AnonymousObservable(function (o) {
var lastOnNext = 0;
return source.subscribe(
function (x) {
var now = scheduler.now();
if (lastOnNext === 0 || now - lastOnNext >= duration) {
lastOnNext = now;
o.onNext(x);
}
},function (e) { o.onError(e); }, function () { o.onCompleted(); }
);
}, source);
};
/**
* Executes a transducer to transform the observable sequence
* @param {Transducer} transducer A transducer to execute
* @returns {Observable} An Observable sequence containing the results from the transducer.
*/
observableProto.transduce = function(transducer) {
var source = this;
function transformForObserver(o) {
return {
'@@transducer/init': function() {
return o;
},
'@@transducer/step': function(obs, input) {
return obs.onNext(input);
},
'@@transducer/result': function(obs) {
return obs.onCompleted();
}
};
}
return new AnonymousObservable(function(o) {
var xform = transducer(transformForObserver(o));
return source.subscribe(
function(v) {
try {
xform['@@transducer/step'](o, v);
} catch (e) {
o.onError(e);
}
},
function (e) { o.onError(e); },
function() { xform['@@transducer/result'](o); }
);
}, source);
};
/*
* 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;
}, this);
};
/*
* 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,
selectorFunc = bindCallback(selector, thisArg, 3);
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 = selectorFunc(x, index++, innerSource);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
},
function (e) { observer.onError(e); },
function () {
g.remove(innerSubscription);
hasCurrent = false;
if (isStopped && g.length === 1) {
observer.onCompleted();
}
}));
}
},
function (e) { observer.onError(e); },
function () {
isStopped = true;
if (g.length === 1 && !hasCurrent) {
observer.onCompleted();
}
}));
return g;
}, this);
};
/** Provides a set of extension methods for virtual time scheduling. */
Rx.VirtualTimeScheduler = (function (__super__) {
function localNow() {
return this.toDateTimeOffset(this.clock);
}
function scheduleNow(state, action) {
return this.scheduleAbsoluteWithState(state, this.clock, action);
}
function scheduleRelative(state, dueTime, action) {
return this.scheduleRelativeWithState(state, this.toRelative(dueTime), action);
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleRelativeWithState(state, this.toRelative(dueTime - this.now()), action);
}
function invokeAction(scheduler, action) {
action();
return disposableEmpty;
}
inherits(VirtualTimeScheduler, __super__);
/**
* Creates a new virtual time scheduler with the specified initial clock value and absolute time comparer.
*
* @constructor
* @param {Number} initialClock Initial value for the clock.
* @param {Function} comparer Comparer to determine causality of events based on absolute time.
*/
function VirtualTimeScheduler(initialClock, comparer) {
this.clock = initialClock;
this.comparer = comparer;
this.isEnabled = false;
this.queue = new PriorityQueue(1024);
__super__.call(this, localNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}
var VirtualTimeSchedulerPrototype = VirtualTimeScheduler.prototype;
/**
* Adds a relative time value to an absolute time value.
* @param {Number} absolute Absolute virtual time value.
* @param {Number} relative Relative virtual time value to add.
* @return {Number} Resulting absolute virtual time sum value.
*/
VirtualTimeSchedulerPrototype.add = notImplemented;
/**
* Converts an absolute time to a number
* @param {Any} The absolute time.
* @returns {Number} The absolute time in ms
*/
VirtualTimeSchedulerPrototype.toDateTimeOffset = notImplemented;
/**
* Converts the TimeSpan value to a relative virtual time value.
* @param {Number} timeSpan TimeSpan value to convert.
* @return {Number} Corresponding relative virtual time value.
*/
VirtualTimeSchedulerPrototype.toRelative = notImplemented;
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be emulated using recursive scheduling.
* @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).
*/
VirtualTimeSchedulerPrototype.schedulePeriodicWithState = function (state, period, action) {
var s = new SchedulePeriodicRecursive(this, state, period, action);
return s.start();
};
/**
* Schedules an action to be executed after dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleRelativeWithState = function (state, dueTime, action) {
var runAt = this.add(this.clock, dueTime);
return this.scheduleAbsoluteWithState(state, runAt, action);
};
/**
* Schedules an action to be executed at dueTime.
* @param {Number} dueTime Relative time after which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleRelative = function (dueTime, action) {
return this.scheduleRelativeWithState(action, dueTime, invokeAction);
};
/**
* Starts the virtual time scheduler.
*/
VirtualTimeSchedulerPrototype.start = function () {
if (!this.isEnabled) {
this.isEnabled = true;
do {
var next = this.getNext();
if (next !== null) {
this.comparer(next.dueTime, this.clock) > 0 && (this.clock = next.dueTime);
next.invoke();
} else {
this.isEnabled = false;
}
} while (this.isEnabled);
}
};
/**
* Stops the virtual time scheduler.
*/
VirtualTimeSchedulerPrototype.stop = function () {
this.isEnabled = false;
};
/**
* Advances the scheduler's clock to the specified time, running all work till that point.
* @param {Number} time Absolute time to advance the scheduler's clock to.
*/
VirtualTimeSchedulerPrototype.advanceTo = function (time) {
var dueToClock = this.comparer(this.clock, time);
if (this.comparer(this.clock, time) > 0) { throw new ArgumentOutOfRangeError(); }
if (dueToClock === 0) { return; }
if (!this.isEnabled) {
this.isEnabled = true;
do {
var next = this.getNext();
if (next !== null && this.comparer(next.dueTime, time) <= 0) {
this.comparer(next.dueTime, this.clock) > 0 && (this.clock = next.dueTime);
next.invoke();
} else {
this.isEnabled = false;
}
} while (this.isEnabled);
this.clock = time;
}
};
/**
* Advances the scheduler's clock by the specified relative time, running all work scheduled for that timespan.
* @param {Number} time Relative time to advance the scheduler's clock by.
*/
VirtualTimeSchedulerPrototype.advanceBy = function (time) {
var dt = this.add(this.clock, time),
dueToClock = this.comparer(this.clock, dt);
if (dueToClock > 0) { throw new ArgumentOutOfRangeError(); }
if (dueToClock === 0) { return; }
this.advanceTo(dt);
};
/**
* Advances the scheduler's clock by the specified relative time.
* @param {Number} time Relative time to advance the scheduler's clock by.
*/
VirtualTimeSchedulerPrototype.sleep = function (time) {
var dt = this.add(this.clock, time);
if (this.comparer(this.clock, dt) >= 0) { throw new ArgumentOutOfRangeError(); }
this.clock = dt;
};
/**
* Gets the next scheduled item to be executed.
* @returns {ScheduledItem} The next scheduled item.
*/
VirtualTimeSchedulerPrototype.getNext = function () {
while (this.queue.length > 0) {
var next = this.queue.peek();
if (next.isCancelled()) {
this.queue.dequeue();
} else {
return next;
}
}
return null;
};
/**
* Schedules an action to be executed at dueTime.
* @param {Scheduler} scheduler Scheduler to execute the action on.
* @param {Number} dueTime Absolute time at which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleAbsolute = function (dueTime, action) {
return this.scheduleAbsoluteWithState(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Number} dueTime Absolute time at which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleAbsoluteWithState = function (state, dueTime, action) {
var self = this;
function run(scheduler, state1) {
self.queue.remove(si);
return action(scheduler, state1);
}
var si = new ScheduledItem(this, state, run, dueTime, this.comparer);
this.queue.enqueue(si);
return si.disposable;
};
return VirtualTimeScheduler;
}(Scheduler));
/** Provides a virtual time scheduler that uses Date for absolute time and number for relative time. */
Rx.HistoricalScheduler = (function (__super__) {
inherits(HistoricalScheduler, __super__);
/**
* Creates a new historical scheduler with the specified initial clock value.
* @constructor
* @param {Number} initialClock Initial value for the clock.
* @param {Function} comparer Comparer to determine causality of events based on absolute time.
*/
function HistoricalScheduler(initialClock, comparer) {
var clock = initialClock == null ? 0 : initialClock;
var cmp = comparer || defaultSubComparer;
__super__.call(this, clock, cmp);
}
var HistoricalSchedulerProto = HistoricalScheduler.prototype;
/**
* Adds a relative time value to an absolute time value.
* @param {Number} absolute Absolute virtual time value.
* @param {Number} relative Relative virtual time value to add.
* @return {Number} Resulting absolute virtual time sum value.
*/
HistoricalSchedulerProto.add = function (absolute, relative) {
return absolute + relative;
};
HistoricalSchedulerProto.toDateTimeOffset = function (absolute) {
return new Date(absolute).getTime();
};
/**
* Converts the TimeSpan value to a relative virtual time value.
* @memberOf HistoricalScheduler
* @param {Number} timeSpan TimeSpan value to convert.
* @return {Number} Corresponding relative virtual time value.
*/
HistoricalSchedulerProto.toRelative = function (timeSpan) {
return timeSpan;
};
return HistoricalScheduler;
}(Rx.VirtualTimeScheduler));
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) {
return subscriber && isFunction(subscriber.dispose) ? subscriber :
isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty;
}
function setDisposable(s, state) {
var ado = state[0], subscribe = state[1];
var sub = tryCatch(subscribe)(ado);
if (sub === errorObj) {
if(!ado.fail(errorObj.e)) { return thrower(errorObj.e); }
}
ado.setDisposable(fixSubscriber(sub));
}
function AnonymousObservable(subscribe, parent) {
this.source = parent;
function s(observer) {
var ado = new AutoDetachObserver(observer), state = [ado, subscribe];
if (currentThreadScheduler.scheduleRequired()) {
currentThreadScheduler.scheduleWithState(state, setDisposable);
} else {
setDisposable(null, state);
}
return ado;
}
__super__.call(this, s);
}
return AnonymousObservable;
}(Observable));
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 result = tryCatch(this.observer.onNext).call(this.observer, value);
if (result === errorObj) {
this.dispose();
thrower(result.e);
}
};
AutoDetachObserverPrototype.error = function (err) {
var result = tryCatch(this.observer.onError).call(this.observer, err);
this.dispose();
result === errorObj && thrower(result.e);
};
AutoDetachObserverPrototype.completed = function () {
var result = tryCatch(this.observer.onCompleted).call(this.observer);
this.dispose();
result === errorObj && thrower(result.e);
};
AutoDetachObserverPrototype.setDisposable = function (value) { this.m.setDisposable(value); };
AutoDetachObserverPrototype.getDisposable = function () { return this.m.getDisposable(); };
AutoDetachObserverPrototype.dispose = function () {
__super__.prototype.dispose.call(this);
this.m.dispose();
};
return AutoDetachObserver;
}(AbstractObserver));
var GroupedObservable = (function (__super__) {
inherits(GroupedObservable, __super__);
function subscribe(observer) {
return this.underlyingObservable.subscribe(observer);
}
function GroupedObservable(key, underlyingObservable, mergedDisposable) {
__super__.call(this, subscribe);
this.key = key;
this.underlyingObservable = !mergedDisposable ?
underlyingObservable :
new AnonymousObservable(function (observer) {
return new CompositeDisposable(mergedDisposable.getDisposable(), underlyingObservable.subscribe(observer));
});
}
return GroupedObservable;
}(Observable));
/**
* 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(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
if (this.hasError) {
observer.onError(this.error);
return disposableEmpty;
}
observer.onCompleted();
return disposableEmpty;
}
inherits(Subject, __super__);
/**
* Creates a subject.
*/
function Subject() {
__super__.call(this, subscribe);
this.isDisposed = false,
this.isStopped = false,
this.observers = [];
this.hasError = false;
}
addProperties(Subject.prototype, Observer.prototype, {
/**
* 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(this);
if (!this.isStopped) {
this.isStopped = true;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers.length = 0;
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {
checkDisposed(this);
if (!this.isStopped) {
this.isStopped = true;
this.error = error;
this.hasError = true;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onError(error);
}
this.observers.length = 0;
}
},
/**
* 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(this);
if (!this.isStopped) {
for (var i = 0, os = cloneArray(this.observers), 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(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
if (this.hasError) {
observer.onError(this.error);
} else if (this.hasValue) {
observer.onNext(this.value);
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.hasValue = false;
this.observers = [];
this.hasError = false;
}
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(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 i, len;
checkDisposed(this);
if (!this.isStopped) {
this.isStopped = true;
var os = cloneArray(this.observers), len = os.length;
if (this.hasValue) {
for (i = 0; i < len; i++) {
var o = os[i];
o.onNext(this.value);
o.onCompleted();
}
} else {
for (i = 0; i < len; i++) {
os[i].onCompleted();
}
}
this.observers.length = 0;
}
},
/**
* Notifies all subscribed observers about the error.
* @param {Mixed} error The Error to send to all observers.
*/
onError: function (error) {
checkDisposed(this);
if (!this.isStopped) {
this.isStopped = true;
this.hasError = true;
this.error = error;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onError(error);
}
this.observers.length = 0;
}
},
/**
* 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(this);
if (this.isStopped) { return; }
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 subscribe(observer) {
return this.observable.subscribe(observer);
}
function AnonymousSubject(observer, observable) {
this.observer = observer;
this.observable = observable;
__super__.call(this, subscribe);
}
addProperties(AnonymousSubject.prototype, Observer.prototype, {
onCompleted: function () {
this.observer.onCompleted();
},
onError: function (error) {
this.observer.onError(error);
},
onNext: function (value) {
this.observer.onNext(value);
}
});
return AnonymousSubject;
}(Observable));
/**
* Used to pause and resume streams.
*/
Rx.Pauser = (function (__super__) {
inherits(Pauser, __super__);
function Pauser() {
__super__.call(this);
}
/**
* Pauses the underlying sequence.
*/
Pauser.prototype.pause = function () { this.onNext(false); };
/**
* Resumes the underlying sequence.
*/
Pauser.prototype.resume = function () { this.onNext(true); };
return Pauser;
}(Subject));
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;
}
// All code before this point will be filtered from stack traces.
var rEndingLine = captureLine();
}.call(this));
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"_process":2}],59:[function(require,module,exports){
var escape = require('escape-html');
var propConfig = require('./property-config');
var types = propConfig.attributeTypes;
var properties = propConfig.properties;
var attributeNames = propConfig.attributeNames;
var prefixAttribute = memoizeString(function (name) {
return escape(name) + '="';
});
module.exports = createAttribute;
/**
* Create attribute string.
*
* @param {String} name The name of the property or attribute
* @param {*} value The value
* @param {Boolean} [isAttribute] Denotes whether `name` is an attribute.
* @return {?String} Attribute string || null if not a valid property or custom attribute.
*/
function createAttribute(name, value, isAttribute) {
var attrType = properties[name];
if (attrType) {
if (shouldSkip(name, value)) return '';
name = (attributeNames[name] || name).toLowerCase();
// for BOOLEAN `value` only has to be truthy
// for OVERLOADED_BOOLEAN `value` has to be === true
if ((attrType === types.BOOLEAN) ||
(attrType === types.OVERLOADED_BOOLEAN && value === true)) {
return escape(name);
}
return prefixAttribute(name) + escape(value) + '"';
} else if (isAttribute) {
if (value == null) return '';
return prefixAttribute(name) + escape(value) + '"';
}
// return null if `name` is neither a valid property nor an attribute
return null;
}
/**
* Should skip false boolean attributes.
*/
function shouldSkip(name, value) {
var attrType = properties[name];
return value == null ||
(attrType === types.BOOLEAN && !value) ||
(attrType === types.OVERLOADED_BOOLEAN && value === false);
}
/**
* Memoizes the return value of a function that accepts one string argument.
*
* @param {function} callback
* @return {function}
*/
function memoizeString(callback) {
var cache = {};
return function(string) {
if (cache.hasOwnProperty(string)) {
return cache[string];
} else {
return cache[string] = callback.call(this, string);
}
};
}
},{"./property-config":69,"escape-html":61}],60:[function(require,module,exports){
var escape = require('escape-html');
var extend = require('xtend');
var isVNode = require('virtual-dom/vnode/is-vnode');
var isVText = require('virtual-dom/vnode/is-vtext');
var isThunk = require('virtual-dom/vnode/is-thunk');
var softHook = require('virtual-dom/virtual-hyperscript/hooks/soft-set-hook');
var attrHook = require('virtual-dom/virtual-hyperscript/hooks/attribute-hook');
var paramCase = require('param-case');
var createAttribute = require('./create-attribute');
var voidElements = require('./void-elements');
module.exports = toHTML;
function toHTML(node, parent) {
if (!node) return '';
if (isThunk(node)) {
node = node.render();
}
if (isVNode(node)) {
return openTag(node) + tagContent(node) + closeTag(node);
} else if (isVText(node)) {
if (parent && parent.tagName.toLowerCase() === 'script') return String(node.text);
return escape(String(node.text));
}
return '';
}
function openTag(node) {
var props = node.properties;
var ret = '<' + node.tagName.toLowerCase();
for (var name in props) {
var value = props[name];
if (value == null) continue;
if (name == 'attributes') {
value = extend({}, value);
for (var attrProp in value) {
ret += ' ' + createAttribute(attrProp, value[attrProp], true);
}
continue;
}
if (name == 'style') {
var css = '';
value = extend({}, value);
for (var styleProp in value) {
css += paramCase(styleProp) + ': ' + value[styleProp] + '; ';
}
value = css.trim();
}
if (value instanceof softHook || value instanceof attrHook) {
ret += ' ' + createAttribute(name, value.value, true);
continue;
}
var attr = createAttribute(name, value);
if (attr) ret += ' ' + attr;
}
return ret + '>';
}
function tagContent(node) {
var innerHTML = node.properties.innerHTML;
if (innerHTML != null) return innerHTML;
else {
var ret = '';
if (node.children && node.children.length) {
for (var i = 0, l = node.children.length; i<l; i++) {
var child = node.children[i];
ret += toHTML(child, node);
}
}
return ret;
}
}
function closeTag(node) {
var tag = node.tagName.toLowerCase();
return voidElements[tag] ? '' : '</' + tag + '>';
}
},{"./create-attribute":59,"./void-elements":70,"escape-html":61,"param-case":67,"virtual-dom/virtual-hyperscript/hooks/attribute-hook":89,"virtual-dom/virtual-hyperscript/hooks/soft-set-hook":91,"virtual-dom/vnode/is-thunk":95,"virtual-dom/vnode/is-vnode":97,"virtual-dom/vnode/is-vtext":98,"xtend":68}],61:[function(require,module,exports){
/**
* Escape special characters in the given string of html.
*
* @param {String} html
* @return {String}
* @api private
*/
module.exports = function(html) {
return String(html)
.replace(/&/g, '&')
.replace(/"/g, '"')
.replace(/'/g, ''')
.replace(/</g, '<')
.replace(/>/g, '>');
}
},{}],62:[function(require,module,exports){
/**
* Special language-specific overrides.
*
* Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
*
* @type {Object}
*/
var LANGUAGES = {
tr: {
regexp: /\u0130|\u0049|\u0049\u0307/g,
map: {
'\u0130': '\u0069',
'\u0049': '\u0131',
'\u0049\u0307': '\u0069'
}
},
az: {
regexp: /[\u0130]/g,
map: {
'\u0130': '\u0069',
'\u0049': '\u0131',
'\u0049\u0307': '\u0069'
}
},
lt: {
regexp: /[\u0049\u004A\u012E\u00CC\u00CD\u0128]/g,
map: {
'\u0049': '\u0069\u0307',
'\u004A': '\u006A\u0307',
'\u012E': '\u012F\u0307',
'\u00CC': '\u0069\u0307\u0300',
'\u00CD': '\u0069\u0307\u0301',
'\u0128': '\u0069\u0307\u0303'
}
}
}
/**
* Lowercase a string.
*
* @param {String} str
* @return {String}
*/
module.exports = function (str, locale) {
var lang = LANGUAGES[locale]
str = str == null ? '' : String(str)
if (lang) {
str = str.replace(lang.regexp, function (m) { return lang.map[m] })
}
return str.toLowerCase()
}
},{}],63:[function(require,module,exports){
var lowerCase = require('lower-case')
var NON_WORD_REGEXP = require('./vendor/non-word-regexp')
var CAMEL_CASE_REGEXP = require('./vendor/camel-case-regexp')
var TRAILING_DIGIT_REGEXP = require('./vendor/trailing-digit-regexp')
/**
* Sentence case a string.
*
* @param {String} str
* @param {String} locale
* @param {String} replacement
* @return {String}
*/
module.exports = function (str, locale, replacement) {
if (str == null) {
return ''
}
replacement = replacement || ' '
function replace (match, index, string) {
if (index === 0 || index === (string.length - match.length)) {
return ''
}
return replacement
}
str = String(str)
// Support camel case ("camelCase" -> "camel Case").
.replace(CAMEL_CASE_REGEXP, '$1 $2')
// Support digit groups ("test2012" -> "test 2012").
.replace(TRAILING_DIGIT_REGEXP, '$1 $2')
// Remove all non-word characters and replace with a single space.
.replace(NON_WORD_REGEXP, replace)
// Lower case the entire string.
return lowerCase(str, locale)
}
},{"./vendor/camel-case-regexp":64,"./vendor/non-word-regexp":65,"./vendor/trailing-digit-regexp":66,"lower-case":62}],64:[function(require,module,exports){
module.exports = /([\u0061-\u007A\u00B5\u00DF-\u00F6\u00F8-\u00FF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0561-\u0587\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD0-\u1FD3\u1FD6\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u210A\u210E\u210F\u2113\u212F\u2134\u2139\u213C\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5E\u2C61\u2C65\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73\u2C74\u2C76-\u2C7B\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7FA\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A])([\u0041-\u005A\u00C0-\u00D6\u00D8-\u00DE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2183\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA\uFF21-\uFF3A\u0030-\u0039\u00B2\u00B3\u00B9\u00BC-\u00BE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D66-\u0D75\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19])/g
},{}],65:[function(require,module,exports){
module.exports = /[^\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\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\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\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-\u0C33\u0C35-\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\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\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\u2183\u2184\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\u3006\u3031-\u3035\u303B\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-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\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\u0030-\u0039\u00B2\u00B3\u00B9\u00BC-\u00BE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D66-\u0D75\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]+/g
},{}],66:[function(require,module,exports){
module.exports = /([\u0030-\u0039\u00B2\u00B3\u00B9\u00BC-\u00BE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D66-\u0D75\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19])([^\u0030-\u0039\u00B2\u00B3\u00B9\u00BC-\u00BE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D66-\u0D75\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19])/g
},{}],67:[function(require,module,exports){
var sentenceCase = require('sentence-case');
/**
* Param case a string.
*
* @param {String} string
* @param {String} [locale]
* @return {String}
*/
module.exports = function (string, locale) {
return sentenceCase(string, locale, '-');
};
},{"sentence-case":63}],68:[function(require,module,exports){
module.exports = extend
function extend() {
var target = {}
for (var i = 0; i < arguments.length; i++) {
var source = arguments[i]
for (var key in source) {
if (source.hasOwnProperty(key)) {
target[key] = source[key]
}
}
}
return target
}
},{}],69:[function(require,module,exports){
/**
* Attribute types.
*/
var types = {
BOOLEAN: 1,
OVERLOADED_BOOLEAN: 2
};
/**
* Properties.
*
* Taken from https://github.com/facebook/react/blob/847357e42e5267b04dd6e297219eaa125ab2f9f4/src/browser/ui/dom/HTMLDOMPropertyConfig.js
*
*/
var properties = {
/**
* Standard Properties
*/
accept: true,
acceptCharset: true,
accessKey: true,
action: true,
allowFullScreen: types.BOOLEAN,
allowTransparency: true,
alt: true,
async: types.BOOLEAN,
autocomplete: true,
autofocus: types.BOOLEAN,
autoplay: types.BOOLEAN,
cellPadding: true,
cellSpacing: true,
charset: true,
checked: types.BOOLEAN,
classID: true,
className: true,
cols: true,
colSpan: true,
content: true,
contentEditable: true,
contextMenu: true,
controls: types.BOOLEAN,
coords: true,
crossOrigin: true,
data: true, // For `<object />` acts as `src`.
dateTime: true,
defer: types.BOOLEAN,
dir: true,
disabled: types.BOOLEAN,
download: types.OVERLOADED_BOOLEAN,
draggable: true,
enctype: true,
form: true,
formAction: true,
formEncType: true,
formMethod: true,
formNoValidate: types.BOOLEAN,
formTarget: true,
frameBorder: true,
headers: true,
height: true,
hidden: types.BOOLEAN,
href: true,
hreflang: true,
htmlFor: true,
httpEquiv: true,
icon: true,
id: true,
label: true,
lang: true,
list: true,
loop: types.BOOLEAN,
manifest: true,
marginHeight: true,
marginWidth: true,
max: true,
maxLength: true,
media: true,
mediaGroup: true,
method: true,
min: true,
multiple: types.BOOLEAN,
muted: types.BOOLEAN,
name: true,
noValidate: types.BOOLEAN,
open: true,
pattern: true,
placeholder: true,
poster: true,
preload: true,
radiogroup: true,
readOnly: types.BOOLEAN,
rel: true,
required: types.BOOLEAN,
role: true,
rows: true,
rowSpan: true,
sandbox: true,
scope: true,
scrolling: true,
seamless: types.BOOLEAN,
selected: types.BOOLEAN,
shape: true,
size: true,
sizes: true,
span: true,
spellcheck: true,
src: true,
srcdoc: true,
srcset: true,
start: true,
step: true,
style: true,
tabIndex: true,
target: true,
title: true,
type: true,
useMap: true,
value: true,
width: true,
wmode: true,
/**
* Non-standard Properties
*/
// autoCapitalize and autoCorrect are supported in Mobile Safari for
// keyboard hints.
autocapitalize: true,
autocorrect: true,
// itemProp, itemScope, itemType are for Microdata support. See
// http://schema.org/docs/gs.html
itemProp: true,
itemScope: types.BOOLEAN,
itemType: true,
// property is supported for OpenGraph in meta tags.
property: true
};
/**
* Properties to attributes mapping.
*
* The ones not here are simply converted to lower case.
*/
var attributeNames = {
acceptCharset: 'accept-charset',
className: 'class',
htmlFor: 'for',
httpEquiv: 'http-equiv'
};
/**
* Exports.
*/
module.exports = {
attributeTypes: types,
properties: properties,
attributeNames: attributeNames
};
},{}],70:[function(require,module,exports){
/**
* Void elements.
*
* https://github.com/facebook/react/blob/v0.12.0/src/browser/ui/ReactDOMComponent.js#L99
*/
module.exports = {
'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
};
},{}],71:[function(require,module,exports){
var createElement = require("./vdom/create-element.js")
module.exports = createElement
},{"./vdom/create-element.js":84}],72:[function(require,module,exports){
var diff = require("./vtree/diff.js")
module.exports = diff
},{"./vtree/diff.js":105}],73:[function(require,module,exports){
var h = require("./virtual-hyperscript/index.js")
module.exports = h
},{"./virtual-hyperscript/index.js":92}],74:[function(require,module,exports){
var diff = require("./diff.js")
var patch = require("./patch.js")
var h = require("./h.js")
var create = require("./create-element.js")
var VNode = require('./vnode/vnode.js')
var VText = require('./vnode/vtext.js')
module.exports = {
diff: diff,
patch: patch,
h: h,
create: create,
VNode: VNode,
VText: VText
}
},{"./create-element.js":71,"./diff.js":72,"./h.js":73,"./patch.js":82,"./vnode/vnode.js":101,"./vnode/vtext.js":103}],75:[function(require,module,exports){
/*!
* Cross-Browser Split 1.1.1
* Copyright 2007-2012 Steven Levithan <stevenlevithan.com>
* Available under the MIT License
* ECMAScript compliant, uniform cross-browser split method
*/
/**
* Splits a string into an array of strings using a regex or string separator. Matches of the
* separator are not included in the result array. However, if `separator` is a regex that contains
* capturing groups, backreferences are spliced into the result each time `separator` is matched.
* Fixes browser bugs compared to the native `String.prototype.split` and can be used reliably
* cross-browser.
* @param {String} str String to split.
* @param {RegExp|String} separator Regex or string to use for separating the string.
* @param {Number} [limit] Maximum number of items to include in the result array.
* @returns {Array} Array of substrings.
* @example
*
* // Basic use
* split('a b c d', ' ');
* // -> ['a', 'b', 'c', 'd']
*
* // With limit
* split('a b c d', ' ', 2);
* // -> ['a', 'b']
*
* // Backreferences in result array
* split('..word1 word2..', /([a-z]+)(\d+)/i);
* // -> ['..', 'word', '1', ' ', 'word', '2', '..']
*/
module.exports = (function split(undef) {
var nativeSplit = String.prototype.split,
compliantExecNpcg = /()??/.exec("")[1] === undef,
// NPCG: nonparticipating capturing group
self;
self = function(str, separator, limit) {
// If `separator` is not a regex, use `nativeSplit`
if (Object.prototype.toString.call(separator) !== "[object RegExp]") {
return nativeSplit.call(str, separator, limit);
}
var output = [],
flags = (separator.ignoreCase ? "i" : "") + (separator.multiline ? "m" : "") + (separator.extended ? "x" : "") + // Proposed for ES6
(separator.sticky ? "y" : ""),
// Firefox 3+
lastLastIndex = 0,
// Make `global` and avoid `lastIndex` issues by working with a copy
separator = new RegExp(separator.source, flags + "g"),
separator2, match, lastIndex, lastLength;
str += ""; // Type-convert
if (!compliantExecNpcg) {
// Doesn't need flags gy, but they don't hurt
separator2 = new RegExp("^" + separator.source + "$(?!\\s)", flags);
}
/* Values for `limit`, per the spec:
* If undefined: 4294967295 // Math.pow(2, 32) - 1
* If 0, Infinity, or NaN: 0
* If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296;
* If negative number: 4294967296 - Math.floor(Math.abs(limit))
* If other: Type-convert, then use the above rules
*/
limit = limit === undef ? -1 >>> 0 : // Math.pow(2, 32) - 1
limit >>> 0; // ToUint32(limit)
while (match = separator.exec(str)) {
// `separator.lastIndex` is not reliable cross-browser
lastIndex = match.index + match[0].length;
if (lastIndex > lastLastIndex) {
output.push(str.slice(lastLastIndex, match.index));
// Fix browsers whose `exec` methods don't consistently return `undefined` for
// nonparticipating capturing groups
if (!compliantExecNpcg && match.length > 1) {
match[0].replace(separator2, function() {
for (var i = 1; i < arguments.length - 2; i++) {
if (arguments[i] === undef) {
match[i] = undef;
}
}
});
}
if (match.length > 1 && match.index < str.length) {
Array.prototype.push.apply(output, match.slice(1));
}
lastLength = match[0].length;
lastLastIndex = lastIndex;
if (output.length >= limit) {
break;
}
}
if (separator.lastIndex === match.index) {
separator.lastIndex++; // Avoid an infinite loop
}
}
if (lastLastIndex === str.length) {
if (lastLength || !separator.test("")) {
output.push("");
}
} else {
output.push(str.slice(lastLastIndex));
}
return output.length > limit ? output.slice(0, limit) : output;
};
return self;
})();
},{}],76:[function(require,module,exports){
'use strict';
var OneVersionConstraint = require('individual/one-version');
var MY_VERSION = '7';
OneVersionConstraint('ev-store', MY_VERSION);
var hashKey = '__EV_STORE_KEY@' + MY_VERSION;
module.exports = EvStore;
function EvStore(elem) {
var hash = elem[hashKey];
if (!hash) {
hash = elem[hashKey] = {};
}
return hash;
}
},{"individual/one-version":78}],77:[function(require,module,exports){
(function (global){
'use strict';
/*global window, global*/
var root = typeof window !== 'undefined' ?
window : typeof global !== 'undefined' ?
global : {};
module.exports = Individual;
function Individual(key, value) {
if (key in root) {
return root[key];
}
root[key] = value;
return value;
}
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}],78:[function(require,module,exports){
'use strict';
var Individual = require('./index.js');
module.exports = OneVersion;
function OneVersion(moduleName, version, defaultValue) {
var key = '__INDIVIDUAL_ONE_VERSION_' + moduleName;
var enforceKey = key + '_ENFORCE_SINGLETON';
var versionValue = Individual(enforceKey, version);
if (versionValue !== version) {
throw new Error('Can only have one copy of ' +
moduleName + '.\n' +
'You already have version ' + versionValue +
' installed.\n' +
'This means you cannot install version ' + version);
}
return Individual(key, defaultValue);
}
},{"./index.js":77}],79:[function(require,module,exports){
(function (global){
var topLevel = typeof global !== 'undefined' ? global :
typeof window !== 'undefined' ? window : {}
var minDoc = require('min-document');
if (typeof document !== 'undefined') {
module.exports = document;
} else {
var doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'];
if (!doccy) {
doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc;
}
module.exports = doccy;
}
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"min-document":1}],80:[function(require,module,exports){
"use strict";
module.exports = function isObject(x) {
return typeof x === "object" && x !== null;
};
},{}],81:[function(require,module,exports){
var nativeIsArray = Array.isArray
var toString = Object.prototype.toString
module.exports = nativeIsArray || isArray
function isArray(obj) {
return toString.call(obj) === "[object Array]"
}
},{}],82:[function(require,module,exports){
var patch = require("./vdom/patch.js")
module.exports = patch
},{"./vdom/patch.js":87}],83:[function(require,module,exports){
var isObject = require("is-object")
var isHook = require("../vnode/is-vhook.js")
module.exports = applyProperties
function applyProperties(node, props, previous) {
for (var propName in props) {
var propValue = props[propName]
if (propValue === undefined) {
removeProperty(node, propName, propValue, previous);
} else if (isHook(propValue)) {
removeProperty(node, propName, propValue, previous)
if (propValue.hook) {
propValue.hook(node,
propName,
previous ? previous[propName] : undefined)
}
} else {
if (isObject(propValue)) {
patchObject(node, props, previous, propName, propValue);
} else {
node[propName] = propValue
}
}
}
}
function removeProperty(node, propName, propValue, previous) {
if (previous) {
var previousValue = previous[propName]
if (!isHook(previousValue)) {
if (propName === "attributes") {
for (var attrName in previousValue) {
node.removeAttribute(attrName)
}
} else if (propName === "style") {
for (var i in previousValue) {
node.style[i] = ""
}
} else if (typeof previousValue === "string") {
node[propName] = ""
} else {
node[propName] = null
}
} else if (previousValue.unhook) {
previousValue.unhook(node, propName, propValue)
}
}
}
function patchObject(node, props, previous, propName, propValue) {
var previousValue = previous ? previous[propName] : undefined
// Set attributes
if (propName === "attributes") {
for (var attrName in propValue) {
var attrValue = propValue[attrName]
if (attrValue === undefined) {
node.removeAttribute(attrName)
} else {
node.setAttribute(attrName, attrValue)
}
}
return
}
if(previousValue && isObject(previousValue) &&
getPrototype(previousValue) !== getPrototype(propValue)) {
node[propName] = propValue
return
}
if (!isObject(node[propName])) {
node[propName] = {}
}
var replacer = propName === "style" ? "" : undefined
for (var k in propValue) {
var value = propValue[k]
node[propName][k] = (value === undefined) ? replacer : value
}
}
function getPrototype(value) {
if (Object.getPrototypeOf) {
return Object.getPrototypeOf(value)
} else if (value.__proto__) {
return value.__proto__
} else if (value.constructor) {
return value.constructor.prototype
}
}
},{"../vnode/is-vhook.js":96,"is-object":80}],84:[function(require,module,exports){
var document = require("global/document")
var applyProperties = require("./apply-properties")
var isVNode = require("../vnode/is-vnode.js")
var isVText = require("../vnode/is-vtext.js")
var isWidget = require("../vnode/is-widget.js")
var handleThunk = require("../vnode/handle-thunk.js")
module.exports = createElement
function createElement(vnode, opts) {
var doc = opts ? opts.document || document : document
var warn = opts ? opts.warn : null
vnode = handleThunk(vnode).a
if (isWidget(vnode)) {
return vnode.init()
} else if (isVText(vnode)) {
return doc.createTextNode(vnode.text)
} else if (!isVNode(vnode)) {
if (warn) {
warn("Item is not a valid virtual dom node", vnode)
}
return null
}
var node = (vnode.namespace === null) ?
doc.createElement(vnode.tagName) :
doc.createElementNS(vnode.namespace, vnode.tagName)
var props = vnode.properties
applyProperties(node, props)
var children = vnode.children
for (var i = 0; i < children.length; i++) {
var childNode = createElement(children[i], opts)
if (childNode) {
node.appendChild(childNode)
}
}
return node
}
},{"../vnode/handle-thunk.js":94,"../vnode/is-vnode.js":97,"../vnode/is-vtext.js":98,"../vnode/is-widget.js":99,"./apply-properties":83,"global/document":79}],85:[function(require,module,exports){
// Maps a virtual DOM tree onto a real DOM tree in an efficient manner.
// We don't want to read all of the DOM nodes in the tree so we use
// the in-order tree indexing to eliminate recursion down certain branches.
// We only recurse into a DOM node if we know that it contains a child of
// interest.
var noChild = {}
module.exports = domIndex
function domIndex(rootNode, tree, indices, nodes) {
if (!indices || indices.length === 0) {
return {}
} else {
indices.sort(ascending)
return recurse(rootNode, tree, indices, nodes, 0)
}
}
function recurse(rootNode, tree, indices, nodes, rootIndex) {
nodes = nodes || {}
if (rootNode) {
if (indexInRange(indices, rootIndex, rootIndex)) {
nodes[rootIndex] = rootNode
}
var vChildren = tree.children
if (vChildren) {
var childNodes = rootNode.childNodes
for (var i = 0; i < tree.children.length; i++) {
rootIndex += 1
var vChild = vChildren[i] || noChild
var nextIndex = rootIndex + (vChild.count || 0)
// skip recursion down the tree if there are no nodes down here
if (indexInRange(indices, rootIndex, nextIndex)) {
recurse(childNodes[i], vChild, indices, nodes, rootIndex)
}
rootIndex = nextIndex
}
}
}
return nodes
}
// Binary search for an index in the interval [left, right]
function indexInRange(indices, left, right) {
if (indices.length === 0) {
return false
}
var minIndex = 0
var maxIndex = indices.length - 1
var currentIndex
var currentItem
while (minIndex <= maxIndex) {
currentIndex = ((maxIndex + minIndex) / 2) >> 0
currentItem = indices[currentIndex]
if (minIndex === maxIndex) {
return currentItem >= left && currentItem <= right
} else if (currentItem < left) {
minIndex = currentIndex + 1
} else if (currentItem > right) {
maxIndex = currentIndex - 1
} else {
return true
}
}
return false;
}
function ascending(a, b) {
return a > b ? 1 : -1
}
},{}],86:[function(require,module,exports){
var applyProperties = require("./apply-properties")
var isWidget = require("../vnode/is-widget.js")
var VPatch = require("../vnode/vpatch.js")
var render = require("./create-element")
var updateWidget = require("./update-widget")
module.exports = applyPatch
function applyPatch(vpatch, domNode, renderOptions) {
var type = vpatch.type
var vNode = vpatch.vNode
var patch = vpatch.patch
switch (type) {
case VPatch.REMOVE:
return removeNode(domNode, vNode)
case VPatch.INSERT:
return insertNode(domNode, patch, renderOptions)
case VPatch.VTEXT:
return stringPatch(domNode, vNode, patch, renderOptions)
case VPatch.WIDGET:
return widgetPatch(domNode, vNode, patch, renderOptions)
case VPatch.VNODE:
return vNodePatch(domNode, vNode, patch, renderOptions)
case VPatch.ORDER:
reorderChildren(domNode, patch)
return domNode
case VPatch.PROPS:
applyProperties(domNode, patch, vNode.properties)
return domNode
case VPatch.THUNK:
return replaceRoot(domNode,
renderOptions.patch(domNode, patch, renderOptions))
default:
return domNode
}
}
function removeNode(domNode, vNode) {
var parentNode = domNode.parentNode
if (parentNode) {
parentNode.removeChild(domNode)
}
destroyWidget(domNode, vNode);
return null
}
function insertNode(parentNode, vNode, renderOptions) {
var newNode = render(vNode, renderOptions)
if (parentNode) {
parentNode.appendChild(newNode)
}
return parentNode
}
function stringPatch(domNode, leftVNode, vText, renderOptions) {
var newNode
if (domNode.nodeType === 3) {
domNode.replaceData(0, domNode.length, vText.text)
newNode = domNode
} else {
var parentNode = domNode.parentNode
newNode = render(vText, renderOptions)
if (parentNode && newNode !== domNode) {
parentNode.replaceChild(newNode, domNode)
}
}
return newNode
}
function widgetPatch(domNode, leftVNode, widget, renderOptions) {
var updating = updateWidget(leftVNode, widget)
var newNode
if (updating) {
newNode = widget.update(leftVNode, domNode) || domNode
} else {
newNode = render(widget, renderOptions)
}
var parentNode = domNode.parentNode
if (parentNode && newNode !== domNode) {
parentNode.replaceChild(newNode, domNode)
}
if (!updating) {
destroyWidget(domNode, leftVNode)
}
return newNode
}
function vNodePatch(domNode, leftVNode, vNode, renderOptions) {
var parentNode = domNode.parentNode
var newNode = render(vNode, renderOptions)
if (parentNode && newNode !== domNode) {
parentNode.replaceChild(newNode, domNode)
}
return newNode
}
function destroyWidget(domNode, w) {
if (typeof w.destroy === "function" && isWidget(w)) {
w.destroy(domNode)
}
}
function reorderChildren(domNode, moves) {
var childNodes = domNode.childNodes
var keyMap = {}
var node
var remove
var insert
for (var i = 0; i < moves.removes.length; i++) {
remove = moves.removes[i]
node = childNodes[remove.from]
if (remove.key) {
keyMap[remove.key] = node
}
domNode.removeChild(node)
}
var length = childNodes.length
for (var j = 0; j < moves.inserts.length; j++) {
insert = moves.inserts[j]
node = keyMap[insert.key]
// this is the weirdest bug i've ever seen in webkit
domNode.insertBefore(node, insert.to >= length++ ? null : childNodes[insert.to])
}
}
function replaceRoot(oldRoot, newRoot) {
if (oldRoot && newRoot && oldRoot !== newRoot && oldRoot.parentNode) {
oldRoot.parentNode.replaceChild(newRoot, oldRoot)
}
return newRoot;
}
},{"../vnode/is-widget.js":99,"../vnode/vpatch.js":102,"./apply-properties":83,"./create-element":84,"./update-widget":88}],87:[function(require,module,exports){
var document = require("global/document")
var isArray = require("x-is-array")
var domIndex = require("./dom-index")
var patchOp = require("./patch-op")
module.exports = patch
function patch(rootNode, patches) {
return patchRecursive(rootNode, patches)
}
function patchRecursive(rootNode, patches, renderOptions) {
var indices = patchIndices(patches)
if (indices.length === 0) {
return rootNode
}
var index = domIndex(rootNode, patches.a, indices)
var ownerDocument = rootNode.ownerDocument
if (!renderOptions) {
renderOptions = { patch: patchRecursive }
if (ownerDocument !== document) {
renderOptions.document = ownerDocument
}
}
for (var i = 0; i < indices.length; i++) {
var nodeIndex = indices[i]
rootNode = applyPatch(rootNode,
index[nodeIndex],
patches[nodeIndex],
renderOptions)
}
return rootNode
}
function applyPatch(rootNode, domNode, patchList, renderOptions) {
if (!domNode) {
return rootNode
}
var newNode
if (isArray(patchList)) {
for (var i = 0; i < patchList.length; i++) {
newNode = patchOp(patchList[i], domNode, renderOptions)
if (domNode === rootNode) {
rootNode = newNode
}
}
} else {
newNode = patchOp(patchList, domNode, renderOptions)
if (domNode === rootNode) {
rootNode = newNode
}
}
return rootNode
}
function patchIndices(patches) {
var indices = []
for (var key in patches) {
if (key !== "a") {
indices.push(Number(key))
}
}
return indices
}
},{"./dom-index":85,"./patch-op":86,"global/document":79,"x-is-array":81}],88:[function(require,module,exports){
var isWidget = require("../vnode/is-widget.js")
module.exports = updateWidget
function updateWidget(a, b) {
if (isWidget(a) && isWidget(b)) {
if ("name" in a && "name" in b) {
return a.id === b.id
} else {
return a.init === b.init
}
}
return false
}
},{"../vnode/is-widget.js":99}],89:[function(require,module,exports){
'use strict';
module.exports = AttributeHook;
function AttributeHook(namespace, value) {
if (!(this instanceof AttributeHook)) {
return new AttributeHook(namespace, value);
}
this.namespace = namespace;
this.value = value;
}
AttributeHook.prototype.hook = function (node, prop, prev) {
if (prev && prev.type === 'AttributeHook' &&
prev.value === this.value &&
prev.namespace === this.namespace) {
return;
}
node.setAttributeNS(this.namespace, prop, this.value);
};
AttributeHook.prototype.unhook = function (node, prop, next) {
if (next && next.type === 'AttributeHook' &&
next.namespace === this.namespace) {
return;
}
var colonPosition = prop.indexOf(':');
var localName = colonPosition > -1 ? prop.substr(colonPosition + 1) : prop;
node.removeAttributeNS(this.namespace, localName);
};
AttributeHook.prototype.type = 'AttributeHook';
},{}],90:[function(require,module,exports){
'use strict';
var EvStore = require('ev-store');
module.exports = EvHook;
function EvHook(value) {
if (!(this instanceof EvHook)) {
return new EvHook(value);
}
this.value = value;
}
EvHook.prototype.hook = function (node, propertyName) {
var es = EvStore(node);
var propName = propertyName.substr(3);
es[propName] = this.value;
};
EvHook.prototype.unhook = function(node, propertyName) {
var es = EvStore(node);
var propName = propertyName.substr(3);
es[propName] = undefined;
};
},{"ev-store":76}],91:[function(require,module,exports){
'use strict';
module.exports = SoftSetHook;
function SoftSetHook(value) {
if (!(this instanceof SoftSetHook)) {
return new SoftSetHook(value);
}
this.value = value;
}
SoftSetHook.prototype.hook = function (node, propertyName) {
if (node[propertyName] !== this.value) {
node[propertyName] = this.value;
}
};
},{}],92:[function(require,module,exports){
'use strict';
var isArray = require('x-is-array');
var VNode = require('../vnode/vnode.js');
var VText = require('../vnode/vtext.js');
var isVNode = require('../vnode/is-vnode');
var isVText = require('../vnode/is-vtext');
var isWidget = require('../vnode/is-widget');
var isHook = require('../vnode/is-vhook');
var isVThunk = require('../vnode/is-thunk');
var parseTag = require('./parse-tag.js');
var softSetHook = require('./hooks/soft-set-hook.js');
var evHook = require('./hooks/ev-hook.js');
module.exports = h;
function h(tagName, properties, children) {
var childNodes = [];
var tag, props, key, namespace;
if (!children && isChildren(properties)) {
children = properties;
props = {};
}
props = props || properties || {};
tag = parseTag(tagName, props);
// support keys
if (props.hasOwnProperty('key')) {
key = props.key;
props.key = undefined;
}
// support namespace
if (props.hasOwnProperty('namespace')) {
namespace = props.namespace;
props.namespace = undefined;
}
// fix cursor bug
if (tag === 'INPUT' &&
!namespace &&
props.hasOwnProperty('value') &&
props.value !== undefined &&
!isHook(props.value)
) {
props.value = softSetHook(props.value);
}
transformProperties(props);
if (children !== undefined && children !== null) {
addChild(children, childNodes, tag, props);
}
return new VNode(tag, props, childNodes, key, namespace);
}
function addChild(c, childNodes, tag, props) {
if (typeof c === 'string') {
childNodes.push(new VText(c));
} else if (isChild(c)) {
childNodes.push(c);
} else if (isArray(c)) {
for (var i = 0; i < c.length; i++) {
addChild(c[i], childNodes, tag, props);
}
} else if (c === null || c === undefined) {
return;
} else {
throw UnexpectedVirtualElement({
foreignObject: c,
parentVnode: {
tagName: tag,
properties: props
}
});
}
}
function transformProperties(props) {
for (var propName in props) {
if (props.hasOwnProperty(propName)) {
var value = props[propName];
if (isHook(value)) {
continue;
}
if (propName.substr(0, 3) === 'ev-') {
// add ev-foo support
props[propName] = evHook(value);
}
}
}
}
function isChild(x) {
return isVNode(x) || isVText(x) || isWidget(x) || isVThunk(x);
}
function isChildren(x) {
return typeof x === 'string' || isArray(x) || isChild(x);
}
function UnexpectedVirtualElement(data) {
var err = new Error();
err.type = 'virtual-hyperscript.unexpected.virtual-element';
err.message = 'Unexpected virtual child passed to h().\n' +
'Expected a VNode / Vthunk / VWidget / string but:\n' +
'got:\n' +
errorString(data.foreignObject) +
'.\n' +
'The parent vnode is:\n' +
errorString(data.parentVnode)
'\n' +
'Suggested fix: change your `h(..., [ ... ])` callsite.';
err.foreignObject = data.foreignObject;
err.parentVnode = data.parentVnode;
return err;
}
function errorString(obj) {
try {
return JSON.stringify(obj, null, ' ');
} catch (e) {
return String(obj);
}
}
},{"../vnode/is-thunk":95,"../vnode/is-vhook":96,"../vnode/is-vnode":97,"../vnode/is-vtext":98,"../vnode/is-widget":99,"../vnode/vnode.js":101,"../vnode/vtext.js":103,"./hooks/ev-hook.js":90,"./hooks/soft-set-hook.js":91,"./parse-tag.js":93,"x-is-array":81}],93:[function(require,module,exports){
'use strict';
var split = require('browser-split');
var classIdSplit = /([\.#]?[a-zA-Z0-9_:-]+)/;
var notClassId = /^\.|#/;
module.exports = parseTag;
function parseTag(tag, props) {
if (!tag) {
return 'DIV';
}
var noId = !(props.hasOwnProperty('id'));
var tagParts = split(tag, classIdSplit);
var tagName = null;
if (notClassId.test(tagParts[1])) {
tagName = 'DIV';
}
var classes, part, type, i;
for (i = 0; i < tagParts.length; i++) {
part = tagParts[i];
if (!part) {
continue;
}
type = part.charAt(0);
if (!tagName) {
tagName = part;
} else if (type === '.') {
classes = classes || [];
classes.push(part.substring(1, part.length));
} else if (type === '#' && noId) {
props.id = part.substring(1, part.length);
}
}
if (classes) {
if (props.className) {
classes.push(props.className);
}
props.className = classes.join(' ');
}
return props.namespace ? tagName : tagName.toUpperCase();
}
},{"browser-split":75}],94:[function(require,module,exports){
var isVNode = require("./is-vnode")
var isVText = require("./is-vtext")
var isWidget = require("./is-widget")
var isThunk = require("./is-thunk")
module.exports = handleThunk
function handleThunk(a, b) {
var renderedA = a
var renderedB = b
if (isThunk(b)) {
renderedB = renderThunk(b, a)
}
if (isThunk(a)) {
renderedA = renderThunk(a, null)
}
return {
a: renderedA,
b: renderedB
}
}
function renderThunk(thunk, previous) {
var renderedThunk = thunk.vnode
if (!renderedThunk) {
renderedThunk = thunk.vnode = thunk.render(previous)
}
if (!(isVNode(renderedThunk) ||
isVText(renderedThunk) ||
isWidget(renderedThunk))) {
throw new Error("thunk did not return a valid node");
}
return renderedThunk
}
},{"./is-thunk":95,"./is-vnode":97,"./is-vtext":98,"./is-widget":99}],95:[function(require,module,exports){
module.exports = isThunk
function isThunk(t) {
return t && t.type === "Thunk"
}
},{}],96:[function(require,module,exports){
module.exports = isHook
function isHook(hook) {
return hook &&
(typeof hook.hook === "function" && !hook.hasOwnProperty("hook") ||
typeof hook.unhook === "function" && !hook.hasOwnProperty("unhook"))
}
},{}],97:[function(require,module,exports){
var version = require("./version")
module.exports = isVirtualNode
function isVirtualNode(x) {
return x && x.type === "VirtualNode" && x.version === version
}
},{"./version":100}],98:[function(require,module,exports){
var version = require("./version")
module.exports = isVirtualText
function isVirtualText(x) {
return x && x.type === "VirtualText" && x.version === version
}
},{"./version":100}],99:[function(require,module,exports){
module.exports = isWidget
function isWidget(w) {
return w && w.type === "Widget"
}
},{}],100:[function(require,module,exports){
module.exports = "2"
},{}],101:[function(require,module,exports){
var version = require("./version")
var isVNode = require("./is-vnode")
var isWidget = require("./is-widget")
var isThunk = require("./is-thunk")
var isVHook = require("./is-vhook")
module.exports = VirtualNode
var noProperties = {}
var noChildren = []
function VirtualNode(tagName, properties, children, key, namespace) {
this.tagName = tagName
this.properties = properties || noProperties
this.children = children || noChildren
this.key = key != null ? String(key) : undefined
this.namespace = (typeof namespace === "string") ? namespace : null
var count = (children && children.length) || 0
var descendants = 0
var hasWidgets = false
var hasThunks = false
var descendantHooks = false
var hooks
for (var propName in properties) {
if (properties.hasOwnProperty(propName)) {
var property = properties[propName]
if (isVHook(property) && property.unhook) {
if (!hooks) {
hooks = {}
}
hooks[propName] = property
}
}
}
for (var i = 0; i < count; i++) {
var child = children[i]
if (isVNode(child)) {
descendants += child.count || 0
if (!hasWidgets && child.hasWidgets) {
hasWidgets = true
}
if (!hasThunks && child.hasThunks) {
hasThunks = true
}
if (!descendantHooks && (child.hooks || child.descendantHooks)) {
descendantHooks = true
}
} else if (!hasWidgets && isWidget(child)) {
if (typeof child.destroy === "function") {
hasWidgets = true
}
} else if (!hasThunks && isThunk(child)) {
hasThunks = true;
}
}
this.count = count + descendants
this.hasWidgets = hasWidgets
this.hasThunks = hasThunks
this.hooks = hooks
this.descendantHooks = descendantHooks
}
VirtualNode.prototype.version = version
VirtualNode.prototype.type = "VirtualNode"
},{"./is-thunk":95,"./is-vhook":96,"./is-vnode":97,"./is-widget":99,"./version":100}],102:[function(require,module,exports){
var version = require("./version")
VirtualPatch.NONE = 0
VirtualPatch.VTEXT = 1
VirtualPatch.VNODE = 2
VirtualPatch.WIDGET = 3
VirtualPatch.PROPS = 4
VirtualPatch.ORDER = 5
VirtualPatch.INSERT = 6
VirtualPatch.REMOVE = 7
VirtualPatch.THUNK = 8
module.exports = VirtualPatch
function VirtualPatch(type, vNode, patch) {
this.type = Number(type)
this.vNode = vNode
this.patch = patch
}
VirtualPatch.prototype.version = version
VirtualPatch.prototype.type = "VirtualPatch"
},{"./version":100}],103:[function(require,module,exports){
var version = require("./version")
module.exports = VirtualText
function VirtualText(text) {
this.text = String(text)
}
VirtualText.prototype.version = version
VirtualText.prototype.type = "VirtualText"
},{"./version":100}],104:[function(require,module,exports){
var isObject = require("is-object")
var isHook = require("../vnode/is-vhook")
module.exports = diffProps
function diffProps(a, b) {
var diff
for (var aKey in a) {
if (!(aKey in b)) {
diff = diff || {}
diff[aKey] = undefined
}
var aValue = a[aKey]
var bValue = b[aKey]
if (aValue === bValue) {
continue
} else if (isObject(aValue) && isObject(bValue)) {
if (getPrototype(bValue) !== getPrototype(aValue)) {
diff = diff || {}
diff[aKey] = bValue
} else if (isHook(bValue)) {
diff = diff || {}
diff[aKey] = bValue
} else {
var objectDiff = diffProps(aValue, bValue)
if (objectDiff) {
diff = diff || {}
diff[aKey] = objectDiff
}
}
} else {
diff = diff || {}
diff[aKey] = bValue
}
}
for (var bKey in b) {
if (!(bKey in a)) {
diff = diff || {}
diff[bKey] = b[bKey]
}
}
return diff
}
function getPrototype(value) {
if (Object.getPrototypeOf) {
return Object.getPrototypeOf(value)
} else if (value.__proto__) {
return value.__proto__
} else if (value.constructor) {
return value.constructor.prototype
}
}
},{"../vnode/is-vhook":96,"is-object":80}],105:[function(require,module,exports){
var isArray = require("x-is-array")
var VPatch = require("../vnode/vpatch")
var isVNode = require("../vnode/is-vnode")
var isVText = require("../vnode/is-vtext")
var isWidget = require("../vnode/is-widget")
var isThunk = require("../vnode/is-thunk")
var handleThunk = require("../vnode/handle-thunk")
var diffProps = require("./diff-props")
module.exports = diff
function diff(a, b) {
var patch = { a: a }
walk(a, b, patch, 0)
return patch
}
function walk(a, b, patch, index) {
if (a === b) {
return
}
var apply = patch[index]
var applyClear = false
if (isThunk(a) || isThunk(b)) {
thunks(a, b, patch, index)
} else if (b == null) {
// If a is a widget we will add a remove patch for it
// Otherwise any child widgets/hooks must be destroyed.
// This prevents adding two remove patches for a widget.
if (!isWidget(a)) {
clearState(a, patch, index)
apply = patch[index]
}
apply = appendPatch(apply, new VPatch(VPatch.REMOVE, a, b))
} else if (isVNode(b)) {
if (isVNode(a)) {
if (a.tagName === b.tagName &&
a.namespace === b.namespace &&
a.key === b.key) {
var propsPatch = diffProps(a.properties, b.properties)
if (propsPatch) {
apply = appendPatch(apply,
new VPatch(VPatch.PROPS, a, propsPatch))
}
apply = diffChildren(a, b, patch, apply, index)
} else {
apply = appendPatch(apply, new VPatch(VPatch.VNODE, a, b))
applyClear = true
}
} else {
apply = appendPatch(apply, new VPatch(VPatch.VNODE, a, b))
applyClear = true
}
} else if (isVText(b)) {
if (!isVText(a)) {
apply = appendPatch(apply, new VPatch(VPatch.VTEXT, a, b))
applyClear = true
} else if (a.text !== b.text) {
apply = appendPatch(apply, new VPatch(VPatch.VTEXT, a, b))
}
} else if (isWidget(b)) {
if (!isWidget(a)) {
applyClear = true
}
apply = appendPatch(apply, new VPatch(VPatch.WIDGET, a, b))
}
if (apply) {
patch[index] = apply
}
if (applyClear) {
clearState(a, patch, index)
}
}
function diffChildren(a, b, patch, apply, index) {
var aChildren = a.children
var orderedSet = reorder(aChildren, b.children)
var bChildren = orderedSet.children
var aLen = aChildren.length
var bLen = bChildren.length
var len = aLen > bLen ? aLen : bLen
for (var i = 0; i < len; i++) {
var leftNode = aChildren[i]
var rightNode = bChildren[i]
index += 1
if (!leftNode) {
if (rightNode) {
// Excess nodes in b need to be added
apply = appendPatch(apply,
new VPatch(VPatch.INSERT, null, rightNode))
}
} else {
walk(leftNode, rightNode, patch, index)
}
if (isVNode(leftNode) && leftNode.count) {
index += leftNode.count
}
}
if (orderedSet.moves) {
// Reorder nodes last
apply = appendPatch(apply, new VPatch(
VPatch.ORDER,
a,
orderedSet.moves
))
}
return apply
}
function clearState(vNode, patch, index) {
// TODO: Make this a single walk, not two
unhook(vNode, patch, index)
destroyWidgets(vNode, patch, index)
}
// Patch records for all destroyed widgets must be added because we need
// a DOM node reference for the destroy function
function destroyWidgets(vNode, patch, index) {
if (isWidget(vNode)) {
if (typeof vNode.destroy === "function") {
patch[index] = appendPatch(
patch[index],
new VPatch(VPatch.REMOVE, vNode, null)
)
}
} else if (isVNode(vNode) && (vNode.hasWidgets || vNode.hasThunks)) {
var children = vNode.children
var len = children.length
for (var i = 0; i < len; i++) {
var child = children[i]
index += 1
destroyWidgets(child, patch, index)
if (isVNode(child) && child.count) {
index += child.count
}
}
} else if (isThunk(vNode)) {
thunks(vNode, null, patch, index)
}
}
// Create a sub-patch for thunks
function thunks(a, b, patch, index) {
var nodes = handleThunk(a, b)
var thunkPatch = diff(nodes.a, nodes.b)
if (hasPatches(thunkPatch)) {
patch[index] = new VPatch(VPatch.THUNK, null, thunkPatch)
}
}
function hasPatches(patch) {
for (var index in patch) {
if (index !== "a") {
return true
}
}
return false
}
// Execute hooks when two nodes are identical
function unhook(vNode, patch, index) {
if (isVNode(vNode)) {
if (vNode.hooks) {
patch[index] = appendPatch(
patch[index],
new VPatch(
VPatch.PROPS,
vNode,
undefinedKeys(vNode.hooks)
)
)
}
if (vNode.descendantHooks || vNode.hasThunks) {
var children = vNode.children
var len = children.length
for (var i = 0; i < len; i++) {
var child = children[i]
index += 1
unhook(child, patch, index)
if (isVNode(child) && child.count) {
index += child.count
}
}
}
} else if (isThunk(vNode)) {
thunks(vNode, null, patch, index)
}
}
function undefinedKeys(obj) {
var result = {}
for (var key in obj) {
result[key] = undefined
}
return result
}
// List diff, naive left to right reordering
function reorder(aChildren, bChildren) {
// O(M) time, O(M) memory
var bChildIndex = keyIndex(bChildren)
var bKeys = bChildIndex.keys
var bFree = bChildIndex.free
if (bFree.length === bChildren.length) {
return {
children: bChildren,
moves: null
}
}
// O(N) time, O(N) memory
var aChildIndex = keyIndex(aChildren)
var aKeys = aChildIndex.keys
var aFree = aChildIndex.free
if (aFree.length === aChildren.length) {
return {
children: bChildren,
moves: null
}
}
// O(MAX(N, M)) memory
var newChildren = []
var freeIndex = 0
var freeCount = bFree.length
var deletedItems = 0
// Iterate through a and match a node in b
// O(N) time,
for (var i = 0 ; i < aChildren.length; i++) {
var aItem = aChildren[i]
var itemIndex
if (aItem.key) {
if (bKeys.hasOwnProperty(aItem.key)) {
// Match up the old keys
itemIndex = bKeys[aItem.key]
newChildren.push(bChildren[itemIndex])
} else {
// Remove old keyed items
itemIndex = i - deletedItems++
newChildren.push(null)
}
} else {
// Match the item in a with the next free item in b
if (freeIndex < freeCount) {
itemIndex = bFree[freeIndex++]
newChildren.push(bChildren[itemIndex])
} else {
// There are no free items in b to match with
// the free items in a, so the extra free nodes
// are deleted.
itemIndex = i - deletedItems++
newChildren.push(null)
}
}
}
var lastFreeIndex = freeIndex >= bFree.length ?
bChildren.length :
bFree[freeIndex]
// Iterate through b and append any new keys
// O(M) time
for (var j = 0; j < bChildren.length; j++) {
var newItem = bChildren[j]
if (newItem.key) {
if (!aKeys.hasOwnProperty(newItem.key)) {
// Add any new keyed items
// We are adding new items to the end and then sorting them
// in place. In future we should insert new items in place.
newChildren.push(newItem)
}
} else if (j >= lastFreeIndex) {
// Add any leftover non-keyed items
newChildren.push(newItem)
}
}
var simulate = newChildren.slice()
var simulateIndex = 0
var removes = []
var inserts = []
var simulateItem
for (var k = 0; k < bChildren.length;) {
var wantedItem = bChildren[k]
simulateItem = simulate[simulateIndex]
// remove items
while (simulateItem === null && simulate.length) {
removes.push(remove(simulate, simulateIndex, null))
simulateItem = simulate[simulateIndex]
}
if (!simulateItem || simulateItem.key !== wantedItem.key) {
// if we need a key in this position...
if (wantedItem.key) {
if (simulateItem && simulateItem.key) {
// if an insert doesn't put this key in place, it needs to move
if (bKeys[simulateItem.key] !== k + 1) {
removes.push(remove(simulate, simulateIndex, simulateItem.key))
simulateItem = simulate[simulateIndex]
// if the remove didn't put the wanted item in place, we need to insert it
if (!simulateItem || simulateItem.key !== wantedItem.key) {
inserts.push({key: wantedItem.key, to: k})
}
// items are matching, so skip ahead
else {
simulateIndex++
}
}
else {
inserts.push({key: wantedItem.key, to: k})
}
}
else {
inserts.push({key: wantedItem.key, to: k})
}
k++
}
// a key in simulate has no matching wanted key, remove it
else if (simulateItem && simulateItem.key) {
removes.push(remove(simulate, simulateIndex, simulateItem.key))
}
}
else {
simulateIndex++
k++
}
}
// remove all the remaining nodes from simulate
while(simulateIndex < simulate.length) {
simulateItem = simulate[simulateIndex]
removes.push(remove(simulate, simulateIndex, simulateItem && simulateItem.key))
}
// If the only moves we have are deletes then we can just
// let the delete patch remove these items.
if (removes.length === deletedItems && !inserts.length) {
return {
children: newChildren,
moves: null
}
}
return {
children: newChildren,
moves: {
removes: removes,
inserts: inserts
}
}
}
function remove(arr, index, key) {
arr.splice(index, 1)
return {
from: index,
key: key
}
}
function keyIndex(children) {
var keys = {}
var free = []
var length = children.length
for (var i = 0; i < length; i++) {
var child = children[i]
if (child.key) {
keys[child.key] = i
} else {
free.push(i)
}
}
return {
keys: keys, // A hash of key name to index
free: free, // An array of unkeyed item indices
}
}
function appendPatch(apply, patch) {
if (apply) {
if (isArray(apply)) {
apply.push(patch)
} else {
apply = [apply, patch]
}
return apply
} else {
return patch
}
}
},{"../vnode/handle-thunk":94,"../vnode/is-thunk":95,"../vnode/is-vnode":97,"../vnode/is-vtext":98,"../vnode/is-widget":99,"../vnode/vpatch":102,"./diff-props":104,"x-is-array":81}],106:[function(require,module,exports){
'use strict';
var Rx = require('rx');
function makeDispatchFunction(element, eventName) {
return function dispatchCustomEvent(evData) {
//console.log('%cdispatchCustomEvent ' + eventName,
// 'background-color: #CCCCFF; color: black');
var event;
try {
event = new Event(eventName);
} catch (err) {
event = document.createEvent('Event');
event.initEvent(eventName, true, true);
}
event.data = evData;
element.dispatchEvent(event);
};
}
function subscribeDispatchers(element) {
var customEvents = element.cycleCustomElementMetadata.customEvents;
var disposables = new Rx.CompositeDisposable();
for (var _name in customEvents) {
if (customEvents.hasOwnProperty(_name)) {
if (/\$$/.test(_name) && _name !== 'vtree$' && typeof customEvents[_name].subscribe === 'function') {
var eventName = _name.slice(0, -1);
var disposable = customEvents[_name].subscribe(makeDispatchFunction(element, eventName));
disposables.add(disposable);
}
}
}
return disposables;
}
function subscribeDispatchersWhenRootChanges(metadata) {
return metadata.rootElem$.distinctUntilChanged(Rx.helpers.identity, function (x, y) {
return x && y && x.isEqualNode && x.isEqualNode(y);
}).subscribe(function resubscribeDispatchers(rootElem) {
if (metadata.eventDispatchingSubscription) {
metadata.eventDispatchingSubscription.dispose();
}
metadata.eventDispatchingSubscription = subscribeDispatchers(rootElem);
});
}
function makePropertiesProxy() {
var propertiesProxy = {};
Object.defineProperty(propertiesProxy, 'type', {
enumerable: false,
value: 'PropertiesProxy'
});
Object.defineProperty(propertiesProxy, 'get', {
enumerable: false,
value: function get(streamKey) {
var comparer = arguments[1] === undefined ? Rx.helpers.defaultComparer : arguments[1];
if (typeof this[streamKey] === 'undefined') {
this[streamKey] = new Rx.ReplaySubject(1);
}
return this[streamKey].distinctUntilChanged(Rx.helpers.identity, comparer);
}
});
return propertiesProxy;
}
function createContainerElement(tagName, vtreeProperties) {
var element = document.createElement('div');
element.id = vtreeProperties.id || '';
element.className = vtreeProperties.className || '';
element.className += ' cycleCustomElement-' + tagName.toUpperCase();
return element;
}
function warnIfVTreeHasNoKey(vtree) {
if (typeof vtree.key === 'undefined') {
console.warn('Missing `key` property for Cycle custom element ' + vtree.tagName);
}
}
function throwIfVTreeHasPropertyChildren(vtree) {
if (typeof vtree.properties.children !== 'undefined') {
throw new Error('Custom element should not have property `children`. ' + 'It is reserved for children elements nested into this custom element.');
}
}
function makeConstructor() {
return function customElementConstructor(vtree) {
//console.log('%cnew (constructor) custom element ' + vtree.tagName,
// 'color: #880088');
warnIfVTreeHasNoKey(vtree);
throwIfVTreeHasPropertyChildren(vtree);
this.type = 'Widget';
this.properties = vtree.properties;
this.properties.children = vtree.children;
this.key = vtree.key;
this.isCustomElementWidget = true;
this.rootElem$ = new Rx.ReplaySubject(1);
this.disposables = new Rx.CompositeDisposable();
};
}
function makeInit(tagName, definitionFn) {
var _require = require('./render-dom');
var applyToDOM = _require.applyToDOM;
return function initCustomElement() {
//console.log('%cInit() custom element ' + tagName, 'color: #880088');
var widget = this;
var element = createContainerElement(tagName, widget.properties);
var propertiesProxy = makePropertiesProxy();
var domUI = applyToDOM(element, definitionFn, {
observer: widget.rootElem$.asObserver(),
props: propertiesProxy
});
element.cycleCustomElementMetadata = {
propertiesProxy: propertiesProxy,
rootElem$: domUI.rootElem$,
customEvents: domUI.customEvents,
eventDispatchingSubscription: false
};
element.cycleCustomElementMetadata.eventDispatchingSubscription = subscribeDispatchers(element);
widget.disposables.add(element.cycleCustomElementMetadata.eventDispatchingSubscription);
widget.disposables.add(subscribeDispatchersWhenRootChanges(element.cycleCustomElementMetadata));
widget.disposables.add(domUI);
widget.disposables.add(widget.rootElem$);
widget.update(null, element);
return element;
};
}
function validatePropertiesProxyInMetadata(element, fnName) {
if (!element) {
throw new Error('Missing DOM element when calling ' + fnName + ' on custom ' + 'element Widget.');
}
if (!element.cycleCustomElementMetadata) {
throw new Error('Missing custom element metadata on DOM element when ' + 'calling ' + fnName + ' on custom element Widget.');
}
var metadata = element.cycleCustomElementMetadata;
if (metadata.propertiesProxy.type !== 'PropertiesProxy') {
throw new Error('Custom element metadata\'s propertiesProxy type is ' + 'invalid: ' + metadata.propertiesProxy.type + '.');
}
}
function makeUpdate() {
return function updateCustomElement(previous, element) {
if (previous) {
this.disposables = previous.disposables;
// This is a new rootElem$ which is not being used by init(),
// but used by render-dom for creating rootElemAfterChildren$.
this.rootElem$.onNext(null);
this.rootElem$.onCompleted();
}
validatePropertiesProxyInMetadata(element, 'update()');
//console.log(`%cupdate() custom el ${element.className}`,'color: #880088');
var proxiedProps = element.cycleCustomElementMetadata.propertiesProxy;
if (proxiedProps.hasOwnProperty('*')) {
proxiedProps['*'].onNext(this.properties);
}
for (var prop in proxiedProps) {
if (proxiedProps.hasOwnProperty(prop)) {
if (this.properties.hasOwnProperty(prop)) {
proxiedProps[prop].onNext(this.properties[prop]);
}
}
}
};
}
function makeDestroy() {
return function destroyCustomElement(element) {
//console.log(`%cdestroy() custom el ${element.className}`, 'color: #808');
// Dispose propertiesProxy
var proxiedProps = element.cycleCustomElementMetadata.propertiesProxy;
for (var prop in proxiedProps) {
if (proxiedProps.hasOwnProperty(prop)) {
this.disposables.add(proxiedProps[prop]);
}
}
if (element.cycleCustomElementMetadata.eventDispatchingSubscription) {
// This subscription has to be disposed.
// Because disposing subscribeDispatchersWhenRootChanges only
// is not enough.
this.disposables.add(element.cycleCustomElementMetadata.eventDispatchingSubscription);
}
this.disposables.dispose();
};
}
module.exports = {
makeDispatchFunction: makeDispatchFunction,
subscribeDispatchers: subscribeDispatchers,
subscribeDispatchersWhenRootChanges: subscribeDispatchersWhenRootChanges,
makePropertiesProxy: makePropertiesProxy,
createContainerElement: createContainerElement,
warnIfVTreeHasNoKey: warnIfVTreeHasNoKey,
throwIfVTreeHasPropertyChildren: throwIfVTreeHasPropertyChildren,
makeConstructor: makeConstructor,
makeInit: makeInit,
makeUpdate: makeUpdate,
makeDestroy: makeDestroy
};
},{"./render-dom":108,"rx":58}],107:[function(require,module,exports){
'use strict';
var CustomElementWidget = require('./custom-element-widget');
var Map = Map || require('es6-map'); // eslint-disable-line no-native-reassign
var CustomElementsRegistry = new Map();
function replaceCustomElementsWithSomething(vtree, toSomethingFn) {
// Silently ignore corner cases
if (!vtree || vtree.type === 'VirtualText') {
return vtree;
}
var tagName = (vtree.tagName || '').toUpperCase();
// Replace vtree itself
if (tagName && CustomElementsRegistry.has(tagName)) {
var WidgetClass = CustomElementsRegistry.get(tagName);
return toSomethingFn(vtree, WidgetClass);
}
// Or replace children recursively
if (Array.isArray(vtree.children)) {
for (var i = vtree.children.length - 1; i >= 0; i--) {
vtree.children[i] = replaceCustomElementsWithSomething(vtree.children[i], toSomethingFn);
}
}
return vtree;
}
function registerCustomElement(givenTagName, definitionFn) {
if (typeof givenTagName !== 'string' || typeof definitionFn !== 'function') {
throw new Error('registerCustomElement requires parameters `tagName` and ' + '`definitionFn`.');
}
var tagName = givenTagName.toUpperCase();
if (CustomElementsRegistry.has(tagName)) {
throw new Error('Cannot register custom element `' + tagName + '` ' + 'for the DOMUser because that tagName is already registered.');
}
var WidgetClass = CustomElementWidget.makeConstructor();
WidgetClass.definitionFn = definitionFn;
WidgetClass.prototype.init = CustomElementWidget.makeInit(tagName, definitionFn);
WidgetClass.prototype.update = CustomElementWidget.makeUpdate();
WidgetClass.prototype.destroy = CustomElementWidget.makeDestroy();
CustomElementsRegistry.set(tagName, WidgetClass);
}
function unregisterAllCustomElements() {
CustomElementsRegistry.clear();
}
module.exports = {
replaceCustomElementsWithSomething: replaceCustomElementsWithSomething,
registerCustomElement: registerCustomElement,
unregisterAllCustomElements: unregisterAllCustomElements
};
},{"./custom-element-widget":106,"es6-map":3}],108:[function(require,module,exports){
/* jshint maxparams: 4 */
'use strict';
function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }
var Rx = require('rx');
var VDOM = {
h: require('virtual-dom').h,
diff: require('virtual-dom/diff'),
patch: require('virtual-dom/patch')
};
var _require = require('./custom-elements');
var replaceCustomElementsWithSomething = _require.replaceCustomElementsWithSomething;
function isElement(obj) {
return typeof HTMLElement === 'object' ? obj instanceof HTMLElement || obj instanceof DocumentFragment : //DOM2
obj && typeof obj === 'object' && obj !== null && (obj.nodeType === 1 || obj.nodeType === 11) && typeof obj.nodeName === 'string';
}
function fixRootElem$(rawRootElem$, domContainer) {
// Create rootElem stream and automatic className correction
var originalClasses = (domContainer.className || '').trim().split(/\s+/);
//console.log('%coriginalClasses: ' + originalClasses, 'color: lightgray');
return rawRootElem$.map(function fixRootElemClassName(rootElem) {
var previousClasses = rootElem.className.trim().split(/\s+/);
var missingClasses = originalClasses.filter(function (clss) {
return previousClasses.indexOf(clss) < 0;
});
//console.log('%cfixRootElemClassName(), missingClasses: ' +
// missingClasses, 'color: lightgray');
rootElem.className = previousClasses.concat(missingClasses).join(' ');
//console.log('%c result: ' + rootElem.className, 'color: lightgray');
//console.log('%cEmit rootElem$ ' + rootElem.tagName + '.' +
// rootElem.className, 'color: #009988');
return rootElem;
}).replay(null, 1);
}
function isVTreeCustomElement(vtree) {
return vtree.type === 'Widget' && vtree.isCustomElementWidget;
}
function replaceCustomElementsWithWidgets(vtree) {
return replaceCustomElementsWithSomething(vtree, function (_vtree, WidgetClass) {
return new WidgetClass(_vtree);
});
}
function getArrayOfAllWidgetRootElemStreams(vtree) {
if (vtree.type === 'Widget' && vtree.rootElem$) {
return [vtree.rootElem$];
}
// Or replace children recursively
var array = [];
if (Array.isArray(vtree.children)) {
for (var i = vtree.children.length - 1; i >= 0; i--) {
array = array.concat(getArrayOfAllWidgetRootElemStreams(vtree.children[i]));
}
}
return array;
}
function checkRootVTreeNotCustomElement(vtree) {
if (isVTreeCustomElement(vtree)) {
throw new Error('Illegal to use a Cycle custom element as the root of ' + 'a View.');
}
}
function makeDiffAndPatchToElement$(rootElem) {
return function diffAndPatchToElement$(_ref) {
var _ref2 = _slicedToArray(_ref, 2);
var oldVTree = _ref2[0];
var newVTree = _ref2[1];
if (typeof newVTree === 'undefined') {
return Rx.Observable.empty();
}
var arrayOfAll = getArrayOfAllWidgetRootElemStreams(newVTree);
var rootElemAfterChildren$ = Rx.Observable.combineLatest(arrayOfAll, function () {
//console.log('%cEmit rawRootElem$ (1) ', 'color: #008800');
return rootElem;
});
var cycleCustomElementMetadata = rootElem.cycleCustomElementMetadata;
//let isCustomElement = !!rootElem.cycleCustomElementMetadata;
//let k = isCustomElement ? ' is custom element ' : ' is top level';
//console.log('%cVDOM diff and patch START' + k, 'color: #636300');
/* eslint-disable */
rootElem = VDOM.patch(rootElem, VDOM.diff(oldVTree, newVTree));
/* eslint-enable */
//console.log('%cVDOM diff and patch END' + k, 'color: #636300');
if (cycleCustomElementMetadata) {
rootElem.cycleCustomElementMetadata = cycleCustomElementMetadata;
}
if (arrayOfAll.length === 0) {
//console.log('%cEmit rawRootElem$ (2)', 'color: #008800');
return Rx.Observable.just(rootElem);
} else {
return rootElemAfterChildren$;
}
};
}
function getRenderRootElem(domContainer) {
var rootElem = undefined;
if (/cycleCustomElement-[^\b]+/.exec(domContainer.className) !== null) {
rootElem = domContainer;
} else {
rootElem = document.createElement('div');
domContainer.innerHTML = '';
domContainer.appendChild(rootElem);
}
return rootElem;
}
function renderRawRootElem$(vtree$, domContainer) {
var rootElem = getRenderRootElem(domContainer);
var diffAndPatchToElement$ = makeDiffAndPatchToElement$(rootElem);
return vtree$.startWith(VDOM.h()).map(replaceCustomElementsWithWidgets).doOnNext(checkRootVTreeNotCustomElement).pairwise().flatMap(diffAndPatchToElement$).startWith(rootElem);
}
function makeInteractions(rootElem$) {
return {
get: function get(selector, eventName) {
if (typeof selector !== 'string') {
throw new Error('interactions.get() expects first argument to be a ' + 'string as a CSS selector');
}
if (typeof eventName !== 'string') {
throw new Error('interactions.get() expects second argument to be a ' + 'string representing the event type to listen for.');
}
//console.log(`%cget("${selector}", "${eventName}")`, 'color: #0000BB');
return rootElem$.flatMapLatest(function rootElemToEvent$(rootElem) {
if (!rootElem) {
return Rx.Observable.empty();
}
//let isCustomElement = !!rootElem.cycleCustomElementMetadata;
//console.log(`%cget('${selector}', '${eventName}') flatMapper` +
// (isCustomElement ? ' for a custom element' : ' for top-level View'),
// 'color: #0000BB');
var klass = selector.replace('.', '');
if (rootElem.className.search(new RegExp('\\b' + klass + '\\b')) >= 0) {
//console.log('%c Good return. (A)', 'color:#0000BB');
return Rx.Observable.fromEvent(rootElem, eventName);
}
var targetElements = rootElem.querySelectorAll(selector);
if (targetElements && targetElements.length > 0) {
//console.log('%c Good return. (B)', 'color:#0000BB');
return Rx.Observable.fromEvent(targetElements, eventName);
} else {
//console.log('%c returning empty!', 'color: #0000BB');
return Rx.Observable.empty();
}
});
}
};
}
function digestDefinitionFnOutput(output) {
var vtree$ = undefined;
var customEvents = {};
if (typeof output.subscribe === 'function') {
vtree$ = output;
} else if (output.hasOwnProperty('vtree$') && typeof output.vtree$.subscribe === 'function') {
vtree$ = output.vtree$;
customEvents = output;
} else {
throw new Error('definitionFn given to applyToDOM must return an ' + 'Observable of virtual DOM elements, or an object containing such ' + 'Observable named as `vtree$`');
}
return { vtree$: vtree$, customEvents: customEvents };
}
function applyToDOM(container, definitionFn) {
var _ref3 = arguments[2] === undefined ? {} : arguments[2];
var _ref3$observer = _ref3.observer;
var observer = _ref3$observer === undefined ? null : _ref3$observer;
var _ref3$props = _ref3.props;
var props = _ref3$props === undefined ? null : _ref3$props;
// Find and prepare the container
var domContainer = typeof container === 'string' ? document.querySelector(container) : container;
// Check pre-conditions
if (typeof container === 'string' && domContainer === null) {
throw new Error('Cannot render into unknown element \'' + container + '\'');
} else if (!isElement(domContainer)) {
throw new Error('Given container is not a DOM element neither a selector ' + 'string.');
}
var proxyVTree$$ = new Rx.AsyncSubject();
var rawRootElem$ = renderRawRootElem$(proxyVTree$$.mergeAll(), domContainer);
var rootElem$ = fixRootElem$(rawRootElem$, domContainer);
var interactions = makeInteractions(rootElem$);
var output = definitionFn(interactions, props);
var _digestDefinitionFnOutput = digestDefinitionFnOutput(output);
var vtree$ = _digestDefinitionFnOutput.vtree$;
var customEvents = _digestDefinitionFnOutput.customEvents;
var connection = rootElem$.connect();
var subscription = observer ? rootElem$.subscribe(observer) : rootElem$.subscribe();
proxyVTree$$.onNext(vtree$.shareReplay(1));
proxyVTree$$.onCompleted();
return {
dispose: function dispose() {
subscription.dispose();
connection.dispose();
proxyVTree$$.dispose();
},
rootElem$: rootElem$,
interactions: interactions,
customEvents: customEvents
};
}
module.exports = {
isElement: isElement,
fixRootElem$: fixRootElem$,
isVTreeCustomElement: isVTreeCustomElement,
replaceCustomElementsWithWidgets: replaceCustomElementsWithWidgets,
getArrayOfAllWidgetRootElemStreams: getArrayOfAllWidgetRootElemStreams,
checkRootVTreeNotCustomElement: checkRootVTreeNotCustomElement,
makeDiffAndPatchToElement$: makeDiffAndPatchToElement$,
getRenderRootElem: getRenderRootElem,
renderRawRootElem$: renderRawRootElem$,
makeInteractions: makeInteractions,
digestDefinitionFnOutput: digestDefinitionFnOutput,
applyToDOM: applyToDOM
};
},{"./custom-elements":107,"rx":58,"virtual-dom":74,"virtual-dom/diff":72,"virtual-dom/patch":82}],109:[function(require,module,exports){
'use strict';
var Rx = require('rx');
var toHTML = require('vdom-to-html');
var _require = require('./custom-elements');
var replaceCustomElementsWithSomething = _require.replaceCustomElementsWithSomething;
function makePropertiesProxyFromVTree(vtree) {
return {
get: function get(propertyName) {
return Rx.Observable.just(vtree.properties[propertyName]);
}
};
}
/**
* Converts a tree of VirtualNode|Observable<VirtualNode> into
* Observable<VirtualNode>.
*/
function transposeVTree(vtree) {
if (typeof vtree.subscribe === 'function') {
return vtree;
} else if (vtree.type === 'VirtualText') {
return Rx.Observable.just(vtree);
} else if (vtree.type === 'VirtualNode' && Array.isArray(vtree.children) && vtree.children.length > 0) {
return Rx.Observable.combineLatest(vtree.children.map(transposeVTree), function () {
for (var _len = arguments.length, arr = Array(_len), _key = 0; _key < _len; _key++) {
arr[_key] = arguments[_key];
}
vtree.children = arr;
return vtree;
});
} else if (vtree.type === 'VirtualNode') {
return Rx.Observable.just(vtree);
} else {
throw new Error('Unhandled case in transposeVTree()');
}
}
function makeEmptyInteractions() {
return {
get: function get() {
return Rx.Observable.empty();
}
};
}
function replaceCustomElementsWithVTree$(vtree) {
return replaceCustomElementsWithSomething(vtree, function toVTree$(_vtree, WidgetClass) {
var interactions = makeEmptyInteractions();
var props = makePropertiesProxyFromVTree(_vtree);
var output = WidgetClass.definitionFn(interactions, props);
/*eslint-disable no-use-before-define */
return convertCustomElementsToVTree(output.vtree$.last());
/*eslint-enable no-use-before-define */
});
}
function convertCustomElementsToVTree(vtree$) {
return vtree$.map(replaceCustomElementsWithVTree$).flatMap(transposeVTree);
}
function renderAsHTML(input) {
var vtree$ = undefined;
var computerFn = undefined;
if (typeof input === 'function') {
computerFn = input;
vtree$ = computerFn(makeEmptyInteractions());
} else if (typeof input.subscribe === 'function') {
vtree$ = input;
}
return convertCustomElementsToVTree(vtree$.last()).map(function (vtree) {
return toHTML(vtree);
});
}
module.exports = {
makePropertiesProxyFromVTree: makePropertiesProxyFromVTree,
replaceCustomElementsWithVTree$: replaceCustomElementsWithVTree$,
convertCustomElementsToVTree: convertCustomElementsToVTree,
renderAsHTML: renderAsHTML
};
},{"./custom-elements":107,"rx":58,"vdom-to-html":60}],110:[function(require,module,exports){
'use strict';
var VirtualDOM = require('virtual-dom');
var Rx = require('rx');
var CustomElements = require('./custom-elements');
var RenderingDOM = require('./render-dom');
var RenderingHTML = require('./render-html');
var Cycle = {
/**
* Takes a `computer` function which outputs an Observable of virtual DOM
* elements, and renders that into the DOM element indicated by `container`,
* which can be either a CSS selector or an actual element. At the same time,
* provides the `interactions` input to the `computer` function, which is a
* collection of all possible events happening on all elements which were
* rendered. You must query this collection with
* `interactions.get(selector, eventName)` in order to get an Observable of
* interactions of type `eventName` happening on the element identified by
* `selector`.
* Example: `interactions.get('.mybutton', 'click').map(ev => ...)`
*
* @param {(String|HTMLElement)} container the DOM selector for the element
* (or the element itself) to contain the rendering of the VTrees.
* @param {Function} computer a function that takes `interactions` as input
* and outputs an Observable of virtual DOM elements.
* @return {Object} an object containing properties `rootElem$`,
* `interactions`, `dispose()` that can be used for debugging or testing.
* @function applyToDOM
*/
applyToDOM: RenderingDOM.applyToDOM,
/**
* Converts a given Observable of virtual DOM elements (`vtree$`) into an
* Observable of corresponding HTML strings (`html$`). The provided `vtree$`
* must complete (must call onCompleted on its observers) in finite time,
* otherwise the output `html$` will never emit an HTML string.
*
* @param {Rx.Observable} vtree$ Observable of virtual DOM elements.
* @return {Rx.Observable} an Observable emitting a string as the HTML
* renderization of the virtual DOM element.
* @function renderAsHTML
*/
renderAsHTML: RenderingHTML.renderAsHTML,
/**
* Informs Cycle to recognize the given `tagName` as a custom element
* implemented as the given function whenever `tagName` is used in VTrees
* rendered in the context of some parent (in `applyToDOM` or in other custom
* elements).
* The given `definitionFn` function takes two parameters as input, in this
* order: `interactions` and `properties`. The former works just like it does
* in the `computer` function given to `applyToDOM`, and the later contains
* Observables representing properties of the custom element, given from the
* parent context. `properties.get('foo')` will return the Observable `foo$`.
*
* The `definitionFn` must output an object containing the property `vtree$`
* as an Observable. If the output object contains other Observables, then
* they are treated as custom events of the custom element.
*
* @param {String} tagName a name for identifying the custom element.
* @param {Function} definitionFn the implementation for the custom element.
* This function takes two arguments: `interactions`, and `properties`, and
* should output an object of Observables.
* @function registerCustomElement
*/
registerCustomElement: CustomElements.registerCustomElement,
/**
* A shortcut to the root object of
* [RxJS](https://github.com/Reactive-Extensions/RxJS).
* @name Rx
*/
Rx: Rx,
/**
* A shortcut to [virtual-hyperscript](
* https://github.com/Matt-Esch/virtual-dom/tree/master/virtual-hyperscript).
* This is a helper for creating VTrees in Views.
* @name h
*/
h: VirtualDOM.h
};
module.exports = Cycle;
},{"./custom-elements":107,"./render-dom":108,"./render-html":109,"rx":58,"virtual-dom":74}]},{},[110])(110)
}); |
ajax/libs/forerunnerdb/1.3.475/fdb-core+views.min.js | nolsherry/cdnjs | !function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){var d=a("./core");a("../lib/View");"undefined"!=typeof window&&(window.ForerunnerDB=d),b.exports=d},{"../lib/View":31,"./core":2}],2:[function(a,b,c){var d=a("../lib/Core");a("../lib/Shim.IE8");"undefined"!=typeof window&&(window.ForerunnerDB=d),b.exports=d},{"../lib/Core":7,"../lib/Shim.IE8":30}],3:[function(a,b,c){"use strict";var d=a("./Shared"),e=function(a){var b;this._primaryKey="_id",this._keyArr=[],this._data=[],this._objLookup={},this._count=0;for(b in a)a.hasOwnProperty(b)&&this._keyArr.push({key:b,dir:a[b]})};d.addModule("ActiveBucket",e),d.mixin(e.prototype,"Mixin.Sorting"),d.synthesize(e.prototype,"primaryKey"),e.prototype.qs=function(a,b,c,d){if(!b.length)return 0;for(var e,f,g,h=-1,i=0,j=b.length-1;j>=i&&(e=Math.floor((i+j)/2),h!==e);)f=b[e],void 0!==f&&(g=d(this,a,c,f),g>0&&(i=e+1),0>g&&(j=e-1)),h=e;return g>0?e+1:e},e.prototype._sortFunc=function(a,b,c,d){var e,f,g,h=c.split(".:."),i=d.split(".:."),j=a._keyArr,k=j.length;for(e=0;k>e;e++)if(f=j[e],g=typeof b[f.key],"number"===g&&(h[e]=Number(h[e]),i[e]=Number(i[e])),h[e]!==i[e]){if(1===f.dir)return a.sortAsc(h[e],i[e]);if(-1===f.dir)return a.sortDesc(h[e],i[e])}},e.prototype.insert=function(a){var b,c;return b=this.documentKey(a),c=this._data.indexOf(b),-1===c?(c=this.qs(a,this._data,b,this._sortFunc),this._data.splice(c,0,b)):this._data.splice(c,0,b),this._objLookup[a[this._primaryKey]]=b,this._count++,c},e.prototype.remove=function(a){var b,c;return b=this._objLookup[a[this._primaryKey]],b?(c=this._data.indexOf(b),c>-1?(this._data.splice(c,1),delete this._objLookup[a[this._primaryKey]],this._count--,!0):!1):!1},e.prototype.index=function(a){var b,c;return b=this.documentKey(a),c=this._data.indexOf(b),-1===c&&(c=this.qs(a,this._data,b,this._sortFunc)),c},e.prototype.documentKey=function(a){var b,c,d="",e=this._keyArr,f=e.length;for(b=0;f>b;b++)c=e[b],d&&(d+=".:."),d+=a[c.key];return d+=".:."+a[this._primaryKey]},e.prototype.count=function(){return this._count},d.finishModule("ActiveBucket"),b.exports=e},{"./Shared":29}],4:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Path"),f=function(a,b,c){this.init.apply(this,arguments)};f.prototype.init=function(a,b,c,d){this._store=[],this._keys=[],void 0!==b&&this.index(b),void 0!==c&&this.compareFunc(c),void 0!==d&&this.hashFunc(d),void 0!==a&&this.data(a)},d.addModule("BinaryTree",f),d.mixin(f.prototype,"Mixin.ChainReactor"),d.mixin(f.prototype,"Mixin.Sorting"),d.mixin(f.prototype,"Mixin.Common"),d.synthesize(f.prototype,"compareFunc"),d.synthesize(f.prototype,"hashFunc"),d.synthesize(f.prototype,"indexDir"),d.synthesize(f.prototype,"keys"),d.synthesize(f.prototype,"index",function(a){return void 0!==a&&this.keys(this.extractKeys(a)),this.$super.call(this,a)}),f.prototype.extractKeys=function(a){var b,c=[];for(b in a)a.hasOwnProperty(b)&&c.push({key:b,val:a[b]});return c},f.prototype.data=function(a){return void 0!==a?(this._data=a,this._hashFunc&&(this._hash=this._hashFunc(a)),this):this._data},f.prototype.push=function(a){return void 0!==a?(this._store.push(a),this):!1},f.prototype.pull=function(a){if(void 0!==a){var b=this._store.indexOf(a);if(b>-1)return this._store.splice(b,1),this}return!1},f.prototype._compareFunc=function(a,b){var c,d,e=0;for(c=0;c<this._keys.length;c++)if(d=this._keys[c],1===d.val?e=this.sortAsc(a[d.key],b[d.key]):-1===d.val&&(e=this.sortDesc(a[d.key],b[d.key])),0!==e)return e;return e},f.prototype._hashFunc=function(a){return a[this._keys[0].key]},f.prototype.insert=function(a){var b,c,d,e;if(a instanceof Array){for(c=[],d=[],e=0;e<a.length;e++)this.insert(a[e])?c.push(a[e]):d.push(a[e]);return{inserted:c,failed:d}}return this._data?(b=this._compareFunc(this._data,a),0===b?(this.push(a),this._left?this._left.insert(a):this._left=new f(a,this._index,this._compareFunc,this._hashFunc),!0):-1===b?(this._right?this._right.insert(a):this._right=new f(a,this._index,this._compareFunc,this._hashFunc),!0):1===b?(this._left?this._left.insert(a):this._left=new f(a,this._index,this._compareFunc,this._hashFunc),!0):!1):(this.data(a),!0)},f.prototype.lookup=function(a,b){var c=this._compareFunc(this._data,a);return b=b||[],0===c&&(this._left&&this._left.lookup(a,b),b.push(this._data),this._right&&this._right.lookup(a,b)),-1===c&&this._right&&this._right.lookup(a,b),1===c&&this._left&&this._left.lookup(a,b),b},f.prototype.inOrder=function(a,b){switch(b=b||[],this._left&&this._left.inOrder(a,b),a){case"hash":b.push(this._hash);break;case"data":b.push(this._data);break;default:b.push({key:this._data,arr:this._store})}return this._right&&this._right.inOrder(a,b),b},f.prototype.findRange=function(a,b,c,d,f,g){f=f||[],g=g||new e(b),this._left&&this._left.findRange(a,b,c,d,f,g);var h=g.value(this._data),i=this.sortAsc(h,c),j=this.sortAsc(h,d);if(!(0!==i&&1!==i||0!==j&&-1!==j))switch(a){case"hash":f.push(this._hash);break;case"data":f.push(this._data);break;default:f.push({key:this._data,arr:this._store})}return this._right&&this._right.findRange(a,b,c,d,f,g),f},f.prototype.match=function(a,b){var c,d,f,g=new e,h=[],i=0;for(c=g.parseArr(this._index,{verbose:!0}),d=g.parseArr(a,{ignore:/\$/,verbose:!0}),f=0;f<c.length;f++)d[f]===c[f]&&(i++,h.push(d[f]));return{matchedKeys:h,totalKeyCount:d.length,score:i}},d.finishModule("BinaryTree"),b.exports=f},{"./Path":26,"./Shared":29}],5:[function(a,b,c){"use strict";var d,e,f,g,h,i,j,k,l,m;d=a("./Shared");var n=function(a){this.init.apply(this,arguments)};n.prototype.init=function(a,b){this._primaryKey="_id",this._primaryIndex=new g("primary"),this._primaryCrc=new g("primaryCrc"),this._crcLookup=new g("crcLookup"),this._name=a,this._data=[],this._metrics=new f,this._options=b||{changeTimestamp:!1},this._metaData={},this._deferQueue={insert:[],update:[],remove:[],upsert:[]},this._deferThreshold={insert:100,update:100,remove:100,upsert:100},this._deferTime={insert:1,update:1,remove:1,upsert:1},this._deferredCalls=!0,this.subsetOf(this)},d.addModule("Collection",n),d.mixin(n.prototype,"Mixin.Common"),d.mixin(n.prototype,"Mixin.Events"),d.mixin(n.prototype,"Mixin.ChainReactor"),d.mixin(n.prototype,"Mixin.CRUD"),d.mixin(n.prototype,"Mixin.Constants"),d.mixin(n.prototype,"Mixin.Triggers"),d.mixin(n.prototype,"Mixin.Sorting"),d.mixin(n.prototype,"Mixin.Matching"),d.mixin(n.prototype,"Mixin.Updating"),d.mixin(n.prototype,"Mixin.Tags"),f=a("./Metrics"),g=a("./KeyValueStore"),h=a("./Path"),i=a("./IndexHashMap"),j=a("./IndexBinaryTree"),k=a("./Crc"),e=d.modules.Db,l=a("./Overload"),m=a("./ReactorIO"),n.prototype.crc=k,d.synthesize(n.prototype,"deferredCalls"),d.synthesize(n.prototype,"state"),d.synthesize(n.prototype,"name"),d.synthesize(n.prototype,"metaData"),d.synthesize(n.prototype,"capped"),d.synthesize(n.prototype,"cappedSize"),n.prototype.data=function(){return this._data},n.prototype.drop=function(a){var b;if(this.isDropped())return a&&a(!1,!0),!0;if(this._db&&this._db._collection&&this._name){if(this.debug()&&console.log(this.logIdentifier()+" Dropping"),this._state="dropped",this.emit("drop",this),delete this._db._collection[this._name],this._collate)for(b in this._collate)this._collate.hasOwnProperty(b)&&this.collateRemove(b);return delete this._primaryKey,delete this._primaryIndex,delete this._primaryCrc,delete this._crcLookup,delete this._name,delete this._data,delete this._metrics,a&&a(!1,!0),!0}return a&&a(!1,!0),!1},n.prototype.primaryKey=function(a){if(void 0!==a){if(this._primaryKey!==a){var b=this._primaryKey;this._primaryKey=a,this._primaryIndex.primaryKey(a),this.rebuildPrimaryKeyIndex(),this.chainSend("primaryKey",a,{oldData:b})}return this}return this._primaryKey},n.prototype._onInsert=function(a,b){this.emit("insert",a,b)},n.prototype._onUpdate=function(a){this.emit("update",a)},n.prototype._onRemove=function(a){this.emit("remove",a)},n.prototype._onChange=function(){this._options.changeTimestamp&&(this._metaData.lastChange=new Date)},d.synthesize(n.prototype,"db",function(a){return a&&"_id"===this.primaryKey()&&(this.primaryKey(a.primaryKey()),this.debug(a.debug())),this.$super.apply(this,arguments)}),d.synthesize(n.prototype,"mongoEmulation"),n.prototype.setData=function(a,b,c){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";if(a){var d=this._metrics.create("setData");d.start(),b=this.options(b),this.preSetData(a,b,c),b.$decouple&&(a=this.decouple(a)),a instanceof Array||(a=[a]),d.time("transformIn"),a=this.transformIn(a),d.time("transformIn");var e=[].concat(this._data);this._dataReplace(a),d.time("Rebuild Primary Key Index"),this.rebuildPrimaryKeyIndex(b),d.time("Rebuild Primary Key Index"),d.time("Rebuild All Other Indexes"),this._rebuildIndexes(),d.time("Rebuild All Other Indexes"),d.time("Resolve chains"),this.chainSend("setData",a,{oldData:e}),d.time("Resolve chains"),d.stop(),this._onChange(),this.emit("setData",this._data,e)}return c&&c(!1),this},n.prototype.rebuildPrimaryKeyIndex=function(a){a=a||{$ensureKeys:void 0,$violationCheck:void 0};var b,c,d,e,f=a&&void 0!==a.$ensureKeys?a.$ensureKeys:!0,g=a&&void 0!==a.$violationCheck?a.$violationCheck:!0,h=this._primaryIndex,i=this._primaryCrc,j=this._crcLookup,k=this._primaryKey;for(h.truncate(),i.truncate(),j.truncate(),b=this._data,c=b.length;c--;){if(d=b[c],f&&this.ensurePrimaryKey(d),g){if(!h.uniqueSet(d[k],d))throw this.logIdentifier()+" Call to setData on collection failed because your data violates the primary key unique constraint. One or more documents are using the same primary key: "+d[this._primaryKey]}else h.set(d[k],d);e=this.jStringify(d),i.set(d[k],e),j.set(e,d)}},n.prototype.ensurePrimaryKey=function(a){void 0===a[this._primaryKey]&&(a[this._primaryKey]=this.objectId())},n.prototype.truncate=function(){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";return this.emit("truncate",this._data),this._data.length=0,this._primaryIndex=new g("primary"),this._primaryCrc=new g("primaryCrc"),this._crcLookup=new g("crcLookup"),this._onChange(),this.deferEmit("change",{type:"truncate"}),this},n.prototype.upsert=function(a,b){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";if(a){var c,d,e=this._deferQueue.upsert,f=this._deferThreshold.upsert,g={};if(a instanceof Array){if(this._deferredCalls&&a.length>f)return this._deferQueue.upsert=e.concat(a),this.processQueue("upsert",b),{};for(g=[],d=0;d<a.length;d++)g.push(this.upsert(a[d]));return b&&b(),g}switch(a[this._primaryKey]?(c={},c[this._primaryKey]=a[this._primaryKey],this._primaryIndex.lookup(c)[0]?g.op="update":g.op="insert"):g.op="insert",g.op){case"insert":g.result=this.insert(a);break;case"update":g.result=this.update(c,a)}return g}return b&&b(),{}},n.prototype.filter=function(a,b,c){return this.find(a,c).filter(b)},n.prototype.filterUpdate=function(a,b,c){var d,e,f,g,h=this.find(a,c),i=[],j=this.primaryKey();for(g=0;g<h.length;g++)d=h[g],f=b(d),f&&(e={},e[j]=d[j],i.push(this.update(e,f)));return i},n.prototype.update=function(a,b,c){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";b=this.decouple(b),this.mongoEmulation()&&(this.convertToFdb(a),this.convertToFdb(b)),b=this.transformIn(b),this.debug()&&console.log(this.logIdentifier()+" Updating some data");var d,e,f=this,g=this._metrics.create("update"),h=function(d){var e,h,i,j=f.decouple(d);return f.willTrigger(f.TYPE_UPDATE,f.PHASE_BEFORE)||f.willTrigger(f.TYPE_UPDATE,f.PHASE_AFTER)?(e=f.decouple(d),h={type:"update",query:f.decouple(a),update:f.decouple(b),options:f.decouple(c),op:g},i=f.updateObject(e,h.update,h.query,h.options,""),f.processTrigger(h,f.TYPE_UPDATE,f.PHASE_BEFORE,d,e)!==!1?(i=f.updateObject(d,e,h.query,h.options,""),f.processTrigger(h,f.TYPE_UPDATE,f.PHASE_AFTER,j,e)):i=!1):i=f.updateObject(d,b,a,c,""),f._updateIndexes(j,d),i};return g.start(),g.time("Retrieve documents to update"),d=this.find(a,{$decouple:!1}),g.time("Retrieve documents to update"),d.length&&(g.time("Update documents"),e=d.filter(h),g.time("Update documents"),e.length&&(g.time("Resolve chains"),this.chainSend("update",{query:a,update:b,dataSet:e},c),g.time("Resolve chains"),this._onUpdate(e),this._onChange(),this.deferEmit("change",{type:"update",data:e}))),g.stop(),e||[]},n.prototype._replaceObj=function(a,b){var c;this._removeFromIndexes(a);for(c in a)a.hasOwnProperty(c)&&delete a[c];for(c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);if(!this._insertIntoIndexes(a))throw this.logIdentifier()+" Primary key violation in update! Key violated: "+a[this._primaryKey];return this},n.prototype.updateById=function(a,b){var c={};return c[this._primaryKey]=a,this.update(c,b)},n.prototype.updateObject=function(a,b,c,d,e,f){b=this.decouple(b),e=e||"","."===e.substr(0,1)&&(e=e.substr(1,e.length-1));var g,i,j,k,l,m,n,o,p,q=!1,r=!1;for(p in b)if(b.hasOwnProperty(p)){if(g=!1,"$"===p.substr(0,1))switch(p){case"$key":case"$index":case"$data":case"$min":case"$max":g=!0;break;case"$each":for(g=!0,k=b.$each.length,j=0;k>j;j++)r=this.updateObject(a,b.$each[j],c,d,e),r&&(q=!0);q=q||r;break;default:g=!0,r=this.updateObject(a,b[p],c,d,e,p),q=q||r}if(this._isPositionalKey(p)&&(g=!0,p=p.substr(0,p.length-2),m=new h(e+"."+p),a[p]&&a[p]instanceof Array&&a[p].length)){for(i=[],j=0;j<a[p].length;j++)this._match(a[p][j],m.value(c)[0],d,"",{})&&i.push(j);for(j=0;j<i.length;j++)r=this.updateObject(a[p][i[j]],b[p+".$"],c,d,e+"."+p,f),q=q||r}if(!g)if(f||"object"!=typeof b[p])switch(f){case"$inc":var s=!0;b[p]>0?b.$max&&a[p]>=b.$max&&(s=!1):b[p]<0&&b.$min&&a[p]<=b.$min&&(s=!1),s&&(this._updateIncrement(a,p,b[p]),q=!0);break;case"$cast":switch(b[p]){case"array":a[p]instanceof Array||(this._updateProperty(a,p,b.$data||[]),q=!0);break;case"object":(!(a[p]instanceof Object)||a[p]instanceof Array)&&(this._updateProperty(a,p,b.$data||{}),q=!0);break;case"number":"number"!=typeof a[p]&&(this._updateProperty(a,p,Number(a[p])),q=!0);break;case"string":"string"!=typeof a[p]&&(this._updateProperty(a,p,String(a[p])),q=!0);break;default:throw this.logIdentifier()+" Cannot update cast to unknown type: "+b[p]}break;case"$push":if(void 0===a[p]&&this._updateProperty(a,p,[]),!(a[p]instanceof Array))throw this.logIdentifier()+" Cannot push to a key that is not an array! ("+p+")";if(void 0!==b[p].$position&&b[p].$each instanceof Array)for(l=b[p].$position,k=b[p].$each.length,j=0;k>j;j++)this._updateSplicePush(a[p],l+j,b[p].$each[j]);else if(b[p].$each instanceof Array)for(k=b[p].$each.length,j=0;k>j;j++)this._updatePush(a[p],b[p].$each[j]);else this._updatePush(a[p],b[p]);q=!0;break;case"$pull":if(a[p]instanceof Array){for(i=[],j=0;j<a[p].length;j++)this._match(a[p][j],b[p],d,"",{})&&i.push(j);for(k=i.length;k--;)this._updatePull(a[p],i[k]),q=!0}break;case"$pullAll":if(a[p]instanceof Array){if(!(b[p]instanceof Array))throw this.logIdentifier()+" Cannot pullAll without being given an array of values to pull! ("+p+")";if(i=a[p],k=i.length,k>0)for(;k--;){for(l=0;l<b[p].length;l++)i[k]===b[p][l]&&(this._updatePull(a[p],k),k--,q=!0);if(0>k)break}}break;case"$addToSet":if(void 0===a[p]&&this._updateProperty(a,p,[]),!(a[p]instanceof Array))throw this.logIdentifier()+" Cannot addToSet on a key that is not an array! ("+p+")";var t,u,v,w,x=a[p],y=x.length,z=!0,A=d&&d.$addToSet;for(b[p].$key?(v=!1,w=new h(b[p].$key),u=w.value(b[p])[0],delete b[p].$key):A&&A.key?(v=!1,w=new h(A.key),u=w.value(b[p])[0]):(u=this.jStringify(b[p]),v=!0),t=0;y>t;t++)if(v){if(this.jStringify(x[t])===u){z=!1;break}}else if(u===w.value(x[t])[0]){z=!1;break}z&&(this._updatePush(a[p],b[p]),q=!0);break;case"$splicePush":if(void 0===a[p]&&this._updateProperty(a,p,[]),!(a[p]instanceof Array))throw this.logIdentifier()+" Cannot splicePush with a key that is not an array! ("+p+")";if(l=b.$index,void 0===l)throw this.logIdentifier()+" Cannot splicePush without a $index integer value!";delete b.$index,l>a[p].length&&(l=a[p].length),this._updateSplicePush(a[p],l,b[p]),q=!0;break;case"$move":if(!(a[p]instanceof Array))throw this.logIdentifier()+" Cannot move on a key that is not an array! ("+p+")";for(j=0;j<a[p].length;j++)if(this._match(a[p][j],b[p],d,"",{})){var B=b.$index;if(void 0===B)throw this.logIdentifier()+" Cannot move without a $index integer value!";delete b.$index,this._updateSpliceMove(a[p],j,B),q=!0;break}break;case"$mul":this._updateMultiply(a,p,b[p]),q=!0;break;case"$rename":this._updateRename(a,p,b[p]),q=!0;break;case"$overwrite":this._updateOverwrite(a,p,b[p]),q=!0;break;case"$unset":this._updateUnset(a,p),q=!0;break;case"$clear":this._updateClear(a,p),q=!0;break;case"$pop":if(!(a[p]instanceof Array))throw this.logIdentifier()+" Cannot pop from a key that is not an array! ("+p+")";this._updatePop(a[p],b[p])&&(q=!0);break;case"$toggle":this._updateProperty(a,p,!a[p]),q=!0;break;default:a[p]!==b[p]&&(this._updateProperty(a,p,b[p]),q=!0)}else if(null!==a[p]&&"object"==typeof a[p])if(n=a[p]instanceof Array,o=b[p]instanceof Array,n||o)if(!o&&n)for(j=0;j<a[p].length;j++)r=this.updateObject(a[p][j],b[p],c,d,e+"."+p,f),q=q||r;else a[p]!==b[p]&&(this._updateProperty(a,p,b[p]),q=!0);else r=this.updateObject(a[p],b[p],c,d,e+"."+p,f),q=q||r;else a[p]!==b[p]&&(this._updateProperty(a,p,b[p]),q=!0)}return q},n.prototype._isPositionalKey=function(a){return".$"===a.substr(a.length-2,2)},n.prototype.remove=function(a,b,c){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";var d,e,f,g,h,i,j,k,l=this;if("function"==typeof b&&(c=b,b={}),this.mongoEmulation()&&this.convertToFdb(a),a instanceof Array){for(g=[],f=0;f<a.length;f++)g.push(this.remove(a[f],{noEmit:!0}));return(!b||b&&!b.noEmit)&&this._onRemove(g),c&&c(!1,g),g}if(g=[],d=this.find(a,{$decouple:!1}),d.length){h=function(a){l._removeFromIndexes(a),e=l._data.indexOf(a),l._dataRemoveAtIndex(e),g.push(a)};for(var m=0;m<d.length;m++)j=d[m],l.willTrigger(l.TYPE_REMOVE,l.PHASE_BEFORE)||l.willTrigger(l.TYPE_REMOVE,l.PHASE_AFTER)?(i={type:"remove"},k=l.decouple(j),l.processTrigger(i,l.TYPE_REMOVE,l.PHASE_BEFORE,k,k)!==!1&&(h(j),l.processTrigger(i,l.TYPE_REMOVE,l.PHASE_AFTER,k,k))):h(j);g.length&&(l.chainSend("remove",{query:a,dataSet:g},b),(!b||b&&!b.noEmit)&&this._onRemove(g),this._onChange(),this.deferEmit("change",{type:"remove",data:g}))}return c&&c(!1,g),g},n.prototype.removeById=function(a){var b={};return b[this._primaryKey]=a,this.remove(b)},n.prototype.processQueue=function(a,b,c){var d,e,f=this,g=this._deferQueue[a],h=this._deferThreshold[a],i=this._deferTime[a];if(c=c||{deferred:!0},g.length){if(g.length)switch(d=g.length>h?g.splice(0,h):g.splice(0,g.length),e=f[a](d),a){case"insert":c.inserted=c.inserted||[],c.failed=c.failed||[],c.inserted=c.inserted.concat(e.inserted),c.failed=c.failed.concat(e.failed)}setTimeout(function(){f.processQueue.call(f,a,b,c)},i)}else b&&b(c);this.isProcessingQueue()||this.emit("queuesComplete")},n.prototype.isProcessingQueue=function(){var a;for(a in this._deferQueue)if(this._deferQueue.hasOwnProperty(a)&&this._deferQueue[a].length)return!0;return!1},n.prototype.insert=function(a,b,c){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";return"function"==typeof b?(c=b,b=this._data.length):void 0===b&&(b=this._data.length),a=this.transformIn(a),this._insertHandle(a,b,c)},n.prototype._insertHandle=function(a,b,c){var d,e,f,g=this._deferQueue.insert,h=this._deferThreshold.insert,i=[],j=[];if(a instanceof Array){if(this._deferredCalls&&a.length>h)return this._deferQueue.insert=g.concat(a),void this.processQueue("insert",c);for(f=0;f<a.length;f++)d=this._insert(a[f],b+f),d===!0?i.push(a[f]):j.push({doc:a[f],reason:d})}else d=this._insert(a,b),d===!0?i.push(a):j.push({doc:a,reason:d});return e={deferred:!1,inserted:i,failed:j},this._onInsert(i,j),c&&c(e),this._onChange(),this.deferEmit("change",{type:"insert",data:i}),e},n.prototype._insert=function(a,b){if(a){var c,d,e,f,g=this,h=this.capped(),i=this.cappedSize();if(this.ensurePrimaryKey(a),c=this.insertIndexViolation(a),e=function(a){g._insertIntoIndexes(a),b>g._data.length&&(b=g._data.length),g._dataInsertAtIndex(b,a),h&&g._data.length>i&&g.removeById(g._data[0][g._primaryKey]),g.chainSend("insert",a,{index:b})},c)return"Index violation in index: "+c;if(g.willTrigger(g.TYPE_INSERT,g.PHASE_BEFORE)||g.willTrigger(g.TYPE_INSERT,g.PHASE_AFTER)){if(d={type:"insert"},g.processTrigger(d,g.TYPE_INSERT,g.PHASE_BEFORE,{},a)===!1)return"Trigger cancelled operation";e(a),g.willTrigger(g.TYPE_INSERT,g.PHASE_AFTER)&&(f=g.decouple(a),g.processTrigger(d,g.TYPE_INSERT,g.PHASE_AFTER,{},f))}else e(a);return!0}return"No document passed to insert"},n.prototype._dataInsertAtIndex=function(a,b){this._data.splice(a,0,b)},n.prototype._dataRemoveAtIndex=function(a){this._data.splice(a,1)},n.prototype._dataReplace=function(a){for(;this._data.length;)this._data.pop();this._data=this._data.concat(a)},n.prototype._insertIntoIndexes=function(a){var b,c,d=this._indexByName,e=this.jStringify(a);c=this._primaryIndex.uniqueSet(a[this._primaryKey],a),this._primaryCrc.uniqueSet(a[this._primaryKey],e),this._crcLookup.uniqueSet(e,a);for(b in d)d.hasOwnProperty(b)&&d[b].insert(a);return c},n.prototype._removeFromIndexes=function(a){var b,c=this._indexByName,d=this.jStringify(a);this._primaryIndex.unSet(a[this._primaryKey]),this._primaryCrc.unSet(a[this._primaryKey]),this._crcLookup.unSet(d);for(b in c)c.hasOwnProperty(b)&&c[b].remove(a)},n.prototype._updateIndexes=function(a,b){this._removeFromIndexes(a),this._insertIntoIndexes(b)},n.prototype._rebuildIndexes=function(){var a,b=this._indexByName;for(a in b)b.hasOwnProperty(a)&&b[a].rebuild()},n.prototype.subset=function(a,b){var c=this.find(a,b);return(new n).subsetOf(this).primaryKey(this._primaryKey).setData(c)},d.synthesize(n.prototype,"subsetOf"),n.prototype.isSubsetOf=function(a){return this._subsetOf===a},n.prototype.distinct=function(a,b,c){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";var d,e,f=this.find(b,c),g=new h(a),i={},j=[];for(e=0;e<f.length;e++)d=g.value(f[e])[0],d&&!i[d]&&(i[d]=!0,j.push(d));return j},n.prototype.findById=function(a,b){var c={};return c[this._primaryKey]=a,this.find(c,b)[0]},n.prototype.peek=function(a,b){var c,d,e=this._data,f=e.length,g=new n,h=typeof a;if("string"===h){for(c=0;f>c;c++)d=this.jStringify(e[c]),d.indexOf(a)>-1&&g.insert(e[c]);return g.find({},b)}return this.find(a,b)},n.prototype.explain=function(a,b){var c=this.find(a,b);return c.__fdbOp._data},n.prototype.options=function(a){return a=a||{},a.$decouple=void 0!==a.$decouple?a.$decouple:!0,a.$explain=void 0!==a.$explain?a.$explain:!1,a},n.prototype.find=function(a,b,c){return this.mongoEmulation()&&this.convertToFdb(a),c?(c("Callbacks for the find() operation are not yet implemented!",[]),[]):this._find.apply(this,arguments)},n.prototype._find=function(a,b){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";a=a||{},b=this.options(b);var c,d,e,f,g,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I=this._metrics.create("find"),J=this.primaryKey(),K=this,L=!0,M={},N=[],O=[],P=[],Q={},R={},S=function(c){return K._match(c,a,b,"and",Q)};if(I.start(),a){if(I.time("analyseQuery"),c=this._analyseQuery(K.decouple(a),b,I),I.time("analyseQuery"),I.data("analysis",c),c.hasJoin&&c.queriesJoin){for(I.time("joinReferences"),g=0;g<c.joinsOn.length;g++)k=c.joinsOn[g],j=new h(c.joinQueries[k]),i=j.value(a)[0],M[c.joinsOn[g]]=this._db.collection(c.joinsOn[g]).subset(i),delete a[c.joinQueries[k]];I.time("joinReferences")}if(c.indexMatch.length&&(!b||b&&!b.$skipIndex)?(I.data("index.potential",c.indexMatch),I.data("index.used",c.indexMatch[0].index),I.time("indexLookup"),e=c.indexMatch[0].lookup||[],I.time("indexLookup"),c.indexMatch[0].keyData.totalKeyCount===c.indexMatch[0].keyData.score&&(L=!1)):I.flag("usedIndex",!1),L&&(e&&e.length?(d=e.length,I.time("tableScan: "+d),e=e.filter(S)):(d=this._data.length,I.time("tableScan: "+d),e=this._data.filter(S)),I.time("tableScan: "+d)),b.$orderBy&&(I.time("sort"),e=this.sort(b.$orderBy,e),I.time("sort")),void 0!==b.$page&&void 0!==b.$limit&&(R.page=b.$page,R.pages=Math.ceil(e.length/b.$limit),R.records=e.length,b.$page&&b.$limit>0&&(I.data("cursor",R),e.splice(0,b.$page*b.$limit))),b.$skip&&(R.skip=b.$skip,e.splice(0,b.$skip),I.data("skip",b.$skip)),b.$limit&&e&&e.length>b.$limit&&(R.limit=b.$limit,e.length=b.$limit,I.data("limit",b.$limit)),b.$decouple&&(I.time("decouple"),e=this.decouple(e),I.time("decouple"),I.data("flag.decouple",!0)),b.$join){for(f=0;f<b.$join.length;f++)for(k in b.$join[f])if(b.$join[f].hasOwnProperty(k))for(w=k,l=M[k]?M[k]:this._db.collection(k),m=b.$join[f][k],x=0;x<e.length;x++){o={},q=!1,r=!1,v="";for(n in m)if(m.hasOwnProperty(n))if("$"===n.substr(0,1))switch(n){case"$where":m[n].query&&(o=K._resolveDynamicQuery(m[n].query,e[x])),m[n].options&&(p=m[n].options);break;case"$as":w=m[n];break;case"$multi":q=m[n];break;case"$require":r=m[n];break;case"$prefix":v=m[n]}else o[n]=K._resolveDynamicQuery(m[n],e[x]);if(s=l.find(o,p),!r||r&&s[0])if("$root"===w){if(q!==!1)throw this.logIdentifier()+' Cannot combine [$as: "$root"] with [$multi: true] in $join clause!';t=s[0],u=e[x];for(C in t)t.hasOwnProperty(C)&&void 0===u[v+C]&&(u[v+C]=t[C])}else e[x][w]=q===!1?s[0]:s;else N.push(e[x])}I.data("flag.join",!0)}if(N.length){for(I.time("removalQueue"),z=0;z<N.length;z++)y=e.indexOf(N[z]),y>-1&&e.splice(y,1);I.time("removalQueue")}if(b.$transform){for(I.time("transform"),z=0;z<e.length;z++)e.splice(z,1,b.$transform(e[z]));I.time("transform"),I.data("flag.transform",!0)}this._transformEnabled&&this._transformOut&&(I.time("transformOut"),e=this.transformOut(e),I.time("transformOut")),I.data("results",e.length)}else e=[];if(!b.$aggregate){I.time("scanFields");for(z in b)b.hasOwnProperty(z)&&0!==z.indexOf("$")&&(1===b[z]?O.push(z):0===b[z]&&P.push(z));if(I.time("scanFields"),O.length||P.length){for(I.data("flag.limitFields",!0),I.data("limitFields.on",O),I.data("limitFields.off",P),I.time("limitFields"),z=0;z<e.length;z++){G=e[z];for(A in G)G.hasOwnProperty(A)&&(O.length&&A!==J&&-1===O.indexOf(A)&&delete G[A],P.length&&P.indexOf(A)>-1&&delete G[A])}I.time("limitFields")}if(b.$elemMatch){I.data("flag.elemMatch",!0),I.time("projection-elemMatch");for(z in b.$elemMatch)if(b.$elemMatch.hasOwnProperty(z))for(D=new h(z),A=0;A<e.length;A++)if(E=D.value(e[A])[0],E&&E.length)for(B=0;B<E.length;B++)if(K._match(E[B],b.$elemMatch[z],b,"",{})){D.set(e[A],z,[E[B]]);break}I.time("projection-elemMatch")}if(b.$elemsMatch){I.data("flag.elemsMatch",!0),I.time("projection-elemsMatch");for(z in b.$elemsMatch)if(b.$elemsMatch.hasOwnProperty(z))for(D=new h(z),A=0;A<e.length;A++)if(E=D.value(e[A])[0],E&&E.length){for(F=[],B=0;B<E.length;B++)K._match(E[B],b.$elemsMatch[z],b,"",{})&&F.push(E[B]);D.set(e[A],z,F)}I.time("projection-elemsMatch")}}return b.$aggregate&&(I.data("flag.aggregate",!0),I.time("aggregate"),H=new h(b.$aggregate),e=H.value(e),I.time("aggregate")),I.stop(),e.__fdbOp=I,e.$cursor=R,e},n.prototype._resolveDynamicQuery=function(a,b){var c,d,e,f,g,i=this;if("string"==typeof a)return f="$$."===a.substr(0,3)?new h(a.substr(3,a.length-3)).value(b):new h(a).value(b),f.length>1?{$in:f}:f[0];c={};for(g in a)if(a.hasOwnProperty(g))switch(d=typeof a[g],e=a[g],d){case"string":"$$."===e.substr(0,3)?c[g]=new h(e.substr(3,e.length-3)).value(b)[0]:c[g]=e;break;case"object":c[g]=i._resolveDynamicQuery(e,b);break;default:c[g]=e}return c},n.prototype.findOne=function(){return this.find.apply(this,arguments)[0]},n.prototype.indexOf=function(a,b){var c,d=this.find(a,{$decouple:!1})[0];return d?!b||b&&!b.$orderBy?this._data.indexOf(d):(b.$decouple=!1,c=this.find(a,b),c.indexOf(d)):-1},n.prototype.indexOfDocById=function(a,b){var c,d;return c="object"!=typeof a?this._primaryIndex.get(a):this._primaryIndex.get(a[this._primaryKey]),c?!b||b&&!b.$orderBy?this._data.indexOf(c):(b.$decouple=!1,d=this.find({},b),d.indexOf(c)):-1},n.prototype.removeByIndex=function(a){var b,c;return b=this._data[a],void 0!==b?(b=this.decouple(b),c=b[this.primaryKey()],this.removeById(c)):!1},n.prototype.transform=function(a){return void 0!==a?("object"==typeof a?(void 0!==a.enabled&&(this._transformEnabled=a.enabled),void 0!==a.dataIn&&(this._transformIn=a.dataIn),void 0!==a.dataOut&&(this._transformOut=a.dataOut)):this._transformEnabled=a!==!1,this):{enabled:this._transformEnabled,dataIn:this._transformIn,dataOut:this._transformOut}},n.prototype.transformIn=function(a){if(this._transformEnabled&&this._transformIn){if(a instanceof Array){var b,c=[];for(b=0;b<a.length;b++)c[b]=this._transformIn(a[b]);return c}return this._transformIn(a)}return a},n.prototype.transformOut=function(a){if(this._transformEnabled&&this._transformOut){if(a instanceof Array){var b,c=[];for(b=0;b<a.length;b++)c[b]=this._transformOut(a[b]);return c}return this._transformOut(a)}return a},n.prototype.sort=function(a,b){b=b||[];var c,d,e=[];for(c in a)a.hasOwnProperty(c)&&(d={},d[c]=a[c],d.___fdbKey=String(c),e.push(d));return e.length<2?this._sort(a,b):this._bucketSort(e,b)},n.prototype._bucketSort=function(a,b){var c,d,e,f,g,h,i=a.shift(),j=[];if(a.length>0){for(b=this._sort(i,b),d=this.bucket(i.___fdbKey,b),e=d.order,g=d.buckets,h=0;h<e.length;h++)f=e[h],c=[].concat(a),j=j.concat(this._bucketSort(c,g[f]));return j}return this._sort(i,b)},n.prototype._sort=function(a,b){var c,d=this,e=new h,f=e.parse(a,!0)[0];if(e.path(f.path),1===f.value)c=function(a,b){var c=e.value(a)[0],f=e.value(b)[0];return d.sortAsc(c,f)};else{if(-1!==f.value)throw this.logIdentifier()+" $orderBy clause has invalid direction: "+f.value+", accepted values are 1 or -1 for ascending or descending!";c=function(a,b){var c=e.value(a)[0],f=e.value(b)[0];return d.sortDesc(c,f)}}return b.sort(c)},n.prototype.bucket=function(a,b){var c,d,e,f=[],g={};for(c=0;c<b.length;c++)e=String(b[c][a]),d!==e&&(f.push(e),d=e),g[e]=g[e]||[],g[e].push(b[c]);return{buckets:g,order:f}},n.prototype._analyseQuery=function(a,b,c){var d,e,f,g,i,j,k,l,m,n,o,p={queriesOn:[this._name],indexMatch:[],hasJoin:!1,queriesJoin:!1,joinQueries:{},query:a,options:b},q=[],r=[];if(c.time("checkIndexes"),m=new h,n=m.countKeys(a)){void 0!==a[this._primaryKey]&&(c.time("checkIndexMatch: Primary Key"),p.indexMatch.push({lookup:this._primaryIndex.lookup(a,b),keyData:{matchedKeys:[this._primaryKey],totalKeyCount:n,score:1},index:this._primaryIndex}),c.time("checkIndexMatch: Primary Key"));for(o in this._indexById)if(this._indexById.hasOwnProperty(o)&&(j=this._indexById[o],k=j.name(),c.time("checkIndexMatch: "+k),i=j.match(a,b),i.score>0&&(l=j.lookup(a,b),p.indexMatch.push({lookup:l,keyData:i,index:j})),c.time("checkIndexMatch: "+k),i.score===n))break;c.time("checkIndexes"),p.indexMatch.length>1&&(c.time("findOptimalIndex"),p.indexMatch.sort(function(a,b){return a.keyData.score>b.keyData.score?-1:a.keyData.score<b.keyData.score?1:a.keyData.score===b.keyData.score?a.lookup.length-b.lookup.length:void 0}),c.time("findOptimalIndex"))}if(b.$join){for(p.hasJoin=!0,d=0;d<b.$join.length;d++)for(e in b.$join[d])b.$join[d].hasOwnProperty(e)&&(q.push(e),"$as"in b.$join[d][e]?r.push(b.$join[d][e].$as):r.push(e));for(g=0;g<r.length;g++)f=this._queryReferencesCollection(a,r[g],""),f&&(p.joinQueries[q[g]]=f,p.queriesJoin=!0);p.joinsOn=q,p.queriesOn=p.queriesOn.concat(q)}return p},n.prototype._queryReferencesCollection=function(a,b,c){var d;for(d in a)if(a.hasOwnProperty(d)){if(d===b)return c&&(c+="."),c+d;if("object"==typeof a[d])return c&&(c+="."),c+=d,this._queryReferencesCollection(a[d],b,c)}return!1},n.prototype.count=function(a,b){return a?this.find(a,b).length:this._data.length},n.prototype.findSub=function(a,b,c,d){var e,f,g,i=new h(b),j=this.find(a),k=j.length,l=this._db.collection("__FDB_temp_"+this.objectId()),m={
parents:k,subDocTotal:0,subDocs:[],pathFound:!1,err:""};for(d=d||{},e=0;k>e;e++)if(f=i.value(j[e])[0]){if(l.setData(f),g=l.find(c,d),d.returnFirst&&g.length)return g[0];d.$split?m.subDocs.push(g):m.subDocs=m.subDocs.concat(g),m.subDocTotal+=g.length,m.pathFound=!0}return l.drop(),d.$stats?m:m.subDocs},n.prototype.findSubOne=function(a,b,c,d){return this.findSub(a,b,c,d)[0]},n.prototype.insertIndexViolation=function(a){var b,c,d,e=this._indexByName;if(this._primaryIndex.get(a[this._primaryKey]))b=this._primaryIndex;else for(c in e)if(e.hasOwnProperty(c)&&(d=e[c],d.unique()&&d.violation(a))){b=d;break}return b?b.name():!1},n.prototype.ensureIndex=function(a,b){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";this._indexByName=this._indexByName||{},this._indexById=this._indexById||{};var c,d={start:(new Date).getTime()};if(b)switch(b.type){case"hashed":c=new i(a,b,this);break;case"btree":c=new j(a,b,this);break;default:c=new i(a,b,this)}else c=new i(a,b,this);return this._indexByName[c.name()]?{err:"Index with that name already exists"}:this._indexById[c.id()]?{err:"Index with those keys already exists"}:(c.rebuild(),this._indexByName[c.name()]=c,this._indexById[c.id()]=c,d.end=(new Date).getTime(),d.total=d.end-d.start,this._lastOp={type:"ensureIndex",stats:{time:d}},{index:c,id:c.id(),name:c.name(),state:c.state()})},n.prototype.index=function(a){return this._indexByName?this._indexByName[a]:void 0},n.prototype.lastOp=function(){return this._metrics.list()},n.prototype.diff=function(a){var b,c,d,e,f={insert:[],update:[],remove:[]},g=this.primaryKey();if(g!==a.primaryKey())throw this.logIdentifier()+" Diffing requires that both collections have the same primary key!";for(b=a._data;b&&!(b instanceof Array);)a=b,b=a._data;for(e=b.length,c=0;e>c;c++)d=b[c],this._primaryIndex.get(d[g])?this._primaryCrc.get(d[g])!==a._primaryCrc.get(d[g])&&f.update.push(d):f.insert.push(d);for(b=this._data,e=b.length,c=0;e>c;c++)d=b[c],a._primaryIndex.get(d[g])||f.remove.push(d);return f},n.prototype.collateAdd=new l({"object, string":function(a,b){var c=this;c.collateAdd(a,function(d){var e,f;switch(d.type){case"insert":b?(e={$push:{}},e.$push[b]=c.decouple(d.data),c.update({},e)):c.insert(d.data);break;case"update":b?(e={},f={},e[b]=d.data.query,f[b+".$"]=d.data.update,c.update(e,f)):c.update(d.data.query,d.data.update);break;case"remove":b?(e={$pull:{}},e.$pull[b]={},e.$pull[b][c.primaryKey()]=d.data.dataSet[0][a.primaryKey()],c.update({},e)):c.remove(d.data)}})},"object, function":function(a,b){if("string"==typeof a&&(a=this._db.collection(a,{autoCreate:!1,throwError:!1})),a)return this._collate=this._collate||{},this._collate[a.name()]=new m(a,this,b),this;throw"Cannot collate from a non-existent collection!"}}),n.prototype.collateRemove=function(a){if("object"==typeof a&&(a=a.name()),a)return this._collate[a].drop(),delete this._collate[a],this;throw"No collection name passed to collateRemove() or collection not found!"},e.prototype.collection=new l({"":function(){return this.$main.call(this,{name:this.objectId()})},object:function(a){return a instanceof n?"droppped"!==a.state()?a:this.$main.call(this,{name:a.name()}):this.$main.call(this,a)},string:function(a){return this.$main.call(this,{name:a})},"string, string":function(a,b){return this.$main.call(this,{name:a,primaryKey:b})},"string, object":function(a,b){return b.name=a,this.$main.call(this,b)},"string, string, object":function(a,b,c){return c.name=a,c.primaryKey=b,this.$main.call(this,c)},$main:function(a){var b=a.name;if(b){if(!this._collection[b]){if(a&&a.autoCreate===!1&&a&&a.throwError!==!1)throw this.logIdentifier()+" Cannot get collection "+b+" because it does not exist and auto-create has been disabled!";this.debug()&&console.log(this.logIdentifier()+" Creating collection "+b)}if(this._collection[b]=this._collection[b]||new n(b,a).db(this),this._collection[b].mongoEmulation(this.mongoEmulation()),void 0!==a.primaryKey&&this._collection[b].primaryKey(a.primaryKey),void 0!==a.capped){if(void 0===a.size)throw this.logIdentifier()+" Cannot create a capped collection without specifying a size!";this._collection[b].capped(a.capped),this._collection[b].cappedSize(a.size)}return this._collection[b]}if(!a||a&&a.throwError!==!1)throw this.logIdentifier()+" Cannot get collection with undefined name!"}}),e.prototype.collectionExists=function(a){return Boolean(this._collection[a])},e.prototype.collections=function(a){var b,c,d=[],e=this._collection;a&&(a instanceof RegExp||(a=new RegExp(a)));for(c in e)e.hasOwnProperty(c)&&(b=e[c],a?a.exec(c)&&d.push({name:c,count:b.count(),linked:void 0!==b.isLinked?b.isLinked():!1}):d.push({name:c,count:b.count(),linked:void 0!==b.isLinked?b.isLinked():!1}));return d.sort(function(a,b){return a.name.localeCompare(b.name)}),d},d.finishModule("Collection"),b.exports=n},{"./Crc":8,"./IndexBinaryTree":10,"./IndexHashMap":11,"./KeyValueStore":12,"./Metrics":13,"./Overload":25,"./Path":26,"./ReactorIO":27,"./Shared":29}],6:[function(a,b,c){"use strict";var d,e,f,g;d=a("./Shared");var h=function(){this.init.apply(this,arguments)};h.prototype.init=function(a){var b=this;b._name=a,b._data=new g("__FDB__cg_data_"+b._name),b._collections=[],b._view=[]},d.addModule("CollectionGroup",h),d.mixin(h.prototype,"Mixin.Common"),d.mixin(h.prototype,"Mixin.ChainReactor"),d.mixin(h.prototype,"Mixin.Constants"),d.mixin(h.prototype,"Mixin.Triggers"),d.mixin(h.prototype,"Mixin.Tags"),g=a("./Collection"),e=d.modules.Db,f=d.modules.Db.prototype.init,h.prototype.on=function(){this._data.on.apply(this._data,arguments)},h.prototype.off=function(){this._data.off.apply(this._data,arguments)},h.prototype.emit=function(){this._data.emit.apply(this._data,arguments)},h.prototype.primaryKey=function(a){return void 0!==a?(this._primaryKey=a,this):this._primaryKey},d.synthesize(h.prototype,"state"),d.synthesize(h.prototype,"db"),d.synthesize(h.prototype,"name"),h.prototype.addCollection=function(a){if(a&&-1===this._collections.indexOf(a)){if(this._collections.length){if(this._primaryKey!==a.primaryKey())throw this.logIdentifier()+" All collections in a collection group must have the same primary key!"}else this.primaryKey(a.primaryKey());this._collections.push(a),a._groups=a._groups||[],a._groups.push(this),a.chain(this),a.on("drop",function(){if(a._groups&&a._groups.length){var b,c=[];for(b=0;b<a._groups.length;b++)c.push(a._groups[b]);for(b=0;b<c.length;b++)a._groups[b].removeCollection(a)}delete a._groups}),this._data.insert(a.find())}return this},h.prototype.removeCollection=function(a){if(a){var b,c=this._collections.indexOf(a);-1!==c&&(a.unChain(this),this._collections.splice(c,1),a._groups=a._groups||[],b=a._groups.indexOf(this),-1!==b&&a._groups.splice(b,1),a.off("drop")),0===this._collections.length&&delete this._primaryKey}return this},h.prototype._chainHandler=function(a){switch(a.type){case"setData":a.data=this.decouple(a.data),this._data.remove(a.options.oldData),this._data.insert(a.data);break;case"insert":a.data=this.decouple(a.data),this._data.insert(a.data);break;case"update":this._data.update(a.data.query,a.data.update,a.options);break;case"remove":this._data.remove(a.data.query,a.options)}},h.prototype.insert=function(){this._collectionsRun("insert",arguments)},h.prototype.update=function(){this._collectionsRun("update",arguments)},h.prototype.updateById=function(){this._collectionsRun("updateById",arguments)},h.prototype.remove=function(){this._collectionsRun("remove",arguments)},h.prototype._collectionsRun=function(a,b){for(var c=0;c<this._collections.length;c++)this._collections[c][a].apply(this._collections[c],b)},h.prototype.find=function(a,b){return this._data.find(a,b)},h.prototype.removeById=function(a){for(var b=0;b<this._collections.length;b++)this._collections[b].removeById(a)},h.prototype.subset=function(a,b){var c=this.find(a,b);return(new g).subsetOf(this).primaryKey(this._primaryKey).setData(c)},h.prototype.drop=function(a){if(!this.isDropped()){var b,c,d;if(this._debug&&console.log(this.logIdentifier()+" Dropping"),this._state="dropped",this._collections&&this._collections.length)for(c=[].concat(this._collections),b=0;b<c.length;b++)this.removeCollection(c[b]);if(this._view&&this._view.length)for(d=[].concat(this._view),b=0;b<d.length;b++)this._removeView(d[b]);this.emit("drop",this),a&&a(!1,!0)}return!0},e.prototype.init=function(){this._collectionGroup={},f.apply(this,arguments)},e.prototype.collectionGroup=function(a){return a?a instanceof h?a:(this._collectionGroup[a]=this._collectionGroup[a]||new h(a).db(this),this._collectionGroup[a]):this._collectionGroup},e.prototype.collectionGroups=function(){var a,b=[];for(a in this._collectionGroup)this._collectionGroup.hasOwnProperty(a)&&b.push({name:a});return b},b.exports=h},{"./Collection":5,"./Shared":29}],7:[function(a,b,c){"use strict";var d,e,f,g,h=[];d=a("./Shared"),g=a("./Overload");var i=function(a){this.init.apply(this,arguments)};i.prototype.init=function(a){this._db={},this._debug={},this._name=a||"ForerunnerDB",h.push(this)},i.prototype.instantiatedCount=function(){return h.length},i.prototype.instances=function(a){return void 0!==a?h[a]:h},i.prototype.namedInstances=function(a){var b,c;{if(void 0===a){for(c=[],b=0;b<h.length;b++)c.push(h[b].name);return c}for(b=0;b<h.length;b++)if(h[b].name===a)return h[b]}},i.prototype.moduleLoaded=new g({string:function(a){if(void 0!==a){a=a.replace(/ /g,"");var b,c=a.split(",");for(b=0;b<c.length;b++)if(!d.modules[c[b]])return!1;return!0}return!1},"string, function":function(a,b){if(void 0!==a){a=a.replace(/ /g,"");var c,e=a.split(",");for(c=0;c<e.length;c++)if(!d.modules[e[c]])return!1;b&&b()}},"array, function":function(a,b){var c,e;for(e=0;e<a.length;e++)if(c=a[e],void 0!==c){c=c.replace(/ /g,"");var f,g=c.split(",");for(f=0;f<g.length;f++)if(!d.modules[g[f]])return!1}b&&b()},"string, function, function":function(a,b,c){if(void 0!==a){a=a.replace(/ /g,"");var e,f=a.split(",");for(e=0;e<f.length;e++)if(!d.modules[f[e]])return c(),!1;b()}}}),i.prototype.version=function(a,b){return void 0!==a?0===d.version.indexOf(a)?(b&&b(),!0):!1:d.version},i.moduleLoaded=i.prototype.moduleLoaded,i.version=i.prototype.version,i.instances=i.prototype.instances,i.instantiatedCount=i.prototype.instantiatedCount,i.shared=d,i.prototype.shared=d,d.addModule("Core",i),d.mixin(i.prototype,"Mixin.Common"),d.mixin(i.prototype,"Mixin.Constants"),e=a("./Db.js"),f=a("./Metrics.js"),d.synthesize(i.prototype,"name"),d.synthesize(i.prototype,"mongoEmulation"),i.prototype._isServer=!1,i.prototype.isClient=function(){return!this._isServer},i.prototype.isServer=function(){return this._isServer},i.prototype.isClient=function(){return!this._isServer},i.prototype.isServer=function(){return this._isServer},i.prototype.collection=function(){throw"ForerunnerDB's instantiation has changed since version 1.3.36 to support multiple database instances. Please see the readme.md file for the minor change you have to make to get your project back up and running, or see the issue related to this change at https://github.com/Irrelon/ForerunnerDB/issues/44"},b.exports=i},{"./Db.js":9,"./Metrics.js":13,"./Overload":25,"./Shared":29}],8:[function(a,b,c){"use strict";var d=function(){var a,b,c,d=[];for(b=0;256>b;b++){for(a=b,c=0;8>c;c++)a=1&a?3988292384^a>>>1:a>>>1;d[b]=a}return d}();b.exports=function(a){var b,c=-1;for(b=0;b<a.length;b++)c=c>>>8^d[255&(c^a.charCodeAt(b))];return(-1^c)>>>0}},{}],9:[function(a,b,c){"use strict";var d,e,f,g,h,i;d=a("./Shared"),i=a("./Overload");var j=function(a,b){this.init.apply(this,arguments)};j.prototype.init=function(a,b){this.core(b),this._primaryKey="_id",this._name=a,this._collection={},this._debug={}},d.addModule("Db",j),j.prototype.moduleLoaded=new i({string:function(a){if(void 0!==a){a=a.replace(/ /g,"");var b,c=a.split(",");for(b=0;b<c.length;b++)if(!d.modules[c[b]])return!1;return!0}return!1},"string, function":function(a,b){if(void 0!==a){a=a.replace(/ /g,"");var c,e=a.split(",");for(c=0;c<e.length;c++)if(!d.modules[e[c]])return!1;b&&b()}},"string, function, function":function(a,b,c){if(void 0!==a){a=a.replace(/ /g,"");var e,f=a.split(",");for(e=0;e<f.length;e++)if(!d.modules[f[e]])return c(),!1;b()}}}),j.prototype.version=function(a,b){return void 0!==a?0===d.version.indexOf(a)?(b&&b(),!0):!1:d.version},j.moduleLoaded=j.prototype.moduleLoaded,j.version=j.prototype.version,j.shared=d,j.prototype.shared=d,d.addModule("Db",j),d.mixin(j.prototype,"Mixin.Common"),d.mixin(j.prototype,"Mixin.ChainReactor"),d.mixin(j.prototype,"Mixin.Constants"),d.mixin(j.prototype,"Mixin.Tags"),e=d.modules.Core,f=a("./Collection.js"),g=a("./Metrics.js"),h=a("./Crc.js"),j.prototype._isServer=!1,d.synthesize(j.prototype,"core"),d.synthesize(j.prototype,"primaryKey"),d.synthesize(j.prototype,"state"),d.synthesize(j.prototype,"name"),d.synthesize(j.prototype,"mongoEmulation"),j.prototype.isClient=function(){return!this._isServer},j.prototype.isServer=function(){return this._isServer},j.prototype.crc=h,j.prototype.isClient=function(){return!this._isServer},j.prototype.isServer=function(){return this._isServer},j.prototype.arrayToCollection=function(a){return(new f).setData(a)},j.prototype.on=function(a,b){return this._listeners=this._listeners||{},this._listeners[a]=this._listeners[a]||[],this._listeners[a].push(b),this},j.prototype.off=function(a,b){if(a in this._listeners){var c=this._listeners[a],d=c.indexOf(b);d>-1&&c.splice(d,1)}return this},j.prototype.emit=function(a,b){if(this._listeners=this._listeners||{},a in this._listeners){var c,d=this._listeners[a],e=d.length;for(c=0;e>c;c++)d[c].apply(this,Array.prototype.slice.call(arguments,1))}return this},j.prototype.peek=function(a){var b,c,d=[],e=typeof a;for(b in this._collection)this._collection.hasOwnProperty(b)&&(c=this._collection[b],d="string"===e?d.concat(c.peek(a)):d.concat(c.find(a)));return d},j.prototype.peek=function(a){var b,c,d=[],e=typeof a;for(b in this._collection)this._collection.hasOwnProperty(b)&&(c=this._collection[b],d="string"===e?d.concat(c.peek(a)):d.concat(c.find(a)));return d},j.prototype.peekCat=function(a){var b,c,d,e={},f=typeof a;for(b in this._collection)this._collection.hasOwnProperty(b)&&(c=this._collection[b],"string"===f?(d=c.peek(a),d&&d.length&&(e[c.name()]=d)):(d=c.find(a),d&&d.length&&(e[c.name()]=d)));return e},j.prototype.drop=new i({"":function(){if(!this.isDropped()){var a,b=this.collections(),c=b.length;for(this._state="dropped",a=0;c>a;a++)this.collection(b[a].name).drop(),delete this._collection[b[a].name];this.emit("drop",this),delete this._core._db[this._name]}return!0},"function":function(a){if(!this.isDropped()){var b,c=this.collections(),d=c.length,e=0,f=function(){e++,e===d&&a&&a()};for(this._state="dropped",b=0;d>b;b++)this.collection(c[b].name).drop(f),delete this._collection[c[b].name];this.emit("drop",this),delete this._core._db[this._name]}return!0},"boolean":function(a){if(!this.isDropped()){var b,c=this.collections(),d=c.length;for(this._state="dropped",b=0;d>b;b++)this.collection(c[b].name).drop(a),delete this._collection[c[b].name];this.emit("drop",this),delete this._core._db[this._name]}return!0},"boolean, function":function(a,b){if(!this.isDropped()){var c,d=this.collections(),e=d.length,f=0,g=function(){f++,f===e&&b&&b()};for(this._state="dropped",c=0;e>c;c++)this.collection(d[c].name).drop(a,g),delete this._collection[d[c].name];this.emit("drop",this),delete this._core._db[this._name]}return!0}}),e.prototype.db=function(a){return a instanceof j?a:(a||(a=this.objectId()),this._db[a]=this._db[a]||new j(a,this),this._db[a].mongoEmulation(this.mongoEmulation()),this._db[a])},e.prototype.databases=function(a){var b,c,d,e=[];a&&(a instanceof RegExp||(a=new RegExp(a)));for(d in this._db)this._db.hasOwnProperty(d)&&(c=!0,a&&(a.exec(d)||(c=!1)),c&&(b={name:d,children:[]},this.shared.moduleExists("Collection")&&b.children.push({module:"collection",moduleName:"Collections",count:this._db[d].collections().length}),this.shared.moduleExists("CollectionGroup")&&b.children.push({module:"collectionGroup",moduleName:"Collection Groups",count:this._db[d].collectionGroups().length}),this.shared.moduleExists("Document")&&b.children.push({module:"document",moduleName:"Documents",count:this._db[d].documents().length}),this.shared.moduleExists("Grid")&&b.children.push({module:"grid",moduleName:"Grids",count:this._db[d].grids().length}),this.shared.moduleExists("Overview")&&b.children.push({module:"overview",moduleName:"Overviews",count:this._db[d].overviews().length}),this.shared.moduleExists("View")&&b.children.push({module:"view",moduleName:"Views",count:this._db[d].views().length}),e.push(b)));return e.sort(function(a,b){return a.name.localeCompare(b.name)}),e},d.finishModule("Db"),b.exports=j},{"./Collection.js":5,"./Crc.js":8,"./Metrics.js":13,"./Overload":25,"./Shared":29}],10:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Path"),f=a("./BinaryTree"),g=new f,h=function(){};g.inOrder("hash");var i=function(){this.init.apply(this,arguments)};i.prototype.init=function(a,b,c){this._btree=new(h.create(2,this.sortAsc)),this._size=0,this._id=this._itemKeyHash(a,a),this.unique(b&&b.unique?b.unique:!1),void 0!==a&&this.keys(a),void 0!==c&&this.collection(c),this.name(b&&b.name?b.name:this._id)},d.addModule("IndexBinaryTree",i),d.mixin(i.prototype,"Mixin.ChainReactor"),d.mixin(i.prototype,"Mixin.Sorting"),i.prototype.id=function(){return this._id},i.prototype.state=function(){return this._state},i.prototype.size=function(){return this._size},d.synthesize(i.prototype,"data"),d.synthesize(i.prototype,"name"),d.synthesize(i.prototype,"collection"),d.synthesize(i.prototype,"type"),d.synthesize(i.prototype,"unique"),i.prototype.keys=function(a){return void 0!==a?(this._keys=a,this._keyCount=(new e).parse(this._keys).length,this):this._keys},i.prototype.rebuild=function(){if(this._collection){var a,b=this._collection.subset({},{$decouple:!1,$orderBy:this._keys}),c=b.find(),d=c.length;for(this._btree=new(h.create(2,this.sortAsc)),this._unique&&(this._uniqueLookup={}),a=0;d>a;a++)this.insert(c[a])}this._state={name:this._name,keys:this._keys,indexSize:this._size,built:new Date,updated:new Date,ok:!0}},i.prototype.insert=function(a,b){var c,d,e=this._unique,f=this._itemKeyHash(a,this._keys);e&&(c=this._itemHash(a,this._keys),this._uniqueLookup[c]=a),d=this._btree.get(f),void 0===d&&(d=[],this._btree.put(f,d)),d.push(a),this._size++},i.prototype.remove=function(a,b){var c,d,e,f=this._unique,g=this._itemKeyHash(a,this._keys);f&&(c=this._itemHash(a,this._keys),delete this._uniqueLookup[c]),d=this._btree.get(g),void 0!==d&&(e=d.indexOf(a),e>-1&&(1===d.length?this._btree.del(g):d.splice(e,1),this._size--))},i.prototype.violation=function(a){var b=this._itemHash(a,this._keys);return Boolean(this._uniqueLookup[b])},i.prototype.hashViolation=function(a){return Boolean(this._uniqueLookup[a])},i.prototype.lookup=function(a){return this._data[this._itemHash(a,this._keys)]||[]},i.prototype.match=function(a,b){var c,d=new e,f=d.parseArr(this._keys),g=d.parseArr(a),h=[],i=0;for(c=0;c<f.length;c++){if(g[c]!==f[c])return{matchedKeys:[],totalKeyCount:g.length,score:0};i++,h.push(g[c])}return{matchedKeys:h,totalKeyCount:g.length,score:i}},i.prototype._itemHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.value(a,c[d].path).join(":");return g},i.prototype._itemKeyHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.keyValue(a,c[d].path);return g},i.prototype._itemHashArr=function(a,b){var c,d,f,g,h,i=new e,j=[];for(c=i.parse(b),g=0;g<c.length;g++)for(d=i.value(a,c[g].path),f=0;f<d.length;f++)if(0===g)j.push(d[f]);else for(h=0;h<j.length;h++)j[h]=j[h]+"_"+d[f];return j},d.finishModule("IndexBinaryTree"),b.exports=i},{"./BinaryTree":4,"./Path":26,"./Shared":29}],11:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Path"),f=function(){this.init.apply(this,arguments)};f.prototype.init=function(a,b,c){this._crossRef={},this._size=0,this._id=this._itemKeyHash(a,a),this.data({}),this.unique(b&&b.unique?b.unique:!1),void 0!==a&&this.keys(a),void 0!==c&&this.collection(c),this.name(b&&b.name?b.name:this._id)},d.addModule("IndexHashMap",f),d.mixin(f.prototype,"Mixin.ChainReactor"),f.prototype.id=function(){return this._id},f.prototype.state=function(){return this._state},f.prototype.size=function(){return this._size},d.synthesize(f.prototype,"data"),d.synthesize(f.prototype,"name"),d.synthesize(f.prototype,"collection"),d.synthesize(f.prototype,"type"),d.synthesize(f.prototype,"unique"),f.prototype.keys=function(a){return void 0!==a?(this._keys=a,this._keyCount=(new e).parse(this._keys).length,this):this._keys},f.prototype.rebuild=function(){if(this._collection){var a,b=this._collection.subset({},{$decouple:!1,$orderBy:this._keys}),c=b.find(),d=c.length;for(this._data={},this._unique&&(this._uniqueLookup={}),a=0;d>a;a++)this.insert(c[a])}this._state={name:this._name,keys:this._keys,indexSize:this._size,built:new Date,updated:new Date,ok:!0}},f.prototype.insert=function(a,b){var c,d,e,f=this._unique;for(f&&(c=this._itemHash(a,this._keys),this._uniqueLookup[c]=a),d=this._itemHashArr(a,this._keys),e=0;e<d.length;e++)this.pushToPathValue(d[e],a)},f.prototype.update=function(a,b){},f.prototype.remove=function(a,b){var c,d,e,f=this._unique;for(f&&(c=this._itemHash(a,this._keys),delete this._uniqueLookup[c]),d=this._itemHashArr(a,this._keys),e=0;e<d.length;e++)this.pullFromPathValue(d[e],a)},f.prototype.violation=function(a){var b=this._itemHash(a,this._keys);return Boolean(this._uniqueLookup[b])},f.prototype.hashViolation=function(a){return Boolean(this._uniqueLookup[a])},f.prototype.pushToPathValue=function(a,b){var c=this._data[a]=this._data[a]||[];-1===c.indexOf(b)&&(c.push(b),this._size++,this.pushToCrossRef(b,c))},f.prototype.pullFromPathValue=function(a,b){var c,d=this._data[a];c=d.indexOf(b),c>-1&&(d.splice(c,1),this._size--,this.pullFromCrossRef(b,d)),d.length||delete this._data[a]},f.prototype.pull=function(a){var b,c,d=a[this._collection.primaryKey()],e=this._crossRef[d],f=e.length;for(b=0;f>b;b++)c=e[b],this._pullFromArray(c,a);this._size--,delete this._crossRef[d]},f.prototype._pullFromArray=function(a,b){for(var c=a.length;c--;)a[c]===b&&a.splice(c,1)},f.prototype.pushToCrossRef=function(a,b){var c,d=a[this._collection.primaryKey()];this._crossRef[d]=this._crossRef[d]||[],c=this._crossRef[d],-1===c.indexOf(b)&&c.push(b)},f.prototype.pullFromCrossRef=function(a,b){var c=a[this._collection.primaryKey()];delete this._crossRef[c]},f.prototype.lookup=function(a){return this._data[this._itemHash(a,this._keys)]||[]},f.prototype.match=function(a,b){var c,d=new e,f=d.parseArr(this._keys),g=d.parseArr(a),h=[],i=0;for(c=0;c<f.length;c++){if(g[c]!==f[c])return{matchedKeys:[],totalKeyCount:g.length,score:0};i++,h.push(g[c])}return{matchedKeys:h,totalKeyCount:g.length,score:i}},f.prototype._itemHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.value(a,c[d].path).join(":");return g},f.prototype._itemKeyHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.keyValue(a,c[d].path);return g},f.prototype._itemHashArr=function(a,b){var c,d,f,g,h,i=new e,j=[];for(c=i.parse(b),g=0;g<c.length;g++)for(d=i.value(a,c[g].path),f=0;f<d.length;f++)if(0===g)j.push(d[f]);else for(h=0;h<j.length;h++)j[h]=j[h]+"_"+d[f];return j},d.finishModule("IndexHashMap"),b.exports=f},{"./Path":26,"./Shared":29}],12:[function(a,b,c){"use strict";var d=a("./Shared"),e=function(a){this.init.apply(this,arguments)};e.prototype.init=function(a){this._name=a,this._data={},this._primaryKey="_id"},d.addModule("KeyValueStore",e),d.mixin(e.prototype,"Mixin.ChainReactor"),d.synthesize(e.prototype,"name"),e.prototype.primaryKey=function(a){return void 0!==a?(this._primaryKey=a,this):this._primaryKey},e.prototype.truncate=function(){return this._data={},this},e.prototype.set=function(a,b){return this._data[a]=b?b:!0,this},e.prototype.get=function(a){return this._data[a]},e.prototype.lookup=function(a){var b,c,d,e,f=a[this._primaryKey];if(f instanceof Array){for(c=f.length,e=[],b=0;c>b;b++)d=this._data[f[b]],d&&e.push(d);return e}if(f instanceof RegExp){e=[];for(b in this._data)this._data.hasOwnProperty(b)&&f.test(b)&&e.push(this._data[b]);return e}if("object"!=typeof f)return d=this._data[f],void 0!==d?[d]:[];if(f.$ne){e=[];for(b in this._data)this._data.hasOwnProperty(b)&&b!==f.$ne&&e.push(this._data[b]);return e}if(f.$in&&f.$in instanceof Array){e=[];for(b in this._data)this._data.hasOwnProperty(b)&&f.$in.indexOf(b)>-1&&e.push(this._data[b]);return e}if(f.$nin&&f.$nin instanceof Array){e=[];for(b in this._data)this._data.hasOwnProperty(b)&&-1===f.$nin.indexOf(b)&&e.push(this._data[b]);return e}if(f.$or&&f.$or instanceof Array){for(e=[],b=0;b<f.$or.length;b++)e=e.concat(this.lookup(f.$or[b]));return e}},e.prototype.unSet=function(a){return delete this._data[a],this},e.prototype.uniqueSet=function(a,b){return void 0===this._data[a]?(this._data[a]=b,!0):!1},d.finishModule("KeyValueStore"),b.exports=e},{"./Shared":29}],13:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Operation"),f=function(){this.init.apply(this,arguments)};f.prototype.init=function(){this._data=[]},d.addModule("Metrics",f),d.mixin(f.prototype,"Mixin.ChainReactor"),f.prototype.create=function(a){var b=new e(a);return this._enabled&&this._data.push(b),b},f.prototype.start=function(){return this._enabled=!0,this},f.prototype.stop=function(){return this._enabled=!1,this},f.prototype.clear=function(){return this._data=[],this},f.prototype.list=function(){return this._data},d.finishModule("Metrics"),b.exports=f},{"./Operation":24,"./Shared":29}],14:[function(a,b,c){"use strict";var d={preSetData:function(){},postSetData:function(){}};b.exports=d},{}],15:[function(a,b,c){"use strict";var d={chain:function(a){this.debug&&this.debug()&&(a._reactorIn&&a._reactorOut?console.log(a._reactorIn.logIdentifier()+' Adding target "'+a._reactorOut.instanceIdentifier()+'" to the chain reactor target list'):console.log(this.logIdentifier()+' Adding target "'+a.instanceIdentifier()+'" to the chain reactor target list')),this._chain=this._chain||[];var b=this._chain.indexOf(a);-1===b&&this._chain.push(a)},unChain:function(a){if(this.debug&&this.debug()&&(a._reactorIn&&a._reactorOut?console.log(a._reactorIn.logIdentifier()+' Removing target "'+a._reactorOut.instanceIdentifier()+'" from the chain reactor target list'):console.log(this.logIdentifier()+' Removing target "'+a.instanceIdentifier()+'" from the chain reactor target list')),this._chain){var b=this._chain.indexOf(a);b>-1&&this._chain.splice(b,1)}},chainSend:function(a,b,c){if(this._chain){var d,e,f=this._chain,g=f.length;for(e=0;g>e;e++){if(d=f[e],d._state&&(!d._state||d.isDropped()))throw console.log("Reactor Data:",a,b,c),console.log("Reactor Node:",d),"Chain reactor attempting to send data to target reactor node that is in a dropped state!";this.debug&&this.debug()&&(d._reactorIn&&d._reactorOut?console.log(d._reactorIn.logIdentifier()+' Sending data down the chain reactor pipe to "'+d._reactorOut.instanceIdentifier()+'"'):console.log(this.logIdentifier()+' Sending data down the chain reactor pipe to "'+d.instanceIdentifier()+'"')),d.chainReceive(this,a,b,c)}}},chainReceive:function(a,b,c,d){var e={sender:a,type:b,data:c,options:d};this.debug&&this.debug()&&console.log(this.logIdentifier()+"Received data from parent reactor node"),(!this._chainHandler||this._chainHandler&&!this._chainHandler(e))&&this.chainSend(e.type,e.data,e.options)}};b.exports=d},{}],16:[function(a,b,c){"use strict";var d,e=0,f=a("./Overload"),g=a("./Serialiser"),h=new g;d={serialiser:h,store:function(a,b){if(void 0!==a){if(void 0!==b)return this._store=this._store||{},this._store[a]=b,this;if(this._store)return this._store[a]}},unStore:function(a){return void 0!==a&&delete this._store[a],this},decouple:function(a,b){if(void 0!==a){if(b){var c,d=this.jStringify(a),e=[];for(c=0;b>c;c++)e.push(this.jParse(d));return e}return this.jParse(this.jStringify(a))}},jParse:function(a){return h.parse(a)},jStringify:function(a){return h.stringify(a)},objectId:function(a){var b,c=Math.pow(10,17);if(a){var d,f=0,g=a.length;for(d=0;g>d;d++)f+=a.charCodeAt(d)*c;b=f.toString(16)}else e++,b=(e+(Math.random()*c+Math.random()*c+Math.random()*c+Math.random()*c)).toString(16);return b},debug:new f([function(){return this._debug&&this._debug.all},function(a){return void 0!==a?"boolean"==typeof a?(this._debug=this._debug||{},this._debug.all=a,this.chainSend("debug",this._debug),this):this._debug&&this._debug[a]||this._db&&this._db._debug&&this._db._debug[a]||this._debug&&this._debug.all:this._debug&&this._debug.all},function(a,b){return void 0!==a?void 0!==b?(this._debug=this._debug||{},this._debug[a]=b,this.chainSend("debug",this._debug),this):this._debug&&this._debug[b]||this._db&&this._db._debug&&this._db._debug[a]:this._debug&&this._debug.all}]),classIdentifier:function(){return"ForerunnerDB."+this.className},instanceIdentifier:function(){return"["+this.className+"]"+this.name()},logIdentifier:function(){return this.classIdentifier()+": "+this.instanceIdentifier()},convertToFdb:function(a){var b,c,d,e;for(e in a)if(a.hasOwnProperty(e)&&(d=a,e.indexOf(".")>-1)){for(e=e.replace(".$","[|$|]"),c=e.split(".");b=c.shift();)b=b.replace("[|$|]",".$"),c.length?d[b]={}:d[b]=a[e],d=d[b];delete a[e]}},isDropped:function(){return"dropped"===this._state}},b.exports=d},{"./Overload":25,"./Serialiser":28}],17:[function(a,b,c){"use strict";var d={TYPE_INSERT:0,TYPE_UPDATE:1,TYPE_REMOVE:2,PHASE_BEFORE:0,PHASE_AFTER:1};b.exports=d},{}],18:[function(a,b,c){"use strict";var d=a("./Overload"),e={on:new d({"string, function":function(a,b){return this._listeners=this._listeners||{},this._listeners[a]=this._listeners[a]||{},this._listeners[a]["*"]=this._listeners[a]["*"]||[],this._listeners[a]["*"].push(b),this},"string, *, function":function(a,b,c){return this._listeners=this._listeners||{},this._listeners[a]=this._listeners[a]||{},this._listeners[a][b]=this._listeners[a][b]||[],this._listeners[a][b].push(c),this}}),once:new d({"string, function":function(a,b){var c=this,d=function(){c.off(a,d),b.apply(c,arguments)};return this.on(a,d)},"string, *, function":function(a,b,c){var d=this,e=function(){d.off(a,b,e),c.apply(d,arguments)};return this.on(a,b,e)}}),off:new d({string:function(a){return this._listeners&&this._listeners[a]&&a in this._listeners&&delete this._listeners[a],this},"string, function":function(a,b){var c,d;return"string"==typeof b?this._listeners&&this._listeners[a]&&this._listeners[a][b]&&delete this._listeners[a][b]:this._listeners&&a in this._listeners&&(c=this._listeners[a]["*"],d=c.indexOf(b),d>-1&&c.splice(d,1)),this},"string, *, function":function(a,b,c){if(this._listeners&&a in this._listeners&&b in this.listeners[a]){var d=this._listeners[a][b],e=d.indexOf(c);e>-1&&d.splice(e,1)}},"string, *":function(a,b){this._listeners&&a in this._listeners&&b in this._listeners[a]&&delete this._listeners[a][b]}}),emit:function(a,b){if(this._listeners=this._listeners||{},a in this._listeners){var c,d,e,f,g,h,i;if(this._listeners[a]["*"])for(f=this._listeners[a]["*"],d=f.length,c=0;d>c;c++)e=f[c],"function"==typeof e&&e.apply(this,Array.prototype.slice.call(arguments,1));if(b instanceof Array&&b[0]&&b[0][this._primaryKey])for(g=this._listeners[a],d=b.length,c=0;d>c;c++)if(g[b[c][this._primaryKey]])for(h=g[b[c][this._primaryKey]].length,i=0;h>i;i++)e=g[b[c][this._primaryKey]][i],"function"==typeof e&&g[b[c][this._primaryKey]][i].apply(this,Array.prototype.slice.call(arguments,1))}return this},deferEmit:function(a,b){var c,d=this;return this._noEmitDefer||this._db&&(!this._db||this._db._noEmitDefer)?this.emit.apply(this,arguments):(c=arguments,this._deferTimeout=this._deferTimeout||{},this._deferTimeout[a]&&clearTimeout(this._deferTimeout[a]),this._deferTimeout[a]=setTimeout(function(){d.debug()&&console.log(d.logIdentifier()+" Emitting "+c[0]),
d.emit.apply(d,c)},1)),this}};b.exports=e},{"./Overload":25}],19:[function(a,b,c){"use strict";var d={_match:function(a,b,c,d,e){var f,g,h,i,j,k,l=d,m=typeof a,n=typeof b,o=!0;if(e=e||{},c=c||{},e.$rootQuery||(e.$rootQuery=b),e.$rootSource||(e.$rootSource=a),e.$currentQuery=b,e.$rootData=e.$rootData||{},"string"!==m&&"number"!==m||"string"!==n&&"number"!==n){if(("string"===m||"number"===m)&&"object"===n&&b instanceof RegExp)b.test(a)||(o=!1);else for(k in b)if(b.hasOwnProperty(k)){if(e.$previousQuery=e.$parent,e.$parent={query:b[k],key:k,parent:e.$previousQuery},f=!1,j=k.substr(0,2),"//"===j)continue;if(0===j.indexOf("$")&&(i=this._matchOp(k,a,b[k],c,e),i>-1)){if(i){if("or"===d)return!0}else o=i;f=!0}if(!f&&b[k]instanceof RegExp)if(f=!0,"object"===m&&void 0!==a[k]&&b[k].test(a[k])){if("or"===d)return!0}else o=!1;if(!f)if("object"==typeof b[k])if(void 0!==a[k])if(a[k]instanceof Array&&!(b[k]instanceof Array)){for(g=!1,h=0;h<a[k].length&&!(g=this._match(a[k][h],b[k],c,l,e));h++);if(g){if("or"===d)return!0}else o=!1}else if(!(a[k]instanceof Array)&&b[k]instanceof Array){for(g=!1,h=0;h<b[k].length&&!(g=this._match(a[k],b[k][h],c,l,e));h++);if(g){if("or"===d)return!0}else o=!1}else if("object"==typeof a)if(g=this._match(a[k],b[k],c,l,e)){if("or"===d)return!0}else o=!1;else if(g=this._match(void 0,b[k],c,l,e)){if("or"===d)return!0}else o=!1;else if(b[k]&&void 0!==b[k].$exists)if(g=this._match(void 0,b[k],c,l,e)){if("or"===d)return!0}else o=!1;else o=!1;else if(a&&a[k]===b[k]){if("or"===d)return!0}else if(a&&a[k]&&a[k]instanceof Array&&b[k]&&"object"!=typeof b[k]){for(g=!1,h=0;h<a[k].length&&!(g=this._match(a[k][h],b[k],c,l,e));h++);if(g){if("or"===d)return!0}else o=!1}else o=!1;if("and"===d&&!o)return!1}}else"number"===m?a!==b&&(o=!1):a.localeCompare(b)&&(o=!1);return o},_matchOp:function(a,b,c,d,e){switch(a){case"$gt":return b>c;case"$gte":return b>=c;case"$lt":return c>b;case"$lte":return c>=b;case"$exists":return void 0===b!==c;case"$eq":return b==c;case"$eeq":return b===c;case"$ne":return b!=c;case"$nee":return b!==c;case"$or":for(var f=0;f<c.length;f++)if(this._match(b,c[f],d,"and",e))return!0;return!1;case"$and":for(var g=0;g<c.length;g++)if(!this._match(b,c[g],d,"and",e))return!1;return!0;case"$in":if(c instanceof Array){var h,i=c,j=i.length;for(h=0;j>h;h++)if(this._match(b,i[h],d,"and",e))return!0;return!1}if("object"==typeof c)return this._match(b,c,d,"and",e);throw this.logIdentifier()+" Cannot use an $in operator on a non-array key: "+a;case"$nin":if(c instanceof Array){var k,l=c,m=l.length;for(k=0;m>k;k++)if(this._match(b,l[k],d,"and",e))return!1;return!0}if("object"==typeof c)return this._match(b,c,d,"and",e);throw this.logIdentifier()+" Cannot use a $nin operator on a non-array key: "+a;case"$distinct":e.$rootData["//distinctLookup"]=e.$rootData["//distinctLookup"]||{};for(var n in c)if(c.hasOwnProperty(n))return e.$rootData["//distinctLookup"][n]=e.$rootData["//distinctLookup"][n]||{},e.$rootData["//distinctLookup"][n][b[n]]?!1:(e.$rootData["//distinctLookup"][n][b[n]]=!0,!0);break;case"$count":var o,p,q;for(o in c)if(c.hasOwnProperty(o)&&(p=b[o],q="object"==typeof p&&p instanceof Array?p.length:0,!this._match(q,c[o],d,"and",e)))return!1;return!0;case"$find":case"$findOne":case"$findSub":var r,s,t,u,v,w,x="collection",y={};if(!this.db())throw"Cannot operate a "+a+" sub-query on an anonymous collection (one with no db set)!";if(!c.$from)throw a+" missing $from property!";if(c.$fromType&&(x=c.$fromType,!this.db()[x]||"function"!=typeof this.db()[x]))throw a+' cannot operate against $fromType "'+x+'" because the database does not recognise this type of object!';if(r=c.$query||{},s=c.$options||{},"$findSub"===a){if(!c.$path)throw a+" missing $path property!";v=c.$path,t=c.$subQuery||{},u=c.$subOptions||{},w=this.db()[x](c.$from).findSub(r,v,t,u)}else w=this.db()[x](c.$from)[a.substr(1)](r,s);return y[e.$parent.parent.key]=w,this._match(b,y,d,"and",e)}return-1}};b.exports=d},{}],20:[function(a,b,c){"use strict";var d={sortAsc:function(a,b){return"string"==typeof a&&"string"==typeof b?a.localeCompare(b):a>b?1:b>a?-1:0},sortDesc:function(a,b){return"string"==typeof a&&"string"==typeof b?b.localeCompare(a):a>b?-1:b>a?1:0}};b.exports=d},{}],21:[function(a,b,c){"use strict";var d,e={};d={tagAdd:function(a){var b,c=this,d=e[a]=e[a]||[];for(b=0;b<d.length;b++)if(d[b]===c)return!0;return d.push(c),c.on&&c.on("drop",function(){c.tagRemove(a)}),!0},tagRemove:function(a){var b,c=e[a];if(c)for(b=0;b<c.length;b++)if(c[b]===this)return c.splice(b,1),!0;return!1},tagLookup:function(a){return e[a]||[]},tagDrop:function(a,b){var c,d,e,f=this.tagLookup(a);if(c=function(){d--,b&&0===d&&b(!1)},f.length)for(d=f.length,e=f.length-1;e>=0;e--)f[e].drop(c);return!0}},b.exports=d},{}],22:[function(a,b,c){"use strict";var d=a("./Overload"),e={addTrigger:function(a,b,c,d){var e,f=this;return e=f._triggerIndexOf(a,b,c),-1===e?(f._trigger=f._trigger||{},f._trigger[b]=f._trigger[b]||{},f._trigger[b][c]=f._trigger[b][c]||[],f._trigger[b][c].push({id:a,method:d,enabled:!0}),!0):!1},removeTrigger:function(a,b,c){var d,e=this;return d=e._triggerIndexOf(a,b,c),d>-1&&e._trigger[b][c].splice(d,1),!1},enableTrigger:new d({string:function(a){var b,c,d,e,f,g=this,h=g._trigger,i=!1;if(h)for(f in h)if(h.hasOwnProperty(f)&&(b=h[f]))for(d in b)if(b.hasOwnProperty(d))for(c=b[d],e=0;e<c.length;e++)c[e].id===a&&(c[e].enabled=!0,i=!0);return i},number:function(a){var b,c,d,e=this,f=e._trigger[a],g=!1;if(f)for(c in f)if(f.hasOwnProperty(c))for(b=f[c],d=0;d<b.length;d++)b[d].enabled=!0,g=!0;return g},"number, number":function(a,b){var c,d,e=this,f=e._trigger[a],g=!1;if(f&&(c=f[b]))for(d=0;d<c.length;d++)c[d].enabled=!0,g=!0;return g},"string, number, number":function(a,b,c){var d=this,e=d._triggerIndexOf(a,b,c);return e>-1?(d._trigger[b][c][e].enabled=!0,!0):!1}}),disableTrigger:new d({string:function(a){var b,c,d,e,f,g=this,h=g._trigger,i=!1;if(h)for(f in h)if(h.hasOwnProperty(f)&&(b=h[f]))for(d in b)if(b.hasOwnProperty(d))for(c=b[d],e=0;e<c.length;e++)c[e].id===a&&(c[e].enabled=!1,i=!0);return i},number:function(a){var b,c,d,e=this,f=e._trigger[a],g=!1;if(f)for(c in f)if(f.hasOwnProperty(c))for(b=f[c],d=0;d<b.length;d++)b[d].enabled=!1,g=!0;return g},"number, number":function(a,b){var c,d,e=this,f=e._trigger[a],g=!1;if(f&&(c=f[b]))for(d=0;d<c.length;d++)c[d].enabled=!1,g=!0;return g},"string, number, number":function(a,b,c){var d=this,e=d._triggerIndexOf(a,b,c);return e>-1?(d._trigger[b][c][e].enabled=!1,!0):!1}}),willTrigger:function(a,b){if(this._trigger&&this._trigger[a]&&this._trigger[a][b]&&this._trigger[a][b].length){var c,d=this._trigger[a][b];for(c=0;c<d.length;c++)if(d[c].enabled)return!0}return!1},processTrigger:function(a,b,c,d,e){var f,g,h,i,j,k=this;if(k._trigger&&k._trigger[b]&&k._trigger[b][c]){for(f=k._trigger[b][c],h=f.length,g=0;h>g;g++)if(i=f[g],i.enabled){if(this.debug()){var l,m;switch(b){case this.TYPE_INSERT:l="insert";break;case this.TYPE_UPDATE:l="update";break;case this.TYPE_REMOVE:l="remove";break;default:l=""}switch(c){case this.PHASE_BEFORE:m="before";break;case this.PHASE_AFTER:m="after";break;default:m=""}}if(j=i.method.call(k,a,d,e),j===!1)return!1;if(void 0!==j&&j!==!0&&j!==!1)throw"ForerunnerDB.Mixin.Triggers: Trigger error: "+j}return!0}},_triggerIndexOf:function(a,b,c){var d,e,f,g=this;if(g._trigger&&g._trigger[b]&&g._trigger[b][c])for(d=g._trigger[b][c],e=d.length,f=0;e>f;f++)if(d[f].id===a)return f;return-1}};b.exports=e},{"./Overload":25}],23:[function(a,b,c){"use strict";var d={_updateProperty:function(a,b,c){a[b]=c,this.debug()&&console.log(this.logIdentifier()+' Setting non-data-bound document property "'+b+'"')},_updateIncrement:function(a,b,c){a[b]+=c},_updateSpliceMove:function(a,b,c){a.splice(c,0,a.splice(b,1)[0]),this.debug()&&console.log(this.logIdentifier()+' Moving non-data-bound document array index from "'+b+'" to "'+c+'"')},_updateSplicePush:function(a,b,c){a.length>b?a.splice(b,0,c):a.push(c)},_updatePush:function(a,b){a.push(b)},_updatePull:function(a,b){a.splice(b,1)},_updateMultiply:function(a,b,c){a[b]*=c},_updateRename:function(a,b,c){a[c]=a[b],delete a[b]},_updateOverwrite:function(a,b,c){a[b]=c},_updateUnset:function(a,b){delete a[b]},_updateClear:function(a,b){var c,d=a[b];if(d&&"object"==typeof d)for(c in d)d.hasOwnProperty(c)&&this._updateUnset(d,c)},_updatePop:function(a,b){var c,d=!1;if(a.length>0)if(b>0){for(c=0;b>c;c++)a.pop();d=!0}else if(0>b){for(c=0;c>b;c--)a.shift();d=!0}return d}};b.exports=d},{}],24:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Path"),f=function(a){this.pathSolver=new e,this.counter=0,this.init.apply(this,arguments)};f.prototype.init=function(a){this._data={operation:a,index:{potential:[],used:!1},steps:[],time:{startMs:0,stopMs:0,totalMs:0,process:{}},flag:{},log:[]}},d.addModule("Operation",f),d.mixin(f.prototype,"Mixin.ChainReactor"),f.prototype.start=function(){this._data.time.startMs=(new Date).getTime()},f.prototype.log=function(a){if(a){var b=this._log.length>0?this._data.log[this._data.log.length-1].time:0,c={event:a,time:(new Date).getTime(),delta:0};return this._data.log.push(c),b&&(c.delta=c.time-b),this}return this._data.log},f.prototype.time=function(a){if(void 0!==a){var b=this._data.time.process,c=b[a]=b[a]||{};return c.startMs?(c.stopMs=(new Date).getTime(),c.totalMs=c.stopMs-c.startMs,c.stepObj.totalMs=c.totalMs,delete c.stepObj):(c.startMs=(new Date).getTime(),c.stepObj={name:a},this._data.steps.push(c.stepObj)),this}return this._data.time},f.prototype.flag=function(a,b){return void 0===a||void 0===b?void 0!==a?this._data.flag[a]:this._data.flag:void(this._data.flag[a]=b)},f.prototype.data=function(a,b,c){return void 0!==b?(this.pathSolver.set(this._data,a,b),this):this.pathSolver.get(this._data,a)},f.prototype.pushData=function(a,b,c){this.pathSolver.push(this._data,a,b)},f.prototype.stop=function(){this._data.time.stopMs=(new Date).getTime(),this._data.time.totalMs=this._data.time.stopMs-this._data.time.startMs},d.finishModule("Operation"),b.exports=f},{"./Path":26,"./Shared":29}],25:[function(a,b,c){"use strict";var d=function(a){if(a){var b,c,d,e,f,g,h=this;if(!(a instanceof Array)){d={};for(b in a)if(a.hasOwnProperty(b))if(e=b.replace(/ /g,""),-1===e.indexOf("*"))d[e]=a[b];else for(g=this.generateSignaturePermutations(e),f=0;f<g.length;f++)d[g[f]]||(d[g[f]]=a[b]);a=d}return function(){var d,e,f,g=[];if(a instanceof Array){for(c=a.length,b=0;c>b;b++)if(a[b].length===arguments.length)return h.callExtend(this,"$main",a,a[b],arguments)}else{for(b=0;b<arguments.length&&(e=typeof arguments[b],"object"===e&&arguments[b]instanceof Array&&(e="array"),1!==arguments.length||"undefined"!==e);b++)g.push(e);if(d=g.join(","),a[d])return h.callExtend(this,"$main",a,a[d],arguments);for(b=g.length;b>=0;b--)if(d=g.slice(0,b).join(","),a[d+",..."])return h.callExtend(this,"$main",a,a[d+",..."],arguments)}throw f="function"==typeof this.name?this.name():"Unknown",console.log("Overload: ",a),'ForerunnerDB.Overload "'+f+'": Overloaded method does not have a matching signature for the passed arguments: '+this.jStringify(g)}}return function(){}};d.prototype.generateSignaturePermutations=function(a){var b,c,d=[],e=["string","object","number","function","undefined"];if(a.indexOf("*")>-1)for(c=0;c<e.length;c++)b=a.replace("*",e[c]),d=d.concat(this.generateSignaturePermutations(b));else d.push(a);return d},d.prototype.callExtend=function(a,b,c,d,e){var f,g;return a&&c[b]?(f=a[b],a[b]=c[b],g=d.apply(a,e),a[b]=f,g):d.apply(a,e)},b.exports=d},{}],26:[function(a,b,c){"use strict";var d=a("./Shared"),e=function(a){this.init.apply(this,arguments)};e.prototype.init=function(a){a&&this.path(a)},d.addModule("Path",e),d.mixin(e.prototype,"Mixin.Common"),d.mixin(e.prototype,"Mixin.ChainReactor"),e.prototype.path=function(a){return void 0!==a?(this._path=this.clean(a),this._pathParts=this._path.split("."),this):this._path},e.prototype.hasObjectPaths=function(a,b){var c,d=!0;for(c in a)if(a.hasOwnProperty(c)){if(void 0===b[c])return!1;if("object"==typeof a[c]&&(d=this.hasObjectPaths(a[c],b[c]),!d))return!1}return d},e.prototype.countKeys=function(a){var b,c=0;for(b in a)a.hasOwnProperty(b)&&void 0!==a[b]&&("object"!=typeof a[b]?c++:c+=this.countKeys(a[b]));return c},e.prototype.countObjectPaths=function(a,b){var c,d,e={},f=0,g=0;for(d in b)b.hasOwnProperty(d)&&("object"==typeof b[d]?(c=this.countObjectPaths(a[d],b[d]),e[d]=c.matchedKeys,g+=c.totalKeyCount,f+=c.matchedKeyCount):(g++,a&&a[d]&&"object"!=typeof a[d]?(e[d]=!0,f++):e[d]=!1));return{matchedKeys:e,matchedKeyCount:f,totalKeyCount:g}},e.prototype.parse=function(a,b){var c,d,e,f=[],g="";for(d in a)if(a.hasOwnProperty(d))if(g=d,"object"==typeof a[d])if(b)for(c=this.parse(a[d],b),e=0;e<c.length;e++)f.push({path:g+"."+c[e].path,value:c[e].value});else for(c=this.parse(a[d]),e=0;e<c.length;e++)f.push({path:g+"."+c[e].path});else b?f.push({path:g,value:a[d]}):f.push({path:g});return f},e.prototype.parseArr=function(a,b){return b=b||{},this._parseArr(a,"",[],b)},e.prototype._parseArr=function(a,b,c,d){var e,f="";b=b||"",c=c||[];for(e in a)a.hasOwnProperty(e)&&(!d.ignore||d.ignore&&!d.ignore.test(e))&&(f=b?b+"."+e:e,"object"==typeof a[e]?(d.verbose&&c.push(f),this._parseArr(a[e],f,c,d)):c.push(f));return c},e.prototype.valueOne=function(a,b){return this.value(a,b)[0]},e.prototype.value=function(a,b,c){var d,e,f,g,h,i,j,k,l;if(void 0!==a&&"object"==typeof a){if((!c||c&&!c.skipArrCheck)&&a instanceof Array){for(j=[],k=0;k<a.length;k++)j.push(this.valueOne(a[k],b));return j}for(i=[],void 0!==b&&(b=this.clean(b),d=b.split(".")),e=d||this._pathParts,f=e.length,g=a,k=0;f>k;k++){if(g=g[e[k]],h instanceof Array){for(l=0;l<h.length;l++)i=i.concat(this.value(h,l+"."+e[k],{skipArrCheck:!0}));return i}if(!g||"object"!=typeof g)break;h=g}return[g]}return[]},e.prototype.set=function(a,b,c){if(void 0!==a&&void 0!==b){var d,e;b=this.clean(b),d=b.split("."),e=d.shift(),d.length?(a[e]=a[e]||{},this.set(a[e],d.join("."),c)):a[e]=c}return a},e.prototype.get=function(a,b){return this.value(a,b)[0]},e.prototype.push=function(a,b,c){if(void 0!==a&&void 0!==b){var d,e;if(b=this.clean(b),d=b.split("."),e=d.shift(),d.length)a[e]=a[e]||{},this.set(a[e],d.join("."),c);else{if(a[e]=a[e]||[],!(a[e]instanceof Array))throw"ForerunnerDB.Path: Cannot push to a path whose endpoint is not an array!";a[e].push(c)}}return a},e.prototype.keyValue=function(a,b){var c,d,e,f,g,h,i;for(void 0!==b&&(b=this.clean(b),c=b.split(".")),d=c||this._pathParts,e=d.length,f=a,i=0;e>i;i++){if(f=f[d[i]],!f||"object"!=typeof f){h=d[i]+":"+f;break}g=f}return h},e.prototype.set=function(a,b,c){if(void 0!==a&&void 0!==b){var d,e;b=this.clean(b),d=b.split("."),e=d.shift(),d.length?(a[e]=a[e]||{},this.set(a[e],d.join("."),c)):a[e]=c}return a},e.prototype.clean=function(a){return"."===a.substr(0,1)&&(a=a.substr(1,a.length-1)),a},d.finishModule("Path"),b.exports=e},{"./Shared":29}],27:[function(a,b,c){"use strict";var d=a("./Shared"),e=function(a,b,c){if(!(a&&b&&c))throw"ForerunnerDB.ReactorIO: ReactorIO requires in, out and process arguments to instantiate!";if(this._reactorIn=a,this._reactorOut=b,this._chainHandler=c,!a.chain||!b.chainReceive)throw"ForerunnerDB.ReactorIO: ReactorIO requires passed in and out objects to implement the ChainReactor mixin!";a.chain(this),this.chain(b)};d.addModule("ReactorIO",e),e.prototype.drop=function(){return this.isDropped()||(this._state="dropped",this._reactorIn&&this._reactorIn.unChain(this),this._reactorOut&&this.unChain(this._reactorOut),delete this._reactorIn,delete this._reactorOut,delete this._chainHandler,this.emit("drop",this)),!0},d.synthesize(e.prototype,"state"),d.mixin(e.prototype,"Mixin.Common"),d.mixin(e.prototype,"Mixin.ChainReactor"),d.mixin(e.prototype,"Mixin.Events"),d.finishModule("ReactorIO"),b.exports=e},{"./Shared":29}],28:[function(a,b,c){"use strict";var d=function(){this.init.apply(this,arguments)};d.prototype.init=function(){this._encoder=[],this._decoder={},this.registerEncoder("$date",function(a){return a instanceof Date?a.toISOString():void 0}),this.registerDecoder("$date",function(a){return new Date(a)})},d.prototype.registerEncoder=function(a,b){this._encoder.push(function(c){var d,e=b(c);return void 0!==e&&(d={},d[a]=e),d})},d.prototype.registerDecoder=function(a,b){this._decoder[a]=b},d.prototype._encode=function(a){for(var b,c=this._encoder.length;c--&&!b;)b=this._encoder[c](a);return b},d.prototype.parse=function(a){return this._parse(JSON.parse(a))},d.prototype._parse=function(a,b){var c;if("object"==typeof a&&null!==a){b=a instanceof Array?b||[]:b||{};for(c in a)if(a.hasOwnProperty(c)){if("$"===c.substr(0,1)&&this._decoder[c])return this._decoder[c](a[c]);b[c]=this._parse(a[c],b[c])}}else b=a;return b},d.prototype.stringify=function(a){return JSON.stringify(this._stringify(a))},d.prototype._stringify=function(a,b){var c,d;if("object"==typeof a&&null!==a){if(c=this._encode(a))return c;b=a instanceof Array?b||[]:b||{};for(d in a)a.hasOwnProperty(d)&&(b[d]=this._stringify(a[d],b[d]))}else b=a;return b},b.exports=d},{}],29:[function(a,b,c){"use strict";var d=a("./Overload"),e={version:"1.3.475",modules:{},plugins:{},_synth:{},addModule:function(a,b){this.modules[a]=b,this.emit("moduleLoad",[a,b])},finishModule:function(a){if(!this.modules[a])throw"ForerunnerDB.Shared: finishModule called on a module that has not been registered with addModule(): "+a;this.modules[a]._fdbFinished=!0,this.modules[a].prototype?this.modules[a].prototype.className=a:this.modules[a].className=a,this.emit("moduleFinished",[a,this.modules[a]])},moduleFinished:function(a,b){this.modules[a]&&this.modules[a]._fdbFinished?b&&b(a,this.modules[a]):this.on("moduleFinished",b)},moduleExists:function(a){return Boolean(this.modules[a])},mixin:new d({"object, string":function(a,b){var c;if("string"==typeof b&&(c=this.mixins[b],!c))throw"ForerunnerDB.Shared: Cannot find mixin named: "+b;return this.$main.call(this,a,c)},"object, *":function(a,b){return this.$main.call(this,a,b)},$main:function(a,b){if(b&&"object"==typeof b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}}),synthesize:function(a,b,c){if(this._synth[b]=this._synth[b]||function(a){return void 0!==a?(this["_"+b]=a,this):this["_"+b]},c){var d=this;a[b]=function(){var a,e=this.$super;return this.$super=d._synth[b],a=c.apply(this,arguments),this.$super=e,a}}else a[b]=this._synth[b]},overload:d,mixins:{"Mixin.Common":a("./Mixin.Common"),"Mixin.Events":a("./Mixin.Events"),"Mixin.ChainReactor":a("./Mixin.ChainReactor"),"Mixin.CRUD":a("./Mixin.CRUD"),"Mixin.Constants":a("./Mixin.Constants"),"Mixin.Triggers":a("./Mixin.Triggers"),"Mixin.Sorting":a("./Mixin.Sorting"),"Mixin.Matching":a("./Mixin.Matching"),"Mixin.Updating":a("./Mixin.Updating"),"Mixin.Tags":a("./Mixin.Tags")}};e.mixin(e,"Mixin.Events"),b.exports=e},{"./Mixin.CRUD":14,"./Mixin.ChainReactor":15,"./Mixin.Common":16,"./Mixin.Constants":17,"./Mixin.Events":18,"./Mixin.Matching":19,"./Mixin.Sorting":20,"./Mixin.Tags":21,"./Mixin.Triggers":22,"./Mixin.Updating":23,"./Overload":25}],30:[function(a,b,c){Array.prototype.filter||(Array.prototype.filter=function(a){if(void 0===this||null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if("function"!=typeof a)throw new TypeError;for(var d=[],e=arguments.length>=2?arguments[1]:void 0,f=0;c>f;f++)if(f in b){var g=b[f];a.call(e,g,f,b)&&d.push(g)}return d}),"function"!=typeof Object.create&&(Object.create=function(){var a=function(){};return function(b){if(arguments.length>1)throw Error("Second argument not supported");if("object"!=typeof b)throw TypeError("Argument must be an object");a.prototype=b;var c=new a;return a.prototype=null,c}}()),Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){var c;if(null===this)throw new TypeError('"this" is null or not defined');var d=Object(this),e=d.length>>>0;if(0===e)return-1;var f=+b||0;if(Math.abs(f)===1/0&&(f=0),f>=e)return-1;for(c=Math.max(f>=0?f:e-Math.abs(f),0);e>c;){if(c in d&&d[c]===a)return c;c++}return-1}),b.exports={}},{}],31:[function(a,b,c){"use strict";var d,e,f,g,h,i,j,k;d=a("./Shared");var l=function(a,b,c){this.init.apply(this,arguments)};l.prototype.init=function(a,b,c){var d=this;this._name=a,this._listeners={},this._querySettings={},this._debug={},this.query(b,!1),this.queryOptions(c,!1),this._collectionDroppedWrap=function(){d._collectionDropped.apply(d,arguments)},this._privateData=new f(this.name()+"_internalPrivate")},d.addModule("View",l),d.mixin(l.prototype,"Mixin.Common"),d.mixin(l.prototype,"Mixin.ChainReactor"),d.mixin(l.prototype,"Mixin.Constants"),d.mixin(l.prototype,"Mixin.Triggers"),d.mixin(l.prototype,"Mixin.Tags"),f=a("./Collection"),g=a("./CollectionGroup"),k=a("./ActiveBucket"),j=a("./ReactorIO"),h=f.prototype.init,e=d.modules.Db,i=e.prototype.init,d.synthesize(l.prototype,"state"),d.synthesize(l.prototype,"name"),d.synthesize(l.prototype,"cursor",function(a){return void 0===a?this._cursor||{}:void this.$super.apply(this,arguments)}),l.prototype.insert=function(){this._from.insert.apply(this._from,arguments)},l.prototype.update=function(){this._from.update.apply(this._from,arguments)},l.prototype.updateById=function(){this._from.updateById.apply(this._from,arguments)},l.prototype.remove=function(){this._from.remove.apply(this._from,arguments)},l.prototype.find=function(a,b){return this.publicData().find(a,b)},l.prototype.findOne=function(a,b){return this.publicData().findOne(a,b)},l.prototype.findById=function(a,b){return this.publicData().findById(a,b)},l.prototype.findSub=function(a,b,c,d){return this.publicData().findSub(a,b,c,d)},l.prototype.findSubOne=function(a,b,c,d){return this.publicData().findSubOne(a,b,c,d)},l.prototype.data=function(){return this._privateData},l.prototype.from=function(a,b){var c=this;if(void 0!==a){this._from&&(this._from.off("drop",this._collectionDroppedWrap),delete this._from),"string"==typeof a&&(a=this._db.collection(a)),"View"===a.className&&(a=a.privateData(),this.debug()&&console.log(this.logIdentifier()+' Using internal private data "'+a.instanceIdentifier()+'" for IO graph linking')),this._from=a,this._from.on("drop",this._collectionDroppedWrap),this._io=new j(a,this,function(a){var b,d,e,f,g,h,i;if(c&&!c.isDropped()&&c._querySettings.query){if("insert"===a.type){if(b=a.data,b instanceof Array)for(f=[],i=0;i<b.length;i++)c._privateData._match(b[i],c._querySettings.query,c._querySettings.options,"and",{})&&(f.push(b[i]),g=!0);else c._privateData._match(b,c._querySettings.query,c._querySettings.options,"and",{})&&(f=b,g=!0);return g&&this.chainSend("insert",f),!0}if("update"===a.type){if(d=c._privateData.diff(c._from.subset(c._querySettings.query,c._querySettings.options)),d.insert.length||d.remove.length){if(d.insert.length&&this.chainSend("insert",d.insert),d.update.length)for(h=c._privateData.primaryKey(),i=0;i<d.update.length;i++)e={},e[h]=d.update[i][h],this.chainSend("update",{query:e,update:d.update[i]});if(d.remove.length){h=c._privateData.primaryKey();var j=[],k={query:{$or:j}};for(i=0;i<d.remove.length;i++)j.push({_id:d.remove[i][h]});this.chainSend("remove",k)}return!0}return!1}}return!1});var d=a.find(this._querySettings.query,this._querySettings.options);return this._privateData.primaryKey(a.primaryKey()),this._privateData.setData(d,{},b),this._querySettings.options&&this._querySettings.options.$orderBy?this.rebuildActiveBucket(this._querySettings.options.$orderBy):this.rebuildActiveBucket(),this}return this._from},l.prototype._collectionDropped=function(a){a&&delete this._from},l.prototype.ensureIndex=function(){return this._privateData.ensureIndex.apply(this._privateData,arguments)},l.prototype._chainHandler=function(a){var b,c,d,e,f,g,h,i;switch(this.debug()&&console.log(this.logIdentifier()+" Received chain reactor data"),a.type){case"setData":this.debug()&&console.log(this.logIdentifier()+' Setting data in underlying (internal) view collection "'+this._privateData.name()+'"');var j=this._from.find(this._querySettings.query,this._querySettings.options);this._privateData.setData(j);break;case"insert":if(this.debug()&&console.log(this.logIdentifier()+' Inserting some data into underlying (internal) view collection "'+this._privateData.name()+'"'),a.data=this.decouple(a.data),a.data instanceof Array||(a.data=[a.data]),this._querySettings.options&&this._querySettings.options.$orderBy)for(b=a.data,c=b.length,d=0;c>d;d++)e=this._activeBucket.insert(b[d]),this._privateData._insertHandle(a.data,e);else e=this._privateData._data.length,this._privateData._insertHandle(a.data,e);break;case"update":if(this.debug()&&console.log(this.logIdentifier()+' Updating some data in underlying (internal) view collection "'+this._privateData.name()+'"'),g=this._privateData.primaryKey(),f=this._privateData.update(a.data.query,a.data.update,a.data.options),this._querySettings.options&&this._querySettings.options.$orderBy)for(c=f.length,d=0;c>d;d++)h=f[d],this._activeBucket.remove(h),i=this._privateData._data.indexOf(h),e=this._activeBucket.insert(h),i!==e&&this._privateData._updateSpliceMove(this._privateData._data,i,e);break;case"remove":this.debug()&&console.log(this.logIdentifier()+' Removing some data from underlying (internal) view collection "'+this._privateData.name()+'"'),this._privateData.remove(a.data.query,a.options)}},l.prototype.on=function(){return this._privateData.on.apply(this._privateData,arguments)},l.prototype.off=function(){return this._privateData.off.apply(this._privateData,arguments)},l.prototype.emit=function(){return this._privateData.emit.apply(this._privateData,arguments)},l.prototype.distinct=function(a,b,c){var d=this.publicData();return d.distinct.apply(d,arguments)},l.prototype.primaryKey=function(){return this.publicData().primaryKey()},l.prototype.drop=function(a){return this.isDropped()?!1:(this._from&&(this._from.off("drop",this._collectionDroppedWrap),this._from._removeView(this)),(this.debug()||this._db&&this._db.debug())&&console.log(this.logIdentifier()+" Dropping"),this._state="dropped",this._io&&this._io.drop(),this._privateData&&this._privateData.drop(),this._publicData&&this._publicData!==this._privateData&&this._publicData.drop(),this._db&&this._name&&delete this._db._view[this._name],this.emit("drop",this),a&&a(!1,!0),delete this._chain,delete this._from,delete this._privateData,delete this._io,delete this._listeners,delete this._querySettings,delete this._db,!0)},d.synthesize(l.prototype,"db",function(a){return a&&(this.privateData().db(a),this.publicData().db(a),this.debug(a.debug()),this.privateData().debug(a.debug()),this.publicData().debug(a.debug())),this.$super.apply(this,arguments)}),l.prototype.queryData=function(a,b,c){return void 0!==a&&(this._querySettings.query=a),void 0!==b&&(this._querySettings.options=b),void 0!==a||void 0!==b?((void 0===c||c===!0)&&this.refresh(),this):this._querySettings},l.prototype.queryAdd=function(a,b,c){this._querySettings.query=this._querySettings.query||{};var d,e=this._querySettings.query;if(void 0!==a)for(d in a)a.hasOwnProperty(d)&&(void 0===e[d]||void 0!==e[d]&&b!==!1)&&(e[d]=a[d]);(void 0===c||c===!0)&&this.refresh()},l.prototype.queryRemove=function(a,b){var c,d=this._querySettings.query;if(d){if(void 0!==a)for(c in a)a.hasOwnProperty(c)&&delete d[c];(void 0===b||b===!0)&&this.refresh()}},l.prototype.query=function(a,b){return void 0!==a?(this._querySettings.query=a,(void 0===b||b===!0)&&this.refresh(),this):this._querySettings.query},l.prototype.orderBy=function(a){if(void 0!==a){var b=this.queryOptions()||{};return b.$orderBy=a,this.queryOptions(b),this}return(this.queryOptions()||{}).$orderBy},l.prototype.page=function(a){if(void 0!==a){var b=this.queryOptions()||{};return a!==b.$page&&(b.$page=a,this.queryOptions(b)),this}return(this.queryOptions()||{}).$page},l.prototype.pageFirst=function(){return this.page(0)},l.prototype.pageLast=function(){var a=this.cursor().pages,b=void 0!==a?a:0;return this.page(b-1)},l.prototype.pageScan=function(a){if(void 0!==a){var b=this.cursor().pages,c=this.queryOptions()||{},d=void 0!==c.$page?c.$page:0;return d+=a,0>d&&(d=0),d>=b&&(d=b-1),this.page(d)}},l.prototype.queryOptions=function(a,b){return void 0!==a?(this._querySettings.options=a,void 0===a.$decouple&&(a.$decouple=!0),void 0===b||b===!0?this.refresh():this.rebuildActiveBucket(a.$orderBy),this):this._querySettings.options},l.prototype.rebuildActiveBucket=function(a){if(a){var b=this._privateData._data,c=b.length;this._activeBucket=new k(a),this._activeBucket.primaryKey(this._privateData.primaryKey());for(var d=0;c>d;d++)this._activeBucket.insert(b[d])}else delete this._activeBucket},l.prototype.refresh=function(){if(this._from){var a,b=this.publicData();this._privateData.remove(),a=this._from.find(this._querySettings.query,this._querySettings.options),this.cursor(a.$cursor),this._privateData.insert(a),this._privateData._data.$cursor=a.$cursor,b._data.$cursor=a.$cursor}return this._querySettings.options&&this._querySettings.options.$orderBy?this.rebuildActiveBucket(this._querySettings.options.$orderBy):this.rebuildActiveBucket(),this},l.prototype.count=function(){return this.publicData()?this.publicData().count.apply(this.publicData(),arguments):0},l.prototype.subset=function(){return this.publicData().subset.apply(this._privateData,arguments)},l.prototype.transform=function(a){var b=this;return void 0!==a?("object"==typeof a?(void 0!==a.enabled&&(this._transformEnabled=a.enabled),void 0!==a.dataIn&&(this._transformIn=a.dataIn),void 0!==a.dataOut&&(this._transformOut=a.dataOut)):this._transformEnabled=a!==!1,this._transformEnabled?(this._publicData||(this._publicData=new f("__FDB__view_publicData_"+this._name),this._publicData.db(this._privateData._db),this._publicData.transform({enabled:!0,dataIn:this._transformIn,dataOut:this._transformOut}),this._transformIo=new j(this._privateData,this._publicData,function(a){var c=a.data;switch(a.type){case"primaryKey":b._publicData.primaryKey(c),this.chainSend("primaryKey",c);break;case"setData":b._publicData.setData(c),this.chainSend("setData",c);break;case"insert":b._publicData.insert(c),this.chainSend("insert",c);break;case"update":b._publicData.update(c.query,c.update,c.options),this.chainSend("update",c);break;case"remove":b._publicData.remove(c.query,a.options),this.chainSend("remove",c)}})),this._publicData.primaryKey(this.privateData().primaryKey()),this._publicData.setData(this.privateData().find())):this._publicData&&(this._publicData.drop(),delete this._publicData,this._transformIo&&(this._transformIo.drop(),delete this._transformIo)),this):{enabled:this._transformEnabled,dataIn:this._transformIn,dataOut:this._transformOut}},l.prototype.filter=function(a,b,c){return this.publicData().filter(a,b,c)},l.prototype.privateData=function(){return this._privateData},l.prototype.publicData=function(){return this._transformEnabled?this._publicData:this._privateData},f.prototype.init=function(){this._view=[],h.apply(this,arguments)},f.prototype.view=function(a,b,c){if(this._db&&this._db._view){if(this._db._view[a])throw this.logIdentifier()+" Cannot create a view using this collection because a view with this name already exists: "+a;var d=new l(a,b,c).db(this._db).from(this);return this._view=this._view||[],this._view.push(d),d}},f.prototype._addView=g.prototype._addView=function(a){return void 0!==a&&this._view.push(a),this},f.prototype._removeView=g.prototype._removeView=function(a){if(void 0!==a){var b=this._view.indexOf(a);b>-1&&this._view.splice(b,1)}return this},e.prototype.init=function(){this._view={},i.apply(this,arguments)},e.prototype.view=function(a){return a instanceof l?a:(this._view[a]||(this.debug()||this._db&&this._db.debug())&&console.log(this.logIdentifier()+" Creating view "+a),this._view[a]=this._view[a]||new l(a).db(this),this._view[a])},e.prototype.viewExists=function(a){return Boolean(this._view[a])},e.prototype.views=function(){var a,b,c=[];for(b in this._view)this._view.hasOwnProperty(b)&&(a=this._view[b],c.push({name:b,count:a.count(),linked:void 0!==a.isLinked?a.isLinked():!1}));
return c},d.finishModule("View"),b.exports=l},{"./ActiveBucket":3,"./Collection":5,"./CollectionGroup":6,"./ReactorIO":27,"./Shared":29}]},{},[1]); |
src/containers/Authentication/RegisterSkill.js | JamesJin038801/CampID | import React, { Component } from 'react';
import {
Text,
TextInput,
View,
Platform,
TouchableOpacity,
Image,
Alert,
} from 'react-native';
import { connect } from 'react-redux';
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
import Icon from 'react-native-vector-icons/FontAwesome';
import I18n from 'react-native-i18n';
import ImagePicker from 'react-native-image-picker';
import ImageResizer from 'react-native-image-resizer';
import { MKButton } from 'react-native-material-kit';
import NavigationBar from 'react-native-navbar';
import { replaceRoute, popRoute } from '@actions/route';
import { setAvatarUri } from '@actions/globals';
import CommonWidgets from '@components/CommonWidgets';
import ActionSheet from '@components/ActionSheet/';
import { Metrics, Styles, Images, Colors, Fonts } from '@theme/';
import Utils from '@src/utils';
import Constants from '@src/constants';
import styles from './styles';
class RegisterSkill extends Component {
constructor(props) {
super(props);
this.state = {
beginnerFocus: false,
noviceFocus: false,
intermediateFocus: false,
advancedFocus: false,
eliteFocus: false,
};
}
onBtnFocus(value) {
this.setState({ beginnerFocus: false, noviceFocus: false, intermediateFocus: false, advancedFocus: false, eliteFocus: false });
this.setState({ [`${value}Focus`]: true });
}
showActionSheetMenu() {
this.ActionSheet.show();
}
onActionSheetMenu(index) {
const options = {
quality: 1.0,
storageOptions: {
skipBackup: true,
path: 'images',
},
};
switch (index) {
case 0:
ImagePicker.launchCamera(options, (response) => {
this.onImagePicker(response);
});
break;
case 1:
ImagePicker.launchImageLibrary(options, (response) => {
this.onImagePicker(response);
});
break;
default:
}
}
onImagePicker(response) {
if (response.didCancel) {
console.log('User cancelled image picker');
} else if (response.error) {
console.log('ImagePicker Error: ', response.error);
} else if (response.customButton) {
console.log('User tapped custom button: ', response.customButton);
} else if (response.uri !== undefined) {
let source = '';
if (Platform.OS === 'android') {
source = { uri: response.uri };
} else {
source = { uri: response.uri.replace('file://', ''), isStatic: true };
}
ImageResizer.createResizedImage(source.uri, 400, 300, 'JPEG', 80)
.then((resizedImageUri) => {
this.props.setAvatarUri(resizedImageUri);
}).catch((err) => {
console.log(err);
}).catch((err) => {
console.log(err);
});
}
}
/* source={Images.bkgLogin}*/
render() {
return (
<KeyboardAwareScrollView
alwaysBounceVertical={false}
style={{ flex: 1, backgroundColor: Colors.brandPrimary }}
automaticallyAdjustContentInsets={false}>
<View style={Styles.fullScreen}>
{CommonWidgets.renderStatusBar('black')}
<NavigationBar
style={Styles.navBarStyle}
title={CommonWidgets.renderNavBarHeader('Christina Smith')}
tintColor={Colors.txtTitle}
leftButton={CommonWidgets.renderNavBarLeftButton(() => this.props.replaceRoute('login'))} />
<Image
resizeMode={'stretch'}
style={Styles.navbarFullScreen}
source= {Images.registerSkillBg}>
{/* -----Avatar---- */}
<View style={{ flex: 26 }}>
{CommonWidgets.renderSpacer(168)}
</View>
<View style={[{ flex: 25 }, Styles.center]}>
{CommonWidgets.renderAvatar(this.props.globals.avatarUri, () => this.showActionSheetMenu())}
</View>
<View style={{ flex: 14, flexDirection: 'column' }}>
<View style={[{ flex: 1, flexDirection: 'row' }, Styles.center]}>
{CommonWidgets.renderNormalButton(I18n.t('BEGINNER'), Utils.getNormalBtnBackcolor(this.state.beginnerFocus), () => this.onBtnFocus('beginner'))}
{CommonWidgets.renderNormalButton(I18n.t('NOVICE'), Utils.getNormalBtnBackcolor(this.state.noviceFocus), () => this.onBtnFocus('novice'))}
{CommonWidgets.renderNormalButton(I18n.t('INTERMEDIATE'), Utils.getNormalBtnBackcolor(this.state.intermediateFocus), () => this.onBtnFocus('intermediate'))}
</View>
<View style={[{ flex: 1, flexDirection: 'row' }, Styles.center]}>
{CommonWidgets.renderNormalButton(I18n.t('ADVANCED'), Utils.getNormalBtnBackcolor(this.state.advancedFocus), () => this.onBtnFocus('advanced'))}
{CommonWidgets.renderNormalButton(I18n.t('ELITE'), Utils.getNormalBtnBackcolor(this.state.eliteFocus), () => this.onBtnFocus('elite'))}
</View>
</View>
<View style={{ flex: 26 }} />
<View style={{ flex: 9, flexDirection: 'row' }}>
<View style={{ flex: 1 }}>
{CommonWidgets.renderImgBtn(() => this.props.replaceRoute('register'), { left: Metrics.bottomBtnMargin }, Images.imgLeftBtn)}
</View>
<View style={{ flex: 1, alignItems: 'flex-end' }} >
{CommonWidgets.renderImgBtn(() => this.props.replaceRoute('registerExp'), { marginRight: Metrics.bottomBtnMargin }, Images.imgRightBtn)}
</View>
</View>
<View style={{ flex: 5 }} />
</Image>
<ActionSheet
ref={(as) => { this.ActionSheet = as; }}
options={Constants.IP_BUTTONS}
cancelButtonIndex={Constants.IP_BUTTONS.length - 1}
onPress={this.onActionSheetMenu.bind(this)}
tintColor={Colors.textPrimary} />
</View>
</KeyboardAwareScrollView>
);
}
}
RegisterSkill.propTypes = {
dispatch: React.PropTypes.func.isRequired,
replaceRoute: React.PropTypes.func.isRequired,
popRoute: React.PropTypes.func.isRequired,
};
function mapDispatchToProps(dispatch) {
return {
dispatch,
popRoute: () => dispatch(popRoute()),
replaceRoute: route => dispatch(replaceRoute(route)),
setAvatarUri: avatarUri => dispatch(setAvatarUri(avatarUri)),
};
}
function mapStateToProps(state) {
const globals = state.get('globals');
return { globals };
}
export default connect(mapStateToProps, mapDispatchToProps)(RegisterSkill);
|
ajax/libs/yui/3.4.0pr2/event/event.js | sashberd/cdnjs | (function () {
var GLOBAL_ENV = YUI.Env;
if (!GLOBAL_ENV._ready) {
GLOBAL_ENV._ready = function() {
GLOBAL_ENV.DOMReady = true;
GLOBAL_ENV.remove(YUI.config.doc, 'DOMContentLoaded', GLOBAL_ENV._ready);
};
GLOBAL_ENV.add(YUI.config.doc, 'DOMContentLoaded', GLOBAL_ENV._ready);
}
})();
YUI.add('event-base', function(Y) {
/*
* DOM event listener abstraction layer
* @module event
* @submodule event-base
*/
/**
* The domready event fires at the moment the browser's DOM is
* usable. In most cases, this is before images are fully
* downloaded, allowing you to provide a more responsive user
* interface.
*
* In YUI 3, domready subscribers will be notified immediately if
* that moment has already passed when the subscription is created.
*
* One exception is if the yui.js file is dynamically injected into
* the page. If this is done, you must tell the YUI instance that
* you did this in order for DOMReady (and window load events) to
* fire normally. That configuration option is 'injected' -- set
* it to true if the yui.js script is not included inline.
*
* This method is part of the 'event-ready' module, which is a
* submodule of 'event'.
*
* @event domready
* @for YUI
*/
Y.publish('domready', {
fireOnce: true,
async: true
});
if (YUI.Env.DOMReady) {
Y.fire('domready');
} else {
Y.Do.before(function() { Y.fire('domready'); }, YUI.Env, '_ready');
}
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event
* @submodule event-base
*/
/**
* Wraps a DOM event, properties requiring browser abstraction are
* fixed here. Provids a security layer when required.
* @class DOMEventFacade
* @param ev {Event} the DOM event
* @param currentTarget {HTMLElement} the element the listener was attached to
* @param wrapper {Event.Custom} the custom event wrapper for this DOM event
*/
var ua = Y.UA,
EMPTY = {},
/**
* webkit key remapping required for Safari < 3.1
* @property webkitKeymap
* @private
*/
webkitKeymap = {
63232: 38, // up
63233: 40, // down
63234: 37, // left
63235: 39, // right
63276: 33, // page up
63277: 34, // page down
25: 9, // SHIFT-TAB (Safari provides a different key code in
// this case, even though the shiftKey modifier is set)
63272: 46, // delete
63273: 36, // home
63275: 35 // end
},
/**
* Returns a wrapped node. Intended to be used on event targets,
* so it will return the node's parent if the target is a text
* node.
*
* If accessing a property of the node throws an error, this is
* probably the anonymous div wrapper Gecko adds inside text
* nodes. This likely will only occur when attempting to access
* the relatedTarget. In this case, we now return null because
* the anonymous div is completely useless and we do not know
* what the related target was because we can't even get to
* the element's parent node.
*
* @method resolve
* @private
*/
resolve = function(n) {
if (!n) {
return n;
}
try {
if (n && 3 == n.nodeType) {
n = n.parentNode;
}
} catch(e) {
return null;
}
return Y.one(n);
},
DOMEventFacade = function(ev, currentTarget, wrapper) {
this._event = ev;
this._currentTarget = currentTarget;
this._wrapper = wrapper || EMPTY;
// if not lazy init
this.init();
};
Y.extend(DOMEventFacade, Object, {
init: function() {
var e = this._event,
overrides = this._wrapper.overrides,
x = e.pageX,
y = e.pageY,
c,
currentTarget = this._currentTarget;
this.altKey = e.altKey;
this.ctrlKey = e.ctrlKey;
this.metaKey = e.metaKey;
this.shiftKey = e.shiftKey;
this.type = (overrides && overrides.type) || e.type;
this.clientX = e.clientX;
this.clientY = e.clientY;
this.pageX = x;
this.pageY = y;
c = e.keyCode || e.charCode;
if (ua.webkit && (c in webkitKeymap)) {
c = webkitKeymap[c];
}
this.keyCode = c;
this.charCode = c;
this.which = e.which || e.charCode || c;
// this.button = e.button;
this.button = this.which;
this.target = resolve(e.target);
this.currentTarget = resolve(currentTarget);
this.relatedTarget = resolve(e.relatedTarget);
if (e.type == "mousewheel" || e.type == "DOMMouseScroll") {
this.wheelDelta = (e.detail) ? (e.detail * -1) : Math.round(e.wheelDelta / 80) || ((e.wheelDelta < 0) ? -1 : 1);
}
if (this._touch) {
this._touch(e, currentTarget, this._wrapper);
}
},
stopPropagation: function() {
this._event.stopPropagation();
this._wrapper.stopped = 1;
this.stopped = 1;
},
stopImmediatePropagation: function() {
var e = this._event;
if (e.stopImmediatePropagation) {
e.stopImmediatePropagation();
} else {
this.stopPropagation();
}
this._wrapper.stopped = 2;
this.stopped = 2;
},
preventDefault: function(returnValue) {
var e = this._event;
e.preventDefault();
e.returnValue = returnValue || false;
this._wrapper.prevented = 1;
this.prevented = 1;
},
halt: function(immediate) {
if (immediate) {
this.stopImmediatePropagation();
} else {
this.stopPropagation();
}
this.preventDefault();
}
});
DOMEventFacade.resolve = resolve;
Y.DOM2EventFacade = DOMEventFacade;
Y.DOMEventFacade = DOMEventFacade;
/**
* The native event
* @property _event
*/
/**
* The X location of the event on the page (including scroll)
* @property pageX
* @type int
*/
/**
* The Y location of the event on the page (including scroll)
* @property pageY
* @type int
*/
/**
* The keyCode for key events. Uses charCode if keyCode is not available
* @property keyCode
* @type int
*/
/**
* The charCode for key events. Same as keyCode
* @property charCode
* @type int
*/
/**
* The button that was pushed.
* @property button
* @type int
*/
/**
* The button that was pushed. Same as button.
* @property which
* @type int
*/
/**
* Node reference for the targeted element
* @propery target
* @type Node
*/
/**
* Node reference for the element that the listener was attached to.
* @propery currentTarget
* @type Node
*/
/**
* Node reference to the relatedTarget
* @propery relatedTarget
* @type Node
*/
/**
* Number representing the direction and velocity of the movement of the mousewheel.
* Negative is down, the higher the number, the faster. Applies to the mousewheel event.
* @property wheelDelta
* @type int
*/
/**
* Stops the propagation to the next bubble target
* @method stopPropagation
*/
/**
* Stops the propagation to the next bubble target and
* prevents any additional listeners from being exectued
* on the current target.
* @method stopImmediatePropagation
*/
/**
* Prevents the event's default behavior
* @method preventDefault
* @param returnValue {string} sets the returnValue of the event to this value
* (rather than the default false value). This can be used to add a customized
* confirmation query to the beforeunload event).
*/
/**
* Stops the event propagation and prevents the default
* event behavior.
* @method halt
* @param immediate {boolean} if true additional listeners
* on the current target will not be executed
*/
(function() {
/**
* DOM event listener abstraction layer
* @module event
* @submodule event-base
*/
/**
* The event utility provides functions to add and remove event listeners,
* event cleansing. It also tries to automatically remove listeners it
* registers during the unload event.
*
* @class Event
* @static
*/
Y.Env.evt.dom_wrappers = {};
Y.Env.evt.dom_map = {};
var _eventenv = Y.Env.evt,
config = Y.config,
win = config.win,
add = YUI.Env.add,
remove = YUI.Env.remove,
onLoad = function() {
YUI.Env.windowLoaded = true;
Y.Event._load();
remove(win, "load", onLoad);
},
onUnload = function() {
Y.Event._unload();
},
EVENT_READY = 'domready',
COMPAT_ARG = '~yui|2|compat~',
shouldIterate = function(o) {
try {
return (o && typeof o !== "string" && Y.Lang.isNumber(o.length) &&
!o.tagName && !o.alert);
} catch(ex) {
return false;
}
},
// aliases to support DOM event subscription clean up when the last
// subscriber is detached. deleteAndClean overrides the DOM event's wrapper
// CustomEvent _delete method.
_ceProtoDelete = Y.CustomEvent.prototype._delete,
_deleteAndClean = function(s) {
var ret = _ceProtoDelete.apply(this, arguments);
if (!this.subCount && !this.afterCount) {
Y.Event._clean(this);
}
return ret;
},
Event = function() {
/**
* True after the onload event has fired
* @property _loadComplete
* @type boolean
* @static
* @private
*/
var _loadComplete = false,
/**
* The number of times to poll after window.onload. This number is
* increased if additional late-bound handlers are requested after
* the page load.
* @property _retryCount
* @static
* @private
*/
_retryCount = 0,
/**
* onAvailable listeners
* @property _avail
* @static
* @private
*/
_avail = [],
/**
* Custom event wrappers for DOM events. Key is
* 'event:' + Element uid stamp + event type
* @property _wrappers
* @type Y.Event.Custom
* @static
* @private
*/
_wrappers = _eventenv.dom_wrappers,
_windowLoadKey = null,
/**
* Custom event wrapper map DOM events. Key is
* Element uid stamp. Each item is a hash of custom event
* wrappers as provided in the _wrappers collection. This
* provides the infrastructure for getListeners.
* @property _el_events
* @static
* @private
*/
_el_events = _eventenv.dom_map;
return {
/**
* The number of times we should look for elements that are not
* in the DOM at the time the event is requested after the document
* has been loaded. The default is 1000@amp;40 ms, so it will poll
* for 40 seconds or until all outstanding handlers are bound
* (whichever comes first).
* @property POLL_RETRYS
* @type int
* @static
* @final
*/
POLL_RETRYS: 1000,
/**
* The poll interval in milliseconds
* @property POLL_INTERVAL
* @type int
* @static
* @final
*/
POLL_INTERVAL: 40,
/**
* addListener/removeListener can throw errors in unexpected scenarios.
* These errors are suppressed, the method returns false, and this property
* is set
* @property lastError
* @static
* @type Error
*/
lastError: null,
/**
* poll handle
* @property _interval
* @static
* @private
*/
_interval: null,
/**
* document readystate poll handle
* @property _dri
* @static
* @private
*/
_dri: null,
/**
* True when the document is initially usable
* @property DOMReady
* @type boolean
* @static
*/
DOMReady: false,
/**
* @method startInterval
* @static
* @private
*/
startInterval: function() {
if (!Event._interval) {
Event._interval = setInterval(Event._poll, Event.POLL_INTERVAL);
}
},
/**
* Executes the supplied callback when the item with the supplied
* id is found. This is meant to be used to execute behavior as
* soon as possible as the page loads. If you use this after the
* initial page load it will poll for a fixed time for the element.
* The number of times it will poll and the frequency are
* configurable. By default it will poll for 10 seconds.
*
* <p>The callback is executed with a single parameter:
* the custom object parameter, if provided.</p>
*
* @method onAvailable
*
* @param {string||string[]} id the id of the element, or an array
* of ids to look for.
* @param {function} fn what to execute when the element is found.
* @param {object} p_obj an optional object to be passed back as
* a parameter to fn.
* @param {boolean|object} p_override If set to true, fn will execute
* in the context of p_obj, if set to an object it
* will execute in the context of that object
* @param checkContent {boolean} check child node readiness (onContentReady)
* @static
* @deprecated Use Y.on("available")
*/
// @TODO fix arguments
onAvailable: function(id, fn, p_obj, p_override, checkContent, compat) {
var a = Y.Array(id), i, availHandle;
for (i=0; i<a.length; i=i+1) {
_avail.push({
id: a[i],
fn: fn,
obj: p_obj,
override: p_override,
checkReady: checkContent,
compat: compat
});
}
_retryCount = this.POLL_RETRYS;
// We want the first test to be immediate, but async
setTimeout(Event._poll, 0);
availHandle = new Y.EventHandle({
_delete: function() {
// set by the event system for lazy DOM listeners
if (availHandle.handle) {
availHandle.handle.detach();
return;
}
var i, j;
// otherwise try to remove the onAvailable listener(s)
for (i = 0; i < a.length; i++) {
for (j = 0; j < _avail.length; j++) {
if (a[i] === _avail[j].id) {
_avail.splice(j, 1);
}
}
}
}
});
return availHandle;
},
/**
* Works the same way as onAvailable, but additionally checks the
* state of sibling elements to determine if the content of the
* available element is safe to modify.
*
* <p>The callback is executed with a single parameter:
* the custom object parameter, if provided.</p>
*
* @method onContentReady
*
* @param {string} id the id of the element to look for.
* @param {function} fn what to execute when the element is ready.
* @param {object} obj an optional object to be passed back as
* a parameter to fn.
* @param {boolean|object} override If set to true, fn will execute
* in the context of p_obj. If an object, fn will
* exectute in the context of that object
*
* @static
* @deprecated Use Y.on("contentready")
*/
// @TODO fix arguments
onContentReady: function(id, fn, obj, override, compat) {
return Event.onAvailable(id, fn, obj, override, true, compat);
},
/**
* Adds an event listener
*
* @method attach
*
* @param {String} type The type of event to append
* @param {Function} fn The method the event invokes
* @param {String|HTMLElement|Array|NodeList} el An id, an element
* reference, or a collection of ids and/or elements to assign the
* listener to.
* @param {Object} context optional context object
* @param {Boolean|object} args 0..n arguments to pass to the callback
* @return {EventHandle} an object to that can be used to detach the listener
*
* @static
*/
attach: function(type, fn, el, context) {
return Event._attach(Y.Array(arguments, 0, true));
},
_createWrapper: function (el, type, capture, compat, facade) {
var cewrapper,
ek = Y.stamp(el),
key = 'event:' + ek + type;
if (false === facade) {
key += 'native';
}
if (capture) {
key += 'capture';
}
cewrapper = _wrappers[key];
if (!cewrapper) {
// create CE wrapper
cewrapper = Y.publish(key, {
silent: true,
bubbles: false,
contextFn: function() {
if (compat) {
return cewrapper.el;
} else {
cewrapper.nodeRef = cewrapper.nodeRef || Y.one(cewrapper.el);
return cewrapper.nodeRef;
}
}
});
cewrapper.overrides = {};
// for later removeListener calls
cewrapper.el = el;
cewrapper.key = key;
cewrapper.domkey = ek;
cewrapper.type = type;
cewrapper.fn = function(e) {
cewrapper.fire(Event.getEvent(e, el, (compat || (false === facade))));
};
cewrapper.capture = capture;
if (el == win && type == "load") {
// window load happens once
cewrapper.fireOnce = true;
_windowLoadKey = key;
}
cewrapper._delete = _deleteAndClean;
_wrappers[key] = cewrapper;
_el_events[ek] = _el_events[ek] || {};
_el_events[ek][key] = cewrapper;
add(el, type, cewrapper.fn, capture);
}
return cewrapper;
},
_attach: function(args, conf) {
var compat,
handles, oEl, cewrapper, context,
fireNow = false, ret,
type = args[0],
fn = args[1],
el = args[2] || win,
facade = conf && conf.facade,
capture = conf && conf.capture,
overrides = conf && conf.overrides;
if (args[args.length-1] === COMPAT_ARG) {
compat = true;
}
if (!fn || !fn.call) {
// throw new TypeError(type + " attach call failed, callback undefined");
return false;
}
// The el argument can be an array of elements or element ids.
if (shouldIterate(el)) {
handles=[];
Y.each(el, function(v, k) {
args[2] = v;
handles.push(Event._attach(args.slice(), conf));
});
// return (handles.length === 1) ? handles[0] : handles;
return new Y.EventHandle(handles);
// If the el argument is a string, we assume it is
// actually the id of the element. If the page is loaded
// we convert el to the actual element, otherwise we
// defer attaching the event until the element is
// ready
} else if (Y.Lang.isString(el)) {
// oEl = (compat) ? Y.DOM.byId(el) : Y.Selector.query(el);
if (compat) {
oEl = Y.DOM.byId(el);
} else {
oEl = Y.Selector.query(el);
switch (oEl.length) {
case 0:
oEl = null;
break;
case 1:
oEl = oEl[0];
break;
default:
args[2] = oEl;
return Event._attach(args, conf);
}
}
if (oEl) {
el = oEl;
// Not found = defer adding the event until the element is available
} else {
ret = Event.onAvailable(el, function() {
ret.handle = Event._attach(args, conf);
}, Event, true, false, compat);
return ret;
}
}
// Element should be an html element or node
if (!el) {
return false;
}
if (Y.Node && Y.instanceOf(el, Y.Node)) {
el = Y.Node.getDOMNode(el);
}
cewrapper = Event._createWrapper(el, type, capture, compat, facade);
if (overrides) {
Y.mix(cewrapper.overrides, overrides);
}
if (el == win && type == "load") {
// if the load is complete, fire immediately.
// all subscribers, including the current one
// will be notified.
if (YUI.Env.windowLoaded) {
fireNow = true;
}
}
if (compat) {
args.pop();
}
context = args[3];
// set context to the Node if not specified
// ret = cewrapper.on.apply(cewrapper, trimmedArgs);
ret = cewrapper._on(fn, context, (args.length > 4) ? args.slice(4) : null);
if (fireNow) {
cewrapper.fire();
}
return ret;
},
/**
* Removes an event listener. Supports the signature the event was bound
* with, but the preferred way to remove listeners is using the handle
* that is returned when using Y.on
*
* @method detach
*
* @param {String} type the type of event to remove.
* @param {Function} fn the method the event invokes. If fn is
* undefined, then all event handlers for the type of event are
* removed.
* @param {String|HTMLElement|Array|NodeList|EventHandle} el An
* event handle, an id, an element reference, or a collection
* of ids and/or elements to remove the listener from.
* @return {boolean} true if the unbind was successful, false otherwise.
* @static
*/
detach: function(type, fn, el, obj) {
var args=Y.Array(arguments, 0, true), compat, l, ok, i,
id, ce;
if (args[args.length-1] === COMPAT_ARG) {
compat = true;
// args.pop();
}
if (type && type.detach) {
return type.detach();
}
// The el argument can be a string
if (typeof el == "string") {
// el = (compat) ? Y.DOM.byId(el) : Y.all(el);
if (compat) {
el = Y.DOM.byId(el);
} else {
el = Y.Selector.query(el);
l = el.length;
if (l < 1) {
el = null;
} else if (l == 1) {
el = el[0];
}
}
// return Event.detach.apply(Event, args);
}
if (!el) {
return false;
}
if (el.detach) {
args.splice(2, 1);
return el.detach.apply(el, args);
// The el argument can be an array of elements or element ids.
} else if (shouldIterate(el)) {
ok = true;
for (i=0, l=el.length; i<l; ++i) {
args[2] = el[i];
ok = ( Y.Event.detach.apply(Y.Event, args) && ok );
}
return ok;
}
if (!type || !fn || !fn.call) {
return Event.purgeElement(el, false, type);
}
id = 'event:' + Y.stamp(el) + type;
ce = _wrappers[id];
if (ce) {
return ce.detach(fn);
} else {
return false;
}
},
/**
* Finds the event in the window object, the caller's arguments, or
* in the arguments of another method in the callstack. This is
* executed automatically for events registered through the event
* manager, so the implementer should not normally need to execute
* this function at all.
* @method getEvent
* @param {Event} e the event parameter from the handler
* @param {HTMLElement} el the element the listener was attached to
* @return {Event} the event
* @static
*/
getEvent: function(e, el, noFacade) {
var ev = e || win.event;
return (noFacade) ? ev :
new Y.DOMEventFacade(ev, el, _wrappers['event:' + Y.stamp(el) + e.type]);
},
/**
* Generates an unique ID for the element if it does not already
* have one.
* @method generateId
* @param el the element to create the id for
* @return {string} the resulting id of the element
* @static
*/
generateId: function(el) {
return Y.DOM.generateID(el);
},
/**
* We want to be able to use getElementsByTagName as a collection
* to attach a group of events to. Unfortunately, different
* browsers return different types of collections. This function
* tests to determine if the object is array-like. It will also
* fail if the object is an array, but is empty.
* @method _isValidCollection
* @param o the object to test
* @return {boolean} true if the object is array-like and populated
* @deprecated was not meant to be used directly
* @static
* @private
*/
_isValidCollection: shouldIterate,
/**
* hook up any deferred listeners
* @method _load
* @static
* @private
*/
_load: function(e) {
if (!_loadComplete) {
_loadComplete = true;
// Just in case DOMReady did not go off for some reason
// E._ready();
if (Y.fire) {
Y.fire(EVENT_READY);
}
// Available elements may not have been detected before the
// window load event fires. Try to find them now so that the
// the user is more likely to get the onAvailable notifications
// before the window load notification
Event._poll();
}
},
/**
* Polling function that runs before the onload event fires,
* attempting to attach to DOM Nodes as soon as they are
* available
* @method _poll
* @static
* @private
*/
_poll: function() {
if (Event.locked) {
return;
}
if (Y.UA.ie && !YUI.Env.DOMReady) {
// Hold off if DOMReady has not fired and check current
// readyState to protect against the IE operation aborted
// issue.
Event.startInterval();
return;
}
Event.locked = true;
// keep trying until after the page is loaded. We need to
// check the page load state prior to trying to bind the
// elements so that we can be certain all elements have been
// tested appropriately
var i, len, item, el, notAvail, executeItem,
tryAgain = !_loadComplete;
if (!tryAgain) {
tryAgain = (_retryCount > 0);
}
// onAvailable
notAvail = [];
executeItem = function (el, item) {
var context, ov = item.override;
if (item.compat) {
if (item.override) {
if (ov === true) {
context = item.obj;
} else {
context = ov;
}
} else {
context = el;
}
item.fn.call(context, item.obj);
} else {
context = item.obj || Y.one(el);
item.fn.apply(context, (Y.Lang.isArray(ov)) ? ov : []);
}
};
// onAvailable
for (i=0,len=_avail.length; i<len; ++i) {
item = _avail[i];
if (item && !item.checkReady) {
// el = (item.compat) ? Y.DOM.byId(item.id) : Y.one(item.id);
el = (item.compat) ? Y.DOM.byId(item.id) : Y.Selector.query(item.id, null, true);
if (el) {
executeItem(el, item);
_avail[i] = null;
} else {
notAvail.push(item);
}
}
}
// onContentReady
for (i=0,len=_avail.length; i<len; ++i) {
item = _avail[i];
if (item && item.checkReady) {
// el = (item.compat) ? Y.DOM.byId(item.id) : Y.one(item.id);
el = (item.compat) ? Y.DOM.byId(item.id) : Y.Selector.query(item.id, null, true);
if (el) {
// The element is available, but not necessarily ready
// @todo should we test parentNode.nextSibling?
if (_loadComplete || (el.get && el.get('nextSibling')) || el.nextSibling) {
executeItem(el, item);
_avail[i] = null;
}
} else {
notAvail.push(item);
}
}
}
_retryCount = (notAvail.length === 0) ? 0 : _retryCount - 1;
if (tryAgain) {
// we may need to strip the nulled out items here
Event.startInterval();
} else {
clearInterval(Event._interval);
Event._interval = null;
}
Event.locked = false;
return;
},
/**
* Removes all listeners attached to the given element via addListener.
* Optionally, the node's children can also be purged.
* Optionally, you can specify a specific type of event to remove.
* @method purgeElement
* @param {HTMLElement} el the element to purge
* @param {boolean} recurse recursively purge this element's children
* as well. Use with caution.
* @param {string} type optional type of listener to purge. If
* left out, all listeners will be removed
* @static
*/
purgeElement: function(el, recurse, type) {
// var oEl = (Y.Lang.isString(el)) ? Y.one(el) : el,
var oEl = (Y.Lang.isString(el)) ? Y.Selector.query(el, null, true) : el,
lis = Event.getListeners(oEl, type), i, len, children, child;
if (recurse && oEl) {
lis = lis || [];
children = Y.Selector.query('*', oEl);
i = 0;
len = children.length;
for (; i < len; ++i) {
child = Event.getListeners(children[i], type);
if (child) {
lis = lis.concat(child);
}
}
}
if (lis) {
for (i = 0, len = lis.length; i < len; ++i) {
lis[i].detachAll();
}
}
},
/**
* Removes all object references and the DOM proxy subscription for
* a given event for a DOM node.
*
* @method _clean
* @param wrapper {CustomEvent} Custom event proxy for the DOM
* subscription
* @private
* @static
* @since 3.4.0
*/
_clean: function (wrapper) {
var key = wrapper.key,
domkey = wrapper.domkey;
remove(wrapper.el, wrapper.type, wrapper.fn, wrapper.capture);
delete _wrappers[key];
delete Y._yuievt.events[key];
if (_el_events[domkey]) {
delete _el_events[domkey][key];
if (!Y.Object.size(_el_events[domkey])) {
delete _el_events[domkey];
}
}
},
/**
* Returns all listeners attached to the given element via addListener.
* Optionally, you can specify a specific type of event to return.
* @method getListeners
* @param el {HTMLElement|string} the element or element id to inspect
* @param type {string} optional type of listener to return. If
* left out, all listeners will be returned
* @return {Y.Custom.Event} the custom event wrapper for the DOM event(s)
* @static
*/
getListeners: function(el, type) {
var ek = Y.stamp(el, true), evts = _el_events[ek],
results=[] , key = (type) ? 'event:' + ek + type : null,
adapters = _eventenv.plugins;
if (!evts) {
return null;
}
if (key) {
// look for synthetic events
if (adapters[type] && adapters[type].eventDef) {
key += '_synth';
}
if (evts[key]) {
results.push(evts[key]);
}
// get native events as well
key += 'native';
if (evts[key]) {
results.push(evts[key]);
}
} else {
Y.each(evts, function(v, k) {
results.push(v);
});
}
return (results.length) ? results : null;
},
/**
* Removes all listeners registered by pe.event. Called
* automatically during the unload event.
* @method _unload
* @static
* @private
*/
_unload: function(e) {
Y.each(_wrappers, function(v, k) {
if (v.type == 'unload') {
v.fire(e);
}
v.detachAll();
});
remove(win, "unload", onUnload);
},
/**
* Adds a DOM event directly without the caching, cleanup, context adj, etc
*
* @method nativeAdd
* @param {HTMLElement} el the element to bind the handler to
* @param {string} type the type of event handler
* @param {function} fn the callback to invoke
* @param {boolen} capture capture or bubble phase
* @static
* @private
*/
nativeAdd: add,
/**
* Basic remove listener
*
* @method nativeRemove
* @param {HTMLElement} el the element to bind the handler to
* @param {string} type the type of event handler
* @param {function} fn the callback to invoke
* @param {boolen} capture capture or bubble phase
* @static
* @private
*/
nativeRemove: remove
};
}();
Y.Event = Event;
if (config.injected || YUI.Env.windowLoaded) {
onLoad();
} else {
add(win, "load", onLoad);
}
// Process onAvailable/onContentReady items when when the DOM is ready in IE
if (Y.UA.ie) {
Y.on(EVENT_READY, Event._poll);
}
add(win, "unload", onUnload);
Event.Custom = Y.CustomEvent;
Event.Subscriber = Y.Subscriber;
Event.Target = Y.EventTarget;
Event.Handle = Y.EventHandle;
Event.Facade = Y.EventFacade;
Event._poll();
})();
/**
* DOM event listener abstraction layer
* @module event
* @submodule event-base
*/
/**
* Executes the callback as soon as the specified element
* is detected in the DOM. This function expects a selector
* string for the element(s) to detect. If you already have
* an element reference, you don't need this event.
* @event available
* @param type {string} 'available'
* @param fn {function} the callback function to execute.
* @param el {string} an selector for the element(s) to attach
* @param context optional argument that specifies what 'this' refers to.
* @param args* 0..n additional arguments to pass on to the callback function.
* These arguments will be added after the event object.
* @return {EventHandle} the detach handle
* @for YUI
*/
Y.Env.evt.plugins.available = {
on: function(type, fn, id, o) {
var a = arguments.length > 4 ? Y.Array(arguments, 4, true) : null;
return Y.Event.onAvailable.call(Y.Event, id, fn, o, a);
}
};
/**
* Executes the callback as soon as the specified element
* is detected in the DOM with a nextSibling property
* (indicating that the element's children are available).
* This function expects a selector
* string for the element(s) to detect. If you already have
* an element reference, you don't need this event.
* @event contentready
* @param type {string} 'contentready'
* @param fn {function} the callback function to execute.
* @param el {string} an selector for the element(s) to attach.
* @param context optional argument that specifies what 'this' refers to.
* @param args* 0..n additional arguments to pass on to the callback function.
* These arguments will be added after the event object.
* @return {EventHandle} the detach handle
* @for YUI
*/
Y.Env.evt.plugins.contentready = {
on: function(type, fn, id, o) {
var a = arguments.length > 4 ? Y.Array(arguments, 4, true) : null;
return Y.Event.onContentReady.call(Y.Event, id, fn, o, a);
}
};
}, '@VERSION@' ,{requires:['event-custom-base']});
YUI.add('event-delegate', function(Y) {
/**
* Adds event delegation support to the library.
*
* @module event
* @submodule event-delegate
*/
var toArray = Y.Array,
YLang = Y.Lang,
isString = YLang.isString,
isObject = YLang.isObject,
isArray = YLang.isArray,
selectorTest = Y.Selector.test,
detachCategories = Y.Env.evt.handles;
/**
* <p>Sets up event delegation on a container element. The delegated event
* will use a supplied selector or filtering function to test if the event
* references at least one node that should trigger the subscription
* callback.</p>
*
* <p>Selector string filters will trigger the callback if the event originated
* from a node that matches it or is contained in a node that matches it.
* Function filters are called for each Node up the parent axis to the
* subscribing container node, and receive at each level the Node and the event
* object. The function should return true (or a truthy value) if that Node
* should trigger the subscription callback. Note, it is possible for filters
* to match multiple Nodes for a single event. In this case, the delegate
* callback will be executed for each matching Node.</p>
*
* <p>For each matching Node, the callback will be executed with its 'this'
* object set to the Node matched by the filter (unless a specific context was
* provided during subscription), and the provided event's
* <code>currentTarget</code> will also be set to the matching Node. The
* containing Node from which the subscription was originally made can be
* referenced as <code>e.container</code>.
*
* @method delegate
* @param type {String} the event type to delegate
* @param fn {Function} the callback function to execute. This function
* will be provided the event object for the delegated event.
* @param el {String|node} the element that is the delegation container
* @param spec {string|Function} a selector that must match the target of the
* event or a function to test target and its parents for a match
* @param context optional argument that specifies what 'this' refers to.
* @param args* 0..n additional arguments to pass on to the callback function.
* These arguments will be added after the event object.
* @return {EventHandle} the detach handle
* @for YUI
*/
function delegate(type, fn, el, filter) {
var args = toArray(arguments, 0, true),
query = isString(el) ? el : null,
typeBits, synth, container, categories, cat, i, len, handles, handle;
// Support Y.delegate({ click: fnA, key: fnB }, context, filter, ...);
// and Y.delegate(['click', 'key'], fn, context, filter, ...);
if (isObject(type)) {
handles = [];
if (isArray(type)) {
for (i = 0, len = type.length; i < len; ++i) {
args[0] = type[i];
handles.push(Y.delegate.apply(Y, args));
}
} else {
// Y.delegate({'click', fn}, context, filter) =>
// Y.delegate('click', fn, context, filter)
args.unshift(null); // one arg becomes two; need to make space
for (i in type) {
if (type.hasOwnProperty(i)) {
args[0] = i;
args[1] = type[i];
handles.push(Y.delegate.apply(Y, args));
}
}
}
return new Y.EventHandle(handles);
}
typeBits = type.split(/\|/);
if (typeBits.length > 1) {
cat = typeBits.shift();
args[0] = type = typeBits.shift();
}
synth = Y.Node.DOM_EVENTS[type];
if (isObject(synth) && synth.delegate) {
handle = synth.delegate.apply(synth, arguments);
}
if (!handle) {
if (!type || !fn || !el || !filter) {
return;
}
container = (query) ? Y.Selector.query(query, null, true) : el;
if (!container && isString(el)) {
handle = Y.on('available', function () {
Y.mix(handle, Y.delegate.apply(Y, args), true);
}, el);
}
if (!handle && container) {
args.splice(2, 2, container); // remove the filter
handle = Y.Event._attach(args, { facade: false });
handle.sub.filter = filter;
handle.sub._notify = delegate.notifySub;
}
}
if (handle && cat) {
categories = detachCategories[cat] || (detachCategories[cat] = {});
categories = categories[type] || (categories[type] = []);
categories.push(handle);
}
return handle;
}
/**
* Overrides the <code>_notify</code> method on the normal DOM subscription to
* inject the filtering logic and only proceed in the case of a match.
*
* @method delegate.notifySub
* @param thisObj {Object} default 'this' object for the callback
* @param args {Array} arguments passed to the event's <code>fire()</code>
* @param ce {CustomEvent} the custom event managing the DOM subscriptions for
* the subscribed event on the subscribing node.
* @return {Boolean} false if the event was stopped
* @private
* @static
* @since 3.2.0
*/
delegate.notifySub = function (thisObj, args, ce) {
// Preserve args for other subscribers
args = args.slice();
if (this.args) {
args.push.apply(args, this.args);
}
// Only notify subs if the event occurred on a targeted element
var currentTarget = delegate._applyFilter(this.filter, args, ce),
//container = e.currentTarget,
e, i, len, ret;
if (currentTarget) {
// Support multiple matches up the the container subtree
currentTarget = toArray(currentTarget);
// The second arg is the currentTarget, but we'll be reusing this
// facade, replacing the currentTarget for each use, so it doesn't
// matter what element we seed it with.
e = args[0] = new Y.DOMEventFacade(args[0], ce.el, ce);
e.container = Y.one(ce.el);
for (i = 0, len = currentTarget.length; i < len && !e.stopped; ++i) {
e.currentTarget = Y.one(currentTarget[i]);
ret = this.fn.apply(this.context || e.currentTarget, args);
if (ret === false) { // stop further notifications
break;
}
}
return ret;
}
};
/**
* <p>Compiles a selector string into a filter function to identify whether
* Nodes along the parent axis of an event's target should trigger event
* notification.</p>
*
* <p>This function is memoized, so previously compiled filter functions are
* returned if the same selector string is provided.</p>
*
* <p>This function may be useful when defining synthetic events for delegate
* handling.</p>
*
* @method delegate.compileFilter
* @param selector {String} the selector string to base the filtration on
* @return {Function}
* @since 3.2.0
* @static
*/
delegate.compileFilter = Y.cached(function (selector) {
return function (target, e) {
return selectorTest(target._node, selector, e.currentTarget._node);
};
});
/**
* Walks up the parent axis of an event's target, and tests each element
* against a supplied filter function. If any Nodes, including the container,
* satisfy the filter, the delegated callback will be triggered for each.
*
* @method delegate._applyFilter
* @param filter {Function} boolean function to test for inclusion in event
* notification
* @param args {Array} the arguments that would be passed to subscribers
* @param ce {CustomEvent} the DOM event wrapper
* @return {Node|Node[]|undefined} The Node or Nodes that satisfy the filter
* @protected
*/
delegate._applyFilter = function (filter, args, ce) {
var e = args[0],
container = ce.el, // facadeless events in IE, have no e.currentTarget
target = e.target || e.srcElement,
match = [],
isContainer = false;
// Resolve text nodes to their containing element
if (target.nodeType === 3) {
target = target.parentNode;
}
// passing target as the first arg rather than leaving well enough alone
// making 'this' in the filter function refer to the target. This is to
// support bound filter functions.
args.unshift(target);
if (isString(filter)) {
while (target) {
isContainer = (target === container);
if (selectorTest(target, filter, (isContainer ?null: container))) {
match.push(target);
}
if (isContainer) {
break;
}
target = target.parentNode;
}
} else {
// filter functions are implementer code and should receive wrappers
args[0] = Y.one(target);
args[1] = new Y.DOMEventFacade(e, container, ce);
while (target) {
// filter(target, e, extra args...) - this === target
if (filter.apply(args[0], args)) {
match.push(target);
}
if (target === container) {
break;
}
target = target.parentNode;
args[0] = Y.one(target);
}
args[1] = e; // restore the raw DOM event
}
if (match.length <= 1) {
match = match[0]; // single match or undefined
}
// remove the target
args.shift();
return match;
};
/**
* Sets up event delegation on a container element. The delegated event
* will use a supplied filter to test if the callback should be executed.
* This filter can be either a selector string or a function that returns
* a Node to use as the currentTarget for the event.
*
* The event object for the delegated event is supplied to the callback
* function. It is modified slightly in order to support all properties
* that may be needed for event delegation. 'currentTarget' is set to
* the element that matched the selector string filter or the Node returned
* from the filter function. 'container' is set to the element that the
* listener is delegated from (this normally would be the 'currentTarget').
*
* Filter functions will be called with the arguments that would be passed to
* the callback function, including the event object as the first parameter.
* The function should return false (or a falsey value) if the success criteria
* aren't met, and the Node to use as the event's currentTarget and 'this'
* object if they are.
*
* @method delegate
* @param type {string} the event type to delegate
* @param fn {function} the callback function to execute. This function
* will be provided the event object for the delegated event.
* @param el {string|node} the element that is the delegation container
* @param filter {string|function} a selector that must match the target of the
* event or a function that returns a Node or false.
* @param context optional argument that specifies what 'this' refers to.
* @param args* 0..n additional arguments to pass on to the callback function.
* These arguments will be added after the event object.
* @return {EventHandle} the detach handle
* @for YUI
*/
Y.delegate = Y.Event.delegate = delegate;
}, '@VERSION@' ,{requires:['node-base']});
YUI.add('event-synthetic', function(Y) {
/**
* Define new DOM events that can be subscribed to from Nodes.
*
* @module event
* @submodule event-synthetic
*/
var DOMMap = Y.Env.evt.dom_map,
toArray = Y.Array,
YLang = Y.Lang,
isObject = YLang.isObject,
isString = YLang.isString,
isArray = YLang.isArray,
query = Y.Selector.query,
noop = function () {};
/**
* <p>The triggering mechanism used by SyntheticEvents.</p>
*
* <p>Implementers should not instantiate these directly. Use the Notifier
* provided to the event's implemented <code>on(node, sub, notifier)</code> or
* <code>delegate(node, sub, notifier, filter)</code> methods.</p>
*
* @class SyntheticEvent.Notifier
* @constructor
* @param handle {EventHandle} the detach handle for the subscription to an
* internal custom event used to execute the callback passed to
* on(..) or delegate(..)
* @param emitFacade {Boolean} take steps to ensure the first arg received by
* the subscription callback is an event facade
* @private
* @since 3.2.0
*/
function Notifier(handle, emitFacade) {
this.handle = handle;
this.emitFacade = emitFacade;
}
/**
* <p>Executes the subscription callback, passing the firing arguments as the
* first parameters to that callback. For events that are configured with
* emitFacade=true, it is common practice to pass the triggering DOMEventFacade
* as the first parameter. Barring a proper DOMEventFacade or EventFacade
* (from a CustomEvent), a new EventFacade will be generated. In that case, if
* fire() is called with a simple object, it will be mixed into the facade.
* Otherwise, the facade will be prepended to the callback parameters.</p>
*
* <p>For notifiers provided to delegate logic, the first argument should be an
* object with a "currentTarget" property to identify what object to
* default as 'this' in the callback. Typically this is gleaned from the
* DOMEventFacade or EventFacade, but if configured with emitFacade=false, an
* object must be provided. In that case, the object will be removed from the
* callback parameters.</p>
*
* <p>Additional arguments passed during event subscription will be
* automatically added after those passed to fire().</p>
*
* @method fire
* @param e {EventFacade|DOMEventFacade|Object|any} (see description)
* @param arg* {any} additional arguments received by all subscriptions
* @private
*/
Notifier.prototype.fire = function (e) {
// first arg to delegate notifier should be an object with currentTarget
var args = toArray(arguments, 0, true),
handle = this.handle,
ce = handle.evt,
sub = handle.sub,
thisObj = sub.context,
delegate = sub.filter,
event = e || {},
ret;
if (this.emitFacade) {
if (!e || !e.preventDefault) {
event = ce._getFacade();
if (isObject(e) && !e.preventDefault) {
Y.mix(event, e, true);
args[0] = event;
} else {
args.unshift(event);
}
}
event.type = ce.type;
event.details = args.slice();
if (delegate) {
event.container = ce.host;
}
} else if (delegate && isObject(e) && e.currentTarget) {
args.shift();
}
sub.context = thisObj || event.currentTarget || ce.host;
ret = ce.fire.apply(ce, args);
sub.context = thisObj; // reset for future firing
// to capture callbacks that return false to stopPropagation.
// Useful for delegate implementations
return ret;
};
/**
* Manager object for synthetic event subscriptions to aggregate multiple synths on the same node without colliding with actual DOM subscription entries in the global map of DOM subscriptions. Also facilitates proper cleanup on page unload.
*
* @class SynthRegistry
* @constructor
* @param el {HTMLElement} the DOM element
* @param yuid {String} the yuid stamp for the element
* @param key {String} the generated id token used to identify an event type +
* element in the global DOM subscription map.
* @private
*/
function SynthRegistry(el, yuid, key) {
this.handles = [];
this.el = el;
this.key = key;
this.domkey = yuid;
}
SynthRegistry.prototype = {
constructor: SynthRegistry,
// A few object properties to fake the CustomEvent interface for page
// unload cleanup. DON'T TOUCH!
type : '_synth',
fn : noop,
capture : false,
/**
* Adds a subscription from the Notifier registry.
*
* @method register
* @param handle {EventHandle} the subscription
* @since 3.4.0
*/
register: function (handle) {
handle.evt.registry = this;
this.handles.push(handle);
},
/**
* Removes the subscription from the Notifier registry.
*
* @method _unregisterSub
* @param sub {Subscription} the subscription
* @since 3.4.0
*/
unregister: function (sub) {
var handles = this.handles,
events = DOMMap[this.domkey],
i;
for (i = handles.length - 1; i >= 0; --i) {
if (handles[i].sub === sub) {
handles.splice(i, 1);
break;
}
}
// Clean up left over objects when there are no more subscribers.
if (!handles.length) {
delete events[this.key];
if (!Y.Object.size(events)) {
delete DOMMap[this.domkey];
}
}
},
/**
* Used by the event system's unload cleanup process. When navigating
* away from the page, the event system iterates the global map of element
* subscriptions and detaches everything using detachAll(). Normally,
* the map is populated with custom events, so this object needs to
* at least support the detachAll method to duck type its way to
* cleanliness.
*
* @method detachAll
* @private
* @since 3.4.0
*/
detachAll : function () {
var handles = this.handles,
i = handles.length;
while (--i >= 0) {
handles[i].detach();
}
}
};
/**
* <p>Wrapper class for the integration of new events into the YUI event
* infrastructure. Don't instantiate this object directly, use
* <code>Y.Event.define(type, config)</code>. See that method for details.</p>
*
* <p>Properties that MAY or SHOULD be specified in the configuration are noted
* below and in the description of <code>Y.Event.define</code>.</p>
*
* @class SyntheticEvent
* @constructor
* @param cfg {Object} Implementation pieces and configuration
* @since 3.1.0
* @in event-synthetic
*/
function SyntheticEvent() {
this._init.apply(this, arguments);
}
Y.mix(SyntheticEvent, {
Notifier: Notifier,
SynthRegistry: SynthRegistry,
/**
* Returns the array of subscription handles for a node for the given event
* type. Passing true as the third argument will create a registry entry
* in the event system's DOM map to host the array if one doesn't yet exist.
*
* @method getRegistry
* @param node {Node} the node
* @param type {String} the event
* @param create {Boolean} create a registration entry to host a new array
* if one doesn't exist.
* @return {Array}
* @static
* @protected
* @since 3.2.0
*/
getRegistry: function (node, type, create) {
var el = node._node,
yuid = Y.stamp(el),
key = 'event:' + yuid + type + '_synth',
events = DOMMap[yuid];
if (create) {
if (!events) {
events = DOMMap[yuid] = {};
}
if (!events[key]) {
events[key] = new SynthRegistry(el, yuid, key);
}
}
return (events && events[key]) || null;
},
/**
* Alternate <code>_delete()</code> method for the CustomEvent object
* created to manage SyntheticEvent subscriptions.
*
* @method _deleteSub
* @param sub {Subscription} the subscription to clean up
* @private
* @since 3.2.0
*/
_deleteSub: function (sub) {
if (sub && sub.fn) {
var synth = this.eventDef,
method = (sub.filter) ? 'detachDelegate' : 'detach';
this.subscribers = {};
this.subCount = 0;
synth[method](sub.node, sub, this.notifier, sub.filter);
this.registry.unregister(sub);
delete sub.fn;
delete sub.node;
delete sub.context;
}
},
prototype: {
constructor: SyntheticEvent,
/**
* Construction logic for the event.
*
* @method _init
* @protected
*/
_init: function () {
var config = this.publishConfig || (this.publishConfig = {});
// The notification mechanism handles facade creation
this.emitFacade = ('emitFacade' in config) ?
config.emitFacade :
true;
config.emitFacade = false;
},
/**
* <p>Implementers MAY provide this method definition.</p>
*
* <p>Implement this function if the event supports a different
* subscription signature. This function is used by both
* <code>on()</code> and <code>delegate()</code>. The second parameter
* indicates that the event is being subscribed via
* <code>delegate()</code>.</p>
*
* <p>Implementations must remove extra arguments from the args list
* before returning. The required args for <code>on()</code>
* subscriptions are</p>
* <pre><code>[type, callback, target, context, argN...]</code></pre>
*
* <p>The required args for <code>delegate()</code>
* subscriptions are</p>
*
* <pre><code>[type, callback, target, filter, context, argN...]</code></pre>
*
* <p>The return value from this function will be stored on the
* subscription in the '_extra' property for reference elsewhere.</p>
*
* @method processArgs
* @param args {Array} parmeters passed to Y.on(..) or Y.delegate(..)
* @param delegate {Boolean} true if the subscription is from Y.delegate
* @return {any}
*/
processArgs: noop,
/**
* <p>Implementers MAY override this property.</p>
*
* <p>Whether to prevent multiple subscriptions to this event that are
* classified as being the same. By default, this means the subscribed
* callback is the same function. See the <code>subMatch</code>
* method. Setting this to true will impact performance for high volume
* events.</p>
*
* @property preventDups
* @type {Boolean}
* @default false
*/
//preventDups : false,
/**
* <p>Implementers SHOULD provide this method definition.</p>
*
* Implementation logic for subscriptions done via <code>node.on(type,
* fn)</code> or <code>Y.on(type, fn, target)</code>. This
* function should set up the monitor(s) that will eventually fire the
* event. Typically this involves subscribing to at least one DOM
* event. It is recommended to store detach handles from any DOM
* subscriptions to make for easy cleanup in the <code>detach</code>
* method. Typically these handles are added to the <code>sub</code>
* object. Also for SyntheticEvents that leverage a single DOM
* subscription under the hood, it is recommended to pass the DOM event
* object to <code>notifier.fire(e)</code>. (The event name on the
* object will be updated).
*
* @method on
* @param node {Node} the node the subscription is being applied to
* @param sub {Subscription} the object to track this subscription
* @param notifier {SyntheticEvent.Notifier} call notifier.fire(..) to
* trigger the execution of the subscribers
*/
on: noop,
/**
* <p>Implementers SHOULD provide this method definition.</p>
*
* <p>Implementation logic for detaching subscriptions done via
* <code>node.on(type, fn)</code>. This function should clean up any
* subscriptions made in the <code>on()</code> phase.</p>
*
* @method detach
* @param node {Node} the node the subscription was applied to
* @param sub {Subscription} the object tracking this subscription
* @param notifier {SyntheticEvent.Notifier} the Notifier used to
* trigger the execution of the subscribers
*/
detach: noop,
/**
* <p>Implementers SHOULD provide this method definition.</p>
*
* <p>Implementation logic for subscriptions done via
* <code>node.delegate(type, fn, filter)</code> or
* <code>Y.delegate(type, fn, container, filter)</code>. Like with
* <code>on()</code> above, this function should monitor the environment
* for the event being fired, and trigger subscription execution by
* calling <code>notifier.fire(e)</code>.</p>
*
* <p>This function receives a fourth argument, which is the filter
* used to identify which Node's are of interest to the subscription.
* The filter will be either a boolean function that accepts a target
* Node for each hierarchy level as the event bubbles, or a selector
* string. To translate selector strings into filter functions, use
* <code>Y.delegate.compileFilter(filter)</code>.</p>
*
* @method delegate
* @param node {Node} the node the subscription is being applied to
* @param sub {Subscription} the object to track this subscription
* @param notifier {SyntheticEvent.Notifier} call notifier.fire(..) to
* trigger the execution of the subscribers
* @param filter {String|Function} Selector string or function that
* accepts an event object and returns null, a Node, or an
* array of Nodes matching the criteria for processing.
* @since 3.2.0
*/
delegate : noop,
/**
* <p>Implementers SHOULD provide this method definition.</p>
*
* <p>Implementation logic for detaching subscriptions done via
* <code>node.delegate(type, fn, filter)</code> or
* <code>Y.delegate(type, fn, container, filter)</code>. This function
* should clean up any subscriptions made in the
* <code>delegate()</code> phase.</p>
*
* @method detachDelegate
* @param node {Node} the node the subscription was applied to
* @param sub {Subscription} the object tracking this subscription
* @param notifier {SyntheticEvent.Notifier} the Notifier used to
* trigger the execution of the subscribers
* @param filter {String|Function} Selector string or function that
* accepts an event object and returns null, a Node, or an
* array of Nodes matching the criteria for processing.
* @since 3.2.0
*/
detachDelegate : noop,
/**
* Sets up the boilerplate for detaching the event and facilitating the
* execution of subscriber callbacks.
*
* @method _on
* @param args {Array} array of arguments passed to
* <code>Y.on(...)</code> or <code>Y.delegate(...)</code>
* @param delegate {Boolean} true if called from
* <code>Y.delegate(...)</code>
* @return {EventHandle} the detach handle for this subscription
* @private
* since 3.2.0
*/
_on: function (args, delegate) {
var handles = [],
originalArgs = args.slice(),
extra = this.processArgs(args, delegate),
selector = args[2],
method = delegate ? 'delegate' : 'on',
nodes, handle;
// Can't just use Y.all because it doesn't support window (yet?)
nodes = (isString(selector)) ? query(selector) : toArray(selector);
if (!nodes.length && isString(selector)) {
handle = Y.on('available', function () {
Y.mix(handle, Y[method].apply(Y, originalArgs), true);
}, selector);
return handle;
}
Y.Array.each(nodes, function (node) {
var subArgs = args.slice(),
filter;
node = Y.one(node);
if (node) {
if (delegate) {
filter = subArgs.splice(3, 1)[0];
}
// (type, fn, el, thisObj, ...) => (fn, thisObj, ...)
subArgs.splice(0, 4, subArgs[1], subArgs[3]);
if (!this.preventDups ||
!this.getSubs(node, args, null, true))
{
handles.push(this._subscribe(node, method, subArgs, extra, filter));
}
}
}, this);
return (handles.length === 1) ?
handles[0] :
new Y.EventHandle(handles);
},
/**
* Creates a new Notifier object for use by this event's
* <code>on(...)</code> or <code>delegate(...)</code> implementation
* and register the custom event proxy in the DOM system for cleanup.
*
* @method _subscribe
* @param node {Node} the Node hosting the event
* @param method {String} "on" or "delegate"
* @param args {Array} the subscription arguments passed to either
* <code>Y.on(...)</code> or <code>Y.delegate(...)</code>
* after running through <code>processArgs(args)</code> to
* normalize the argument signature
* @param extra {any} Extra data parsed from
* <code>processArgs(args)</code>
* @param filter {String|Function} the selector string or function
* filter passed to <code>Y.delegate(...)</code> (not
* present when called from <code>Y.on(...)</code>)
* @return {EventHandle}
* @private
* @since 3.2.0
*/
_subscribe: function (node, method, args, extra, filter) {
var dispatcher = new Y.CustomEvent(this.type, this.publishConfig),
handle = dispatcher.on.apply(dispatcher, args),
notifier = new Notifier(handle, this.emitFacade),
registry = SyntheticEvent.getRegistry(node, this.type, true),
sub = handle.sub;
sub.node = node;
sub.filter = filter;
if (extra) {
this.applyArgExtras(extra, sub);
}
Y.mix(dispatcher, {
eventDef : this,
notifier : notifier,
host : node, // I forget what this is for
currentTarget: node, // for generating facades
target : node, // for generating facades
el : node._node, // For category detach
_delete : SyntheticEvent._deleteSub
}, true);
handle.notifier = notifier;
registry.register(handle);
// Call the implementation's "on" or "delegate" method
this[method](node, sub, notifier, filter);
return handle;
},
/**
* <p>Implementers MAY provide this method definition.</p>
*
* <p>Implement this function if you want extra data extracted during
* processArgs to be propagated to subscriptions on a per-node basis.
* That is to say, if you call <code>Y.on('xyz', fn, xtra, 'div')</code>
* the data returned from processArgs will be shared
* across the subscription objects for all the divs. If you want each
* subscription to receive unique information, do that processing
* here.</p>
*
* <p>The default implementation adds the data extracted by processArgs
* to the subscription object as <code>sub._extra</code>.</p>
*
* @method applyArgExtras
* @param extra {any} Any extra data extracted from processArgs
* @param sub {Subscription} the individual subscription
*/
applyArgExtras: function (extra, sub) {
sub._extra = extra;
},
/**
* Removes the subscription(s) from the internal subscription dispatch
* mechanism. See <code>SyntheticEvent._deleteSub</code>.
*
* @method _detach
* @param args {Array} The arguments passed to
* <code>node.detach(...)</code>
* @private
* @since 3.2.0
*/
_detach: function (args) {
// Can't use Y.all because it doesn't support window (yet?)
// TODO: Does Y.all support window now?
var target = args[2],
els = (isString(target)) ?
query(target) : toArray(target),
node, i, len, handles, j;
// (type, fn, el, context, filter?) => (type, fn, context, filter?)
args.splice(2, 1);
for (i = 0, len = els.length; i < len; ++i) {
node = Y.one(els[i]);
if (node) {
handles = this.getSubs(node, args);
if (handles) {
for (j = handles.length - 1; j >= 0; --j) {
handles[j].detach();
}
}
}
}
},
/**
* Returns the detach handles of subscriptions on a node that satisfy a
* search/filter function. By default, the filter used is the
* <code>subMatch</code> method.
*
* @method getSubs
* @param node {Node} the node hosting the event
* @param args {Array} the array of original subscription args passed
* to <code>Y.on(...)</code> (before
* <code>processArgs</code>
* @param filter {Function} function used to identify a subscription
* for inclusion in the returned array
* @param first {Boolean} stop after the first match (used to check for
* duplicate subscriptions)
* @return {EventHandle[]} detach handles for the matching subscriptions
*/
getSubs: function (node, args, filter, first) {
var registry = SyntheticEvent.getRegistry(node, this.type),
handles = [],
allHandles, i, len, handle;
if (registry) {
allHandles = registry.handles;
if (!filter) {
filter = this.subMatch;
}
for (i = 0, len = allHandles.length; i < len; ++i) {
handle = allHandles[i];
if (filter.call(this, handle.sub, args)) {
if (first) {
return handle;
} else {
handles.push(allHandles[i]);
}
}
}
}
return handles.length && handles;
},
/**
* <p>Implementers MAY override this to define what constitutes a
* "same" subscription. Override implementations should
* consider the lack of a comparator as a match, so calling
* <code>getSubs()</code> with no arguments will return all subs.</p>
*
* <p>Compares a set of subscription arguments against a Subscription
* object to determine if they match. The default implementation
* compares the callback function against the second argument passed to
* <code>Y.on(...)</code> or <code>node.detach(...)</code> etc.</p>
*
* @method subMatch
* @param sub {Subscription} the existing subscription
* @param args {Array} the calling arguments passed to
* <code>Y.on(...)</code> etc.
* @return {Boolean} true if the sub can be described by the args
* present
* @since 3.2.0
*/
subMatch: function (sub, args) {
// Default detach cares only about the callback matching
return !args[1] || sub.fn === args[1];
}
}
}, true);
Y.SyntheticEvent = SyntheticEvent;
/**
* <p>Defines a new event in the DOM event system. Implementers are
* responsible for monitoring for a scenario whereby the event is fired. A
* notifier object is provided to the functions identified below. When the
* criteria defining the event are met, call notifier.fire( [args] ); to
* execute event subscribers.</p>
*
* <p>The first parameter is the name of the event. The second parameter is a
* configuration object which define the behavior of the event system when the
* new event is subscribed to or detached from. The methods that should be
* defined in this configuration object are <code>on</code>,
* <code>detach</code>, <code>delegate</code>, and <code>detachDelegate</code>.
* You are free to define any other methods or properties needed to define your
* event. Be aware, however, that since the object is used to subclass
* SyntheticEvent, you should avoid method names used by SyntheticEvent unless
* your intention is to override the default behavior.</p>
*
* <p>This is a list of properties and methods that you can or should specify
* in the configuration object:</p>
*
* <dl>
* <dt><code>on</code></dt>
* <dd><code>function (node, subscription, notifier)</code> The
* implementation logic for subscription. Any special setup you need to
* do to create the environment for the event being fired--E.g. native
* DOM event subscriptions. Store subscription related objects and
* state on the <code>subscription</code> object. When the
* criteria have been met to fire the synthetic event, call
* <code>notifier.fire(e)</code>. See Notifier's <code>fire()</code>
* method for details about what to pass as parameters.</dd>
*
* <dt><code>detach</code></dt>
* <dd><code>function (node, subscription, notifier)</code> The
* implementation logic for cleaning up a detached subscription. E.g.
* detach any DOM subscriptions added in <code>on</code>.</dd>
*
* <dt><code>delegate</code></dt>
* <dd><code>function (node, subscription, notifier, filter)</code> The
* implementation logic for subscription via <code>Y.delegate</code> or
* <code>node.delegate</code>. The filter is typically either a selector
* string or a function. You can use
* <code>Y.delegate.compileFilter(selectorString)</code> to create a
* filter function from a selector string if needed. The filter function
* expects an event object as input and should output either null, a
* matching Node, or an array of matching Nodes. Otherwise, this acts
* like <code>on</code> DOM event subscriptions. Store subscription
* related objects and information on the <code>subscription</code>
* object. When the criteria have been met to fire the synthetic event,
* call <code>notifier.fire(e)</code> as noted above.</dd>
*
* <dt><code>detachDelegate</code></dt>
* <dd><code>function (node, subscription, notifier)</code> The
* implementation logic for cleaning up a detached delegate subscription.
* E.g. detach any DOM delegate subscriptions added in
* <code>delegate</code>.</dd>
*
* <dt><code>publishConfig</code></dt>
* <dd>(Object) The configuration object that will be used to instantiate
* the underlying CustomEvent. See Notifier's <code>fire</code> method
* for details.</dd>
*
* <dt><code>processArgs</code></dt
* <dd>
* <p><code>function (argArray, fromDelegate)</code> Optional method
* to extract any additional arguments from the subscription
* signature. Using this allows <code>on</code> or
* <code>delegate</code> signatures like
* <code>node.on("hover", overCallback,
* outCallback)</code>.</p>
* <p>When processing an atypical argument signature, make sure the
* args array is returned to the normal signature before returning
* from the function. For example, in the "hover" example
* above, the <code>outCallback</code> needs to be <code>splice</code>d
* out of the array. The expected signature of the args array for
* <code>on()</code> subscriptions is:</p>
* <pre>
* <code>[type, callback, target, contextOverride, argN...]</code>
* </pre>
* <p>And for <code>delegate()</code>:</p>
* <pre>
* <code>[type, callback, target, filter, contextOverride, argN...]</code>
* </pre>
* <p>where <code>target</code> is the node the event is being
* subscribed for. You can see these signatures documented for
* <code>Y.on()</code> and <code>Y.delegate()</code> respectively.</p>
* <p>Whatever gets returned from the function will be stored on the
* <code>subscription</code> object under
* <code>subscription._extra</code>.</p></dd>
* <dt><code>subMatch</code></dt>
* <dd>
* <p><code>function (sub, args)</code> Compares a set of
* subscription arguments against a Subscription object to determine
* if they match. The default implementation compares the callback
* function against the second argument passed to
* <code>Y.on(...)</code> or <code>node.detach(...)</code> etc.</p>
* </dd>
* </dl>
*
* @method Event.define
* @param type {String} the name of the event
* @param config {Object} the prototype definition for the new event (see above)
* @param force {Boolean} override an existing event (use with caution)
* @static
* @return {SyntheticEvent} the subclass implementation instance created to
* handle event subscriptions of this type
* @for Event
* @since 3.1.0
* @in event-synthetic
*/
Y.Event.define = function (type, config, force) {
var eventDef, Impl, synth;
if (config) {
eventDef = (isObject(type)) ? type : Y.merge({ type: type }, config);
if (force || !Y.Node.DOM_EVENTS[eventDef.type]) {
Impl = function () {
SyntheticEvent.apply(this, arguments);
};
Y.extend(Impl, SyntheticEvent, eventDef);
synth = new Impl();
type = synth.type;
Y.Node.DOM_EVENTS[type] = Y.Env.evt.plugins[type] = {
eventDef: synth,
on: function () {
return synth._on(toArray(arguments));
},
delegate: function () {
return synth._on(toArray(arguments), true);
},
detach: function () {
return synth._detach(toArray(arguments));
}
};
}
} else if (isString(type) || isArray(type)) {
Y.Array.each(toArray(type), function (t) {
Y.Node.DOM_EVENTS[t] = 1;
});
}
return synth;
};
}, '@VERSION@' ,{requires:['node-base', 'event-custom-complex']});
YUI.add('event-mousewheel', function(Y) {
/**
* Adds mousewheel event support
* @module event
* @submodule event-mousewheel
*/
var DOM_MOUSE_SCROLL = 'DOMMouseScroll',
fixArgs = function(args) {
var a = Y.Array(args, 0, true), target;
if (Y.UA.gecko) {
a[0] = DOM_MOUSE_SCROLL;
target = Y.config.win;
} else {
target = Y.config.doc;
}
if (a.length < 3) {
a[2] = target;
} else {
a.splice(2, 0, target);
}
return a;
};
/**
* Mousewheel event. This listener is automatically attached to the
* correct target, so one should not be supplied. Mouse wheel
* direction and velocity is stored in the 'mouseDelta' field.
* @event mousewheel
* @param type {string} 'mousewheel'
* @param fn {function} the callback to execute
* @param context optional context object
* @param args 0..n additional arguments to provide to the listener.
* @return {EventHandle} the detach handle
* @for YUI
*/
Y.Env.evt.plugins.mousewheel = {
on: function() {
return Y.Event._attach(fixArgs(arguments));
},
detach: function() {
return Y.Event.detach.apply(Y.Event, fixArgs(arguments));
}
};
}, '@VERSION@' ,{requires:['node-base']});
YUI.add('event-mouseenter', function(Y) {
/**
* <p>Adds subscription and delegation support for mouseenter and mouseleave
* events. Unlike mouseover and mouseout, these events aren't fired from child
* elements of a subscribed node.</p>
*
* <p>This avoids receiving three mouseover notifications from a setup like</p>
*
* <pre><code>div#container > p > a[href]</code></pre>
*
* <p>where</p>
*
* <pre><code>Y.one('#container').on('mouseover', callback)</code></pre>
*
* <p>When the mouse moves over the link, one mouseover event is fired from
* #container, then when the mouse moves over the p, another mouseover event is
* fired and bubbles to #container, causing a second notification, and finally
* when the mouse moves over the link, a third mouseover event is fired and
* bubbles to #container for a third notification.</p>
*
* <p>By contrast, using mouseenter instead of mouseover, the callback would be
* executed only once when the mouse moves over #container.</p>
*
* @module event
* @submodule event-mouseenter
*/
var domEventProxies = Y.Env.evt.dom_wrappers,
contains = Y.DOM.contains,
toArray = Y.Array,
noop = function () {},
config = {
proxyType: "mouseover",
relProperty: "fromElement",
_notify: function (e, property, notifier) {
var el = this._node,
related = e.relatedTarget || e[property];
if (el !== related && !contains(el, related)) {
notifier.fire(new Y.DOMEventFacade(e, el,
domEventProxies['event:' + Y.stamp(el) + e.type]));
}
},
on: function (node, sub, notifier) {
var el = Y.Node.getDOMNode(node),
args = [
this.proxyType,
this._notify,
el,
null,
this.relProperty,
notifier];
sub.handle = Y.Event._attach(args, { facade: false });
// node.on(this.proxyType, notify, null, notifier);
},
detach: function (node, sub) {
sub.handle.detach();
},
delegate: function (node, sub, notifier, filter) {
var el = Y.Node.getDOMNode(node),
args = [
this.proxyType,
noop,
el,
null,
notifier
];
sub.handle = Y.Event._attach(args, { facade: false });
sub.handle.sub.filter = filter;
sub.handle.sub.relProperty = this.relProperty;
sub.handle.sub._notify = this._filterNotify;
},
_filterNotify: function (thisObj, args, ce) {
args = args.slice();
if (this.args) {
args.push.apply(args, this.args);
}
var currentTarget = Y.delegate._applyFilter(this.filter, args, ce),
related = args[0].relatedTarget || args[0][this.relProperty],
e, i, len, ret, ct;
if (currentTarget) {
currentTarget = toArray(currentTarget);
for (i = 0, len = currentTarget.length && (!e || !e.stopped); i < len; ++i) {
ct = currentTarget[0];
if (!contains(ct, related)) {
if (!e) {
e = new Y.DOMEventFacade(args[0], ct, ce);
e.container = Y.one(ce.el);
}
e.currentTarget = Y.one(ct);
// TODO: where is notifier? args? this.notifier?
ret = args[1].fire(e);
if (ret === false) {
break;
}
}
}
}
return ret;
},
detachDelegate: function (node, sub) {
sub.handle.detach();
}
};
Y.Event.define("mouseenter", config, true);
Y.Event.define("mouseleave", Y.merge(config, {
proxyType: "mouseout",
relProperty: "toElement"
}), true);
}, '@VERSION@' ,{requires:['event-synthetic']});
YUI.add('event-key', function(Y) {
/**
* Functionality to listen for one or more specific key combinations.
* @module event
* @submodule event-key
*/
var ALT = "+alt",
CTRL = "+ctrl",
META = "+meta",
SHIFT = "+shift",
isString = Y.Lang.isString,
trim = Y.Lang.trim,
eventDef = {
KEY_MAP: {
enter : 13,
esc : 27,
backspace: 8,
tab : 9,
pageup : 33,
pagedown : 34
},
_typeRE: /^(up|down|press):/,
processArgs: function (args) {
var spec = args.splice(3,1)[0],
mods = Y.Array.hash(spec.match(/\+(?:alt|ctrl|meta|shift)\b/g) || []),
config = {
type: this._typeRE.test(spec) ? RegExp.$1 : null,
keys: null
},
bits = spec
.replace(/^(?:up|down|press):|\+(alt|ctrl|meta|shift)/g, '')
.split(/,/),
chr, uc, lc, i;
spec = spec.replace(this._typeRE, '');
if (bits.length) {
config.keys = {};
// FIXME: need to support '65,esc' => keypress, keydown
for (i = bits.length - 1; i >= 0; --i) {
chr = trim(bits[i]);
// non-numerics are single characters or key names
if (+chr == chr) {
config.keys[chr] = mods;
} else {
lc = chr.toLowerCase();
if (this.KEY_MAP[lc]) {
config.keys[this.KEY_MAP[lc]] = mods;
// FIXME: '65,enter' defaults to keydown for both
if (!config.type) {
config.type = "down"; // safest
}
} else {
uc = chr.charAt(0).toUpperCase();
lc = lc.charAt(0);
// FIXME: possibly stupid assumption that
// the keycode of the lower case == the
// charcode of the upper case
// a (key:65,char:97), A (key:65,char:65)
config.keys[uc.charCodeAt(0)] =
(lc !== uc && chr === uc) ?
// upper case chars get +shift free
Y.merge(mods, { "+shift": true }) :
mods;
}
}
}
}
if (!config.type) {
config.type = "press";
}
return config;
},
on: function (node, sub, notifier, filter) {
var spec = sub._extra,
type = "key" + spec.type,
keys = spec.keys,
method = (filter) ? "delegate" : "on";
if (keys) {
sub._detach = node[method](type, function (e) {
var key = keys[e.keyCode];
if (key &&
(!key[ALT] || (key[ALT] && e.altKey)) &&
(!key[CTRL] || (key[CTRL] && e.ctrlKey)) &&
(!key[META] || (key[META] && e.metaKey)) &&
(!key[SHIFT] || (key[SHIFT] && e.shiftKey)))
{
notifier.fire(e);
}
}, filter);
} else {
// Pass through to a plain old key(up|down|press)
// Note: this is horribly inefficient, but I can't abort this
// subscription for a simple Y.on('keypress', ...);
sub._detach = node[method](type,
Y.bind(notifier.fire, notifier),
filter);
}
},
detach: function (node, sub, notifier) {
sub._detach.detach();
}
};
eventDef.delegate = eventDef.on;
eventDef.detachDelegate = eventDef.detach;
/**
* <p>Add a key listener. The listener will only be notified if the
* keystroke detected meets the supplied specification. The
* specification is a string that is defined as:</p>
*
* <dl>
* <dt>spec</dt>
* <dd><code>[{type}:]{code}[,{code}]*</dd>
* <dt>type</dt>
* <dd><code>"down", "up", or "press"</code></dd>
* <dt>code</dt>
* <dd><code>{keyCode|character|keyName}[+{modifier}]*</code></dd>
* <dt>modifier</dt>
* <dd><code>"shift", "ctrl", "alt", or "meta"</code></dd>
* <dt>keyName</dt>
* <dd><code>"enter", "backspace", "esc", "tab", "pageup", or "pagedown"</code></dd>
* </dl>
*
* <p>Examples:</p>
* <ul>
* <li><code>Y.on("key", callback, "press:12,65+shift+ctrl", "#my-input");</code></li>
* <li><code>Y.delegate("key", preventSubmit, "enter", "#forms", "input[type=text]");</code></li>
* <li><code>Y.one("doc").on("key", viNav, "j,k,l,;");</code></li>
* </ul>
*
* @event key
* @for YUI
* @param type {string} 'key'
* @param fn {function} the function to execute
* @param id {string|HTMLElement|collection} the element(s) to bind
* @param spec {string} the keyCode and modifier specification
* @param o optional context object
* @param args 0..n additional arguments to provide to the listener.
* @return {Event.Handle} the detach handle
*/
Y.Event.define('key', eventDef, true);
}, '@VERSION@' ,{requires:['event-synthetic']});
YUI.add('event-focus', function(Y) {
/**
* Adds bubbling and delegation support to DOM events focus and blur.
*
* @module event
* @submodule event-focus
*/
var Event = Y.Event,
YLang = Y.Lang,
isString = YLang.isString,
useActivate = YLang.isFunction(
Y.DOM.create('<p onbeforeactivate=";"/>').onbeforeactivate);
function define(type, proxy, directEvent) {
var nodeDataKey = '_' + type + 'Notifiers';
Y.Event.define(type, {
_attach: function (el, notifier, delegate) {
if (Y.DOM.isWindow(el)) {
return Event._attach([type, function (e) {
notifier.fire(e);
}, el]);
} else {
return Event._attach(
[proxy, this._proxy, el, this, notifier, delegate],
{ capture: true });
}
},
_proxy: function (e, notifier, delegate) {
var node = e.target,
notifiers = node.getData(nodeDataKey),
yuid = Y.stamp(e.currentTarget._node),
defer = (useActivate || e.target !== e.currentTarget),
sub = notifier.handle.sub,
filterArgs = [node, e].concat(sub.args || []),
directSub;
notifier.currentTarget = (delegate) ? node : e.currentTarget;
notifier.container = (delegate) ? e.currentTarget : null;
if (!sub.filter || sub.filter.apply(node, filterArgs)) {
// Maintain a list to handle subscriptions from nested
// containers div#a>div#b>input #a.on(focus..) #b.on(focus..),
// use one focus or blur subscription that fires notifiers from
// #b then #a to emulate bubble sequence.
if (!notifiers) {
notifiers = {};
node.setData(nodeDataKey, notifiers);
// only subscribe to the element's focus if the target is
// not the current target (
if (defer) {
directSub = Event._attach(
[directEvent, this._notify, node._node]).sub;
directSub.once = true;
}
}
if (!notifiers[yuid]) {
notifiers[yuid] = [];
}
notifiers[yuid].push(notifier);
if (!defer) {
this._notify(e);
}
}
},
_notify: function (e, container) {
var node = e.currentTarget,
notifiers = node.getData(nodeDataKey),
// document.get('ownerDocument') returns null
doc = node.get('ownerDocument') || node,
target = node,
nots = [],
notifier, i, len;
if (notifiers) {
// Walk up the parent axis until the origin node,
while (target && target !== doc) {
nots.push.apply(nots, notifiers[Y.stamp(target)] || []);
target = target.get('parentNode');
}
nots.push.apply(nots, notifiers[Y.stamp(doc)] || []);
for (i = 0, len = nots.length; i < len; ++i) {
notifier = nots[i];
e.currentTarget = nots[i].currentTarget;
if (notifier.container) {
e.container = notifier.container;
}
notifier.fire(e);
}
// clear the notifications list (mainly for delegation)
node.clearData(nodeDataKey);
}
},
on: function (node, sub, notifier) {
sub.onHandle = this._attach(node._node, notifier);
},
detach: function (node, sub) {
sub.onHandle.detach();
},
delegate: function (node, sub, notifier, filter) {
if (isString(filter)) {
sub.filter = Y.delegate.compileFilter(filter);
}
sub.delegateHandle = this._attach(node._node, notifier, true);
},
detachDelegate: function (node, sub) {
sub.delegateHandle.detach();
}
}, true);
}
// For IE, we need to defer to focusin rather than focus because
// `el.focus(); doSomething();` executes el.onbeforeactivate, el.onactivate,
// el.onfocusin, doSomething, then el.onfocus. All others support capture
// phase focus, which executes before doSomething. To guarantee consistent
// behavior for this use case, IE's direct subscriptions are made against
// focusin so subscribers will be notified before js following el.focus() is
// executed.
if (useActivate) {
// name capture phase direct subscription
define("focus", "beforeactivate", "focusin");
define("blur", "beforedeactivate", "focusout");
} else {
define("focus", "focus", "focus");
define("blur", "blur", "blur");
}
}, '@VERSION@' ,{requires:['event-synthetic']});
YUI.add('event-resize', function(Y) {
/**
* Adds a window resize event that has its behavior normalized to fire at the
* end of the resize rather than constantly during the resize.
* @module event
* @submodule event-resize
*/
(function() {
var detachHandle,
timerHandle,
CE_NAME = 'window:resize',
handler = function(e) {
if (Y.UA.gecko) {
Y.fire(CE_NAME, e);
} else {
if (timerHandle) {
timerHandle.cancel();
}
timerHandle = Y.later(Y.config.windowResizeDelay || 40, Y, function() {
Y.fire(CE_NAME, e);
});
}
};
/**
* Firefox fires the window resize event once when the resize action
* finishes, other browsers fire the event periodically during the
* resize. This code uses timeout logic to simulate the Firefox
* behavior in other browsers.
* @event windowresize
* @for YUI
*/
Y.Env.evt.plugins.windowresize = {
on: function(type, fn) {
// check for single window listener and add if needed
if (!detachHandle) {
detachHandle = Y.Event._attach(['resize', handler]);
}
var a = Y.Array(arguments, 0, true);
a[0] = CE_NAME;
return Y.on.apply(Y, a);
}
};
})();
}, '@VERSION@' ,{requires:['node-base']});
YUI.add('event-hover', function(Y) {
/**
* Adds support for a "hover" event. The event provides a convenience wrapper
* for subscribing separately to mouseenter and mouseleave. The signature for
* subscribing to the event is</p>
*
* <pre><code>node.on("hover", overFn, outFn);
* node.delegate("hover", overFn, outFn, ".filterSelector");
* Y.on("hover", overFn, outFn, ".targetSelector");
* Y.delegate("hover", overFn, outFn, "#container", ".filterSelector");
* </code></pre>
*
* <p>Additionally, for compatibility with a more typical subscription
* signature, the following are also supported:</p>
*
* <pre><code>Y.on("hover", overFn, ".targetSelector", outFn);
* Y.delegate("hover", overFn, "#container", outFn, ".filterSelector");
* </code></pre>
*
* @module event
* @submodule event-hover
*/
var isFunction = Y.Lang.isFunction,
noop = function () {},
conf = {
processArgs: function (args) {
// Y.delegate('hover', over, out, '#container', '.filter')
// comes in as ['hover', over, out, '#container', '.filter'], but
// node.delegate('hover', over, out, '.filter')
// comes in as ['hover', over, containerEl, out, '.filter']
var i = isFunction(args[2]) ? 2 : 3;
return (isFunction(args[i])) ? args.splice(i,1)[0] : noop;
},
on: function (node, sub, notifier, filter) {
sub._detach = node[(filter) ? "delegate" : "on"]({
mouseenter: function (e) {
e.phase = 'over';
notifier.fire(e);
},
mouseleave: function (e) {
var thisObj = sub.context || this;
e.type = 'hover';
e.phase = 'out';
sub._extra.apply(thisObj, [e].concat(sub.args));
}
}, filter);
},
detach: function (node, sub, notifier) {
sub._detach.detach();
}
};
conf.delegate = conf.on;
conf.detachDelegate = conf.detach;
Y.Event.define("hover", conf);
}, '@VERSION@' ,{requires:['event-mouseenter']});
YUI.add('event', function(Y){}, '@VERSION@' ,{use:['event-base', 'event-delegate', 'event-synthetic', 'event-mousewheel', 'event-mouseenter', 'event-key', 'event-focus', 'event-resize', 'event-hover']});
|
src/components/modals/settings/OtherContractModal.js | Pavel-DV/ChronoMint | import React, {Component} from 'react'
import {connect} from 'react-redux'
import IconButton from 'material-ui/IconButton'
import NavigationClose from 'material-ui/svg-icons/navigation/close'
import {Dialog, FlatButton, RaisedButton} from 'material-ui'
import OtherContractForm from '../../../components/forms/settings/OtherContractForm'
import DAOFactory from '../../../dao/DAOFactory'
import {addContract} from '../../../redux/settings/otherContracts'
import styles from '../styles'
const mapDispatchToProps = (dispatch) => ({
addContract: (address: string) => dispatch(addContract(address, window.localStorage.getItem('chronoBankAccount')))
})
@connect(null, mapDispatchToProps)
class OtherContractModal extends Component {
handleSubmit = (values) => {
this.props.addContract(values.get('address'))
this.handleClose()
};
handleSubmitClick = () => {
this.refs.OtherContractForm.getWrappedInstance().submit()
};
handleClose = () => {
this.props.hideModal()
};
render () {
const {open} = this.props
const actions = [
<FlatButton
label='Cancel'
onTouchTap={this.handleClose}
/>,
<RaisedButton
label={'Add'}
primary
onTouchTap={this.handleSubmitClick.bind(this)}
/>
]
const types = DAOFactory.getOtherDAOsTypes()
let typesNames = []
for (let key in types) {
if (types.hasOwnProperty(key)) {
typesNames.push(DAOFactory.getDAOs()[types[key]].getTypeName())
}
}
return (
<Dialog
title={<div>
{'Add other contract'}
<IconButton style={styles.close} onTouchTap={this.handleClose}><NavigationClose /></IconButton>
</div>}
actions={actions}
actionsContainerStyle={styles.container}
titleStyle={styles.title}
modal
open={open}>
Available types: <b>{typesNames.join(', ')}</b>
<OtherContractForm ref='OtherContractForm' onSubmit={this.handleSubmit} />
</Dialog>
)
}
}
export default OtherContractModal
|
examples/todos-with-undo/index.js | mjasinski5/redux | import React from 'react';
import { createStore } from 'redux';
import { Provider } from 'react-redux';
import App from './containers/App';
import todoApp from './reducers';
const store = createStore(todoApp);
const rootElement = document.getElementById('root');
React.render(
// The child must be wrapped in a function
// to work around an issue in React 0.13.
<Provider store={store}>
{() => <App />}
</Provider>,
rootElement
);
|
vendor/jquery/jquery.js | michaelwartmann/michaelwartmann.github.io | /*!
* jQuery JavaScript Library v1.12.4
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2016-05-20T17:17Z
*/
(function( global, factory ) {
if ( typeof module === "object" && typeof module.exports === "object" ) {
// For CommonJS and CommonJS-like environments where a proper `window`
// is present, execute the factory and get jQuery.
// For environments that do not have a `window` with a `document`
// (such as Node.js), expose a factory as module.exports.
// This accentuates the need for the creation of a real `window`.
// e.g. var jQuery = require("jquery")(window);
// See ticket #14549 for more info.
module.exports = global.document ?
factory( global, true ) :
function( w ) {
if ( !w.document ) {
throw new Error( "jQuery requires a window with a document" );
}
return factory( w );
};
} else {
factory( global );
}
// Pass this if window is not defined yet
}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
// Support: Firefox 18+
// Can't be in strict mode, several libs including ASP.NET trace
// the stack via arguments.caller.callee and Firefox dies if
// you try to trace through "use strict" call chains. (#13335)
//"use strict";
var deletedIds = [];
var document = window.document;
var slice = deletedIds.slice;
var concat = deletedIds.concat;
var push = deletedIds.push;
var indexOf = deletedIds.indexOf;
var class2type = {};
var toString = class2type.toString;
var hasOwn = class2type.hasOwnProperty;
var support = {};
var
version = "1.12.4",
// Define a local copy of jQuery
jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
// Need init if jQuery is called (just allow error to be thrown if not included)
return new jQuery.fn.init( selector, context );
},
// Support: Android<4.1, IE<9
// Make sure we trim BOM and NBSP
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
// Matches dashed string for camelizing
rmsPrefix = /^-ms-/,
rdashAlpha = /-([\da-z])/gi,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
return letter.toUpperCase();
};
jQuery.fn = jQuery.prototype = {
// The current version of jQuery being used
jquery: version,
constructor: jQuery,
// Start with an empty selector
selector: "",
// The default length of a jQuery object is 0
length: 0,
toArray: function() {
return slice.call( this );
},
// 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 just the one element from the set
( num < 0 ? this[ num + this.length ] : this[ num ] ) :
// Return all the elements in a clean array
slice.call( this );
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems ) {
// Build a new jQuery matched element set
var ret = jQuery.merge( this.constructor(), elems );
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
// Return the newly-formed element set
return ret;
},
// Execute a callback for every element in the matched set.
each: function( callback ) {
return jQuery.each( this, callback );
},
map: function( callback ) {
return this.pushStack( jQuery.map( this, function( elem, i ) {
return callback.call( elem, i, elem );
} ) );
},
slice: function() {
return this.pushStack( slice.apply( this, arguments ) );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
eq: function( i ) {
var len = this.length,
j = +i + ( i < 0 ? len : 0 );
return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
},
end: function() {
return this.prevObject || this.constructor();
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: push,
sort: deletedIds.sort,
splice: deletedIds.splice
};
jQuery.extend = jQuery.fn.extend = function() {
var src, copyIsArray, copy, name, options, clone,
target = arguments[ 0 ] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
// skip the boolean and the target
target = arguments[ i ] || {};
i++;
}
// 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 ( i === length ) {
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( {
// Unique for each copy of jQuery on the page
expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
// Assume jQuery is ready without the ready module
isReady: true,
error: function( msg ) {
throw new Error( msg );
},
noop: function() {},
// 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";
},
isWindow: function( obj ) {
/* jshint eqeqeq: false */
return obj != null && obj == obj.window;
},
isNumeric: function( obj ) {
// parseFloat NaNs numeric-cast false positives (null|true|false|"")
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
// subtraction forces infinities to NaN
// adding 1 corrects loss of precision from parseFloat (#15100)
var realStringObj = obj && obj.toString();
return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0;
},
isEmptyObject: function( obj ) {
var name;
for ( name in obj ) {
return false;
}
return true;
},
isPlainObject: function( obj ) {
var key;
// 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;
}
// Support: IE<9
// Handle iteration over inherited properties before own properties.
if ( !support.ownFirst ) {
for ( key in obj ) {
return hasOwn.call( obj, key );
}
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
for ( key in obj ) {}
return key === undefined || hasOwn.call( obj, key );
},
type: function( obj ) {
if ( obj == null ) {
return obj + "";
}
return typeof obj === "object" || typeof obj === "function" ?
class2type[ toString.call( obj ) ] || "object" :
typeof obj;
},
// 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 && jQuery.trim( 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 ); // jscs:ignore requireDotNotation
} )( 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.toLowerCase() === name.toLowerCase();
},
each: function( obj, callback ) {
var length, i = 0;
if ( isArrayLike( obj ) ) {
length = obj.length;
for ( ; i < length; i++ ) {
if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
break;
}
}
} else {
for ( i in obj ) {
if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
break;
}
}
}
return obj;
},
// Support: Android<4.1, IE<9
trim: function( text ) {
return text == null ?
"" :
( text + "" ).replace( rtrim, "" );
},
// results is for internal usage only
makeArray: function( arr, results ) {
var ret = results || [];
if ( arr != null ) {
if ( isArrayLike( Object( arr ) ) ) {
jQuery.merge( ret,
typeof arr === "string" ?
[ arr ] : arr
);
} else {
push.call( ret, arr );
}
}
return ret;
},
inArray: function( elem, arr, i ) {
var len;
if ( arr ) {
if ( indexOf ) {
return indexOf.call( arr, elem, i );
}
len = arr.length;
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
for ( ; i < len; i++ ) {
// Skip accessing in sparse arrays
if ( i in arr && arr[ i ] === elem ) {
return i;
}
}
}
return -1;
},
merge: function( first, second ) {
var len = +second.length,
j = 0,
i = first.length;
while ( j < len ) {
first[ i++ ] = second[ j++ ];
}
// Support: IE<9
// Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists)
if ( len !== len ) {
while ( second[ j ] !== undefined ) {
first[ i++ ] = second[ j++ ];
}
}
first.length = i;
return first;
},
grep: function( elems, callback, invert ) {
var callbackInverse,
matches = [],
i = 0,
length = elems.length,
callbackExpect = !invert;
// Go through the array, only saving the items
// that pass the validator function
for ( ; i < length; i++ ) {
callbackInverse = !callback( elems[ i ], i );
if ( callbackInverse !== callbackExpect ) {
matches.push( elems[ i ] );
}
}
return matches;
},
// arg is for internal usage only
map: function( elems, callback, arg ) {
var length, value,
i = 0,
ret = [];
// Go through the array, translating each of the items to their new values
if ( isArrayLike( elems ) ) {
length = elems.length;
for ( ; i < length; i++ ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret.push( value );
}
}
// Go through every key on the object,
} else {
for ( i in elems ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret.push( value );
}
}
}
// Flatten any nested arrays
return 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 ) {
var args, proxy, tmp;
if ( typeof context === "string" ) {
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
args = slice.call( arguments, 2 );
proxy = function() {
return fn.apply( context || this, 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 || jQuery.guid++;
return proxy;
},
now: function() {
return +( new Date() );
},
// jQuery.support is not used in Core but other projects attach their
// properties to it so it needs to exist.
support: support
} );
// JSHint would error on this code due to the Symbol not being defined in ES5.
// Defining this global in .jshintrc would create a danger of using the global
// unguarded in another place, it seems safer to just disable JSHint for these
// three lines.
/* jshint ignore: start */
if ( typeof Symbol === "function" ) {
jQuery.fn[ Symbol.iterator ] = deletedIds[ Symbol.iterator ];
}
/* jshint ignore: end */
// Populate the class2type map
jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
function( i, name ) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
} );
function isArrayLike( obj ) {
// Support: iOS 8.2 (not reproducible in simulator)
// `in` check used to prevent JIT error (gh-2145)
// hasOwn isn't used here due to false negatives
// regarding Nodelist length in IE
var length = !!obj && "length" in obj && obj.length,
type = jQuery.type( obj );
if ( type === "function" || jQuery.isWindow( obj ) ) {
return false;
}
return type === "array" || length === 0 ||
typeof length === "number" && length > 0 && ( length - 1 ) in obj;
}
var Sizzle =
/*!
* Sizzle CSS Selector Engine v2.2.1
* http://sizzlejs.com/
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2015-10-17
*/
(function( window ) {
var i,
support,
Expr,
getText,
isXML,
tokenize,
compile,
select,
outermostContext,
sortInput,
hasDuplicate,
// Local document vars
setDocument,
document,
docElem,
documentIsHTML,
rbuggyQSA,
rbuggyMatches,
matches,
contains,
// Instance-specific data
expando = "sizzle" + 1 * new Date(),
preferredDoc = window.document,
dirruns = 0,
done = 0,
classCache = createCache(),
tokenCache = createCache(),
compilerCache = createCache(),
sortOrder = function( a, b ) {
if ( a === b ) {
hasDuplicate = true;
}
return 0;
},
// General-purpose constants
MAX_NEGATIVE = 1 << 31,
// Instance methods
hasOwn = ({}).hasOwnProperty,
arr = [],
pop = arr.pop,
push_native = arr.push,
push = arr.push,
slice = arr.slice,
// Use a stripped-down indexOf as it's faster than native
// http://jsperf.com/thor-indexof-vs-for/5
indexOf = function( list, elem ) {
var i = 0,
len = list.length;
for ( ; i < len; i++ ) {
if ( list[i] === elem ) {
return i;
}
}
return -1;
},
booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
// Regular expressions
// http://www.w3.org/TR/css3-selectors/#whitespace
whitespace = "[\\x20\\t\\r\\n\\f]",
// http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
// Operator (capture 2)
"*([*^$|!~]?=)" + whitespace +
// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
"*\\]",
pseudos = ":(" + identifier + ")(?:\\((" +
// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
// 1. quoted (capture 3; capture 4 or capture 5)
"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
// 2. simple (capture 6)
"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
// 3. anything else (capture 2)
".*" +
")\\)|)",
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
rwhitespace = new RegExp( whitespace + "+", "g" ),
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
rpseudo = new RegExp( pseudos ),
ridentifier = new RegExp( "^" + identifier + "$" ),
matchExpr = {
"ID": new RegExp( "^#(" + identifier + ")" ),
"CLASS": new RegExp( "^\\.(" + identifier + ")" ),
"TAG": new RegExp( "^(" + identifier + "|[*])" ),
"ATTR": new RegExp( "^" + attributes ),
"PSEUDO": new RegExp( "^" + pseudos ),
"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
"bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
// For use in libraries implementing .is()
// We use this for POS matching in `select`
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
},
rinputs = /^(?:input|select|textarea|button)$/i,
rheader = /^h\d$/i,
rnative = /^[^{]+\{\s*\[native \w/,
// Easily-parseable/retrievable ID or TAG or CLASS selectors
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
rsibling = /[+~]/,
rescape = /'|\\/g,
// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
funescape = function( _, escaped, escapedWhitespace ) {
var high = "0x" + escaped - 0x10000;
// NaN means non-codepoint
// Support: Firefox<24
// Workaround erroneous numeric interpretation of +"0x"
return high !== high || escapedWhitespace ?
escaped :
high < 0 ?
// BMP codepoint
String.fromCharCode( high + 0x10000 ) :
// Supplemental Plane codepoint (surrogate pair)
String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
},
// Used for iframes
// See setDocument()
// Removing the function wrapper causes a "Permission Denied"
// error in IE
unloadHandler = function() {
setDocument();
};
// Optimize for push.apply( _, NodeList )
try {
push.apply(
(arr = slice.call( preferredDoc.childNodes )),
preferredDoc.childNodes
);
// Support: Android<4.0
// Detect silently failing push.apply
arr[ preferredDoc.childNodes.length ].nodeType;
} catch ( e ) {
push = { apply: arr.length ?
// Leverage slice if possible
function( target, els ) {
push_native.apply( target, slice.call(els) );
} :
// Support: IE<9
// Otherwise append directly
function( target, els ) {
var j = target.length,
i = 0;
// Can't trust NodeList.length
while ( (target[j++] = els[i++]) ) {}
target.length = j - 1;
}
};
}
function Sizzle( selector, context, results, seed ) {
var m, i, elem, nid, nidselect, match, groups, newSelector,
newContext = context && context.ownerDocument,
// nodeType defaults to 9, since context defaults to document
nodeType = context ? context.nodeType : 9;
results = results || [];
// Return early from calls with invalid selector or context
if ( typeof selector !== "string" || !selector ||
nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
return results;
}
// Try to shortcut find operations (as opposed to filters) in HTML documents
if ( !seed ) {
if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
setDocument( context );
}
context = context || document;
if ( documentIsHTML ) {
// If the selector is sufficiently simple, try using a "get*By*" DOM method
// (excepting DocumentFragment context, where the methods don't exist)
if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
// ID selector
if ( (m = match[1]) ) {
// Document context
if ( nodeType === 9 ) {
if ( (elem = context.getElementById( m )) ) {
// Support: IE, Opera, Webkit
// TODO: identify versions
// getElementById can match elements by name instead of ID
if ( elem.id === m ) {
results.push( elem );
return results;
}
} else {
return results;
}
// Element context
} else {
// Support: IE, Opera, Webkit
// TODO: identify versions
// getElementById can match elements by name instead of ID
if ( newContext && (elem = newContext.getElementById( m )) &&
contains( context, elem ) &&
elem.id === m ) {
results.push( elem );
return results;
}
}
// Type selector
} else if ( match[2] ) {
push.apply( results, context.getElementsByTagName( selector ) );
return results;
// Class selector
} else if ( (m = match[3]) && support.getElementsByClassName &&
context.getElementsByClassName ) {
push.apply( results, context.getElementsByClassName( m ) );
return results;
}
}
// Take advantage of querySelectorAll
if ( support.qsa &&
!compilerCache[ selector + " " ] &&
(!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
if ( nodeType !== 1 ) {
newContext = context;
newSelector = selector;
// qSA looks outside Element context, which is not what we want
// Thanks to Andrew Dupont for this workaround technique
// Support: IE <=8
// Exclude object elements
} else if ( context.nodeName.toLowerCase() !== "object" ) {
// Capture the context ID, setting it first if necessary
if ( (nid = context.getAttribute( "id" )) ) {
nid = nid.replace( rescape, "\\$&" );
} else {
context.setAttribute( "id", (nid = expando) );
}
// Prefix every selector in the list
groups = tokenize( selector );
i = groups.length;
nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']";
while ( i-- ) {
groups[i] = nidselect + " " + toSelector( groups[i] );
}
newSelector = groups.join( "," );
// Expand context for sibling selectors
newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
context;
}
if ( newSelector ) {
try {
push.apply( results,
newContext.querySelectorAll( newSelector )
);
return results;
} catch ( qsaError ) {
} finally {
if ( nid === expando ) {
context.removeAttribute( "id" );
}
}
}
}
}
}
// All others
return select( selector.replace( rtrim, "$1" ), context, results, seed );
}
/**
* Create key-value caches of limited size
* @returns {function(string, object)} Returns the Object data after storing it on itself with
* property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
* deleting the oldest entry
*/
function createCache() {
var keys = [];
function cache( key, value ) {
// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
if ( keys.push( key + " " ) > Expr.cacheLength ) {
// Only keep the most recent entries
delete cache[ keys.shift() ];
}
return (cache[ key + " " ] = value);
}
return cache;
}
/**
* Mark a function for special use by Sizzle
* @param {Function} fn The function to mark
*/
function markFunction( fn ) {
fn[ expando ] = true;
return fn;
}
/**
* Support testing using an element
* @param {Function} fn Passed the created div and expects a boolean result
*/
function assert( fn ) {
var div = document.createElement("div");
try {
return !!fn( div );
} catch (e) {
return false;
} finally {
// Remove from its parent by default
if ( div.parentNode ) {
div.parentNode.removeChild( div );
}
// release memory in IE
div = null;
}
}
/**
* Adds the same handler for all of the specified attrs
* @param {String} attrs Pipe-separated list of attributes
* @param {Function} handler The method that will be applied
*/
function addHandle( attrs, handler ) {
var arr = attrs.split("|"),
i = arr.length;
while ( i-- ) {
Expr.attrHandle[ arr[i] ] = handler;
}
}
/**
* Checks document order of two siblings
* @param {Element} a
* @param {Element} b
* @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
*/
function siblingCheck( a, b ) {
var cur = b && a,
diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
( ~b.sourceIndex || MAX_NEGATIVE ) -
( ~a.sourceIndex || MAX_NEGATIVE );
// Use IE sourceIndex if available on both nodes
if ( diff ) {
return diff;
}
// Check if b follows a
if ( cur ) {
while ( (cur = cur.nextSibling) ) {
if ( cur === b ) {
return -1;
}
}
}
return a ? 1 : -1;
}
/**
* Returns a function to use in pseudos for input types
* @param {String} type
*/
function createInputPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === type;
};
}
/**
* Returns a function to use in pseudos for buttons
* @param {String} type
*/
function createButtonPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && elem.type === type;
};
}
/**
* Returns a function to use in pseudos for positionals
* @param {Function} fn
*/
function createPositionalPseudo( fn ) {
return markFunction(function( argument ) {
argument = +argument;
return markFunction(function( seed, matches ) {
var j,
matchIndexes = fn( [], seed.length, argument ),
i = matchIndexes.length;
// Match elements found at the specified indexes
while ( i-- ) {
if ( seed[ (j = matchIndexes[i]) ] ) {
seed[j] = !(matches[j] = seed[j]);
}
}
});
});
}
/**
* Checks a node for validity as a Sizzle context
* @param {Element|Object=} context
* @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
*/
function testContext( context ) {
return context && typeof context.getElementsByTagName !== "undefined" && context;
}
// Expose support vars for convenience
support = Sizzle.support = {};
/**
* Detects XML nodes
* @param {Element|Object} elem An element or a document
* @returns {Boolean} True iff elem is a non-HTML XML node
*/
isXML = 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).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
/**
* Sets document-related variables once based on the current document
* @param {Element|Object} [doc] An element or document object to use to set the document
* @returns {Object} Returns the current document
*/
setDocument = Sizzle.setDocument = function( node ) {
var hasCompare, parent,
doc = node ? node.ownerDocument || node : preferredDoc;
// Return early if doc is invalid or already selected
if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
return document;
}
// Update global variables
document = doc;
docElem = document.documentElement;
documentIsHTML = !isXML( document );
// Support: IE 9-11, Edge
// Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
if ( (parent = document.defaultView) && parent.top !== parent ) {
// Support: IE 11
if ( parent.addEventListener ) {
parent.addEventListener( "unload", unloadHandler, false );
// Support: IE 9 - 10 only
} else if ( parent.attachEvent ) {
parent.attachEvent( "onunload", unloadHandler );
}
}
/* Attributes
---------------------------------------------------------------------- */
// Support: IE<8
// Verify that getAttribute really returns attributes and not properties
// (excepting IE8 booleans)
support.attributes = assert(function( div ) {
div.className = "i";
return !div.getAttribute("className");
});
/* getElement(s)By*
---------------------------------------------------------------------- */
// Check if getElementsByTagName("*") returns only elements
support.getElementsByTagName = assert(function( div ) {
div.appendChild( document.createComment("") );
return !div.getElementsByTagName("*").length;
});
// Support: IE<9
support.getElementsByClassName = rnative.test( document.getElementsByClassName );
// Support: IE<10
// Check if getElementById returns elements by name
// The broken getElementById methods don't pick up programatically-set names,
// so use a roundabout getElementsByName test
support.getById = assert(function( div ) {
docElem.appendChild( div ).id = expando;
return !document.getElementsByName || !document.getElementsByName( expando ).length;
});
// ID find and filter
if ( support.getById ) {
Expr.find["ID"] = function( id, context ) {
if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
var m = context.getElementById( id );
return m ? [ m ] : [];
}
};
Expr.filter["ID"] = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
return elem.getAttribute("id") === attrId;
};
};
} else {
// Support: IE6/7
// getElementById is not reliable as a find shortcut
delete Expr.find["ID"];
Expr.filter["ID"] = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
var node = typeof elem.getAttributeNode !== "undefined" &&
elem.getAttributeNode("id");
return node && node.value === attrId;
};
};
}
// Tag
Expr.find["TAG"] = support.getElementsByTagName ?
function( tag, context ) {
if ( typeof context.getElementsByTagName !== "undefined" ) {
return context.getElementsByTagName( tag );
// DocumentFragment nodes don't have gEBTN
} else if ( support.qsa ) {
return context.querySelectorAll( tag );
}
} :
function( tag, context ) {
var elem,
tmp = [],
i = 0,
// By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
results = context.getElementsByTagName( tag );
// Filter out possible comments
if ( tag === "*" ) {
while ( (elem = results[i++]) ) {
if ( elem.nodeType === 1 ) {
tmp.push( elem );
}
}
return tmp;
}
return results;
};
// Class
Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
return context.getElementsByClassName( className );
}
};
/* QSA/matchesSelector
---------------------------------------------------------------------- */
// QSA and matchesSelector support
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
rbuggyMatches = [];
// qSa(:focus) reports false when true (Chrome 21)
// We allow this because of a bug in IE8/9 that throws an error
// whenever `document.activeElement` is accessed on an iframe
// So, we allow :focus to pass through QSA all the time to avoid the IE error
// See http://bugs.jquery.com/ticket/13378
rbuggyQSA = [];
if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
// Build QSA regex
// Regex strategy adopted from Diego Perini
assert(function( div ) {
// Select is set to empty string on purpose
// This is to test IE's treatment of not explicitly
// setting a boolean content attribute,
// since its presence should be enough
// http://bugs.jquery.com/ticket/12359
docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
"<select id='" + expando + "-\r\\' msallowcapture=''>" +
"<option selected=''></option></select>";
// Support: IE8, Opera 11-12.16
// Nothing should be selected when empty strings follow ^= or $= or *=
// The test attribute must be unknown in Opera but "safe" for WinRT
// http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
if ( div.querySelectorAll("[msallowcapture^='']").length ) {
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
}
// Support: IE8
// Boolean attributes and "value" are not treated correctly
if ( !div.querySelectorAll("[selected]").length ) {
rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
}
// Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
rbuggyQSA.push("~=");
}
// Webkit/Opera - :checked should return selected option elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
// IE8 throws error here and will not see later tests
if ( !div.querySelectorAll(":checked").length ) {
rbuggyQSA.push(":checked");
}
// Support: Safari 8+, iOS 8+
// https://bugs.webkit.org/show_bug.cgi?id=136851
// In-page `selector#id sibing-combinator selector` fails
if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
rbuggyQSA.push(".#.+[+~]");
}
});
assert(function( div ) {
// Support: Windows 8 Native Apps
// The type and name attributes are restricted during .innerHTML assignment
var input = document.createElement("input");
input.setAttribute( "type", "hidden" );
div.appendChild( input ).setAttribute( "name", "D" );
// Support: IE8
// Enforce case-sensitivity of name attribute
if ( div.querySelectorAll("[name=d]").length ) {
rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
}
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
// IE8 throws error here and will not see later tests
if ( !div.querySelectorAll(":enabled").length ) {
rbuggyQSA.push( ":enabled", ":disabled" );
}
// Opera 10-11 does not throw on post-comma invalid pseudos
div.querySelectorAll("*,:x");
rbuggyQSA.push(",.*:");
});
}
if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
docElem.webkitMatchesSelector ||
docElem.mozMatchesSelector ||
docElem.oMatchesSelector ||
docElem.msMatchesSelector) )) ) {
assert(function( div ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9)
support.disconnectedMatch = matches.call( div, "div" );
// This should fail with an exception
// Gecko does not error, returns false instead
matches.call( div, "[s!='']:x" );
rbuggyMatches.push( "!=", pseudos );
});
}
rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
/* Contains
---------------------------------------------------------------------- */
hasCompare = rnative.test( docElem.compareDocumentPosition );
// Element contains another
// Purposefully self-exclusive
// As in, an element does not contain itself
contains = hasCompare || rnative.test( docElem.contains ) ?
function( a, b ) {
var adown = a.nodeType === 9 ? a.documentElement : a,
bup = b && b.parentNode;
return a === bup || !!( bup && bup.nodeType === 1 && (
adown.contains ?
adown.contains( bup ) :
a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
));
} :
function( a, b ) {
if ( b ) {
while ( (b = b.parentNode) ) {
if ( b === a ) {
return true;
}
}
}
return false;
};
/* Sorting
---------------------------------------------------------------------- */
// Document order sorting
sortOrder = hasCompare ?
function( a, b ) {
// Flag for duplicate removal
if ( a === b ) {
hasDuplicate = true;
return 0;
}
// Sort on method existence if only one input has compareDocumentPosition
var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
if ( compare ) {
return compare;
}
// Calculate position if both inputs belong to the same document
compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
a.compareDocumentPosition( b ) :
// Otherwise we know they are disconnected
1;
// Disconnected nodes
if ( compare & 1 ||
(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
// Choose the first element that is related to our preferred document
if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
return -1;
}
if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
return 1;
}
// Maintain original order
return sortInput ?
( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
0;
}
return compare & 4 ? -1 : 1;
} :
function( a, b ) {
// Exit early if the nodes are identical
if ( a === b ) {
hasDuplicate = true;
return 0;
}
var cur,
i = 0,
aup = a.parentNode,
bup = b.parentNode,
ap = [ a ],
bp = [ b ];
// Parentless nodes are either documents or disconnected
if ( !aup || !bup ) {
return a === document ? -1 :
b === document ? 1 :
aup ? -1 :
bup ? 1 :
sortInput ?
( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
0;
// If the nodes are siblings, we can do a quick check
} else if ( aup === bup ) {
return siblingCheck( a, b );
}
// Otherwise we need full lists of their ancestors for comparison
cur = a;
while ( (cur = cur.parentNode) ) {
ap.unshift( cur );
}
cur = b;
while ( (cur = cur.parentNode) ) {
bp.unshift( cur );
}
// Walk down the tree looking for a discrepancy
while ( ap[i] === bp[i] ) {
i++;
}
return i ?
// Do a sibling check if the nodes have a common ancestor
siblingCheck( ap[i], bp[i] ) :
// Otherwise nodes in our document sort first
ap[i] === preferredDoc ? -1 :
bp[i] === preferredDoc ? 1 :
0;
};
return document;
};
Sizzle.matches = function( expr, elements ) {
return Sizzle( expr, null, null, elements );
};
Sizzle.matchesSelector = function( elem, expr ) {
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
// Make sure that attribute selectors are quoted
expr = expr.replace( rattributeQuotes, "='$1']" );
if ( support.matchesSelector && documentIsHTML &&
!compilerCache[ expr + " " ] &&
( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
try {
var ret = matches.call( elem, expr );
// IE 9's matchesSelector returns false on disconnected nodes
if ( ret || support.disconnectedMatch ||
// As well, disconnected nodes are said to be in a document
// fragment in IE 9
elem.document && elem.document.nodeType !== 11 ) {
return ret;
}
} catch (e) {}
}
return Sizzle( expr, document, null, [ elem ] ).length > 0;
};
Sizzle.contains = function( context, elem ) {
// Set document vars if needed
if ( ( context.ownerDocument || context ) !== document ) {
setDocument( context );
}
return contains( context, elem );
};
Sizzle.attr = function( elem, name ) {
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
var fn = Expr.attrHandle[ name.toLowerCase() ],
// Don't get fooled by Object.prototype properties (jQuery #13807)
val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
fn( elem, name, !documentIsHTML ) :
undefined;
return val !== undefined ?
val :
support.attributes || !documentIsHTML ?
elem.getAttribute( name ) :
(val = elem.getAttributeNode(name)) && val.specified ?
val.value :
null;
};
Sizzle.error = function( msg ) {
throw new Error( "Syntax error, unrecognized expression: " + msg );
};
/**
* Document sorting and removing duplicates
* @param {ArrayLike} results
*/
Sizzle.uniqueSort = function( results ) {
var elem,
duplicates = [],
j = 0,
i = 0;
// Unless we *know* we can detect duplicates, assume their presence
hasDuplicate = !support.detectDuplicates;
sortInput = !support.sortStable && results.slice( 0 );
results.sort( sortOrder );
if ( hasDuplicate ) {
while ( (elem = results[i++]) ) {
if ( elem === results[ i ] ) {
j = duplicates.push( i );
}
}
while ( j-- ) {
results.splice( duplicates[ j ], 1 );
}
}
// Clear input after sorting to release objects
// See https://github.com/jquery/sizzle/pull/225
sortInput = null;
return results;
};
/**
* Utility function for retrieving the text value of an array of DOM nodes
* @param {Array|Element} elem
*/
getText = Sizzle.getText = function( elem ) {
var node,
ret = "",
i = 0,
nodeType = elem.nodeType;
if ( !nodeType ) {
// If no nodeType, this is expected to be an array
while ( (node = elem[i++]) ) {
// Do not traverse comment nodes
ret += getText( node );
}
} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
// Use textContent for elements
// innerText usage removed for consistency of new lines (jQuery #11153)
if ( typeof elem.textContent === "string" ) {
return elem.textContent;
} else {
// Traverse its children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
ret += getText( elem );
}
}
} else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}
// Do not include comment or processing instruction nodes
return ret;
};
Expr = Sizzle.selectors = {
// Can be adjusted by the user
cacheLength: 50,
createPseudo: markFunction,
match: matchExpr,
attrHandle: {},
find: {},
relative: {
">": { dir: "parentNode", first: true },
" ": { dir: "parentNode" },
"+": { dir: "previousSibling", first: true },
"~": { dir: "previousSibling" }
},
preFilter: {
"ATTR": function( match ) {
match[1] = match[1].replace( runescape, funescape );
// Move the given value to match[3] whether quoted or unquoted
match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
if ( match[2] === "~=" ) {
match[3] = " " + match[3] + " ";
}
return match.slice( 0, 4 );
},
"CHILD": function( match ) {
/* matches from matchExpr["CHILD"]
1 type (only|nth|...)
2 what (child|of-type)
3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
4 xn-component of xn+y argument ([+-]?\d*n|)
5 sign of xn-component
6 x of xn-component
7 sign of y-component
8 y of y-component
*/
match[1] = match[1].toLowerCase();
if ( match[1].slice( 0, 3 ) === "nth" ) {
// nth-* requires argument
if ( !match[3] ) {
Sizzle.error( match[0] );
}
// numeric x and y parameters for Expr.filter.CHILD
// remember that false/true cast respectively to 0/1
match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
// other types prohibit arguments
} else if ( match[3] ) {
Sizzle.error( match[0] );
}
return match;
},
"PSEUDO": function( match ) {
var excess,
unquoted = !match[6] && match[2];
if ( matchExpr["CHILD"].test( match[0] ) ) {
return null;
}
// Accept quoted arguments as-is
if ( match[3] ) {
match[2] = match[4] || match[5] || "";
// Strip excess characters from unquoted arguments
} else if ( unquoted && rpseudo.test( unquoted ) &&
// Get excess from tokenize (recursively)
(excess = tokenize( unquoted, true )) &&
// advance to the next closing parenthesis
(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
// excess is a negative index
match[0] = match[0].slice( 0, excess );
match[2] = unquoted.slice( 0, excess );
}
// Return only captures needed by the pseudo filter method (type and argument)
return match.slice( 0, 3 );
}
},
filter: {
"TAG": function( nodeNameSelector ) {
var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
return nodeNameSelector === "*" ?
function() { return true; } :
function( elem ) {
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
};
},
"CLASS": function( className ) {
var pattern = classCache[ className + " " ];
return pattern ||
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
classCache( className, function( elem ) {
return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
});
},
"ATTR": function( name, operator, check ) {
return function( elem ) {
var result = Sizzle.attr( elem, name );
if ( result == null ) {
return operator === "!=";
}
if ( !operator ) {
return true;
}
result += "";
return operator === "=" ? result === check :
operator === "!=" ? result !== check :
operator === "^=" ? check && result.indexOf( check ) === 0 :
operator === "*=" ? check && result.indexOf( check ) > -1 :
operator === "$=" ? check && result.slice( -check.length ) === check :
operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
false;
};
},
"CHILD": function( type, what, argument, first, last ) {
var simple = type.slice( 0, 3 ) !== "nth",
forward = type.slice( -4 ) !== "last",
ofType = what === "of-type";
return first === 1 && last === 0 ?
// Shortcut for :nth-*(n)
function( elem ) {
return !!elem.parentNode;
} :
function( elem, context, xml ) {
var cache, uniqueCache, outerCache, node, nodeIndex, start,
dir = simple !== forward ? "nextSibling" : "previousSibling",
parent = elem.parentNode,
name = ofType && elem.nodeName.toLowerCase(),
useCache = !xml && !ofType,
diff = false;
if ( parent ) {
// :(first|last|only)-(child|of-type)
if ( simple ) {
while ( dir ) {
node = elem;
while ( (node = node[ dir ]) ) {
if ( ofType ?
node.nodeName.toLowerCase() === name :
node.nodeType === 1 ) {
return false;
}
}
// Reverse direction for :only-* (if we haven't yet done so)
start = dir = type === "only" && !start && "nextSibling";
}
return true;
}
start = [ forward ? parent.firstChild : parent.lastChild ];
// non-xml :nth-child(...) stores cache data on `parent`
if ( forward && useCache ) {
// Seek `elem` from a previously-cached index
// ...in a gzip-friendly way
node = parent;
outerCache = node[ expando ] || (node[ expando ] = {});
// Support: IE <9 only
// Defend against cloned attroperties (jQuery gh-1709)
uniqueCache = outerCache[ node.uniqueID ] ||
(outerCache[ node.uniqueID ] = {});
cache = uniqueCache[ type ] || [];
nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
diff = nodeIndex && cache[ 2 ];
node = nodeIndex && parent.childNodes[ nodeIndex ];
while ( (node = ++nodeIndex && node && node[ dir ] ||
// Fallback to seeking `elem` from the start
(diff = nodeIndex = 0) || start.pop()) ) {
// When found, cache indexes on `parent` and break
if ( node.nodeType === 1 && ++diff && node === elem ) {
uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
break;
}
}
} else {
// Use previously-cached element index if available
if ( useCache ) {
// ...in a gzip-friendly way
node = elem;
outerCache = node[ expando ] || (node[ expando ] = {});
// Support: IE <9 only
// Defend against cloned attroperties (jQuery gh-1709)
uniqueCache = outerCache[ node.uniqueID ] ||
(outerCache[ node.uniqueID ] = {});
cache = uniqueCache[ type ] || [];
nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
diff = nodeIndex;
}
// xml :nth-child(...)
// or :nth-last-child(...) or :nth(-last)?-of-type(...)
if ( diff === false ) {
// Use the same loop as above to seek `elem` from the start
while ( (node = ++nodeIndex && node && node[ dir ] ||
(diff = nodeIndex = 0) || start.pop()) ) {
if ( ( ofType ?
node.nodeName.toLowerCase() === name :
node.nodeType === 1 ) &&
++diff ) {
// Cache the index of each encountered element
if ( useCache ) {
outerCache = node[ expando ] || (node[ expando ] = {});
// Support: IE <9 only
// Defend against cloned attroperties (jQuery gh-1709)
uniqueCache = outerCache[ node.uniqueID ] ||
(outerCache[ node.uniqueID ] = {});
uniqueCache[ type ] = [ dirruns, diff ];
}
if ( node === elem ) {
break;
}
}
}
}
}
// Incorporate the offset, then check against cycle size
diff -= last;
return diff === first || ( diff % first === 0 && diff / first >= 0 );
}
};
},
"PSEUDO": function( pseudo, argument ) {
// pseudo-class names are case-insensitive
// http://www.w3.org/TR/selectors/#pseudo-classes
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
// Remember that setFilters inherits from pseudos
var args,
fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
Sizzle.error( "unsupported pseudo: " + pseudo );
// The user may use createPseudo to indicate that
// arguments are needed to create the filter function
// just as Sizzle does
if ( fn[ expando ] ) {
return fn( argument );
}
// But maintain support for old signatures
if ( fn.length > 1 ) {
args = [ pseudo, pseudo, "", argument ];
return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
markFunction(function( seed, matches ) {
var idx,
matched = fn( seed, argument ),
i = matched.length;
while ( i-- ) {
idx = indexOf( seed, matched[i] );
seed[ idx ] = !( matches[ idx ] = matched[i] );
}
}) :
function( elem ) {
return fn( elem, 0, args );
};
}
return fn;
}
},
pseudos: {
// Potentially complex pseudos
"not": markFunction(function( selector ) {
// Trim the selector passed to compile
// to avoid treating leading and trailing
// spaces as combinators
var input = [],
results = [],
matcher = compile( selector.replace( rtrim, "$1" ) );
return matcher[ expando ] ?
markFunction(function( seed, matches, context, xml ) {
var elem,
unmatched = matcher( seed, null, xml, [] ),
i = seed.length;
// Match elements unmatched by `matcher`
while ( i-- ) {
if ( (elem = unmatched[i]) ) {
seed[i] = !(matches[i] = elem);
}
}
}) :
function( elem, context, xml ) {
input[0] = elem;
matcher( input, null, xml, results );
// Don't keep the element (issue #299)
input[0] = null;
return !results.pop();
};
}),
"has": markFunction(function( selector ) {
return function( elem ) {
return Sizzle( selector, elem ).length > 0;
};
}),
"contains": markFunction(function( text ) {
text = text.replace( runescape, funescape );
return function( elem ) {
return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
};
}),
// "Whether an element is represented by a :lang() selector
// is based solely on the element's language value
// being equal to the identifier C,
// or beginning with the identifier C immediately followed by "-".
// The matching of C against the element's language value is performed case-insensitively.
// The identifier C does not have to be a valid language name."
// http://www.w3.org/TR/selectors/#lang-pseudo
"lang": markFunction( function( lang ) {
// lang value must be a valid identifier
if ( !ridentifier.test(lang || "") ) {
Sizzle.error( "unsupported lang: " + lang );
}
lang = lang.replace( runescape, funescape ).toLowerCase();
return function( elem ) {
var elemLang;
do {
if ( (elemLang = documentIsHTML ?
elem.lang :
elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
elemLang = elemLang.toLowerCase();
return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
}
} while ( (elem = elem.parentNode) && elem.nodeType === 1 );
return false;
};
}),
// Miscellaneous
"target": function( elem ) {
var hash = window.location && window.location.hash;
return hash && hash.slice( 1 ) === elem.id;
},
"root": function( elem ) {
return elem === docElem;
},
"focus": function( elem ) {
return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
},
// Boolean properties
"enabled": function( elem ) {
return elem.disabled === false;
},
"disabled": function( elem ) {
return elem.disabled === true;
},
"checked": function( elem ) {
// In CSS3, :checked should return both checked and selected elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
var nodeName = elem.nodeName.toLowerCase();
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
},
"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;
},
// Contents
"empty": function( elem ) {
// http://www.w3.org/TR/selectors/#empty-pseudo
// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
// but not by others (comment: 8; processing instruction: 7; etc.)
// nodeType < 6 works because attributes (2) do not appear as children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
if ( elem.nodeType < 6 ) {
return false;
}
}
return true;
},
"parent": function( elem ) {
return !Expr.pseudos["empty"]( elem );
},
// Element/input types
"header": function( elem ) {
return rheader.test( elem.nodeName );
},
"input": function( elem ) {
return rinputs.test( elem.nodeName );
},
"button": function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === "button" || name === "button";
},
"text": function( elem ) {
var attr;
return elem.nodeName.toLowerCase() === "input" &&
elem.type === "text" &&
// Support: IE<8
// New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
},
// Position-in-collection
"first": createPositionalPseudo(function() {
return [ 0 ];
}),
"last": createPositionalPseudo(function( matchIndexes, length ) {
return [ length - 1 ];
}),
"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
return [ argument < 0 ? argument + length : argument ];
}),
"even": createPositionalPseudo(function( matchIndexes, length ) {
var i = 0;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"odd": createPositionalPseudo(function( matchIndexes, length ) {
var i = 1;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; --i >= 0; ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; ++i < length; ) {
matchIndexes.push( i );
}
return matchIndexes;
})
}
};
Expr.pseudos["nth"] = Expr.pseudos["eq"];
// Add button/input type pseudos
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
Expr.pseudos[ i ] = createInputPseudo( i );
}
for ( i in { submit: true, reset: true } ) {
Expr.pseudos[ i ] = createButtonPseudo( i );
}
// Easy API for creating new setFilters
function setFilters() {}
setFilters.prototype = Expr.filters = Expr.pseudos;
Expr.setFilters = new setFilters();
tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
var matched, match, tokens, type,
soFar, groups, preFilters,
cached = tokenCache[ selector + " " ];
if ( cached ) {
return parseOnly ? 0 : cached.slice( 0 );
}
soFar = selector;
groups = [];
preFilters = Expr.preFilter;
while ( soFar ) {
// Comma and first run
if ( !matched || (match = rcomma.exec( soFar )) ) {
if ( match ) {
// Don't consume trailing commas as valid
soFar = soFar.slice( match[0].length ) || soFar;
}
groups.push( (tokens = []) );
}
matched = false;
// Combinators
if ( (match = rcombinators.exec( soFar )) ) {
matched = match.shift();
tokens.push({
value: matched,
// Cast descendant combinators to space
type: match[0].replace( rtrim, " " )
});
soFar = soFar.slice( matched.length );
}
// Filters
for ( type in Expr.filter ) {
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
(match = preFilters[ type ]( match ))) ) {
matched = match.shift();
tokens.push({
value: matched,
type: type,
matches: match
});
soFar = soFar.slice( matched.length );
}
}
if ( !matched ) {
break;
}
}
// Return the length of the invalid excess
// if we're just parsing
// Otherwise, throw an error or return tokens
return parseOnly ?
soFar.length :
soFar ?
Sizzle.error( selector ) :
// Cache the tokens
tokenCache( selector, groups ).slice( 0 );
};
function toSelector( tokens ) {
var i = 0,
len = tokens.length,
selector = "";
for ( ; i < len; i++ ) {
selector += tokens[i].value;
}
return selector;
}
function addCombinator( matcher, combinator, base ) {
var dir = combinator.dir,
checkNonElements = base && dir === "parentNode",
doneName = done++;
return combinator.first ?
// Check against closest ancestor/preceding element
function( elem, context, xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
return matcher( elem, context, xml );
}
}
} :
// Check against all ancestor/preceding elements
function( elem, context, xml ) {
var oldCache, uniqueCache, outerCache,
newCache = [ dirruns, doneName ];
// We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
if ( xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
if ( matcher( elem, context, xml ) ) {
return true;
}
}
}
} else {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
outerCache = elem[ expando ] || (elem[ expando ] = {});
// Support: IE <9 only
// Defend against cloned attroperties (jQuery gh-1709)
uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
if ( (oldCache = uniqueCache[ dir ]) &&
oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
// Assign to newCache so results back-propagate to previous elements
return (newCache[ 2 ] = oldCache[ 2 ]);
} else {
// Reuse newcache so results back-propagate to previous elements
uniqueCache[ dir ] = newCache;
// A match means we're done; a fail means we have to keep checking
if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
return true;
}
}
}
}
}
};
}
function elementMatcher( matchers ) {
return matchers.length > 1 ?
function( elem, context, xml ) {
var i = matchers.length;
while ( i-- ) {
if ( !matchers[i]( elem, context, xml ) ) {
return false;
}
}
return true;
} :
matchers[0];
}
function multipleContexts( selector, contexts, results ) {
var i = 0,
len = contexts.length;
for ( ; i < len; i++ ) {
Sizzle( selector, contexts[i], results );
}
return results;
}
function condense( unmatched, map, filter, context, xml ) {
var elem,
newUnmatched = [],
i = 0,
len = unmatched.length,
mapped = map != null;
for ( ; i < len; i++ ) {
if ( (elem = unmatched[i]) ) {
if ( !filter || filter( elem, context, xml ) ) {
newUnmatched.push( elem );
if ( mapped ) {
map.push( i );
}
}
}
}
return newUnmatched;
}
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
if ( postFilter && !postFilter[ expando ] ) {
postFilter = setMatcher( postFilter );
}
if ( postFinder && !postFinder[ expando ] ) {
postFinder = setMatcher( postFinder, postSelector );
}
return markFunction(function( seed, results, context, xml ) {
var temp, i, elem,
preMap = [],
postMap = [],
preexisting = results.length,
// Get initial elements from seed or context
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
// Prefilter to get matcher input, preserving a map for seed-results synchronization
matcherIn = preFilter && ( seed || !selector ) ?
condense( elems, preMap, preFilter, context, xml ) :
elems,
matcherOut = matcher ?
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
// ...intermediate processing is necessary
[] :
// ...otherwise use results directly
results :
matcherIn;
// Find primary matches
if ( matcher ) {
matcher( matcherIn, matcherOut, context, xml );
}
// Apply postFilter
if ( postFilter ) {
temp = condense( matcherOut, postMap );
postFilter( temp, [], context, xml );
// Un-match failing elements by moving them back to matcherIn
i = temp.length;
while ( i-- ) {
if ( (elem = temp[i]) ) {
matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
}
}
}
if ( seed ) {
if ( postFinder || preFilter ) {
if ( postFinder ) {
// Get the final matcherOut by condensing this intermediate into postFinder contexts
temp = [];
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) ) {
// Restore matcherIn since elem is not yet a final match
temp.push( (matcherIn[i] = elem) );
}
}
postFinder( null, (matcherOut = []), temp, xml );
}
// Move matched elements from seed to results to keep them synchronized
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) &&
(temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
seed[temp] = !(results[temp] = elem);
}
}
}
// Add elements to results, through postFinder if defined
} else {
matcherOut = condense(
matcherOut === results ?
matcherOut.splice( preexisting, matcherOut.length ) :
matcherOut
);
if ( postFinder ) {
postFinder( null, results, matcherOut, xml );
} else {
push.apply( results, matcherOut );
}
}
});
}
function matcherFromTokens( tokens ) {
var checkContext, matcher, j,
len = tokens.length,
leadingRelative = Expr.relative[ tokens[0].type ],
implicitRelative = leadingRelative || Expr.relative[" "],
i = leadingRelative ? 1 : 0,
// The foundational matcher ensures that elements are reachable from top-level context(s)
matchContext = addCombinator( function( elem ) {
return elem === checkContext;
}, implicitRelative, true ),
matchAnyContext = addCombinator( function( elem ) {
return indexOf( checkContext, elem ) > -1;
}, implicitRelative, true ),
matchers = [ function( elem, context, xml ) {
var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
(checkContext = context).nodeType ?
matchContext( elem, context, xml ) :
matchAnyContext( elem, context, xml ) );
// Avoid hanging onto element (issue #299)
checkContext = null;
return ret;
} ];
for ( ; i < len; i++ ) {
if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
} else {
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
// Return special upon seeing a positional matcher
if ( matcher[ expando ] ) {
// Find the next relative operator (if any) for proper handling
j = ++i;
for ( ; j < len; j++ ) {
if ( Expr.relative[ tokens[j].type ] ) {
break;
}
}
return setMatcher(
i > 1 && elementMatcher( matchers ),
i > 1 && toSelector(
// If the preceding token was a descendant combinator, insert an implicit any-element `*`
tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
).replace( rtrim, "$1" ),
matcher,
i < j && matcherFromTokens( tokens.slice( i, j ) ),
j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
j < len && toSelector( tokens )
);
}
matchers.push( matcher );
}
}
return elementMatcher( matchers );
}
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
var bySet = setMatchers.length > 0,
byElement = elementMatchers.length > 0,
superMatcher = function( seed, context, xml, results, outermost ) {
var elem, j, matcher,
matchedCount = 0,
i = "0",
unmatched = seed && [],
setMatched = [],
contextBackup = outermostContext,
// We must always have either seed elements or outermost context
elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
// Use integer dirruns iff this is the outermost matcher
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
len = elems.length;
if ( outermost ) {
outermostContext = context === document || context || outermost;
}
// Add elements passing elementMatchers directly to results
// Support: IE<9, Safari
// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
if ( byElement && elem ) {
j = 0;
if ( !context && elem.ownerDocument !== document ) {
setDocument( elem );
xml = !documentIsHTML;
}
while ( (matcher = elementMatchers[j++]) ) {
if ( matcher( elem, context || document, xml) ) {
results.push( elem );
break;
}
}
if ( outermost ) {
dirruns = dirrunsUnique;
}
}
// Track unmatched elements for set filters
if ( bySet ) {
// They will have gone through all possible matchers
if ( (elem = !matcher && elem) ) {
matchedCount--;
}
// Lengthen the array for every element, matched or not
if ( seed ) {
unmatched.push( elem );
}
}
}
// `i` is now the count of elements visited above, and adding it to `matchedCount`
// makes the latter nonnegative.
matchedCount += i;
// Apply set filters to unmatched elements
// NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
// equals `i`), unless we didn't visit _any_ elements in the above loop because we have
// no element matchers and no seed.
// Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
// case, which will result in a "00" `matchedCount` that differs from `i` but is also
// numerically zero.
if ( bySet && i !== matchedCount ) {
j = 0;
while ( (matcher = setMatchers[j++]) ) {
matcher( unmatched, setMatched, context, xml );
}
if ( seed ) {
// Reintegrate element matches to eliminate the need for sorting
if ( matchedCount > 0 ) {
while ( i-- ) {
if ( !(unmatched[i] || setMatched[i]) ) {
setMatched[i] = pop.call( results );
}
}
}
// Discard index placeholder values to get only actual matches
setMatched = condense( setMatched );
}
// Add matches to results
push.apply( results, setMatched );
// Seedless set matches succeeding multiple successful matchers stipulate sorting
if ( outermost && !seed && setMatched.length > 0 &&
( matchedCount + setMatchers.length ) > 1 ) {
Sizzle.uniqueSort( results );
}
}
// Override manipulation of globals by nested matchers
if ( outermost ) {
dirruns = dirrunsUnique;
outermostContext = contextBackup;
}
return unmatched;
};
return bySet ?
markFunction( superMatcher ) :
superMatcher;
}
compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
var i,
setMatchers = [],
elementMatchers = [],
cached = compilerCache[ selector + " " ];
if ( !cached ) {
// Generate a function of recursive functions that can be used to check each element
if ( !match ) {
match = tokenize( selector );
}
i = match.length;
while ( i-- ) {
cached = matcherFromTokens( match[i] );
if ( cached[ expando ] ) {
setMatchers.push( cached );
} else {
elementMatchers.push( cached );
}
}
// Cache the compiled function
cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
// Save selector and tokenization
cached.selector = selector;
}
return cached;
};
/**
* A low-level selection function that works with Sizzle's compiled
* selector functions
* @param {String|Function} selector A selector or a pre-compiled
* selector function built with Sizzle.compile
* @param {Element} context
* @param {Array} [results]
* @param {Array} [seed] A set of elements to match against
*/
select = Sizzle.select = function( selector, context, results, seed ) {
var i, tokens, token, type, find,
compiled = typeof selector === "function" && selector,
match = !seed && tokenize( (selector = compiled.selector || selector) );
results = results || [];
// Try to minimize operations if there is only one selector in the list and no seed
// (the latter of which guarantees us context)
if ( match.length === 1 ) {
// Reduce context if the leading compound selector is an ID
tokens = match[0] = match[0].slice( 0 );
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
support.getById && context.nodeType === 9 && documentIsHTML &&
Expr.relative[ tokens[1].type ] ) {
context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
if ( !context ) {
return results;
// Precompiled matchers will still verify ancestry, so step up a level
} else if ( compiled ) {
context = context.parentNode;
}
selector = selector.slice( tokens.shift().value.length );
}
// Fetch a seed set for right-to-left matching
i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
while ( i-- ) {
token = tokens[i];
// Abort if we hit a combinator
if ( Expr.relative[ (type = token.type) ] ) {
break;
}
if ( (find = Expr.find[ type ]) ) {
// Search, expanding context for leading sibling combinators
if ( (seed = find(
token.matches[0].replace( runescape, funescape ),
rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
)) ) {
// If seed is empty or no tokens remain, we can return early
tokens.splice( i, 1 );
selector = seed.length && toSelector( tokens );
if ( !selector ) {
push.apply( results, seed );
return results;
}
break;
}
}
}
}
// Compile and execute a filtering function if one is not provided
// Provide `match` to avoid retokenization if we modified the selector above
( compiled || compile( selector, match ) )(
seed,
context,
!documentIsHTML,
results,
!context || rsibling.test( selector ) && testContext( context.parentNode ) || context
);
return results;
};
// One-time assignments
// Sort stability
support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
// Support: Chrome 14-35+
// Always assume duplicates if they aren't passed to the comparison function
support.detectDuplicates = !!hasDuplicate;
// Initialize against the default document
setDocument();
// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
// Detached nodes confoundingly follow *each other*
support.sortDetached = assert(function( div1 ) {
// Should return 1, but returns 4 (following)
return div1.compareDocumentPosition( document.createElement("div") ) & 1;
});
// Support: IE<8
// Prevent attribute/property "interpolation"
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !assert(function( div ) {
div.innerHTML = "<a href='#'></a>";
return div.firstChild.getAttribute("href") === "#" ;
}) ) {
addHandle( "type|href|height|width", function( elem, name, isXML ) {
if ( !isXML ) {
return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
}
});
}
// Support: IE<9
// Use defaultValue in place of getAttribute("value")
if ( !support.attributes || !assert(function( div ) {
div.innerHTML = "<input/>";
div.firstChild.setAttribute( "value", "" );
return div.firstChild.getAttribute( "value" ) === "";
}) ) {
addHandle( "value", function( elem, name, isXML ) {
if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
return elem.defaultValue;
}
});
}
// Support: IE<9
// Use getAttributeNode to fetch booleans when getAttribute lies
if ( !assert(function( div ) {
return div.getAttribute("disabled") == null;
}) ) {
addHandle( booleans, function( elem, name, isXML ) {
var val;
if ( !isXML ) {
return elem[ name ] === true ? name.toLowerCase() :
(val = elem.getAttributeNode( name )) && val.specified ?
val.value :
null;
}
});
}
return Sizzle;
})( window );
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[ ":" ] = jQuery.expr.pseudos;
jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
var dir = function( elem, dir, until ) {
var matched = [],
truncate = until !== undefined;
while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
if ( elem.nodeType === 1 ) {
if ( truncate && jQuery( elem ).is( until ) ) {
break;
}
matched.push( elem );
}
}
return matched;
};
var siblings = function( n, elem ) {
var matched = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType === 1 && n !== elem ) {
matched.push( n );
}
}
return matched;
};
var rneedsContext = jQuery.expr.match.needsContext;
var rsingleTag = ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ );
var risSimple = /^.[^:#\[\.,]*$/;
// Implement the identical functionality for filter and not
function winnow( elements, qualifier, not ) {
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep( elements, function( elem, i ) {
/* jshint -W018 */
return !!qualifier.call( elem, i, elem ) !== not;
} );
}
if ( qualifier.nodeType ) {
return jQuery.grep( elements, function( elem ) {
return ( elem === qualifier ) !== not;
} );
}
if ( typeof qualifier === "string" ) {
if ( risSimple.test( qualifier ) ) {
return jQuery.filter( qualifier, elements, not );
}
qualifier = jQuery.filter( qualifier, elements );
}
return jQuery.grep( elements, function( elem ) {
return ( jQuery.inArray( elem, qualifier ) > -1 ) !== not;
} );
}
jQuery.filter = function( expr, elems, not ) {
var elem = elems[ 0 ];
if ( not ) {
expr = ":not(" + expr + ")";
}
return elems.length === 1 && elem.nodeType === 1 ?
jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
return elem.nodeType === 1;
} ) );
};
jQuery.fn.extend( {
find: function( selector ) {
var i,
ret = [],
self = this,
len = self.length;
if ( typeof selector !== "string" ) {
return this.pushStack( jQuery( selector ).filter( function() {
for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( self[ i ], this ) ) {
return true;
}
}
} ) );
}
for ( i = 0; i < len; i++ ) {
jQuery.find( selector, self[ i ], ret );
}
// Needed because $( selector, context ) becomes $( context ).find( selector )
ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
ret.selector = this.selector ? this.selector + " " + selector : selector;
return ret;
},
filter: function( selector ) {
return this.pushStack( winnow( this, selector || [], false ) );
},
not: function( selector ) {
return this.pushStack( winnow( this, selector || [], true ) );
},
is: function( selector ) {
return !!winnow(
this,
// If this is a positional/relative selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
typeof selector === "string" && rneedsContext.test( selector ) ?
jQuery( selector ) :
selector || [],
false
).length;
}
} );
// Initialize a jQuery object
// A central reference to the root jQuery(document)
var rootjQuery,
// A simple way to check for HTML strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
// Strict HTML recognition (#11290: must start with <)
rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
init = jQuery.fn.init = function( selector, context, root ) {
var match, elem;
// HANDLE: $(""), $(null), $(undefined), $(false)
if ( !selector ) {
return this;
}
// init accepts an alternate rootjQuery
// so migrate can support jQuery.sub (gh-2101)
root = root || rootjQuery;
// Handle HTML strings
if ( typeof selector === "string" ) {
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 = rquickExpr.exec( selector );
}
// Match html or make sure no context is specified for #id
if ( match && ( match[ 1 ] || !context ) ) {
// HANDLE: $(html) -> $(array)
if ( match[ 1 ] ) {
context = context instanceof jQuery ? context[ 0 ] : context;
// scripts is true for back-compat
// Intentionally let the error be thrown if parseHTML is not present
jQuery.merge( this, jQuery.parseHTML(
match[ 1 ],
context && context.nodeType ? context.ownerDocument || context : document,
true
) );
// HANDLE: $(html, props)
if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
for ( match in context ) {
// Properties of context are called as methods if possible
if ( jQuery.isFunction( this[ match ] ) ) {
this[ match ]( context[ match ] );
// ...and otherwise set as attributes
} else {
this.attr( match, context[ match ] );
}
}
}
return this;
// 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 || root ).find( selector );
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
return this.constructor( context ).find( selector );
}
// HANDLE: $(DOMElement)
} else if ( selector.nodeType ) {
this.context = this[ 0 ] = selector;
this.length = 1;
return this;
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) {
return typeof root.ready !== "undefined" ?
root.ready( selector ) :
// Execute immediately if ready is not present
selector( jQuery );
}
if ( selector.selector !== undefined ) {
this.selector = selector.selector;
this.context = selector.context;
}
return jQuery.makeArray( selector, this );
};
// Give the init function the jQuery prototype for later instantiation
init.prototype = jQuery.fn;
// Initialize central reference
rootjQuery = jQuery( document );
var rparentsprev = /^(?:parents|prev(?:Until|All))/,
// 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( {
has: function( target ) {
var i,
targets = jQuery( target, this ),
len = targets.length;
return this.filter( function() {
for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( this, targets[ i ] ) ) {
return true;
}
}
} );
},
closest: function( selectors, context ) {
var cur,
i = 0,
l = this.length,
matched = [],
pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
jQuery( selectors, context || this.context ) :
0;
for ( ; i < l; i++ ) {
for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
// Always skip document fragments
if ( cur.nodeType < 11 && ( pos ?
pos.index( cur ) > -1 :
// Don't pass non-elements to Sizzle
cur.nodeType === 1 &&
jQuery.find.matchesSelector( cur, selectors ) ) ) {
matched.push( cur );
break;
}
}
}
return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
},
// 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.first().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 ) {
return this.pushStack(
jQuery.uniqueSort(
jQuery.merge( this.get(), jQuery( selector, context ) )
)
);
},
addBack: function( selector ) {
return this.add( selector == null ?
this.prevObject : this.prevObject.filter( selector )
);
}
} );
function sibling( cur, dir ) {
do {
cur = cur[ dir ];
} while ( cur && cur.nodeType !== 1 );
return cur;
}
jQuery.each( {
parent: function( elem ) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
parents: function( elem ) {
return dir( elem, "parentNode" );
},
parentsUntil: function( elem, i, until ) {
return dir( elem, "parentNode", until );
},
next: function( elem ) {
return sibling( elem, "nextSibling" );
},
prev: function( elem ) {
return sibling( elem, "previousSibling" );
},
nextAll: function( elem ) {
return dir( elem, "nextSibling" );
},
prevAll: function( elem ) {
return dir( elem, "previousSibling" );
},
nextUntil: function( elem, i, until ) {
return dir( elem, "nextSibling", until );
},
prevUntil: function( elem, i, until ) {
return dir( elem, "previousSibling", until );
},
siblings: function( elem ) {
return siblings( ( elem.parentNode || {} ).firstChild, elem );
},
children: function( elem ) {
return siblings( elem.firstChild );
},
contents: function( elem ) {
return jQuery.nodeName( elem, "iframe" ) ?
elem.contentDocument || elem.contentWindow.document :
jQuery.merge( [], elem.childNodes );
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
var ret = jQuery.map( this, fn, until );
if ( name.slice( -5 ) !== "Until" ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
if ( this.length > 1 ) {
// Remove duplicates
if ( !guaranteedUnique[ name ] ) {
ret = jQuery.uniqueSort( ret );
}
// Reverse order for parents* and prev-derivatives
if ( rparentsprev.test( name ) ) {
ret = ret.reverse();
}
}
return this.pushStack( ret );
};
} );
var rnotwhite = ( /\S+/g );
// Convert String-formatted options into Object-formatted ones
function createOptions( options ) {
var object = {};
jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
object[ flag ] = true;
} );
return object;
}
/*
* Create a callback list using the following parameters:
*
* options: an optional list of space-separated options that will change how
* the callback list behaves or a more traditional option object
*
* By default a callback list will act like an event callback list and can be
* "fired" multiple times.
*
* Possible options:
*
* 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( options ) {
// Convert options from String-formatted to Object-formatted if needed
// (we check in cache first)
options = typeof options === "string" ?
createOptions( options ) :
jQuery.extend( {}, options );
var // Flag to know if list is currently firing
firing,
// Last fire value for non-forgettable lists
memory,
// Flag to know if list was already fired
fired,
// Flag to prevent firing
locked,
// Actual callback list
list = [],
// Queue of execution data for repeatable lists
queue = [],
// Index of currently firing callback (modified by add/remove as needed)
firingIndex = -1,
// Fire callbacks
fire = function() {
// Enforce single-firing
locked = options.once;
// Execute callbacks for all pending executions,
// respecting firingIndex overrides and runtime changes
fired = firing = true;
for ( ; queue.length; firingIndex = -1 ) {
memory = queue.shift();
while ( ++firingIndex < list.length ) {
// Run callback and check for early termination
if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
options.stopOnFalse ) {
// Jump to end and forget the data so .add doesn't re-fire
firingIndex = list.length;
memory = false;
}
}
}
// Forget the data if we're done with it
if ( !options.memory ) {
memory = false;
}
firing = false;
// Clean up if we're done firing for good
if ( locked ) {
// Keep an empty list if we have data for future add calls
if ( memory ) {
list = [];
// Otherwise, this object is spent
} else {
list = "";
}
}
},
// Actual Callbacks object
self = {
// Add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
// If we have memory from a past run, we should fire after adding
if ( memory && !firing ) {
firingIndex = list.length - 1;
queue.push( memory );
}
( function add( args ) {
jQuery.each( args, function( _, arg ) {
if ( jQuery.isFunction( arg ) ) {
if ( !options.unique || !self.has( arg ) ) {
list.push( arg );
}
} else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
// Inspect recursively
add( arg );
}
} );
} )( arguments );
if ( memory && !firing ) {
fire();
}
}
return this;
},
// Remove a callback from the list
remove: function() {
jQuery.each( arguments, function( _, arg ) {
var index;
while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
list.splice( index, 1 );
// Handle firing indexes
if ( index <= firingIndex ) {
firingIndex--;
}
}
} );
return this;
},
// Check if a given callback is in the list.
// If no argument is given, return whether or not list has callbacks attached.
has: function( fn ) {
return fn ?
jQuery.inArray( fn, list ) > -1 :
list.length > 0;
},
// Remove all callbacks from the list
empty: function() {
if ( list ) {
list = [];
}
return this;
},
// Disable .fire and .add
// Abort any current/pending executions
// Clear all callbacks and values
disable: function() {
locked = queue = [];
list = memory = "";
return this;
},
disabled: function() {
return !list;
},
// Disable .fire
// Also disable .add unless we have memory (since it would have no effect)
// Abort any pending executions
lock: function() {
locked = true;
if ( !memory ) {
self.disable();
}
return this;
},
locked: function() {
return !!locked;
},
// Call all callbacks with the given context and arguments
fireWith: function( context, args ) {
if ( !locked ) {
args = args || [];
args = [ context, args.slice ? args.slice() : args ];
queue.push( args );
if ( !firing ) {
fire();
}
}
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 !!fired;
}
};
return self;
};
jQuery.extend( {
Deferred: function( func ) {
var tuples = [
// action, add listener, listener list, final state
[ "resolve", "done", jQuery.Callbacks( "once memory" ), "resolved" ],
[ "reject", "fail", jQuery.Callbacks( "once memory" ), "rejected" ],
[ "notify", "progress", jQuery.Callbacks( "memory" ) ]
],
state = "pending",
promise = {
state: function() {
return state;
},
always: function() {
deferred.done( arguments ).fail( arguments );
return this;
},
then: function( /* fnDone, fnFail, fnProgress */ ) {
var fns = arguments;
return jQuery.Deferred( function( newDefer ) {
jQuery.each( tuples, function( i, tuple ) {
var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
// deferred[ done | fail | progress ] for forwarding actions to newDefer
deferred[ tuple[ 1 ] ]( function() {
var returned = fn && fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise()
.progress( newDefer.notify )
.done( newDefer.resolve )
.fail( newDefer.reject );
} else {
newDefer[ tuple[ 0 ] + "With" ](
this === promise ? newDefer.promise() : this,
fn ? [ returned ] : arguments
);
}
} );
} );
fns = null;
} ).promise();
},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj ) {
return obj != null ? jQuery.extend( obj, promise ) : promise;
}
},
deferred = {};
// Keep pipe for back-compat
promise.pipe = promise.then;
// Add list-specific methods
jQuery.each( tuples, function( i, tuple ) {
var list = tuple[ 2 ],
stateString = tuple[ 3 ];
// promise[ done | fail | progress ] = list.add
promise[ tuple[ 1 ] ] = list.add;
// Handle state
if ( stateString ) {
list.add( function() {
// state = [ resolved | rejected ]
state = stateString;
// [ reject_list | resolve_list ].disable; progress_list.lock
}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
}
// deferred[ resolve | reject | notify ]
deferred[ tuple[ 0 ] ] = function() {
deferred[ tuple[ 0 ] + "With" ]( this === deferred ? promise : this, arguments );
return this;
};
deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
} );
// Make the deferred a promise
promise.promise( deferred );
// Call given func if any
if ( func ) {
func.call( deferred, deferred );
}
// All done!
return deferred;
},
// Deferred helper
when: function( subordinate /* , ..., subordinateN */ ) {
var i = 0,
resolveValues = slice.call( arguments ),
length = resolveValues.length,
// the count of uncompleted subordinates
remaining = length !== 1 ||
( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
// the master Deferred.
// If resolveValues consist of only a single Deferred, just use that.
deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
// Update function for both resolve and progress values
updateFunc = function( i, contexts, values ) {
return function( value ) {
contexts[ i ] = this;
values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
if ( values === progressValues ) {
deferred.notifyWith( contexts, values );
} else if ( !( --remaining ) ) {
deferred.resolveWith( contexts, values );
}
};
},
progressValues, progressContexts, resolveContexts;
// add listeners to Deferred subordinates; treat others as resolved
if ( length > 1 ) {
progressValues = new Array( length );
progressContexts = new Array( length );
resolveContexts = new Array( length );
for ( ; i < length; i++ ) {
if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
resolveValues[ i ].promise()
.progress( updateFunc( i, progressContexts, progressValues ) )
.done( updateFunc( i, resolveContexts, resolveValues ) )
.fail( deferred.reject );
} else {
--remaining;
}
}
}
// if we're not waiting on anything, resolve the master
if ( !remaining ) {
deferred.resolveWith( resolveContexts, resolveValues );
}
return deferred.promise();
}
} );
// The deferred used on DOM ready
var readyList;
jQuery.fn.ready = function( fn ) {
// Add the callback
jQuery.ready.promise().done( fn );
return this;
};
jQuery.extend( {
// 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 ) {
// Abort if there are pending holds or we're already ready
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
return;
}
// 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.resolveWith( document, [ jQuery ] );
// Trigger any bound ready events
if ( jQuery.fn.triggerHandler ) {
jQuery( document ).triggerHandler( "ready" );
jQuery( document ).off( "ready" );
}
}
} );
/**
* Clean-up method for dom ready events
*/
function detach() {
if ( document.addEventListener ) {
document.removeEventListener( "DOMContentLoaded", completed );
window.removeEventListener( "load", completed );
} else {
document.detachEvent( "onreadystatechange", completed );
window.detachEvent( "onload", completed );
}
}
/**
* The ready event handler and self cleanup method
*/
function completed() {
// readyState === "complete" is good enough for us to call the dom ready in oldIE
if ( document.addEventListener ||
window.event.type === "load" ||
document.readyState === "complete" ) {
detach();
jQuery.ready();
}
}
jQuery.ready.promise = function( obj ) {
if ( !readyList ) {
readyList = jQuery.Deferred();
// Catch cases where $(document).ready() is called
// after the browser event has already occurred.
// Support: IE6-10
// Older IE sometimes signals "interactive" too soon
if ( document.readyState === "complete" ||
( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
window.setTimeout( jQuery.ready );
// Standards-based browsers support DOMContentLoaded
} else if ( document.addEventListener ) {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", completed );
// A fallback to window.onload, that will always work
window.addEventListener( "load", completed );
// If IE event model is used
} else {
// Ensure firing before onload, maybe late but safe also for iframes
document.attachEvent( "onreadystatechange", completed );
// A fallback to window.onload, that will always work
window.attachEvent( "onload", completed );
// If IE and not a frame
// continually check to see if the document is ready
var top = false;
try {
top = window.frameElement == null && document.documentElement;
} catch ( e ) {}
if ( top && top.doScroll ) {
( function doScrollCheck() {
if ( !jQuery.isReady ) {
try {
// Use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
top.doScroll( "left" );
} catch ( e ) {
return window.setTimeout( doScrollCheck, 50 );
}
// detach all dom ready events
detach();
// and execute any waiting functions
jQuery.ready();
}
} )();
}
}
}
return readyList.promise( obj );
};
// Kick off the DOM ready check even if the user does not
jQuery.ready.promise();
// Support: IE<9
// Iteration over object's inherited properties before its own
var i;
for ( i in jQuery( support ) ) {
break;
}
support.ownFirst = i === "0";
// Note: most support tests are defined in their respective modules.
// false until the test is run
support.inlineBlockNeedsLayout = false;
// Execute ASAP in case we need to set body.style.zoom
jQuery( function() {
// Minified: var a,b,c,d
var val, div, body, container;
body = document.getElementsByTagName( "body" )[ 0 ];
if ( !body || !body.style ) {
// Return for frameset docs that don't have a body
return;
}
// Setup
div = document.createElement( "div" );
container = document.createElement( "div" );
container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
body.appendChild( container ).appendChild( div );
if ( typeof div.style.zoom !== "undefined" ) {
// Support: IE<8
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layout
div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1";
support.inlineBlockNeedsLayout = val = div.offsetWidth === 3;
if ( val ) {
// Prevent IE 6 from affecting layout for positioned elements #11048
// Prevent IE from shrinking the body in IE 7 mode #12869
// Support: IE<8
body.style.zoom = 1;
}
}
body.removeChild( container );
} );
( function() {
var div = document.createElement( "div" );
// Support: IE<9
support.deleteExpando = true;
try {
delete div.test;
} catch ( e ) {
support.deleteExpando = false;
}
// Null elements to avoid leaks in IE.
div = null;
} )();
var acceptData = function( elem ) {
var noData = jQuery.noData[ ( elem.nodeName + " " ).toLowerCase() ],
nodeType = +elem.nodeType || 1;
// Do not set data on non-element DOM nodes because it will not be cleared (#8335).
return nodeType !== 1 && nodeType !== 9 ?
false :
// Nodes accept data unless otherwise specified; rejection can be conditional
!noData || noData !== true && elem.getAttribute( "classid" ) === noData;
};
var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
rmultiDash = /([A-Z])/g;
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 :
// Only convert to a number if it doesn't change the string
+data + "" === data ? +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 ) {
var name;
for ( 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 internalData( elem, name, data, pvt /* Internal Use Only */ ) {
if ( !acceptData( elem ) ) {
return;
}
var ret, thisCache,
internalKey = jQuery.expando,
// 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;
// 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 ] || ( !pvt && !cache[ id ].data ) ) &&
data === undefined && typeof name === "string" ) {
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 ) {
id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++;
} else {
id = internalKey;
}
}
if ( !cache[ id ] ) {
// Avoid exposing jQuery metadata on plain JS objects when the object
// is serialized using JSON.stringify
cache[ id ] = isNode ? {} : { 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 );
}
}
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;
}
// Check for both converted-to-camel and non-converted data property names
// If a data property was specified
if ( typeof name === "string" ) {
// 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;
}
function internalRemoveData( elem, name, pvt ) {
if ( !acceptData( elem ) ) {
return;
}
var thisCache, i,
isNode = elem.nodeType,
// See jQuery.data for more information
cache = isNode ? jQuery.cache : elem,
id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
// 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( " " );
}
}
} else {
// If "name" is an array of keys...
// When data is initially created, via ("key", "val") signature,
// keys will be converted to camelCase.
// Since there is no way to tell _how_ a key was added, remove
// both plain key and camelCase key. #12786
// This will only penalize the array argument path.
name = name.concat( jQuery.map( name, jQuery.camelCase ) );
}
i = name.length;
while ( 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( thisCache ) : !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;
}
}
// Destroy the cache
if ( isNode ) {
jQuery.cleanData( [ elem ], true );
// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
/* jshint eqeqeq: false */
} else if ( support.deleteExpando || cache != cache.window ) {
/* jshint eqeqeq: true */
delete cache[ id ];
// When all else fails, undefined
} else {
cache[ id ] = undefined;
}
}
jQuery.extend( {
cache: {},
// The following elements (space-suffixed to avoid Object.prototype collisions)
// throw uncatchable exceptions if you attempt to set expando properties
noData: {
"applet ": true,
"embed ": true,
// ...but Flash objects (which have this classid) *can* handle expandos
"object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
},
hasData: function( elem ) {
elem = elem.nodeType ? jQuery.cache[ elem[ jQuery.expando ] ] : elem[ jQuery.expando ];
return !!elem && !isEmptyDataObject( elem );
},
data: function( elem, name, data ) {
return internalData( elem, name, data );
},
removeData: function( elem, name ) {
return internalRemoveData( elem, name );
},
// For internal use only.
_data: function( elem, name, data ) {
return internalData( elem, name, data, true );
},
_removeData: function( elem, name ) {
return internalRemoveData( elem, name, true );
}
} );
jQuery.fn.extend( {
data: function( key, value ) {
var i, name, data,
elem = this[ 0 ],
attrs = elem && elem.attributes;
// Special expections of .data basically thwart jQuery.access,
// so implement the relevant behavior ourselves
// Gets all values
if ( key === undefined ) {
if ( this.length ) {
data = jQuery.data( elem );
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
i = attrs.length;
while ( i-- ) {
// Support: IE11+
// The attrs elements can be null (#14894)
if ( attrs[ i ] ) {
name = attrs[ i ].name;
if ( name.indexOf( "data-" ) === 0 ) {
name = jQuery.camelCase( name.slice( 5 ) );
dataAttr( elem, name, data[ name ] );
}
}
}
jQuery._data( elem, "parsedAttrs", true );
}
}
return data;
}
// Sets multiple values
if ( typeof key === "object" ) {
return this.each( function() {
jQuery.data( this, key );
} );
}
return arguments.length > 1 ?
// Sets one value
this.each( function() {
jQuery.data( this, key, value );
} ) :
// Gets one value
// Try to fetch any internally stored data first
elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined;
},
removeData: function( key ) {
return this.each( function() {
jQuery.removeData( this, key );
} );
}
} );
jQuery.extend( {
queue: function( elem, type, data ) {
var queue;
if ( elem ) {
type = ( type || "fx" ) + "queue";
queue = jQuery._data( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !queue || jQuery.isArray( data ) ) {
queue = jQuery._data( elem, type, jQuery.makeArray( data ) );
} else {
queue.push( data );
}
}
return queue || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
startLength = queue.length,
fn = queue.shift(),
hooks = jQuery._queueHooks( elem, type ),
next = function() {
jQuery.dequeue( elem, type );
};
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
startLength--;
}
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift( "inprogress" );
}
// clear up the last queue stop function
delete hooks.stop;
fn.call( elem, next, hooks );
}
if ( !startLength && hooks ) {
hooks.empty.fire();
}
},
// not intended for public consumption - generates a queueHooks object,
// or returns the current one
_queueHooks: function( elem, type ) {
var key = type + "queueHooks";
return jQuery._data( elem, key ) || jQuery._data( elem, key, {
empty: jQuery.Callbacks( "once memory" ).add( function() {
jQuery._removeData( elem, type + "queue" );
jQuery._removeData( elem, key );
} )
} );
}
} );
jQuery.fn.extend( {
queue: function( type, data ) {
var setter = 2;
if ( typeof type !== "string" ) {
data = type;
type = "fx";
setter--;
}
if ( arguments.length < setter ) {
return jQuery.queue( this[ 0 ], type );
}
return data === undefined ?
this :
this.each( function() {
var queue = jQuery.queue( this, type, data );
// ensure a hooks for this queue
jQuery._queueHooks( this, type );
if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
jQuery.dequeue( this, type );
}
} );
},
dequeue: function( type ) {
return this.each( function() {
jQuery.dequeue( this, type );
} );
},
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, obj ) {
var tmp,
count = 1,
defer = jQuery.Deferred(),
elements = this,
i = this.length,
resolve = function() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
};
if ( typeof type !== "string" ) {
obj = type;
type = undefined;
}
type = type || "fx";
while ( i-- ) {
tmp = jQuery._data( elements[ i ], type + "queueHooks" );
if ( tmp && tmp.empty ) {
count++;
tmp.empty.add( resolve );
}
}
resolve();
return defer.promise( obj );
}
} );
( function() {
var shrinkWrapBlocksVal;
support.shrinkWrapBlocks = function() {
if ( shrinkWrapBlocksVal != null ) {
return shrinkWrapBlocksVal;
}
// Will be changed later if needed.
shrinkWrapBlocksVal = false;
// Minified: var b,c,d
var div, body, container;
body = document.getElementsByTagName( "body" )[ 0 ];
if ( !body || !body.style ) {
// Test fired too early or in an unsupported environment, exit.
return;
}
// Setup
div = document.createElement( "div" );
container = document.createElement( "div" );
container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
body.appendChild( container ).appendChild( div );
// Support: IE6
// Check if elements with layout shrink-wrap their children
if ( typeof div.style.zoom !== "undefined" ) {
// Reset CSS: box-sizing; display; margin; border
div.style.cssText =
// Support: Firefox<29, Android 2.3
// Vendor-prefix box-sizing
"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
"box-sizing:content-box;display:block;margin:0;border:0;" +
"padding:1px;width:1px;zoom:1";
div.appendChild( document.createElement( "div" ) ).style.width = "5px";
shrinkWrapBlocksVal = div.offsetWidth !== 3;
}
body.removeChild( container );
return shrinkWrapBlocksVal;
};
} )();
var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
var isHidden = function( elem, el ) {
// isHidden might be called from jQuery#filter function;
// in that case, element will be second argument
elem = el || elem;
return jQuery.css( elem, "display" ) === "none" ||
!jQuery.contains( elem.ownerDocument, elem );
};
function adjustCSS( elem, prop, valueParts, tween ) {
var adjusted,
scale = 1,
maxIterations = 20,
currentValue = tween ?
function() { return tween.cur(); } :
function() { return jQuery.css( elem, prop, "" ); },
initial = currentValue(),
unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
// Starting value computation is required for potential unit mismatches
initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
rcssNum.exec( jQuery.css( elem, prop ) );
if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
// Trust units reported by jQuery.css
unit = unit || initialInUnit[ 3 ];
// Make sure we update the tween properties later on
valueParts = valueParts || [];
// Iteratively approximate from a nonzero starting point
initialInUnit = +initial || 1;
do {
// If previous iteration zeroed out, double until we get *something*.
// Use string for doubling so we don't accidentally see scale as unchanged below
scale = scale || ".5";
// Adjust and apply
initialInUnit = initialInUnit / scale;
jQuery.style( elem, prop, initialInUnit + unit );
// Update scale, tolerating zero or NaN from tween.cur()
// Break the loop if scale is unchanged or perfect, or if we've just had enough.
} while (
scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
);
}
if ( valueParts ) {
initialInUnit = +initialInUnit || +initial || 0;
// Apply relative offset (+=/-=) if specified
adjusted = valueParts[ 1 ] ?
initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
+valueParts[ 2 ];
if ( tween ) {
tween.unit = unit;
tween.start = initialInUnit;
tween.end = adjusted;
}
}
return adjusted;
}
// Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function
var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
var i = 0,
length = elems.length,
bulk = key == null;
// Sets many values
if ( jQuery.type( key ) === "object" ) {
chainable = true;
for ( i in key ) {
access( elems, fn, i, key[ i ], true, emptyGet, raw );
}
// Sets one value
} else if ( value !== undefined ) {
chainable = true;
if ( !jQuery.isFunction( value ) ) {
raw = true;
}
if ( bulk ) {
// Bulk operations run against the entire set
if ( raw ) {
fn.call( elems, value );
fn = null;
// ...except when executing function values
} else {
bulk = fn;
fn = function( elem, key, value ) {
return bulk.call( jQuery( elem ), value );
};
}
}
if ( fn ) {
for ( ; i < length; i++ ) {
fn(
elems[ i ],
key,
raw ? value : value.call( elems[ i ], i, fn( elems[ i ], key ) )
);
}
}
}
return chainable ?
elems :
// Gets
bulk ?
fn.call( elems ) :
length ? fn( elems[ 0 ], key ) : emptyGet;
};
var rcheckableType = ( /^(?:checkbox|radio)$/i );
var rtagName = ( /<([\w:-]+)/ );
var rscriptType = ( /^$|\/(?:java|ecma)script/i );
var rleadingWhitespace = ( /^\s+/ );
var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|" +
"details|dialog|figcaption|figure|footer|header|hgroup|main|" +
"mark|meter|nav|output|picture|progress|section|summary|template|time|video";
function createSafeFragment( document ) {
var list = nodeNames.split( "|" ),
safeFrag = document.createDocumentFragment();
if ( safeFrag.createElement ) {
while ( list.length ) {
safeFrag.createElement(
list.pop()
);
}
}
return safeFrag;
}
( function() {
var div = document.createElement( "div" ),
fragment = document.createDocumentFragment(),
input = document.createElement( "input" );
// Setup
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
// IE strips leading whitespace when .innerHTML is used
support.leadingWhitespace = div.firstChild.nodeType === 3;
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
support.tbody = !div.getElementsByTagName( "tbody" ).length;
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
support.htmlSerialize = !!div.getElementsByTagName( "link" ).length;
// Makes sure cloning an html5 element does not cause problems
// Where outerHTML is undefined, this still works
support.html5Clone =
document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>";
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
input.type = "checkbox";
input.checked = true;
fragment.appendChild( input );
support.appendChecked = input.checked;
// Make sure textarea (and checkbox) defaultValue is properly cloned
// Support: IE6-IE11+
div.innerHTML = "<textarea>x</textarea>";
support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
// #11217 - WebKit loses check when the name is after the checked attribute
fragment.appendChild( div );
// Support: Windows Web Apps (WWA)
// `name` and `type` must use .setAttribute for WWA (#14901)
input = document.createElement( "input" );
input.setAttribute( "type", "radio" );
input.setAttribute( "checked", "checked" );
input.setAttribute( "name", "t" );
div.appendChild( input );
// Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
// old WebKit doesn't clone checked state correctly in fragments
support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
// Support: IE<9
// Cloned elements keep attachEvent handlers, we use addEventListener on IE9+
support.noCloneEvent = !!div.addEventListener;
// Support: IE<9
// Since attributes and properties are the same in IE,
// cleanData must set properties to undefined rather than use removeAttribute
div[ jQuery.expando ] = 1;
support.attributes = !div.getAttribute( jQuery.expando );
} )();
// We have to close these tags to support XHTML (#13200)
var wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
area: [ 1, "<map>", "</map>" ],
// Support: IE8
param: [ 1, "<object>", "</object>" ],
thead: [ 1, "<table>", "</table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
// unless wrapped in a div with non-breaking characters in front of it.
_default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
};
// Support: IE8-IE9
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
function getAll( context, tag ) {
var elems, elem,
i = 0,
found = typeof context.getElementsByTagName !== "undefined" ?
context.getElementsByTagName( tag || "*" ) :
typeof context.querySelectorAll !== "undefined" ?
context.querySelectorAll( tag || "*" ) :
undefined;
if ( !found ) {
for ( found = [], elems = context.childNodes || context;
( elem = elems[ i ] ) != null;
i++
) {
if ( !tag || jQuery.nodeName( elem, tag ) ) {
found.push( elem );
} else {
jQuery.merge( found, getAll( elem, tag ) );
}
}
}
return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
jQuery.merge( [ context ], found ) :
found;
}
// Mark scripts as having already been evaluated
function setGlobalEval( elems, refElements ) {
var elem,
i = 0;
for ( ; ( elem = elems[ i ] ) != null; i++ ) {
jQuery._data(
elem,
"globalEval",
!refElements || jQuery._data( refElements[ i ], "globalEval" )
);
}
}
var rhtml = /<|&#?\w+;/,
rtbody = /<tbody/i;
function fixDefaultChecked( elem ) {
if ( rcheckableType.test( elem.type ) ) {
elem.defaultChecked = elem.checked;
}
}
function buildFragment( elems, context, scripts, selection, ignored ) {
var j, elem, contains,
tmp, tag, tbody, wrap,
l = elems.length,
// Ensure a safe fragment
safe = createSafeFragment( context ),
nodes = [],
i = 0;
for ( ; i < l; i++ ) {
elem = elems[ i ];
if ( elem || elem === 0 ) {
// Add nodes directly
if ( jQuery.type( elem ) === "object" ) {
jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
// Convert non-html into a text node
} else if ( !rhtml.test( elem ) ) {
nodes.push( context.createTextNode( elem ) );
// Convert html into DOM nodes
} else {
tmp = tmp || safe.appendChild( context.createElement( "div" ) );
// Deserialize a standard representation
tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
wrap = wrapMap[ tag ] || wrapMap._default;
tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
// Descend through wrappers to the right content
j = wrap[ 0 ];
while ( j-- ) {
tmp = tmp.lastChild;
}
// Manually add leading whitespace removed by IE
if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[ 0 ] ) );
}
// Remove IE's autoinserted <tbody> from table fragments
if ( !support.tbody ) {
// String was a <table>, *may* have spurious <tbody>
elem = tag === "table" && !rtbody.test( elem ) ?
tmp.firstChild :
// String was a bare <thead> or <tfoot>
wrap[ 1 ] === "<table>" && !rtbody.test( elem ) ?
tmp :
0;
j = elem && elem.childNodes.length;
while ( j-- ) {
if ( jQuery.nodeName( ( tbody = elem.childNodes[ j ] ), "tbody" ) &&
!tbody.childNodes.length ) {
elem.removeChild( tbody );
}
}
}
jQuery.merge( nodes, tmp.childNodes );
// Fix #12392 for WebKit and IE > 9
tmp.textContent = "";
// Fix #12392 for oldIE
while ( tmp.firstChild ) {
tmp.removeChild( tmp.firstChild );
}
// Remember the top-level container for proper cleanup
tmp = safe.lastChild;
}
}
}
// Fix #11356: Clear elements from fragment
if ( tmp ) {
safe.removeChild( tmp );
}
// Reset defaultChecked for any radios and checkboxes
// about to be appended to the DOM in IE 6/7 (#8060)
if ( !support.appendChecked ) {
jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
}
i = 0;
while ( ( elem = nodes[ i++ ] ) ) {
// Skip elements already in the context collection (trac-4087)
if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
if ( ignored ) {
ignored.push( elem );
}
continue;
}
contains = jQuery.contains( elem.ownerDocument, elem );
// Append to fragment
tmp = getAll( safe.appendChild( elem ), "script" );
// Preserve script evaluation history
if ( contains ) {
setGlobalEval( tmp );
}
// Capture executables
if ( scripts ) {
j = 0;
while ( ( elem = tmp[ j++ ] ) ) {
if ( rscriptType.test( elem.type || "" ) ) {
scripts.push( elem );
}
}
}
}
tmp = null;
return safe;
}
( function() {
var i, eventName,
div = document.createElement( "div" );
// Support: IE<9 (lack submit/change bubble), Firefox (lack focus(in | out) events)
for ( i in { submit: true, change: true, focusin: true } ) {
eventName = "on" + i;
if ( !( support[ i ] = eventName in window ) ) {
// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
div.setAttribute( eventName, "t" );
support[ i ] = div.attributes[ eventName ].expando === false;
}
}
// Null elements to avoid leaks in IE.
div = null;
} )();
var rformElems = /^(?:input|select|textarea)$/i,
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
function returnTrue() {
return true;
}
function returnFalse() {
return false;
}
// Support: IE9
// See #13393 for more info
function safeActiveElement() {
try {
return document.activeElement;
} catch ( err ) { }
}
function on( elem, types, selector, data, fn, 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 = data || selector;
selector = undefined;
}
for ( type in types ) {
on( elem, type, selector, data, types[ type ], one );
}
return elem;
}
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 elem;
}
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 elem.each( function() {
jQuery.event.add( this, types, fn, data, selector );
} );
}
/*
* Helper functions for managing events -- not part of the public interface.
* Props to Dean Edwards' addEvent library for many of the ideas.
*/
jQuery.event = {
global: {},
add: function( elem, types, handler, data, selector ) {
var tmp, events, t, handleObjIn,
special, eventHandle, handleObj,
handlers, type, namespaces, origType,
elemData = jQuery._data( elem );
// Don't attach events to noData or text/comment nodes (but allow plain objects)
if ( !elemData ) {
return;
}
// Caller can pass in an object of custom data in lieu of the handler
if ( handler.handler ) {
handleObjIn = handler;
handler = handleObjIn.handler;
selector = handleObjIn.selector;
}
// 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
if ( !( events = elemData.events ) ) {
events = elemData.events = {};
}
if ( !( eventHandle = elemData.handle ) ) {
eventHandle = elemData.handle = 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
types = ( types || "" ).match( rnotwhite ) || [ "" ];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[ t ] ) || [];
type = origType = tmp[ 1 ];
namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
// There *must* be a type, no attaching namespace-only handlers
if ( !type ) {
continue;
}
// 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: origType,
data: data,
handler: handler,
guid: handler.guid,
selector: selector,
needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
namespace: namespaces.join( "." )
}, handleObjIn );
// Init the event handler queue if we're the first
if ( !( handlers = events[ type ] ) ) {
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;
},
// Detach an event or set of events from an element
remove: function( elem, types, handler, selector, mappedTypes ) {
var j, handleObj, tmp,
origCount, t, events,
special, handlers, type,
namespaces, origType,
elemData = jQuery.hasData( elem ) && jQuery._data( elem );
if ( !elemData || !( events = elemData.events ) ) {
return;
}
// Once for each type.namespace in types; type may be omitted
types = ( types || "" ).match( rnotwhite ) || [ "" ];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[ t ] ) || [];
type = origType = tmp[ 1 ];
namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
// 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;
handlers = events[ type ] || [];
tmp = tmp[ 2 ] &&
new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
// Remove matching events
origCount = j = handlers.length;
while ( j-- ) {
handleObj = handlers[ j ];
if ( ( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) &&
( !tmp || tmp.test( handleObj.namespace ) ) &&
( !selector || selector === handleObj.selector ||
selector === "**" && handleObj.selector ) ) {
handlers.splice( j, 1 );
if ( handleObj.selector ) {
handlers.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 ( origCount && !handlers.length ) {
if ( !special.teardown ||
special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
jQuery.removeEvent( elem, type, elemData.handle );
}
delete events[ type ];
}
}
// Remove the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) {
delete elemData.handle;
// removeData also checks for emptiness and clears the expando if empty
// so use it instead of delete
jQuery._removeData( elem, "events" );
}
},
trigger: function( event, data, elem, onlyHandlers ) {
var handle, ontype, cur,
bubbleType, special, tmp, i,
eventPath = [ elem || document ],
type = hasOwn.call( event, "type" ) ? event.type : event,
namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
cur = tmp = elem = elem || document;
// Don't do events on text and comment nodes
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
return;
}
// 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( "." ) > -1 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split( "." );
type = namespaces.shift();
namespaces.sort();
}
ontype = type.indexOf( ":" ) < 0 && "on" + type;
// Caller can pass in a jQuery.Event object, Object, or just an event type string
event = event[ jQuery.expando ] ?
event :
new jQuery.Event( type, typeof event === "object" && event );
// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
event.isTrigger = onlyHandlers ? 2 : 3;
event.namespace = namespaces.join( "." );
event.rnamespace = event.namespace ?
new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
null;
// 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 ?
[ event ] :
jQuery.makeArray( data, [ event ] );
// Allow special events to draw outside the lines
special = jQuery.event.special[ type ] || {};
if ( !onlyHandlers && 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)
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
bubbleType = special.delegateType || type;
if ( !rfocusMorph.test( bubbleType + type ) ) {
cur = cur.parentNode;
}
for ( ; cur; cur = cur.parentNode ) {
eventPath.push( cur );
tmp = cur;
}
// Only add window if we got to document (e.g., not plain obj or detached DOM)
if ( tmp === ( elem.ownerDocument || document ) ) {
eventPath.push( tmp.defaultView || tmp.parentWindow || window );
}
}
// Fire handlers on the event path
i = 0;
while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
event.type = i > 1 ?
bubbleType :
special.bindType || type;
// jQuery handler
handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] &&
jQuery._data( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
}
// Native handler
handle = ontype && cur[ ontype ];
if ( handle && handle.apply && acceptData( cur ) ) {
event.result = handle.apply( cur, data );
if ( event.result === 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( eventPath.pop(), data ) === false
) && 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)
if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method
tmp = elem[ ontype ];
if ( tmp ) {
elem[ ontype ] = null;
}
// Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type;
try {
elem[ type ]();
} catch ( e ) {
// IE<9 dies on focus/blur to hidden element (#1486,#12518)
// only reproducible on winXP IE8 native, not IE9 in IE8 mode
}
jQuery.event.triggered = undefined;
if ( tmp ) {
elem[ ontype ] = tmp;
}
}
}
}
return event.result;
},
dispatch: function( event ) {
// Make a writable jQuery.Event from the native event object
event = jQuery.event.fix( event );
var i, j, ret, matched, handleObj,
handlerQueue = [],
args = slice.call( arguments ),
handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
special = jQuery.event.special[ event.type ] || {};
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args[ 0 ] = event;
event.delegateTarget = this;
// Call the preDispatch hook for the mapped type, and let it bail if desired
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
return;
}
// Determine handlers
handlerQueue = jQuery.event.handlers.call( this, event, handlers );
// Run delegates first; they may want to stop propagation beneath us
i = 0;
while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
event.currentTarget = matched.elem;
j = 0;
while ( ( handleObj = matched.handlers[ j++ ] ) &&
!event.isImmediatePropagationStopped() ) {
// Triggered event must either 1) have no namespace, or 2) have namespace(s)
// a subset or equal to those in the bound event (both can have no namespace).
if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
event.handleObj = handleObj;
event.data = handleObj.data;
ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
handleObj.handler ).apply( matched.elem, args );
if ( ret !== undefined ) {
if ( ( event.result = ret ) === false ) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}
// Call the postDispatch hook for the mapped type
if ( special.postDispatch ) {
special.postDispatch.call( this, event );
}
return event.result;
},
handlers: function( event, handlers ) {
var i, matches, sel, handleObj,
handlerQueue = [],
delegateCount = handlers.delegateCount,
cur = event.target;
// Support (at least): Chrome, IE9
// Find delegate handlers
// Black-hole SVG <use> instance trees (#13180)
//
// Support: Firefox<=42+
// Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343)
if ( delegateCount && cur.nodeType &&
( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) {
/* jshint eqeqeq: false */
for ( ; cur != this; cur = cur.parentNode || this ) {
/* jshint eqeqeq: true */
// Don't check non-elements (#13208)
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) {
matches = [];
for ( i = 0; i < delegateCount; i++ ) {
handleObj = handlers[ i ];
// Don't conflict with Object.prototype properties (#13203)
sel = handleObj.selector + " ";
if ( matches[ sel ] === undefined ) {
matches[ sel ] = handleObj.needsContext ?
jQuery( sel, this ).index( cur ) > -1 :
jQuery.find( sel, this, null, [ cur ] ).length;
}
if ( matches[ sel ] ) {
matches.push( handleObj );
}
}
if ( matches.length ) {
handlerQueue.push( { elem: cur, handlers: matches } );
}
}
}
}
// Add the remaining (directly-bound) handlers
if ( delegateCount < handlers.length ) {
handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } );
}
return handlerQueue;
},
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
// Create a writable copy of the event object and normalize some properties
var i, prop, copy,
type = event.type,
originalEvent = event,
fixHook = this.fixHooks[ type ];
if ( !fixHook ) {
this.fixHooks[ type ] = fixHook =
rmouseEvent.test( type ) ? this.mouseHooks :
rkeyEvent.test( type ) ? this.keyHooks :
{};
}
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
event = new jQuery.Event( originalEvent );
i = copy.length;
while ( i-- ) {
prop = copy[ i ];
event[ prop ] = originalEvent[ prop ];
}
// Support: IE<9
// Fix target property (#1925)
if ( !event.target ) {
event.target = originalEvent.srcElement || document;
}
// Support: Safari 6-8+
// Target should not be a text node (#504, #13143)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;
}
// Support: IE<9
// For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
event.metaKey = !!event.metaKey;
return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
},
// Includes some event props shared by KeyEvent and MouseEvent
props: ( "altKey bubbles cancelable ctrlKey currentTarget detail 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 body, eventDoc, doc,
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;
}
},
special: {
load: {
// Prevent triggered image.load events from bubbling to window.load
noBubble: true
},
focus: {
// Fire native event if possible so blur/focus sequence is correct
trigger: function() {
if ( this !== safeActiveElement() && this.focus ) {
try {
this.focus();
return false;
} catch ( e ) {
// Support: IE<9
// If we error on focus to hidden element (#1486, #12518),
// let .trigger() run the handlers
}
}
},
delegateType: "focusin"
},
blur: {
trigger: function() {
if ( this === safeActiveElement() && this.blur ) {
this.blur();
return false;
}
},
delegateType: "focusout"
},
click: {
// For checkbox, fire native event so checked state will be right
trigger: function() {
if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
this.click();
return false;
}
},
// For cross-browser consistency, don't fire native .click() on links
_default: function( event ) {
return jQuery.nodeName( event.target, "a" );
}
},
beforeunload: {
postDispatch: function( event ) {
// Support: Firefox 20+
// Firefox doesn't alert if the returnValue field is not set.
if ( event.result !== undefined && event.originalEvent ) {
event.originalEvent.returnValue = event.result;
}
}
}
},
// Piggyback on a donor event to simulate a different one
simulate: function( type, elem, event ) {
var e = jQuery.extend(
new jQuery.Event(),
event,
{
type: type,
isSimulated: true
// Previously, `originalEvent: {}` was set here, so stopPropagation call
// would not be triggered on donor event, since in our own
// jQuery.event.stopPropagation function we had a check for existence of
// originalEvent.stopPropagation method, so, consequently it would be a noop.
//
// Guard for simulated events was moved to jQuery.event.stopPropagation function
// since `originalEvent` should point to the original event for the
// constancy with other events and for more focused logic
}
);
jQuery.event.trigger( e, null, elem );
if ( e.isDefaultPrevented() ) {
event.preventDefault();
}
}
};
jQuery.removeEvent = document.removeEventListener ?
function( elem, type, handle ) {
// This "if" is needed for plain objects
if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle );
}
} :
function( elem, type, handle ) {
var name = "on" + type;
if ( elem.detachEvent ) {
// #8545, #7054, preventing memory leaks for custom events in IE6-8
// detachEvent needed property on element, by name of that event,
// to properly expose it to GC
if ( typeof elem[ name ] === "undefined" ) {
elem[ name ] = null;
}
elem.detachEvent( name, 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.defaultPrevented === undefined &&
// Support: IE < 9, Android < 4.0
src.returnValue === false ?
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;
};
// 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 = {
constructor: jQuery.Event,
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse,
preventDefault: function() {
var e = this.originalEvent;
this.isDefaultPrevented = returnTrue;
if ( !e ) {
return;
}
// If preventDefault exists, run it on the original event
if ( e.preventDefault ) {
e.preventDefault();
// Support: IE
// Otherwise set the returnValue property of the original event to false
} else {
e.returnValue = false;
}
},
stopPropagation: function() {
var e = this.originalEvent;
this.isPropagationStopped = returnTrue;
if ( !e || this.isSimulated ) {
return;
}
// If stopPropagation exists, run it on the original event
if ( e.stopPropagation ) {
e.stopPropagation();
}
// Support: IE
// Set the cancelBubble property of the original event to true
e.cancelBubble = true;
},
stopImmediatePropagation: function() {
var e = this.originalEvent;
this.isImmediatePropagationStopped = returnTrue;
if ( e && e.stopImmediatePropagation ) {
e.stopImmediatePropagation();
}
this.stopPropagation();
}
};
// Create mouseenter/leave events using mouseover/out and event-time checks
// so that event delegation works in jQuery.
// Do the same for pointerenter/pointerleave and pointerover/pointerout
//
// Support: Safari 7 only
// Safari sends mouseenter too often; see:
// https://code.google.com/p/chromium/issues/detail?id=470258
// for the description of the bug (it existed in older Chrome versions as well).
jQuery.each( {
mouseenter: "mouseover",
mouseleave: "mouseout",
pointerenter: "pointerover",
pointerleave: "pointerout"
}, function( orig, fix ) {
jQuery.event.special[ orig ] = {
delegateType: fix,
bindType: fix,
handle: function( event ) {
var ret,
target = this,
related = event.relatedTarget,
handleObj = event.handleObj;
// For mouseenter/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 ( !support.submit ) {
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" ) ?
// Support: IE <=8
// We use jQuery.prop instead of elem.form
// to allow fixing the IE8 delegated submit issue (gh-2332)
// by 3rd party polyfills/workarounds.
jQuery.prop( elem, "form" ) :
undefined;
if ( form && !jQuery._data( form, "submit" ) ) {
jQuery.event.add( form, "submit._submit", function( event ) {
event._submitBubble = true;
} );
jQuery._data( form, "submit", true );
}
} );
// return undefined since we don't need an event listener
},
postDispatch: function( event ) {
// If form was submitted by the user, bubble the event up the tree
if ( event._submitBubble ) {
delete event._submitBubble;
if ( this.parentNode && !event.isTrigger ) {
jQuery.event.simulate( "submit", this.parentNode, event );
}
}
},
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 ( !support.change ) {
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._justChanged = true;
}
} );
jQuery.event.add( this, "click._change", function( event ) {
if ( this._justChanged && !event.isTrigger ) {
this._justChanged = false;
}
// Allow triggered, simulated change events (#11500)
jQuery.event.simulate( "change", this, event );
} );
}
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 ) && !jQuery._data( elem, "change" ) ) {
jQuery.event.add( elem, "change._change", function( event ) {
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
jQuery.event.simulate( "change", this.parentNode, event );
}
} );
jQuery._data( elem, "change", 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 );
}
};
}
// Support: Firefox
// Firefox doesn't have focus(in | out) events
// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
//
// Support: Chrome, Safari
// focus(in | out) events fire after focus & blur events,
// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
// Related ticket - https://code.google.com/p/chromium/issues/detail?id=449857
if ( !support.focusin ) {
jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
// Attach a single capturing handler on the document while someone wants focusin/focusout
var handler = function( event ) {
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
};
jQuery.event.special[ fix ] = {
setup: function() {
var doc = this.ownerDocument || this,
attaches = jQuery._data( doc, fix );
if ( !attaches ) {
doc.addEventListener( orig, handler, true );
}
jQuery._data( doc, fix, ( attaches || 0 ) + 1 );
},
teardown: function() {
var doc = this.ownerDocument || this,
attaches = jQuery._data( doc, fix ) - 1;
if ( !attaches ) {
doc.removeEventListener( orig, handler, true );
jQuery._removeData( doc, fix );
} else {
jQuery._data( doc, fix, attaches );
}
}
};
} );
}
jQuery.fn.extend( {
on: function( types, selector, data, fn ) {
return on( this, types, selector, data, fn );
},
one: function( types, selector, data, fn ) {
return on( this, types, selector, data, fn, 1 );
},
off: function( types, selector, fn ) {
var handleObj, type;
if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event
handleObj = types.handleObj;
jQuery( types.delegateTarget ).off(
handleObj.namespace ?
handleObj.origType + "." + handleObj.namespace :
handleObj.origType,
handleObj.selector,
handleObj.handler
);
return this;
}
if ( typeof types === "object" ) {
// ( types-object [, selector] )
for ( 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 );
} );
},
trigger: function( type, data ) {
return this.each( function() {
jQuery.event.trigger( type, data, this );
} );
},
triggerHandler: function( type, data ) {
var elem = this[ 0 ];
if ( elem ) {
return jQuery.event.trigger( type, data, elem, true );
}
}
} );
var rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
rnoshimcache = new RegExp( "<(?:" + nodeNames + ")[\\s/>]", "i" ),
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,
// Support: IE 10-11, Edge 10240+
// In IE/Edge using regex groups here causes severe slowdowns.
// See https://connect.microsoft.com/IE/feedback/details/1736512/
rnoInnerhtml = /<script|<style|<link/i,
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptTypeMasked = /^true\/(.*)/,
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
safeFragment = createSafeFragment( document ),
fragmentDiv = safeFragment.appendChild( document.createElement( "div" ) );
// Support: IE<8
// Manipulating tables requires a tbody
function manipulationTarget( elem, content ) {
return jQuery.nodeName( elem, "table" ) &&
jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
elem.getElementsByTagName( "tbody" )[ 0 ] ||
elem.appendChild( elem.ownerDocument.createElement( "tbody" ) ) :
elem;
}
// Replace/restore the type attribute of script elements for safe DOM manipulation
function disableScript( elem ) {
elem.type = ( jQuery.find.attr( elem, "type" ) !== null ) + "/" + elem.type;
return elem;
}
function restoreScript( elem ) {
var match = rscriptTypeMasked.exec( elem.type );
if ( match ) {
elem.type = match[ 1 ];
} else {
elem.removeAttribute( "type" );
}
return 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 ] );
}
}
}
// make the cloned public data object a copy from the original
if ( curData.data ) {
curData.data = jQuery.extend( {}, curData.data );
}
}
function fixCloneNodeIssues( src, dest ) {
var nodeName, e, data;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
return;
}
nodeName = dest.nodeName.toLowerCase();
// IE6-8 copies events bound via attachEvent when using cloneNode.
if ( !support.noCloneEvent && dest[ jQuery.expando ] ) {
data = jQuery._data( dest );
for ( e in data.events ) {
jQuery.removeEvent( dest, e, data.handle );
}
// Event data gets referenced instead of copied if the expando gets copied too
dest.removeAttribute( jQuery.expando );
}
// IE blanks contents when cloning scripts, and tries to evaluate newly-set text
if ( nodeName === "script" && dest.text !== src.text ) {
disableScript( dest ).text = src.text;
restoreScript( dest );
// IE6-10 improperly clones children of object elements using classid.
// IE10 throws NoModificationAllowedError if parent is null, #12132.
} else if ( nodeName === "object" ) {
if ( dest.parentNode ) {
dest.outerHTML = src.outerHTML;
}
// This path appears unavoidable for IE9. When cloning an object
// element in IE9, the outerHTML strategy above is not sufficient.
// If the src has innerHTML and the destination does not,
// copy the src.innerHTML into the dest.innerHTML. #10324
if ( support.html5Clone && ( src.innerHTML && !jQuery.trim( dest.innerHTML ) ) ) {
dest.innerHTML = src.innerHTML;
}
} else if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
// 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
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.defaultSelected = 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;
}
}
function domManip( collection, args, callback, ignored ) {
// Flatten any nested arrays
args = concat.apply( [], args );
var first, node, hasScripts,
scripts, doc, fragment,
i = 0,
l = collection.length,
iNoClone = l - 1,
value = args[ 0 ],
isFunction = jQuery.isFunction( value );
// We can't cloneNode fragments that contain checked, in WebKit
if ( isFunction ||
( l > 1 && typeof value === "string" &&
!support.checkClone && rchecked.test( value ) ) ) {
return collection.each( function( index ) {
var self = collection.eq( index );
if ( isFunction ) {
args[ 0 ] = value.call( this, index, self.html() );
}
domManip( self, args, callback, ignored );
} );
}
if ( l ) {
fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
first = fragment.firstChild;
if ( fragment.childNodes.length === 1 ) {
fragment = first;
}
// Require either new content or an interest in ignored elements to invoke the callback
if ( first || ignored ) {
scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
hasScripts = scripts.length;
// Use the original fragment for the last item
// instead of the first because it can end up
// being emptied incorrectly in certain situations (#8070).
for ( ; i < l; i++ ) {
node = fragment;
if ( i !== iNoClone ) {
node = jQuery.clone( node, true, true );
// Keep references to cloned scripts for later restoration
if ( hasScripts ) {
// Support: Android<4.1, PhantomJS<2
// push.apply(_, arraylike) throws on ancient WebKit
jQuery.merge( scripts, getAll( node, "script" ) );
}
}
callback.call( collection[ i ], node, i );
}
if ( hasScripts ) {
doc = scripts[ scripts.length - 1 ].ownerDocument;
// Reenable scripts
jQuery.map( scripts, restoreScript );
// Evaluate executable scripts on first document insertion
for ( i = 0; i < hasScripts; i++ ) {
node = scripts[ i ];
if ( rscriptType.test( node.type || "" ) &&
!jQuery._data( node, "globalEval" ) &&
jQuery.contains( doc, node ) ) {
if ( node.src ) {
// Optional AJAX dependency, but won't run scripts if not present
if ( jQuery._evalUrl ) {
jQuery._evalUrl( node.src );
}
} else {
jQuery.globalEval(
( node.text || node.textContent || node.innerHTML || "" )
.replace( rcleanScript, "" )
);
}
}
}
}
// Fix #11809: Avoid leaking memory
fragment = first = null;
}
}
return collection;
}
function remove( elem, selector, keepData ) {
var node,
elems = selector ? jQuery.filter( selector, elem ) : elem,
i = 0;
for ( ; ( node = elems[ i ] ) != null; i++ ) {
if ( !keepData && node.nodeType === 1 ) {
jQuery.cleanData( getAll( node ) );
}
if ( node.parentNode ) {
if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
setGlobalEval( getAll( node, "script" ) );
}
node.parentNode.removeChild( node );
}
}
return elem;
}
jQuery.extend( {
htmlPrefilter: function( html ) {
return html.replace( rxhtmlTag, "<$1></$2>" );
},
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var destElements, node, clone, i, srcElements,
inPage = jQuery.contains( elem.ownerDocument, elem );
if ( support.html5Clone || jQuery.isXMLDoc( elem ) ||
!rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
clone = elem.cloneNode( true );
// IE<=8 does not properly clone detached, unknown element nodes
} else {
fragmentDiv.innerHTML = elem.outerHTML;
fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
}
if ( ( !support.noCloneEvent || !support.noCloneChecked ) &&
( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) {
// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
destElements = getAll( clone );
srcElements = getAll( elem );
// Fix all IE cloning issues
for ( i = 0; ( node = srcElements[ i ] ) != null; ++i ) {
// Ensure that the destination node is not null; Fixes #9587
if ( destElements[ i ] ) {
fixCloneNodeIssues( node, destElements[ i ] );
}
}
}
// Copy the events from the original to the clone
if ( dataAndEvents ) {
if ( deepDataAndEvents ) {
srcElements = srcElements || getAll( elem );
destElements = destElements || getAll( clone );
for ( i = 0; ( node = srcElements[ i ] ) != null; i++ ) {
cloneCopyEvent( node, destElements[ i ] );
}
} else {
cloneCopyEvent( elem, clone );
}
}
// Preserve script evaluation history
destElements = getAll( clone, "script" );
if ( destElements.length > 0 ) {
setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
}
destElements = srcElements = node = null;
// Return the cloned set
return clone;
},
cleanData: function( elems, /* internal */ forceAcceptData ) {
var elem, type, id, data,
i = 0,
internalKey = jQuery.expando,
cache = jQuery.cache,
attributes = support.attributes,
special = jQuery.event.special;
for ( ; ( elem = elems[ i ] ) != null; i++ ) {
if ( forceAcceptData || acceptData( elem ) ) {
id = elem[ internalKey ];
data = id && cache[ id ];
if ( data ) {
if ( data.events ) {
for ( 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 );
}
}
}
// Remove cache only if it was not already removed by jQuery.event.remove
if ( cache[ id ] ) {
delete cache[ id ];
// Support: IE<9
// IE does not allow us to delete expando properties from nodes
// IE creates expando attributes along with the property
// IE does not have a removeAttribute function on Document nodes
if ( !attributes && typeof elem.removeAttribute !== "undefined" ) {
elem.removeAttribute( internalKey );
// Webkit & Blink performance suffers when deleting properties
// from DOM nodes, so set to undefined instead
// https://code.google.com/p/chromium/issues/detail?id=378607
} else {
elem[ internalKey ] = undefined;
}
deletedIds.push( id );
}
}
}
}
}
} );
jQuery.fn.extend( {
// Keep domManip exposed until 3.0 (gh-2225)
domManip: domManip,
detach: function( selector ) {
return remove( this, selector, true );
},
remove: function( selector ) {
return remove( this, selector );
},
text: function( value ) {
return access( this, function( value ) {
return value === undefined ?
jQuery.text( this ) :
this.empty().append(
( this[ 0 ] && this[ 0 ].ownerDocument || document ).createTextNode( value )
);
}, null, value, arguments.length );
},
append: function() {
return domManip( this, arguments, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
var target = manipulationTarget( this, elem );
target.appendChild( elem );
}
} );
},
prepend: function() {
return domManip( this, arguments, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
var target = manipulationTarget( this, elem );
target.insertBefore( elem, target.firstChild );
}
} );
},
before: function() {
return domManip( this, arguments, function( elem ) {
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this );
}
} );
},
after: function() {
return domManip( this, arguments, function( elem ) {
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this.nextSibling );
}
} );
},
empty: function() {
var elem,
i = 0;
for ( ; ( elem = this[ i ] ) != null; i++ ) {
// Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem, false ) );
}
// Remove any remaining nodes
while ( elem.firstChild ) {
elem.removeChild( elem.firstChild );
}
// If this is a select, ensure that it displays empty (#12336)
// Support: IE<9
if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
elem.options.length = 0;
}
}
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 ) {
return access( this, function( value ) {
var elem = this[ 0 ] || {},
i = 0,
l = this.length;
if ( value === undefined ) {
return elem.nodeType === 1 ?
elem.innerHTML.replace( rinlinejQuery, "" ) :
undefined;
}
// See if we can take a shortcut and just use innerHTML
if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
( support.htmlSerialize || !rnoshimcache.test( value ) ) &&
( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
!wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
value = jQuery.htmlPrefilter( value );
try {
for ( ; i < l; i++ ) {
// Remove element nodes and prevent memory leaks
elem = this[ i ] || {};
if ( elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem, false ) );
elem.innerHTML = value;
}
}
elem = 0;
// If using innerHTML throws an exception, use the fallback method
} catch ( e ) {}
}
if ( elem ) {
this.empty().append( value );
}
}, null, value, arguments.length );
},
replaceWith: function() {
var ignored = [];
// Make the changes, replacing each non-ignored context element with the new content
return domManip( this, arguments, function( elem ) {
var parent = this.parentNode;
if ( jQuery.inArray( this, ignored ) < 0 ) {
jQuery.cleanData( getAll( this ) );
if ( parent ) {
parent.replaceChild( elem, this );
}
}
// Force callback invocation
}, ignored );
}
} );
jQuery.each( {
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function( name, original ) {
jQuery.fn[ name ] = function( selector ) {
var elems,
i = 0,
ret = [],
insert = jQuery( selector ),
last = insert.length - 1;
for ( ; i <= last; i++ ) {
elems = i === last ? this : this.clone( true );
jQuery( insert[ i ] )[ original ]( elems );
// Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
push.apply( ret, elems.get() );
}
return this.pushStack( ret );
};
} );
var iframe,
elemdisplay = {
// Support: Firefox
// We have to pre-define these values for FF (#10227)
HTML: "block",
BODY: "block"
};
/**
* Retrieve the actual display of a element
* @param {String} name nodeName of the element
* @param {Object} doc Document object
*/
// Called only from within defaultDisplay
function actualDisplay( name, doc ) {
var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
display = jQuery.css( elem[ 0 ], "display" );
// We don't have any data stored on the element,
// so use "detach" method as fast way to get rid of the element
elem.detach();
return display;
}
/**
* Try to determine the default display value of an element
* @param {String} nodeName
*/
function defaultDisplay( nodeName ) {
var doc = document,
display = elemdisplay[ nodeName ];
if ( !display ) {
display = actualDisplay( nodeName, doc );
// If the simple way fails, read from inside an iframe
if ( display === "none" || !display ) {
// Use the already-created iframe if possible
iframe = ( iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" ) )
.appendTo( doc.documentElement );
// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document;
// Support: IE
doc.write();
doc.close();
display = actualDisplay( nodeName, doc );
iframe.detach();
}
// Store the correct default display
elemdisplay[ nodeName ] = display;
}
return display;
}
var rmargin = ( /^margin/ );
var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
var swap = function( elem, options, callback, args ) {
var ret, name,
old = {};
// Remember the old values, and insert the new ones
for ( name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
ret = callback.apply( elem, args || [] );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
return ret;
};
var documentElement = document.documentElement;
( function() {
var pixelPositionVal, pixelMarginRightVal, boxSizingReliableVal,
reliableHiddenOffsetsVal, reliableMarginRightVal, reliableMarginLeftVal,
container = document.createElement( "div" ),
div = document.createElement( "div" );
// Finish early in limited (non-browser) environments
if ( !div.style ) {
return;
}
div.style.cssText = "float:left;opacity:.5";
// Support: IE<9
// Make sure that element opacity exists (as opposed to filter)
support.opacity = div.style.opacity === "0.5";
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
support.cssFloat = !!div.style.cssFloat;
div.style.backgroundClip = "content-box";
div.cloneNode( true ).style.backgroundClip = "";
support.clearCloneStyle = div.style.backgroundClip === "content-box";
container = document.createElement( "div" );
container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
"padding:0;margin-top:1px;position:absolute";
div.innerHTML = "";
container.appendChild( div );
// Support: Firefox<29, Android 2.3
// Vendor-prefix box-sizing
support.boxSizing = div.style.boxSizing === "" || div.style.MozBoxSizing === "" ||
div.style.WebkitBoxSizing === "";
jQuery.extend( support, {
reliableHiddenOffsets: function() {
if ( pixelPositionVal == null ) {
computeStyleTests();
}
return reliableHiddenOffsetsVal;
},
boxSizingReliable: function() {
// We're checking for pixelPositionVal here instead of boxSizingReliableVal
// since that compresses better and they're computed together anyway.
if ( pixelPositionVal == null ) {
computeStyleTests();
}
return boxSizingReliableVal;
},
pixelMarginRight: function() {
// Support: Android 4.0-4.3
if ( pixelPositionVal == null ) {
computeStyleTests();
}
return pixelMarginRightVal;
},
pixelPosition: function() {
if ( pixelPositionVal == null ) {
computeStyleTests();
}
return pixelPositionVal;
},
reliableMarginRight: function() {
// Support: Android 2.3
if ( pixelPositionVal == null ) {
computeStyleTests();
}
return reliableMarginRightVal;
},
reliableMarginLeft: function() {
// Support: IE <=8 only, Android 4.0 - 4.3 only, Firefox <=3 - 37
if ( pixelPositionVal == null ) {
computeStyleTests();
}
return reliableMarginLeftVal;
}
} );
function computeStyleTests() {
var contents, divStyle,
documentElement = document.documentElement;
// Setup
documentElement.appendChild( container );
div.style.cssText =
// Support: Android 2.3
// Vendor-prefix box-sizing
"-webkit-box-sizing:border-box;box-sizing:border-box;" +
"position:relative;display:block;" +
"margin:auto;border:1px;padding:1px;" +
"top:1%;width:50%";
// Support: IE<9
// Assume reasonable values in the absence of getComputedStyle
pixelPositionVal = boxSizingReliableVal = reliableMarginLeftVal = false;
pixelMarginRightVal = reliableMarginRightVal = true;
// Check for getComputedStyle so that this code is not run in IE<9.
if ( window.getComputedStyle ) {
divStyle = window.getComputedStyle( div );
pixelPositionVal = ( divStyle || {} ).top !== "1%";
reliableMarginLeftVal = ( divStyle || {} ).marginLeft === "2px";
boxSizingReliableVal = ( divStyle || { width: "4px" } ).width === "4px";
// Support: Android 4.0 - 4.3 only
// Some styles come back with percentage values, even though they shouldn't
div.style.marginRight = "50%";
pixelMarginRightVal = ( divStyle || { marginRight: "4px" } ).marginRight === "4px";
// Support: Android 2.3 only
// Div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container (#3333)
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
contents = div.appendChild( document.createElement( "div" ) );
// Reset CSS: box-sizing; display; margin; border; padding
contents.style.cssText = div.style.cssText =
// Support: Android 2.3
// Vendor-prefix box-sizing
"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
"box-sizing:content-box;display:block;margin:0;border:0;padding:0";
contents.style.marginRight = contents.style.width = "0";
div.style.width = "1px";
reliableMarginRightVal =
!parseFloat( ( window.getComputedStyle( contents ) || {} ).marginRight );
div.removeChild( contents );
}
// Support: IE6-8
// First check that getClientRects works as expected
// 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).
div.style.display = "none";
reliableHiddenOffsetsVal = div.getClientRects().length === 0;
if ( reliableHiddenOffsetsVal ) {
div.style.display = "";
div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
div.childNodes[ 0 ].style.borderCollapse = "separate";
contents = div.getElementsByTagName( "td" );
contents[ 0 ].style.cssText = "margin:0;border:0;padding:0;display:none";
reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
if ( reliableHiddenOffsetsVal ) {
contents[ 0 ].style.display = "";
contents[ 1 ].style.display = "none";
reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
}
}
// Teardown
documentElement.removeChild( container );
}
} )();
var getStyles, curCSS,
rposition = /^(top|right|bottom|left)$/;
if ( window.getComputedStyle ) {
getStyles = function( elem ) {
// Support: IE<=11+, Firefox<=30+ (#15098, #14150)
// IE throws on elements created in popups
// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
var view = elem.ownerDocument.defaultView;
if ( !view || !view.opener ) {
view = window;
}
return view.getComputedStyle( elem );
};
curCSS = function( elem, name, computed ) {
var width, minWidth, maxWidth, ret,
style = elem.style;
computed = computed || getStyles( elem );
// getPropertyValue is only needed for .css('filter') in IE9, see #12537
ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined;
// Support: Opera 12.1x only
// Fall back to style even without computed
// computed is undefined for elems on document fragments
if ( ( ret === "" || ret === undefined ) && !jQuery.contains( elem.ownerDocument, elem ) ) {
ret = jQuery.style( elem, name );
}
if ( computed ) {
// A tribute to the "awesome hack by Dean Edwards"
// Chrome < 17 and Safari 5.0 uses "computed value"
// instead of "used value" for margin-right
// Safari 5.1.7 (at least) returns percentage for a larger set of values,
// but width seems to be reliably pixels
// this is against the CSSOM draft spec:
// http://dev.w3.org/csswg/cssom/#resolved-values
if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
// Remember the original values
width = style.width;
minWidth = style.minWidth;
maxWidth = style.maxWidth;
// Put in the new values to get a computed value out
style.minWidth = style.maxWidth = style.width = ret;
ret = computed.width;
// Revert the changed values
style.width = width;
style.minWidth = minWidth;
style.maxWidth = maxWidth;
}
}
// Support: IE
// IE returns zIndex value as an integer.
return ret === undefined ?
ret :
ret + "";
};
} else if ( documentElement.currentStyle ) {
getStyles = function( elem ) {
return elem.currentStyle;
};
curCSS = function( elem, name, computed ) {
var left, rs, rsLeft, ret,
style = elem.style;
computed = computed || getStyles( elem );
ret = computed ? computed[ name ] : undefined;
// Avoid setting ret to empty string here
// so we don't default to auto
if ( ret == null && style && style[ name ] ) {
ret = style[ name ];
}
// 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
// but not position css attributes, as those are
// proportional to the parent element instead
// and we can't measure the parent instead because it
// might trigger a "stacking dolls" problem
if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
// Remember the original values
left = style.left;
rs = elem.runtimeStyle;
rsLeft = rs && rs.left;
// Put in the new values to get a computed value out
if ( rsLeft ) {
rs.left = elem.currentStyle.left;
}
style.left = name === "fontSize" ? "1em" : ret;
ret = style.pixelLeft + "px";
// Revert the changed values
style.left = left;
if ( rsLeft ) {
rs.left = rsLeft;
}
}
// Support: IE
// IE returns zIndex value as an integer.
return ret === undefined ?
ret :
ret + "" || "auto";
};
}
function addGetHookIf( conditionFn, hookFn ) {
// Define the hook, we'll check on the first run if it's really needed.
return {
get: function() {
if ( conditionFn() ) {
// Hook not needed (or it's not possible to use it due
// to missing dependency), remove it.
delete this.get;
return;
}
// Hook needed; redefine it so that the support test is not executed again.
return ( this.get = hookFn ).apply( this, arguments );
}
};
}
var
ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity\s*=\s*([^)]*)/i,
// swappable if display is none or starts with table except
// "table", "table-cell", or "table-caption"
// see here for display values:
// https://developer.mozilla.org/en-US/docs/CSS/display
rdisplayswap = /^(none|table(?!-c[ea]).+)/,
rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssNormalTransform = {
letterSpacing: "0",
fontWeight: "400"
},
cssPrefixes = [ "Webkit", "O", "Moz", "ms" ],
emptyStyle = document.createElement( "div" ).style;
// return a css property mapped to a potentially vendor prefixed property
function vendorPropName( name ) {
// shortcut for names that are not vendor prefixed
if ( name in emptyStyle ) {
return name;
}
// check for vendor prefixed names
var capName = name.charAt( 0 ).toUpperCase() + name.slice( 1 ),
i = cssPrefixes.length;
while ( i-- ) {
name = cssPrefixes[ i ] + capName;
if ( name in emptyStyle ) {
return name;
}
}
}
function showHide( elements, show ) {
var display, elem, hidden,
values = [],
index = 0,
length = elements.length;
for ( ; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
values[ index ] = jQuery._data( elem, "olddisplay" );
display = elem.style.display;
if ( show ) {
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !values[ index ] && display === "none" ) {
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 ( elem.style.display === "" && isHidden( elem ) ) {
values[ index ] =
jQuery._data( elem, "olddisplay", defaultDisplay( elem.nodeName ) );
}
} else {
hidden = isHidden( elem );
if ( display && display !== "none" || !hidden ) {
jQuery._data(
elem,
"olddisplay",
hidden ? display : jQuery.css( elem, "display" )
);
}
}
}
// Set the display of most of the elements in a second loop
// to avoid the constant reflow
for ( index = 0; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
elem.style.display = show ? values[ index ] || "" : "none";
}
}
return elements;
}
function setPositiveNumber( elem, value, subtract ) {
var matches = rnumsplit.exec( value );
return matches ?
// Guard against undefined "subtract", e.g., when used as in cssHooks
Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
value;
}
function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
var i = extra === ( isBorderBox ? "border" : "content" ) ?
// If we already have the right measurement, avoid augmentation
4 :
// Otherwise initialize for horizontal or vertical properties
name === "width" ? 1 : 0,
val = 0;
for ( ; i < 4; i += 2 ) {
// both box models exclude margin, so add it if we want it
if ( extra === "margin" ) {
val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
}
if ( isBorderBox ) {
// border-box includes padding, so remove it if we want content
if ( extra === "content" ) {
val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
}
// at this point, extra isn't border nor margin, so remove border
if ( extra !== "margin" ) {
val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
}
} else {
// at this point, extra isn't content, so add padding
val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
// at this point, extra isn't content nor padding, so add border
if ( extra !== "padding" ) {
val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
}
}
}
return val;
}
function getWidthOrHeight( elem, name, extra ) {
// Start with offset property, which is equivalent to the border-box value
var valueIsBorderBox = true,
val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
styles = getStyles( elem ),
isBorderBox = support.boxSizing &&
jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
// some non-html elements return undefined for offsetWidth, so check for null/undefined
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
if ( val <= 0 || val == null ) {
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name, styles );
if ( val < 0 || val == null ) {
val = elem.style[ name ];
}
// Computed unit is not pixels. Stop here and return.
if ( rnumnonpx.test( val ) ) {
return val;
}
// we need the check for style in case a browser which returns unreliable values
// for getComputedStyle silently falls back to the reliable elem.style
valueIsBorderBox = isBorderBox &&
( support.boxSizingReliable() || val === elem.style[ name ] );
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
}
// use the active box-sizing model to add/subtract irrelevant styles
return ( val +
augmentWidthOrHeight(
elem,
name,
extra || ( isBorderBox ? "border" : "content" ),
valueIsBorderBox,
styles
)
) + "px";
}
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" );
return ret === "" ? "1" : ret;
}
}
}
},
// Don't automatically add "px" to these possibly-unitless properties
cssNumber: {
"animationIterationCount": true,
"columnCount": true,
"fillOpacity": true,
"flexGrow": true,
"flexShrink": true,
"fontWeight": true,
"lineHeight": true,
"opacity": true,
"order": 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": 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, hooks,
origName = jQuery.camelCase( name ),
style = elem.style;
name = jQuery.cssProps[ origName ] ||
( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
// gets hook for the prefixed version
// followed by the unprefixed version
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
// Check if we're setting a value
if ( value !== undefined ) {
type = typeof value;
// Convert "+=" or "-=" to relative numbers (#7345)
if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
value = adjustCSS( elem, name, ret );
// Fixes bug #9237
type = "number";
}
// Make sure that null and NaN values aren't set. See: #7116
if ( value == null || value !== value ) {
return;
}
// If a number was passed in, add the unit (except for certain CSS properties)
if ( type === "number" ) {
value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
}
// Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
// but it would mean to define eight
// (for every problematic property) identical functions
if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
style[ name ] = "inherit";
}
// If a hook was provided, use that value, otherwise just set the specified value
if ( !hooks || !( "set" in hooks ) ||
( value = hooks.set( elem, value, extra ) ) !== undefined ) {
// Support: IE
// Swallow errors from 'invalid' CSS values (#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, styles ) {
var num, val, hooks,
origName = jQuery.camelCase( name );
// Make sure that we're working with the right name
name = jQuery.cssProps[ origName ] ||
( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
// gets hook for the prefixed version
// followed by the unprefixed version
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
// If a hook was provided get the computed value from there
if ( hooks && "get" in hooks ) {
val = hooks.get( elem, true, extra );
}
// Otherwise, if a way to get the computed value exists, use that
if ( val === undefined ) {
val = curCSS( elem, name, styles );
}
//convert "normal" to computed value
if ( val === "normal" && name in cssNormalTransform ) {
val = cssNormalTransform[ name ];
}
// Return, converting to number if forced or a qualifier was provided and val looks numeric
if ( extra === "" || extra ) {
num = parseFloat( val );
return extra === true || isFinite( num ) ? num || 0 : val;
}
return val;
}
} );
jQuery.each( [ "height", "width" ], function( i, name ) {
jQuery.cssHooks[ name ] = {
get: function( elem, computed, extra ) {
if ( computed ) {
// certain elements can have dimension info if we invisibly show them
// however, it must have a current display style that would benefit from this
return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
elem.offsetWidth === 0 ?
swap( elem, cssShow, function() {
return getWidthOrHeight( elem, name, extra );
} ) :
getWidthOrHeight( elem, name, extra );
}
},
set: function( elem, value, extra ) {
var styles = extra && getStyles( elem );
return setPositiveNumber( elem, value, extra ?
augmentWidthOrHeight(
elem,
name,
extra,
support.boxSizing &&
jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
styles
) : 0
);
}
};
} );
if ( !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 ) || "" ) ?
( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
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 === "", then remove inline opacity #12685
if ( ( value >= 1 || value === "" ) &&
jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
style.removeAttribute ) {
// 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 is no filter style applied in a css rule
// or unset inline opacity, we are done
if ( value === "" || currentStyle && !currentStyle.filter ) {
return;
}
}
// otherwise, set new filter values
style.filter = ralpha.test( filter ) ?
filter.replace( ralpha, opacity ) :
filter + " " + opacity;
}
};
}
jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
function( elem, computed ) {
if ( computed ) {
return swap( elem, { "display": "inline-block" },
curCSS, [ elem, "marginRight" ] );
}
}
);
jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
function( elem, computed ) {
if ( computed ) {
return (
parseFloat( curCSS( elem, "marginLeft" ) ) ||
// Support: IE<=11+
// Running getBoundingClientRect on a disconnected node in IE throws an error
// Support: IE8 only
// getClientRects() errors on disconnected elems
( jQuery.contains( elem.ownerDocument, elem ) ?
elem.getBoundingClientRect().left -
swap( elem, { marginLeft: 0 }, function() {
return elem.getBoundingClientRect().left;
} ) :
0
)
) + "px";
}
}
);
// These hooks are used by animate to expand properties
jQuery.each( {
margin: "",
padding: "",
border: "Width"
}, function( prefix, suffix ) {
jQuery.cssHooks[ prefix + suffix ] = {
expand: function( value ) {
var i = 0,
expanded = {},
// assumes a single number if not a string
parts = typeof value === "string" ? value.split( " " ) : [ value ];
for ( ; i < 4; i++ ) {
expanded[ prefix + cssExpand[ i ] + suffix ] =
parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
}
return expanded;
}
};
if ( !rmargin.test( prefix ) ) {
jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
}
} );
jQuery.fn.extend( {
css: function( name, value ) {
return access( this, function( elem, name, value ) {
var styles, len,
map = {},
i = 0;
if ( jQuery.isArray( name ) ) {
styles = getStyles( elem );
len = name.length;
for ( ; i < len; i++ ) {
map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
}
return map;
}
return value !== undefined ?
jQuery.style( elem, name, value ) :
jQuery.css( elem, name );
}, name, value, arguments.length > 1 );
},
show: function() {
return showHide( this, true );
},
hide: function() {
return showHide( this );
},
toggle: function( state ) {
if ( typeof state === "boolean" ) {
return state ? this.show() : this.hide();
}
return this.each( function() {
if ( isHidden( this ) ) {
jQuery( this ).show();
} else {
jQuery( this ).hide();
}
} );
}
} );
function Tween( elem, options, prop, end, easing ) {
return new Tween.prototype.init( elem, options, prop, end, easing );
}
jQuery.Tween = Tween;
Tween.prototype = {
constructor: Tween,
init: function( elem, options, prop, end, easing, unit ) {
this.elem = elem;
this.prop = prop;
this.easing = easing || jQuery.easing._default;
this.options = options;
this.start = this.now = this.cur();
this.end = end;
this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
},
cur: function() {
var hooks = Tween.propHooks[ this.prop ];
return hooks && hooks.get ?
hooks.get( this ) :
Tween.propHooks._default.get( this );
},
run: function( percent ) {
var eased,
hooks = Tween.propHooks[ this.prop ];
if ( this.options.duration ) {
this.pos = eased = jQuery.easing[ this.easing ](
percent, this.options.duration * percent, 0, 1, this.options.duration
);
} else {
this.pos = eased = percent;
}
this.now = ( this.end - this.start ) * eased + this.start;
if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this );
}
if ( hooks && hooks.set ) {
hooks.set( this );
} else {
Tween.propHooks._default.set( this );
}
return this;
}
};
Tween.prototype.init.prototype = Tween.prototype;
Tween.propHooks = {
_default: {
get: function( tween ) {
var result;
// Use a property on the element directly when it is not a DOM element,
// or when there is no matching style property that exists.
if ( tween.elem.nodeType !== 1 ||
tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
return tween.elem[ tween.prop ];
}
// passing an empty string as a 3rd parameter to .css will automatically
// attempt a parseFloat and fallback to a string if the parse fails
// so, simple values such as "10px" are parsed to Float.
// complex values such as "rotate(1rad)" are returned as is.
result = jQuery.css( tween.elem, tween.prop, "" );
// Empty strings, null, undefined and "auto" are converted to 0.
return !result || result === "auto" ? 0 : result;
},
set: function( tween ) {
// use step hook for back compat - use cssHook if its there - use .style if its
// available and use plain properties where available
if ( jQuery.fx.step[ tween.prop ] ) {
jQuery.fx.step[ tween.prop ]( tween );
} else if ( tween.elem.nodeType === 1 &&
( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
jQuery.cssHooks[ tween.prop ] ) ) {
jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
} else {
tween.elem[ tween.prop ] = tween.now;
}
}
}
};
// Support: IE <=9
// Panic based approach to setting things on disconnected nodes
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
set: function( tween ) {
if ( tween.elem.nodeType && tween.elem.parentNode ) {
tween.elem[ tween.prop ] = tween.now;
}
}
};
jQuery.easing = {
linear: function( p ) {
return p;
},
swing: function( p ) {
return 0.5 - Math.cos( p * Math.PI ) / 2;
},
_default: "swing"
};
jQuery.fx = Tween.prototype.init;
// Back Compat <1.8 extension point
jQuery.fx.step = {};
var
fxNow, timerId,
rfxtypes = /^(?:toggle|show|hide)$/,
rrun = /queueHooks$/;
// Animations created synchronously will run synchronously
function createFxNow() {
window.setTimeout( function() {
fxNow = undefined;
} );
return ( fxNow = jQuery.now() );
}
// Generate parameters to create a standard animation
function genFx( type, includeWidth ) {
var which,
attrs = { height: type },
i = 0;
// if we include width, step value is 1 to do all cssExpand values,
// if we don't include width, step value is 2 to skip over Left and Right
includeWidth = includeWidth ? 1 : 0;
for ( ; i < 4 ; i += 2 - includeWidth ) {
which = cssExpand[ i ];
attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
}
if ( includeWidth ) {
attrs.opacity = attrs.width = type;
}
return attrs;
}
function createTween( value, prop, animation ) {
var tween,
collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
index = 0,
length = collection.length;
for ( ; index < length; index++ ) {
if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
// we're done with this property
return tween;
}
}
}
function defaultPrefilter( elem, props, opts ) {
/* jshint validthis: true */
var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
anim = this,
orig = {},
style = elem.style,
hidden = elem.nodeType && isHidden( elem ),
dataShow = jQuery._data( elem, "fxshow" );
// handle queue: false promises
if ( !opts.queue ) {
hooks = jQuery._queueHooks( elem, "fx" );
if ( hooks.unqueued == null ) {
hooks.unqueued = 0;
oldfire = hooks.empty.fire;
hooks.empty.fire = function() {
if ( !hooks.unqueued ) {
oldfire();
}
};
}
hooks.unqueued++;
anim.always( function() {
// doing this makes sure that the complete handler will be called
// before this completes
anim.always( function() {
hooks.unqueued--;
if ( !jQuery.queue( elem, "fx" ).length ) {
hooks.empty.fire();
}
} );
} );
}
// height/width overflow pass
if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
// 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
opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
// Set display property to inline-block for height/width
// animations on inline elements that are having width/height animated
display = jQuery.css( elem, "display" );
// Test default display if display is currently "none"
checkDisplay = display === "none" ?
jQuery._data( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
// inline-level elements accept inline-block;
// block-level elements need to be inline with layout
if ( !support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) {
style.display = "inline-block";
} else {
style.zoom = 1;
}
}
}
if ( opts.overflow ) {
style.overflow = "hidden";
if ( !support.shrinkWrapBlocks() ) {
anim.always( function() {
style.overflow = opts.overflow[ 0 ];
style.overflowX = opts.overflow[ 1 ];
style.overflowY = opts.overflow[ 2 ];
} );
}
}
// show/hide pass
for ( prop in props ) {
value = props[ prop ];
if ( rfxtypes.exec( value ) ) {
delete props[ prop ];
toggle = toggle || value === "toggle";
if ( value === ( hidden ? "hide" : "show" ) ) {
// If there is dataShow left over from a stopped hide or show
// and we are going to proceed with show, we should pretend to be hidden
if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
hidden = true;
} else {
continue;
}
}
orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
// Any non-fx value stops us from restoring the original display value
} else {
display = undefined;
}
}
if ( !jQuery.isEmptyObject( orig ) ) {
if ( dataShow ) {
if ( "hidden" in dataShow ) {
hidden = dataShow.hidden;
}
} else {
dataShow = jQuery._data( elem, "fxshow", {} );
}
// store state if its toggle - enables .stop().toggle() to "reverse"
if ( toggle ) {
dataShow.hidden = !hidden;
}
if ( hidden ) {
jQuery( elem ).show();
} else {
anim.done( function() {
jQuery( elem ).hide();
} );
}
anim.done( function() {
var prop;
jQuery._removeData( elem, "fxshow" );
for ( prop in orig ) {
jQuery.style( elem, prop, orig[ prop ] );
}
} );
for ( prop in orig ) {
tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
if ( !( prop in dataShow ) ) {
dataShow[ prop ] = tween.start;
if ( hidden ) {
tween.end = tween.start;
tween.start = prop === "width" || prop === "height" ? 1 : 0;
}
}
}
// If this is a noop like .hide().hide(), restore an overwritten display value
} else if ( ( display === "none" ? defaultDisplay( elem.nodeName ) : display ) === "inline" ) {
style.display = display;
}
}
function propFilter( props, specialEasing ) {
var index, name, easing, value, hooks;
// camelCase, specialEasing and expand cssHook pass
for ( index in props ) {
name = jQuery.camelCase( index );
easing = specialEasing[ name ];
value = props[ index ];
if ( jQuery.isArray( value ) ) {
easing = value[ 1 ];
value = props[ index ] = value[ 0 ];
}
if ( index !== name ) {
props[ name ] = value;
delete props[ index ];
}
hooks = jQuery.cssHooks[ name ];
if ( hooks && "expand" in hooks ) {
value = hooks.expand( value );
delete props[ name ];
// not quite $.extend, this wont overwrite keys already present.
// also - reusing 'index' from above because we have the correct "name"
for ( index in value ) {
if ( !( index in props ) ) {
props[ index ] = value[ index ];
specialEasing[ index ] = easing;
}
}
} else {
specialEasing[ name ] = easing;
}
}
}
function Animation( elem, properties, options ) {
var result,
stopped,
index = 0,
length = Animation.prefilters.length,
deferred = jQuery.Deferred().always( function() {
// don't match elem in the :animated selector
delete tick.elem;
} ),
tick = function() {
if ( stopped ) {
return false;
}
var currentTime = fxNow || createFxNow(),
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
// Support: Android 2.3
// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
temp = remaining / animation.duration || 0,
percent = 1 - temp,
index = 0,
length = animation.tweens.length;
for ( ; index < length ; index++ ) {
animation.tweens[ index ].run( percent );
}
deferred.notifyWith( elem, [ animation, percent, remaining ] );
if ( percent < 1 && length ) {
return remaining;
} else {
deferred.resolveWith( elem, [ animation ] );
return false;
}
},
animation = deferred.promise( {
elem: elem,
props: jQuery.extend( {}, properties ),
opts: jQuery.extend( true, {
specialEasing: {},
easing: jQuery.easing._default
}, options ),
originalProperties: properties,
originalOptions: options,
startTime: fxNow || createFxNow(),
duration: options.duration,
tweens: [],
createTween: function( prop, end ) {
var tween = jQuery.Tween( elem, animation.opts, prop, end,
animation.opts.specialEasing[ prop ] || animation.opts.easing );
animation.tweens.push( tween );
return tween;
},
stop: function( gotoEnd ) {
var index = 0,
// if we are going to the end, we want to run all the tweens
// otherwise we skip this part
length = gotoEnd ? animation.tweens.length : 0;
if ( stopped ) {
return this;
}
stopped = true;
for ( ; index < length ; index++ ) {
animation.tweens[ index ].run( 1 );
}
// resolve when we played the last frame
// otherwise, reject
if ( gotoEnd ) {
deferred.notifyWith( elem, [ animation, 1, 0 ] );
deferred.resolveWith( elem, [ animation, gotoEnd ] );
} else {
deferred.rejectWith( elem, [ animation, gotoEnd ] );
}
return this;
}
} ),
props = animation.props;
propFilter( props, animation.opts.specialEasing );
for ( ; index < length ; index++ ) {
result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
if ( result ) {
if ( jQuery.isFunction( result.stop ) ) {
jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
jQuery.proxy( result.stop, result );
}
return result;
}
}
jQuery.map( props, createTween, animation );
if ( jQuery.isFunction( animation.opts.start ) ) {
animation.opts.start.call( elem, animation );
}
jQuery.fx.timer(
jQuery.extend( tick, {
elem: elem,
anim: animation,
queue: animation.opts.queue
} )
);
// attach callbacks from options
return animation.progress( animation.opts.progress )
.done( animation.opts.done, animation.opts.complete )
.fail( animation.opts.fail )
.always( animation.opts.always );
}
jQuery.Animation = jQuery.extend( Animation, {
tweeners: {
"*": [ function( prop, value ) {
var tween = this.createTween( prop, value );
adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
return tween;
} ]
},
tweener: function( props, callback ) {
if ( jQuery.isFunction( props ) ) {
callback = props;
props = [ "*" ];
} else {
props = props.match( rnotwhite );
}
var prop,
index = 0,
length = props.length;
for ( ; index < length ; index++ ) {
prop = props[ index ];
Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
Animation.tweeners[ prop ].unshift( callback );
}
},
prefilters: [ defaultPrefilter ],
prefilter: function( callback, prepend ) {
if ( prepend ) {
Animation.prefilters.unshift( callback );
} else {
Animation.prefilters.push( callback );
}
}
} );
jQuery.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() {
if ( jQuery.isFunction( opt.old ) ) {
opt.old.call( this );
}
if ( opt.queue ) {
jQuery.dequeue( this, opt.queue );
}
};
return opt;
};
jQuery.fn.extend( {
fadeTo: function( speed, to, easing, callback ) {
// show any hidden elements after setting opacity to 0
return this.filter( isHidden ).css( "opacity", 0 ).show()
// animate to the value specified
.end().animate( { opacity: to }, speed, easing, callback );
},
animate: function( prop, speed, easing, callback ) {
var empty = jQuery.isEmptyObject( prop ),
optall = jQuery.speed( speed, easing, callback ),
doAnimation = function() {
// Operate on a copy of prop so per-property easing won't be lost
var anim = Animation( this, jQuery.extend( {}, prop ), optall );
// Empty animations, or finishing resolves immediately
if ( empty || jQuery._data( this, "finish" ) ) {
anim.stop( true );
}
};
doAnimation.finish = doAnimation;
return empty || optall.queue === false ?
this.each( doAnimation ) :
this.queue( optall.queue, doAnimation );
},
stop: function( type, clearQueue, gotoEnd ) {
var stopQueue = function( hooks ) {
var stop = hooks.stop;
delete hooks.stop;
stop( gotoEnd );
};
if ( typeof type !== "string" ) {
gotoEnd = clearQueue;
clearQueue = type;
type = undefined;
}
if ( clearQueue && type !== false ) {
this.queue( type || "fx", [] );
}
return this.each( function() {
var dequeue = true,
index = type != null && type + "queueHooks",
timers = jQuery.timers,
data = jQuery._data( this );
if ( index ) {
if ( data[ index ] && data[ index ].stop ) {
stopQueue( data[ index ] );
}
} else {
for ( index in data ) {
if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
stopQueue( data[ index ] );
}
}
}
for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this &&
( type == null || timers[ index ].queue === type ) ) {
timers[ index ].anim.stop( gotoEnd );
dequeue = false;
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 ( dequeue || !gotoEnd ) {
jQuery.dequeue( this, type );
}
} );
},
finish: function( type ) {
if ( type !== false ) {
type = type || "fx";
}
return this.each( function() {
var index,
data = jQuery._data( this ),
queue = data[ type + "queue" ],
hooks = data[ type + "queueHooks" ],
timers = jQuery.timers,
length = queue ? queue.length : 0;
// enable finishing flag on private data
data.finish = true;
// empty the queue first
jQuery.queue( this, type, [] );
if ( hooks && hooks.stop ) {
hooks.stop.call( this, true );
}
// look for any active animations, and finish them
for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
timers[ index ].anim.stop( true );
timers.splice( index, 1 );
}
}
// look for any animations in the old queue and finish them
for ( index = 0; index < length; index++ ) {
if ( queue[ index ] && queue[ index ].finish ) {
queue[ index ].finish.call( this );
}
}
// turn off finishing flag
delete data.finish;
} );
}
} );
jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
var cssFn = jQuery.fn[ name ];
jQuery.fn[ name ] = function( speed, easing, callback ) {
return speed == null || typeof speed === "boolean" ?
cssFn.apply( this, arguments ) :
this.animate( genFx( name, true ), speed, easing, callback );
};
} );
// Generate shortcuts for custom animations
jQuery.each( {
slideDown: genFx( "show" ),
slideUp: genFx( "hide" ),
slideToggle: genFx( "toggle" ),
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.timers = [];
jQuery.fx.tick = function() {
var timer,
timers = jQuery.timers,
i = 0;
fxNow = jQuery.now();
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();
}
fxNow = undefined;
};
jQuery.fx.timer = function( timer ) {
jQuery.timers.push( timer );
if ( timer() ) {
jQuery.fx.start();
} else {
jQuery.timers.pop();
}
};
jQuery.fx.interval = 13;
jQuery.fx.start = function() {
if ( !timerId ) {
timerId = window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
}
};
jQuery.fx.stop = function() {
window.clearInterval( timerId );
timerId = null;
};
jQuery.fx.speeds = {
slow: 600,
fast: 200,
// Default speed
_default: 400
};
// Based off of the plugin by Clint Helfers, with permission.
// http://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
jQuery.fn.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 = window.setTimeout( next, time );
hooks.stop = function() {
window.clearTimeout( timeout );
};
} );
};
( function() {
var a,
input = document.createElement( "input" ),
div = document.createElement( "div" ),
select = document.createElement( "select" ),
opt = select.appendChild( document.createElement( "option" ) );
// Setup
div = document.createElement( "div" );
div.setAttribute( "className", "t" );
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
a = div.getElementsByTagName( "a" )[ 0 ];
// Support: Windows Web Apps (WWA)
// `type` must use .setAttribute for WWA (#14901)
input.setAttribute( "type", "checkbox" );
div.appendChild( input );
a = div.getElementsByTagName( "a" )[ 0 ];
// First batch of tests.
a.style.cssText = "top:1px";
// Test setAttribute on camelCase class.
// If it works, we need attrFixes when doing get/setAttribute (ie6/7)
support.getSetAttribute = div.className !== "t";
// Get the style information from getAttribute
// (IE uses .cssText instead)
support.style = /top/.test( a.getAttribute( "style" ) );
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
support.hrefNormalized = a.getAttribute( "href" ) === "/a";
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
support.checkOn = !!input.value;
// 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)
support.optSelected = opt.selected;
// Tests for enctype support on a form (#6743)
support.enctype = !!document.createElement( "form" ).enctype;
// 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;
// Support: IE8 only
// Check if we can trust getAttribute("value")
input = document.createElement( "input" );
input.setAttribute( "value", "" );
support.input = input.getAttribute( "value" ) === "";
// Check if an input maintains its value after becoming a radio
input.value = "t";
input.setAttribute( "type", "radio" );
support.radioValue = input.value === "t";
} )();
var rreturn = /\r/g,
rspaces = /[\x20\t\r\n\f]+/g;
jQuery.fn.extend( {
val: function( value ) {
var hooks, ret, isFunction,
elem = this[ 0 ];
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.type ] ||
jQuery.valHooks[ elem.nodeName.toLowerCase() ];
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 val;
if ( this.nodeType !== 1 ) {
return;
}
if ( isFunction ) {
val = value.call( this, i, jQuery( this ).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.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
// 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 ) {
var val = jQuery.find.attr( elem, "value" );
return val != null ?
val :
// Support: IE10-11+
// option.text throws exceptions (#14686, #14858)
// Strip and collapse whitespace
// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " );
}
},
select: {
get: function( elem ) {
var value, option,
options = elem.options,
index = elem.selectedIndex,
one = elem.type === "select-one" || index < 0,
values = one ? null : [],
max = one ? index + 1 : options.length,
i = index < 0 ?
max :
one ? index : 0;
// Loop through all the selected options
for ( ; i < max; i++ ) {
option = options[ i ];
// oldIE doesn't update selected after form reset (#2551)
if ( ( option.selected || i === index ) &&
// Don't return options that are disabled or in a disabled optgroup
( 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 );
}
}
return values;
},
set: function( elem, value ) {
var optionSet, option,
options = elem.options,
values = jQuery.makeArray( value ),
i = options.length;
while ( i-- ) {
option = options[ i ];
if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 ) {
// Support: IE6
// When new option element is added to select box we need to
// force reflow of newly added node in order to workaround delay
// of initialization properties
try {
option.selected = optionSet = true;
} catch ( _ ) {
// Will be executed only in IE6
option.scrollHeight;
}
} else {
option.selected = false;
}
}
// Force browsers to behave consistently when non-matching value is set
if ( !optionSet ) {
elem.selectedIndex = -1;
}
return options;
}
}
}
} );
// Radios and checkboxes getter/setter
jQuery.each( [ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
set: function( elem, value ) {
if ( jQuery.isArray( value ) ) {
return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
}
}
};
if ( !support.checkOn ) {
jQuery.valHooks[ this ].get = function( elem ) {
return elem.getAttribute( "value" ) === null ? "on" : elem.value;
};
}
} );
var nodeHook, boolHook,
attrHandle = jQuery.expr.attrHandle,
ruseDefault = /^(?:checked|selected)$/i,
getSetAttribute = support.getSetAttribute,
getSetInput = support.input;
jQuery.fn.extend( {
attr: function( name, value ) {
return access( this, jQuery.attr, name, value, arguments.length > 1 );
},
removeAttr: function( name ) {
return this.each( function() {
jQuery.removeAttr( this, name );
} );
}
} );
jQuery.extend( {
attr: function( elem, name, value ) {
var ret, hooks,
nType = elem.nodeType;
// Don't get/set attributes on text, comment and attribute nodes
if ( nType === 3 || nType === 8 || nType === 2 ) {
return;
}
// Fallback to prop when attributes are not supported
if ( typeof elem.getAttribute === "undefined" ) {
return jQuery.prop( elem, name, value );
}
// All attributes are lowercase
// Grab necessary hook if one is defined
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
name = name.toLowerCase();
hooks = jQuery.attrHooks[ name ] ||
( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
}
if ( value !== undefined ) {
if ( value === null ) {
jQuery.removeAttr( elem, name );
return;
}
if ( hooks && "set" in hooks &&
( ret = hooks.set( elem, value, name ) ) !== undefined ) {
return ret;
}
elem.setAttribute( name, value + "" );
return value;
}
if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
return ret;
}
ret = jQuery.find.attr( elem, name );
// Non-existent attributes return null, we normalize to undefined
return ret == null ? undefined : ret;
},
attrHooks: {
type: {
set: function( elem, value ) {
if ( !support.radioValue && value === "radio" &&
jQuery.nodeName( elem, "input" ) ) {
// Setting the type on a radio button after the value resets the value in IE8-9
// Reset value to default in case type is set after value during creation
var val = elem.value;
elem.setAttribute( "type", value );
if ( val ) {
elem.value = val;
}
return value;
}
}
}
},
removeAttr: function( elem, value ) {
var name, propName,
i = 0,
attrNames = value && value.match( rnotwhite );
if ( attrNames && elem.nodeType === 1 ) {
while ( ( name = attrNames[ i++ ] ) ) {
propName = jQuery.propFix[ name ] || name;
// Boolean attributes get special treatment (#10870)
if ( jQuery.expr.match.bool.test( name ) ) {
// Set corresponding property to false
if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
elem[ propName ] = false;
// Support: IE<9
// Also clear defaultChecked/defaultSelected (if appropriate)
} else {
elem[ jQuery.camelCase( "default-" + name ) ] =
elem[ propName ] = false;
}
// See #9699 for explanation of this approach (setting first, then removal)
} else {
jQuery.attr( elem, name, "" );
}
elem.removeAttribute( getSetAttribute ? name : propName );
}
}
}
} );
// Hooks for boolean attributes
boolHook = {
set: function( elem, value, name ) {
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
// IE<8 needs the *property* name
elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
} else {
// Support: IE<9
// Use defaultChecked and defaultSelected for oldIE
elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
}
return name;
}
};
jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
var getter = attrHandle[ name ] || jQuery.find.attr;
if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
attrHandle[ name ] = function( elem, name, isXML ) {
var ret, handle;
if ( !isXML ) {
// Avoid an infinite loop by temporarily removing this function from the getter
handle = attrHandle[ name ];
attrHandle[ name ] = ret;
ret = getter( elem, name, isXML ) != null ?
name.toLowerCase() :
null;
attrHandle[ name ] = handle;
}
return ret;
};
} else {
attrHandle[ name ] = function( elem, name, isXML ) {
if ( !isXML ) {
return elem[ jQuery.camelCase( "default-" + name ) ] ?
name.toLowerCase() :
null;
}
};
}
} );
// fix oldIE attroperties
if ( !getSetInput || !getSetAttribute ) {
jQuery.attrHooks.value = {
set: function( elem, value, name ) {
if ( jQuery.nodeName( elem, "input" ) ) {
// Does not return so that setAttribute is also used
elem.defaultValue = value;
} else {
// Use nodeHook if defined (#1954); otherwise setAttribute is fine
return nodeHook && nodeHook.set( elem, value, name );
}
}
};
}
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !getSetAttribute ) {
// Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue
nodeHook = {
set: function( elem, value, name ) {
// Set the existing or create a new attribute node
var ret = elem.getAttributeNode( name );
if ( !ret ) {
elem.setAttributeNode(
( ret = elem.ownerDocument.createAttribute( name ) )
);
}
ret.value = value += "";
// Break association with cloned elements by also using setAttribute (#9646)
if ( name === "value" || value === elem.getAttribute( name ) ) {
return value;
}
}
};
// Some attributes are constructed with empty-string values when not defined
attrHandle.id = attrHandle.name = attrHandle.coords =
function( elem, name, isXML ) {
var ret;
if ( !isXML ) {
return ( ret = elem.getAttributeNode( name ) ) && ret.value !== "" ?
ret.value :
null;
}
};
// Fixing value retrieval on a button requires this module
jQuery.valHooks.button = {
get: function( elem, name ) {
var ret = elem.getAttributeNode( name );
if ( ret && ret.specified ) {
return ret.value;
}
},
set: nodeHook.set
};
// Set contenteditable to false on removals(#10429)
// Setting to empty string throws an error as an invalid value
jQuery.attrHooks.contenteditable = {
set: function( elem, value, name ) {
nodeHook.set( elem, value === "" ? false : value, name );
}
};
// 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 ] = {
set: function( elem, value ) {
if ( value === "" ) {
elem.setAttribute( name, "auto" );
return value;
}
}
};
} );
}
if ( !support.style ) {
jQuery.attrHooks.style = {
get: function( elem ) {
// Return undefined in the case of empty string
// Note: IE uppercases css property names, but if we were to .toLowerCase()
// .cssText, that would destroy case sensitivity in URL's, like in "background"
return elem.style.cssText || undefined;
},
set: function( elem, value ) {
return ( elem.style.cssText = value + "" );
}
};
}
var rfocusable = /^(?:input|select|textarea|button|object)$/i,
rclickable = /^(?:a|area)$/i;
jQuery.fn.extend( {
prop: function( name, value ) {
return access( this, jQuery.prop, name, value, arguments.length > 1 );
},
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 ) {}
} );
}
} );
jQuery.extend( {
prop: function( elem, name, value ) {
var ret, hooks,
nType = elem.nodeType;
// Don't get/set properties on text, comment and attribute nodes
if ( nType === 3 || nType === 8 || nType === 2 ) {
return;
}
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
// 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;
}
return ( elem[ name ] = value );
}
if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
return ret;
}
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/
// Use proper attribute retrieval(#12072)
var tabindex = jQuery.find.attr( elem, "tabindex" );
return tabindex ?
parseInt( tabindex, 10 ) :
rfocusable.test( elem.nodeName ) ||
rclickable.test( elem.nodeName ) && elem.href ?
0 :
-1;
}
}
},
propFix: {
"for": "htmlFor",
"class": "className"
}
} );
// Some attributes require a special call on IE
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !support.hrefNormalized ) {
// href/src property should get the full normalized URL (#10299/#12915)
jQuery.each( [ "href", "src" ], function( i, name ) {
jQuery.propHooks[ name ] = {
get: function( elem ) {
return elem.getAttribute( name, 4 );
}
};
} );
}
// Support: Safari, IE9+
// Accessing the selectedIndex property
// forces the browser to respect setting selected
// on the option
// The getter ensures a default option is selected
// when in an optgroup
if ( !support.optSelected ) {
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;
},
set: function( elem ) {
var parent = elem.parentNode;
if ( parent ) {
parent.selectedIndex;
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
}
}
};
}
jQuery.each( [
"tabIndex",
"readOnly",
"maxLength",
"cellSpacing",
"cellPadding",
"rowSpan",
"colSpan",
"useMap",
"frameBorder",
"contentEditable"
], function() {
jQuery.propFix[ this.toLowerCase() ] = this;
} );
// IE6/7 call enctype encoding
if ( !support.enctype ) {
jQuery.propFix.enctype = "encoding";
}
var rclass = /[\t\r\n\f]/g;
function getClass( elem ) {
return jQuery.attr( elem, "class" ) || "";
}
jQuery.fn.extend( {
addClass: function( value ) {
var classes, elem, cur, curValue, clazz, j, finalValue,
i = 0;
if ( jQuery.isFunction( value ) ) {
return this.each( function( j ) {
jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
} );
}
if ( typeof value === "string" && value ) {
classes = value.match( rnotwhite ) || [];
while ( ( elem = this[ i++ ] ) ) {
curValue = getClass( elem );
cur = elem.nodeType === 1 &&
( " " + curValue + " " ).replace( rclass, " " );
if ( cur ) {
j = 0;
while ( ( clazz = classes[ j++ ] ) ) {
if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
cur += clazz + " ";
}
}
// only assign if different to avoid unneeded rendering.
finalValue = jQuery.trim( cur );
if ( curValue !== finalValue ) {
jQuery.attr( elem, "class", finalValue );
}
}
}
}
return this;
},
removeClass: function( value ) {
var classes, elem, cur, curValue, clazz, j, finalValue,
i = 0;
if ( jQuery.isFunction( value ) ) {
return this.each( function( j ) {
jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
} );
}
if ( !arguments.length ) {
return this.attr( "class", "" );
}
if ( typeof value === "string" && value ) {
classes = value.match( rnotwhite ) || [];
while ( ( elem = this[ i++ ] ) ) {
curValue = getClass( elem );
// This expression is here for better compressibility (see addClass)
cur = elem.nodeType === 1 &&
( " " + curValue + " " ).replace( rclass, " " );
if ( cur ) {
j = 0;
while ( ( clazz = classes[ j++ ] ) ) {
// Remove *all* instances
while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
cur = cur.replace( " " + clazz + " ", " " );
}
}
// Only assign if different to avoid unneeded rendering.
finalValue = jQuery.trim( cur );
if ( curValue !== finalValue ) {
jQuery.attr( elem, "class", finalValue );
}
}
}
}
return this;
},
toggleClass: function( value, stateVal ) {
var type = typeof value;
if ( typeof stateVal === "boolean" && type === "string" ) {
return stateVal ? this.addClass( value ) : this.removeClass( value );
}
if ( jQuery.isFunction( value ) ) {
return this.each( function( i ) {
jQuery( this ).toggleClass(
value.call( this, i, getClass( this ), stateVal ),
stateVal
);
} );
}
return this.each( function() {
var className, i, self, classNames;
if ( type === "string" ) {
// Toggle individual class names
i = 0;
self = jQuery( this );
classNames = value.match( rnotwhite ) || [];
while ( ( className = classNames[ i++ ] ) ) {
// Check each className given, space separated list
if ( self.hasClass( className ) ) {
self.removeClass( className );
} else {
self.addClass( className );
}
}
// Toggle whole class name
} else if ( value === undefined || type === "boolean" ) {
className = getClass( this );
if ( className ) {
// store className if set
jQuery._data( this, "__className__", className );
}
// If the element has a class name or if we're passed "false",
// then remove the whole classname (if there was one, the above saved it).
// Otherwise bring back whatever was previously saved (if anything),
// falling back to the empty string if nothing was stored.
jQuery.attr( this, "class",
className || value === false ?
"" :
jQuery._data( this, "__className__" ) || ""
);
}
} );
},
hasClass: function( selector ) {
var className, elem,
i = 0;
className = " " + selector + " ";
while ( ( elem = this[ i++ ] ) ) {
if ( elem.nodeType === 1 &&
( " " + getClass( elem ) + " " ).replace( rclass, " " )
.indexOf( className ) > -1
) {
return true;
}
}
return false;
}
} );
// Return jQuery for attributes-only inclusion
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 ) {
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
} );
jQuery.fn.extend( {
hover: function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
}
} );
var location = window.location;
var nonce = jQuery.now();
var rquery = ( /\?/ );
var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;
jQuery.parseJSON = function( data ) {
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
// Support: Android 2.3
// Workaround failure to string-cast null input
return window.JSON.parse( data + "" );
}
var requireNonComma,
depth = null,
str = jQuery.trim( data + "" );
// Guard against invalid (and possibly dangerous) input by ensuring that nothing remains
// after removing valid tokens
return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) {
// Force termination if we see a misplaced comma
if ( requireNonComma && comma ) {
depth = 0;
}
// Perform no more replacements after returning to outermost depth
if ( depth === 0 ) {
return token;
}
// Commas must not follow "[", "{", or ","
requireNonComma = open || comma;
// Determine new depth
// array/object open ("[" or "{"): depth += true - false (increment)
// array/object close ("]" or "}"): depth += false - true (decrement)
// other cases ("," or primitive): depth += true - true (numeric cast)
depth += !close - !open;
// Remove this token
return "";
} ) ) ?
( Function( "return " + str ) )() :
jQuery.error( "Invalid JSON: " + data );
};
// Cross-browser xml parsing
jQuery.parseXML = function( data ) {
var xml, tmp;
if ( !data || typeof data !== "string" ) {
return null;
}
try {
if ( window.DOMParser ) { // Standard
tmp = new window.DOMParser();
xml = tmp.parseFromString( data, "text/xml" );
} else { // IE
xml = new window.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;
};
var
rhash = /#.*$/,
rts = /([?&])_=[^&]*/,
// IE leaves an \r character at EOL
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg,
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
/* 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 = {},
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = "*/".concat( "*" ),
// Document location
ajaxLocation = location.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 = "*";
}
var dataType,
i = 0,
dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
if ( jQuery.isFunction( func ) ) {
// For each dataType in the dataTypeExpression
while ( ( dataType = dataTypes[ i++ ] ) ) {
// Prepend if requested
if ( dataType.charAt( 0 ) === "+" ) {
dataType = dataType.slice( 1 ) || "*";
( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
// Otherwise append
} else {
( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
}
}
}
};
}
// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
var inspected = {},
seekingTransport = ( structure === transports );
function inspect( dataType ) {
var selected;
inspected[ dataType ] = true;
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
if ( typeof dataTypeOrTransport === "string" &&
!seekingTransport && !inspected[ dataTypeOrTransport ] ) {
options.dataTypes.unshift( dataTypeOrTransport );
inspect( dataTypeOrTransport );
return false;
} else if ( seekingTransport ) {
return !( selected = dataTypeOrTransport );
}
} );
return selected;
}
return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
}
// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend( target, src ) {
var deep, key,
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 );
}
return target;
}
/* Handles responses to an ajax request:
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
*/
function ajaxHandleResponses( s, jqXHR, responses ) {
var firstDataType, ct, finalDataType, type,
contents = s.contents,
dataTypes = s.dataTypes;
// 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
* Also sets the responseXXX fields on the jqXHR instance
*/
function ajaxConvert( s, response, jqXHR, isSuccess ) {
var conv2, current, conv, tmp, prev,
converters = {},
// Work with a copy of dataTypes in case we need to modify it for conversion
dataTypes = s.dataTypes.slice();
// Create converters map with lowercased keys
if ( dataTypes[ 1 ] ) {
for ( conv in s.converters ) {
converters[ conv.toLowerCase() ] = s.converters[ conv ];
}
}
current = dataTypes.shift();
// Convert to each sequential dataType
while ( current ) {
if ( s.responseFields[ current ] ) {
jqXHR[ s.responseFields[ current ] ] = response;
}
// Apply the dataFilter if provided
if ( !prev && isSuccess && s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
}
prev = current;
current = dataTypes.shift();
if ( current ) {
// There's only work to do if current dataType is non-auto
if ( current === "*" ) {
current = prev;
// Convert response if prev dataType is non-auto and differs from current
} else if ( prev !== "*" && prev !== current ) {
// Seek a direct converter
conv = converters[ prev + " " + current ] || converters[ "* " + current ];
// If none found, seek a pair
if ( !conv ) {
for ( conv2 in converters ) {
// If conv2 outputs current
tmp = conv2.split( " " );
if ( tmp[ 1 ] === current ) {
// If prev can be converted to accepted input
conv = converters[ prev + " " + tmp[ 0 ] ] ||
converters[ "* " + tmp[ 0 ] ];
if ( conv ) {
// Condense equivalence converters
if ( conv === true ) {
conv = converters[ conv2 ];
// Otherwise, insert the intermediate dataType
} else if ( converters[ conv2 ] !== true ) {
current = tmp[ 0 ];
dataTypes.unshift( tmp[ 1 ] );
}
break;
}
}
}
}
// Apply converter (if not an equivalence)
if ( conv !== true ) {
// Unless errors are allowed to bubble, catch and return them
if ( conv && s[ "throws" ] ) { // jscs:ignore requireDotNotation
response = conv( response );
} else {
try {
response = conv( response );
} catch ( e ) {
return {
state: "parsererror",
error: conv ? e : "No conversion from " + prev + " to " + current
};
}
}
}
}
}
}
return { state: "success", data: response };
}
jQuery.extend( {
// Counter for holding the number of active queries
active: 0,
// Last-Modified header cache for next request
lastModified: {},
etag: {},
ajaxSettings: {
url: ajaxLocation,
type: "GET",
isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
global: true,
processData: true,
async: true,
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
/*
timeout: 0,
data: null,
dataType: null,
username: null,
password: null,
cache: null,
throws: false,
traditional: false,
headers: {},
*/
accepts: {
"*": allTypes,
text: "text/plain",
html: "text/html",
xml: "application/xml, text/xml",
json: "application/json, text/javascript"
},
contents: {
xml: /\bxml\b/,
html: /\bhtml/,
json: /\bjson\b/
},
responseFields: {
xml: "responseXML",
text: "responseText",
json: "responseJSON"
},
// Data converters
// Keys separate source (or catchall "*") and destination types with a single space
converters: {
// Convert anything to text
"* text": 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: {
url: true,
context: true
}
},
// 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 ) {
return settings ?
// Building a settings object
ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
// Extending ajaxSettings
ajaxExtend( jQuery.ajaxSettings, target );
},
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
// Cross-domain detection vars
parts,
// Loop variable
i,
// URL without anti-cache param
cacheURL,
// Response headers as string
responseHeadersString,
// timeout handle
timeoutTimer,
// To know if global events are to be dispatched
fireGlobals,
transport,
// Response headers
responseHeaders,
// Create the final options object
s = jQuery.ajaxSetup( {}, options ),
// Callbacks context
callbackContext = s.context || s,
// Context for global events is callbackContext if it is a DOM node or jQuery collection
globalEventContext = s.context &&
( callbackContext.nodeType || callbackContext.jquery ) ?
jQuery( callbackContext ) :
jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery.Callbacks( "once memory" ),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// The jqXHR state
state = 0,
// Default abort message
strAbort = "canceled",
// Fake xhr
jqXHR = {
readyState: 0,
// 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 == null ? null : match;
},
// Raw string
getAllResponseHeaders: function() {
return state === 2 ? responseHeadersString : null;
},
// Caches the header
setRequestHeader: function( name, value ) {
var lname = name.toLowerCase();
if ( !state ) {
name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
requestHeaders[ name ] = value;
}
return this;
},
// Overrides response content-type header
overrideMimeType: function( type ) {
if ( !state ) {
s.mimeType = type;
}
return this;
},
// Status-dependent callbacks
statusCode: function( map ) {
var code;
if ( map ) {
if ( state < 2 ) {
for ( code in map ) {
// Lazy-add the new callback in a way that preserves old ones
statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
}
} else {
// Execute the appropriate callbacks
jqXHR.always( map[ jqXHR.status ] );
}
}
return this;
},
// Cancel the request
abort: function( statusText ) {
var finalText = statusText || strAbort;
if ( transport ) {
transport.abort( finalText );
}
done( 0, finalText );
return this;
}
};
// Attach deferreds
deferred.promise( jqXHR ).complete = completeDeferred.add;
jqXHR.success = jqXHR.done;
jqXHR.error = jqXHR.fail;
// Remove hash character (#7531: and string promotion)
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
// Handle falsy url in the settings object (#10093: consistency with old signature)
// We also use the url parameter if available
s.url = ( ( url || s.url || ajaxLocation ) + "" )
.replace( rhash, "" )
.replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
// Alias method option to type as per ticket #12004
s.type = options.method || options.type || s.method || s.type;
// Extract dataTypes list
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
// A cross-domain request is in order when we have a protocol:host:port mismatch
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 prefilter, stop there
if ( state === 2 ) {
return jqXHR;
}
// We can fire global events as of now if asked to
// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
fireGlobals = jQuery.event && s.global;
// Watch for a new set of requests
if ( fireGlobals && jQuery.active++ === 0 ) {
jQuery.event.trigger( "ajaxStart" );
}
// Uppercase the type
s.type = s.type.toUpperCase();
// Determine if request has content
s.hasContent = !rnoContent.test( s.type );
// Save the URL in case we're toying with the If-Modified-Since
// and/or If-None-Match header later on
cacheURL = s.url;
// More options handling for requests with no content
if ( !s.hasContent ) {
// If data is available, append data to url
if ( s.data ) {
cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Add anti-cache in url if needed
if ( s.cache === false ) {
s.url = rts.test( cacheURL ) ?
// If there is already a '_' parameter, set its value
cacheURL.replace( rts, "$1_=" + nonce++ ) :
// Otherwise add one to the end
cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
}
}
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
if ( jQuery.lastModified[ cacheURL ] ) {
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
}
if ( jQuery.etag[ cacheURL ] ) {
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
}
}
// 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 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 and return
return jqXHR.abort();
}
// aborting is no longer a cancellation
strAbort = "abort";
// 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 ] );
}
// If request was aborted inside ajaxSend, stop there
if ( state === 2 ) {
return jqXHR;
}
// Timeout
if ( s.async && s.timeout > 0 ) {
timeoutTimer = window.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;
}
}
}
// Callback for when everything is done
function done( status, nativeStatusText, responses, headers ) {
var isSuccess, success, error, response, modified,
statusText = nativeStatusText;
// Called once
if ( state === 2 ) {
return;
}
// State is "done" now
state = 2;
// Clear timeout if it exists
if ( timeoutTimer ) {
window.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;
// Determine if successful
isSuccess = status >= 200 && status < 300 || status === 304;
// Get response data
if ( responses ) {
response = ajaxHandleResponses( s, jqXHR, responses );
}
// Convert no matter what (that way responseXXX fields are always set)
response = ajaxConvert( s, response, jqXHR, isSuccess );
// If successful, handle type chaining
if ( isSuccess ) {
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
modified = jqXHR.getResponseHeader( "Last-Modified" );
if ( modified ) {
jQuery.lastModified[ cacheURL ] = modified;
}
modified = jqXHR.getResponseHeader( "etag" );
if ( modified ) {
jQuery.etag[ cacheURL ] = modified;
}
}
// if no content
if ( status === 204 || s.type === "HEAD" ) {
statusText = "nocontent";
// if not modified
} else if ( status === 304 ) {
statusText = "notmodified";
// If we have data, let's convert it
} else {
statusText = response.state;
success = response.data;
error = response.error;
isSuccess = !error;
}
} else {
// We extract error from statusText
// then normalize statusText and status for non-aborts
error = statusText;
if ( status || !statusText ) {
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( isSuccess ? "ajaxSuccess" : "ajaxError",
[ 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" );
}
}
}
return jqXHR;
},
getJSON: function( url, data, callback ) {
return jQuery.get( url, data, callback, "json" );
},
getScript: function( url, callback ) {
return jQuery.get( url, undefined, callback, "script" );
}
} );
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;
}
// The url can be an options object (which then must have .url)
return jQuery.ajax( jQuery.extend( {
url: url,
type: method,
dataType: type,
data: data,
success: callback
}, jQuery.isPlainObject( url ) && url ) );
};
} );
jQuery._evalUrl = function( url ) {
return jQuery.ajax( {
url: url,
// Make this explicit, since user can override this through ajaxSetup (#11264)
type: "GET",
dataType: "script",
cache: true,
async: false,
global: false,
"throws": true
} );
};
jQuery.fn.extend( {
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();
}
} );
function getDisplay( elem ) {
return elem.style && elem.style.display || jQuery.css( elem, "display" );
}
function filterHidden( elem ) {
// Disconnected elements are considered hidden
if ( !jQuery.contains( elem.ownerDocument || document, elem ) ) {
return true;
}
while ( elem && elem.nodeType === 1 ) {
if ( getDisplay( elem ) === "none" || elem.type === "hidden" ) {
return true;
}
elem = elem.parentNode;
}
return false;
}
jQuery.expr.filters.hidden = function( elem ) {
// Support: Opera <= 12.12
// Opera reports offsetWidths and offsetHeights less than zero on some elements
return support.reliableHiddenOffsets() ?
( elem.offsetWidth <= 0 && elem.offsetHeight <= 0 &&
!elem.getClientRects().length ) :
filterHidden( elem );
};
jQuery.expr.filters.visible = function( elem ) {
return !jQuery.expr.filters.hidden( elem );
};
var r20 = /%20/g,
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
rsubmittable = /^(?:input|select|textarea|keygen)/i;
function buildParams( prefix, obj, traditional, add ) {
var name;
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 {
// Item is non-scalar (array or object), encode its numeric index.
buildParams(
prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
v,
traditional,
add
);
}
} );
} else if ( !traditional && jQuery.type( obj ) === "object" ) {
// Serialize object item.
for ( name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
}
// Serialize an array of form elements or a set of
// key/values into a query string
jQuery.param = function( a, traditional ) {
var prefix,
s = [],
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
};
// Set traditional to true for jQuery <= 1.3.2 behavior.
if ( traditional === undefined ) {
traditional = jQuery.ajaxSettings && 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 ( prefix in a ) {
buildParams( prefix, a[ prefix ], traditional, add );
}
}
// Return the resulting serialization
return s.join( "&" ).replace( r20, "+" );
};
jQuery.fn.extend( {
serialize: function() {
return jQuery.param( this.serializeArray() );
},
serializeArray: function() {
return this.map( function() {
// Can add propHook for "elements" to filter or add form elements
var elements = jQuery.prop( this, "elements" );
return elements ? jQuery.makeArray( elements ) : this;
} )
.filter( function() {
var type = this.type;
// Use .is(":disabled") so that fieldset[disabled] works
return this.name && !jQuery( this ).is( ":disabled" ) &&
rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
( this.checked || !rcheckableType.test( type ) );
} )
.map( function( i, elem ) {
var val = jQuery( this ).val();
return val == null ?
null :
jQuery.isArray( val ) ?
jQuery.map( val, function( val ) {
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
} ) :
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
} ).get();
}
} );
// Create the request object
// (This is still attached to ajaxSettings for backward compatibility)
jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ?
// Support: IE6-IE8
function() {
// XHR cannot access local files, always use ActiveX for that case
if ( this.isLocal ) {
return createActiveXHR();
}
// Support: IE 9-11
// IE seems to error on cross-domain PATCH requests when ActiveX XHR
// is used. In IE 9+ always use the native XHR.
// Note: this condition won't catch Edge as it doesn't define
// document.documentMode but it also doesn't support ActiveX so it won't
// reach this code.
if ( document.documentMode > 8 ) {
return createStandardXHR();
}
// Support: IE<9
// oldIE XHR does not support non-RFC2616 methods (#13240)
// See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx
// and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9
// Although this check for six methods instead of eight
// since IE also does not support "trace" and "connect"
return /^(get|post|head|put|delete|options)$/i.test( this.type ) &&
createStandardXHR() || createActiveXHR();
} :
// For all other browsers, use the standard XMLHttpRequest object
createStandardXHR;
var xhrId = 0,
xhrCallbacks = {},
xhrSupported = jQuery.ajaxSettings.xhr();
// Support: IE<10
// Open requests must be manually aborted on unload (#5280)
// See https://support.microsoft.com/kb/2856746 for more info
if ( window.attachEvent ) {
window.attachEvent( "onunload", function() {
for ( var key in xhrCallbacks ) {
xhrCallbacks[ key ]( undefined, true );
}
} );
}
// Determine support properties
support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
xhrSupported = support.ajax = !!xhrSupported;
// Create transport if the browser can provide an xhr
if ( xhrSupported ) {
jQuery.ajaxTransport( function( options ) {
// Cross domain only allowed if supported through XMLHttpRequest
if ( !options.crossDomain || support.cors ) {
var callback;
return {
send: function( headers, complete ) {
var i,
xhr = options.xhr(),
id = ++xhrId;
// Open the socket
xhr.open(
options.type,
options.url,
options.async,
options.username,
options.password
);
// Apply custom fields if provided
if ( options.xhrFields ) {
for ( i in options.xhrFields ) {
xhr[ i ] = options.xhrFields[ i ];
}
}
// Override mime type if needed
if ( options.mimeType && xhr.overrideMimeType ) {
xhr.overrideMimeType( options.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 ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
headers[ "X-Requested-With" ] = "XMLHttpRequest";
}
// Set headers
for ( i in headers ) {
// Support: IE<9
// IE's ActiveXObject throws a 'Type Mismatch' exception when setting
// request header to a null-value.
//
// To keep consistent with other XHR implementations, cast the value
// to string and ignore `undefined`.
if ( headers[ i ] !== undefined ) {
xhr.setRequestHeader( i, headers[ i ] + "" );
}
}
// Do send the request
// This may raise an exception which is actually
// handled in jQuery.ajax (so no try/catch here)
xhr.send( ( options.hasContent && options.data ) || null );
// Listener
callback = function( _, isAbort ) {
var status, statusText, responses;
// Was never called and is aborted or complete
if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
// Clean up
delete xhrCallbacks[ id ];
callback = undefined;
xhr.onreadystatechange = jQuery.noop;
// Abort manually if needed
if ( isAbort ) {
if ( xhr.readyState !== 4 ) {
xhr.abort();
}
} else {
responses = {};
status = xhr.status;
// Support: IE<10
// Accessing binary-data responseText throws an exception
// (#11426)
if ( typeof xhr.responseText === "string" ) {
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 && options.isLocal && !options.crossDomain ) {
status = responses.text ? 200 : 404;
// IE - #1450: sometimes returns 1223 when it should be 204
} else if ( status === 1223 ) {
status = 204;
}
}
}
// Call complete if needed
if ( responses ) {
complete( status, statusText, responses, xhr.getAllResponseHeaders() );
}
};
// Do send the request
// `xhr.send` may raise an exception, but it will be
// handled in jQuery.ajax (so no try/catch here)
if ( !options.async ) {
// If we're in sync mode we fire the callback
callback();
} else if ( xhr.readyState === 4 ) {
// (IE6 & IE7) if it's in cache and has been
// retrieved directly we need to fire the callback
window.setTimeout( callback );
} else {
// Register the callback, but delay it in case `xhr.send` throws
// Add to the list of active xhr callbacks
xhr.onreadystatechange = xhrCallbacks[ id ] = callback;
}
},
abort: function() {
if ( callback ) {
callback( undefined, true );
}
}
};
}
} );
}
// Functions to create xhrs
function createStandardXHR() {
try {
return new window.XMLHttpRequest();
} catch ( e ) {}
}
function createActiveXHR() {
try {
return new window.ActiveXObject( "Microsoft.XMLHTTP" );
} catch ( e ) {}
}
// Install script dataType
jQuery.ajaxSetup( {
accepts: {
script: "text/javascript, application/javascript, " +
"application/ecmascript, application/x-ecmascript"
},
contents: {
script: /\b(?:java|ecma)script\b/
},
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 || jQuery( "head" )[ 0 ] || document.documentElement;
return {
send: function( _, callback ) {
script = document.createElement( "script" );
script.async = true;
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 ( script.parentNode ) {
script.parentNode.removeChild( script );
}
// Dereference the script
script = null;
// Callback if not abort
if ( !isAbort ) {
callback( 200, "success" );
}
}
};
// Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
// Use native DOM manipulation to avoid our domManip AJAX trickery
head.insertBefore( script, head.firstChild );
},
abort: function() {
if ( script ) {
script.onload( undefined, true );
}
}
};
}
} );
var oldCallbacks = [],
rjsonp = /(=)\?(?=&|$)|\?\?/;
// Default jsonp settings
jQuery.ajaxSetup( {
jsonp: "callback",
jsonpCallback: function() {
var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
this[ callback ] = true;
return callback;
}
} );
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var callbackName, overwritten, responseContainer,
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
"url" :
typeof s.data === "string" &&
( s.contentType || "" )
.indexOf( "application/x-www-form-urlencoded" ) === 0 &&
rjsonp.test( s.data ) && "data"
);
// Handle iff the expected data type is "jsonp" or we have a parameter to set
if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
// Get callback name, remembering preexisting value associated with it
callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
s.jsonpCallback() :
s.jsonpCallback;
// Insert callback into url or form data
if ( jsonProp ) {
s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
} else if ( s.jsonp !== false ) {
s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
}
// Use data converter to retrieve json after script execution
s.converters[ "script json" ] = function() {
if ( !responseContainer ) {
jQuery.error( callbackName + " was not called" );
}
return responseContainer[ 0 ];
};
// force json dataType
s.dataTypes[ 0 ] = "json";
// Install callback
overwritten = window[ callbackName ];
window[ callbackName ] = function() {
responseContainer = arguments;
};
// Clean-up function (fires after converters)
jqXHR.always( function() {
// If previous value didn't exist - remove it
if ( overwritten === undefined ) {
jQuery( window ).removeProp( callbackName );
// Otherwise restore preexisting value
} else {
window[ callbackName ] = overwritten;
}
// Save back as free
if ( s[ callbackName ] ) {
// make sure that re-using the options doesn't screw things around
s.jsonpCallback = originalSettings.jsonpCallback;
// save the callback name for future use
oldCallbacks.push( callbackName );
}
// Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( overwritten ) ) {
overwritten( responseContainer[ 0 ] );
}
responseContainer = overwritten = undefined;
} );
// Delegate to script
return "script";
}
} );
// data: string of html
// context (optional): If specified, the fragment will be created in this context,
// defaults to document
// keepScripts (optional): If true, will include scripts passed in the html string
jQuery.parseHTML = function( data, context, keepScripts ) {
if ( !data || typeof data !== "string" ) {
return null;
}
if ( typeof context === "boolean" ) {
keepScripts = context;
context = false;
}
context = context || document;
var parsed = rsingleTag.exec( data ),
scripts = !keepScripts && [];
// Single tag
if ( parsed ) {
return [ context.createElement( parsed[ 1 ] ) ];
}
parsed = buildFragment( [ data ], context, scripts );
if ( scripts && scripts.length ) {
jQuery( scripts ).remove();
}
return jQuery.merge( [], parsed.childNodes );
};
// Keep a copy of the old load method
var _load = jQuery.fn.load;
/**
* Load a url into a page
*/
jQuery.fn.load = function( url, params, callback ) {
if ( typeof url !== "string" && _load ) {
return _load.apply( this, arguments );
}
var selector, type, response,
self = this,
off = url.indexOf( " " );
if ( off > -1 ) {
selector = jQuery.trim( url.slice( off, url.length ) );
url = url.slice( 0, off );
}
// 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 ( params && typeof params === "object" ) {
type = "POST";
}
// If we have elements to modify, make the request
if ( self.length > 0 ) {
jQuery.ajax( {
url: url,
// If "type" variable is undefined, then "GET" method will be used.
// Make value of this field explicit since
// user can override it through ajaxSetup method
type: type || "GET",
dataType: "html",
data: params
} ).done( function( responseText ) {
// Save response for use in complete callback
response = arguments;
self.html( selector ?
// If a selector was specified, locate the right elements in a dummy div
// Exclude scripts to avoid IE 'Permission Denied' errors
jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
// Otherwise use the full result
responseText );
// If the request succeeds, this function gets "data", "status", "jqXHR"
// but they are ignored because response was set above.
// If it fails, this function gets "jqXHR", "status", "error"
} ).always( callback && function( jqXHR, status ) {
self.each( function() {
callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
} );
} );
}
return this;
};
// Attach a bunch of functions for handling common AJAX events
jQuery.each( [
"ajaxStart",
"ajaxStop",
"ajaxComplete",
"ajaxError",
"ajaxSuccess",
"ajaxSend"
], function( i, type ) {
jQuery.fn[ type ] = function( fn ) {
return this.on( type, fn );
};
} );
jQuery.expr.filters.animated = function( elem ) {
return jQuery.grep( jQuery.timers, function( fn ) {
return elem === fn.elem;
} ).length;
};
/**
* Gets a window from an element
*/
function getWindow( elem ) {
return jQuery.isWindow( elem ) ?
elem :
elem.nodeType === 9 ?
elem.defaultView || elem.parentWindow :
false;
}
jQuery.offset = {
setOffset: function( elem, options, i ) {
var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
position = jQuery.css( elem, "position" ),
curElem = jQuery( elem ),
props = {};
// set position first, in-case top/left are set even on static elem
if ( position === "static" ) {
elem.style.position = "relative";
}
curOffset = curElem.offset();
curCSSTop = jQuery.css( elem, "top" );
curCSSLeft = jQuery.css( elem, "left" );
calculatePosition = ( position === "absolute" || position === "fixed" ) &&
jQuery.inArray( "auto", [ curCSSTop, curCSSLeft ] ) > -1;
// 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 ) ) {
// Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
options = options.call( elem, i, jQuery.extend( {}, 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( {
offset: function( options ) {
if ( arguments.length ) {
return options === undefined ?
this :
this.each( function( i ) {
jQuery.offset.setOffset( this, options, i );
} );
}
var docElem, win,
box = { top: 0, left: 0 },
elem = this[ 0 ],
doc = elem && elem.ownerDocument;
if ( !doc ) {
return;
}
docElem = doc.documentElement;
// Make sure it's not a disconnected DOM node
if ( !jQuery.contains( docElem, elem ) ) {
return box;
}
// If we don't have gBCR, just use 0,0 rather than error
// BlackBerry 5, iOS 3 (original iPhone)
if ( typeof elem.getBoundingClientRect !== "undefined" ) {
box = elem.getBoundingClientRect();
}
win = getWindow( doc );
return {
top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
};
},
position: function() {
if ( !this[ 0 ] ) {
return;
}
var offsetParent, offset,
parentOffset = { top: 0, left: 0 },
elem = this[ 0 ];
// Fixed elements are offset from window (parentOffset = {top:0, left: 0},
// because it is its only offset parent
if ( jQuery.css( elem, "position" ) === "fixed" ) {
// we assume that getBoundingClientRect is available when computed position is fixed
offset = elem.getBoundingClientRect();
} else {
// Get *real* offsetParent
offsetParent = this.offsetParent();
// Get correct offsets
offset = this.offset();
if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
parentOffset = offsetParent.offset();
}
// Add offsetParent borders
parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
}
// Subtract parent offsets and 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
return {
top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
};
},
offsetParent: function() {
return this.map( function() {
var offsetParent = this.offsetParent;
while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) &&
jQuery.css( offsetParent, "position" ) === "static" ) ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent || documentElement;
} );
}
} );
// Create scrollLeft and scrollTop methods
jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
var top = /Y/.test( prop );
jQuery.fn[ method ] = function( val ) {
return access( this, function( elem, method, val ) {
var win = getWindow( elem );
if ( val === undefined ) {
return win ? ( prop in win ) ? win[ prop ] :
win.document.documentElement[ method ] :
elem[ method ];
}
if ( win ) {
win.scrollTo(
!top ? val : jQuery( win ).scrollLeft(),
top ? val : jQuery( win ).scrollTop()
);
} else {
elem[ method ] = val;
}
}, method, val, arguments.length, null );
};
} );
// Support: Safari<7-8+, Chrome<37-44+
// Add the top/left cssHooks using jQuery.fn.position
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
// getComputedStyle returns percent when specified for top/left/bottom/right
// rather than make the css module depend on the offset module, we just check for it here
jQuery.each( [ "top", "left" ], function( i, prop ) {
jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
function( elem, computed ) {
if ( computed ) {
computed = curCSS( elem, prop );
// if curCSS returns percentage, fallback to offset
return rnumnonpx.test( computed ) ?
jQuery( elem ).position()[ prop ] + "px" :
computed;
}
}
);
} );
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
function( defaultExtra, funcName ) {
// margin is only for outerHeight, outerWidth
jQuery.fn[ funcName ] = function( margin, value ) {
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
return access( this, function( elem, type, value ) {
var doc;
if ( jQuery.isWindow( elem ) ) {
// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
// isn't a whole lot we can do. See pull request at this URL for discussion:
// https://github.com/jquery/jquery/pull/764
return elem.document.documentElement[ "client" + name ];
}
// Get document width or height
if ( elem.nodeType === 9 ) {
doc = elem.documentElement;
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
// whichever is greatest
// unfortunately, this causes bug #3838 in IE6/8 only,
// but there is currently no good, small way to fix it.
return Math.max(
elem.body[ "scroll" + name ], doc[ "scroll" + name ],
elem.body[ "offset" + name ], doc[ "offset" + name ],
doc[ "client" + name ]
);
}
return value === undefined ?
// Get width or height on the element, requesting but not forcing parseFloat
jQuery.css( elem, type, extra ) :
// Set width or height on the element
jQuery.style( elem, type, value, extra );
}, type, chainable ? margin : undefined, chainable, null );
};
} );
} );
jQuery.fn.extend( {
bind: function( types, data, fn ) {
return this.on( types, null, data, fn );
},
unbind: function( types, fn ) {
return this.off( types, null, fn );
},
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 );
}
} );
// The number of elements contained in the matched element set
jQuery.fn.size = function() {
return this.length;
};
jQuery.fn.andSelf = jQuery.fn.addBack;
// Register as a named AMD module, since jQuery can be concatenated with other
// files that may use define, but not via 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.
// Note that for maximum portability, libraries that are not jQuery should
// declare themselves as anonymous modules, and avoid setting a global if an
// AMD loader is present. jQuery is a special case. For more information, see
// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
if ( typeof define === "function" && define.amd ) {
define( "jquery", [], function() {
return jQuery;
} );
}
var
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$;
jQuery.noConflict = function( deep ) {
if ( window.$ === jQuery ) {
window.$ = _$;
}
if ( deep && window.jQuery === jQuery ) {
window.jQuery = _jQuery;
}
return jQuery;
};
// Expose jQuery and $ identifiers, even in
// AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
// and CommonJS for browser emulators (#13566)
if ( !noGlobal ) {
window.jQuery = window.$ = jQuery;
}
return jQuery;
}));
|
packages/material-ui-lab/src/internal/svg-icons/createSvgIcon.js | kybarg/material-ui | import React from 'react';
import SvgIcon from '@material-ui/core/SvgIcon';
export default function createSvgIcon(path, displayName) {
const Component = React.memo(
React.forwardRef((props, ref) => (
<SvgIcon data-mui-test={`${displayName}Icon`} ref={ref} {...props}>
{path}
</SvgIcon>
)),
);
if (process.env.NODE_ENV !== 'production') {
Component.displayName = `${displayName}Icon`;
}
Component.muiName = SvgIcon.muiName;
return Component;
}
|
test/components/LegacyAccountLoginForm.spec.js | CPatchane/cozy-collect | /* eslint-env jest */
import React from 'react'
import { shallow } from 'enzyme'
import { Button } from 'cozy-ui/react/Button'
import { tMock } from '../jestLib/I18n'
import { AccountLoginForm } from '../../src/components/LegacyAccountLoginForm'
describe('LegacyAccountLoginForm component', () => {
beforeEach(() => {
jest.resetModules()
})
it('should enable connection button for valid OAuth account', () => {
const wrapper = shallow(
<AccountLoginForm t={tMock} onSubmit={jest.fn()} isOAuth />
)
const button = wrapper.find(Button)
expect(button.props().disabled).toBe(false)
})
})
|
ajax/libs/reactive-elements/0.5.9/reactive-elements.min.js | kennynaoh/cdnjs | !function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.ReactiveElements=e()}}(function(){var define,module,exports;return function e(t,r,n){function o(a,u){if(!r[a]){if(!t[a]){var c="function"==typeof require&&require;if(!u&&c)return c(a,!0);if(i)return i(a,!0);throw new Error("Cannot find module '"+a+"'")}var p=r[a]={exports:{}};t[a][0].call(p.exports,function(e){var r=t[a][1][e];return o(r?r:e)},p,p.exports,e,t,r,n)}return r[a].exports}for(var i="function"==typeof require&&require,a=0;a<n.length;a++)o(n[a]);return o}({1:[function(){},{}],2:[function(e,t,r){!function(){function t(e,t){t.forceUpdate=e.forceUpdate.bind(e)}function n(e,t){u.extend(t,e)}var o=document.registerElement||document.register;if(!o)throw new Error("No custom element support or polyfill found!");o=o.bind(document);var i=window.React||e("react"),a=window.React||e("react-dom"),u=e("./utils");r.registerReact=function(e,r){function c(e,t){var n=i.createElement(r,t);return e.reactiveElement=n,a.render(n,e,t.onRender)}var p,s=Object.create(HTMLElement.prototype);s.createdCallback=function(){var e=u.getProps(this);e.children=u.getChildren(this),p=c(this,e),n(p,p.props.container),t(p,p.props.container),u.getterSetter(this,"props",function(){return p.props},function(e){p=c(this,e)})},s.detachedCallback=function(){a.unmountComponentAtNode(this)},s.attributeChangedCallback=function(e,t,r){var n=u.attributeNameToPropertyName(e),o=u.parseAttributeValue(r),i={};i[n]=o,this.setProps(i,function(){p=c(this,this.props)})},o(e,{prototype:s})},r.utils=u,document.registerReact=r.registerReact}()},{"./utils":3,react:"CwoHg3"}],3:[function(_dereq_,module,exports){var getAllProperties=function(e){for(var t={};e&&e!==React.Component.prototype&&e!==Object.prototype;){for(var r=Object.getOwnPropertyNames(e),n=0;n<r.length;n++)t[r[n]]=null;e=Object.getPrototypeOf(e)}return delete t.constructor,Object.keys(t)};exports.extend=function(e,t){for(var r=getAllProperties(t),n=0;n<r.length;n++){var o=r[n];if(!(o in e)){var i=t[o];"function"==typeof i&&(i=i.bind(t)),e[o]=i}}},exports.getProps=function(e){for(var t={},r=0;r<e.attributes.length;r++){var n=e.attributes[r],o=exports.attributeNameToPropertyName(n.name);t[o]=exports.parseAttributeValue(n.value)}return t.container=e,t},exports.getterSetter=function(e,t,r,n){Object.defineProperty?Object.defineProperty(e,t,{get:r,set:n}):document.__defineGetter__&&(e.__defineGetter__(t,r),e.__defineSetter__(t,n)),e["get"+t]=r,e["set"+t]=n},exports.attributeNameToPropertyName=function(e){return e.replace(/^(x|data)[-_:]/i,"").replace(/[-_:](.)/g,function(e,t){return t.toUpperCase()})},exports.parseAttributeValue=function(value){var pointerRegexp=/^{.*?}$/i,jsonRegexp=/^{{2}.*}{2}$/,jsonArrayRegexp=/^{\[.*\]}$/,pointerMatches=value.match(pointerRegexp),jsonMatches=value.match(jsonRegexp)||value.match(jsonArrayRegexp);return jsonMatches?value=JSON.parse(jsonMatches[0].replace(/^{|}$/g,"")):pointerMatches&&(value=eval(pointerMatches[0].replace(/[{}]/g,""))),value},exports.getChildren=function(e){for(var t=document.createDocumentFragment();e.childNodes.length;)t.appendChild(e.childNodes[0]);return t}},{}]},{},[2])(2)}); |
src/app/views/oils.js | nazar/soapee-ui | import React from 'react';
import DocMeta from 'react-doc-meta';
import GridOil from 'components/gridOil';
export default React.createClass( {
render() {
document.title = 'Soapee - Oils';
return (
<div id="oils">
<DocMeta tags={ this.tags() } />
<GridOil />
</div>
);
},
tags() {
let description = `Soapee Oils Database`;
return [
{name: 'description', content: description},
{name: 'twitter:card', content: description},
{name: 'twitter:title', content: description},
{property: 'og:title', content: description}
];
}
} ); |
src/components/nav/index.js | Adutchguy/portfolio | import './_nav.scss';
import React, { Component } from 'react';
import {HashRouter as Router, Link} from 'react-router-dom';
import Icon from '../icon';
class Nav extends React.Component {
constructor(props){
super(props);
this.state = {
};
}
render() {
return(
<div className='nav-menu'>
<Router>
<ul className='nav-menu-ul'>
<li>
<Icon
className='nav-menu-ul-close-menu'
icon='menu'
width='50'
height='50'
onClick={this.props.handleNavIconClickEvent}
/>
</li>
<li onClick={this.props.handleNavIconClickEvent} className='nav-menu-ul-home'>
<Link
to='/'>
Home
</Link>
</li>
<li onClick={this.props.handleNavIconClickEvent} className='nav-menu-ul-education'>
<Link
to='/education'>
Education
</Link>
</li>
<li onClick={this.props.handleNavIconClickEvent} className='nav-menu-ul-projects'>
<Link
to='/projects'>
Projects
</Link>
</li>
</ul>
</Router>
</div>
);
}
}
export default Nav;
|
src/components/IntroScreen/IntroBubbles.js | vogelino/design-timeline | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import './IntroBubbles.css';
const getRandomInt = (min, max) =>
Math.floor(Math.random() * ((max - min) + 1)) + min;
class IntroBubbles extends Component {
shouldComponentUpdate() {
return false;
}
render() {
const { colors } = this.props;
const bubbles = Array.from(Array(20)).map((val, id) => {
const diameter = getRandomInt(100, 2);
return {
id,
diameter,
color: colors[getRandomInt(colors.length, 0)],
xPosition: getRandomInt(100, 0),
yPosition: getRandomInt(100, 0),
};
});
return (
<div className="introbubbles">
{bubbles.map((bubble) => (
<div
key={bubble.id}
className="introbubbles_bubblewrapper"
style={{
width: bubble.diameter,
height: bubble.diameter,
left: `${bubble.xPosition}%`,
top: `${bubble.yPosition}%`,
}}
>
<span
className="introbubbles_bubble"
style={{
width: bubble.diameter,
height: bubble.diameter,
borderColor: bubble.color,
}}
/>
</div>
))}
</div>
);
}
}
IntroBubbles.defaultProps = {
colors: [],
};
IntroBubbles.propTypes = {
colors: PropTypes.array,
};
const mapStateToProps = ({ categories }) => ({
colors: categories.map(({ color }) => color),
});
export default connect(mapStateToProps)(IntroBubbles);
|
ajax/libs/6to5/2.13.0/browser.js | iamJoeTaylor/cdnjs | !function(n){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.to5=n()}}(function(){var define,module,exports;return function e(e,n,t){function r(l,u){if(!n[l]){if(!e[l]){var s=typeof require=="function"&&require;if(!u&&s)return s(l,!0);if(a)return a(l,!0);var o=new Error("Cannot find module '"+l+"'");throw o.code="MODULE_NOT_FOUND",o}var i=n[l]={exports:{}};e[l][0].call(i.exports,function(n){var t=e[l][1][n];return r(t?t:n)},i,i.exports,e,e,n,t)}return n[l].exports}var a=typeof require=="function"&&require;for(var l=0;l<t.length;l++)r(t[l]);return r}({1:[function(t,n,e){(function(r,t){if(typeof e=="object"&&typeof n=="object")return t(e);if(typeof define=="function"&&define.amd)return define(["exports"],t);t(r.acorn||(r.acorn={}))})(this,function(B){"use strict";B.version="0.11.1";var r,a,V,yt;B.parse=function(e,t){a=String(e);V=a.length;xt(t);ht();var l=r.locations?[n,mn()]:n;nr();return ua(r.program||S(l))};var cr=B.defaultOptions={playground:false,ecmaVersion:5,strictSemicolons:false,allowTrailingCommas:true,forbidReserved:false,allowReturnOutsideFunction:false,allowImportExportEverywhere:false,allowHashBang:false,locations:false,onToken:null,onComment:null,ranges:false,program:null,sourceFile:null,directSourceFile:null,preserveParens:false};B.parseExpressionAt=function(e,n,t){a=String(e);V=a.length;xt(t);ht(n);nr();return y()};var lr=function(e){return Object.prototype.toString.call(e)==="[object Array]"};function xt(n){r={};for(var e in cr)r[e]=n&&pt(n,e)?n[e]:cr[e];yt=r.sourceFile||null;if(lr(r.onToken)){var t=r.onToken;r.onToken=function(e){t.push(e)}}if(lr(r.onComment)){var l=r.onComment;r.onComment=function(a,i,n,t,s,o){var e={type:a?"Block":"Line",value:i,start:n,end:t};if(r.locations){e.loc=new rt;e.loc.start=s;e.loc.end=o}if(r.ranges)e.range=[n,t];l.push(e)}}if(r.strictMode){M=true}if(r.ecmaVersion>=6){at=El}else{at=Zt}}var Dl=B.getLineInfo=function(l,t){for(var r=1,n=0;;){En.lastIndex=n;var e=En.exec(l);if(e&&e.index<t){++r;n=e.index+e[0].length}else break}return{line:r,column:t-n}};function _t(){this.type=e;this.value=f;this.start=m;this.end=D;if(r.locations){this.loc=new rt;this.loc.end=Nn;this.startLoc=ln;this.endLoc=Nn}if(r.ranges)this.range=[m,D]}B.Token=_t;B.tokenize=function(t,l){a=String(t);V=a.length;xt(l);ht();sn();function e(e){T=D;un(e);return new _t}e.jumpTo=function(t,l){n=t;if(r.locations){U=1;P=En.lastIndex=0;var e;while((e=En.exec(a))&&e.index<t){++U;P=e.index+e[0].length}}$=l;sn()};e.noRegexp=function(){$=false};e.options=r;return e};var n;var m,D;var ln,Nn;var e,f;var $;var U,P;var jn,T,rn;var Gn,Rn,Xn,k,M,A,I,on;var Vn;var en;function nr(){jn=T=n;if(r.locations)rn=new Qn;Gn=Rn=Xn=M=false;k=[];sn();un()}function u(r,l){var t=Dl(a,r);l+=" ("+t.line+":"+t.column+")";var e=new SyntaxError(l);e.pos=r;e.loc=t;e.raisedAt=n;throw e}var mr=[];var yn={type:"num"},kt={type:"regexp"},J={type:"string"};var p={type:"name"},xn={type:"eof"};var bt={type:"xjsName"},Mn={type:"xjsText"};var hr={keyword:"break"},gt={keyword:"case",beforeExpr:true},zr={keyword:"catch"};var Yt={keyword:"continue"},Wr={keyword:"debugger"},Yn={keyword:"default"};var Gr={keyword:"do",isLoop:true},Vr={keyword:"else",beforeExpr:true};var Ur={keyword:"finally"},Fn={keyword:"for",isLoop:true},dn={keyword:"function"};var Tt={keyword:"if"},Nr={keyword:"return",beforeExpr:true},ct={keyword:"switch"};var jr={keyword:"throw",beforeExpr:true},Pr={keyword:"try"},kn={keyword:"var"};var An={keyword:"let"},zn={keyword:"const"};var ft={keyword:"while",isLoop:true},Tr={keyword:"with"},Ar={keyword:"new",beforeExpr:true};var Ir={keyword:"this"};var wn={keyword:"class"},Ct={keyword:"extends",beforeExpr:true};var _r={keyword:"export"},Lt={keyword:"import"};var wr={keyword:"yield",beforeExpr:true};var Er={keyword:"null",atomValue:null},br={keyword:"true",atomValue:true};var xr={keyword:"false",atomValue:false};var On={keyword:"in",binop:7,beforeExpr:true};var Jn={"break":hr,"case":gt,"catch":zr,"continue":Yt,"debugger":Wr,"default":Yn,"do":Gr,"else":Vr,"finally":Ur,"for":Fn,"function":dn,"if":Tt,"return":Nr,"switch":ct,"throw":jr,"try":Pr,"var":kn,let:An,"const":zn,"while":ft,"with":Tr,"null":Er,"true":br,"false":xr,"new":Ar,"in":On,"instanceof":{keyword:"instanceof",binop:7,beforeExpr:true},"this":Ir,"typeof":{keyword:"typeof",prefix:true,beforeExpr:true},"void":{keyword:"void",prefix:true,beforeExpr:true},"delete":{keyword:"delete",prefix:true,beforeExpr:true},"class":wn,"extends":Ct,"export":_r,"import":Lt,"yield":wr};var X={type:"[",beforeExpr:true},N={type:"]"},R={type:"{",beforeExpr:true};var b={type:"}"},v={type:"(",beforeExpr:true},h={type:")"};var x={type:",",beforeExpr:true},L={type:";",beforeExpr:true};var _={type:":",beforeExpr:true},qn={type:"."},Z={type:"?",beforeExpr:true};var Q={type:"=>",beforeExpr:true},dr={type:"`"},pr={type:"${",beforeExpr:true};var ot={type:"</"};var Q={type:"=>",beforeExpr:true},et={type:"template"},Zn={type:"templateContinued"};var K={type:"...",prefix:true,beforeExpr:true};var dt={type:"::",beforeExpr:true};var mt={type:"@"};var $n={type:"#"};var Bn={binop:10,beforeExpr:true},tn={isAssign:true,beforeExpr:true};var z={isAssign:true,beforeExpr:true};var wl={postfix:true,prefix:true,isUpdate:true},fr={prefix:true,beforeExpr:true};var sr={binop:1,beforeExpr:true};var ir={binop:2,beforeExpr:true};var ar={binop:3,beforeExpr:true};var Jl={binop:4,beforeExpr:true};var rr={binop:5,beforeExpr:true};var ia={binop:6,beforeExpr:true};var ul={binop:7,beforeExpr:true};var fl={binop:8,beforeExpr:true};var hl={binop:9,prefix:true,beforeExpr:true};var yl={binop:10,beforeExpr:true};var Y={binop:10,beforeExpr:true};var tr={binop:11,beforeExpr:true,rightAssociative:true};var w={binop:7,beforeExpr:true},H={binop:7,beforeExpr:true};B.tokTypes={bracketL:X,bracketR:N,braceL:R,braceR:b,parenL:v,parenR:h,comma:x,semi:L,colon:_,dot:qn,ellipsis:K,question:Z,slash:Bn,eq:tn,name:p,eof:xn,num:yn,regexp:kt,string:J,arrow:Q,bquote:dr,dollarBraceL:pr,star:Y,assign:z,xjsName:bt,xjsText:Mn,paamayimNekudotayim:dt,exponent:tr,at:mt,hash:$n,template:et,templateContinued:Zn};for(var er in Jn)B.tokTypes["_"+er]=Jn[er];var al=function Da(e){switch(e.length){case 6:switch(e){case"double":case"export":case"import":case"native":case"public":case"static":case"throws":return true}return false;case 4:switch(e){case"byte":case"char":case"enum":case"goto":case"long":return true}return false;case 5:switch(e){case"class":case"final":case"float":case"short":case"super":return true}return false;case 7:switch(e){case"boolean":case"extends":case"package":case"private":return true}return false;case 9:switch(e){case"interface":case"protected":case"transient":return true}return false;case 8:switch(e){case"abstract":case"volatile":return true}return false;case 10:return e==="implements";case 3:return e==="int";case 12:return e==="synchronized"}};var il=function Na(e){switch(e.length){case 5:switch(e){case"class":case"super":case"const":return true}return false;case 6:switch(e){case"export":case"import":return true}return false;case 4:return e==="enum";case 7:return e==="extends"}};var Mt=function Fa(e){switch(e.length){case 9:switch(e){case"interface":case"protected":return true}return false;case 7:switch(e){case"package":case"private":return true}return false;case 6:switch(e){case"public":case"static":return true}return false;case 10:return e==="implements";case 3:return e==="let";case 5:return e==="yield"}};var Ot=function Ba(e){switch(e){case"eval":case"arguments":return true}return false};var ml="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";var Zt=function Ua(e){switch(e.length){case 4:switch(e){case"case":case"else":case"with":case"null":case"true":case"void":case"this":return true}return false;case 5:switch(e){case"break":case"catch":case"throw":case"while":case"false":return true}return false;case 3:switch(e){case"for":case"try":case"var":case"new":return true}return false;case 6:switch(e){case"return":case"switch":case"typeof":case"delete":return true}return false;case 8:switch(e){case"continue":case"debugger":case"function":return true}return false;case 2:switch(e){case"do":case"if":case"in":return true}return false;case 7:switch(e){case"default":case"finally":return true}return false;case 10:return e==="instanceof"}};var Oa=ml+" let const class extends export import yield";var El=function Va(e){switch(e.length){case 5:switch(e){case"break":case"catch":case"throw":case"while":case"false":case"const":case"class":case"yield":return true}return false;case 4:switch(e){case"case":case"else":case"with":case"null":case"true":case"void":case"this":return true}return false;case 6:switch(e){case"return":case"switch":case"typeof":case"delete":case"export":case"import":return true}return false;case 3:switch(e){case"for":case"try":case"var":case"new":case"let":return true}return false;case 8:switch(e){case"continue":case"debugger":case"function":return true}return false;case 7:switch(e){case"default":case"finally":case"extends":return true}return false;case 2:switch(e){case"do":case"if":case"in":return true}return false;case 10:return e==="instanceof"}};var at=Zt;var Ll=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;var Qt="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";var ql="̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏ᦰ-ᧀᧈᧉ᧐-᧙ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷼-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-꣄꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︭︳︴﹍-﹏0-9_";var Kt=new RegExp("["+Qt+"]");var Gl=new RegExp("["+Qt+ql+"]");var Wl=/^\d+$/;var zl=/^[\da-fA-F]+$/;var pn=/[\n\r\u2028\u2029]/;function Ma(e){return e===10||e===13||e===8232||e==8233}var En=/\r\n|[\n\r\u2028\u2029]/g;var Hn=B.isIdentifierStart=function(e){if(e<65)return e===36;if(e<91)return true;if(e<97)return e===95;if(e<123)return true;return e>=170&&Kt.test(String.fromCharCode(e))};var $t=B.isIdentifierChar=function(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<91)return true;if(e<97)return e===95;if(e<123)return true;return e>=170&&Gl.test(String.fromCharCode(e))};function Qn(e,n){this.line=e;this.column=n}Qn.prototype.offset=function(e){return new Qn(this.line,this.column+e)};function mn(){return new Qn(U,n-P)}function ht(e){if(e){n=e;P=Math.max(0,a.lastIndexOf("\n",e));U=a.slice(0,P).split(pn).length}else{U=1;n=P=0}$=true;Vn=0;on=A=I=false;en=[];if(n===0&&r.allowHashBang&&a.slice(0,2)==="#!"){Wn(2)}}function g(t,l,a){D=n;if(r.locations)Nn=mn();e=t;if(a!==false)sn();f=l;$=t.beforeExpr;if(r.onToken){r.onToken(new _t)}}function vl(){var i=r.onComment&&r.locations&&mn();var t=n,l=a.indexOf("*/",n+=2);if(l===-1)u(n-2,"Unterminated comment");n=l+2;if(r.locations){En.lastIndex=t;var e;while((e=En.exec(a))&&e.index<n){++U;P=e.index+e[0].length}}if(r.onComment)r.onComment(true,a.slice(t+2,l),t,n,i,r.locations&&mn())}function Wn(t){var l=n;var i=r.onComment&&r.locations&&mn();var e=a.charCodeAt(n+=t);while(n<V&&e!==10&&e!==13&&e!==8232&&e!==8233){++n;e=a.charCodeAt(n)}if(r.onComment)r.onComment(false,a.slice(l+t,n),l,n,i,r.locations&&mn())}function sn(){while(n<V){var e=a.charCodeAt(n);if(e===32){++n}else if(e===13){++n;var t=a.charCodeAt(n);if(t===10){++n}if(r.locations){++U;P=n}}else if(e===10||e===8232||e===8233){++n;if(r.locations){++U;P=n}}else if(e>8&&e<14){++n}else if(e===47){var t=a.charCodeAt(n+1);if(t===42){vl()}else if(t===47){Wn(2)}else break}else if(e===160){++n}else if(e>=5760&&Ll.test(String.fromCharCode(e))){++n}else{break}}}function _l(){var e=a.charCodeAt(n+1);if(e>=48&&e<=57)return Gt(true);var t=a.charCodeAt(n+2);if(r.playground&&e===63){n+=2;return g(_dotQuestion)}else if(r.ecmaVersion>=6&&e===46&&t===46){n+=3;return g(K)}else{++n;return g(qn)}}function Sl(){var e=a.charCodeAt(n+1);if($){++n;return Wt()}if(e===61)return E(z,2);return E(Bn,1)}function kl(){var e=a.charCodeAt(n+1);if(e===61)return E(z,2);return E(yl,1)}function Il(){var e=Y;var t=1;var l=a.charCodeAt(n+1);if(r.ecmaVersion>=7&&l===42){t++;l=a.charCodeAt(n+2);e=tr}if(l===61){t++;e=z}return E(e,t)}function Rl(e){var t=a.charCodeAt(n+1);if(t===e){if(r.playground&&a.charCodeAt(n+2)===61)return E(z,3);return E(e===124?sr:ir,2)}if(t===61)return E(z,2);return E(e===124?ar:rr,1)}function Al(){var e=a.charCodeAt(n+1);if(e===61)return E(z,2);return E(Jl,1)}function Tl(t){var e=a.charCodeAt(n+1);if(e===t){if(e==45&&a.charCodeAt(n+2)==62&&pn.test(a.slice(T,n))){Wn(3);sn();return un()}return E(wl,2)}if(e===61)return E(z,2);return E(hl,1)}function La(t){var r=a.charCodeAt(n+1);var e=1;if(!on&&r===t){e=t===62&&a.charCodeAt(n+2)===62?3:2;if(a.charCodeAt(n+e)===61)return E(z,e+1);return E(fl,e)}if(r==33&&t==60&&a.charCodeAt(n+2)==45&&a.charCodeAt(n+3)==45){Wn(4);sn();return un()}if(r===61){e=a.charCodeAt(n+2)===61?3:2;return E(ul,e)}if(t===60&&r===47){e=2;return E(ot,e)}return t===60?E(w,e):E(H,e,!I)}function Pl(e){var t=a.charCodeAt(n+1);if(t===61)return E(ia,a.charCodeAt(n+2)===61?3:2);if(e===61&&t===62&&r.ecmaVersion>=6){n+=2;return g(Q)}return E(e===61?tn:fr,1)}function ja(t){if(e===J){if(t===96){++n;return g(dr)}else if(t===36&&a.charCodeAt(n+1)===123){n+=2;return g(pr)}}return readTmplString()}function Ol(t){switch(t){case 46:return _l();case 40:++n;return g(v);case 41:++n;return g(h);case 59:++n;return g(L);case 44:++n;return g(x);case 91:++n;return g(X);case 93:++n;return g(N);case 123:++n;if(en.length)++en[en.length-1];return g(R);case 125:++n;if(en.length&&--en[en.length-1]===0)return Jt(Zn);else return g(b);case 63:++n;return g(Z);case 64:if(r.playground){++n;return g(mt)}case 35:if(r.playground){++n;return g($n)}case 58:++n;if(r.ecmaVersion>=7){var e=a.charCodeAt(n);if(e===58){++n;return g(dt)}}return g(_);case 96:if(r.ecmaVersion>=6){++n;return Jt(et)}case 48:var e=a.charCodeAt(n+1);if(e===120||e===88)return It(16);if(r.ecmaVersion>=6){if(e===111||e===79)return It(8);if(e===98||e===66)return It(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return Gt(false);case 34:case 39:return I?cl():ha(t);case 47:return Sl();case 37:return kl();case 42:return Il();case 124:case 38:return Rl(t);case 94:return Al();case 43:case 45:return Tl(t);case 60:case 62:return La(t);case 61:case 33:return Pl(t);case 126:return E(fr,1)}return false}function un(i){if(!i)m=n;else n=m+1;if(r.locations)ln=mn();if(i)return Wt();if(n>=V)return g(xn);var t=a.charCodeAt(n);if(A&&e!==R&&t!==60&&t!==123&&t!==125){return Xt(["<","{"])}if(Hn(t)||t===92)return Vt();var s=Ol(t);if(s===false){var l=String.fromCharCode(t);if(l==="\\"||Kt.test(l))return Vt();u(n,"Unexpected character '"+l+"'")}return s}function E(t,e,r){var l=a.slice(n,n+e);n+=e;g(t,l,r)}var zt=false;try{new RegExp("","u");zt=true}catch(Pa){}function Wt(){var s="",o,i,t=n;for(;;){if(n>=V)u(t,"Unterminated regular expression");var l=an();if(pn.test(l))u(t,"Unterminated regular expression");if(!o){if(l==="[")i=true;else if(l==="]"&&i)i=false;else if(l==="/"&&!i)break;o=l==="\\"}else o=false;++n}var s=a.slice(t,n);++n;var e=yr();var c=s;if(e){var p=/^[gmsiy]*$/;if(r.ecmaVersion>=6)p=/^[gmsiyu]*$/;if(!p.test(e))u(t,"Invalid regular expression flag");if(e.indexOf("u")>=0&&!zt){c=c.replace(/\\u\{([0-9a-fA-F]{5,6})\}/g,"x").replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x")}}try{new RegExp(c)}catch(f){if(f instanceof SyntaxError)u(t,"Error parsing regular expression: "+f.message);u(f)}try{var d=new RegExp(s,e)}catch(m){d=null}return g(kt,{pattern:s,flags:e,value:d})}function Cn(i,r){var s=n,l=0;for(var o=0,u=r==null?Infinity:r;o<u;++o){var e=a.charCodeAt(n),t;if(e>=97)t=e-97+10;else if(e>=65)t=e-65+10;else if(e>=48&&e<=57)t=e-48;else t=Infinity;if(t>=i)break;++n;l=l*i+t}if(n===s||r!=null&&n-s!==r)return null;return l}function It(e){n+=2;var t=Cn(e);if(t==null)u(m+2,"Expected number in radix "+e);if(Hn(a.charCodeAt(n)))u(n,"Identifier directly after number");return g(yn,t)}function Gt(s){var r=n,i=false,o=a.charCodeAt(n)===48;if(!s&&Cn(10)===null)u(r,"Invalid number");if(a.charCodeAt(n)===46){++n;Cn(10);i=true}var e=a.charCodeAt(n);if(e===69||e===101){e=a.charCodeAt(++n);if(e===43||e===45)++n;if(Cn(10)===null)u(r,"Invalid number");i=true}if(Hn(a.charCodeAt(n)))u(n,"Identifier directly after number");var t=a.slice(r,n),l;if(i)l=parseFloat(t);else if(!o||t.length===1)l=parseInt(t,10);else if(/[89]/.test(t)||M)u(r,"Invalid number");else l=parseInt(t,8);return g(yn,l)}function da(){var t=a.charCodeAt(n),e;if(t===123){if(r.ecmaVersion<6)c();++n;e=lt(a.indexOf("}",n)-n);++n;if(e>1114111)c()}else{e=lt(4)}if(e<=65535){return String.fromCharCode(e)}var l=(e-65536>>10)+55296;var i=(e-65536&1023)+56320;return String.fromCharCode(l,i)}function ha(r){++n;var t="";for(;;){if(n>=V)u(m,"Unterminated string constant");var e=a.charCodeAt(n);if(e===r){++n;return g(J,t)}if(e===92){t+=qt()}else{++n;if(pn.test(String.fromCharCode(e))){u(m,"Unterminated string constant")}t+=String.fromCharCode(e)}}}function Jt(l){if(l==Zn)en.pop();var t="",i=n;for(;;){if(n>=V)u(m,"Unterminated template");var e=a.charAt(n);if(e==="`"||e==="$"&&a.charCodeAt(n+1)===123){var s=a.slice(i,n);++n;if(e=="$"){++n;en.push(1)}return g(l,{cooked:t,raw:s})}if(e==="\\"){t+=qt()}else{++n;if(pn.test(e)){if(e==="\r"&&a.charCodeAt(n)===10){++n;e="\n"}if(r.locations){++U;P=n}}t+=e}}}function qt(){var t=a.charCodeAt(++n);var e=/^[0-7]+/.exec(a.slice(n,n+3));if(e)e=e[0];while(e&&parseInt(e,8)>255)e=e.slice(0,-1);if(e==="0")e=null;++n;if(e){if(M)u(n-2,"Octal literal in strict mode");n+=e.length-1;return String.fromCharCode(parseInt(e,8))}else{switch(t){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(lt(2));case 117:return da();case 116:return" ";case 98:return"\b";case 118:return"";case 102:return"\f";case 48:return"\x00";case 13:if(a.charCodeAt(n)===10)++n;case 10:if(r.locations){P=n;++U}return"";default:return String.fromCharCode(t)}}}var sl={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:"♦"};function ol(){var e="",l=0,t;var r=an();if(r!=="&")u(n,"Entity must start with an ampersand");var a=++n;while(n<V&&l++<10){r=an();n++;if(r===";"){if(e[0]==="#"){if(e[1]==="x"){e=e.substr(2);if(zl.test(e)){t=String.fromCharCode(parseInt(e,16))}}else{e=e.substr(1);if(Wl.test(e)){t=String.fromCharCode(parseInt(e,10))}}}else{t=sl[e]}break}e+=r}if(!t){n=a;return"&"}return t}function Xt(l){var t="";while(n<V){var e=an();if(l.indexOf(e)!==-1){break}if(e==="&"){t+=ol()}else{++n;if(e==="\r"&&an()==="\n"){t+=e;++n;e="\n"}if(e==="\n"&&r.locations){P=n;++U}t+=e}}return g(Mn,t)}function cl(){var t=a.charCodeAt(n);if(t!==34&&t!==39){u("String literal must starts with a quote")}++n;Xt([String.fromCharCode(t)]);if(t!==a.charCodeAt(n)){c()}++n;return g(e,f)}function lt(n){var e=Cn(16,n);if(e===null)u(m,"Bad character escape sequence");return e}var bn;function yr(){bn=false;var e,l=true,i=n;for(;;){var t=a.charCodeAt(n);if($t(t)||I&&t===45){if(bn)e+=an();++n}else if(t===92&&!I){if(!bn)e=a.slice(i,n);bn=true;if(a.charCodeAt(++n)!=117)u(n,"Expecting Unicode escape sequence \\uXXXX");++n;var r=lt(4);var s=String.fromCharCode(r);if(!s)u(n-1,"Invalid Unicode escape");if(!(l?Hn(r):$t(r)))u(n-4,"Invalid Unicode escape");e+=s}else{break}l=false}return bn?e:a.slice(i,n)}function Vt(){var e=yr();var n=I?bt:p;if(!bn&&at(e))n=Jn[e];return g(n,e)}function s(){jn=m;T=D;rn=Nn;un()}function Dt(e){M=e;n=m;if(r.locations){while(n<P){P=a.lastIndexOf("\n",P-2)+1;--U}}sn();un()}function Nt(){this.type=null;this.start=m;this.end=null}B.Node=Nt;function rt(){this.start=ln;this.end=null;if(yt!==null)this.source=yt}function o(){var e=new Nt;if(r.locations)e.loc=new rt;if(r.directSourceFile)e.sourceFile=r.directSourceFile;if(r.ranges)e.range=[m,0];return e}function C(){return r.locations?[m,ln]:m}function S(t){var e=new Nt,n=t;if(r.locations){e.loc=new rt;e.loc.start=n[1];n=t[0]}e.start=n;if(r.directSourceFile)e.sourceFile=r.directSourceFile;if(r.ranges)e.range=[n,0];return e}function t(e,n){e.type=n;e.end=T;if(r.locations)e.loc.end=rn;if(r.ranges)e.range[1]=T;return e}function Cl(e,t,n){if(r.locations){e.loc.end=n[1];n=n[0]}e.type=t;e.end=n;if(r.ranges)e.range[1]=n;return e}function At(e){return r.ecmaVersion>=5&&e.type==="ExpressionStatement"&&e.expression.type==="Literal"&&e.expression.value==="use strict"}function i(n){if(e===n){s();return true}else{return false}}function cn(){return!r.strictSemicolons&&(e===xn||e===b||pn.test(a.slice(T,m)))}function j(){if(!i(L)&&!cn())c()}function l(e){i(e)||c()}function an(){return a.charAt(n)}function c(e){u(e!=null?e:m,"Unexpected token")}function pt(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function _n(e,i,t){if(r.ecmaVersion>=6&&e){switch(e.type){case"Identifier":case"MemberExpression":break;case"ObjectExpression":e.type="ObjectPattern";for(var n=0;n<e.properties.length;n++){var l=e.properties[n];if(l.type==="Property"&&l.kind!=="init")c(l.key.start);_n(l.value,false,t)}break;case"ArrayExpression":e.type="ArrayPattern";for(var n=0,a=e.elements.length-1;n<=a;n++){_n(e.elements[n],n===a,t)}break;case"SpreadElement":if(i){_n(e.argument,false,t);jt(e.argument)}else{c(e.start)}break;case"AssignmentExpression":if(e.operator==="="){e.type="AssignmentPattern"}else{c(e.left.end)}break;default:if(t)c(e.start)}}return e}function vn(){if(r.ecmaVersion<6)return d();switch(e){case p:return d();case X:var a=o();s();var u=a.elements=[],f=true;while(!i(N)){f?f=false:l(x);if(e===K){var n=o();s();n.argument=vn();jt(n.argument);u.push(t(n,"SpreadElement"));l(N);break}u.push(e===x?null:Ft())}return t(a,"ArrayPattern");case R:return vr(true);default:c()}}function Ft(r,e){e=e||vn();if(!i(tn))return e;var n=r?S(r):o();n.operator="=";n.left=e;n.right=fn();return t(n,"AssignmentPattern")}function jt(e){if(e.type!=="Identifier"&&e.type!=="ArrayPattern")c(e.start)}function Tn(e,t){switch(e.type){case"Identifier":if(Mt(e.name)||Ot(e.name))u(e.start,"Defining '"+e.name+"' in strict mode");if(pt(t,e.name))u(e.start,"Argument name clash in strict mode");t[e.name]=true;break;case"ObjectPattern":for(var n=0;n<e.properties.length;n++)Tn(e.properties[n].value,t);break;case"ArrayPattern":for(var n=0;n<e.elements.length;n++){var r=e.elements[n];if(r)Tn(r,t)}break}}function ra(i,l){if(r.ecmaVersion>=6)return;var t=i.key,e;switch(t.type){case"Identifier":e=t.name;break;case"Literal":e=String(t.value);break;default:return}var a=i.kind||"init",n;if(pt(l,e)){n=l[e];var s=a!=="init";if((M||s)&&n[a]||!(s^n.init))u(t.start,"Redefinition of property")}else{n=l[e]={init:false,get:false,set:false}}n[a]=true}function W(e,t){switch(e.type){case"Identifier":if(M&&(Ot(e.name)||Mt(e.name)))u(e.start,(t?"Binding ":"Assigning to ")+e.name+" in strict mode");break;case"MemberExpression":if(t)u(e.start,"Binding to member expression");break;case"ObjectPattern":for(var n=0;n<e.properties.length;n++){var r=e.properties[n];if(r.type==="Property")r=r.value;W(r,t)}break;case"ArrayPattern":for(var n=0;n<e.elements.length;n++){var l=e.elements[n];if(l)W(l,t)}break;case"SpreadProperty":case"AssignmentPattern":case"SpreadElement":case"VirtualPropertyExpression":break;default:u(e.start,"Assigning to rvalue")}}function ua(n){var r=true;if(!n.body)n.body=[];while(e!==xn){var l=F(true);n.body.push(l);if(r&&At(l))Dt(true);r=false}jn=m;T=D;rn=Nn;return t(n,"Program")}var Rt={kind:"loop"},ma={kind:"switch"};function F(a){if(e===Bn||e===z&&f=="/=")un(true);var l=e,n=o(),c=C();switch(l){case hr:case Yt:return ya(n,l.keyword);case Wr:return ba(n);case Gr:return ka(n);case Fn:return Ia(n);case dn:return Ca(n);case wn:return Cr(n,true);case Tt:return Ta(n);case Nr:return Yr(n);case ct:return $r(n);case jr:return Kr(n);case Pr:return Qr(n);case kn:case An:case zn:return Zr(n,l.keyword);case ft:return el(n);case Tr:return nl(n);case R:return In();case L:return tl(n);case _r:case Lt:if(!a&&!r.allowImportExportEverywhere)u(m,"'import' and 'export' may only appear at the top level");return l===Lt?Bl(n):Nl(n);default:var s=f,t=y(false,false,true);if(t.type==="FunctionDeclaration")return t;if(l===p&&t.type==="Identifier"){if(i(_)){return rl(n,s,t)}if(r.ecmaVersion>=7&&t.name==="private"&&e===p){return Rr(n)}else if(t.name==="declare"){if(e===wn||e===p||e===dn||e===kn){return Fr(n)}}else if(e===p){if(t.name==="interface"){return fa(n)}else if(t.name==="type"){return pa(n)}}}return ll(n,t)}}function ya(n,o){var l=o=="break";s();if(i(L)||cn())n.label=null;else if(e!==p)c();else{n.label=d();j()}for(var r=0;r<k.length;++r){var a=k[r];if(n.label==null||a.name===n.label.name){if(a.kind!=null&&(l||a.kind==="loop"))break;if(n.label&&l)break}}if(r===k.length)u(n.start,"Unsyntactic "+o);return t(n,l?"BreakStatement":"ContinueStatement")}function ba(e){s();j();return t(e,"DebuggerStatement")}function ka(e){s();k.push(Rt);e.body=F();k.pop();l(ft);e.test=gn();if(r.ecmaVersion>=6)i(L);else j();return t(e,"DoWhileStatement")}function Ia(a){s();k.push(Rt);l(v);if(e===L)return wt(a,null);if(e===kn||e===An){var n=o(),i=e.keyword,u=e===An;s();ur(n,true,i);t(n,"VariableDeclaration");if((e===On||r.ecmaVersion>=6&&e===p&&f==="of")&&n.declarations.length===1&&!(u&&n.declarations[0].init))return or(a,n);return wt(a,n)}var n=y(false,true);if(e===On||r.ecmaVersion>=6&&e===p&&f==="of"){W(n);return or(a,n)}return wt(a,n)}function Ca(e){s();return Bt(e,true,false)}function Ta(e){s();e.test=gn();e.consequent=F();e.alternate=i(Vr)?F():null;return t(e,"IfStatement")}function Yr(e){if(!Gn&&!r.allowReturnOutsideFunction)u(m,"'return' outside of function");s();if(i(L)||cn())e.argument=null;else{e.argument=y();j()}return t(e,"ReturnStatement")}function $r(r){s();r.discriminant=gn();r.cases=[];l(R);k.push(ma);for(var n,a;e!=b;){if(e===gt||e===Yn){var i=e===gt;if(n)t(n,"SwitchCase");r.cases.push(n=o());n.consequent=[];s();if(i)n.test=y();else{if(a)u(jn,"Multiple default clauses");a=true;n.test=null}l(_)}else{if(!n)c();n.consequent.push(F())}}if(n)t(n,"SwitchCase");s();k.pop();return t(r,"SwitchStatement")}function Kr(e){s();if(pn.test(a.slice(T,m)))u(T,"Illegal newline after throw");e.argument=y();j();return t(e,"ThrowStatement")}function Qr(n){s();n.block=In();n.handler=null;if(e===zr){var r=o();s();l(v);r.param=d();if(M&&Ot(r.param.name))u(r.param.start,"Binding "+r.param.name+" in strict mode");l(h);r.guard=null;r.body=In();n.handler=t(r,"CatchClause")}n.guardedHandlers=mr;n.finalizer=i(Ur)?In():null;if(!n.handler&&!n.finalizer)u(n.start,"Missing catch or finally clause");return t(n,"TryStatement")}function Zr(e,n){s();ur(e,false,n);j();return t(e,"VariableDeclaration")}function el(e){s();e.test=gn();k.push(Rt);e.body=F();k.pop();return t(e,"WhileStatement")}function nl(e){if(M)u(m,"'with' in strict mode");s();e.object=gn();e.body=F();return t(e,"WithStatement")}function tl(e){s();return t(e,"EmptyStatement")}function rl(n,r,a){for(var l=0;l<k.length;++l)if(k[l].name===r)u(a.start,"Label '"+r+"' is already declared");var i=e.isLoop?"loop":e===ct?"switch":null;k.push({name:r,kind:i});n.body=F();k.pop();n.label=a;return t(n,"LabeledStatement")}function ll(e,n){e.expression=n;j();return t(e,"ExpressionStatement")}function gn(){l(v);var e=y();l(h);return e}function In(s){var e=o(),n=true,r;e.body=[];l(R);while(!i(b)){var a=F();e.body.push(a);if(n&&s&&At(a)){r=M;Dt(M=true)}n=false}if(r===false)Dt(false);return t(e,"BlockStatement")}function wt(n,r){n.init=r;l(L);n.test=e===L?null:y();l(L);n.update=e===h?null:y();l(h);n.body=F();k.pop();return t(n,"ForStatement")}function or(n,r){var a=e===On?"ForInStatement":"ForOfStatement";s();n.left=r;n.right=y();l(h);n.body=F();k.pop();return t(n,a)}function ur(r,a,l){r.declarations=[];r.kind=l;for(;;){var n=o();n.id=vn();W(n.id,true);if(e===_){n.id.typeAnnotation=Pn();t(n.id,n.id.type)}n.init=i(tn)?y(true,a):l===zn.keyword?c():null;r.declarations.push(t(n,"VariableDeclarator"));if(!i(x))break}return r}function y(a,r,s){var o=C();var l=fn(r,false,s);if(!a&&e===x){var n=S(o);n.expressions=[l];while(i(x))n.expressions.push(fn(r));return t(n,"SequenceExpression")}return l}function fn(l,a,i){var o=C();var n=pl(l,a,i);if(e.isAssign){var r=S(o);r.operator=f;r.left=e===tn?_n(n):n;W(n);s();r.right=fn(l);return t(r,"AssignmentExpression")}return n}function pl(n,o,c){var f=C();var a=dl(n,o,c);if(i(Z)){var e=S(f);if(r.playground&&i(tn)){var s=e.left=_n(a);if(s.type!=="MemberExpression")u(s.start,"You can only use member expressions in memoization assignment");
e.right=fn(n);e.operator="?=";return t(e,"AssignmentExpression")}e.test=a;e.consequent=y(true);l(_);e.alternate=y(true,n);return t(e,"ConditionalExpression")}return a}function dl(e,n,t){var r=C();return st(Ln(t),r,-1,e,n)}function st(i,o,u,l,c){var r=e.binop;if(r!=null&&(!l||e!==On)&&(!c||e!==w)){if(r>u){var n=S(o);n.left=i;n.operator=f;var a=e;s();var p=C();n.right=st(Ln(),p,a.rightAssociative?r-1:r,l);t(n,a===sr||a===ir?"LogicalExpression":"BinaryExpression");return st(n,o,u,l)}}return i}function Ln(i){if(e.prefix){var n=o(),a=e.isUpdate,l;if(e===K){l="SpreadElement"}else{l=a?"UpdateExpression":"UnaryExpression";n.operator=f;n.prefix=true}$=true;s();n.argument=Ln();if(a)W(n.argument);else if(M&&n.operator==="delete"&&n.argument.type==="Identifier")u(n.start,"Deleting local variable in strict mode");return t(n,l)}var c=C();var r=gl(i);while(e.postfix&&!cn()){var n=S(c);n.operator=f;n.prefix=false;n.argument=r;W(r);s();r=t(n,"UpdateExpression")}return r}function gl(e){var n=C();return G(q(e),n)}function G(s,a,o){if(r.playground&&i($n)){var n=S(a);n.object=s;n.property=d(true);if(i(v)){n.arguments=Un(h,false)}else{n.arguments=[]}return G(t(n,"BindMemberExpression"),a,o)}else if(i(dt)){var n=S(a);n.object=s;n.property=d(true);return G(t(n,"VirtualPropertyExpression"),a,o)}else if(i(qn)){var n=S(a);n.object=s;n.property=d(true);n.computed=false;return G(t(n,"MemberExpression"),a,o)}else if(i(X)){var n=S(a);n.object=s;n.property=y();n.computed=true;l(N);return G(t(n,"MemberExpression"),a,o)}else if(!o&&i(v)){var n=S(a);n.callee=s;n.arguments=Un(h,false);return G(t(n,"CallExpression"),a,o)}else if(e===et){var n=S(a);n.tag=s;n.quasi=Ut();return G(t(n,"TaggedTemplateExpression"),a,o)}return s}function q(I){switch(e){case Ir:var n=o();s();return t(n,"ThisExpression");case mt:var b=C();var n=o();var A=o();s();n.object=t(A,"ThisExpression");n.property=G(d(),b);n.computed=false;return t(n,"MemberExpression");case wr:if(Rn)return Vl();case p:var b=C();var n=o();var g=d(e!==p);if(r.ecmaVersion>=7){if(g.name==="async"){if(e===v){s();var _=++Vn;if(e!==h){u=y();x=u.type==="SequenceExpression"?u.expressions:[u]}else{x=[]}l(h);if(Vn===_&&i(Q)){return tt(n,x,true)}else{n.callee=g;n.arguments=x;return G(t(n,"CallExpression"),b)}}else if(e===p){g=d();if(i(Q)){return tt(n,[g],true)}return g}if(e===dn){if(cn())return g;s();return Bt(n,I,true)}}else if(g.name==="await"){if(Xn)return Xl(n)}}if(i(Q)){return tt(n,[g])}return g;case kt:var n=o();n.regex={pattern:f.pattern,flags:f.flags};n.value=f.value;n.raw=a.slice(m,D);s();return t(n,"Literal");case yn:case J:case Mn:var n=o();n.value=f;n.raw=a.slice(m,D);s();return t(n,"Literal");case Er:case br:case xr:var n=o();n.value=e.atomValue;n.raw=e.keyword;s();return t(n,"Literal");case v:var b=C();var u,x;s();if(r.ecmaVersion>=7&&e===Fn){u=Lr(S(b),true)}else{var _=++Vn;if(e!==h){u=y();x=u.type==="SequenceExpression"?u.expressions:[u]}else{x=[]}l(h);if(Vn===_&&i(Q)){u=tt(S(b),x)}else{if(!u)c(jn);if(r.ecmaVersion>=6){for(var E=0;E<x.length;E++){if(x[E].type==="SpreadElement")c()}}if(r.preserveParens){var k=S(b);k.expression=u;u=t(k,"ParenthesizedExpression")}}}return u;case X:var n=o();s();if(r.ecmaVersion>=7&&e===Fn){return Lr(n,false)}n.elements=Un(N,true,true);return t(n,"ArrayExpression");case R:return vr();case dn:var n=o();s();return Bt(n,false,false);case wn:return Cr(o(),false);case Ar:return bl();case et:return Ut();case w:return ut();case $n:return xl();default:c()}}function xl(){var e=o();s();var n=C();e.callee=G(q(),n,true);if(i(v)){e.arguments=Un(h,false)}else{e.arguments=[]}return t(e,"BindFunctionExpression")}function bl(){var e=o();s();var n=C();e.callee=G(q(),n,true);if(i(v))e.arguments=Un(h,false);else e.arguments=mr;return t(e,"NewExpression")}function gr(){var e=S(r.locations?[m+1,ln.offset(1)]:m+1);e.value=f;e.tail=a.charCodeAt(D-1)!==123;s();var n=e.tail?1:2;return Cl(e,"TemplateElement",r.locations?[T-n,rn.offset(-n)]:T-n)}function Ut(){var n=o();n.expressions=[];var r=gr();n.quasis=[r];while(!r.tail){n.expressions.push(y());if(e!==Zn)c();n.quasis.push(r=gr())}return t(n,"TemplateLiteral")}function vr(a){var u=o(),y=true,S={};u.properties=[];s();while(!i(b)){if(!y){l(x);if(r.allowTrailingCommas&&i(b))break}else y=false;var n=o(),m,h=false,g=false;if(r.ecmaVersion>=7&&e===K){n=Ln();n.type="SpreadProperty";u.properties.push(n);continue}if(r.ecmaVersion>=6){n.method=false;n.shorthand=false;if(a){m=C()}else{h=i(Y)}}if(r.ecmaVersion>=7&&e===p&&f==="async"){var k=d();if(e===_||e===v){n.key=k}else{g=true;hn(n)}}else{hn(n)}var E;if(e===w){E=nn();if(e!==v)c()}if(i(_)){n.value=a?Ft(m):fn();n.kind="init"}else if(r.ecmaVersion>=6&&e===v){if(a)c();n.kind="init";n.method=true;n.value=Pt(h,g)}else if(r.ecmaVersion>=5&&!n.computed&&n.key.type==="Identifier"&&(n.key.name==="get"||n.key.name==="set"||r.playground&&n.key.name==="memo")&&(e!=x&&e!=b)){if(h||g||a)c();n.kind=n.key.name;hn(n);n.value=Pt(false,false)}else if(r.ecmaVersion>=6&&!n.computed&&n.key.type==="Identifier"){n.kind="init";n.value=a?Ft(m,n.key):n.key;n.shorthand=true}else c();n.value.typeParameters=E;ra(n,S);u.properties.push(t(n,"Property"))}return t(u,a?"ObjectPattern":"ObjectExpression")}function hn(n){if(r.ecmaVersion>=6){if(i(X)){n.computed=true;n.key=y();l(N);return}else{n.computed=false}}n.key=e===yn||e===J?q():d(true)}function it(e,n){e.id=null;e.params=[];if(r.ecmaVersion>=6){e.defaults=[];e.rest=null;e.generator=false}if(r.ecmaVersion>=7){e.async=n}}function Bt(n,l,a,s){it(n,a);if(r.ecmaVersion>=6){n.generator=i(Y)}if(l||e===p){n.id=d()}if(e===w){n.typeParameters=nn()}Sr(n);Et(n,s);return t(n,l?"FunctionDeclaration":"FunctionExpression")}function Pt(l,a){var e=o();it(e,a);Sr(e);var n;if(r.ecmaVersion>=6){e.generator=l;n=true}else{n=false}Et(e,n);return t(e,"FunctionExpression")}function tt(e,r,o){it(e,o);var a=e.defaults,i=false;for(var l=0,s=r.length-1;l<=s;l++){var n=r[l];if(n.type==="AssignmentExpression"&&n.operator==="="){i=true;r[l]=n.left;a.push(n.right)}else{_n(n,l===s,true);a.push(null);if(n.type==="SpreadElement"){r.length--;e.rest=n.argument;break}}}e.params=r;if(!i)e.defaults=[];Et(e,true);return t(e,"ArrowFunctionExpression")}function Sr(n){var t=[],a=false;l(v);for(;;){if(i(h)){break}else if(r.ecmaVersion>=6&&i(K)){n.rest=vn();jt(n.rest);kr(n.rest);l(h);t.push(null);break}else{var s=vn();kr(s);n.params.push(s);if(r.ecmaVersion>=6){if(i(tn)){a=true;t.push(y(true))}else{t.push(null)}}if(!i(x)){l(h);break}}}if(a)n.defaults=t;if(e===_){n.returnType=Pn()}}function kr(n){if(i(Z)){n.optional=true}if(e===_){n.typeAnnotation=Pn()}t(n,n.type)}function Et(n,a){var r=a&&e!==R;var i=Xn;Xn=n.async;if(r){n.body=y(true);n.expression=true}else{var s=Gn,o=Rn,u=k;Gn=true;Rn=n.generator;k=[];n.body=In(true);n.expression=false;Gn=s;Rn=o;k=u}Xn=i;if(M||!r&&n.body.body.length&&At(n.body.body[0])){var l={};if(n.id)Tn(n.id,{});for(var t=0;t<n.params.length;t++)Tn(n.params[t],l);if(n.rest)Tn(n.rest,l)}}function Rr(e){e.declarations=[];do{e.declarations.push(d())}while(i(x));j();return t(e,"PrivateDeclaration")}function Cr(a,g){s();a.id=e===p?d():g?c():null;if(e===w){a.typeParameters=nn()}a.superClass=i(Ct)?fn(false,true):null;if(a.superClass&&e===w){a.superTypeParameters=Kn()}if(e===p&&f==="implements"){s();a.implements=Ml()}var u=o();u.body=[];l(R);while(!i(b)){while(i(L));if(e===b)continue;var n=o();if(r.ecmaVersion>=7&&e===p&&f==="private"){s();u.body.push(Rr(n));continue}if(e===p&&f==="static"){s();n["static"]=true}else{n["static"]=false}var m=false;var h=i(Y);if(r.ecmaVersion>=7&&!h&&e===p&&f==="async"){var x=d();if(e===_||e===v){n.key=x}else{m=true;hn(n)}}else{hn(n)}if(e!==v&&!n.computed&&n.key.type==="Identifier"&&(n.key.name==="get"||n.key.name==="set"||r.playground&&n.key.name==="memo")){if(h||m)c();n.kind=n.key.name;hn(n)}else{n.kind=""}if(e===_){if(h||m)c();n.typeAnnotation=Pn();j();u.body.push(t(n,"ClassProperty"))}else{var y;if(e===w){y=nn()}n.value=Pt(h,m);n.value.typeParameters=y;u.body.push(t(n,"MethodDefinition"))}}a.body=t(u,"ClassBody");return t(a,g?"ClassDeclaration":"ClassExpression")}function Ml(){var r=[];do{var n=o();n.id=d();if(e===w){n.typeParameters=Kn()}else{n.typeParameters=null}r.push(t(n,"ClassImplements"))}while(i(x));return r}function Un(t,s,o){var n=[],a=true;while(!i(t)){if(!a){l(x);if(s&&r.allowTrailingCommas&&i(t))break}else a=false;if(o&&e===x)n.push(null);else n.push(y(true))}return n}function d(n){var l=o();if(n&&r.forbidReserved=="everywhere")n=false;if(e===p){if(!n&&(r.forbidReserved&&(r.ecmaVersion===3?al:il)(f)||M&&Mt(f))&&a.slice(m,D).indexOf("\\")==-1)u(m,"The keyword '"+f+"' is reserved");l.name=f}else if(n&&e.keyword){l.name=e.keyword}else{c()}$=false;s();return t(l,"Identifier")}function Nl(n){s();if(e===kn||e===zn||e===An||e===dn||e===wn||e===p&&f==="async"){n.declaration=F();n["default"]=false;n.specifiers=null;n.source=null}else if(i(Yn)){var r=n.declaration=y(true);if(r.id){if(r.type==="FunctionExpression"){r.type="FunctionDeclaration"}else if(r.type==="ClassExpression"){r.type="ClassDeclaration"}}n["default"]=true;n.specifiers=null;n.source=null;j()}else{var l=e===Y;n.declaration=null;n["default"]=false;n.specifiers=Fl();if(e===p&&f==="from"){s();n.source=e===J?q():c()}else{if(l)c();n.source=null}j()}return t(n,"ExportDeclaration")}function Fl(){var a=[],u=true;if(e===Y){var n=o();s();a.push(t(n,"ExportBatchSpecifier"))}else{l(R);while(!i(b)){if(!u){l(x);if(r.allowTrailingCommas&&i(b))break}else u=false;var n=o();n.id=d(e===Yn);if(e===p&&f==="as"){s();n.name=d(true)}else{n.name=null}a.push(t(n,"ExportSpecifier"))}}return a}function Bl(n){s();if(e===J){n.specifiers=[];n.source=q()}else{n.specifiers=Ul();if(e!==p||f!=="from")c();s();n.source=e===J?q():c()}j();return t(n,"ImportDeclaration")}function Ul(){var a=[],u=true;if(e===p){var n=o();n.id=o();n.name=d();W(n.name,true);n.id.name="default";t(n.id,"Identifier");a.push(t(n,"ImportSpecifier"));if(!i(x))return a}if(e===Y){var n=o();s();if(e!==p||f!=="as")c();s();n.name=d();W(n.name,true);a.push(t(n,"ImportBatchSpecifier"));return a}l(R);while(!i(b)){if(!u){l(x);if(r.allowTrailingCommas&&i(b))break}else u=false;var n=o();n.id=d(true);if(e===p&&f==="as"){s();n.name=d()}else{n.name=null}W(n.name||n.id,true);n["default"]=false;a.push(t(n,"ImportSpecifier"))}return a}function Vl(){var e=o();s();if(i(L)||cn()){e.delegate=false;e.argument=null}else{e.delegate=i(Y);e.argument=y(true)}return t(e,"YieldExpression")}function Xl(e){if(i(L)||cn()){c()}e.delegate=i(Y);e.argument=y(true);return t(e,"AwaitExpression")}function Lr(n,a){n.blocks=[];while(e===Fn){var r=o();s();l(v);r.left=vn();W(r.left,true);if(e!==p||f!=="of")c();s();r.of=true;r.right=y();l(h);n.blocks.push(t(r,"ComprehensionBlock"))}n.filter=i(Tt)?gn():null;n.body=y();l(a?h:N);n.generator=a;return t(n,"ComprehensionExpression")}function Dn(e){if(e.type==="XJSIdentifier"){return e.name}if(e.type==="XJSNamespacedName"){return e.namespace.name+":"+e.name.name}if(e.type==="XJSMemberExpression"){return Dn(e.object)+"."+Dn(e.property)}}function Sn(){var n=o();if(e===bt){n.name=f}else if(e.keyword){n.name=e.keyword}else{c()}$=false;s();return t(n,"XJSIdentifier")}function Mr(){var e=o();e.namespace=Sn();l(_);e.name=Sn();return t(e,"XJSNamespacedName")}function Hl(){var r=C();var e=Sn();while(i(qn)){var n=S(r);n.object=e;n.property=Sn();e=t(n,"XJSMemberExpression")}return e}function Or(){switch(an()){case":":return Mr();case".":return Hl();default:return Sn()}}function Yl(){if(an()===":"){return Mr()}return Sn()}function $l(){switch(e){case R:var n=Dr();if(n.expression.type==="XJSEmptyExpression"){u(n.start,"XJS attributes must only be assigned a non-empty "+"expression")}return n;case w:return ut();case Mn:return q();default:u(m,"XJS value should be either an expression or a quoted XJS text")}}function Kl(){if(e!==b){c()}var n;n=m;m=T;T=n;n=ln;ln=rn;rn=n;return t(o(),"XJSEmptyExpression")}function Dr(){var r=o();var a=I,i=A;I=false;A=false;s();r.expression=e===b?Kl():y();I=a;A=i;if(A){n=D}l(b);return t(r,"XJSExpressionContainer")}function Zl(){if(e===R){var a=m,i=ln;var u=I;I=false;s();if(e!==K)c();var n=Ln();I=u;l(b);n.type="XJSSpreadAttribute";n.start=a;n.end=T;if(r.locations){n.loc.start=i;n.loc.end=rn}if(r.ranges){n.range=[a,T]}return n}var n=o();n.name=Yl();if(e===tn){s();n.value=$l()}else{n.value=null}return t(n,"XJSAttribute")}function ea(){switch(e){case R:return Dr();case Mn:return q();default:return ut()}}function na(){var n=o(),r=n.attributes=[];var a=A;var u=I;A=false;I=true;s();n.name=Or();while(e!==xn&&e!==Bn&&e!==H){r.push(Zl())}I=false;if(n.selfClosing=!!i(Bn)){I=u;A=a}else{A=true}l(H);return t(n,"XJSOpeningElement")}function ta(){var e=o();var r=A;var a=I;A=false;I=true;$=false;l(ot);e.name=Or();sn();A=r;I=a;$=false;if(A){n=D}l(H);return t(e,"XJSClosingElement")}function ut(){var n=o();var a=[];var i=A;var r=na();var l=null;if(!r.selfClosing){while(e!==xn&&e!==ot){A=true;a.push(ea())}A=i;l=ta();if(Dn(l.name)!==Dn(r.name)){u(l.start,"Expected corresponding XJS closing tag for '"+Dn(r.name)+"'")}}if(!i&&e===w){u(m,"Adjacent XJS elements must be wrapped in an enclosing tag")}n.openingElement=r;n.closingElement=l;n.children=a;return t(n,"XJSElement")}function la(e){s();Br(e,true);return t(e,"DeclareClass")}function aa(a){s();var r=a.id=d();var n=o();var i=o();if(e===w){n.typeParameters=nn()}else{n.typeParameters=null}l(v);var u=St();n.params=u.params;n.rest=u.rest;l(h);l(_);n.returnType=O();i.typeAnnotation=t(n,"FunctionTypeAnnotation");r.typeAnnotation=t(i,"TypeAnnotation");t(r,r.type);j();return t(a,"DeclareFunction")}function Fr(n){if(e===wn){return la(n)}else if(e===dn){return aa(n)}else if(e===kn){return sa(n)}else if(e===p&&f==="module"){return oa(n)}else{c()}}function sa(e){s();e.id=Ql();j();return t(e,"DeclareVariable")}function oa(n){s();if(e===J){n.id=q()}else{n.id=d()}var r=n.body=o();var a=r.body=[];l(R);while(e!==b){var i=o();s();a.push(Fr(i))}l(b);t(r,"BlockStatement");return t(n,"DeclareModule")}function Br(n,t){n.id=d();if(e===w){n.typeParameters=nn()}else{n.typeParameters=null}n.extends=[];if(i(Ct)){do{n.extends.push(ca())}while(i(x))}n.body=Jr(t)}function ca(){var n=o();n.id=d();if(e===w){n.typeParameters=Kn()}else{n.typeParameters=null}return t(n,"InterfaceExtends")}function fa(e){Br(e,false);return t(e,"InterfaceDeclaration")}function pa(n){n.id=d();if(e===w){n.typeParameters=nn()}else{n.typeParameters=null}l(tn);n.right=O();j();return t(n,"TypeAlias")}function nn(){var n=o();n.params=[];l(w);while(e!==H){n.params.push(d());if(e!==H){l(x)}}l(H);return t(n,"TypeParameterDeclaration")}function Kn(){var n=o(),r=on;n.params=[];on=true;l(w);while(e!==H){n.params.push(O());if(e!==H){l(x)}}l(H);on=r;return t(n,"TypeParameterInstantiation")}function Xr(){return e===yn||e===J?q():d(true)}function ga(e,n){e.static=n;l(X);e.id=Xr();l(_);e.key=O();l(N);l(_);e.value=O();return t(e,"ObjectTypeIndexer")}function qr(n){n.params=[];n.rest=null;n.typeParameters=null;if(e===w){n.typeParameters=nn()}l(v);while(e===p){n.params.push(nt());if(e!==h){l(x)}}if(i(K)){n.rest=nt()}l(h);l(_);n.returnType=O();return t(n,"FunctionTypeAnnotation")}function va(n,r,l){var e=S(n);e.value=qr(S(n));e.static=r;e.key=l;e.optional=false;return t(e,"ObjectTypeProperty")}function xa(e,n){var r=o();e.static=n;e.value=qr(r);return t(e,"ObjectTypeCallProperty")}function Jr(m){var n=o();var r;var h=false;var y;var u;var x;var E;var a;n.callProperties=[];n.properties=[];n.indexers=[];l(R);while(e!==b){var g=C();r=o();if(m&&e===p&&f==="static"){s();a=true}if(e===X){n.indexers.push(ga(r,a))}else if(e===v||e===w){n.callProperties.push(xa(r,m))}else{if(a&&e===_){u=d()}else{u=Xr()}if(e===w||e===v){n.properties.push(va(g,a,u))}else{if(i(Z)){h=true}l(_);r.key=u;r.value=O();r.optional=h;r.static=a;n.properties.push(t(r,"ObjectTypeProperty"))}}if(!i(L)&&e!==b){c()}}l(b);return t(n,"ObjectTypeAnnotation")}function Ea(l,a){var n=S(l);n.typeParameters=null;n.id=a;while(i(qn)){var r=S(l);r.qualification=n.id;r.id=d();n.id=t(r,"QualifiedTypeIdentifier")}if(e===w){n.typeParameters=Kn()}return t(n,"GenericTypeAnnotation")}function wa(){var e=o();l(Jn["void"]);return t(e,"VoidTypeAnnotation")}function _a(){var e=o();l(Jn["typeof"]);e.argument=Hr();return t(e,"TypeofTypeAnnotation")}function Sa(){var r=o();r.types=[];l(X);while(n<V&&e!==N){r.types.push(O());if(e===N)break;l(x)}l(N);return t(r,"TupleTypeAnnotation")}function nt(){var n=false;var e=o();e.name=d();if(i(Z)){n=true}l(_);e.optional=n;e.typeAnnotation=O();return t(e,"FunctionTypeParam")}function St(){var n={params:[],rest:null};while(e===p){n.params.push(nt());if(e!==h){l(x)}}if(i(K)){n.rest=nt()}return n}function Ra(r,e,n){switch(n.name){case"any":return t(e,"AnyTypeAnnotation");case"bool":case"boolean":return t(e,"BooleanTypeAnnotation");case"number":return t(e,"NumberTypeAnnotation");case"string":return t(e,"StringTypeAnnotation");default:return Ea(r,n)}}function Hr(){var A=null;var _=null;var I=null;var b=C();var n=o();var E=null;var r;var S;var k;var g;var x=false;switch(e){case p:return Ra(b,n,d());case R:return Jr();case X:return Sa();case w:n.typeParameters=nn();l(v);r=St();n.params=r.params;n.rest=r.rest;l(h);l(Q);n.returnType=O();return t(n,"FunctionTypeAnnotation");case v:s();var y;if(e!==h&&e!==K){if(e===p){}else{x=true}}if(x){if(y&&h){g=y}else{g=O();l(h)}if(i(Q)){u(n,"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")}return g}r=St();n.params=r.params;n.rest=r.rest;l(h);l(Q);n.returnType=O();n.typeParameters=null;return t(n,"FunctionTypeAnnotation");case J:n.value=f;n.raw=a.slice(m,D);s();return t(n,"StringLiteralTypeAnnotation");default:if(e.keyword){switch(e.keyword){case"void":return wa();case"typeof":return _a()}}}c()}function Aa(){var n=o();var r=n.elementType=Hr();if(e===X){l(X);l(N);return t(n,"ArrayTypeAnnotation")}return r}function vt(){var e=o();if(i(Z)){e.typeAnnotation=vt();return t(e,"NullableTypeAnnotation")}return Aa()}function Ht(){var e=o();var n=vt();e.types=[n];while(i(rr)){e.types.push(vt())}return e.types.length===1?n:t(e,"IntersectionTypeAnnotation")}function jl(){var e=o();var n=Ht();e.types=[n];while(i(ar)){e.types.push(Ht())}return e.types.length===1?n:t(e,"UnionTypeAnnotation")}function O(){var e=on;on=true;var n=jl();on=e;return n}function Pn(){var e=o();l(_);e.typeAnnotation=O();return t(e,"TypeAnnotation")}function Ql(a,s){var u=o();var n=d();var r=false;if(s&&i(Z)){l(Z);r=true}if(a||e===_){n.typeAnnotation=Pn();t(n,n.type)}if(r){n.optional=true;t(n,n.type)}return n}})},{}],2:[function(e,n,t){(function(r){"use strict";var t=n.exports=e("./transformation/transform");t.version=e("../../package").version;t.transform=t;t.run=function(n,e){e=e||{};e.sourceMap="inline";return new Function(t(n,e).code)()};t.load=function(l,a,n,i){n=n||{};n.filename=n.filename||l;var e=r.ActiveXObject?new r.ActiveXObject("Microsoft.XMLHTTP"):new r.XMLHttpRequest;e.open("GET",l,true);if("overrideMimeType"in e)e.overrideMimeType("text/plain");e.onreadystatechange=function(){if(e.readyState!==4)return;var r=e.status;if(r===0||r===200){var s=[e.responseText,n];if(!i)t.run.apply(t,s);if(a)a(s)}else{throw new Error("Could not load "+l)}};e.send(null)};var l=function(){var e=[];var o=["text/ecmascript-6","text/6to5","module"];var a=0;var l=function(){var n=e[a];if(n instanceof Array){t.run.apply(t,n);a++;l()}};var u=function(n,a){var r={};if(n.src){t.load(n.src,function(n){e[a]=n;l()},r,true)}else{r.filename="embedded";e[a]=[n.innerHTML,r]}};var i=r.document.getElementsByTagName("script");for(var n=0;n<i.length;++n){var s=i[n];if(o.indexOf(s.type)>=0)e.push(s)}for(n in e){u(e[n],n)}l()};if(r.addEventListener){r.addEventListener("DOMContentLoaded",l,false)}else if(r.attachEvent){r.attachEvent("onload",l)}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"../../package":197,"./transformation/transform":44}],3:[function(a,o,c){"use strict";o.exports=e;var i=/^\#\!.*/;var l=a("./transformation/transform");var u=a("./generation/generator");var s=a("./traverse/scope");var r=a("./util");var t=a("./types");var n=a("lodash");function e(n){this.dynamicImports=[];this.dynamicImportIds={};this.opts=e.normaliseOptions(n);this.transformers=this.getTransformers();this.uids={};this.ast={}}e.helpers=["inherits","defaults","prototype-properties","apply-constructor","tagged-template-literal","tagged-template-literal-loose","interop-require","to-array","sliced-to-array","object-without-properties","has-own","slice","bind","define-property","async-to-generator","interop-require-wildcard","typeof","extends","get"];e.excludeHelpersFromRuntime=["async-to-generator","typeof","tagged-template-literal-loose"];e.normaliseOptions=function(e){e=n.cloneDeep(e||{});n.defaults(e,{keepModuleIdExtensions:false,includeRegenerator:false,experimental:false,reactCompat:false,playground:false,whitespace:true,moduleIds:e.amdModuleIds||false,blacklist:[],whitelist:[],sourceMap:false,optional:[],comments:true,filename:"unknown",modules:"common",runtime:false,loose:[],code:true,ast:true});e.filename=e.filename.replace(/\\/g,"/");e.blacklist=r.arrayify(e.blacklist);e.whitelist=r.arrayify(e.whitelist);e.optional=r.arrayify(e.optional);e.loose=r.arrayify(e.loose);if(n.contains(e.loose,"all")){e.loose=Object.keys(l.transformers)}n.each({fastForOf:"forOf",classesFastSuper:"classes"},function(r,t){if(n.contains(e.optional,t)){n.pull(e.optional,t);e.loose.push(r)}});n.defaults(e,{moduleRoot:e.sourceRoot});n.defaults(e,{sourceRoot:e.moduleRoot});n.defaults(e,{filenameRelative:e.filename});n.defaults(e,{sourceFileName:e.filenameRelative,sourceMapName:e.filenameRelative});if(e.runtime===true){e.runtime="to5Runtime"}if(e.playground){e.experimental=true}l._ensureTransformerNames("blacklist",e.blacklist);l._ensureTransformerNames("whitelist",e.whitelist);l._ensureTransformerNames("optional",e.optional);l._ensureTransformerNames("loose",e.loose);return e};e.prototype.isLoose=function(e){return n.contains(this.opts.loose,e)};e.prototype.getTransformers=function(){var e=this;var t=[];var r=[];n.each(l.transformers,function(n){if(n.canRun(e)){t.push(n);if(n.secondPass){r.push(n)}if(n.manipulateOptions){n.manipulateOptions(e.opts,e)}}});return t.concat(r)};e.prototype.toArray=function(e,n){if(t.isArrayExpression(e)){return e}else if(t.isIdentifier(e)&&e.name==="arguments"){return t.callExpression(t.memberExpression(this.addHelper("slice"),t.identifier("call")),[e])}else{var r="to-array";var l=[e];if(n){l.push(t.literal(n));r="sliced-to-array"}return t.callExpression(this.addHelper(r),l)}};e.prototype.getModuleFormatter=function(e){var t=n.isFunction(e)?e:l.moduleFormatters[e];if(!t){var i=r.resolve(e);if(i)t=a(i)}if(!t){throw new ReferenceError("Unknown module formatter type "+JSON.stringify(e))}return new t(this)};e.prototype.parseShebang=function(e){var n=e.match(i);if(n){this.shebang=n[0];e=e.replace(i,"")}return e};e.prototype.addImport=function(r,e){e=e||r;var n=this.dynamicImportIds[e];if(!n){n=this.dynamicImportIds[e]=this.generateUidIdentifier(e);var a=[t.importSpecifier(t.identifier("default"),n)];var l=t.importDeclaration(a,t.literal(r));l._blockHoist=3;this.dynamicImports.push(l)}return n};e.prototype.addHelper=function(l){if(!n.contains(e.helpers,l)){throw new ReferenceError("unknown declaration "+l)}var a=this.ast.program;var i=a._declarations&&a._declarations[l];if(i)return i.id;var s;var o=this.opts.runtime;if(o&&!n.contains(e.excludeHelpersFromRuntime,l)){l=t.identifier(t.toIdentifier(l));return t.memberExpression(t.identifier(o),l)}else{s=r.template(l)}var u=this.generateUidIdentifier(l);this.scope.push({key:l,id:u,init:s});return u};e.prototype.errorWithNode=function(r,l,e){e=e||SyntaxError;var n=r.loc.start;var t=new e("Line "+n.line+": "+l);t.loc=n;return t};e.prototype.addCode=function(e){e=(e||"")+"";this.code=e;return this.parseShebang(e)};e.prototype.parse=function(e){var n=this;e=this.addCode(e);return r.parse(this.opts,e,function(e){n.transform(e);return n.generate()})};e.prototype.transform=function(t){var e=this;this.ast=t;this.scope=new s(t.program);this.moduleFormatter=this.getModuleFormatter(this.opts.modules);var r=function(t){n.each(e.transformers,function(n){n.astRun(e,t)})};r("enter");n.each(this.transformers,function(n){n.transform(e)});r("exit")};e.prototype.generate=function(){var n=this.opts;var t=this.ast;var e={code:"",map:null,ast:null};if(n.ast)e.ast=t;if(!n.code)return e;var l=u(t,n,this.code);e.code=l.code;e.map=l.map;if(this.shebang){e.code=this.shebang+"\n"+e.code}if(n.sourceMap==="inline"){e.code+="\n"+r.sourceMapToComment(e.map)}return e};e.prototype.generateUid=function(e,n){e=t.toIdentifier(e).replace(/^_+/,"");n=n||this.scope;var r;do{r=this._generateUid(e)}while(n.has(r));return r};e.prototype.generateUidIdentifier=function(r,e){e=e||this.scope;var n=t.identifier(this.generateUid(r,e));e.add(n);return n};e.prototype._generateUid=function(e){var t=this.uids;var n=t[e]||1;var r=e;if(n>1)r+=n;t[e]=n+1;return"_"+r}},{"./generation/generator":5,"./transformation/transform":44,"./traverse/scope":89,"./types":92,"./util":94,lodash:142}],4:[function(r,l,a){"use strict";l.exports=e;var n=r("../util");var t=r("lodash");function e(n,e){this.position=n;this._indent=e.indent.base;this.format=e;this.buf=""}e.prototype.get=function(){return n.trimRight(this.buf)};e.prototype.getIndent=function(){if(this.format.compact){return""}else{return n.repeat(this._indent,this.format.indent.style)}};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(){if(!this.isLast(";"))this.semicolon()};e.prototype.rightBrace=function(){this.newline(true);this.push("}")};e.prototype.keyword=function(e){this.push(e);this.push(" ")};e.prototype.space=function(){if(this.buf&&!this.isLast([" ","\n"])){this.push(" ")}};e.prototype.removeLast=function(e){if(!this.isLast(e))return;this.buf=this.buf.substr(0,this.buf.length-1);this.position.unshift(e)};e.prototype.newline=function(e,r){if(this.format.compact)return;r=r||false;if(t.isNumber(e)){if(this.endsWith("{\n"))e--;if(this.endsWith(n.repeat(e,"\n")))return;while(e--){this._newline(r)}return}if(t.isBoolean(e)){r=e}this._newline(r)};e.prototype._newline=function(e){if(e&&this.isLast("\n"))this.removeLast("\n");this.removeLast(" ");this._removeSpacesAfterLastNewline();this._push("\n")};e.prototype._removeSpacesAfterLastNewline=function(){var n=this.buf.lastIndexOf("\n");if(n===-1)return;var e=this.buf.length-1;while(e>n){if(this.buf[e]!==" "){break}e--}if(e===n){this.buf=this.buf.substring(0,e+1)}};e.prototype.push=function(e,t){if(this._indent&&!t&&e!=="\n"){var n=this.getIndent();e=e.replace(/\n/g,"\n"+n);if(this.isLast("\n"))e=n+e}this._push(e)};e.prototype._push=function(e){this.position.push(e);this.buf+=e};e.prototype.endsWith=function(e){var n=this.buf.length-e.length;return n>=0&&this.buf.lastIndexOf(e)===n};e.prototype.isLast=function(r,a){var e=this.buf;if(a)e=n.trimRight(e);var l=e[e.length-1];if(Array.isArray(r)){return t.contains(r,l)}else{return r===l}}},{"../util":94,lodash:142}],5:[function(e,a,f){"use strict";a.exports=function(e,t,r){var l=new n(e,t,r);return l.generate()};a.exports.CodeGenerator=n;var s=e("./whitespace");var o=e("./source-map");var u=e("./position");var i=e("./buffer");var c=e("../util");var r=e("./node");var l=e("../types");var t=e("lodash");function n(t,e,r){e=e||{};this.comments=t.comments||[];this.tokens=t.tokens||[];this.format=n.normaliseOptions(e);this.ast=t;this.whitespace=new s(this.tokens,this.comments);this.position=new u;this.map=new o(this.position,e,r);this.buffer=new i(this.position,this.format)}t.each(i.prototype,function(e,t){n.prototype[t]=function(){return e.apply(this.buffer,arguments)}});n.normaliseOptions=function(e){return t.merge({parentheses:true,comments:e.comments==null||e.comments,compact:false,indent:{adjustMultilineComment:true,style:" ",base:0}},e.format||{})};n.generators={templateLiterals:e("./generators/template-literals"),comprehensions:e("./generators/comprehensions"),expressions:e("./generators/expressions"),statements:e("./generators/statements"),playground:e("./generators/playground"),classes:e("./generators/classes"),methods:e("./generators/methods"),modules:e("./generators/modules"),types:e("./generators/types"),flow:e("./generators/flow"),base:e("./generators/base"),jsx:e("./generators/jsx")};t.each(n.generators,function(e){t.extend(n.prototype,e)});n.prototype.generate=function(){var e=this.ast;this.print(e);var n=[];t.each(e.comments,function(e){if(!e._displayed)n.push(e)});this._printComments(n);return{map:this.map.get(),code:this.buffer.get()}};n.prototype.buildPrint=function(t){var n=this;var e=function(e,r){return n.print(e,t,r)};e.sequence=function(r,t){t=t||{};t.statement=true;return n.printJoin(e,r,t)};e.join=function(t,r){return n.printJoin(e,t,r)};e.block=function(t){return n.printBlock(e,t)};e.indentOnComments=function(t){return n.printAndIndentOnComments(e,t)};return e};n.prototype.print=function(e,n,t){if(!e)return"";var l=this;t=t||{};var i=function(i){if(!t.statement&&!r.isUserWhitespacable(e,n)){return}var a=0;if(e.start!=null&&!e._ignoreUserWhitespace){if(i){a=l.whitespace.getNewlinesBefore(e)}else{a=l.whitespace.getNewlinesAfter(e)}}else{if(!i)a++;var s=r.needsWhitespaceAfter;if(i)s=r.needsWhitespaceBefore;a+=s(e,n);if(!l.buffer.get())a=0}l.newline(a)};if(this[e.type]){var a=r.needsParensNoLineTerminator(e,n);var s=a||r.needsParens(e,n);if(s)this.push("(");if(a)this.indent();this.printLeadingComments(e,n);i(true);if(t.before)t.before();this.map.mark(e,"start");this[e.type](e,this.buildPrint(e),n);if(a){this.newline();this.dedent()}if(s)this.push(")");this.map.mark(e,"end");if(t.after)t.after();i(false);this.printTrailingComments(e,n)}else{throw new ReferenceError("unknown node of type "+JSON.stringify(e.type)+" with constructor "+JSON.stringify(e&&e.constructor.name))}};n.prototype.printJoin=function(l,n,e){if(!n||!n.length)return;e=e||{};var r=this;var a=n.length;if(e.indent)r.indent();t.each(n,function(n,t){l(n,{statement:e.statement,after:function(){if(e.iterator){e.iterator(n,t)}if(e.separator&&t<a-1){r.push(e.separator)}}})});if(e.indent)r.dedent()};n.prototype.printAndIndentOnComments=function(t,e){var n=!!e.leadingComments;if(n)this.indent();t(e);if(n)this.dedent()};n.prototype.printBlock=function(n,e){if(l.isEmptyStatement(e)){this.semicolon()}else{this.push(" ");n(e)}};n.prototype.generateComment=function(n){var e=n.value;if(n.type==="Line"){e="//"+e}else{e="/*"+e+"*/"}return e};n.prototype.printTrailingComments=function(e,n){this._printComments(this.getComments("trailingComments",e,n))};n.prototype.printLeadingComments=function(e,n){this._printComments(this.getComments("leadingComments",e,n))};n.prototype.getComments=function(a,e,i){if(l.isExpressionStatement(i)){return[]}var n=[];var r=[e];var s=this;if(l.isExpressionStatement(e)){r.push(e.argument)}t.each(r,function(e){n=n.concat(s._getComments(a,e))});return n};n.prototype._getComments=function(n,e){return e&&e[n]||[]};n.prototype._printComments=function(n){if(this.format.compact)return;if(!this.format.comments)return;if(!n||!n.length)return;var e=this;t.each(n,function(r){var a=false;t.each(e.ast.comments,function(e){if(e.start===r.start){if(e._displayed)a=true;e._displayed=true;return false}});if(a)return;e.newline(e.whitespace.getNewlinesBefore(r));var l=e.position.column;var n=e.generateComment(r);if(l&&!e.isLast(["\n"," ","[","{"])){e._push(" ");l++}if(r.type==="Block"&&e.format.indent.adjustMultilineComment){var i=r.loc.start.column;if(i){var s=new RegExp("\\n\\s{1,"+i+"}","g");n=n.replace(s,"\n")}var o=Math.max(e.indentSize(),l);
n=n.replace(/\n/g,"\n"+c.repeat(o))}if(l===0){n=e.getIndent()+n}e._push(n);e.newline(e.whitespace.getNewlinesAfter(r))})}},{"../types":92,"../util":94,"./buffer":4,"./generators/base":6,"./generators/classes":7,"./generators/comprehensions":8,"./generators/expressions":9,"./generators/flow":10,"./generators/jsx":11,"./generators/methods":12,"./generators/modules":13,"./generators/playground":14,"./generators/statements":15,"./generators/template-literals":16,"./generators/types":17,"./node":18,"./position":21,"./source-map":22,"./whitespace":23,lodash:142}],6:[function(n,t,e){"use strict";e.File=function(e,n){n(e.program)};e.Program=function(e,n){n.sequence(e.body)};e.BlockStatement=function(e,n){if(e.body.length===0){this.push("{}")}else{this.push("{");this.newline();n.sequence(e.body,{indent:true});this.removeLast("\n");this.rightBrace()}}},{}],7:[function(n,t,e){"use strict";e.ClassExpression=e.ClassDeclaration=function(e,n){this.push("class");if(e.id){this.space();n(e.id)}if(e.superClass){this.push(" extends ");n(e.superClass)}this.space();n(e.body)};e.ClassBody=function(e,n){if(e.body.length===0){this.push("{}")}else{this.push("{");this.newline();this.indent();n.sequence(e.body);this.dedent();this.rightBrace()}};e.MethodDefinition=function(e,n){if(e.static){this.push("static ")}this._method(e,n)}},{}],8:[function(n,t,e){"use strict";e.ComprehensionBlock=function(e,n){this.keyword("for");this.push("(");n(e.left);this.push(" of ");n(e.right);this.push(")")};e.ComprehensionExpression=function(e,n){this.push(e.generator?"(":"[");n.join(e.blocks,{separator:" "});this.space();if(e.filter){this.keyword("if");this.push("(");n(e.filter);this.push(")");this.space()}n(e.body);this.push(e.generator?")":"]")}},{}],9:[function(t,s,e){"use strict";var l=t("../../util");var n=t("../../types");var a=t("lodash");e.UnaryExpression=function(e,l){var r=/[a-z]$/.test(e.operator);var t=e.argument;if(n.isUpdateExpression(t)||n.isUnaryExpression(t)){r=true}if(n.isUnaryExpression(t)&&t.operator==="!"){r=false}this.push(e.operator);if(r)this.space();l(e.argument)};e.UpdateExpression=function(e,n){if(e.prefix){this.push(e.operator);n(e.argument)}else{n(e.argument);this.push(e.operator)}};e.ConditionalExpression=function(e,n){n(e.test);this.push(" ? ");n(e.consequent);this.push(" : ");n(e.alternate)};e.NewExpression=function(e,n){this.push("new ");n(e.callee);if(e.arguments.length||this.format.parentheses){this.push("(");n.join(e.arguments,{separator:", "});this.push(")")}};e.SequenceExpression=function(e,n){n.join(e.expressions,{separator:", "})};e.ThisExpression=function(){this.push("this")};e.CallExpression=function(e,t){t(e.callee);this.push("(");var n=",";if(e._prettyCall){n+="\n";this.newline();this.indent()}else{n+=" "}t.join(e.arguments,{separator:n});if(e._prettyCall){this.newline();this.dedent()}this.push(")")};var r=function(e){return function(n,t){this.push(e);if(n.delegate)this.push("*");if(n.argument){this.space();t(n.argument)}}};e.YieldExpression=r("yield");e.AwaitExpression=r("await");e.EmptyStatement=function(){this.semicolon()};e.ExpressionStatement=function(e,n){n(e.expression);this.semicolon()};e.BinaryExpression=e.LogicalExpression=e.AssignmentPattern=e.AssignmentExpression=function(e,n){n(e.left);this.push(" "+e.operator+" ");n(e.right)};var i=/e/i;e.MemberExpression=function(e,r){var t=e.object;r(t);if(!e.computed&&n.isMemberExpression(e.property)){throw new TypeError("Got a MemberExpression for MemberExpression property")}var s=e.computed;if(n.isLiteral(e.property)&&a.isNumber(e.property.value)){s=true}if(s){this.push("[");r(e.property);this.push("]")}else{if(n.isLiteral(t)&&l.isInteger(t.value)&&!i.test(t.value.toString())){this.push(".")}this.push(".");r(e.property)}}},{"../../types":92,"../../util":94,lodash:142}],10:[function(n,t,e){"use strict";e.AnyTypeAnnotation=e.ArrayTypeAnnotation=e.BooleanTypeAnnotation=e.ClassProperty=e.DeclareClass=e.DeclareFunction=e.DeclareModule=e.DeclareVariable=e.FunctionTypeAnnotation=e.FunctionTypeParam=e.GenericTypeAnnotation=e.InterfaceExtends=e.InterfaceDeclaration=e.IntersectionTypeAnnotation=e.NullableTypeAnnotation=e.NumberTypeAnnotation=e.StringLiteralTypeAnnotation=e.StringTypeAnnotation=e.TupleTypeAnnotation=e.TypeofTypeAnnotation=e.TypeAlias=e.TypeAnnotation=e.TypeParameterDeclaration=e.TypeParameterInstantiation=e.ObjectTypeAnnotation=e.ObjectTypeCallProperty=e.ObjectTypeIndexer=e.ObjectTypeProperty=e.QualifiedTypeIdentifier=e.UnionTypeAnnotation=e.VoidTypeAnnotation=function(){}},{}],11:[function(n,l,e){"use strict";var t=n("../../types");var r=n("lodash");e.XJSAttribute=function(e,n){n(e.name);if(e.value){this.push("=");n(e.value)}};e.XJSIdentifier=function(e){this.push(e.name)};e.XJSNamespacedName=function(e,n){n(e.namespace);this.push(":");n(e.name)};e.XJSMemberExpression=function(e,n){n(e.object);this.push(".");n(e.property)};e.XJSSpreadAttribute=function(e,n){this.push("{...");n(e.argument);this.push("}")};e.XJSExpressionContainer=function(e,n){this.push("{");n(e.expression);this.push("}")};e.XJSElement=function(e,n){var a=this;var l=e.openingElement;n(l);if(l.selfClosing)return;this.indent();r.each(e.children,function(e){if(t.isLiteral(e)){a.push(e.value)}else{n(e)}});this.dedent();n(e.closingElement)};e.XJSOpeningElement=function(e,n){this.push("<");n(e.name);if(e.attributes.length>0){this.space();n.join(e.attributes,{separator:" "})}this.push(e.selfClosing?" />":">")};e.XJSClosingElement=function(e,n){this.push("</");n(e.name);this.push(">")};e.XJSEmptyExpression=function(){}},{"../../types":92,lodash:142}],12:[function(n,r,e){"use strict";var t=n("../../types");e._params=function(e,n){var t=this;this.push("(");n.join(e.params,{separator:", ",iterator:function(a,l){var r=e.defaults&&e.defaults[l];if(r){t.push(" = ");n(r)}}});if(e.rest){if(e.params.length){this.push(", ")}this.push("...");n(e.rest)}this.push(")")};e._method=function(e,n){var t=e.value;var r=e.kind;var l=e.key;if(!r||r==="init"){if(t.generator){this.push("*")}}else{this.push(r+" ")}if(t.async)this.push("async ");if(e.computed){this.push("[");n(l);this.push("]")}else{n(l)}this._params(t,n);this.space();n(t.body)};e.FunctionDeclaration=e.FunctionExpression=function(e,n){if(e.async)this.push("async ");this.push("function");if(e.generator)this.push("*");this.space();if(e.id)n(e.id);this._params(e,n);this.space();n(e.body)};e.ArrowFunctionExpression=function(e,n){if(e.async)this.push("async ");if(e.params.length===1&&!e.defaults.length&&!e.rest&&t.isIdentifier(e.params[0])){n(e.params[0])}else{this._params(e,n)}this.push(" => ");n(e.body)}},{"../../types":92}],13:[function(n,l,e){"use strict";var t=n("../../types");var r=n("lodash");e.ImportSpecifier=function(n,t){if(n.id&&n.id.name==="default"){t(n.name)}else{return e.ExportSpecifier.apply(this,arguments)}};e.ExportSpecifier=function(e,n){n(e.id);if(e.name){this.push(" as ");n(e.name)}};e.ExportBatchSpecifier=function(){this.push("*")};e.ExportDeclaration=function(e,r){this.push("export ");var n=e.specifiers;if(e.default){this.push("default ")}if(e.declaration){r(e.declaration);if(t.isStatement(e.declaration))return}else{if(n.length===1&&t.isExportBatchSpecifier(n[0])){r(n[0])}else{this.push("{");if(n.length){this.space();r.join(n,{separator:", "});this.space()}this.push("}")}if(e.source){this.push(" from ");r(e.source)}}this.ensureSemicolon()};e.ImportDeclaration=function(e,t){var l=this;this.push("import ");var a=e.specifiers;if(a&&a.length){var n=false;r.each(e.specifiers,function(e,r){if(+r>0){l.push(", ")}var a=e.id&&e.id.name==="default";if(!a&&e.type!=="ImportBatchSpecifier"&&!n){n=true;l.push("{ ")}t(e)});if(n){this.push(" }")}this.push(" from ")}t(e.source);this.semicolon()};e.ImportBatchSpecifier=function(e,n){this.push("* as ");n(e.name)}},{"../../types":92,lodash:142}],14:[function(e,r,n){"use strict";var t=e("lodash");t.each(["BindMemberExpression","BindFunctionExpression"],function(e){n[e]=function(){throw new ReferenceError("Trying to render non-standard playground node "+JSON.stringify(e))}})},{lodash:142}],15:[function(t,i,e){"use strict";var a=t("../../util");var r=t("../../types");e.WithStatement=function(e,n){this.keyword("with");this.push("(");n(e.object);this.push(")");n.block(e.body)};e.IfStatement=function(e,n){this.keyword("if");this.push("(");n(e.test);this.push(") ");n.indentOnComments(e.consequent);if(e.alternate){if(this.isLast("}"))this.space();this.keyword("else");n.indentOnComments(e.alternate)}};e.ForStatement=function(e,n){this.keyword("for");this.push("(");n(e.init);this.push(";");if(e.test){this.space();n(e.test)}this.push(";");if(e.update){this.space();n(e.update)}this.push(")");n.block(e.body)};e.WhileStatement=function(e,n){this.keyword("while");this.push("(");n(e.test);this.push(")");n.block(e.body)};var l=function(e){return function(n,t){this.keyword("for");this.push("(");t(n.left);this.push(" "+e+" ");t(n.right);this.push(")");t.block(n.body)}};e.ForInStatement=l("in");e.ForOfStatement=l("of");e.DoWhileStatement=function(e,n){this.keyword("do");n(e.body);this.space();this.keyword("while");this.push("(");n(e.test);this.push(");")};var n=function(e,n){return function(r,l){this.push(e);var t=r[n||"label"];if(t){this.space();l(t)}this.semicolon()}};e.ContinueStatement=n("continue");e.ReturnStatement=n("return","argument");e.BreakStatement=n("break");e.LabeledStatement=function(e,n){n(e.label);this.push(": ");n(e.body)};e.TryStatement=function(e,n){this.keyword("try");n(e.block);this.space();if(e.handlers){n(e.handlers[0])}else{n(e.handler)}if(e.finalizer){this.space();this.push("finally ");n(e.finalizer)}};e.CatchClause=function(e,n){this.keyword("catch");this.push("(");n(e.param);this.push(") ");n(e.body)};e.ThrowStatement=function(e,n){this.push("throw ");n(e.argument);this.semicolon()};e.SwitchStatement=function(e,n){this.keyword("switch");this.push("(");n(e.discriminant);this.push(") {");n.sequence(e.cases,{indent:true});this.push("}")};e.SwitchCase=function(e,n){if(e.test){this.push("case ");n(e.test);this.push(":")}else{this.push("default:")}this.newline();n.sequence(e.consequent,{indent:true})};e.DebuggerStatement=function(){this.push("debugger;")};e.VariableDeclaration=function(e,o,l){this.push(e.kind+" ");var i=0;var s=0;if(!r.isFor(l)){for(var n=0;n<e.declarations.length;n++){if(e.declarations[n].init){i++}else{s++}}}var t=",";if(i>s){t+="\n"+a.repeat(e.kind.length+1)}else{t+=" "}o.join(e.declarations,{separator:t});if(!r.isFor(l)){this.semicolon()}};e.PrivateDeclaration=function(e,n){this.push("private ");n.join(e.declarations,{separator:", "});this.semicolon()};e.VariableDeclarator=function(e,n){if(e.init){n(e.id);this.push(" = ");n(e.init)}else{n(e.id)}}},{"../../types":92,"../../util":94}],16:[function(n,r,e){"use strict";var t=n("lodash");e.TaggedTemplateExpression=function(e,n){n(e.tag);n(e.quasi)};e.TemplateElement=function(e){this._push(e.value.raw)};e.TemplateLiteral=function(e,n){this.push("`");var r=e.quasis;var l=this;var a=r.length;t.each(r,function(r,t){n(r);if(t+1<a){l.push("${ ");n(e.expressions[t]);l.push(" }")}});this._push("`")}},{lodash:142}],17:[function(n,r,e){"use strict";var t=n("lodash");e.Identifier=function(e){this.push(e.name)};e.SpreadElement=e.SpreadProperty=function(e,n){this.push("...");n(e.argument)};e.VirtualPropertyExpression=function(e,n){n(e.object);this.push("::");n(e.property)};e.ObjectExpression=e.ObjectPattern=function(n,t){var e=n.properties;if(e.length){this.push("{");this.space();t.join(e,{separator:", ",indent:true});this.space();this.push("}")}else{this.push("{}")}};e.Property=function(e,n){if(e.method||e.kind==="get"||e.kind==="set"){this._method(e,n)}else{if(e.computed){this.push("[");n(e.key);this.push("]")}else{n(e.key);if(e.shorthand)return}this.push(": ");n(e.value)}};e.ArrayExpression=e.ArrayPattern=function(r,l){var n=r.elements;var e=this;var a=n.length;this.push("[");t.each(n,function(n,t){if(!n){e.push(",")}else{if(t>0)e.push(" ");l(n);if(t<a-1)e.push(",")}});this.push("]")};e.Literal=function(n){var e=n.value;var t=typeof e;if(t==="string"){e=JSON.stringify(e);e=e.replace(/[\u000A\u000D\u2028\u2029]/g,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)});this.push(e)}else if(t==="boolean"||t==="number"){this.push(JSON.stringify(e))}else if(n.regex){this.push("/"+n.regex.pattern+"/"+n.regex.flags)}else if(e===null){this.push("null")}}},{lodash:142}],18:[function(t,i,o){"use strict";i.exports=e;var a=t("./whitespace");var s=t("./parentheses");var n=t("../../types");var r=t("lodash");var l=function(e,l,s){if(!e)return;var t;var a=Object.keys(e);for(var r=0;r<a.length;r++){var i=a[r];if(n.is(i,l)){var o=e[i];t=o(l,s);if(t!=null)break}}return t};function e(e,n){this.parent=n;this.node=e}e.isUserWhitespacable=function(e){return n.isUserWhitespacable(e)};e.needsWhitespace=function(t,o,s){if(!t)return 0;if(n.isExpressionStatement(t)){t=t.expression}var i=l(a[s].nodes,t,o);if(i)return i;r.each(l(a[s].list,t,o),function(n){i=e.needsWhitespace(n,t,s);if(i)return false});return i||0};e.needsWhitespaceBefore=function(n,t){return e.needsWhitespace(n,t,"before")};e.needsWhitespaceAfter=function(n,t){return e.needsWhitespace(n,t,"after")};e.needsParens=function(e,t){if(!t)return false;if(n.isNewExpression(t)&&t.callee===e){if(n.isCallExpression(e))return true;var a=r.some(e,function(e){return n.isCallExpression(e)});if(a)return true}return l(s,e,t)};e.needsParensNoLineTerminator=function(t,e){if(!e)return false;if(!t.leadingComments||!t.leadingComments.length){return false}if(n.isYieldExpression(e)||n.isAwaitExpression(e)){return true}if(n.isContinueStatement(e)||n.isBreakStatement(e)||n.isReturnStatement(e)||n.isThrowStatement(e)){return true}return false};r.each(e,function(t,n){e.prototype[n]=function(){var t=new Array(arguments.length+2);t[0]=this.node;t[1]=this.parent;for(var r=0;r<t.length;r++){t[r+2]=arguments[r]}return e[n].apply(null,t)}})},{"../../types":92,"./parentheses":19,"./whitespace":20,lodash:142}],19:[function(r,a,n){"use strict";var e=r("../../types");var l=r("lodash");var t={};l.each([["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"],["**"]],function(e,n){l.each(e,function(e){t[e]=n})});n.UpdateExpression=function(t,n){if(e.isMemberExpression(n)&&n.object===t){return true}};n.ObjectExpression=function(t,n){if(e.isExpressionStatement(n)){return true}if(e.isMemberExpression(n)&&n.object===t){return true}return false};n.Binary=function(r,n){if((e.isCallExpression(n)||e.isNewExpression(n))&&n.callee===r){return true}if(e.isUnaryLike(n)){return true}if(e.isMemberExpression(n)&&n.object===r){return true}if(e.isBinary(n)){var i=n.operator;var l=t[i];var s=r.operator;var a=t[s];if(l>a){return true}if(l===a&&n.right===r){return true}}};n.BinaryExpression=function(t,n){if(t.operator==="in"){if(e.isVariableDeclarator(n)){return true}if(e.isFor(n)){return true}}};n.SequenceExpression=function(t,n){if(e.isForStatement(n)){return false}if(e.isExpressionStatement(n)&&n.expression===t){return false}return true};n.YieldExpression=function(t,n){return e.isBinary(n)||e.isUnaryLike(n)||e.isCallExpression(n)||e.isMemberExpression(n)||e.isNewExpression(n)||e.isConditionalExpression(n)||e.isYieldExpression(n)};n.ClassExpression=function(t,n){return e.isExpressionStatement(n)};n.UnaryLike=function(t,n){return e.isMemberExpression(n)&&n.object===t};n.FunctionExpression=function(t,n){if(e.isExpressionStatement(n)){return true}if(e.isMemberExpression(n)&&n.object===t){return true}if(e.isCallExpression(n)&&n.callee===t){return true}};n.AssignmentExpression=n.ConditionalExpression=function(t,n){if(e.isUnaryLike(n)){return true}if(e.isBinary(n)){return true}if(e.isCallExpression(n)&&n.callee===t){return true}if(e.isConditionalExpression(n)&&n.test===t){return true}if(e.isMemberExpression(n)&&n.object===t){return true}return false}},{"../../types":92,lodash:142}],20:[function(r,l,n){"use strict";var e=r("lodash");var t=r("../../types");n.before={nodes:{Property:function(e,n){if(n.properties[0]===e){return 1}},SpreadProperty:function(e,t){return n.before.nodes.Property(e,t)},SwitchCase:function(e,n){if(n.cases[0]===e){return 1}},CallExpression:function(e){if(t.isFunction(e.callee)){return 1}}}};n.after={nodes:{AssignmentExpression:function(e){if(t.isFunction(e.right)){return 1}}},list:{VariableDeclaration:function(n){return e.map(n.declarations,"init")},ArrayExpression:function(e){return e.elements},ObjectExpression:function(e){return e.properties}}};e.each({Function:1,Class:1,For:1,ArrayExpression:{after:1},ObjectExpression:{after:1},SwitchStatement:1,IfStatement:{before:1},CallExpression:{after:1},Literal:{after:1}},function(r,l){if(e.isNumber(r)){r={after:r,before:r}}e.each([l].concat(t.FLIPPED_ALIAS_KEYS[l]||[]),function(t){e.each(r,function(e,r){n[r].nodes[t]=function(){return e}})})})},{"../../types":92,lodash:142}],21:[function(t,n,r){"use strict";n.exports=e;function e(){this.line=1;this.column=0}e.prototype.push=function(n){for(var e=0;e<n.length;e++){if(n[e]==="\n"){this.line++;this.column=0}else{this.column++}}};e.prototype.unshift=function(n){for(var e=0;e<n.length;e++){if(n[e]==="\n"){this.line--}else{this.column--}}}},{}],22:[function(n,r,a){"use strict";r.exports=e;var l=n("source-map");var t=n("../types");function e(n,e,t){this.position=n;this.opts=e;if(e.sourceMap){this.map=new l.SourceMapGenerator({file:e.sourceMapName,sourceRoot:e.sourceRoot});this.map.setSourceContent(e.sourceFileName,t)}else{this.map=null}}e.prototype.get=function(){var e=this.map;if(e){return e.toJSON()}else{return e}};e.prototype.mark=function(e,s){var l=e.loc;if(!l)return;var a=this.map;if(!a)return;if(t.isProgram(e)||t.isFile(e))return;var i=this.position;var n={line:i.line,column:i.column};var r=l[s];if(n.line===r.line&&n.column===r.column)return;a.addMapping({source:this.opts.sourceFileName,generated:n,original:r})}},{"../types":92,"source-map":186}],23:[function(t,r,a){"use strict";r.exports=e;var l=t("lodash");function n(e,t,n){e+=t;if(e>=n)e-=n;return e}function e(e,n){this.tokens=l.sortBy(e.concat(n),"start");this.used={};this._lastFoundIndex=0}e.prototype.getNewlinesBefore=function(s){var a;var i;var e=this.tokens;var t;for(var r=0;r<e.length;r++){var l=n(r,this._lastFoundIndex,this.tokens.length);t=e[l];if(s.start===t.start){a=e[l-1];i=t;this._lastFoundIndex=l;break}}return this.getNewlinesBetween(a,i)};e.prototype.getNewlinesAfter=function(i){var s;var e;var t=this.tokens;var r;for(var l=0;l<t.length;l++){var a=n(l,this._lastFoundIndex,this.tokens.length);r=t[a];if(i.end===r.end){s=r;e=t[a+1];this._lastFoundIndex=a;break}}if(e.type.type==="eof"){return 1}else{var o=this.getNewlinesBetween(s,e);if(i.type==="Line"&&!o){return 1}else{return o}}};e.prototype.getNewlinesBetween=function(n,r){var l=n?n.loc.end.line:1;var a=r.loc.start.line;var t=0;for(var e=l;e<a;e++){if(typeof this.used[e]==="undefined"){this.used[e]=true;t++}}return t}},{lodash:142}],24:[function(n,s,o){"use strict";var l=n("./types");var a=n("lodash");var i=n("estraverse");a.extend(i.VisitorKeys,l.VISITOR_KEYS);var t=n("ast-types");var e=t.Type.def;var r=t.Type.or;e("AssignmentPattern").bases("Pattern").build("left","right").field("left",e("Pattern")).field("right",e("Expression"));e("ImportBatchSpecifier").bases("Specifier").build("name").field("name",e("Identifier"));e("VirtualPropertyExpression").bases("Expression").build("object","property").field("object",e("Expression")).field("property",r(e("Identifier"),e("Expression")));e("PrivateDeclaration").bases("Declaration").build("declarations").field("declarations",[e("Identifier")]);e("BindMemberExpression").bases("Expression").build("object","property","arguments").field("object",e("Expression")).field("property",r(e("Identifier"),e("Expression"))).field("arguments",[e("Expression")]);e("BindFunctionExpression").bases("Expression").build("callee","arguments").field("callee",e("Expression")).field("arguments",[e("Expression")]);t.finalize()},{"./types":92,"ast-types":108,estraverse:136,lodash:142}],25:[function(require,module,exports){"use strict";module.exports=function toFastProperties(obj){function f(){}f.prototype=obj;return f;eval(obj)}},{}],26:[function(n,r,l){"use strict";var t=n("./explode-assignable-expression");var e=n("../../types");r.exports=function(r,n){var l=function(e){return e.operator===n.operator+"="};var a=function(n,t){return e.assignmentExpression("=",n,t)};r.ExpressionStatement=function(o,f,u,p,c){var r=o.expression;if(!l(r))return;var i=[];var s=t(r.left,i,c,u,true);i.push(e.expressionStatement(a(s.ref,n.build(s.uid,r.right))));return i};r.AssignmentExpression=function(a,o,i,c,u){if(e.isExpressionStatement(o))return;if(!l(a))return;var r=[];var s=t(a.left,r,u,i);r.push(n.build(s.uid,a.right));r.push(s.ref);return e.toSequenceExpression(r,i)};r.BinaryExpression=function(e){if(e.operator!==n.operator)return;return n.build(e.left,e.right)}}},{"../../types":92,"./explode-assignable-expression":29}],27:[function(n,t,r){"use strict";var e=n("../../types");t.exports=function l(t,l){var r=t.blocks.shift();if(!r)return;var n=l(t,l);if(!n){n=l();if(t.filter){n=e.ifStatement(t.filter,e.blockStatement([n]))}}return e.forOfStatement(e.variableDeclaration("let",[e.variableDeclarator(r.left)]),r.right,e.blockStatement([n]))}},{"../../types":92}],28:[function(n,r,l){"use strict";var t=n("./explode-assignable-expression");var e=n("../../types");r.exports=function(r,n){var l=function(n,t){return e.assignmentExpression("=",n,t)};r.ExpressionStatement=function(o,c,u,f,r){var a=o.expression;if(!n.is(a,r))return;var i=[];var s=t(a.left,i,r,u);i.push(e.ifStatement(n.build(s.uid,r),e.expressionStatement(l(s.ref,a.right))));return i};r.AssignmentExpression=function(a,u,o,c,i){if(e.isExpressionStatement(u))return;if(!n.is(a,i))return;var r=[];var s=t(a.left,r,i,o);r.push(e.logicalExpression("&&",n.build(s.uid,i),l(s.ref,a.right)));r.push(s.ref);return e.toSequenceExpression(r,o)}}},{"../../types":92,"./explode-assignable-expression":29}],29:[function(n,t,a){"use strict";var e=n("../../types");var r=function(n,l,a,i){var t;if(e.isIdentifier(n)){t=n}else if(e.isMemberExpression(n)){t=n.object}else{throw new Error("We can't explode this node type "+n.type)}var r=i.generateUidBasedOnNode(t,a);l.push(e.variableDeclaration("var",[e.variableDeclarator(r,t)]));return r};var l=function(t,a,i,s){var n=t.property;var r=e.toComputedKey(t,n);if(e.isLiteral(r))return r;var l=s.generateUidBasedOnNode(n,i);a.push(e.variableDeclaration("var",[e.variableDeclarator(l,n)]));return l};t.exports=function(n,s,o,u,f){var t;if(e.isIdentifier(n)&&f){t=n}else{t=r(n,s,o,u)}var a,i;if(e.isIdentifier(n)){a=n;i=t}else{var c=l(n,s,o,u);var p=n.computed||e.isLiteral(c);i=a=e.memberExpression(t,c,p)}return{uid:i,ref:a}}},{"../../types":92}],30:[function(n,i,t){"use strict";var r=n("../../traverse");var l=n("../../util");var e=n("../../types");var a={enter:function(t,r,l,a,n){if(!e.isIdentifier(t,{name:n.id}))return;if(!e.isReferenced(t,r))return;var i=l.get(n.id,true);if(i!==n.outerDeclar)return;n.selfReference=true;a.stop()}};t.property=function(n,o,s){var t=e.toComputedKey(n,n.key);if(!e.isLiteral(t))return n;var i=e.toIdentifier(t.value);t=e.identifier(i);var u={id:i,selfReference:false,outerDeclar:s.get(i,true)};r(n,a,s,u);if(u.selfReference){n.value=l.template("property-method-assignment-wrapper",{FUNCTION:n.value,FUNCTION_ID:t,FUNCTION_KEY:o.generateUidIdentifier(i,s),WRAPPER_KEY:o.generateUidIdentifier(i+"Wrapper",s)})}else{n.value.id=t}}},{"../../traverse":88,"../../types":92,"../../util":94}],31:[function(n,t,l){"use strict";var r=n("../../traverse");var e=n("../../types");t.exports=function(n,a){n.async=false;n.generator=true;r(n,{enter:function(n,r,l,t){if(e.isFunction(n))t.skip();if(e.isAwaitExpression(n)){n.type="YieldExpression"}}});var t=e.callExpression(a,[n]);if(e.isFunctionDeclaration(n)){var l=e.variableDeclaration("var",[e.variableDeclarator(n.id,t)]);l._blockHoist=true;return l}else{return t}}},{"../../traverse":88,"../../types":92}],32:[function(t,r,a){"use strict";r.exports=n;var l=t("../../traverse");var e=t("../../types");function n(e,n,t,r,l){this.topLevelThisReference=null;this.methodNode=e;this.className=n;this.superName=t;this.isLoose=r;this.file=l}n.prototype.superProperty=function(n,t,r,l){return e.callExpression(this.file.addHelper("get"),[e.callExpression(e.memberExpression(e.identifier("Object"),e.identifier("getPrototypeOf")),[t?this.className:e.memberExpression(this.className,e.identifier("prototype"))]),r?n:e.literal(n.name),l])};n.prototype.looseSuperProperty=function(t,n,r){var a=t.key;var l=this.superName||e.identifier("Function");if(r.property===n){return}else if(e.isCallExpression(r,{callee:n})){r.arguments.unshift(e.thisExpression());if(a.name==="constructor"){return e.memberExpression(l,e.identifier("call"))}else{n=l;if(!t.static){n=e.memberExpression(n,e.identifier("prototype"))}n=e.memberExpression(n,a,t.computed);return e.memberExpression(n,e.identifier("call"))}}else if(e.isMemberExpression(r)&&!t.static){return e.memberExpression(l,e.identifier("prototype"))}else{return l}};n.prototype.replace=function(){this.traverseLevel(this.methodNode.value,true)};n.prototype.traverseLevel=function(t,r){var n=this;l(t,{enter:function(t,i,o,l){if(e.isFunction(t)&&!e.isArrowFunctionExpression(t)){n.traverseLevel(t,false);return l.skip()}if(e.isProperty(t,{method:true})||e.isMethodDefinition(t)){return l.skip()}var s=function(){if(r){return e.thisExpression()}else{return n.getThisReference()}};var a=n.specHandle;if(n.isLoose)a=n.looseHandle;return a.call(n,s,t,i)}})};n.prototype.getThisReference=function(){if(this.topLevelThisReference){return this.topLevelThisReference}else{var n=this.topLevelThisReference=this.file.generateUidIdentifier("this");this.methodNode.body.body.unshift(e.variableDeclaration("var",[e.variableDeclarator(this.topLevelThisReference,e.thisExpression())]));return n}};n.prototype.looseHandle=function(r,n,l){if(e.isIdentifier(n,{name:"super"})){return this.looseSuperProperty(this.methodNode,n,l)}else if(e.isCallExpression(n)){var t=n.callee;if(!e.isMemberExpression(t))return;if(t.object.name!=="super")return;e.appendToMemberExpression(t,e.identifier("call"));n.arguments.unshift(r())}};n.prototype.specHandle=function(c,n,i){var s=this.methodNode;var r;var a;var t;if(e.isIdentifier(n,{name:"super"})){if(!(e.isMemberExpression(i)&&!i.computed&&i.property===n)){throw this.file.errorWithNode(n,"illegal use of bare super")}}else if(e.isCallExpression(n)){var l=n.callee;if(e.isIdentifier(l,{name:"super"})){r=s.key;a=s.computed;t=n.arguments}else{if(!e.isMemberExpression(l))return;if(l.object.name!=="super")return;r=l.property;a=l.computed;t=n.arguments}}else if(e.isMemberExpression(n)){if(!e.isIdentifier(n.object,{name:"super"}))return;r=n.property;a=n.computed}if(!r)return;var o=c();var u=this.superProperty(r,s.static,a,o);if(t){if(t.length===1&&e.isSpreadElement(t[0])){return e.callExpression(e.memberExpression(u,e.identifier("apply")),[o,t[0].argument])}else{return e.callExpression(e.memberExpression(u,e.identifier("call")),[o].concat(t))}}else{return u}}},{"../../traverse":88,"../../types":92}],33:[function(t,r,e){"use strict";var n=t("../../types");e.has=function(t){var e=t.body[0];return n.isExpressionStatement(e)&&n.isLiteral(e.expression,{value:"use strict"})};e.wrap=function(n,r){var t;if(e.has(n)){t=n.body.shift()}r();if(t){n.body.unshift(t)}}},{"../../types":92}],34:[function(t,a,c){"use strict";a.exports=n;var r=t("../../traverse");var i=t("../../util");var e=t("../../types");var l=t("lodash");function n(e){this.file=e;this.localExports=this.getLocalExports();this.localImports=this.getLocalImports();this.remapAssignments()}var s={enter:function(n,a,i,s,r){var t=n&&n.declaration;if(e.isExportDeclaration(n)&&t&&e.isStatement(t)){l.extend(r,e.getIds(t,true))}}};n.prototype.getLocalExports=function(){var e={};r(this.file.ast,s,null,e);return e};var o={enter:function(n,r,a,i,t){if(e.isImportDeclaration(n)){l.extend(t,e.getIds(n,true))}}};n.prototype.getLocalImports=function(){var e={};r(this.file.ast,o,null,e);return e};var u={enter:function(t,a,i,s,r){if(e.isAssignmentExpression(t)){var n=t.left;if(e.isMemberExpression(n)){while(n.object)n=n.object}r(n)}else if(e.isDeclaration(t)){l.each(e.getIds(t,true),r)}}};n.prototype.checkCollisions=function(){var n=this.localImports;var t=this.file;var a=function(t){return e.isIdentifier(t)&&l.has(n,t.name)&&n[t.name]!==t};var i=function(e){if(a(e)){throw t.errorWithNode(e,"Illegal assignment of module import")}};r(t.ast,u,null,i)};n.prototype.remapExportAssignment=function(n){return e.assignmentExpression("=",n.left,e.assignmentExpression(n.operator,e.memberExpression(e.identifier("exports"),n.left),n.right))};n.prototype.remapAssignments=function(){var n=this.localExports;var t=this;var l=function(r,l){var t=r.name;return e.isIdentifier(r)&&n[t]&&n[t]===l.get(t,true)};r(this.file.ast,{enter:function(n,u,a,i,s){if(e.isUpdateExpression(n)&&s(n.argument,a)){i.skip();var c=e.assignmentExpression(n.operator[0]+"=",n.argument,e.literal(1));var o=t.remapExportAssignment(c);if(e.isExpressionStatement(u)||n.prefix){return o}var r=[];r.push(o);var l;if(n.operator==="--"){l="+"}else{l="-"}r.push(e.binaryExpression(l,n.argument,e.literal(1)));return e.sequenceExpression(r)}if(e.isAssignmentExpression(n)&&s(n.left,a)){i.skip();return t.remapExportAssignment(n)}}},null,l)};n.prototype.getModuleName=function(){var e=this.file.opts;var t=e.filenameRelative;var n="";if(e.moduleRoot){n=e.moduleRoot+"/"}if(!e.filenameRelative){return n+e.filename.replace(/^\//,"")}if(e.sourceRoot){var r=new RegExp("^"+e.sourceRoot+"/?");t=t.replace(r,"")}if(!e.keepModuleIdExtensions){t=t.replace(/\.(.*?)$/,"")}n+=t;n=n.replace(/\\/g,"/");return n};n.prototype._pushStatement=function(n,t){if(e.isClass(n)||e.isFunction(n)){if(n.id){t.push(e.toStatement(n));n=n.id}}return n};n.prototype._hoistExport=function(t,n,r){if(e.isFunctionDeclaration(t)){n._blockHoist=r||2}return n};n.prototype._exportSpecifier=function(r,n,t,l){var i=false;if(t.specifiers.length===1)i=t;if(t.source){if(e.isExportBatchSpecifier(n)){l.push(this._exportsWildcard(r(),t))}else{var a;if(e.isSpecifierDefault(n)&&!this.noInteropRequire){a=e.callExpression(this.file.addHelper("interop-require"),[r()])}else{a=e.memberExpression(r(),n.id)}l.push(this._exportsAssign(e.getSpecifierName(n),a,t))}}else{l.push(this._exportsAssign(e.getSpecifierName(n),n.id,t))}};n.prototype._exportsWildcard=function(n){return e.expressionStatement(e.callExpression(this.file.addHelper("defaults"),[e.identifier("exports"),e.callExpression(this.file.addHelper("interop-require-wildcard"),[n])]))};n.prototype._exportsAssign=function(e,n){return i.template("exports-assign",{VALUE:n,KEY:e},true)};n.prototype.exportDeclaration=function(t,a){var n=t.declaration;var s=n.id;if(t.default){s=e.identifier("default")}var i;if(e.isVariableDeclaration(n)){for(var r=0;r<n.declarations.length;r++){var l=n.declarations[r];l.init=this._exportsAssign(l.id,l.init,t).expression;var o=e.variableDeclaration(n.kind,[l]);if(r===0)e.inherits(o,n);a.push(o)}}else{var u=n;if(e.isFunctionDeclaration(n)||e.isClassDeclaration(n)){u=n.id;a.push(n)}i=this._exportsAssign(s,u,t);a.push(i);this._hoistExport(n,i)}}},{"../../traverse":88,"../../types":92,"../../util":94,lodash:142}],35:[function(e,n,r){"use strict";var t=e("../../util");n.exports=function(e){var n=function(){this.noInteropExport=true;e.apply(this,arguments)};t.inherits(n,e);return n}},{"../../util":94}],36:[function(e,n,t){"use strict";n.exports=e("./_strict")(e("./amd"))},{"./_strict":35,"./amd":37}],37:[function(t,a,o){"use strict";a.exports=n;var r=t("./_default");var l=t("./common");var i=t("../../util");var e=t("../../types");var s=t("lodash");function n(){l.apply(this,arguments);this.ids={}}i.inherits(n,r);n.prototype.buildDependencyLiterals=function(){var n=[];for(var t in this.ids){n.push(e.literal(t))}return n};n.prototype.transform=function(i){var r=i.program;
var o=r.body;var n=[e.literal("exports")];if(this.passModuleArg)n.push(e.literal("module"));n=n.concat(this.buildDependencyLiterals());n=e.arrayExpression(n);var t=s.values(this.ids);if(this.passModuleArg)t.unshift(e.identifier("module"));t.unshift(e.identifier("exports"));var u=e.functionExpression(null,t,e.blockStatement(o));var l=[n,u];var a=this.getModuleName();if(a)l.unshift(e.literal(a));var c=e.callExpression(e.identifier("define"),l);r.body=[e.expressionStatement(c)]};n.prototype.getModuleName=function(){if(this.file.opts.moduleIds){return r.prototype.getModuleName.apply(this,arguments)}else{return null}};n.prototype._push=function(t){var e=t.source.value;var n=this.ids;if(n[e]){return n[e]}else{return this.ids[e]=this.file.generateUidIdentifier(e)}};n.prototype.importDeclaration=function(e){this._push(e)};n.prototype.importSpecifier=function(t,r,l){var a=e.getSpecifierName(t);var n=this._push(r);if(e.isImportBatchSpecifier(t)){}else if(e.isSpecifierDefault(t)&&!this.noInteropRequire){n=e.callExpression(this.file.addHelper("interop-require"),[n])}else{n=e.memberExpression(n,t.id,false)}l.push(e.variableDeclaration("var",[e.variableDeclarator(a,n)]))};n.prototype.exportDeclaration=function(e){if(e.default&&!this.noInteropExport){this.passModuleArg=true}l.prototype.exportDeclaration.apply(this,arguments)};n.prototype.exportSpecifier=function(n,e,t){var r=this;return this._exportSpecifier(function(){return r._push(e)},n,e,t)}},{"../../types":92,"../../util":94,"./_default":34,"./common":39,lodash:142}],38:[function(e,n,t){"use strict";n.exports=e("./_strict")(e("./common"))},{"./_strict":35,"./common":39}],39:[function(r,a,s){"use strict";a.exports=t;var l=r("./_default");var i=r("../../traverse");var n=r("../../util");var e=r("../../types");function t(t){l.apply(this,arguments);var n=false;i(t.ast,{enter:function(t){if(e.isExportDeclaration(t)&&!t.default)n=true}});this.hasNonDefaultExports=n}n.inherits(t,l);t.prototype.importSpecifier=function(t,r,l){var a=e.getSpecifierName(t);if(e.isSpecifierDefault(t)){l.push(e.variableDeclaration("var",[e.variableDeclarator(a,e.callExpression(this.file.addHelper("interop-require"),[n.template("require",{MODULE_NAME:r.source})]))]))}else{if(t.type==="ImportBatchSpecifier"){l.push(e.variableDeclaration("var",[e.variableDeclarator(a,e.callExpression(this.file.addHelper("interop-require-wildcard"),[e.callExpression(e.identifier("require"),[r.source])]))]))}else{l.push(n.template("require-assign-key",{VARIABLE_NAME:a,MODULE_NAME:r.source,KEY:t.id}))}}};t.prototype.importDeclaration=function(e,t){t.push(n.template("require",{MODULE_NAME:e.source},true))};t.prototype.exportDeclaration=function(i,r){if(i.default&&!this.noInteropRequire&&!this.noInteropExport){var a=i.declaration;var t;var s="exports-default-module";if(this.hasNonDefaultExports)s="exports-default-module-override";if(e.isFunctionDeclaration(a)||!this.hasNonDefaultExports){t=n.template(s,{VALUE:this._pushStatement(a,r)},true);r.push(this._hoistExport(a,t,3));return}else{t=n.template("common-export-default-assign",{EXTENDS_HELPER:this.file.addHelper("extends")},true);t._blockHoist=0;r.push(t)}}l.prototype.exportDeclaration.apply(this,arguments)};t.prototype.exportSpecifier=function(t,n,r){this._exportSpecifier(function(){return e.callExpression(e.identifier("require"),[n.source])},t,n,r)}},{"../../traverse":88,"../../types":92,"../../util":94,"./_default":34}],40:[function(t,r,l){"use strict";r.exports=e;var n=t("../../types");function e(){}e.prototype.exportDeclaration=function(e,r){var t=n.toStatement(e.declaration,true);if(t)r.push(n.inherits(t,e))};e.prototype.importDeclaration=e.prototype.importSpecifier=e.prototype.exportSpecifier=function(){}},{"../../types":92}],41:[function(t,s,u){"use strict";s.exports=n;var l=t("./amd");var o=t("../helpers/use-strict");var a=t("../../traverse");var i=t("../../util");var e=t("../../types");var r=t("lodash");function n(e){this.exportIdentifier=e.generateUidIdentifier("export");this.noInteropRequire=true;l.apply(this,arguments)}i.inherits(n,l);n.prototype._addImportSource=function(e,n){e._importSource=n.source&&n.source.value;return e};n.prototype._exportsWildcard=function(t,r){var n=this.file.generateUidIdentifier("key");var l=e.memberExpression(t,n,true);var a=e.variableDeclaration("var",[e.variableDeclarator(n)]);var i=t;var s=e.blockStatement([e.expressionStatement(this.buildExportCall(n,l))]);return this._addImportSource(e.forInStatement(a,i,s),r)};n.prototype._exportsAssign=function(n,t,r){var l=this.buildExportCall(e.literal(n.name),t,true);return this._addImportSource(l,r)};n.prototype.remapExportAssignment=function(n){return this.buildExportCall(e.literal(n.left.name),n)};n.prototype.buildExportCall=function(t,r,l){var n=e.callExpression(this.exportIdentifier,[t,r]);if(l){return e.expressionStatement(n)}else{return n}};n.prototype.importSpecifier=function(t,e,n){l.prototype.importSpecifier.apply(this,arguments);this._addImportSource(r.last(n),e)};n.prototype.buildRunnerSetters=function(n,t){return e.arrayExpression(r.map(this.ids,function(i,s){var l={nodes:[],hoistDeclarators:t};a(n,{enter:function(n,a,i,l,t){if(n._importSource===s){if(e.isVariableDeclaration(n)){r.each(n.declarations,function(n){t.hoistDeclarators.push(e.variableDeclarator(n.id));t.nodes.push(e.expressionStatement(e.assignmentExpression("=",n.id,n.init)))})}else{t.nodes.push(n)}l.remove()}}},null,l);return e.functionExpression(null,[i],e.blockStatement(l.nodes))}))};n.prototype.transform=function(p){var u=p.program;var l=[];var c=this.getModuleName();var d=e.literal(c);var n=e.blockStatement(u.body);var s=i.template("system",{MODULE_NAME:d,MODULE_DEPENDENCIES:e.arrayExpression(this.buildDependencyLiterals()),EXPORT_IDENTIFIER:this.exportIdentifier,SETTERS:this.buildRunnerSetters(n,l),EXECUTE:e.functionExpression(null,[],n)},true);var t=s.expression.arguments[2].body.body;if(!c)s.expression.arguments.shift();var m=t.pop();a(n,{enter:function(n,t,a,i,s){if(e.isFunction(n)){return i.skip()}if(e.isVariableDeclaration(n)){if(n.kind!=="var"&&!e.isProgram(t)){return}var l=[];r.each(n.declarations,function(n){s.push(e.variableDeclarator(n.id));if(n.init){var t=e.expressionStatement(e.assignmentExpression("=",n.id,n.init));l.push(t)}});if(e.isFor(t)){if(t.left===n){return n.declarations[0].id}if(t.init===n){return e.toSequenceExpression(l,a)}}return l}}},null,l);if(l.length){var f=e.variableDeclaration("var",l);f._blockHoist=true;t.unshift(f)}a(n,{enter:function(n,l,a,t,r){if(e.isFunction(n))t.skip();if(e.isFunctionDeclaration(n)||n._blockHoist){r.push(n);t.remove()}}},null,t);t.push(m);if(o.has(n)){t.unshift(n.body.shift())}u.body=[s]}},{"../../traverse":88,"../../types":92,"../../util":94,"../helpers/use-strict":33,"./amd":37,lodash:142}],42:[function(e,n,t){"use strict";n.exports=e("./_strict")(e("./umd"))},{"./_strict":35,"./umd":43}],43:[function(n,a,s){"use strict";a.exports=r;var l=n("./amd");var t=n("../../util");var e=n("../../types");var i=n("lodash");function r(){l.apply(this,arguments)}t.inherits(r,l);r.prototype.transform=function(f){var s=f.program;var g=s.body;var a=[];for(var p in this.ids){a.push(e.literal(p))}var h=i.values(this.ids);var r=[e.identifier("exports")];if(this.passModuleArg)r.push(e.identifier("module"));r=r.concat(h);var c=e.functionExpression(null,r,e.blockStatement(g));var n=[e.literal("exports")];if(this.passModuleArg)n.push(e.literal("module"));n=n.concat(a);n=[e.arrayExpression(n)];var o=t.template("test-exports");var d=t.template("test-module");var m=this.passModuleArg?e.logicalExpression("&&",o,d):o;var l=[e.identifier("exports")];if(this.passModuleArg)l.push(e.identifier("module"));l=l.concat(a.map(function(n){return e.callExpression(e.identifier("require"),[n])}));var u=this.getModuleName();if(u)n.unshift(e.literal(u));var y=t.template("umd-runner-body",{AMD_ARGUMENTS:n,COMMON_TEST:m,COMMON_ARGUMENTS:l});var v=e.callExpression(y,[c]);s.body=[e.expressionStatement(v)]}},{"../../types":92,"../../util":94,"./amd":37,lodash:142}],44:[function(e,l,s){"use strict";l.exports=n;var a=e("./transformer");var t=e("../file");var i=e("../util");var r=e("lodash");function n(e,n){var r=new t(n);return r.parse(e)}n.fromAst=function(e,r,l){e=i.normaliseAst(e);var n=new t(l);n.addCode(r);n.transform(e);return n.generate()};n._ensureTransformerNames=function(a,t){for(var e=0;e<t.length;e++){var l=t[e];if(!r.has(n.transformers,l)){throw new ReferenceError("unknown transformer "+l+" specified in "+a)}}};n.transformers={};n.moduleFormatters={commonStrict:e("./modules/common-strict"),umdStrict:e("./modules/umd-strict"),amdStrict:e("./modules/amd-strict"),common:e("./modules/common"),system:e("./modules/system"),ignore:e("./modules/ignore"),amd:e("./modules/amd"),umd:e("./modules/umd")};r.each({specNoForInOfAssignment:e("./transformers/spec-no-for-in-of-assignment"),specSetters:e("./transformers/spec-setters"),specBlockScopedFunctions:e("./transformers/spec-block-scoped-functions"),malletOperator:e("./transformers/playground-mallet-operator"),methodBinding:e("./transformers/playground-method-binding"),memoizationOperator:e("./transformers/playground-memoization-operator"),objectGetterMemoization:e("./transformers/playground-object-getter-memoization"),asyncToGenerator:e("./transformers/optional-async-to-generator"),bluebirdCoroutines:e("./transformers/optional-bluebird-coroutines"),react:e("./transformers/react"),modules:e("./transformers/es6-modules"),propertyNameShorthand:e("./transformers/es6-property-name-shorthand"),arrayComprehension:e("./transformers/es7-array-comprehension"),generatorComprehension:e("./transformers/es7-generator-comprehension"),arrowFunctions:e("./transformers/es6-arrow-functions"),classes:e("./transformers/es6-classes"),objectSpread:e("./transformers/es7-object-spread"),exponentiationOperator:e("./transformers/es7-exponentiation-operator"),spread:e("./transformers/es6-spread"),templateLiterals:e("./transformers/es6-template-literals"),propertyMethodAssignment:e("./transformers/es6-property-method-assignment"),computedPropertyNames:e("./transformers/es6-computed-property-names"),destructuring:e("./transformers/es6-destructuring"),defaultParameters:e("./transformers/es6-default-parameters"),forOf:e("./transformers/es6-for-of"),unicodeRegex:e("./transformers/es6-unicode-regex"),abstractReferences:e("./transformers/es7-abstract-references"),constants:e("./transformers/es6-constants"),letScoping:e("./transformers/es6-let-scoping"),_blockHoist:e("./transformers/_block-hoist"),generators:e("./transformers/es6-generators"),restParameters:e("./transformers/es6-rest-parameters"),protoToAssign:e("./transformers/optional-proto-to-assign"),_declarations:e("./transformers/_declarations"),useStrict:e("./transformers/use-strict"),_aliasFunctions:e("./transformers/_alias-functions"),_moduleFormatter:e("./transformers/_module-formatter"),typeofSymbol:e("./transformers/optional-typeof-symbol"),coreAliasing:e("./transformers/optional-core-aliasing"),undefinedToVoid:e("./transformers/optional-undefined-to-void"),specPropertyLiterals:e("./transformers/spec-property-literals"),specMemberExpressionLiterals:e("./transformers/spec-member-expression-literals")},function(t,e){n.transformers[e]=new a(e,t)})},{"../file":3,"../util":94,"./modules/amd":37,"./modules/amd-strict":36,"./modules/common":39,"./modules/common-strict":38,"./modules/ignore":40,"./modules/system":41,"./modules/umd":43,"./modules/umd-strict":42,"./transformer":45,"./transformers/_alias-functions":46,"./transformers/_block-hoist":47,"./transformers/_declarations":48,"./transformers/_module-formatter":49,"./transformers/es6-arrow-functions":50,"./transformers/es6-classes":51,"./transformers/es6-computed-property-names":52,"./transformers/es6-constants":53,"./transformers/es6-default-parameters":54,"./transformers/es6-destructuring":55,"./transformers/es6-for-of":56,"./transformers/es6-generators":57,"./transformers/es6-let-scoping":58,"./transformers/es6-modules":59,"./transformers/es6-property-method-assignment":60,"./transformers/es6-property-name-shorthand":61,"./transformers/es6-rest-parameters":62,"./transformers/es6-spread":63,"./transformers/es6-template-literals":64,"./transformers/es6-unicode-regex":65,"./transformers/es7-abstract-references":66,"./transformers/es7-array-comprehension":67,"./transformers/es7-exponentiation-operator":68,"./transformers/es7-generator-comprehension":69,"./transformers/es7-object-spread":70,"./transformers/optional-async-to-generator":71,"./transformers/optional-bluebird-coroutines":72,"./transformers/optional-core-aliasing":73,"./transformers/optional-proto-to-assign":74,"./transformers/optional-typeof-symbol":75,"./transformers/optional-undefined-to-void":76,"./transformers/playground-mallet-operator":77,"./transformers/playground-memoization-operator":78,"./transformers/playground-method-binding":79,"./transformers/playground-object-getter-memoization":80,"./transformers/react":81,"./transformers/spec-block-scoped-functions":82,"./transformers/spec-member-expression-literals":83,"./transformers/spec-no-for-in-of-assignment":84,"./transformers/spec-property-literals":85,"./transformers/spec-setters":86,"./transformers/use-strict":87,lodash:142}],45:[function(t,i,c){"use strict";i.exports=n;var l=t("../traverse");var a=t("../types");var e=t("lodash");function r(){}function s(e,r,l,a,n){var t=n[1][e.type];if(!t)return;return t.enter(e,r,l,a,n[0])}function o(e,r,l,a,n){var t=n[1][e.type];if(!t)return;return t.exit(e,r,l,a,n[0])}var u={enter:s,exit:o};function n(n,e,t){this.manipulateOptions=e.manipulateOptions;this.experimental=!!e.experimental;this.secondPass=!!e.secondPass;this.transformer=this.normalise(e);this.optional=!!e.optional;this.opts=t||{};this.key=n}n.prototype.normalise=function(n){var t=this;if(e.isFunction(n)){n={ast:n}}e.each(n,function(l,i){if(i[0]==="_"){t[i]=l;return}if(e.isFunction(l))l={enter:l};if(!e.isObject(l))return;if(!l.enter)l.enter=r;if(!l.exit)l.exit=r;n[i]=l;var s=a.FLIPPED_ALIAS_KEYS[i];if(s){e.each(s,function(e){n[e]=l})}});return n};n.prototype.astRun=function(n,t){var e=this.transformer;if(e.ast&&e.ast[t]){e.ast[t](n.ast,n)}};n.prototype.transform=function(e){this.astRun(e,"before");l(e.ast,u,null,[e,this.transformer]);this.astRun(e,"after")};n.prototype.canRun=function(a){var n=a.opts;var t=this.key;if(t[0]==="_")return true;var r=n.blacklist;if(r.length&&e.contains(r,t))return false;var l=n.whitelist;if(l.length&&!e.contains(l,t))return false;if(this.optional&&!e.contains(n.optional,t))return false;if(this.experimental&&!n.experimental)return false;return true}},{"../traverse":88,"../types":92,lodash:142}],46:[function(t,s,n){"use strict";var r=t("../../traverse");var e=t("../../types");var a={enter:function(n,a,i,r,l){if(e.isFunction(n)&&!n._aliasFunction){return r.skip()}if(n._ignoreAliasFunctions)return r.skip();var t;if(e.isIdentifier(n)&&n.name==="arguments"){t=l.getArgumentsId}else if(e.isThisExpression(n)){t=l.getThisId}else{return}if(e.isReferenced(n,a))return t()}};var i={enter:function(n,i,s,t,l){if(!n._aliasFunction){if(e.isFunction(n)){return t.skip()}else{return}}r(n,a,null,l);return t.skip()}};var l=function(u,c,a,s){var n;var t;var f={getArgumentsId:function(){return n=n||a.generateUidIdentifier("arguments",s)},getThisId:function(){return t=t||a.generateUidIdentifier("this",s)}};r(c,i,null,f);var l;var o=function(n,t){l=l||u();l.unshift(e.variableDeclaration("var",[e.variableDeclarator(n,t)]))};if(n){o(n,e.identifier("arguments"))}if(t){o(t,e.thisExpression())}};n.Program=function(e,r,n,a,t){l(function(){return e.body},e,t,n)};n.FunctionDeclaration=n.FunctionExpression=function(n,a,t,i,r){l(function(){e.ensureBlock(n);return n.body.body},n,r,t)}},{"../../traverse":88,"../../types":92}],47:[function(n,l,t){"use strict";var r=n("../helpers/use-strict");var e=n("lodash");t.BlockStatement=t.Program={exit:function(n){var l=false;for(var t=0;t<n.body.length;t++){var a=n.body[t];if(a&&a._blockHoist!=null)l=true}if(!l)return;r.wrap(n,function(){var t=e.groupBy(n.body,function(n){var e=n._blockHoist;if(e==null)e=1;if(e===true)e=2;return e});n.body=e.flatten(e.values(t).reverse())})}}},{"../helpers/use-strict":33,lodash:142}],48:[function(t,l,e){"use strict";var r=t("../helpers/use-strict");var n=t("../../types");e.secondPass=true;e.BlockStatement=e.Program=function(t){if(!t._declarations)return;var l={};var e;r.wrap(t,function(){for(var i in t._declarations){var r=t._declarations[i];e=r.kind||"var";var a=n.variableDeclarator(r.id,r.init);if(!r.init){l[e]=l[e]||[];l[e].push(a)}else{t.body.unshift(n.variableDeclaration(e,[a]))}}for(e in l){t.body.unshift(n.variableDeclaration(e,l[e]))}});t._declarations=null}},{"../../types":92,"../helpers/use-strict":33}],49:[function(e,r,n){"use strict";var t=e("../transform");n.ast={exit:function(n,e){if(!t.transformers.modules.canRun(e))return;if(e.moduleFormatter.transform){e.moduleFormatter.transform(n)}}}},{"../transform":44}],50:[function(e,r,n){"use strict";var t=e("../../types");n.ArrowFunctionExpression=function(e){t.ensureBlock(e);e._aliasFunction="arrow";e.expression=false;e.type="FunctionExpression";return e}},{"../../types":92}],51:[function(t,s,l){"use strict";var a=t("../helpers/replace-supers");var i=t("../helpers/name-method");var r=t("../../util");var e=t("../../types");l.ClassDeclaration=function(e,l,t,a,r){return new n(e,r,t,true).run()};l.ClassExpression=function(r,t,l,i,a){if(!r.id){if(e.isProperty(t)&&t.value===r&&!t.computed&&e.isIdentifier(t.key)){r.id=t.key}if(e.isVariableDeclarator(t)&&e.isIdentifier(t.id)){r.id=t.id}}return new n(r,a,l,false).run()};function n(e,n,t,r){this.isStatement=r;this.scope=t;this.node=e;this.file=n;this.hasInstanceMutators=false;this.hasStaticMutators=false;this.instanceMutatorMap={};this.staticMutatorMap={};this.hasConstructor=false;this.className=e.id||n.generateUidIdentifier("class",t);this.superName=e.superClass;this.isLoose=n.isLoose("classes")}n.prototype.run=function(){var n=this.superName;var l=this.className;var o=this.file;var t=this.body=[];var r;if(this.node.id){r=e.functionDeclaration(l,[],e.blockStatement([]));t.push(r)}else{r=e.functionExpression(null,[],e.blockStatement([]));t.push(e.variableDeclaration("var",[e.variableDeclarator(l,r)]))}this.constructor=r;var i=[];var s=[];if(n){s.push(n);if(!e.isIdentifier(n)){var u=this.scope.generateUidBasedOnNode(n,this.file);n=u}i.push(n);this.superName=n;t.push(e.expressionStatement(e.callExpression(o.addHelper("inherits"),[l,n])))}this.buildBody();e.inheritsComments(t[0],this.node);var a;if(t.length===1){a=e.toExpression(r)}else{t.push(e.returnStatement(l));a=e.callExpression(e.functionExpression(null,i,e.blockStatement(t)),s)}if(this.isStatement){return e.variableDeclaration("let",[e.variableDeclarator(l,a)])}else{return a}};n.prototype.buildBody=function(){var m=this.constructor;var u=this.className;var c=this.superName;var p=this.node.body.body;var s=this.body;for(var i=0;i<p.length;i++){var n=p[i];if(e.isMethodDefinition(n)){var d=new a(n,this.className,this.superName,this.isLoose,this.file);d.replace();if(n.key.name==="constructor"){this.pushConstructor(n)}else{this.pushMethod(n)}}else if(e.isPrivateDeclaration(n)){this.closure=true;s.unshift(n)}}if(!this.hasConstructor&&c&&!e.isFalsyExpression(c)){var f="class-super-constructor-call";if(this.isLoose)f+="-loose";m.body.body.push(r.template(f,{CLASS_NAME:u,SUPER_NAME:this.superName},true))}var l;var t;if(this.hasInstanceMutators){l=r.buildDefineProperties(this.instanceMutatorMap)}if(this.hasStaticMutators){t=r.buildDefineProperties(this.staticMutatorMap)}if(l||t){t=t||e.literal(null);var o=[u,t];if(l)o.push(l);s.push(e.expressionStatement(e.callExpression(this.file.addHelper("prototype-properties"),o)))}};n.prototype.pushMethod=function(n){var t=n.key;var l=n.kind;if(l===""){i.property(n,this.file,this.scope);if(this.isLoose){var a=this.className;if(!n.static)a=e.memberExpression(a,e.identifier("prototype"));t=e.memberExpression(a,t,n.computed);var s=e.expressionStatement(e.assignmentExpression("=",t,n.value));e.inheritsComments(s,n);this.body.push(s);return}l="value"}var o=this.instanceMutatorMap;if(n.static){this.hasStaticMutators=true;o=this.staticMutatorMap}else{this.hasInstanceMutators=true}r.pushMutatorMap(o,t,l,n.computed,n)};n.prototype.pushConstructor=function(r){if(r.kind){throw this.file.errorWithNode(r,"illegal kind for constructor method")}var n=this.constructor;var t=r.value;this.hasConstructor=true;e.inherits(n,t);e.inheritsComments(n,r);n._ignoreUserWhitespace=true;n.defaults=t.defaults;n.params=t.params;n.body=t.body;n.rest=t.rest}},{"../../types":92,"../../util":94,"../helpers/name-method":30,"../helpers/replace-supers":32}],52:[function(n,a,t){"use strict";var e=n("../../types");t.ObjectExpression=function(a,d,m,h,s){var o=false;for(var t=0;t<a.properties.length;t++){o=e.isProperty(a.properties[t],{computed:true,kind:"init"});if(o)break}if(!o)return;var u=[];var i=m.generateUidBasedOnNode(d,s);var n=[];var c=e.functionExpression(null,[],e.blockStatement(n));c._aliasFunction=true;var f=l;if(s.isLoose("computedPropertyNames"))f=r;var p=f(a,n,i,u,s);if(p)return p;n.unshift(e.variableDeclaration("var",[e.variableDeclarator(i,e.objectExpression(u))]));n.push(e.returnStatement(i));return e.callExpression(c,[])};var r=function(r,l,a){for(var n=0;n<r.properties.length;n++){var t=r.properties[n];l.push(e.expressionStatement(e.assignmentExpression("=",e.memberExpression(a,t.key,t.computed),t.value)))}};var l=function(p,s,c,o,f){var l=p.properties;var n,r;for(var t=0;t<l.length;t++){n=l[t];if(n.kind!=="init")continue;r=n.key;if(!n.computed&&e.isIdentifier(r)){n.key=e.literal(r.name)}}var u=false;for(t=0;t<l.length;t++){n=l[t];if(n.computed){u=true}if(n.kind!=="init"||!u||e.isLiteral(e.toComputedKey(n,n.key),{value:"__proto__"})){o.push(n);l[t]=null}}for(t=0;t<l.length;t++){n=l[t];if(!n)continue;r=n.key;var a;if(n.computed&&e.isMemberExpression(r)&&e.isIdentifier(r.object,{name:"Symbol"})){a=e.assignmentExpression("=",e.memberExpression(c,r,true),n.value)}else{a=e.callExpression(f.addHelper("define-property"),[c,r,n.value])}s.push(e.expressionStatement(a))}if(s.length===1){var i=s[0].expression;if(e.isCallExpression(i)){i.arguments[0]=e.objectExpression(o);return i}}}},{"../../types":92}],53:[function(t,a,n){"use strict";var l=t("../../traverse");var e=t("../../types");var r=t("lodash");n.Program=n.BlockStatement=n.ForInStatement=n.ForOfStatement=n.ForStatement=function(t,c,f,p,o){var a=false;var n={};var i=function(l,a,i){for(var t in a){var s=a[t];if(!r.has(n,t))continue;if(l&&e.isBlockStatement(l)&&l!==n[t])continue;if(i){var u=i.get(t);if(u&&u===s)continue}throw o.errorWithNode(s,t+" is read-only")}};var s=function(n){return e.getIds(n,true,["MemberExpression"])};r.each(t.body,function(t,o){if(e.isExportDeclaration(t)){t=t.declaration}if(e.isVariableDeclaration(t,{kind:"const"})){for(var r=0;r<t.declarations.length;r++){var u=t.declarations[r];var c=s(u);for(var l in c){var p=c[l];var f={};f[l]=p;i(o,f);n[l]=o;a=true}u._ignoreConstant=true}t._ignoreConstant=true;t.kind="let"}});if(!a)return;var u={check:i,getIds:s};l(t,{enter:function(n,r,l,a,t){if(n._ignoreConstant)return;if(e.isVariableDeclaration(n))return;if(e.isVariableDeclarator(n)||e.isDeclaration(n)||e.isAssignmentExpression(n)){t.check(r,t.getIds(n),l)}}},null,u)}},{"../../traverse":88,"../../types":92,lodash:142}],54:[function(n,a,t){"use strict";var r=n("../../traverse");var l=n("../../util");var e=n("../../types");t.Function=function(n,b,u,x,y){if(!n.defaults||!n.defaults.length)return;e.ensureBlock(n);var g=n.params.map(function(n){return e.getIds(n)});var s=false;var a;var h=function(l){var t=function(n,t){if(!e.isIdentifier(n)||!e.isReferenced(n,t))return;if(l.indexOf(n.name)>=0){throw y.errorWithNode(n,"Temporal dead zone - accessing a variable before it's initialized")}if(u.has(n.name,true)){s=true}};t(a,n);r(a,{enter:t})};for(var t=0;t<n.defaults.length;t++){a=n.defaults[t];if(!a)continue;var v=n.params[t];var m=g.slice(t);for(var o=0;o<m.length;o++){h(m[o])}var p=u.get(v.name,true);if(p&&n.params.indexOf(p)<0){s=true}}var i=[];var f=e.identifier("arguments");f._ignoreAliasFunctions=true;var c=0;for(t=0;t<n.defaults.length;t++){a=n.defaults[t];if(!a){c=+t+1;continue}i.push(l.template("default-parameter",{VARIABLE_NAME:n.params[t],DEFAULT_VALUE:a,ARGUMENT_KEY:e.literal(+t),ARGUMENTS:f},true))}n.params=n.params.slice(0,c);if(s){var d=e.functionExpression(null,[],n.body,n.generator);d._aliasFunction=true;i.push(e.returnStatement(e.callExpression(d,[])));n.body=e.blockStatement(i)}else{n.body.body=i.concat(n.body.body)}n.defaults=[]}},{"../../traverse":88,"../../types":92,"../../util":94}],55:[function(a,u,n){"use strict";var e=a("../../types");var r=function(r,n,l){var t=r.operator;if(e.isMemberExpression(n))t="=";if(t){return e.expressionStatement(e.assignmentExpression(t,n,l))}else{return e.variableDeclaration(r.kind,[e.variableDeclarator(n,l)])}};var t=function(t,l,n,a){if(e.isObjectPattern(n)){s(t,l,n,a)}else if(e.isArrayPattern(n)){o(t,l,n,a)}else if(e.isAssignmentPattern(n)){i(t,l,n,a)}else{l.push(r(t,n,a))}};var i=function(n,l,a,i){var t=n.scope.generateUidBasedOnNode(i,n.file);l.push(e.variableDeclaration("var",[e.variableDeclarator(t,i)]));l.push(r(n,a.left,e.conditionalExpression(e.binaryExpression("===",t,e.identifier("undefined")),a.right,t)))};var s=function(o,u,a,d){for(var s=0;s<a.properties.length;s++){var n=a.properties[s];if(e.isSpreadProperty(n)){var l=[];for(var i=0;i<a.properties.length;i++){var c=a.properties[i];if(i>=s)break;if(e.isSpreadProperty(c))continue;var f=c.key;if(e.isIdentifier(f)){f=e.literal(c.key.name)}l.push(f)}l=e.arrayExpression(l);var h=e.callExpression(o.file.addHelper("object-without-properties"),[d,l]);u.push(r(o,n.argument,h))}else{if(e.isLiteral(n.key))n.computed=true;var p=n.value;var m=e.memberExpression(d,n.key,n.computed);if(e.isPattern(p)){t(o,u,p,m)}else{u.push(r(o,p,m))}}}};var o=function(l,o,r,a){if(!r.elements)return;var n;var u=false;for(n=0;n<r.elements.length;n++){if(e.isSpreadElement(r.elements[n])){u=true;break}}var f=l.file.toArray(a,!u&&r.elements.length);var c=l.scope.generateUidBasedOnNode(a,l.file);o.push(e.variableDeclaration("var",[e.variableDeclarator(c,f)]));a=c;for(n=0;n<r.elements.length;n++){var i=r.elements[n];if(!i)continue;n=+n;var s;if(e.isSpreadElement(i)){s=l.file.toArray(a);if(n>0){s=e.callExpression(e.memberExpression(s,e.identifier("slice")),[e.literal(n)])}i=i.argument}else{s=e.memberExpression(a,e.literal(n),true)}t(l,o,i,s)}};var l=function(r){var l=r.nodes;var i=r.pattern;var n=r.id;var s=r.file;var o=r.scope;if(!e.isArrayExpression(n)&&!e.isMemberExpression(n)&&!e.isIdentifier(n)){var a=o.generateUidBasedOnNode(n,s);l.push(e.variableDeclaration("var",[e.variableDeclarator(a,n)]));n=a}t(r,l,i,n)};n.ForInStatement=n.ForOfStatement=function(n,c,l,f,a){var r=n.left;if(!e.isVariableDeclaration(r))return;var i=r.declarations[0].id;if(!e.isPattern(i))return;var s=a.generateUidIdentifier("ref",l);n.left=e.variableDeclaration(r.kind,[e.variableDeclarator(s,null)]);var o=[];t({kind:r.kind,file:a,scope:l},o,i,s);e.ensureBlock(n);var u=n.body;u.body=o.concat(u.body)};n.Function=function(n,o,t,u,r){var a=[];var i=false;n.params=n.params.map(function(n){if(!e.isPattern(n))return n;i=true;var s=r.generateUidIdentifier("ref",t);l({kind:"var",nodes:a,pattern:n,id:s,file:r,scope:t});return s});if(!i)return;e.ensureBlock(n);var s=n.body;s.body=a.concat(s.body)};n.CatchClause=function(n,o,r,u,l){var a=n.param;if(!e.isPattern(a))return;var i=l.generateUidIdentifier("ref",r);n.param=i;var s=[];t({kind:"var",file:l,scope:r},s,a,i);n.body.body=s.concat(n.body.body)};n.ExpressionStatement=function(s,o,l,u,a){var n=s.expression;if(n.type!=="AssignmentExpression")return;if(!e.isPattern(n.left))return;var r=[];var i=a.generateUidIdentifier("ref",l);r.push(e.variableDeclaration("var",[e.variableDeclarator(i,n.right)]));t({operator:n.operator,file:a,scope:l},r,n.left,i);return r};n.AssignmentExpression=function(r,s,l,o,i){if(s.type==="ExpressionStatement")return;if(!e.isPattern(r.left))return;var n=i.generateUidIdentifier("temp",l);l.push({key:n.name,id:n});var a=[];a.push(e.assignmentExpression("=",n,r.right));t({operator:r.operator,file:i,scope:l},a,r.left,n);a.push(n);return e.toSequenceExpression(a,l)};n.VariableDeclaration=function(a,s,d,m,o){if(e.isForInStatement(s)||e.isForOfStatement(s))return;var i=[];var t;var n;var u=false;for(t=0;t<a.declarations.length;t++){n=a.declarations[t];if(e.isPattern(n.id)){u=true;break}}if(!u)return;for(t=0;t<a.declarations.length;t++){n=a.declarations[t];var c=n.init;var f=n.id;var p={kind:a.kind,nodes:i,pattern:f,id:c,file:o,scope:d};if(e.isPattern(f)&&c){l(p);if(+t!==a.declarations.length-1){e.inherits(i[i.length-1],n)}}else{i.push(e.inherits(r(p,n.id,n.init),n))}}if(!e.isProgram(s)&&!e.isBlockStatement(s)){n=null;for(t=0;t<i.length;t++){a=i[t];n=n||e.variableDeclaration(a.kind,[]);if(!e.isVariableDeclaration(a)&&n.kind!==a.kind){throw o.errorWithNode(a,"Cannot use this node within the current parent")}n.declarations=n.declarations.concat(a.declarations)}return n}return i}},{"../../types":92}],56:[function(n,i,r){"use strict";var t=n("../../util");var e=n("../../types");r.ForOfStatement=function(n,c,f,p,o){var u=a;if(o.isLoose("forOf"))u=l;var r=u(n,c,f,p,o);var i=r.declar;var s=r.loop;var t=s.body;e.inheritsComments(s,n);e.ensureBlock(n);if(i){if(r.shouldUnshift){t.body.unshift(i)}else{t.body.push(i)}}t.body=t.body.concat(n.body.body);return s};var l=function(i,u,a,c,r){var n=i.left;var s,l;if(e.isIdentifier(n)||e.isPattern(n)){l=n}else if(e.isVariableDeclaration(n)){l=n.declarations[0].id;s=e.variableDeclaration(n.kind,[e.variableDeclarator(l)])}else{throw r.errorWithNode(n,"Unknown node type "+n.type+" in ForOfStatement")}var o=t.template("for-of-loose",{LOOP_OBJECT:r.generateUidIdentifier("iterator",a),IS_ARRAY:r.generateUidIdentifier("isArray",a),OBJECT:i.right,INDEX:r.generateUidIdentifier("i",a),ID:l});return{shouldUnshift:true,declar:s,loop:o}};var a=function(a,c,i,f,r){var n=a.left;var l;var s=r.generateUidIdentifier("step",i);var o=e.memberExpression(s,e.identifier("value"));if(e.isIdentifier(n)||e.isPattern(n)){l=e.expressionStatement(e.assignmentExpression("=",n,o))}else if(e.isVariableDeclaration(n)){l=e.variableDeclaration(n.kind,[e.variableDeclarator(n.declarations[0].id,o)])}else{throw r.errorWithNode(n,"Unknown node type "+n.type+" in ForOfStatement")}var u=t.template("for-of",{ITERATOR_KEY:r.generateUidIdentifier("iterator",i),STEP_KEY:s,OBJECT:a.right});return{declar:l,loop:u}}},{"../../types":92,"../../util":94}],57:[function(e,r,n){"use strict";var t=e("regenerator");n.ast={before:function(e,n){t.transform(e,{includeRuntime:n.opts.includeRegenerator&&"if used"})}}},{regenerator:150}],58:[function(a,c,i){"use strict";var t=a("../../traverse");var o=a("../../util");var e=a("../../types");var r=a("lodash");var l=function(n,t){if(!e.isVariableDeclaration(n))return false;if(n._let)return true;if(n.kind!=="let")return false;if(!e.isFor(t)||e.isFor(t)&&t.left!==n){r.each(n.declarations,function(n){n.init=n.init||e.identifier("undefined")})}n._let=true;n.kind="var";return true};var s=function(n,t){return e.isVariableDeclaration(n,{kind:"var"})&&!l(n,t)};var u=function(n){for(var e=0;e<n.length;e++){delete n[e]._let}};i.VariableDeclaration=function(e,n){l(e,n)};i.Loop=function(t,r,i,u,s){var a=t.left||t.init;if(l(a,t)){e.ensureBlock(t);t.body._letDeclars=[a]}if(e.isLabeledStatement(r)){t.label=r.label}var o=new n(t,t.body,r,i,s);o.run();if(t.label&&!e.isLabeledStatement(r)){return e.labeledStatement(t.label,t)}};i.BlockStatement=function(r,t,l,s,a){if(!e.isLoop(t)){var i=new n(false,r,t,l,a);i.run()}};function n(e,n,t,r,l){this.loopParent=e;this.parent=t;this.scope=r;this.block=n;this.file=l;this.outsideLetReferences={};this.letReferences={};this.body=[]}n.prototype.run=function(){var n=this.block;if(n._letDone)return;n._letDone=true;
if(e.isFunction(this.parent))return;var t=this.getLetReferences();if(t){this.needsClosure()}else{this.remap()}};n.prototype.remap=function(){var u=this.letReferences;var r=this.scope;var f=this.file;var l={};for(var a in u){var i=u[a];if(r.parentHas(a)){var c=f.generateUidIdentifier(i.name,r).name;i.name=c;l[a]={node:i,uid:c}}}var s=function(n,l,a,r,i){if(!e.isIdentifier(n))return;if(!e.isReferenced(n,l))return;var t=i[n.name];if(!t)return;var s=a.get(n.name,true);if(s===t.node){n.name=t.uid}else{if(r)r.skip()}};var o=function(e,n){s(e,n,r,null,l);t(e,{enter:s},r,l)};var n=this.loopParent;if(n){o(n.right,n);o(n.test,n);o(n.update,n)}t(this.block,{enter:s},r,l)};n.prototype.needsClosure=function(){var a=this.block;this.has=this.checkLoop();this.hoistVarDeclarations();var i=r.values(this.outsideLetReferences);var n=e.functionExpression(null,i,e.blockStatement(a.body));n._aliasFunction=true;a.body=this.body;var l=e.callExpression(n,i);var s=this.file.generateUidIdentifier("ret",this.scope);var o=t.hasType(n.body,"YieldExpression",e.FUNCTION_TYPES);if(o){n.generator=true;l=e.yieldExpression(l,true)}this.build(s,l)};n.prototype.getLetReferences=function(){var s=this.block;var a=s._letDeclars||[];var i;for(var n=0;n<a.length;n++){i=a[n];r.extend(this.outsideLetReferences,e.getIds(i,true))}if(s.body){for(n=0;n<s.body.length;n++){i=s.body[n];if(l(i,s)){a=a.concat(i.declarations)}}}for(n=0;n<a.length;n++){i=a[n];var c=e.getIds(i,true);r.extend(this.letReferences,c)}u(a);var o={letReferences:this.letReferences,closurify:false};t(this.block,{enter:function(r,i,l,a,n){if(e.isFunction(r)){t(r,{enter:function(t,r){if(!e.isIdentifier(t))return;if(!e.isReferenced(t,r))return;if(l.hasOwn(t.name,true))return;if(!n.letReferences[t.name])return;n.closurify=true}},l,n);return a.skip()}}},this.scope,o);return o.closurify};n.prototype.checkLoop=function(){var n={hasContinue:false,hasReturn:false,hasBreak:false};t(this.block,{enter:function(t,l,i,a){var r;if(e.isFunction(t)||e.isLoop(t)){return a.skip()}if(t&&!t.label){if(e.isBreakStatement(t)){if(e.isSwitchCase(l))return;n.hasBreak=true;r=e.returnStatement(e.literal("break"))}else if(e.isContinueStatement(t)){n.hasContinue=true;r=e.returnStatement(e.literal("continue"))}}if(e.isReturnStatement(t)){n.hasReturn=true;r=e.returnStatement(e.objectExpression([e.property("init",e.identifier("v"),t.argument||e.identifier("undefined"))]))}if(r)return e.inherits(r,t)}},this.scope,n);return n};n.prototype.hoistVarDeclarations=function(){t(this.block,{enter:function(n,r,a,l,t){if(e.isForStatement(n)){if(s(n.init,n)){n.init=e.sequenceExpression(t.pushDeclar(n.init))}}else if(e.isFor(n)){if(s(n.left,n)){n.left=n.left.declarations[0].id}}else if(s(n,r)){return t.pushDeclar(n).map(e.expressionStatement)}else if(e.isFunction(n)){return l.skip()}}},this.scope,this)};n.prototype.pushDeclar=function(n){this.body.push(e.variableDeclaration(n.kind,n.declarations.map(function(n){return e.variableDeclarator(n.id)})));var l=[];for(var r=0;r<n.declarations.length;r++){var t=n.declarations[r];if(!t.init)continue;var a=e.assignmentExpression("=",t.id,t.init);l.push(e.inherits(a,t))}return l};n.prototype.build=function(r,t){var n=this.has;if(n.hasReturn||n.hasBreak||n.hasContinue){this.buildHas(r,t)}else{this.body.push(e.expressionStatement(t))}};n.prototype.buildHas=function(r,c){var l=this.body;l.push(e.variableDeclaration("var",[e.variableDeclarator(r,c)]));var i=this.loopParent;var a;var n=this.has;var t=[];if(n.hasReturn){a=o.template("let-scoping-return",{RETURN:r})}if(n.hasBreak||n.hasContinue){var s=i.label=i.label||this.file.generateUidIdentifier("loop",this.scope);if(n.hasBreak){t.push(e.switchCase(e.literal("break"),[e.breakStatement(s)]))}if(n.hasContinue){t.push(e.switchCase(e.literal("continue"),[e.continueStatement(s)]))}if(n.hasReturn){t.push(e.switchCase(null,[a]))}if(t.length===1){var u=t[0];l.push(e.ifStatement(e.binaryExpression("===",r,u.test),u.consequent[0]))}else{l.push(e.switchStatement(r,t))}}else{if(n.hasReturn)l.push(a)}}},{"../../traverse":88,"../../types":92,"../../util":94,lodash:142}],59:[function(t,r,e){"use strict";var n=t("../../types");e.ast={before:function(e,n){e.program.body=n.dynamicImports.concat(e.program.body)}};e.ImportDeclaration=function(e,r,a,i,l){var n=[];if(e.specifiers.length){for(var t=0;t<e.specifiers.length;t++){l.moduleFormatter.importSpecifier(e.specifiers[t],e,n,r)}}else{l.moduleFormatter.importDeclaration(e,n,r)}if(n.length===1){n[0]._blockHoist=e._blockHoist}return n};e.ExportDeclaration=function(e,l,s,o,a){var t=[];if(e.declaration){if(n.isVariableDeclaration(e.declaration)){var i=e.declaration.declarations[0];i.init=i.init||n.identifier("undefined")}a.moduleFormatter.exportDeclaration(e,t,l)}else{for(var r=0;r<e.specifiers.length;r++){a.moduleFormatter.exportSpecifier(e.specifiers[r],e,t,l)}}return t}},{"../../types":92}],60:[function(n,a,t){"use strict";var l=n("../helpers/name-method");var r=n("../../util");var e=n("../../types");t.Property=function(e,r,n,a,t){if(!e.method)return;e.method=false;l.property(e,t,n)};t.ObjectExpression=function(n){var t={};var l=false;n.properties=n.properties.filter(function(e){if(e.kind==="get"||e.kind==="set"){l=true;r.pushMutatorMap(t,e.key,e.kind,e.computed,e.value);return false}else{return true}});if(!l)return;return e.callExpression(e.memberExpression(e.identifier("Object"),e.identifier("defineProperties")),[n,r.buildDefineProperties(t)])}},{"../../types":92,"../../util":94,"../helpers/name-method":30}],61:[function(e,l,n){"use strict";var t=e("../../types");var r=e("lodash");n.Property=function(e){if(!e.shorthand)return;e.shorthand=false;e.key=t.removeComments(r.clone(e.key))}},{"../../types":92,lodash:142}],62:[function(n,l,t){"use strict";var r=n("../../util");var e=n("../../types");t.Function=function(n,f,d,p,i){if(!n.rest)return;var c=n.rest;n.rest=null;e.ensureBlock(n);var u=e.identifier("arguments");u._ignoreAliasFunctions=true;var l=e.literal(n.params.length);var a=i.generateUidIdentifier("key");var t=i.generateUidIdentifier("len");var s=a;var o=t;if(n.params.length){s=e.binaryExpression("-",a,l);o=e.conditionalExpression(e.binaryExpression(">",t,l),e.binaryExpression("-",t,l),e.literal(0))}n.body.body.unshift(r.template("rest",{ARGUMENTS:u,ARRAY_KEY:s,ARRAY_LEN:o,START:l,ARRAY:c,KEY:a,LEN:t}))}},{"../../types":92,"../../util":94}],63:[function(l,s,n){"use strict";var e=l("../../types");var a=l("lodash");var i=function(e,n){return n.toArray(e.argument)};var t=function(t){for(var n=0;n<t.length;n++){if(e.isSpreadElement(t[n])){return true}}return false};var r=function(a,o){var t=[];var n=[];var s=function(){if(!n.length)return;t.push(e.arrayExpression(n));n=[]};for(var r=0;r<a.length;r++){var l=a[r];if(e.isSpreadElement(l)){s();t.push(i(l,o))}else{n.push(l)}}s();return t};n.ArrayExpression=function(i,o,u,c,s){var a=i.elements;if(!t(a))return;var l=r(a,s);var n=l.shift();if(!e.isArrayExpression(n)){l.unshift(n);n=e.arrayExpression([])}return e.callExpression(e.memberExpression(n,e.identifier("concat")),l)};n.CallExpression=function(n,p,f,d,u){var a=n.arguments;if(!t(a))return;var s=e.identifier("undefined");n.arguments=[];var i;if(a.length===1&&a[0].argument.name==="arguments"){i=[a[0].argument]}else{i=r(a,u)}var c=i.shift();if(i.length){n.arguments.push(e.callExpression(e.memberExpression(c,e.identifier("concat")),i))}else{n.arguments.push(c)}var l=n.callee;if(e.isMemberExpression(l)){var o=f.generateTempBasedOnNode(l.object,u);if(o){l.object=e.assignmentExpression("=",o,l.object);s=o}else{s=l.object}e.appendToMemberExpression(l,e.identifier("apply"))}else{n.callee=e.memberExpression(n.callee,e.identifier("apply"))}n.arguments.unshift(s)};n.NewExpression=function(l,c,f,p,s){var n=l.arguments;if(!t(n))return;var o=e.isIdentifier(l.callee)&&a.contains(e.NATIVE_TYPE_NAMES,l.callee.name);var i=r(n,s);if(o){i.unshift(e.arrayExpression([e.literal(null)]))}var u=i.shift();if(i.length){n=e.callExpression(e.memberExpression(u,e.identifier("concat")),i)}else{n=u}if(o){return e.newExpression(e.callExpression(e.memberExpression(s.addHelper("bind"),e.identifier("apply")),[l.callee,n]),[])}else{return e.callExpression(s.addHelper("apply-constructor"),[l.callee,n])}}},{"../../types":92,lodash:142}],64:[function(r,l,n){"use strict";var e=r("../../types");var t=function(n,t){return e.binaryExpression("+",n,t)};n.TaggedTemplateExpression=function(s,c,p,f,o){var n=[];var l=s.quasi;var r=[];var t=[];for(var a=0;a<l.quasis.length;a++){var i=l.quasis[a];r.push(e.literal(i.value.cooked));t.push(e.literal(i.value.raw))}r=e.arrayExpression(r);t=e.arrayExpression(t);var u="tagged-template-literal";if(o.isLoose("templateLiterals"))u+="-loose";n.push(e.callExpression(o.addHelper(u),[r,t]));n=n.concat(l.expressions);return e.callExpression(s.tag,n)};n.TemplateLiteral=function(l){var n=[];var r;for(r=0;r<l.quasis.length;r++){var s=l.quasis[r];n.push(e.literal(s.value.cooked));var i=l.expressions.shift();if(i)n.push(i)}if(n.length>1){var o=n[n.length-1];if(e.isLiteral(o,{value:""}))n.pop();var a=t(n.shift(),n.shift());for(r=0;r<n.length;r++){a=t(a,n[r])}return a}else{return n[0]}}},{"../../types":92}],65:[function(e,l,n){"use strict";var t=e("regexpu/rewrite-pattern");var r=e("lodash");n.Literal=function(l){var e=l.regex;if(!e)return;var n=e.flags.split("");if(e.flags.indexOf("u")<0)return;r.pull(n,"u");e.pattern=t(e.pattern,e.flags);e.flags=n.join("")}},{lodash:142,"regexpu/rewrite-pattern":185}],66:[function(r,a,n){"use strict";var t=r("../../util");var e=r("../../types");n.experimental=true;var l=function(r,n,l){if(e.isExpressionStatement(r)){return n}else{var t=[];if(e.isSequenceExpression(n)){t=n.expressions}else{t.push(n)}t.push(l);return e.sequenceExpression(t)}};n.AssignmentExpression=function(n,o,u,f,c){var i=n.left;if(!e.isVirtualPropertyExpression(i))return;var r=n.right;var a;if(!e.isExpressionStatement(o)){a=u.generateTempBasedOnNode(n.right,c);if(a)r=a}if(n.operator!=="="){r=e.binaryExpression(n.operator[0],t.template("abstract-expression-get",{PROPERTY:n.property,OBJECT:n.object}),r)}var s=t.template("abstract-expression-set",{PROPERTY:i.property,OBJECT:i.object,VALUE:r});if(a){s=e.sequenceExpression([e.assignmentExpression("=",a,n.right),s])}return l(o,s,r)};n.UnaryExpression=function(r,a){var n=r.argument;if(!e.isVirtualPropertyExpression(n))return;if(r.operator!=="delete")return;var i=t.template("abstract-expression-delete",{PROPERTY:n.property,OBJECT:n.object});return l(a,i,e.literal(true))};n.CallExpression=function(a,o,i,u,s){var n=a.callee;if(!e.isVirtualPropertyExpression(n))return;var l=i.generateTempBasedOnNode(n.object,s);var r=t.template("abstract-expression-call",{PROPERTY:n.property,OBJECT:l||n.object});r.arguments=r.arguments.concat(a.arguments);if(l){return e.sequenceExpression([e.assignmentExpression("=",l,n.object),r])}else{return r}};n.VirtualPropertyExpression=function(e){return t.template("abstract-expression-get",{PROPERTY:e.property,OBJECT:e.object})};n.PrivateDeclaration=function(n){return e.variableDeclaration("const",n.declarations.map(function(n){return e.variableDeclarator(n,e.newExpression(e.identifier("WeakMap"),[]))}))}},{"../../types":92,"../../util":94}],67:[function(e,s,n){"use strict";var l=e("../helpers/build-comprehension");var a=e("../../traverse");var t=e("../../util");var r=e("../../types");n.experimental=true;var i=function(n,o,u,d,c){var s=u.generateUidBasedOnNode(o,c);var e=t.template("array-comprehension-container",{KEY:s});e.callee._aliasFunction=true;var f=e.callee.body;var i=f.body;if(a.hasType(n,"YieldExpression",r.FUNCTION_TYPES)){e.callee.generator=true;e=r.yieldExpression(e,true)}var p=i.pop();i.push(l(n,function(){return t.template("array-push",{STATEMENT:n.body,KEY:s},true)}));i.push(p);return e};n.ComprehensionExpression=function(e,n,t,r,l){if(e.generator)return;return i(e,n,t,r,l)}},{"../../traverse":88,"../../types":92,"../../util":94,"../helpers/build-comprehension":27}],68:[function(n,a,t){"use strict";t.experimental=true;var r=n("../helpers/build-binary-assignment-operator-transformer");var e=n("../../types");var l=e.memberExpression(e.identifier("Math"),e.identifier("pow"));r(t,{operator:"**",build:function(n,t){return e.callExpression(l,[n,t])}})},{"../../types":92,"../helpers/build-binary-assignment-operator-transformer":26}],69:[function(n,l,t){"use strict";var r=n("../helpers/build-comprehension");var e=n("../../types");t.experimental=true;t.ComprehensionExpression=function(n){if(!n.generator)return;var t=[];var l=e.functionExpression(null,[],e.blockStatement(t),true);l._aliasFunction=true;t.push(r(n,function(){return e.expressionStatement(e.yieldExpression(n.body))}));return e.callExpression(l,[])}},{"../../types":92,"../helpers/build-comprehension":27}],70:[function(t,r,n){"use strict";var e=t("../../types");n.experimental=true;n.ObjectExpression=function(l,u,f,c,o){var s=false;var n;var t;for(n=0;n<l.properties.length;n++){t=l.properties[n];if(e.isSpreadProperty(t)){s=true;break}}if(!s)return;var r=[];var a=[];var i=function(){if(!a.length)return;r.push(e.objectExpression(a));a=[]};for(n=0;n<l.properties.length;n++){t=l.properties[n];if(e.isSpreadProperty(t)){i();r.push(t.argument)}else{a.push(t)}}i();if(!e.isObjectExpression(r[0])){r.unshift(e.objectExpression([]))}return e.callExpression(o.addHelper("extends"),r)}},{"../../types":92}],71:[function(n,l,e){"use strict";var t=n("../helpers/remap-async-to-generator");var r=n("./optional-bluebird-coroutines");e.optional=true;e.manipulateOptions=r.manipulateOptions;e.Function=function(e,r,l,a,n){if(!e.async||e.generator)return;return t(e,n.addHelper("async-to-generator"))}},{"../helpers/remap-async-to-generator":31,"./optional-bluebird-coroutines":72}],72:[function(n,l,e){"use strict";var r=n("../helpers/remap-async-to-generator");var t=n("../../types");e.manipulateOptions=function(e){e.experimental=true;e.blacklist.push("generators")};e.optional=true;e.Function=function(e,l,a,i,n){if(!e.async||e.generator)return;return r(e,t.memberExpression(n.addImport("bluebird"),t.identifier("coroutine")))}},{"../../types":92,"../helpers/remap-async-to-generator":31}],73:[function(n,u,r){"use strict";var a=n("../../traverse");var i=n("../../util");var l=n("core-js/library");var e=n("../../types");var t=n("lodash");var s=function(e){return e.name!=="_"&&t.has(l,e.name)};var o=["Symbol","Promise","Map","WeakMap","Set","WeakSet"];r.optional=true;r.ast={enter:function(n,e){e._coreId=e.addImport("core-js/library","core")},exit:function(r,n){a(r,{enter:function(r,c,d,p){var a;if(e.isMemberExpression(r)&&e.isReferenced(r,c)){var f=r.object;a=r.property;if(!e.isReferenced(f,r))return;if(!r.computed&&s(f)&&t.has(l[f.name],a.name)){p.skip();return e.prependToMemberExpression(r,n._coreId)}}else if(e.isIdentifier(r)&&!e.isMemberExpression(c)&&e.isReferenced(r,c)&&t.contains(o,r.name)){return e.memberExpression(n._coreId,r)}else if(e.isCallExpression(r)){if(r.arguments.length)return;var u=r.callee;if(!e.isMemberExpression(u))return;if(!u.computed)return;a=u.property;if(!e.isIdentifier(a.object,{name:"Symbol"}))return;if(!e.isIdentifier(a.property,{name:"iterator"}))return;return i.template("corejs-iterator",{CORE_ID:n._coreId,VALUE:u.object})}}})}}},{"../../traverse":88,"../../types":92,"../../util":94,"core-js/library":135,lodash:142}],74:[function(t,s,n){"use strict";var e=t("../../types");var a=t("lodash");var i=function(n){return e.isLiteral(e.toComputedKey(n,n.key),{value:"__proto__"})};var r=function(t){var n=t.left;return e.isMemberExpression(n)&&e.isLiteral(e.toComputedKey(n,n.property),{value:"__proto__"})};var l=function(n,t,r){return e.expressionStatement(e.callExpression(r.addHelper("defaults"),[t,n.right]))};n.optional=true;n.secondPass=true;n.AssignmentExpression=function(n,s,o,c,i){if(e.isExpressionStatement(s))return;if(!r(n))return;var t=[];var u=n.left.object;var a=o.generateTempBasedOnNode(n.left.object,i);t.push(e.expressionStatement(e.assignmentExpression("=",a,u)));t.push(l(n,a,i));if(a)t.push(a);return e.toSequenceExpression(t)};n.ExpressionStatement=function(t,i,s,o,a){var n=t.expression;if(!e.isAssignmentExpression(n,{operator:"="}))return;if(r(n)){return l(n,n.left.object,a)}};n.ObjectExpression=function(n,u,c,f,o){var t;for(var r=0;r<n.properties.length;r++){var l=n.properties[r];if(i(l)){t=l.value;a.pull(n.properties,l)}}if(t){var s=[e.objectExpression([]),t];if(n.properties.length)s.push(n);return e.callExpression(o.addHelper("extends"),s)}}},{"../../types":92,lodash:142}],75:[function(t,r,n){"use strict";var e=t("../../types");n.optional=true;n.UnaryExpression=function(n,i,s,l,a){l.skip();if(n.operator==="typeof"){var t=e.callExpression(a.addHelper("typeof"),[n.argument]);if(e.isIdentifier(n.argument)){var r=e.literal("undefined");return e.conditionalExpression(e.binaryExpression("===",e.unaryExpression("typeof",n.argument),r),r,t)}else{return t}}}},{"../../types":92}],76:[function(t,r,n){"use strict";var e=t("../../types");n.optional=true;n.Identifier=function(n,t){if(n.name==="undefined"&&e.isReferenced(n,t)){return e.unaryExpression("void",e.literal(0),true)}}},{"../../types":92}],77:[function(n,l,t){"use strict";var r=n("../helpers/build-conditional-assignment-operator-transformer");var e=n("../../types");r(t,{is:function(n,r){var l=e.isAssignmentExpression(n)&&n.operator==="||=";if(l){var t=n.left;if(!e.isMemberExpression(t)&&!e.isIdentifier(t)){throw r.errorWithNode(t,"Expected type MemeberExpression or Identifier")}return true}},build:function(n){return e.unaryExpression("!",n,true)}})},{"../../types":92,"../helpers/build-conditional-assignment-operator-transformer":28}],78:[function(n,l,t){"use strict";var r=n("../helpers/build-conditional-assignment-operator-transformer");var e=n("../../types");r(t,{is:function(n){var t=e.isAssignmentExpression(n)&&n.operator==="?=";if(t)e.assertMemberExpression(n.left);return t},build:function(n,t){return e.unaryExpression("!",e.callExpression(e.memberExpression(t.addHelper("has-own"),e.identifier("call")),[n.object,n.property]),true)}})},{"../../types":92,"../helpers/build-conditional-assignment-operator-transformer":28}],79:[function(t,r,n){"use strict";var e=t("../../types");n.BindMemberExpression=function(n,o,a,u,i){var r=n.object;var s=n.property;var t=a.generateTempBasedOnNode(n.object,i);if(t)r=t;var l=e.callExpression(e.memberExpression(e.memberExpression(r,s),e.identifier("bind")),[r].concat(n.arguments));if(t){return e.sequenceExpression([e.assignmentExpression("=",t,n.object),l])}else{return l}};n.BindFunctionExpression=function(n,i,t,s,r){var a=function(a){var l=r.generateUidIdentifier("val",t);return e.functionExpression(null,[l],e.blockStatement([e.returnStatement(e.callExpression(e.memberExpression(l,n.callee),a))]))};var l=t.generateTemp(r,"args");return e.sequenceExpression([e.assignmentExpression("=",l,e.arrayExpression(n.arguments)),a(n.arguments.map(function(t,n){return e.memberExpression(l,e.literal(n),true)}))])}},{"../../types":92}],80:[function(n,l,t){"use strict";var r=n("../../traverse");var e=n("../../types");t.Property=t.MethodDefinition=function(n,i,s,o,a){if(n.kind!=="memo")return;n.kind="get";var l=n.value;e.ensureBlock(l);var t=n.key;if(e.isIdentifier(t)&&!n.computed){t=e.literal(t.name)}r(l,{enter:function(n){if(e.isFunction(n))return;if(e.isReturnStatement(n)&&n.argument){n.argument=e.memberExpression(e.callExpression(a.addHelper("define-property"),[e.thisExpression(),t,n.argument]),t,true)}}})}},{"../../traverse":88,"../../types":92}],81:[function(t,c,n){"use strict";var i=t("esutils");var e=t("../../types");var u=t("lodash");n.XJSIdentifier=function(n){if(i.keyword.isIdentifierName(n.name)){n.type="Identifier"}else{return e.literal(n.name)}};n.XJSNamespacedName=function(e,t,r,l,n){throw n.errorWithNode(e,"Namespace tags are not supported. ReactJSX is not XML.")};n.XJSMemberExpression={exit:function(n){n.computed=e.isLiteral(n.property);n.type="MemberExpression"}};n.XJSExpressionContainer=function(e){return e.expression};n.XJSAttribute={exit:function(n){var t=n.value||e.literal(true);return e.inherits(e.property("init",n.name,t),n)}};var r=function(e){return/^[a-z]|\-/.test(e)};n.XJSOpeningElement={exit:function(i,c,f,p,u){var o=u.opts.reactCompat;var n=i.name;var l=[];var t;if(e.isIdentifier(n)){t=n.name}else if(e.isLiteral(n)){t=n.value}if(!o){if(t&&r(t)){l.push(e.literal(t))}else{l.push(n)}}var a=i.attributes;if(a.length){a=s(a)}else{a=e.literal(null)}l.push(a);if(o){if(t&&r(t)){return e.callExpression(e.memberExpression(e.memberExpression(e.identifier("React"),e.identifier("DOM")),n,e.isLiteral(n)),l)}}else{n=e.memberExpression(e.identifier("React"),e.identifier("createElement"))}return e.callExpression(n,l)}};var s=function(t){var r=[];var n=[];var a=function(){if(!r.length)return;n.push(e.objectExpression(r));r=[]};while(t.length){var l=t.shift();if(e.isXJSSpreadAttribute(l)){a();n.push(l.argument)}else{r.push(l)}}a();if(n.length===1){t=n[0]}else{if(!e.isObjectExpression(n[0])){n.unshift(e.objectExpression([]))}t=e.callExpression(e.memberExpression(e.identifier("React"),e.identifier("__spread")),n)}return t};n.XJSElement={exit:function(r){var n=r.openingElement;for(var l=0;l<r.children.length;l++){var t=r.children[l];if(e.isLiteral(t)&&u.isString(t.value)){o(t,n.arguments);continue}else if(e.isXJSEmptyExpression(t)){continue}n.arguments.push(t)}if(n.arguments.length>=3){n._prettyCall=true}return e.inherits(n,r)}};var o=function(l,a){var r=l.value.split(/\r\n|\n|\r/);for(var t=0;t<r.length;t++){var i=r[t];var s=t===0;var o=t===r.length-1;var n=i.replace(/\t/g," ");if(!s){n=n.replace(/^[ ]+/,"")}if(!o){n=n.replace(/[ ]+$/,"")}if(n){a.push(e.literal(n))}}};var a=function(n){if(!n||!e.isCallExpression(n))return false;var t=n.callee;if(!e.isMemberExpression(t))return false;var l=t.object;if(!e.isIdentifier(l,{name:"React"}))return false;var a=t.property;if(!e.isIdentifier(a,{name:"createClass"}))return false;var r=n.arguments;if(r.length!==1)return false;var i=r[0];if(!e.isObjectExpression(i))return;return true};var l=function(i,r){if(!a(r))return;var n=r.arguments[0].properties;var l=true;for(var t=0;t<n.length;t++){var s=n[t];if(e.isIdentifier(s.key,{name:"displayName"})){l=false;break}}if(l){n.unshift(e.property("init",e.identifier("displayName"),e.literal(i)))}};n.AssignmentExpression=n.Property=n.VariableDeclarator=function(n){var t,r;if(e.isAssignmentExpression(n)){t=n.left;r=n.right}else if(e.isProperty(n)){t=n.key;r=n.value}else if(e.isVariableDeclarator(n)){t=n.id;r=n.init}if(e.isMemberExpression(t)){t=t.property}if(e.isIdentifier(t)){l(t.name,r)}}},{"../../types":92,esutils:140,lodash:142}],82:[function(n,r,t){"use strict";var e=n("../../types");t.FunctionDeclaration=function(n,t){if(e.isProgram(t)||e.isExportDeclaration(t)){return}var r=e.variableDeclaration("let",[e.variableDeclarator(n.id,e.toExpression(n))]);r._blockHoist=2;n.id=null;return r}},{"../../types":92}],83:[function(n,r,t){"use strict";var e=n("../../types");t.MemberExpression=function(n){var t=n.property;if(n.computed&&e.isLiteral(t)&&e.isValidIdentifier(t.value)){n.property=e.identifier(t.value);n.computed=false}else if(!n.computed&&e.isIdentifier(t)&&!e.isValidIdentifier(t.name)){n.property=e.literal(t.name);n.computed=true}}},{"../../types":92}],84:[function(n,r,e){"use strict";var t=n("../../types");e.ForInStatement=e.ForOfStatement=function(r,a,i,s,l){var e=r.left;if(t.isVariableDeclaration(e)){var n=e.declarations[0];if(n.init)throw l.errorWithNode(n,"No assignments allowed in for-in/of head")}}},{"../../types":92}],85:[function(n,r,t){"use strict";var e=n("../../types");t.Property=function(t){var n=t.key;if(e.isLiteral(n)&&e.isValidIdentifier(n.value)){t.key=e.identifier(n.value);t.computed=false}else if(!t.computed&&e.isIdentifier(n)&&!e.isValidIdentifier(n.name)){t.key=e.literal(n.name)}}},{"../../types":92}],86:[function(n,t,e){"use strict";e.MethodDefinition=e.Property=function(e,t,r,l,n){if(e.kind==="set"&&e.value.params.length!==1){throw n.errorWithNode(e.value,"Setters must have only one parameter")}}},{}],87:[function(e,l,t){"use strict";var r=e("../helpers/use-strict");var n=e("../../types");t.ast={exit:function(e){if(!r.has(e.program)){e.program.body.unshift(n.expressionStatement(n.literal("use strict")))}}}},{"../../types":92,"../helpers/use-strict":33}],88:[function(a,u,c){"use strict";u.exports=r;var o=a("./scope");var n=a("../types");var t=a("lodash");function i(){}function e(){this.shouldFlatten=false;this.shouldRemove=false;this.shouldSkip=false;this.shouldStop=false}e.prototype.flatten=function(){this.shouldFlatten=true};e.prototype.remove=function(){this.shouldRemove=true;this.shouldSkip=true};e.prototype.skip=function(){this.shouldSkip=true};e.prototype.stop=function(){this.shouldStop=true;this.shouldSkip=true};e.prototype.reset=function(){this.shouldRemove=false;this.shouldSkip=false;this.shouldStop=false};function s(r,l,s,e){var a=Array.isArray(e);var i=e;if(a)i=e[0];if(i)n.inheritsComments(i,s);r[l]=e;if(a&&t.contains(n.STATEMENT_OR_BLOCK_KEYS,l)&&!n.isBlockStatement(r)){n.ensureBlock(r,l)}if(a){return true}}e.prototype.enterNode=function(t,r,e,a,i,o,u){var n=a(e,i,o,this,u);var l=false;if(n){l=s(t,r,e,n);e=n;if(l){this.shouldFlatten=true}}if(this.shouldRemove){t[r]=null;this.shouldFlatten=true}return e};e.prototype.exitNode=function(r,l,e,a,i,o,u){var n=a(e,i,o,this,u);var t=false;if(n){t=s(r,l,e,n);e=n;if(t){this.shouldFlatten=true}}return e};e.prototype.visitNode=function(a,i,t,u,c,s){this.reset();var e=a[i];if(t.blacklist&&t.blacklist.indexOf(e.type)>-1)return;var r=u;if(n.isScope(e)){r=new o(e,u)}e=this.enterNode(a,i,e,t.enter,c,r,s);if(this.shouldSkip)return this.shouldStop;l(e,t,r,s);this.exitNode(a,i,e,t.exit,c,r,s);return this.shouldStop};e.prototype.visit=function(e,n,a,i,s){var r=e[n];if(!r)return;if(!Array.isArray(r)){return this.visitNode(e,n,a,i,e,s)}if(r.length===0){return}for(var l=0;l<r.length;l++){if(r[l]&&this.visitNode(r,l,a,i,e,s))return true}if(this.shouldFlatten){e[n]=t.flatten(e[n]);if(n==="body"){e[n]=t.compact(e[n])}}};function l(l,a,i,s){var t=n.VISITOR_KEYS[l.type];if(!t)return;var o=new e;for(var r=0;r<t.length;r++){if(o.visit(l,t[r],a,i,s)){return}}}function r(n,e,r,a){if(!n)return;if(!e)e={};if(!e.enter)e.enter=i;if(!e.exit)e.exit=i;if(Array.isArray(n)){for(var t=0;t<n.length;t++){l(n[t],e,r,a)}}else{l(n,e,r,a)}}r.removeProperties=function(e){var n=function(e){e._declarations=null;e.extendedRange=null;e._scopeInfo=null;e.tokens=null;e.range=null;e.start=null;e.end=null;e.loc=null;e.raw=null;l(e.trailingComments);l(e.leadingComments)};var l=function(e){t.each(e,n)};n(e);r(e,{enter:n});return e};r.hasType=function(n,l,e){e=[].concat(e||[]);if(t.contains(e,n.type))return false;if(n.type===l)return true;var a={has:false};r(n,{blacklist:e,enter:function(e,r,a,n,t){if(e.type===l){t.has=true;n.skip()}}},null,a);return a.has}},{"../types":92,"./scope":89,lodash:142}],89:[function(r,i,o){"use strict";i.exports=n;var s=r("./index");var e=r("../types");var t=r("lodash");var a=["left","init"];function n(n,t){this.parent=t;this.block=n;var e=this.getInfo();this.references=e.references;this.declarations=e.declarations}var l=r("jshint/src/vars");n.defaultDeclarations=t.flatten([l.newEcmaIdentifiers,l.node,l.ecmaIdentifiers,l.reservedVars].map(t.keys));n.add=function(n,r){if(!n)return;t.defaults(r,e.getIds(n,true))};n.prototype.generateTemp=function(n,t){var e=n.generateUidIdentifier(t||"temp",this);this.push({key:e.name,id:e});return e};n.prototype.generateUidBasedOnNode=function(t,i){var n=t;if(e.isAssignmentExpression(t)){n=t.left}else if(e.isVariableDeclarator(t)){n=t.id}else if(e.isProperty(n)){n=n.key}var l=[];var r=function(n){if(e.isMemberExpression(n)){r(n.object);r(n.property)}else if(e.isIdentifier(n)){l.push(n.name)}else if(e.isLiteral(n)){l.push(n.value)}else if(e.isCallExpression(n)){r(n.callee)}};r(n);var a=l.join("$");a=a.replace(/^_/,"")||"ref";return i.generateUidIdentifier(a,this)};n.prototype.generateTempBasedOnNode=function(n,r){if(e.isIdentifier(n)&&this.has(n.name,true)){return null}var t=this.generateUidBasedOnNode(n,r);this.push({key:t.name,id:t});return t};n.prototype.getInfo=function(){var r=this.block;if(r._scopeInfo)return r._scopeInfo;var i=r._scopeInfo={};var o=i.references={};var u=i.declarations={};var l=function(e,t){n.add(e,o);if(!t)n.add(e,u)};if(e.isFor(r)){t.each(a,function(t){var n=r[t];if(e.isBlockScoped(n))l(n)})}if(e.isBlockStatement(r)||e.isProgram(r)){t.each(r.body,function(n){if(e.isBlockScoped(n))l(n)})}if(e.isCatchClause(r)){l(r.param)}if(e.isComprehensionExpression(r)){l(r)}if(e.isProgram(r)||e.isFunction(r)){var c={blockId:r.id,add:l};s(r,{enter:function(n,i,s,o,r){if(e.isFor(n)){t.each(a,function(r){var t=n[r];if(e.isVar(t))l(t)})}if(e.isFunction(n))return o.skip();if(r.blockId&&n===r.blockId)return;if(e.isIdentifier(n)&&e.isReferenced(n,i)&&!s.has(n.name)){r.add(n,true)}if(e.isDeclaration(n)&&!e.isBlockScoped(n)){r.add(n)}}},this,c)}if(e.isFunction(r)){l(r.rest);t.each(r.params,function(e){l(e)})}return i};n.prototype.push=function(t){var n=this.block;if(e.isFor(n)||e.isCatchClause(n)||e.isFunction(n)){e.ensureBlock(n);n=n.body}if(e.isBlockStatement(n)||e.isProgram(n)){n._declarations=n._declarations||{};n._declarations[t.key]={kind:t.kind,id:t.id,init:t.init}}else{throw new TypeError("cannot add a declaration here in node type "+n.type)}};n.prototype.add=function(e){n.add(e,this.references)};n.prototype.get=function(e,n){return e&&(this.getOwn(e,n)||this.parentGet(e,n))};n.prototype.getOwn=function(n,r){var e=this.references;if(r)e=this.declarations;return t.has(e,n)&&e[n]};n.prototype.parentGet=function(e,n){return this.parent&&this.parent.get(e,n)};n.prototype.has=function(e,r){return e&&(this.hasOwn(e,r)||this.parentHas(e,r))||t.contains(n.defaultDeclarations,e)};n.prototype.hasOwn=function(e,n){return!!this.getOwn(e,n)};n.prototype.parentHas=function(e,n){return this.parent&&this.parent.has(e,n)}},{"../types":92,"./index":88,"jshint/src/vars":141,lodash:142}],90:[function(n,e,t){e.exports={ExpressionStatement:["Statement"],BreakStatement:["Statement"],ContinueStatement:["Statement"],DebuggerStatement:["Statement"],DoWhileStatement:["Statement","Loop","While"],IfStatement:["Statement"],ReturnStatement:["Statement"],SwitchStatement:["Statement"],ThrowStatement:["Statement"],TryStatement:["Statement"],WhileStatement:["Statement","Loop","While"],WithStatement:["Statement"],EmptyStatement:["Statement"],LabeledStatement:["Statement"],VariableDeclaration:["Statement","Declaration"],ExportDeclaration:["Statement","Declaration"],ImportDeclaration:["Statement","Declaration"],PrivateDeclaration:["Statement","Declaration"],ArrowFunctionExpression:["Scope","Function","Expression"],FunctionDeclaration:["Statement","Declaration","Scope","Function"],FunctionExpression:["Scope","Function","Expression"],BlockStatement:["Statement","Scope"],Program:["Scope"],CatchClause:["Scope"],LogicalExpression:["Binary","Expression"],BinaryExpression:["Binary","Expression"],UnaryExpression:["UnaryLike","Expression"],SpreadProperty:["UnaryLike"],SpreadElement:["UnaryLike"],ClassDeclaration:["Statement","Declaration","Class"],ClassExpression:["Class","Expression"],ForOfStatement:["Statement","For","Scope","Loop"],ForInStatement:["Statement","For","Scope","Loop"],ForStatement:["Statement","For","Scope","Loop"],ObjectPattern:["Pattern"],ArrayPattern:["Pattern"],AssignmentPattern:["Pattern"],Property:["UserWhitespacable"],XJSElement:["UserWhitespacable","Expression"],ArrayExpression:["Expression"],AssignmentExpression:["Expression"],AwaitExpression:["Expression"],BindFunctionExpression:["Expression"],BindMemberExpression:["Expression"],CallExpression:["Expression"],ComprehensionExpression:["Expression","Scope"],ConditionalExpression:["Expression"],Identifier:["Expression"],Literal:["Expression"],MemberExpression:["Expression"],NewExpression:["Expression"],ObjectExpression:["Expression"],SequenceExpression:["Expression"],TaggedTemplateExpression:["Expression"],ThisExpression:["Expression"],UpdateExpression:["Expression"],VirtualPropertyExpression:["Expression"],XJSEmptyExpression:["Expression"],XJSMemberExpression:["Expression"],YieldExpression:["Expression"]}
},{}],91:[function(n,e,t){e.exports={ArrayExpression:["elements"],ArrowFunctionExpression:["params","body"],AssignmentExpression:["operator","left","right"],BinaryExpression:["operator","left","right"],BlockStatement:["body"],CallExpression:["callee","arguments"],ConditionalExpression:["test","consequent","alternate"],ExpressionStatement:["expression"],File:["program","comments","tokens"],FunctionExpression:["id","params","body","generator"],FunctionDeclaration:["id","params","body","generator"],Identifier:["name"],IfStatement:["test","consequent","alternate"],ImportDeclaration:["specifiers","source"],ImportSpecifier:["id","name"],Literal:["value"],LogicalExpression:["operator","left","right"],MemberExpression:["object","property","computed"],MethodDefinition:["key","value","computed","kind"],NewExpression:["callee","arguments"],ObjectExpression:["properties"],Program:["body"],Property:["kind","key","value","computed"],ReturnStatement:["argument"],SequenceExpression:["expressions"],ThrowExpression:["argument"],UnaryExpression:["operator","argument","prefix"],VariableDeclaration:["kind","declarations"],VariableDeclarator:["id","init"],WithStatement:["object","body"],YieldExpression:["argument","delegate"]}},{}],92:[function(t,s,r){"use strict";var l=t("../to-fast-properties");var a=t("esutils");var n=t("lodash");var e=r;e.NATIVE_TYPE_NAMES=["Array","Object","Number","Boolean","Date","Array","String"];function i(n,t){var r=e["is"+n]=function(r,l){return e.is(n,r,l,t)};e["assert"+n]=function(t,e){e=e||{};if(!r(t,e)){throw new Error("Expected type "+JSON.stringify(n)+" with option "+JSON.stringify(e))}}}e.STATEMENT_OR_BLOCK_KEYS=["consequent","body"];e.VISITOR_KEYS=t("./visitor-keys");e.ALIAS_KEYS=t("./alias-keys");e.FLIPPED_ALIAS_KEYS={};n.each(e.VISITOR_KEYS,function(n,e){i(e,true)});n.each(e.ALIAS_KEYS,function(t,r){n.each(t,function(n){var t=e.FLIPPED_ALIAS_KEYS[n]=e.FLIPPED_ALIAS_KEYS[n]||[];t.push(r)})});n.each(e.FLIPPED_ALIAS_KEYS,function(t,n){e[n.toUpperCase()+"_TYPES"]=t;i(n,false)});e.is=function(r,n,l,i){if(!n)return;var t=r===n.type;if(!t&&!i){var a=e.FLIPPED_ALIAS_KEYS[r];if(typeof a!=="undefined")t=a.indexOf(n.type)>-1}if(!t){return false}if(typeof l!=="undefined")return e.shallowEqual(n,l);return true};e.BUILDER_KEYS=n.defaults(t("./builder-keys"),e.VISITOR_KEYS);n.each(e.BUILDER_KEYS,function(r,t){e[t[0].toLowerCase()+t.slice(1)]=function(){var l=arguments;var e={type:t};n.each(r,function(n,t){e[n]=l[t]});return e}});e.toComputedKey=function(t,n){if(!t.computed){if(e.isIdentifier(n))n=e.literal(n.name)}return n};e.isFalsyExpression=function(n){if(e.isLiteral(n)){return!n.value}else if(e.isIdentifier(n)){return n.name==="undefined"}return false};e.toSequenceExpression=function(r,l){var t=[];n.each(r,function(r){if(e.isExpression(r)){t.push(r)}if(e.isExpressionStatement(r)){t.push(r.expression)}else if(e.isVariableDeclaration(r)){n.each(r.declarations,function(n){l.push({kind:r.kind,key:n.id.name,id:n.id});t.push(e.assignmentExpression("=",n.id,n.init))})}});if(t.length===1){return t[0]}else{return e.sequenceExpression(t)}};e.shallowEqual=function(l,t){var r=Object.keys(t);var e;for(var n=0;n<r.length;n++){e=r[n];if(l[e]!==t[e])return false}return true};e.appendToMemberExpression=function(n,t,r){n.object=e.memberExpression(n.object,n.property,n.computed);n.property=t;n.computed=!!r;return n};e.prependToMemberExpression=function(n,t){n.object=e.memberExpression(t,n.object);return n};e.isReferenced=function(r,t){if(e.isProperty(t)&&t.key===r&&!t.computed)return false;if(e.isFunction(t)){if(n.contains(t.params,r))return false;if(t.rest===r)return false}if(e.isMethodDefinition(t)&&t.key===r&&!t.computed){return false}if(e.isCatchClause(t)&&t.param===r)return false;if(e.isVariableDeclarator(t)&&t.id===r)return false;var l=e.isMemberExpression(t);var a=l&&t.property===r&&t.computed;var i=l&&t.object===r;if(!l||a||i)return true;return false};e.isValidIdentifier=function(e){return n.isString(e)&&a.keyword.isIdentifierName(e)&&!a.keyword.isReservedWordES6(e,true)};e.toIdentifier=function(n){if(e.isIdentifier(n))return n.name;n=n+"";n=n.replace(/[^a-zA-Z0-9$_]/g,"-");n=n.replace(/^[-0-9]+/,"");n=n.replace(/[-_\s]+(.)?/g,function(n,e){return e?e.toUpperCase():""});n=n.replace(/^\_/,"");if(!e.isValidIdentifier(n)){n="_"+n}return n||"_"};e.ensureBlock=function(t,n){n=n||"body";t[n]=e.toBlock(t[n],t)};e.toStatement=function(n,l){if(e.isStatement(n)){return n}var r=false;var t;if(e.isClass(n)){r=true;t="ClassDeclaration"}else if(e.isFunction(n)){r=true;t="FunctionDeclaration"}if(r&&!n.id){t=false}if(!t){if(l){return false}else{throw new Error("cannot turn "+n.type+" to a statement")}}n.type=t;return n};r.toExpression=function(n){if(e.isExpressionStatement(n)){n=n.expression}if(e.isClass(n)){n.type="ClassExpression"}else if(e.isFunction(n)){n.type="FunctionExpression"}if(e.isExpression(n)){return n}else{throw new Error("cannot turn "+n.type+" to an expression")}};e.toBlock=function(n,t){if(e.isBlockStatement(n)){return n}if(e.isEmptyStatement(n)){n=[]}if(!Array.isArray(n)){if(!e.isStatement(n)){if(e.isFunction(t)){n=e.returnStatement(n)}else{n=e.expressionStatement(n)}}n=[n]}return e.blockStatement(n)};e.getIds=function(c,f,s){s=s||[];var l=[].concat(c);var i={};while(l.length){var t=l.shift();if(!t)continue;if(n.contains(s,t.type))continue;var o=e.getIds.nodes[t.type];var u=e.getIds.arrays[t.type];var r,a;if(e.isIdentifier(t)){i[t.name]=t}else if(o){for(r=0;r<o.length;r++){a=o[r];if(t[a]){l.push(t[a]);break}}}else if(u){for(r=0;r<u.length;r++){a=u[r];l=l.concat(t[a]||[])}}}if(!f)i=n.keys(i);return i};e.getIds.nodes={AssignmentExpression:["left"],ImportBatchSpecifier:["name"],ImportSpecifier:["name","id"],ExportSpecifier:["name","id"],VariableDeclarator:["id"],FunctionDeclaration:["id"],ClassDeclaration:["id"],MemeberExpression:["object"],SpreadElement:["argument"],Property:["value"],ComprehensionBlock:["left"]};e.getIds.arrays={PrivateDeclaration:["declarations"],ComprehensionExpression:["blocks"],ExportDeclaration:["specifiers","declaration"],ImportDeclaration:["specifiers"],VariableDeclaration:["declarations"],ArrayPattern:["elements"],ObjectPattern:["properties"]};e.isLet=function(n){return e.isVariableDeclaration(n)&&(n.kind!=="var"||n._let)};e.isBlockScoped=function(n){return e.isFunctionDeclaration(n)||e.isLet(n)};e.isVar=function(n){return e.isVariableDeclaration(n,{kind:"var"})&&!n._let};e.COMMENT_KEYS=["leadingComments","trailingComments"];e.removeComments=function(t){n.each(e.COMMENT_KEYS,function(e){delete t[e]});return t};e.inheritsComments=function(t,r){n.each(e.COMMENT_KEYS,function(e){t[e]=n.uniq(n.compact([].concat(t[e],r[e])))});return t};e.inherits=function(n,t){n.range=t.range;n.start=t.start;n.loc=t.loc;n.end=t.end;e.inheritsComments(n,t);return n};e.getSpecifierName=function(e){return e.name||e.id};e.isSpecifierDefault=function(n){return e.isIdentifier(n.id)&&n.id.name==="default"};l(e);l(e.VISITOR_KEYS)},{"../to-fast-properties":25,"./alias-keys":90,"./builder-keys":91,"./visitor-keys":93,esutils:140,lodash:142}],93:[function(n,e,t){e.exports={ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","defaults","rest","body"],AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],AwaitExpression:["argument"],BinaryExpression:["left","right"],BindFunctionExpression:["callee","arguments"],BindMemberExpression:["object","property","arguments"],BlockStatement:["body"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ClassBody:["body"],ClassDeclaration:["id","body","superClass"],ClassExpression:["id","body","superClass"],ComprehensionBlock:["left","right","body"],ComprehensionExpression:["filter","blocks","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportBatchSpecifier:[],ExportDeclaration:["declaration","specifiers","source"],ExportSpecifier:["id","name"],ExpressionStatement:["expression"],File:["program"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],ForStatement:["init","test","update","body"],FunctionDeclaration:["id","params","defaults","rest","body"],FunctionExpression:["id","params","defaults","rest","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportBatchSpecifier:["id"],ImportDeclaration:["specifiers","source"],ImportSpecifier:["id","name"],LabeledStatement:["label","body"],Literal:[],LogicalExpression:["left","right"],MemberExpression:["object","property"],MethodDefinition:["key","value"],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateDeclaration:["declarations"],Program:["body"],Property:["key","value"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],SpreadProperty:["argument"],SwitchCase:["test","consequent"],SwitchStatement:["discriminant","cases"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handlers","handler","guardedHandlers","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],VirtualPropertyExpression:["object","property"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"],AnyTypeAnnotation:[],ArrayTypeAnnotation:[],BooleanTypeAnnotation:[],ClassProperty:["key"],DeclareClass:[],DeclareFunction:[],DeclareModule:[],DeclareVariable:[],FunctionTypeAnnotation:[],FunctionTypeParam:[],GenericTypeAnnotation:[],InterfaceExtends:[],InterfaceDeclaration:[],IntersectionTypeAnnotation:[],NullableTypeAnnotation:[],NumberTypeAnnotation:[],StringLiteralTypeAnnotation:[],StringTypeAnnotation:[],TupleTypeAnnotation:[],TypeofTypeAnnotation:[],TypeAlias:[],TypeAnnotation:[],TypeParameterDeclaration:[],TypeParameterInstantiation:[],ObjectTypeAnnotation:[],ObjectTypeCallProperty:[],ObjectTypeIndexer:[],ObjectTypeProperty:[],QualifiedTypeIdentifier:[],UnionTypeAnnotation:[],VoidTypeAnnotation:[],XJSAttribute:["name","value"],XJSClosingElement:["name"],XJSElement:["openingElement","closingElement","children"],XJSEmptyExpression:[],XJSExpressionContainer:["expression"],XJSIdentifier:[],XJSMemberExpression:["object","property"],XJSNamespacedName:["namespace","name"],XJSOpeningElement:["name","attributes"],XJSSpreadAttribute:["argument"]}},{}],94:[function(n,t,e){(function(u,o){"use strict";n("./patch");var f=n("estraverse");var l=n("./traverse");var c=n("acorn-6to5");var a=n("path");var m=n("util");var i=n("fs");var t=n("./types");var r=n("lodash");e.inherits=m.inherits;e.canCompile=function(n,t){var l=t||e.canCompile.EXTENSIONS;var i=a.extname(n);return r.contains(l,i)};e.canCompile.EXTENSIONS=[".js",".jsx",".es6",".es"];e.isInteger=function(e){return r.isNumber(e)&&e%1===0};e.resolve=function(e){try{return n.resolve(e)}catch(t){return null}};e.trimRight=function(e){return e.replace(/[\n\s]+$/g,"")};e.list=function(e){return e?e.split(","):[]};e.regexify=function(e){if(!e)return new RegExp(/.^/);if(Array.isArray(e))e=e.join("|");if(r.isString(e))return new RegExp(e);if(r.isRegExp(e))return e;throw new TypeError("illegal type for regexify")};e.arrayify=function(n){if(!n)return[];if(r.isString(n))return e.list(n);if(Array.isArray(n))return n;throw new TypeError("illegal type for arrayify")};e.isAbsolute=function(e){if(!e)return false;if(e[0]==="/")return true;if(e[1]===":"&&e[2]==="\\")return true;return false};e.sourceMapToComment=function(e){var n=JSON.stringify(e);var t=new u(n).toString("base64");return"//# sourceMappingURL=data:application/json;base64,"+t};e.pushMutatorMap=function(i,n,o,s,u){var e;if(t.isIdentifier(n)){e=n.name;if(s)e="computed:"+e}else if(t.isLiteral(n)){e=String(n.value)}else{e=JSON.stringify(l.removeProperties(r.cloneDeep(n)))}var a;if(r.has(i,e)){a=i[e]}else{a={}}i[e]=a;a._key=n;if(s){a._computed=true}a[o]=u};e.buildDefineProperties=function(n){var e=t.objectExpression([]);r.each(n,function(n){var l=t.objectExpression([]);var a=t.property("init",n._key,l,n._computed);if(!n.get&&!n.set){n.writable=t.literal(true)}n.enumerable=t.literal(true);n.configurable=t.literal(true);r.each(n,function(e,n){if(n[0]==="_")return;e=r.clone(e);var a=e;if(t.isMethodDefinition(e))e=e.value;var i=t.property("init",t.identifier(n),e);t.inheritsComments(i,a);t.removeComments(a);l.properties.push(i)});e.properties.push(a)});return e};var p={enter:function(e,l,a,i,n){if(t.isIdentifier(e)&&r.has(n,e.name)){return n[e.name]}}};e.template=function(s,a,o){var n=e.templates[s];if(!n)throw new ReferenceError("unknown template "+s);if(a===true){o=true;a=null}n=r.cloneDeep(n);if(!r.isEmpty(a)){l(n,p,null,a)}var i=n.body[0];if(!o&&t.isExpressionStatement(i)){return i.expression}else{return i}};e.codeFrame=function(n,t,r){r=Math.max(r,0);n=n.split("\n");var l=Math.max(t-3,0);var a=Math.min(n.length,t+3);var i=(a+"").length;if(!t&&!r){l=0;a=n.length}return"\n"+n.slice(l,a).map(function(o,u){var a=u+l+1;var s=a===t?"> ":" ";var c=a+e.repeat(i+1);s+=c+"| ";var n=s+o;if(r&&a===t){n+="\n";n+=e.repeat(s.length-2);n+="|"+e.repeat(r)+"^"}return n}).join("\n")};e.repeat=function(r,e){e=e||" ";var n="";for(var t=0;t<r;t++){n+=e}return n};e.normaliseAst=function(e,n,r){if(e&&e.type==="Program"){return t.file(e,n||[],r||[])}else{throw new Error("Not a valid ast?")}};e.parse=function(r,o,u){try{var l=[];var a=[];var t=c.parse(o,{allowImportExportEverywhere:true,allowReturnOutsideFunction:true,ecmaVersion:r.experimental?7:6,playground:r.playground,strictMode:true,onComment:l,locations:true,onToken:a,ranges:true});f.attachComments(t,l,a);t=e.normaliseAst(t,l,a);if(u){return u(t)}else{return t}}catch(n){if(!n._6to5){n._6to5=true;var i=r.filename+": "+n.message;var s=n.loc;if(s){var p=e.codeFrame(o,s.line,s.column);i+=p}if(n.stack)n.stack=n.stack.replace(n.message,i);n.message=i}throw n}};e.parseTemplate=function(n,t){var r=e.parse({filename:n},t).program;return l.removeProperties(r)};var d=function(){var t={};var n=o+"/transformation/templates";if(!i.existsSync(n)){throw new Error("no templates directory - this is most likely the "+"result of a broken `npm publish`. Please report to "+"https://github.com/6to5/6to5/issues")}r.each(i.readdirSync(n),function(r){if(r[0]===".")return;var s=a.basename(r,a.extname(r));var l=n+"/"+r;var o=i.readFileSync(l,"utf8");t[s]=e.parseTemplate(l,o)});return t};try{e.templates=n("../../templates.json")}catch(s){if(s.code!=="MODULE_NOT_FOUND")throw s;e.templates=d()}}).call(this,n("buffer").Buffer,"/lib/6to5")},{"../../templates.json":198,"./patch":24,"./traverse":88,"./types":92,"acorn-6to5":1,buffer:111,estraverse:136,fs:109,lodash:142,path:118,util:134}],95:[function(u,v,x){var s=u("../lib/types");var o=s.Type;var e=o.def;var n=o.or;var a=s.builtInTypes;var l=a.string;var p=a.number;var r=a.boolean;var f=a.RegExp;var c=u("../lib/shared");var t=c.defaults;var i=c.geq;e("Printable").field("loc",n(e("SourceLocation"),null),t["null"],true);e("Node").bases("Printable").field("type",l);e("SourceLocation").build("start","end","source").field("start",e("Position")).field("end",e("Position")).field("source",n(l,null),t["null"]);e("Position").build("line","column").field("line",i(1)).field("column",i(0));e("Program").bases("Node").build("body").field("body",[e("Statement")]).field("comments",n([n(e("Block"),e("Line"))],null),t["null"],true);e("Function").bases("Node").field("id",n(e("Identifier"),null),t["null"]).field("params",[e("Pattern")]).field("body",n(e("BlockStatement"),e("Expression")));e("Statement").bases("Node");e("EmptyStatement").bases("Statement").build();e("BlockStatement").bases("Statement").build("body").field("body",[e("Statement")]);e("ExpressionStatement").bases("Statement").build("expression").field("expression",e("Expression"));e("IfStatement").bases("Statement").build("test","consequent","alternate").field("test",e("Expression")).field("consequent",e("Statement")).field("alternate",n(e("Statement"),null),t["null"]);e("LabeledStatement").bases("Statement").build("label","body").field("label",e("Identifier")).field("body",e("Statement"));e("BreakStatement").bases("Statement").build("label").field("label",n(e("Identifier"),null),t["null"]);e("ContinueStatement").bases("Statement").build("label").field("label",n(e("Identifier"),null),t["null"]);e("WithStatement").bases("Statement").build("object","body").field("object",e("Expression")).field("body",e("Statement"));e("SwitchStatement").bases("Statement").build("discriminant","cases","lexical").field("discriminant",e("Expression")).field("cases",[e("SwitchCase")]).field("lexical",r,t["false"]);e("ReturnStatement").bases("Statement").build("argument").field("argument",n(e("Expression"),null));e("ThrowStatement").bases("Statement").build("argument").field("argument",e("Expression"));e("TryStatement").bases("Statement").build("block","handler","finalizer").field("block",e("BlockStatement")).field("handler",n(e("CatchClause"),null),function(){return this.handlers&&this.handlers[0]||null}).field("handlers",[e("CatchClause")],function(){return this.handler?[this.handler]:[]},true).field("guardedHandlers",[e("CatchClause")],t.emptyArray).field("finalizer",n(e("BlockStatement"),null),t["null"]);e("CatchClause").bases("Node").build("param","guard","body").field("param",e("Pattern")).field("guard",n(e("Expression"),null),t["null"]).field("body",e("BlockStatement"));e("WhileStatement").bases("Statement").build("test","body").field("test",e("Expression")).field("body",e("Statement"));e("DoWhileStatement").bases("Statement").build("body","test").field("body",e("Statement")).field("test",e("Expression"));e("ForStatement").bases("Statement").build("init","test","update","body").field("init",n(e("VariableDeclaration"),e("Expression"),null)).field("test",n(e("Expression"),null)).field("update",n(e("Expression"),null)).field("body",e("Statement"));e("ForInStatement").bases("Statement").build("left","right","body","each").field("left",n(e("VariableDeclaration"),e("Expression"))).field("right",e("Expression")).field("body",e("Statement")).field("each",r);e("DebuggerStatement").bases("Statement").build();e("Declaration").bases("Statement");e("FunctionDeclaration").bases("Function","Declaration").build("id","params","body").field("id",e("Identifier"));e("FunctionExpression").bases("Function","Expression").build("id","params","body");e("VariableDeclaration").bases("Declaration").build("kind","declarations").field("kind",n("var","let","const")).field("declarations",[n(e("VariableDeclarator"),e("Identifier"))]);e("VariableDeclarator").bases("Node").build("id","init").field("id",e("Pattern")).field("init",n(e("Expression"),null));e("Expression").bases("Node","Pattern");e("ThisExpression").bases("Expression").build();e("ArrayExpression").bases("Expression").build("elements").field("elements",[n(e("Expression"),null)]);e("ObjectExpression").bases("Expression").build("properties").field("properties",[e("Property")]);e("Property").bases("Node").build("kind","key","value").field("kind",n("init","get","set")).field("key",n(e("Literal"),e("Identifier"))).field("value",e("Expression"));e("SequenceExpression").bases("Expression").build("expressions").field("expressions",[e("Expression")]);var d=n("-","+","!","~","typeof","void","delete");e("UnaryExpression").bases("Expression").build("operator","argument","prefix").field("operator",d).field("argument",e("Expression")).field("prefix",r,t["true"]);var m=n("==","!=","===","!==","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","&","|","^","in","instanceof","..");e("BinaryExpression").bases("Expression").build("operator","left","right").field("operator",m).field("left",e("Expression")).field("right",e("Expression"));var h=n("=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","^=","&=");e("AssignmentExpression").bases("Expression").build("operator","left","right").field("operator",h).field("left",e("Pattern")).field("right",e("Expression"));var g=n("++","--");e("UpdateExpression").bases("Expression").build("operator","argument","prefix").field("operator",g).field("argument",e("Expression")).field("prefix",r);var y=n("||","&&");e("LogicalExpression").bases("Expression").build("operator","left","right").field("operator",y).field("left",e("Expression")).field("right",e("Expression"));e("ConditionalExpression").bases("Expression").build("test","consequent","alternate").field("test",e("Expression")).field("consequent",e("Expression")).field("alternate",e("Expression"));e("NewExpression").bases("Expression").build("callee","arguments").field("callee",e("Expression")).field("arguments",[e("Expression")]);e("CallExpression").bases("Expression").build("callee","arguments").field("callee",e("Expression")).field("arguments",[e("Expression")]);e("MemberExpression").bases("Expression").build("object","property","computed").field("object",e("Expression")).field("property",n(e("Identifier"),e("Expression"))).field("computed",r);e("Pattern").bases("Node");e("ObjectPattern").bases("Pattern").build("properties").field("properties",[e("PropertyPattern")]);e("PropertyPattern").bases("Pattern").build("key","pattern").field("key",n(e("Literal"),e("Identifier"))).field("pattern",e("Pattern"));e("ArrayPattern").bases("Pattern").build("elements").field("elements",[n(e("Pattern"),null)]);e("SwitchCase").bases("Node").build("test","consequent").field("test",n(e("Expression"),null)).field("consequent",[e("Statement")]);e("Identifier").bases("Node","Expression","Pattern").build("name").field("name",l);e("Literal").bases("Node","Expression").build("value").field("value",n(l,r,null,p,f));e("Block").bases("Printable").build("loc","value").field("value",l);e("Line").bases("Printable").build("loc","value").field("value",l)},{"../lib/shared":106,"../lib/types":107}],96:[function(l,s,o){l("./core");var r=l("../lib/types");var e=r.Type.def;var t=r.Type.or;var a=r.builtInTypes;var n=a.string;var i=a.boolean;e("XMLDefaultDeclaration").bases("Declaration").field("namespace",e("Expression"));e("XMLAnyName").bases("Expression");e("XMLQualifiedIdentifier").bases("Expression").field("left",t(e("Identifier"),e("XMLAnyName"))).field("right",t(e("Identifier"),e("Expression"))).field("computed",i);e("XMLFunctionQualifiedIdentifier").bases("Expression").field("right",t(e("Identifier"),e("Expression"))).field("computed",i);e("XMLAttributeSelector").bases("Expression").field("attribute",e("Expression"));e("XMLFilterExpression").bases("Expression").field("left",e("Expression")).field("right",e("Expression"));e("XMLElement").bases("XML","Expression").field("contents",[e("XML")]);e("XMLList").bases("XML","Expression").field("contents",[e("XML")]);e("XML").bases("Node");e("XMLEscape").bases("XML").field("expression",e("Expression"));e("XMLText").bases("XML").field("text",n);e("XMLStartTag").bases("XML").field("contents",[e("XML")]);e("XMLEndTag").bases("XML").field("contents",[e("XML")]);e("XMLPointTag").bases("XML").field("contents",[e("XML")]);e("XMLName").bases("XML").field("contents",t(n,[e("XML")]));e("XMLAttribute").bases("XML").field("value",n);e("XMLCdata").bases("XML").field("contents",n);e("XMLComment").bases("XML").field("contents",n);e("XMLProcessingInstruction").bases("XML").field("target",n).field("contents",t(n,null))},{"../lib/types":107,"./core":95}],97:[function(s,c,f){s("./core");var a=s("../lib/types");var e=a.Type.def;var n=a.Type.or;var l=a.builtInTypes;var r=l.boolean;var u=l.object;var i=l.string;var t=s("../lib/shared").defaults;e("Function").field("generator",r,t["false"]).field("expression",r,t["false"]).field("defaults",[n(e("Expression"),null)],t.emptyArray).field("rest",n(e("Identifier"),null),t["null"]);e("FunctionDeclaration").build("id","params","body","generator","expression");e("FunctionExpression").build("id","params","body","generator","expression");e("ArrowFunctionExpression").bases("Function","Expression").build("params","body","expression").field("id",null,t["null"]).field("generator",false);e("YieldExpression").bases("Expression").build("argument","delegate").field("argument",n(e("Expression"),null)).field("delegate",r,t["false"]);e("GeneratorExpression").bases("Expression").build("body","blocks","filter").field("body",e("Expression")).field("blocks",[e("ComprehensionBlock")]).field("filter",n(e("Expression"),null));e("ComprehensionExpression").bases("Expression").build("body","blocks","filter").field("body",e("Expression")).field("blocks",[e("ComprehensionBlock")]).field("filter",n(e("Expression"),null));e("ComprehensionBlock").bases("Node").build("left","right","each").field("left",e("Pattern")).field("right",e("Expression")).field("each",r);e("ModuleSpecifier").bases("Literal").build("value").field("value",i);e("Property").field("key",n(e("Literal"),e("Identifier"),e("Expression"))).field("method",r,t["false"]).field("shorthand",r,t["false"]).field("computed",r,t["false"]);e("PropertyPattern").field("key",n(e("Literal"),e("Identifier"),e("Expression"))).field("computed",r,t["false"]);e("MethodDefinition").bases("Declaration").build("kind","key","value").field("kind",n("init","get","set","")).field("key",n(e("Literal"),e("Identifier"),e("Expression"))).field("value",e("Function")).field("computed",r,t["false"]);e("SpreadElement").bases("Node").build("argument").field("argument",e("Expression"));e("ArrayExpression").field("elements",[n(e("Expression"),e("SpreadElement"),null)]);e("NewExpression").field("arguments",[n(e("Expression"),e("SpreadElement"))]);e("CallExpression").field("arguments",[n(e("Expression"),e("SpreadElement"))]);e("SpreadElementPattern").bases("Pattern").build("argument").field("argument",e("Pattern"));var o=n(e("MethodDefinition"),e("VariableDeclarator"),e("ClassPropertyDefinition"),e("ClassProperty"));e("ClassProperty").bases("Declaration").build("key").field("key",n(e("Literal"),e("Identifier"),e("Expression"))).field("computed",r,t["false"]);e("ClassPropertyDefinition").bases("Declaration").build("definition").field("definition",o);e("ClassBody").bases("Declaration").build("body").field("body",[o]);e("ClassDeclaration").bases("Declaration").build("id","body","superClass").field("id",e("Identifier")).field("body",e("ClassBody")).field("superClass",n(e("Expression"),null),t["null"]);e("ClassExpression").bases("Expression").build("id","body","superClass").field("id",n(e("Identifier"),null),t["null"]).field("body",e("ClassBody")).field("superClass",n(e("Expression"),null),t["null"]).field("implements",[e("ClassImplements")],t.emptyArray);e("ClassImplements").bases("Node").build("id").field("id",e("Identifier")).field("superClass",n(e("Expression"),null),t["null"]);e("Specifier").bases("Node");e("NamedSpecifier").bases("Specifier").field("id",e("Identifier")).field("name",n(e("Identifier"),null),t["null"]);e("ExportSpecifier").bases("NamedSpecifier").build("id","name");e("ExportBatchSpecifier").bases("Specifier").build();e("ImportSpecifier").bases("NamedSpecifier").build("id","name");e("ImportNamespaceSpecifier").bases("Specifier").build("id").field("id",e("Identifier"));e("ImportDefaultSpecifier").bases("Specifier").build("id").field("id",e("Identifier"));e("ExportDeclaration").bases("Declaration").build("default","declaration","specifiers","source").field("default",r).field("declaration",n(e("Declaration"),e("Expression"),null)).field("specifiers",[n(e("ExportSpecifier"),e("ExportBatchSpecifier"))],t.emptyArray).field("source",n(e("ModuleSpecifier"),null),t["null"]);e("ImportDeclaration").bases("Declaration").build("specifiers","source").field("specifiers",[n(e("ImportSpecifier"),e("ImportNamespaceSpecifier"),e("ImportDefaultSpecifier"))],t.emptyArray).field("source",e("ModuleSpecifier"));e("TaggedTemplateExpression").bases("Expression").field("tag",e("Expression")).field("quasi",e("TemplateLiteral"));e("TemplateLiteral").bases("Expression").build("quasis","expressions").field("quasis",[e("TemplateElement")]).field("expressions",[e("Expression")]);e("TemplateElement").bases("Node").build("value","tail").field("value",{cooked:i,raw:i}).field("tail",r)},{"../lib/shared":106,"../lib/types":107,"./core":95}],98:[function(n,s,o){n("./core");var t=n("../lib/types");var e=t.Type.def;var r=t.Type.or;var i=t.builtInTypes;var l=i.boolean;var a=n("../lib/shared").defaults;e("Function").field("async",l,a["false"]);e("SpreadProperty").bases("Node").build("argument").field("argument",e("Expression"));e("ObjectExpression").field("properties",[r(e("Property"),e("SpreadProperty"))]);e("SpreadPropertyPattern").bases("Pattern").build("argument").field("argument",e("Pattern"));e("ObjectPattern").field("properties",[r(e("PropertyPattern"),e("SpreadPropertyPattern"))]);e("AwaitExpression").bases("Expression").build("argument","all").field("argument",r(e("Expression"),null)).field("all",l,a["false"])},{"../lib/shared":106,"../lib/types":107,"./core":95}],99:[function(a,c,f){a("./core");var s=a("../lib/types");var e=s.Type.def;var n=s.Type.or;var u=s.builtInTypes;var l=u.string;var r=u.boolean;var t=a("../lib/shared").defaults;e("XJSAttribute").bases("Node").build("name","value").field("name",n(e("XJSIdentifier"),e("XJSNamespacedName"))).field("value",n(e("Literal"),e("XJSExpressionContainer"),null),t["null"]);e("XJSIdentifier").bases("Node").build("name").field("name",l);e("XJSNamespacedName").bases("Node").build("namespace","name").field("namespace",e("XJSIdentifier")).field("name",e("XJSIdentifier"));e("XJSMemberExpression").bases("MemberExpression").build("object","property").field("object",n(e("XJSIdentifier"),e("XJSMemberExpression"))).field("property",e("XJSIdentifier")).field("computed",r,t.false);var i=n(e("XJSIdentifier"),e("XJSNamespacedName"),e("XJSMemberExpression"));e("XJSSpreadAttribute").bases("Node").build("argument").field("argument",e("Expression"));var o=[n(e("XJSAttribute"),e("XJSSpreadAttribute"))];e("XJSExpressionContainer").bases("Expression").build("expression").field("expression",e("Expression"));e("XJSElement").bases("Expression").build("openingElement","closingElement","children").field("openingElement",e("XJSOpeningElement")).field("closingElement",n(e("XJSClosingElement"),null),t["null"]).field("children",[n(e("XJSElement"),e("XJSExpressionContainer"),e("XJSText"),e("Literal"))],t.emptyArray).field("name",i,function(){return this.openingElement.name}).field("selfClosing",r,function(){return this.openingElement.selfClosing}).field("attributes",o,function(){return this.openingElement.attributes});e("XJSOpeningElement").bases("Node").build("name","attributes","selfClosing").field("name",i).field("attributes",o,t.emptyArray).field("selfClosing",r,t["false"]);e("XJSClosingElement").bases("Node").build("name").field("name",i);e("XJSText").bases("Literal").build("value").field("value",l);e("XJSEmptyExpression").bases("Expression").build();e("Type").bases("Node");e("AnyTypeAnnotation").bases("Type");e("VoidTypeAnnotation").bases("Type");e("NumberTypeAnnotation").bases("Type");e("StringTypeAnnotation").bases("Type");e("StringLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",l).field("raw",l);e("BooleanTypeAnnotation").bases("Type");e("TypeAnnotation").bases("Node").build("typeAnnotation").field("typeAnnotation",e("Type"));e("NullableTypeAnnotation").bases("Type").build("typeAnnotation").field("typeAnnotation",e("Type"));e("FunctionTypeAnnotation").bases("Type").build("params","returnType","rest","typeParameters").field("params",[e("FunctionTypeParam")]).field("returnType",e("Type")).field("rest",n(e("FunctionTypeParam"),null)).field("typeParameters",n(e("TypeParameterDeclaration"),null));e("FunctionTypeParam").bases("Node").build("name","typeAnnotation","optional").field("name",e("Identifier")).field("typeAnnotation",e("Type")).field("optional",r);e("ObjectTypeAnnotation").bases("Type").build("properties").field("properties",[e("ObjectTypeProperty")]).field("indexers",[e("ObjectTypeIndexer")],t.emptyArray).field("callProperties",[e("ObjectTypeCallProperty")],t.emptyArray);
e("ObjectTypeProperty").bases("Node").build("key","value","optional").field("key",n(e("Literal"),e("Identifier"))).field("value",e("Type")).field("optional",r);e("ObjectTypeIndexer").bases("Node").build("id","key","value").field("id",e("Identifier")).field("key",e("Type")).field("value",e("Type"));e("ObjectTypeCallProperty").bases("Node").build("value").field("value",e("FunctionTypeAnnotation")).field("static",r,false);e("QualifiedTypeIdentifier").bases("Node").build("qualification","id").field("qualification",n(e("Identifier"),e("QualifiedTypeIdentifier"))).field("id",e("Identifier"));e("GenericTypeAnnotation").bases("Type").build("id","typeParameters").field("id",n(e("Identifier"),e("QualifiedTypeIdentifier"))).field("typeParameters",n(e("TypeParameterInstantiation"),null));e("MemberTypeAnnotation").bases("Type").build("object","property").field("object",e("Identifier")).field("property",n(e("MemberTypeAnnotation"),e("GenericTypeAnnotation")));e("UnionTypeAnnotation").bases("Type").build("types").field("types",[e("Type")]);e("IntersectionTypeAnnotation").bases("Type").build("types").field("types",[e("Type")]);e("TypeofTypeAnnotation").bases("Type").build("argument").field("argument",e("Type"));e("Identifier").field("typeAnnotation",n(e("TypeAnnotation"),null),t["null"]);e("TypeParameterDeclaration").bases("Node").build("params").field("params",[e("Identifier")]);e("TypeParameterInstantiation").bases("Node").build("params").field("params",[e("Type")]);e("Function").field("returnType",n(e("TypeAnnotation"),null),t["null"]).field("typeParameters",n(e("TypeParameterDeclaration"),null),t["null"]);e("ClassProperty").build("key","typeAnnotation").field("typeAnnotation",e("TypeAnnotation")).field("static",r,false);e("ClassImplements").field("typeParameters",n(e("TypeParameterInstantiation"),null),t["null"]);e("InterfaceDeclaration").bases("Statement").build("id","body","extends").field("id",e("Identifier")).field("typeParameters",n(e("TypeParameterDeclaration"),null),t["null"]).field("body",e("ObjectTypeAnnotation")).field("extends",[e("InterfaceExtends")]);e("InterfaceExtends").bases("Node").build("id").field("id",e("Identifier")).field("typeParameters",n(e("TypeParameterInstantiation"),null));e("TypeAlias").bases("Statement").build("id","typeParameters","right").field("id",e("Identifier")).field("typeParameters",n(e("TypeParameterDeclaration"),null)).field("right",e("Type"));e("TupleTypeAnnotation").bases("Type").build("types").field("types",[e("Type")]);e("DeclareVariable").bases("Statement").build("id").field("id",e("Identifier"));e("DeclareFunction").bases("Statement").build("id").field("id",e("Identifier"));e("DeclareClass").bases("InterfaceDeclaration").build("id");e("DeclareModule").bases("Statement").build("id","body").field("id",n(e("Identifier"),e("Literal"))).field("body",e("BlockStatement"))},{"../lib/shared":106,"../lib/types":107,"./core":95}],100:[function(n,a,i){n("./core");var t=n("../lib/types");var e=t.Type.def;var l=t.Type.or;var r=n("../lib/shared").geq;e("ForOfStatement").bases("Statement").build("left","right","body").field("left",l(e("VariableDeclaration"),e("Expression"))).field("right",e("Expression")).field("body",e("Statement"));e("LetStatement").bases("Statement").build("head","body").field("head",[e("VariableDeclarator")]).field("body",e("Statement"));e("LetExpression").bases("Expression").build("head","body").field("head",[e("VariableDeclarator")]).field("body",e("Expression"));e("GraphExpression").bases("Expression").build("index","expression").field("index",r(0)).field("expression",e("Literal"));e("GraphIndexExpression").bases("Expression").build("index").field("index",r(0))},{"../lib/shared":106,"../lib/types":107,"./core":95}],101:[function(s,p,g){var n=s("assert");var e=s("../main");var o=e.getFieldNames;var i=e.getFieldValue;var t=e.builtInTypes.array;var r=e.builtInTypes.object;var u=e.builtInTypes.Date;var c=e.builtInTypes.RegExp;var f=Object.prototype.hasOwnProperty;function a(n,r,e){if(t.check(e)){e.length=0}else{e=null}return l(n,r,e)}a.assert=function(t,r){var e=[];if(!a(t,r,e)){if(e.length===0){n.strictEqual(t,r)}else{n.ok(false,"Nodes differ in the following path: "+e.map(d).join(""))}}};function d(e){if(/[_$a-z][_$a-z0-9]*/i.test(e)){return"."+e}return"["+JSON.stringify(e)+"]"}function l(e,n,l){if(e===n){return true}if(t.check(e)){return m(e,n,l)}if(r.check(e)){return h(e,n,l)}if(u.check(e)){return u.check(n)&&+e===+n}if(c.check(e)){return c.check(n)&&(e.source===n.source&&e.global===n.global&&e.multiline===n.multiline&&e.ignoreCase===n.ignoreCase)}return e==n}function m(a,i,r){t.assert(a);var s=a.length;if(!t.check(i)||i.length!==s){if(r){r.push("length")}return false}for(var e=0;e<s;++e){if(r){r.push(e)}if(e in a!==e in i){return false}if(!l(a[e],i[e],r)){return false}if(r){n.strictEqual(r.pop(),e)}}return true}function h(s,c,t){r.assert(s);if(!r.check(c)){return false}if(s.type!==c.type){if(t){t.push("type")}return false}var d=o(s);var p=d.length;var m=o(c);var h=m.length;if(p===h){for(var e=0;e<p;++e){var a=d[e];var g=i(s,a);var y=i(c,a);if(t){t.push(a)}if(!l(g,y,t)){return false}if(t){n.strictEqual(t.pop(),a)}}return true}if(!t){return false}var u=Object.create(null);for(e=0;e<p;++e){u[d[e]]=true}for(e=0;e<h;++e){a=m[e];if(!f.call(u,a)){t.push(a);return false}delete u[a]}for(a in u){t.push(a);break}return false}p.exports=a},{"../main":108,assert:110}],102:[function(l,f,x){var n=l("assert");var r=l("./types");var e=r.namedTypes;var c=r.builders;var m=r.builtInTypes.number;var p=r.builtInTypes.array;var o=l("./path");var u=l("./scope");function a(e,t,r){n.ok(this instanceof a);o.call(this,e,t,r)}l("util").inherits(a,o);var t=a.prototype;Object.defineProperties(t,{node:{get:function(){Object.defineProperty(this,"node",{configurable:true,value:this._computeNode()});return this.node}},parent:{get:function(){Object.defineProperty(this,"parent",{configurable:true,value:this._computeParent()});return this.parent}},scope:{get:function(){Object.defineProperty(this,"scope",{configurable:true,value:this._computeScope()});return this.scope}}});t.replace=function(){delete this.node;delete this.parent;delete this.scope;return o.prototype.replace.apply(this,arguments)};t.prune=function(){var e=this.parent;this.replace();return g(e)};t._computeNode=function(){var n=this.value;if(e.Node.check(n)){return n}var t=this.parentPath;return t&&t.node||null};t._computeParent=function(){var t=this.value;var n=this.parentPath;if(!e.Node.check(t)){while(n&&!e.Node.check(n.value)){n=n.parentPath}if(n){n=n.parentPath}}while(n&&!e.Node.check(n.value)){n=n.parentPath}return n||null};t._computeScope=function(){var t=this.value;var r=this.parentPath;var n=r&&r.scope;if(e.Node.check(t)&&u.isEstablishedBy(t)){n=new u(this,n)}return n||null};t.getValueProperty=function(e){return r.getFieldValue(this.value,e)};t.needsParens=function(o){var l=this.parentPath;if(!l){return false}var r=this.value;if(!e.Expression.check(r)){return false}if(r.type==="Identifier"){return false}while(!e.Node.check(l.value)){l=l.parentPath;if(!l){return false}}var t=l.value;switch(r.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return t.type==="MemberExpression"&&this.name==="object"&&t.object===r;case"BinaryExpression":case"LogicalExpression":switch(t.type){case"CallExpression":return this.name==="callee"&&t.callee===r;case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return true;case"MemberExpression":return this.name==="object"&&t.object===r;case"BinaryExpression":case"LogicalExpression":var u=t.operator;var l=s[u];var c=r.operator;var a=s[c];if(l>a){return true}if(l===a&&this.name==="right"){n.strictEqual(t.right,r);return true}default:return false}case"SequenceExpression":switch(t.type){case"ForStatement":return false;case"ExpressionStatement":return this.name!=="expression";default:return true}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 true;default:return false}case"Literal":return t.type==="MemberExpression"&&m.check(r.value)&&this.name==="object"&&t.object===r;case"AssignmentExpression":case"ConditionalExpression":switch(t.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":return true;case"CallExpression":return this.name==="callee"&&t.callee===r;case"ConditionalExpression":return this.name==="test"&&t.test===r;case"MemberExpression":return this.name==="object"&&t.object===r;default:return false}default:if(t.type==="NewExpression"&&this.name==="callee"&&t.callee===r){return i(r)}}if(o!==true&&!this.canBeFirstInStatement()&&this.firstInStatement())return true;return false};function d(n){return e.BinaryExpression.check(n)||e.LogicalExpression.check(n)}function v(n){return e.UnaryExpression.check(n)||e.SpreadElement&&e.SpreadElement.check(n)||e.SpreadProperty&&e.SpreadProperty.check(n)}var s={};[["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]].forEach(function(e,n){e.forEach(function(e){s[e]=n})});function i(n){if(e.CallExpression.check(n)){return true}if(p.check(n)){return n.some(i)}if(e.Node.check(n)){return r.someField(n,function(n,e){return i(e)})}return false}t.canBeFirstInStatement=function(){var n=this.node;return!e.FunctionExpression.check(n)&&!e.ObjectExpression.check(n)};t.firstInStatement=function(){return h(this)};function h(r){for(var l,t;r.parent;r=r.parent){l=r.node;t=r.parent.node;if(e.BlockStatement.check(t)&&r.parent.name==="body"&&r.name===0){n.strictEqual(t.body[0],l);return true}if(e.ExpressionStatement.check(t)&&r.name==="expression"){n.strictEqual(t.expression,l);return true}if(e.SequenceExpression.check(t)&&r.parent.name==="expressions"&&r.name===0){n.strictEqual(t.expressions[0],l);continue}if(e.CallExpression.check(t)&&r.name==="callee"){n.strictEqual(t.callee,l);continue}if(e.MemberExpression.check(t)&&r.name==="object"){n.strictEqual(t.object,l);continue}if(e.ConditionalExpression.check(t)&&r.name==="test"){n.strictEqual(t.test,l);continue}if(d(t)&&r.name==="left"){n.strictEqual(t.left,l);continue}if(e.UnaryExpression.check(t)&&!t.prefix&&r.name==="argument"){n.strictEqual(t.argument,l);continue}return false}return true}function g(n){if(e.VariableDeclaration.check(n.node)){var t=n.get("declarations").value;if(!t||t.length===0){return n.prune()}}else if(e.ExpressionStatement.check(n.node)){if(!n.get("expression").value){return n.prune()}}else if(e.IfStatement.check(n.node)){y(n)}return n}function y(n){var t=n.get("test").value;var r=n.get("alternate").value;var l=n.get("consequent").value;if(!l&&!r){var i=c.expressionStatement(t);n.replace(i)}else if(!l&&r){var a=c.unaryExpression("!",t,true);if(e.UnaryExpression.check(t)&&t.operator==="!"){a=t.argument}n.get("test").replace(a);n.get("consequent").replace(r);n.get("alternate").replace()}}f.exports=a},{"./path":104,"./scope":105,"./types":107,assert:110,util:134}],103:[function(s,m,x){var e=s("assert");var l=s("./types");var t=s("./node-path");var v=l.namedTypes.Node;var p=l.builtInTypes.array;var u=l.builtInTypes.object;var o=l.builtInTypes.function;var c=Object.prototype.hasOwnProperty;var g;function n(){e.ok(this instanceof n);this._reusableContextStack=[];this._methodNameTable=d(this);this.Context=y(this);this._visiting=false;this._changeReported=false}function d(r){var n=Object.create(null);for(var e in r){if(/^visit[A-Z]/.test(e)){n[e.slice("visit".length)]=true}}var a=l.computeSupertypeLookupTable(n);var i=Object.create(null);var n=Object.keys(a);var u=n.length;for(var t=0;t<u;++t){var s=n[t];e="visit"+a[s];if(o.check(r[e])){i[s]=e}}return i}n.fromMethodsObject=function b(l){if(l instanceof n){return l}if(!u.check(l)){return new n}function t(){e.ok(this instanceof t);n.call(this)}var a=t.prototype=Object.create(r);a.constructor=t;i(a,l);i(t,n);o.assert(t.fromMethodsObject);o.assert(t.visit);return new t};function i(t,e){for(var n in e){if(c.call(e,n)){t[n]=e[n]}}return t}n.visit=function E(e,t){return n.fromMethodsObject(t).visit(e)};var r=n.prototype;var h=["Recursively calling visitor.visit(path) resets visitor state.","Try this.visit(path) or this.traverse(path) instead."].join(" ");r.visit=function(){e.ok(!this._visiting,h);this._visiting=true;this._changeReported=false;var l=arguments.length;var n=new Array(l);for(var r=0;r<l;++r){n[r]=arguments[r]}if(!(n[0]instanceof t)){n[0]=new t({root:n[0]}).get("root")}this.reset.apply(this,n);try{return this.visitWithoutReset(n[0])}finally{this._visiting=false}};r.reset=function(e){};r.visitWithoutReset=function(n){if(this instanceof this.Context){return this.visitor.visitWithoutReset(n)}e.ok(n instanceof t);var r=n.value;var l=v.check(r)&&this._methodNameTable[r.type];if(l){var a=this.acquireContext(n);try{return a.invokeVisitorMethod(l)}finally{this.releaseContext(a)}}else{return f(n,this)}};function f(i,s){e.ok(i instanceof t);e.ok(s instanceof n);var r=i.value;if(p.check(r)){i.each(s.visitWithoutReset,s)}else if(!u.check(r)){}else{var f=l.getFieldNames(r);var d=f.length;var m=[];for(var a=0;a<d;++a){var o=f[a];if(!c.call(r,o)){r[o]=l.getFieldValue(r,o)}m.push(i.get(o))}for(var a=0;a<d;++a){s.visitWithoutReset(m[a])}}return i.value}r.acquireContext=function(e){if(this._reusableContextStack.length===0){return new this.Context(e)}return this._reusableContextStack.pop().reset(e)};r.releaseContext=function(n){e.ok(n instanceof this.Context);this._reusableContextStack.push(n);n.currentPath=null};r.reportChanged=function(){this._changeReported=true};r.wasChangeReported=function(){return this._changeReported};function y(l){function r(a){e.ok(this instanceof r);e.ok(this instanceof n);e.ok(a instanceof t);Object.defineProperty(this,"visitor",{value:l,writable:false,enumerable:true,configurable:false});this.currentPath=a;this.needToCallTraverse=true;Object.seal(this)}e.ok(l instanceof n);var s=r.prototype=Object.create(l);s.constructor=r;i(s,a);return r}var a=Object.create(null);a.reset=function w(n){e.ok(this instanceof this.Context);e.ok(n instanceof t);this.currentPath=n;this.needToCallTraverse=true;return this};a.invokeVisitorMethod=function _(r){e.ok(this instanceof this.Context);e.ok(this.currentPath instanceof t);var n=this.visitor[r].call(this,this.currentPath);if(n===false){this.needToCallTraverse=false}else if(n!==g){this.currentPath=this.currentPath.replace(n)[0];if(this.needToCallTraverse){this.traverse(this.currentPath)}}e.strictEqual(this.needToCallTraverse,false,"Must either call this.traverse or return false in "+r);var l=this.currentPath;return l&&l.value};a.traverse=function S(r,l){e.ok(this instanceof this.Context);e.ok(r instanceof t);e.ok(this.currentPath instanceof t);this.needToCallTraverse=false;return f(r,n.fromMethodsObject(l||this.visitor))};a.visit=function k(r,l){e.ok(this instanceof this.Context);e.ok(r instanceof t);e.ok(this.currentPath instanceof t);this.needToCallTraverse=false;return n.fromMethodsObject(l||this.visitor).visitWithoutReset(r)};a.reportChanged=function I(){this.visitor.reportChanged()};m.exports=n},{"./node-path":102,"./types":107,assert:110}],104:[function(c,p,v){var n=c("assert");var m=Object.prototype;var i=m.hasOwnProperty;var u=c("./types");var r=u.builtInTypes.array;var f=u.builtInTypes.number;var o=Array.prototype;var y=o.slice;var g=o.map;function l(r,e,t){n.ok(this instanceof l);if(e){n.ok(e instanceof l)}else{e=null;t=null}this.value=r;this.parentPath=e;this.name=t;this.__childCache=null}var e=l.prototype;function t(e){return e.__childCache||(e.__childCache=Object.create(null))}function d(n,e){var r=t(n);var a=n.getValueProperty(e);var l=r[e];if(!i.call(r,e)||l.value!==a){l=r[e]=new n.constructor(a,n,e)}return l}e.getValueProperty=function x(e){return this.value[e]};e.get=function b(l){var e=this;var t=arguments;var r=t.length;for(var n=0;n<r;++n){e=d(e,t[n])}return e};e.each=function E(l,n){var t=[];var r=this.value.length;var e=0;for(var e=0;e<r;++e){if(i.call(this.value,e)){t[e]=this.get(e)}}n=n||this;for(e=0;e<r;++e){if(i.call(t,e)){l.call(n,t[e])}}};e.map=function w(n,t){var e=[];this.each(function(t){e.push(n.call(this,t))},t);return e};e.filter=function _(n,t){var e=[];this.each(function(t){if(n.call(this,t)){e.push(t)}},t);return e};function s(){}function a(a,h,e,o){r.assert(a.value);if(h===0){return s}var u=a.value.length;if(u<1){return s}var g=arguments.length;if(g===2){e=0;o=u}else if(g===3){e=Math.max(e,0);o=u}else{e=Math.max(e,0);o=Math.min(o,u)}f.assert(e);f.assert(o);var c=Object.create(null);var p=t(a);for(var l=e;l<o;++l){if(i.call(a.value,l)){var d=a.get(l);n.strictEqual(d.name,l);var m=l+h;d.name=m;c[m]=d;delete p[l]}}delete p.length;return function(){for(var e in c){var t=c[e];n.strictEqual(t.name,+e);p[e]=t;a.value[e]=t.value}}}e.shift=function S(){var e=a(this,-1);var n=this.value.shift();e();return n};e.unshift=function k(t){var e=a(this,arguments.length);var n=this.value.unshift.apply(this.value,arguments);e();return n};e.push=function I(e){r.assert(this.value);delete t(this).length;return this.value.push.apply(this.value,arguments)};e.pop=function R(){r.assert(this.value);var e=t(this);delete e[this.value.length-1];delete e.length;return this.value.pop()};e.insertAt=function C(e,l){var t=arguments.length;var r=a(this,t-1,e);if(r===s){return this}e=Math.max(e,0);for(var n=1;n<t;++n){this.value[e+n-1]=arguments[n]}r();return this};e.insertBefore=function A(l){var n=this.parentPath;var r=arguments.length;var t=[this.name];for(var e=0;e<r;++e){t.push(arguments[e])}return n.insertAt.apply(n,t)};e.insertAfter=function T(l){var n=this.parentPath;var r=arguments.length;var t=[this.name+1];for(var e=0;e<r;++e){t.push(arguments[e])}return n.insertAt.apply(n,t)};function h(e){n.ok(e instanceof l);var i=e.parentPath;if(!i){return e}var a=i.value;var s=t(i);if(a[e.name]===e.value){s[e.name]=e}else if(r.check(a)){var o=a.indexOf(e.value);if(o>=0){s[e.name=o]=e}}else{a[e.name]=e.value;s[e.name]=e}n.strictEqual(a[e.name],e.value);n.strictEqual(e.parentPath.get(e.name),e);return e}e.replace=function L(s){var o=[];var e=this.parentPath.value;var p=t(this.parentPath);var l=arguments.length;h(this);if(r.check(e)){var c=e.length;var f=a(this.parentPath,l-1,this.name+1);var u=[this.name,1];for(var i=0;i<l;++i){u.push(arguments[i])}var d=e.splice.apply(e,u);n.strictEqual(d[0],this.value);n.strictEqual(e.length,c-1+l);f();if(l===0){delete this.value;delete p[this.name];this.__childCache=null}else{n.strictEqual(e[this.name],s);if(this.value!==s){this.value=s;this.__childCache=null}for(i=0;i<l;++i){o.push(this.parentPath.get(this.name+i))}n.strictEqual(o[0],this)}}else if(l===1){if(this.value!==s){this.__childCache=null}this.value=e[this.name]=s;o.push(this)}else if(l===0){delete e[this.name];delete this.value;this.__childCache=null}else{n.ok(false,"Could not replace path")}return o};p.exports=l},{"./types":107,assert:110}],105:[function(o,m,x){var l=o("assert");var r=o("./types");var d=r.Type;var e=r.namedTypes;var y=e.Node;var p=e.Expression;var h=r.builtInTypes.array;var c=Object.prototype.hasOwnProperty;var f=r.builders;function a(n,e){l.ok(this instanceof a);l.ok(n instanceof o("./node-path"));s.assert(n.value);var t;if(e){l.ok(e instanceof a);t=e.depth+1}else{e=null;t=0}Object.defineProperties(this,{path:{value:n},node:{value:n.value},isGlobal:{value:!e,enumerable:true},depth:{value:t},parent:{value:e},bindings:{value:{}}})}var g=[e.Program,e.Function,e.CatchClause];var s=d.or.apply(d,g);a.isEstablishedBy=function(e){return s.check(e)};var t=a.prototype;t.didScan=false;t.declares=function(e){this.scan();return c.call(this.bindings,e)};t.declareTemporary=function(e){if(e){l.ok(/^[a-z$_]/i.test(e),e)}else{e="t$"}e+=this.depth.toString(36)+"$";this.scan();var n=0;while(this.declares(e+n)){++n}var t=e+n;return this.bindings[t]=r.builders.identifier(t)};t.injectTemporary=function(n,r){n||(n=this.declareTemporary());var t=this.path.get("body");if(e.BlockStatement.check(t.value)){t=t.get("body")}t.unshift(f.variableDeclaration("var",[f.variableDeclarator(n,r||null)]));return n};t.scan=function(e){if(e||!this.didScan){for(var n in this.bindings){delete this.bindings[n]}v(this.path,this.bindings);this.didScan=true}};t.getBindings=function(){this.scan();return this.bindings};function v(t,r){var l=t.value;s.assert(l);if(e.CatchClause.check(l)){n(t.get("param"),r)}else{u(t,r)}}function u(t,s){var a=t.value;if(t.parent&&e.FunctionExpression.check(t.parent.node)&&t.parent.node.id){n(t.parent.get("id"),s)}if(!a){}else if(h.check(a)){t.each(function(e){i(e,s)})}else if(e.Function.check(a)){t.get("params").each(function(e){n(e,s)});i(t.get("body"),s)}else if(e.VariableDeclarator.check(a)){n(t.get("id"),s);i(t.get("init"),s)}else if(a.type==="ImportSpecifier"||a.type==="ImportNamespaceSpecifier"||a.type==="ImportDefaultSpecifier"){n(a.name?t.get("name"):t.get("id"),s)}else if(y.check(a)&&!p.check(a)){r.eachField(a,function(n,r){var e=t.get(n);l.strictEqual(e.value,r);i(e,s)})}}function i(l,r){var t=l.value;if(!t||p.check(t)){}else if(e.FunctionDeclaration.check(t)){n(l.get("id"),r)}else if(e.ClassDeclaration&&e.ClassDeclaration.check(t)){n(l.get("id"),r)}else if(s.check(t)){if(e.CatchClause.check(t)){var a=t.param.name;var i=c.call(r,a);u(l.get("body"),r);if(!i){delete r[a]}}}else{u(l,r)}}function n(r,l){var t=r.value;e.Pattern.assert(t);if(e.Identifier.check(t)){if(c.call(l,t.name)){l[t.name].push(r)}else{l[t.name]=[r]}}else if(e.SpreadElement&&e.SpreadElement.check(t)){n(r.get("argument"),l)}}t.lookup=function(n){for(var e=this;e;e=e.parent)if(e.declares(n))break;return e};t.getGlobalScope=function(){var e=this;while(!e.isGlobal)e=e.parent;return e};m.exports=a},{"./node-path":102,"./types":107,assert:110}],106:[function(a,s,n){var r=a("../lib/types");var t=r.Type;var e=r.builtInTypes;var l=e.number;n.geq=function(e){return new t(function(n){return l.check(n)&&n>=e},l+" >= "+e)};n.defaults={"null":function(){return null},emptyArray:function(){return[]},"false":function(){return false},"true":function(){return true},undefined:function(){}};var i=t.or(e.string,e.number,e.boolean,e.null,e.undefined);n.isPrimitive=new t(function(e){if(e===null)return true;var n=typeof e;return!(n==="object"||n==="function")},i.toString())},{"../lib/types":107}],107:[function(T,N,r){var e=T("assert");var E=Array.prototype;var A=E.slice;var F=E.map;var O=E.forEach;var k=Object.prototype;var o=k.toString;var v=o.call(function(){});var P=o.call("");var l=k.hasOwnProperty;function n(r,l){var t=this;e.ok(t instanceof n,t);e.strictEqual(o.call(r),v,r+" is not a function");var a=o.call(l);e.ok(a===v||a===P,l+" is neither a function nor a string");Object.defineProperties(t,{name:{value:l},check:{value:function(n,e){var l=r.call(t,n,e);if(!l&&e&&o.call(e)===v)e(t,n);return l}}})}var w=n.prototype;r.Type=n;w.assert=function(n,t){if(!this.check(n,t)){var r=h(n);e.ok(false,r+" does not match type "+this);return false}return true};function h(e){if(u.check(e))return"{"+Object.keys(e).map(function(n){return n+": "+e[n]}).join(", ")+"}";if(p.check(e))return"["+e.map(h).join(", ")+"]";return JSON.stringify(e)}w.toString=function(){var e=this.name;if(c.check(e))return e;if(f.check(e))return e.call(this)+"";return e+" type"};var g={};r.builtInTypes=g;function a(t,e){var r=o.call(t);Object.defineProperty(g,e,{enumerable:true,value:new n(function(e){return o.call(e)===r},e)});return g[e]}var c=a("","string");var f=a(function(){},"function");var p=a([],"array");var u=a({},"object");var B=a(/./,"RegExp");var U=a(new Date,"Date");var L=a(3,"number");var V=a(true,"boolean");var D=a(null,"null");var S=a(void 0,"undefined");function _(e,t){if(e instanceof n)return e;if(e instanceof s)return e.type;if(p.check(e))return n.fromArray(e);if(u.check(e))return n.fromObject(e);if(f.check(e))return new n(e,t);return new n(function(n){return n===e},S.check(t)?function(){return e+""}:t)}n.or=function(){var e=[];var r=arguments.length;for(var t=0;t<r;++t)e.push(_(arguments[t]));return new n(function(t,l){for(var n=0;n<r;++n)if(e[n].check(t,l))return true;return false},function(){return e.join(" | ")})};n.fromArray=function(n){e.ok(p.check(n));e.strictEqual(n.length,1,"only one element type is permitted for typed arrays");return _(n[0]).arrayOf()};w.arrayOf=function(){var e=this;return new n(function(n,t){return p.check(n)&&n.every(function(n){return e.check(n,t)})},function(){return"["+e+"]"})};n.fromObject=function(e){var t=Object.keys(e).map(function(n){return new m(n,e[n])});return new n(function(e,n){return u.check(e)&&t.every(function(t){return t.type.check(e[t.name],n)})},function(){return"{ "+t.join(", ")+" }"})};function m(t,n,r,i){var l=this;e.ok(l instanceof m);c.assert(t);n=_(n);var a={name:{value:t},type:{value:n},hidden:{value:!!i}};if(f.check(r)){a.defaultFn={value:r}}Object.defineProperties(l,a)}var I=m.prototype;I.toString=function(){return JSON.stringify(this.name)+": "+this.type};I.getValue=function(n){var e=n[this.name];if(!S.check(e))return e;if(this.defaultFn)e=this.defaultFn.call(n);return e};n.def=function(e){c.assert(e);return l.call(t,e)?t[e]:t[e]=new s(e)};var t=Object.create(null);function s(r){var t=this;e.ok(t instanceof s);Object.defineProperties(t,{typeName:{value:r},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,n){return t.check(e,n)},r)}})}s.fromValue=function(e){if(e&&typeof e==="object"){var n=e.type;if(typeof n==="string"&&l.call(t,n)){var r=t[n];if(r.finalized){return r}}}return null};var i=s.prototype;i.isSupertypeOf=function(n){if(n instanceof s){e.strictEqual(this.finalized,true);e.strictEqual(n.finalized,true);return l.call(n.allSupertypes,this.typeName)}else{e.ok(false,n+" is not a Def")}};r.getSupertypeNames=function(n){e.ok(l.call(t,n));var r=t[n];e.strictEqual(r.finalized,true);return r.supertypeList.slice(1)};r.computeSupertypeLookupTable=function(c){var i={};var s=Object.keys(t);var f=s.length;for(var n=0;n<f;++n){var o=s[n];var r=t[o];e.strictEqual(r.finalized,true);for(var a=0;a<r.supertypeList.length;++a){var u=r.supertypeList[a];if(l.call(c,u)){i[o]=u;break}}}return i};i.checkAllFields=function(n,r){var t=this.allFields;e.strictEqual(this.finalized,true);function l(l){var e=t[l];var a=e.type;var i=e.getValue(n);return a.check(i,r)}return u.check(n)&&Object.keys(t).every(l)};i.check=function(n,t){e.strictEqual(this.finalized,true,"prematurely checking unfinalized type "+this.typeName);if(!u.check(n))return false;var r=s.fromValue(n);if(!r){if(this.typeName==="SourceLocation"||this.typeName==="Position"){return this.checkAllFields(n,t)}return false}if(t&&r===this)return this.checkAllFields(n,t);if(!this.isSupertypeOf(r))return false;if(!t)return true;return r.checkAllFields(n,t)&&this.checkAllFields(n,false)};i.bases=function(){var n=this.baseNames;e.strictEqual(this.finalized,false);O.call(arguments,function(e){c.assert(e);if(n.indexOf(e)<0)n.push(e)});return this};Object.defineProperty(i,"buildable",{value:false});var C={};r.builders=C;var d={};r.defineMethod=function(e,n){var t=d[e];if(S.check(n)){delete d[e]}else{f.assert(n);Object.defineProperty(d,e,{enumerable:true,configurable:true,value:n})}return t};i.build=function(){var n=this;Object.defineProperty(n,"buildParams",{value:A.call(arguments),writable:false,enumerable:false,configurable:true});e.strictEqual(n.finalized,false);c.arrayOf().assert(n.buildParams);if(n.buildable){return n}n.field("type",n.typeName,function(){return n.typeName});Object.defineProperty(n,"buildable",{value:true});Object.defineProperty(C,j(n.typeName),{enumerable:true,value:function(){var r=arguments;var i=r.length;var t=Object.create(d);e.ok(n.finalized,"attempting to instantiate unfinalized type "+n.typeName);function a(a,u){if(l.call(t,a))return;var c=n.allFields;e.ok(l.call(c,a),a);var o=c[a];var f=o.type;var s;if(L.check(u)&&u<i){s=r[u]}else if(o.defaultFn){s=o.defaultFn.call(t)}else{var p="no value or default function given for field "+JSON.stringify(a)+" of "+n.typeName+"("+n.buildParams.map(function(e){return c[e]}).join(", ")+")";e.ok(false,p)}if(!f.check(s)){e.ok(false,h(s)+" does not match field "+o+" of type "+n.typeName)}t[a]=s}n.buildParams.forEach(function(e,n){a(e,n)});Object.keys(n.allFields).forEach(function(e){a(e)});e.strictEqual(t.type,n.typeName);return t}});return n};function j(e){return e.replace(/^[A-Z]+/,function(e){var n=e.length;switch(n){case 0:return"";case 1:return e.toLowerCase();default:return e.slice(0,n-1).toLowerCase()+e.charAt(n-1)}})}i.field=function(n,t,r,l){e.strictEqual(this.finalized,false);this.ownFields[n]=new m(n,t,r,l);return this};var R={};r.namedTypes=R;function x(n){var t=s.fromValue(n);if(t){return t.fieldNames.slice(0)}if("type"in n){e.ok(false,"did not recognize object of type "+JSON.stringify(n.type))}return Object.keys(n)}r.getFieldNames=x;function y(e,n){var t=s.fromValue(e);if(t){var r=t.allFields[n];if(r){return r.getValue(e)}}return e[n]}r.getFieldValue=y;r.eachField=function(e,n,t){x(e).forEach(function(t){n.call(this,t,y(e,t))},t)};r.someField=function(e,n,t){return x(e).some(function(t){return n.call(this,t,y(e,t))},t)};Object.defineProperty(i,"finalized",{value:false});i.finalize=function(){if(!this.finalized){var e=this.allFields;var r=this.allSupertypes;this.baseNames.forEach(function(l){var n=t[l];n.finalize();b(e,n.allFields);b(r,n.allSupertypes)});b(e,this.ownFields);r[this.typeName]=this;this.fieldNames.length=0;for(var n in e){if(l.call(e,n)&&!e[n].hidden){this.fieldNames.push(n)}}Object.defineProperty(R,this.typeName,{enumerable:true,value:this.type});Object.defineProperty(this,"finalized",{value:true});M(this.typeName,this.supertypeList)}};function M(r,n){n.length=0;n.push(r);var s=Object.create(null);for(var a=0;a<n.length;++a){r=n[a];var u=t[r];e.strictEqual(u.finalized,true);if(l.call(s,r)){delete n[s[r]]}s[r]=a;n.push.apply(n,u.baseNames)}for(var o=0,i=o,c=n.length;i<c;++i){if(l.call(n,i)){n[o++]=n[i]}}n.length=o}function b(e,n){Object.keys(n).forEach(function(t){e[t]=n[t]});return e}r.finalize=function(){Object.keys(t).forEach(function(e){t[e].finalize()})}},{assert:110}],108:[function(t,r,e){var n=t("./lib/types");t("./def/core");t("./def/es6");t("./def/es7");t("./def/mozilla");t("./def/e4x");t("./def/fb-harmony");n.finalize();e.Type=n.Type;e.builtInTypes=n.builtInTypes;e.namedTypes=n.namedTypes;e.builders=n.builders;e.defineMethod=n.defineMethod;e.getFieldNames=n.getFieldNames;e.getFieldValue=n.getFieldValue;e.eachField=n.eachField;e.someField=n.someField;e.getSupertypeNames=n.getSupertypeNames;e.astNodesAreEquivalent=t("./lib/equiv");e.finalize=n.finalize;e.NodePath=t("./lib/node-path");e.PathVisitor=t("./lib/path-visitor");e.visit=e.PathVisitor.visit},{"./def/core":95,"./def/e4x":96,"./def/es6":97,"./def/es7":98,"./def/fb-harmony":99,"./def/mozilla":100,"./lib/equiv":101,"./lib/node-path":102,"./lib/path-visitor":103,"./lib/types":107}],109:[function(e,n,t){},{}],110:[function(h,p,y){var n=h("util/");var r=Array.prototype.slice;var d=Object.prototype.hasOwnProperty;var e=p.exports=o;e.AssertionError=function v(e){this.name="AssertionError";this.actual=e.actual;this.expected=e.expected;this.operator=e.operator;if(e.message){this.message=e.message;this.generatedMessage=false}else{this.message=g(this);this.generatedMessage=true}var r=e.stackStartFunction||t;if(Error.captureStackTrace){Error.captureStackTrace(this,r)}else{var l=new Error;if(l.stack){var n=l.stack;var i=r.name;var a=n.indexOf("\n"+i);if(a>=0){var s=n.indexOf("\n",a+1);n=n.substring(s+1)}this.stack=n}}};n.inherits(e.AssertionError,Error);function u(t,e){if(n.isUndefined(e)){return""+e}if(n.isNumber(e)&&!isFinite(e)){return e.toString()}if(n.isFunction(e)||n.isRegExp(e)){return e.toString()}return e
}function a(e,t){if(n.isString(e)){return e.length<t?e:e.slice(0,t)}else{return e}}function g(e){return a(JSON.stringify(e.actual,u),128)+" "+e.operator+" "+a(JSON.stringify(e.expected,u),128)}function t(n,t,r,l,a){throw new e.AssertionError({message:r,actual:n,expected:t,operator:l,stackStartFunction:a})}e.fail=t;function o(n,r){if(!n)t(n,true,r,"==",e.ok)}e.ok=o;e.equal=function x(n,r,l){if(n!=r)t(n,r,l,"==",e.equal)};e.notEqual=function b(n,r,l){if(n==r){t(n,r,l,"!=",e.notEqual)}};e.deepEqual=function E(n,r,a){if(!l(n,r)){t(n,r,a,"deepEqual",e.deepEqual)}};function l(e,t){if(e===t){return true}else if(n.isBuffer(e)&&n.isBuffer(t)){if(e.length!=t.length)return false;for(var r=0;r<e.length;r++){if(e[r]!==t[r])return false}return true}else if(n.isDate(e)&&n.isDate(t)){return e.getTime()===t.getTime()}else if(n.isRegExp(e)&&n.isRegExp(t)){return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase}else if(!n.isObject(e)&&!n.isObject(t)){return e==t}else{return m(e,t)}}function c(e){return Object.prototype.toString.call(e)=="[object Arguments]"}function m(e,t){if(n.isNullOrUndefined(e)||n.isNullOrUndefined(t))return false;if(e.prototype!==t.prototype)return false;if(n.isPrimitive(e)||n.isPrimitive(t)){return e===t}var o=c(e),p=c(t);if(o&&!p||!o&&p)return false;if(o){e=r.call(e);t=r.call(t);return l(e,t)}var i=s(e),u=s(t),f,a;if(i.length!=u.length)return false;i.sort();u.sort();for(a=i.length-1;a>=0;a--){if(i[a]!=u[a])return false}for(a=i.length-1;a>=0;a--){f=i[a];if(!l(e[f],t[f]))return false}return true}e.notDeepEqual=function w(n,r,a){if(l(n,r)){t(n,r,a,"notDeepEqual",e.notDeepEqual)}};e.strictEqual=function _(n,r,l){if(n!==r){t(n,r,l,"===",e.strictEqual)}};e.notStrictEqual=function S(n,r,l){if(n===r){t(n,r,l,"!==",e.notStrictEqual)}};function f(n,e){if(!n||!e){return false}if(Object.prototype.toString.call(e)=="[object RegExp]"){return e.test(n)}else if(n instanceof e){return true}else if(e.call({},n)===true){return true}return false}function i(a,i,e,l){var r;if(n.isString(e)){l=e;e=null}try{i()}catch(s){r=s}l=(e&&e.name?" ("+e.name+").":".")+(l?" "+l:".");if(a&&!r){t(r,e,"Missing expected exception"+l)}if(!a&&f(r,e)){t(r,e,"Got unwanted exception"+l)}if(a&&r&&e&&!f(r,e)||!a&&r){throw r}}e.throws=function(e,n,t){i.apply(this,[true].concat(r.call(arguments)))};e.doesNotThrow=function(e,n){i.apply(this,[false].concat(r.call(arguments)))};e.ifError=function(e){if(e){throw e}};var s=Object.keys||function(e){var n=[];for(var t in e){if(d.call(e,t))n.push(t)}return n}},{"util/":134}],111:[function(c,U,i){var u=c("base64-js");var l=c("ieee754");var f=c("is-array");i.Buffer=e;i.SlowBuffer=d;i.INSPECT_MAX_BYTES=50;e.poolSize=8192;var v=1073741823;var L={};e.TYPED_ARRAY_SUPPORT=function(){try{var n=new ArrayBuffer(0);var e=new Uint8Array(n);e.foo=function(){return 42};return 42===e.foo()&&typeof e.subarray==="function"&&new Uint8Array(1).subarray(1,1).byteLength===0}catch(t){return false}}();function e(n,i,s){if(!(this instanceof e))return new e(n,i,s);var a=typeof n;var r;if(a==="number")r=n>0?n>>>0:0;else if(a==="string"){r=e.byteLength(n,i)}else if(a==="object"&&n!==null){if(n.type==="Buffer"&&f(n.data))n=n.data;r=+n.length>0?Math.floor(+n.length):0}else throw new TypeError("must start with number, buffer, array or string");if(r>v)throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+v.toString(16)+" bytes");var l;if(e.TYPED_ARRAY_SUPPORT){l=e._augment(new Uint8Array(r))}else{l=this;l.length=r;l._isBuffer=true}var t;if(e.TYPED_ARRAY_SUPPORT&&typeof n.byteLength==="number"){l._set(n)}else if(j(n)){if(e.isBuffer(n)){for(t=0;t<r;t++)l[t]=n.readUInt8(t)}else{for(t=0;t<r;t++)l[t]=(n[t]%256+256)%256}}else if(a==="string"){l.write(n,0,i)}else if(a==="number"&&!e.TYPED_ARRAY_SUPPORT&&!s){for(t=0;t<r;t++){l[t]=0}}if(r>0&&r<=e.poolSize)l.parent=L;return l}function d(n,t,r){if(!(this instanceof d))return new d(n,t,r);var l=new e(n,t,r);delete l.parent;return l}e.isBuffer=function(e){return!!(e!=null&&e._isBuffer)};e.compare=function(t,r){if(!e.isBuffer(t)||!e.isBuffer(r))throw new TypeError("Arguments must be Buffers");var l=t.length;var a=r.length;for(var n=0,i=Math.min(l,a);n<i&&t[n]===r[n];n++){}if(n!==i){l=t[n];a=r[n]}if(l<a)return-1;if(a<l)return 1;return 0};e.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 true;default:return false}};e.concat=function(n,r){if(!f(n))throw new TypeError("Usage: Buffer.concat(list[, length])");if(n.length===0){return new e(0)}else if(n.length===1){return n[0]}var t;if(r===undefined){r=0;for(t=0;t<n.length;t++){r+=n[t].length}}var l=new e(r);var a=0;for(t=0;t<n.length;t++){var i=n[t];i.copy(l,a);a+=i.length}return l};e.byteLength=function(e,t){var n;e=e+"";switch(t||"utf8"){case"ascii":case"binary":case"raw":n=e.length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n=e.length*2;break;case"hex":n=e.length>>>1;break;case"utf8":case"utf-8":n=p(e).length;break;case"base64":n=y(e).length;break;default:n=e.length}return n};e.prototype.length=undefined;e.prototype.parent=undefined;e.prototype.toString=function(t,n,e){var r=false;n=n>>>0;e=e===undefined||e===Infinity?this.length:e>>>0;if(!t)t="utf8";if(n<0)n=0;if(e>this.length)e=this.length;if(e<=n)return"";while(true){switch(t){case"hex":return B(this,n,e);case"utf8":case"utf-8":return k(this,n,e);case"ascii":return S(this,n,e);case"binary":return _(this,n,e);case"base64":return I(this,n,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,n,e);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase();r=true}}};e.prototype.equals=function(n){if(!e.isBuffer(n))throw new TypeError("Argument must be a Buffer");return e.compare(this,n)===0};e.prototype.inspect=function(){var e="";var n=i.INSPECT_MAX_BYTES;if(this.length>0){e=this.toString("hex",0,n).match(/.{2}/g).join(" ");if(this.length>n)e+=" ... "}return"<Buffer "+e+">"};e.prototype.compare=function(n){if(!e.isBuffer(n))throw new TypeError("Argument must be a Buffer");return e.compare(this,n)};e.prototype.get=function(e){console.log(".get() is deprecated. Access using array indexes instead.");return this.readUInt8(e)};e.prototype.set=function(e,n){console.log(".set() is deprecated. Access using array indexes instead.");return this.writeUInt8(e,n)};function F(a,i,t,e){t=Number(t)||0;var r=a.length-t;if(!e){e=r}else{e=Number(e);if(e>r){e=r}}var l=i.length;if(l%2!==0)throw new Error("Invalid hex string");if(e>l/2){e=l/2}for(var n=0;n<e;n++){var s=parseInt(i.substr(n*2,2),16);if(isNaN(s))throw new Error("Invalid hex string");a[t+n]=s}return n}function O(e,t,n,r){var l=a(p(t,e.length-n),e,n,r);return l}function x(e,n,t,r){var l=a(D(n),e,t,r);return l}function A(e,n,t,r){return x(e,n,t,r)}function C(e,n,t,r){var l=a(y(n),e,t,r);return l}function R(e,t,n,r){var l=a(N(t,e.length-n),e,n,r,2);return l}e.prototype.write=function(l,n,e,t){if(isFinite(n)){if(!isFinite(e)){t=e;e=undefined}}else{var i=t;t=n;n=e;e=i}n=Number(n)||0;if(e<0||n<0||n>this.length)throw new RangeError("attempt to write outside buffer bounds");var a=this.length-n;if(!e){e=a}else{e=Number(e);if(e>a){e=a}}t=String(t||"utf8").toLowerCase();var r;switch(t){case"hex":r=F(this,l,n,e);break;case"utf8":case"utf-8":r=O(this,l,n,e);break;case"ascii":r=x(this,l,n,e);break;case"binary":r=A(this,l,n,e);break;case"base64":r=C(this,l,n,e);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":r=R(this,l,n,e);break;default:throw new TypeError("Unknown encoding: "+t)}return r};e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function I(e,n,t){if(n===0&&t===e.length){return u.fromByteArray(e)}else{return u.fromByteArray(e.slice(n,t))}}function k(n,a,r){var l="";var t="";r=Math.min(n.length,r);for(var e=a;e<r;e++){if(n[e]<=127){l+=b(t)+String.fromCharCode(n[e]);t=""}else{t+="%"+n[e].toString(16)}}return l+b(t)}function S(t,l,e){var r="";e=Math.min(t.length,e);for(var n=l;n<e;n++){r+=String.fromCharCode(t[n]&127)}return r}function _(t,l,e){var r="";e=Math.min(t.length,e);for(var n=l;n<e;n++){r+=String.fromCharCode(t[n])}return r}function B(r,n,e){var l=r.length;if(!n||n<0)n=0;if(!e||e<0||e>l)e=l;var a="";for(var t=n;t<e;t++){a+=M(r[t])}return a}function w(r,l,a){var n=r.slice(l,a);var t="";for(var e=0;e<n.length;e+=2){t+=String.fromCharCode(n[e]+n[e+1]*256)}return t}e.prototype.slice=function(n,t){var r=this.length;n=~~n;t=t===undefined?r:~~t;if(n<0){n+=r;if(n<0)n=0}else if(n>r){n=r}if(t<0){t+=r;if(t<0)t=0}else if(t>r){t=r}if(t<n)t=n;var l;if(e.TYPED_ARRAY_SUPPORT){l=e._augment(this.subarray(n,t))}else{var i=t-n;l=new e(i,undefined,true);for(var a=0;a<i;a++){l[a]=this[a+n]}}if(l.length)l.parent=this.parent||this;return l};function t(e,n,t){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+n>t)throw new RangeError("Trying to access beyond buffer length")}e.prototype.readUIntLE=function(e,n,i){e=e>>>0;n=n>>>0;if(!i)t(e,n,this.length);var r=this[e];var l=1;var a=0;while(++a<n&&(l*=256))r+=this[e+a]*l;return r};e.prototype.readUIntBE=function(n,e,a){n=n>>>0;e=e>>>0;if(!a)t(n,e,this.length);var r=this[n+--e];var l=1;while(e>0&&(l*=256))r+=this[n+--e]*l;return r};e.prototype.readUInt8=function(e,n){if(!n)t(e,1,this.length);return this[e]};e.prototype.readUInt16LE=function(e,n){if(!n)t(e,2,this.length);return this[e]|this[e+1]<<8};e.prototype.readUInt16BE=function(e,n){if(!n)t(e,2,this.length);return this[e]<<8|this[e+1]};e.prototype.readUInt32LE=function(e,n){if(!n)t(e,4,this.length);return(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};e.prototype.readUInt32BE=function(e,n){if(!n)t(e,4,this.length);return this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};e.prototype.readIntLE=function(e,n,i){e=e>>>0;n=n>>>0;if(!i)t(e,n,this.length);var r=this[e];var l=1;var a=0;while(++a<n&&(l*=256))r+=this[e+a]*l;l*=128;if(r>=l)r-=Math.pow(2,8*n);return r};e.prototype.readIntBE=function(e,n,i){e=e>>>0;n=n>>>0;if(!i)t(e,n,this.length);var a=n;var r=1;var l=this[e+--a];while(a>0&&(r*=256))l+=this[e+--a]*r;r*=128;if(l>=r)l-=Math.pow(2,8*n);return l};e.prototype.readInt8=function(e,n){if(!n)t(e,1,this.length);if(!(this[e]&128))return this[e];return(255-this[e]+1)*-1};e.prototype.readInt16LE=function(e,r){if(!r)t(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};e.prototype.readInt16BE=function(e,r){if(!r)t(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};e.prototype.readInt32LE=function(e,n){if(!n)t(e,4,this.length);return this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};e.prototype.readInt32BE=function(e,n){if(!n)t(e,4,this.length);return this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};e.prototype.readFloatLE=function(e,n){if(!n)t(e,4,this.length);return l.read(this,e,true,23,4)};e.prototype.readFloatBE=function(e,n){if(!n)t(e,4,this.length);return l.read(this,e,false,23,4)};e.prototype.readDoubleLE=function(e,n){if(!n)t(e,8,this.length);return l.read(this,e,true,52,8)};e.prototype.readDoubleBE=function(e,n){if(!n)t(e,8,this.length);return l.read(this,e,false,52,8)};function r(n,t,r,l,a,i){if(!e.isBuffer(n))throw new TypeError("buffer must be a Buffer instance");if(t>a||t<i)throw new RangeError("value is out of bounds");if(r+l>n.length)throw new RangeError("index out of range")}e.prototype.writeUIntLE=function(t,e,n,i){t=+t;e=e>>>0;n=n>>>0;if(!i)r(this,t,e,n,Math.pow(2,8*n),0);var l=1;var a=0;this[e]=t&255;while(++a<n&&(l*=256))this[e+a]=t/l>>>0&255;return e+n};e.prototype.writeUIntBE=function(t,e,n,i){t=+t;e=e>>>0;n=n>>>0;if(!i)r(this,t,e,n,Math.pow(2,8*n),0);var l=n-1;var a=1;this[e+l]=t&255;while(--l>=0&&(a*=256))this[e+l]=t/a>>>0&255;return e+n};e.prototype.writeUInt8=function(n,t,l){n=+n;t=t>>>0;if(!l)r(this,n,t,1,255,0);if(!e.TYPED_ARRAY_SUPPORT)n=Math.floor(n);this[t]=n;return t+1};function o(t,n,r,l){if(n<0)n=65535+n+1;for(var e=0,a=Math.min(t.length-r,2);e<a;e++){t[r+e]=(n&255<<8*(l?e:1-e))>>>(l?e:1-e)*8}}e.prototype.writeUInt16LE=function(t,n,l){t=+t;n=n>>>0;if(!l)r(this,t,n,2,65535,0);if(e.TYPED_ARRAY_SUPPORT){this[n]=t;this[n+1]=t>>>8}else o(this,t,n,true);return n+2};e.prototype.writeUInt16BE=function(t,n,l){t=+t;n=n>>>0;if(!l)r(this,t,n,2,65535,0);if(e.TYPED_ARRAY_SUPPORT){this[n]=t>>>8;this[n+1]=t}else o(this,t,n,false);return n+2};function s(t,n,r,l){if(n<0)n=4294967295+n+1;for(var e=0,a=Math.min(t.length-r,4);e<a;e++){t[r+e]=n>>>(l?e:3-e)*8&255}}e.prototype.writeUInt32LE=function(t,n,l){t=+t;n=n>>>0;if(!l)r(this,t,n,4,4294967295,0);if(e.TYPED_ARRAY_SUPPORT){this[n+3]=t>>>24;this[n+2]=t>>>16;this[n+1]=t>>>8;this[n]=t}else s(this,t,n,true);return n+4};e.prototype.writeUInt32BE=function(t,n,l){t=+t;n=n>>>0;if(!l)r(this,t,n,4,4294967295,0);if(e.TYPED_ARRAY_SUPPORT){this[n]=t>>>24;this[n+1]=t>>>16;this[n+2]=t>>>8;this[n+3]=t}else s(this,t,n,false);return n+4};e.prototype.writeIntLE=function(e,n,t,i){e=+e;n=n>>>0;if(!i){r(this,e,n,t,Math.pow(2,8*t-1)-1,-Math.pow(2,8*t-1))}var l=0;var a=1;var s=e<0?1:0;this[n]=e&255;while(++l<t&&(a*=256))this[n+l]=(e/a>>0)-s&255;return n+t};e.prototype.writeIntBE=function(e,n,t,i){e=+e;n=n>>>0;if(!i){r(this,e,n,t,Math.pow(2,8*t-1)-1,-Math.pow(2,8*t-1))}var l=t-1;var a=1;var s=e<0?1:0;this[n+l]=e&255;while(--l>=0&&(a*=256))this[n+l]=(e/a>>0)-s&255;return n+t};e.prototype.writeInt8=function(n,t,l){n=+n;t=t>>>0;if(!l)r(this,n,t,1,127,-128);if(!e.TYPED_ARRAY_SUPPORT)n=Math.floor(n);if(n<0)n=255+n+1;this[t]=n;return t+1};e.prototype.writeInt16LE=function(t,n,l){t=+t;n=n>>>0;if(!l)r(this,t,n,2,32767,-32768);if(e.TYPED_ARRAY_SUPPORT){this[n]=t;this[n+1]=t>>>8}else o(this,t,n,true);return n+2};e.prototype.writeInt16BE=function(t,n,l){t=+t;n=n>>>0;if(!l)r(this,t,n,2,32767,-32768);if(e.TYPED_ARRAY_SUPPORT){this[n]=t>>>8;this[n+1]=t}else o(this,t,n,false);return n+2};e.prototype.writeInt32LE=function(t,n,l){t=+t;n=n>>>0;if(!l)r(this,t,n,4,2147483647,-2147483648);if(e.TYPED_ARRAY_SUPPORT){this[n]=t;this[n+1]=t>>>8;this[n+2]=t>>>16;this[n+3]=t>>>24}else s(this,t,n,true);return n+4};e.prototype.writeInt32BE=function(n,t,l){n=+n;t=t>>>0;if(!l)r(this,n,t,4,2147483647,-2147483648);if(n<0)n=4294967295+n+1;if(e.TYPED_ARRAY_SUPPORT){this[t]=n>>>24;this[t+1]=n>>>16;this[t+2]=n>>>8;this[t+3]=n}else s(this,n,t,false);return t+4};function g(t,e,n,r,l,a){if(e>l||e<a)throw new RangeError("value is out of bounds");if(n+r>t.length)throw new RangeError("index out of range");if(n<0)throw new RangeError("index out of range")}function h(n,t,e,r,a){if(!a)g(n,t,e,4,3.4028234663852886e38,-3.4028234663852886e38);l.write(n,t,e,r,23,4);return e+4}e.prototype.writeFloatLE=function(e,n,t){return h(this,e,n,true,t)};e.prototype.writeFloatBE=function(e,n,t){return h(this,e,n,false,t)};function m(n,t,e,r,a){if(!a)g(n,t,e,8,1.7976931348623157e308,-1.7976931348623157e308);l.write(n,t,e,r,52,8);return e+8}e.prototype.writeDoubleLE=function(e,n,t){return m(this,e,n,true,t)};e.prototype.writeDoubleBE=function(e,n,t){return m(this,e,n,false,t)};e.prototype.copy=function(l,r,n,t){var s=this;if(!n)n=0;if(!t&&t!==0)t=this.length;if(r>=l.length)r=l.length;if(!r)r=0;if(t>0&&t<n)t=n;if(t===n)return 0;if(l.length===0||s.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=s.length)throw new RangeError("sourceStart out of bounds");if(t<0)throw new RangeError("sourceEnd out of bounds");if(t>this.length)t=this.length;if(l.length-r<t-n)t=l.length-r+n;var a=t-n;if(a<1e3||!e.TYPED_ARRAY_SUPPORT){for(var i=0;i<a;i++){l[i+r]=this[i+n]}}else{l._set(this.subarray(n,n+a),r)}return a};e.prototype.fill=function(r,n,t){if(!r)r=0;if(!n)n=0;if(!t)t=this.length;if(t<n)throw new RangeError("end < start");if(t===n)return;if(this.length===0)return;if(n<0||n>=this.length)throw new RangeError("start out of bounds");if(t<0||t>this.length)throw new RangeError("end out of bounds");var e;if(typeof r==="number"){for(e=n;e<t;e++){this[e]=r}}else{var l=p(r.toString());var a=l.length;for(e=n;e<t;e++){this[e]=l[e%a]}}return this};e.prototype.toArrayBuffer=function(){if(typeof Uint8Array!=="undefined"){if(e.TYPED_ARRAY_SUPPORT){return new e(this).buffer}else{var t=new Uint8Array(this.length);for(var n=0,r=t.length;n<r;n+=1){t[n]=this[n]}return t.buffer}}else{throw new TypeError("Buffer.toArrayBuffer not supported in this browser")}};var n=e.prototype;e._augment=function(t){t.constructor=e;t._isBuffer=true;t._get=t.get;t._set=t.set;t.get=n.get;t.set=n.set;t.write=n.write;t.toString=n.toString;t.toLocaleString=n.toString;t.toJSON=n.toJSON;t.equals=n.equals;t.compare=n.compare;t.copy=n.copy;t.slice=n.slice;t.readUIntLE=n.readUIntLE;t.readUIntBE=n.readUIntBE;t.readUInt8=n.readUInt8;t.readUInt16LE=n.readUInt16LE;t.readUInt16BE=n.readUInt16BE;t.readUInt32LE=n.readUInt32LE;t.readUInt32BE=n.readUInt32BE;t.readIntLE=n.readIntLE;t.readIntBE=n.readIntBE;t.readInt8=n.readInt8;t.readInt16LE=n.readInt16LE;t.readInt16BE=n.readInt16BE;t.readInt32LE=n.readInt32LE;t.readInt32BE=n.readInt32BE;t.readFloatLE=n.readFloatLE;t.readFloatBE=n.readFloatBE;t.readDoubleLE=n.readDoubleLE;t.readDoubleBE=n.readDoubleBE;t.writeUInt8=n.writeUInt8;t.writeUIntLE=n.writeUIntLE;t.writeUIntBE=n.writeUIntBE;t.writeUInt16LE=n.writeUInt16LE;t.writeUInt16BE=n.writeUInt16BE;t.writeUInt32LE=n.writeUInt32LE;t.writeUInt32BE=n.writeUInt32BE;t.writeIntLE=n.writeIntLE;t.writeIntBE=n.writeIntBE;t.writeInt8=n.writeInt8;t.writeInt16LE=n.writeInt16LE;t.writeInt16BE=n.writeInt16BE;t.writeInt32LE=n.writeInt32LE;t.writeInt32BE=n.writeInt32BE;t.writeFloatLE=n.writeFloatLE;t.writeFloatBE=n.writeFloatBE;t.writeDoubleLE=n.writeDoubleLE;t.writeDoubleBE=n.writeDoubleBE;t.fill=n.fill;t.inspect=n.inspect;t.toArrayBuffer=n.toArrayBuffer;return t};var T=/[^+\/0-9A-z\-]/g;function E(e){e=P(e).replace(T,"");if(e.length<2)return"";while(e.length%4!==0){e=e+"="}return e}function P(e){if(e.trim)return e.trim();return e.replace(/^\s+|\s+$/g,"")}function j(n){return f(n)||e.isBuffer(n)||n&&typeof n==="object"&&typeof n.length==="number"}function M(e){if(e<16)return"0"+e.toString(16);return e.toString(16)}function p(a,n){var e,i=a.length;var r=null;n=n||Infinity;var t=[];var l=0;for(;l<i;l++){e=a.charCodeAt(l);if(e>55295&&e<57344){if(r){if(e<56320){if((n-=3)>-1)t.push(239,191,189);r=e;continue}else{e=r-55296<<10|e-56320|65536;r=null}}else{if(e>56319){if((n-=3)>-1)t.push(239,191,189);continue}else if(l+1===i){if((n-=3)>-1)t.push(239,191,189);continue}else{r=e;continue}}}else if(r){if((n-=3)>-1)t.push(239,191,189);r=null}if(e<128){if((n-=1)<0)break;t.push(e)}else if(e<2048){if((n-=2)<0)break;t.push(e>>6|192,e&63|128)}else if(e<65536){if((n-=3)<0)break;t.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<2097152){if((n-=4)<0)break;t.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else{throw new Error("Invalid code point")}}return t}function D(n){var t=[];for(var e=0;e<n.length;e++){t.push(n.charCodeAt(e)&255)}return t}function N(r,i){var e,l,a;var n=[];for(var t=0;t<r.length;t++){if((i-=2)<0)break;e=r.charCodeAt(t);l=e>>8;a=e%256;n.push(a);n.push(l)}return n}function y(e){return u.toByteArray(E(e))}function a(t,r,l,n,a){if(a)n-=n%a;for(var e=0;e<n;e++){if(e+l>=r.length||e>=t.length)break;r[e+l]=t[e]}return e}function b(e){try{return decodeURIComponent(e)}catch(n){return String.fromCharCode(65533)}}},{"base64-js":112,ieee754:113,"is-array":114}],112:[function(t,r,e){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(a){"use strict";var s=typeof Uint8Array!=="undefined"?Uint8Array:Array;var c="+".charCodeAt(0);var i="/".charCodeAt(0);var t="0".charCodeAt(0);var l="a".charCodeAt(0);var r="A".charCodeAt(0);var o="-".charCodeAt(0);var u="_".charCodeAt(0);function e(n){var e=n.charCodeAt(0);if(e===c||e===o)return 62;if(e===i||e===u)return 63;if(e<t)return-1;if(e<t+10)return e-t+26+26;if(e<r+26)return e-r;if(e<l+26)return e-l+26}function f(n){var t,o,u,r,a,i;if(n.length%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var c=n.length;a="="===n.charAt(c-2)?2:"="===n.charAt(c-1)?1:0;i=new s(n.length*3/4-a);u=a>0?n.length-4:n.length;var f=0;function l(e){i[f++]=e}for(t=0,o=0;t<u;t+=4,o+=3){r=e(n.charAt(t))<<18|e(n.charAt(t+1))<<12|e(n.charAt(t+2))<<6|e(n.charAt(t+3));l((r&16711680)>>16);l((r&65280)>>8);l(r&255)}if(a===2){r=e(n.charAt(t))<<2|e(n.charAt(t+1))>>4;l(r&255)}else if(a===1){r=e(n.charAt(t))<<10|e(n.charAt(t+1))<<4|e(n.charAt(t+2))>>2;l(r>>8&255);l(r&255)}return i}function p(e){var a,i=e.length%3,t="",r,s;function l(e){return n.charAt(e)}function o(e){return l(e>>18&63)+l(e>>12&63)+l(e>>6&63)+l(e&63)}for(a=0,s=e.length-i;a<s;a+=3){r=(e[a]<<16)+(e[a+1]<<8)+e[a+2];t+=o(r)}switch(i){case 1:r=e[e.length-1];t+=l(r>>2);t+=l(r<<4&63);t+="==";break;case 2:r=(e[e.length-2]<<8)+e[e.length-1];t+=l(r>>10);t+=l(r>>4&63);t+=l(r<<2&63);t+="=";break}return t}a.toByteArray=f;a.fromByteArray=p})(typeof e==="undefined"?this.base64js={}:e)},{}],113:[function(n,t,e){e.read=function(o,s,p,a,f){var e,t,d=f*8-a-1,c=(1<<d)-1,u=c>>1,n=-7,r=p?f-1:0,i=p?-1:1,l=o[s+r];r+=i;e=l&(1<<-n)-1;l>>=-n;n+=d;for(;n>0;e=e*256+o[s+r],r+=i,n-=8);t=e&(1<<-n)-1;e>>=-n;n+=a;for(;n>0;t=t*256+o[s+r],r+=i,n-=8);if(e===0){e=1-u}else if(e===c){return t?NaN:(l?-1:1)*Infinity}else{t=t+Math.pow(2,a);e=e-u}return(l?-1:1)*t*Math.pow(2,e-a)};e.write=function(c,n,f,m,t,d){var e,r,l,s=d*8-t-1,o=(1<<s)-1,a=o>>1,p=t===23?Math.pow(2,-24)-Math.pow(2,-77):0,i=m?0:d-1,u=m?1:-1,h=n<0||n===0&&1/n<0?1:0;n=Math.abs(n);if(isNaN(n)||n===Infinity){r=isNaN(n)?1:0;e=o}else{e=Math.floor(Math.log(n)/Math.LN2);if(n*(l=Math.pow(2,-e))<1){e--;l*=2}if(e+a>=1){n+=p/l}else{n+=p*Math.pow(2,1-a)}if(n*l>=2){e++;l/=2}if(e+a>=o){r=0;e=o}else if(e+a>=1){r=(n*l-1)*Math.pow(2,t);e=e+a}else{r=n*Math.pow(2,a-1)*Math.pow(2,t);e=0}}for(;t>=8;c[f+i]=r&255,i+=u,r/=256,t-=8);e=e<<t|r;s+=t;for(;s>0;c[f+i]=e&255,i+=u,e/=256,s-=8);c[f+i-u]|=h*128}},{}],114:[function(r,e,l){var n=Array.isArray;var t=Object.prototype.toString;e.exports=n||function(e){return!!e&&"[object Array]"==t.call(e)}},{}],115:[function(i,l,s){function e(){this._events=this._events||{};this._maxListeners=this._maxListeners||undefined}l.exports=e;e.EventEmitter=e;e.prototype._events=undefined;e.prototype._maxListeners=undefined;e.defaultMaxListeners=10;e.prototype.setMaxListeners=function(e){if(!a(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");this._maxListeners=e;return this};e.prototype.emit=function(u){var s,l,a,i,e,o;if(!this._events)this._events={};if(u==="error"){if(!this._events.error||t(this._events.error)&&!this._events.error.length){s=arguments[1];if(s instanceof Error){throw s}throw TypeError('Uncaught, unspecified "error" event.')}}l=this._events[u];if(r(l))return false;if(n(l)){switch(arguments.length){case 1:l.call(this);break;case 2:l.call(this,arguments[1]);break;case 3:l.call(this,arguments[1],arguments[2]);break;default:a=arguments.length;i=new Array(a-1);for(e=1;e<a;e++)i[e-1]=arguments[e];l.apply(this,i)}}else if(t(l)){a=arguments.length;i=new Array(a-1);for(e=1;e<a;e++)i[e-1]=arguments[e];o=l.slice();a=o.length;for(e=0;e<a;e++)o[e].apply(this,i)}return true};e.prototype.addListener=function(l,a){var i;if(!n(a))throw TypeError("listener must be a function");if(!this._events)this._events={};if(this._events.newListener)this.emit("newListener",l,n(a.listener)?a.listener:a);if(!this._events[l])this._events[l]=a;else if(t(this._events[l]))this._events[l].push(a);else this._events[l]=[this._events[l],a];if(t(this._events[l])&&!this._events[l].warned){var i;if(!r(this._maxListeners)){i=this._maxListeners}else{i=e.defaultMaxListeners}if(i&&i>0&&this._events[l].length>i){this._events[l].warned=true;console.error("(node) warning: possible EventEmitter memory "+"leak detected. %d listeners added. "+"Use emitter.setMaxListeners() to increase limit.",this._events[l].length);if(typeof console.trace==="function"){console.trace()}}}return this};e.prototype.on=e.prototype.addListener;e.prototype.once=function(r,e){if(!n(e))throw TypeError("listener must be a function");var l=false;function t(){this.removeListener(r,t);if(!l){l=true;e.apply(this,arguments)}}t.listener=e;this.on(r,t);return this};e.prototype.removeListener=function(l,r){var e,i,s,a;if(!n(r))throw TypeError("listener must be a function");if(!this._events||!this._events[l])return this;e=this._events[l];s=e.length;i=-1;if(e===r||n(e.listener)&&e.listener===r){delete this._events[l];if(this._events.removeListener)this.emit("removeListener",l,r)}else if(t(e)){for(a=s;a-->0;){if(e[a]===r||e[a].listener&&e[a].listener===r){i=a;break}}if(i<0)return this;if(e.length===1){e.length=0;delete this._events[l]}else{e.splice(i,1)}if(this._events.removeListener)this.emit("removeListener",l,r)}return this};e.prototype.removeAllListeners=function(e){var r,t;if(!this._events)return this;if(!this._events.removeListener){if(arguments.length===0)this._events={};else if(this._events[e])delete this._events[e];return this}if(arguments.length===0){for(r in this._events){if(r==="removeListener")continue;this.removeAllListeners(r)}this.removeAllListeners("removeListener");this._events={};return this}t=this._events[e];if(n(t)){this.removeListener(e,t)}else{while(t.length)this.removeListener(e,t[t.length-1])}delete this._events[e];return this};e.prototype.listeners=function(e){var t;if(!this._events||!this._events[e])t=[];else if(n(this._events[e]))t=[this._events[e]];else t=this._events[e].slice();return t};e.listenerCount=function(e,r){var t;if(!e._events||!e._events[r])t=0;else if(n(e._events[r]))t=1;else t=e._events[r].length;return t};function n(e){return typeof e==="function"}function a(e){return typeof e==="number"}function t(e){return typeof e==="object"&&e!==null}function r(e){return e===void 0}},{}],116:[function(n,e,t){if(typeof Object.create==="function"){e.exports=function r(e,n){e.super_=n;e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}})}}else{e.exports=function l(e,n){e.super_=n;var t=function(){};t.prototype=n.prototype;e.prototype=new t;e.prototype.constructor=e}}},{}],117:[function(n,e,t){e.exports=Array.isArray||function(e){return Object.prototype.toString.call(e)=="[object Array]"}},{}],118:[function(n,t,e){(function(l){function r(e,l){var t=0;for(var n=e.length-1;n>=0;n--){var r=e[n];if(r==="."){e.splice(n,1)}else if(r===".."){e.splice(n,1);t++}else if(t){e.splice(n,1);t--}}if(l){for(;t--;t){e.unshift("..")}}return e}var a=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var n=function(e){return a.exec(e).slice(1)};e.resolve=function(){var e="",n=false;for(var a=arguments.length-1;a>=-1&&!n;a--){var i=a>=0?arguments[a]:l.cwd();if(typeof i!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!i){continue}e=i+"/"+e;n=i.charAt(0)==="/"}e=r(t(e.split("/"),function(e){return!!e}),!n).join("/");return(n?"/":"")+e||"."};e.normalize=function(n){var l=e.isAbsolute(n),a=i(n,-1)==="/";n=r(t(n.split("/"),function(e){return!!e}),!l).join("/");if(!n&&!l){n="."}if(n&&a){n+="/"}return(l?"/":"")+n};e.isAbsolute=function(e){return e.charAt(0)==="/"};e.join=function(){var n=Array.prototype.slice.call(arguments,0);return e.normalize(t(n,function(e,n){if(typeof e!=="string"){throw new TypeError("Arguments to path.join must be strings")}return e}).join("/"))};e.relative=function(r,l){r=e.resolve(r).substr(1);l=e.resolve(l).substr(1);function o(n){var e=0;for(;e<n.length;e++){if(n[e]!=="")break}var t=n.length-1;for(;t>=0;t--){if(n[t]!=="")break}if(e>t)return[];return n.slice(e,t-e+1)}var a=o(r.split("/"));var i=o(l.split("/"));var u=Math.min(a.length,i.length);var s=u;for(var n=0;n<u;n++){if(a[n]!==i[n]){s=n;break}}var t=[];for(var n=s;n<a.length;n++){t.push("..")}t=t.concat(i.slice(s));return t.join("/")};e.sep="/";e.delimiter=":";e.dirname=function(l){var t=n(l),r=t[0],e=t[1];if(!r&&!e){return"."}if(e){e=e.substr(0,e.length-1)}return r+e};e.basename=function(r,t){var e=n(r)[2];if(t&&e.substr(-1*t.length)===t){e=e.substr(0,e.length-t.length)}return e};e.extname=function(e){return n(e)[3]};function t(e,t){if(e.filter)return e.filter(t);var r=[];for(var n=0;n<e.length;n++){if(t(e[n],n,e))r.push(e[n])}return r}var i="ab".substr(-1)==="b"?function(e,n,t){return e.substr(n,t)}:function(n,e,t){if(e<0)e=n.length+e;return n.substr(e,t)}}).call(this,n("_process"))},{_process:119}],119:[function(i,l,s){var e=l.exports={};var t=[];var r=false;function a(){if(r){return}r=true;var n;var e=t.length;while(e){n=t;t=[];var l=-1;while(++l<e){n[l]()}e=t.length}r=false}e.nextTick=function(e){t.push(e);if(!r){setTimeout(a,0)}};e.title="browser";e.browser=true;e.env={};e.argv=[];e.version="";function n(){}e.on=n;e.addListener=n;e.once=n;e.off=n;e.removeListener=n;e.removeAllListeners=n;e.emit=n;e.binding=function(e){throw new Error("process.binding is not supported")};e.cwd=function(){return"/"};e.chdir=function(e){throw new Error("process.chdir is not supported")};e.umask=function(){return 0}},{}],120:[function(e,n,t){n.exports=e("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":121}],121:[function(e,n,t){(function(i){n.exports=t;var s=Object.keys||function(n){var e=[];for(var t in n)e.push(t);return e};var l=e("core-util-is");l.inherits=e("inherits");var a=e("./_stream_readable");var r=e("./_stream_writable");l.inherits(t,a);u(s(r.prototype),function(e){if(!t.prototype[e])t.prototype[e]=r.prototype[e]});function t(e){if(!(this instanceof t))return new t(e);a.call(this,e);r.call(this,e);if(e&&e.readable===false)this.readable=false;if(e&&e.writable===false)this.writable=false;this.allowHalfOpen=true;if(e&&e.allowHalfOpen===false)this.allowHalfOpen=false;this.once("end",o)}function o(){if(this.allowHalfOpen||this._writableState.ended)return;i.nextTick(this.end.bind(this))}function u(n,t){for(var e=0,r=n.length;e<r;e++){t(n[e],e)}}}).call(this,e("_process"))},{"./_stream_readable":123,"./_stream_writable":125,_process:119,"core-util-is":126,inherits:116}],122:[function(n,l,a){l.exports=e;var t=n("./_stream_transform");var r=n("core-util-is");r.inherits=n("inherits");r.inherits(e,t);function e(n){if(!(this instanceof e))return new e(n);t.call(this,n)}e.prototype._transform=function(e,t,n){n(null,e)}},{"./_stream_transform":124,"core-util-is":126,inherits:116}],123:[function(e,n,t){(function(r){n.exports=t;var S=e("isarray");var s=e("buffer").Buffer;t.ReadableState=x;var o=e("events").EventEmitter;if(!o.listenerCount)o.listenerCount=function(e,n){return e.listeners(n).length};var a=e("stream");var h=e("core-util-is");h.inherits=e("inherits");var l;h.inherits(t,a);function x(n,r){n=n||{};var t=n.highWaterMark;this.highWaterMark=t||t===0?t:16*1024;this.highWaterMark=~~this.highWaterMark;this.buffer=[];this.length=0;this.pipes=null;this.pipesCount=0;this.flowing=false;this.ended=false;this.endEmitted=false;this.reading=false;this.calledRead=false;this.sync=true;this.needReadable=false;this.emittedReadable=false;this.readableListening=false;this.objectMode=!!n.objectMode;this.defaultEncoding=n.defaultEncoding||"utf8";this.ranOut=false;this.awaitDrain=0;this.readingMore=false;this.decoder=null;this.encoding=null;if(n.encoding){if(!l)l=e("string_decoder/").StringDecoder;this.decoder=new l(n.encoding);this.encoding=n.encoding}}function t(e){if(!(this instanceof t))return new t(e);this._readableState=new x(e,this);this.readable=true;a.call(this)}t.prototype.push=function(n,e){var t=this._readableState;if(typeof n==="string"&&!t.objectMode){e=e||t.defaultEncoding;if(e!==t.encoding){n=new s(n,e);e=""}}return g(this,t,n,e,false)};t.prototype.unshift=function(e){var n=this._readableState;return g(this,n,e,"",true)};function g(t,e,n,s,r){var l=A(e,n);if(l){t.emit("error",l)}else if(n===null||n===undefined){e.reading=false;if(!e.ended)k(t,e)}else if(e.objectMode||n&&n.length>0){if(e.ended&&!r){var a=new Error("stream.push() after EOF");t.emit("error",a)}else if(e.endEmitted&&r){var a=new Error("stream.unshift() after end event");t.emit("error",a)}else{if(e.decoder&&!r&&!s)n=e.decoder.write(n);
e.length+=e.objectMode?1:n.length;if(r){e.buffer.unshift(n)}else{e.reading=false;e.buffer.push(n)}if(e.needReadable)i(t);C(t,e)}}else if(!r){e.reading=false}return _(e)}function _(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}t.prototype.setEncoding=function(n){if(!l)l=e("string_decoder/").StringDecoder;this._readableState.decoder=new l(n);this._readableState.encoding=n};var b=8388608;function R(e){if(e>=b){e=b}else{e--;for(var n=1;n<32;n<<=1)e|=e>>n;e++}return e}function v(n,e){if(e.length===0&&e.ended)return 0;if(e.objectMode)return n===0?0:1;if(n===null||isNaN(n)){if(e.flowing&&e.buffer.length)return e.buffer[0].length;else return e.length}if(n<=0)return 0;if(n>e.highWaterMark)e.highWaterMark=R(n);if(n>e.length){if(!e.ended){e.needReadable=true;return 0}else return e.length}return n}t.prototype.read=function(n){var e=this._readableState;e.calledRead=true;var l=n;var t;if(typeof n!=="number"||n>0)e.emittedReadable=false;if(n===0&&e.needReadable&&(e.length>=e.highWaterMark||e.ended)){i(this);return null}n=v(n,e);if(n===0&&e.ended){t=null;if(e.length>0&&e.decoder){t=p(n,e);e.length-=t.length}if(e.length===0)d(this);return t}var r=e.needReadable;if(e.length-n<=e.highWaterMark)r=true;if(e.ended||e.reading)r=false;if(r){e.reading=true;e.sync=true;if(e.length===0)e.needReadable=true;this._read(e.highWaterMark);e.sync=false}if(r&&!e.reading)n=v(l,e);if(n>0)t=p(n,e);else t=null;if(t===null){e.needReadable=true;n=0}e.length-=n;if(e.length===0&&!e.ended)e.needReadable=true;if(e.ended&&!e.endEmitted&&e.length===0)d(this);return t};function A(t,e){var n=null;if(!s.isBuffer(e)&&"string"!==typeof e&&e!==null&&e!==undefined&&!t.objectMode){n=new TypeError("Invalid non-string/buffer chunk")}return n}function k(t,e){if(e.decoder&&!e.ended){var n=e.decoder.end();if(n&&n.length){e.buffer.push(n);e.length+=e.objectMode?1:n.length}}e.ended=true;if(e.length>0)i(t);else d(t)}function i(n){var e=n._readableState;e.needReadable=false;if(e.emittedReadable)return;e.emittedReadable=true;if(e.sync)r.nextTick(function(){m(n)});else m(n)}function m(e){e.emit("readable")}function C(n,e){if(!e.readingMore){e.readingMore=true;r.nextTick(function(){E(n,e)})}}function E(t,e){var n=e.length;while(!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark){t.read(0);if(n===e.length)break;else n=e.length}e.readingMore=false}t.prototype._read=function(e){this.emit("error",new Error("not implemented"))};t.prototype.pipe=function(e,d){var t=this;var n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e);break}n.pipesCount+=1;var y=(!d||d.end!==false)&&e!==r.stdout&&e!==r.stderr;var h=y?g:u;if(n.endEmitted)r.nextTick(h);else t.once("end",h);e.on("unpipe",m);function m(e){if(e!==t)return;u()}function g(){e.end()}var p=w(t);e.on("drain",p);function u(){e.removeListener("close",i);e.removeListener("finish",a);e.removeListener("drain",p);e.removeListener("error",l);e.removeListener("unpipe",m);t.removeListener("end",g);t.removeListener("end",u);if(!e._writableState||e._writableState.needDrain)p()}function l(n){s();e.removeListener("error",l);if(o.listenerCount(e,"error")===0)e.emit("error",n)}if(!e._events||!e._events.error)e.on("error",l);else if(S(e._events.error))e._events.error.unshift(l);else e._events.error=[l,e._events.error];function i(){e.removeListener("finish",a);s()}e.once("close",i);function a(){e.removeListener("close",i);s()}e.once("finish",a);function s(){t.unpipe(e)}e.emit("pipe",t);if(!n.flowing){this.on("readable",c);n.flowing=true;r.nextTick(function(){f(t)})}return e};function w(e){return function(){var t=this;var n=e._readableState;n.awaitDrain--;if(n.awaitDrain===0)f(e)}}function f(n){var e=n._readableState;var t;e.awaitDrain=0;function r(n,l,a){var r=n.write(t);if(false===r){e.awaitDrain++}}while(e.pipesCount&&null!==(t=n.read())){if(e.pipesCount===1)r(e.pipes,0,null);else y(e.pipes,r);n.emit("data",t);if(e.awaitDrain>0)return}if(e.pipesCount===0){e.flowing=false;if(o.listenerCount(n,"data")>0)u(n);return}e.ranOut=true}function c(){if(this._readableState.ranOut){this._readableState.ranOut=false;f(this)}}t.prototype.unpipe=function(n){var e=this._readableState;if(e.pipesCount===0)return this;if(e.pipesCount===1){if(n&&n!==e.pipes)return this;if(!n)n=e.pipes;e.pipes=null;e.pipesCount=0;this.removeListener("readable",c);e.flowing=false;if(n)n.emit("unpipe",this);return this}if(!n){var r=e.pipes;var l=e.pipesCount;e.pipes=null;e.pipesCount=0;this.removeListener("readable",c);e.flowing=false;for(var t=0;t<l;t++)r[t].emit("unpipe",this);return this}var t=I(e.pipes,n);if(t===-1)return this;e.pipes.splice(t,1);e.pipesCount-=1;if(e.pipesCount===1)e.pipes=e.pipes[0];n.emit("unpipe",this);return this};t.prototype.on=function(n,t){var r=a.prototype.on.call(this,n,t);if(n==="data"&&!this._readableState.flowing)u(this);if(n==="readable"&&this.readable){var e=this._readableState;if(!e.readableListening){e.readableListening=true;e.emittedReadable=false;e.needReadable=true;if(!e.reading){this.read(0)}else if(e.length){i(this,e)}}}return r};t.prototype.addListener=t.prototype.on;t.prototype.resume=function(){u(this);this.read(0);this.emit("resume")};t.prototype.pause=function(){u(this,true);this.emit("pause")};function u(e,l){var i=e._readableState;if(i.flowing){throw new Error("Cannot switch to old mode now.")}var n=l||false;var t=false;e.readable=true;e.pipe=a.prototype.pipe;e.on=e.addListener=a.prototype.on;e.on("readable",function(){t=true;var r;while(!n&&null!==(r=e.read()))e.emit("data",r);if(r===null){t=false;e._readableState.needReadable=true}});e.pause=function(){n=true;this.emit("pause")};e.resume=function(){n=false;if(t)r.nextTick(function(){e.emit("readable")});else this.read(0);this.emit("resume")};e.emit("readable")}t.prototype.wrap=function(e){var n=this._readableState;var l=false;var t=this;e.on("end",function(){if(n.decoder&&!n.ended){var e=n.decoder.end();if(e&&e.length)t.push(e)}t.push(null)});e.on("data",function(r){if(n.decoder)r=n.decoder.write(r);if(n.objectMode&&(r===null||r===undefined))return;else if(!n.objectMode&&(!r||!r.length))return;var a=t.push(r);if(!a){l=true;e.pause()}});for(var r in e){if(typeof e[r]==="function"&&typeof this[r]==="undefined"){this[r]=function(n){return function(){return e[n].apply(e,arguments)}}(r)}}var a=["error","close","destroy","pause","resume"];y(a,function(n){e.on(n,t.emit.bind(t,n))});t._read=function(n){if(l){l=false;e.resume()}};return t};t._fromList=p;function p(t,a){var e=a.buffer;var o=a.length;var u=!!a.decoder;var f=!!a.objectMode;var n;if(e.length===0)return null;if(o===0)n=null;else if(f)n=e.shift();else if(!t||t>=o){if(u)n=e.join("");else n=s.concat(e,o);e.length=0}else{if(t<e[0].length){var r=e[0];n=r.slice(0,t);e[0]=r.slice(t)}else if(t===e[0].length){n=e.shift()}else{if(u)n="";else n=new s(t);var i=0;for(var c=0,p=e.length;c<p&&i<t;c++){var r=e[0];var l=Math.min(t-i,r.length);if(u)n+=r.slice(0,l);else r.copy(n,i,0,l);if(l<r.length)e[0]=r.slice(l);else e.shift();i+=l}}}return n}function d(n){var e=n._readableState;if(e.length>0)throw new Error("endReadable called on non-empty stream");if(!e.endEmitted&&e.calledRead){e.ended=true;r.nextTick(function(){if(!e.endEmitted&&e.length===0){e.endEmitted=true;n.readable=false;n.emit("end")}})}}function y(n,t){for(var e=0,r=n.length;e<r;e++){t(n[e],e)}}function I(n,t){for(var e=0,r=n.length;e<r;e++){if(n[e]===t)return e}return-1}}).call(this,e("_process"))},{_process:119,buffer:111,"core-util-is":126,events:115,inherits:116,isarray:117,stream:131,"string_decoder/":132}],124:[function(n,a,o){a.exports=e;var t=n("./_stream_duplex");var r=n("core-util-is");r.inherits=n("inherits");r.inherits(e,t);function i(n,e){this.afterTransform=function(n,t){return s(e,n,t)};this.needTransform=false;this.transforming=false;this.writecb=null;this.writechunk=null}function s(e,a,r){var t=e._transformState;t.transforming=false;var l=t.writecb;if(!l)return e.emit("error",new Error("no writecb in Transform class"));t.writechunk=null;t.writecb=null;if(r!==null&&r!==undefined)e.push(r);if(l)l(a);var n=e._readableState;n.reading=false;if(n.needReadable||n.length<n.highWaterMark){e._read(n.highWaterMark)}}function e(n){if(!(this instanceof e))return new e(n);t.call(this,n);var a=this._transformState=new i(n,this);var r=this;this._readableState.needReadable=true;this._readableState.sync=false;this.once("finish",function(){if("function"===typeof this._flush)this._flush(function(e){l(r,e)});else l(r)})}e.prototype.push=function(e,n){this._transformState.needTransform=false;return t.prototype.push.call(this,e,n)};e.prototype._transform=function(e,n,t){throw new Error("not implemented")};e.prototype._write=function(t,r,l){var e=this._transformState;e.writecb=l;e.writechunk=t;e.writeencoding=r;if(!e.transforming){var n=this._readableState;if(e.needTransform||n.needReadable||n.length<n.highWaterMark)this._read(n.highWaterMark)}};e.prototype._read=function(n){var e=this._transformState;if(e.writechunk!==null&&e.writecb&&!e.transforming){e.transforming=true;this._transform(e.writechunk,e.writeencoding,e.afterTransform)}else{e.needTransform=true}};function l(e,n){if(n)return e.emit("error",n);var t=e._writableState;var l=e._readableState;var r=e._transformState;if(t.length)throw new Error("calling transform done when ws.length != 0");if(r.transforming)throw new Error("calling transform done when still transforming");return e.push(null)}},{"./_stream_duplex":121,"core-util-is":126,inherits:116}],125:[function(e,n,t){(function(r){n.exports=t;var l=e("buffer").Buffer;t.WritableState=s;var a=e("core-util-is");a.inherits=e("inherits");var i=e("stream");a.inherits(t,i);function d(e,n,t){this.chunk=e;this.encoding=n;this.callback=t}function s(e,t){e=e||{};var n=e.highWaterMark;this.highWaterMark=n||n===0?n:16*1024;this.objectMode=!!e.objectMode;this.highWaterMark=~~this.highWaterMark;this.needDrain=false;this.ending=false;this.ended=false;this.finished=false;var r=e.decodeStrings===false;this.decodeStrings=!r;this.defaultEncoding=e.defaultEncoding||"utf8";this.length=0;this.writing=false;this.sync=true;this.bufferProcessing=false;this.onwrite=function(e){g(t,e)};this.writecb=null;this.writelen=0;this.buffer=[];this.errorEmitted=false}function t(n){var r=e("./_stream_duplex");if(!(this instanceof t)&&!(this instanceof r))return new t(n);this._writableState=new s(n,this);this.writable=true;i.call(this)}t.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))};function y(n,l,t){var e=new Error("write after end");n.emit("error",e);r.nextTick(function(){t(e)})}function b(a,i,e,s){var n=true;if(!l.isBuffer(e)&&"string"!==typeof e&&e!==null&&e!==undefined&&!i.objectMode){var t=new TypeError("Invalid non-string/buffer chunk");a.emit("error",t);r.nextTick(function(){s(t)});n=false}return n}t.prototype.write=function(r,e,n){var t=this._writableState;var a=false;if(typeof e==="function"){n=e;e=null}if(l.isBuffer(r))e="buffer";else if(!e)e=t.defaultEncoding;if(typeof n!=="function")n=function(){};if(t.ended)y(this,t,n);else if(b(this,t,r,n))a=w(this,t,r,e,n);return a};function E(n,e,t){if(!n.objectMode&&n.decodeStrings!==false&&typeof e==="string"){e=new l(e,t)}return e}function w(s,e,n,t,r){n=E(e,n,t);if(l.isBuffer(n))t="buffer";var a=e.objectMode?1:n.length;e.length+=a;var i=e.length<e.highWaterMark;if(!i)e.needDrain=true;if(e.writing)e.buffer.push(new d(n,t,r));else o(s,e,a,n,t,r);return i}function o(n,e,t,r,l,a){e.writelen=t;e.writecb=a;e.writing=true;e.sync=true;n._write(r,l,e.onwrite);e.sync=false}function m(n,a,l,e,t){if(l)r.nextTick(function(){t(e)});else t(e);n._writableState.errorEmitted=true;n.emit("error",e)}function h(e){e.writing=false;e.writecb=null;e.length-=e.writelen;e.writelen=0}function g(n,a){var e=n._writableState;var i=e.sync;var t=e.writecb;h(e);if(a)m(n,e,i,a,t);else{var l=c(n,e);if(!l&&!e.bufferProcessing&&e.buffer.length)x(n,e);if(i){r.nextTick(function(){u(n,e,l,t)})}else{u(n,e,l,t)}}}function u(e,n,t,r){if(!t)v(e,n);r();if(t)f(e,n)}function v(n,e){if(e.length===0&&e.needDrain){e.needDrain=false;n.emit("drain")}}function x(l,e){e.bufferProcessing=true;for(var n=0;n<e.buffer.length;n++){var t=e.buffer[n];var r=t.chunk;var a=t.encoding;var i=t.callback;var s=e.objectMode?1:r.length;o(l,e,s,r,a,i);if(e.writing){n++;break}}e.bufferProcessing=false;if(n<e.buffer.length)e.buffer=e.buffer.slice(n);else e.buffer.length=0}t.prototype._write=function(n,t,e){e(new Error("not implemented"))};t.prototype.end=function(e,n,t){var r=this._writableState;if(typeof e==="function"){t=e;e=null;n=null}else if(typeof n==="function"){t=n;n=null}if(typeof e!=="undefined"&&e!==null)this.write(e,n);if(!r.ending&&!r.finished)p(this,r,t)};function c(n,e){return e.ending&&e.length===0&&!e.finished&&!e.writing}function f(e,n){var t=c(e,n);if(t){n.finished=true;e.emit("finish")}return t}function p(t,e,n){e.ending=true;f(t,e);if(n){if(e.finished)r.nextTick(n);else t.once("finish",n)}e.ended=true}}).call(this,e("_process"))},{"./_stream_duplex":121,_process:119,buffer:111,"core-util-is":126,inherits:116,stream:131}],126:[function(n,t,e){(function(f){function u(e){return Array.isArray(e)}e.isArray=u;function r(e){return typeof e==="boolean"}e.isBoolean=r;function l(e){return e===null}e.isNull=l;function a(e){return e==null}e.isNullOrUndefined=a;function i(e){return typeof e==="number"}e.isNumber=i;function s(e){return typeof e==="string"}e.isString=s;function o(e){return typeof e==="symbol"}e.isSymbol=o;function y(e){return e===void 0}e.isUndefined=y;function c(e){return n(e)&&t(e)==="[object RegExp]"}e.isRegExp=c;function n(e){return typeof e==="object"&&e!==null}e.isObject=n;function p(e){return n(e)&&t(e)==="[object Date]"}e.isDate=p;function d(e){return n(e)&&(t(e)==="[object Error]"||e instanceof Error)}e.isError=d;function m(e){return typeof e==="function"}e.isFunction=m;function h(e){return e===null||typeof e==="boolean"||typeof e==="number"||typeof e==="string"||typeof e==="symbol"||typeof e==="undefined"}e.isPrimitive=h;function g(e){return f.isBuffer(e)}e.isBuffer=g;function t(e){return Object.prototype.toString.call(e)}}).call(this,n("buffer").Buffer)},{buffer:111}],127:[function(e,n,t){n.exports=e("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":122}],128:[function(n,t,e){var r=n("stream");e=t.exports=n("./lib/_stream_readable.js");e.Stream=r;e.Readable=e;e.Writable=n("./lib/_stream_writable.js");e.Duplex=n("./lib/_stream_duplex.js");e.Transform=n("./lib/_stream_transform.js");e.PassThrough=n("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":121,"./lib/_stream_passthrough.js":122,"./lib/_stream_readable.js":123,"./lib/_stream_transform.js":124,"./lib/_stream_writable.js":125,stream:131}],129:[function(e,n,t){n.exports=e("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":124}],130:[function(e,n,t){n.exports=e("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":125}],131:[function(n,r,a){r.exports=e;var t=n("events").EventEmitter;var l=n("inherits");l(e,t);e.Readable=n("readable-stream/readable.js");e.Writable=n("readable-stream/writable.js");e.Duplex=n("readable-stream/duplex.js");e.Transform=n("readable-stream/transform.js");e.PassThrough=n("readable-stream/passthrough.js");e.Stream=e;function e(){t.call(this)}e.prototype.pipe=function(n,i){var e=this;function s(t){if(n.writable){if(false===n.write(t)&&e.pause){e.pause()}}}e.on("data",s);function o(){if(e.readable&&e.resume){e.resume()}}n.on("drain",o);if(!n._isStdio&&(!i||i.end!==false)){e.on("end",u);e.on("close",c)}var l=false;function u(){if(l)return;l=true;n.end()}function c(){if(l)return;l=true;if(typeof n.destroy==="function")n.destroy()}function a(e){r();if(t.listenerCount(this,"error")===0){throw e}}e.on("error",a);n.on("error",a);function r(){e.removeListener("data",s);n.removeListener("drain",o);e.removeListener("end",u);e.removeListener("close",c);e.removeListener("error",a);n.removeListener("error",a);e.removeListener("end",r);e.removeListener("close",r);n.removeListener("close",r)}e.on("end",r);e.on("close",r);n.on("close",r);n.emit("pipe",e);return n}},{events:115,inherits:116,"readable-stream/duplex.js":120,"readable-stream/passthrough.js":127,"readable-stream/readable.js":128,"readable-stream/transform.js":129,"readable-stream/writable.js":130}],132:[function(t,u,r){var n=t("buffer").Buffer;var l=n.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return true;default:return false}};function a(e){if(e&&!l(e)){throw new Error("Unknown encoding: "+e)}}var e=r.StringDecoder=function(e){this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,"");a(e);switch(this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2;this.detectIncompleteChar=s;break;case"base64":this.surrogateSize=3;this.detectIncompleteChar=o;break;default:this.write=i;return}this.charBuffer=new n(6);this.charReceived=0;this.charLength=0};e.prototype.write=function(e){var n="";while(this.charLength){var a=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;e.copy(this.charBuffer,this.charReceived,0,a);this.charReceived+=a;if(this.charReceived<this.charLength){return""}e=e.slice(a,e.length);n=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var l=n.charCodeAt(n.length-1);if(l>=55296&&l<=56319){this.charLength+=this.surrogateSize;n="";continue}this.charReceived=this.charLength=0;if(e.length===0){return n}break}this.detectIncompleteChar(e);var t=e.length;if(this.charLength){e.copy(this.charBuffer,0,e.length-this.charReceived,t);t-=this.charReceived}n+=e.toString(this.encoding,0,t);var t=n.length-1;var l=n.charCodeAt(t);if(l>=55296&&l<=56319){var r=this.surrogateSize;this.charLength+=r;this.charReceived+=r;this.charBuffer.copy(this.charBuffer,r,0,r);e.copy(this.charBuffer,0,0,r);return n.substring(0,t)}return n};e.prototype.detectIncompleteChar=function(n){var e=n.length>=3?3:n.length;for(;e>0;e--){var t=n[n.length-e];if(e==1&&t>>5==6){this.charLength=2;break}if(e<=2&&t>>4==14){this.charLength=3;break}if(e<=3&&t>>3==30){this.charLength=4;break}}this.charReceived=e};e.prototype.end=function(e){var n="";if(e&&e.length)n=this.write(e);if(this.charReceived){var t=this.charReceived;var r=this.charBuffer;var l=this.encoding;n+=r.slice(0,t).toString(l)}return n};function i(e){return e.toString(this.encoding)}function s(e){this.charReceived=e.length%2;this.charLength=this.charReceived?2:0}function o(e){this.charReceived=e.length%3;this.charLength=this.charReceived?3:0}},{buffer:111}],133:[function(n,e,t){e.exports=function r(e){return e&&typeof e==="object"&&typeof e.copy==="function"&&typeof e.fill==="function"&&typeof e.readUInt8==="function"}},{}],134:[function(n,t,e){(function(a,L){var _=/%[sdj%]/g;e.format=function(i){if(!p(i)){var o=[];for(var e=0;e<arguments.length;e++){o.push(r(arguments[e]))}return o.join(" ")}var e=1;var n=arguments;var u=n.length;var a=String(i).replace(_,function(t){if(t==="%%")return"%";if(e>=u)return t;switch(t){case"%s":return String(n[e++]);case"%d":return Number(n[e++]);case"%j":try{return JSON.stringify(n[e++])}catch(r){return"[Circular]"}default:return t}});for(var t=n[e];e<u;t=n[++e]){if(s(t)||!l(t)){a+=" "+t}else{a+=" "+r(t)}}return a};e.deprecate=function(r,n){if(t(L.process)){return function(){return e.deprecate(r,n).apply(this,arguments)}}if(a.noDeprecation===true){return r}var l=false;function i(){if(!l){if(a.throwDeprecation){throw new Error(n)}else if(a.traceDeprecation){console.trace(n)}else{console.error(n)}l=true}return r.apply(this,arguments)}return i};var c={};var v;e.debuglog=function(n){if(t(v))v=a.env.NODE_DEBUG||"";n=n.toUpperCase();if(!c[n]){if(new RegExp("\\b"+n+"\\b","i").test(v)){var r=a.pid;c[n]=function(){var t=e.format.apply(e,arguments);console.error("%s %d: %s",n,r,t)}}else{c[n]=function(){}}}return c[n]};function r(l,r){var n={seen:[],stylize:k};if(arguments.length>=3)n.depth=arguments[2];if(arguments.length>=4)n.colors=arguments[3];if(g(r)){n.showHidden=r}else if(r){e._extend(n,r)}if(t(n.showHidden))n.showHidden=false;if(t(n.depth))n.depth=2;if(t(n.colors))n.colors=false;if(t(n.customInspect))n.customInspect=true;if(n.colors)n.stylize=I;return f(n,l,n.depth)}e.inspect=r;r.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]};r.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"};function I(n,t){var e=r.styles[t];if(e){return"["+r.colors[e][0]+"m"+n+"["+r.colors[e][1]+"m"}else{return n}}function k(e,n){return e}function O(n){var e={};n.forEach(function(n,t){e[n]=true});return e}function f(t,n,a){if(t.customInspect&&n&&o(n.inspect)&&n.inspect!==e.inspect&&!(n.constructor&&n.constructor.prototype===n)){var s=n.inspect(a,t);if(!p(s)){s=f(t,s,a)}return s}var y=R(t,n);if(y){return y}var r=Object.keys(n);var v=O(r);if(t.showHidden){r=Object.getOwnPropertyNames(n)}if(i(n)&&(r.indexOf("message")>=0||r.indexOf("description")>=0)){return d(n)}if(r.length===0){if(o(n)){var b=n.name?": "+n.name:"";return t.stylize("[Function"+b+"]","special")}if(u(n)){return t.stylize(RegExp.prototype.toString.call(n),"regexp")}if(x(n)){return t.stylize(Date.prototype.toString.call(n),"date")}if(i(n)){return d(n)}}var l="",h=false,c=["{","}"];if(w(n)){h=true;c=["[","]"]}if(o(n)){var E=n.name?": "+n.name:"";l=" [Function"+E+"]"}if(u(n)){l=" "+RegExp.prototype.toString.call(n)}if(x(n)){l=" "+Date.prototype.toUTCString.call(n)}if(i(n)){l=" "+d(n)}if(r.length===0&&(!h||n.length==0)){return c[0]+l+c[1]}if(a<0){if(u(n)){return t.stylize(RegExp.prototype.toString.call(n),"regexp")}else{return t.stylize("[Object]","special")}}t.seen.push(n);var g;if(h){g=A(t,n,a,v,r)}else{g=r.map(function(e){return m(t,n,a,v,e,h)})}t.seen.pop();return P(g,l,c)}function R(n,e){if(t(e))return n.stylize("undefined","undefined");if(p(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return n.stylize(r,"string")}if(E(e))return n.stylize(""+e,"number");if(g(e))return n.stylize(""+e,"boolean");if(s(e))return n.stylize("null","null")}function d(e){return"["+Error.prototype.toString.call(e)+"]"}function A(r,e,l,a,i){var n=[];for(var t=0,s=e.length;t<s;++t){if(b(e,String(t))){n.push(m(r,e,l,a,String(t),true))}else{n.push("")}}i.forEach(function(t){if(!t.match(/^\d+$/)){n.push(m(r,e,l,a,t,true))}});return n}function m(r,i,o,c,a,u){var e,n,l;l=Object.getOwnPropertyDescriptor(i,a)||{value:i[a]};if(l.get){if(l.set){n=r.stylize("[Getter/Setter]","special")}else{n=r.stylize("[Getter]","special")}}else{if(l.set){n=r.stylize("[Setter]","special")}}if(!b(c,a)){e="["+a+"]"}if(!n){if(r.seen.indexOf(l.value)<0){if(s(o)){n=f(r,l.value,null)}else{n=f(r,l.value,o-1)}if(n.indexOf("\n")>-1){if(u){n=n.split("\n").map(function(e){return" "+e}).join("\n").substr(2)}else{n="\n"+n.split("\n").map(function(e){return" "+e}).join("\n")}}}else{n=r.stylize("[Circular]","special")}}if(t(e)){if(u&&a.match(/^\d+$/)){return n}e=JSON.stringify(""+a);if(e.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){e=e.substr(1,e.length-2);e=r.stylize(e,"name")}else{e=e.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");e=r.stylize(e,"string")}}return e+": "+n}function P(n,t,e){var r=0;var l=n.reduce(function(n,e){r++;if(e.indexOf("\n")>=0)r++;return n+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(l>60){return e[0]+(t===""?"":t+"\n ")+" "+n.join(",\n ")+" "+e[1]}return e[0]+t+" "+n.join(", ")+" "+e[1]}function w(e){return Array.isArray(e)}e.isArray=w;function g(e){return typeof e==="boolean"}e.isBoolean=g;function s(e){return e===null}e.isNull=s;function C(e){return e==null}e.isNullOrUndefined=C;function E(e){return typeof e==="number"}e.isNumber=E;function p(e){return typeof e==="string"}e.isString=p;function S(e){return typeof e==="symbol"}e.isSymbol=S;function t(e){return e===void 0}e.isUndefined=t;function u(e){return l(e)&&y(e)==="[object RegExp]"}e.isRegExp=u;function l(e){return typeof e==="object"&&e!==null}e.isObject=l;function x(e){return l(e)&&y(e)==="[object Date]"}e.isDate=x;function i(e){return l(e)&&(y(e)==="[object Error]"||e instanceof Error)}e.isError=i;function o(e){return typeof e==="function"}e.isFunction=o;function T(e){return e===null||typeof e==="boolean"||typeof e==="number"||typeof e==="string"||typeof e==="symbol"||typeof e==="undefined"}e.isPrimitive=T;e.isBuffer=n("./support/isBuffer");function y(e){return Object.prototype.toString.call(e)}function h(e){return e<10?"0"+e.toString(10):e.toString(10)}var j=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function M(){var e=new Date;var n=[h(e.getHours()),h(e.getMinutes()),h(e.getSeconds())].join(":");return[e.getDate(),j[e.getMonth()],n].join(" ")}e.log=function(){console.log("%s - %s",M(),e.format.apply(e,arguments))};e.inherits=n("inherits");e._extend=function(n,e){if(!e||!l(e))return n;var t=Object.keys(e);var r=t.length;while(r--){n[t[r]]=e[t[r]]}return n};function b(e,n){return Object.prototype.hasOwnProperty.call(e,n)}}).call(this,n("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./support/isBuffer":133,_process:119,inherits:116}],135:[function(n,e,t){!function(n,M,r){"use strict";var O="Object",It="Function",N="Array",on="String",En="Number",xn="RegExp",Nn="Date",xt="Map",Vn="Set",ot="WeakMap",pt="WeakSet",j="Symbol",In="Promise",Gn="Math",Dt="Arguments",l="prototype",Hn="constructor",U="toString",ct=U+"Tag",bt="toLocaleString",Ft="hasOwnProperty",At="forEach",Mn="iterator",ln="@@"+Mn,jt="process",Pt="createElement",Lt=n[It],i=n[O],R=n[N],y=n[on],Tt=n[En],tn=n[xn],Zt=n[Nn],rt=n[xt],kt=n[Vn],nt=n[ot],_t=n[pt],x=n[j],d=n[Gn],Ln=n.TypeError,Ut=n.setTimeout,jn=n.setImmediate,Zn=n.clearImmediate,Qn=n[jt],mt=Qn&&Qn.nextTick,wn=n.document,dt=wn&&wn.documentElement,Qt=n.navigator,Bn=n.define,p=R[l],T=i[l],fn=Lt[l],$=1/0,hn=".";function f(e){return e!=null&&(typeof e=="object"||typeof e=="function")}function v(e){return typeof e=="function"}var en=o(/./.test,/\[native code\]\s*\}\s*$/,1);var qt={Undefined:1,Null:1,Array:1,String:1,Arguments:1,Function:1,Error:1,Boolean:1,Number:1,Date:1,RegExp:1},Jt=T[U];function J(e,n,t){if(e&&!s(e=t?e:e[l],yn))a(e,yn,n)}function pn(e){return e==r?e===r?"Undefined":"Null":Jt.call(e).slice(8,-1)}function Sn(n){var t=pn(n),e;return t==O&&(e=n[yn])?s(qt,e)?"~"+e:e:t}var z=fn.call,it=fn.apply,Y;function Tn(){var e=arguments.length,t=R(e),n=0,r=gn._,l=false;while(e>n)if((t[n]=arguments[n++])===r)l=true;return at(this,t,e,l,r,false)}function at(e,n,r,t,l,a,i){P(e);return function(){var c=a?i:this,f=arguments.length,o=0,u=0,s;if(!t&&!f)return B(e,n,c);s=n.slice();if(t)for(;r>o;o++)if(s[o]===l)s[o]=arguments[u++];while(f>u)s.push(arguments[u++]);return B(e,s,c)}}function o(e,n,t){P(e);if(~t&&n===r)return e;switch(t){case 1:return function(t){return e.call(n,t)};case 2:return function(t,r){return e.call(n,t,r)};case 3:return function(t,r,l){return e.call(n,t,r,l)}}return function(){return e.apply(n,arguments)}}function B(n,e,t){var l=t===r;switch(e.length|0){case 0:return l?n():n.call(t);case 1:return l?n(e[0]):n.call(t,e[0]);case 2:return l?n(e[0],e[1]):n.call(t,e[0],e[1]);case 3:return l?n(e[0],e[1],e[2]):n.call(t,e[0],e[1],e[2]);case 4:return l?n(e[0],e[1],e[2],e[3]):n.call(t,e[0],e[1],e[2],e[3]);case 5:return l?n(e[0],e[1],e[2],e[3],e[4]):n.call(t,e[0],e[1],e[2],e[3],e[4])}return n.apply(t,e)}function zt(e,r){var n=W((arguments.length<3?e:P(arguments[2]))[l]),t=it.call(e,n,r);return f(t)?t:n}var W=i.create,nn=i.getPrototypeOf,_n=i.setPrototypeOf,E=i.defineProperty,Kt=i.defineProperties,G=i.getOwnPropertyDescriptor,mn=i.keys,qn=i.getOwnPropertyNames,ft=i.getOwnPropertySymbols,s=o(z,T[Ft],2),Fn=i;function k(e){return Fn(w(e))}function $t(e){return e}function bn(){return this}function On(e,n){if(s(e,n))return e[n]}function Xn(e){return ft?qn(e).concat(ft(e)):qn(e)}var Ct=i.assign||function(s,c){var e=i(w(s)),o=arguments.length,n=1;while(o>n){var t=Fn(arguments[n++]),r=mn(t),u=r.length,l=0,a;while(u>l)e[a=r[l++]]=t[a]}return e};function Un(l,a){var e=k(l),n=mn(e),i=n.length,t=0,r;while(i>t)if(e[r=n[t++]]===a)return r}function un(e){return y(e).split(",")}var Et=p.push,rr=p.unshift,tr=p.slice,nr=p.splice,er=p.indexOf,X=p[At];function st(e){var t=e==1,a=e==2,s=e==3,n=e==4,l=e==6,u=e==5||l;return function(y){var h=i(w(this)),v=arguments[1],p=Fn(h),x=o(y,v,3),g=S(p.length),c=0,d=t?R(g):a?[]:r,f,m;for(;g>c;c++)if(u||c in p){f=p[c];m=x(f,c,h);if(e){if(t)d[c]=m;else if(m)switch(e){case 3:return true;case 5:return f;case 6:return c;case 2:d.push(f)}else if(n)return false}}return l?-1:s||n?n:d}}function Bt(e){return function(r){var t=k(this),l=S(t.length),n=V(arguments[1],l);if(e&&r!=r){for(;l>n;n++)if(Jn(t[n]))return e||n}else for(;l>n;n++)if(e||n in t){if(t[n]===r)return e||n}return!e&&-1}}function Dn(e,n){return typeof e=="function"?e:n}var An=9007199254740991,Xt=d.ceil,yt=d.floor,vt=d.max,q=d.min,wt=d.random,St=d.trunc||function(e){return(e>0?yt:Xt)(e)};function Jn(e){return e!=e}function kn(e){return isNaN(e)?0:St(e)}function S(e){return e>0?q(kn(e),An):0}function V(e,n){var e=kn(e);return e<0?vt(e+n,0):q(e,n)}function Rn(n,e,t){var r=f(e)?function(n){return e[n]}:e;return function(e){return y(t?e:this).replace(n,r)}}function Wn(e){return function(s){var t=y(w(this)),n=kn(s),i=t.length,l,a;if(n<0||n>=i)return e?"":r;l=t.charCodeAt(n);return l<55296||l>56319||n+1===i||(a=t.charCodeAt(n+1))<56320||a>57343?e?t.charAt(n):l:e?t.slice(n,n+2):(l-55296<<10)+(a-56320)+65536}}var Gt="Reduce of empty object with no initial value";function H(t,e,n){if(!t)throw Ln(n?e+n:e)}function w(e){if(e==r)throw Ln("Function called on null or undefined");return e}function P(e){H(v(e),e," is not a function!");return e}function A(e){H(f(e),e," is not an object!");return e}function Cn(e,n,t){H(e instanceof n,t,": use the 'new' operator!")}function dn(e,n){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:n}}function ht(e,n,t){e[n]=t;return e}function gt(e){return K?function(n,t,r){return E(n,t,dn(e,r))}:ht}function Kn(e){return j+"("+e+")_"+(++Vt+wt())[U](36)}function F(e,n){return x&&x[e]||(n?x:_)(j+hn+e)}var K=!!function(){try{return E({},hn,T)}catch(e){}}(),Vt=0,a=gt(1),b=x?ht:a,_=x||Kn;function Q(e,n){for(var t in n)a(e,t,n[t]);return e}var Pn=F("unscopables"),tt=p[Pn]||{};var Z=F(Mn),yn=F(ct),Ht=ln in p,c=_("iter"),D=1,I=2,rn={},Mt={},Nt=Z in p,Ot="keys"in p&&!("next"in[].keys());cn(Mt,bn);function cn(e,n){a(e,Z,n);Ht&&a(e,ln,n)}function an(e,n,t,r){e[l]=W(r||Mt,{next:dn(1,t)});J(e,n+" Iterator")}function lt(r,t,a,i){var e=r[l],n=On(e,Z)||On(e,ln)||i&&On(e,i)||a;if(M){cn(e,n);if(n!==a){var o=nn(n.call(new r));J(o,t+" Iterator",true);s(e,ln)&&cn(o,bn)}}rn[t]=n;rn[t+" Iterator"]=bn;return n}function et(a,e,i,o,s,u){function r(e){return function(){return new i(this,e)}}an(i,e,o);var l=r(D+I),n=r(I);if(s==I)n=lt(a,e,n,"values");else l=lt(a,e,l,"entries");if(s){t(C+h*Ot,e,{entries:l,keys:u?n:r(D),values:n})}}function u(e,n){return{value:n,done:!!e}}function $n(r){var e=i(r),t=n[j],l=(t&&t[Mn]||ln)in e;return l||Z in e||s(rn,Sn(e))}function sn(e){var t=n[j],r=e[t&&t[Mn]||ln],l=r||e[Z]||rn[Sn(e)];return A(l.call(e))}function zn(e,n,t){return t?B(e,n):e(n)}function vn(t,e,r,l){var a=sn(t),i=o(r,l,e?2:1),n;while(!(n=a.next()).done)if(zn(i,n.value,e)===false)return}var Wt=pn(Qn)==jt,m={},gn=M?n:m,Yt=n.core,Rt,h=1,L=2,g=4,C=8,ut=16,Yn=32;function t(i,s,p){var t,c,e,u,f=i&L,r=f?n:i&g?n[s]:(n[s]||T)[l],d=f?m:m[s]||(m[s]={});if(f)p=s;for(t in p){c=!(i&h)&&r&&t in r&&(!v(r[t])||en(r[t]));e=(c?r:p)[t];if(i&ut&&c)u=o(e,n);else if(i&Yn&&!M&&r[t]==e){u=function(n){return this instanceof e?new e(n):e(n)};u[l]=e[l]}else u=i&C&&v(e)?o(z,e):e;if(d[t]!=e)a(d,t,u);if(M&&r&&!c){if(f)r[t]=e;
else delete r[t]&&a(r,t,e)}}}if(typeof e!="undefined"&&e.exports)e.exports=m;else if(v(Bn)&&Bn.amd)Bn(function(){return m});else Rt=true;if(Rt||M){m.noConflict=function(){n.core=Yt;return m};n.core=m}t(L+h,{global:n});!function(r,e,n){if(!en(x)){x=function(t){H(!(this instanceof x),j+" is not a "+Hn);var e=Kn(t);K&&n&&E(T,e,{configurable:true,set:function(n){a(this,e,n)}});return b(W(x[l]),r,e)};a(x[l],U,function(){return this[r]})}t(L+Yn,{Symbol:x});var i={"for":function(n){return s(e,n+="")?e[n]:e[n]=x(n)},iterator:Z,keyFor:Tn.call(Un,e),toStringTag:yn=F(ct,true),unscopables:Pn,pure:_,set:b,useSetter:function(){n=true},useSimple:function(){n=false}};X.call(un("hasInstance,isConcatSpreadable,match,replace,search,"+"species,split,toPrimitive"),function(e){i[e]=F(e)});t(g,j,i);J(x,j);t(L,{Reflect:{ownKeys:Xn}})}(_("tag"),{},true);!function(j,P,nn,_){var Z=n.RangeError,cn=Tt.isInteger||function(e){return!f(e)&&P(e)&&yt(e)===e},W=d.sign||function bn(e){return(e=+e)==0||e!=e?e:e<0?-1:1},F=d.pow,Q=d.abs,v=d.exp,x=d.log,B=d.sqrt,mn=y.fromCharCode,gn=Wn(true);var ln={assign:Ct,is:function(e,n){return e===n?e!==0||1/e===1/n:e!=e&&n!=n}};"__proto__"in T&&function(n,e){try{e=o(z,G(T,"__proto__").set,2);e({},p)}catch(t){n=true}ln.setPrototypeOf=_n=_n||function(r,t){A(r);H(t===null||f(t),t,": can't set as prototype!");if(n)r.__proto__=t;else e(r,t);return r}}();t(g,O,ln);function an(e){return!P(e=+e)||e==0?e:e<0?-an(-e):x(e+B(e*e+1))}t(g,En,{EPSILON:F(2,-52),isFinite:function(e){return typeof e=="number"&&P(e)},isInteger:cn,isNaN:Jn,isSafeInteger:function(e){return cn(e)&&Q(e)<=An},MAX_SAFE_INTEGER:An,MIN_SAFE_INTEGER:-An,parseFloat:parseFloat,parseInt:parseInt});t(g,Gn,{acosh:function(e){return(e=+e)<1?NaN:x(e+B(e*e-1))},asinh:an,atanh:function(e){return(e=+e)==0?e:x((1+e)/(1-e))/2},cbrt:function(e){return W(e=+e)*F(Q(e),1/3)},clz32:function(e){return(e>>>=0)?32-e[U](2).length:32},cosh:function(e){return(v(e=+e)+v(-e))/2},expm1:function(e){return(e=+e)==0?e:e>-1e-6&&e<1e-6?e+e*e/2:v(e)-1},fround:function(e){return new Float32Array([e])[0]},hypot:function(i,s){var r=0,n=arguments.length,l=n,a=R(n),t=-$,e;while(n--){e=a[n]=+arguments[n];if(e==$||e==-$)return $;if(e>t)t=e}t=e||1;while(l--)r+=F(a[l]/t,2);return t*B(r)},imul:function(a,i){var e=65535,n=+a,t=+i,r=e&n,l=e&t;return 0|r*l+((e&n>>>16)*l+r*(e&t>>>16)<<16>>>0)},log1p:function(e){return(e=+e)>-1e-8&&e<1e-8?e-e*e/2:x(1+e)},log10:function(e){return x(e)/d.LN10},log2:function(e){return x(e)/d.LN2},sign:W,sinh:function(e){return(e=+e)==0?e:(v(e)-v(-e))/2},tanh:function(e){return P(e=+e)?e==0?e:(v(e)-v(-e))/(v(e)+v(-e)):W(e)},trunc:St});J(d,Gn,true);function Y(e){if(pn(e)==xn)throw Ln()}t(g,on,{fromCodePoint:function(l){var n=[],r=arguments.length,t=0,e;while(r>t){e=+arguments[t++];if(V(e,1114111)!==e)throw Z(e+" is not a valid code point");n.push(e<65536?mn(e):mn(((e-=65536)>>10)+55296,e%1024+56320))}return n.join("")},raw:function(r){var t=k(r.raw),l=S(t.length),a=arguments.length,n=[],e=0;while(l>e){n.push(y(t[e++]));if(e<a)n.push(y(arguments[e]))}return n.join("")}});t(C,on,{codePointAt:Wn(false),endsWith:function(e){Y(e);var n=y(w(this)),t=arguments[1],l=S(n.length),a=t===r?l:q(S(t),l);e+="";return n.slice(a-e.length,a)===e},includes:function(e){Y(e);return!!~y(w(this)).indexOf(e,arguments[1])},repeat:function(r){var n=y(w(this)),t="",e=kn(r);if(0>e||e==$)throw Z("Count can't be negative");for(;e>0;(e>>>=1)&&(n+=n))if(e&1)t+=n;return t},startsWith:function(e){Y(e);var n=y(w(this)),t=S(q(arguments[1],n.length));e+="";return n.slice(t,t+e.length)===e}});et(y,on,function(e){b(this,c,{o:y(e),i:0})},function(){var e=this[c],t=e.o,r=e.i,n;if(r>=t.length)return u(1);n=gn.call(t,r);e.i+=n.length;return u(0,n)});t(g,N,{from:function(d){var n=i(w(d)),t=new(Dn(this,R)),u=arguments[1],f=arguments[2],l=u!==r,s=l?o(u,f,2):r,e=0,c;if($n(n))for(var p=sn(n),a;!(a=p.next()).done;e++){t[e]=l?s(a.value,e):a.value}else for(c=S(n.length);c>e;e++){t[e]=l?s(n[e],e):n[e]}t.length=e;return t},of:function(){var e=0,n=arguments.length,t=new(Dn(this,R))(n);while(n>e)t[e]=arguments[e++];t.length=n;return t}});t(C,N,{copyWithin:function(u,c){var t=i(w(this)),l=S(t.length),e=V(u,l),n=V(c,l),o=arguments[2],f=o===r?l:V(o,l),a=q(f-n,l-e),s=1;if(n<e&&e<n+a){s=-1;n=n+a-1;e=e+a-1}while(a-->0){if(n in t)t[e]=t[n];else delete t[e];e+=s;n+=s}return t},fill:function(a){var e=i(w(this)),n=S(e.length),t=V(arguments[1],n),l=arguments[2],s=l===r?n:V(l,n);while(s>t)e[t++]=a;return e},find:st(5),findIndex:st(6)});et(R,N,function(e,n){b(this,c,{o:k(e),i:0,k:n})},function(){var n=this[c],t=n.o,l=n.k,e=n.i++;if(!t||e>=t.length)return n.o=r,u(1);if(l==D)return u(0,e);if(l==I)return u(0,t[e]);return u(0,[e,t[e]])},I);rn[Dt]=rn[N];J(n.JSON,"JSON",true);function e(r,n){var e=i[r],l=m[O][r],a=0,s={};if(!l||en(l)){s[r]=n==1?function(n){return f(n)?e(n):n}:n==2?function(n){return f(n)?e(n):true}:n==3?function(n){return f(n)?e(n):false}:n==4?function(n,t){return e(k(n),t)}:function(n){return e(k(n))};try{e(hn)}catch(o){a=1}t(g+h*a,O,s)}}e("freeze",1);e("seal",1);e("preventExtensions",1);e("isFrozen",2);e("isSealed",2);e("isExtensible",3);e("getOwnPropertyDescriptor",4);e("getPrototypeOf");e("keys");e("getOwnPropertyNames");if(M){nn[yn]=hn;if(pn(nn)!=hn)a(T,U,function(){return"[object "+Sn(this)+"]"});_ in fn||E(fn,_,{configurable:true,get:function(){var e=y(this).match(/^\s*function ([^ (]*)/),n=e?e[1]:"";s(this,_)||E(this,_,dn(5,n));return n},set:function(e){s(this,_)||E(this,_,dn(0,e))}});var vn=tn;var L=function wn(e,n){return new vn(pn(e)==xn&&n!==r?e.source:e,n)};if(K&&!function(){try{return tn(/a/g,"i")=="/a/i"}catch(e){}}()){X.call(qn(tn),function(e){e in L||E(L,e,{configurable:true,get:function(){return tn[e]},set:function(n){tn[e]=n}})});j[Hn]=L;L[l]=j;a(n,xn,L)}if(/./g.flags!="g")E(j,"flags",{configurable:true,get:Rn(/^.*\/(\w*)$/,"$1")});X.call(un("find,findIndex,fill,copyWithin,entries,keys,values"),function(e){tt[e]=true});Pn in p||a(p,Pn,tt)}}(tn[l],isFinite,{},"name");v(jn)&&v(Zn)||function(f){var p=n.postMessage,u=n.addEventListener,c=n.MessageChannel,l=0,t={},e,a,i;jn=function(n){var r=[],a=1;while(arguments.length>a)r.push(arguments[a++]);t[++l]=function(){B(v(n)?n:Lt(n),r)};e(l);return l};Zn=function(e){delete t[e]};function r(e){if(s(t,e)){var n=t[e];delete t[e];n()}}function d(e){r(e.data)}if(Wt){e=function(e){mt(Tn.call(r,e))}}else if(u&&v(p)&&!n.importScripts){e=function(e){p(e,"*")};u("message",d,false)}else if(v(c)){a=new c;i=a.port2;a.port1.onmessage=d;e=o(i.postMessage,i,1)}else if(wn&&f in wn[Pt]("script")){e=function(e){dt.appendChild(wn[Pt]("script"))[f]=function(){dt.removeChild(this);r(e)}}}else{e=function(e){Ut(Tn.call(r,e),0)}}}("onreadystatechange");t(L+ut,{setImmediate:jn,clearImmediate:Zn});!function(e,n){v(e)&&v(e.resolve)&&e.resolve(n=new e(function(){}))==n||function(c,i){function s(n){var e;if(f(n))e=n.then;return v(e)?e:false}function t(n){var e=n.chain;e.length&&c(function(){var t=n.msg,l=n.state==1,r=0;while(e.length>r)!function(e){var r=l?e.ok:e.fail,n,a;try{if(r){n=r===true?t:r(t);if(n===e.P){e.rej(Ln(In+"-chain cycle"))}else if(a=s(n)){a.call(n,e.res,e.rej)}else e.res(n)}else e.rej(t)}catch(i){e.rej(i)}}(e[r++]);e.length=0})}function u(l){var e=this,a,r;if(e.done)return;e.done=true;e=e.def||e;try{if(a=s(l)){r={def:e,done:false};a.call(l,o(u,r,1),o(n,r,1))}else{e.msg=l;e.state=1;t(e)}}catch(i){n.call(r||{def:e,done:false},i)}}function n(n){var e=this;if(e.done)return;e.done=true;e=e.def||e;e.msg=n;e.state=2;t(e)}e=function(l){P(l);Cn(this,e,In);var t={chain:[],state:0,done:false,msg:r};a(this,i,t);try{l(o(u,t,1),o(n,t,1))}catch(s){n.call(t,s)}};Q(e[l],{then:function(r,l){var e={ok:v(r)?r:true,fail:v(l)?l:false},a=e.P=new this[Hn](function(n,t){e.res=P(n);e.rej=P(t)}),n=this[i];n.chain.push(e);n.state&&t(n);return a},"catch":function(e){return this.then(r,e)}});Q(e,{all:function(t){var n=this,e=[];return new n(function(a,i){vn(t,false,Et,e);var r=e.length,l=R(r);if(r)X.call(e,function(e,t){n.resolve(e).then(function(e){l[t]=e;--r||a(l)},i)});else a(l)})},race:function(n){var e=this;return new e(function(t,r){vn(n,false,function(n){e.resolve(n).then(t,r)})})},reject:function(e){return new this(function(t,n){n(e)})},resolve:function(e){return f(e)&&nn(e)===this[l]?e:new this(function(n,t){n(e)})}})}(mt||jn,_("def"));J(e,In);t(L+h*!en(e),{Promise:e})}(n[In]);!function(){var e=_("uid"),p=_("data"),n=_("weak"),d=_("last"),i=_("first"),m=K?_("size"):"size",v=0;function y(n,o,T,A,g,f){var _=g?"set":"add",x=n&&n[l],C={};function S(e,n){if(n!=r)vn(n,g,e[_],e);return e}function y(e,n){var t=x[e];M&&a(x,e,function(e,r){var l=t.call(this,e===0?0:e,r);return n?this:l})}if(!en(n)||!(f||!Ot&&s(x,"entries"))){n=f?function(t){Cn(this,n,o);b(this,e,v++);S(this,t)}:function(t){var e=this;Cn(e,n,o);b(e,p,W(null));b(e,m,0);b(e,d,r);b(e,i,r);S(e,t)};Q(Q(n[l],T),A);f||E(n[l],"size",{get:function(){return w(this[m])}})}else{var P=n,k=new n,j=k[_](f?{}:-0,1),R;if(!Nt||!n.length){n=function(e){Cn(this,n,o);return S(new P,e)};n[l]=x}f||k[At](function(n,e){R=1/e===-$});if(R){y("delete");y("has");g&&y("get")}if(R||j!==k)y(_,true)}J(n,o);C[o]=n;t(L+Yn+h*!en(n),C);f||et(n,o,function(e,n){b(this,c,{o:e,k:n})},function(){var n=this[c],t=n.o,l=n.k,e=n.l;while(e&&e.r)e=e.p;if(!t||!(n.l=e=e?e.n:t[i]))return n.o=r,u(1);if(l==D)return u(0,e.k);if(l==I)return u(0,e.v);return u(0,[e.k,e.v])},g?D+I:I,!g);return n}function g(n,t){if(!f(n))return(typeof n=="string"?"S":"P")+n;if(!s(n,e)){if(t)a(n,e,++v);else return""}return"O"+n[e]}function x(e,a,s){var t=g(a,true),r=e[p],l=e[d],n;if(t in r)r[t].v=s;else{n=r[t]={k:a,v:s,p:l};if(!e[i])e[i]=n;if(l)l.n=n;e[d]=n;e[m]++}return e}function S(e,l){var a=e[p],n=a[l],t=n.n,r=n.p;delete a[l];n.r=true;if(r)r.n=t;if(t)t.p=r;if(e[i]==n)e[i]=t;if(e[d]==n)e[d]=r;e[m]--}var k={clear:function(){for(var e in this[p])S(this,e)},"delete":function(t){var e=g(t),n=e in this[p];if(n)S(this,e);return n},forEach:function(n){var t=o(n,arguments[1],3),e;while(e=e?e.n:this[i]){t(e.v,e.k,this);while(e&&e.r)e=e.p}},has:function(e){return g(e)in this[p]}};rt=y(rt,xt,{get:function(n){var e=this[p][g(n)];return e&&e.v},set:function(e,n){return x(this,e===0?0:e,n)}},k,true);kt=y(kt,Vn,{add:function(e){return x(this,e=e===0?0:e,e)}},k);function R(r,t,l){s(A(t),n)||a(t,n,{});t[n][r[e]]=l;return r}function C(t){return f(t)&&s(t,n)&&s(t[n],this[e])}var T={"delete":function(t){return C.call(this,t)&&delete t[n][this[e]]},has:C};nt=y(nt,ot,{get:function(t){if(f(t)&&s(t,n))return t[n][this[e]]},set:function(e,n){return R(this,e,n)}},T,true,true);_t=y(_t,pt,{add:function(e){return R(this,e,true)}},T,false,true)}();!function(){function e(e){var n=[],t;for(t in e)n.push(t);b(this,c,{o:e,a:n,i:0})}an(e,O,function(){var e=this[c],n=e.a,t;do{if(e.i>=n.length)return u(1)}while(!((t=n[e.i++])in e.o));return u(0,t)});function n(e){return function(n){A(n);try{return e.apply(r,arguments),true}catch(t){return false}}}function l(n,t){var a=arguments.length<3?n:arguments[2],e=G(A(n),t),i;if(e)return e.get?e.get.call(a):e.value;return f(i=nn(n))?l(i,t,a):r}function a(r,n,l){var t=arguments.length<4?r:arguments[3],e=G(A(r),n),i;if(e){if(e.writable===false)return false;if(e.set)return e.set.call(t,l),true}if(f(i=nn(r)))return a(i,n,l,t);e=G(t,n)||dn(0);e.value=l;return E(t,n,e),true}var s={apply:o(z,it,3),construct:zt,defineProperty:n(E),deleteProperty:function(e,n){var t=G(A(e),n);return t&&!t.configurable?false:delete e[n]},enumerate:function(n){return new e(A(n))},get:l,getOwnPropertyDescriptor:G,getPrototypeOf:nn,has:function(e,n){return n in e},isExtensible:i.isExtensible||function(e){return!!A(e)},ownKeys:Xn,preventExtensions:n(i.preventExtensions||$t),set:a};if(_n)s.setPrototypeOf=function(e,n){return _n(A(e),n),true};t(L,{Reflect:{}});t(g,"Reflect",s)}();!function(){t(C,N,{includes:Bt(true)});t(C,on,{at:Wn(true)});function e(e){return function(a){var i=k(a),t=mn(a),r=t.length,n=0,l=R(r),s;if(e)while(r>n)l[n]=[s=t[n++],i[s]];else while(r>n)l[n]=i[t[n++]];return l}}t(g,O,{values:e(false),entries:e(true)});t(g,xn,{escape:Rn(/([\\\-[\]{}()*+?.,^$|])/g,"\\$1",true)})}();!function(e){Y=F(e+"Get",true);var n=F(e+Vn,true),r=F(e+"Delete",true);t(g,j,{referenceGet:Y,referenceSet:n,referenceDelete:r});a(fn,Y,bn);function i(t){if(t){var e=t[l];a(e,Y,e.get);a(e,n,e.set);a(e,r,e["delete"])}}i(rt);i(nt)}("reference");!function(y){function n(e){var n=W(null);if(e!=r){if($n(e)){for(var a=sn(e),l,t;!(l=a.next()).done;){t=l.value;n[t[0]]=t[1]}}else Ct(n,e)}return n}n[l]=null;function d(e,n){b(this,c,{o:k(e),a:mn(e),i:0,k:n})}an(d,y,function(){var e=this[c],t=e.o,r=e.a,l=e.k,n;do{if(e.i>=r.length)return u(1)}while(!s(t,n=r[e.i++]));if(l==D)return u(0,n);if(l==I)return u(0,t[n]);return u(0,[n,t[n]])});function a(e){return function(n){return new d(n,e)}}function e(e){var l=e==1,t=e==4;return function(p,d,m){var h=o(d,m,3),f=k(p),u=l||e==7||e==2?new(Dn(this,n)):r,a,c,i;for(a in f)if(s(f,a)){c=f[a];i=h(c,a,p);if(e){if(l)u[a]=i;else if(i)switch(e){case 2:u[a]=c;break;case 3:return true;case 5:return c;case 6:return a;case 7:u[i[0]]=i[1]}else if(t)return false}}return e==3||t?t:u}}function m(e){return function(p,d,a){P(d);var l=k(p),o=mn(l),m=o.length,u=0,t,c,f;if(e)t=a==r?new(Dn(this,n)):i(a);else if(arguments.length<3){H(m,Gt);t=l[o[u++]]}else t=i(a);while(m>u)if(s(l,c=o[u++])){f=d(t,l[c],c,p);if(e){if(f===false)break}else t=f}return t}}var g=e(6);function v(n,e){return(e==e?Un(n,e):g(n,Jn))!==r}var p={keys:a(D),values:a(I),entries:a(D+I),forEach:e(0),map:e(1),filter:e(2),some:e(3),every:e(4),find:e(5),findKey:g,mapPairs:e(7),reduce:m(false),turn:m(true),keyOf:Un,includes:v,has:s,get:On,set:gt(0),isDict:function(e){return f(e)&&nn(e)===n[l]}};if(Y)for(var x in p)!function(e){function n(){for(var n=[this],t=0;t<arguments.length;)n.push(arguments[t++]);return B(e,n)}e[Y]=function(){return n}}(p[x]);t(L+h,{Dict:Q(n,p)})}("Dict");!function(e,a){function n(t,r){if(!(this instanceof n))return new n(t,r);this[c]=sn(t);this[e]=!!r}an(n,"Wrapper",function(){return this[c].next()});var i=n[l];cn(i,function(){return this[c]});function s(t){function n(n,t,r){this[c]=sn(n);this[e]=n[e];this[a]=o(t,r,n[e]?2:1)}an(n,"Chain",t,i);cn(n[l],bn);return n}var f=s(function(){var n=this[c].next();return n.done?n:u(0,zn(this[a],n.value,this[e]))});var p=s(function(){for(;;){var n=this[c].next();if(n.done||zn(this[a],n.value,this[e]))return n}});Q(i,{of:function(n,t){vn(this,this[e],n,t)},array:function(e,t){var n=[];vn(e!=r?this.map(e,t):this,false,Et,n);return n},filter:function(e,n){return new p(this,e,n)},map:function(e,n){return new f(this,e,n)}});n.isIterable=$n;n.getIterator=sn;t(L+h,{$for:n})}("entries",_("fn"));!function(e,l){m._=gn._=gn._||{};t(C+h,It,{part:Tn,by:function(i){var e=this,l=gn._,s=false,n=arguments.length,u=i===l,t=+!u,c=t,r,a;if(u){r=e;e=z}else r=i;if(n<2)return o(e,r,-1);a=R(n-c);while(n>t)if((a[t-c]=arguments[t++])===l)s=true;return at(e,a,n,s,l,true,r)},only:function(e,n){var t=P(this),r=S(e),l=arguments.length>1;return function(){var a=q(r,arguments.length),i=R(a),e=0;while(a>e)i[e]=arguments[e++];return B(t,i,l?n:this)}}});function n(i){var n=this,t={};return a(n,e,function(e){if(e===r||!(e in n))return l.call(n);return s(t,e)?t[e]:t[e]=o(n[e],n,-1)})[e](i)}a(gn._,U,function(){return e});a(T,e,n);K||a(p,e,n)}(K?Kn("tie"):bt,T[bt]);!function(){function e(e,n){var t=Xn(k(n)),a=t.length,r=0,l;while(a>r)E(e,l=t[r++],G(n,l));return e}t(g+h,O,{isObject:f,classof:Sn,define:e,make:function(n,t){return e(W(n),t)}})}();t(C+h,N,{turn:function(n,t){P(n);var l=t==r?[]:i(t),a=Fn(this),s=S(a.length),e=0;while(s>e)if(n(l,a[e],e++,this)===false)break;return l}});if(M)tt.turn=true;!function(n){function e(e,t){X.call(un(e),function(e){if(e in p)n[e]=o(z,p[e],t)})}e("pop,reverse,shift,keys,values,entries",1);e("indexOf,every,some,forEach,map,filter,find,findIndex,includes",3);e("join,slice,concat,push,splice,unshift,sort,lastIndexOf,"+"reduce,reduceRight,copyWithin,fill,turn");t(g,N,n)}({});!function(e){function n(e){b(this,c,{l:S(e),i:0})}an(n,En,function(){var e=this[c],n=e.i++;return n<e.l?u(0,n):u(1)});lt(Tt,En,function(){return new n(this)});e.random=function(e){var n=+this,t=e==r?0:+e,l=q(n,t);return wt()*(vt(n,t)-l)+l};X.call(un("round,floor,ceil,abs,sin,asin,cos,acos,tan,atan,exp,sqrt,max,min,pow,atan2,"+"acosh,asinh,atanh,cbrt,clz32,cosh,expm1,hypot,imul,log1p,log10,log2,sign,sinh,tanh,trunc"),function(n){var t=d[n];if(t)e[n]=function(){var e=[+this],n=0;while(arguments.length>n)e.push(arguments[n++]);return B(t,e)}});t(C+h,En,e)}({});!function(){var e={"&":"&","<":"<",">":">",'"':""","'":"'"},r={},n;for(n in e)r[e[n]]=n;t(C+h,on,{escapeHTML:Rn(/[&<>"']/g,e),unescapeHTML:Rn(/&(?:amp|lt|gt|quot|apos);/g,r)})}();!function(d,p,n,r,u,i,o,l,c){function f(t){return function(m,p){var h=this,f=n[s(n,p)?p:r];function a(e){return h[t+e]()}return y(m).replace(d,function(n){switch(n){case"s":return a(u);case"ss":return e(a(u));case"m":return a(i);case"mm":return e(a(i));case"h":return a(o);case"hh":return e(a(o));case"D":return a(Nn);case"DD":return e(a(Nn));case"W":return f[0][a("Day")];case"N":return a(l)+1;case"NN":return e(a(l)+1);case"M":return f[2][a(l)];case"MM":return f[1][a(l)];case"Y":return a(c);case"YY":return e(a(c)%100)}return n})}}function e(e){return e>9?e:"0"+e}function a(r,e){function t(t){var n=[];X.call(un(e.months),function(e){n.push(e.replace(p,"$"+t))});return n}n[r]=[un(e.weekdays),t(1),t(2)];return m}t(C+h,Nn,{format:f("get"),formatUTC:f("getUTC")});a(r,{weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",months:"January,February,March,April,May,June,July,August,September,October,November,December"});a("ru",{weekdays:"Воскресенье,Понедельник,Вторник,Среда,Четверг,Пятница,Суббота",months:"Январ:я|ь,Феврал:я|ь,Март:а|,Апрел:я|ь,Ма:я|й,Июн:я|ь,"+"Июл:я|ь,Август:а|,Сентябр:я|ь,Октябр:я|ь,Ноябр:я|ь,Декабр:я|ь"});m.locale=function(e){return s(n,e)?r=e:r};m.addLocale=a}(/\b\w\w?\b/g,/:(.*)\|(.*)$/,{},"en","Seconds","Minutes","Hours","Month","FullYear")}(typeof self!="undefined"&&self.Math===Math?self:Function("return this")(),false)},{}],136:[function(n,t,e){(function(t,n){"use strict";if(typeof define==="function"&&define.amd){define(["exports"],n)}else if(typeof e!=="undefined"){n(e)}else{n(t.estraverse={})}})(this,function r(t){"use strict";var c,i,s,d,g,u,n,r,l;function h(){}i=Array.isArray;if(!i){i=function k(e){return Object.prototype.toString.call(e)==="[object Array]"}}function m(t){var r={},e,n;for(e in t){if(t.hasOwnProperty(e)){n=t[e];if(typeof n==="object"&&n!==null){r[e]=m(n)}else{r[e]=n}}}return r}function v(n){var t={},e;for(e in n){if(n.hasOwnProperty(e)){t[e]=n[e]}}return t}h(v);function E(l,a){var n,e,t,r;e=l.length;t=0;while(e){n=e>>>1;r=t+n;if(a(l[r])){e=n}else{t=r+1;e-=n+1}}return t}function x(l,a){var n,e,t,r;e=l.length;t=0;while(e){n=e>>>1;r=t+n;if(a(l[r])){t=r+1;e-=n+1}else{e=n}}return t}h(x);g=Object.create||function(){function e(){}return function(n){e.prototype=n;return new e}}();u=Object.keys||function(t){var e=[],n;for(n in t){e.push(n)}return e};function b(e,n){u(n).forEach(function(t){e[t]=n[t]});return e}c={AssignmentExpression:"AssignmentExpression",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportBatchSpecifier:"ExportBatchSpecifier",ExportDeclaration:"ExportDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"};d={AssignmentExpression:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","defaults","rest","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ClassBody:["body"],ClassDeclaration:["id","body","superClass"],ClassExpression:["id","body","superClass"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportBatchSpecifier:[],ExportDeclaration:["declaration","specifiers","source"],ExportSpecifier:["id","name"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","defaults","rest","body"],FunctionExpression:["id","params","defaults","rest","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["id"],ImportNamespaceSpecifier:["id"],ImportSpecifier:["id","name"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["key","value"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handlers","handler","guardedHandlers","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]};n={};r={};l={};s={Break:n,Skip:r,Remove:l};function o(e,n){this.parent=e;this.key=n}o.prototype.replace=function I(e){this.parent[this.key]=e};o.prototype.remove=function R(){if(i(this.parent)){this.parent.splice(this.key,1);return true}else{this.replace(null);return false}};function a(e,n,t,r){this.node=e;this.path=n;this.wrap=t;this.ref=r}function e(){}e.prototype.path=function C(){var e,r,n,l,t,a;function s(t,e){if(i(e)){for(n=0,l=e.length;n<l;++n){t.push(e[n])}}else{t.push(e)}}if(!this.__current.path){return null}t=[];for(e=2,r=this.__leavelist.length;e<r;++e){a=this.__leavelist[e];s(t,a.path)}s(t,this.__current.path);return t};e.prototype.type=function(){var e=this.current();return e.type||this.__current.wrap};e.prototype.parents=function A(){var e,t,n;n=[];for(e=1,t=this.__leavelist.length;e<t;++e){n.push(this.__leavelist[e].node)}return n};e.prototype.current=function T(){return this.__current.node};e.prototype.__execute=function L(n,t){var r,e;e=undefined;r=this.__current;this.__current=t;this.__state=null;if(n){e=n.call(this,t.node,this.__leavelist[this.__leavelist.length-1].node)}this.__current=r;return e};e.prototype.notify=function P(e){this.__state=e};e.prototype.skip=function(){this.notify(r)};e.prototype["break"]=function(){this.notify(n)};e.prototype.remove=function(){this.notify(l)};e.prototype.__initialize=function(n,e){this.visitor=e;this.root=n;this.__worklist=[];this.__leavelist=[];this.__current=null;this.__state=null;this.__fallback=e.fallback==="iteration";this.__keys=d;if(e.keys){this.__keys=b(g(this.__keys),e.keys)}};function f(e){if(e==null){return false}return typeof e==="object"&&typeof e.type==="string"}function y(e,n){return(e===c.ObjectExpression||e===c.ObjectPattern)&&"properties"===n}e.prototype.traverse=function j(b,x){var s,h,e,d,g,c,p,m,l,o,t,v;this.__initialize(b,x);v={};s=this.__worklist;h=this.__leavelist;s.push(new a(b,null,null,null));h.push(new a(null,null,null,null));while(s.length){e=s.pop();if(e===v){e=h.pop();c=this.__execute(x.leave,e);if(this.__state===n||c===n){return}continue}if(e.node){c=this.__execute(x.enter,e);if(this.__state===n||c===n){return}s.push(v);h.push(e);if(this.__state===r||c===r){continue}d=e.node;g=e.wrap||d.type;o=this.__keys[g];if(!o){if(this.__fallback){o=u(d)}else{throw new Error("Unknown node type "+g+".")}}m=o.length;while((m-=1)>=0){p=o[m];t=d[p];if(!t){continue}if(i(t)){l=t.length;while((l-=1)>=0){if(!t[l]){continue}if(y(g,o[m])){e=new a(t[l],[p,l],"Property",null)}else if(f(t[l])){e=new a(t[l],[p,l],null,null)}else{continue}s.push(e)}}else if(f(t)){s.push(new a(t,p,null,null))}}}}};e.prototype.replace=function M(E,w){function S(n){var t,r,e,l;if(n.ref.remove()){r=n.ref.key;l=n.ref.parent;t=p.length;while(t--){e=p[t];if(e.ref&&e.ref.parent===l){if(e.ref.key<r){break}--e.ref.key}}}}var p,b,m,v,t,e,x,c,d,s,_,g,h;this.__initialize(E,w);_={};p=this.__worklist;b=this.__leavelist;g={root:E};e=new a(E,null,null,new o(g,"root"));p.push(e);b.push(e);while(p.length){e=p.pop();if(e===_){e=b.pop();t=this.__execute(w.leave,e);if(t!==undefined&&t!==n&&t!==r&&t!==l){e.ref.replace(t)}if(this.__state===l||t===l){S(e)}if(this.__state===n||t===n){return g.root}continue}t=this.__execute(w.enter,e);if(t!==undefined&&t!==n&&t!==r&&t!==l){e.ref.replace(t);e.node=t}if(this.__state===l||t===l){S(e);e.node=null}if(this.__state===n||t===n){return g.root}m=e.node;if(!m){continue}p.push(_);b.push(e);if(this.__state===r||t===r){continue}v=e.wrap||m.type;d=this.__keys[v];if(!d){if(this.__fallback){d=u(m)}else{throw new Error("Unknown node type "+v+".")}}x=d.length;while((x-=1)>=0){h=d[x];s=m[h];if(!s){continue}if(i(s)){c=s.length;while((c-=1)>=0){if(!s[c]){continue}if(y(v,d[x])){e=new a(s[c],[h,c],"Property",new o(s,c))}else if(f(s[c])){e=new a(s[c],[h,c],null,new o(s,c))}else{continue}p.push(e)}}else if(f(s)){p.push(new a(s,h,null,new o(m,h)))}}}return g.root};function p(n,t){var r=new e;return r.traverse(n,t)}function w(n,t){var r=new e;return r.replace(n,t)}function _(e,t){var n;n=E(t,function r(n){return n.range[0]>e.range[0]});e.extendedRange=[e.range[0],e.range[1]];if(n!==t.length){e.extendedRange[1]=t[n].range[0]}n-=1;if(n>=0){e.extendedRange[0]=t[n].range[1]}return e}function S(r,l,o){var n=[],i,a,t,e;if(!r.range){throw new Error("attachComments needs range information")}if(!o.length){if(l.length){for(t=0,a=l.length;t<a;t+=1){i=m(l[t]);i.extendedRange=[0,r.range[0]];n.push(i)}r.leadingComments=n}return r}for(t=0,a=l.length;t<a;t+=1){n.push(_(m(l[t]),o))}e=0;p(r,{enter:function(t){var r;while(e<n.length){r=n[e];if(r.extendedRange[1]>t.range[0]){break}if(r.extendedRange[1]===t.range[0]){if(!t.leadingComments){t.leadingComments=[]}t.leadingComments.push(r);n.splice(e,1)}else{e+=1}}if(e===n.length){return s.Break}if(n[e].extendedRange[0]>t.range[1]){return s.Skip}}});e=0;p(r,{leave:function(t){var r;while(e<n.length){r=n[e];if(t.range[1]<r.extendedRange[0]){break}if(t.range[1]===r.extendedRange[0]){if(!t.trailingComments){t.trailingComments=[]}t.trailingComments.push(r);n.splice(e,1)}else{e+=1}}if(e===n.length){return s.Break}if(n[e].extendedRange[0]>t.range[1]){return s.Skip}}});return r}t.version="1.8.1-dev";t.Syntax=c;t.traverse=p;t.replace=w;t.attachComments=S;t.VisitorKeys=d;t.VisitorOption=s;t.Controller=e;t.cloneEnvironment=function(){return r({})};return t})},{}],137:[function(n,e,t){(function(){"use strict";function r(e){if(e==null){return false}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 true}return false}function l(e){if(e==null){return false}switch(e.type){case"DoWhileStatement":case"ForInStatement":case"ForStatement":case"WhileStatement":return true}return false}function n(e){if(e==null){return false}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 true}return false}function a(e){return n(e)||e!=null&&e.type==="FunctionDeclaration"}function t(e){switch(e.type){case"IfStatement":if(e.alternate!=null){return e.alternate}return e.consequent;case"LabeledStatement":case"ForStatement":case"ForInStatement":case"WhileStatement":case"WithStatement":return e.body}return null}function i(n){var e;if(n.type!=="IfStatement"){return false}if(n.alternate==null){return false}e=n.consequent;do{if(e.type==="IfStatement"){if(e.alternate==null){return true}}e=t(e)}while(e);return false}e.exports={isExpression:r,isStatement:n,isIterationStatement:l,isSourceElement:a,isProblematicIfStatement:i,trailingStatement:t}})()},{}],138:[function(n,e,t){(function(){"use strict";var n,t;n={NonAsciiIdentifierStart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),NonAsciiIdentifierPart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԧԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠࢢ-ࢬࣤ-ࣾऀ-ॣ०-९ॱ-ॷॹ-ॿঁ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఁ-ఃఅ-ఌఎ-ఐఒ-నప-ళవ-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಂಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲംഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤜᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶᴀ-ᷦ᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺꩻꪀ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︦︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]")};
function r(e){return e>=48&&e<=57}function l(e){return r(e)||97<=e&&e<=102||65<=e&&e<=70}function a(e){return e>=48&&e<=55}t=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279];function i(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&t.indexOf(e)>=0}function s(e){return e===10||e===13||e===8232||e===8233}function o(e){return e>=97&&e<=122||e>=65&&e<=90||e===36||e===95||e===92||e>=128&&n.NonAsciiIdentifierStart.test(String.fromCharCode(e))}function u(e){return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===36||e===95||e===92||e>=128&&n.NonAsciiIdentifierPart.test(String.fromCharCode(e))}e.exports={isDecimalDigit:r,isHexDigit:l,isOctalDigit:a,isWhiteSpace:i,isLineTerminator:s,isIdentifierStart:o,isIdentifierPart:u}})()},{}],139:[function(e,n,t){(function(){"use strict";var l=e("./code");function o(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"let":return true;default:return false}}function a(e,n){if(!n&&e==="yield"){return false}return t(e,n)}function t(e,n){if(n&&o(e)){return true}switch(e.length){case 2:return e==="if"||e==="in"||e==="do";case 3:return e==="var"||e==="for"||e==="new"||e==="try";case 4:return e==="this"||e==="else"||e==="case"||e==="void"||e==="with"||e==="enum";case 5:return e==="while"||e==="break"||e==="catch"||e==="throw"||e==="const"||e==="yield"||e==="class"||e==="super";case 6:return e==="return"||e==="typeof"||e==="delete"||e==="switch"||e==="export"||e==="import";case 7:return e==="default"||e==="finally"||e==="extends";case 8:return e==="function"||e==="continue"||e==="debugger";case 10:return e==="instanceof";default:return false}}function i(e,n){return e==="null"||e==="true"||e==="false"||a(e,n)}function s(e,n){return e==="null"||e==="true"||e==="false"||t(e,n)}function u(e){return e==="eval"||e==="arguments"}function r(n){var t,r,e;if(n.length===0){return false}e=n.charCodeAt(0);if(!l.isIdentifierStart(e)||e===92){return false}for(t=1,r=n.length;t<r;++t){e=n.charCodeAt(t);if(!l.isIdentifierPart(e)||e===92){return false}}return true}function c(e,n){return r(e)&&!i(e,n)}function f(e,n){return r(e)&&!s(e,n)}n.exports={isKeywordES5:a,isKeywordES6:t,isReservedWordES5:i,isReservedWordES6:s,isRestrictedWord:u,isIdentifierName:r,isIdentifierES5:c,isIdentifierES6:f}})()},{"./code":138}],140:[function(e,t,n){(function(){"use strict";n.ast=e("./ast");n.code=e("./code");n.keyword=e("./keyword")})()},{"./ast":137,"./code":138,"./keyword":139}],141:[function(n,t,e){"use strict";e.reservedVars={arguments:false,NaN:false};e.ecmaIdentifiers={Array:false,Boolean:false,Date:false,decodeURI:false,decodeURIComponent:false,encodeURI:false,encodeURIComponent:false,Error:false,eval:false,EvalError:false,Function:false,hasOwnProperty:false,isFinite:false,isNaN:false,JSON:false,Map:false,Math:false,Number:false,Object:false,Proxy:false,Promise:false,parseInt:false,parseFloat:false,RangeError:false,ReferenceError:false,RegExp:false,Set:false,String:false,SyntaxError:false,TypeError:false,URIError:false,WeakMap:false,WeakSet:false};e.newEcmaIdentifiers={Set:false,Map:false,WeakMap:false,WeakSet:false,Proxy:false,Promise:false,Reflect:false,Symbol:false,System:false};e.browser={Audio:false,Blob:false,addEventListener:false,applicationCache:false,atob:false,blur:false,btoa:false,cancelAnimationFrame:false,CanvasGradient:false,CanvasPattern:false,CanvasRenderingContext2D:false,CSS:false,clearInterval:false,clearTimeout:false,close:false,closed:false,CustomEvent:false,DOMParser:false,defaultStatus:false,Document:false,document:false,Element:false,ElementTimeControl:false,Event:false,event:false,FileReader:false,FormData:false,focus:false,frames:false,getComputedStyle:false,HTMLElement:false,HTMLAnchorElement:false,HTMLBaseElement:false,HTMLBlockquoteElement:false,HTMLBodyElement:false,HTMLBRElement:false,HTMLButtonElement:false,HTMLCanvasElement:false,HTMLDirectoryElement:false,HTMLDivElement:false,HTMLDListElement:false,HTMLFieldSetElement:false,HTMLFontElement:false,HTMLFormElement:false,HTMLFrameElement:false,HTMLFrameSetElement:false,HTMLHeadElement:false,HTMLHeadingElement:false,HTMLHRElement:false,HTMLHtmlElement:false,HTMLIFrameElement:false,HTMLImageElement:false,HTMLInputElement:false,HTMLIsIndexElement:false,HTMLLabelElement:false,HTMLLayerElement:false,HTMLLegendElement:false,HTMLLIElement:false,HTMLLinkElement:false,HTMLMapElement:false,HTMLMenuElement:false,HTMLMetaElement:false,HTMLModElement:false,HTMLObjectElement:false,HTMLOListElement:false,HTMLOptGroupElement:false,HTMLOptionElement:false,HTMLParagraphElement:false,HTMLParamElement:false,HTMLPreElement:false,HTMLQuoteElement:false,HTMLScriptElement:false,HTMLSelectElement:false,HTMLStyleElement:false,HTMLTableCaptionElement:false,HTMLTableCellElement:false,HTMLTableColElement:false,HTMLTableElement:false,HTMLTableRowElement:false,HTMLTableSectionElement:false,HTMLTextAreaElement:false,HTMLTitleElement:false,HTMLUListElement:false,HTMLVideoElement:false,history:false,Image:false,Intl:false,length:false,localStorage:false,location:false,matchMedia:false,MessageChannel:false,MessageEvent:false,MessagePort:false,MouseEvent:false,moveBy:false,moveTo:false,MutationObserver:false,name:false,Node:false,NodeFilter:false,NodeList:false,navigator:false,onbeforeunload:true,onblur:true,onerror:true,onfocus:true,onload:true,onresize:true,onunload:true,open:false,openDatabase:false,opener:false,Option:false,parent:false,print:false,requestAnimationFrame:false,removeEventListener:false,resizeBy:false,resizeTo:false,screen:false,scroll:false,scrollBy:false,scrollTo:false,sessionStorage:false,setInterval:false,setTimeout:false,SharedWorker:false,status:false,SVGAElement:false,SVGAltGlyphDefElement:false,SVGAltGlyphElement:false,SVGAltGlyphItemElement:false,SVGAngle:false,SVGAnimateColorElement:false,SVGAnimateElement:false,SVGAnimateMotionElement:false,SVGAnimateTransformElement:false,SVGAnimatedAngle:false,SVGAnimatedBoolean:false,SVGAnimatedEnumeration:false,SVGAnimatedInteger:false,SVGAnimatedLength:false,SVGAnimatedLengthList:false,SVGAnimatedNumber:false,SVGAnimatedNumberList:false,SVGAnimatedPathData:false,SVGAnimatedPoints:false,SVGAnimatedPreserveAspectRatio:false,SVGAnimatedRect:false,SVGAnimatedString:false,SVGAnimatedTransformList:false,SVGAnimationElement:false,SVGCSSRule:false,SVGCircleElement:false,SVGClipPathElement:false,SVGColor:false,SVGColorProfileElement:false,SVGColorProfileRule:false,SVGComponentTransferFunctionElement:false,SVGCursorElement:false,SVGDefsElement:false,SVGDescElement:false,SVGDocument:false,SVGElement:false,SVGElementInstance:false,SVGElementInstanceList:false,SVGEllipseElement:false,SVGExternalResourcesRequired:false,SVGFEBlendElement:false,SVGFEColorMatrixElement:false,SVGFEComponentTransferElement:false,SVGFECompositeElement:false,SVGFEConvolveMatrixElement:false,SVGFEDiffuseLightingElement:false,SVGFEDisplacementMapElement:false,SVGFEDistantLightElement:false,SVGFEFloodElement:false,SVGFEFuncAElement:false,SVGFEFuncBElement:false,SVGFEFuncGElement:false,SVGFEFuncRElement:false,SVGFEGaussianBlurElement:false,SVGFEImageElement:false,SVGFEMergeElement:false,SVGFEMergeNodeElement:false,SVGFEMorphologyElement:false,SVGFEOffsetElement:false,SVGFEPointLightElement:false,SVGFESpecularLightingElement:false,SVGFESpotLightElement:false,SVGFETileElement:false,SVGFETurbulenceElement:false,SVGFilterElement:false,SVGFilterPrimitiveStandardAttributes:false,SVGFitToViewBox:false,SVGFontElement:false,SVGFontFaceElement:false,SVGFontFaceFormatElement:false,SVGFontFaceNameElement:false,SVGFontFaceSrcElement:false,SVGFontFaceUriElement:false,SVGForeignObjectElement:false,SVGGElement:false,SVGGlyphElement:false,SVGGlyphRefElement:false,SVGGradientElement:false,SVGHKernElement:false,SVGICCColor:false,SVGImageElement:false,SVGLangSpace:false,SVGLength:false,SVGLengthList:false,SVGLineElement:false,SVGLinearGradientElement:false,SVGLocatable:false,SVGMPathElement:false,SVGMarkerElement:false,SVGMaskElement:false,SVGMatrix:false,SVGMetadataElement:false,SVGMissingGlyphElement:false,SVGNumber:false,SVGNumberList:false,SVGPaint:false,SVGPathElement:false,SVGPathSeg:false,SVGPathSegArcAbs:false,SVGPathSegArcRel:false,SVGPathSegClosePath:false,SVGPathSegCurvetoCubicAbs:false,SVGPathSegCurvetoCubicRel:false,SVGPathSegCurvetoCubicSmoothAbs:false,SVGPathSegCurvetoCubicSmoothRel:false,SVGPathSegCurvetoQuadraticAbs:false,SVGPathSegCurvetoQuadraticRel:false,SVGPathSegCurvetoQuadraticSmoothAbs:false,SVGPathSegCurvetoQuadraticSmoothRel:false,SVGPathSegLinetoAbs:false,SVGPathSegLinetoHorizontalAbs:false,SVGPathSegLinetoHorizontalRel:false,SVGPathSegLinetoRel:false,SVGPathSegLinetoVerticalAbs:false,SVGPathSegLinetoVerticalRel:false,SVGPathSegList:false,SVGPathSegMovetoAbs:false,SVGPathSegMovetoRel:false,SVGPatternElement:false,SVGPoint:false,SVGPointList:false,SVGPolygonElement:false,SVGPolylineElement:false,SVGPreserveAspectRatio:false,SVGRadialGradientElement:false,SVGRect:false,SVGRectElement:false,SVGRenderingIntent:false,SVGSVGElement:false,SVGScriptElement:false,SVGSetElement:false,SVGStopElement:false,SVGStringList:false,SVGStylable:false,SVGStyleElement:false,SVGSwitchElement:false,SVGSymbolElement:false,SVGTRefElement:false,SVGTSpanElement:false,SVGTests:false,SVGTextContentElement:false,SVGTextElement:false,SVGTextPathElement:false,SVGTextPositioningElement:false,SVGTitleElement:false,SVGTransform:false,SVGTransformList:false,SVGTransformable:false,SVGURIReference:false,SVGUnitTypes:false,SVGUseElement:false,SVGVKernElement:false,SVGViewElement:false,SVGViewSpec:false,SVGZoomAndPan:false,TextDecoder:false,TextEncoder:false,TimeEvent:false,top:false,URL:false,WebGLActiveInfo:false,WebGLBuffer:false,WebGLContextEvent:false,WebGLFramebuffer:false,WebGLProgram:false,WebGLRenderbuffer:false,WebGLRenderingContext:false,WebGLShader:false,WebGLShaderPrecisionFormat:false,WebGLTexture:false,WebGLUniformLocation:false,WebSocket:false,window:false,Worker:false,XDomainRequest:false,XMLHttpRequest:false,XMLSerializer:false,XPathEvaluator:false,XPathException:false,XPathExpression:false,XPathNamespace:false,XPathNSResolver:false,XPathResult:false};e.devel={alert:false,confirm:false,console:false,Debug:false,opera:false,prompt:false};e.worker={importScripts:true,postMessage:true,self:true,FileReaderSync:true};e.nonstandard={escape:false,unescape:false};e.couch={require:false,respond:false,getRow:false,emit:false,send:false,start:false,sum:false,log:false,exports:false,module:false,provides:false};e.node={__filename:false,__dirname:false,GLOBAL:false,global:false,module:false,require:false,Buffer:true,console:true,exports:true,process:true,setTimeout:true,clearTimeout:true,setInterval:true,clearInterval:true,setImmediate:true,clearImmediate:true};e.browserify={__filename:false,__dirname:false,global:false,module:false,require:false,Buffer:true,exports:true,process:true};e.phantom={phantom:true,require:true,WebPage:true,console:true,exports:true};e.qunit={asyncTest:false,deepEqual:false,equal:false,expect:false,module:false,notDeepEqual:false,notEqual:false,notPropEqual:false,notStrictEqual:false,ok:false,propEqual:false,QUnit:false,raises:false,start:false,stop:false,strictEqual:false,test:false,"throws":false};e.rhino={defineClass:false,deserialize:false,gc:false,help:false,importClass:false,importPackage:false,java:false,load:false,loadClass:false,Packages:false,print:false,quit:false,readFile:false,readUrl:false,runCommand:false,seal:false,serialize:false,spawn:false,sync:false,toint32:false,version:false};e.shelljs={target:false,echo:false,exit:false,cd:false,pwd:false,ls:false,find:false,cp:false,rm:false,mv:false,mkdir:false,test:false,cat:false,sed:false,grep:false,which:false,dirs:false,pushd:false,popd:false,env:false,exec:false,chmod:false,config:false,error:false,tempdir:false};e.typed={ArrayBuffer:false,ArrayBufferView:false,DataView:false,Float32Array:false,Float64Array:false,Int16Array:false,Int32Array:false,Int8Array:false,Uint16Array:false,Uint32Array:false,Uint8Array:false,Uint8ClampedArray:false};e.wsh={ActiveXObject:true,Enumerator:true,GetObject:true,ScriptEngine:true,ScriptEngineBuildVersion:true,ScriptEngineMajorVersion:true,ScriptEngineMinorVersion:true,VBArray:true,WSH:true,WScript:true,XDomainRequest:true};e.dojo={dojo:false,dijit:false,dojox:false,define:false,require:false};e.jquery={$:false,jQuery:false};e.mootools={$:false,$$:false,Asset:false,Browser:false,Chain:false,Class:false,Color:false,Cookie:false,Core:false,Document:false,DomReady:false,DOMEvent:false,DOMReady:false,Drag:false,Element:false,Elements:false,Event:false,Events:false,Fx:false,Group:false,Hash:false,HtmlTable:false,IFrame:false,IframeShim:false,InputValidator:false,instanceOf:false,Keyboard:false,Locale:false,Mask:false,MooTools:false,Native:false,Options:false,OverText:false,Request:false,Scroller:false,Slick:false,Slider:false,Sortables:false,Spinner:false,Swiff:false,Tips:false,Type:false,typeOf:false,URI:false,Window:false};e.prototypejs={$:false,$$:false,$A:false,$F:false,$H:false,$R:false,$break:false,$continue:false,$w:false,Abstract:false,Ajax:false,Class:false,Enumerable:false,Element:false,Event:false,Field:false,Form:false,Hash:false,Insertion:false,ObjectRange:false,PeriodicalExecuter:false,Position:false,Prototype:false,Selector:false,Template:false,Toggle:false,Try:false,Autocompleter:false,Builder:false,Control:false,Draggable:false,Draggables:false,Droppables:false,Effect:false,Sortable:false,SortableObserver:false,Sound:false,Scriptaculous:false};e.yui={YUI:false,Y:false,YUI_config:false};e.mocha={describe:false,it:false,before:false,after:false,beforeEach:false,afterEach:false,suite:false,test:false,setup:false,teardown:false};e.jasmine={jasmine:false,describe:false,it:false,xit:false,beforeEach:false,afterEach:false,setFixtures:false,loadFixtures:false,spyOn:false,expect:false,runs:false,waitsFor:false,waits:false}},{}],142:[function(t,e,n){(function(t){(function(){var u;var A=[],P=[];var Q=0;var R=+new Date+"";var T=75;var U=40;var N=" \f "+"\n\r\u2028\u2029"+" ";var X=/\b__p \+= '';/g,nn=/\b(__p \+=) '' \+/g,en=/(__e\(.*?\)|\b__t\)) \+\n'';/g;var Z=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;var K=/\w*$/;var $=/^\s*function[ \n\r\t]+\w/;var F=/<%=([\s\S]+?)%>/g;var tn=RegExp("^["+N+"]*0+(?=.$)");var _=/($^)/;var M=/\bthis\b/;var W=/['\n\r\t\u2028\u2029\\]/g;var J=["Array","Boolean","Date","Function","Math","Number","Object","RegExp","String","_","attachEvent","clearTimeout","isFinite","isNaN","parseInt","setTimeout"];var q=0;var b="[object Arguments]",E="[object Array]",x="[object Boolean]",v="[object Date]",B="[object Function]",y="[object Number]",o="[object Object]",g="[object RegExp]",d="[object String]";var s={};s[B]=false;s[b]=s[E]=s[x]=s[v]=s[y]=s[o]=s[g]=s[d]=true;var k={leading:false,maxWait:0,trailing:false};var O={configurable:false,enumerable:false,value:null,writable:false};var l={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false};var V={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};var f=l[typeof window]&&window||this;var w=l[typeof n]&&n&&!n.nodeType&&n;var I=l[typeof e]&&e&&!e.nodeType&&e;var z=I&&I.exports===w&&w;var p=l[typeof t]&&t;if(p&&(p.global===p||p.window===p)){f=p}function m(e,t,r){var n=(r||0)-1,l=e?e.length:0;while(++n<l){if(e[n]===t){return n}}return-1}function S(e,t){var n=typeof t;e=e.cache;if(n=="boolean"||t==null){return e[t]?0:-1}if(n!="number"&&n!="string"){n="object"}var r=n=="number"?t:R+t;e=(e=e[n])&&e[r];return n=="object"?e&&m(e,t)>-1?0:-1:e?0:-1}function G(n){var t=this.cache,e=typeof n;if(e=="boolean"||n==null){t[n]=true}else{if(e!="number"&&e!="string"){e="object"}var r=e=="number"?n:R+n,l=t[e]||(t[e]={});if(e=="object"){(l[r]||(l[r]=[])).push(n)}else{l[r]=true}}}function D(e){return e.charCodeAt(0)}function H(r,l){var a=r.criteria,i=l.criteria,t=-1,s=a.length;while(++t<s){var e=a[t],n=i[t];if(e!==n){if(e>n||typeof e=="undefined"){return 1}if(e<n||typeof n=="undefined"){return-1}}}return r.index-l.index}function L(e){var l=-1,r=e.length,a=e[0],i=e[r/2|0],s=e[r-1];if(a&&typeof a=="object"&&i&&typeof i=="object"&&s&&typeof s=="object"){return false}var n=j();n["false"]=n["null"]=n["true"]=n["undefined"]=false;var t=j();t.array=e;t.cache=n;t.push=G;while(++l<r){t.push(e[l])}return t}function Y(e){return"\\"+V[e]}function i(){return A.pop()||[]}function j(){return P.pop()||{array:null,cache:null,criteria:null,"false":false,index:0,"null":false,number:null,object:null,push:null,string:null,"true":false,undefined:false,value:null}}function a(e){e.length=0;if(A.length<U){A.push(e)}}function h(e){var n=e.cache;if(n){h(n)}e.array=e.cache=e.criteria=e.object=e.number=e.string=e.value=null;if(P.length<U){P.push(e)}}function r(n,e,t){e||(e=0);if(typeof t=="undefined"){t=n?n.length:0}var r=-1,l=t-e||0,a=Array(l<0?0:l);while(++r<l){a[r]=n[e+r]}return a}function C(n){n=n?c.defaults(f.Object(),n,c.pick(f,J)):f;var z=n.Array,al=n.Boolean,Zn=n.Date,Nn=n.Function,Cn=n.Math,rl=n.Number,gn=n.Object,Rn=n.RegExp,un=n.String,sn=n.TypeError;var yn=[];var at=gn.prototype;var tl=n._;var A=at.toString;var el=Rn("^"+un(A).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$");var Zr=Cn.ceil,Pn=n.clearTimeout,Vr=Cn.floor,Dr=Nn.prototype.toString,hn=fn(hn=gn.getPrototypeOf)&&hn,P=at.hasOwnProperty,xn=yn.push,wn=n.setTimeout,ft=yn.splice,Mr=yn.unshift;var dt=function(){try{var n={},e=fn(e=gn.defineProperty)&&e,t=e(n,n,n)&&e}catch(r){}return t}();var Tn=fn(Tn=gn.create)&&Tn,Wn=fn(Wn=z.isArray)&&Wn,jr=n.isFinite,Tr=n.isNaN,jn=fn(jn=gn.keys)&&jn,rn=Cn.max,En=Cn.min,nt=n.parseInt,ut=Cn.random;var on={};on[E]=z;on[x]=al;on[v]=Zn;on[B]=Nn;on[o]=gn;on[y]=rl;on[g]=Rn;on[d]=un;function e(e){return e&&typeof e=="object"&&!w(e)&&P.call(e,"__wrapped__")?e:new dn(e)}function dn(e,n){this.__chain__=!!n;this.__wrapped__=e}dn.prototype=e.prototype;var kn=e.support={};kn.funcDecomp=!fn(n.WinRTError)&&M.test(C);kn.funcNames=typeof Nn.name=="string";e.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:F,variable:"",imports:{_:e}};function Cr(e){var n=e[0],l=e[2],a=e[4];function t(){if(l){var e=r(l);xn.apply(e,arguments)}if(this instanceof t){var i=vn(n.prototype),s=n.apply(i,e||arguments);return I(s)?s:i}return n.apply(a,e||arguments)}Hn(t,e);return t}function et(e,f,m,l,o){if(m){var n=m(e);if(typeof n!="undefined"){return n}}var E=I(e);if(E){var p=A.call(e);if(!s[p]){return e}var u=on[p];switch(p){case x:case v:return new u(+e);case y:case d:return new u(e);case g:n=u(e.source,K.exec(e));n.lastIndex=e.lastIndex;return n}}else{return e}var c=w(e);if(f){var b=!l;l||(l=i());o||(o=i());var h=l.length;while(h--){if(l[h]==e){return o[h]}}n=c?u(e.length):{}}else{n=c?r(e):Fn({},e)}if(c){if(P.call(e,"index")){n.index=e.index}if(P.call(e,"input")){n.input=e.input}}if(!f){return n}l.push(e);o.push(n);(c?U:t)(e,function(e,t){n[t]=et(e,f,m,l,o)});if(b){a(l);a(o)}return n}function vn(e,n){return I(e)?Tn(e):{}}if(!Tn){vn=function(){function e(){}return function(t){if(I(t)){e.prototype=t;var r=new e;e.prototype=null}return r||n.Object()}}()}function G(e,t,l){if(typeof e!="function"){return Gn}if(typeof t=="undefined"||!("prototype"in e)){return e}var n=e.__bindData__;if(typeof n=="undefined"){if(kn.funcNames){n=!e.name}n=n||!kn.funcDecomp;if(!n){var r=Dr.call(e);if(!kn.funcNames){n=!$.test(r)}if(!n){n=M.test(r);Hn(e,n)}}}if(n===false||n!==true&&n[1]&1){return e}switch(l){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,l){return e.call(t,n,r,l)};case 4:return function(n,r,l,a){return e.call(t,n,r,l,a)}}return yt(e,t)}function kt(e){var t=e[0],n=e[1],s=e[2],a=e[3],i=e[4],u=e[5];var c=n&1,f=n&2,o=n&4,p=n&8,d=t;function l(){var m=c?i:this;if(s){var e=r(s);xn.apply(e,arguments)}if(a||o){e||(e=r(arguments));if(a){xn.apply(e,a)}if(o&&e.length<u){n|=16&~32;return kt([t,p?n:n&~3,e,null,i,u])}}e||(e=arguments);if(f){t=m[d]}if(this instanceof l){m=vn(t.prototype);var h=t.apply(m,e);return I(h)?h:m}return t.apply(m,e)}Hn(l,e);return l}function bn(n,e){var l=-1,t=Ln(),a=n?n.length:0,r=a>=T&&t===m,i=[];if(r){var s=L(e);if(s){t=S;e=s}else{r=false}}while(++l<a){var o=n[l];if(t(e,o)<0){i.push(o)}}if(r){h(e)}return i}function cn(t,a,r,u){var l=(u||0)-1,c=t?t.length:0,n=[];while(++l<c){var e=t[l];if(e&&typeof e=="object"&&typeof e.length=="number"&&(w(e)||An(e))){if(!a){e=cn(e,a,r)}var i=-1,s=e.length,o=n.length;n.length+=s;while(++i<s){n[o++]=e[i]}}else if(!r){n.push(e)}}return n}function mn(e,n,h,c,t,s){if(h){var r=h(e,n);if(typeof r!="undefined"){return!!r}}if(e===n){return e!==0||1/e==1/n}var M=typeof e,j=typeof n;if(e===e&&!(e&&l[M])&&!(n&&l[j])){return false}if(e==null||n==null){return e===n}var m=A.call(e),S=A.call(n);if(m==b){m=o}if(S==b){S=o}if(m!=S){return false}switch(m){case x:case v:return+e==+n;case y:return e!=+e?n!=+n:e==0?1/e==1/n:e==+n;case g:case d:return e==un(n)}var R=m==E;if(!R){var I=P.call(e,"__wrapped__"),k=P.call(n,"__wrapped__");if(I||k){return mn(I?e.__wrapped__:e,k?n.__wrapped__:n,h,c,t,s)}if(m!=o){return false}var _=e.constructor,w=n.constructor;if(_!=w&&!(p(_)&&_ instanceof _&&p(w)&&w instanceof w)&&("constructor"in e&&"constructor"in n)){return false}}var L=!t;t||(t=i());s||(s=i());var f=t.length;while(f--){if(t[f]==e){return s[f]==n}}var u=0;r=true;t.push(e);s.push(n);if(R){f=e.length;u=n.length;r=u==f;if(r||c){while(u--){var C=f,T=n[u];if(c){while(C--){if(r=mn(e[C],T,h,c,t,s)){break}}}else if(!(r=mn(e[u],T,h,c,t,s))){break}}}}else{an(n,function(l,n,a){if(P.call(a,n)){u++;return r=P.call(e,n)&&mn(e[n],l,h,c,t,s)}});if(r&&!c){an(e,function(t,e,n){if(P.call(n,e)){return r=--u>-1}})}}t.pop();s.pop();if(L){a(t);a(s)}return r}function st(l,a,e,n,r){(w(a)?U:t)(a,function(a,u){var c,f,i=a,t=l[u];if(a&&((f=w(a))||tt(a))){var s=n.length;while(s--){if(c=n[s]==a){t=r[s];break}}if(!c){var o;if(e){i=e(t,a);if(o=typeof i!="undefined"){t=i}}if(!o){t=f?w(t)?t:[]:tt(t)?t:{}}n.push(a);r.push(t);if(!o){st(t,a,e,n,r)}}}else{if(e){i=e(t,a);if(typeof i=="undefined"){i=a}}if(typeof i!="undefined"){t=i}}l[u]=t})}function Qn(e,n){return e+Vr(ut()*(n-e+1))}function Kn(t,f,n){var r=-1,u=Ln(),p=t?t.length:0,c=[];var l=!f&&p>=T&&u===m,e=n||l?i():c;if(l){var d=L(e);u=S;e=d}while(++r<p){var s=t[r],o=n?n(s,r,t):s;if(f?!r||e[e.length-1]!==o:u(e,o)<0){if(n||l){e.push(o)}c.push(s)}}if(l){a(e.array);h(e)}else if(n){a(e)}return c}function $n(n){return function(r,l,u){var a={};l=e.createCallback(l,u,3);var i=-1,s=r?r.length:0;if(typeof s=="number"){while(++i<s){var o=r[i];n(a,o,l(o,i,r),r)}}else{t(r,function(e,r,t){n(a,e,l(e,r,t),t)})}return a}}function ln(t,n,l,a,o,u){var c=n&1,m=n&2,f=n&4,h=n&8,i=n&16,s=n&32;if(!m&&!p(t)){throw new sn}if(i&&!l.length){n&=~16;i=l=false}if(s&&!a.length){n&=~32;s=a=false}var e=t&&t.__bindData__;if(e&&e!==true){e=r(e);if(e[2]){e[2]=r(e[2])}if(e[3]){e[3]=r(e[3])}if(c&&!(e[1]&1)){e[4]=o}if(!c&&e[1]&1){n|=8}if(f&&!(e[1]&4)){e[5]=u}if(i){xn.apply(e[2]||(e[2]=[]),l)}if(s){Mr.apply(e[3]||(e[3]=[]),a)}e[1]|=n;return ln.apply(null,e)}var d=n==1||n===17?Cr:kt;return d([t,n,l,a,o,u])}function Rr(e){return Un[e]}function Ln(){var n=(n=e.indexOf)===bt?m:n;return n}function fn(e){return typeof e=="function"&&el.test(e)}var Hn=!dt?ot:function(e,n){O.value=n;dt(e,"__bindData__",O)};function xt(e){var n,t;if(!(e&&A.call(e)==o)||(n=e.constructor,p(n)&&!(n instanceof n))){return false}an(e,function(n,e){t=e});return typeof t=="undefined"||P.call(e,t)}function xr(e){return Ct[e]}function An(e){return e&&typeof e=="object"&&typeof e.length=="number"&&A.call(e)==b||false}var w=Wn||function(e){return e&&typeof e=="object"&&typeof e.length=="number"&&A.call(e)==E||false};var yr=function(r){var n,t=r,e=[];if(!t)return e;if(!l[typeof r])return e;for(n in t){if(P.call(t,n)){e.push(n)}}return e};var V=!jn?yr:function(e){if(!I(e)){return[]}return jn(e)};var Un={"&":"&","<":"<",">":">",'"':""","'":"'"};var Ct=vt(Un);var ur=Rn("("+V(Ct).join("|")+")","g"),sr=Rn("["+V(Un).join("")+"]","g");var Fn=function(c,d,f){var r,e=c,a=e;if(!e)return a;var t=arguments,o=0,n=typeof f=="number"?2:t.length;if(n>3&&typeof t[n-2]=="function"){var s=G(t[--n-1],t[n--],2)}else if(n>2&&typeof t[n-1]=="function"){s=t[--n]}while(++o<n){e=t[o];if(e&&l[typeof e]){var u=-1,i=l[typeof e]&&V(e),p=i?i.length:0;while(++u<p){r=i[u];a[r]=s?s(a[r],e[r]):e[r]}}}return a};function lr(r,e,n,t){if(typeof e!="boolean"&&e!=null){t=n;n=e;e=false}return et(r,e,typeof n=="function"&&G(n,t,1))}function rr(n,e,t){return et(n,true,typeof e=="function"&&G(e,t,1))}function tr(t,e){var n=vn(t);return e?Fn(n,e):n}var Xn=function(o,p,c){var n,e=o,t=e;if(!e)return t;var a=arguments,i=0,u=typeof c=="number"?2:a.length;while(++i<u){e=a[i];if(e&&l[typeof e]){var s=-1,r=l[typeof e]&&V(e),f=r?r.length:0;while(++s<f){n=r[s];if(typeof t[n]=="undefined")t[n]=e[n]}}}return t};function er(l,n,a){var r;n=e.createCallback(n,a,3);t(l,function(t,e,l){if(n(t,e,l)){r=e;return false}});return r}function Zt(r,n,l){var t;n=e.createCallback(n,l,3);ht(r,function(r,e,l){if(n(r,e,l)){t=e;return false}});return t}var an=function(a,e,i){var r,n=a,t=n;if(!n)return t;if(!l[typeof n])return t;e=e&&typeof i=="undefined"?e:G(e,i,3);for(r in n){if(e(n[r],r,a)===false)return t}return t};function Yt(n,t,l){var e=[];an(n,function(n,t){e.push(t,n)});var r=e.length;t=G(t,l,3);while(r--){if(t(e[r--],e[r],n)===false){break}}return n}var t=function(i,n,s){var r,e=i,t=e;if(!e)return t;if(!l[typeof e])return t;n=n&&typeof s=="undefined"?n:G(n,s,3);var o=-1,a=l[typeof e]&&V(e),u=a?a.length:0;while(++o<u){r=a[o];if(n(e[r],r,i)===false)return t}return t};function ht(e,n,a){var t=V(e),r=t.length;n=G(n,a,3);while(r--){var l=t[r];if(n(e[l],l,e)===false){break}}return e}function In(n){var e=[];an(n,function(n,t){if(p(n)){e.push(t)}});return e.sort()}function zt(e,n){return e?P.call(e,n):false}function vt(e){var n=-1,t=V(e),a=t.length,r={};while(++n<a){var l=t[n];r[e[l]]=l}return r}function Wt(e){return e===true||e===false||e&&typeof e=="object"&&A.call(e)==x||false}function Gt(e){return e&&typeof e=="object"&&A.call(e)==v||false}function Jt(e){return e&&e.nodeType===1||false}function Xt(e){var r=true;if(!e){return r}var n=A.call(e),l=e.length;if(n==E||n==d||n==b||n==o&&typeof l=="number"&&p(e.splice)){return!l}t(e,function(){return r=false});return r}function Ut(n,t,e,r){return mn(n,t,typeof e=="function"&&G(e,r,2))}function Pt(e){return jr(e)&&!Tr(parseFloat(e))}function p(e){return typeof e=="function"}function I(e){return!!(e&&l[typeof e])}function _r(e){return At(e)&&e!=+e}function Lt(e){return e===null}function At(e){return typeof e=="number"||e&&typeof e=="object"&&A.call(e)==y||false}var tt=!hn?xt:function(e){if(!(e&&A.call(e)==o)){return false}var t=e.valueOf,n=fn(t)&&(n=hn(t))&&hn(n);return n?e==n||hn(e)==n:xt(e)};function gl(e){return e&&typeof e=="object"&&A.call(e)==g||false}function _n(e){return typeof e=="string"||e&&typeof e=="object"&&A.call(e)==d||false}function jt(e){return typeof e=="undefined"}function Mt(l,n,a){var r={};n=e.createCallback(n,a,3);t(l,function(t,e,l){r[e]=n(t,e,l)});return r}function Ot(t){var n=arguments,e=2;if(!I(t)){return t}if(typeof n[2]!="number"){e=n.length}if(e>3&&typeof n[e-2]=="function"){var l=G(n[--e-1],n[e--],2)}else if(e>2&&typeof n[e-1]=="function"){l=n[--e]}var c=r(arguments,1,e),s=-1,o=i(),u=i();while(++s<e){st(t,c[s],l,o,u)}a(o);a(u);return t}function Dt(r,t,s){var l={};if(typeof t!="function"){var n=[];an(r,function(t,e){n.push(e)});n=bn(n,cn(arguments,true,false,1));var a=-1,o=n.length;while(++a<o){var i=n[a];l[i]=r[i]}}else{t=e.createCallback(t,s,3);an(r,function(e,n,r){if(!t(e,n,r)){l[n]=e}})}return l}function Nt(n){var e=-1,t=V(n),r=t.length,l=z(r);while(++e<r){var a=t[e];l[e]=[a,n[a]]}return l}function Ft(n,t,s){var r={};if(typeof t!="function"){var a=-1,i=cn(arguments,true,false,1),o=I(n)?i.length:0;while(++a<o){var l=i[a];if(l in n){r[l]=n[l]}}}else{t=e.createCallback(t,s,3);an(n,function(e,n,l){if(t(e,n,l)){r[n]=e}})}return r}function Bt(r,l,n,s){var a=w(r);if(n==null){if(a){n=[]}else{var i=r&&r.constructor,o=i&&i.prototype;n=vn(o)}}if(l){l=e.createCallback(l,s,4);(a?U:t)(r,function(e,t,r){return l(n,e,t,r)})}return n}function Mn(n){var e=-1,t=V(n),r=t.length,l=z(r);while(++e<r){l[e]=n[t[e]]}return l}function Vt(t){var e=arguments,n=-1,r=cn(e,true,false,1),l=e[2]&&e[2][e[1]]===t?1:r.length,a=z(l);while(++n<l){a[n]=t[r[n]]}return a}function wt(e,r,n){var s=-1,a=Ln(),i=e?e.length:0,l=false;n=(n<0?rn(0,i+n):n)||0;if(w(e)){l=a(e,r,n)>-1}else if(typeof i=="number"){l=(_n(e)?e.indexOf(r,n):a(e,r,n))>-1}else{t(e,function(e){if(++s>=n){return!(l=e===r)}})}return l}var qt=$n(function(e,t,n){P.call(e,n)?e[n]++:e[n]=1});function Et(n,r,s){var l=true;r=e.createCallback(r,s,3);var a=-1,i=n?n.length:0;if(typeof i=="number"){while(++a<i){if(!(l=!!r(n[a],a,n))){break}}}else{t(n,function(e,n,t){return l=!!r(e,n,t)})}return l}function Dn(n,r,o){var l=[];r=e.createCallback(r,o,3);var a=-1,i=n?n.length:0;if(typeof i=="number"){while(++a<i){var s=n[a];if(r(s,a,n)){l.push(s)}}}else{t(n,function(e,n,t){if(r(e,n,t)){l.push(e)}})}return l}function Yn(n,r,o){r=e.createCallback(r,o,3);var l=-1,a=n?n.length:0;if(typeof a=="number"){while(++l<a){var i=n[l];if(r(i,l,n)){return i}}}else{var s;t(n,function(e,n,t){if(r(e,n,t)){s=e;return false}});return s}}function Ht(r,n,l){var t;n=e.createCallback(n,l,3);On(r,function(e,r,l){if(n(e,r,l)){t=e;return false}});return t}function U(e,n,l){var r=-1,a=e?e.length:0;n=n&&typeof l=="undefined"?n:G(n,l,3);if(typeof a=="number"){while(++r<a){if(n(e[r],r,e)===false){break}}}else{t(e,n)}return e}function On(e,r,a){var n=e?e.length:0;r=r&&typeof a=="undefined"?r:G(r,a,3);if(typeof n=="number"){while(n--){if(r(e[n],n,e)===false){break}}}else{var l=V(e);n=l.length;t(e,function(a,e,t){e=l?l[--n]:--n;return r(t[e],e,t)})}return e}var $t=$n(function(e,t,n){(P.call(e,n)?e[n]:e[n]=[]).push(t)});var Kt=$n(function(e,n,t){e[t]=n});function Qt(e,n){var a=r(arguments,2),i=-1,s=typeof n=="function",t=e?e.length:0,l=z(typeof t=="number"?t:0);U(e,function(e){l[++i]=(s?n:e[n]).apply(e,a)});return l}function Sn(n,l,s){var r=-1,i=n?n.length:0;l=e.createCallback(l,s,3);if(typeof i=="number"){var a=z(i);while(++r<i){a[r]=l(n[r],r,n)}}else{a=[];t(n,function(e,n,t){a[++r]=l(e,n,t)})}return a}function ct(t,n,l){var a=-Infinity,r=a;if(typeof n!="function"&&l&&l[n]===t){n=null}if(n==null&&w(t)){var i=-1,o=t.length;while(++i<o){var s=t[i];if(s>r){r=s}}}else{n=n==null&&_n(t)?D:e.createCallback(n,l,3);U(t,function(e,l,i){var t=n(e,l,i);if(t>a){a=t;r=e}})}return r}function nr(t,n,l){var a=Infinity,r=a;if(typeof n!="function"&&l&&l[n]===t){n=null}if(n==null&&w(t)){var i=-1,o=t.length;while(++i<o){var s=t[i];if(s<r){r=s}}}else{n=n==null&&_n(t)?D:e.createCallback(n,l,3);U(t,function(e,l,i){var t=n(e,l,i);if(t<a){a=t;r=e}})}return r}var Vn=Sn;function zn(r,l,n,o){if(!r)return n;var i=arguments.length<3;l=e.createCallback(l,o,4);var a=-1,s=r.length;if(typeof s=="number"){if(i){n=r[++a]}while(++a<s){n=l(n,r[a],a,r)}}else{t(r,function(e,t,r){n=i?(i=false,e):l(n,e,t,r)})}return n}function it(l,n,t,a){var r=arguments.length<3;n=e.createCallback(n,a,4);On(l,function(e,l,a){t=r?(r=false,e):n(t,e,l,a)});return t}function ar(t,n,r){n=e.createCallback(n,r,3);return Dn(t,function(e,t,r){return!n(e,t,r)})}function ir(e,t,r){if(e&&typeof e.length!="number"){e=Mn(e)}if(t==null||r){return e?e[Qn(0,e.length-1)]:u}var n=lt(e);n.length=En(rn(0,t),n.length);return n}function lt(n){var t=-1,r=n?n.length:0,e=z(typeof r=="number"?r:0);U(n,function(r){var n=Qn(0,++t);e[t]=e[n];e[n]=r});return e}function or(e){var n=e?e.length:0;return typeof n=="number"?n:V(e).length}function rt(n,r,s){var l;r=e.createCallback(r,s,3);var a=-1,i=n?n.length:0;if(typeof i=="number"){while(++a<i){if(l=r(n[a],a,n)){break}}}else{t(n,function(e,n,t){return!(l=r(e,n,t))})}return!!l}function cr(l,r,c){var u=-1,s=w(r),n=l?l.length:0,t=z(typeof n=="number"?n:0);
if(!s){r=e.createCallback(r,c,3)}U(l,function(n,l,a){var e=t[++u]=j();if(s){e.criteria=Sn(r,function(e){return n[e]})}else{(e.criteria=i())[0]=r(n,l,a)}e.index=u;e.value=n});n=t.length;t.sort(H);while(n--){var o=t[n];t[n]=o.value;if(!s){a(o.criteria)}h(o)}return t}function fr(e){if(e&&typeof e.length=="number"){return r(e)}return Mn(e)}var pr=Dn;function dr(e){var n=-1,l=e?e.length:0,t=[];while(++n<l){var r=e[n];if(r){t.push(r)}}return t}function mr(e){return bn(e,cn(arguments,true,true,1))}function hr(n,r,l){var t=-1,a=n?n.length:0;r=e.createCallback(r,l,3);while(++t<a){if(r(n[t],t,n)){return t}}return-1}function gr(n,r,l){var t=n?n.length:0;r=e.createCallback(r,l,3);while(t--){if(r(n[t],t,n)){return t}}return-1}function Jn(n,t,i){var l=0,s=n?n.length:0;if(typeof t!="number"&&t!=null){var a=-1;t=e.createCallback(t,i,3);while(++a<s&&t(n[a],a,n)){l++}}else{l=t;if(l==null||i){return n?n[0]:u}}return r(n,0,En(rn(0,l),s))}function vr(n,e,t,r){if(typeof e!="boolean"&&e!=null){r=t;t=typeof e!="function"&&r&&r[e]===n?null:e;e=false}if(t!=null){n=Sn(n,t,r)}return cn(n,e)}function bt(n,t,e){if(typeof e=="number"){var l=n?n.length:0;e=e<0?rn(0,l+e):e||0}else if(e){var r=gt(n,t);return n[r]===t?r:-1}return m(n,t,e)}function br(t,n,s){var l=0,a=t?t.length:0;if(typeof n!="number"&&n!=null){var i=a;n=e.createCallback(n,s,3);while(i--&&n(t[i],i,t)){l++}}else{l=n==null||s?1:n||l}return r(t,0,En(rn(0,a-l),a))}function Er(){var s=[],t=-1,l=arguments.length,r=i(),u=Ln(),d=u===m,o=i();while(++t<l){var e=arguments[t];if(w(e)||An(e)){s.push(e);r.push(d&&e.length>=T&&L(t?s[t]:o))}}var c=s[0],f=-1,g=c?c.length:0,p=[];e:while(++f<g){var n=r[0];e=c[f];if((n?S(n,e):u(o,e))<0){t=l;(n||o).push(e);while(--t){n=r[t];if((n?S(n,e):u(s[t],e))<0){continue e}}p.push(e)}}while(l--){n=r[l];if(n){h(n)}}a(r);a(o);return p}function wr(n,t,s){var l=0,a=n?n.length:0;if(typeof t!="number"&&t!=null){var i=a;t=e.createCallback(t,s,3);while(i--&&t(n[i],i,n)){l++}}else{l=t;if(l==null||s){return n?n[a-1]:u}}return r(n,rn(0,a-l))}function Tt(t,r,n){var e=t?t.length:0;if(typeof n=="number"){e=(n<0?rn(0,e+n):En(n,e-1))+1}while(e--){if(t[e]===r){return e}}return-1}function Sr(e){var t=arguments,r=0,a=t.length,l=e?e.length:0;while(++r<a){var n=-1,i=t[r];while(++n<l){if(e[n]===i){ft.call(e,n--,1);l--}}}return e}function kr(e,t,n){e=+e||0;n=typeof n=="number"?n:+n||1;if(t==null){t=e;e=0}var r=-1,l=rn(0,Zr((t-e)/(n||1))),a=z(l);while(++r<l){a[r]=e;e+=n}return a}function Ir(n,r,s){var t=-1,l=n?n.length:0,a=[];r=e.createCallback(r,s,3);while(++t<l){var i=n[t];if(r(i,t,n)){a.push(i);ft.call(n,t--,1);l--}}return a}function Bn(t,n,i){if(typeof n!="number"&&n!=null){var l=0,a=-1,s=t?t.length:0;n=e.createCallback(n,i,3);while(++a<s&&n(t[a],a,t)){l++}}else{l=n==null||i?1:rn(0,n)}return r(t,l)}function gt(r,l,n,s){var t=0,a=r?r.length:t;n=n?e.createCallback(n,s,1):Gn;l=n(l);while(t<a){var i=t+a>>>1;n(r[i])<l?t=i+1:a=i}return t}function Ar(){return Kn(cn(arguments,true,true))}function St(l,n,t,r){if(typeof n!="boolean"&&n!=null){r=t;t=typeof n!="function"&&r&&r[n]===l?null:n;n=false}if(t!=null){t=e.createCallback(t,r,3)}return Kn(l,n,t)}function Lr(e){return bn(e,r(arguments,1))}function Pr(){var t=-1,r=arguments.length;while(++t<r){var e=arguments[t];if(w(e)||An(e)){var n=n?Kn(bn(n,e).concat(bn(e,n))):e}}return n||[]}function _t(){var e=arguments.length>1?arguments:arguments[0],n=-1,t=e?ct(Vn(e,"length")):0,r=z(t<0?0:t);while(++n<t){r[n]=Vn(e,n)}return r}function pt(e,n){var r=-1,a=e?e.length:0,l={};if(!n&&a&&!w(e[0])){n=[]}while(++r<a){var t=e[r];if(n){l[t]=n[r]}else if(t){l[t[0]]=t[1]}}return l}function Or(n,e){if(!p(e)){throw new sn}return function(){if(--n<1){return e.apply(this,arguments)}}}function yt(e,n){return arguments.length>2?ln(e,17,r(arguments,2),null,n):ln(e,1,null,null,n)}function Nr(e){var n=arguments.length>1?cn(arguments,true,false,1):In(e),t=-1,l=n.length;while(++t<l){var r=n[t];e[r]=ln(e[r],1,null,null,e)}return e}function Fr(e,n){return arguments.length>2?ln(n,19,r(arguments,2),null,e):ln(n,3,null,null,e)}function Br(){var e=arguments,n=e.length;while(n--){if(!p(e[n])){throw new sn}}return function(){var n=arguments,t=e.length;while(t--){n=[e[t].apply(this,n)]}return n[0]}}function Ur(n,e){e=typeof e=="number"?e:+e||n.length;return ln(n,4,null,null,null,e)}function mt(s,a,l){var t,n,o,i,r,e,m,f=0,d=false,c=true;if(!p(s)){throw new sn}a=rn(0,a)||0;if(l===true){var h=true;c=false}else if(I(l)){h=l.leading;d="maxWait"in l&&(rn(a,l.maxWait)||0);c="trailing"in l?l.trailing:c}var g=function(){var l=a-(pn()-i);if(l<=0){if(n){Pn(n)}var c=m;n=e=m=u;if(c){f=pn();o=s.apply(r,t);if(!e&&!n){t=r=null}}}else{e=wn(g,l)}};var y=function(){if(e){Pn(e)}n=e=m=u;if(c||d!==a){f=pn();o=s.apply(r,t);if(!e&&!n){t=r=null}}};return function(){t=arguments;i=pn();r=this;m=c&&(e||!h);if(d===false){var p=h&&!e}else{if(!n&&!h){f=i}var u=d-(i-f),l=u<=0;if(l){if(n){n=Pn(n)}f=i;o=s.apply(r,t)}else if(!n){n=wn(y,u)}}if(l&&e){e=Pn(e)}else if(!e&&a!==d){e=wn(g,a)}if(p){l=true;o=s.apply(r,t)}if(l&&!e&&!n){t=r=null}return o}}function Xr(e){if(!p(e)){throw new sn}var n=r(arguments,1);return wn(function(){e.apply(u,n)},1)}function qr(e,n){if(!p(e)){throw new sn}var t=r(arguments,2);return wn(function(){e.apply(u,t)},n)}function Jr(n,t){if(!p(n)){throw new sn}var e=function(){var r=e.cache,l=t?t.apply(this,arguments):R+arguments[0];return P.call(r,l)?r[l]:r[l]=n.apply(this,arguments)};e.cache={};return e}function Gr(e){var t,n;if(!p(e)){throw new sn}return function(){if(t){return n}t=true;n=e.apply(this,arguments);e=null;return n}}function Wr(e){return ln(e,16,r(arguments,1))}function Hr(e){return ln(e,32,null,r(arguments,1))}function zr(r,l,e){var n=true,t=true;if(!p(r)){throw new sn}if(e===false){n=false}else if(I(e)){n="leading"in e?e.leading:n;t="trailing"in e?e.trailing:t}k.leading=n;k.maxWait=l;k.trailing=t;return mt(r,l,k)}function Yr(e,n){return ln(n,16,[e])}function $r(e){return function(){return e}}function Kr(e,a,i){var r=typeof e;if(e==null||r=="function"){return G(e,a,i)}if(r!="object"){return It(e)}var t=V(e),l=t[0],n=e[l];if(t.length==1&&n===n&&!I(n)){return function(t){var e=t[l];return n===e&&(n!==0||1/n==1/e)}}return function(l){var n=t.length,r=false;while(n--){if(!(r=mn(l[t[n]],e[t[n]],null,true))){break}}return r}}function Qr(e){return e==null?"":un(e).replace(sr,Rr)}function Gn(e){return e}function qn(r,n,t){var a=true,i=n&&In(n);if(!n||!t&&!i.length){if(t==null){t=n}l=dn;n=r;r=e;i=In(n)}if(t===false){a=false}else if(I(t)&&"chain"in t){a=t.chain}var l=r,s=p(l);U(i,function(e){var t=r[e]=n[e];if(s){l.prototype[e]=function(){var n=this.__chain__,i=this.__wrapped__,s=[i];xn.apply(s,arguments);var e=t.apply(r,s);if(a||n){if(i===e&&I(e)){return this}e=new l(e);e.__chain__=n}return e}}})}function nl(){n._=tl;return this}function ot(){}var pn=fn(pn=Zn.now)&&pn||function(){return(new Zn).getTime()};var ll=nt(N+"08")==8?nt:function(e,n){return nt(_n(e)?e.replace(tn,""):e,n||0)};function It(e){return function(n){return n[e]}}function il(e,n,r){var a=e==null,t=n==null;if(r==null){if(typeof e=="boolean"&&t){r=e;e=1}else if(!t&&typeof n=="boolean"){r=n;t=true}}if(a&&t){n=1}e=+e||0;if(t){n=e;e=0}else{n=+n||0}if(r||e%1||n%1){var l=ut();return En(e+l*(n-e+parseFloat("1e-"+((l+"").length-1))),n)}return Qn(e,n)}function sl(e,n){if(e){var t=e[n];return p(t)?e[n]():t}}function ol(l,c,t){var o=e.templateSettings;l=un(l||"");t=Xn({},t,o);var p=Xn({},t.imports,o.imports),v=V(p),g=Mn(p);var i,m=0,f=t.interpolate||_,n="__p += '";var h=Rn((t.escape||_).source+"|"+f.source+"|"+(f===F?Z:_).source+"|"+(t.evaluate||_).source+"|$","g");l.replace(h,function(t,r,e,o,a,s){e||(e=o);n+=l.slice(m,s).replace(W,Y);if(r){n+="' +\n__e("+r+") +\n'"}if(a){i=true;n+="';\n"+a+";\n__p += '"}if(e){n+="' +\n((__t = ("+e+")) == null ? '' : __t) +\n'"}m=s+t.length;return t});n+="';\n";var r=t.variable,s=r;if(!s){r="obj";n="with ("+r+") {\n"+n+"\n}\n"}n=(i?n.replace(X,""):n).replace(nn,"$1").replace(en,"$1;");n="function("+r+") {\n"+(s?"":r+" || ("+r+" = {});\n")+"var __t, __p = '', __e = _.escape"+(i?", __j = Array.prototype.join;\n"+"function print() { __p += __j.call(arguments, '') }\n":";\n")+n+"return __p\n}";var y="\n/*\n//# sourceURL="+(t.sourceURL||"/lodash/template/source["+q++ +"]")+"\n*/";try{var a=Nn(v,"return "+n+y).apply(u,g)}catch(d){d.source=n;throw d}if(c){return a(c)}a.source=n;return a}function ul(e,n,l){e=(e=+e)>-1?e:0;var t=-1,r=z(e);n=G(n,l,1);while(++t<e){r[t]=n(t)}return r}function cl(e){return e==null?"":un(e).replace(ur,xr)}function fl(e){var n=++Q;return un(e==null?"":e)+n}function pl(e){e=new dn(e);e.__chain__=true;return e}function dl(e,n){n(e);return e}function ml(){this.__chain__=true;return this}function hl(){return un(this.__wrapped__)}function Rt(){return this.__wrapped__}e.after=Or;e.assign=Fn;e.at=Vt;e.bind=yt;e.bindAll=Nr;e.bindKey=Fr;e.chain=pl;e.compact=dr;e.compose=Br;e.constant=$r;e.countBy=qt;e.create=tr;e.createCallback=Kr;e.curry=Ur;e.debounce=mt;e.defaults=Xn;e.defer=Xr;e.delay=qr;e.difference=mr;e.filter=Dn;e.flatten=vr;e.forEach=U;e.forEachRight=On;e.forIn=an;e.forInRight=Yt;e.forOwn=t;e.forOwnRight=ht;e.functions=In;e.groupBy=$t;e.indexBy=Kt;e.initial=br;e.intersection=Er;e.invert=vt;e.invoke=Qt;e.keys=V;e.map=Sn;e.mapValues=Mt;e.max=ct;e.memoize=Jr;e.merge=Ot;e.min=nr;e.omit=Dt;e.once=Gr;e.pairs=Nt;e.partial=Wr;e.partialRight=Hr;e.pick=Ft;e.pluck=Vn;e.property=It;e.pull=Sr;e.range=kr;e.reject=ar;e.remove=Ir;e.rest=Bn;e.shuffle=lt;e.sortBy=cr;e.tap=dl;e.throttle=zr;e.times=ul;e.toArray=fr;e.transform=Bt;e.union=Ar;e.uniq=St;e.values=Mn;e.where=pr;e.without=Lr;e.wrap=Yr;e.xor=Pr;e.zip=_t;e.zipObject=pt;e.collect=Sn;e.drop=Bn;e.each=U;e.eachRight=On;e.extend=Fn;e.methods=In;e.object=pt;e.select=Dn;e.tail=Bn;e.unique=St;e.unzip=_t;qn(e);e.clone=lr;e.cloneDeep=rr;e.contains=wt;e.escape=Qr;e.every=Et;e.find=Yn;e.findIndex=hr;e.findKey=er;e.findLast=Ht;e.findLastIndex=gr;e.findLastKey=Zt;e.has=zt;e.identity=Gn;e.indexOf=bt;e.isArguments=An;e.isArray=w;e.isBoolean=Wt;e.isDate=Gt;e.isElement=Jt;e.isEmpty=Xt;e.isEqual=Ut;e.isFinite=Pt;e.isFunction=p;e.isNaN=_r;e.isNull=Lt;e.isNumber=At;e.isObject=I;e.isPlainObject=tt;e.isRegExp=gl;e.isString=_n;e.isUndefined=jt;e.lastIndexOf=Tt;e.mixin=qn;e.noConflict=nl;e.noop=ot;e.now=pn;e.parseInt=ll;e.random=il;e.reduce=zn;e.reduceRight=it;e.result=sl;e.runInContext=C;e.size=or;e.some=rt;e.sortedIndex=gt;e.template=ol;e.unescape=cl;e.uniqueId=fl;e.all=Et;e.any=rt;e.detect=Yn;e.findWhere=Yn;e.foldl=zn;e.foldr=it;e.include=wt;e.inject=zn;qn(function(){var n={};t(e,function(r,t){if(!e.prototype[t]){n[t]=r}});return n}(),false);e.first=Jn;e.last=wr;e.sample=ir;e.take=Jn;e.head=Jn;t(e,function(t,n){var r=n!=="sample";if(!e.prototype[n]){e.prototype[n]=function(e,n){var l=this.__chain__,a=t(this.__wrapped__,e,n);return!l&&(e==null||n&&!(r&&typeof e=="function"))?a:new dn(a,l)}}});e.VERSION="2.4.1";e.prototype.chain=ml;e.prototype.toString=hl;e.prototype.value=Rt;e.prototype.valueOf=Rt;U(["join","pop","shift"],function(n){var t=yn[n];e.prototype[n]=function(){var e=this.__chain__,n=t.apply(this.__wrapped__,arguments);return e?new dn(n,e):n}});U(["push","reverse","sort","unshift"],function(n){var t=yn[n];e.prototype[n]=function(){t.apply(this.__wrapped__,arguments);return this}});U(["concat","slice","splice"],function(n){var t=yn[n];e.prototype[n]=function(){return new dn(t.apply(this.__wrapped__,arguments),this.__chain__)}});return e}var c=C();if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){f._=c;define(function(){return c})}else if(w&&I){if(z){(I.exports=c)._=c}else{w._=c}}else{f._=c}}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],143:[function(x,v,c){"use strict";var s=Object;var r=Object.defineProperty;var l=Object.create;function n(e,n,t){if(r)try{r.call(s,e,n,{value:t})}catch(l){e[n]=t}else{e[n]=t}}function e(e){if(e){n(e,"call",e.call);n(e,"apply",e.apply)}return e}e(r);e(l);var t=e(Object.prototype.hasOwnProperty);var p=e(Number.prototype.toString);var f=e(String.prototype.slice);var o=function(){};function a(e){if(l){return l.call(s,e)}o.prototype=e||null;return new o}var d=Math.random;var i=a(null);function u(){do var e=g(f.call(p.call(d(),36),2));while(t.call(i,e));return i[e]=e}function g(n){var e={};e[n]=true;return Object.keys(e)[0]}n(c,"makeUniqueKey",u);var y=Object.getOwnPropertyNames;Object.getOwnPropertyNames=function b(l){for(var e=y(l),n=0,r=0,a=e.length;n<a;++n){if(!t.call(i,e[n])){if(n>r){e[r]=e[n]}++r}}e.length=r;return e};function m(e){return a(null)}function h(r){var e=u();var l=a(null);r=r||m;function s(a){var t;function i(e,n){if(e===l){return n?t=null:t||(t=r(a))}}n(a,e,i)}function i(n){if(!t.call(n,e))s(n);return n[e](l)}i.forget=function(n){if(t.call(n,e))n[e](l,true)};return i}n(c,"makeAccessor",h)},{}],144:[function(s,x,y){var l=s("assert");var i=s("recast").types;var b=i.builtInTypes.array;var e=i.builders;var n=i.namedTypes;var a=s("./leap");var u=s("./meta");var f=s("./util");var d=f.runtimeProperty("keys");var o=Object.prototype.hasOwnProperty;function c(e){l.ok(this instanceof c);n.Identifier.assert(e);Object.defineProperties(this,{contextId:{value:e},listing:{value:[]},marked:{value:[true]},finalLoc:{value:t()},tryEntries:{value:[]}});Object.defineProperties(this,{leapManager:{value:new a.LeapManager(this)}})}var r=c.prototype;y.Emitter=c;function t(){return e.literal(-1)}r.mark=function(e){n.Literal.assert(e);var t=this.listing.length;if(e.value===-1){e.value=t}else{l.strictEqual(e.value,t)}this.marked[t]=true;return e};r.emit=function(t){if(n.Expression.check(t))t=e.expressionStatement(t);n.Statement.assert(t);this.listing.push(t)};r.emitAssign=function(e,n){this.emit(this.assign(e,n));return e};r.assign=function(n,t){return e.expressionStatement(e.assignmentExpression("=",n,t))};r.contextProperty=function(n,t){return e.memberExpression(this.contextId,t?e.literal(n):e.identifier(n),!!t)};var m={prev:true,next:true,sent:true,rval:true};r.isVolatileContextProperty=function(e){if(n.MemberExpression.check(e)){if(e.computed){return true}if(n.Identifier.check(e.object)&&n.Identifier.check(e.property)&&e.object.name===this.contextId.name&&o.call(m,e.property.name)){return true}}return false};r.stop=function(e){if(e){this.setReturnValue(e)}this.jump(this.finalLoc)};r.setReturnValue=function(e){n.Expression.assert(e.value);this.emitAssign(this.contextProperty("rval"),this.explodeExpression(e))};r.clearPendingException=function(t,r){n.Literal.assert(t);var l=e.callExpression(this.contextProperty("catch",true),[t]);if(r){this.emitAssign(r,l)}else{this.emit(l)}};r.jump=function(n){this.emitAssign(this.contextProperty("next"),n);this.emit(e.breakStatement())};r.jumpIf=function(t,r){n.Expression.assert(t);n.Literal.assert(r);this.emit(e.ifStatement(t,e.blockStatement([this.assign(this.contextProperty("next"),r),e.breakStatement()])))};r.jumpIfNot=function(t,l){n.Expression.assert(t);n.Literal.assert(l);var r;if(n.UnaryExpression.check(t)&&t.operator==="!"){r=t.argument}else{r=e.unaryExpression("!",t)}this.emit(e.ifStatement(r,e.blockStatement([this.assign(this.contextProperty("next"),l),e.breakStatement()])))};var h=0;r.makeTempVar=function(){return this.contextProperty("t"+h++)};r.getContextFunction=function(n){return e.functionExpression(n||null,[this.contextId],e.blockStatement([this.getDispatchLoop()]),false,false)};r.getDispatchLoop=function(){var r=this;var n=[];var l;var t=false;r.listing.forEach(function(a,i){if(r.marked.hasOwnProperty(i)){n.push(e.switchCase(e.literal(i),l=[]));t=false}if(!t){l.push(a);if(g(a))t=true}});this.finalLoc.value=this.listing.length;n.push(e.switchCase(this.finalLoc,[]),e.switchCase(e.literal("end"),[e.returnStatement(e.callExpression(this.contextProperty("stop"),[]))]));return e.whileStatement(e.literal(1),e.switchStatement(e.assignmentExpression("=",this.contextProperty("prev"),this.contextProperty("next")),n))};function g(e){return n.BreakStatement.check(e)||n.ContinueStatement.check(e)||n.ReturnStatement.check(e)||n.ThrowStatement.check(e)}r.getTryEntryList=function(){if(this.tryEntries.length===0){return null}var n=0;return e.arrayExpression(this.tryEntries.map(function(t){var r=t.firstLoc.value;l.ok(r>=n,"try entries out of order");n=r;var a=t.catchEntry;var i=t.finallyEntry;var s=[t.firstLoc,a?a.firstLoc:null];if(i){s[2]=i.firstLoc}return e.arrayExpression(s)}))};r.explode=function(t,a){l.ok(t instanceof i.NodePath);var e=t.value;var r=this;n.Node.assert(e);if(n.Statement.check(e))return r.explodeStatement(t);if(n.Expression.check(e))return r.explodeExpression(t,a);if(n.Declaration.check(e))throw p(e);switch(e.type){case"Program":return t.get("body").map(r.explodeStatement,r);case"VariableDeclarator":throw p(e);case"Property":case"SwitchCase":case"CatchClause":throw new Error(e.type+" nodes should be handled by their parents");default:throw new Error("unknown Node of type "+JSON.stringify(e.type))}};function p(e){return new Error("all declarations should have been transformed into "+"assignments before the Exploder began its work: "+JSON.stringify(e))}r.explodeStatement=function(s,p){l.ok(s instanceof i.NodePath);var o=s.value;var r=this;n.Statement.assert(o);if(p){n.Identifier.assert(p)}else{p=null}if(n.BlockStatement.check(o)){return s.get("body").each(r.explodeStatement,r)}if(!u.containsLeap(o)){r.emit(o);return}switch(o.type){case"ExpressionStatement":r.explodeExpression(s.get("expression"),true);break;case"LabeledStatement":var c=t();r.leapManager.withEntry(new a.LabeledEntry(c,o.label),function(){r.explodeStatement(s.get("body"),o.label)});r.mark(c);break;case"WhileStatement":var w=t();var c=t();r.mark(w);r.jumpIfNot(r.explodeExpression(s.get("test")),c);r.leapManager.withEntry(new a.LoopEntry(c,w,p),function(){r.explodeStatement(s.get("body"))});r.jump(w);r.mark(c);break;case"DoWhileStatement":var A=t();var C=t();var c=t();r.mark(A);r.leapManager.withEntry(new a.LoopEntry(c,C,p),function(){r.explode(s.get("body"))});r.mark(C);r.jumpIf(r.explodeExpression(s.get("test")),A);r.mark(c);break;case"ForStatement":var y=t();var P=t();var c=t();if(o.init){r.explode(s.get("init"),true)}r.mark(y);if(o.test){r.jumpIfNot(r.explodeExpression(s.get("test")),c)}else{}r.leapManager.withEntry(new a.LoopEntry(c,P,p),function(){r.explodeStatement(s.get("body"))});r.mark(P);if(o.update){r.explode(s.get("update"),true)}r.jump(y);r.mark(c);break;case"ForInStatement":n.Identifier.assert(o.left);var y=t();var c=t();var j=r.makeTempVar();r.emitAssign(j,e.callExpression(d,[r.explodeExpression(s.get("right"))]));r.mark(y);var R=r.makeTempVar();r.jumpIf(e.memberExpression(e.assignmentExpression("=",R,e.callExpression(j,[])),e.identifier("done"),false),c);r.emitAssign(o.left,e.memberExpression(R,e.identifier("value"),false));r.leapManager.withEntry(new a.LoopEntry(c,y,p),function(){r.explodeStatement(s.get("body"))});r.jump(y);r.mark(c);break;case"BreakStatement":r.emitAbruptCompletion({type:"break",target:r.leapManager.getBreakLoc(o.label)});break;case"ContinueStatement":r.emitAbruptCompletion({type:"continue",target:r.leapManager.getContinueLoc(o.label)});break;case"SwitchStatement":var M=r.emitAssign(r.makeTempVar(),r.explodeExpression(s.get("discriminant")));var c=t();var v=t();var _=v;var S=[];var T=o.cases||[];for(var g=T.length-1;g>=0;--g){var k=T[g];n.SwitchCase.assert(k);if(k.test){_=e.conditionalExpression(e.binaryExpression("===",M,k.test),S[g]=t(),_)}else{S[g]=v}}r.jump(r.explodeExpression(new i.NodePath(_,s,"discriminant")));r.leapManager.withEntry(new a.SwitchEntry(c),function(){s.get("cases").each(function(e){var t=e.value;var n=e.name;r.mark(S[n]);e.get("consequent").each(r.explodeStatement,r)})});r.mark(c);if(v.value===-1){r.mark(v);l.strictEqual(c.value,v.value)}break;case"IfStatement":var I=o.alternate&&t();var c=t();r.jumpIfNot(r.explodeExpression(s.get("test")),I||c);r.explodeStatement(s.get("consequent"));if(I){r.jump(c);r.mark(I);r.explodeStatement(s.get("alternate"))}r.mark(c);break;case"ReturnStatement":r.emitAbruptCompletion({type:"return",value:r.explodeExpression(s.get("argument"))});break;case"WithStatement":throw new Error(node.type+" not supported in generator functions.");case"TryStatement":var c=t();var h=o.handler;if(!h&&o.handlers){h=o.handlers[0]||null}var b=h&&t();var L=b&&new a.CatchEntry(b,h.param);var m=o.finalizer&&t();var E=m&&new a.FinallyEntry(m);var x=new a.TryEntry(r.getUnmarkedCurrentLoc(),L,E);r.tryEntries.push(x);r.updateContextPrevLoc(x.firstLoc);r.leapManager.withEntry(x,function(){r.explodeStatement(s.get("block"));if(b){if(m){r.jump(m)}else{r.jump(c)}r.updateContextPrevLoc(r.mark(b));var o=s.get("handler","body");var u=r.makeTempVar();r.clearPendingException(x.firstLoc,u);var t=o.scope;var a=h.param.name;n.CatchClause.assert(t.node);l.strictEqual(t.lookup(a),t);i.visit(o,{visitIdentifier:function(e){if(f.isReference(e,a)&&e.scope.lookup(a)===t){return u}this.traverse(e)},visitFunction:function(e){if(e.scope.declares(a)){return false}this.traverse(e)}});r.leapManager.withEntry(L,function(){r.explodeStatement(o)})}if(m){r.updateContextPrevLoc(r.mark(m));r.leapManager.withEntry(E,function(){r.explodeStatement(s.get("finalizer"))});r.emit(e.callExpression(r.contextProperty("finish"),[E.firstLoc]))}});r.mark(c);break;case"ThrowStatement":r.emit(e.throwStatement(r.explodeExpression(s.get("argument"))));break;default:throw new Error("unknown Statement of type "+JSON.stringify(o.type))}};r.emitAbruptCompletion=function(t){if(!v(t)){l.ok(false,"invalid completion record: "+JSON.stringify(t))}l.notStrictEqual(t.type,"normal","normal completions are not abrupt");var r=[e.literal(t.type)];if(t.type==="break"||t.type==="continue"){n.Literal.assert(t.target);r[1]=t.target}else if(t.type==="return"||t.type==="throw"){if(t.value){n.Expression.assert(t.value);r[1]=t.value}}this.emit(e.returnStatement(e.callExpression(this.contextProperty("abrupt"),r)))};function v(e){var t=e.type;if(t==="normal"){return!o.call(e,"target")}if(t==="break"||t==="continue"){return!o.call(e,"value")&&n.Literal.check(e.target)}if(t==="return"||t==="throw"){return o.call(e,"value")&&!o.call(e,"target")}return false}r.getUnmarkedCurrentLoc=function(){return e.literal(this.listing.length)};r.updateContextPrevLoc=function(e){if(e){n.Literal.assert(e);if(e.value===-1){e.value=this.listing.length}else{l.strictEqual(e.value,this.listing.length)}}else{e=this.getUnmarkedCurrentLoc()}this.emitAssign(this.contextProperty("prev"),e)};r.explodeExpression=function(a,d){l.ok(a instanceof i.NodePath);var s=a.value;if(s){n.Expression.assert(s)}else{return s}var r=this;var o;function f(e){n.Expression.assert(e);if(d){r.emit(e)}else{return e}}if(!u.containsLeap(s)){return f(s)}var b=u.containsLeap.onlyChildren(s);function c(n,a,t){l.ok(a instanceof i.NodePath);l.ok(!t||!n,"Ignoring the result of a child expression but forcing it to "+"be assigned to a temporary variable?");var e=r.explodeExpression(a,t);if(t){}else if(n||b&&(r.isVolatileContextProperty(e)||u.hasSideEffects(e))){e=r.emitAssign(n||r.makeTempVar(),e)}return e}switch(s.type){case"MemberExpression":return f(e.memberExpression(r.explodeExpression(a.get("object")),s.computed?c(null,a.get("property")):s.property,s.computed));case"CallExpression":var v=a.get("callee");var m=r.explodeExpression(v);if(!n.MemberExpression.check(v.node)&&n.MemberExpression.check(m)){m=e.sequenceExpression([e.literal(0),m])}return f(e.callExpression(m,a.get("arguments").map(function(e){return c(null,e)})));case"NewExpression":return f(e.newExpression(c(null,a.get("callee")),a.get("arguments").map(function(e){return c(null,e)})));case"ObjectExpression":return f(e.objectExpression(a.get("properties").map(function(n){return e.property(n.value.kind,n.value.key,c(null,n.get("value")))})));case"ArrayExpression":return f(e.arrayExpression(a.get("elements").map(function(e){return c(null,e)})));case"SequenceExpression":var x=s.expressions.length-1;a.get("expressions").each(function(e){if(e.name===x){o=r.explodeExpression(e,d)}else{r.explodeExpression(e,true)}});return o;case"LogicalExpression":var p=t();if(!d){o=r.makeTempVar()}var g=c(o,a.get("left"));if(s.operator==="&&"){r.jumpIfNot(g,p)}else{l.strictEqual(s.operator,"||");r.jumpIf(g,p)}c(o,a.get("right"),d);r.mark(p);return o;case"ConditionalExpression":var y=t();var p=t();var E=r.explodeExpression(a.get("test"));r.jumpIfNot(E,y);if(!d){o=r.makeTempVar()}c(o,a.get("consequent"),d);r.jump(p);r.mark(y);c(o,a.get("alternate"),d);r.mark(p);return o;case"UnaryExpression":return f(e.unaryExpression(s.operator,r.explodeExpression(a.get("argument")),!!s.prefix));case"BinaryExpression":return f(e.binaryExpression(s.operator,c(null,a.get("left")),c(null,a.get("right"))));case"AssignmentExpression":return f(e.assignmentExpression(s.operator,r.explodeExpression(a.get("left")),r.explodeExpression(a.get("right"))));case"UpdateExpression":return f(e.updateExpression(s.operator,r.explodeExpression(a.get("argument")),s.prefix));case"YieldExpression":var p=t();var h=s.argument&&r.explodeExpression(a.get("argument"));if(h&&s.delegate){var o=r.makeTempVar();r.emit(e.returnStatement(e.callExpression(r.contextProperty("delegateYield"),[h,e.literal(o.property.name),p])));r.mark(p);return o}r.emitAssign(r.contextProperty("next"),p);r.emit(e.returnStatement(h||null));r.mark(p);return r.contextProperty("sent");default:throw new Error("unknown Expression of type "+JSON.stringify(s.type))}}},{"./leap":146,"./meta":147,"./util":148,assert:110,recast:177}],145:[function(r,s,l){var a=r("assert");var t=r("recast").types;var n=t.namedTypes;var e=t.builders;var i=Object.prototype.hasOwnProperty;l.hoist=function(r){a.ok(r instanceof t.NodePath);n.Function.assert(r.value);var l={};function s(r,a){n.VariableDeclaration.assert(r);var t=[];r.declarations.forEach(function(n){l[n.id.name]=n.id;if(n.init){t.push(e.assignmentExpression("=",n.id,n.init))}else if(a){t.push(n.id)}});if(t.length===0)return null;if(t.length===1)return t[0];return e.sequenceExpression(t)}t.visit(r.get("body"),{visitVariableDeclaration:function(n){var t=s(n.value,false);if(t===null){n.replace()}else{return e.expressionStatement(t)}return false},visitForStatement:function(e){var t=e.value.init;if(n.VariableDeclaration.check(t)){e.get("init").replace(s(t,false))}this.traverse(e)},visitForInStatement:function(e){var t=e.value.left;if(n.VariableDeclaration.check(t)){e.get("left").replace(s(t,true))}this.traverse(e)},visitFunctionDeclaration:function(r){var t=r.value;l[t.id.name]=t.id;var i=r.parent.node;var a=e.expressionStatement(e.assignmentExpression("=",t.id,e.functionExpression(t.id,t.params,t.body,t.generator,t.expression)));if(n.BlockStatement.check(r.parent.node)){r.parent.get("body").unshift(a);r.replace()}else{r.replace(a)}return false},visitFunctionExpression:function(e){return false}});var u={};r.get("params").each(function(t){var e=t.value;if(n.Identifier.check(e)){u[e.name]=e}else{}});var o=[];Object.keys(l).forEach(function(n){if(!i.call(u,n)){o.push(e.variableDeclarator(l[n],null))}});if(o.length===0){return null}return e.variableDeclaration("var",o)}},{assert:110,recast:177}],146:[function(a,g,t){var r=a("assert");var p=a("recast").types;var n=p.namedTypes;var v=p.builders;var l=a("util").inherits;var y=Object.prototype.hasOwnProperty;function e(){r.ok(this instanceof e)}function u(t){e.call(this);n.Literal.assert(t);this.returnLoc=t}l(u,e);t.FunctionEntry=u;function h(r,l,t){e.call(this);n.Literal.assert(r);n.Literal.assert(l);if(t){n.Identifier.assert(t)}else{t=null}this.breakLoc=r;this.continueLoc=l;this.label=t}l(h,e);t.LoopEntry=h;function m(t){e.call(this);n.Literal.assert(t);this.breakLoc=t}l(m,e);t.SwitchEntry=m;function d(a,t,l){e.call(this);n.Literal.assert(a);if(t){r.ok(t instanceof c)}else{t=null}if(l){r.ok(l instanceof f)}else{l=null}r.ok(t||l);this.firstLoc=a;this.catchEntry=t;this.finallyEntry=l}l(d,e);t.TryEntry=d;function c(t,r){e.call(this);n.Literal.assert(t);n.Identifier.assert(r);this.firstLoc=t;this.paramId=r}l(c,e);t.CatchEntry=c;function f(t){e.call(this);n.Literal.assert(t);this.firstLoc=t}l(f,e);t.FinallyEntry=f;function o(t,r){e.call(this);n.Literal.assert(t);n.Identifier.assert(r);this.breakLoc=t;this.label=r}l(o,e);t.LabeledEntry=o;function s(e){r.ok(this instanceof s);var n=a("./emit").Emitter;r.ok(e instanceof n);this.emitter=e;this.entryStack=[new u(e.finalLoc)]}var i=s.prototype;t.LeapManager=s;i.withEntry=function(n,t){r.ok(n instanceof e);this.entryStack.push(n);try{t.call(this.emitter)}finally{var l=this.entryStack.pop();r.strictEqual(l,n)}};i._findLeapLocation=function(l,r){for(var n=this.entryStack.length-1;n>=0;--n){var e=this.entryStack[n];var t=e[l];if(t){if(r){if(e.label&&e.label.name===r.name){return t}}else if(e instanceof o){}else{return t}}}return null};i.getBreakLoc=function(e){return this._findLeapLocation("breakLoc",e)};i.getContinueLoc=function(e){return this._findLeapLocation("continueLoc",e)}},{"./emit":144,assert:110,recast:177,util:134}],147:[function(r,d,o){var f=r("assert");var u=r("private").makeAccessor();var l=r("recast").types;var c=l.builtInTypes.array;var t=l.namedTypes;var n=Object.prototype.hasOwnProperty;function i(e,i){function a(n){t.Node.assert(n);var e=false;function a(n){if(e){}else if(c.check(n)){n.some(a)}else if(t.Node.check(n)){f.strictEqual(e,false);e=r(n)}return e}l.eachField(n,function(n,e){a(e)});return e}function r(r){t.Node.assert(r);var l=u(r);if(n.call(l,e))return l[e];if(n.call(p,r.type))return l[e]=false;if(n.call(i,r.type))return l[e]=true;return l[e]=a(r)}r.onlyChildren=a;return r}var p={FunctionExpression:true};var s={CallExpression:true,ForInStatement:true,UnaryExpression:true,BinaryExpression:true,AssignmentExpression:true,UpdateExpression:true,NewExpression:true};var e={YieldExpression:true,BreakStatement:true,ContinueStatement:true,ReturnStatement:true,ThrowStatement:true};for(var a in e){if(n.call(e,a)){s[a]=e[a]}}o.hasSideEffects=i("hasSideEffects",s);o.containsLeap=i("containsLeap",e)},{assert:110,"private":143,recast:177}],148:[function(t,i,e){var s=t("assert");var r=t("recast").types;var a=r.namedTypes;var n=r.builders;var l=Object.prototype.hasOwnProperty;e.defaults=function(t){var a=arguments.length;var e;for(var r=1;r<a;++r){if(e=arguments[r]){for(var n in e){if(l.call(e,n)&&!l.call(t,n)){t[n]=e[n]}}}}return t};e.runtimeProperty=function(e){return n.memberExpression(n.identifier("regeneratorRuntime"),n.identifier(e),false)};e.isReference=function(e,r){var t=e.value;if(!a.Identifier.check(t)){return false}if(r&&t.name!==r){return false}var n=e.parent.value;switch(n.type){case"VariableDeclarator":return e.name==="init";case"MemberExpression":return e.name==="object"||n.computed&&e.name==="property";case"FunctionExpression":case"FunctionDeclaration":case"ArrowFunctionExpression":if(e.name==="id"){return false}if(n.params===e.parentPath&&n.params[e.name]===t){return false}return true;case"ClassDeclaration":case"ClassExpression":return e.name!=="id";case"CatchClause":return e.name!=="param";case"Property":case"MethodDefinition":return e.name!=="key";case"ImportSpecifier":case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":case"LabeledStatement":return false;default:return true}}},{assert:110,recast:177}],149:[function(r,E,p){var m=r("assert");var g=r("fs");var a=r("recast");var t=a.types;var n=t.namedTypes;var e=t.builders;var _=t.builtInTypes.array;var w=t.builtInTypes.object;var o=t.NodePath;var b=r("./hoist").hoist;var d=r("./emit").Emitter;var l=r("./util").runtimeProperty;var h=l("wrap");var s=l("mark");var y=l("values");var v=l("async");p.transform=function S(e,t){t=t||{};var r=e instanceof o?e:new o(e);i.visit(r,t);e=r.value;if(t.includeRuntime===true||t.includeRuntime==="if used"&&i.wasChangeReported()){x(n.File.check(e)?e.program:e)}t.madeChanges=i.wasChangeReported();return e};function x(e){n.Program.assert(e);var t=r("..").runtime.path;var i=g.readFileSync(t,"utf8");var s=a.parse(i,{sourceFileName:t}).program.body;var l=e.body;l.unshift.apply(l,s)
}var i=t.PathVisitor.fromMethodsObject({reset:function(n,e){this.options=e},visitFunction:function(r){this.traverse(r);var t=r.value;var i=t.async&&!this.options.disableAsync;if(!t.generator&&!i){return}this.reportChanged();t.generator=false;if(t.expression){t.expression=false;t.body=e.blockStatement([e.returnStatement(t.body)])}if(i){f.visit(r.get("body"))}var A=t.id||(t.id=r.scope.parent.declareTemporary("callee$"));var R=e.identifier(t.id.name+"$");var I=r.scope.declareTemporary("context$");var w=r.scope.declareTemporary("args$");var S=u(r,w);var a=b(r);if(S){a=a||e.variableDeclaration("var",[]);a.declarations.push(e.variableDeclarator(w,e.identifier("arguments")))}var y=new d(I);y.explode(r.get("body"));var p=[];if(a&&a.declarations.length>0){p.push(a)}var x=[y.getContextFunction(R),i?e.literal(null):A,e.thisExpression()];var E=y.getTryEntryList();if(E){x.push(E)}var k=e.callExpression(i?v:h,x);p.push(e.returnStatement(k));t.body=e.blockStatement(p);if(i){t.async=false;return}if(n.FunctionDeclaration.check(t)){var l=r.parent;while(l&&!(n.BlockStatement.check(l.value)||n.Program.check(l.value))){l=l.parent}if(!l){return}r.replace();t.type="FunctionExpression";var o=e.variableDeclaration("var",[e.variableDeclarator(t.id,e.callExpression(s,[t]))]);if(t.comments){o.comments=t.comments;t.comments=null}var g=l.get("body");var C=g.value.length;for(var m=0;m<C;++m){var _=g.get(m);if(!c(_)){_.insertBefore(o);return}}g.push(o)}else{n.FunctionExpression.assert(t);return e.callExpression(s,[t])}},visitForOfStatement:function(l){this.traverse(l);var t=l.value;var s=l.scope.declareTemporary("t$");var o=e.variableDeclarator(s,e.callExpression(y,[t.right]));var i=l.scope.declareTemporary("t$");var u=e.variableDeclarator(i,null);var r=t.left;var a;if(n.VariableDeclaration.check(r)){a=r.declarations[0].id;r.declarations.push(o,u)}else{a=r;r=e.variableDeclaration("var",[o,u])}n.Identifier.assert(a);var c=e.expressionStatement(e.assignmentExpression("=",a,e.memberExpression(i,e.identifier("value"),false)));if(n.BlockStatement.check(t.body)){t.body.body.unshift(c)}else{t.body=e.blockStatement([c,t.body])}return e.forStatement(r,e.unaryExpression("!",e.memberExpression(e.assignmentExpression("=",i,e.callExpression(e.memberExpression(s,e.identifier("next"),false),[])),e.identifier("done"),false)),null,t.body)}});function c(a){var e=a.value;n.Statement.assert(e);if(n.ExpressionStatement.check(e)&&n.Literal.check(e.expression)&&e.expression.value==="use strict"){return true}if(n.VariableDeclaration.check(e)){for(var r=0;r<e.declarations.length;++r){var l=e.declarations[r];if(n.CallExpression.check(l.init)&&t.astNodesAreEquivalent(l.init.callee,s)){return true}}}return false}function u(e,i){m.ok(e instanceof t.NodePath);var s=e.value;var r=false;var l=false;a.visit(e,{visitFunction:function(e){if(e.value===s){l=!e.scope.lookup("arguments");this.traverse(e)}else{return false}},visitIdentifier:function(e){if(e.value.name==="arguments"){var t=n.MemberExpression.check(e.parent.node)&&e.name==="property"&&!e.parent.node.computed;if(!t){e.replace(i);r=true;return false}}this.traverse(e)}});return r&&l}var f=t.PathVisitor.fromMethodsObject({visitFunction:function(e){return false},visitAwaitExpression:function(n){return e.yieldExpression(n.value.argument,false)}})},{"..":150,"./emit":144,"./hoist":145,"./util":148,assert:110,fs:109,recast:177}],150:[function(e,n,t){(function(m){var f=e("assert");var g=e("path");var y=e("fs");var d=e("through");var i=e("./lib/visit").transform;var h=e("./lib/util");var t=e("recast");var s=t.types;var b=/\bfunction\s*\*|\basync\b/;var p=/\b(let|const)\s+/;function r(l,n){var e=[];return d(t,r);function t(n){e.push(n)}function r(){this.queue(o(e.join(""),n).code);this.queue(null)}}n.exports=r;function l(){e("./runtime")}r.runtime=l;l.path=g.join(m,"runtime.js");function o(n,e){e=u(e);if(!b.test(n)){return{code:(e.includeRuntime===true?y.readFileSync(l.path,"utf-8")+"\n":"")+n}}var r=c(e);var p=t.parse(n,r);var o=new s.NodePath(p);var f=o.get("program");if(v(n,e)){a(f.node)}i(f,e);return t.print(o,r)}function u(n){n=h.defaults(n||{},{includeRuntime:false,supportBlockBinding:true});if(!n.esprima){n.esprima=e("esprima-fb")}f.ok(/harmony/.test(n.esprima.version),"Bad esprima version: "+n.esprima.version);return n}function c(n){var t={range:true};function e(e){if(e in n){t[e]=n[e]}}e("esprima");e("sourceFileName");e("sourceMapName");e("inputSourceMap");e("sourceRoot");return t}function v(n,t){var e=!!t.supportBlockBinding;if(e){if(!p.test(n)){e=false}}return e}function x(r,l){var e=c(u(l));var n=t.parse(r,e);a(n.program);return t.print(n,e).code}function a(n){s.namedTypes.Program.assert(n);var t=e("defs")(n,{ast:true,disallowUnknownReferences:false,disallowDuplicated:false,disallowVars:false,loopClosures:"iife"});if(t.errors){throw new Error(t.errors.join("\n"))}return n}r.varify=x;r.compile=o;r.transform=i}).call(this,"/node_modules/regenerator")},{"./lib/util":148,"./lib/visit":149,"./runtime":179,assert:110,defs:151,"esprima-fb":166,fs:109,path:118,recast:177,through:178}],151:[function(t,x,N){"use strict";var l=t("assert");var r=t("simple-is");var f=t("simple-fmt");var M=t("stringmap");var w=t("stringset");var _=t("alter");var a=t("ast-traverse");var I=t("breakable");var s=t("./scope");var n=t("./error");var e=n.getline;var i=t("./options");var k=t("./stats");var u=t("./jshint_globals/vars.js");function c(e){return r.someof(e,["const","let"])}function v(e){return r.someof(e,["var","const","let"])}function O(e){return e.type==="BlockStatement"&&r.noneof(e.$parent.type,["FunctionDeclaration","FunctionExpression"])}function b(e){return e.type==="ForStatement"&&e.init&&e.init.type==="VariableDeclaration"&&c(e.init.kind)}function E(e){return y(e)&&e.left.type==="VariableDeclaration"&&c(e.left.kind)}function y(e){return r.someof(e.type,["ForInStatement","ForOfStatement"])}function o(e){return r.someof(e.type,["FunctionDeclaration","FunctionExpression"])}function m(e){return r.someof(e.type,["ForStatement","ForInStatement","ForOfStatement","WhileStatement","DoWhileStatement"])}function p(n){var e=n.$parent;return n.$refToScope||n.type==="Identifier"&&!(e.type==="VariableDeclarator"&&e.id===n)&&!(e.type==="MemberExpression"&&e.computed===false&&e.property===n)&&!(e.type==="Property"&&e.key===n)&&!(e.type==="LabeledStatement"&&e.label===n)&&!(e.type==="CatchClause"&&e.param===n)&&!(o(e)&&e.id===n)&&!(o(e)&&r.someof(n,e.params))&&true}function g(e){return p(e)&&(e.$parent.type==="AssignmentExpression"&&e.$parent.left===e||e.$parent.type==="UpdateExpression"&&e.$parent.argument===e)}function R(t,a){l(!t.$scope);t.$parent=a;t.$scope=t.$parent?t.$parent.$scope:null;if(t.type==="Program"){t.$scope=new s({kind:"hoist",node:t,parent:null})}else if(o(t)){t.$scope=new s({kind:"hoist",node:t,parent:t.$parent.$scope});if(t.id){l(t.id.type==="Identifier");if(t.type==="FunctionDeclaration"){t.$parent.$scope.add(t.id.name,"fun",t.id,null)}else if(t.type==="FunctionExpression"){t.$scope.add(t.id.name,"fun",t.id,null)}else{l(false)}}t.params.forEach(function(e){t.$scope.add(e.name,"param",e,null)})}else if(t.type==="VariableDeclaration"){l(v(t.kind));t.declarations.forEach(function(r){l(r.type==="VariableDeclarator");var a=r.id.name;if(i.disallowVars&&t.kind==="var"){n(e(r),"var {0} is not allowed (use let or const)",a)}t.$scope.add(a,t.kind,r.id,r.range[1])})}else if(b(t)||E(t)){t.$scope=new s({kind:"block",node:t,parent:t.$parent.$scope})}else if(O(t)){t.$scope=new s({kind:"block",node:t,parent:t.$parent.$scope})}else if(t.type==="CatchClause"){var r=t.param;t.$scope=new s({kind:"catch-block",node:t,parent:t.$parent.$scope});t.$scope.add(r.name,"caught",r,null);t.$scope.closestHoistScope().markPropagates(r.name)}}function C(r,l,a){function t(t){for(var n in t){var r=t[n];var l=r?"var":"const";if(e.hasOwn(n)){e.remove(n)}e.add(n,l,{loc:{start:{line:-1}}},-1)}}var e=new s({kind:"hoist",node:{},parent:null});var i={undefined:false,Infinity:false,console:false};t(i);t(u.reservedVars);t(u.ecmaIdentifiers);if(l){l.forEach(function(e){if(!u[e]){n(-1,'environment "{0}" not found',e)}else{t(u[e])}})}if(a){t(a)}r.parent=e;e.children.push(r);return e}function A(o,u,t){var s=r.own(t,"analyze")?t.analyze:true;function c(t){if(!p(t)){return}u.add(t.name);var a=t.$scope.lookup(t.name);if(s&&!a&&i.disallowUnknownReferences){n(e(t),"reference to unknown global variable {0}",t.name)}if(s&&a&&r.someof(a.getKind(t.name),["const","let"])){var o=a.getFromPos(t.name);var c=t.range[0];l(r.finitenumber(o));l(r.finitenumber(c));if(c<o){if(!t.$scope.hasFunctionScopeBetween(a)){n(e(t),"{0} is referenced before its declaration",t.name)}}}t.$refToScope=a}a(o,{pre:c})}function T(t,i,r,n){function s(e){l(r.has(e));for(var n=0;;n++){var t=e+"$"+String(n);if(!r.has(t)){return t}}}function o(t){if(t.type==="VariableDeclaration"&&c(t.kind)){var a=t.$scope.closestHoistScope();var o=t.$scope;n.push({start:t.range[0],end:t.range[0]+t.kind.length,str:"var"});t.declarations.forEach(function(u){l(u.type==="VariableDeclarator");var c=u.id.name;i.declarator(t.kind);var p=o!==a&&(a.hasOwn(c)||a.doesPropagate(c));var f=p?s(c):c;o.remove(c);a.add(f,"var",u.id,u.range[1]);o.moves=o.moves||M();o.moves.set(c,{name:f,scope:a});r.add(f);if(f!==c){i.rename(c,f,e(u));u.id.originalName=c;u.id.name=f;n.push({start:u.id.range[0],end:u.id.range[1],str:f})}});t.kind="var"}}function u(e){if(!e.$refToScope){return}var t=e.$refToScope.moves&&e.$refToScope.moves.get(e.name);if(!t){return}e.$refToScope=t.scope;if(e.name!==t.name){e.originalName=e.name;e.name=t.name;if(e.alterop){var r=null;for(var a=0;a<n.length;a++){var i=n[a];if(i.node===e){r=i;break}}l(r);r.str=t.name}else{n.push({start:e.range[0],end:e.range[1],str:t.name})}}}a(t,{pre:o});a(t,{pre:u});t.$scope.traverse({pre:function(e){delete e.moves}})}function L(t){a(t,{pre:s});function r(r,t){return I(function(l){a(r,{pre:function(r){if(o(r)){return false}var i=true;var a="loop-variable {0} is captured by a loop-closure that can't be transformed due to use of {1} at line {2}";if(r.type==="BreakStatement"){n(e(t),a,t.name,"break",e(r))}else if(r.type==="ContinueStatement"){n(e(t),a,t.name,"continue",e(r))}else if(r.type==="ReturnStatement"){n(e(t),a,t.name,"return",e(r))}else if(r.type==="YieldExpression"){n(e(t),a,t.name,"yield",e(r))}else if(r.type==="Identifier"&&r.name==="arguments"){n(e(t),a,t.name,"arguments",e(r))}else if(r.type==="VariableDeclaration"&&r.kind==="var"){n(e(t),a,t.name,"var",e(r))}else{i=false}if(i){l(true)}}});return false})}function s(t){var a=null;if(p(t)&&t.$refToScope&&c(t.$refToScope.getKind(t.name))){for(var s=t.$refToScope.node;;){if(o(s)){return}else if(m(s)){a=s;break}s=s.$parent;if(!s){return}}l(m(a));var f=t.$refToScope;var h=i.loopClosures==="iife";for(var u=t.$scope;u;u=u.parent){if(u===f){return}else if(o(u.node)){if(!h){var g='loop-variable {0} is captured by a loop-closure. Tried "loopClosures": "iife" in defs-config.json?';return n(e(t),g,t.name)}if(a.type==="ForStatement"&&f.node===a){var d=f.getNode(t.name);return n(e(d),"Not yet specced ES6 feature. {0} is declared in for-loop header and then captured in loop closure",d.name)}if(r(a.body,t)){return}a.$iify=true}}}}}function P(n,t,r){function e(e,l,n){var r={start:e,end:e,str:l};if(n){r.node=n}t.push(r)}a(n,{pre:function(n){if(!n.$iify){return}var i=n.body.type==="BlockStatement";var d=i?n.body.range[0]+1:n.body.range[0];var l=i?n.body.range[1]-1:n.body.range[1];var t=y(n)&&n.left.declarations[0].id.name;var s=f("(function({0}){",t?t:"");var o=f("}).call(this{0});",t?", "+t:"");var v=r.parse(s+o);var a=v.body[0];var p=a.expression.callee.object.body;if(i){var c=n.body;var m=c.body;c.body=[a];p.body=m}else{var h=n.body;n.body=a;p.body[0]=h}e(d,s);if(t){e(l,"}).call(this, ");var g=a.expression.arguments;var u=g[1];u.alterop=true;e(l,t,u);e(l,");")}else{e(l,o)}}})}function j(t){a(t,{pre:function(t){if(g(t)){var r=t.$scope.lookup(t.name);if(r&&r.getKind(t.name)==="const"){n(e(t),"can't assign to const variable {0}",t.name)}}}})}function D(e){a(e,{pre:function(e){if(g(e)){var n=e.$scope.lookup(e.name);if(n){n.markWrite(e.name)}}}});e.$scope.detectUnmodifiedLets()}function h(e,t){a(e,{pre:R});var r=C(e.$scope,i.environments,i.globals);var n=w();r.traverse({pre:function(e){n.addMany(e.decls.keys())}});A(e,n,t);return n}function d(e){a(e,{pre:function(e){for(var n in e){if(n[0]==="$"){delete e[n]}}}})}function S(t,c){for(var p in c){i[p]=c[p]}var o;if(r.object(t)){if(!i.ast){return{errors:["Can't produce string output when input is an AST. "+"Did you forget to set options.ast = true?"]}}o=t}else if(r.string(t)){try{o=i.parse(t,{loc:true,range:true})}catch(a){return{errors:[f("line {0} column {1}: Error during input file parsing\n{2}\n{3}",a.lineNumber,a.column,t.split("\n")[a.lineNumber-1],f.repeat(" ",a.column-1)+"^")]}}}else{return{errors:["Input was neither an AST object nor a string."]}}var e=o;n.reset();var m=h(e,{});L(e);j(e);var s=[];P(e,s,i);if(n.errors.length>=1){return{errors:n.errors}}if(s.length>0){d(e);m=h(e,{analyze:false})}l(n.errors.length===0);var u=new k;T(e,u,m,s);if(i.ast){d(e);return{stats:u,ast:e}}else{var g=_(t,s);return{stats:u,src:g}}}x.exports=S},{"./error":152,"./jshint_globals/vars.js":153,"./options":154,"./scope":155,"./stats":156,alter:157,assert:110,"ast-traverse":159,breakable:160,"simple-fmt":162,"simple-is":163,stringmap:164,stringset:165}],152:[function(t,r,a){"use strict";var n=t("simple-fmt");var l=t("assert");function e(t,a){l(arguments.length>=2);var r=arguments.length===2?String(a):n.apply(n,Array.prototype.slice.call(arguments,1));e.errors.push(t===-1?r:n("line {0}: {1}",t,r))}e.reset=function(){e.errors=[]};e.getline=function(e){if(e&&e.loc&&e.loc.start){return e.loc.start.line}return-1};e.reset();r.exports=e},{assert:110,"simple-fmt":162}],153:[function(n,t,e){"use strict";e.reservedVars={arguments:false,NaN:false};e.ecmaIdentifiers={Array:false,Boolean:false,Date:false,decodeURI:false,decodeURIComponent:false,encodeURI:false,encodeURIComponent:false,Error:false,eval:false,EvalError:false,Function:false,hasOwnProperty:false,isFinite:false,isNaN:false,JSON:false,Math:false,Map:false,Number:false,Object:false,parseInt:false,parseFloat:false,RangeError:false,ReferenceError:false,RegExp:false,Set:false,String:false,SyntaxError:false,TypeError:false,URIError:false,WeakMap:false};e.browser={ArrayBuffer:false,ArrayBufferView:false,Audio:false,Blob:false,addEventListener:false,applicationCache:false,atob:false,blur:false,btoa:false,clearInterval:false,clearTimeout:false,close:false,closed:false,DataView:false,DOMParser:false,defaultStatus:false,document:false,Element:false,event:false,FileReader:false,Float32Array:false,Float64Array:false,FormData:false,focus:false,frames:false,getComputedStyle:false,HTMLElement:false,HTMLAnchorElement:false,HTMLBaseElement:false,HTMLBlockquoteElement:false,HTMLBodyElement:false,HTMLBRElement:false,HTMLButtonElement:false,HTMLCanvasElement:false,HTMLDirectoryElement:false,HTMLDivElement:false,HTMLDListElement:false,HTMLFieldSetElement:false,HTMLFontElement:false,HTMLFormElement:false,HTMLFrameElement:false,HTMLFrameSetElement:false,HTMLHeadElement:false,HTMLHeadingElement:false,HTMLHRElement:false,HTMLHtmlElement:false,HTMLIFrameElement:false,HTMLImageElement:false,HTMLInputElement:false,HTMLIsIndexElement:false,HTMLLabelElement:false,HTMLLayerElement:false,HTMLLegendElement:false,HTMLLIElement:false,HTMLLinkElement:false,HTMLMapElement:false,HTMLMenuElement:false,HTMLMetaElement:false,HTMLModElement:false,HTMLObjectElement:false,HTMLOListElement:false,HTMLOptGroupElement:false,HTMLOptionElement:false,HTMLParagraphElement:false,HTMLParamElement:false,HTMLPreElement:false,HTMLQuoteElement:false,HTMLScriptElement:false,HTMLSelectElement:false,HTMLStyleElement:false,HTMLTableCaptionElement:false,HTMLTableCellElement:false,HTMLTableColElement:false,HTMLTableElement:false,HTMLTableRowElement:false,HTMLTableSectionElement:false,HTMLTextAreaElement:false,HTMLTitleElement:false,HTMLUListElement:false,HTMLVideoElement:false,history:false,Int16Array:false,Int32Array:false,Int8Array:false,Image:false,length:false,localStorage:false,location:false,MessageChannel:false,MessageEvent:false,MessagePort:false,moveBy:false,moveTo:false,MutationObserver:false,name:false,Node:false,NodeFilter:false,navigator:false,onbeforeunload:true,onblur:true,onerror:true,onfocus:true,onload:true,onresize:true,onunload:true,open:false,openDatabase:false,opener:false,Option:false,parent:false,print:false,removeEventListener:false,resizeBy:false,resizeTo:false,screen:false,scroll:false,scrollBy:false,scrollTo:false,sessionStorage:false,setInterval:false,setTimeout:false,SharedWorker:false,status:false,top:false,Uint16Array:false,Uint32Array:false,Uint8Array:false,Uint8ClampedArray:false,WebSocket:false,window:false,Worker:false,XMLHttpRequest:false,XMLSerializer:false,XPathEvaluator:false,XPathException:false,XPathExpression:false,XPathNamespace:false,XPathNSResolver:false,XPathResult:false};e.devel={alert:false,confirm:false,console:false,Debug:false,opera:false,prompt:false};e.worker={importScripts:true,postMessage:true,self:true};e.nonstandard={escape:false,unescape:false};e.couch={require:false,respond:false,getRow:false,emit:false,send:false,start:false,sum:false,log:false,exports:false,module:false,provides:false};e.node={__filename:false,__dirname:false,Buffer:false,DataView:false,console:false,exports:true,GLOBAL:false,global:false,module:false,process:false,require:false,setTimeout:false,clearTimeout:false,setInterval:false,clearInterval:false};e.phantom={phantom:true,require:true,WebPage:true};e.rhino={defineClass:false,deserialize:false,gc:false,help:false,importPackage:false,java:false,load:false,loadClass:false,print:false,quit:false,readFile:false,readUrl:false,runCommand:false,seal:false,serialize:false,spawn:false,sync:false,toint32:false,version:false};e.wsh={ActiveXObject:true,Enumerator:true,GetObject:true,ScriptEngine:true,ScriptEngineBuildVersion:true,ScriptEngineMajorVersion:true,ScriptEngineMinorVersion:true,VBArray:true,WSH:true,WScript:true,XDomainRequest:true};e.dojo={dojo:false,dijit:false,dojox:false,define:false,require:false};e.jquery={$:false,jQuery:false};e.mootools={$:false,$$:false,Asset:false,Browser:false,Chain:false,Class:false,Color:false,Cookie:false,Core:false,Document:false,DomReady:false,DOMEvent:false,DOMReady:false,Drag:false,Element:false,Elements:false,Event:false,Events:false,Fx:false,Group:false,Hash:false,HtmlTable:false,Iframe:false,IframeShim:false,InputValidator:false,instanceOf:false,Keyboard:false,Locale:false,Mask:false,MooTools:false,Native:false,Options:false,OverText:false,Request:false,Scroller:false,Slick:false,Slider:false,Sortables:false,Spinner:false,Swiff:false,Tips:false,Type:false,typeOf:false,URI:false,Window:false};e.prototypejs={$:false,$$:false,$A:false,$F:false,$H:false,$R:false,$break:false,$continue:false,$w:false,Abstract:false,Ajax:false,Class:false,Enumerable:false,Element:false,Event:false,Field:false,Form:false,Hash:false,Insertion:false,ObjectRange:false,PeriodicalExecuter:false,Position:false,Prototype:false,Selector:false,Template:false,Toggle:false,Try:false,Autocompleter:false,Builder:false,Control:false,Draggable:false,Draggables:false,Droppables:false,Effect:false,Sortable:false,SortableObserver:false,Sound:false,Scriptaculous:false};e.yui={YUI:false,Y:false,YUI_config:false}},{}],154:[function(e,n,t){n.exports={disallowVars:false,disallowDuplicated:true,disallowUnknownReferences:true,parse:e("esprima-fb").parse}},{"esprima-fb":161}],155:[function(r,u,f){"use strict";var t=r("assert");var o=r("stringmap");var s=r("stringset");var n=r("simple-is");var a=r("simple-fmt");var l=r("./error");var i=l.getline;var c=r("./options");function e(e){t(n.someof(e.kind,["hoist","block","catch-block"]));t(n.object(e.node));t(e.parent===null||n.object(e.parent));this.kind=e.kind;this.node=e.node;this.parent=e.parent;this.children=[];this.decls=o();this.written=s();this.propagates=this.kind==="hoist"?s():null;if(this.parent){this.parent.children.push(this)}}e.prototype.print=function(e){e=e||0;var n=this;var t=this.decls.keys().map(function(e){return a("{0} [{1}]",e,n.decls.get(e).kind)}).join(", ");var r=this.propagates?this.propagates.items().join(", "):"";console.log(a("{0}{1}: {2}. propagates: {3}",a.repeat(" ",e),this.node.type,t,r));this.children.forEach(function(n){n.print(e+2)})};e.prototype.add=function(r,a,s,u){t(n.someof(a,["fun","param","var","caught","const","let"]));function o(e){return n.someof(e,["const","let"])}var e=this;if(n.someof(a,["fun","param","var"])){while(e.kind!=="hoist"){if(e.decls.has(r)&&o(e.decls.get(r).kind)){return l(i(s),"{0} is already declared",r)}e=e.parent}}if(e.decls.has(r)&&(c.disallowDuplicated||o(e.decls.get(r).kind)||o(a))){return l(i(s),"{0} is already declared",r)}var f={kind:a,node:s};if(u){t(n.someof(a,["var","const","let"]));f.from=u}e.decls.set(r,f)};e.prototype.getKind=function(e){t(n.string(e));var r=this.decls.get(e);return r?r.kind:null};e.prototype.getNode=function(e){t(n.string(e));var r=this.decls.get(e);return r?r.node:null};e.prototype.getFromPos=function(e){t(n.string(e));var r=this.decls.get(e);return r?r.from:null};e.prototype.hasOwn=function(e){return this.decls.has(e)};e.prototype.remove=function(e){return this.decls.remove(e)};e.prototype.doesPropagate=function(e){return this.propagates.has(e)};e.prototype.markPropagates=function(e){this.propagates.add(e)};e.prototype.closestHoistScope=function(){var e=this;while(e.kind!=="hoist"){e=e.parent}return e};e.prototype.hasFunctionScopeBetween=function(t){function r(e){return n.someof(e.type,["FunctionDeclaration","FunctionExpression"])}for(var e=this;e;e=e.parent){if(e===t){return false}if(r(e.node)){return true}}throw new Error("wasn't inner scope of outer")};e.prototype.lookup=function(n){for(var e=this;e;e=e.parent){if(e.decls.has(n)){return e}else if(e.kind==="hoist"){e.propagates.add(n)}}return null};e.prototype.markWrite=function(e){t(n.string(e));this.written.add(e)};e.prototype.detectUnmodifiedLets=function(){var n=this;function e(t){if(t!==n){t.decls.keys().forEach(function(e){if(t.getKind(e)==="let"&&!t.written.has(e)){return l(i(t.getNode(e)),"{0} is declared as let but never modified so could be const",e)}})}t.children.forEach(function(n){e(n)})}e(this)};e.prototype.traverse=function(e){e=e||{};var n=e.pre;var t=e.post;function r(e){if(n){n(e)}e.children.forEach(function(e){r(e)});if(t){t(e)}}r(this)};u.exports=e},{"./error":152,"./options":154,assert:110,"simple-fmt":162,"simple-is":163,stringmap:164,stringset:165}],156:[function(n,r,i){var t=n("simple-fmt");var l=n("simple-is");var a=n("assert");function e(){this.lets=0;this.consts=0;this.renames=[]}e.prototype.declarator=function(e){a(l.someof(e,["const","let"]));if(e==="const"){this.consts++}else{this.lets++}};e.prototype.rename=function(e,n,t){this.renames.push({oldName:e,newName:n,line:t})};e.prototype.toString=function(){var n=this.renames.map(function(e){return e}).sort(function(e,n){return e.line-n.line});var r=n.map(function(e){return t("\nline {0}: {1} => {2}",e.line,e.oldName,e.newName)}).join("");var e=this.consts+this.lets;var l=e===0?"can't calculate const coverage (0 consts, 0 lets)":t("{0}% const coverage ({1} consts, {2} lets)",Math.floor(100*this.consts/e),this.consts,this.lets);return l+r+"\n"};r.exports=e},{assert:110,"simple-fmt":162,"simple-is":163}],157:[function(t,n,a){var e=t("assert");var r=t("stable");function l(l,s){"use strict";var u=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};e(typeof l==="string");e(u(s));var o=r(s,function(e,n){return e.start-n.start});var a=[];var t=0;for(var i=0;i<o.length;i++){var n=o[i];e(t<=n.start);e(n.start<=n.end);a.push(l.slice(t,n.start));a.push(n.str);t=n.end}if(t<l.length){a.push(l.slice(t))}return a.join("")}if(typeof n!=="undefined"&&typeof n.exports!=="undefined"){n.exports=l}},{assert:110,stable:158}],158:[function(n,e,t){(function(){var n=function(e,n){return t(e.slice(),n)};n.inplace=function(e,l){var n=t(e,l);if(n!==e){r(n,null,e.length,e)}return e};function t(e,n){if(typeof n!=="function"){n=function(e,n){return String(e).localeCompare(n)}}var t=e.length;if(t<=1){return e}var l=new Array(t);for(var a=1;a<t;a*=2){r(e,n,a,l);var i=e;e=l;l=i}return e}var r=function(e,c,u,o){var l=e.length;var s=0;var f=u*2;var a,n,i;var t,r;for(a=0;a<l;a+=f){n=a+u;i=n+u;if(n>l)n=l;if(i>l)i=l;t=a;r=n;while(true){if(t<n&&r<i){if(c(e[t],e[r])<=0){o[s++]=e[t++]}else{o[s++]=e[r++]}}else if(t<n){o[s++]=e[t++]}else if(r<i){o[s++]=e[r++]}else{break}}}};if(typeof e!=="undefined"){e.exports=n}else{window.stable=n}})()},{}],159:[function(t,e,r){function n(a,e){"use strict";e=e||{};var t=e.pre;var r=e.post;var l=e.skipProperty;function n(e,o,a,u){if(!e||typeof e.type!=="string"){return}var c=undefined;if(t){c=t(e,o,a,u)}if(c!==false){for(var a in e){if(l?l(a,e):a[0]==="$"){continue}var i=e[a];if(Array.isArray(i)){for(var s=0;s<i.length;s++){n(i[s],e,a,s)}}else{n(i,e,a)}}}if(r){r(e,o,a,u)}}n(a,null)}if(typeof e!=="undefined"&&typeof e.exports!=="undefined"){e.exports=n}},{}],160:[function(t,e,r){var n=function(){"use strict";function e(e,n){this.val=e;this.brk=n}function n(){return function n(t){throw new e(t,n)}}function t(l){var r=n();try{return l(r)}catch(t){if(t instanceof e&&t.brk===r){return t.val}throw t}}return t}();if(typeof e!=="undefined"&&typeof e.exports!=="undefined"){e.exports=n}},{}],161:[function(n,t,e){(function(t,n){"use strict";if(typeof define==="function"&&define.amd){define(["exports"],n)}else if(typeof e!=="undefined"){n(e)}else{n(t.esprima={})}})(this,function(En){"use strict";var u,C,Gn,l,J,i,_n,Fn,Nn,$,s,v,e,h,g,y,t,c,a,p;u={BooleanLiteral:1,EOF:2,Identifier:3,Keyword:4,NullLiteral:5,NumericLiteral:6,Punctuator:7,StringLiteral:8,RegularExpression:9,Template:10,XJSIdentifier:11,XJSText:12};C={};C[u.BooleanLiteral]="Boolean";C[u.EOF]="<end>";C[u.Identifier]="Identifier";C[u.Keyword]="Keyword";C[u.NullLiteral]="Null";C[u.NumericLiteral]="Numeric";C[u.Punctuator]="Punctuator";C[u.StringLiteral]="String";C[u.XJSIdentifier]="XJSIdentifier";C[u.XJSText]="XJSText";C[u.RegularExpression]="RegularExpression";Gn=["(","{","[","in","typeof","instanceof","new","return","case","delete","throw","void","=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","&=","|=","^=",",","+","-","*","/","%","++","--","<<",">>",">>>","&","|","^","!","~","&&","||","?",":","===","==",">=","<=","<",">","!=","!=="];l={AnyTypeAnnotation:"AnyTypeAnnotation",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrayTypeAnnotation:"ArrayTypeAnnotation",ArrowFunctionExpression:"ArrowFunctionExpression",AssignmentExpression:"AssignmentExpression",BinaryExpression:"BinaryExpression",BlockStatement:"BlockStatement",BooleanTypeAnnotation:"BooleanTypeAnnotation",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ClassImplements:"ClassImplements",ClassProperty:"ClassProperty",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DeclareClass:"DeclareClass",DeclareFunction:"DeclareFunction",DeclareModule:"DeclareModule",DeclareVariable:"DeclareVariable",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportDeclaration:"ExportDeclaration",ExportBatchSpecifier:"ExportBatchSpecifier",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",ForStatement:"ForStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",FunctionTypeAnnotation:"FunctionTypeAnnotation",FunctionTypeParam:"FunctionTypeParam",GenericTypeAnnotation:"GenericTypeAnnotation",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",InterfaceDeclaration:"InterfaceDeclaration",InterfaceExtends:"InterfaceExtends",IntersectionTypeAnnotation:"IntersectionTypeAnnotation",LabeledStatement:"LabeledStatement",Literal:"Literal",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",NullableTypeAnnotation:"NullableTypeAnnotation",NumberTypeAnnotation:"NumberTypeAnnotation",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",ObjectTypeAnnotation:"ObjectTypeAnnotation",ObjectTypeCallProperty:"ObjectTypeCallProperty",ObjectTypeIndexer:"ObjectTypeIndexer",ObjectTypeProperty:"ObjectTypeProperty",Program:"Program",Property:"Property",QualifiedTypeIdentifier:"QualifiedTypeIdentifier",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",SpreadProperty:"SpreadProperty",StringLiteralTypeAnnotation:"StringLiteralTypeAnnotation",StringTypeAnnotation:"StringTypeAnnotation",SwitchCase:"SwitchCase",SwitchStatement:"SwitchStatement",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TupleTypeAnnotation:"TupleTypeAnnotation",TryStatement:"TryStatement",TypeAlias:"TypeAlias",TypeAnnotation:"TypeAnnotation",TypeofTypeAnnotation:"TypeofTypeAnnotation",TypeParameterDeclaration:"TypeParameterDeclaration",TypeParameterInstantiation:"TypeParameterInstantiation",UnaryExpression:"UnaryExpression",UnionTypeAnnotation:"UnionTypeAnnotation",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",VoidTypeAnnotation:"VoidTypeAnnotation",WhileStatement:"WhileStatement",WithStatement:"WithStatement",XJSIdentifier:"XJSIdentifier",XJSNamespacedName:"XJSNamespacedName",XJSMemberExpression:"XJSMemberExpression",XJSEmptyExpression:"XJSEmptyExpression",XJSExpressionContainer:"XJSExpressionContainer",XJSElement:"XJSElement",XJSClosingElement:"XJSClosingElement",XJSOpeningElement:"XJSOpeningElement",XJSAttribute:"XJSAttribute",XJSSpreadAttribute:"XJSSpreadAttribute",XJSText:"XJSText",YieldExpression:"YieldExpression",AwaitExpression:"AwaitExpression"};J={Data:1,Get:2,Set:4};$={"static":"static",prototype:"prototype"};i={UnexpectedToken:"Unexpected token %0",UnexpectedNumber:"Unexpected number",UnexpectedString:"Unexpected string",UnexpectedIdentifier:"Unexpected identifier",UnexpectedReserved:"Unexpected reserved word",UnexpectedTemplate:"Unexpected quasi %0",UnexpectedEOS:"Unexpected end of input",NewlineAfterThrow:"Illegal newline after throw",InvalidRegExp:"Invalid regular expression",UnterminatedRegExp:"Invalid regular expression: missing /",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInFormalsList:"Invalid left-hand side in formals list",InvalidLHSInForIn:"Invalid left-hand side in for-in",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NoCatchOrFinally:"Missing catch or finally after try",UnknownLabel:"Undefined label '%0'",Redeclaration:"%0 '%1' has already been declared",IllegalContinue:"Illegal continue statement",IllegalBreak:"Illegal break statement",IllegalDuplicateClassProperty:"Illegal duplicate property in class definition",IllegalReturn:"Illegal return statement",IllegalSpread:"Illegal spread element",StrictModeWith:"Strict mode code may not include a with statement",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictParamDupe:"Strict mode function may not have duplicate parameter names",ParameterAfterRestParameter:"Rest parameter must be final parameter of an argument list",DefaultRestParameter:"Rest parameter can not have a default value",ElementAfterSpreadElement:"Spread must be the final element of an element list",PropertyAfterSpreadProperty:"A rest property must be the final property of an object literal",ObjectPatternAsRestParameter:"Invalid rest parameter",ObjectPatternAsSpread:"Invalid spread argument",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictDuplicateProperty:"Duplicate data property in object literal not allowed in strict mode",AccessorDataProperty:"Object literal may not have data and accessor property with the same name",AccessorGetSet:"Object literal may not have multiple get/set accessors with the same name",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictReservedWord:"Use of future reserved word in strict mode",MissingFromClause:"Missing from clause",NoAsAfterImportNamespace:"Missing as after import *",InvalidModuleSpecifier:"Invalid module specifier",NoUnintializedConst:"Const must be initialized",ComprehensionRequiresBlock:"Comprehension must have at least one block",ComprehensionError:"Comprehension Error",EachNotAllowed:"Each is not supported",InvalidXJSAttributeValue:"XJS value should be either an expression or a quoted XJS text",ExpectedXJSClosingTag:"Expected corresponding XJS closing tag for %0",AdjacentXJSElements:"Adjacent XJS elements must be wrapped in an enclosing tag",ConfusedAboutFunctionType:"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"};
_n={NonAsciiIdentifierStart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),NonAsciiIdentifierPart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԧԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠࢢ-ࢬࣤ-ࣾऀ-ॣ०-९ॱ-ॷॹ-ॿঁ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఁ-ఃఅ-ఌఎ-ఐఒ-నప-ళవ-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಂಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲംഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤜᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶᴀ-ᷦ᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺꩻꪀ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︦︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),LeadingZeros:new RegExp("^0+(?!$)")};function G(e,n){if(!e){throw new Error("ASSERT: "+n)}}function D(e){return e>=48&&e<=57}function Dn(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function U(e){return"01234567".indexOf(e)>=0}function st(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&" ".indexOf(String.fromCharCode(e))>0}function T(e){return e===10||e===13||e===8232||e===8233}function q(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&_n.NonAsciiIdentifierStart.test(String.fromCharCode(e))}function an(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&_n.NonAsciiIdentifierPart.test(String.fromCharCode(e))}function Lr(e){switch(e){case"class":case"enum":case"export":case"extends":case"import":case"super":return true;default:return false}}function un(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return true;default:return false}}function L(e){return e==="eval"||e==="arguments"}function Yr(e){if(v&&un(e)){return true}switch(e.length){case 2:return e==="if"||e==="in"||e==="do";case 3:return e==="var"||e==="for"||e==="new"||e==="try"||e==="let";case 4:return e==="this"||e==="else"||e==="case"||e==="void"||e==="with"||e==="enum";case 5:return e==="while"||e==="break"||e==="catch"||e==="throw"||e==="const"||e==="class"||e==="super";case 6:return e==="return"||e==="typeof"||e==="delete"||e==="switch"||e==="export"||e==="import";case 7:return e==="default"||e==="finally"||e==="extends";case 8:return e==="function"||e==="continue"||e==="debugger";case 10:return e==="instanceof";default:return false}}function O(){var n,t,r;t=false;r=false;while(e<y){n=s.charCodeAt(e);if(r){++e;if(T(n)){r=false;if(n===13&&s.charCodeAt(e)===10){++e}++h;g=e}}else if(t){if(T(n)){if(n===13){++e}if(n!==13||s.charCodeAt(e)===10){++h;++e;g=e;if(e>=y){d({},i.UnexpectedToken,"ILLEGAL")}}}else{n=s.charCodeAt(e++);if(e>=y){d({},i.UnexpectedToken,"ILLEGAL")}if(n===42){n=s.charCodeAt(e);if(n===47){++e;t=false}}}}else if(n===47){n=s.charCodeAt(e+1);if(n===47){e+=2;r=true}else if(n===42){e+=2;t=true;if(e>=y){d({},i.UnexpectedToken,"ILLEGAL")}}else{break}}else if(st(n)){++e}else if(T(n)){++e;if(n===13&&s.charCodeAt(e)===10){++e}++h;g=e}else{break}}}function cn(a){var n,r,l,t=0;r=a==="u"?4:2;for(n=0;n<r;++n){if(e<y&&Dn(s[e])){l=s[e++];t=t*16+"0123456789abcdef".indexOf(l.toLowerCase())}else{return""}}return String.fromCharCode(t)}function zn(){var t,n,r,l;t=s[e];n=0;if(t==="}"){d({},i.UnexpectedToken,"ILLEGAL")}while(e<y){t=s[e++];if(!Dn(t)){break}n=n*16+"0123456789abcdef".indexOf(t.toLowerCase())}if(n>1114111||t!=="}"){d({},i.UnexpectedToken,"ILLEGAL")}if(n<=65535){return String.fromCharCode(n)}r=(n-65536>>10)+55296;l=(n-65536&1023)+56320;return String.fromCharCode(r,l)}function Yn(){var n,t;n=s.charCodeAt(e++);t=String.fromCharCode(n);if(n===92){if(s.charCodeAt(e)!==117){d({},i.UnexpectedToken,"ILLEGAL")}++e;n=cn("u");if(!n||n==="\\"||!q(n.charCodeAt(0))){d({},i.UnexpectedToken,"ILLEGAL")}t=n}while(e<y){n=s.charCodeAt(e);if(!an(n)){break}++e;t+=String.fromCharCode(n);if(n===92){t=t.substr(0,t.length-1);if(s.charCodeAt(e)!==117){d({},i.UnexpectedToken,"ILLEGAL")}++e;n=cn("u");if(!n||n==="\\"||!an(n.charCodeAt(0))){d({},i.UnexpectedToken,"ILLEGAL")}t+=n}}return t}function ar(){var n,t;n=e++;while(e<y){t=s.charCodeAt(e);if(t===92){e=n;return Yn()}if(an(t)){++e}else{break}}return s.slice(n,e)}function pr(){var r,n,t;r=e;n=s.charCodeAt(e)===92?Yn():ar();if(n.length===1){t=u.Identifier}else if(Yr(n)){t=u.Keyword}else if(n==="null"){t=u.NullLiteral}else if(n==="true"||n==="false"){t=u.BooleanLiteral}else{t=u.Identifier}return{type:t,value:n,lineNumber:h,lineStart:g,range:[r,e]}}function V(){var n=e,l=s.charCodeAt(e),c,t=s[e],r,o,f;switch(l){case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:++e;if(p.tokenize){if(l===40){p.openParenToken=p.tokens.length}else if(l===123){p.openCurlyToken=p.tokens.length}}return{type:u.Punctuator,value:String.fromCharCode(l),lineNumber:h,lineStart:g,range:[n,e]};default:c=s.charCodeAt(e+1);if(c===61){switch(l){case 37:case 38:case 42:case 43:case 45:case 47:case 60:case 62:case 94:case 124:e+=2;return{type:u.Punctuator,value:String.fromCharCode(l)+String.fromCharCode(c),lineNumber:h,lineStart:g,range:[n,e]};case 33:case 61:e+=2;if(s.charCodeAt(e)===61){++e}return{type:u.Punctuator,value:s.slice(n,e),lineNumber:h,lineStart:g,range:[n,e]};default:break}}break}r=s[e+1];o=s[e+2];f=s[e+3];if(t===">"&&r===">"&&o===">"){if(f==="="){e+=4;return{type:u.Punctuator,value:">>>=",lineNumber:h,lineStart:g,range:[n,e]}}}if(t===">"&&r===">"&&o===">"){e+=3;return{type:u.Punctuator,value:">>>",lineNumber:h,lineStart:g,range:[n,e]}}if(t==="<"&&r==="<"&&o==="="){e+=3;return{type:u.Punctuator,value:"<<=",lineNumber:h,lineStart:g,range:[n,e]}}if(t===">"&&r===">"&&o==="="){e+=3;return{type:u.Punctuator,value:">>=",lineNumber:h,lineStart:g,range:[n,e]}}if(t==="."&&r==="."&&o==="."){e+=3;return{type:u.Punctuator,value:"...",lineNumber:h,lineStart:g,range:[n,e]}}if(t===r&&"+-<>&|".indexOf(t)>=0&&!a.inType){e+=2;return{type:u.Punctuator,value:t+r,lineNumber:h,lineStart:g,range:[n,e]}}if(t==="="&&r===">"){e+=2;return{type:u.Punctuator,value:"=>",lineNumber:h,lineStart:g,range:[n,e]}}if("<>=!+-*%&|^/".indexOf(t)>=0){++e;return{type:u.Punctuator,value:t,lineNumber:h,lineStart:g,range:[n,e]}}if(t==="."){++e;return{type:u.Punctuator,value:t,lineNumber:h,lineStart:g,range:[n,e]}}d({},i.UnexpectedToken,"ILLEGAL")}function qr(t){var n="";while(e<y){if(!Dn(s[e])){break}n+=s[e++]}if(n.length===0){d({},i.UnexpectedToken,"ILLEGAL")}if(q(s.charCodeAt(e))){d({},i.UnexpectedToken,"ILLEGAL")}return{type:u.NumericLiteral,value:parseInt("0x"+n,16),lineNumber:h,lineStart:g,range:[t,e]}}function Wr(r,l){var n,t;if(U(r)){t=true;n="0"+s[e++]}else{t=false;++e;n=""}while(e<y){if(!U(s[e])){break}n+=s[e++]}if(!t&&n.length===0){d({},i.UnexpectedToken,"ILLEGAL")}if(q(s.charCodeAt(e))||D(s.charCodeAt(e))){d({},i.UnexpectedToken,"ILLEGAL")}return{type:u.NumericLiteral,value:parseInt(n,8),octal:t,lineNumber:h,lineStart:g,range:[l,e]}}function Zn(){var t,r,n,l;n=s[e];G(D(n.charCodeAt(0))||n===".","Numeric literal must start with a decimal digit or a decimal point");r=e;t="";if(n!=="."){t=s[e++];n=s[e];if(t==="0"){if(n==="x"||n==="X"){++e;return qr(r)}if(n==="b"||n==="B"){++e;t="";while(e<y){n=s[e];if(n!=="0"&&n!=="1"){break}t+=s[e++]}if(t.length===0){d({},i.UnexpectedToken,"ILLEGAL")}if(e<y){n=s.charCodeAt(e);if(q(n)||D(n)){d({},i.UnexpectedToken,"ILLEGAL")}}return{type:u.NumericLiteral,value:parseInt(t,2),lineNumber:h,lineStart:g,range:[r,e]}}if(n==="o"||n==="O"||U(n)){return Wr(n,r)}if(n&&D(n.charCodeAt(0))){d({},i.UnexpectedToken,"ILLEGAL")}}while(D(s.charCodeAt(e))){t+=s[e++]}n=s[e]}if(n==="."){t+=s[e++];while(D(s.charCodeAt(e))){t+=s[e++]}n=s[e]}if(n==="e"||n==="E"){t+=s[e++];n=s[e];if(n==="+"||n==="-"){t+=s[e++]}if(D(s.charCodeAt(e))){while(D(s.charCodeAt(e))){t+=s[e++]}}else{d({},i.UnexpectedToken,"ILLEGAL")}}if(q(s.charCodeAt(e))){d({},i.UnexpectedToken,"ILLEGAL")}return{type:u.NumericLiteral,value:parseFloat(t),lineNumber:h,lineStart:g,range:[r,e]}}function St(){var t="",l,c,n,r,a,f,o=false;l=s[e];G(l==="'"||l==='"',"String literal must starts with a quote");c=e;++e;while(e<y){n=s[e++];if(n===l){l="";break}else if(n==="\\"){n=s[e++];if(!n||!T(n.charCodeAt(0))){switch(n){case"n":t+="\n";break;case"r":t+="\r";break;case"t":t+=" ";break;case"u":case"x":if(s[e]==="{"){++e;t+=zn()}else{f=e;a=cn(n);if(a){t+=a}else{e=f;t+=n}}break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="";break;default:if(U(n)){r="01234567".indexOf(n);if(r!==0){o=true}if(e<y&&U(s[e])){o=true;r=r*8+"01234567".indexOf(s[e++]);if("0123".indexOf(n)>=0&&e<y&&U(s[e])){r=r*8+"01234567".indexOf(s[e++])}}t+=String.fromCharCode(r)}else{t+=n}break}}else{++h;if(n==="\r"&&s[e]==="\n"){++e}g=e}}else if(T(n.charCodeAt(0))){break}else{t+=n}}if(l!==""){d({},i.UnexpectedToken,"ILLEGAL")}return{type:u.StringLiteral,value:t,octal:o,lineNumber:h,lineStart:g,range:[c,e]}}function rt(){var t="",n,o,l,a,p,c,r,f;l=false;a=false;o=e;++e;while(e<y){n=s[e++];if(n==="`"){a=true;l=true;break}else if(n==="$"){if(s[e]==="{"){++e;l=true;break}t+=n}else if(n==="\\"){n=s[e++];if(!T(n.charCodeAt(0))){switch(n){case"n":t+="\n";break;case"r":t+="\r";break;case"t":t+=" ";break;case"u":case"x":if(s[e]==="{"){++e;t+=zn()}else{p=e;c=cn(n);if(c){t+=c}else{e=p;t+=n}}break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="";break;default:if(U(n)){r="01234567".indexOf(n);if(r!==0){f=true}if(e<y&&U(s[e])){f=true;r=r*8+"01234567".indexOf(s[e++]);if("0123".indexOf(n)>=0&&e<y&&U(s[e])){r=r*8+"01234567".indexOf(s[e++])}}t+=String.fromCharCode(r)}else{t+=n}break}}else{++h;if(n==="\r"&&s[e]==="\n"){++e}g=e}}else if(T(n.charCodeAt(0))){++h;if(n==="\r"&&s[e]==="\n"){++e}g=e;t+="\n"}else{t+=n}}if(!l){d({},i.UnexpectedToken,"ILLEGAL")}return{type:u.Template,value:{cooked:t,raw:s.slice(o+1,e-(a?1:2))},tail:a,octal:f,lineNumber:h,lineStart:g,range:[o,e]}}function Xt(r){var n,t;c=null;O();n=r.head?"`":"}";if(s[e]!==n){d({},i.UnexpectedToken,"ILLEGAL")}t=rt();mn();return t}function N(){var t,n,v,l,r,a,m=false,o,x=false,f;c=null;O();v=e;n=s[e];G(n==="/","Regular expression literal must start with a slash");t=s[e++];while(e<y){n=s[e++];t+=n;if(m){if(n==="]"){m=false}}else{if(n==="\\"){n=s[e++];if(T(n.charCodeAt(0))){d({},i.UnterminatedRegExp)}t+=n}else if(n==="/"){x=true;break}else if(n==="["){m=true}else if(T(n.charCodeAt(0))){d({},i.UnterminatedRegExp)}}}if(!x){d({},i.UnterminatedRegExp)}l=t.substr(1,t.length-2);r="";while(e<y){n=s[e];if(!an(n.charCodeAt(0))){break}++e;if(n==="\\"&&e<y){n=s[e];if(n==="u"){++e;o=e;n=cn("u");if(n){r+=n;for(t+="\\u";o<e;++o){t+=s[o]}}else{e=o;r+="u";t+="\\u"}}else{t+="\\"}}else{r+=n;t+=n}}f=l;if(r.indexOf("u")>=0){f=f.replace(/\\u\{([0-9a-fA-F]{5,6})\}/g,"x").replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x")}try{a=new RegExp(f)}catch(b){d({},i.InvalidRegExp)}try{a=new RegExp(l,r)}catch(E){a=null}mn();if(p.tokenize){return{type:u.RegularExpression,value:a,regex:{pattern:l,flags:r},lineNumber:h,lineStart:g,range:[v,e]}}return{literal:t,value:a,regex:{pattern:l,flags:r},range:[v,e]}}function On(e){return e.type===u.Identifier||e.type===u.Keyword||e.type===u.BooleanLiteral||e.type===u.NullLiteral}function gr(){var n,e;n=p.tokens[p.tokens.length-1];if(!n){return N()}if(n.type==="Punctuator"){if(n.value===")"){e=p.tokens[p.openParenToken-1];if(e&&e.type==="Keyword"&&(e.value==="if"||e.value==="while"||e.value==="for"||e.value==="with")){return N()}return V()}if(n.value==="}"){if(p.tokens[p.openCurlyToken-3]&&p.tokens[p.openCurlyToken-3].type==="Keyword"){e=p.tokens[p.openCurlyToken-4];if(!e){return V()}}else if(p.tokens[p.openCurlyToken-4]&&p.tokens[p.openCurlyToken-4].type==="Keyword"){e=p.tokens[p.openCurlyToken-5];if(!e){return N()}}else{return V()}if(Gn.indexOf(e.value)>=0){return V()}return N()}return N()}if(n.type==="Keyword"){return N()}return V()}function nn(){var n;if(!a.inXJSChild){O()}if(e>=y){return{type:u.EOF,lineNumber:h,lineStart:g,range:[e,e]}}if(a.inXJSChild){return Ar()}n=s.charCodeAt(e);if(n===40||n===41||n===58){return V()}if(n===39||n===34){if(a.inXJSTag){return Cr()}return St()}if(a.inXJSTag&&_r(n)){return kr()}if(n===96){return rt()}if(q(n)){return pr()}if(n===46){if(D(s.charCodeAt(e+1))){return Zn()}return V()}if(D(n)){return Zn()}if(p.tokenize&&n===47){return gr()}return V()}function m(){var n;n=c;e=n.range[1];h=n.lineNumber;g=n.lineStart;c=nn();e=n.range[1];h=n.lineNumber;g=n.lineStart;return n}function mn(){var n,t,r;n=e;t=h;r=g;c=nn();e=n;h=t;g=r}function P(){var n,t,r,l,a;n=typeof p.advance==="function"?p.advance:nn;t=e;r=h;l=g;if(c===null){c=n()}e=c.range[1];h=c.lineNumber;g=c.lineStart;a=n();e=t;h=r;g=l;return a}function fn(n){e=n.range[0];h=n.lineNumber;g=n.lineStart;c=n}function f(){if(!p.loc&&!p.range){return undefined}O();return{offset:e,line:h,col:e-g}}function Xn(){if(!p.loc&&!p.range){return undefined}return{offset:e,line:h,col:e-g}}function er(e){var t,r,a=p.bottomRightStack,n=a[a.length-1];if(e.type===l.Program){if(e.body.length>0){return}}if(p.trailingComments.length>0){if(p.trailingComments[0].range[0]>=e.range[1]){r=p.trailingComments;p.trailingComments=[]}else{p.trailingComments.length=0}}else{if(n&&n.trailingComments&&n.trailingComments[0].range[0]>=e.range[1]){r=n.trailingComments;delete n.trailingComments}}if(n){while(n&&n.range[0]>=e.range[0]){t=n;n=a.pop()}}if(t){if(t.leadingComments&&t.leadingComments[t.leadingComments.length-1].range[1]<=e.range[0]){e.leadingComments=t.leadingComments;delete t.leadingComments}}else if(p.leadingComments.length>0&&p.leadingComments[p.leadingComments.length-1].range[1]<=e.range[0]){e.leadingComments=p.leadingComments;p.leadingComments=[]}if(r){e.trailingComments=r}a.push(e)}function n(r,n){if(p.range){n.range=[r.offset,e]}if(p.loc){n.loc={start:{line:r.line,column:r.col},end:{line:h,column:e-g}};n=t.postProcess(n)}if(p.attachComment){er(n)}return n}Fn={name:"SyntaxTree",postProcess:function(e){return e},createArrayExpression:function(e){return{type:l.ArrayExpression,elements:e}},createAssignmentExpression:function(e,n,t){return{type:l.AssignmentExpression,operator:e,left:n,right:t}},createBinaryExpression:function(e,n,t){var r=e==="||"||e==="&&"?l.LogicalExpression:l.BinaryExpression;return{type:r,operator:e,left:n,right:t}},createBlockStatement:function(e){return{type:l.BlockStatement,body:e}},createBreakStatement:function(e){return{type:l.BreakStatement,label:e}},createCallExpression:function(e,n){return{type:l.CallExpression,callee:e,arguments:n}},createCatchClause:function(e,n){return{type:l.CatchClause,param:e,body:n}},createConditionalExpression:function(e,n,t){return{type:l.ConditionalExpression,test:e,consequent:n,alternate:t}},createContinueStatement:function(e){return{type:l.ContinueStatement,label:e}},createDebuggerStatement:function(){return{type:l.DebuggerStatement}},createDoWhileStatement:function(e,n){return{type:l.DoWhileStatement,body:e,test:n}},createEmptyStatement:function(){return{type:l.EmptyStatement}},createExpressionStatement:function(e){return{type:l.ExpressionStatement,expression:e}},createForStatement:function(e,n,t,r){return{type:l.ForStatement,init:e,test:n,update:t,body:r}},createForInStatement:function(e,n,t){return{type:l.ForInStatement,left:e,right:n,body:t,each:false}},createForOfStatement:function(e,n,t){return{type:l.ForOfStatement,left:e,right:n,body:t}},createFunctionDeclaration:function(n,i,t,r,a,f,s,o,u,c){var e={type:l.FunctionDeclaration,id:n,params:i,defaults:t,body:r,rest:a,generator:f,expression:s,returnType:u,typeParameters:c};if(o){e.async=true}return e},createFunctionExpression:function(n,i,t,r,a,f,s,o,u,c){var e={type:l.FunctionExpression,id:n,params:i,defaults:t,body:r,rest:a,generator:f,expression:s,returnType:u,typeParameters:c};if(o){e.async=true}return e},createIdentifier:function(e){return{type:l.Identifier,name:e,typeAnnotation:undefined,optional:undefined}},createTypeAnnotation:function(e){return{type:l.TypeAnnotation,typeAnnotation:e}},createFunctionTypeAnnotation:function(e,n,t,r){return{type:l.FunctionTypeAnnotation,params:e,returnType:n,rest:t,typeParameters:r}},createFunctionTypeParam:function(e,n,t){return{type:l.FunctionTypeParam,name:e,typeAnnotation:n,optional:t}},createNullableTypeAnnotation:function(e){return{type:l.NullableTypeAnnotation,typeAnnotation:e}},createArrayTypeAnnotation:function(e){return{type:l.ArrayTypeAnnotation,elementType:e}},createGenericTypeAnnotation:function(e,n){return{type:l.GenericTypeAnnotation,id:e,typeParameters:n}},createQualifiedTypeIdentifier:function(e,n){return{type:l.QualifiedTypeIdentifier,qualification:e,id:n}},createTypeParameterDeclaration:function(e){return{type:l.TypeParameterDeclaration,params:e}},createTypeParameterInstantiation:function(e){return{type:l.TypeParameterInstantiation,params:e}},createAnyTypeAnnotation:function(){return{type:l.AnyTypeAnnotation}},createBooleanTypeAnnotation:function(){return{type:l.BooleanTypeAnnotation}},createNumberTypeAnnotation:function(){return{type:l.NumberTypeAnnotation}},createStringTypeAnnotation:function(){return{type:l.StringTypeAnnotation}},createStringLiteralTypeAnnotation:function(e){return{type:l.StringLiteralTypeAnnotation,value:e.value,raw:s.slice(e.range[0],e.range[1])}},createVoidTypeAnnotation:function(){return{type:l.VoidTypeAnnotation}},createTypeofTypeAnnotation:function(e){return{type:l.TypeofTypeAnnotation,argument:e}},createTupleTypeAnnotation:function(e){return{type:l.TupleTypeAnnotation,types:e}},createObjectTypeAnnotation:function(e,n,t){return{type:l.ObjectTypeAnnotation,properties:e,indexers:n,callProperties:t}},createObjectTypeIndexer:function(e,n,t,r){return{type:l.ObjectTypeIndexer,id:e,key:n,value:t,"static":r}},createObjectTypeCallProperty:function(e,n){return{type:l.ObjectTypeCallProperty,value:e,"static":n}},createObjectTypeProperty:function(e,n,t,r){return{type:l.ObjectTypeProperty,key:e,value:n,optional:t,"static":r}},createUnionTypeAnnotation:function(e){return{type:l.UnionTypeAnnotation,types:e}},createIntersectionTypeAnnotation:function(e){return{type:l.IntersectionTypeAnnotation,types:e}},createTypeAlias:function(e,n,t){return{type:l.TypeAlias,id:e,typeParameters:n,right:t}},createInterface:function(e,n,t,r){return{type:l.InterfaceDeclaration,id:e,typeParameters:n,body:t,"extends":r}},createInterfaceExtends:function(e,n){return{type:l.InterfaceExtends,id:e,typeParameters:n}},createDeclareFunction:function(e){return{type:l.DeclareFunction,id:e}},createDeclareVariable:function(e){return{type:l.DeclareVariable,id:e}},createDeclareModule:function(e,n){return{type:l.DeclareModule,id:e,body:n}},createXJSAttribute:function(e,n){return{type:l.XJSAttribute,name:e,value:n||null}},createXJSSpreadAttribute:function(e){return{type:l.XJSSpreadAttribute,argument:e}},createXJSIdentifier:function(e){return{type:l.XJSIdentifier,name:e}},createXJSNamespacedName:function(e,n){return{type:l.XJSNamespacedName,namespace:e,name:n}},createXJSMemberExpression:function(e,n){return{type:l.XJSMemberExpression,object:e,property:n}},createXJSElement:function(e,n,t){return{type:l.XJSElement,openingElement:e,closingElement:n,children:t}},createXJSEmptyExpression:function(){return{type:l.XJSEmptyExpression}},createXJSExpressionContainer:function(e){return{type:l.XJSExpressionContainer,expression:e}},createXJSOpeningElement:function(e,n,t){return{type:l.XJSOpeningElement,name:e,selfClosing:t,attributes:n}},createXJSClosingElement:function(e){return{type:l.XJSClosingElement,name:e}},createIfStatement:function(e,n,t){return{type:l.IfStatement,test:e,consequent:n,alternate:t}},createLabeledStatement:function(e,n){return{type:l.LabeledStatement,label:e,body:n}},createLiteral:function(e){var n={type:l.Literal,value:e.value,raw:s.slice(e.range[0],e.range[1])};if(e.regex){n.regex=e.regex}return n},createMemberExpression:function(e,n,t){return{type:l.MemberExpression,computed:e==="[",object:n,property:t}},createNewExpression:function(e,n){return{type:l.NewExpression,callee:e,arguments:n}},createObjectExpression:function(e){return{type:l.ObjectExpression,properties:e}},createPostfixExpression:function(e,n){return{type:l.UpdateExpression,operator:e,argument:n,prefix:false}},createProgram:function(e){return{type:l.Program,body:e}},createProperty:function(e,n,t,r,a,i){return{type:l.Property,key:n,value:t,kind:e,method:r,shorthand:a,computed:i}},createReturnStatement:function(e){return{type:l.ReturnStatement,argument:e}},createSequenceExpression:function(e){return{type:l.SequenceExpression,expressions:e}},createSwitchCase:function(e,n){return{type:l.SwitchCase,test:e,consequent:n}},createSwitchStatement:function(e,n){return{type:l.SwitchStatement,discriminant:e,cases:n}},createThisExpression:function(){return{type:l.ThisExpression}},createThrowStatement:function(e){return{type:l.ThrowStatement,argument:e}},createTryStatement:function(e,n,t,r){return{type:l.TryStatement,block:e,guardedHandlers:n,handlers:t,finalizer:r}},createUnaryExpression:function(e,n){if(e==="++"||e==="--"){return{type:l.UpdateExpression,operator:e,argument:n,prefix:true}}return{type:l.UnaryExpression,operator:e,argument:n,prefix:true}},createVariableDeclaration:function(e,n){return{type:l.VariableDeclaration,declarations:e,kind:n}},createVariableDeclarator:function(e,n){return{type:l.VariableDeclarator,id:e,init:n}},createWhileStatement:function(e,n){return{type:l.WhileStatement,test:e,body:n}},createWithStatement:function(e,n){return{type:l.WithStatement,object:e,body:n}},createTemplateElement:function(e,n){return{type:l.TemplateElement,value:e,tail:n}},createTemplateLiteral:function(e,n){return{type:l.TemplateLiteral,quasis:e,expressions:n}},createSpreadElement:function(e){return{type:l.SpreadElement,argument:e}},createSpreadProperty:function(e){return{type:l.SpreadProperty,argument:e}},createTaggedTemplateExpression:function(e,n){return{type:l.TaggedTemplateExpression,tag:e,quasi:n}},createArrowFunctionExpression:function(n,t,r,a,i,s){var e={type:l.ArrowFunctionExpression,id:null,params:n,defaults:t,body:r,rest:a,generator:false,expression:i};if(s){e.async=true}return e},createMethodDefinition:function(e,n,t,r){return{type:l.MethodDefinition,key:t,value:r,kind:n,"static":e===$.static}},createClassProperty:function(e,n,t,r){return{type:l.ClassProperty,key:e,typeAnnotation:n,computed:t,"static":r}},createClassBody:function(e){return{type:l.ClassBody,body:e}},createClassImplements:function(e,n){return{type:l.ClassImplements,id:e,typeParameters:n}},createClassExpression:function(e,n,t,r,a,i){return{type:l.ClassExpression,id:e,superClass:n,body:t,typeParameters:r,superTypeParameters:a,"implements":i}},createClassDeclaration:function(e,n,t,r,a,i){return{type:l.ClassDeclaration,id:e,superClass:n,body:t,typeParameters:r,superTypeParameters:a,"implements":i}},createModuleSpecifier:function(e){return{type:l.ModuleSpecifier,value:e.value,raw:s.slice(e.range[0],e.range[1])}},createExportSpecifier:function(e,n){return{type:l.ExportSpecifier,id:e,name:n}},createExportBatchSpecifier:function(){return{type:l.ExportBatchSpecifier}},createImportDefaultSpecifier:function(e){return{type:l.ImportDefaultSpecifier,id:e}},createImportNamespaceSpecifier:function(e){return{type:l.ImportNamespaceSpecifier,id:e}},createExportDeclaration:function(e,n,t,r){return{type:l.ExportDeclaration,"default":!!e,declaration:n,specifiers:t,source:r}},createImportSpecifier:function(e,n){return{type:l.ImportSpecifier,id:e,name:n}},createImportDeclaration:function(e,n){return{type:l.ImportDeclaration,specifiers:e,source:n}},createYieldExpression:function(e,n){return{type:l.YieldExpression,argument:e,delegate:n}},createAwaitExpression:function(e){return{type:l.AwaitExpression,argument:e}},createComprehensionExpression:function(e,n,t){return{type:l.ComprehensionExpression,filter:e,blocks:n,body:t}}};function K(){var t,n,r,l;t=e;n=h;r=g;O();l=h!==n;e=t;h=n;g=r;return l}function d(t,a){var n,l=Array.prototype.slice.call(arguments,2),r=a.replace(/%(\d)/g,function(n,e){G(e<l.length,"Message reference must be in range");return l[e]});if(typeof t.lineNumber==="number"){n=new Error("Line "+t.lineNumber+": "+r);n.index=t.range[0];n.lineNumber=t.lineNumber;n.column=t.range[0]-g+1}else{n=new Error("Line "+h+": "+r);n.index=e;n.lineNumber=h;n.column=e-g+1}n.description=r;throw n}function E(){try{d.apply(null,arguments)}catch(e){if(p.errors){p.errors.push(e)}else{throw e}}}function I(e){if(e.type===u.EOF){d(e,i.UnexpectedEOS)}if(e.type===u.NumericLiteral){d(e,i.UnexpectedNumber)}if(e.type===u.StringLiteral||e.type===u.XJSText){d(e,i.UnexpectedString)}if(e.type===u.Identifier){d(e,i.UnexpectedIdentifier)}if(e.type===u.Keyword){if(Lr(e.value)){d(e,i.UnexpectedReserved)}else if(v&&un(e.value)){E(e,i.StrictReservedWord);return}d(e,i.UnexpectedToken,e.value)}if(e.type===u.Template){d(e,i.UnexpectedTemplate,e.value.raw)}d(e,i.UnexpectedToken,e.value)}function o(n){var e=m();if(e.type!==u.Punctuator||e.value!==n){I(e)}}function b(n,t){var e=m();if(e.type!==(t?u.Identifier:u.Keyword)||e.value!==n){I(e)}}function X(e){return b(e,true)}function r(e){return c.type===u.Punctuator&&c.value===e}function x(e,n){var t=n?u.Identifier:u.Keyword;return c.type===t&&c.value===e}function _(e){return x(e,true)}function tr(){var e;if(c.type!==u.Punctuator){return false}e=c.value;return e==="="||e==="*="||e==="/="||e==="%="||e==="+="||e==="-="||e==="<<="||e===">>="||e===">>>="||e==="&="||e==="^="||e==="|="}function lr(){return a.yieldAllowed&&x("yield",!v)}function ln(){var n=c,e=false;if(_("async")){m();e=!K();fn(n)}return e}function ir(){return a.awaitAllowed&&_("await")}function S(){var n,t=e,l=h,a=g,i=c;if(s.charCodeAt(e)===59){m();return}n=h;O();if(h!==n){e=t;h=l;g=a;c=i;return}if(r(";")){m();return}if(c.type!==u.EOF&&!r("}")){I(c)}}function vn(e){return e.type===l.Identifier||e.type===l.MemberExpression}function Tr(e){return vn(e)||e.type===l.ObjectPattern||e.type===l.ArrayPattern}function xn(){var a=[],s=[],h=null,e,p=true,y,g=f();o("[");while(!r("]")){if(c.value==="for"&&c.type===u.Keyword){if(!p){d({},i.ComprehensionError)}x("for");e=$n({ignoreBody:true});e.of=e.type===l.ForOfStatement;e.type=l.ComprehensionBlock;if(e.left.kind){d({},i.ComprehensionError)}s.push(e)}else if(c.value==="if"&&c.type===u.Keyword){if(!p){d({},i.ComprehensionError)}b("if");o("(");h=w();o(")")}else if(c.value===","&&c.type===u.Punctuator){p=false;m();a.push(null)}else{e=Ln();a.push(e);if(e&&e.type===l.SpreadElement){if(!r("]")){d({},i.ElementAfterSpreadElement)}}else if(!(r("]")||x("for")||x("if"))){o(",");p=false}}}o("]");if(h&&!s.length){d({},i.ComprehensionRequiresBlock)}if(s.length){if(a.length!==1){d({},i.ComprehensionError)}return n(g,t.createComprehensionExpression(h,s,a[0]))}return n(g,t.createArrayExpression(a))}function rn(e){var o,u,c,r,p,s,d=f();o=v;u=a.yieldAllowed;a.yieldAllowed=e.generator;c=a.awaitAllowed;a.awaitAllowed=e.async;r=e.params||[];p=e.defaults||[];s=Qn();if(e.name&&v&&L(r[0].name)){E(e.name,i.StrictParamName)}v=o;a.yieldAllowed=u;a.awaitAllowed=c;return n(d,t.createFunctionExpression(null,r,p,s,e.rest||null,e.generator,s.type!==l.BlockStatement,e.async,e.returnType,e.typeParameters))}function en(n){var t,e,r;t=v;v=true;e=hn();if(e.stricted){E(e.stricted,e.message)}r=rn({params:e.params,defaults:e.defaults,rest:e.rest,generator:n.generator,async:n.async,returnType:e.returnType,typeParameters:n.typeParameters});v=t;return r}function j(){var r=f(),e=m(),l,a;if(e.type===u.StringLiteral||e.type===u.NumericLiteral){if(v&&e.octal){E(e,i.StrictOctalLiteral)}return n(r,t.createLiteral(e))}if(e.type===u.Punctuator&&e.value==="["){r=f();l=R();a=n(r,l);o("]");return a}return n(r,t.createIdentifier(e.value))}function el(){var l,a,s,h,d,g,e,i=f(),p;l=c;e=l.value==="[";if(l.type===u.Identifier||e||ln()){s=j();if(r(":")){m();return n(i,t.createProperty("init",s,R(),false,false,e))}if(r("(")){return n(i,t.createProperty("init",s,en({generator:false,async:false}),true,false,e))}if(l.value==="get"){e=c.value==="[";a=j();o("(");o(")");if(r(":")){p=M()}return n(i,t.createProperty("get",a,rn({generator:false,async:false,returnType:p}),false,false,e))}if(l.value==="set"){e=c.value==="[";a=j();o("(");l=c;d=[tn()];o(")");if(r(":")){p=M()}return n(i,t.createProperty("set",a,rn({params:d,generator:false,async:false,name:l,returnType:p}),false,false,e))}if(l.value==="async"){e=c.value==="[";a=j();return n(i,t.createProperty("init",a,en({generator:false,async:true}),true,false,e))}if(e){I(c)}return n(i,t.createProperty("init",s,s,false,true,false))}if(l.type===u.EOF||l.type===u.Punctuator){if(!r("*")){I(l)}m();e=c.type===u.Punctuator&&c.value==="[";s=j();if(!r("(")){I(m())}return n(i,t.createProperty("init",s,en({generator:true}),true,false,e))}a=j();if(r(":")){m();return n(i,t.createProperty("init",a,R(),false,false,false))}if(r("(")){return n(i,t.createProperty("init",a,en({generator:false}),true,false,false))}I(m())}function nl(){var e=f();o("...");return n(e,t.createSpreadProperty(R()))}function dn(){var p=[],e,c,s,a,u={},d=String,m=f();o("{");while(!r("}")){if(r("...")){e=nl()}else{e=el();if(e.key.type===l.Identifier){c=e.key.name}else{c=d(e.key.value)}a=e.kind==="init"?J.Data:e.kind==="get"?J.Get:J.Set;s="$"+c;if(Object.prototype.hasOwnProperty.call(u,s)){if(u[s]===J.Data){if(v&&a===J.Data){E({},i.StrictDuplicateProperty)}else if(a!==J.Data){E({},i.AccessorDataProperty)}}else{if(a===J.Data){E({},i.AccessorDataProperty)}else if(u[s]&a){E({},i.AccessorGetSet)}}u[s]|=a}else{u[s]=a}}p.push(e);if(!r("}")){o(",")}}o("}");return n(m,t.createObjectExpression(p))}function _t(r){var l=f(),e=Xt(r);if(v&&e.octal){d(e,i.StrictOctalLiteral)}return n(l,t.createTemplateElement({raw:e.value.raw,cooked:e.value.cooked},e.tail))}function Sn(){var e,r,l,a=f();e=_t({head:true});r=[e];l=[];while(!e.tail){l.push(w());e=_t({head:false});r.push(e)}return n(a,t.createTemplateLiteral(r,l))}function Zt(){var e;o("(");++a.parenthesizedCount;e=w();o(")");return e}function et(){var e;if(ln()){e=P();if(e.type===u.Keyword&&e.value==="function"){return true}}return false}function nt(){var e,l,a,s;l=c.type;if(l===u.Identifier){e=f();return n(e,t.createIdentifier(m().value))}if(l===u.StringLiteral||l===u.NumericLiteral){if(v&&c.octal){E(c,i.StrictOctalLiteral)}e=f();return n(e,t.createLiteral(m()))}if(l===u.Keyword){if(x("this")){e=f();m();return n(e,t.createThisExpression())}if(x("function")){return Mn()}if(x("class")){return it()}if(x("super")){e=f();m();return n(e,t.createIdentifier("super"))}}if(l===u.BooleanLiteral){e=f();a=m();a.value=a.value==="true";return n(e,t.createLiteral(a))}if(l===u.NullLiteral){e=f();a=m();a.value=null;return n(e,t.createLiteral(a))}if(r("[")){return xn()}if(r("{")){return dn()}if(r("(")){return Zt()}if(r("/")||r("/=")){e=f();return n(e,t.createLiteral(N()))
}if(l===u.Template){return Sn()}if(r("<")){return Bn()}I(m())}function tt(){var t=[],n;o("(");if(!r(")")){while(e<y){n=Ln();t.push(n);if(r(")")){break}else if(n.type===l.SpreadElement){d({},i.ElementAfterSpreadElement)}o(",")}}o(")");return t}function Ln(){if(r("...")){var e=f();m();return n(e,t.createSpreadElement(R()))}return R()}function W(){var r=f(),e=m();if(!On(e)){I(e)}return n(r,t.createIdentifier(e.value))}function ut(){o(".");return W()}function gt(){var e;o("[");e=w();o("]");return e}function Un(){var e,l,a=f();b("new");e=jr();l=r("(")?tt():[];return n(a,t.createNewExpression(e,l))}function An(){var e,a,l=f();e=x("new")?Un():nt();while(r(".")||r("[")||r("(")||c.type===u.Template){if(r("(")){a=tt();e=n(l,t.createCallExpression(e,a))}else if(r("[")){e=n(l,t.createMemberExpression("[",e,gt()))}else if(r(".")){e=n(l,t.createMemberExpression(".",e,ut()))}else{e=n(l,t.createTaggedTemplateExpression(e,Sn()))}}return e}function jr(){var e,l=f();e=x("new")?Un():nt();while(r(".")||r("[")||c.type===u.Template){if(r("[")){e=n(l,t.createMemberExpression("[",e,gt()))}else if(r(".")){e=n(l,t.createMemberExpression(".",e,ut()))}else{e=n(l,t.createTaggedTemplateExpression(e,Sn()))}}return e}function Jn(){var s=f(),e=An(),a;if(c.type!==u.Punctuator){return e}if((r("++")||r("--"))&&!K()){if(v&&e.type===l.Identifier&&L(e.name)){E({},i.StrictLHSPostfix)}if(!vn(e)){d({},i.InvalidLHSInAssignment)}a=m();e=n(s,t.createPostfixExpression(a.value,e))}return e}function Z(){var a,s,e;if(c.type!==u.Punctuator&&c.type!==u.Keyword){return Jn()}if(r("++")||r("--")){a=f();s=m();e=Z();if(v&&e.type===l.Identifier&&L(e.name)){E({},i.StrictLHSPrefix)}if(!vn(e)){d({},i.InvalidLHSInAssignment)}return n(a,t.createUnaryExpression(s.value,e))}if(r("+")||r("-")||r("~")||r("!")){a=f();s=m();e=Z();return n(a,t.createUnaryExpression(s.value,e))}if(x("delete")||x("void")||x("typeof")){a=f();s=m();e=Z();e=n(a,t.createUnaryExpression(s.value,e));if(v&&e.operator==="delete"&&e.argument.type===l.Identifier){E({},i.StrictDelete)}return e}return Jn()}function Wn(n,t){var e=0;if(n.type!==u.Punctuator&&n.type!==u.Keyword){return 0}switch(n.value){case"||":e=1;break;case"&&":e=2;break;case"|":e=3;break;case"^":e=4;break;case"&":e=5;break;case"==":case"!=":case"===":case"!==":e=6;break;case"<":case">":case"<=":case">=":case"instanceof":e=7;break;case"in":e=t?7:0;break;case"<<":case">>":case">>>":e=8;break;case"+":case"-":e=9;break;case"*":case"/":case"%":e=11;break;default:break}return e}function $r(){var r,i,u,d,e,h,g,p,o,l,s;d=a.allowIn;a.allowIn=true;l=f();p=Z();i=c;u=Wn(i,d);if(u===0){return p}i.prec=u;m();s=[l,f()];h=Z();e=[p,i,h];while((u=Wn(c,d))>0){while(e.length>2&&u<=e[e.length-2].prec){h=e.pop();g=e.pop().value;p=e.pop();r=t.createBinaryExpression(g,p,h);s.pop();l=s.pop();n(l,r);e.push(r);s.push(l)}i=m();i.prec=u;e.push(i);s.push(f());r=Z();e.push(r)}a.allowIn=d;o=e.length-1;r=e[o];s.pop();while(o>1){r=t.createBinaryExpression(e[o-1].value,e[o-2],r);o-=2;l=s.pop();n(l,r)}return r}function Hn(){var e,l,i,s,u=f();e=$r();if(r("?")){m();l=a.allowIn;a.allowIn=true;i=R();a.allowIn=l;o(":");s=R();e=n(u,t.createConditionalExpression(e,i,s))}return e}function z(e){var n,t,r,a;if(e.type===l.ObjectExpression){e.type=l.ObjectPattern;for(n=0,t=e.properties.length;n<t;n+=1){r=e.properties[n];if(r.type===l.SpreadProperty){if(n<t-1){d({},i.PropertyAfterSpreadProperty)}z(r.argument)}else{if(r.kind!=="init"){d({},i.InvalidLHSInAssignment)}z(r.value)}}}else if(e.type===l.ArrayExpression){e.type=l.ArrayPattern;for(n=0,t=e.elements.length;n<t;n+=1){a=e.elements[n];if(a){z(a)}}}else if(e.type===l.Identifier){if(L(e.name)){d({},i.InvalidLHSInAssignment)}}else if(e.type===l.SpreadElement){z(e.argument);if(e.argument.type===l.ObjectPattern){d({},i.ObjectPatternAsSpread)}}else{if(e.type!==l.MemberExpression&&e.type!==l.CallExpression&&e.type!==l.NewExpression){d({},i.InvalidLHSInAssignment)}}}function Y(a,e){var n,t,r,s;if(e.type===l.ObjectExpression){e.type=l.ObjectPattern;for(n=0,t=e.properties.length;n<t;n+=1){r=e.properties[n];if(r.type===l.SpreadProperty){if(n<t-1){d({},i.PropertyAfterSpreadProperty)}Y(a,r.argument)}else{if(r.kind!=="init"){d({},i.InvalidLHSInFormalsList)}Y(a,r.value)}}}else if(e.type===l.ArrayExpression){e.type=l.ArrayPattern;for(n=0,t=e.elements.length;n<t;n+=1){s=e.elements[n];if(s){Y(a,s)}}}else if(e.type===l.Identifier){yn(a,e,e.name)}else{if(e.type!==l.MemberExpression){d({},i.InvalidLHSInFormalsList)}}}function Cn(c){var r,s,e,a,t,o,n,u;a=[];t=[];o=0;u=null;n={paramSet:{}};for(r=0,s=c.length;r<s;r+=1){e=c[r];if(e.type===l.Identifier){a.push(e);t.push(null);yn(n,e,e.name)}else if(e.type===l.ObjectExpression||e.type===l.ArrayExpression){Y(n,e);a.push(e);t.push(null)}else if(e.type===l.SpreadElement){G(r===s-1,"It is guaranteed that SpreadElement is last element by parseExpression");Y(n,e.argument);u=e.argument}else if(e.type===l.AssignmentExpression){a.push(e.left);t.push(e.right);++o;yn(n,e.left,e.left.name)}else{return null}}if(n.message===i.StrictParamDupe){d(v?n.stricted:n.firstRestricted,n.message)}if(o===0){t=[]}return{params:a,defaults:t,rest:u,stricted:n.stricted,firstRestricted:n.firstRestricted,message:n.message}}function In(e,c){var i,s,u,r;o("=>");i=v;s=a.yieldAllowed;a.yieldAllowed=false;u=a.awaitAllowed;a.awaitAllowed=!!e.async;r=Qn();if(v&&e.firstRestricted){d(e.firstRestricted,e.message)}if(v&&e.stricted){E(e.stricted,e.message)}v=i;a.yieldAllowed=s;a.awaitAllowed=u;return n(c,t.createArrowFunctionExpression(e.params,e.defaults,r,e.rest,r.type!==l.BlockStatement,!!e.async))}function R(){var h,e,o,s,g,y=c,p=false;if(lr()){return sr()}if(ir()){return or()}g=a.parenthesizedCount;h=f();if(et()){return Mn()}if(ln()){p=true;m()}if(r("(")){o=P();if(o.type===u.Punctuator&&o.value===")"||o.value==="..."){s=hn();if(!r("=>")){I(m())}s.async=p;return In(s,h)}}o=c;if(p&&!r("(")&&o.type!==u.Identifier){p=false;fn(y)}e=Hn();if(r("=>")&&(a.parenthesizedCount===g||a.parenthesizedCount===g+1)){if(e.type===l.Identifier){s=Cn([e])}else if(e.type===l.SequenceExpression){s=Cn(e.expressions)}if(s){s.async=p;return In(s,h)}}if(p){p=false;fn(y);e=Hn()}if(tr()){if(v&&e.type===l.Identifier&&L(e.name)){E(o,i.StrictLHSAssignment)}if(r("=")&&(e.type===l.ObjectExpression||e.type===l.ArrayExpression)){z(e)}else if(!vn(e)){d({},i.InvalidLHSInAssignment)}e=n(h,t.createAssignmentExpression(m().value,e,R()))}return e}function w(){var u,s,o,h,c,g,p;p=a.parenthesizedCount;u=f();s=R();o=[s];if(r(",")){while(e<y){if(!r(",")){break}m();s=Ln();o.push(s);if(s.type===l.SpreadElement){g=true;if(!r(")")){d({},i.ElementAfterSpreadElement)}break}}h=n(u,t.createSequenceExpression(o))}if(r("=>")){if(a.parenthesizedCount===p||a.parenthesizedCount===p+1){s=s.type===l.SequenceExpression?s.expressions:o;c=Cn(s);if(c){return In(c,u)}}I(m())}if(g&&P().value!=="=>"){d({},i.IllegalSpread)}return h||s}function nr(){var t=[],n;while(e<y){if(r("}")){break}n=H();if(typeof n==="undefined"){break}t.push(n)}return t}function gn(){var e,r=f();o("{");e=nr();o("}");return n(r,t.createBlockStatement(e))}function F(){var l=f(),e=[];o("<");while(!r(">")){e.push(k());if(!r(">")){o(",")}}o(">");return n(l,t.createTypeParameterDeclaration(e))}function sn(){var l=f(),i=a.inType,e=[];a.inType=true;o("<");while(!r(">")){e.push(A());if(!r(">")){o(",")}}o(">");a.inType=i;return n(l,t.createTypeParameterInstantiation(e))}function al(a,i){var e,r,l;o("[");e=j();o(":");r=A();o("]");o(":");l=A();return n(a,t.createObjectTypeIndexer(e,r,l,i))}function ct(s){var e=[],l=null,a,i=null;if(r("<")){i=F()}o("(");while(c.type===u.Identifier){e.push(bn());if(!r(")")){o(",")}}if(r("...")){m();l=bn()}o(")");o(":");a=A();return n(s,t.createFunctionTypeAnnotation(e,a,l,i))}function dr(e,l,a){var i=false,r;r=ct(e);return n(e,t.createObjectTypeProperty(a,r,i,l))}function mr(e,r){var l=f();return n(e,t.createObjectTypeCallProperty(ct(l),r))}function pt(y){var p=[],g=[],e,d=false,s=[],v,a,h,u,l;o("{");while(!r("}")){e=f();if(y&&_("static")){u=m();l=true}if(r("[")){g.push(al(e,l))}else if(r("(")||r("<")){p.push(mr(e,y))}else{if(l&&r(":")){a=n(e,t.createIdentifier(u));E(u,i.StrictReservedWord)}else{a=j()}if(r("<")||r("(")){s.push(dr(e,l,a))}else{if(r("?")){m();d=true}o(":");h=A();s.push(n(e,t.createObjectTypeProperty(a,h,d,l)))}}if(r(";")){m()}else if(!r("}")){I(c)}}o("}");return t.createObjectTypeAnnotation(s,g,p)}function yr(){var l=f(),i=null,a=null,e,s=f;e=k();while(r(".")){o(".");e=n(l,t.createQualifiedTypeIdentifier(e,k()))}if(r("<")){a=sn()}return n(l,t.createGenericTypeAnnotation(e,a))}function br(){var e=f();b("void");return n(e,t.createVoidTypeAnnotation())}function wr(){var e,r=f();b("typeof");e=Vn();return n(r,t.createTypeofTypeAnnotation(e))}function Rr(){var a=f(),l=[];o("[");while(e<y&&!r("]")){l.push(A());if(r("]")){break}o(",")}o("]");return n(a,t.createTupleTypeAnnotation(l))}function bn(){var i=f(),e,l=false,a;e=k();if(r("?")){m();l=true}o(":");a=A();return n(i,t.createFunctionTypeParam(e,a,l))}function Pn(){var e={params:[],rest:null};while(c.type===u.Identifier){e.params.push(bn());if(!r(")")){o(",")}}if(r("...")){m();e.rest=bn()}return e}function Vn(){var x=null,s=null,p=null,e=f(),h=null,a,y,l,v,g=false;switch(c.type){case u.Identifier:switch(c.value){case"any":m();return n(e,t.createAnyTypeAnnotation());case"bool":case"boolean":m();return n(e,t.createBooleanTypeAnnotation());case"number":m();return n(e,t.createNumberTypeAnnotation());case"string":m();return n(e,t.createStringTypeAnnotation())}return n(e,yr());case u.Punctuator:switch(c.value){case"{":return n(e,pt());case"[":return Rr();case"<":y=F();o("(");a=Pn();s=a.params;h=a.rest;o(")");o("=>");p=A();return n(e,t.createFunctionTypeAnnotation(s,p,h,y));case"(":m();if(!r(")")&&!r("...")){if(c.type===u.Identifier){l=P();g=l.value!=="?"&&l.value!==":"}else{g=true}}if(g){v=A();o(")");if(r("=>")){d({},i.ConfusedAboutFunctionType)}return v}a=Pn();s=a.params;h=a.rest;o(")");o("=>");p=A();return n(e,t.createFunctionTypeAnnotation(s,p,h,null))}break;case u.Keyword:switch(c.value){case"void":return n(e,br());case"typeof":return n(e,wr())}break;case u.StringLiteral:l=m();if(l.octal){d(l,i.StrictOctalLiteral)}return n(e,t.createStringLiteralTypeAnnotation(l))}I(c)}function Nr(){var l=f(),e=Vn();if(r("[")){o("[");o("]");return n(l,t.createArrayTypeAnnotation(e))}return e}function kn(){var e=f();if(r("?")){m();return n(e,t.createNullableTypeAnnotation(kn()))}return Nr()}function qn(){var a=f(),l,e;l=kn();e=[l];while(r("&")){m();e.push(kn())}return e.length===1?l:n(a,t.createIntersectionTypeAnnotation(e))}function zr(){var a=f(),l,e;l=qn();e=[l];while(r("|")){m();e.push(qn())}return e.length===1?l:n(a,t.createUnionTypeAnnotation(e))}function A(){var n=a.inType,e;a.inType=true;e=zr();a.inType=n;return e}function M(){var r=f(),e;o(":");e=A();return n(r,t.createTypeAnnotation(e))}function k(){var r=f(),e=m();if(e.type!==u.Identifier){I(e)}return n(r,t.createIdentifier(e.value))}function tn(a,i){var t=f(),e=k(),l=false;if(i&&r("?")){o("?");l=true}if(a||r(":")){e.typeAnnotation=M();e=n(t,e)}if(l){e.optional=true;e=n(t,e)}return e}function tl(u){var e,c=f(),l=null,s=f();if(r("{")){e=dn();z(e);if(r(":")){e.typeAnnotation=M();n(s,e)}}else if(r("[")){e=xn();z(e);if(r(":")){e.typeAnnotation=M();n(s,e)}}else{e=a.allowKeyword?W():tn();if(v&&L(e.name)){E({},i.StrictVarName)}}if(u==="const"){if(!r("=")){d({},i.NoUnintializedConst)}o("=");l=R()}else if(r("=")){m();l=R()}return n(c,t.createVariableDeclarator(e,l))}function Rn(t){var n=[];do{n.push(tl(t));if(!r(",")){break}m()}while(e<y);return n}function kt(){var e,r=f();b("var");e=Rn();S();return n(r,t.createVariableDeclaration(e,"var"))}function It(e){var r,l=f();b(e);r=Rn(e);S();return n(l,t.createVariableDeclaration(r,e))}function pn(){var r=f(),e;if(c.type!==u.StringLiteral){d({},i.InvalidModuleSpecifier)}e=t.createModuleSpecifier(c);m();return n(r,e)}function Ct(){var e=f();o("*");return n(e,t.createExportBatchSpecifier())}function At(){var e,r=null,l=f(),a;if(x("default")){m();e=n(l,t.createIdentifier("default"))}else{e=k()}if(_("as")){m();r=W()}return n(l,t.createExportSpecifier(e,r))}function Tt(){var p,g,y,l=null,h,s=null,a=[],e=f();b("export");if(x("default")){m();if(x("function")||x("class")){p=c;m();if(On(c)){g=W();fn(p);return n(e,t.createExportDeclaration(true,H(),[g],null))}fn(p);switch(c.value){case"class":return n(e,t.createExportDeclaration(true,it(),[],null));case"function":return n(e,t.createExportDeclaration(true,Mn(),[],null))}}if(_("from")){d({},i.UnexpectedToken,c.value)}if(r("{")){l=dn()}else if(r("[")){l=xn()}else{l=R()}S();return n(e,t.createExportDeclaration(true,l,[],null))}if(c.type===u.Keyword){switch(c.value){case"let":case"const":case"var":case"class":case"function":return n(e,t.createExportDeclaration(false,H(),a,null))}}if(r("*")){a.push(Ct());if(!_("from")){d({},c.value?i.UnexpectedToken:i.MissingFromClause,c.value)}m();s=pn();S();return n(e,t.createExportDeclaration(false,null,a,s))}o("{");do{h=h||x("default");a.push(At())}while(r(",")&&m());o("}");if(_("from")){m();s=pn();S()}else if(h){d({},c.value?i.UnexpectedToken:i.MissingFromClause,c.value)}else{S()}return n(e,t.createExportDeclaration(false,l,a,s))}function Lt(){var e,r=null,l=f();e=W();if(_("as")){m();r=k()}return n(l,t.createImportSpecifier(e,r))}function Pt(){var e=[];o("{");do{e.push(Lt())}while(r(",")&&m());o("}");return e}function jt(){var e,r=f();e=W();return n(r,t.createImportDefaultSpecifier(e))}function Mt(){var e,r=f();o("*");if(!_("as")){d({},i.NoAsAfterImportNamespace)}m();e=W();return n(r,t.createImportNamespaceSpecifier(e))}function Ot(){var e,l,a=f();b("import");e=[];if(c.type===u.StringLiteral){l=pn();S();return n(a,t.createImportDeclaration(e,l))}if(!x("default")&&On(c)){e.push(jt());if(r(",")){m()}}if(r("*")){e.push(Mt())}else if(r("{")){e=e.concat(Pt())}if(!_("from")){d({},c.value?i.UnexpectedToken:i.MissingFromClause,c.value)}m();l=pn();S();return n(a,t.createImportDeclaration(e,l))}function Dt(){var e=f();o(";");return n(e,t.createEmptyStatement())}function Nt(){var e=f(),r=w();S();return n(e,t.createExpressionStatement(r))}function Ft(){var r,l,e,a=f();b("if");o("(");r=w();o(")");l=B();if(x("else")){m();e=B()}else{e=null}return n(a,t.createIfStatement(r,l,e))}function Bt(){var e,l,i,s=f();b("do");i=a.inIteration;a.inIteration=true;e=B();a.inIteration=i;b("while");o("(");l=w();o(")");if(r(";")){m()}return n(s,t.createDoWhileStatement(e,l))}function Ut(){var e,r,l,i=f();b("while");o("(");e=w();o(")");l=a.inIteration;a.inIteration=true;r=B();a.inIteration=l;return n(i,t.createWhileStatement(e,r))}function Vt(){var e=f(),r=m(),l=Rn();return n(e,t.createVariableDeclaration(l,r.value))}function $n(v){var e,h,g,l,s,p,u,E,y=f();e=h=g=null;b("for");if(_("each")){d({},i.EachNotAllowed)}o("(");if(r(";")){m()}else{if(x("var")||x("let")||x("const")){a.allowIn=false;e=Vt();a.allowIn=true;if(e.declarations.length===1){if(x("in")||_("of")){u=c;if(!((u.value==="in"||e.kind!=="var")&&e.declarations[0].init)){m();l=e;s=w();e=null}}}}else{a.allowIn=false;e=w();a.allowIn=true;if(_("of")){u=m();l=e;s=w();e=null}else if(x("in")){if(!Tr(e)){d({},i.InvalidLHSInForIn)}u=m();l=e;s=w();e=null}}if(typeof l==="undefined"){o(";")}}if(typeof l==="undefined"){if(!r(";")){h=w()}o(";");if(!r(")")){g=w()}}o(")");E=a.inIteration;a.inIteration=true;if(!(v!==undefined&&v.ignoreBody)){p=B()}a.inIteration=E;if(typeof l==="undefined"){return n(y,t.createForStatement(e,h,g,p))}if(u.value==="in"){return n(y,t.createForInStatement(l,s,p))}return n(y,t.createForOfStatement(l,s,p))}function qt(){var r=null,o,l=f();b("continue");if(s.charCodeAt(e)===59){m();if(!a.inIteration){d({},i.IllegalContinue)}return n(l,t.createContinueStatement(null))}if(K()){if(!a.inIteration){d({},i.IllegalContinue)}return n(l,t.createContinueStatement(null))}if(c.type===u.Identifier){r=k();o="$"+r.name;if(!Object.prototype.hasOwnProperty.call(a.labelSet,o)){d({},i.UnknownLabel,r.name)}}S();if(r===null&&!a.inIteration){d({},i.IllegalContinue)}return n(l,t.createContinueStatement(r))}function Jt(){var r=null,o,l=f();b("break");if(s.charCodeAt(e)===59){m();if(!(a.inIteration||a.inSwitch)){d({},i.IllegalBreak)}return n(l,t.createBreakStatement(null))}if(K()){if(!(a.inIteration||a.inSwitch)){d({},i.IllegalBreak)}return n(l,t.createBreakStatement(null))}if(c.type===u.Identifier){r=k();o="$"+r.name;if(!Object.prototype.hasOwnProperty.call(a.labelSet,o)){d({},i.UnknownLabel,r.name)}}S();if(r===null&&!(a.inIteration||a.inSwitch)){d({},i.IllegalBreak)}return n(l,t.createBreakStatement(r))}function Gt(){var l=null,o=f();b("return");if(!a.inFunctionBody){E({},i.IllegalReturn)}if(s.charCodeAt(e)===32){if(q(s.charCodeAt(e+1))){l=w();S();return n(o,t.createReturnStatement(l))}}if(K()){return n(o,t.createReturnStatement(null))}if(!r(";")){if(!r("}")&&c.type!==u.EOF){l=w()}}S();return n(o,t.createReturnStatement(l))}function Wt(){var e,r,l=f();if(v){E({},i.StrictModeWith)}b("with");o("(");e=w();o(")");r=B();return n(l,t.createWithStatement(e,r))}function Ht(){var l,i=[],a,s=f();if(x("default")){m();l=null}else{b("case");l=w()}o(":");while(e<y){if(r("}")||x("default")||x("case")){break}a=H();if(typeof a==="undefined"){break}i.push(a)}return n(s,t.createSwitchCase(l,i))}function zt(){var s,l,u,p,c,h=f();b("switch");o("(");s=w();o(")");o("{");l=[];if(r("}")){m();return n(h,t.createSwitchStatement(s,l))}p=a.inSwitch;a.inSwitch=true;c=false;while(e<y){if(r("}")){break}u=Ht();if(u.test===null){if(c){d({},i.MultipleDefaultsInSwitch)}c=true}l.push(u)}a.inSwitch=p;o("}");return n(h,t.createSwitchStatement(s,l))}function Yt(){var e,r=f();b("throw");if(K()){d({},i.NewlineAfterThrow)}e=w();S();return n(r,t.createThrowStatement(e))}function $t(){var e,a,s=f();b("catch");o("(");if(r(")")){I(c)}e=w();if(v&&e.type===l.Identifier&&L(e.name)){E({},i.StrictCatchVariable)}o(")");a=gn();return n(s,t.createCatchClause(e,a))}function Kt(){var l,e=[],r=null,a=f();b("try");l=gn();if(x("catch")){e.push($t())}if(x("finally")){m();r=gn()}if(e.length===0&&!r){d({},i.NoCatchOrFinally)}return n(a,t.createTryStatement(l,[],e,r))}function Qt(){var e=f();b("debugger");S();return n(e,t.createDebuggerStatement())}function B(){var o=c.type,p,e,h,s;if(o===u.EOF){I(c)}if(o===u.Punctuator){switch(c.value){case";":return Dt();case"{":return gn();case"(":return Nt();default:break}}if(o===u.Keyword){switch(c.value){case"break":return Jt();case"continue":return qt();case"debugger":return Qt();case"do":return Bt();case"for":return $n();case"function":return jn();case"class":return hr();case"if":return Ft();case"return":return Gt();case"switch":return zt();case"throw":return Yt();case"try":return Kt();case"var":return kt();case"while":return Ut();case"with":return Wt();default:break}}if(et()){return jn()}p=f();e=w();if(e.type===l.Identifier&&r(":")){m();s="$"+e.name;if(Object.prototype.hasOwnProperty.call(a.labelSet,s)){d({},i.Redeclaration,"Label",e.name)}a.labelSet[s]=true;h=B();delete a.labelSet[s];return n(p,t.createLabeledStatement(e,h))}S();return n(p,t.createExpressionStatement(e))}function Qn(){if(r("{")){return Tn()}return R()}function Tn(){var p,h=[],d,x,m,g,b,w,_,S,k=f();o("{");while(e<y){if(c.type!==u.StringLiteral){break}d=c;p=H();h.push(p);if(p.expression.type!==l.Literal){break}x=s.slice(d.range[0]+1,d.range[1]-1);if(x==="use strict"){v=true;if(m){E(m,i.StrictOctalLiteral)}}else{if(!m&&d.octal){m=d}}}g=a.labelSet;b=a.inIteration;w=a.inSwitch;_=a.inFunctionBody;S=a.parenthesizedCount;a.labelSet={};a.inIteration=false;a.inSwitch=false;a.inFunctionBody=true;a.parenthesizedCount=0;while(e<y){if(r("}")){break}p=H();if(typeof p==="undefined"){break}h.push(p)}o("}");a.labelSet=g;a.inIteration=b;a.inSwitch=w;a.inFunctionBody=_;a.parenthesizedCount=S;return n(k,t.createBlockStatement(h))}function yn(e,n,t){var r="$"+t;if(v){if(L(t)){e.stricted=n;e.message=i.StrictParamName}if(Object.prototype.hasOwnProperty.call(e.paramSet,r)){e.stricted=n;e.message=i.StrictParamDupe}}else if(!e.firstRestricted){if(L(t)){e.firstRestricted=n;e.message=i.StrictParamName}else if(un(t)){e.firstRestricted=n;e.message=i.StrictReservedWord}else if(Object.prototype.hasOwnProperty.call(e.paramSet,r)){e.firstRestricted=n;e.message=i.StrictParamDupe}}e.paramSet[r]=true}function rr(t){var s,l,a,e,o;l=c;if(l.value==="..."){l=m();a=true}if(r("[")){s=f();e=xn();Y(t,e);if(r(":")){e.typeAnnotation=M();n(s,e)}}else if(r("{")){s=f();if(a){d({},i.ObjectPatternAsRestParameter)}e=dn();Y(t,e);if(r(":")){e.typeAnnotation=M();n(s,e)}}else{e=a?tn(false,false):tn(false,true);yn(t,l,l.value)}if(r("=")){if(a){E(c,i.DefaultRestParameter)}m();o=R();++t.defaultCount}if(a){if(!r(")")){d({},i.ParameterAfterRestParameter)}t.rest=e;return false}t.params.push(e);t.defaults.push(o);return!r(")")}function hn(l){var t,a=f();t={params:[],defaultCount:0,defaults:[],rest:null,firstRestricted:l};o("(");if(!r(")")){t.paramSet={};while(e<y){if(!rr(t)){break}o(",")}}o(")");if(t.defaultCount===0){t.defaults=[]}if(r(":")){t.returnType=M()}return n(a,t)}function jn(){var g,h,l,e,s,o,u,p,y,x,w,S=f(),_;p=false;if(ln()){m();p=true}b("function");u=false;if(r("*")){m();u=true}l=c;g=k();if(r("<")){_=F()}if(v){if(L(l.value)){E(l,i.StrictFunctionName)}}else{if(L(l.value)){s=l;o=i.StrictFunctionName}else if(un(l.value)){s=l;o=i.StrictReservedWord}}e=hn(s);s=e.firstRestricted;if(e.message){o=e.message}y=v;x=a.yieldAllowed;a.yieldAllowed=u;w=a.awaitAllowed;a.awaitAllowed=p;h=Tn();if(v&&s){d(s,o)}if(v&&e.stricted){E(e.stricted,o)}v=y;a.yieldAllowed=x;a.awaitAllowed=w;return n(S,t.createFunctionDeclaration(g,e.params,e.defaults,h,e.rest,u,false,p,e.returnType,_))}function Mn(){var l,h=null,s,o,e,g,u,p,y,x,w,S=f(),_;p=false;if(ln()){m();p=true}b("function");u=false;if(r("*")){m();u=true}if(!r("(")){if(!r("<")){l=c;h=k();if(v){if(L(l.value)){E(l,i.StrictFunctionName)}}else{if(L(l.value)){s=l;o=i.StrictFunctionName}else if(un(l.value)){s=l;o=i.StrictReservedWord}}}if(r("<")){_=F()}}e=hn(s);s=e.firstRestricted;if(e.message){o=e.message}y=v;x=a.yieldAllowed;a.yieldAllowed=u;w=a.awaitAllowed;a.awaitAllowed=p;g=Tn();if(v&&s){d(s,o)}if(v&&e.stricted){E(e.stricted,o)}v=y;a.yieldAllowed=x;a.awaitAllowed=w;return n(S,t.createFunctionExpression(h,e.params,e.defaults,g,e.rest,u,false,p,e.returnType,_))}function sr(){var e,l,a=f();b("yield",!v);e=false;if(r("*")){m();e=true}l=R();return n(a,t.createYieldExpression(l,e))}function or(){var e,r=f();X("await");e=R();return n(r,t.createAwaitExpression(e))}function ur(l,e,y,g,v){var p,m,n,a=false,f,h,u,s,x;n=y?$.static:$.prototype;if(g){return t.createMethodDefinition(n,"",e,en({generator:true}))}u=e.type==="Identifier"&&e.name;if(u==="get"&&!r("(")){e=j();if(l[n].hasOwnProperty(e.name)){a=l[n][e.name].get===undefined&&l[n][e.name].data===undefined&&l[n][e.name].set!==undefined;if(!a){d(e,i.IllegalDuplicateClassProperty)}}else{l[n][e.name]={}}l[n][e.name].get=true;o("(");o(")");if(r(":")){s=M()}return t.createMethodDefinition(n,"get",e,rn({generator:false,returnType:s}))}if(u==="set"&&!r("(")){e=j();if(l[n].hasOwnProperty(e.name)){a=l[n][e.name].set===undefined&&l[n][e.name].data===undefined&&l[n][e.name].get!==undefined;if(!a){d(e,i.IllegalDuplicateClassProperty)}}else{l[n][e.name]={}}l[n][e.name].set=true;o("(");p=c;m=[tn()];o(")");if(r(":")){s=M()}return t.createMethodDefinition(n,"set",e,rn({params:m,generator:false,name:p,returnType:s}))}if(r("<")){h=F()}f=u==="async"&&!r("(");if(f){e=j()}if(l[n].hasOwnProperty(e.name)){d(e,i.IllegalDuplicateClassProperty)}else{l[n][e.name]={}}l[n][e.name].data=true;return t.createMethodDefinition(n,"",e,en({generator:false,async:f,typeParameters:h}))}function cr(a,n,r,l){var e;e=M();o(";");return t.createClassProperty(n,e,r,l)}function fr(i){var e,t=false,l,s=f(),a=false;if(r(";")){m();return}if(c.value==="static"){m();a=true}if(r("*")){m();t=true}e=c.value==="[";l=j();if(!t&&c.value===":"){return n(s,cr(i,l,e,a))}return n(s,ur(i,l,a,t,e))}function lt(){var l,i=[],a={},s=f();a[$.static]={};a[$.prototype]={};o("{");while(e<y){if(r("}")){break}l=fr(a);if(typeof l!=="undefined"){i.push(l)}}o("}");return n(s,t.createClassBody(i))}function at(){var a,i=[],s,l;X("implements");while(e<y){s=f();a=k();if(r("<")){l=sn()}else{l=null}i.push(n(s,t.createClassImplements(a,l)));if(!r(",")){break}o(",")}return i}function it(){var e,l,i,s=null,o,c=f(),u;b("class");if(!x("extends")&&!_("implements")&&!r("{")){e=k()}if(r("<")){u=F()}if(x("extends")){b("extends");i=a.yieldAllowed;a.yieldAllowed=false;s=An();if(r("<")){o=sn()}a.yieldAllowed=i}if(_("implements")){l=at()}return n(c,t.createClassExpression(e,s,lt(),u,o,l))}function hr(){var e,l,i,s=null,o,c=f(),u;b("class");e=k();if(r("<")){u=F()}if(x("extends")){b("extends");i=a.yieldAllowed;a.yieldAllowed=false;s=An();if(r("<")){o=sn()}a.yieldAllowed=i}if(_("implements")){l=at()}return n(c,t.createClassDeclaration(e,s,lt(),u,o,l))}function H(){var e;if(c.type===u.Keyword){switch(c.value){case"const":case"let":return It(c.value);case"function":return jn();default:return B()}}if(_("type")&&P().type===u.Identifier){return Jr()}if(_("interface")&&P().type===u.Identifier){return Hr()}if(_("declare")){e=P();if(e.type===u.Keyword){switch(e.value){case"class":return vt();case"function":return xt();case"var":return bt()}}else if(e.type===u.Identifier&&e.value==="module"){return Kr()}}if(c.type!==u.EOF){return B()}}function ot(){if(c.type===u.Keyword){switch(c.value){case"export":return Tt();case"import":return Ot()}}return H()}function vr(){var n,a=[],t,o,r;while(e<y){t=c;if(t.type!==u.StringLiteral){break}n=ot();a.push(n);if(n.expression.type!==l.Literal){break}o=s.slice(t.range[0]+1,t.range[1]-1);if(o==="use strict"){v=true;if(r){E(r,i.StrictOctalLiteral)}}else{if(!r&&t.octal){r=t}}}while(e<y){n=ot();if(typeof n==="undefined"){break}a.push(n)}return a}function xr(){var e,r=f();v=false;mn();e=vr();return n(r,t.createProgram(e))}function wn(t,r,n,l,i){var e;G(typeof n==="number","Comment must have valid position");if(a.lastCommentStart>=n){return}a.lastCommentStart=n;e={type:t,value:r};if(p.range){e.range=[n,l]}if(p.loc){e.loc=i}p.comments.push(e);if(p.attachComment){p.leadingComments.push(e);p.trailingComments.push(e)}}function Er(){var t,n,r,l,o,a;t="";o=false;a=false;while(e<y){n=s[e];if(a){n=s[e++];if(T(n.charCodeAt(0))){r.end={line:h,column:e-g-1};a=false;wn("Line",t,l,e-1,r);if(n==="\r"&&s[e]==="\n"){++e}++h;g=e;t=""}else if(e>=y){a=false;t+=n;r.end={line:h,column:y-g};wn("Line",t,l,y,r)}else{t+=n}}else if(o){if(T(n.charCodeAt(0))){if(n==="\r"){++e;t+="\r"}if(n!=="\r"||s[e]==="\n"){t+=s[e];++h;++e;g=e;if(e>=y){d({},i.UnexpectedToken,"ILLEGAL")}}}else{n=s[e++];if(e>=y){d({},i.UnexpectedToken,"ILLEGAL")}t+=n;if(n==="*"){n=s[e];if(n==="/"){t=t.substr(0,t.length-1);o=false;++e;r.end={line:h,column:e-g};wn("Block",t,l,e,r);t=""}}}}else if(n==="/"){n=s[e+1];if(n==="/"){r={start:{line:h,column:e-g}};l=e;e+=2;a=true;if(e>=y){r.end={line:h,column:e-g};a=false;wn("Line",t,l,e,r)}}else if(n==="*"){l=e;e+=2;o=true;r={start:{line:h,column:e-g-2}};if(e>=y){d({},i.UnexpectedToken,"ILLEGAL")}}else{break}}else if(st(n.charCodeAt(0))){++e}else if(T(n.charCodeAt(0))){++e;if(n==="\r"&&s[e]==="\n"){++e}++h;g=e}else{break}}}Nn={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:"♦"};function on(e){if(e.type===l.XJSIdentifier){return e.name}if(e.type===l.XJSNamespacedName){return e.namespace.name+":"+e.name.name}if(e.type===l.XJSMemberExpression){return on(e.object)+"."+on(e.property)}}function _r(e){return e!==92&&q(e)}function Sr(e){return e!==92&&(e===45||an(e))}function kr(){var n,t,r="";t=e;while(e<y){n=s.charCodeAt(e);if(!Sr(n)){break}r+=s[e++]}return{type:u.XJSIdentifier,value:r,lineNumber:h,lineStart:g,range:[t,e]}}function Ir(){var t,n="",l=e,a=0,r;t=s[e];G(t==="&","Entity must start with an ampersand");e++;while(e<y&&a++<10){t=s[e++];if(t===";"){break}n+=t}if(t===";"){if(n[0]==="#"){if(n[1]==="x"){r=+("0"+n.substr(1))}else{r=+n.substr(1).replace(_n.LeadingZeros,"")}if(!isNaN(r)){return String.fromCharCode(r)}}else if(Nn[n]){return Nn[n]}}e=l+1;return"&"}function ft(l){var n,t="",r;r=e;while(e<y){n=s[e];if(l.indexOf(n)!==-1){break}if(n==="&"){t+=Ir()}else{e++;if(n==="\r"&&s[e]==="\n"){t+=n;n=s[e];e++}if(T(n.charCodeAt(0))){++h;g=e}t+=n}}return{type:u.XJSText,value:t,lineNumber:h,lineStart:g,range:[r,e]}}function Cr(){var t,n,r;n=s[e];G(n==="'"||n==='"',"String literal must starts with a quote");r=e;++e;t=ft([n]);if(n!==s[e]){d({},i.UnexpectedToken,"ILLEGAL")}++e;t.range=[r,e];return t}function Ar(){var n=s.charCodeAt(e);if(n!==123&&n!==60){return ft(["<","{"])}return V()}function Q(){var e,r=f();if(c.type!==u.XJSIdentifier){I(c)}e=m();return n(r,t.createXJSIdentifier(e.value))}function dt(){var e,r,l=f();e=Q();o(":");r=Q();return n(l,t.createXJSNamespacedName(e,r))}function Pr(){var l=f(),e=Q();while(r(".")){m();e=n(l,t.createXJSMemberExpression(e,Q()))}return e}function mt(){if(P().value===":"){return dt()}if(P().value==="."){return Pr()}return Q()}function Mr(){if(P().value===":"){return dt()}return Q()}function Or(){var e,a;if(r("{")){e=ht();if(e.expression.type===l.XJSEmptyExpression){d(e,"XJS attributes must only be assigned a non-empty "+"expression")}}else if(r("<")){e=Bn()}else if(c.type===u.XJSText){a=f();e=n(a,t.createLiteral(m()))}else{d({},i.InvalidXJSAttributeValue)}return e}function Dr(){var r=Xn();while(s.charAt(e)!=="}"){e++}return n(r,t.createXJSEmptyExpression())}function ht(){var e,l,i,s=f();l=a.inXJSChild;i=a.inXJSTag;a.inXJSChild=false;a.inXJSTag=false;o("{");if(r("}")){e=Dr()}else{e=w()}a.inXJSChild=l;a.inXJSTag=i;o("}");return n(s,t.createXJSExpressionContainer(e))}function Fr(){var e,r,l,i=f();r=a.inXJSChild;l=a.inXJSTag;a.inXJSChild=false;a.inXJSTag=false;
o("{");o("...");e=R();a.inXJSChild=r;a.inXJSTag=l;o("}");return n(i,t.createXJSSpreadAttribute(e))}function Br(){var e,l;if(r("{")){return Fr()}l=f();e=Mr();if(r("=")){m();return n(l,t.createXJSAttribute(e,Or()))}return n(l,t.createXJSAttribute(e))}function Ur(){var e,l;if(r("{")){e=ht()}else if(c.type===u.XJSText){l=Xn();e=n(l,t.createLiteral(m()))}else{e=Bn()}return e}function Vr(){var e,r,l,i=f();r=a.inXJSChild;l=a.inXJSTag;a.inXJSChild=false;a.inXJSTag=true;o("<");o("/");e=mt();a.inXJSChild=r;a.inXJSTag=l;o(">");return n(i,t.createXJSClosingElement(e))}function Xr(){var r,d,l=[],i=false,s,u,p=f();s=a.inXJSChild;u=a.inXJSTag;a.inXJSChild=false;a.inXJSTag=true;o("<");r=mt();while(e<y&&c.value!=="/"&&c.value!==">"){l.push(Br())}a.inXJSTag=u;if(c.value==="/"){o("/");a.inXJSChild=s;o(">");i=true}else{a.inXJSChild=true;o(">")}return n(p,t.createXJSOpeningElement(r,l,i))}function Bn(){var l,s=null,u=[],o,p,m=f();o=a.inXJSChild;p=a.inXJSTag;l=Xr();if(!l.selfClosing){while(e<y){a.inXJSChild=false;if(c.value==="<"&&P().value==="/"){break}a.inXJSChild=true;u.push(Ur())}a.inXJSChild=o;a.inXJSTag=p;s=Vr();if(on(s.name)!==on(l.name)){d({},i.ExpectedXJSClosingTag,on(l.name))}}if(!o&&r("<")){d(c,i.AdjacentXJSElements)}return n(m,t.createXJSElement(l,s,u))}function Jr(){var e,i=f(),l=null,a;X("type");e=k();if(r("<")){l=F()}o("=");a=A();S();return n(i,t.createTypeAlias(e,l,a))}function Gr(){var a=f(),e,l=null;e=k();if(r("<")){l=sn()}return n(a,t.createInterfaceExtends(e,l))}function yt(c,p){var l,a,i=[],s,u=null;s=k();if(r("<")){u=F()}if(x("extends")){b("extends");while(e<y){i.push(Gr());if(!r(",")){break}o(",")}}a=f();l=n(a,pt(p));return n(c,t.createInterface(s,u,l,i))}function Hr(){var n,t,r=[],l,e=f(),a=null;X("interface");return yt(e,false)}function vt(){var n=f(),e;X("declare");b("class");e=yt(n,true);e.type=l.DeclareClass;return e}function xt(){var e,i,m=f(),s,u,c,l,p=null,d,a;X("declare");b("function");i=f();e=k();a=f();if(r("<")){p=F()}o("(");l=Pn();s=l.params;c=l.rest;o(")");o(":");u=A();d=n(a,t.createFunctionTypeAnnotation(s,u,c,p));e.typeAnnotation=n(a,t.createTypeAnnotation(d));n(i,e);S();return n(m,t.createDeclareFunction(e))}function bt(){var e,r=f();X("declare");b("var");e=tn();S();return n(r,t.createDeclareVariable(e))}function Kr(){var l=[],s,a,p,h=f(),d;X("declare");X("module");if(c.type===u.StringLiteral){if(v&&c.octal){E(c,i.StrictOctalLiteral)}p=f();a=n(p,t.createLiteral(m()))}else{a=k()}s=f();o("{");while(e<y&&!r("}")){d=P();switch(d.value){case"class":l.push(vt());break;case"function":l.push(xt());break;case"var":l.push(bt());break;default:I(c)}}o("}");return n(h,t.createDeclareModule(a,n(s,t.createBlockStatement(l))))}function Qr(){var o,t,n,l,i,r;if(!a.inXJSChild){O()}o=e;t={start:{line:h,column:e-g}};n=p.advance();t.end={line:h,column:e-g};if(n.type!==u.EOF){l=[n.range[0],n.range[1]];i=s.slice(n.range[0],n.range[1]);r={type:C[n.type],value:i,range:l,loc:t};if(n.regex){r.regex={pattern:n.regex.pattern,flags:n.regex.flags}}p.tokens.push(r)}return n}function Zr(){var r,l,t,n;O();r=e;l={start:{line:h,column:e-g}};t=p.scanRegExp();l.end={line:h,column:e-g};if(!p.tokenize){if(p.tokens.length>0){n=p.tokens[p.tokens.length-1];if(n.range[0]===r&&n.type==="Punctuator"){if(n.value==="/"||n.value==="/="){p.tokens.pop()}}}p.tokens.push({type:"RegularExpression",value:t.literal,regex:t.regex,range:[r,e],loc:l})}return t}function Et(){var t,e,n,r=[];for(t=0;t<p.tokens.length;++t){e=p.tokens[t];n={type:e.type,value:e.value};if(e.regex){n.regex={pattern:e.regex.pattern,flags:e.regex.flags}}if(p.range){n.range=e.range}if(p.loc){n.loc=e.loc}r.push(n)}p.tokens=r}function wt(){if(p.comments){p.skipComment=O;O=Er}if(typeof p.tokens!=="undefined"){p.advance=nn;p.scanRegExp=N;nn=Qr;N=Zr}}function Kn(){if(typeof p.skipComment==="function"){O=p.skipComment}if(typeof p.scanRegExp==="function"){nn=p.advance;N=p.scanRegExp}}function rl(n,t){var e,r={};for(e in n){if(n.hasOwnProperty(e)){r[e]=n[e]}}for(e in t){if(t.hasOwnProperty(e)){r[e]=t[e]}}return r}function ll(r,n){var o,i,l;o=String;if(typeof r!=="string"&&!(r instanceof String)){r=o(r)}t=Fn;s=r;e=0;h=s.length>0?1:0;g=0;y=s.length;c=null;a={allowKeyword:true,allowIn:true,labelSet:{},inFunctionBody:false,inIteration:false,inSwitch:false,lastCommentStart:-1};p={};n=n||{};n.tokens=true;p.tokens=[];p.tokenize=true;p.openParenToken=-1;p.openCurlyToken=-1;p.range=typeof n.range==="boolean"&&n.range;p.loc=typeof n.loc==="boolean"&&n.loc;if(typeof n.comment==="boolean"&&n.comment){p.comments=[]}if(typeof n.tolerant==="boolean"&&n.tolerant){p.errors=[]}if(y>0){if(typeof s[0]==="undefined"){if(r instanceof String){s=r.valueOf()}}}wt();try{mn();if(c.type===u.EOF){return p.tokens}i=m();while(c.type!==u.EOF){try{i=m()}catch(f){i=c;if(p.errors){p.errors.push(f);break}else{throw f}}}Et();l=p.tokens;if(typeof p.comments!=="undefined"){l.comments=p.comments}if(typeof p.errors!=="undefined"){l.errors=p.errors}}catch(d){throw d}finally{Kn();p={}}return l}function Rt(r,n){var l,i;i=String;if(typeof r!=="string"&&!(r instanceof String)){r=i(r)}t=Fn;s=r;e=0;h=s.length>0?1:0;g=0;y=s.length;c=null;a={allowKeyword:false,allowIn:true,labelSet:{},parenthesizedCount:0,inFunctionBody:false,inIteration:false,inSwitch:false,inXJSChild:false,inXJSTag:false,inType:false,lastCommentStart:-1,yieldAllowed:false,awaitAllowed:false};p={};if(typeof n!=="undefined"){p.range=typeof n.range==="boolean"&&n.range;p.loc=typeof n.loc==="boolean"&&n.loc;p.attachComment=typeof n.attachComment==="boolean"&&n.attachComment;if(p.loc&&n.source!==null&&n.source!==undefined){t=rl(t,{postProcess:function(e){e.loc.source=i(n.source);return e}})}if(typeof n.tokens==="boolean"&&n.tokens){p.tokens=[]}if(typeof n.comment==="boolean"&&n.comment){p.comments=[]}if(typeof n.tolerant==="boolean"&&n.tolerant){p.errors=[]}if(p.attachComment){p.range=true;p.comments=[];p.bottomRightStack=[];p.trailingComments=[];p.leadingComments=[]}}if(y>0){if(typeof s[0]==="undefined"){if(r instanceof String){s=r.valueOf()}}}wt();try{l=xr();if(typeof p.comments!=="undefined"){l.comments=p.comments}if(typeof p.tokens!=="undefined"){Et();l.tokens=p.tokens}if(typeof p.errors!=="undefined"){l.errors=p.errors}}catch(o){throw o}finally{Kn();p={}}return l}En.version="8001.1001.0-dev-harmony-fb";En.tokenize=ll;En.parse=Rt;En.Syntax=function(){var e,n={};if(typeof Object.create==="function"){n=Object.create(null)}for(e in l){if(l.hasOwnProperty(e)){n[e]=l[e]}}if(typeof Object.freeze==="function"){Object.freeze(n)}return n}()})},{}],162:[function(t,e,r){var n=function(){"use strict";function e(n,t){var e=Array.prototype.slice.call(arguments,1);return n.replace(/\{(\d+)\}/g,function(t,n){return n in e?e[n]:t})}function n(n,e){return n.replace(/\{([_$a-zA-Z0-9][_$a-zA-Z0-9]*)\}/g,function(t,n){return n in e?e[n]:t})}function t(e,n){return new Array(n+1).join(e)}e.fmt=e;e.obj=n;e.repeat=t;return e}();if(typeof e!=="undefined"&&typeof e.exports!=="undefined"){e.exports=n}},{}],163:[function(t,e,r){var n=function(){"use strict";var e=Object.prototype.hasOwnProperty;var n=Object.prototype.toString;var t=void 0;return{nan:function(e){return e!==e},"boolean":function(e){return typeof e==="boolean"},number:function(e){return typeof e==="number"},string:function(e){return typeof e==="string"},fn:function(e){return typeof e==="function"},object:function(e){return e!==null&&typeof e==="object"},primitive:function(e){var n=typeof e;return e===null||e===t||n==="boolean"||n==="number"||n==="string"},array:Array.isArray||function(e){return n.call(e)==="[object Array]"},finitenumber:function(e){return typeof e==="number"&&isFinite(e)},someof:function(e,n){return n.indexOf(e)>=0},noneof:function(e,n){return n.indexOf(e)===-1},own:function(n,t){return e.call(n,t)}}}();if(typeof e!=="undefined"&&typeof e.exports!=="undefined"){e.exports=n}},{}],164:[function(t,e,r){var n=function(){"use strict";var n=Object.prototype.hasOwnProperty;var t=function(){function r(e){for(var t in e){if(n.call(e,t)){return true}}return false}function l(e){return n.call(e,"__count__")||n.call(e,"__parent__")}var e=false;if(typeof Object.create==="function"){if(!r(Object.create(null))){e=true}}if(e===false){if(r({})){throw new Error("StringMap environment error 0, please file a bug at https://github.com/olov/stringmap/issues")}}var t=e?Object.create(null):{};var a=false;if(l(t)){t.__proto__=null;if(r(t)||l(t)){throw new Error("StringMap environment error 1, please file a bug at https://github.com/olov/stringmap/issues")}a=true}return function(){var n=e?Object.create(null):{};if(a){n.__proto__=null}return n}}();function e(n){if(!(this instanceof e)){return new e(n)}this.obj=t();this.hasProto=false;this.proto=undefined;if(n){this.setMany(n)}}e.prototype.has=function(e){if(typeof e!=="string"){throw new Error("StringMap expected string key")}return e==="__proto__"?this.hasProto:n.call(this.obj,e)};e.prototype.get=function(e){if(typeof e!=="string"){throw new Error("StringMap expected string key")}return e==="__proto__"?this.proto:n.call(this.obj,e)?this.obj[e]:undefined};e.prototype.set=function(e,n){if(typeof e!=="string"){throw new Error("StringMap expected string key")}if(e==="__proto__"){this.hasProto=true;this.proto=n}else{this.obj[e]=n}};e.prototype.remove=function(e){if(typeof e!=="string"){throw new Error("StringMap expected string key")}var n=this.has(e);if(e==="__proto__"){this.hasProto=false;this.proto=undefined}else{delete this.obj[e]}return n};e.prototype["delete"]=e.prototype.remove;e.prototype.isEmpty=function(){for(var e in this.obj){if(n.call(this.obj,e)){return false}}return!this.hasProto};e.prototype.size=function(){var e=0;for(var t in this.obj){if(n.call(this.obj,t)){++e}}return this.hasProto?e+1:e};e.prototype.keys=function(){var e=[];for(var t in this.obj){if(n.call(this.obj,t)){e.push(t)}}if(this.hasProto){e.push("__proto__")}return e};e.prototype.values=function(){var e=[];for(var t in this.obj){if(n.call(this.obj,t)){e.push(this.obj[t])}}if(this.hasProto){e.push(this.proto)}return e};e.prototype.items=function(){var e=[];for(var t in this.obj){if(n.call(this.obj,t)){e.push([t,this.obj[t]])}}if(this.hasProto){e.push(["__proto__",this.proto])}return e};e.prototype.setMany=function(e){if(e===null||typeof e!=="object"&&typeof e!=="function"){throw new Error("StringMap expected Object")}for(var t in e){if(n.call(e,t)){this.set(t,e[t])}}return this};e.prototype.merge=function(n){var t=n.keys();for(var e=0;e<t.length;e++){var r=t[e];this.set(r,n.get(r))}return this};e.prototype.map=function(r){var e=this.keys();for(var n=0;n<e.length;n++){var t=e[n];e[n]=r(this.get(t),t)}return e};e.prototype.forEach=function(r){var n=this.keys();for(var e=0;e<n.length;e++){var t=n[e];r(this.get(t),t)}};e.prototype.clone=function(){var n=e();return n.merge(this)};e.prototype.toString=function(){var e=this;return"{"+this.keys().map(function(n){return JSON.stringify(n)+":"+JSON.stringify(e.get(n))}).join(",")+"}"};return e}();if(typeof e!=="undefined"&&typeof e.exports!=="undefined"){e.exports=n}},{}],165:[function(t,e,r){var n=function(){"use strict";var n=Object.prototype.hasOwnProperty;var t=function(){function r(e){for(var t in e){if(n.call(e,t)){return true}}return false}function l(e){return n.call(e,"__count__")||n.call(e,"__parent__")}var e=false;if(typeof Object.create==="function"){if(!r(Object.create(null))){e=true}}if(e===false){if(r({})){throw new Error("StringSet environment error 0, please file a bug at https://github.com/olov/stringset/issues")}}var t=e?Object.create(null):{};var a=false;if(l(t)){t.__proto__=null;if(r(t)||l(t)){throw new Error("StringSet environment error 1, please file a bug at https://github.com/olov/stringset/issues")}a=true}return function(){var n=e?Object.create(null):{};if(a){n.__proto__=null}return n}}();function e(n){if(!(this instanceof e)){return new e(n)}this.obj=t();this.hasProto=false;if(n){this.addMany(n)}}e.prototype.has=function(e){if(typeof e!=="string"){throw new Error("StringSet expected string item")}return e==="__proto__"?this.hasProto:n.call(this.obj,e)};e.prototype.add=function(e){if(typeof e!=="string"){throw new Error("StringSet expected string item")}if(e==="__proto__"){this.hasProto=true}else{this.obj[e]=true}};e.prototype.remove=function(e){if(typeof e!=="string"){throw new Error("StringSet expected string item")}var n=this.has(e);if(e==="__proto__"){this.hasProto=false}else{delete this.obj[e]}return n};e.prototype["delete"]=e.prototype.remove;e.prototype.isEmpty=function(){for(var e in this.obj){if(n.call(this.obj,e)){return false}}return!this.hasProto};e.prototype.size=function(){var e=0;for(var t in this.obj){if(n.call(this.obj,t)){++e}}return this.hasProto?e+1:e};e.prototype.items=function(){var e=[];for(var t in this.obj){if(n.call(this.obj,t)){e.push(t)}}if(this.hasProto){e.push("__proto__")}return e};e.prototype.addMany=function(e){if(!Array.isArray(e)){throw new Error("StringSet expected array")}for(var n=0;n<e.length;n++){this.add(e[n])}return this};e.prototype.merge=function(e){this.addMany(e.items());return this};e.prototype.clone=function(){var n=e();return n.merge(this)};e.prototype.toString=function(){return"{"+this.items().map(JSON.stringify).join(",")+"}"};return e}();if(typeof e!=="undefined"&&typeof e.exports!=="undefined"){e.exports=n}},{}],166:[function(n,t,e){(function(t,n){"use strict";if(typeof define==="function"&&define.amd){define(["exports"],n)}else if(typeof e!=="undefined"){n(e)}else{n(t.esprima={})}})(this,function(En){"use strict";var o,A,bt,r,G,i,wn,kn,Rn,tn,s,v,e,h,g,y,l,c,a,f;o={BooleanLiteral:1,EOF:2,Identifier:3,Keyword:4,NullLiteral:5,NumericLiteral:6,Punctuator:7,StringLiteral:8,RegularExpression:9,Template:10,XJSIdentifier:11,XJSText:12};A={};A[o.BooleanLiteral]="Boolean";A[o.EOF]="<end>";A[o.Identifier]="Identifier";A[o.Keyword]="Keyword";A[o.NullLiteral]="Null";A[o.NumericLiteral]="Numeric";A[o.Punctuator]="Punctuator";A[o.StringLiteral]="String";A[o.XJSIdentifier]="XJSIdentifier";A[o.XJSText]="XJSText";A[o.RegularExpression]="RegularExpression";bt=["(","{","[","in","typeof","instanceof","new","return","case","delete","throw","void","=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","&=","|=","^=",",","+","-","*","/","%","++","--","<<",">>",">>>","&","|","^","!","~","&&","||","?",":","===","==",">=","<=","<",">","!=","!=="];r={AnyTypeAnnotation:"AnyTypeAnnotation",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrayTypeAnnotation:"ArrayTypeAnnotation",ArrowFunctionExpression:"ArrowFunctionExpression",AssignmentExpression:"AssignmentExpression",BinaryExpression:"BinaryExpression",BlockStatement:"BlockStatement",BooleanTypeAnnotation:"BooleanTypeAnnotation",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ClassImplements:"ClassImplements",ClassProperty:"ClassProperty",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DeclareClass:"DeclareClass",DeclareFunction:"DeclareFunction",DeclareModule:"DeclareModule",DeclareVariable:"DeclareVariable",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportDeclaration:"ExportDeclaration",ExportBatchSpecifier:"ExportBatchSpecifier",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",ForStatement:"ForStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",FunctionTypeAnnotation:"FunctionTypeAnnotation",FunctionTypeParam:"FunctionTypeParam",GenericTypeAnnotation:"GenericTypeAnnotation",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",InterfaceDeclaration:"InterfaceDeclaration",InterfaceExtends:"InterfaceExtends",IntersectionTypeAnnotation:"IntersectionTypeAnnotation",LabeledStatement:"LabeledStatement",Literal:"Literal",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",NullableTypeAnnotation:"NullableTypeAnnotation",NumberTypeAnnotation:"NumberTypeAnnotation",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",ObjectTypeAnnotation:"ObjectTypeAnnotation",ObjectTypeCallProperty:"ObjectTypeCallProperty",ObjectTypeIndexer:"ObjectTypeIndexer",ObjectTypeProperty:"ObjectTypeProperty",Program:"Program",Property:"Property",QualifiedTypeIdentifier:"QualifiedTypeIdentifier",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",SpreadProperty:"SpreadProperty",StringLiteralTypeAnnotation:"StringLiteralTypeAnnotation",StringTypeAnnotation:"StringTypeAnnotation",SwitchCase:"SwitchCase",SwitchStatement:"SwitchStatement",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TupleTypeAnnotation:"TupleTypeAnnotation",TryStatement:"TryStatement",TypeAlias:"TypeAlias",TypeAnnotation:"TypeAnnotation",TypeofTypeAnnotation:"TypeofTypeAnnotation",TypeParameterDeclaration:"TypeParameterDeclaration",TypeParameterInstantiation:"TypeParameterInstantiation",UnaryExpression:"UnaryExpression",UnionTypeAnnotation:"UnionTypeAnnotation",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",VoidTypeAnnotation:"VoidTypeAnnotation",WhileStatement:"WhileStatement",WithStatement:"WithStatement",XJSIdentifier:"XJSIdentifier",XJSNamespacedName:"XJSNamespacedName",XJSMemberExpression:"XJSMemberExpression",XJSEmptyExpression:"XJSEmptyExpression",XJSExpressionContainer:"XJSExpressionContainer",XJSElement:"XJSElement",XJSClosingElement:"XJSClosingElement",XJSOpeningElement:"XJSOpeningElement",XJSAttribute:"XJSAttribute",XJSSpreadAttribute:"XJSSpreadAttribute",XJSText:"XJSText",YieldExpression:"YieldExpression",AwaitExpression:"AwaitExpression"};G={Data:1,Get:2,Set:4};tn={"static":"static",prototype:"prototype"};i={UnexpectedToken:"Unexpected token %0",UnexpectedNumber:"Unexpected number",UnexpectedString:"Unexpected string",UnexpectedIdentifier:"Unexpected identifier",UnexpectedReserved:"Unexpected reserved word",UnexpectedTemplate:"Unexpected quasi %0",UnexpectedEOS:"Unexpected end of input",NewlineAfterThrow:"Illegal newline after throw",InvalidRegExp:"Invalid regular expression",UnterminatedRegExp:"Invalid regular expression: missing /",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInFormalsList:"Invalid left-hand side in formals list",InvalidLHSInForIn:"Invalid left-hand side in for-in",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NoCatchOrFinally:"Missing catch or finally after try",UnknownLabel:"Undefined label '%0'",Redeclaration:"%0 '%1' has already been declared",IllegalContinue:"Illegal continue statement",IllegalBreak:"Illegal break statement",IllegalDuplicateClassProperty:"Illegal duplicate property in class definition",IllegalReturn:"Illegal return statement",IllegalSpread:"Illegal spread element",StrictModeWith:"Strict mode code may not include a with statement",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictParamDupe:"Strict mode function may not have duplicate parameter names",ParameterAfterRestParameter:"Rest parameter must be final parameter of an argument list",DefaultRestParameter:"Rest parameter can not have a default value",ElementAfterSpreadElement:"Spread must be the final element of an element list",PropertyAfterSpreadProperty:"A rest property must be the final property of an object literal",ObjectPatternAsRestParameter:"Invalid rest parameter",ObjectPatternAsSpread:"Invalid spread argument",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictDuplicateProperty:"Duplicate data property in object literal not allowed in strict mode",AccessorDataProperty:"Object literal may not have data and accessor property with the same name",AccessorGetSet:"Object literal may not have multiple get/set accessors with the same name",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictReservedWord:"Use of future reserved word in strict mode",MissingFromClause:"Missing from clause",NoAsAfterImportNamespace:"Missing as after import *",InvalidModuleSpecifier:"Invalid module specifier",IllegalImportDeclaration:"Illegal import declaration",IllegalExportDeclaration:"Illegal export declaration",NoUnintializedConst:"Const must be initialized",ComprehensionRequiresBlock:"Comprehension must have at least one block",ComprehensionError:"Comprehension Error",EachNotAllowed:"Each is not supported",InvalidXJSAttributeValue:"XJS value should be either an expression or a quoted XJS text",ExpectedXJSClosingTag:"Expected corresponding XJS closing tag for %0",AdjacentXJSElements:"Adjacent XJS elements must be wrapped in an enclosing tag",ConfusedAboutFunctionType:"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"};wn={NonAsciiIdentifierStart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),NonAsciiIdentifierPart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԧԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠࢢ-ࢬࣤ-ࣾऀ-ॣ०-९ॱ-ॷॹ-ॿঁ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఁ-ఃఅ-ఌఎ-ఐఒ-నప-ళవ-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಂಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲംഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤜᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶᴀ-ᷦ᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺꩻꪀ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︦︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),LeadingZeros:new RegExp("^0+(?!$)")};function J(e,n){if(!e){throw new Error("ASSERT: "+n)}}function O(){this.$data={}}O.prototype.get=function(e){e="$"+e;return this.$data[e]};O.prototype.set=function(e,n){e="$"+e;this.$data[e]=n;return this};O.prototype.has=function(e){e="$"+e;return Object.prototype.hasOwnProperty.call(this.$data,e)};O.prototype["delete"]=function(e){e="$"+e;return delete this.$data[e]};function B(e){return e>=48&&e<=57}function Un(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function X(e){return"01234567".indexOf(e)>=0}function gt(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&" ".indexOf(String.fromCharCode(e))>0}function T(e){return e===10||e===13||e===8232||e===8233}function W(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&wn.NonAsciiIdentifierStart.test(String.fromCharCode(e))}function an(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&wn.NonAsciiIdentifierPart.test(String.fromCharCode(e))}function jr(e){switch(e){case"class":case"enum":case"export":case"extends":case"import":case"super":return true;default:return false}}function ln(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return true;default:return false}}function L(e){return e==="eval"||e==="arguments"}function Kr(e){if(v&&ln(e)){return true}switch(e.length){case 2:return e==="if"||e==="in"||e==="do";case 3:return e==="var"||e==="for"||e==="new"||e==="try"||e==="let";case 4:return e==="this"||e==="else"||e==="case"||e==="void"||e==="with"||e==="enum";case 5:return e==="while"||e==="break"||e==="catch"||e==="throw"||e==="const"||e==="class"||e==="super";case 6:return e==="return"||e==="typeof"||e==="delete"||e==="switch"||e==="export"||e==="import";case 7:return e==="default"||e==="finally"||e==="extends";case 8:return e==="function"||e==="continue"||e==="debugger";case 10:return e==="instanceof";default:return false}}function N(){var n,t,r;t=false;r=false;while(e<y){n=s.charCodeAt(e);if(r){++e;if(T(n)){r=false;if(n===13&&s.charCodeAt(e)===10){++e}++h;g=e}}else if(t){if(T(n)){if(n===13){++e}if(n!==13||s.charCodeAt(e)===10){++h;++e;g=e;if(e>=y){d({},i.UnexpectedToken,"ILLEGAL")}}}else{n=s.charCodeAt(e++);if(e>=y){d({},i.UnexpectedToken,"ILLEGAL")}if(n===42){n=s.charCodeAt(e);if(n===47){++e;t=false}}}}else if(n===47){n=s.charCodeAt(e+1);if(n===47){e+=2;r=true}else if(n===42){e+=2;t=true;if(e>=y){d({},i.UnexpectedToken,"ILLEGAL")}}else{break}}else if(gt(n)){++e}else if(T(n)){++e;if(n===13&&s.charCodeAt(e)===10){++e}++h;g=e}else{break}}}function pn(a){var n,r,l,t=0;r=a==="u"?4:2;for(n=0;n<r;++n){if(e<y&&Un(s[e])){l=s[e++];t=t*16+"0123456789abcdef".indexOf(l.toLowerCase())}else{return""}}return String.fromCharCode(t)}function mt(){var t,n,r,l;t=s[e];n=0;if(t==="}"){d({},i.UnexpectedToken,"ILLEGAL")}while(e<y){t=s[e++];if(!Un(t)){break}n=n*16+"0123456789abcdef".indexOf(t.toLowerCase())}if(n>1114111||t!=="}"){d({},i.UnexpectedToken,"ILLEGAL")}if(n<=65535){return String.fromCharCode(n)}r=(n-65536>>10)+55296;l=(n-65536&1023)+56320;return String.fromCharCode(r,l)}function dt(){var n,t;n=s.charCodeAt(e++);t=String.fromCharCode(n);if(n===92){if(s.charCodeAt(e)!==117){d({},i.UnexpectedToken,"ILLEGAL")}++e;n=pn("u");if(!n||n==="\\"||!W(n.charCodeAt(0))){d({},i.UnexpectedToken,"ILLEGAL")}t=n}while(e<y){n=s.charCodeAt(e);if(!an(n)){break}++e;t+=String.fromCharCode(n);if(n===92){t=t.substr(0,t.length-1);if(s.charCodeAt(e)!==117){d({},i.UnexpectedToken,"ILLEGAL")}++e;n=pn("u");if(!n||n==="\\"||!an(n.charCodeAt(0))){d({},i.UnexpectedToken,"ILLEGAL")}t+=n}}return t}function sr(){var n,t;n=e++;while(e<y){t=s.charCodeAt(e);if(t===92){e=n;return dt()}if(an(t)){++e}else{break}}return s.slice(n,e)}function gr(){var r,n,t;r=e;n=s.charCodeAt(e)===92?dt():sr();if(n.length===1){t=o.Identifier}else if(Kr(n)){t=o.Keyword}else if(n==="null"){t=o.NullLiteral}else if(n==="true"||n==="false"){t=o.BooleanLiteral}else{t=o.Identifier}return{type:t,value:n,lineNumber:h,lineStart:g,range:[r,e]}}function U(){var n=e,l=s.charCodeAt(e),c,t=s[e],r,u,p;switch(l){case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:++e;if(f.tokenize){if(l===40){f.openParenToken=f.tokens.length}else if(l===123){f.openCurlyToken=f.tokens.length}}return{type:o.Punctuator,value:String.fromCharCode(l),lineNumber:h,lineStart:g,range:[n,e]};default:c=s.charCodeAt(e+1);if(c===61){switch(l){case 37:case 38:case 42:case 43:case 45:case 47:case 60:case 62:case 94:case 124:e+=2;return{type:o.Punctuator,value:String.fromCharCode(l)+String.fromCharCode(c),lineNumber:h,lineStart:g,range:[n,e]};case 33:case 61:e+=2;if(s.charCodeAt(e)===61){++e}return{type:o.Punctuator,value:s.slice(n,e),lineNumber:h,lineStart:g,range:[n,e]};default:break}}break}r=s[e+1];u=s[e+2];p=s[e+3];if(t===">"&&r===">"&&u===">"){if(p==="="){e+=4;return{type:o.Punctuator,value:">>>=",lineNumber:h,lineStart:g,range:[n,e]}}}if(t===">"&&r===">"&&u===">"){e+=3;return{type:o.Punctuator,value:">>>",lineNumber:h,lineStart:g,range:[n,e]}}if(t==="<"&&r==="<"&&u==="="){e+=3;return{type:o.Punctuator,value:"<<=",lineNumber:h,lineStart:g,range:[n,e]}}if(t===">"&&r===">"&&u==="="){e+=3;return{type:o.Punctuator,value:">>=",lineNumber:h,lineStart:g,range:[n,e]}}if(t==="."&&r==="."&&u==="."){e+=3;return{type:o.Punctuator,value:"...",lineNumber:h,lineStart:g,range:[n,e]}}if(t===r&&"+-<>&|".indexOf(t)>=0&&!a.inType){e+=2;return{type:o.Punctuator,value:t+r,lineNumber:h,lineStart:g,range:[n,e]}}if(t==="="&&r===">"){e+=2;return{type:o.Punctuator,value:"=>",lineNumber:h,lineStart:g,range:[n,e]}}if("<>=!+-*%&|^/".indexOf(t)>=0){++e;return{type:o.Punctuator,value:t,lineNumber:h,lineStart:g,range:[n,e]}}if(t==="."){++e;return{type:o.Punctuator,value:t,lineNumber:h,lineStart:g,range:[n,e]}}d({},i.UnexpectedToken,"ILLEGAL")}function Ur(t){var n="";while(e<y){if(!Un(s[e])){break}n+=s[e++]}if(n.length===0){d({},i.UnexpectedToken,"ILLEGAL")}if(W(s.charCodeAt(e))){d({},i.UnexpectedToken,"ILLEGAL")}return{type:o.NumericLiteral,value:parseInt("0x"+n,16),lineNumber:h,lineStart:g,range:[t,e]}}function Yr(r,l){var n,t;if(X(r)){t=true;n="0"+s[e++]}else{t=false;++e;n=""}while(e<y){if(!X(s[e])){break}n+=s[e++]}if(!t&&n.length===0){d({},i.UnexpectedToken,"ILLEGAL")}if(W(s.charCodeAt(e))||B(s.charCodeAt(e))){d({},i.UnexpectedToken,"ILLEGAL")}return{type:o.NumericLiteral,value:parseInt(n,8),octal:t,lineNumber:h,lineStart:g,range:[l,e]}}function ft(){var t,r,n,l;n=s[e];J(B(n.charCodeAt(0))||n===".","Numeric literal must start with a decimal digit or a decimal point");r=e;t="";if(n!=="."){t=s[e++];n=s[e];if(t==="0"){if(n==="x"||n==="X"){++e;return Ur(r)}if(n==="b"||n==="B"){++e;t="";while(e<y){n=s[e];if(n!=="0"&&n!=="1"){break}t+=s[e++]}if(t.length===0){d({},i.UnexpectedToken,"ILLEGAL")}if(e<y){n=s.charCodeAt(e);if(W(n)||B(n)){d({},i.UnexpectedToken,"ILLEGAL")}}return{type:o.NumericLiteral,value:parseInt(t,2),lineNumber:h,lineStart:g,range:[r,e]}}if(n==="o"||n==="O"||X(n)){return Yr(n,r)}if(n&&B(n.charCodeAt(0))){d({},i.UnexpectedToken,"ILLEGAL")}}while(B(s.charCodeAt(e))){t+=s[e++]}n=s[e]}if(n==="."){t+=s[e++];while(B(s.charCodeAt(e))){t+=s[e++]}n=s[e]}if(n==="e"||n==="E"){t+=s[e++];n=s[e];if(n==="+"||n==="-"){t+=s[e++]}if(B(s.charCodeAt(e))){while(B(s.charCodeAt(e))){t+=s[e++]}}else{d({},i.UnexpectedToken,"ILLEGAL")}}if(W(s.charCodeAt(e))){d({},i.UnexpectedToken,"ILLEGAL")}return{type:o.NumericLiteral,value:parseFloat(t),lineNumber:h,lineStart:g,range:[r,e]}}function Pt(){var t="",l,c,n,r,a,f,u=false;l=s[e];J(l==="'"||l==='"',"String literal must starts with a quote");c=e;++e;while(e<y){n=s[e++];if(n===l){l="";break}else if(n==="\\"){n=s[e++];if(!n||!T(n.charCodeAt(0))){switch(n){case"n":t+="\n";
break;case"r":t+="\r";break;case"t":t+=" ";break;case"u":case"x":if(s[e]==="{"){++e;t+=mt()}else{f=e;a=pn(n);if(a){t+=a}else{e=f;t+=n}}break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="";break;default:if(X(n)){r="01234567".indexOf(n);if(r!==0){u=true}if(e<y&&X(s[e])){u=true;r=r*8+"01234567".indexOf(s[e++]);if("0123".indexOf(n)>=0&&e<y&&X(s[e])){r=r*8+"01234567".indexOf(s[e++])}}t+=String.fromCharCode(r)}else{t+=n}break}}else{++h;if(n==="\r"&&s[e]==="\n"){++e}g=e}}else if(T(n.charCodeAt(0))){break}else{t+=n}}if(l!==""){d({},i.UnexpectedToken,"ILLEGAL")}return{type:o.StringLiteral,value:t,octal:u,lineNumber:h,lineStart:g,range:[c,e]}}function st(){var t="",n,u,l,a,p,c,r,f;l=false;a=false;u=e;++e;while(e<y){n=s[e++];if(n==="`"){a=true;l=true;break}else if(n==="$"){if(s[e]==="{"){++e;l=true;break}t+=n}else if(n==="\\"){n=s[e++];if(!T(n.charCodeAt(0))){switch(n){case"n":t+="\n";break;case"r":t+="\r";break;case"t":t+=" ";break;case"u":case"x":if(s[e]==="{"){++e;t+=mt()}else{p=e;c=pn(n);if(c){t+=c}else{e=p;t+=n}}break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="";break;default:if(X(n)){r="01234567".indexOf(n);if(r!==0){f=true}if(e<y&&X(s[e])){f=true;r=r*8+"01234567".indexOf(s[e++]);if("0123".indexOf(n)>=0&&e<y&&X(s[e])){r=r*8+"01234567".indexOf(s[e++])}}t+=String.fromCharCode(r)}else{t+=n}break}}else{++h;if(n==="\r"&&s[e]==="\n"){++e}g=e}}else if(T(n.charCodeAt(0))){++h;if(n==="\r"&&s[e]==="\n"){++e}g=e;t+="\n"}else{t+=n}}if(!l){d({},i.UnexpectedToken,"ILLEGAL")}return{type:o.Template,value:{cooked:t,raw:s.slice(u+1,e-(a?1:2))},tail:a,octal:f,lineNumber:h,lineStart:g,range:[u,e]}}function Jt(r){var n,t;c=null;N();n=r.head?"`":"}";if(s[e]!==n){d({},i.UnexpectedToken,"ILLEGAL")}t=st();mn();return t}function F(){var t,n,v,l,r,a,m=false,u,x=false,p;c=null;N();v=e;n=s[e];J(n==="/","Regular expression literal must start with a slash");t=s[e++];while(e<y){n=s[e++];t+=n;if(m){if(n==="]"){m=false}}else{if(n==="\\"){n=s[e++];if(T(n.charCodeAt(0))){d({},i.UnterminatedRegExp)}t+=n}else if(n==="/"){x=true;break}else if(n==="["){m=true}else if(T(n.charCodeAt(0))){d({},i.UnterminatedRegExp)}}}if(!x){d({},i.UnterminatedRegExp)}l=t.substr(1,t.length-2);r="";while(e<y){n=s[e];if(!an(n.charCodeAt(0))){break}++e;if(n==="\\"&&e<y){n=s[e];if(n==="u"){++e;u=e;n=pn("u");if(n){r+=n;for(t+="\\u";u<e;++u){t+=s[u]}}else{e=u;r+="u";t+="\\u"}E({},i.UnexpectedToken,"ILLEGAL")}else{t+="\\"}}else{r+=n;t+=n}}p=l;if(r.indexOf("u")>=0){p=p.replace(/\\u\{([0-9a-fA-F]+)\}/g,function(n,e){if(parseInt(e,16)<=1114111){return"x"}d({},i.InvalidRegExp)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x")}try{a=new RegExp(p)}catch(b){d({},i.InvalidRegExp)}try{a=new RegExp(l,r)}catch(w){a=null}if(f.tokenize){return{type:o.RegularExpression,value:a,regex:{pattern:l,flags:r},lineNumber:h,lineStart:g,range:[v,e]}}return{literal:t,value:a,regex:{pattern:l,flags:r},range:[v,e]}}function Dn(e){return e.type===o.Identifier||e.type===o.Keyword||e.type===o.BooleanLiteral||e.type===o.NullLiteral}function kr(){var n,e;n=f.tokens[f.tokens.length-1];if(!n){return F()}if(n.type==="Punctuator"){if(n.value===")"){e=f.tokens[f.openParenToken-1];if(e&&e.type==="Keyword"&&(e.value==="if"||e.value==="while"||e.value==="for"||e.value==="with")){return F()}return U()}if(n.value==="}"){if(f.tokens[f.openCurlyToken-3]&&f.tokens[f.openCurlyToken-3].type==="Keyword"){e=f.tokens[f.openCurlyToken-4];if(!e){return U()}}else if(f.tokens[f.openCurlyToken-4]&&f.tokens[f.openCurlyToken-4].type==="Keyword"){e=f.tokens[f.openCurlyToken-5];if(!e){return F()}}else{return U()}if(bt.indexOf(e.value)>=0){return U()}return F()}return F()}if(n.type==="Keyword"){return F()}return U()}function en(){var n;if(!a.inXJSChild){N()}if(e>=y){return{type:o.EOF,lineNumber:h,lineStart:g,range:[e,e]}}if(a.inXJSChild){return Pr()}n=s.charCodeAt(e);if(n===40||n===41||n===58){return U()}if(n===39||n===34){if(a.inXJSTag){return Lr()}return Pt()}if(a.inXJSTag&&Ir(n)){return Cr()}if(n===96){return st()}if(W(n)){return gr()}if(n===46){if(B(s.charCodeAt(e+1))){return ft()}return U()}if(B(n)){return ft()}if(f.tokenize&&n===47){return kr()}return U()}function m(){var n;n=c;e=n.range[1];h=n.lineNumber;g=n.lineStart;c=en();e=n.range[1];h=n.lineNumber;g=n.lineStart;return n}function mn(){var n,t,r;n=e;t=h;r=g;c=en();e=n;h=t;g=r}function P(){var n,t,r,l,a;n=typeof f.advance==="function"?f.advance:en;t=e;r=h;l=g;if(c===null){c=n()}e=c.range[1];h=c.lineNumber;g=c.lineStart;a=n();e=t;h=r;g=l;return a}function dn(n){e=n.range[0];h=n.lineNumber;g=n.lineStart;c=n}function p(){if(!f.loc&&!f.range){return undefined}N();return{offset:e,line:h,col:e-g}}function it(){if(!f.loc&&!f.range){return undefined}return{offset:e,line:h,col:e-g}}function rr(e){var t,l,a=f.bottomRightStack,n=a[a.length-1];if(e.type===r.Program){if(e.body.length>0){return}}if(f.trailingComments.length>0){if(f.trailingComments[0].range[0]>=e.range[1]){l=f.trailingComments;f.trailingComments=[]}else{f.trailingComments.length=0}}else{if(n&&n.trailingComments&&n.trailingComments[0].range[0]>=e.range[1]){l=n.trailingComments;delete n.trailingComments}}if(n){while(n&&n.range[0]>=e.range[0]){t=n;n=a.pop()}}if(t){if(t.leadingComments&&t.leadingComments[t.leadingComments.length-1].range[1]<=e.range[0]){e.leadingComments=t.leadingComments;delete t.leadingComments}}else if(f.leadingComments.length>0&&f.leadingComments[f.leadingComments.length-1].range[1]<=e.range[0]){e.leadingComments=f.leadingComments;f.leadingComments=[]}if(l){e.trailingComments=l}a.push(e)}function t(t,n){if(f.range){n.range=[t.offset,e]}if(f.loc){n.loc={start:{line:t.line,column:t.col},end:{line:h,column:e-g}};n=l.postProcess(n)}if(f.attachComment){rr(n)}return n}kn={name:"SyntaxTree",postProcess:function(e){return e},createArrayExpression:function(e){return{type:r.ArrayExpression,elements:e}},createAssignmentExpression:function(e,n,t){return{type:r.AssignmentExpression,operator:e,left:n,right:t}},createBinaryExpression:function(e,n,t){var l=e==="||"||e==="&&"?r.LogicalExpression:r.BinaryExpression;return{type:l,operator:e,left:n,right:t}},createBlockStatement:function(e){return{type:r.BlockStatement,body:e}},createBreakStatement:function(e){return{type:r.BreakStatement,label:e}},createCallExpression:function(e,n){return{type:r.CallExpression,callee:e,arguments:n}},createCatchClause:function(e,n){return{type:r.CatchClause,param:e,body:n}},createConditionalExpression:function(e,n,t){return{type:r.ConditionalExpression,test:e,consequent:n,alternate:t}},createContinueStatement:function(e){return{type:r.ContinueStatement,label:e}},createDebuggerStatement:function(){return{type:r.DebuggerStatement}},createDoWhileStatement:function(e,n){return{type:r.DoWhileStatement,body:e,test:n}},createEmptyStatement:function(){return{type:r.EmptyStatement}},createExpressionStatement:function(e){return{type:r.ExpressionStatement,expression:e}},createForStatement:function(e,n,t,l){return{type:r.ForStatement,init:e,test:n,update:t,body:l}},createForInStatement:function(e,n,t){return{type:r.ForInStatement,left:e,right:n,body:t,each:false}},createForOfStatement:function(e,n,t){return{type:r.ForOfStatement,left:e,right:n,body:t}},createFunctionDeclaration:function(n,i,t,l,a,f,s,o,u,c){var e={type:r.FunctionDeclaration,id:n,params:i,defaults:t,body:l,rest:a,generator:f,expression:s,returnType:u,typeParameters:c};if(o){e.async=true}return e},createFunctionExpression:function(n,i,t,l,a,f,s,o,u,c){var e={type:r.FunctionExpression,id:n,params:i,defaults:t,body:l,rest:a,generator:f,expression:s,returnType:u,typeParameters:c};if(o){e.async=true}return e},createIdentifier:function(e){return{type:r.Identifier,name:e,typeAnnotation:undefined,optional:undefined}},createTypeAnnotation:function(e){return{type:r.TypeAnnotation,typeAnnotation:e}},createFunctionTypeAnnotation:function(e,n,t,l){return{type:r.FunctionTypeAnnotation,params:e,returnType:n,rest:t,typeParameters:l}},createFunctionTypeParam:function(e,n,t){return{type:r.FunctionTypeParam,name:e,typeAnnotation:n,optional:t}},createNullableTypeAnnotation:function(e){return{type:r.NullableTypeAnnotation,typeAnnotation:e}},createArrayTypeAnnotation:function(e){return{type:r.ArrayTypeAnnotation,elementType:e}},createGenericTypeAnnotation:function(e,n){return{type:r.GenericTypeAnnotation,id:e,typeParameters:n}},createQualifiedTypeIdentifier:function(e,n){return{type:r.QualifiedTypeIdentifier,qualification:e,id:n}},createTypeParameterDeclaration:function(e){return{type:r.TypeParameterDeclaration,params:e}},createTypeParameterInstantiation:function(e){return{type:r.TypeParameterInstantiation,params:e}},createAnyTypeAnnotation:function(){return{type:r.AnyTypeAnnotation}},createBooleanTypeAnnotation:function(){return{type:r.BooleanTypeAnnotation}},createNumberTypeAnnotation:function(){return{type:r.NumberTypeAnnotation}},createStringTypeAnnotation:function(){return{type:r.StringTypeAnnotation}},createStringLiteralTypeAnnotation:function(e){return{type:r.StringLiteralTypeAnnotation,value:e.value,raw:s.slice(e.range[0],e.range[1])}},createVoidTypeAnnotation:function(){return{type:r.VoidTypeAnnotation}},createTypeofTypeAnnotation:function(e){return{type:r.TypeofTypeAnnotation,argument:e}},createTupleTypeAnnotation:function(e){return{type:r.TupleTypeAnnotation,types:e}},createObjectTypeAnnotation:function(e,n,t){return{type:r.ObjectTypeAnnotation,properties:e,indexers:n,callProperties:t}},createObjectTypeIndexer:function(e,n,t,l){return{type:r.ObjectTypeIndexer,id:e,key:n,value:t,"static":l}},createObjectTypeCallProperty:function(e,n){return{type:r.ObjectTypeCallProperty,value:e,"static":n}},createObjectTypeProperty:function(e,n,t,l){return{type:r.ObjectTypeProperty,key:e,value:n,optional:t,"static":l}},createUnionTypeAnnotation:function(e){return{type:r.UnionTypeAnnotation,types:e}},createIntersectionTypeAnnotation:function(e){return{type:r.IntersectionTypeAnnotation,types:e}},createTypeAlias:function(e,n,t){return{type:r.TypeAlias,id:e,typeParameters:n,right:t}},createInterface:function(e,n,t,l){return{type:r.InterfaceDeclaration,id:e,typeParameters:n,body:t,"extends":l}},createInterfaceExtends:function(e,n){return{type:r.InterfaceExtends,id:e,typeParameters:n}},createDeclareFunction:function(e){return{type:r.DeclareFunction,id:e}},createDeclareVariable:function(e){return{type:r.DeclareVariable,id:e}},createDeclareModule:function(e,n){return{type:r.DeclareModule,id:e,body:n}},createXJSAttribute:function(e,n){return{type:r.XJSAttribute,name:e,value:n||null}},createXJSSpreadAttribute:function(e){return{type:r.XJSSpreadAttribute,argument:e}},createXJSIdentifier:function(e){return{type:r.XJSIdentifier,name:e}},createXJSNamespacedName:function(e,n){return{type:r.XJSNamespacedName,namespace:e,name:n}},createXJSMemberExpression:function(e,n){return{type:r.XJSMemberExpression,object:e,property:n}},createXJSElement:function(e,n,t){return{type:r.XJSElement,openingElement:e,closingElement:n,children:t}},createXJSEmptyExpression:function(){return{type:r.XJSEmptyExpression}},createXJSExpressionContainer:function(e){return{type:r.XJSExpressionContainer,expression:e}},createXJSOpeningElement:function(e,n,t){return{type:r.XJSOpeningElement,name:e,selfClosing:t,attributes:n}},createXJSClosingElement:function(e){return{type:r.XJSClosingElement,name:e}},createIfStatement:function(e,n,t){return{type:r.IfStatement,test:e,consequent:n,alternate:t}},createLabeledStatement:function(e,n){return{type:r.LabeledStatement,label:e,body:n}},createLiteral:function(e){var n={type:r.Literal,value:e.value,raw:s.slice(e.range[0],e.range[1])};if(e.regex){n.regex=e.regex}return n},createMemberExpression:function(e,n,t){return{type:r.MemberExpression,computed:e==="[",object:n,property:t}},createNewExpression:function(e,n){return{type:r.NewExpression,callee:e,arguments:n}},createObjectExpression:function(e){return{type:r.ObjectExpression,properties:e}},createPostfixExpression:function(e,n){return{type:r.UpdateExpression,operator:e,argument:n,prefix:false}},createProgram:function(e){return{type:r.Program,body:e}},createProperty:function(e,n,t,l,a,i){return{type:r.Property,key:n,value:t,kind:e,method:l,shorthand:a,computed:i}},createReturnStatement:function(e){return{type:r.ReturnStatement,argument:e}},createSequenceExpression:function(e){return{type:r.SequenceExpression,expressions:e}},createSwitchCase:function(e,n){return{type:r.SwitchCase,test:e,consequent:n}},createSwitchStatement:function(e,n){return{type:r.SwitchStatement,discriminant:e,cases:n}},createThisExpression:function(){return{type:r.ThisExpression}},createThrowStatement:function(e){return{type:r.ThrowStatement,argument:e}},createTryStatement:function(e,n,t,l){return{type:r.TryStatement,block:e,guardedHandlers:n,handlers:t,finalizer:l}},createUnaryExpression:function(e,n){if(e==="++"||e==="--"){return{type:r.UpdateExpression,operator:e,argument:n,prefix:true}}return{type:r.UnaryExpression,operator:e,argument:n,prefix:true}},createVariableDeclaration:function(e,n){return{type:r.VariableDeclaration,declarations:e,kind:n}},createVariableDeclarator:function(e,n){return{type:r.VariableDeclarator,id:e,init:n}},createWhileStatement:function(e,n){return{type:r.WhileStatement,test:e,body:n}},createWithStatement:function(e,n){return{type:r.WithStatement,object:e,body:n}},createTemplateElement:function(e,n){return{type:r.TemplateElement,value:e,tail:n}},createTemplateLiteral:function(e,n){return{type:r.TemplateLiteral,quasis:e,expressions:n}},createSpreadElement:function(e){return{type:r.SpreadElement,argument:e}},createSpreadProperty:function(e){return{type:r.SpreadProperty,argument:e}},createTaggedTemplateExpression:function(e,n){return{type:r.TaggedTemplateExpression,tag:e,quasi:n}},createArrowFunctionExpression:function(n,t,l,a,i,s){var e={type:r.ArrowFunctionExpression,id:null,params:n,defaults:t,body:l,rest:a,generator:false,expression:i};if(s){e.async=true}return e},createMethodDefinition:function(e,n,t,l,a){return{type:r.MethodDefinition,key:t,value:l,kind:n,"static":e===tn.static,computed:a}},createClassProperty:function(e,n,t,l){return{type:r.ClassProperty,key:e,typeAnnotation:n,computed:t,"static":l}},createClassBody:function(e){return{type:r.ClassBody,body:e}},createClassImplements:function(e,n){return{type:r.ClassImplements,id:e,typeParameters:n}},createClassExpression:function(e,n,t,l,a,i){return{type:r.ClassExpression,id:e,superClass:n,body:t,typeParameters:l,superTypeParameters:a,"implements":i}},createClassDeclaration:function(e,n,t,l,a,i){return{type:r.ClassDeclaration,id:e,superClass:n,body:t,typeParameters:l,superTypeParameters:a,"implements":i}},createModuleSpecifier:function(e){return{type:r.ModuleSpecifier,value:e.value,raw:s.slice(e.range[0],e.range[1])}},createExportSpecifier:function(e,n){return{type:r.ExportSpecifier,id:e,name:n}},createExportBatchSpecifier:function(){return{type:r.ExportBatchSpecifier}},createImportDefaultSpecifier:function(e){return{type:r.ImportDefaultSpecifier,id:e}},createImportNamespaceSpecifier:function(e){return{type:r.ImportNamespaceSpecifier,id:e}},createExportDeclaration:function(e,n,t,l){return{type:r.ExportDeclaration,"default":!!e,declaration:n,specifiers:t,source:l}},createImportSpecifier:function(e,n){return{type:r.ImportSpecifier,id:e,name:n}},createImportDeclaration:function(e,n){return{type:r.ImportDeclaration,specifiers:e,source:n}},createYieldExpression:function(e,n){return{type:r.YieldExpression,argument:e,delegate:n}},createAwaitExpression:function(e){return{type:r.AwaitExpression,argument:e}},createComprehensionExpression:function(e,n,t){return{type:r.ComprehensionExpression,filter:e,blocks:n,body:t}}};function rn(){var t,n,r,l;t=e;n=h;r=g;N();l=h!==n;e=t;h=n;g=r;return l}function d(t,a){var n,l=Array.prototype.slice.call(arguments,2),r=a.replace(/%(\d)/g,function(n,e){J(e<l.length,"Message reference must be in range");return l[e]});if(typeof t.lineNumber==="number"){n=new Error("Line "+t.lineNumber+": "+r);n.index=t.range[0];n.lineNumber=t.lineNumber;n.column=t.range[0]-g+1}else{n=new Error("Line "+h+": "+r);n.index=e;n.lineNumber=h;n.column=e-g+1}n.description=r;throw n}function E(){try{d.apply(null,arguments)}catch(e){if(f.errors){f.errors.push(e)}else{throw e}}}function S(e){if(e.type===o.EOF){d(e,i.UnexpectedEOS)}if(e.type===o.NumericLiteral){d(e,i.UnexpectedNumber)}if(e.type===o.StringLiteral||e.type===o.XJSText){d(e,i.UnexpectedString)}if(e.type===o.Identifier){d(e,i.UnexpectedIdentifier)}if(e.type===o.Keyword){if(jr(e.value)){d(e,i.UnexpectedReserved)}else if(v&&ln(e.value)){E(e,i.StrictReservedWord);return}d(e,i.UnexpectedToken,e.value)}if(e.type===o.Template){d(e,i.UnexpectedTemplate,e.value.raw)}d(e,i.UnexpectedToken,e.value)}function u(n){var e=m();if(e.type!==o.Punctuator||e.value!==n){S(e)}}function x(n,t){var e=m();if(e.type!==(t?o.Identifier:o.Keyword)||e.value!==n){S(e)}}function V(e){return x(e,true)}function n(e){return c.type===o.Punctuator&&c.value===e}function b(e,n){var t=n?o.Identifier:o.Keyword;return c.type===t&&c.value===e}function _(e){return b(e,true)}function lr(){var e;if(c.type!==o.Punctuator){return false}e=c.value;return e==="="||e==="*="||e==="/="||e==="%="||e==="+="||e==="-="||e==="<<="||e===">>="||e===">>>="||e==="&="||e==="^="||e==="|="}function ir(){return a.yieldAllowed&&b("yield",!v)}function un(){var n=c,e=false;if(_("async")){m();e=!rn();dn(n)}return e}function or(){return a.awaitAllowed&&_("await")}function k(){var t,r=e,l=h,a=g,i=c;if(s.charCodeAt(e)===59){m();return}t=h;N();if(h!==t){e=r;h=l;g=a;c=i;return}if(n(";")){m();return}if(c.type!==o.EOF&&!n("}")){S(c)}}function gn(e){return e.type===r.Identifier||e.type===r.MemberExpression}function Tr(e){return gn(e)||e.type===r.ObjectPattern||e.type===r.ArrayPattern}function yn(){var a=[],s=[],h=null,e,f=true,y,g=p();u("[");while(!n("]")){if(c.value==="for"&&c.type===o.Keyword){if(!f){d({},i.ComprehensionError)}b("for");e=Zn({ignoreBody:true});e.of=e.type===r.ForOfStatement;e.type=r.ComprehensionBlock;if(e.left.kind){d({},i.ComprehensionError)}s.push(e)}else if(c.value==="if"&&c.type===o.Keyword){if(!f){d({},i.ComprehensionError)}x("if");u("(");h=w();u(")")}else if(c.value===","&&c.type===o.Punctuator){f=false;m();a.push(null)}else{e=jn();a.push(e);if(e&&e.type===r.SpreadElement){if(!n("]")){d({},i.ElementAfterSpreadElement)}}else if(!(n("]")||b("for")||b("if"))){u(",");f=false}}}u("]");if(h&&!s.length){d({},i.ComprehensionRequiresBlock)}if(s.length){if(a.length!==1){d({},i.ComprehensionError)}return t(g,l.createComprehensionExpression(h,s,a[0]))}return t(g,l.createArrayExpression(a))}function cn(e){var o,u,c,n,f,s,d=p();o=v;u=a.yieldAllowed;a.yieldAllowed=e.generator;c=a.awaitAllowed;a.awaitAllowed=e.async;n=e.params||[];f=e.defaults||[];s=nt();if(e.name&&v&&L(n[0].name)){E(e.name,i.StrictParamName)}v=o;a.yieldAllowed=u;a.awaitAllowed=c;return t(d,l.createFunctionExpression(null,n,f,s,e.rest||null,e.generator,s.type!==r.BlockStatement,e.async,e.returnType,e.typeParameters))}function Z(n){var t,e,r;t=v;v=true;e=hn();if(e.stricted){E(e.stricted,e.message)}r=cn({params:e.params,defaults:e.defaults,rest:e.rest,generator:n.generator,async:n.async,returnType:e.returnType,typeParameters:n.typeParameters});v=t;return r}function M(){var n=p(),e=m(),r,a;if(e.type===o.StringLiteral||e.type===o.NumericLiteral){if(v&&e.octal){E(e,i.StrictOctalLiteral)}return t(n,l.createLiteral(e))}if(e.type===o.Punctuator&&e.value==="["){n=p();r=R();a=t(n,r);u("]");return a}return t(n,l.createIdentifier(e.value))}function Zr(){var r,a,f,g,h,y,e,i=p(),d,s;r=c;e=r.value==="["&&r.type===o.Punctuator;if(r.type===o.Identifier||e||un()){f=M();if(n(":")){m();return t(i,l.createProperty("init",f,R(),false,false,e))}if(n("(")||n("<")){if(n("<")){s=C()}return t(i,l.createProperty("init",f,Z({generator:false,async:false,typeParameters:s}),true,false,e))}if(r.value==="get"){e=c.value==="[";a=M();u("(");u(")");if(n(":")){d=D()}return t(i,l.createProperty("get",a,cn({generator:false,async:false,returnType:d}),false,false,e))}if(r.value==="set"){e=c.value==="[";a=M();u("(");r=c;h=[Q()];u(")");if(n(":")){d=D()}return t(i,l.createProperty("set",a,cn({params:h,generator:false,async:false,name:r,returnType:d}),false,false,e))}if(r.value==="async"){e=c.value==="[";a=M();if(n("<")){s=C()}return t(i,l.createProperty("init",a,Z({generator:false,async:true,typeParameters:s}),true,false,e))}if(e){S(c)}return t(i,l.createProperty("init",f,f,false,true,false))}if(r.type===o.EOF||r.type===o.Punctuator){if(!n("*")){S(r)}m();e=c.type===o.Punctuator&&c.value==="[";f=M();if(n("<")){s=C()}if(!n("(")){S(m())}return t(i,l.createProperty("init",f,Z({generator:true,typeParameters:s}),true,false,e))}a=M();if(n(":")){m();return t(i,l.createProperty("init",a,R(),false,false,false))}if(n("(")||n("<")){if(n("<")){s=C()}return t(i,l.createProperty("init",a,Z({generator:false,typeParameters:s}),true,false,false))}S(m())}function ll(){var e=p();u("...");return t(e,l.createSpreadProperty(R()))}function At(e){var n=String;if(e.type===r.Identifier){return e.name}return n(e.value)}function _n(){var f=[],e,s,a,o,c=new O,d=p(),m=String;u("{");while(!n("}")){if(n("...")){e=ll()}else{e=Zr();if(e.key.type===r.Identifier){s=e.key.name}else{s=m(e.key.value)}a=e.kind==="init"?G.Data:e.kind==="get"?G.Get:G.Set;if(c.has(s)){o=c.get(s);if(o===G.Data){if(v&&a===G.Data){E({},i.StrictDuplicateProperty)}else if(a!==G.Data){E({},i.AccessorDataProperty)}}else{if(a===G.Data){E({},i.AccessorDataProperty)}else if(o&a){E({},i.AccessorGetSet)}}c.set(s,o|a)}else{c.set(s,a)}}f.push(e);if(!n("}")){u(",")}}u("}");return t(d,l.createObjectExpression(f))}function at(n){var r=p(),e=Jt(n);if(v&&e.octal){d(e,i.StrictOctalLiteral)}return t(r,l.createTemplateElement({raw:e.value.raw,cooked:e.value.cooked},e.tail))}function Cn(){var e,n,r,a=p();e=at({head:true});n=[e];r=[];while(!e.tail){r.push(w());e=at({head:false});n.push(e)}return t(a,l.createTemplateLiteral(n,r))}function nr(){var e;u("(");++a.parenthesizedCount;e=w();u(")");return e}function lt(){var e;if(un()){e=P();if(e.type===o.Keyword&&e.value==="function"){return true}}return false}function rt(){var e,r,a,s;r=c.type;if(r===o.Identifier){e=p();return t(e,l.createIdentifier(m().value))}if(r===o.StringLiteral||r===o.NumericLiteral){if(v&&c.octal){E(c,i.StrictOctalLiteral)}e=p();return t(e,l.createLiteral(m()))}if(r===o.Keyword){if(b("this")){e=p();m();return t(e,l.createThisExpression())}if(b("function")){return On()}if(b("class")){return ct()}if(b("super")){e=p();m();return t(e,l.createIdentifier("super"))}}if(r===o.BooleanLiteral){e=p();a=m();a.value=a.value==="true";return t(e,l.createLiteral(a))}if(r===o.NullLiteral){e=p();a=m();a.value=null;return t(e,l.createLiteral(a))}if(n("[")){return yn()}if(n("{")){return _n()}if(n("(")){return nr()}if(n("/")||n("/=")){e=p();s=l.createLiteral(F());mn();return t(e,s)}if(r===o.Template){return Cn()}if(n("<")){return Mn()}S(m())}function tt(){var l=[],t;u("(");if(!n(")")){while(e<y){t=jn();l.push(t);if(n(")")){break}else if(t.type===r.SpreadElement){d({},i.ElementAfterSpreadElement)}u(",")}}u(")");return l}function jn(){if(n("...")){var e=p();m();return t(e,l.createSpreadElement(R()))}return R()}function H(){var n=p(),e=m();if(!Dn(e)){S(e)}return t(n,l.createIdentifier(e.value))}function et(){u(".");return H()}function $n(){var e;u("[");e=w();u("]");return e}function Yn(){var e,r,a=p();x("new");e=Dr();r=n("(")?tt():[];return t(a,l.createNewExpression(e,r))}function Fn(){var e,a,r=p();e=b("new")?Yn():rt();while(n(".")||n("[")||n("(")||c.type===o.Template){if(n("(")){a=tt();e=t(r,l.createCallExpression(e,a))}else if(n("[")){e=t(r,l.createMemberExpression("[",e,$n()))}else if(n(".")){e=t(r,l.createMemberExpression(".",e,et()))}else{e=t(r,l.createTaggedTemplateExpression(e,Cn()))}}return e}function Dr(){var e,r=p();e=b("new")?Yn():rt();while(n(".")||n("[")||c.type===o.Template){if(n("[")){e=t(r,l.createMemberExpression("[",e,$n()))}else if(n(".")){e=t(r,l.createMemberExpression(".",e,et()))}else{e=t(r,l.createTaggedTemplateExpression(e,Cn()))}}return e}function zn(){var s=p(),e=Fn(),a;if(c.type!==o.Punctuator){return e}if((n("++")||n("--"))&&!rn()){if(v&&e.type===r.Identifier&&L(e.name)){E({},i.StrictLHSPostfix)}if(!gn(e)){d({},i.InvalidLHSInAssignment)}a=m();e=t(s,l.createPostfixExpression(a.value,e))}return e}function K(){var a,s,e;if(c.type!==o.Punctuator&&c.type!==o.Keyword){return zn()}if(n("++")||n("--")){a=p();s=m();e=K();if(v&&e.type===r.Identifier&&L(e.name)){E({},i.StrictLHSPrefix)}if(!gn(e)){d({},i.InvalidLHSInAssignment)}return t(a,l.createUnaryExpression(s.value,e))}if(n("+")||n("-")||n("~")||n("!")){a=p();s=m();e=K();return t(a,l.createUnaryExpression(s.value,e))}if(b("delete")||b("void")||b("typeof")){a=p();s=m();e=K();e=t(a,l.createUnaryExpression(s.value,e));if(v&&e.operator==="delete"&&e.argument.type===r.Identifier){E({},i.StrictDelete)}return e}return zn()}function Hn(n,t){var e=0;if(n.type!==o.Punctuator&&n.type!==o.Keyword){return 0}switch(n.value){case"||":e=1;break;case"&&":e=2;break;case"|":e=3;break;case"^":e=4;break;case"&":e=5;break;case"==":case"!=":case"===":case"!==":e=6;break;case"<":case">":case"<=":case">=":case"instanceof":e=7;break;case"in":e=t?7:0;break;case"<<":case">>":case">>>":e=8;break;case"+":case"-":e=9;break;case"*":case"/":case"%":e=11;break;default:break}return e}function Qr(){var n,i,u,d,e,h,g,f,o,r,s;d=a.allowIn;a.allowIn=true;r=p();f=K();i=c;u=Hn(i,d);if(u===0){return f}i.prec=u;m();s=[r,p()];h=K();e=[f,i,h];while((u=Hn(c,d))>0){while(e.length>2&&u<=e[e.length-2].prec){h=e.pop();g=e.pop().value;f=e.pop();n=l.createBinaryExpression(g,f,h);s.pop();r=s.pop();t(r,n);e.push(n);s.push(r)}i=m();i.prec=u;e.push(i);s.push(p());n=K();e.push(n)}a.allowIn=d;o=e.length-1;n=e[o];s.pop();while(o>1){n=l.createBinaryExpression(e[o-1].value,e[o-2],n);o-=2;r=s.pop();t(r,n)}return n}function Wn(){var e,r,i,s,o=p();e=Qr();if(n("?")){m();r=a.allowIn;a.allowIn=true;i=R();a.allowIn=r;u(":");s=R();e=t(o,l.createConditionalExpression(e,i,s))}return e}function z(e){var n,t,l,a;if(e.type===r.ObjectExpression){e.type=r.ObjectPattern;for(n=0,t=e.properties.length;n<t;n+=1){l=e.properties[n];if(l.type===r.SpreadProperty){if(n<t-1){d({},i.PropertyAfterSpreadProperty)}z(l.argument)}else{if(l.kind!=="init"){d({},i.InvalidLHSInAssignment)}z(l.value)}}}else if(e.type===r.ArrayExpression){e.type=r.ArrayPattern;for(n=0,t=e.elements.length;n<t;n+=1){a=e.elements[n];if(a){z(a)}}}else if(e.type===r.Identifier){if(L(e.name)){d({},i.InvalidLHSInAssignment)}}else if(e.type===r.SpreadElement){z(e.argument);if(e.argument.type===r.ObjectPattern){d({},i.ObjectPatternAsSpread)}}else{if(e.type!==r.MemberExpression&&e.type!==r.CallExpression&&e.type!==r.NewExpression){d({},i.InvalidLHSInAssignment)}}}function Y(t,e){var n,l,a,s;if(e.type===r.ObjectExpression){e.type=r.ObjectPattern;for(n=0,l=e.properties.length;n<l;n+=1){a=e.properties[n];if(a.type===r.SpreadProperty){if(n<l-1){d({},i.PropertyAfterSpreadProperty)}Y(t,a.argument)}else{if(a.kind!=="init"){d({},i.InvalidLHSInFormalsList)}Y(t,a.value)}}}else if(e.type===r.ArrayExpression){e.type=r.ArrayPattern;for(n=0,l=e.elements.length;n<l;n+=1){s=e.elements[n];if(s){Y(t,s)}}}else if(e.type===r.Identifier){sn(t,e,e.name)}else if(e.type===r.SpreadElement){if(e.argument.type!==r.Identifier){d({},i.InvalidLHSInFormalsList)}sn(t,e.argument,e.argument.name)}else{d({},i.InvalidLHSInFormalsList)}}function Tn(c){var l,s,e,a,t,o,n,u;a=[];t=[];o=0;u=null;n={paramSet:new O};for(l=0,s=c.length;l<s;l+=1){e=c[l];if(e.type===r.Identifier){a.push(e);t.push(null);sn(n,e,e.name)}else if(e.type===r.ObjectExpression||e.type===r.ArrayExpression){Y(n,e);a.push(e);t.push(null)}else if(e.type===r.SpreadElement){J(l===s-1,"It is guaranteed that SpreadElement is last element by parseExpression");if(e.argument.type!==r.Identifier){d({},i.InvalidLHSInFormalsList)}Y(n,e.argument);u=e.argument}else if(e.type===r.AssignmentExpression){a.push(e.left);t.push(e.right);++o;sn(n,e.left,e.left.name)}else{return null}}if(n.message===i.StrictParamDupe){d(v?n.stricted:n.firstRestricted,n.message)}if(o===0){t=[]}return{params:a,defaults:t,rest:u,stricted:n.stricted,firstRestricted:n.firstRestricted,message:n.message}}function Ln(e,c){var i,s,o,n;u("=>");i=v;s=a.yieldAllowed;a.yieldAllowed=false;o=a.awaitAllowed;a.awaitAllowed=!!e.async;n=nt();if(v&&e.firstRestricted){d(e.firstRestricted,e.message)}if(v&&e.stricted){E(e.stricted,e.message)}v=i;a.yieldAllowed=s;a.awaitAllowed=o;return t(c,l.createArrowFunctionExpression(e.params,e.defaults,n,e.rest,n.type!==r.BlockStatement,!!e.async))}function R(){var h,e,u,s,g,y=c,f=false;if(ir()){return ur()}if(or()){return cr()}g=a.parenthesizedCount;h=p();if(lt()){return On()}if(un()){f=true;m()}if(n("(")){u=P();if(u.type===o.Punctuator&&u.value===")"||u.value==="..."){s=hn();if(!n("=>")){S(m())}s.async=f;return Ln(s,h)}}u=c;if(f&&!n("(")&&u.type!==o.Identifier){f=false;dn(y)}e=Wn();if(n("=>")&&(a.parenthesizedCount===g||a.parenthesizedCount===g+1)){if(e.type===r.Identifier){s=Tn([e])}else if(e.type===r.SequenceExpression){s=Tn(e.expressions)}if(s){s.async=f;return Ln(s,h)}}if(f){f=false;dn(y);e=Wn()}if(lr()){if(v&&e.type===r.Identifier&&L(e.name)){E(u,i.StrictLHSAssignment)}if(n("=")&&(e.type===r.ObjectExpression||e.type===r.ArrayExpression)){z(e)}else if(!gn(e)){d({},i.InvalidLHSInAssignment)}e=t(h,l.createAssignmentExpression(m().value,e,R()))}return e}function w(){var u,s,o,h,c,g,f;f=a.parenthesizedCount;u=p();s=R();o=[s];if(n(",")){while(e<y){if(!n(",")){break}m();s=jn();o.push(s);if(s.type===r.SpreadElement){g=true;if(!n(")")){d({},i.ElementAfterSpreadElement)}break}}h=t(u,l.createSequenceExpression(o))}if(n("=>")){if(a.parenthesizedCount===f||a.parenthesizedCount===f+1){s=s.type===r.SequenceExpression?s.expressions:o;c=Tn(s);if(c){return Ln(c,u)}}S(m())}if(g&&P().value!=="=>"){d({},i.IllegalSpread)}return h||s}function tr(){var r=[],t;while(e<y){if(n("}")){break}t=$();if(typeof t==="undefined"){break}r.push(t)}return r}function xn(){var e,n=p();u("{");e=tr();u("}");return t(n,l.createBlockStatement(e))}function C(){var r=p(),e=[];u("<");while(!n(">")){e.push(I());if(!n(">")){u(",")}}u(">");return t(r,l.createTypeParameterDeclaration(e))}function fn(){var r=p(),i=a.inType,e=[];a.inType=true;u("<");while(!n(">")){e.push(j());if(!n(">")){u(",")}}u(">");a.inType=i;return t(r,l.createTypeParameterInstantiation(e))}function ol(a,i){var e,n,r;u("[");e=M();u(":");n=j();u("]");u(":");r=j();return t(a,l.createObjectTypeIndexer(e,n,r,i))}function Gn(s){var e=[],r=null,a,i=null;if(n("<")){i=C()}u("(");while(c.type===o.Identifier){e.push(Sn());if(!n(")")){u(",")}}if(n("...")){m();r=Sn()}u(")");u(":");a=j();return t(s,l.createFunctionTypeAnnotation(e,a,r,i))}function fr(e,r,a){var i=false,n;n=Gn(e);return t(e,l.createObjectTypeProperty(a,n,i,r))}function hr(e,n){var r=p();return t(e,l.createObjectTypeCallProperty(Gn(r),n))}function ot(y){var f=[],g=[],e,d=false,s=[],v,a,h,o,r;u("{");while(!n("}")){e=p();if(y&&_("static")){o=m();r=true}if(n("[")){g.push(ol(e,r))}else if(n("(")||n("<")){f.push(hr(e,y))}else{if(r&&n(":")){a=t(e,l.createIdentifier(o));E(o,i.StrictReservedWord)}else{a=M()}if(n("<")||n("(")){s.push(fr(e,r,a))}else{if(n("?")){m();d=true}u(":");h=j();s.push(t(e,l.createObjectTypeProperty(a,h,d,r)))}}if(n(";")){m()}else if(!n("}")){S(c)}}u("}");return l.createObjectTypeAnnotation(s,g,f)}function yr(){var r=p(),i=null,a=null,e,s=p;e=I();while(n(".")){u(".");e=t(r,l.createQualifiedTypeIdentifier(e,I()))}if(n("<")){a=fn()}return t(r,l.createGenericTypeAnnotation(e,a))}function xr(){var e=p();x("void");return t(e,l.createVoidTypeAnnotation())}function br(){var e,n=p();x("typeof");e=qn();return t(n,l.createTypeofTypeAnnotation(e))}function _r(){var a=p(),r=[];u("[");while(e<y&&!n("]")){r.push(j());if(n("]")){break}u(",")}u("]");return t(a,l.createTupleTypeAnnotation(r))}function Sn(){var i=p(),e,r=false,a;e=I();if(n("?")){m();r=true}u(":");a=j();return t(i,l.createFunctionTypeParam(e,a,r))}function Vn(){var e={params:[],rest:null};while(c.type===o.Identifier){e.params.push(Sn());
if(!n(")")){u(",")}}if(n("...")){m();e.rest=Sn()}return e}function qn(){var x=null,s=null,f=null,e=p(),h=null,a,y,r,v,g=false;switch(c.type){case o.Identifier:switch(c.value){case"any":m();return t(e,l.createAnyTypeAnnotation());case"bool":case"boolean":m();return t(e,l.createBooleanTypeAnnotation());case"number":m();return t(e,l.createNumberTypeAnnotation());case"string":m();return t(e,l.createStringTypeAnnotation())}return t(e,yr());case o.Punctuator:switch(c.value){case"{":return t(e,ot());case"[":return _r();case"<":y=C();u("(");a=Vn();s=a.params;h=a.rest;u(")");u("=>");f=j();return t(e,l.createFunctionTypeAnnotation(s,f,h,y));case"(":m();if(!n(")")&&!n("...")){if(c.type===o.Identifier){r=P();g=r.value!=="?"&&r.value!==":"}else{g=true}}if(g){v=j();u(")");if(n("=>")){d({},i.ConfusedAboutFunctionType)}return v}a=Vn();s=a.params;h=a.rest;u(")");u("=>");f=j();return t(e,l.createFunctionTypeAnnotation(s,f,h,null))}break;case o.Keyword:switch(c.value){case"void":return t(e,xr());case"typeof":return t(e,br())}break;case o.StringLiteral:r=m();if(r.octal){d(r,i.StrictOctalLiteral)}return t(e,l.createStringLiteralTypeAnnotation(r))}S(c)}function Mr(){var r=p(),e=qn();if(n("[")){u("[");u("]");return t(r,l.createArrayTypeAnnotation(e))}return e}function Bn(){var e=p();if(n("?")){m();return t(e,l.createNullableTypeAnnotation(Bn()))}return Mr()}function Jn(){var a=p(),r,e;r=Bn();e=[r];while(n("&")){m();e.push(Bn())}return e.length===1?r:t(a,l.createIntersectionTypeAnnotation(e))}function Wr(){var a=p(),r,e;r=Jn();e=[r];while(n("|")){m();e.push(Jn())}return e.length===1?r:t(a,l.createUnionTypeAnnotation(e))}function j(){var n=a.inType,e;a.inType=true;e=Wr();a.inType=n;return e}function D(){var n=p(),e;u(":");e=j();return t(n,l.createTypeAnnotation(e))}function I(){var n=p(),e=m();if(e.type!==o.Identifier){S(e)}return t(n,l.createIdentifier(e.value))}function Q(a,i){var r=p(),e=I(),l=false;if(i&&n("?")){u("?");l=true}if(a||n(":")){e.typeAnnotation=D();e=t(r,e)}if(l){e.optional=true;e=t(r,e)}return e}function rl(o){var e,c=p(),r=null,s=p();if(n("{")){e=_n();z(e);if(n(":")){e.typeAnnotation=D();t(s,e)}}else if(n("[")){e=yn();z(e);if(n(":")){e.typeAnnotation=D();t(s,e)}}else{e=a.allowKeyword?H():Q();if(v&&L(e.name)){E({},i.StrictVarName)}}if(o==="const"){if(!n("=")){d({},i.NoUnintializedConst)}u("=");r=R()}else if(n("=")){m();r=R()}return t(c,l.createVariableDeclarator(e,r))}function Nn(r){var t=[];do{t.push(rl(r));if(!n(",")){break}m()}while(e<y);return t}function al(){var e,n=p();x("var");e=Nn();k();return t(n,l.createVariableDeclaration(e,"var"))}function Ct(e){var n,r=p();x(e);n=Nn(e);k();return t(r,l.createVariableDeclaration(n,e))}function bn(){var n=p(),e;if(c.type!==o.StringLiteral){d({},i.InvalidModuleSpecifier)}e=l.createModuleSpecifier(c);m();return t(n,e)}function Tt(){var e=p();u("*");return t(e,l.createExportBatchSpecifier())}function Lt(){var e,n=null,r=p(),a;if(b("default")){m();e=t(r,l.createIdentifier("default"))}else{e=I()}if(_("as")){m();n=H()}return t(r,l.createExportSpecifier(e,n))}function Kn(){var f,g,y,r=null,h,s=null,a=[],e=p();x("export");if(b("default")){m();if(b("function")||b("class")){f=c;m();if(Dn(c)){g=H();dn(f);return t(e,l.createExportDeclaration(true,$(),[g],null))}dn(f);switch(c.value){case"class":return t(e,l.createExportDeclaration(true,ct(),[],null));case"function":return t(e,l.createExportDeclaration(true,On(),[],null))}}if(_("from")){d({},i.UnexpectedToken,c.value)}if(n("{")){r=_n()}else if(n("[")){r=yn()}else{r=R()}k();return t(e,l.createExportDeclaration(true,r,[],null))}if(c.type===o.Keyword){switch(c.value){case"let":case"const":case"var":case"class":case"function":return t(e,l.createExportDeclaration(false,$(),a,null))}}if(n("*")){a.push(Tt());if(!_("from")){d({},c.value?i.UnexpectedToken:i.MissingFromClause,c.value)}m();s=bn();k();return t(e,l.createExportDeclaration(false,null,a,s))}u("{");if(!n("}")){do{h=h||b("default");a.push(Lt())}while(n(",")&&m())}u("}");if(_("from")){m();s=bn();k()}else if(h){d({},c.value?i.UnexpectedToken:i.MissingFromClause,c.value)}else{k()}return t(e,l.createExportDeclaration(false,r,a,s))}function jt(){var e,n=null,r=p();e=H();if(_("as")){m();n=I()}return t(r,l.createImportSpecifier(e,n))}function Mt(){var e=[];u("{");if(!n("}")){do{e.push(jt())}while(n(",")&&m())}u("}");return e}function Ot(){var e,n=p();e=H();return t(n,l.createImportDefaultSpecifier(e))}function Dt(){var e,n=p();u("*");if(!_("as")){d({},i.NoAsAfterImportNamespace)}m();e=H();return t(n,l.createImportNamespaceSpecifier(e))}function Qn(){var e,r,a=p();x("import");e=[];if(c.type===o.StringLiteral){r=bn();k();return t(a,l.createImportDeclaration(e,r))}if(!b("default")&&Dn(c)){e.push(Ot());if(n(",")){m()}}if(n("*")){e.push(Dt())}else if(n("{")){e=e.concat(Mt())}if(!_("from")){d({},c.value?i.UnexpectedToken:i.MissingFromClause,c.value)}m();r=bn();k();return t(a,l.createImportDeclaration(e,r))}function Ft(){var e=p();u(";");return t(e,l.createEmptyStatement())}function Bt(){var e=p(),n=w();k();return t(e,l.createExpressionStatement(n))}function Ut(){var n,r,e,a=p();x("if");u("(");n=w();u(")");r=q();if(b("else")){m();e=q()}else{e=null}return t(a,l.createIfStatement(n,r,e))}function Vt(){var e,r,i,s=p();x("do");i=a.inIteration;a.inIteration=true;e=q();a.inIteration=i;x("while");u("(");r=w();u(")");if(n(";")){m()}return t(s,l.createDoWhileStatement(e,r))}function Xt(){var e,n,r,i=p();x("while");u("(");e=w();u(")");r=a.inIteration;a.inIteration=true;n=q();a.inIteration=r;return t(i,l.createWhileStatement(e,n))}function qt(){var e=p(),n=m(),r=Nn();return t(e,l.createVariableDeclaration(r,n.value))}function Zn(v){var e,h,g,r,s,f,o,E,y=p();e=h=g=null;x("for");if(_("each")){d({},i.EachNotAllowed)}u("(");if(n(";")){m()}else{if(b("var")||b("let")||b("const")){a.allowIn=false;e=qt();a.allowIn=true;if(e.declarations.length===1){if(b("in")||_("of")){o=c;if(!((o.value==="in"||e.kind!=="var")&&e.declarations[0].init)){m();r=e;s=w();e=null}}}}else{a.allowIn=false;e=w();a.allowIn=true;if(_("of")){o=m();r=e;s=w();e=null}else if(b("in")){if(!Tr(e)){d({},i.InvalidLHSInForIn)}o=m();r=e;s=w();e=null}}if(typeof r==="undefined"){u(";")}}if(typeof r==="undefined"){if(!n(";")){h=w()}u(";");if(!n(")")){g=w()}}u(")");E=a.inIteration;a.inIteration=true;if(!(v!==undefined&&v.ignoreBody)){f=q()}a.inIteration=E;if(typeof r==="undefined"){return t(y,l.createForStatement(e,h,g,f))}if(o.value==="in"){return t(y,l.createForInStatement(r,s,f))}return t(y,l.createForOfStatement(r,s,f))}function Gt(){var n=null,r=p();x("continue");if(s.charCodeAt(e)===59){m();if(!a.inIteration){d({},i.IllegalContinue)}return t(r,l.createContinueStatement(null))}if(rn()){if(!a.inIteration){d({},i.IllegalContinue)}return t(r,l.createContinueStatement(null))}if(c.type===o.Identifier){n=I();if(!a.labelSet.has(n.name)){d({},i.UnknownLabel,n.name)}}k();if(n===null&&!a.inIteration){d({},i.IllegalContinue)}return t(r,l.createContinueStatement(n))}function Wt(){var n=null,r=p();x("break");if(s.charCodeAt(e)===59){m();if(!(a.inIteration||a.inSwitch)){d({},i.IllegalBreak)}return t(r,l.createBreakStatement(null))}if(rn()){if(!(a.inIteration||a.inSwitch)){d({},i.IllegalBreak)}return t(r,l.createBreakStatement(null))}if(c.type===o.Identifier){n=I();if(!a.labelSet.has(n.name)){d({},i.UnknownLabel,n.name)}}k();if(n===null&&!(a.inIteration||a.inSwitch)){d({},i.IllegalBreak)}return t(r,l.createBreakStatement(n))}function Ht(){var r=null,u=p();x("return");if(!a.inFunctionBody){E({},i.IllegalReturn)}if(s.charCodeAt(e)===32){if(W(s.charCodeAt(e+1))){r=w();k();return t(u,l.createReturnStatement(r))}}if(rn()){return t(u,l.createReturnStatement(null))}if(!n(";")){if(!n("}")&&c.type!==o.EOF){r=w()}}k();return t(u,l.createReturnStatement(r))}function zt(){var e,n,r=p();if(v){E({},i.StrictModeWith)}x("with");u("(");e=w();u(")");n=q();return t(r,l.createWithStatement(e,n))}function Yt(){var r,i=[],a,s=p();if(b("default")){m();r=null}else{x("case");r=w()}u(":");while(e<y){if(n("}")||b("default")||b("case")){break}a=$();if(typeof a==="undefined"){break}i.push(a)}return t(s,l.createSwitchCase(r,i))}function $t(){var s,r,o,f,c,h=p();x("switch");u("(");s=w();u(")");u("{");r=[];if(n("}")){m();return t(h,l.createSwitchStatement(s,r))}f=a.inSwitch;a.inSwitch=true;c=false;while(e<y){if(n("}")){break}o=Yt();if(o.test===null){if(c){d({},i.MultipleDefaultsInSwitch)}c=true}r.push(o)}a.inSwitch=f;u("}");return t(h,l.createSwitchStatement(s,r))}function Kt(){var e,n=p();x("throw");if(rn()){d({},i.NewlineAfterThrow)}e=w();k();return t(n,l.createThrowStatement(e))}function Qt(){var e,a,s=p();x("catch");u("(");if(n(")")){S(c)}e=w();if(v&&e.type===r.Identifier&&L(e.name)){E({},i.StrictCatchVariable)}u(")");a=xn();return t(s,l.createCatchClause(e,a))}function Zt(){var r,e=[],n=null,a=p();x("try");r=xn();if(b("catch")){e.push(Qt())}if(b("finally")){m();n=xn()}if(e.length===0&&!n){d({},i.NoCatchOrFinally)}return t(a,l.createTryStatement(r,[],e,n))}function er(){var e=p();x("debugger");k();return t(e,l.createDebuggerStatement())}function q(){var s=c.type,u,e,f;if(s===o.EOF){S(c)}if(s===o.Punctuator){switch(c.value){case";":return Ft();case"{":return xn();case"(":return Bt();default:break}}if(s===o.Keyword){switch(c.value){case"break":return Wt();case"continue":return Gt();case"debugger":return er();case"do":return Vt();case"for":return Zn();case"function":return In();case"class":return vr();case"if":return Ut();case"return":return Ht();case"switch":return $t();case"throw":return Kt();case"try":return Zt();case"var":return al();case"while":return Xt();case"with":return zt();default:break}}if(lt()){return In()}u=p();e=w();if(e.type===r.Identifier&&n(":")){m();if(a.labelSet.has(e.name)){d({},i.Redeclaration,"Label",e.name)}a.labelSet.set(e.name,true);f=q();a.labelSet["delete"](e.name);return t(u,l.createLabeledStatement(e,f))}k();return t(u,l.createExpressionStatement(e))}function nt(){if(n("{")){return Pn()}return R()}function Pn(){var f,h=[],d,x,m,g,b,w,_,S,k=p();u("{");while(e<y){if(c.type!==o.StringLiteral){break}d=c;f=$();h.push(f);if(f.expression.type!==r.Literal){break}x=s.slice(d.range[0]+1,d.range[1]-1);if(x==="use strict"){v=true;if(m){E(m,i.StrictOctalLiteral)}}else{if(!m&&d.octal){m=d}}}g=a.labelSet;b=a.inIteration;w=a.inSwitch;_=a.inFunctionBody;S=a.parenthesizedCount;a.labelSet=new O;a.inIteration=false;a.inSwitch=false;a.inFunctionBody=true;a.parenthesizedCount=0;while(e<y){if(n("}")){break}f=$();if(typeof f==="undefined"){break}h.push(f)}u("}");a.labelSet=g;a.inIteration=b;a.inSwitch=w;a.inFunctionBody=_;a.parenthesizedCount=S;return t(k,l.createBlockStatement(h))}function sn(e,t,n){if(v){if(L(n)){e.stricted=t;e.message=i.StrictParamName}if(e.paramSet.has(n)){e.stricted=t;e.message=i.StrictParamDupe}}else if(!e.firstRestricted){if(L(n)){e.firstRestricted=t;e.message=i.StrictParamName}else if(ln(n)){e.firstRestricted=t;e.message=i.StrictReservedWord}else if(e.paramSet.has(n)){e.firstRestricted=t;e.message=i.StrictParamDupe}}e.paramSet.set(n,true)}function ar(r){var s,l,a,e,o;l=c;if(l.value==="..."){l=m();a=true}if(n("[")){s=p();e=yn();Y(r,e);if(n(":")){e.typeAnnotation=D();t(s,e)}}else if(n("{")){s=p();if(a){d({},i.ObjectPatternAsRestParameter)}e=_n();Y(r,e);if(n(":")){e.typeAnnotation=D();t(s,e)}}else{e=a?Q(false,false):Q(false,true);sn(r,l,l.value)}if(n("=")){if(a){E(c,i.DefaultRestParameter)}m();o=R();++r.defaultCount}if(a){if(!n(")")){d({},i.ParameterAfterRestParameter)}r.rest=e;return false}r.params.push(e);r.defaults.push(o);return!n(")")}function hn(l){var r,a=p();r={params:[],defaultCount:0,defaults:[],rest:null,firstRestricted:l};u("(");if(!n(")")){r.paramSet=new O;while(e<y){if(!ar(r)){break}u(",")}}u(")");if(r.defaultCount===0){r.defaults=[]}if(n(":")){r.returnType=D()}return t(a,r)}function In(){var g,h,r,e,s,o,u,f,y,b,w,S=p(),_;f=false;if(un()){m();f=true}x("function");u=false;if(n("*")){m();u=true}r=c;g=I();if(n("<")){_=C()}if(v){if(L(r.value)){E(r,i.StrictFunctionName)}}else{if(L(r.value)){s=r;o=i.StrictFunctionName}else if(ln(r.value)){s=r;o=i.StrictReservedWord}}e=hn(s);s=e.firstRestricted;if(e.message){o=e.message}y=v;b=a.yieldAllowed;a.yieldAllowed=u;w=a.awaitAllowed;a.awaitAllowed=f;h=Pn();if(v&&s){d(s,o)}if(v&&e.stricted){E(e.stricted,o)}v=y;a.yieldAllowed=b;a.awaitAllowed=w;return t(S,l.createFunctionDeclaration(g,e.params,e.defaults,h,e.rest,u,false,f,e.returnType,_))}function On(){var r,h=null,s,o,e,g,u,f,y,b,w,S=p(),_;f=false;if(un()){m();f=true}x("function");u=false;if(n("*")){m();u=true}if(!n("(")){if(!n("<")){r=c;h=I();if(v){if(L(r.value)){E(r,i.StrictFunctionName)}}else{if(L(r.value)){s=r;o=i.StrictFunctionName}else if(ln(r.value)){s=r;o=i.StrictReservedWord}}}if(n("<")){_=C()}}e=hn(s);s=e.firstRestricted;if(e.message){o=e.message}y=v;b=a.yieldAllowed;a.yieldAllowed=u;w=a.awaitAllowed;a.awaitAllowed=f;g=Pn();if(v&&s){d(s,o)}if(v&&e.stricted){E(e.stricted,o)}v=y;a.yieldAllowed=b;a.awaitAllowed=w;return t(S,l.createFunctionExpression(h,e.params,e.defaults,g,e.rest,u,false,f,e.returnType,_))}function ur(){var e,r,a=p();x("yield",!v);e=false;if(n("*")){m();e=true}r=R();return t(a,l.createYieldExpression(r,e))}function cr(){var e,n=p();V("await");e=R();return t(n,l.createAwaitExpression(e))}function An(r,s,n){var e,l,t,a;t=At(s);if(r.has(t)){e=r.get(t);if(n==="data"){a=false}else{if(n==="get"){l="set"}else{l="get"}a=e[n]===undefined&&e.data===undefined&&e[l]!==undefined}if(!a){d(s,i.IllegalDuplicateClassProperty)}}else{e={get:undefined,set:undefined,data:undefined};r.set(t,e)}e[n]=true}function pr(g,e,h,m,t){var p,f,r,y=false,o,d,a,s,v,i;r=h?tn.static:tn.prototype;i=g[r];if(m){return l.createMethodDefinition(r,"",e,Z({generator:true}),t)}a=e.type==="Identifier"&&e.name;if(a==="get"&&!n("(")){e=M();if(!t){An(i,e,"get")}u("(");u(")");if(n(":")){s=D()}return l.createMethodDefinition(r,"get",e,cn({generator:false,returnType:s}),t)}if(a==="set"&&!n("(")){e=M();if(!t){An(i,e,"set")}u("(");p=c;f=[Q()];u(")");if(n(":")){s=D()}return l.createMethodDefinition(r,"set",e,cn({params:f,generator:false,name:p,returnType:s}),t)}if(n("<")){d=C()}o=a==="async"&&!n("(");if(o){e=M()}if(!t){An(i,e,"data")}return l.createMethodDefinition(r,"",e,Z({generator:false,async:o,typeParameters:d}),t)}function dr(a,n,t,r){var e;e=D();u(";");return l.createClassProperty(n,e,t,r)}function mr(s){var r=false,l=false,a,u=p(),i=false,e;if(n(";")){m();return}if(c.value==="static"){m();i=true}if(n("*")){m();l=true}e=c;if(_("get")||_("set")){e=P()}if(e.type===o.Punctuator&&e.value==="["){r=true}a=M();if(!l&&c.value===":"){return t(u,dr(s,a,r,i))}return t(u,pr(s,a,i,l,r))}function Xn(){var r,i=[],a={},s=p();a[tn.static]=new O;a[tn.prototype]=new O;u("{");while(e<y){if(n("}")){break}r=mr(a);if(typeof r!=="undefined"){i.push(r)}}u("}");return t(s,l.createClassBody(i))}function ut(){var a,i=[],s,r;V("implements");while(e<y){s=p();a=I();if(n("<")){r=fn()}else{r=null}i.push(t(s,l.createClassImplements(a,r)));if(!n(",")){break}u(",")}return i}function ct(){var e,r,i,s=null,o,c=p(),u;x("class");if(!b("extends")&&!_("implements")&&!n("{")){e=I()}if(n("<")){u=C()}if(b("extends")){x("extends");i=a.yieldAllowed;a.yieldAllowed=false;s=Fn();if(n("<")){o=fn()}a.yieldAllowed=i}if(_("implements")){r=ut()}return t(c,l.createClassExpression(e,s,Xn(),u,o,r))}function vr(){var e,r,i,s=null,o,c=p(),u;x("class");e=I();if(n("<")){u=C()}if(b("extends")){x("extends");i=a.yieldAllowed;a.yieldAllowed=false;s=Fn();if(n("<")){o=fn()}a.yieldAllowed=i}if(_("implements")){r=ut()}return t(c,l.createClassDeclaration(e,s,Xn(),u,o,r))}function $(){var e;if(c.type===o.Keyword){switch(c.value){case"const":case"let":return Ct(c.value);case"function":return In();case"export":E({},i.IllegalExportDeclaration);return Kn();case"import":E({},i.IllegalImportDeclaration);return Qn();default:return q()}}if(_("type")&&P().type===o.Identifier){return Hr()}if(_("interface")&&P().type===o.Identifier){return $r()}if(_("declare")){e=P();if(e.type===o.Keyword){switch(e.value){case"class":return wt();case"function":return _t();case"var":return St()}}else if(e.type===o.Identifier&&e.value==="module"){return el()}}if(c.type!==o.EOF){return q()}}function pt(){if(f.isModule&&c.type===o.Keyword){switch(c.value){case"export":return Kn();case"import":return Qn()}}return $()}function Er(){var n,a=[],t,u,l;while(e<y){t=c;if(t.type!==o.StringLiteral){break}n=pt();a.push(n);if(n.expression.type!==r.Literal){break}u=s.slice(t.range[0]+1,t.range[1]-1);if(u==="use strict"){v=true;if(l){E(l,i.StrictOctalLiteral)}}else{if(!l&&t.octal){l=t}}}while(e<y){n=pt();if(typeof n==="undefined"){break}a.push(n)}return a}function wr(){var e,n=p();v=!!f.isModule;mn();e=Er();return t(n,l.createProgram(e))}function vn(t,r,n,l,i){var e;J(typeof n==="number","Comment must have valid position");if(a.lastCommentStart>=n){return}a.lastCommentStart=n;e={type:t,value:r};if(f.range){e.range=[n,l]}if(f.loc){e.loc=i}f.comments.push(e);if(f.attachComment){f.leadingComments.push(e);f.trailingComments.push(e)}}function Sr(){var t,n,r,l,o,a;t="";o=false;a=false;while(e<y){n=s[e];if(a){n=s[e++];if(T(n.charCodeAt(0))){r.end={line:h,column:e-g-1};a=false;vn("Line",t,l,e-1,r);if(n==="\r"&&s[e]==="\n"){++e}++h;g=e;t=""}else if(e>=y){a=false;t+=n;r.end={line:h,column:y-g};vn("Line",t,l,y,r)}else{t+=n}}else if(o){if(T(n.charCodeAt(0))){if(n==="\r"){++e;t+="\r"}if(n!=="\r"||s[e]==="\n"){t+=s[e];++h;++e;g=e;if(e>=y){d({},i.UnexpectedToken,"ILLEGAL")}}}else{n=s[e++];if(e>=y){d({},i.UnexpectedToken,"ILLEGAL")}t+=n;if(n==="*"){n=s[e];if(n==="/"){t=t.substr(0,t.length-1);o=false;++e;r.end={line:h,column:e-g};vn("Block",t,l,e,r);t=""}}}}else if(n==="/"){n=s[e+1];if(n==="/"){r={start:{line:h,column:e-g}};l=e;e+=2;a=true;if(e>=y){r.end={line:h,column:e-g};a=false;vn("Line",t,l,e,r)}}else if(n==="*"){l=e;e+=2;o=true;r={start:{line:h,column:e-g-2}};if(e>=y){d({},i.UnexpectedToken,"ILLEGAL")}}else{break}}else if(gt(n.charCodeAt(0))){++e}else if(T(n.charCodeAt(0))){++e;if(n==="\r"&&s[e]==="\n"){++e}++h;g=e}else{break}}}Rn={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:"♦"};function on(e){if(e.type===r.XJSIdentifier){return e.name}if(e.type===r.XJSNamespacedName){return e.namespace.name+":"+e.name.name}if(e.type===r.XJSMemberExpression){return on(e.object)+"."+on(e.property)}S(e)}function Ir(e){return e!==92&&W(e)}function Rr(e){return e!==92&&(e===45||an(e))}function Cr(){var n,t,r="";t=e;while(e<y){n=s.charCodeAt(e);if(!Rr(n)){break}r+=s[e++]}return{type:o.XJSIdentifier,value:r,lineNumber:h,lineStart:g,range:[t,e]}}function Ar(){var t,n="",l=e,a=0,r;t=s[e];J(t==="&","Entity must start with an ampersand");e++;while(e<y&&a++<10){t=s[e++];if(t===";"){break}n+=t}if(t===";"){if(n[0]==="#"){if(n[1]==="x"){r=+("0"+n.substr(1))}else{r=+n.substr(1).replace(wn.LeadingZeros,"")}if(!isNaN(r)){return String.fromCharCode(r)}}else if(Rn[n]){return Rn[n]}}e=l+1;return"&"}function ht(l){var n,t="",r;r=e;while(e<y){n=s[e];if(l.indexOf(n)!==-1){break}if(n==="&"){t+=Ar()}else{e++;if(n==="\r"&&s[e]==="\n"){t+=n;n=s[e];e++}if(T(n.charCodeAt(0))){++h;g=e}t+=n}}return{type:o.XJSText,value:t,lineNumber:h,lineStart:g,range:[r,e]}}function Lr(){var t,n,r;n=s[e];J(n==="'"||n==='"',"String literal must starts with a quote");r=e;++e;t=ht([n]);if(n!==s[e]){d({},i.UnexpectedToken,"ILLEGAL")}++e;t.range=[r,e];return t}function Pr(){var n=s.charCodeAt(e);if(n!==123&&n!==60){return ht(["<","{"])}return U()}function nn(){var e,n=p();if(c.type!==o.XJSIdentifier){S(c)}e=m();return t(n,l.createXJSIdentifier(e.value))}function yt(){var e,n,r=p();e=nn();u(":");n=nn();return t(r,l.createXJSNamespacedName(e,n))}function Or(){var r=p(),e=nn();while(n(".")){m();e=t(r,l.createXJSMemberExpression(e,nn()))}return e}function vt(){if(P().value===":"){return yt()}if(P().value==="."){return Or()}return nn()}function Nr(){if(P().value===":"){return yt()}return nn()}function Fr(){var e,a;if(n("{")){e=xt();if(e.expression.type===r.XJSEmptyExpression){d(e,"XJS attributes must only be assigned a non-empty "+"expression")}}else if(n("<")){e=Mn()}else if(c.type===o.XJSText){a=p();e=t(a,l.createLiteral(m()))}else{d({},i.InvalidXJSAttributeValue)}return e}function Br(){var n=it();while(s.charAt(e)!=="}"){e++}return t(n,l.createXJSEmptyExpression())}function xt(){var e,r,i,s=p();r=a.inXJSChild;i=a.inXJSTag;a.inXJSChild=false;a.inXJSTag=false;u("{");if(n("}")){e=Br()}else{e=w()}a.inXJSChild=r;a.inXJSTag=i;u("}");return t(s,l.createXJSExpressionContainer(e))}function Vr(){var e,n,r,i=p();n=a.inXJSChild;r=a.inXJSTag;a.inXJSChild=false;a.inXJSTag=false;u("{");u("...");e=R();a.inXJSChild=n;a.inXJSTag=r;u("}");return t(i,l.createXJSSpreadAttribute(e))}function Xr(){var e,r;if(n("{")){return Vr()}r=p();e=Nr();if(n("=")){m();return t(r,l.createXJSAttribute(e,Fr()))}return t(r,l.createXJSAttribute(e))}function qr(){var e,r;if(n("{")){e=xt()}else if(c.type===o.XJSText){r=it();e=t(r,l.createLiteral(m()))}else{e=Mn()}return e}function Jr(){var e,n,r,i=p();n=a.inXJSChild;r=a.inXJSTag;a.inXJSChild=false;a.inXJSTag=true;u("<");u("/");e=vt();a.inXJSChild=n;a.inXJSTag=r;u(">");return t(i,l.createXJSClosingElement(e))}function Gr(){var n,d,r=[],i=false,s,o,f=p();s=a.inXJSChild;o=a.inXJSTag;a.inXJSChild=false;a.inXJSTag=true;u("<");n=vt();while(e<y&&c.value!=="/"&&c.value!==">"){r.push(Xr())}a.inXJSTag=o;if(c.value==="/"){u("/");a.inXJSChild=s;u(">");i=true}else{a.inXJSChild=true;u(">")}return t(f,l.createXJSOpeningElement(n,r,i))}function Mn(){var r,s=null,u=[],o,f,m=p();o=a.inXJSChild;f=a.inXJSTag;r=Gr();if(!r.selfClosing){while(e<y){a.inXJSChild=false;if(c.value==="<"&&P().value==="/"){break}a.inXJSChild=true;u.push(qr())}a.inXJSChild=o;a.inXJSTag=f;s=Jr();if(on(s.name)!==on(r.name)){d({},i.ExpectedXJSClosingTag,on(r.name))}}if(!o&&n("<")){d(c,i.AdjacentXJSElements)}return t(m,l.createXJSElement(r,s,u))}function Hr(){var e,i=p(),r=null,a;V("type");e=I();if(n("<")){r=C()}u("=");a=j();k();return t(i,l.createTypeAlias(e,r,a))}function zr(){var a=p(),e,r=null;e=I();if(n("<")){r=fn()}return t(a,l.createInterfaceExtends(e,r))}function Et(c,f){var r,a,i=[],s,o=null;s=I();if(n("<")){o=C()}if(b("extends")){x("extends");while(e<y){i.push(zr());if(!n(",")){break}u(",")}}a=p();r=t(a,ot(f));return t(c,l.createInterface(s,o,r,i))}function $r(){var n,t,r=[],l,e=p(),a=null;V("interface");return Et(e,false)}function wt(){var n=p(),e;V("declare");x("class");e=Et(n,true);e.type=r.DeclareClass;return e}function _t(){var e,i,m=p(),s,o,c,r,f=null,d,a;V("declare");x("function");i=p();e=I();a=p();if(n("<")){f=C()}u("(");r=Vn();s=r.params;c=r.rest;u(")");u(":");o=j();d=t(a,l.createFunctionTypeAnnotation(s,o,c,f));e.typeAnnotation=t(a,l.createTypeAnnotation(d));t(i,e);k();return t(m,l.createDeclareFunction(e))}function St(){var e,n=p();V("declare");x("var");e=Q();k();return t(n,l.createDeclareVariable(e))}function el(){var r=[],s,a,f,h=p(),d;V("declare");V("module");if(c.type===o.StringLiteral){if(v&&c.octal){E(c,i.StrictOctalLiteral)}f=p();a=t(f,l.createLiteral(m()))}else{a=I()}s=p();u("{");while(e<y&&!n("}")){d=P();switch(d.value){case"class":r.push(wt());break;case"function":r.push(_t());break;case"var":r.push(St());break;default:S(c)}}u("}");return t(h,l.createDeclareModule(a,t(s,l.createBlockStatement(r))))}function nl(){var u,t,n,l,i,r;if(!a.inXJSChild){N()}u=e;t={start:{line:h,column:e-g}};n=f.advance();t.end={line:h,column:e-g};if(n.type!==o.EOF){l=[n.range[0],n.range[1]];i=s.slice(n.range[0],n.range[1]);r={type:A[n.type],value:i,range:l,loc:t};if(n.regex){r.regex={pattern:n.regex.pattern,flags:n.regex.flags}}f.tokens.push(r)}return n}function tl(){var r,l,t,n;N();r=e;l={start:{line:h,column:e-g}};t=f.scanRegExp();l.end={line:h,column:e-g};if(!f.tokenize){if(f.tokens.length>0){n=f.tokens[f.tokens.length-1];if(n.range[0]===r&&n.type==="Punctuator"){if(n.value==="/"||n.value==="/="){f.tokens.pop()}}}f.tokens.push({type:"RegularExpression",value:t.literal,regex:t.regex,range:[r,e],loc:l})}return t}function kt(){var t,e,n,r=[];for(t=0;t<f.tokens.length;++t){e=f.tokens[t];n={type:e.type,value:e.value};if(e.regex){n.regex={pattern:e.regex.pattern,flags:e.regex.flags}}if(f.range){n.range=e.range}if(f.loc){n.loc=e.loc}r.push(n)}f.tokens=r}function It(){if(f.comments){f.skipComment=N;N=Sr}if(typeof f.tokens!=="undefined"){f.advance=en;f.scanRegExp=F;en=nl;F=tl}}function Rt(){if(typeof f.skipComment==="function"){N=f.skipComment}if(typeof f.scanRegExp==="function"){en=f.advance;F=f.scanRegExp}}function il(n,t){var e,r={};for(e in n){if(n.hasOwnProperty(e)){r[e]=n[e]}}for(e in t){if(t.hasOwnProperty(e)){r[e]=t[e]}}return r}function sl(t,n){var u,i,r;u=String;if(typeof t!=="string"&&!(t instanceof String)){t=u(t)}l=kn;s=t;e=0;h=s.length>0?1:0;g=0;y=s.length;c=null;a={allowKeyword:true,allowIn:true,labelSet:new O,inFunctionBody:false,inIteration:false,inSwitch:false,lastCommentStart:-1};f={};n=n||{};n.tokens=true;f.tokens=[];f.tokenize=true;f.openParenToken=-1;f.openCurlyToken=-1;f.range=typeof n.range==="boolean"&&n.range;f.loc=typeof n.loc==="boolean"&&n.loc;if(typeof n.comment==="boolean"&&n.comment){f.comments=[]}if(typeof n.tolerant==="boolean"&&n.tolerant){f.errors=[]}It();try{mn();if(c.type===o.EOF){return f.tokens}i=m();while(c.type!==o.EOF){try{i=m()}catch(p){i=c;if(f.errors){f.errors.push(p);break}else{throw p}}}kt();r=f.tokens;if(typeof f.comments!=="undefined"){r.comments=f.comments}if(typeof f.errors!=="undefined"){r.errors=f.errors}}catch(d){throw d}finally{Rt();f={}}return r}function Nt(t,n){var r,i;i=String;if(typeof t!=="string"&&!(t instanceof String)){t=i(t)}l=kn;s=t;e=0;h=s.length>0?1:0;g=0;y=s.length;c=null;a={allowKeyword:false,allowIn:true,labelSet:new O,parenthesizedCount:0,inFunctionBody:false,inIteration:false,inSwitch:false,inXJSChild:false,inXJSTag:false,inType:false,lastCommentStart:-1,yieldAllowed:false,awaitAllowed:false};f={};if(typeof n!=="undefined"){f.range=typeof n.range==="boolean"&&n.range;f.loc=typeof n.loc==="boolean"&&n.loc;f.attachComment=typeof n.attachComment==="boolean"&&n.attachComment;if(f.loc&&n.source!==null&&n.source!==undefined){l=il(l,{postProcess:function(e){e.loc.source=i(n.source);return e}})}if(n.sourceType==="module"){f.isModule=true}if(typeof n.tokens==="boolean"&&n.tokens){f.tokens=[]}if(typeof n.comment==="boolean"&&n.comment){f.comments=[]}if(typeof n.tolerant==="boolean"&&n.tolerant){f.errors=[]}if(f.attachComment){f.range=true;f.comments=[];f.bottomRightStack=[];f.trailingComments=[];f.leadingComments=[]}}It();try{r=wr();if(typeof f.comments!=="undefined"){r.comments=f.comments}if(typeof f.tokens!=="undefined"){kt();r.tokens=f.tokens}if(typeof f.errors!=="undefined"){r.errors=f.errors}}catch(o){throw o}finally{Rt();f={}}return r}En.version="10001.1.0-dev-harmony-fb";En.tokenize=sl;En.parse=Nt;En.Syntax=function(){var e,n={};if(typeof Object.create==="function"){n=Object.create(null)}for(e in r){if(r.hasOwnProperty(e)){n[e]=r[e]}}if(typeof Object.freeze==="function"){Object.freeze(n)}return n}()})},{}],167:[function(t,b,g){var n=t("assert");var s=t("./types");var h=s.namedTypes;var m=s.builtInTypes.array;var y=s.builtInTypes.object;var o=t("./lines");var l=o.fromString;var u=o.Lines;var f=o.concat;var a=t("./util").comparePos;var c=t("private").makeUniqueKey();function p(e,n){if(!e){return}if(n){if(h.Node.check(e)&&h.SourceLocation.check(e.loc)){for(var t=n.length-1;t>=0;--t){if(a(n[t].loc.end,e.loc.start)<=0){break}}n.splice(t+1,0,e);return}}else if(e[c]){return e[c]}var r;if(m.check(e)){r=Object.keys(e)}else if(y.check(e)){r=s.getFieldNames(e)}else{return}if(!n){Object.defineProperty(e,c,{value:n=[],enumerable:false})}for(var t=0,l=r.length;t<l;++t){p(e[r[t]],n)}return n}function d(u,e){var i=p(u);var t=0,r=i.length;while(t<r){var l=t+r>>1;var n=i[l];if(a(n.loc.start,e.loc.start)<=0&&a(e.loc.end,n.loc.end)<=0){d(e.enclosingNode=n,e);return}if(a(n.loc.end,e.loc.start)<=0){var s=n;t=l+1;continue}if(a(e.loc.end,n.loc.start)<=0){var o=n;r=l;continue}throw new Error("Comment location overlaps with node location")}if(s){e.precedingNode=s}if(o){e.followingNode=o}}g.attach=function(a,i,l){if(!m.check(a)){return}var t=[];a.forEach(function(a){a.loc.lines=l;d(i,a);var s=a.precedingNode;var c=a.enclosingNode;var o=a.followingNode;if(s&&o){var f=t.length;if(f>0){var u=t[f-1];n.strictEqual(u.precedingNode===a.precedingNode,u.followingNode===a.followingNode);if(u.followingNode!==a.followingNode){r(t,l)}}t.push(a)}else if(s){r(t,l);e.forNode(s).addTrailing(a)}else if(o){r(t,l);e.forNode(o).addLeading(a)}else if(c){r(t,l);e.forNode(c).addDangling(a)}else{throw new Error("AST contains no nodes at all?")}});r(t,l)};function r(t,u){var i=t.length;if(i===0){return}var s=t[0].precedingNode;var a=t[0].followingNode;var o=a.loc.start;for(var r=i;r>0;--r){var l=t[r-1];n.strictEqual(l.precedingNode,s);n.strictEqual(l.followingNode,a);var c=u.sliceString(l.loc.end,o);if(/\S/.test(c)){break}o=l.loc.start}while(r<=i&&(l=t[r])&&l.type==="Line"&&l.loc.start.column>a.loc.start.column){++r}t.forEach(function(n,t){if(t<r){e.forNode(s).addTrailing(n)}else{e.forNode(a).addLeading(n)}});t.length=0}function e(){n.ok(this instanceof e);this.leading=[];this.dangling=[];this.trailing=[]}var i=e.prototype;e.forNode=function E(t){var n=t.comments;if(!n){Object.defineProperty(t,"comments",{value:n=new e,enumerable:false})}return n};i.forEach=function w(e,n){this.leading.forEach(e,n);this.trailing.forEach(e,n)};i.addLeading=function _(e){this.leading.push(e)};i.addDangling=function S(e){this.dangling.push(e)};i.addTrailing=function k(e){e.trailing=true;if(e.type==="Block"){this.trailing.push(e)}else{this.leading.push(e)}};function v(e,s){var r=e.loc;var a=r&&r.lines;var t=[];if(e.type==="Block"){t.push("/*",l(e.value,s),"*/")}else if(e.type==="Line"){t.push("//",l(e.value,s))
}else n.fail(e.type);if(e.trailing){t.push("\n")}else if(a instanceof u){var i=a.slice(r.end,a.skipSpaces(r.end));if(i.length===1){t.push(i)}else{t.push(new Array(i.length).join("\n"))}}else{t.push("\n")}return f(t).stripMargin(r?r.start.column:0)}function x(e,s){var t=e.loc;var a=t&&t.lines;var r=[];if(a instanceof u){var o=a.skipSpaces(t.start,true)||a.firstPos();var i=a.slice(o,t.start);if(i.length===1){r.push(i)}else{r.push(new Array(i.length).join("\n"))}}if(e.type==="Block"){r.push("/*",l(e.value,s),"*/")}else if(e.type==="Line"){r.push("//",l(e.value,s),"\n")}else n.fail(e.type);return f(r).stripMargin(t?t.start.column:0,true)}g.printComments=function(e,t,a){if(t){n.ok(t instanceof u)}else{t=l("")}if(!e||!(e.leading.length+e.trailing.length)){return t}var r=[];e.leading.forEach(function(e){r.push(v(e,a))});r.push(t);e.trailing.forEach(function(e){n.strictEqual(e.type,"Block");r.push(x(e,a))});return f(r)}},{"./lines":169,"./types":175,"./util":176,assert:110,"private":143}],168:[function(s,u,m){var t=s("assert");var l=s("./types");var e=l.namedTypes;var p=e.Node;var f=l.builtInTypes.array;var o=l.builtInTypes.number;function r(e){t.ok(this instanceof r);this.stack=[e]}var n=r.prototype;u.exports=r;r.from=function(e){if(e instanceof r){return e.copy()}if(e instanceof l.NodePath){var t=Object.create(r.prototype);var a=[e.value];for(var n;n=e.parentPath;e=n)a.push(e.name,n.value);t.stack=a.reverse();return t}return new r(e)};n.copy=function h(){var h=Object.create(r.prototype);h.stack=this.stack.slice(0);return h};n.getName=function g(){var e=this.stack;var n=e.length;if(n>1){return e[n-2]}return null};n.getValue=function y(){var e=this.stack;return e[e.length-1]};n.getNode=function v(){var t=this.stack;for(var n=t.length-1;n>=0;n-=2){var r=t[n];if(e.Node.check(r)){return r}}return null};n.getParentNode=function x(){var t=this.stack;var l=0;for(var n=t.length-1;n>=0;n-=2){var r=t[n];if(e.Node.check(r)&&l++>0){return r}}return null};n.getRootValue=function b(){var e=this.stack;if(e.length%2===0){return e[1]}return e[0]};n.call=function E(a){var e=this.stack;var r=e.length;var n=e[r-1];var i=arguments.length;for(var t=1;t<i;++t){var l=arguments[t];n=n[l];e.push(l,n)}var s=a(this);e.length=r;return s};n.each=function w(a){var n=this.stack;var r=n.length;var t=n[r-1];var i=arguments.length;for(var e=1;e<i;++e){var l=arguments[e];t=t[l];n.push(l,t)}for(var e=0;e<t.length;++e){if(e in t){n.push(e,t[e]);a(this);n.length-=2}}n.length=r};n.map=function _(i){var t=this.stack;var r=t.length;var n=t[r-1];var s=arguments.length;for(var e=1;e<s;++e){var l=arguments[e];n=n[l];t.push(l,n)}var a=new Array(n.length);for(var e=0;e<n.length;++e){if(e in n){t.push(e,n[e]);a[e]=i(this,e);t.length-=2}}t.length=r;return a};n.needsParens=function(c){var n=this.getParentNode();if(!n){return false}var l=this.getName();var r=this.getNode();if(!e.Expression.check(r)){return false}if(r.type==="Identifier"){return false}switch(r.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return n.type==="MemberExpression"&&l==="object"&&n.object===r;case"BinaryExpression":case"LogicalExpression":switch(n.type){case"CallExpression":return l==="callee"&&n.callee===r;case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return true;case"MemberExpression":return l==="object"&&n.object===r;case"BinaryExpression":case"LogicalExpression":var f=n.operator;var s=i[f];var p=r.operator;var u=i[p];if(s>u){return true}if(s===u&&l==="right"){t.strictEqual(n.right,r);return true}default:return false}case"SequenceExpression":switch(n.type){case"ForStatement":return false;case"ExpressionStatement":return l!=="expression";default:return true}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 true;default:return false}case"Literal":return n.type==="MemberExpression"&&o.check(r.value)&&l==="object"&&n.object===r;case"AssignmentExpression":case"ConditionalExpression":switch(n.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":return true;case"CallExpression":return l==="callee"&&n.callee===r;case"ConditionalExpression":return l==="test"&&n.test===r;case"MemberExpression":return l==="object"&&n.object===r;default:return false}default:if(n.type==="NewExpression"&&l==="callee"&&n.callee===r){return a(r)}}if(c!==true&&!this.canBeFirstInStatement()&&this.firstInStatement())return true;return false};function c(n){return e.BinaryExpression.check(n)||e.LogicalExpression.check(n)}function d(n){return e.UnaryExpression.check(n)||e.SpreadElement&&e.SpreadElement.check(n)||e.SpreadProperty&&e.SpreadProperty.check(n)}var i={};[["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]].forEach(function(e,n){e.forEach(function(e){i[e]=n})});function a(n){if(e.CallExpression.check(n)){return true}if(f.check(n)){return n.some(a)}if(e.Node.check(n)){return l.someField(n,function(n,e){return a(e)})}return false}n.canBeFirstInStatement=function(){var n=this.getNode();return!e.FunctionExpression.check(n)&&!e.ObjectExpression.check(n)};n.firstInStatement=function(){var i=this.stack;var s,n;var l,r;for(var a=i.length-1;a>=0;a-=2){if(e.Node.check(i[a])){l=s;r=n;s=i[a-1];n=i[a]}if(!n||!r){continue}if(e.BlockStatement.check(n)&&s==="body"&&l===0){t.strictEqual(n.body[0],r);return true}if(e.ExpressionStatement.check(n)&&l==="expression"){t.strictEqual(n.expression,r);return true}if(e.SequenceExpression.check(n)&&s==="expressions"&&l===0){t.strictEqual(n.expressions[0],r);continue}if(e.CallExpression.check(n)&&l==="callee"){t.strictEqual(n.callee,r);continue}if(e.MemberExpression.check(n)&&l==="object"){t.strictEqual(n.object,r);continue}if(e.ConditionalExpression.check(n)&&l==="test"){t.strictEqual(n.test,r);continue}if(c(n)&&l==="left"){t.strictEqual(n.left,r);continue}if(e.UnaryExpression.check(n)&&!n.prefix&&l==="argument"){t.strictEqual(n.argument,r);continue}return false}return true}},{"./types":175,assert:110}],169:[function(l,_,p){var n=l("assert");var E=l("source-map");var h=l("./options").normalize;var y=l("private").makeUniqueKey();var w=l("./types");var m=w.builtInTypes.string;var g=l("./util").comparePos;var b=l("./mapping");function t(e){return e[y]}function r(l,e){n.ok(this instanceof r);n.ok(l.length>0);if(e){m.assert(e)}else{e=null}Object.defineProperty(this,y,{value:{infos:l,mappings:[],name:e,cachedSourceMap:null}});if(e){t(this).mappings.push(new b(this,{start:this.firstPos(),end:this.lastPos()}))}}p.Lines=r;var e=r.prototype;Object.defineProperties(e,{length:{get:function(){return t(this).infos.length}},name:{get:function(){return t(this).name}}});function o(e){return{line:e.line,indent:e.indent,sliceStart:e.sliceStart,sliceEnd:e.sliceEnd}}var f={};var c=f.hasOwnProperty;var v=10;function d(a,t){var e=0;var s=a.length;for(var l=0;l<s;++l){var r=a.charAt(l);if(r===" "){e+=1}else if(r===" "){n.strictEqual(typeof t,"number");n.ok(t>0);var i=Math.ceil(e/t)*t;if(i===e){e+=t}else{e=i}}else if(r==="\r"){}else{n.fail("unexpected whitespace character",r)}}return e}p.countSpaces=d;var x=/^\s*/;function u(e,t){if(e instanceof r)return e;e+="";var l=t&&t.tabWidth;var a=e.indexOf(" ")<0;var i=!t&&a&&e.length<=v;n.ok(l||a,"No tab width specified but encountered tabs in string\n"+e);if(i&&c.call(f,e))return f[e];var s=new r(e.split("\n").map(function(e){var n=x.exec(e)[0];return{line:e,indent:d(n,l),sliceStart:n.length,sliceEnd:e.length}}),h(t).sourceFileName);if(i)f[e]=s;return s}p.fromString=u;function s(e){return!/\S/.test(e)}e.toString=function(e){return this.sliceString(this.firstPos(),this.lastPos(),e)};e.getSourceMap=function(a,i){if(!a){return null}var e=this;function s(e){e=e||{};m.assert(a);e.file=a;if(i){m.assert(i);e.sourceRoot=i}return e}var r=t(e);if(r.cachedSourceMap){return s(r.cachedSourceMap.toJSON())}var l=new E.SourceMapGenerator(s());var o={};r.mappings.forEach(function(t){var r=t.sourceLines.skipSpaces(t.sourceLoc.start)||t.sourceLines.lastPos();var a=e.skipSpaces(t.targetLoc.start)||e.lastPos();while(g(r,t.sourceLoc.end)<0&&g(a,t.targetLoc.end)<0){var u=t.sourceLines.charAt(r);var f=e.charAt(a);n.strictEqual(u,f);var i=t.sourceLines.name;l.addMapping({source:i,original:{line:r.line,column:r.column},generated:{line:a.line,column:a.column}});if(!c.call(o,i)){var s=t.sourceLines.toString();l.setSourceContent(i,s);o[i]=s}e.nextPos(a,true);t.sourceLines.nextPos(r,true)}});r.cachedSourceMap=l;return l.toJSON()};e.bootstrapCharAt=function(e){n.strictEqual(typeof e,"object");n.strictEqual(typeof e.line,"number");n.strictEqual(typeof e.column,"number");var l=e.line,r=e.column,a=this.toString().split("\n"),t=a[l-1];if(typeof t==="undefined")return"";if(r===t.length&&l<a.length)return"\n";if(r>=t.length)return"";return t.charAt(r)};e.charAt=function(r){n.strictEqual(typeof r,"object");n.strictEqual(typeof r.line,"number");n.strictEqual(typeof r.column,"number");var a=r.line,s=r.column,o=t(this),u=o.infos,l=u[a-1],e=s;if(typeof l==="undefined"||e<0)return"";var i=this.getIndentAt(a);if(e<i)return" ";e+=l.sliceStart-i;if(e===l.sliceEnd&&a<this.length)return"\n";if(e>=l.sliceEnd)return"";return l.line.charAt(e)};e.stripMargin=function(e,l){if(e===0)return this;n.ok(e>0,"negative margin: "+e);if(l&&this.length===1)return this;var a=t(this);var i=new r(a.infos.map(function(n,t){if(n.line&&(t>0||!l)){n=o(n);n.indent=Math.max(0,n.indent-e)}return n}));if(a.mappings.length>0){var s=t(i).mappings;n.strictEqual(s.length,0);a.mappings.forEach(function(n){s.push(n.indent(e,l,true))})}return i};e.indent=function(e){if(e===0)return this;var l=t(this);var a=new r(l.infos.map(function(n){if(n.line){n=o(n);n.indent+=e}return n}));if(l.mappings.length>0){var i=t(a).mappings;n.strictEqual(i.length,0);l.mappings.forEach(function(n){i.push(n.indent(e))})}return a};e.indentTail=function(e){if(e===0)return this;if(this.length<2)return this;var l=t(this);var a=new r(l.infos.map(function(n,t){if(t>0&&n.line){n=o(n);n.indent+=e}return n}));if(l.mappings.length>0){var i=t(a).mappings;n.strictEqual(i.length,0);l.mappings.forEach(function(n){i.push(n.indent(e,true))})}return a};e.getIndentAt=function(e){n.ok(e>=1,"no line "+e+" (line numbers start from 1)");var r=t(this),l=r.infos[e-1];return Math.max(l.indent,0)};e.guessTabWidth=function(){var l=t(this);if(c.call(l,"cachedTabWidth")){return l.cachedTabWidth}var n=[];var i=0;for(var a=1,p=this.length;a<=p;++a){var r=l.infos[a-1];var d=r.line.slice(r.sliceStart,r.sliceEnd);if(s(d)){continue}var o=Math.abs(r.indent-i);n[o]=~~n[o]+1;i=r.indent}var u=-1;var f=2;for(var e=1;e<n.length;e+=1){if(c.call(n,e)&&n[e]>u){u=n[e];f=e}}return l.cachedTabWidth=f};e.isOnlyWhitespace=function(){return s(this.toString())};e.isPrecededOnlyByWhitespace=function(n){var a=t(this);var e=a.infos[n.line-1];var i=Math.max(e.indent,0);var r=n.column-i;if(r<=0){return true}var l=e.sliceStart;var o=Math.min(l+r,e.sliceEnd);var u=e.line.slice(l,o);return s(u)};e.getLineLength=function(e){var r=t(this),n=r.infos[e-1];return this.getIndentAt(e)+n.sliceEnd-n.sliceStart};e.nextPos=function(e,n){var t=Math.max(e.line,0),r=Math.max(e.column,0);if(r<this.getLineLength(t)){e.column+=1;return n?!!this.skipSpaces(e,false,true):true}if(t<this.length){e.line+=1;e.column=0;return n?!!this.skipSpaces(e,false,true):true}return false};e.prevPos=function(e,r){var n=e.line,t=e.column;if(t<1){n-=1;if(n<1)return false;t=this.getLineLength(n)}else{t=Math.min(t-1,this.getLineLength(n))}e.line=n;e.column=t;return r?!!this.skipSpaces(e,true,true):true};e.firstPos=function(){return{line:1,column:0}};e.lastPos=function(){return{line:this.length,column:this.getLineLength(this.length)}};e.skipSpaces=function(e,n,t){if(e){e=t?e:{line:e.line,column:e.column}}else if(n){e=this.lastPos()}else{e=this.firstPos()}if(n){while(this.prevPos(e)){if(!s(this.charAt(e))&&this.nextPos(e)){return e}}return null}else{while(s(this.charAt(e))){if(!this.nextPos(e)){return null}}return e}};e.trimLeft=function(){var e=this.skipSpaces(this.firstPos(),false,true);return e?this.slice(e):a};e.trimRight=function(){var e=this.skipSpaces(this.lastPos(),true,true);return e?this.slice(this.firstPos(),e):a};e.trim=function(){var e=this.skipSpaces(this.firstPos(),false,true);if(e===null)return a;var t=this.skipSpaces(this.lastPos(),true,true);n.notStrictEqual(t,null);return this.slice(e,t)};e.eachPos=function(r,n,t){var e=this.firstPos();if(n){e.line=n.line,e.column=n.column}if(t&&!this.skipSpaces(e,false,true)){return}do r.call(this,e);while(this.nextPos(e,t))};e.bootstrapSlice=function(n,t){var e=this.toString().split("\n").slice(n.line-1,t.line);e.push(e.pop().slice(0,t.column));e[0]=e[0].slice(n.column);return u(e.join("\n"))};e.slice=function(l,e){if(!e){if(!l){return this}e=this.lastPos()}var s=t(this);var a=s.infos.slice(l.line-1,e.line);if(l.line===e.line){a[0]=i(a[0],l.column,e.column)}else{n.ok(l.line<e.line);a[0]=i(a[0],l.column);a.push(i(a.pop(),0,e.column))}var o=new r(a);if(s.mappings.length>0){var u=t(o).mappings;n.strictEqual(u.length,0);s.mappings.forEach(function(t){var n=t.slice(this,l,e);if(n){u.push(n)}},this)}return o};function i(r,l,t){var a=r.sliceStart;var i=r.sliceEnd;var e=Math.max(r.indent,0);var s=e+i-a;if(typeof t==="undefined"){t=s}l=Math.max(l,0);t=Math.min(t,s);t=Math.max(t,l);if(t<e){e=t;i=a}else{i-=s-t}s=t;s-=l;if(l<e){e-=l}else{l-=e;e=0;a+=l}n.ok(e>=0);n.ok(a<=i);n.strictEqual(s,e+i-a);if(r.indent===e&&r.sliceStart===a&&r.sliceEnd===i){return r}return{line:r.line,indent:e,sliceStart:a,sliceEnd:i}}e.bootstrapSliceString=function(e,n,t){return this.slice(e,n).toString(t)};e.sliceString=function(a,n,l){if(!n){if(!a){return this}n=this.lastPos()}l=h(l);var y=t(this).infos;var c=[];var m=l.tabWidth;for(var r=a.line;r<=n.line;++r){var e=y[r-1];if(r===a.line){if(r===n.line){e=i(e,a.column,n.column)}else{e=i(e,a.column)}}else if(r===n.line){e=i(e,0,n.column)}var f=Math.max(e.indent,0);var g=e.line.slice(0,e.sliceStart);if(l.reuseWhitespace&&s(g)&&d(g,l.tabWidth)===f){c.push(e.line.slice(0,e.sliceEnd));continue}var o=0;var p=f;if(l.useTabs){o=Math.floor(f/m);p-=o*m}var u="";if(o>0){u+=new Array(o+1).join(" ")}if(p>0){u+=new Array(p+1).join(" ")}u+=e.line.slice(e.sliceStart,e.sliceEnd);c.push(u)}return c.join("\n")};e.isEmpty=function(){return this.length<2&&this.getLineLength(1)<1};e.join=function(f){var s=this;var p=t(s);var n=[];var l=[];var e;function i(t){if(t===null)return;if(e){var r=t.infos[0];var a=new Array(r.indent+1).join(" ");var i=n.length;var s=Math.max(e.indent,0)+e.sliceEnd-e.sliceStart;e.line=e.line.slice(0,e.sliceEnd)+a+r.line.slice(r.sliceStart,r.sliceEnd);e.sliceEnd=e.line.length;if(t.mappings.length>0){t.mappings.forEach(function(e){l.push(e.add(i,s))})}}else if(t.mappings.length>0){l.push.apply(l,t.mappings)}t.infos.forEach(function(t,r){if(!e||r>0){e=o(t);n.push(e)}})}function d(e,n){if(n>0)i(p);i(e)}f.map(function(n){var e=u(n);if(e.isEmpty())return null;return t(e)}).forEach(s.isEmpty()?i:d);if(n.length<1)return a;var c=new r(n);t(c).mappings=l;return c};p.concat=function(e){return a.join(e)};e.concat=function(r){var t=arguments,e=[this];e.push.apply(e,t);n.strictEqual(e.length,t.length+1);return a.join(e)};var a=u("")},{"./mapping":170,"./options":171,"./types":175,"./util":176,assert:110,"private":143,"source-map":186}],170:[function(s,f,h){var e=s("assert");var o=s("./types");var m=o.builtInTypes.string;var i=o.builtInTypes.number;var p=o.namedTypes.SourceLocation;var l=o.namedTypes.Position;var u=s("./lines");var t=s("./util").comparePos;function r(l,t,n){e.ok(this instanceof r);e.ok(l instanceof u.Lines);p.assert(t);if(n){e.ok(i.check(n.start.line)&&i.check(n.start.column)&&i.check(n.end.line)&&i.check(n.end.column))}else{n=t}Object.defineProperties(this,{sourceLines:{value:l},sourceLoc:{value:t},targetLoc:{value:n}})}var a=r.prototype;f.exports=r;a.slice=function(f,a,s){e.ok(f instanceof u.Lines);l.assert(a);if(s){l.assert(s)}else{s=f.lastPos()}var p=this.sourceLines;var o=this.sourceLoc;var i=this.targetLoc;function c(n){var r=o[n];var l=i[n];var t=a;if(n==="end"){t=s}else{e.strictEqual(n,"start")}return d(p,r,f,l,t)}if(t(a,i.start)<=0){if(t(i.end,s)<=0){i={start:n(i.start,a.line,a.column),end:n(i.end,a.line,a.column)}}else if(t(s,i.start)<=0){return null}else{o={start:o.start,end:c("end")};i={start:n(i.start,a.line,a.column),end:n(s,a.line,a.column)}}}else{if(t(i.end,a)<=0){return null}if(t(i.end,s)<=0){o={start:c("start"),end:o.end};i={start:{line:1,column:0},end:n(i.end,a.line,a.column)}}else{o={start:c("start"),end:c("end")};i={start:{line:1,column:0},end:n(s,a.line,a.column)}}}return new r(this.sourceLines,o,i)};a.add=function(e,n){return new r(this.sourceLines,this.sourceLoc,{start:c(this.targetLoc.start,e,n),end:c(this.targetLoc.end,e,n)})};function c(e,n,t){return{line:e.line+n-1,column:e.line===1?e.column+t:e.column}}a.subtract=function(e,t){return new r(this.sourceLines,this.sourceLoc,{start:n(this.targetLoc.start,e,t),end:n(this.targetLoc.end,e,t)})};function n(e,n,t){return{line:e.line-n+1,column:e.line===n?e.column-t:e.column}}a.indent=function(n,t,i){if(n===0){return this}var e=this.targetLoc;var l=e.start.line;var a=e.end.line;if(t&&l===1&&a===1){return this}e={start:e.start,end:e.end};if(!t||l>1){var s=e.start.column+n;e.start={line:l,column:i?Math.max(0,s):s}}if(!t||a>1){var o=e.end.column+n;e.end={line:a,column:i?Math.max(0,o):o}}return new r(this.sourceLines,this.sourceLoc,e)};function d(a,c,i,f,o){e.ok(a instanceof u.Lines);e.ok(i instanceof u.Lines);l.assert(c);l.assert(f);l.assert(o);var p=t(f,o);if(p===0){return c}if(p<0){var r=a.skipSpaces(c);var n=i.skipSpaces(f);var s=o.line-n.line;r.line+=s;n.line+=s;if(s>0){r.column=0;n.column=0}else{e.strictEqual(s,0)}while(t(n,o)<0&&i.nextPos(n,true)){e.ok(a.nextPos(r,true));e.strictEqual(a.charAt(r),i.charAt(n))}}else{var r=a.skipSpaces(c,true);var n=i.skipSpaces(f,true);var s=o.line-n.line;r.line+=s;n.line+=s;if(s<0){r.column=a.getLineLength(r.line);n.column=i.getLineLength(n.line)}else{e.strictEqual(s,0)}while(t(o,n)<0&&i.prevPos(n,true)){e.ok(a.prevPos(r,true));e.strictEqual(a.charAt(r),i.charAt(n))}}return r}},{"./lines":169,"./types":175,"./util":176,assert:110}],171:[function(n,l,t){var e={esprima:n("esprima-fb"),tabWidth:4,useTabs:false,reuseWhitespace:true,wrapColumn:74,sourceFileName:null,sourceMapName:null,sourceRoot:null,inputSourceMap:null,range:false,tolerant:true},r=e.hasOwnProperty;t.normalize=function(t){t=t||e;function n(n){return r.call(t,n)?t[n]:e[n]}return{tabWidth:+n("tabWidth"),useTabs:!!n("useTabs"),reuseWhitespace:!!n("reuseWhitespace"),wrapColumn:Math.max(n("wrapColumn"),0),sourceFileName:n("sourceFileName"),sourceMapName:n("sourceMapName"),sourceRoot:n("sourceRoot"),inputSourceMap:n("inputSourceMap"),esprima:n("esprima"),range:n("range"),tolerant:n("tolerant")}}},{"esprima-fb":166}],172:[function(e,h,a){var o=e("assert");var n=e("./types");var t=n.namedTypes;var i=n.builders;var s=n.builtInTypes.object;var p=n.builtInTypes.array;var m=n.builtInTypes.function;var d=e("./patcher").Patcher;var f=e("./options").normalize;var c=e("./lines").fromString;var u=e("./comments").attach;a.parse=function g(s,e){e=f(e);var n=c(s,e);var o=n.toString({tabWidth:e.tabWidth,reuseWhitespace:false,useTabs:false});var t=e.esprima.parse(o,{loc:true,range:e.range,comment:true,tolerant:e.tolerant,sourceType:"module"});var p=t.comments;delete t.comments;var l=i.file(t);l.loc={lines:n,indent:0,start:n.firstPos(),end:n.lastPos()};var a=new r(n).copy(l);u(p,a.program,n);return a};function r(e){o.ok(this instanceof r);this.lines=e;this.indent=0}var l=r.prototype;l.copy=function(e){if(p.check(e)){return e.map(this.copy,this)}if(!s.check(e)){return e}if(t.MethodDefinition&&t.MethodDefinition.check(e)||t.Property.check(e)&&(e.method||e.shorthand)){e.value.loc=null;if(t.FunctionExpression.check(e.value)){e.value.id=null}}var l=Object.create(Object.getPrototypeOf(e),{original:{value:e,configurable:false,enumerable:false,writable:true}});var n=e.loc;var i=this.indent;var o=i;if(n){if(n.start.line<1){n.start.line=1}if(n.end.line<1){n.end.line=1}if(this.lines.isPrecededOnlyByWhitespace(n.start)){o=this.indent=n.start.column}n.lines=this.lines;n.indent=o}var u=Object.keys(e);var c=u.length;for(var a=0;a<c;++a){var r=u[a];if(r==="loc"){l[r]=e[r]}else if(r==="comments"){}else{l[r]=this.copy(e[r])}}this.indent=i;if(e.comments){Object.defineProperty(l,"comments",{value:e.comments,enumerable:false})}return l}},{"./comments":167,"./lines":169,"./options":171,"./patcher":173,"./types":175,assert:110}],173:[function(a,S,h){var r=a("assert");var o=a("./lines");var e=a("./types");var k=e.getFieldValue;var l=e.namedTypes.Node;var g=e.namedTypes.Expression;var E=e.namedTypes.SourceLocation;var f=a("./util");var t=f.comparePos;var p=a("./fast-path");var n=e.builtInTypes.object;var u=e.builtInTypes.array;var v=e.builtInTypes.string;function i(e){r.ok(this instanceof i);r.ok(e instanceof o.Lines);var n=this,l=[];n.replace=function(n,e){if(v.check(e))e=o.fromString(e);l.push({lines:e,start:n.start,end:n.end})};n.get=function(n){n=n||{start:{line:1,column:0},end:{line:e.length,column:e.getLineLength(e.length)}};var a=n.start,i=[];function s(n,l){r.ok(t(n,l)<=0);i.push(e.slice(n,l))}l.sort(function(e,n){return t(e.start,n.start)}).forEach(function(e){if(t(a,e.start)>0){}else{s(a,e.start);i.push(e.lines);a=e.end}});s(a,n.end);return o.concat(i)}}h.Patcher=i;h.getReprinter=function(e){r.ok(e instanceof p);var a=e.getValue();if(!l.check(a))return;var n=a.original;var t=n&&n.loc;var s=t&&t.lines;var o=[];if(!s||!y(e,o))return;return function(r){var e=new i(s);o.forEach(function(t){var n=t.oldNode;E.assert(n.loc,true);e.replace(n.loc,r(t.newPath).indentTail(n.loc.indent))});return e.get(t).indentTail(-n.loc.indent)}};function y(a,e){var n=a.getValue();l.assert(n);var t=n.original;l.assert(t);r.deepEqual(e,[]);if(n.type!==t.type){return false}var o=new p(t);var i=s(a,o,e);if(!i){e.length=0}return i}function c(e,t,l){var r=e.getValue();var a=t.getValue();if(r===a)return true;if(u.check(r))return x(e,t,l);if(n.check(r))return b(e,t,l);return false}function x(n,t,i){var r=n.getValue();var l=t.getValue();u.assert(r);var a=r.length;if(!(u.check(l)&&l.length===a))return false;for(var e=0;e<a;++e){n.stack.push(e,r[e]);t.stack.push(e,l[e]);var s=c(n,t,i);n.stack.length-=2;t.stack.length-=2;if(!s){return false}}return true}function b(t,i,r){var a=t.getValue();n.assert(a);if(a.original===null){return false}var e=i.getValue();if(!n.check(e))return false;if(l.check(a)){if(!l.check(e)){return false}if(!e.loc){return false}if(a.type===e.type){var o=[];if(s(t,i,o)){r.push.apply(r,o)}else{r.push({oldNode:e,newPath:t.copy()})}return true}if(g.check(a)&&g.check(e)){r.push({oldNode:e,newPath:t.copy()});return true}return false}return s(t,i,r)}var m={line:1,column:0};function d(l){var i=l.getValue();var n=i.loc;var r=n&&n.lines;if(r){var e=m;e.line=n.start.line;e.column=n.start.column;while(r.prevPos(e)){var a=r.charAt(e);if(a==="("){return t(l.getRootValue().loc.start,e)<=0}if(a!==" "){return false}}}return false}function w(l){var i=l.getValue();var n=i.loc;var r=n&&n.lines;if(r){var e=m;e.line=n.end.line;e.column=n.end.column;do{var a=r.charAt(e);if(a===")"){return t(e,l.getRootValue().loc.end)<=0}if(a!==" "){return false}}while(r.nextPos(e))}return false}function _(e){return d(e)&&w(e)}function s(t,r,s){var a=t.getValue();var i=r.getValue();n.assert(a);n.assert(i);if(a.original===null){return false}if(!t.canBeFirstInStatement()&&t.firstInStatement()&&!d(r))return false;if(t.needsParens(true)&&!_(r)){return false}for(var l in f.getUnionOfKeys(a,i)){if(l==="loc")continue;t.stack.push(l,e.getFieldValue(a,l));r.stack.push(l,e.getFieldValue(i,l));var o=c(t,r,s);t.stack.length-=2;r.stack.length-=2;if(!o){return false}}return true}},{"./fast-path":168,"./lines":169,"./types":175,"./util":176,assert:110}],174:[function(l,D,j){var r=l("assert");var O=l("source-map");var L=l("./comments").printComments;var h=l("./lines");var n=h.fromString;var e=h.concat;var A=l("./options").normalize;var I=l("./patcher").getReprinter;var f=l("./types");var t=f.namedTypes;var E=f.builtInTypes.string;var P=f.builtInTypes.object;var s=l("./fast-path");var c=l("./util");function i(n,e){r.ok(this instanceof i);E.assert(n);this.code=n;if(e){P.assert(e);this.map=e}}var M=i.prototype;var g=false;M.toString=function(){if(!g){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.");g=true}return this.code};var y=new i("");function v(n){r.ok(this instanceof v);var u=n&&n.tabWidth;var e=A(n);r.notStrictEqual(e,n);e.sourceFileName=null;function l(n){r.ok(n instanceof s);return L(n.getNode().comments,a(n),e)}function a(n,i){if(i)return l(n);r.ok(n instanceof s);if(!u){var o=e.tabWidth;var a=n.getNode().loc;if(a&&a.lines&&a.lines.guessTabWidth){e.tabWidth=a.lines.guessTabWidth();var c=t(n);e.tabWidth=o;return c}}return t(n)}function t(e){var n=I(e);if(n)return x(e,n(t));return f(e)}function f(n){return b(n,e,l)}function o(n){return b(n,e,o)}this.print=function(n){if(!n){return y}var t=a(s.from(n),true);return new i(t.toString(e),c.composeSourceMaps(e.inputSourceMap,t.getSourceMap(e.sourceMapName,e.sourceRoot)))};this.printGenerically=function(n){if(!n){return y}var t=s.from(n);var r=e.reuseWhitespace;e.reuseWhitespace=false;var l=new i(o(t).toString(e));e.reuseWhitespace=r;return l}}j.Printer=v;function x(t,n){return t.needsParens()?e(["(",n,")"]):n}function b(e,n,t){r.ok(e instanceof s);return x(e,k(e,n,t))}function k(l,f,i){var c=l.getValue();if(!c){return n("")}if(typeof c==="string"){return n(c,f)}t.Node.assert(c);switch(c.type){case"File":return l.call(i,"program");case"Program":return u(l.call(function(e){return o(e,f,i)},"body"));case"EmptyStatement":return n("");case"ExpressionStatement":return e([l.call(i,"expression"),";"]);case"BinaryExpression":case"LogicalExpression":case"AssignmentExpression":return n(" ").join([l.call(i,"left"),c.operator,l.call(i,"right")]);case"MemberExpression":var s=[l.call(i,"object")];if(c.computed)s.push("[",l.call(i,"property"),"]");else s.push(".",l.call(i,"property"));return e(s);case"Path":return n(".").join(c.body);case"Identifier":return n(c.name,f);case"SpreadElement":case"SpreadElementPattern":case"SpreadProperty":case"SpreadPropertyPattern":return e(["...",l.call(i,"argument")]);case"FunctionDeclaration":case"FunctionExpression":var s=[];if(c.async)s.push("async ");s.push("function");if(c.generator)s.push("*");if(c.id)s.push(" ",l.call(i,"id"));s.push("(",m(l,f,i),") ",l.call(i,"body"));return e(s);case"ArrowFunctionExpression":var s=[];if(c.async)s.push("async ");if(c.params.length===1){s.push(l.call(i,"params",0))}else{s.push("(",m(l,f,i),")")}s.push(" => ",l.call(i,"body"));return e(s);case"MethodDefinition":var s=[];if(c.static){s.push("static ")}s.push(w(l,f,i));return e(s);case"YieldExpression":var s=["yield"];if(c.delegate)s.push("*");if(c.argument)s.push(" ",l.call(i,"argument"));return e(s);case"AwaitExpression":var s=["await"];if(c.all)s.push("*");if(c.argument)s.push(" ",l.call(i,"argument"));return e(s);case"ModuleDeclaration":var s=["module",l.call(i,"id")];if(c.source){r.ok(!c.body);s.push("from",l.call(i,"source"))}else{s.push(l.call(i,"body"))}return n(" ").join(s);case"ImportSpecifier":case"ExportSpecifier":var s=[l.call(i,"id")];if(c.name)s.push(" as ",l.call(i,"name"));return e(s);case"ExportBatchSpecifier":return n("*");case"ImportNamespaceSpecifier":return e(["* as ",l.call(i,"id")]);case"ImportDefaultSpecifier":return l.call(i,"id");case"ExportDeclaration":var s=["export"];if(c["default"]){s.push(" default")}else if(c.specifiers&&c.specifiers.length>0){if(c.specifiers.length===1&&c.specifiers[0].type==="ExportBatchSpecifier"){s.push(" *")}else{s.push(" { ",n(", ").join(l.map(i,"specifiers"))," }")}if(c.source)s.push(" from ",l.call(i,"source"));s.push(";");return e(s)}if(c.declaration){if(!t.Node.check(c.declaration)){console.log(JSON.stringify(c,null,2))}var D=l.call(i,"declaration");s.push(" ",D);if(d(D)!==";"){s.push(";")}}return e(s);case"ImportDeclaration":var s=["import "];if(c.specifiers&&c.specifiers.length>0){var y=false;l.each(function(e){var l=e.getName();if(l>0){s.push(", ")}var n=e.getValue();if(t.ImportDefaultSpecifier.check(n)||t.ImportNamespaceSpecifier.check(n)){r.strictEqual(y,false)}else{t.ImportSpecifier.assert(n);if(!y){y=true;s.push("{")}}s.push(i(e))},"specifiers");if(y){s.push("}")}s.push(" from ")}s.push(l.call(i,"source"),";");return e(s);case"BlockStatement":var O=l.call(function(e){return o(e,f,i)},"body");if(O.isEmpty()){return n("{}")}return e(["{\n",O.indent(f.tabWidth),"\n}"]);case"ReturnStatement":var s=["return"];if(c.argument){var E=l.call(i,"argument");if(E.length>1&&t.XJSElement&&t.XJSElement.check(c.argument)){s.push(" (\n",E.indent(f.tabWidth),"\n)")}else{s.push(" ",E)}}s.push(";");return e(s);case"CallExpression":return e([l.call(i,"callee"),_(l,f,i)]);case"ObjectExpression":case"ObjectPattern":var R=false,v=c.properties.length,s=[v>0?"{\n":"{"];l.map(function(e){var r=e.getName();var l=e.getValue();var t=i(e).indent(f.tabWidth);var n=t.length>1;if(n&&R){s.push("\n")}s.push(t);if(r<v-1){s.push(n?",\n\n":",\n");R=!n}},"properties");s.push(v>0?"\n}":"}");return e(s);case"PropertyPattern":return e([l.call(i,"key"),": ",l.call(i,"pattern")]);case"Property":if(c.method||c.kind==="get"||c.kind==="set"){return w(l,f,i)}if(c.shorthand){return l.call(i,"key")}return e([l.call(i,"key"),": ",l.call(i,"value")]);case"ArrayExpression":case"ArrayPattern":var X=c.elements,v=X.length,s=["["];l.each(function(e){var n=e.getName();var t=e.getValue();if(!t){s.push(",")}else{if(n>0)s.push(" ");s.push(i(e));if(n<v-1)s.push(",")}},"elements");s.push("]");return e(s);case"SequenceExpression":return n(", ").join(l.map(i,"expressions"));case"ThisExpression":return n("this");case"Literal":if(typeof c.value!=="string")return n(c.value,f);case"ModuleSpecifier":return n(T(c),f);case"UnaryExpression":var s=[c.operator];if(/[a-z]$/.test(c.operator))s.push(" ");s.push(l.call(i,"argument"));return e(s);case"UpdateExpression":var s=[l.call(i,"argument"),c.operator];if(c.prefix)s.reverse();return e(s);case"ConditionalExpression":return e(["(",l.call(i,"test")," ? ",l.call(i,"consequent")," : ",l.call(i,"alternate"),")"]);case"NewExpression":var s=["new ",l.call(i,"callee")];var N=c.arguments;if(N){s.push(_(l,f,i))}return e(s);case"VariableDeclaration":var s=[c.kind," "];var I=0;var x=l.map(function(n){var e=i(n);I=Math.max(e.length,I);return e},"declarations");if(I===1){s.push(n(", ").join(x))}else if(x.length>1){s.push(n(",\n").join(x).indentTail(c.kind.length+1))}else{s.push(x[0])}var b=l.getParentNode();if(!t.ForStatement.check(b)&&!t.ForInStatement.check(b)&&!(t.ForOfStatement&&t.ForOfStatement.check(b))){s.push(";")}return e(s);case"VariableDeclarator":return c.init?n(" = ").join([l.call(i,"id"),l.call(i,"init")]):l.call(i,"id");case"WithStatement":return e(["with (",l.call(i,"object"),") ",l.call(i,"body")]);case"IfStatement":var C=a(l.call(i,"consequent"),f),s=["if (",l.call(i,"test"),")",C];if(c.alternate)s.push(S(C)?" else":"\nelse",a(l.call(i,"alternate"),f));return e(s);case"ForStatement":var A=l.call(i,"init"),V=A.length>1?";\n":"; ",L="for (",F=n(V).join([A,l.call(i,"test"),l.call(i,"update")]).indentTail(L.length),P=e([L,F,")"]),k=a(l.call(i,"body"),f),s=[P];if(P.length>1){s.push("\n");k=k.trimLeft()}s.push(k);return e(s);case"WhileStatement":return e(["while (",l.call(i,"test"),")",a(l.call(i,"body"),f)]);case"ForInStatement":return e([c.each?"for each (":"for (",l.call(i,"left")," in ",l.call(i,"right"),")",a(l.call(i,"body"),f)]);case"ForOfStatement":return e(["for (",l.call(i,"left")," of ",l.call(i,"right"),")",a(l.call(i,"body"),f)]);
case"DoWhileStatement":var j=e(["do",a(l.call(i,"body"),f)]),s=[j];if(S(j))s.push(" while");else s.push("\nwhile");s.push(" (",l.call(i,"test"),");");return e(s);case"BreakStatement":var s=["break"];if(c.label)s.push(" ",l.call(i,"label"));s.push(";");return e(s);case"ContinueStatement":var s=["continue"];if(c.label)s.push(" ",l.call(i,"label"));s.push(";");return e(s);case"LabeledStatement":return e([l.call(i,"label"),":\n",l.call(i,"body")]);case"TryStatement":var s=["try ",l.call(i,"block")];l.each(function(e){s.push(" ",i(e))},"handlers");if(c.finalizer)s.push(" finally ",l.call(i,"finalizer"));return e(s);case"CatchClause":var s=["catch (",l.call(i,"param")];if(c.guard)s.push(" if ",l.call(i,"guard"));s.push(") ",l.call(i,"body"));return e(s);case"ThrowStatement":return e(["throw ",l.call(i,"argument"),";"]);case"SwitchStatement":return e(["switch (",l.call(i,"discriminant"),") {\n",n("\n").join(l.map(i,"cases")),"\n}"]);case"SwitchCase":var s=[];if(c.test)s.push("case ",l.call(i,"test"),":");else s.push("default:");if(c.consequent.length>0){s.push("\n",l.call(function(e){return o(e,f,i)},"consequent").indent(f.tabWidth))}return e(s);case"DebuggerStatement":return n("debugger;");case"XJSAttribute":var s=[l.call(i,"name")];if(c.value)s.push("=",l.call(i,"value"));return e(s);case"XJSIdentifier":return n(c.name,f);case"XJSNamespacedName":return n(":").join([l.call(i,"namespace"),l.call(i,"name")]);case"XJSMemberExpression":return n(".").join([l.call(i,"object"),l.call(i,"property")]);case"XJSSpreadAttribute":return e(["{...",l.call(i,"argument"),"}"]);case"XJSExpressionContainer":return e(["{",l.call(i,"expression"),"}"]);case"XJSElement":var M=l.call(i,"openingElement");if(c.openingElement.selfClosing){r.ok(!c.closingElement);return M}var B=e(l.map(function(n){var e=n.getValue();if(t.Literal.check(e)&&typeof e.value==="string"){if(/\S/.test(e.value)){return e.value.replace(/^\s+|\s+$/g,"")}else if(/\n/.test(e.value)){return"\n"}}return i(n)},"children")).indentTail(f.tabWidth);var U=l.call(i,"closingElement");return e([M,B,U]);case"XJSOpeningElement":var s=["<",l.call(i,"name")];var h=[];l.each(function(e){h.push(" ",i(e))},"attributes");var g=e(h);var q=g.length>1||g.getLineLength(1)>f.wrapColumn;if(q){h.forEach(function(n,e){if(n===" "){r.strictEqual(e%2,0);h[e]="\n"}});g=e(h).indentTail(f.tabWidth)}s.push(g,c.selfClosing?" />":">");return e(s);case"XJSClosingElement":return e(["</",l.call(i,"name"),">"]);case"XJSText":return n(c.value,f);case"XJSEmptyExpression":return n("");case"TypeAnnotatedIdentifier":return e([l.call(i,"annotation")," ",l.call(i,"identifier")]);case"ClassBody":if(c.body.length===0){return n("{}")}return e(["{\n",l.call(function(e){return o(e,f,i)},"body").indent(f.tabWidth),"\n}"]);case"ClassPropertyDefinition":var s=["static ",l.call(i,"definition")];if(!t.MethodDefinition.check(c.definition))s.push(";");return e(s);case"ClassProperty":return e([l.call(i,"id"),";"]);case"ClassDeclaration":case"ClassExpression":var s=["class"];if(c.id)s.push(" ",l.call(i,"id"));if(c.superClass)s.push(" extends ",l.call(i,"superClass"));s.push(" ",l.call(i,"body"));return e(s);case"Node":case"Printable":case"SourceLocation":case"Position":case"Statement":case"Function":case"Pattern":case"Expression":case"Declaration":case"Specifier":case"NamedSpecifier":case"Block":case"Line":throw new Error("unprintable type: "+JSON.stringify(c.type));case"ClassHeritage":case"ComprehensionBlock":case"ComprehensionExpression":case"Glob":case"TaggedTemplateExpression":case"TemplateElement":case"TemplateLiteral":case"GeneratorExpression":case"LetStatement":case"LetExpression":case"GraphExpression":case"GraphIndexExpression":case"AnyTypeAnnotation":case"BooleanTypeAnnotation":case"ClassImplements":case"DeclareClass":case"DeclareFunction":case"DeclareModule":case"DeclareVariable":case"FunctionTypeAnnotation":case"FunctionTypeParam":case"GenericTypeAnnotation":case"InterfaceDeclaration":case"InterfaceExtends":case"IntersectionTypeAnnotation":case"MemberTypeAnnotation":case"NullableTypeAnnotation":case"NumberTypeAnnotation":case"ObjectTypeAnnotation":case"ObjectTypeCallProperty":case"ObjectTypeIndexer":case"ObjectTypeProperty":case"QualifiedTypeIdentifier":case"StringLiteralTypeAnnotation":case"StringTypeAnnotation":case"TupleTypeAnnotation":case"Type":case"TypeAlias":case"TypeAnnotation":case"TypeParameterDeclaration":case"TypeParameterInstantiation":case"TypeofTypeAnnotation":case"UnionTypeAnnotation":case"VoidTypeAnnotation":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:debugger;throw new Error("unknown type: "+JSON.stringify(c.type))}return p}function o(l,s,o){var a=t.ClassBody&&t.ClassBody.check(l.getParentNode());var n=[];l.each(function(r){var l=r.getName();var e=r.getValue();if(!e){return}if(e.type==="EmptyStatement"){return}if(!a){t.Statement.assert(e)}n.push({node:e,printed:o(r)})});var i=null;var c=n.length;var r=[];n.forEach(function(h,g){var o=h.printed;var f=h.node;var y=true;var v=o.length>1;var w=g>0;var m=g<c-1;var p;var e;if(a){if(t.MethodDefinition.check(f)||t.ClassPropertyDefinition.check(f)&&t.MethodDefinition.check(f.definition)){y=false}}if(y){o=u(o)}var n=s.reuseWhitespace&&R(f);var l=n&&n.lines;if(w){if(l){var x=l.skipSpaces(n.start,true);var b=x?x.line:1;var E=n.start.line-b;p=Array(E+1).join("\n")}else{p=v?"\n\n":"\n"}}else{p=""}if(m){if(l){var d=l.skipSpaces(n.end);var _=d?d.line:l.length;var S=_-n.end.line;e=Array(S+1).join("\n")}else{e=v?"\n\n":"\n"}}else{e=""}r.push(C(i,p),o);if(m){i=e}else if(e){r.push(e)}});return e(r)}function R(e){if(!e.loc){return null}if(!e.comments){return e.loc}var n=e.loc.start;var t=e.loc.end;e.comments.forEach(function(e){if(e.loc){if(c.comparePos(e.loc.start,n)<0){n=e.loc.start}if(c.comparePos(t,e.loc.end)<0){t=e.loc.end}}});return{lines:e.loc.lines,start:n,end:t}}function C(e,t){if(!e&&!t){return n("")}if(!e){return n(t)}if(!t){return n(e)}var r=n(e);var l=n(t);if(l.length>r.length){return l}return r}function w(a,o,s){var i=a.getNode();var n=i.kind;var l=[];t.FunctionExpression.assert(i.value);if(i.value.async){l.push("async ")}if(!n||n==="init"){if(i.value.generator){l.push("*")}}else{r.ok(n==="get"||n==="set");l.push(n," ")}l.push(a.call(s,"key"),"(",a.call(function(e){return m(e,o,s)},"value"),") ",a.call(s,"value","body"));return e(l)}function _(a,r,i){var l=a.map(i,"arguments");var t=n(", ").join(l);if(t.getLineLength(1)>r.wrapColumn){t=n(",\n").join(l);return e(["(\n",t.indent(r.tabWidth),"\n)"])}return e(["(",t,")"])}function m(a,o,i){var s=a.getValue();t.Function.assert(s);var r=a.map(i,"params");if(s.defaults){a.each(function(n){var t=n.getName();var l=r[t];if(l&&n.getValue()){r[t]=e([l,"=",i(n)])}},"defaults")}if(s.rest){r.push(e(["...",a.call(i,"rest")]))}var l=n(", ").join(r);if(l.length>1||l.getLineLength(1)>o.wrapColumn){l=n(",\n").join(r);return e(["\n",l.indent(o.tabWidth)])}return l}function a(n,t){if(n.length>1)return e([" ",n]);return e(["\n",u(n).indent(t.tabWidth)])}function d(e){var n=e.lastPos();do{var t=e.charAt(n);if(/\S/.test(t))return t}while(e.prevPos(n))}function S(e){return d(e)==="}"}function T(e){t.Literal.assert(e);E.assert(e.value);return JSON.stringify(e.value)}function u(n){var t=d(n);if(!t||"\n};".indexOf(t)<0)return e([n,";"]);return n}},{"./comments":167,"./fast-path":168,"./lines":169,"./options":171,"./patcher":173,"./types":175,"./util":176,assert:110,"source-map":186}],175:[function(t,r,l){var e=t("ast-types");var n=e.Type.def;n("File").bases("Node").build("program").field("program",n("Program"));e.finalize();r.exports=e},{"ast-types":108}],176:[function(e,u,n){var c=e("assert");var o=e("./types").getFieldValue;var t=e("source-map");var r=t.SourceMapConsumer;var l=t.SourceMapGenerator;var a=Object.prototype.hasOwnProperty;function i(){var t={};var l=arguments.length;for(var e=0;e<l;++e){var r=Object.keys(arguments[e]);var a=r.length;for(var n=0;n<a;++n){t[r[n]]=true}}return t}n.getUnionOfKeys=i;function s(e,n){return e.line-n.line||e.column-n.column}n.comparePos=s;n.composeSourceMaps=function(n,e){if(n){if(!e){return n}}else{return e||null}var i=new r(n);var o=new r(e);var t=new l({file:e.file,sourceRoot:e.sourceRoot});var s={};o.eachMapping(function(n){var r=i.originalPositionFor({line:n.originalLine,column:n.originalColumn});var e=r.source;if(e===null){return}t.addMapping({source:e,original:{line:r.line,column:r.column},generated:{line:n.generatedLine,column:n.generatedColumn},name:n.name});var l=i.sourceContentFor(e);if(l&&!a.call(s,e)){s[e]=l;t.setSourceContent(e,l)}});return t.toJSON()}},{"./types":175,assert:110,"source-map":186}],177:[function(e,t,n){(function(t){var r=e("./lib/types");var l=e("./lib/parser").parse;var a=e("./lib/printer").Printer;function i(e,n){return new a(n).print(e)}function s(e,n){return new a(n).printGenerically(e)}function o(e,n){return u(t.argv[2],e,n)}function u(n,t,r){e("fs").readFile(n,"utf-8",function(e,n){if(e){console.error(e);return}f(n,t,r)})}function c(e){t.stdout.write(e)}function f(n,t,e){var r=e&&e.writeback||c;t(l(n,e),function(n){r(i(n,e).code)})}Object.defineProperties(n,{parse:{enumerable:true,value:l},visit:{enumerable:true,value:r.visit},print:{enumerable:true,value:i},prettyPrint:{enumerable:false,value:s},types:{enumerable:false,value:r},run:{enumerable:false,value:o}})}).call(this,e("_process"))},{"./lib/parser":172,"./lib/printer":174,"./lib/types":175,_process:119,fs:109}],178:[function(e,n,t){(function(l){var a=e("stream");t=n.exports=r;r.through=r;function r(t,r,s){t=t||function(e){this.queue(e)};r=r||function(){this.queue(null)};var i=false,o=false,n=[],u=false;var e=new a;e.readable=e.writable=true;e.paused=false;e.autoDestroy=!(s&&s.autoDestroy===false);e.write=function(n){t.call(this,n);return!e.paused};function c(){while(n.length&&!e.paused){var t=n.shift();if(null===t)return e.emit("end");else e.emit("data",t)}}e.queue=e.push=function(t){if(u)return e;if(t==null)u=true;n.push(t);c();return e};e.on("end",function(){e.readable=false;if(!e.writable&&e.autoDestroy)l.nextTick(function(){e.destroy()})});function f(){e.writable=false;r.call(e);if(!e.readable&&e.autoDestroy)e.destroy()}e.end=function(n){if(i)return;i=true;if(arguments.length)e.write(n);f();return e};e.destroy=function(){if(o)return;o=true;i=true;n.length=0;e.writable=e.readable=false;e.emit("close");return e};e.pause=function(){if(e.paused)return;e.paused=true;return e};e.resume=function(){if(e.paused){e.paused=false;e.emit("resume")}c();if(!e.paused)e.emit("drain");return e};return e}}).call(this,e("_process"))},{_process:119,stream:131}],179:[function(n,e,t){(function(n){!function(h){"use strict";var r=Object.prototype.hasOwnProperty;var t;var d=typeof Symbol==="function"&&Symbol.iterator||"@@iterator";var m=typeof e==="object";var n=h.regeneratorRuntime;if(n){if(m){e.exports=n}return}n=h.regeneratorRuntime=m?e.exports:{};function b(e,n,t,r){return new y(e,n,t||null,r||[])}n.wrap=b;function f(e,n,t){try{return{type:"normal",arg:e.call(n,t)}}catch(r){return{type:"throw",arg:r}}}var c="suspendedStart";var u="suspendedYield";var g="executing";var s="completed";var o={};function i(){}function a(){}var l=a.prototype=y.prototype;i.prototype=l.constructor=a;a.constructor=i;i.displayName="GeneratorFunction";n.isGeneratorFunction=function(n){var e=typeof n==="function"&&n.constructor;return e?e===i||(e.displayName||e.name)==="GeneratorFunction":false};n.mark=function(e){e.__proto__=a;e.prototype=Object.create(l);return e};n.async=function(e,n,t,r){return new Promise(function(s,o){var l=b(e,n,t,r);var a=i.bind(l.next);var u=i.bind(l["throw"]);function i(t){var e=f(this,null,t);if(e.type==="throw"){o(e.arg);return}var n=e.arg;if(n.done){s(n.value)}else{Promise.resolve(n.value).then(a,u)}}a()})};function y(i,a,d,m){var r=a?Object.create(a.prototype):this;var e=new p(m);var n=c;function l(l,r){if(n===g){throw new Error("Generator is already running")}if(n===s){return E()}while(true){var p=e.delegate;if(p){var a=f(p.iterator[l],p.iterator,r);if(a.type==="throw"){e.delegate=null;l="throw";r=a.arg;continue}l="next";r=t;var m=a.arg;if(m.done){e[p.resultName]=m.value;e.next=p.nextLoc}else{n=u;return m}e.delegate=null}if(l==="next"){if(n===c&&typeof r!=="undefined"){throw new TypeError("attempt to send "+JSON.stringify(r)+" to newborn generator")}if(n===u){e.sent=r}else{delete e.sent}}else if(l==="throw"){if(n===c){n=s;throw r}if(e.dispatchException(r)){l="next";r=t}}else if(l==="return"){e.abrupt("return",r)}n=g;var a=f(i,d,e);if(a.type==="normal"){n=e.done?s:u;var m={value:a.arg,done:e.done};if(a.arg===o){if(e.delegate&&l==="next"){r=t}}else{return m}}else if(a.type==="throw"){n=s;if(l==="next"){e.dispatchException(a.arg)}else{r=a.arg}}}}r.next=l.bind(r,"next");r["throw"]=l.bind(r,"throw");r["return"]=l.bind(r,"return");return r}l[d]=function(){return this};l.toString=function(){return"[object Generator]"};function w(e){var n={tryLoc:e[0]};if(1 in e){n.catchLoc=e[1]}if(2 in e){n.finallyLoc=e[2]}this.tryEntries.push(n)}function x(n,t){var e=n.completion||{};e.type=t===0?"normal":"return";delete e.arg;n.completion=e}function p(e){this.tryEntries=[{tryLoc:"root"}];e.forEach(w,this);this.reset()}n.keys=function(n){var e=[];for(var t in n){e.push(t)}e.reverse();return function r(){while(e.length){var t=e.pop();if(t in n){r.value=t;r.done=false;return r}}r.done=true;return r}};function v(e){if(e){var l=e[d];if(l){return l.call(e)}if(typeof e.next==="function"){return e}if(!isNaN(e.length)){var n=-1,a=function i(){while(++n<e.length){if(r.call(e,n)){i.value=e[n];i.done=false;return i}}i.value=t;i.done=true;return i};return a.next=a}}return{next:E}}n.values=v;function E(){return{value:t,done:true}}p.prototype={constructor:p,reset:function(){this.prev=0;this.next=0;this.sent=t;this.done=false;this.delegate=null;this.tryEntries.forEach(x);for(var e=0,n;r.call(this,n="t"+e)||e<20;++e){this[n]=null}},stop:function(){this.done=true;var n=this.tryEntries[0];var e=n.completion;if(e.type==="throw"){throw e.arg}return this.rval},dispatchException:function(l){if(this.done){throw l}var o=this;function n(e,n){a.type="throw";a.arg=l;o.next=e;return!!n}for(var t=this.tryEntries.length-1;t>=0;--t){var e=this.tryEntries[t];var a=e.completion;if(e.tryLoc==="root"){return n("end")}if(e.tryLoc<=this.prev){var i=r.call(e,"catchLoc");var s=r.call(e,"finallyLoc");if(i&&s){if(this.prev<e.catchLoc){return n(e.catchLoc,true)}else if(this.prev<e.finallyLoc){return n(e.finallyLoc)}}else if(i){if(this.prev<e.catchLoc){return n(e.catchLoc,true)}}else if(s){if(this.prev<e.finallyLoc){return n(e.finallyLoc)}}else{throw new Error("try statement without catch or finally")}}}},_findFinallyEntry:function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var e=this.tryEntries[n];if(e.tryLoc<=this.prev&&r.call(e,"finallyLoc")&&(e.finallyLoc===t||this.prev<e.finallyLoc)){return e}}},abrupt:function(t,r){var e=this._findFinallyEntry();var n=e?e.completion:{};n.type=t;n.arg=r;if(e){this.next=e.finallyLoc}else{this.complete(n)}return o},complete:function(e){if(e.type==="throw"){throw e.arg}if(e.type==="break"||e.type==="continue"){this.next=e.arg}else if(e.type==="return"){this.rval=e.arg;this.next="end"}return o},finish:function(e){var n=this._findFinallyEntry(e);return this.complete(n.completion)},"catch":function(r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===r){var t=n.completion;if(t.type==="throw"){var l=t.arg;x(n,e)}return l}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,t){this.delegate={iterator:v(e),resultName:n,nextLoc:t};return o}}}(typeof n==="object"?n:typeof window==="object"?window:this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],180:[function(t,r,n){var e=t("regenerate");n.REGULAR={d:e().addRange(48,57),D:e().addRange(0,47).addRange(58,65535),s:e(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:e().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:e(95).addRange(48,57).addRange(65,90).addRange(97,122),W:e(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,65535)};n.UNICODE={d:e().addRange(48,57),D:e().addRange(0,47).addRange(58,1114111),s:e(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:e().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:e(95).addRange(48,57).addRange(65,90).addRange(97,122),W:e(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)};n.UNICODE_IGNORE_CASE={d:e().addRange(48,57),D:e().addRange(0,47).addRange(58,1114111),s:e(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:e().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:e(95,383,8490).addRange(48,57).addRange(65,90).addRange(97,122),W:e(75,83,96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)}},{regenerate:182}],181:[function(n,e,t){e.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,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}},{}],182:[function(t,e,n){(function(t){(function(_){var h=typeof n=="object"&&n;var S=typeof e=="object"&&e&&e.exports==h&&e;var c=typeof t=="object"&&t;if(c.global===c||c.window===c){_=c}var f={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."};var r=55296;var l=56319;var o=56320;var v=57343;var X=/\\x00([^0123456789]|$)/g;var R={};var U=R.hasOwnProperty;var F=function(t,n){var e;for(e in n){if(U.call(n,e)){t[e]=n[e]}}return t};var g=function(n,t){var e=-1;var r=n.length;while(++e<r){t(n[e],e)}};var j=R.toString;var T=function(e){return j.call(e)=="[object Array]"};var s=function(e){return typeof e=="number"||j.call(e)=="[object Number]"};var V="0000";var D=function(t,n){var e=String(t);return e.length<n?(V+e).slice(-n):e};var w=function(e){return Number(e).toString(16).toUpperCase()};var E=[].slice;var Y=function(a){var l=-1;var i=a.length;var s=i-1;var n=[];var r=true;var e;var t=0;while(++l<i){e=a[l];if(r){n.push(e);t=e;r=false}else{if(e==t+1){if(l!=s){t=e;continue}else{r=true;n.push(e+1)}}else{n.push(t+1,e);t=e}}}if(!r){n.push(e+1)}return n};var k=function(e,n){var t=0;var r;var l;var a=e.length;while(t<a){r=e[t];l=e[t+1];if(n>=r&&n<l){if(n==r){if(l==r+1){e.splice(t,2);return e}else{e[t]=n+1;return e}}else if(n==l-1){e[t+1]=n;return e}else{e.splice(t,2,r,n,n+1,l);return e}}t+=2}return e};var I=function(e,r,t){if(t<r){throw Error(f.rangeOrder)}var n=0;var l;var a;while(n<e.length){l=e[n];a=e[n+1]-1;if(l>t){return e}if(r<=l&&t>=a){e.splice(n,2);continue}if(r>=l&&t<a){if(r==l){e[n]=t+1;e[n+1]=a+1;return e}e.splice(n,2,l,r,t+1,a+1);return e}if(r>=l&&r<=a){e[n+1]=r}else if(t>=l&&t<=a){e[n]=t+1;return e}n+=2}return e};var p=function(e,n){var t=0;var r;var l;var a=null;var i=e.length;if(n<0||n>1114111){throw RangeError(f.codePointRange)}while(t<i){r=e[t];l=e[t+1];if(n>=r&&n<l){return e}if(n==r-1){e[t]=n;return e}if(r>n){e.splice(a!=null?a+2:0,0,n,n+1);return e}if(n==l){if(n+1==e[t+2]){e.splice(t,4,r,e[t+3]);return e}e[t+1]=n+1;return e}a=t;t+=2}e.push(n,n+1);return e};var C=function(a,r){var n=0;var t;var l;var e=a.slice();var i=r.length;while(n<i){t=r[n];l=r[n+1]-1;if(t==l){e=p(e,t)}else{e=d(e,t,l)}n+=2}return e};var B=function(a,r){var n=0;var t;var l;var e=a.slice();var i=r.length;while(n<i){t=r[n];l=r[n+1]-1;if(t==l){e=k(e,t)}else{e=I(e,t,l)}n+=2}return e};var d=function(e,n,t){if(t<n){throw Error(f.rangeOrder)}if(n<0||n>1114111||t<0||t>1114111){throw RangeError(f.codePointRange)}var r=0;var l;var a;var i=false;var s=e.length;while(r<s){l=e[r];a=e[r+1];if(i){if(l==t+1){e.splice(r-1,2);return e}if(l>t){return e}if(l>=n&&l<=t){if(a>n&&a-1<=t){e.splice(r,2);r-=2}else{e.splice(r-1,2);r-=2}}}else if(l==t+1){e[r]=n;return e}else if(l>t){e.splice(r,0,n,t+1);return e}else if(n>=l&&n<a&&t+1<=a){return e}else if(n>=l&&n<a||a==n){e[r+1]=t+1;i=true}else if(n<=l&&t+1>=a){e[r]=n;e[r+1]=t+1;i=true}r+=2}if(!i){e.push(n,t+1)}return e};var L=function(n,t){var e=0;var r;var l;var a=n.length;while(e<a){r=n[e];l=n[e+1];if(t>=r&&t<l){return true}e+=2}return false};var J=function(l,t){var e=0;var a=t.length;var n;var r=[];while(e<a){n=t[e];if(L(l,n)){r.push(n)}++e}return Y(r)};var y=function(e){return!e.length};var b=function(e){return e.length==2&&e[0]+1==e[1]};var O=function(t){var e=0;var n;var r;var l=[];var a=t.length;while(e<a){n=t[e];r=t[e+1];while(n<r){l.push(n);++n}e+=2}return l};var $=Math.floor;var M=function(e){return parseInt($((e-65536)/1024)+r,10)};var P=function(e){return parseInt((e-65536)%1024+o,10)};var A=String.fromCharCode;var u=function(e){var n;if(e==9){n="\\t"}else if(e==10){n="\\n"}else if(e==12){n="\\f"}else if(e==13){n="\\r"}else if(e==92){n="\\\\"}else if(e==36||e>=40&&e<=43||e==45||e==46||e==63||e>=91&&e<=94||e>=123&&e<=125){n="\\"+A(e)}else if(e>=32&&e<=126){n=A(e)}else if(e<=255){n="\\x"+D(w(e),2)}else{n="\\u"+D(w(e),4)}return n};var i=function(n){var a=n.length;var e=n.charCodeAt(0);var t;if(e>=r&&e<=l&&a>1){t=n.charCodeAt(1);return(e-r)*1024+t-o+65536}return e};var m=function(n){var r="";var l=0;var e;var t;var a=n.length;if(b(n)){return u(n[0])}while(l<a){e=n[l];t=n[l+1]-1;if(e==t){r+=u(e)}else if(e+1==t){r+=u(e)+u(t)}else{r+=u(e)+"-"+u(t)}l+=2}return"["+r+"]"};var q=function(s){var a=[];var t=[];var o=[];var i=0;var e;var n;var u=s.length;while(i<u){e=s[i];n=s[i+1]-1;if(e<=65535&&n<=65535){if(e>=r&&e<=l){if(n<=l){a.push(e,n+1)}else{a.push(e,l+1);t.push(l+1,n+1)}}else if(n>=r&&n<=l){t.push(e,r);a.push(r,n+1)}else if(e<r&&n>l){t.push(e,r,l+1,n+1);a.push(r,l+1)}else{t.push(e,n+1)}}else if(e<=65535&&n>65535){if(e>=r&&e<=l){a.push(e,l+1);t.push(l+1,65535+1)}else if(e<r){t.push(e,r,l+1,65535+1);a.push(r,l+1)}else{t.push(e,65535+1)}o.push(65535+1,n+1)}else{o.push(e,n+1)}i+=2}return{loneHighSurrogates:a,bmp:t,astral:o}};var N=function(i){var u=[];var t=[];var c=false;var n;var e;var a;var o;var s;var l;var r=-1;var f=i.length;while(++r<f){n=i[r];e=i[r+1];if(!e){u.push(n);continue}a=n[0];o=n[1];s=e[0];l=e[1];t=o;while(s&&a[0]==s[0]&&a[1]==s[1]){if(b(l)){t=p(t,l[0])}else{t=d(t,l[0],l[1]-1)}++r;n=i[r];a=n[0];o=n[1];e=i[r+1];s=e&&e[0];l=e&&e[1];c=true}u.push([a,c?t:o]);c=false}return G(u)};var G=function(e){if(e.length==1){return e}var l=-1;var n=-1;while(++l<e.length){var t=e[l];var a=t[1];var c=a[0];var o=a[1];n=l;while(++n<e.length){var r=e[n];var i=r[1];var u=i[0];var s=i[1];if(c==u&&o==s){if(b(r[0])){t[0]=p(t[0],r[0][0])}else{t[0]=d(t[0],r[0][0],r[0][1]-1)}e.splice(n,1);--n}}}return e};var W=function(l){if(!l.length){return[]}var s=0;var c;var u;var e;var a;var d=0;var p=0;var y=[];var n;var r;var t=[];var m=l.length;var g=[];while(s<m){c=l[s];u=l[s+1]-1;e=M(c);a=P(c);n=M(u);r=P(u);var h=a==o;var f=r==v;var i=false;if(e==n||h&&f){t.push([[e,n+1],[a,r+1]]);i=true}else{t.push([[e,e+1],[a,v+1]])}if(!i&&e+1<n){if(f){t.push([[e+1,n+1],[o,r+1]]);i=true}else{t.push([[e+1,n],[o,v+1]])}}if(!i){t.push([[n,n+1],[o,r+1]])}d=e;p=n;s+=2}return N(t)};var H=function(n){var e=[];g(n,function(n){var t=n[0];var r=n[1];e.push(m(t)+m(r))});return e.join("|")};var z=function(s){var e=[];var n=q(s);var r=n.loneHighSurrogates;var t=n.bmp;var o=n.astral;var l=!y(n.astral);var a=!y(r);var i=W(o);if(!l&&a){t=C(t,r)}if(!y(t)){e.push(m(t))}if(i.length){e.push(H(i))}if(l&&a){e.push(m(r))}return e.join("|")};var a=function(e){if(arguments.length>1){e=E.call(arguments)}if(this instanceof a){this.data=[];return e?this.add(e):this}return(new a).add(e)};a.version="1.0.1";var x=a.prototype;F(x,{add:function(e){var n=this;if(e==null){return n}if(e instanceof a){n.data=C(n.data,e.data);return n}if(arguments.length>1){e=E.call(arguments)}if(T(e)){g(e,function(e){n.add(e)});return n}n.data=p(n.data,s(e)?e:i(e));return n},remove:function(e){var n=this;if(e==null){return n}if(e instanceof a){n.data=B(n.data,e.data);return n}if(arguments.length>1){e=E.call(arguments)}if(T(e)){g(e,function(e){n.remove(e)});return n}n.data=k(n.data,s(e)?e:i(e));return n},addRange:function(e,n){var t=this;t.data=d(t.data,s(e)?e:i(e),s(n)?n:i(n));return t},removeRange:function(e,n){var t=this;var r=s(e)?e:i(e);var l=s(n)?n:i(n);t.data=I(t.data,r,l);return t},intersection:function(e){var n=this;var t=e instanceof a?O(e.data):e;n.data=J(n.data,t);return n},contains:function(e){return L(this.data,s(e)?e:i(e))},clone:function(){var e=new a;e.data=this.data.slice(0);return e},toString:function(){var e=z(this.data);return e.replace(X,"\\0$1")},toRegExp:function(e){return RegExp(this.toString(),e||"")},valueOf:function(){return O(this.data)}});x.toArray=x.valueOf;if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define(function(){return a})}else if(h&&!h.nodeType){if(S){S.exports=a}else{h.regenerate=a}}else{_.regenerate=a}})(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],183:[function(t,e,n){(function(t){(function(){"use strict";var i={"function":true,object:true};var u=i[typeof window]&&window||this;var R=u;var s=i[typeof n]&&n;var p=i[typeof e]&&e&&!e.nodeType&&e;var a=s&&p&&typeof t=="object"&&t;if(a&&(a.global===a||a.window===a||a.self===a)){u=a}var b=String.fromCharCode;var d=Math.floor;function o(){var s=16384;var n=[];var l;var a;var t=-1;var r=arguments.length;if(!r){return""}var i="";while(++t<r){var e=Number(arguments[t]);if(!isFinite(e)||e<0||e>1114111||d(e)!=e){throw RangeError("Invalid code point: "+e)}if(e<=65535){n.push(e)}else{e-=65536;l=(e>>10)+55296;a=e%1024+56320;n.push(l,a)}if(t+1==r||n.length>s){i+=b.apply(null,n);n.length=0}}return i}function l(n,e){if(e.indexOf("|")==-1){if(n==e){return}throw Error("Invalid node type: "+n)}e=l.hasOwnProperty(e)?l[e]:l[e]=RegExp("^(?:"+e+")$");if(e.test(n)){return}throw Error("Invalid node type: "+n)}function r(n){var e=n.type;if(r.hasOwnProperty(e)&&typeof r[e]=="function"){return r[e](n)}throw Error("Invalid node type: "+e)}function m(n){l(n.type,"alternative");var e=n.body,t=e?e.length:0;if(t==1){return f(e[0])}else{var r=-1,a="";while(++r<t){a+=f(e[r])}return a}}function I(e){l(e.type,"anchor");switch(e.kind){case"start":return"^";case"end":return"$";case"boundary":return"\\b";case"not-boundary":return"\\B";default:throw Error("Invalid assertion")}}function g(e){l(e.type,"anchor|characterClass|characterClassEscape|dot|group|reference|value");return r(e)}function y(n){l(n.type,"characterClass");var t=n.body,a=t?t.length:0;var r=-1,e="[";if(n.negative){e+="^"}while(++r<a){e+=c(t[r])}e+="]";return e}function v(e){l(e.type,"characterClassEscape");return"\\"+e.value}function x(e){l(e.type,"characterClassRange");var n=e.min,t=e.max;if(n.type=="characterClassRange"||t.type=="characterClassRange"){throw Error("Invalid character class range")}return c(n)+"-"+c(t)}function c(e){l(e.type,"anchor|characterClassEscape|characterClassRange|dot|value");return r(e)}function E(i){l(i.type,"disjunction");var e=i.body,n=e?e.length:0;if(n==0){throw Error("No body")}else if(n==1){return r(e[0])}else{var t=-1,a="";while(++t<n){if(t!=0){a+="|"}a+=r(e[t])}return a}}function w(e){l(e.type,"dot");return"."}function _(n){l(n.type,"group");var e="(";switch(n.behavior){case"normal":break;case"ignore":e+="?:";break;case"lookahead":e+="?=";break;case"negativeLookahead":e+="?!";break;default:throw Error("Invalid behaviour: "+n.behaviour)}var t=n.body,a=t?t.length:0;if(a==1){e+=r(t[0])}else{var i=-1;while(++i<a){e+=r(t[i])}}e+=")";return e}function S(t){l(t.type,"quantifier");var e="",n=t.min,r=t.max;switch(r){case undefined:case null:switch(n){case 0:e="*";break;case 1:e="+";break;default:e="{"+n+",}";break}break;default:if(n==r){e="{"+n+"}"}else if(n==0&&r==1){e="?"}else{e="{"+n+","+r+"}"}break}if(!t.greedy){e+="?"}return g(t.body[0])+e}function k(e){l(e.type,"reference");return"\\"+e.matchIndex}function f(e){l(e.type,"anchor|characterClass|characterClassEscape|empty|group|quantifier|reference|value");return r(e)}function h(n){l(n.type,"value");var t=n.kind,e=n.codePoint;switch(t){case"controlLetter":return"\\c"+o(e+64);case"hexadecimalEscape":return"\\x"+("00"+e.toString(16).toUpperCase()).slice(-2);case"identifier":return"\\"+o(e);case"null":return"\\"+e;case"octal":return"\\"+e.toString(8);case"singleEscape":switch(e){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: "+e)}case"symbol":return o(e);case"unicodeEscape":return"\\u"+("0000"+e.toString(16).toUpperCase()).slice(-4);case"unicodeCodePointEscape":return"\\u{"+e.toString(16).toUpperCase()+"}";default:throw Error("Unsupported node kind: "+t)}}r.alternative=m;r.anchor=I;r.characterClass=y;r.characterClassEscape=v;r.characterClassRange=x;r.disjunction=E;r.dot=w;r.group=_;r.quantifier=S;r.reference=k;r.value=h;if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define(function(){return{generate:r}})}else if(s&&p){s.generate=r}else{u.regjsgen={generate:r}}}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})
},{}],184:[function(n,e,t){(function(){function t(r,L){var m=(L||"").indexOf("u")!==-1;var e=0;var g=0;function l(e){e.raw=r.substring(e.range[0],e.range[1]);return e}function S(e,n){e.range[0]=n;return l(e)}function o(n,t){return l({type:"anchor",kind:n,range:[e-t,e]})}function p(e,n,t,r){return l({type:"value",kind:e,codePoint:n,range:[t,r]})}function a(t,r,l,n){n=n||0;return p(t,r,e-(l.length+n),e)}function u(l){var r=l[0];var n=r.charCodeAt(0);if(m){var t;if(r.length===1&&n>=55296&&n<=56319){t=T().charCodeAt(0);if(t>=56320&&t<=57343){e++;return p("symbol",(n-55296)*1024+t-56320+65536,e-2,e)}}}return p("symbol",n,e-1,e)}function z(e,n,t){return l({type:"disjunction",body:e,range:[n,t]})}function G(){return l({type:"dot",range:[e-1,e]})}function J(n){return l({type:"characterClassEscape",value:n,range:[e-2,e]})}function F(n){return l({type:"reference",matchIndex:parseInt(n,10),range:[e-1-n.length,e]})}function N(e,n,t,r){return l({type:"group",behavior:e,body:n,range:[t,r]})}function s(r,a,t,n){if(n==null){t=e-1;n=e}return l({type:"quantifier",min:r,max:a,greedy:true,body:null,range:[t,n]})}function D(e,n,t){return l({type:"alternative",body:e,range:[n,t]})}function v(e,n,t,r){return l({type:"characterClass",body:e,negative:n,range:[t,r]})}function x(e,n,t,r){if(e.codePoint>n.codePoint){throw SyntaxError("invalid range in character class")}return l({type:"characterClassRange",min:e,max:n,range:[t,r]})}function b(e){if(e.type==="alternative"){return e.body}else{return[e]}}function $(e){return e.type==="empty"}function f(n){n=n||1;var t=r.substring(e,e+n);e+=n||1;return t}function c(e){if(!n(e)){throw SyntaxError("character: "+e)}}function n(n){if(r.indexOf(n,e)===e){return f(n.length)}}function T(){return r[e]}function i(n){return r.indexOf(n,e)===e}function R(n){return r[e+1]===n}function t(t){var l=r.substring(e);var n=l.match(t);if(n){n.range=[];n.range[0]=e;f(n[0].length);n.range[1]=e}return n}function A(){var t=[],r=e;t.push(k());while(n("|")){t.push(k())}if(t.length===1){return t[0]}return z(t,r,e)}function k(){var n=[],r=e;var t;while(t=U()){n.push(t)}if(n.length===1){return n[0]}return D(n,r,e)}function U(){if(e>=r.length||i("|")||i(")")){return null}var l=j();if(l){return l}var n=O();if(!n){throw SyntaxError("Expected atom")}var t=M()||false;if(t){t.body=b(n);S(t,n.range[0]);return t}return n}function E(l,a,i,s){var t=null,o=e;if(n(l)){t=a}else if(n(i)){t=s}else{return false}var r=A();if(!r){throw SyntaxError("Expected disjunction")}c(")");var u=N(t,b(r),o,e);if(t=="normal"){g++}return u}function j(){var t,r=e;if(n("^")){return o("start",1)}else if(n("$")){return o("end",1)}else if(n("\\b")){return o("boundary",2)}else if(n("\\B")){return o("not-boundary",2)}else{return E("(?=","lookahead","(?!","negativeLookahead")}}function M(){var e;var r;var l,a;if(n("*")){r=s(0)}else if(n("+")){r=s(1)}else if(n("?")){r=s(0,1)}else if(e=t(/^\{([0-9]+)\}/)){l=parseInt(e[1],10);r=s(l,l,e.range[0],e.range[1])}else if(e=t(/^\{([0-9]+),\}/)){l=parseInt(e[1],10);r=s(l,undefined,e.range[0],e.range[1])}else if(e=t(/^\{([0-9]+),([0-9]+)\}/)){l=parseInt(e[1],10);a=parseInt(e[2],10);if(l>a){throw SyntaxError("numbers out of order in {} quantifier")}r=s(l,a,e.range[0],e.range[1])}if(r){if(n("?")){r.greedy=false;r.range[1]+=1}}return r}function O(){var e;if(e=t(/^[^^$\\.*+?(){[|]/)){return u(e)}else if(n(".")){return G()}else if(n("\\")){e=I();if(!e){throw SyntaxError("atomEscape")}return e}else if(e=q()){return e}else{return E("(?:","ignore","(","normal")}}function y(n){if(m){var t,r;if(n.kind=="unicodeEscape"&&(t=n.codePoint)>=55296&&t<=56319&&i("\\")&&R("u")){var s=e;e++;var a=C();if(a.kind=="unicodeEscape"&&(r=a.codePoint)>=56320&&r<=57343){n.range[1]=a.range[1];n.codePoint=(t-55296)*1024+r-56320+65536;n.type="value";n.kind="unicodeCodePointEscape";l(n)}else{e=s}}}return n}function C(){return I(true)}function I(t){var e;e=B();if(e){return e}if(t){if(n("b")){return a("singleEscape",8,"\\b")}else if(n("B")){throw SyntaxError("\\B not possible inside of CharacterClass")}}e=Y();return e}function B(){var e,n;if(e=t(/^(?!0)\d+/)){n=e[0];var r=parseInt(e[0],10);if(r<=g){return F(e[0])}else{f(-e[0].length);if(e=t(/^[0-7]{1,3}/)){return a("octal",parseInt(e[0],8),e[0],1)}else{e=u(t(/^[89]/));return S(e,e.range[0]-1)}}}else if(e=t(/^[0-7]{1,3}/)){n=e[0];if(/^0{1,3}$/.test(n)){return a("null",0,"0",n.length+1)}else{return a("octal",parseInt(n,8),n,1)}}else if(e=t(/^[dDsSwW]/)){return J(e[0])}return false}function Y(){var e;if(e=t(/^[fnrtv]/)){var n=0;switch(e[0]){case"t":n=9;break;case"n":n=10;break;case"v":n=11;break;case"f":n=12;break;case"r":n=13;break}return a("singleEscape",n,"\\"+e[0])}else if(e=t(/^c([a-zA-Z])/)){return a("controlLetter",e[1].charCodeAt(0)%32,e[1],2)}else if(e=t(/^x([0-9a-fA-F]{2})/)){return a("hexadecimalEscape",parseInt(e[1],16),e[1],2)}else if(e=t(/^u([0-9a-fA-F]{4})/)){return y(a("unicodeEscape",parseInt(e[1],16),e[1],2))}else if(m&&(e=t(/^u\{([0-9a-fA-F]{1,})\}/))){return a("unicodeCodePointEscape",parseInt(e[1],16),e[1],4)}else{return X()}}function V(e){var n=new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԯԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠ-ࢲࣤ-ॣ०-९ॱ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఀ-ఃఅ-ఌఎ-ఐఒ-నప-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಁ-ಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲഁ-ഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟ෦-෯ෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧ᪰-᪽ᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶ᳸᳹ᴀ-᷵᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚝꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꧠ-ꧾꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︭︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]");return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&n.test(String.fromCharCode(e))}function X(){var t="";var r="";var l;var e;if(!V(T())){e=f();return a("identifier",e.charCodeAt(0),e,1)}if(n(t)){return a("identifier",8204,t)}else if(n(r)){return a("identifier",8205,r)}return null}function q(){var r,l=e;if(r=t(/^\[\^/)){r=d();c("]");return v(r,true,l,e)}else if(n("[")){r=d();c("]");return v(r,false,l,e)}return null}function d(){var e;if(i("]")){return[]}else{e=W();if(!e){throw SyntaxError("nonEmptyClassRanges")}return e}}function _(t){var r,l,n;if(i("-")&&!R("]")){c("-");n=h();if(!n){throw SyntaxError("classAtom")}l=e;var a=d();if(!a){throw SyntaxError("classRanges")}r=t.range[0];if(a.type==="empty"){return[x(t,n,r,l)]}return[x(t,n,r,l)].concat(a)}n=H();if(!n){throw SyntaxError("nonEmptyClassRangesNoDash")}return[t].concat(n)}function W(){var e=h();if(!e){throw SyntaxError("classAtom")}if(i("]")){return[e]}return _(e)}function H(){var e=h();if(!e){throw SyntaxError("classAtom")}if(i("]")){return e}return _(e)}function h(){if(n("-")){return u("-")}else{return P()}}function P(){var e;if(e=t(/^[^\\\]-]/)){return u(e[0])}else if(n("\\")){e=C();if(!e){throw SyntaxError("classEscape")}return y(e)}}r=String(r);if(r===""){r="(?:)"}var w=A();if(w.range[1]!==r.length){throw SyntaxError("Could not parse entire input - got stuck: "+r)}return w}var n={parse:t};if(typeof e!=="undefined"&&e.exports){e.exports=n}else{window.regjsparser=n}})()},{}],185:[function(n,h,_){var E=n("regjsgen").generate;var s=n("regjsparser").parse;var r=n("regenerate");var c=n("./data/iu-mappings.json");var a=n("./data/character-class-escape-sets.js");function o(n){if(e){if(t){return a.UNICODE_IGNORE_CASE[n]}return a.UNICODE[n]}return a.REGULAR[n]}var b={};var v=b.hasOwnProperty;function y(e,n){return v.call(e,n)}var m=r().addRange(0,1114111);var d=r().addRange(0,65535);var p=m.clone().remove(10,13,8232,8233);var g=p.clone().intersection(d);r.prototype.iuAddRange=function(e,r){var n=this;do{var t=i(e);if(t){n.add(t)}}while(++e<=r);return n};function f(t,e){for(var n in e){t[n]=e[n]}}function l(t,n){var e=s(n,"");switch(e.type){case"characterClass":case"group":case"value":break;default:e=x(e,n)}f(t,e)}function x(e,n){return{type:"group",behavior:"ignore",body:[e],raw:"(?:"+n+")"}}function i(e){return y(c,e)?c[e]:false}var t=false;var e=false;function w(a){var n=r();var s=a.body.forEach(function(r){switch(r.type){case"value":n.add(r.codePoint);if(t&&e){var l=i(r.codePoint);if(l){n.add(l)}}break;case"characterClassRange":var a=r.min.codePoint;var s=r.max.codePoint;n.addRange(a,s);if(t&&e){n.iuAddRange(a,s)}break;case"characterClassEscape":n.add(o(r.value));break;default:throw Error("Unknown term type: "+r.type)}});if(a.negative){n=(e?m:d).clone().remove(n)}l(a,n.toString());return a}function u(n){switch(n.type){case"dot":l(n,(e?p:g).toString());break;case"characterClass":n=w(n);break;case"characterClassEscape":l(n,o(n.value).toString());break;case"alternative":case"disjunction":case"group":case"quantifier":n.body=n.body.map(u);break;case"value":var a=n.codePoint;var s=r(a);if(t&&e){var c=i(a);if(c){s.add(c)}}l(n,s.toString());break;case"anchor":case"empty":case"group":case"reference":break;default:throw Error("Unknown term type: "+n.type)}return n}h.exports=function(l,n){var r=s(l,n);t=n?n.indexOf("i")>-1:false;e=n?n.indexOf("u")>-1:false;f(r,u(r));return E(r)}},{"./data/character-class-escape-sets.js":180,"./data/iu-mappings.json":181,regenerate:182,regjsgen:183,regjsparser:184}],186:[function(e,t,n){n.SourceMapGenerator=e("./source-map/source-map-generator").SourceMapGenerator;n.SourceMapConsumer=e("./source-map/source-map-consumer").SourceMapConsumer;n.SourceNode=e("./source-map/source-node").SourceNode},{"./source-map/source-map-consumer":192,"./source-map/source-map-generator":193,"./source-map/source-node":194}],187:[function(e,t,r){if(typeof n!=="function"){var n=e("amdefine")(t,e)}n(function(t,r,l){var n=t("./util");function e(){this._array=[];this._set={}}e.fromArray=function a(t,l){var r=new e;for(var n=0,a=t.length;n<a;n++){r.add(t[n],l)}return r};e.prototype.add=function i(e,r){var t=this.has(e);var l=this._array.length;if(!t||r){this._array.push(e)}if(!t){this._set[n.toSetString(e)]=l}};e.prototype.has=function s(e){return Object.prototype.hasOwnProperty.call(this._set,n.toSetString(e))};e.prototype.indexOf=function o(e){if(this.has(e)){return this._set[n.toSetString(e)]}throw new Error('"'+e+'" is not in the set.')};e.prototype.at=function u(e){if(e>=0&&e<this._array.length){return this._array[e]}throw new Error("No element indexed by "+e)};e.prototype.toArray=function c(){return this._array.slice()};r.ArraySet=e})},{"./util":195,amdefine:196}],188:[function(e,t,r){if(typeof n!=="function"){var n=e("amdefine")(t,e)}n(function(i,n,u){var t=i("./base64");var e=5;var r=1<<e;var l=r-1;var a=r;function s(e){return e<0?(-e<<1)+1:(e<<1)+0}function o(e){var t=(e&1)===1;var n=e>>1;return t?-n:n}n.encode=function c(o){var i="";var r;var n=s(o);do{r=n&l;n>>>=e;if(n>0){r|=a}i+=t.encode(r)}while(n>0);return i};n.decode=function f(r,u){var i=0;var p=r.length;var s=0;var c=0;var f,n;do{if(i>=p){throw new Error("Expected more digits in base 64 VLQ value.")}n=t.decode(r.charAt(i++));f=!!(n&a);n&=l;s=s+(n<<c);c+=e}while(f);u.value=o(s);u.rest=r.slice(i)}})},{"./base64":189,amdefine:196}],189:[function(e,t,r){if(typeof n!=="function"){var n=e("amdefine")(t,e)}n(function(r,t,l){var e={};var n={};"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").forEach(function(t,r){e[t]=r;n[r]=t});t.encode=function a(e){if(e in n){return n[e]}throw new TypeError("Must be between 0 and 63: "+e)};t.decode=function i(n){if(n in e){return e[n]}throw new TypeError("Not a valid base 64 digit: "+n)}})},{amdefine:196}],190:[function(e,t,r){if(typeof n!=="function"){var n=e("amdefine")(t,e)}n(function(t,n,r){function e(t,r,l,a,i){var n=Math.floor((r-t)/2)+t;var s=i(l,a[n],true);if(s===0){return n}else if(s>0){if(r-n>1){return e(n,r,l,a,i)}return n}else{if(n-t>1){return e(t,n,l,a,i)}return t<0?-1:t}}n.search=function l(t,n,r){if(n.length===0){return-1}return e(-1,n.length,t,n,r)}})},{amdefine:196}],191:[function(e,t,r){if(typeof n!=="function"){var n=e("amdefine")(t,e)}n(function(t,r,a){var n=t("./util");function l(e,t){var r=e.generatedLine;var l=t.generatedLine;var a=e.generatedColumn;var i=t.generatedColumn;return l>r||l==r&&i>=a||n.compareByGeneratedPositions(e,t)<=0}function e(){this._array=[];this._sorted=true;this._last={generatedLine:-1,generatedColumn:0}}e.prototype.unsortedForEach=function i(e,n){this._array.forEach(e,n)};e.prototype.add=function s(e){var n;if(l(this._last,e)){this._last=e;this._array.push(e)}else{this._sorted=false;this._array.push(e)}};e.prototype.toArray=function o(){if(!this._sorted){this._array.sort(n.compareByGeneratedPositions);this._sorted=true}return this._array};r.MappingList=e})},{"./util":195,amdefine:196}],192:[function(e,t,r){if(typeof n!=="function"){var n=e("amdefine")(t,e)}n(function(r,a,s){var e=r("./util");var i=r("./binary-search");var l=r("./array-set").ArraySet;var t=r("./base64-vlq");function n(t){var n=t;if(typeof t==="string"){n=JSON.parse(t.replace(/^\)\]\}'/,""))}var a=e.getArg(n,"version");var r=e.getArg(n,"sources");var i=e.getArg(n,"names",[]);var s=e.getArg(n,"sourceRoot",null);var o=e.getArg(n,"sourcesContent",null);var u=e.getArg(n,"mappings");var c=e.getArg(n,"file",null);if(a!=this._version){throw new Error("Unsupported version: "+a)}r=r.map(e.normalize);this._names=l.fromArray(i,true);this._sources=l.fromArray(r,true);this.sourceRoot=s;this.sourcesContent=o;this._mappings=u;this.file=c}n.fromSourceMap=function o(r){var t=Object.create(n.prototype);t._names=l.fromArray(r._names.toArray(),true);t._sources=l.fromArray(r._sources.toArray(),true);t.sourceRoot=r._sourceRoot;t.sourcesContent=r._generateSourcesContent(t._sources.toArray(),t.sourceRoot);t.file=r._file;t.__generatedMappings=r._mappings.toArray().slice();t.__originalMappings=r._mappings.toArray().slice().sort(e.compareByOriginalPositions);return t};n.prototype._version=3;Object.defineProperty(n.prototype,"sources",{get:function(){return this._sources.toArray().map(function(n){return this.sourceRoot!=null?e.join(this.sourceRoot,n):n},this)}});n.prototype.__generatedMappings=null;Object.defineProperty(n.prototype,"_generatedMappings",{get:function(){if(!this.__generatedMappings){this.__generatedMappings=[];this.__originalMappings=[];this._parseMappings(this._mappings,this.sourceRoot)}return this.__generatedMappings}});n.prototype.__originalMappings=null;Object.defineProperty(n.prototype,"_originalMappings",{get:function(){if(!this.__originalMappings){this.__generatedMappings=[];this.__originalMappings=[];this._parseMappings(this._mappings,this.sourceRoot)}return this.__originalMappings}});n.prototype._nextCharIsMappingSeparator=function u(n){var e=n.charAt(0);return e===";"||e===","};n.prototype._parseMappings=function c(f,p){var o=1;var a=0;var s=0;var i=0;var u=0;var c=0;var n=f;var r={};var l;while(n.length>0){if(n.charAt(0)===";"){o++;n=n.slice(1);a=0}else if(n.charAt(0)===","){n=n.slice(1)}else{l={};l.generatedLine=o;t.decode(n,r);l.generatedColumn=a+r.value;a=l.generatedColumn;n=r.rest;if(n.length>0&&!this._nextCharIsMappingSeparator(n)){t.decode(n,r);l.source=this._sources.at(u+r.value);u+=r.value;n=r.rest;if(n.length===0||this._nextCharIsMappingSeparator(n)){throw new Error("Found a source, but no line and column")}t.decode(n,r);l.originalLine=s+r.value;s=l.originalLine;l.originalLine+=1;n=r.rest;if(n.length===0||this._nextCharIsMappingSeparator(n)){throw new Error("Found a source and line, but no column")}t.decode(n,r);l.originalColumn=i+r.value;i=l.originalColumn;n=r.rest;if(n.length>0&&!this._nextCharIsMappingSeparator(n)){t.decode(n,r);l.name=this._names.at(c+r.value);c+=r.value;n=r.rest}}this.__generatedMappings.push(l);if(typeof l.originalLine==="number"){this.__originalMappings.push(l)}}}this.__generatedMappings.sort(e.compareByGeneratedPositions);this.__originalMappings.sort(e.compareByOriginalPositions)};n.prototype._findMapping=function f(e,r,n,t,l){if(e[n]<=0){throw new TypeError("Line must be greater than or equal to 1, got "+e[n])}if(e[t]<0){throw new TypeError("Column must be greater than or equal to 0, got "+e[t])}return i.search(e,r,l)};n.prototype.computeColumnSpans=function p(){for(var e=0;e<this._generatedMappings.length;++e){var n=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var t=this._generatedMappings[e+1];if(n.generatedLine===t.generatedLine){n.lastGeneratedColumn=t.generatedColumn-1;continue}}n.lastGeneratedColumn=Infinity}};n.prototype.originalPositionFor=function d(r){var l={generatedLine:e.getArg(r,"line"),generatedColumn:e.getArg(r,"column")};var a=this._findMapping(l,this._generatedMappings,"generatedLine","generatedColumn",e.compareByGeneratedPositions);if(a>=0){var n=this._generatedMappings[a];if(n.generatedLine===l.generatedLine){var t=e.getArg(n,"source",null);if(t!=null&&this.sourceRoot!=null){t=e.join(this.sourceRoot,t)}return{source:t,line:e.getArg(n,"originalLine",null),column:e.getArg(n,"originalColumn",null),name:e.getArg(n,"name",null)}}}return{source:null,line:null,column:null,name:null}};n.prototype.sourceContentFor=function m(n){if(!this.sourcesContent){return null}if(this.sourceRoot!=null){n=e.relative(this.sourceRoot,n)}if(this._sources.has(n)){return this.sourcesContent[this._sources.indexOf(n)]}var t;if(this.sourceRoot!=null&&(t=e.urlParse(this.sourceRoot))){var r=n.replace(/^file:\/\//,"");if(t.scheme=="file"&&this._sources.has(r)){return this.sourcesContent[this._sources.indexOf(r)]}if((!t.path||t.path=="/")&&this._sources.has("/"+n)){return this.sourcesContent[this._sources.indexOf("/"+n)]}}throw new Error('"'+n+'" is not in the SourceMap.')};n.prototype.generatedPositionFor=function h(n){var t={source:e.getArg(n,"source"),originalLine:e.getArg(n,"line"),originalColumn:e.getArg(n,"column")};if(this.sourceRoot!=null){t.source=e.relative(this.sourceRoot,t.source)}var l=this._findMapping(t,this._originalMappings,"originalLine","originalColumn",e.compareByOriginalPositions);if(l>=0){var r=this._originalMappings[l];return{line:e.getArg(r,"generatedLine",null),column:e.getArg(r,"generatedColumn",null),lastColumn:e.getArg(r,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}};n.prototype.allGeneratedPositionsFor=function g(l){var t={source:e.getArg(l,"source"),originalLine:e.getArg(l,"line"),originalColumn:Infinity};if(this.sourceRoot!=null){t.source=e.relative(this.sourceRoot,t.source)}var a=[];var r=this._findMapping(t,this._originalMappings,"originalLine","originalColumn",e.compareByOriginalPositions);if(r>=0){var n=this._originalMappings[r];while(n&&n.originalLine===t.originalLine){a.push({line:e.getArg(n,"generatedLine",null),column:e.getArg(n,"generatedColumn",null),lastColumn:e.getArg(n,"lastGeneratedColumn",null)});n=this._originalMappings[--r]}}return a.reverse()};n.GENERATED_ORDER=1;n.ORIGINAL_ORDER=2;n.prototype.eachMapping=function y(l,a,i){var s=a||null;var o=i||n.GENERATED_ORDER;var t;switch(o){case n.GENERATED_ORDER:t=this._generatedMappings;break;case n.ORIGINAL_ORDER:t=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var r=this.sourceRoot;t.map(function(n){var t=n.source;if(t!=null&&r!=null){t=e.join(r,t)}return{source:t,generatedLine:n.generatedLine,generatedColumn:n.generatedColumn,originalLine:n.originalLine,originalColumn:n.originalColumn,name:n.name}}).forEach(l,s)};a.SourceMapConsumer=n})},{"./array-set":187,"./base64-vlq":188,"./binary-search":190,"./util":195,amdefine:196}],193:[function(e,t,r){if(typeof n!=="function"){var n=e("amdefine")(t,e)}n(function(r,a,s){var t=r("./base64-vlq");var e=r("./util");var l=r("./array-set").ArraySet;var i=r("./mapping-list").MappingList;function n(n){if(!n){n={}}this._file=e.getArg(n,"file",null);this._sourceRoot=e.getArg(n,"sourceRoot",null);this._skipValidation=e.getArg(n,"skipValidation",false);this._sources=new l;this._names=new l;this._mappings=new i;this._sourcesContents=null}n.prototype._version=3;n.fromSourceMap=function o(t){var r=t.sourceRoot;var l=new n({file:t.file,sourceRoot:r});t.eachMapping(function(n){var t={generated:{line:n.generatedLine,column:n.generatedColumn}};if(n.source!=null){t.source=n.source;if(r!=null){t.source=e.relative(r,t.source)}t.original={line:n.originalLine,column:n.originalColumn};if(n.name!=null){t.name=n.name}}l.addMapping(t)});t.sources.forEach(function(e){var n=t.sourceContentFor(e);if(n!=null){l.setSourceContent(e,n)}});return l};n.prototype.addMapping=function u(l){var a=e.getArg(l,"generated");var n=e.getArg(l,"original",null);var t=e.getArg(l,"source",null);var r=e.getArg(l,"name",null);if(!this._skipValidation){this._validateMapping(a,n,t,r)}if(t!=null&&!this._sources.has(t)){this._sources.add(t)}if(r!=null&&!this._names.has(r)){this._names.add(r)}this._mappings.add({generatedLine:a.line,generatedColumn:a.column,originalLine:n!=null&&n.line,originalColumn:n!=null&&n.column,source:t,name:r})};n.prototype.setSourceContent=function c(r,t){var n=r;if(this._sourceRoot!=null){n=e.relative(this._sourceRoot,n)}if(t!=null){if(!this._sourcesContents){this._sourcesContents={}}this._sourcesContents[e.toSetString(n)]=t}else if(this._sourcesContents){delete this._sourcesContents[e.toSetString(n)];if(Object.keys(this._sourcesContents).length===0){this._sourcesContents=null}}};n.prototype.applySourceMap=function f(t,o,r){var a=o;if(o==null){if(t.file==null){throw new Error("SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, "+'or the source map\'s "file" property. Both were omitted.')}a=t.file}var n=this._sourceRoot;if(n!=null){a=e.relative(n,a)}var i=new l;var s=new l;this._mappings.unsortedForEach(function(l){if(l.source===a&&l.originalLine!=null){var o=t.originalPositionFor({line:l.originalLine,column:l.originalColumn});if(o.source!=null){l.source=o.source;if(r!=null){l.source=e.join(r,l.source)}if(n!=null){l.source=e.relative(n,l.source)}l.originalLine=o.line;l.originalColumn=o.column;if(o.name!=null){l.name=o.name}}}var u=l.source;if(u!=null&&!i.has(u)){i.add(u)}var c=l.name;if(c!=null&&!s.has(c)){s.add(c)}},this);this._sources=i;this._names=s;t.sources.forEach(function(l){var a=t.sourceContentFor(l);if(a!=null){if(r!=null){l=e.join(r,l)}if(n!=null){l=e.relative(n,l)}this.setSourceContent(l,a)}},this)};n.prototype._validateMapping=function p(e,n,t,r){if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!n&&!t&&!r){return}else if(e&&"line"in e&&"column"in e&&n&&"line"in n&&"column"in n&&e.line>0&&e.column>=0&&n.line>0&&n.column>=0&&t){return}else{throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:t,original:n,name:r}))}};n.prototype._serializeMappings=function d(){var i=0;var a=1;var u=0;var c=0;var f=0;var o=0;var r="";var n;var s=this._mappings.toArray();for(var l=0,p=s.length;l<p;l++){n=s[l];if(n.generatedLine!==a){i=0;while(n.generatedLine!==a){r+=";";a++}}else{if(l>0){if(!e.compareByGeneratedPositions(n,s[l-1])){continue}r+=","}}r+=t.encode(n.generatedColumn-i);i=n.generatedColumn;if(n.source!=null){r+=t.encode(this._sources.indexOf(n.source)-o);o=this._sources.indexOf(n.source);r+=t.encode(n.originalLine-1-c);c=n.originalLine-1;r+=t.encode(n.originalColumn-u);u=n.originalColumn;if(n.name!=null){r+=t.encode(this._names.indexOf(n.name)-f);f=this._names.indexOf(n.name)}}}return r};n.prototype._generateSourcesContent=function m(t,n){return t.map(function(t){if(!this._sourcesContents){return null}if(n!=null){t=e.relative(n,t)}var r=e.toSetString(t);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null},this)};n.prototype.toJSON=function h(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};if(this._file!=null){e.file=this._file}if(this._sourceRoot!=null){e.sourceRoot=this._sourceRoot}if(this._sourcesContents){e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)}return e};n.prototype.toString=function g(){return JSON.stringify(this)};a.SourceMapGenerator=n})},{"./array-set":187,"./base64-vlq":188,"./mapping-list":191,"./util":195,amdefine:196}],194:[function(e,t,r){if(typeof n!=="function"){var n=e("amdefine")(t,e)}n(function(r,l,o){var a=r("./source-map-generator").SourceMapGenerator;var t=r("./util");var i=/(\r?\n)/;var s=10;var n="$$$isSourceNode$$$";function e(e,t,r,l,a){this.children=[];this.sourceContents={};this.line=e==null?null:e;this.column=t==null?null:t;this.source=r==null?null:r;this.name=a==null?null:a;this[n]=true;if(l!=null)this.add(l)}e.fromStringWithSourceMap=function u(p,c,s){var r=new e;var n=p.split(i);var u=function(){var e=n.shift();var t=n.shift()||"";return e+t};var o=1,a=0;var l=null;c.eachMapping(function(e){if(l!==null){if(o<e.generatedLine){var i="";f(l,u());o++;a=0}else{var t=n[0];var i=t.substr(0,e.generatedColumn-a);n[0]=t.substr(e.generatedColumn-a);a=e.generatedColumn;f(l,i);l=e;return}}while(o<e.generatedLine){r.add(u());o++}if(a<e.generatedColumn){var t=n[0];r.add(t.substr(0,e.generatedColumn));n[0]=t.substr(e.generatedColumn);a=e.generatedColumn}l=e},this);if(n.length>0){if(l){f(l,u())}r.add(n.join(""))}c.sources.forEach(function(e){var n=c.sourceContentFor(e);if(n!=null){if(s!=null){e=t.join(s,e)}r.setSourceContent(e,n)}});return r;function f(n,l){if(n===null||n.source===undefined){r.add(l)}else{var a=s?t.join(s,n.source):n.source;r.add(new e(n.originalLine,n.originalColumn,a,l,n.name))}}};e.prototype.add=function c(e){if(Array.isArray(e)){e.forEach(function(e){this.add(e)},this)}else if(e[n]||typeof e==="string"){if(e){this.children.push(e)}}else{throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e)}return this};e.prototype.prepend=function f(e){if(Array.isArray(e)){for(var t=e.length-1;t>=0;t--){this.prepend(e[t])}}else if(e[n]||typeof e==="string"){this.children.unshift(e)}else{throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e)}return this};e.prototype.walk=function p(r){var e;for(var t=0,l=this.children.length;t<l;t++){e=this.children[t];if(e[n]){e.walk(r)}else{if(e!==""){r(e,{source:this.source,line:this.line,column:this.column,name:this.name})}}}};e.prototype.join=function d(r){var e;var n;var t=this.children.length;if(t>0){e=[];for(n=0;n<t-1;n++){e.push(this.children[n]);e.push(r)}e.push(this.children[n]);this.children=e}return this};e.prototype.replaceRight=function m(t,r){var e=this.children[this.children.length-1];if(e[n]){e.replaceRight(t,r)}else if(typeof e==="string"){this.children[this.children.length-1]=e.replace(t,r)}else{this.children.push("".replace(t,r))}return this};e.prototype.setSourceContent=function h(e,n){this.sourceContents[t.toSetString(e)]=n};e.prototype.walkSourceContents=function g(l){for(var e=0,a=this.children.length;e<a;e++){if(this.children[e][n]){this.children[e].walkSourceContents(l)}}var r=Object.keys(this.sourceContents);for(var e=0,a=r.length;e<a;e++){l(t.fromSetString(r[e]),this.sourceContents[r[e]])}};e.prototype.toString=function y(){var e="";this.walk(function(n){e+=n});return e};e.prototype.toStringWithSourceMap=function v(u){var e={code:"",line:1,column:0};var n=new a(u);var t=false;var r=null;var l=null;var i=null;var o=null;this.walk(function(c,a){e.code+=c;if(a.source!==null&&a.line!==null&&a.column!==null){if(r!==a.source||l!==a.line||i!==a.column||o!==a.name){n.addMapping({source:a.source,original:{line:a.line,column:a.column},generated:{line:e.line,column:e.column},name:a.name})}r=a.source;l=a.line;i=a.column;o=a.name;t=true}else if(t){n.addMapping({generated:{line:e.line,column:e.column}});r=null;t=false}for(var u=0,f=c.length;u<f;u++){if(c.charCodeAt(u)===s){e.line++;e.column=0;if(u+1===f){r=null;t=false}else if(t){n.addMapping({source:a.source,original:{line:a.line,column:a.column},generated:{line:e.line,column:e.column},name:a.name})}}else{e.column++}}});this.walkSourceContents(function(e,t){n.setSourceContent(e,t)});return{code:e.code,map:n}};l.SourceNode=e})},{"./source-map-generator":193,"./util":195,amdefine:196}],195:[function(e,t,r){if(typeof n!=="function"){var n=e("amdefine")(t,e)}n(function(h,e,m){function o(n,e,t){if(e in n){return n[e]}else if(arguments.length===3){return t}else{throw new Error('"'+e+'" is a required argument.')}}e.getArg=o;var d=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/;var a=/^data:.+\,.+$/;function n(n){var e=n.match(d);if(!e){return null}return{scheme:e[1],auth:e[2],host:e[3],port:e[4],path:e[5]}}e.urlParse=n;function t(e){var n="";if(e.scheme){n+=e.scheme+":"}n+="//";if(e.auth){n+=e.auth+"@"}if(e.host){n+=e.host}if(e.port){n+=":"+e.port}if(e.path){n+=e.path}return n}e.urlGenerate=t;function l(o){var e=o;var r=n(o);if(r){if(!r.path){return o}e=r.path}var u=e.charAt(0)==="/";var l=e.split(/\/+/);for(var s,i=0,a=l.length-1;a>=0;a--){s=l[a];if(s==="."){l.splice(a,1)}else if(s===".."){i++}else if(i>0){if(s===""){l.splice(a+1,i);i=0}else{l.splice(a,2);i--}}}e=l.join("/");if(e===""){e=u?"/":"."}if(r){r.path=e;return t(r)}return e}e.normalize=l;function u(i,r){if(i===""){i="."}if(r===""){r="."}var s=n(r);var e=n(i);if(e){i=e.path||"/"}if(s&&!s.scheme){if(e){s.scheme=e.scheme}return t(s)}if(s||r.match(a)){return r}if(e&&!e.host&&!e.path){e.host=r;return t(e)}var o=r.charAt(0)==="/"?r:l(i.replace(/\/+$/,"")+"/"+r);if(e){e.path=o;return t(e)}return o}e.join=u;function c(e,t){if(e===""){e="."}e=e.replace(/\/$/,"");var r=n(e);if(t.charAt(0)=="/"&&r&&r.path=="/"){return t.slice(1)}return t.indexOf(e+"/")===0?t.substr(e.length+1):t}e.relative=c;function f(e){return"$"+e}e.toSetString=f;function p(e){return e.substr(1)}e.fromSetString=p;function r(t,r){var e=t||"";var n=r||"";return(e>n)-(e<n)}function s(n,t,l){var e;e=r(n.source,t.source);if(e){return e}e=n.originalLine-t.originalLine;if(e){return e}e=n.originalColumn-t.originalColumn;if(e||l){return e}e=r(n.name,t.name);if(e){return e}e=n.generatedLine-t.generatedLine;if(e){return e}return n.generatedColumn-t.generatedColumn}e.compareByOriginalPositions=s;function i(n,t,l){var e;e=n.generatedLine-t.generatedLine;if(e){return e}e=n.generatedColumn-t.generatedColumn;if(e||l){return e}e=r(n.source,t.source);if(e){return e}e=n.originalLine-t.originalLine;if(e){return e}e=n.originalColumn-t.originalColumn;if(e){return e}return r(n.name,t.name)}e.compareByGeneratedPositions=i})},{amdefine:196}],196:[function(e,n,t){(function(t,r){"use strict";function l(l,o){"use strict";var a={},n={},p=false,d=e("path"),i,u;function m(n){var e,t;for(e=0;n[e];e+=1){t=n[e];if(t==="."){n.splice(e,1);e-=1}else if(t===".."){if(e===1&&(n[2]===".."||n[0]==="..")){break}else if(e>0){n.splice(e-1,2);e-=2}}}}function s(n,t){var e;if(n&&n.charAt(0)==="."){if(t){e=t.split("/");e=e.slice(0,e.length-1);e=e.concat(n.split("/"));m(e);n=e.join("/")}}return n}function h(e){return function(n){return s(n,e)}}function g(t){function e(e){n[t]=e}e.fromText=function(e,n){throw new Error("amdefine does not implement load.fromText")};return e}i=function(n,r,e,l){function a(a,i){if(typeof a==="string"){return u(n,r,e,a,l)}else{a=a.map(function(t){return u(n,r,e,t,l)});t.nextTick(function(){i.apply(null,a)})}}a.toUrl=function(n){if(n.indexOf(".")===0){return s(n,d.dirname(e.filename))}else{return n}};return a};o=o||function y(){return l.require.apply(l,arguments)};function c(t,s,c){var f,a,e,u;if(t){a=n[t]={};e={id:t,uri:r,exports:a};f=i(o,a,e,t)}else{if(p){throw new Error("amdefine with no module ID cannot be called more than once per file.")}p=true;a=l.exports;e=l;f=i(o,a,e,l.id)}if(s){s=s.map(function(e){return f(e)})}if(typeof c==="function"){u=c.apply(e.exports,s)
}else{u=c}if(u!==undefined){e.exports=u;if(t){n[t]=e.exports}}}u=function(r,l,o,e,t){var p=e.indexOf("!"),m=e,d,f;if(p===-1){e=s(e,t);if(e==="require"){return i(r,l,o,t)}else if(e==="exports"){return l}else if(e==="module"){return o}else if(n.hasOwnProperty(e)){return n[e]}else if(a[e]){c.apply(null,a[e]);return n[e]}else{if(r){return r(m)}else{throw new Error("No module with ID: "+e)}}}else{d=e.substring(0,p);e=e.substring(p+1,e.length);f=u(r,l,o,d,t);if(f.normalize){e=f.normalize(e,h(t))}else{e=s(e,t)}if(n[e]){return n[e]}else{f.load(e,i(r,l,o,t),g(e),{});return n[e]}}};function f(n,e,t){if(Array.isArray(n)){t=e;e=n;n=undefined}else if(typeof n!=="string"){t=n;n=e=undefined}if(e&&!Array.isArray(e)){t=e;e=undefined}if(!e){e=["require","exports","module"]}if(n){a[n]=[n,e,t]}else{c(n,e,t)}}f.require=function(e){if(n[e]){return n[e]}if(a[e]){c.apply(null,a[e]);return n[e]}};f.amd={};return f}n.exports=l}).call(this,e("_process"),"/node_modules/source-map/node_modules/amdefine/amdefine.js")},{_process:119,path:118}],197:[function(n,e,t){e.exports={name:"6to5",description:"Turn ES6 code into readable vanilla ES5 with source maps",version:"2.13.0",author:"Sebastian McKenzie <[email protected]>",homepage:"https://6to5.org/",repository:"6to5/6to5",preferGlobal:true,main:"lib/6to5/index.js",bin:{"6to5":"./bin/6to5/index.js","6to5-node":"./bin/6to5-node","6to5-runtime":"./bin/6to5-runtime"},browser:{"./lib/6to5/index.js":"./lib/6to5/browser.js","./lib/6to5/register.js":"./lib/6to5/register-browser.js"},keywords:["harmony","classes","modules","let","const","var","es6","transpile","transpiler","6to5"],scripts:{bench:"make bench",test:"make test"},dependencies:{"acorn-6to5":"0.11.1-18","ast-types":"~0.6.1",chokidar:"0.12.6",commander:"2.6.0","core-js":"0.4.5",estraverse:"1.9.1",esutils:"1.1.6",esvalid:"1.1.0","fs-readdir-recursive":"0.1.0",jshint:"2.5.11",lodash:"2.4.1","output-file-sync":"^1.1.0","private":"0.1.6",regenerator:"0.8.9",regexpu:"1.0.0",roadrunner:"1.0.4","source-map":"0.1.43","source-map-support":"0.2.9"},devDependencies:{browserify:"8.1.1",chai:"1.10.0",istanbul:"0.3.5","jshint-stylish":"1.0.0",matcha:"0.6.0",mocha:"2.1.0",rimraf:"2.2.8","uglify-js":"2.4.16"},optionalDependencies:{kexec:"0.2.0"}}},{}],198:[function(n,e,t){e.exports={"abstract-expression-call":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"PROPERTY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"referenceGet",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"call",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"abstract-expression-delete":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"PROPERTY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"referenceDelete",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"abstract-expression-get":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"PROPERTY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"referenceGet",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"abstract-expression-set":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"PROPERTY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"referenceSet",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"apply-constructor":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Constructor",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"args",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instance",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"create",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Constructor",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"result",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Constructor",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"apply",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instance",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"args",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"result",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!=",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:true,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"result",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"object",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"||",right:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:true,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"result",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"function",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"result",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instance",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"array-comprehension-container":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"ArrayExpression",start:null,end:null,loc:null,range:null,elements:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"array-comprehension-for-each":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARRAY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"forEach",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"array-from":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"from",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"array-push":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"push",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"STATEMENT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"async-to-generator":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"fn",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"gen",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"fn",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"apply",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"ThisExpression",start:null,end:null,loc:null,range:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"NewExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Promise",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"resolve",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"reject",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"FunctionDeclaration",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"step",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getNext",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"next",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"TryStatement",start:null,end:null,loc:null,range:null,block:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"next",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getNext",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},handler:{type:"CatchClause",start:null,end:null,loc:null,range:null,param:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"e",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},guard:null,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"reject",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"e",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},guardedHandlers:[],finalizer:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"next",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"done",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"resolve",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"next",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Promise",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"resolve",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"next",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"then",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"v",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"step",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"gen",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"next",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"v",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"e",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"step",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"gen",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Literal",start:null,end:null,loc:null,range:null,value:"throw",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"e",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"step",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"gen",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"next",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},bind:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Function",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"bind",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},call:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"call",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"CONTEXT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"class-super-constructor-call-loose":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"SUPER_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!=",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"SUPER_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"apply",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"ThisExpression",start:null,end:null,loc:null,range:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"class-super-constructor-call":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getPrototypeOf",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"CLASS_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getPrototypeOf",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"CLASS_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"apply",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"ThisExpression",start:null,end:null,loc:null,range:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"common-export-default-assign":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"module",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"EXTENDS_HELPER",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Literal",start:null,end:null,loc:null,range:null,value:"default",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"corejs-iterator":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"CORE_ID",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"$for",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getIterator",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"default-parameter":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VARIABLE_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARGUMENTS",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARGUMENT_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"DEFAULT_VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARGUMENTS",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARGUMENT_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},defaults:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defaults",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ForInStatement",start:null,end:null,loc:null,range:null,left:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defaults",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defaults",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"define-property":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defineProperty",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"enumerable",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:true,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"configurable",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:true,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"writable",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:true,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"exports-assign":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"exports-default-module-override":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"module",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"exports-default-module":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"module",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"extends":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ForStatement",start:null,end:null,loc:null,range:null,init:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"Literal",start:null,end:null,loc:null,range:null,value:1,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"<",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"length",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},update:{type:"UpdateExpression",start:null,end:null,loc:null,range:null,operator:"++",prefix:false,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"source",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ForInStatement",start:null,end:null,loc:null,range:null,left:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"source",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"source",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"for-of-loose":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ForStatement",start:null,end:null,loc:null,range:null,init:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"IS_ARRAY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"isArray",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"INDEX",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"Literal",start:null,end:null,loc:null,range:null,value:0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"IS_ARRAY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"iterator",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},test:null,update:null,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"IS_ARRAY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"INDEX",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:">=",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"length",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BreakStatement",start:null,end:null,loc:null,range:null,label:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ID",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"UpdateExpression",start:null,end:null,loc:null,range:null,operator:"++",prefix:false,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"INDEX",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"INDEX",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"next",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"INDEX",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"done",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BreakStatement",start:null,end:null,loc:null,range:null,label:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ID",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"INDEX",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"for-of":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ForStatement",start:null,end:null,loc:null,range:null,init:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ITERATOR_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"iterator",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"STEP_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},test:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"!",prefix:true,argument:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"STEP_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ITERATOR_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"next",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"done",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},update:null,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},get:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"get",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"property",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"receiver",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getOwnPropertyDescriptor",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"property",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"parent",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getPrototypeOf",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"parent",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"get",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"parent",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"property",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"receiver",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Literal",start:null,end:null,loc:null,range:null,value:"value",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},operator:"in",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"writable",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getter",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"get",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getter",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getter",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"call",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"receiver",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"has-own":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"hasOwnProperty",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},inherits:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"subClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:true,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"function",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ThrowStatement",start:null,end:null,loc:null,range:null,argument:{type:"NewExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"TypeError",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Literal",start:null,end:null,loc:null,range:null,value:"Super expression must either be null or a function, not ",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},operator:"+",right:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:true,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"subClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"create",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"constructor",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"subClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"enumerable",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:false,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"writable",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:true,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"configurable",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:true,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"subClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"__proto__",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"interop-require-wildcard":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"constructor",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"default",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"interop-require":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Literal",start:null,end:null,loc:null,range:null,value:"default",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"||",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"let-scoping-return":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:true,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"RETURN",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"object",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"RETURN",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"v",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"object-without-properties":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"keys",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ForInStatement",start:null,end:null,loc:null,range:null,left:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"keys",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"indexOf",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:">=",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"ContinueStatement",start:null,end:null,loc:null,range:null,label:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"!",prefix:true,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"hasOwnProperty",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"call",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"ContinueStatement",start:null,end:null,loc:null,range:null,label:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"property-method-assignment-wrapper":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"WRAPPER_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_ID",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},params:[],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"apply",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"ThisExpression",start:null,end:null,loc:null,range:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"WRAPPER_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"toString",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"toString",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"WRAPPER_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"prototype-identifier":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"CLASS_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"prototype-properties":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"child",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"staticProps",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instanceProps",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"staticProps",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defineProperties",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"child",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"staticProps",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instanceProps",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defineProperties",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"child",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instanceProps",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"require-assign-key":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VARIABLE_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"require",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"MODULE_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},require:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"require",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"MODULE_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},rest:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ForStatement",start:null,end:null,loc:null,range:null,init:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LEN",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARGUMENTS",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"length",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARRAY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARRAY_LEN",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"START",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"<",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LEN",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},update:{type:"UpdateExpression",start:null,end:null,loc:null,range:null,operator:"++",prefix:false,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARRAY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARRAY_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARGUMENTS",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"self-global":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:true,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"global",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"undefined",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"self",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"global",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},slice:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"slice",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"sliced-to-array":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"isArray",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"ArrayExpression",start:null,end:null,loc:null,range:null,elements:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ForStatement",start:null,end:null,loc:null,range:null,init:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_iterator",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"iterator",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_step",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},test:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"!",prefix:true,argument:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_step",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_iterator",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"next",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"done",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},update:null,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"push",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_step",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"length",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BreakStatement",start:null,end:null,loc:null,range:null,label:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},system:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"System",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"register",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"MODULE_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"MODULE_DEPENDENCIES",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"EXPORT_IDENTIFIER",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"setters",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"SETTERS",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"execute",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"EXECUTE",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"tagged-template-literal-loose":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"strings",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"raw",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"strings",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"raw",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"raw",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"strings",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"tagged-template-literal":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"strings",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"raw",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"freeze",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defineProperties",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"strings",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"raw",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"freeze",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"raw",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"test-exports":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:true,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"undefined",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"test-module":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:true,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"module",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"undefined",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"to-array":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"isArray",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"from",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"typeof":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"constructor",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Literal",start:null,end:null,loc:null,range:null,value:"symbol",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},alternate:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:true,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"umd-runner-body":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"factory",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:true,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"define",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"function",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"define",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"amd",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"define",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"AMD_ARGUMENTS",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"factory",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"COMMON_TEST",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"factory",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"COMMON_ARGUMENTS",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},expression:false,_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}}
},{}]},{},[2])(2)}); |
node_modules/react-router/lib/IndexLink.js | manojadd/bob-demo | 'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _Link = require('./Link');
var _Link2 = _interopRequireDefault(_Link);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* An <IndexLink> is used to link to an <IndexRoute>.
*/
var IndexLink = _react2.default.createClass({
displayName: 'IndexLink',
render: function render() {
return _react2.default.createElement(_Link2.default, _extends({}, this.props, { onlyActiveOnIndex: true }));
}
});
exports.default = IndexLink;
module.exports = exports['default']; |
ajax/libs/react-virtualized/7.18.1/react-virtualized.min.js | tholu/cdnjs | !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("React.addons.shallowCompare"),require("ReactDOM")):"function"==typeof define&&define.amd?define(["React","React.addons.shallowCompare","ReactDOM"],t):"object"==typeof exports?exports.ReactVirtualized=t(require("React"),require("React.addons.shallowCompare"),require("ReactDOM")):e.ReactVirtualized=t(e.React,e["React.addons.shallowCompare"],e.ReactDOM)}(this,function(e,t,n){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return e[o].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);Object.defineProperty(t,"ArrowKeyStepper",{enumerable:!0,get:function(){return o.ArrowKeyStepper}});var r=n(5);Object.defineProperty(t,"AutoSizer",{enumerable:!0,get:function(){return r.AutoSizer}});var i=n(8);Object.defineProperty(t,"CellMeasurer",{enumerable:!0,get:function(){return i.CellMeasurer}});var l=n(11);Object.defineProperty(t,"Collection",{enumerable:!0,get:function(){return l.Collection}});var s=n(25);Object.defineProperty(t,"ColumnSizer",{enumerable:!0,get:function(){return s.ColumnSizer}});var a=n(35);Object.defineProperty(t,"defaultFlexTableCellDataGetter",{enumerable:!0,get:function(){return a.defaultCellDataGetter}}),Object.defineProperty(t,"defaultFlexTableCellRenderer",{enumerable:!0,get:function(){return a.defaultCellRenderer}}),Object.defineProperty(t,"defaultFlexTableHeaderRenderer",{enumerable:!0,get:function(){return a.defaultHeaderRenderer}}),Object.defineProperty(t,"defaultFlexTableRowRenderer",{enumerable:!0,get:function(){return a.defaultRowRenderer}}),Object.defineProperty(t,"FlexTable",{enumerable:!0,get:function(){return a.FlexTable}}),Object.defineProperty(t,"FlexColumn",{enumerable:!0,get:function(){return a.FlexColumn}}),Object.defineProperty(t,"SortDirection",{enumerable:!0,get:function(){return a.SortDirection}}),Object.defineProperty(t,"SortIndicator",{enumerable:!0,get:function(){return a.SortIndicator}});var u=n(27);Object.defineProperty(t,"defaultCellRangeRenderer",{enumerable:!0,get:function(){return u.defaultCellRangeRenderer}}),Object.defineProperty(t,"Grid",{enumerable:!0,get:function(){return u.Grid}});var c=n(44);Object.defineProperty(t,"InfiniteLoader",{enumerable:!0,get:function(){return c.InfiniteLoader}});var d=n(46);Object.defineProperty(t,"ScrollSync",{enumerable:!0,get:function(){return d.ScrollSync}});var f=n(48);Object.defineProperty(t,"VirtualScroll",{enumerable:!0,get:function(){return f.VirtualScroll}});var p=n(50);Object.defineProperty(t,"WindowScroller",{enumerable:!0,get:function(){return p.WindowScroller}})},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.ArrowKeyStepper=t["default"]=void 0;var r=n(2),i=o(r);t["default"]=i["default"],t.ArrowKeyStepper=i["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(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)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),a=n(3),u=o(a),c=n(4),d=o(c),f=function(e){function t(e,n){r(this,t);var o=i(this,Object.getPrototypeOf(t).call(this,e,n));return o.state={scrollToColumn:0,scrollToRow:0},o._columnStartIndex=0,o._columnStopIndex=0,o._rowStartIndex=0,o._rowStopIndex=0,o._onKeyDown=o._onKeyDown.bind(o),o._onSectionRendered=o._onSectionRendered.bind(o),o}return l(t,e),s(t,[{key:"render",value:function(){var e=this.props,t=e.className,n=e.children,o=this.state,r=o.scrollToColumn,i=o.scrollToRow;return u["default"].createElement("div",{className:t,onKeyDown:this._onKeyDown},n({onSectionRendered:this._onSectionRendered,scrollToColumn:r,scrollToRow:i}))}},{key:"shouldComponentUpdate",value:function(e,t){return(0,d["default"])(this,e,t)}},{key:"_onKeyDown",value:function(e){var t=this.props,n=t.columnCount,o=t.rowCount;switch(e.key){case"ArrowDown":e.preventDefault(),this.setState({scrollToRow:Math.min(this._rowStopIndex+1,o-1)});break;case"ArrowLeft":e.preventDefault(),this.setState({scrollToColumn:Math.max(this._columnStartIndex-1,0)});break;case"ArrowRight":e.preventDefault(),this.setState({scrollToColumn:Math.min(this._columnStopIndex+1,n-1)});break;case"ArrowUp":e.preventDefault(),this.setState({scrollToRow:Math.max(this._rowStartIndex-1,0)})}}},{key:"_onSectionRendered",value:function(e){var t=e.columnStartIndex,n=e.columnStopIndex,o=e.rowStartIndex,r=e.rowStopIndex;this._columnStartIndex=t,this._columnStopIndex=n,this._rowStartIndex=o,this._rowStopIndex=r}}]),t}(a.Component);f.propTypes={children:a.PropTypes.func.isRequired,className:a.PropTypes.string,columnCount:a.PropTypes.number.isRequired,rowCount:a.PropTypes.number.isRequired},t["default"]=f},function(t,n){t.exports=e},function(e,t){e.exports=React.addons.shallowCompare},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.AutoSizer=t["default"]=void 0;var r=n(6),i=o(r);t["default"]=i["default"],t.AutoSizer=i["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(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)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),a=n(3),u=o(a),c=n(4),d=o(c),f=function(e){function t(e){r(this,t);var n=i(this,Object.getPrototypeOf(t).call(this,e));return n.state={height:0,width:0},n._onResize=n._onResize.bind(n),n._onScroll=n._onScroll.bind(n),n._setRef=n._setRef.bind(n),n}return l(t,e),s(t,[{key:"componentDidMount",value:function(){this._detectElementResize=n(7),this._detectElementResize.addResizeListener(this._parentNode,this._onResize),this._onResize()}},{key:"componentWillUnmount",value:function(){this._detectElementResize&&this._detectElementResize.removeResizeListener(this._parentNode,this._onResize)}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.disableHeight,o=e.disableWidth,r=this.state,i=r.height,l=r.width,s={overflow:"visible"};return n||(s.height=0),o||(s.width=0),u["default"].createElement("div",{ref:this._setRef,onScroll:this._onScroll,style:s},t({height:i,width:l}))}},{key:"shouldComponentUpdate",value:function(e,t){return(0,d["default"])(this,e,t)}},{key:"_onResize",value:function(){var e=this.props.onResize,t=this._parentNode.getBoundingClientRect(),n=t.height||0,o=t.width||0,r=getComputedStyle(this._parentNode),i=parseInt(r.paddingLeft,10)||0,l=parseInt(r.paddingRight,10)||0,s=parseInt(r.paddingTop,10)||0,a=parseInt(r.paddingBottom,10)||0;this.setState({height:n-s-a,width:o-i-l}),e({height:n,width:o})}},{key:"_onScroll",value:function(e){e.stopPropagation()}},{key:"_setRef",value:function(e){this._parentNode=e&&e.parentNode}}]),t}(a.Component);f.propTypes={children:a.PropTypes.func.isRequired,disableHeight:a.PropTypes.bool,disableWidth:a.PropTypes.bool,onResize:a.PropTypes.func.isRequired},f.defaultProps={onResize:function(){}},t["default"]=f},function(e,t){"use strict";var n;n="undefined"!=typeof window?window:"undefined"!=typeof self?self:void 0;var o="undefined"!=typeof document&&document.attachEvent,r=!1;if(!o){var i=function(){var e=n.requestAnimationFrame||n.mozRequestAnimationFrame||n.webkitRequestAnimationFrame||function(e){return n.setTimeout(e,20)};return function(t){return e(t)}}(),l=function(){var e=n.cancelAnimationFrame||n.mozCancelAnimationFrame||n.webkitCancelAnimationFrame||n.clearTimeout;return function(t){return e(t)}}(),s=function(e){var t=e.__resizeTriggers__,n=t.firstElementChild,o=t.lastElementChild,r=n.firstElementChild;o.scrollLeft=o.scrollWidth,o.scrollTop=o.scrollHeight,r.style.width=n.offsetWidth+1+"px",r.style.height=n.offsetHeight+1+"px",n.scrollLeft=n.scrollWidth,n.scrollTop=n.scrollHeight},a=function(e){return e.offsetWidth!=e.__resizeLast__.width||e.offsetHeight!=e.__resizeLast__.height},u=function(e){var t=this;s(this),this.__resizeRAF__&&l(this.__resizeRAF__),this.__resizeRAF__=i(function(){a(t)&&(t.__resizeLast__.width=t.offsetWidth,t.__resizeLast__.height=t.offsetHeight,t.__resizeListeners__.forEach(function(n){n.call(t,e)}))})},c=!1,d="animation",f="",p="animationstart",h="Webkit Moz O ms".split(" "),y="webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "),_="",m=document.createElement("fakeelement");if(void 0!==m.style.animationName&&(c=!0),c===!1)for(var v=0;v<h.length;v++)if(void 0!==m.style[h[v]+"AnimationName"]){_=h[v],d=_+"Animation",f="-"+_.toLowerCase()+"-",p=y[v],c=!0;break}var S="resizeanim",g="@"+f+"keyframes "+S+" { from { opacity: 0; } to { opacity: 0; } } ",b=f+"animation: 1ms "+S+"; "}var w=function(){if(!r){var e=(g?g:"")+".resize-triggers { "+(b?b:"")+'visibility: hidden; opacity: 0; } .resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e)),t.appendChild(n),r=!0}},T=function(e,t){o?e.attachEvent("onresize",t):(e.__resizeTriggers__||("static"==getComputedStyle(e).position&&(e.style.position="relative"),w(),e.__resizeLast__={},e.__resizeListeners__=[],(e.__resizeTriggers__=document.createElement("div")).className="resize-triggers",e.__resizeTriggers__.innerHTML='<div class="expand-trigger"><div></div></div><div class="contract-trigger"></div>',e.appendChild(e.__resizeTriggers__),s(e),e.addEventListener("scroll",u,!0),p&&e.__resizeTriggers__.addEventListener(p,function(t){t.animationName==S&&s(e)})),e.__resizeListeners__.push(t))},C=function(e,t){o?e.detachEvent("onresize",t):(e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t),1),e.__resizeListeners__.length||(e.removeEventListener("scroll",u,!0),e.__resizeTriggers__=!e.removeChild(e.__resizeTriggers__)))};e.exports={addResizeListener:T,removeResizeListener:C}},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.CellMeasurer=t["default"]=void 0;var r=n(9),i=o(r);t["default"]=i["default"],t.CellMeasurer=i["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(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)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),a=n(3),u=o(a),c=n(10),d=o(c),f=function(e){function t(e,n){r(this,t);var o=i(this,Object.getPrototypeOf(t).call(this,e,n));return o._cachedColumnWidths={},o._cachedRowHeights={},o.getColumnWidth=o.getColumnWidth.bind(o),o.getRowHeight=o.getRowHeight.bind(o),o.resetMeasurements=o.resetMeasurements.bind(o),o.resetMeasurementForColumn=o.resetMeasurementForColumn.bind(o),o.resetMeasurementForRow=o.resetMeasurementForRow.bind(o),o}return l(t,e),s(t,[{key:"getColumnWidth",value:function(e){var t=e.index;if(this._cachedColumnWidths[t])return this._cachedColumnWidths[t];for(var n=this.props.rowCount,o=0,r=0;n>r;r++){var i=this._measureCell({clientWidth:!0,columnIndex:t,rowIndex:r}),l=i.width;o=Math.max(o,l)}return this._cachedColumnWidths[t]=o,o}},{key:"getRowHeight",value:function(e){var t=e.index;if(this._cachedRowHeights[t])return this._cachedRowHeights[t];for(var n=this.props.columnCount,o=0,r=0;n>r;r++){var i=this._measureCell({clientHeight:!0,columnIndex:r,rowIndex:t}),l=i.height;o=Math.max(o,l)}return this._cachedRowHeights[t]=o,o}},{key:"resetMeasurementForColumn",value:function(e){delete this._cachedColumnWidths[e]}},{key:"resetMeasurementForRow",value:function(e){delete this._cachedRowHeights[e]}},{key:"resetMeasurements",value:function(){this._cachedColumnWidths={},this._cachedRowHeights={}}},{key:"componentDidMount",value:function(){this._renderAndMount()}},{key:"componentWillReceiveProps",value:function(e){this._updateDivDimensions(e)}},{key:"componentWillUnmount",value:function(){this._unmountContainer()}},{key:"render",value:function(){var e=this.props.children;return e({getColumnWidth:this.getColumnWidth,getRowHeight:this.getRowHeight,resetMeasurements:this.resetMeasurements,resetMeasurementForColumn:this.resetMeasurementForColumn,resetMeasurementForRow:this.resetMeasurementForRow})}},{key:"_getContainerNode",value:function(e){var t=e.container;return t?d["default"].findDOMNode("function"==typeof t?t():t):document.body}},{key:"_measureCell",value:function(e){var t=e.clientHeight,n=void 0===t?!1:t,o=e.clientWidth,r=void 0===o?!0:o,i=e.columnIndex,l=e.rowIndex,s=this.props.cellRenderer,a=s({columnIndex:i,rowIndex:l});this._renderAndMount(),d["default"].unstable_renderSubtreeIntoContainer(this,a,this._div);var u={height:n&&this._div.clientHeight,width:r&&this._div.clientWidth};return d["default"].unmountComponentAtNode(this._div),u}},{key:"_renderAndMount",value:function(){this._div||(this._div=document.createElement("div"),this._div.style.display="inline-block",this._div.style.position="absolute",this._div.style.visibility="hidden",this._div.style.zIndex=-1,this._updateDivDimensions(this.props),this._containerNode=this._getContainerNode(this.props),this._containerNode.appendChild(this._div))}},{key:"_unmountContainer",value:function(){this._div&&(this._containerNode.removeChild(this._div),this._div=null),this._containerNode=null}},{key:"_updateDivDimensions",value:function(e){var t=e.height,n=e.width;t&&t!==this._divHeight&&(this._divHeight=t,this._div.style.height=t+"px"),n&&n!==this._divWidth&&(this._divWidth=n,this._div.style.width=n+"px")}}]),t}(a.Component);f.propTypes={cellRenderer:a.PropTypes.func.isRequired,children:a.PropTypes.func.isRequired,columnCount:a.PropTypes.number.isRequired,container:u["default"].PropTypes.oneOfType([u["default"].PropTypes.func,u["default"].PropTypes.node]),height:a.PropTypes.number,rowCount:a.PropTypes.number.isRequired,width:a.PropTypes.number},t["default"]=f},function(e,t){e.exports=n},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Collection=t["default"]=void 0;var r=n(12),i=o(r);t["default"]=i["default"],t.Collection=i["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}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)}function a(e){var t=e.cellRenderer,n=e.cellSizeAndPositionGetter,o=e.indices,r=e.isScrolling;return o.map(function(e){var o=n({index:e}),i=t({index:e,isScrolling:r});return null==i||i===!1?null:f["default"].createElement("div",{className:"Collection__cell",key:e,style:{height:o.height,left:o.x,top:o.y,width:o.width}},i)}).filter(function(e){return!!e})}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),d=n(3),f=o(d),p=n(13),h=o(p),y=n(21),_=o(y),m=n(24),v=o(m),S=n(4),g=o(S),b=function(e){function t(e,n){i(this,t);var o=l(this,Object.getPrototypeOf(t).call(this,e,n));return o._cellMetadata=[],o._lastRenderedCellIndices=[],o}return s(t,e),c(t,[{key:"recomputeCellSizesAndPositions",value:function(){this._collectionView.recomputeCellSizesAndPositions()}},{key:"render",value:function(){var e=this,t=r(this.props,[]);return f["default"].createElement(h["default"],u({cellLayoutManager:this,ref:function(t){e._collectionView=t}},t))}},{key:"shouldComponentUpdate",value:function(e,t){return(0,g["default"])(this,e,t)}},{key:"calculateSizeAndPositionData",value:function(){var e=this.props,t=e.cellCount,n=e.cellSizeAndPositionGetter,o=e.sectionSize,r=(0,_["default"])({cellCount:t,cellSizeAndPositionGetter:n,sectionSize:o});this._cellMetadata=r.cellMetadata,this._sectionManager=r.sectionManager,this._height=r.height,this._width=r.width}},{key:"getLastRenderedIndices",value:function(){return this._lastRenderedCellIndices}},{key:"getScrollPositionForCell",value:function(e){var t=e.align,n=e.cellIndex,o=e.height,r=e.scrollLeft,i=e.scrollTop,l=e.width,s=this.props.cellCount;if(n>=0&&s>n){var a=this._cellMetadata[n];r=(0,v["default"])({align:t,cellOffset:a.x,cellSize:a.width,containerSize:l,currentOffset:r,targetIndex:n}),i=(0,v["default"])({align:t,cellOffset:a.y,cellSize:a.height,containerSize:o,currentOffset:i,targetIndex:n})}return{scrollLeft:r,scrollTop:i}}},{key:"getTotalSize",value:function(){return{height:this._height,width:this._width}}},{key:"cellRenderers",value:function(e){var t=this,n=e.height,o=e.isScrolling,r=e.width,i=e.x,l=e.y,s=this.props,a=s.cellGroupRenderer,u=s.cellRenderer;return this._lastRenderedCellIndices=this._sectionManager.getCellIndices({height:n,width:r,x:i,y:l}),a({cellRenderer:u,cellSizeAndPositionGetter:function(e){var n=e.index;return t._sectionManager.getCellMetadata({index:n})},indices:this._lastRenderedCellIndices,isScrolling:o})}}]),t}(d.Component);b.propTypes={"aria-label":d.PropTypes.string,cellCount:d.PropTypes.number.isRequired,cellGroupRenderer:d.PropTypes.func.isRequired,cellRenderer:d.PropTypes.func.isRequired,cellSizeAndPositionGetter:d.PropTypes.func.isRequired,sectionSize:d.PropTypes.number},b.defaultProps={"aria-label":"grid",cellGroupRenderer:a},t["default"]=b},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(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)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),u=n(3),c=o(u),d=n(14),f=o(d),p=n(15),h=o(p),y=n(16),_=o(y),m=n(18),v=o(m),S=n(4),g=o(S),b=150,w={OBSERVED:"observed",REQUESTED:"requested"},T=function(e){function t(e,n){r(this,t);var o=i(this,Object.getPrototypeOf(t).call(this,e,n));return o.state={calculateSizeAndPositionDataOnNextUpdate:!1,isScrolling:!1,scrollLeft:0,scrollTop:0},o._onSectionRenderedMemoizer=(0,h["default"])(),o._onScrollMemoizer=(0,h["default"])(!1),o._invokeOnSectionRenderedHelper=o._invokeOnSectionRenderedHelper.bind(o),o._onScroll=o._onScroll.bind(o),o._updateScrollPositionForScrollToCell=o._updateScrollPositionForScrollToCell.bind(o),o}return l(t,e),a(t,[{key:"recomputeCellSizesAndPositions",value:function(){this.setState({calculateSizeAndPositionDataOnNextUpdate:!0})}},{key:"componentDidMount",value:function(){var e=this.props,t=e.cellLayoutManager,n=e.scrollLeft,o=e.scrollToCell,r=e.scrollTop;this._scrollbarSizeMeasured||(this._scrollbarSize=(0,_["default"])(),this._scrollbarSizeMeasured=!0,this.setState({})),o>=0?this._updateScrollPositionForScrollToCell():(n>=0||r>=0)&&this._setScrollPosition({scrollLeft:n,scrollTop:r}),this._invokeOnSectionRenderedHelper();var i=t.getTotalSize(),l=i.height,s=i.width;this._invokeOnScrollMemoizer({scrollLeft:n||0,scrollTop:r||0,totalHeight:l,totalWidth:s})}},{key:"componentDidUpdate",value:function(e,t){var n=this.props,o=n.height,r=n.scrollToCell,i=n.width,l=this.state,s=l.scrollLeft,a=l.scrollPositionChangeReason,u=l.scrollToAlignment,c=l.scrollTop;a===w.REQUESTED&&(s>=0&&s!==t.scrollLeft&&s!==this._scrollingContainer.scrollLeft&&(this._scrollingContainer.scrollLeft=s),c>=0&&c!==t.scrollTop&&c!==this._scrollingContainer.scrollTop&&(this._scrollingContainer.scrollTop=c)),o===e.height&&u===e.scrollToAlignment&&r===e.scrollToCell&&i===e.width||this._updateScrollPositionForScrollToCell(),this._invokeOnSectionRenderedHelper()}},{key:"componentWillMount",value:function(){var e=this.props.cellLayoutManager;e.calculateSizeAndPositionData(),this._scrollbarSize=(0,_["default"])(),void 0===this._scrollbarSize?(this._scrollbarSizeMeasured=!1,this._scrollbarSize=0):this._scrollbarSizeMeasured=!0}},{key:"componentWillUnmount",value:function(){this._disablePointerEventsTimeoutId&&clearTimeout(this._disablePointerEventsTimeoutId),this._setNextStateAnimationFrameId&&v["default"].cancel(this._setNextStateAnimationFrameId)}},{key:"componentWillUpdate",value:function(e,t){0!==e.cellCount||0===t.scrollLeft&&0===t.scrollTop?e.scrollLeft===this.props.scrollLeft&&e.scrollTop===this.props.scrollTop||this._setScrollPosition({scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}):this._setScrollPosition({scrollLeft:0,scrollTop:0}),(e.cellCount!==this.props.cellCount||e.cellLayoutManager!==this.props.cellLayoutManager||t.calculateSizeAndPositionDataOnNextUpdate)&&e.cellLayoutManager.calculateSizeAndPositionData(),t.calculateSizeAndPositionDataOnNextUpdate&&this.setState({calculateSizeAndPositionDataOnNextUpdate:!1})}},{key:"render",value:function(){var e=this,t=this.props,n=t.cellCount,o=t.cellLayoutManager,r=t.className,i=t.height,l=t.noContentRenderer,a=t.style,u=t.width,d=this.state,p=d.isScrolling,h=d.scrollLeft,y=d.scrollTop,_=i>0&&u>0?o.cellRenderers({height:i,isScrolling:p,width:u,x:h,y:y}):[],m=o.getTotalSize(),v=m.height,S=m.width,g={height:i,width:u},b=v>i?this._scrollbarSize:0,w=S>u?this._scrollbarSize:0;return u>=S+b&&(g.overflowX="hidden"),i>=v+w&&(g.overflowY="hidden"),c["default"].createElement("div",{ref:function(t){e._scrollingContainer=t},"aria-label":this.props["aria-label"],className:(0,f["default"])("Collection",r),onScroll:this._onScroll,role:"grid",style:s({},g,a),tabIndex:0},n>0&&c["default"].createElement("div",{className:"Collection__innerScrollContainer",style:{height:v,maxHeight:v,maxWidth:S,pointerEvents:p?"none":"auto",width:S}},_),0===n&&l())}},{key:"shouldComponentUpdate",value:function(e,t){return(0,g["default"])(this,e,t)}},{key:"_enablePointerEventsAfterDelay",value:function(){var e=this;this._disablePointerEventsTimeoutId&&clearTimeout(this._disablePointerEventsTimeoutId),this._disablePointerEventsTimeoutId=setTimeout(function(){e._disablePointerEventsTimeoutId=null,e.setState({isScrolling:!1})},b)}},{key:"_invokeOnSectionRenderedHelper",value:function(){var e=this.props,t=e.cellLayoutManager,n=e.onSectionRendered;this._onSectionRenderedMemoizer({callback:n,indices:{indices:t.getLastRenderedIndices()}})}},{key:"_invokeOnScrollMemoizer",value:function(e){var t=this,n=e.scrollLeft,o=e.scrollTop,r=e.totalHeight,i=e.totalWidth;this._onScrollMemoizer({callback:function(e){var n=e.scrollLeft,o=e.scrollTop,l=t.props,s=l.height,a=l.onScroll,u=l.width;a({clientHeight:s,clientWidth:u,scrollHeight:r,scrollLeft:n,scrollTop:o,scrollWidth:i})},indices:{scrollLeft:n,scrollTop:o}})}},{key:"_setNextState",value:function(e){var t=this;this._setNextStateAnimationFrameId&&v["default"].cancel(this._setNextStateAnimationFrameId),this._setNextStateAnimationFrameId=(0,v["default"])(function(){t._setNextStateAnimationFrameId=null,t.setState(e)})}},{key:"_setScrollPosition",value:function(e){var t=e.scrollLeft,n=e.scrollTop,o={scrollPositionChangeReason:w.REQUESTED};t>=0&&(o.scrollLeft=t),n>=0&&(o.scrollTop=n),(t>=0&&t!==this.state.scrollLeft||n>=0&&n!==this.state.scrollTop)&&this.setState(o)}},{key:"_updateScrollPositionForScrollToCell",value:function(){var e=this.props,t=e.cellLayoutManager,n=e.height,o=e.scrollToAlignment,r=e.scrollToCell,i=e.width,l=this.state,s=l.scrollLeft,a=l.scrollTop;if(r>=0){var u=t.getScrollPositionForCell({align:o,cellIndex:r,height:n,scrollLeft:s,scrollTop:a,width:i});u.scrollLeft===s&&u.scrollTop===a||this._setScrollPosition(u)}}},{key:"_onScroll",value:function(e){if(e.target===this._scrollingContainer){this._enablePointerEventsAfterDelay();var t=this.props,n=t.cellLayoutManager,o=t.height,r=t.width,i=this._scrollbarSize,l=n.getTotalSize(),s=l.height,a=l.width,u=Math.max(0,Math.min(a-r+i,e.target.scrollLeft)),c=Math.max(0,Math.min(s-o+i,e.target.scrollTop));if(this.state.scrollLeft!==u||this.state.scrollTop!==c){var d=e.cancelable?w.OBSERVED:w.REQUESTED;this.state.isScrolling||this.setState({isScrolling:!0}),this._setNextState({isScrolling:!0,scrollLeft:u,scrollPositionChangeReason:d,scrollTop:c})}this._invokeOnScrollMemoizer({scrollLeft:u,scrollTop:c,totalWidth:a,totalHeight:s})}}}]),t}(u.Component);T.propTypes={"aria-label":u.PropTypes.string,cellCount:u.PropTypes.number.isRequired,cellLayoutManager:u.PropTypes.object.isRequired,className:u.PropTypes.string,height:u.PropTypes.number.isRequired,noContentRenderer:u.PropTypes.func.isRequired,onScroll:u.PropTypes.func.isRequired,onSectionRendered:u.PropTypes.func.isRequired,scrollLeft:u.PropTypes.number,scrollToAlignment:u.PropTypes.oneOf(["auto","end","start","center"]).isRequired,scrollToCell:u.PropTypes.number,scrollTop:u.PropTypes.number,style:u.PropTypes.object,width:u.PropTypes.number.isRequired},T.defaultProps={"aria-label":"grid",noContentRenderer:function(){return null},onScroll:function(){return null},onSectionRendered:function(){return null},scrollToAlignment:"auto",style:{}},t["default"]=T},function(e,t,n){var o,r;!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var r=typeof o;if("string"===r||"number"===r)e.push(o);else if(Array.isArray(o))e.push(n.apply(null,o));else if("object"===r)for(var l in o)i.call(o,l)&&o[l]&&e.push(l)}}return e.join(" ")}var i={}.hasOwnProperty;"undefined"!=typeof e&&e.exports?e.exports=n:(o=[],r=function(){return n}.apply(t,o),!(void 0!==r&&(e.exports=r)))}()},function(e,t){"use strict";function n(){var e=arguments.length<=0||void 0===arguments[0]?!0:arguments[0],t={};return function(n){var o=n.callback,r=n.indices,i=Object.keys(r),l=!e||i.every(function(e){var t=r[e];return Array.isArray(t)?t.length>0:t>=0}),s=i.length!==Object.keys(t).length||i.some(function(e){var n=t[e],o=r[e];return Array.isArray(o)?n.join(",")!==o.join(","):n!==o});t=r,l&&s&&o(r)}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n},function(e,t,n){"use strict";var o,r=n(17);e.exports=function(e){if((!o||e)&&r){var t=document.createElement("div");t.style.position="absolute",t.style.top="-9999px",t.style.width="50px",t.style.height="50px",t.style.overflow="scroll",document.body.appendChild(t),o=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return o}},function(e,t){"use strict";e.exports=!("undefined"==typeof window||!window.document||!window.document.createElement)},function(e,t,n){(function(t){for(var o=n(19),r="undefined"==typeof window?t:window,i=["moz","webkit"],l="AnimationFrame",s=r["request"+l],a=r["cancel"+l]||r["cancelRequest"+l],u=0;!s&&u<i.length;u++)s=r[i[u]+"Request"+l],a=r[i[u]+"Cancel"+l]||r[i[u]+"CancelRequest"+l];if(!s||!a){var c=0,d=0,f=[],p=1e3/60;s=function(e){if(0===f.length){var t=o(),n=Math.max(0,p-(t-c));c=n+t,setTimeout(function(){var e=f.slice(0);f.length=0;for(var t=0;t<e.length;t++)if(!e[t].cancelled)try{e[t].callback(c)}catch(n){setTimeout(function(){throw n},0)}},Math.round(n))}return f.push({handle:++d,callback:e,cancelled:!1}),d},a=function(e){for(var t=0;t<f.length;t++)f[t].handle===e&&(f[t].cancelled=!0)}}e.exports=function(e){return s.call(r,e)},e.exports.cancel=function(){a.apply(r,arguments)},e.exports.polyfill=function(){r.requestAnimationFrame=s,r.cancelAnimationFrame=a}}).call(t,function(){return this}())},function(e,t,n){(function(t){(function(){var n,o,r;"undefined"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:"undefined"!=typeof t&&null!==t&&t.hrtime?(e.exports=function(){return(n()-r)/1e6},o=t.hrtime,n=function(){var e;return e=o(),1e9*e[0]+e[1]},r=n()):Date.now?(e.exports=function(){return Date.now()-r},r=Date.now()):(e.exports=function(){return(new Date).getTime()-r},r=(new Date).getTime())}).call(this)}).call(t,n(20))},function(e,t){function n(){u&&l&&(u=!1,l.length?a=l.concat(a):c=-1,a.length&&o())}function o(){if(!u){var e=setTimeout(n);u=!0;for(var t=a.length;t;){for(l=a,a=[];++c<t;)l&&l[c].run();c=-1,t=a.length}l=null,u=!1,clearTimeout(e)}}function r(e,t){this.fun=e,this.array=t}function i(){}var l,s=e.exports={},a=[],u=!1,c=-1;s.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];
a.push(new r(e,t)),1!==a.length||u||setTimeout(o,0)},r.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=i,s.addListener=i,s.once=i,s.off=i,s.removeListener=i,s.removeAllListeners=i,s.emit=i,s.binding=function(e){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(e){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e){for(var t=e.cellCount,n=e.cellSizeAndPositionGetter,o=e.sectionSize,r=[],i=new l["default"](o),s=0,a=0,u=0;t>u;u++){var c=n({index:u});if(null==c.height||isNaN(c.height)||null==c.width||isNaN(c.width)||null==c.x||isNaN(c.x)||null==c.y||isNaN(c.y))throw Error("Invalid metadata returned for cell "+u+":\n x:"+c.x+", y:"+c.y+", width:"+c.width+", height:"+c.height);s=Math.max(s,c.y+c.height),a=Math.max(a,c.x+c.width),r[u]=c,i.registerCell({cellMetadatum:c,index:u})}return{cellMetadata:r,height:s,sectionManager:i,width:a}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r;var i=n(22),l=o(i)},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),l=n(23),s=o(l),a=100,u=function(){function e(){var t=arguments.length<=0||void 0===arguments[0]?a:arguments[0];r(this,e),this._sectionSize=t,this._cellMetadata=[],this._sections={}}return i(e,[{key:"getCellIndices",value:function(e){var t=e.height,n=e.width,o=e.x,r=e.y,i={};return this.getSections({height:t,width:n,x:o,y:r}).forEach(function(e){return e.getCellIndices().forEach(function(e){i[e]=e})}),Object.keys(i).map(function(e){return i[e]})}},{key:"getCellMetadata",value:function(e){var t=e.index;return this._cellMetadata[t]}},{key:"getSections",value:function(e){for(var t=e.height,n=e.width,o=e.x,r=e.y,i=Math.floor(o/this._sectionSize),l=Math.floor((o+n-1)/this._sectionSize),a=Math.floor(r/this._sectionSize),u=Math.floor((r+t-1)/this._sectionSize),c=[],d=i;l>=d;d++)for(var f=a;u>=f;f++){var p=d+"."+f;this._sections[p]||(this._sections[p]=new s["default"]({height:this._sectionSize,width:this._sectionSize,x:d*this._sectionSize,y:f*this._sectionSize})),c.push(this._sections[p])}return c}},{key:"getTotalSectionCount",value:function(){return Object.keys(this._sections).length}},{key:"toString",value:function(){var e=this;return Object.keys(this._sections).map(function(t){return e._sections[t].toString()})}},{key:"registerCell",value:function(e){var t=e.cellMetadatum,n=e.index;this._cellMetadata[n]=t,this.getSections(t).forEach(function(e){return e.addCellIndex({index:n})})}}]),e}();t["default"]=u},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=function(){function e(t){var o=t.height,r=t.width,i=t.x,l=t.y;n(this,e),this.height=o,this.width=r,this.x=i,this.y=l,this._indexMap={},this._indices=[]}return o(e,[{key:"addCellIndex",value:function(e){var t=e.index;this._indexMap[t]||(this._indexMap[t]=!0,this._indices.push(t))}},{key:"getCellIndices",value:function(){return this._indices}},{key:"toString",value:function(){return this.x+","+this.y+" "+this.width+"x"+this.height}}]),e}();t["default"]=r},function(e,t){"use strict";function n(e){var t=e.align,n=void 0===t?"auto":t,o=e.cellOffset,r=e.cellSize,i=e.containerSize,l=e.currentOffset,s=o,a=s-i+r;switch(n){case"start":return s;case"end":return a;case"center":return s-(i-r)/2;default:return Math.max(a,Math.min(s,l))}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.ColumnSizer=t["default"]=void 0;var r=n(26),i=o(r);t["default"]=i["default"],t.ColumnSizer=i["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(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)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),a=n(3),u=n(4),c=o(u),d=n(27),f=o(d),p=function(e){function t(e,n){r(this,t);var o=i(this,Object.getPrototypeOf(t).call(this,e,n));return o._registerChild=o._registerChild.bind(o),o}return l(t,e),s(t,[{key:"componentDidUpdate",value:function(e,t){var n=this.props,o=n.columnMaxWidth,r=n.columnMinWidth,i=n.columnCount,l=n.width;o===e.columnMaxWidth&&r===e.columnMinWidth&&i===e.columnCount&&l===e.width||this._registeredChild&&this._registeredChild.recomputeGridSize()}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.columnMaxWidth,o=e.columnMinWidth,r=e.columnCount,i=e.width,l=o||1,s=n?Math.min(n,i):i,a=i/r;a=Math.max(l,a),a=Math.min(s,a),a=Math.floor(a);var u=Math.min(i,a*r);return t({adjustedWidth:u,getColumnWidth:function(){return a},registerChild:this._registerChild})}},{key:"shouldComponentUpdate",value:function(e,t){return(0,c["default"])(this,e,t)}},{key:"_registerChild",value:function(e){if(null!==e&&!(e instanceof f["default"]))throw Error("Unexpected child type registered; only Grid children are supported.");this._registeredChild=e,this._registeredChild&&this._registeredChild.recomputeGridSize()}}]),t}(a.Component);p.propTypes={children:a.PropTypes.func.isRequired,columnMaxWidth:a.PropTypes.number,columnMinWidth:a.PropTypes.number,columnCount:a.PropTypes.number.isRequired,width:a.PropTypes.number.isRequired},t["default"]=p},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.defaultCellRangeRenderer=t.Grid=t["default"]=void 0;var r=n(28),i=o(r),l=n(34),s=o(l);t["default"]=i["default"],t.Grid=i["default"],t.defaultCellRangeRenderer=s["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(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)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),u=n(3),c=o(u),d=n(14),f=o(d),p=n(29),h=o(p),y=n(30),_=o(y),m=n(15),v=o(m),S=n(32),g=o(S),b=n(16),w=o(b),T=n(18),C=o(T),P=n(4),x=o(P),R=n(33),z=o(R),O=n(34),M=o(O),I=150,k={OBSERVED:"observed",REQUESTED:"requested"},A=function(e){function t(e,n){r(this,t);var o=i(this,Object.getPrototypeOf(t).call(this,e,n));return o.state={isScrolling:!1,scrollLeft:0,scrollTop:0},o._onGridRenderedMemoizer=(0,v["default"])(),o._onScrollMemoizer=(0,v["default"])(!1),o._enablePointerEventsAfterDelayCallback=o._enablePointerEventsAfterDelayCallback.bind(o),o._invokeOnGridRenderedHelper=o._invokeOnGridRenderedHelper.bind(o),o._onScroll=o._onScroll.bind(o),o._setNextStateCallback=o._setNextStateCallback.bind(o),o._updateScrollLeftForScrollToColumn=o._updateScrollLeftForScrollToColumn.bind(o),o._updateScrollTopForScrollToRow=o._updateScrollTopForScrollToRow.bind(o),o._columnWidthGetter=o._wrapSizeGetter(e.columnWidth),o._rowHeightGetter=o._wrapSizeGetter(e.rowHeight),o._columnSizeAndPositionManager=new _["default"]({cellCount:e.columnCount,cellSizeGetter:function(e){return o._columnWidthGetter(e)},estimatedCellSize:o._getEstimatedColumnSize(e)}),o._rowSizeAndPositionManager=new _["default"]({cellCount:e.rowCount,cellSizeGetter:function(e){return o._rowHeightGetter(e)},estimatedCellSize:o._getEstimatedRowSize(e)}),o._cellCache={},o}return l(t,e),a(t,[{key:"measureAllCells",value:function(){var e=this.props,t=e.columnCount,n=e.rowCount;this._columnSizeAndPositionManager.getSizeAndPositionOfCell(t-1),this._rowSizeAndPositionManager.getSizeAndPositionOfCell(n-1)}},{key:"recomputeGridSize",value:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.columnIndex,n=void 0===t?0:t,o=e.rowIndex,r=void 0===o?0:o;this._columnSizeAndPositionManager.resetCell(n),this._rowSizeAndPositionManager.resetCell(r),this.forceUpdate()}},{key:"componentDidMount",value:function(){var e=this.props,t=e.scrollLeft,n=e.scrollToColumn,o=e.scrollTop,r=e.scrollToRow;this._scrollbarSizeMeasured||(this._scrollbarSize=(0,w["default"])(),this._scrollbarSizeMeasured=!0,this.setState({})),(t>=0||o>=0)&&this._setScrollPosition({scrollLeft:t,scrollTop:o}),(n>=0||r>=0)&&(this._updateScrollLeftForScrollToColumn(),this._updateScrollTopForScrollToRow()),this._invokeOnGridRenderedHelper(),this._invokeOnScrollMemoizer({scrollLeft:t||0,scrollTop:o||0,totalColumnsWidth:this._columnSizeAndPositionManager.getTotalSize(),totalRowsHeight:this._rowSizeAndPositionManager.getTotalSize()})}},{key:"componentDidUpdate",value:function(e,t){var n=this,o=this.props,r=o.autoHeight,i=o.columnCount,l=o.height,a=o.rowCount,u=o.scrollToAlignment,c=o.scrollToColumn,d=o.scrollToRow,f=o.width,p=this.state,h=p.scrollLeft,y=p.scrollPositionChangeReason,_=p.scrollTop,m=i>0&&0===e.columnCount||a>0&&0===e.rowCount;y===k.REQUESTED&&(h>=0&&(h!==t.scrollLeft&&h!==this._scrollingContainer.scrollLeft||m)&&(this._scrollingContainer.scrollLeft=h),!r&&_>=0&&(_!==t.scrollTop&&_!==this._scrollingContainer.scrollTop||m)&&(this._scrollingContainer.scrollTop=_)),(0,z["default"])({cellSizeAndPositionManager:this._columnSizeAndPositionManager,previousCellsCount:e.columnCount,previousCellSize:e.columnWidth,previousScrollToAlignment:e.scrollToAlignment,previousScrollToIndex:e.scrollToColumn,previousSize:e.width,scrollOffset:h,scrollToAlignment:u,scrollToIndex:c,size:f,updateScrollIndexCallback:function(e){return n._updateScrollLeftForScrollToColumn(s({},n.props,{scrollToColumn:e}))}}),(0,z["default"])({cellSizeAndPositionManager:this._rowSizeAndPositionManager,previousCellsCount:e.rowCount,previousCellSize:e.rowHeight,previousScrollToAlignment:e.scrollToAlignment,previousScrollToIndex:e.scrollToRow,previousSize:e.height,scrollOffset:_,scrollToAlignment:u,scrollToIndex:d,size:l,updateScrollIndexCallback:function(e){return n._updateScrollTopForScrollToRow(s({},n.props,{scrollToRow:e}))}}),this._invokeOnGridRenderedHelper()}},{key:"componentWillMount",value:function(){this._scrollbarSize=(0,w["default"])(),void 0===this._scrollbarSize?(this._scrollbarSizeMeasured=!1,this._scrollbarSize=0):this._scrollbarSizeMeasured=!0,this._calculateChildrenToRender()}},{key:"componentWillUnmount",value:function(){this._disablePointerEventsTimeoutId&&clearTimeout(this._disablePointerEventsTimeoutId),this._setNextStateAnimationFrameId&&C["default"].cancel(this._setNextStateAnimationFrameId)}},{key:"componentWillUpdate",value:function(e,t){var n=this;0===e.columnCount&&0!==t.scrollLeft||0===e.rowCount&&0!==t.scrollTop?this._setScrollPosition({scrollLeft:0,scrollTop:0}):e.scrollLeft===this.props.scrollLeft&&e.scrollTop===this.props.scrollTop||this._setScrollPosition({scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}),this._columnWidthGetter=this._wrapSizeGetter(e.columnWidth),this._rowHeightGetter=this._wrapSizeGetter(e.rowHeight),this._columnSizeAndPositionManager.configure({cellCount:e.columnCount,estimatedCellSize:this._getEstimatedColumnSize(e)}),this._rowSizeAndPositionManager.configure({cellCount:e.rowCount,estimatedCellSize:this._getEstimatedRowSize(e)}),(0,h["default"])({cellCount:this.props.columnCount,cellSize:this.props.columnWidth,computeMetadataCallback:function(){return n._columnSizeAndPositionManager.resetCell(0)},computeMetadataCallbackProps:e,nextCellsCount:e.columnCount,nextCellSize:e.columnWidth,nextScrollToIndex:e.scrollToColumn,scrollToIndex:this.props.scrollToColumn,updateScrollOffsetForScrollToIndex:function(){return n._updateScrollLeftForScrollToColumn(e,t)}}),(0,h["default"])({cellCount:this.props.rowCount,cellSize:this.props.rowHeight,computeMetadataCallback:function(){return n._rowSizeAndPositionManager.resetCell(0)},computeMetadataCallbackProps:e,nextCellsCount:e.rowCount,nextCellSize:e.rowHeight,nextScrollToIndex:e.scrollToRow,scrollToIndex:this.props.scrollToRow,updateScrollOffsetForScrollToIndex:function(){return n._updateScrollTopForScrollToRow(e,t)}}),this._calculateChildrenToRender(e,t)}},{key:"render",value:function(){var e=this,t=this.props,n=t.autoContainerWidth,o=t.autoHeight,r=t.className,i=t.height,l=t.noContentRenderer,a=t.style,u=t.tabIndex,d=t.width,p=this.state.isScrolling,h={height:o?"auto":i,width:d},y=this._columnSizeAndPositionManager.getTotalSize(),_=this._rowSizeAndPositionManager.getTotalSize(),m=_>i?this._scrollbarSize:0,v=y>d?this._scrollbarSize:0;h.overflowX=d>=y+m?"hidden":"auto",h.overflowY=i>=_+v?"hidden":"auto";var S=this._childrenToDisplay,g=0===S.length&&i>0&&d>0;return c["default"].createElement("div",{ref:function(t){e._scrollingContainer=t},"aria-label":this.props["aria-label"],className:(0,f["default"])("Grid",r),onScroll:this._onScroll,role:"grid",style:s({},h,a),tabIndex:u},S.length>0&&c["default"].createElement("div",{className:"Grid__innerScrollContainer",style:{width:n?"auto":y,height:_,maxWidth:y,maxHeight:_,pointerEvents:p?"none":"auto"}},S),g&&l())}},{key:"shouldComponentUpdate",value:function(e,t){return(0,x["default"])(this,e,t)}},{key:"_calculateChildrenToRender",value:function(){var e=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],t=arguments.length<=1||void 0===arguments[1]?this.state:arguments[1],n=e.cellClassName,o=e.cellRenderer,r=e.cellRangeRenderer,i=e.cellStyle,l=e.columnCount,s=e.height,a=e.overscanColumnCount,u=e.overscanRowCount,c=e.rowCount,d=e.width,f=t.isScrolling,p=t.scrollLeft,h=t.scrollTop;if(this._childrenToDisplay=[],s>0&&d>0){var y=this._columnSizeAndPositionManager.getVisibleCellRange({containerSize:d,offset:p}),_=this._rowSizeAndPositionManager.getVisibleCellRange({containerSize:s,offset:h}),m=this._columnSizeAndPositionManager.getOffsetAdjustment({containerSize:d,offset:p}),v=this._rowSizeAndPositionManager.getOffsetAdjustment({containerSize:s,offset:h});this._renderedColumnStartIndex=y.start,this._renderedColumnStopIndex=y.stop,this._renderedRowStartIndex=_.start,this._renderedRowStopIndex=_.stop;var S=(0,g["default"])({cellCount:l,overscanCellsCount:a,startIndex:this._renderedColumnStartIndex,stopIndex:this._renderedColumnStopIndex}),b=(0,g["default"])({cellCount:c,overscanCellsCount:u,startIndex:this._renderedRowStartIndex,stopIndex:this._renderedRowStopIndex});this._columnStartIndex=S.overscanStartIndex,this._columnStopIndex=S.overscanStopIndex,this._rowStartIndex=b.overscanStartIndex,this._rowStopIndex=b.overscanStopIndex,this._childrenToDisplay=r({cellCache:this._cellCache,cellClassName:this._wrapCellClassNameGetter(n),cellRenderer:o,cellStyle:this._wrapCellStyleGetter(i),columnSizeAndPositionManager:this._columnSizeAndPositionManager,columnStartIndex:this._columnStartIndex,columnStopIndex:this._columnStopIndex,horizontalOffsetAdjustment:m,isScrolling:f,rowSizeAndPositionManager:this._rowSizeAndPositionManager,rowStartIndex:this._rowStartIndex,rowStopIndex:this._rowStopIndex,scrollLeft:p,scrollTop:h,verticalOffsetAdjustment:v})}}},{key:"_enablePointerEventsAfterDelay",value:function(){this._disablePointerEventsTimeoutId&&clearTimeout(this._disablePointerEventsTimeoutId),this._disablePointerEventsTimeoutId=setTimeout(this._enablePointerEventsAfterDelayCallback,I)}},{key:"_enablePointerEventsAfterDelayCallback",value:function(){this._disablePointerEventsTimeoutId=null,this._cellCache={},this.setState({isScrolling:!1})}},{key:"_getEstimatedColumnSize",value:function(e){return"number"==typeof e.columnWidth?e.columnWidth:e.estimatedColumnSize}},{key:"_getEstimatedRowSize",value:function(e){return"number"==typeof e.rowHeight?e.rowHeight:e.estimatedRowSize}},{key:"_invokeOnGridRenderedHelper",value:function(){var e=this.props.onSectionRendered;this._onGridRenderedMemoizer({callback:e,indices:{columnOverscanStartIndex:this._columnStartIndex,columnOverscanStopIndex:this._columnStopIndex,columnStartIndex:this._renderedColumnStartIndex,columnStopIndex:this._renderedColumnStopIndex,rowOverscanStartIndex:this._rowStartIndex,rowOverscanStopIndex:this._rowStopIndex,rowStartIndex:this._renderedRowStartIndex,rowStopIndex:this._renderedRowStopIndex}})}},{key:"_invokeOnScrollMemoizer",value:function(e){var t=this,n=e.scrollLeft,o=e.scrollTop,r=e.totalColumnsWidth,i=e.totalRowsHeight;this._onScrollMemoizer({callback:function(e){var n=e.scrollLeft,o=e.scrollTop,l=t.props,s=l.height,a=l.onScroll,u=l.width;a({clientHeight:s,clientWidth:u,scrollHeight:i,scrollLeft:n,scrollTop:o,scrollWidth:r})},indices:{scrollLeft:n,scrollTop:o}})}},{key:"_setNextState",value:function(e){this._nextState=e,this._setNextStateAnimationFrameId||(this._setNextStateAnimationFrameId=(0,C["default"])(this._setNextStateCallback))}},{key:"_setNextStateCallback",value:function(){var e=this._nextState;this._setNextStateAnimationFrameId=null,this._nextState=null,this.setState(e)}},{key:"_setScrollPosition",value:function(e){var t=e.scrollLeft,n=e.scrollTop,o={scrollPositionChangeReason:k.REQUESTED};t>=0&&(o.scrollLeft=t),n>=0&&(o.scrollTop=n),(t>=0&&t!==this.state.scrollLeft||n>=0&&n!==this.state.scrollTop)&&this.setState(o)}},{key:"_wrapCellClassNameGetter",value:function(e){return this._wrapPropertyGetter(e)}},{key:"_wrapCellStyleGetter",value:function(e){return this._wrapPropertyGetter(e)}},{key:"_wrapPropertyGetter",value:function(e){return e instanceof Function?e:function(){return e}}},{key:"_wrapSizeGetter",value:function(e){return this._wrapPropertyGetter(e)}},{key:"_updateScrollLeftForScrollToColumn",value:function(){var e=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],t=arguments.length<=1||void 0===arguments[1]?this.state:arguments[1],n=e.columnCount,o=e.scrollToAlignment,r=e.scrollToColumn,i=e.width,l=t.scrollLeft;if(r>=0&&n>0){var s=Math.max(0,Math.min(n-1,r)),a=this._columnSizeAndPositionManager.getUpdatedOffsetForIndex({align:o,containerSize:i,currentOffset:l,targetIndex:s});l!==a&&this._setScrollPosition({scrollLeft:a})}}},{key:"_updateScrollTopForScrollToRow",value:function(){var e=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],t=arguments.length<=1||void 0===arguments[1]?this.state:arguments[1],n=e.height,o=e.rowCount,r=e.scrollToAlignment,i=e.scrollToRow,l=t.scrollTop;if(i>=0&&o>0){var s=Math.max(0,Math.min(o-1,i)),a=this._rowSizeAndPositionManager.getUpdatedOffsetForIndex({align:r,containerSize:n,currentOffset:l,targetIndex:s});l!==a&&this._setScrollPosition({scrollTop:a})}}},{key:"_onScroll",value:function(e){if(e.target===this._scrollingContainer){this._enablePointerEventsAfterDelay();var t=this.props,n=t.height,o=t.width,r=this._scrollbarSize,i=this._rowSizeAndPositionManager.getTotalSize(),l=this._columnSizeAndPositionManager.getTotalSize(),s=Math.min(Math.max(0,l-o+r),e.target.scrollLeft),a=Math.min(Math.max(0,i-n+r),e.target.scrollTop);if(this.state.scrollLeft!==s||this.state.scrollTop!==a){var u=e.cancelable?k.OBSERVED:k.REQUESTED;this.state.isScrolling||this.setState({isScrolling:!0}),this._setNextState({isScrolling:!0,scrollLeft:s,scrollPositionChangeReason:u,scrollTop:a})}this._invokeOnScrollMemoizer({scrollLeft:s,scrollTop:a,totalColumnsWidth:l,totalRowsHeight:i})}}}]),t}(u.Component);A.propTypes={"aria-label":u.PropTypes.string,autoContainerWidth:u.PropTypes.bool,autoHeight:u.PropTypes.bool,cellClassName:u.PropTypes.oneOfType([u.PropTypes.string,u.PropTypes.func]),cellStyle:u.PropTypes.oneOfType([u.PropTypes.object,u.PropTypes.func]),cellRenderer:u.PropTypes.func.isRequired,cellRangeRenderer:u.PropTypes.func.isRequired,className:u.PropTypes.string,columnCount:u.PropTypes.number.isRequired,columnWidth:u.PropTypes.oneOfType([u.PropTypes.number,u.PropTypes.func]).isRequired,estimatedColumnSize:u.PropTypes.number.isRequired,estimatedRowSize:u.PropTypes.number.isRequired,height:u.PropTypes.number.isRequired,noContentRenderer:u.PropTypes.func.isRequired,onScroll:u.PropTypes.func.isRequired,onSectionRendered:u.PropTypes.func.isRequired,overscanColumnCount:u.PropTypes.number.isRequired,overscanRowCount:u.PropTypes.number.isRequired,rowHeight:u.PropTypes.oneOfType([u.PropTypes.number,u.PropTypes.func]).isRequired,rowCount:u.PropTypes.number.isRequired,scrollLeft:u.PropTypes.number,scrollToAlignment:u.PropTypes.oneOf(["auto","end","start","center"]).isRequired,scrollToColumn:u.PropTypes.number,scrollTop:u.PropTypes.number,scrollToRow:u.PropTypes.number,style:u.PropTypes.object,tabIndex:u.PropTypes.number,width:u.PropTypes.number.isRequired},A.defaultProps={"aria-label":"grid",cellStyle:{},cellRangeRenderer:M["default"],estimatedColumnSize:100,estimatedRowSize:30,noContentRenderer:function(){return null},onScroll:function(){return null},onSectionRendered:function(){return null},overscanColumnCount:0,overscanRowCount:10,scrollToAlignment:"auto",style:{},tabIndex:0},t["default"]=A},function(e,t){"use strict";function n(e){var t=e.cellCount,n=e.cellSize,o=e.computeMetadataCallback,r=e.computeMetadataCallbackProps,i=e.nextCellsCount,l=e.nextCellSize,s=e.nextScrollToIndex,a=e.scrollToIndex,u=e.updateScrollOffsetForScrollToIndex;t===i&&("number"!=typeof n&&"number"!=typeof l||n===l)||(o(r),a>=0&&a===s&&u())}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_MAX_SCROLL_SIZE=void 0;var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),s=n(31),a=o(s),u=t.DEFAULT_MAX_SCROLL_SIZE=1e7,c=function(){function e(t){var n=t.maxScrollSize,o=void 0===n?u:n,l=r(t,["maxScrollSize"]);i(this,e),this._cellSizeAndPositionManager=new a["default"](l),this._maxScrollSize=o}return l(e,[{key:"configure",value:function(e){this._cellSizeAndPositionManager.configure(e)}},{key:"getCellCount",value:function(){return this._cellSizeAndPositionManager.getCellCount()}},{key:"getEstimatedCellSize",value:function(){return this._cellSizeAndPositionManager.getEstimatedCellSize()}},{key:"getLastMeasuredIndex",value:function(){return this._cellSizeAndPositionManager.getLastMeasuredIndex()}},{key:"getOffsetAdjustment",value:function(e){var t=e.containerSize,n=e.offset,o=this._cellSizeAndPositionManager.getTotalSize(),r=this.getTotalSize(),i=this._getOffsetPercentage({containerSize:t,offset:n,totalSize:r});return Math.round(i*(r-o))}},{key:"getSizeAndPositionOfCell",value:function(e){return this._cellSizeAndPositionManager.getSizeAndPositionOfCell(e)}},{key:"getSizeAndPositionOfLastMeasuredCell",value:function(){return this._cellSizeAndPositionManager.getSizeAndPositionOfLastMeasuredCell()}},{key:"getTotalSize",value:function(){return Math.min(this._maxScrollSize,this._cellSizeAndPositionManager.getTotalSize())}},{key:"getUpdatedOffsetForIndex",value:function(e){var t=e.align,n=void 0===t?"auto":t,o=e.containerSize,r=e.currentOffset,i=e.targetIndex,l=e.totalSize;r=this._safeOffsetToOffset({containerSize:o,offset:r});var s=this._cellSizeAndPositionManager.getUpdatedOffsetForIndex({align:n,containerSize:o,currentOffset:r,targetIndex:i,totalSize:l});return this._offsetToSafeOffset({containerSize:o,offset:s})}},{key:"getVisibleCellRange",value:function(e){var t=e.containerSize,n=e.offset;return n=this._safeOffsetToOffset({containerSize:t,offset:n}),this._cellSizeAndPositionManager.getVisibleCellRange({containerSize:t,offset:n})}},{key:"resetCell",value:function(e){this._cellSizeAndPositionManager.resetCell(e)}},{key:"_getOffsetPercentage",value:function(e){var t=e.containerSize,n=e.offset,o=e.totalSize;return t>=o?0:n/(o-t)}},{key:"_offsetToSafeOffset",value:function(e){var t=e.containerSize,n=e.offset,o=this._cellSizeAndPositionManager.getTotalSize(),r=this.getTotalSize();if(o===r)return n;var i=this._getOffsetPercentage({containerSize:t,offset:n,totalSize:o});return Math.round(i*(r-t))}},{key:"_safeOffsetToOffset",value:function(e){var t=e.containerSize,n=e.offset,o=this._cellSizeAndPositionManager.getTotalSize(),r=this.getTotalSize();if(o===r)return n;var i=this._getOffsetPercentage({containerSize:t,offset:n,totalSize:r});return Math.round(i*(o-t))}}]),e}();t["default"]=c},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=function(){function e(t){var o=t.cellCount,r=t.cellSizeGetter,i=t.estimatedCellSize;n(this,e),this._cellSizeGetter=r,this._cellCount=o,this._estimatedCellSize=i,this._cellSizeAndPositionData={},this._lastMeasuredIndex=-1}return o(e,[{key:"configure",value:function(e){var t=e.cellCount,n=e.estimatedCellSize;this._cellCount=t,this._estimatedCellSize=n}},{key:"getCellCount",value:function(){return this._cellCount}},{key:"getEstimatedCellSize",value:function(){return this._estimatedCellSize}},{key:"getLastMeasuredIndex",value:function(){return this._lastMeasuredIndex}},{key:"getSizeAndPositionOfCell",value:function(e){if(0>e||e>=this._cellCount)throw Error("Requested index "+e+" is outside of range 0.."+this._cellCount);if(e>this._lastMeasuredIndex){for(var t=this.getSizeAndPositionOfLastMeasuredCell(),n=t.offset+t.size,o=this._lastMeasuredIndex+1;e>=o;o++){var r=this._cellSizeGetter({index:o});if(null==r||isNaN(r))throw Error("Invalid size returned for cell "+o+" of value "+r);this._cellSizeAndPositionData[o]={offset:n,size:r},n+=r}this._lastMeasuredIndex=e}return this._cellSizeAndPositionData[e]}},{key:"getSizeAndPositionOfLastMeasuredCell",value:function(){return this._lastMeasuredIndex>=0?this._cellSizeAndPositionData[this._lastMeasuredIndex]:{offset:0,size:0}}},{key:"getTotalSize",value:function(){var e=this.getSizeAndPositionOfLastMeasuredCell();return e.offset+e.size+(this._cellCount-this._lastMeasuredIndex-1)*this._estimatedCellSize}},{key:"getUpdatedOffsetForIndex",value:function(e){var t=e.align,n=void 0===t?"auto":t,o=e.containerSize,r=e.currentOffset,i=e.targetIndex,l=this.getSizeAndPositionOfCell(i),s=l.offset,a=s-o+l.size,u=void 0;switch(n){case"start":u=s;break;case"end":u=a;break;case"center":u=s-(o-l.size)/2;break;default:u=Math.max(a,Math.min(s,r))}var c=this.getTotalSize();return Math.max(0,Math.min(c-o,u))}},{key:"getVisibleCellRange",value:function(e){var t=e.containerSize,n=e.offset,o=this.getTotalSize();if(0===o)return{};var r=n+t,i=this._findNearestCell(n),l=this.getSizeAndPositionOfCell(i);n=l.offset+l.size;for(var s=i;r>n&&s<this._cellCount-1;)s++,n+=this.getSizeAndPositionOfCell(s).size;return{start:i,stop:s}}},{key:"resetCell",value:function(e){this._lastMeasuredIndex=Math.min(this._lastMeasuredIndex,e-1)}},{key:"_binarySearch",value:function(e){for(var t=e.high,n=e.low,o=e.offset,r=void 0,i=void 0;t>=n;){if(r=n+Math.floor((t-n)/2),i=this.getSizeAndPositionOfCell(r).offset,i===o)return r;o>i?n=r+1:i>o&&(t=r-1)}return n>0?n-1:void 0}},{key:"_exponentialSearch",value:function(e){for(var t=e.index,n=e.offset,o=1;t<this._cellCount&&this.getSizeAndPositionOfCell(t).offset<n;)t+=o,o*=2;return this._binarySearch({high:Math.min(t,this._cellCount-1),low:Math.floor(t/2),offset:n})}},{key:"_findNearestCell",value:function(e){if(isNaN(e))throw Error("Invalid offset "+e+" specified");e=Math.max(0,e);var t=this.getSizeAndPositionOfLastMeasuredCell(),n=Math.max(0,this._lastMeasuredIndex);return t.offset>=e?this._binarySearch({high:n,low:0,offset:e}):this._exponentialSearch({index:n,offset:e})}}]),e}();t["default"]=r},function(e,t){"use strict";function n(e){var t=e.cellCount,n=e.overscanCellsCount,o=e.startIndex,r=e.stopIndex;return{overscanStartIndex:Math.max(0,o-n),overscanStopIndex:Math.min(t-1,r+n)}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n},function(e,t){"use strict";function n(e){var t=e.cellSize,n=e.cellSizeAndPositionManager,o=e.previousCellsCount,r=e.previousCellSize,i=e.previousScrollToAlignment,l=e.previousScrollToIndex,s=e.previousSize,a=e.scrollOffset,u=e.scrollToAlignment,c=e.scrollToIndex,d=e.size,f=e.updateScrollIndexCallback,p=n.getCellCount(),h=c>=0&&p>c,y=d!==s||!r||"number"==typeof t&&t!==r;if(h&&(y||u!==i||c!==l))f(c);else if(!h&&p>0&&(s>d||o>p)){c=p-1;var _=n.getUpdatedOffsetForIndex({containerSize:d,currentOffset:a,targetIndex:c});a>_&&f(p-1)}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e){for(var t=e.cellCache,n=e.cellClassName,o=e.cellRenderer,r=e.cellStyle,l=e.columnSizeAndPositionManager,a=e.columnStartIndex,c=e.columnStopIndex,d=e.horizontalOffsetAdjustment,f=e.isScrolling,p=e.rowSizeAndPositionManager,h=e.rowStartIndex,y=e.rowStopIndex,_=(e.scrollLeft,e.scrollTop,e.verticalOffsetAdjustment),m=[],v=h;y>=v;v++)for(var S=p.getSizeAndPositionOfCell(v),g=a;c>=g;g++){var b=l.getSizeAndPositionOfCell(g),w=v+"-"+g,T=r({rowIndex:v,columnIndex:g}),C=void 0;if(f?(t[w]||(t[w]=o({columnIndex:g,isScrolling:f,rowIndex:v})),C=t[w]):C=o({columnIndex:g,isScrolling:f,rowIndex:v}),null!=C&&C!==!1){var P=n({columnIndex:g,rowIndex:v}),x=s["default"].createElement("div",{key:w,className:(0,u["default"])("Grid__cell",P),style:i({height:S.size,left:b.offset+d,top:S.offset+_,width:b.size},T)},C);m.push(x)}}return m}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);
}return e};t["default"]=r;var l=n(3),s=o(l),a=n(14),u=o(a)},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.SortIndicator=t.SortDirection=t.FlexColumn=t.FlexTable=t.defaultRowRenderer=t.defaultHeaderRenderer=t.defaultCellRenderer=t.defaultCellDataGetter=t["default"]=void 0;var r=n(36),i=o(r),l=n(42),s=o(l),a=n(41),u=o(a),c=n(38),d=o(c),f=n(43),p=o(f),h=n(37),y=o(h),_=n(40),m=o(_),v=n(39),S=o(v);t["default"]=i["default"],t.defaultCellDataGetter=s["default"],t.defaultCellRenderer=u["default"],t.defaultHeaderRenderer=d["default"],t.defaultRowRenderer=p["default"],t.FlexTable=i["default"],t.FlexColumn=y["default"],t.SortDirection=m["default"],t.SortIndicator=S["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(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)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),u=n(14),c=o(u),d=n(37),f=o(d),p=n(3),h=o(p),y=n(10),_=n(4),m=o(_),v=n(27),S=o(v),g=n(43),b=o(g),w=n(40),T=o(w),C=function(e){function t(e){r(this,t);var n=i(this,Object.getPrototypeOf(t).call(this,e));return n.state={scrollbarWidth:0},n._cellClassName=n._cellClassName.bind(n),n._cellStyle=n._cellStyle.bind(n),n._createColumn=n._createColumn.bind(n),n._createRow=n._createRow.bind(n),n._onScroll=n._onScroll.bind(n),n._onSectionRendered=n._onSectionRendered.bind(n),n}return l(t,e),a(t,[{key:"forceUpdateGrid",value:function(){this.Grid.forceUpdate()}},{key:"measureAllRows",value:function(){this.Grid.measureAllCells()}},{key:"recomputeRowHeights",value:function(){var e=arguments.length<=0||void 0===arguments[0]?0:arguments[0];this.Grid.recomputeGridSize({rowIndex:e}),this.forceUpdateGrid()}},{key:"componentDidMount",value:function(){this._setScrollbarWidth()}},{key:"componentDidUpdate",value:function(){this._setScrollbarWidth()}},{key:"render",value:function(){var e=this,t=this.props,n=t.children,o=t.className,r=t.disableHeader,i=t.gridClassName,l=t.gridStyle,a=t.headerHeight,u=t.height,d=t.noRowsRenderer,f=t.rowClassName,p=t.rowStyle,y=t.scrollToIndex,_=t.style,m=t.width,v=this.state.scrollbarWidth,g=u-a,b=f instanceof Function?f({index:-1}):f,w=p instanceof Function?p({index:-1}):p;return this._cachedColumnStyles=[],h["default"].Children.toArray(n).forEach(function(t,n){e._cachedColumnStyles[n]=e._getFlexStyleForColumn(t,t.props.style)}),h["default"].createElement("div",{className:(0,c["default"])("FlexTable",o),style:_},!r&&h["default"].createElement("div",{className:(0,c["default"])("FlexTable__headerRow",b),style:s({},w,{height:a,paddingRight:v,width:m})},this._getRenderedHeaderRow()),h["default"].createElement(S["default"],s({},this.props,{autoContainerWidth:!0,className:(0,c["default"])("FlexTable__Grid",i),cellClassName:this._cellClassName,cellRenderer:this._createRow,cellStyle:this._cellStyle,columnWidth:m,columnCount:1,height:g,noContentRenderer:d,onScroll:this._onScroll,onSectionRendered:this._onSectionRendered,ref:function(t){e.Grid=t},scrollbarWidth:v,scrollToRow:y,style:l})))}},{key:"shouldComponentUpdate",value:function(e,t){return(0,m["default"])(this,e,t)}},{key:"_cellClassName",value:function(e){var t=e.rowIndex,n=this.props.rowWrapperClassName;return n instanceof Function?n({index:t-1}):n}},{key:"_cellStyle",value:function(e){var t=e.rowIndex,n=this.props.rowWrapperStyle;return n instanceof Function?n({index:t-1}):n}},{key:"_createColumn",value:function(e){var t=e.column,n=e.columnIndex,o=e.isScrolling,r=e.rowData,i=e.rowIndex,l=t.props,s=l.cellDataGetter,a=l.cellRenderer,u=l.className,d=l.columnData,f=l.dataKey,p=s({columnData:d,dataKey:f,rowData:r}),y=a({cellData:p,columnData:d,dataKey:f,isScrolling:o,rowData:r,rowIndex:i}),_=this._cachedColumnStyles[n],m="string"==typeof y?y:null;return h["default"].createElement("div",{key:"Row"+i+"-Col"+n,className:(0,c["default"])("FlexTable__rowColumn",u),style:_,title:m},y)}},{key:"_createHeader",value:function(e){var t=e.column,n=e.index,o=this.props,r=o.headerClassName,i=o.headerStyle,l=o.onHeaderClick,a=o.sort,u=o.sortBy,d=o.sortDirection,f=t.props,p=f.dataKey,y=f.disableSort,_=f.headerRenderer,m=f.label,v=f.columnData,S=!y&&a,g=(0,c["default"])("FlexTable__headerColumn",r,t.props.headerClassName,{FlexTable__sortableHeaderColumn:S}),b=this._getFlexStyleForColumn(t,i),w=_({columnData:v,dataKey:p,disableSort:y,label:m,sortBy:u,sortDirection:d}),C={};return(S||l)&&!function(){var e=u!==p||d===T["default"].DESC?T["default"].ASC:T["default"].DESC,n=function(){S&&a({sortBy:p,sortDirection:e}),l&&l({columnData:v,dataKey:p})},o=function(e){"Enter"!==e.key&&" "!==e.key||n()};C["aria-label"]=t.props["aria-label"]||m||p,C.role="rowheader",C.tabIndex=0,C.onClick=n,C.onKeyDown=o}(),h["default"].createElement("div",s({},C,{key:"Header-Col"+n,className:g,style:b}),w)}},{key:"_createRow",value:function(e){var t=this,n=e.rowIndex,o=e.isScrolling,r=this.props,i=r.children,l=r.onRowClick,a=r.onRowDoubleClick,u=r.onRowMouseOver,d=r.onRowMouseOut,f=r.rowClassName,p=r.rowGetter,y=r.rowRenderer,_=r.rowStyle,m=this.state.scrollbarWidth,v=f instanceof Function?f({index:n}):f,S=_ instanceof Function?_({index:n}):_,g=p({index:n}),b=h["default"].Children.toArray(i).map(function(e,r){return t._createColumn({column:e,columnIndex:r,isScrolling:o,rowData:g,rowIndex:n,scrollbarWidth:m})}),w=(0,c["default"])("FlexTable__row",v),T=s({},S,{height:this._getRowHeight(n),paddingRight:m});return y({className:w,columns:b,index:n,isScrolling:o,onRowClick:l,onRowDoubleClick:a,onRowMouseOver:u,onRowMouseOut:d,rowData:g,style:T})}},{key:"_getFlexStyleForColumn",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=e.props.flexGrow+" "+e.props.flexShrink+" "+e.props.width+"px",o=s({},t,{flex:n,msFlex:n,WebkitFlex:n});return e.props.maxWidth&&(o.maxWidth=e.props.maxWidth),e.props.minWidth&&(o.minWidth=e.props.minWidth),o}},{key:"_getRenderedHeaderRow",value:function(){var e=this,t=this.props,n=t.children,o=t.disableHeader,r=o?[]:h["default"].Children.toArray(n);return r.map(function(t,n){return e._createHeader({column:t,index:n})})}},{key:"_getRowHeight",value:function(e){var t=this.props.rowHeight;return t instanceof Function?t({index:e}):t}},{key:"_onScroll",value:function(e){var t=e.clientHeight,n=e.scrollHeight,o=e.scrollTop,r=this.props.onScroll;r({clientHeight:t,scrollHeight:n,scrollTop:o})}},{key:"_onSectionRendered",value:function(e){var t=e.rowOverscanStartIndex,n=e.rowOverscanStopIndex,o=e.rowStartIndex,r=e.rowStopIndex,i=this.props.onRowsRendered;i({overscanStartIndex:t,overscanStopIndex:n,startIndex:o,stopIndex:r})}},{key:"_setScrollbarWidth",value:function(){var e=(0,y.findDOMNode)(this.Grid),t=e.clientWidth||0,n=e.offsetWidth||0,o=n-t;this.setState({scrollbarWidth:o})}}]),t}(p.Component);C.propTypes={"aria-label":p.PropTypes.string,autoHeight:p.PropTypes.bool,children:function P(e,t,n){for(var P=h["default"].Children.toArray(e.children),o=0;o<P.length;o++)if(P[o].type!==f["default"])return new Error("FlexTable only accepts children of type FlexColumn")},className:p.PropTypes.string,disableHeader:p.PropTypes.bool,estimatedRowSize:p.PropTypes.number.isRequired,gridClassName:p.PropTypes.string,gridStyle:p.PropTypes.object,headerClassName:p.PropTypes.string,headerHeight:p.PropTypes.number.isRequired,height:p.PropTypes.number.isRequired,noRowsRenderer:p.PropTypes.func,onHeaderClick:p.PropTypes.func,headerStyle:p.PropTypes.object,onRowClick:p.PropTypes.func,onRowDoubleClick:p.PropTypes.func,onRowMouseOut:p.PropTypes.func,onRowMouseOver:p.PropTypes.func,onRowsRendered:p.PropTypes.func,onScroll:p.PropTypes.func.isRequired,overscanRowCount:p.PropTypes.number.isRequired,rowClassName:p.PropTypes.oneOfType([p.PropTypes.string,p.PropTypes.func]),rowGetter:p.PropTypes.func.isRequired,rowHeight:p.PropTypes.oneOfType([p.PropTypes.number,p.PropTypes.func]).isRequired,rowCount:p.PropTypes.number.isRequired,rowRenderer:p.PropTypes.func,rowStyle:p.PropTypes.oneOfType([p.PropTypes.object,p.PropTypes.func]).isRequired,rowWrapperClassName:p.PropTypes.oneOfType([p.PropTypes.string,p.PropTypes.func]),rowWrapperStyle:p.PropTypes.oneOfType([p.PropTypes.object,p.PropTypes.func]),scrollToAlignment:p.PropTypes.oneOf(["auto","end","start","center"]).isRequired,scrollToIndex:p.PropTypes.number,scrollTop:p.PropTypes.number,sort:p.PropTypes.func,sortBy:p.PropTypes.string,sortDirection:p.PropTypes.oneOf([T["default"].ASC,T["default"].DESC]),style:p.PropTypes.object,tabIndex:p.PropTypes.number,width:p.PropTypes.number.isRequired},C.defaultProps={disableHeader:!1,estimatedRowSize:30,headerHeight:0,headerStyle:{},noRowsRenderer:function(){return null},onRowsRendered:function(){return null},onScroll:function(){return null},overscanRowCount:10,rowRenderer:b["default"],rowStyle:{},scrollToAlignment:"auto",style:{}},t["default"]=C},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(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)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(3),a=n(38),u=o(a),c=n(41),d=o(c),f=n(42),p=o(f),h=function(e){function t(){return r(this,t),i(this,Object.getPrototypeOf(t).apply(this,arguments))}return l(t,e),t}(s.Component);h.defaultProps={cellDataGetter:p["default"],cellRenderer:d["default"],cellStyle:{},flexGrow:0,flexShrink:1,headerRenderer:u["default"]},h.propTypes={"aria-label":s.PropTypes.string,cellDataGetter:s.PropTypes.func,cellRenderer:s.PropTypes.func,className:s.PropTypes.string,columnData:s.PropTypes.object,dataKey:s.PropTypes.any.isRequired,disableSort:s.PropTypes.bool,flexGrow:s.PropTypes.number,flexShrink:s.PropTypes.number,headerClassName:s.PropTypes.string,headerRenderer:s.PropTypes.func.isRequired,label:s.PropTypes.string,maxWidth:s.PropTypes.number,minWidth:s.PropTypes.number,style:s.PropTypes.object,width:s.PropTypes.number.isRequired},t["default"]=h},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e){var t=(e.columnData,e.dataKey),n=(e.disableSort,e.label),o=e.sortBy,r=e.sortDirection,i=o===t,s=[l["default"].createElement("span",{className:"FlexTable__headerTruncatedText",key:"label",title:n},n)];return i&&s.push(l["default"].createElement(a["default"],{key:"SortIndicator",sortDirection:r})),s}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r;var i=n(3),l=o(i),s=n(39),a=o(s)},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e){var t=e.sortDirection,n=(0,a["default"])("FlexTable__sortableHeaderIcon",{"FlexTable__sortableHeaderIcon--ASC":t===c["default"].ASC,"FlexTable__sortableHeaderIcon--DESC":t===c["default"].DESC});return l["default"].createElement("svg",{className:n,width:18,height:18,viewBox:"0 0 24 24"},t===c["default"].ASC?l["default"].createElement("path",{d:"M7 14l5-5 5 5z"}):l["default"].createElement("path",{d:"M7 10l5 5 5-5z"}),l["default"].createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r;var i=n(3),l=o(i),s=n(14),a=o(s),u=n(40),c=o(u);r.propTypes={sortDirection:i.PropTypes.oneOf([c["default"].ASC,c["default"].DESC])}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={ASC:"ASC",DESC:"DESC"};t["default"]=n},function(e,t){"use strict";function n(e){var t=e.cellData;return e.cellDataKey,e.columnData,e.rowData,e.rowIndex,null==t?"":String(t)}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n},function(e,t){"use strict";function n(e){var t=(e.columnData,e.dataKey),n=e.rowData;return n.get instanceof Function?n.get(t):n[t]}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e){var t=e.className,n=e.columns,o=e.index,r=(e.isScrolling,e.onRowClick),l=e.onRowDoubleClick,a=e.onRowMouseOver,u=e.onRowMouseOut,c=(e.rowData,e.style),d={};return(r||l||a||u)&&(d["aria-label"]="row",d.role="row",d.tabIndex=0,r&&(d.onClick=function(){return r({index:o})}),l&&(d.onDoubleClick=function(){return l({index:o})}),u&&(d.onMouseOut=function(){return u({index:o})}),a&&(d.onMouseOver=function(){return a({index:o})})),s["default"].createElement("div",i({},d,{className:t,style:c}),n)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e};t["default"]=r;var l=n(3),s=o(l)},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.InfiniteLoader=t["default"]=void 0;var r=n(45),i=o(r);t["default"]=i["default"],t.InfiniteLoader=i["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(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)}function s(e){var t=e.lastRenderedStartIndex,n=e.lastRenderedStopIndex,o=e.startIndex,r=e.stopIndex;return!(o>n||t>r)}function a(e){for(var t=e.isRowLoaded,n=e.minimumBatchSize,o=e.rowCount,r=e.startIndex,i=e.stopIndex,l=[],s=null,a=null,u=r;i>=u;u++){var c=t({index:u});c?null!==a&&(l.push({startIndex:s,stopIndex:a}),s=a=null):(a=u,null===s&&(s=u))}if(null!==a){for(var d=Math.min(Math.max(a,s+n-1),o-1),f=a+1;d>=f&&!t({index:f});f++)a=f;l.push({startIndex:s,stopIndex:a})}if(l.length)for(var p=l[0];p.stopIndex-p.startIndex+1<n&&p.startIndex>0;){var h=p.startIndex-1;if(t({index:h}))break;p.startIndex=h}return l}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}();t.isRangeVisible=s,t.scanForUnloadedRanges=a;var c=n(3),d=n(4),f=o(d),p=function(e){function t(e,n){r(this,t);var o=i(this,Object.getPrototypeOf(t).call(this,e,n));return o._onRowsRendered=o._onRowsRendered.bind(o),o._registerChild=o._registerChild.bind(o),o}return l(t,e),u(t,[{key:"render",value:function(){var e=this.props.children;return e({onRowsRendered:this._onRowsRendered,registerChild:this._registerChild})}},{key:"shouldComponentUpdate",value:function(e,t){return(0,f["default"])(this,e,t)}},{key:"_onRowsRendered",value:function(e){var t=this,n=e.startIndex,o=e.stopIndex,r=this.props,i=r.isRowLoaded,l=r.loadMoreRows,u=r.minimumBatchSize,c=r.rowCount,d=r.threshold;this._lastRenderedStartIndex=n,this._lastRenderedStopIndex=o;var f=a({isRowLoaded:i,minimumBatchSize:u,rowCount:c,startIndex:Math.max(0,n-d),stopIndex:Math.min(c-1,o+d)});f.forEach(function(e){var n=l(e);n&&n.then(function(){s({lastRenderedStartIndex:t._lastRenderedStartIndex,lastRenderedStopIndex:t._lastRenderedStopIndex,startIndex:e.startIndex,stopIndex:e.stopIndex})&&t._registeredChild&&t._registeredChild.forceUpdate()})})}},{key:"_registerChild",value:function(e){this._registeredChild=e}}]),t}(c.Component);p.propTypes={children:c.PropTypes.func.isRequired,isRowLoaded:c.PropTypes.func.isRequired,loadMoreRows:c.PropTypes.func.isRequired,minimumBatchSize:c.PropTypes.number.isRequired,rowCount:c.PropTypes.number.isRequired,threshold:c.PropTypes.number.isRequired},p.defaultProps={minimumBatchSize:10,rowCount:0,threshold:15},t["default"]=p},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.ScrollSync=t["default"]=void 0;var r=n(47),i=o(r);t["default"]=i["default"],t.ScrollSync=i["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(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)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),a=n(3),u=n(4),c=o(u),d=function(e){function t(e,n){r(this,t);var o=i(this,Object.getPrototypeOf(t).call(this,e,n));return o.state={clientHeight:0,clientWidth:0,scrollHeight:0,scrollLeft:0,scrollTop:0,scrollWidth:0},o._onScroll=o._onScroll.bind(o),o}return l(t,e),s(t,[{key:"render",value:function(){var e=this.props.children,t=this.state,n=t.clientHeight,o=t.clientWidth,r=t.scrollHeight,i=t.scrollLeft,l=t.scrollTop,s=t.scrollWidth;return e({clientHeight:n,clientWidth:o,onScroll:this._onScroll,scrollHeight:r,scrollLeft:i,scrollTop:l,scrollWidth:s})}},{key:"shouldComponentUpdate",value:function(e,t){return(0,c["default"])(this,e,t)}},{key:"_onScroll",value:function(e){var t=e.clientHeight,n=e.clientWidth,o=e.scrollHeight,r=e.scrollLeft,i=e.scrollTop,l=e.scrollWidth;this.setState({clientHeight:t,clientWidth:n,scrollHeight:o,scrollLeft:r,scrollTop:i,scrollWidth:l})}}]),t}(a.Component);d.propTypes={children:a.PropTypes.func.isRequired},t["default"]=d},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.VirtualScroll=t["default"]=void 0;var r=n(49),i=o(r);t["default"]=i["default"],t.VirtualScroll=i["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(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)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),u=n(27),c=o(u),d=n(3),f=o(d),p=n(14),h=o(p),y=n(4),_=o(y),m=function(e){function t(e,n){r(this,t);var o=i(this,Object.getPrototypeOf(t).call(this,e,n));return o._cellRenderer=o._cellRenderer.bind(o),o._createRowClassNameGetter=o._createRowClassNameGetter.bind(o),o._createRowStyleGetter=o._createRowStyleGetter.bind(o),o._onScroll=o._onScroll.bind(o),o._onSectionRendered=o._onSectionRendered.bind(o),o}return l(t,e),a(t,[{key:"forceUpdateGrid",value:function(){this.Grid.forceUpdate()}},{key:"measureAllRows",value:function(){this.Grid.measureAllCells()}},{key:"recomputeRowHeights",value:function(){var e=arguments.length<=0||void 0===arguments[0]?0:arguments[0];this.Grid.recomputeGridSize({rowIndex:e}),this.forceUpdateGrid()}},{key:"render",value:function(){var e=this,t=this.props,n=t.className,o=t.noRowsRenderer,r=t.scrollToIndex,i=t.width,l=(0,h["default"])("VirtualScroll",n);return f["default"].createElement(c["default"],s({},this.props,{autoContainerWidth:!0,cellRenderer:this._cellRenderer,cellClassName:this._createRowClassNameGetter(),cellStyle:this._createRowStyleGetter(),className:l,columnWidth:i,columnCount:1,noContentRenderer:o,onScroll:this._onScroll,onSectionRendered:this._onSectionRendered,ref:function(t){e.Grid=t},scrollToRow:r}))}},{key:"shouldComponentUpdate",value:function(e,t){return(0,_["default"])(this,e,t)}},{key:"_cellRenderer",value:function(e){var t=(e.columnIndex,e.isScrolling),n=e.rowIndex,o=this.props.rowRenderer;return o({index:n,isScrolling:t})}},{key:"_createRowClassNameGetter",value:function(){var e=this.props.rowClassName;return e instanceof Function?function(t){var n=t.rowIndex;return e({index:n})}:function(){return e}}},{key:"_createRowStyleGetter",value:function(){var e=this.props.rowStyle,t=e instanceof Function?e:function(){return e};return function(e){var n=e.rowIndex;return s({width:"100%"},t({index:n}))}}},{key:"_onScroll",value:function(e){var t=e.clientHeight,n=e.scrollHeight,o=e.scrollTop,r=this.props.onScroll;r({clientHeight:t,scrollHeight:n,scrollTop:o})}},{key:"_onSectionRendered",value:function(e){var t=e.rowOverscanStartIndex,n=e.rowOverscanStopIndex,o=e.rowStartIndex,r=e.rowStopIndex,i=this.props.onRowsRendered;i({overscanStartIndex:t,overscanStopIndex:n,startIndex:o,stopIndex:r})}}]),t}(d.Component);m.propTypes={"aria-label":d.PropTypes.string,autoHeight:d.PropTypes.bool,className:d.PropTypes.string,estimatedRowSize:d.PropTypes.number.isRequired,height:d.PropTypes.number.isRequired,noRowsRenderer:d.PropTypes.func.isRequired,onRowsRendered:d.PropTypes.func.isRequired,overscanRowCount:d.PropTypes.number.isRequired,onScroll:d.PropTypes.func.isRequired,rowHeight:d.PropTypes.oneOfType([d.PropTypes.number,d.PropTypes.func]).isRequired,rowRenderer:d.PropTypes.func.isRequired,rowClassName:d.PropTypes.oneOfType([d.PropTypes.string,d.PropTypes.func]),rowCount:d.PropTypes.number.isRequired,rowStyle:d.PropTypes.oneOfType([d.PropTypes.object,d.PropTypes.func]),scrollToAlignment:d.PropTypes.oneOf(["auto","end","start","center"]).isRequired,scrollToIndex:d.PropTypes.number,scrollTop:d.PropTypes.number,style:d.PropTypes.object,tabIndex:d.PropTypes.number,width:d.PropTypes.number.isRequired},m.defaultProps={estimatedRowSize:30,noRowsRenderer:function(){return null},onRowsRendered:function(){return null},onScroll:function(){return null},overscanRowCount:10,scrollToAlignment:"auto",style:{}},t["default"]=m},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.WindowScroller=t["default"]=void 0;var r=n(51),i=o(r);t["default"]=i["default"],t.WindowScroller=i["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(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)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),a=n(3),u=o(a),c=n(10),d=o(c),f=n(4),p=o(f),h=n(18),y=o(h),_=150,m=function(e){function t(e){r(this,t);var n=i(this,Object.getPrototypeOf(t).call(this,e));return n.state={isScrolling:!1,height:0,scrollTop:0},n._onScrollWindow=n._onScrollWindow.bind(n),n._onResizeWindow=n._onResizeWindow.bind(n),n._enablePointerEventsAfterDelayCallback=n._enablePointerEventsAfterDelayCallback.bind(n),n}return l(t,e),s(t,[{key:"componentDidMount",value:function(){this._positionFromTop=d["default"].findDOMNode(this).getBoundingClientRect().top,this.setState({height:window.innerHeight}),window.addEventListener("scroll",this._onScrollWindow,!1),window.addEventListener("resize",this._onResizeWindow,!1)}},{key:"componentWillUnmount",value:function(){window.removeEventListener("scroll",this._onScrollWindow,!1),window.removeEventListener("resize",this._onResizeWindow,!1)}},{key:"_setNextState",value:function(e){var t=this;this._setNextStateAnimationFrameId&&y["default"].cancel(this._setNextStateAnimationFrameId),this._setNextStateAnimationFrameId=(0,y["default"])(function(){t._setNextStateAnimationFrameId=null,t.setState(e)})}},{key:"render",value:function(){var e=this.props.children,t=this.state,n=t.isScrolling,o=t.scrollTop,r=t.height;return u["default"].createElement("div",null,e({height:r,isScrolling:n,scrollTop:o}))}},{key:"shouldComponentUpdate",value:function(e,t){return(0,p["default"])(this,e,t)}},{key:"_enablePointerEventsAfterDelay",value:function(){this._disablePointerEventsTimeoutId&&clearTimeout(this._disablePointerEventsTimeoutId),this._disablePointerEventsTimeoutId=setTimeout(this._enablePointerEventsAfterDelayCallback,_)}},{key:"_enablePointerEventsAfterDelayCallback",value:function(){this._disablePointerEventsTimeoutId=null,document.body.style.pointerEvents=this._originalBodyPointerEvents,this._originalBodyPointerEvents=null,this.setState({isScrolling:!1})}},{key:"_onResizeWindow",value:function(e){var t=this.props.onResize,n=window.innerHeight||0;this.setState({height:n}),t({height:n})}},{key:"_onScrollWindow",value:function(e){var t=this.props.onScroll,n="scrollY"in window?window.scrollY:document.documentElement.scrollTop,o=Math.max(0,n-this._positionFromTop);null==this._originalBodyPointerEvents&&(this._originalBodyPointerEvents=document.body.style.pointerEvents,document.body.style.pointerEvents="none",this._enablePointerEventsAfterDelay());var r={isScrolling:!0,scrollTop:o};this.state.isScrolling?this._setNextState(r):this.setState(r),t({scrollTop:o})}}]),t}(a.Component);m.propTypes={children:a.PropTypes.func.isRequired,onResize:a.PropTypes.func.isRequired,onScroll:a.PropTypes.func.isRequired},m.defaultProps={onResize:function(){},onScroll:function(){}},t["default"]=m}])});
//# sourceMappingURL=react-virtualized.min.js.map |
src/index.js | dragfire/popUpHOC | import React from 'react';
import PropTypes from 'prop-types';
const propTypes = {
onItemSelect: PropTypes.func,
};
const defaultProps = {
onItemSelect: () => null,
};
const getDisplayName = WrappedComponent =>
WrappedComponent.displayName || WrappedComponent.name || 'Component';
const popUpHOC = (TriggerComponent, Component) => {
class WrappedComponent extends React.Component {
static propTypes = propTypes;
static defaultProps = defaultProps;
static displayName = `HOC${getDisplayName(Component)}`;
constructor(props) {
super(props);
this.state = {
open: false,
};
}
componentDidMount() {
window.addEventListener('click', this.handleDOMClick);
}
componentWillUnmount() {
window.removeEventListener('click', this.handleDOMClick);
}
setRef = _ref => {
this.wrappedComponent = _ref;
};
handleDOMClick = event => {
const { target } = event;
const { open } = this.state;
if (
this.wrappedComponent &&
open &&
target !== this.wrappedComponent &&
!this.wrappedComponent.contains(target)
) {
this.setState({ open: false });
}
};
handleTriggerClick = () => {
this.setState({ open: !this.state.open });
};
handleItemSelect = data => {
const { onItemSelect } = this.props;
this.setState({ open: false });
onItemSelect(data);
};
render() {
const { open } = this.state;
const { label, className } = this.props;
return (
<div ref={this.setRef} className={className}>
<TriggerComponent label={label} onClick={this.handleTriggerClick} />
<div
style={{
display: open ? 'block' : 'none',
}}
>
<Component onItemSelect={this.handleItemSelect} />
</div>
</div>
);
}
}
return WrappedComponent;
};
export default popUpHOC;
|
src/components/TouchableWithoutFeedback.js | lelandrichardson/react-native-mock | /**
* https://github.com/facebook/react-native/blob/master/Libraries/Components/Touchable/TouchableWithoutFeedback.js
*/
import React from 'react';
import EdgeInsetsPropType from '../propTypes/EdgeInsetsPropType';
import View from './View';
const TouchableWithoutFeedback = React.createClass({
propTypes: {
accessible: React.PropTypes.bool,
accessibilityComponentType: React.PropTypes.oneOf(View.AccessibilityComponentType),
accessibilityTraits: React.PropTypes.oneOfType([
React.PropTypes.oneOf(View.AccessibilityTraits),
React.PropTypes.arrayOf(React.PropTypes.oneOf(View.AccessibilityTraits)),
]),
/**
* If true, disable all interactions for this component.
*/
disabled: React.PropTypes.bool,
/**
* Called when the touch is released, but not if cancelled (e.g. by a scroll
* that steals the responder lock).
*/
onPress: React.PropTypes.func,
onPressIn: React.PropTypes.func,
onPressOut: React.PropTypes.func,
/**
* Invoked on mount and layout changes with
*
* `{nativeEvent: {layout: {x, y, width, height}}}`
*/
onLayout: React.PropTypes.func,
onLongPress: React.PropTypes.func,
/**
* Delay in ms, from the start of the touch, before onPressIn is called.
*/
delayPressIn: React.PropTypes.number,
/**
* Delay in ms, from the release of the touch, before onPressOut is called.
*/
delayPressOut: React.PropTypes.number,
/**
* Delay in ms, from onPressIn, before onLongPress is called.
*/
delayLongPress: React.PropTypes.number,
/**
* When the scroll view is disabled, this defines how far your touch may
* move off of the button, before deactivating the button. Once deactivated,
* try moving it back and you'll see that the button is once again
* reactivated! Move it back and forth several times while the scroll view
* is disabled. Ensure you pass in a constant to reduce memory allocations.
*/
pressRetentionOffset: EdgeInsetsPropType,
/**
* This defines how far your touch can start away from the button. This is
* added to `pressRetentionOffset` when moving off of the button.
* ** NOTE **
* The touch area never extends past the parent view bounds and the Z-index
* of sibling views always takes precedence if a touch hits two overlapping
* views.
*/
hitSlop: EdgeInsetsPropType,
},
render() {
return null;
},
});
module.exports = TouchableWithoutFeedback;
|
examples/components/Input.js | christianalfoni/formsy-react | import React from 'react';
import Formsy from 'formsy-react';
const MyInput = React.createClass({
// Add the Formsy Mixin
mixins: [Formsy.Mixin],
// setValue() will set the value of the component, which in
// turn will validate it and the rest of the form
changeValue(event) {
this.setValue(event.currentTarget[this.props.type === 'checkbox' ? 'checked' : 'value']);
},
render() {
// Set a specific className based on the validation
// state of this component. showRequired() is true
// when the value is empty and the required prop is
// passed to the input. showError() is true when the
// value typed is invalid
const className = 'form-group' + (this.props.className || ' ') +
(this.showRequired() ? 'required' : this.showError() ? 'error' : '');
// An error message is returned ONLY if the component is invalid
// or the server has returned an error message
const errorMessage = this.getErrorMessage();
return (
<div className={className}>
<label htmlFor={this.props.name}>{this.props.title}</label>
<input
type={this.props.type || 'text'}
name={this.props.name}
onChange={this.changeValue}
value={this.getValue()}
checked={this.props.type === 'checkbox' && this.getValue() ? 'checked' : null}
/>
<span className='validation-error'>{errorMessage}</span>
</div>
);
}
});
export default MyInput;
|
examples/exoskeleton/node_modules/exoskeleton/exoskeleton.js | nitish1125/todomvc | /*!
* Exoskeleton.js 0.7.0
* (c) 2013 Paul Miller <http://paulmillr.com>
* Based on Backbone.js
* (c) 2010-2013 Jeremy Ashkenas, DocumentCloud
* Exoskeleton may be freely distributed under the MIT license.
* For all details and documentation: <http://exosjs.com>
*/
(function(root, factory) {
// Set up Backbone appropriately for the environment.
if (typeof define === 'function' && define.amd) {
define(['underscore', 'jquery', 'exports'], function(_, $, exports) {
root.Backbone = root.Exoskeleton = factory(root, exports, _, $);
});
} else if (typeof exports !== 'undefined') {
var _, $;
try { _ = require('underscore'); } catch(e) { }
try { $ = require('jquery'); } catch(e) { }
factory(root, exports, _, $);
} else {
root.Backbone = root.Exoskeleton = factory(root, {}, root._, (root.jQuery || root.Zepto || root.ender || root.$));
}
})(this, function(root, Backbone, _, $) {
'use strict';
// Initial Setup
// -------------
// Save the previous value of the `Backbone` variable, so that it can be
// restored later on, if `noConflict` is used.
var previousBackbone = root.Backbone;
var previousExoskeleton = root.Exoskeleton;
// Underscore replacement.
var utils = Backbone.utils = _ = (_ || {});
// Hold onto a local reference to `$`. Can be changed at any point.
Backbone.$ = $;
// Create local references to array methods we'll want to use later.
var array = [];
var push = array.push;
var slice = array.slice;
var toString = ({}).toString;
// Current version of the library. Keep in sync with `package.json`.
// Backbone.VERSION = '1.0.0';
// Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable
// to its previous owner. Returns a reference to this Backbone object.
Backbone.noConflict = function() {
root.Backbone = previousBackbone;
root.Exoskeleton = previousExoskeleton;
return this;
};
// Helpers
// -------
// Helper function to correctly set up the prototype chain, for subclasses.
// Similar to `goog.inherits`, but uses a hash of prototype properties and
// class properties to be extended.
Backbone.extend = function(protoProps, staticProps) {
var parent = this;
var child;
// The constructor function for the new subclass is either defined by you
// (the "constructor" property in your `extend` definition), or defaulted
// by us to simply call the parent's constructor.
if (protoProps && _.has(protoProps, 'constructor')) {
child = protoProps.constructor;
} else {
child = function(){ return parent.apply(this, arguments); };
}
// Add static properties to the constructor function, if supplied.
_.extend(child, parent, staticProps);
// Set the prototype chain to inherit from `parent`, without calling
// `parent`'s constructor function.
var Surrogate = function(){ this.constructor = child; };
Surrogate.prototype = parent.prototype;
child.prototype = new Surrogate;
// Add prototype properties (instance properties) to the subclass,
// if supplied.
if (protoProps) _.extend(child.prototype, protoProps);
// Set a convenience property in case the parent's prototype is needed
// later.
child.__super__ = parent.prototype;
return child;
};
// Throw an error when a URL is needed, and none is supplied.
var urlError = function() {
throw new Error('A "url" property or function must be specified');
};
// Wrap an optional error callback with a fallback error event.
var wrapError = function(model, options) {
var error = options.error;
options.error = function(resp) {
if (error) error(model, resp, options);
model.trigger('error', model, resp, options);
};
};
// Checker for utility methods. Useful for custom builds.
var utilExists = function(method) {
return typeof _[method] === 'function';
};
utils.result = function result(object, property) {
var value = object ? object[property] : undefined;
return typeof value === 'function' ? object[property]() : value;
};
utils.defaults = function defaults(obj) {
slice.call(arguments, 1).forEach(function(item) {
for (var key in item) if (obj[key] === undefined)
obj[key] = item[key];
});
return obj;
};
utils.extend = function extend(obj) {
slice.call(arguments, 1).forEach(function(item) {
for (var key in item) obj[key] = item[key];
});
return obj;
};
var htmlEscapes = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": '''
};
utils.escape = function escape(string) {
return string == null ? '' : String(string).replace(/[&<>"']/g, function(match) {
return htmlEscapes[match];
});
};
utils.sortBy = function(obj, value, context) {
var iterator = typeof value === 'function' ? value : function(obj){ return obj[value]; };
return obj
.map(function(value, index, list) {
return {
value: value,
index: index,
criteria: iterator.call(context, value, index, list)
};
})
.sort(function(left, right) {
var a = left.criteria;
var b = right.criteria;
if (a !== b) {
if (a > b || a === void 0) return 1;
if (a < b || b === void 0) return -1;
}
return left.index - right.index;
})
.map(function(item) {
return item.value;
});
};
/** Used to generate unique IDs */
var idCounter = 0;
utils.uniqueId = function uniqueId(prefix) {
var id = ++idCounter + '';
return prefix ? prefix + id : id;
};
utils.has = function(obj, key) {
return Object.hasOwnProperty.call(obj, key);
};
var eq = function(a, b, aStack, bStack) {
// Identical objects are equal. `0 === -0`, but they aren't identical.
// See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
if (a === b) return a !== 0 || 1 / a == 1 / b;
// A strict comparison is necessary because `null == undefined`.
if (a == null || b == null) return a === b;
// Unwrap any wrapped objects.
//if (a instanceof _) a = a._wrapped;
//if (b instanceof _) b = b._wrapped;
// Compare `[[Class]]` names.
var className = toString.call(a);
if (className != toString.call(b)) return false;
switch (className) {
// Strings, numbers, dates, and booleans are compared by value.
case '[object String]':
// Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
// equivalent to `new String("5")`.
return a == String(b);
case '[object Number]':
// `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
// other numeric values.
return a !== +a ? b !== +b : (a === 0 ? 1 / a === 1 / b : a === +b);
case '[object Date]':
case '[object Boolean]':
// Coerce dates and booleans to numeric primitive values. Dates are compared by their
// millisecond representations. Note that invalid dates with millisecond representations
// of `NaN` are not equivalent.
return +a == +b;
// RegExps are compared by their source patterns and flags.
case '[object RegExp]':
return a.source == b.source &&
a.global == b.global &&
a.multiline == b.multiline &&
a.ignoreCase == b.ignoreCase;
}
if (typeof a != 'object' || typeof b != 'object') return false;
// Assume equality for cyclic structures. The algorithm for detecting cyclic
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
var length = aStack.length;
while (length--) {
// Linear search. Performance is inversely proportional to the number of
// unique nested structures.
if (aStack[length] == a) return bStack[length] == b;
}
// Objects with different constructors are not equivalent, but `Object`s
// from different frames are.
var aCtor = a.constructor, bCtor = b.constructor;
if (aCtor !== bCtor && !(typeof aCtor === 'function' && (aCtor instanceof aCtor) &&
typeof bCtor === 'function' && (bCtor instanceof bCtor))) {
return false;
}
// Add the first object to the stack of traversed objects.
aStack.push(a);
bStack.push(b);
var size = 0, result = true;
// Recursively compare objects and arrays.
if (className === '[object Array]') {
// Compare array lengths to determine if a deep comparison is necessary.
size = a.length;
result = size === b.length;
if (result) {
// Deep compare the contents, ignoring non-numeric properties.
while (size--) {
if (!(result = eq(a[size], b[size], aStack, bStack))) break;
}
}
} else {
// Deep compare objects.
for (var key in a) {
if (_.has(a, key)) {
// Count the expected number of properties.
size++;
// Deep compare each member.
if (!(result = _.has(b, key) && eq(a[key], b[key], aStack, bStack))) break;
}
}
// Ensure that both objects contain the same number of properties.
if (result) {
for (key in b) {
if (_.has(b, key) && !(size--)) break;
}
result = !size;
}
}
// Remove the first object from the stack of traversed objects.
aStack.pop();
bStack.pop();
return result;
};
// Perform a deep comparison to check if two objects are equal.
utils.isEqual = function(a, b) {
return eq(a, b, [], []);
};
// Backbone.Events
// ---------------
// A module that can be mixed in to *any object* in order to provide it with
// custom events. You may bind with `on` or remove with `off` callback
// functions to an event; `trigger`-ing an event fires all callbacks in
// succession.
//
// var object = {};
// _.extend(object, Backbone.Events);
// object.on('expand', function(){ alert('expanded'); });
// object.trigger('expand');
//
var Events = Backbone.Events = {
// Bind an event to a `callback` function. Passing `"all"` will bind
// the callback to all events fired.
on: function(name, callback, context) {
if (!eventsApi(this, 'on', name, [callback, context]) || !callback) return this;
this._events || (this._events = {});
var events = this._events[name] || (this._events[name] = []);
events.push({callback: callback, context: context, ctx: context || this});
return this;
},
// Bind an event to only be triggered a single time. After the first time
// the callback is invoked, it will be removed.
once: function(name, callback, context) {
if (!eventsApi(this, 'once', name, [callback, context]) || !callback) return this;
var self = this;
var ran;
var once = function() {
if (ran) return;
ran = true;
self.off(name, once);
callback.apply(this, arguments);
};
once._callback = callback;
return this.on(name, once, context);
},
// Remove one or many callbacks. If `context` is null, removes all
// callbacks with that function. If `callback` is null, removes all
// callbacks for the event. If `name` is null, removes all bound
// callbacks for all events.
off: function(name, callback, context) {
var retain, ev, events, names, i, l, j, k;
if (!this._events || !eventsApi(this, 'off', name, [callback, context])) return this;
if (!name && !callback && !context) {
this._events = void 0;
return this;
}
names = name ? [name] : Object.keys(this._events);
for (i = 0, l = names.length; i < l; i++) {
name = names[i];
if (events = this._events[name]) {
this._events[name] = retain = [];
if (callback || context) {
for (j = 0, k = events.length; j < k; j++) {
ev = events[j];
if ((callback && callback !== ev.callback && callback !== ev.callback._callback) ||
(context && context !== ev.context)) {
retain.push(ev);
}
}
}
if (!retain.length) delete this._events[name];
}
}
return this;
},
// Trigger one or many events, firing all bound callbacks. Callbacks are
// passed the same arguments as `trigger` is, apart from the event name
// (unless you're listening on `"all"`, which will cause your callback to
// receive the true name of the event as the first argument).
trigger: function(name) {
if (!this._events) return this;
var args = slice.call(arguments, 1);
if (!eventsApi(this, 'trigger', name, args)) return this;
var events = this._events[name];
var allEvents = this._events.all;
if (events) triggerEvents(events, args);
if (allEvents) triggerEvents(allEvents, arguments);
return this;
},
// Tell this object to stop listening to either specific events ... or
// to every object it's currently listening to.
stopListening: function(obj, name, callback) {
var listeningTo = this._listeningTo;
if (!listeningTo) return this;
var remove = !name && !callback;
if (!callback && typeof name === 'object') callback = this;
if (obj) (listeningTo = {})[obj._listenId] = obj;
for (var id in listeningTo) {
obj = listeningTo[id];
obj.off(name, callback, this);
if (remove || !Object.keys(obj._events).length) delete this._listeningTo[id];
}
return this;
}
};
// Regular expression used to split event strings.
var eventSplitter = /\s+/;
// Implement fancy features of the Events API such as multiple event
// names `"change blur"` and jQuery-style event maps `{change: action}`
// in terms of the existing API.
var eventsApi = function(obj, action, name, rest) {
if (!name) return true;
// Handle event maps.
if (typeof name === 'object') {
for (var key in name) {
obj[action].apply(obj, [key, name[key]].concat(rest));
}
return false;
}
// Handle space separated event names.
if (eventSplitter.test(name)) {
var names = name.split(eventSplitter);
for (var i = 0, l = names.length; i < l; i++) {
obj[action].apply(obj, [names[i]].concat(rest));
}
return false;
}
return true;
};
// A difficult-to-believe, but optimized internal dispatch function for
// triggering events. Tries to keep the usual cases speedy (most internal
// Backbone events have 3 arguments).
var triggerEvents = function(events, args) {
var ev, i = -1, l = events.length, a1 = args[0], a2 = args[1], a3 = args[2];
switch (args.length) {
case 0: while (++i < l) (ev = events[i]).callback.call(ev.ctx); return;
case 1: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1); return;
case 2: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2); return;
case 3: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2, a3); return;
default: while (++i < l) (ev = events[i]).callback.apply(ev.ctx, args); return;
}
};
var listenMethods = {listenTo: 'on', listenToOnce: 'once'};
// Inversion-of-control versions of `on` and `once`. Tell *this* object to
// listen to an event in another object ... keeping track of what it's
// listening to.
Object.keys(listenMethods).forEach(function(method) {
var implementation = listenMethods[method];
Events[method] = function(obj, name, callback) {
var listeningTo = this._listeningTo || (this._listeningTo = {});
var id = obj._listenId || (obj._listenId = _.uniqueId('l'));
listeningTo[id] = obj;
if (!callback && typeof name === 'object') callback = this;
obj[implementation](name, callback, this);
return this;
};
});
// Aliases for backwards compatibility.
Events.bind = Events.on;
Events.unbind = Events.off;
// Allow the `Backbone` object to serve as a global event bus, for folks who
// want global "pubsub" in a convenient place.
_.extend(Backbone, Events);
// Backbone.Model
// --------------
// Backbone **Models** are the basic data object in the framework --
// frequently representing a row in a table in a database on your server.
// A discrete chunk of data and a bunch of useful, related methods for
// performing computations and transformations on that data.
// Create a new model with the specified attributes. A client id (`cid`)
// is automatically generated and assigned for you.
var Model = Backbone.Model = function(attributes, options) {
var attrs = attributes || {};
options || (options = {});
this.cid = _.uniqueId('c');
this.attributes = Object.create(null);
if (options.collection) this.collection = options.collection;
if (options.parse) attrs = this.parse(attrs, options) || {};
attrs = _.defaults({}, attrs, _.result(this, 'defaults'));
this.set(attrs, options);
this.changed = Object.create(null);
this.initialize.apply(this, arguments);
};
// Attach all inheritable methods to the Model prototype.
_.extend(Model.prototype, Events, {
// A hash of attributes whose current and previous value differ.
changed: null,
// The value returned during the last failed validation.
validationError: null,
// The default name for the JSON `id` attribute is `"id"`. MongoDB and
// CouchDB users may want to set this to `"_id"`.
idAttribute: 'id',
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize: function(){},
// Return a copy of the model's `attributes` object.
toJSON: function(options) {
return _.extend({}, this.attributes);
},
// Proxy `Backbone.sync` by default -- but override this if you need
// custom syncing semantics for *this* particular model.
sync: function() {
return Backbone.sync.apply(this, arguments);
},
// Get the value of an attribute.
get: function(attr) {
return this.attributes[attr];
},
// Get the HTML-escaped value of an attribute.
escape: function(attr) {
return _.escape(this.get(attr));
},
// Returns `true` if the attribute contains a value that is not null
// or undefined.
has: function(attr) {
return this.get(attr) != null;
},
// Set a hash of model attributes on the object, firing `"change"`. This is
// the core primitive operation of a model, updating the data and notifying
// anyone who needs to know about the change in state. The heart of the beast.
set: function(key, val, options) {
var attr, attrs, unset, changes, silent, changing, prev, current;
if (key == null) return this;
// Handle both `"key", value` and `{key: value}` -style arguments.
if (typeof key === 'object') {
attrs = key;
options = val;
} else {
(attrs = {})[key] = val;
}
options || (options = {});
// Run validation.
if (!this._validate(attrs, options)) return false;
// Extract attributes and options.
unset = options.unset;
silent = options.silent;
changes = [];
changing = this._changing;
this._changing = true;
if (!changing) {
this._previousAttributes = _.extend(Object.create(null), this.attributes);
this.changed = {};
}
current = this.attributes, prev = this._previousAttributes;
// Check for changes of `id`.
if (this.idAttribute in attrs) this.id = attrs[this.idAttribute];
// For each `set` attribute, update or delete the current value.
for (attr in attrs) {
val = attrs[attr];
if (!_.isEqual(current[attr], val)) changes.push(attr);
if (!_.isEqual(prev[attr], val)) {
this.changed[attr] = val;
} else {
delete this.changed[attr];
}
unset ? delete current[attr] : current[attr] = val;
}
// Trigger all relevant attribute changes.
if (!silent) {
if (changes.length) this._pending = options;
for (var i = 0, l = changes.length; i < l; i++) {
this.trigger('change:' + changes[i], this, current[changes[i]], options);
}
}
// You might be wondering why there's a `while` loop here. Changes can
// be recursively nested within `"change"` events.
if (changing) return this;
if (!silent) {
while (this._pending) {
options = this._pending;
this._pending = false;
this.trigger('change', this, options);
}
}
this._pending = false;
this._changing = false;
return this;
},
// Remove an attribute from the model, firing `"change"`. `unset` is a noop
// if the attribute doesn't exist.
unset: function(attr, options) {
return this.set(attr, void 0, _.extend({}, options, {unset: true}));
},
// Clear all attributes on the model, firing `"change"`.
clear: function(options) {
var attrs = {};
for (var key in this.attributes) attrs[key] = void 0;
return this.set(attrs, _.extend({}, options, {unset: true}));
},
// Determine if the model has changed since the last `"change"` event.
// If you specify an attribute name, determine if that attribute has changed.
hasChanged: function(attr) {
if (attr == null) return !!Object.keys(this.changed).length;
return _.has(this.changed, attr);
},
// Return an object containing all the attributes that have changed, or
// false if there are no changed attributes. Useful for determining what
// parts of a view need to be updated and/or what attributes need to be
// persisted to the server. Unset attributes will be set to undefined.
// You can also pass an attributes object to diff against the model,
// determining if there *would be* a change.
changedAttributes: function(diff) {
if (!diff) return this.hasChanged() ? _.extend(Object.create(null), this.changed) : false;
var val, changed = false;
var old = this._changing ? this._previousAttributes : this.attributes;
for (var attr in diff) {
if (_.isEqual(old[attr], (val = diff[attr]))) continue;
(changed || (changed = {}))[attr] = val;
}
return changed;
},
// Get the previous value of an attribute, recorded at the time the last
// `"change"` event was fired.
previous: function(attr) {
if (attr == null || !this._previousAttributes) return null;
return this._previousAttributes[attr];
},
// Get all of the attributes of the model at the time of the previous
// `"change"` event.
previousAttributes: function() {
return _.extend(Object.create(null), this._previousAttributes);
},
// Fetch the model from the server. If the server's representation of the
// model differs from its current attributes, they will be overridden,
// triggering a `"change"` event.
fetch: function(options) {
options = options ? _.extend({}, options) : {};
if (options.parse === void 0) options.parse = true;
var model = this;
var success = options.success;
options.success = function(resp) {
if (!model.set(model.parse(resp, options), options)) return false;
if (success) success(model, resp, options);
model.trigger('sync', model, resp, options);
};
wrapError(this, options);
return this.sync('read', this, options);
},
// Set a hash of model attributes, and sync the model to the server.
// If the server returns an attributes hash that differs, the model's
// state will be `set` again.
save: function(key, val, options) {
var attrs, method, xhr, attributes = this.attributes;
// Handle both `"key", value` and `{key: value}` -style arguments.
if (key == null || typeof key === 'object') {
attrs = key;
options = val;
} else {
(attrs = {})[key] = val;
}
options = _.extend({validate: true}, options);
// If we're not waiting and attributes exist, save acts as
// `set(attr).save(null, opts)` with validation. Otherwise, check if
// the model will be valid when the attributes, if any, are set.
if (attrs && !options.wait) {
if (!this.set(attrs, options)) return false;
} else {
if (!this._validate(attrs, options)) return false;
}
// Set temporary attributes if `{wait: true}`.
if (attrs && options.wait) {
this.attributes = _.extend(Object.create(null), attributes, attrs);
}
// After a successful server-side save, the client is (optionally)
// updated with the server-side state.
if (options.parse === void 0) options.parse = true;
var model = this;
var success = options.success;
options.success = function(resp) {
// Ensure attributes are restored during synchronous saves.
model.attributes = attributes;
var serverAttrs = model.parse(resp, options);
if (options.wait) serverAttrs = _.extend(attrs || {}, serverAttrs);
if (serverAttrs && typeof serverAttrs === 'object' && !model.set(serverAttrs, options)) {
return false;
}
if (success) success(model, resp, options);
model.trigger('sync', model, resp, options);
};
wrapError(this, options);
method = this.isNew() ? 'create' : (options.patch ? 'patch' : 'update');
if (method === 'patch') options.attrs = attrs;
xhr = this.sync(method, this, options);
// Restore attributes.
if (attrs && options.wait) this.attributes = attributes;
return xhr;
},
// Destroy this model on the server if it was already persisted.
// Optimistically removes the model from its collection, if it has one.
// If `wait: true` is passed, waits for the server to respond before removal.
destroy: function(options) {
options = options ? _.extend({}, options) : {};
var model = this;
var success = options.success;
var destroy = function() {
model.trigger('destroy', model, model.collection, options);
};
options.success = function(resp) {
if (options.wait || model.isNew()) destroy();
if (success) success(model, resp, options);
if (!model.isNew()) model.trigger('sync', model, resp, options);
};
if (this.isNew()) {
options.success();
return false;
}
wrapError(this, options);
var xhr = this.sync('delete', this, options);
if (!options.wait) destroy();
return xhr;
},
// Default URL for the model's representation on the server -- if you're
// using Backbone's restful methods, override this to change the endpoint
// that will be called.
url: function() {
var base =
_.result(this, 'urlRoot') ||
_.result(this.collection, 'url') ||
urlError();
if (this.isNew()) return base;
return base.replace(/([^\/])$/, '$1/') + encodeURIComponent(this.id);
},
// **parse** converts a response into the hash of attributes to be `set` on
// the model. The default implementation is just to pass the response along.
parse: function(resp, options) {
return resp;
},
// Create a new model with identical attributes to this one.
clone: function() {
return new this.constructor(this.attributes);
},
// A model is new if it has never been saved to the server, and lacks an id.
isNew: function() {
return !this.has(this.idAttribute);
},
// Check if the model is currently in a valid state.
isValid: function(options) {
return this._validate({}, _.extend(options || {}, { validate: true }));
},
// Run validation against the next complete set of model attributes,
// returning `true` if all is well. Otherwise, fire an `"invalid"` event.
_validate: function(attrs, options) {
if (!options.validate || !this.validate) return true;
attrs = _.extend(Object.create(null), this.attributes, attrs);
var error = this.validationError = this.validate(attrs, options) || null;
if (!error) return true;
this.trigger('invalid', this, error, _.extend(options, {validationError: error}));
return false;
}
});
if (_.keys) {
// Underscore methods that we want to implement on the Model.
var modelMethods = ['keys', 'values', 'pairs', 'invert', 'pick', 'omit'];
// Mix in each Underscore method as a proxy to `Model#attributes`.
modelMethods.filter(utilExists).forEach(function(method) {
Model.prototype[method] = function() {
var args = slice.call(arguments);
args.unshift(this.attributes);
return _[method].apply(_, args);
};
});
}
// Backbone.Collection
// -------------------
// If models tend to represent a single row of data, a Backbone Collection is
// more analagous to a table full of data ... or a small slice or page of that
// table, or a collection of rows that belong together for a particular reason
// -- all of the messages in this particular folder, all of the documents
// belonging to this particular author, and so on. Collections maintain
// indexes of their models, both in order, and for lookup by `id`.
// Create a new **Collection**, perhaps to contain a specific type of `model`.
// If a `comparator` is specified, the Collection will maintain
// its models in sort order, as they're added and removed.
var Collection = Backbone.Collection = function(models, options) {
options || (options = {});
if (options.model) this.model = options.model;
if (options.comparator !== void 0) this.comparator = options.comparator;
this._reset();
this.initialize.apply(this, arguments);
if (models) this.reset(models, _.extend({silent: true}, options));
};
// Default options for `Collection#set`.
var setOptions = {add: true, remove: true, merge: true};
var addOptions = {add: true, remove: false};
// Define the Collection's inheritable methods.
_.extend(Collection.prototype, Events, {
// The default model for a collection is just a **Backbone.Model**.
// This should be overridden in most cases.
model: typeof Model === 'undefined' ? null : Model,
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize: function(){},
// The JSON representation of a Collection is an array of the
// models' attributes.
toJSON: function(options) {
return this.map(function(model){ return model.toJSON(options); });
},
// Proxy `Backbone.sync` by default.
sync: function() {
return Backbone.sync.apply(this, arguments);
},
// Add a model, or list of models to the set.
add: function(models, options) {
return this.set(models, _.extend({merge: false}, options, addOptions));
},
// Remove a model, or a list of models from the set.
remove: function(models, options) {
var singular = !Array.isArray(models);
models = singular ? [models] : models.slice();
options || (options = {});
var i, l, index, model;
for (i = 0, l = models.length; i < l; i++) {
model = models[i] = this.get(models[i]);
if (!model) continue;
delete this._byId[model.id];
delete this._byId[model.cid];
index = this.indexOf(model);
this.models.splice(index, 1);
this.length--;
if (!options.silent) {
options.index = index;
model.trigger('remove', model, this, options);
}
this._removeReference(model, options);
}
return singular ? models[0] : models;
},
// Update a collection by `set`-ing a new list of models, adding new ones,
// removing models that are no longer present, and merging models that
// already exist in the collection, as necessary. Similar to **Model#set**,
// the core operation for updating the data contained by the collection.
set: function(models, options) {
options = _.defaults({}, options, setOptions);
if (options.parse) models = this.parse(models, options);
var singular = !Array.isArray(models);
models = singular ? (models ? [models] : []) : models.slice();
var i, l, id, model, attrs, existing, sort;
var at = options.at;
var targetModel = this.model;
var sortable = this.comparator && (at == null) && options.sort !== false;
var sortAttr = typeof this.comparator === 'string' ? this.comparator : null;
var toAdd = [], toRemove = [], modelMap = {};
var add = options.add, merge = options.merge, remove = options.remove;
var order = !sortable && add && remove ? [] : false;
// Turn bare objects into model references, and prevent invalid models
// from being added.
for (i = 0, l = models.length; i < l; i++) {
attrs = models[i] || {};
if (attrs instanceof Model) {
id = model = attrs;
} else {
id = attrs[targetModel.prototype.idAttribute || 'id'];
}
// If a duplicate is found, prevent it from being added and
// optionally merge it into the existing model.
if (existing = this.get(id)) {
if (remove) modelMap[existing.cid] = true;
if (merge) {
attrs = attrs === model ? model.attributes : attrs;
if (options.parse) attrs = existing.parse(attrs, options);
existing.set(attrs, options);
if (sortable && !sort && existing.hasChanged(sortAttr)) sort = true;
}
models[i] = existing;
// If this is a new, valid model, push it to the `toAdd` list.
} else if (add) {
model = models[i] = this._prepareModel(attrs, options);
if (!model) continue;
toAdd.push(model);
this._addReference(model, options);
}
// Do not add multiple models with the same `id`.
model = existing || model;
if (order && (model.isNew() || !modelMap[model.id])) order.push(model);
modelMap[model.id] = true;
}
// Remove nonexistent models if appropriate.
if (remove) {
for (i = 0, l = this.length; i < l; ++i) {
if (!modelMap[(model = this.models[i]).cid]) toRemove.push(model);
}
if (toRemove.length) this.remove(toRemove, options);
}
// See if sorting is needed, update `length` and splice in new models.
if (toAdd.length || (order && order.length)) {
if (sortable) sort = true;
this.length += toAdd.length;
if (at != null) {
for (i = 0, l = toAdd.length; i < l; i++) {
this.models.splice(at + i, 0, toAdd[i]);
}
} else {
if (order) this.models.length = 0;
var orderedModels = order || toAdd;
for (i = 0, l = orderedModels.length; i < l; i++) {
this.models.push(orderedModels[i]);
}
}
}
// Silently sort the collection if appropriate.
if (sort) this.sort({silent: true});
// Unless silenced, it's time to fire all appropriate add/sort events.
if (!options.silent) {
for (i = 0, l = toAdd.length; i < l; i++) {
(model = toAdd[i]).trigger('add', model, this, options);
}
if (sort || (order && order.length)) this.trigger('sort', this, options);
}
// Return the added (or merged) model (or models).
return singular ? models[0] : models;
},
// When you have more items than you want to add or remove individually,
// you can reset the entire set with a new list of models, without firing
// any granular `add` or `remove` events. Fires `reset` when finished.
// Useful for bulk operations and optimizations.
reset: function(models, options) {
options || (options = {});
for (var i = 0, l = this.models.length; i < l; i++) {
this._removeReference(this.models[i], options);
}
options.previousModels = this.models;
this._reset();
models = this.add(models, _.extend({silent: true}, options));
if (!options.silent) this.trigger('reset', this, options);
return models;
},
// Add a model to the end of the collection.
push: function(model, options) {
return this.add(model, _.extend({at: this.length}, options));
},
// Remove a model from the end of the collection.
pop: function(options) {
var model = this.at(this.length - 1);
this.remove(model, options);
return model;
},
// Add a model to the beginning of the collection.
unshift: function(model, options) {
return this.add(model, _.extend({at: 0}, options));
},
// Remove a model from the beginning of the collection.
shift: function(options) {
var model = this.at(0);
this.remove(model, options);
return model;
},
// Slice out a sub-array of models from the collection.
slice: function() {
return slice.apply(this.models, arguments);
},
// Get a model from the set by id.
get: function(obj) {
if (obj == null) return void 0;
return this._byId[obj] || this._byId[obj.id] || this._byId[obj.cid];
},
// Get the model at the given index.
at: function(index) {
return this.models[index];
},
// Return models with matching attributes. Useful for simple cases of
// `filter`.
where: function(attrs, first) {
if (!attrs || !Object.keys(attrs).length) return first ? void 0 : [];
return this[first ? 'find' : 'filter'](function(model) {
for (var key in attrs) {
if (attrs[key] !== model.get(key)) return false;
}
return true;
});
},
// Return the first model with matching attributes. Useful for simple cases
// of `find`.
findWhere: function(attrs) {
return this.where(attrs, true);
},
// Force the collection to re-sort itself. You don't need to call this under
// normal circumstances, as the set will maintain sort order as each item
// is added.
sort: function(options) {
if (!this.comparator) throw new Error('Cannot sort a set without a comparator');
options || (options = {});
// Run sort based on type of `comparator`.
if (typeof this.comparator === 'string' || this.comparator.length === 1) {
this.models = this.sortBy(this.comparator, this);
} else {
this.models.sort(this.comparator.bind(this));
}
if (!options.silent) this.trigger('sort', this, options);
return this;
},
// Pluck an attribute from each model in the collection.
pluck: function(attr) {
return this.models.map(function(model) {
return model.get(attr);
});
},
// Fetch the default set of models for this collection, resetting the
// collection when they arrive. If `reset: true` is passed, the response
// data will be passed through the `reset` method instead of `set`.
fetch: function(options) {
options = options ? _.extend({}, options) : {};
if (options.parse === void 0) options.parse = true;
var success = options.success;
var collection = this;
options.success = function(resp) {
var method = options.reset ? 'reset' : 'set';
collection[method](resp, options);
if (success) success(collection, resp, options);
collection.trigger('sync', collection, resp, options);
};
wrapError(this, options);
return this.sync('read', this, options);
},
// Create a new instance of a model in this collection. Add the model to the
// collection immediately, unless `wait: true` is passed, in which case we
// wait for the server to agree.
create: function(model, options) {
options = options ? _.extend({}, options) : {};
if (!(model = this._prepareModel(model, options))) return false;
if (!options.wait) this.add(model, options);
var collection = this;
var success = options.success;
options.success = function(model, resp) {
if (options.wait) collection.add(model, options);
if (success) success(model, resp, options);
};
model.save(null, options);
return model;
},
// **parse** converts a response into a list of models to be added to the
// collection. The default implementation is just to pass it through.
parse: function(resp, options) {
return resp;
},
// Create a new collection with an identical list of models as this one.
clone: function() {
return new this.constructor(this.models);
},
// Private method to reset all internal state. Called when the collection
// is first initialized or reset.
_reset: function() {
this.length = 0;
this.models = [];
this._byId = Object.create(null);
},
// Prepare a hash of attributes (or other model) to be added to this
// collection.
_prepareModel: function(attrs, options) {
if (attrs instanceof Model) return attrs;
options = _.extend({}, options);
options.collection = this;
var model = new this.model(attrs, options);
if (!model.validationError) return model;
this.trigger('invalid', this, model.validationError, options);
return false;
},
// Internal method to create a model's ties to a collection.
_addReference: function(model, options) {
this._byId[model.cid] = model;
if (model.id != null) this._byId[model.id] = model;
if (!model.collection) model.collection = this;
model.on('all', this._onModelEvent, this);
},
// Internal method to sever a model's ties to a collection.
_removeReference: function(model, options) {
if (this === model.collection) delete model.collection;
model.off('all', this._onModelEvent, this);
},
// Internal method called every time a model in the set fires an event.
// Sets need to update their indexes when models change ids. All other
// events simply proxy through. "add" and "remove" events that originate
// in other collections are ignored.
_onModelEvent: function(event, model, collection, options) {
if ((event === 'add' || event === 'remove') && collection !== this) return;
if (event === 'destroy') this.remove(model, options);
if (model && event === 'change:' + model.idAttribute) {
delete this._byId[model.previous(model.idAttribute)];
if (model.id != null) this._byId[model.id] = model;
}
this.trigger.apply(this, arguments);
}
});
if (utilExists('each')) {
// Underscore methods that we want to implement on the Collection.
// 90% of the core usefulness of Backbone Collections is actually implemented
// right here:
var methods = ['forEach', 'each', 'map', 'collect', 'reduce', 'foldl',
'inject', 'reduceRight', 'foldr', 'find', 'detect', 'filter', 'select',
'reject', 'every', 'all', 'some', 'any', 'include', 'contains', 'invoke',
'max', 'min', 'toArray', 'size', 'first', 'head', 'take', 'initial', 'rest',
'tail', 'drop', 'last', 'without', 'difference', 'indexOf', 'shuffle',
'lastIndexOf', 'isEmpty', 'chain'];
// Mix in each Underscore method as a proxy to `Collection#models`.
methods.filter(utilExists).forEach(function(method) {
Collection.prototype[method] = function() {
var args = slice.call(arguments);
args.unshift(this.models);
return _[method].apply(_, args);
};
});
// Underscore methods that take a property name as an argument.
var attributeMethods = ['groupBy', 'countBy', 'sortBy'];
// Use attributes instead of properties.
attributeMethods.filter(utilExists).forEach(function(method) {
Collection.prototype[method] = function(value, context) {
var iterator = typeof value === 'function' ? value : function(model) {
return model.get(value);
};
return _[method](this.models, iterator, context);
};
});
} else {
['forEach', 'map', 'filter', 'some', 'every', 'reduce', 'reduceRight',
'indexOf', 'lastIndexOf'].forEach(function(method) {
Collection.prototype[method] = function(arg, context) {
return this.models[method](arg, context);
};
});
// Exoskeleton-specific:
Collection.prototype.find = function(iterator, context) {
var result;
this.some(function(value, index, list) {
if (iterator.call(context, value, index, list)) {
result = value;
return true;
}
});
return result;
};
// Underscore methods that take a property name as an argument.
['sortBy'].forEach(function(method) {
Collection.prototype[method] = function(value, context) {
var iterator = typeof value === 'function' ? value : function(model) {
return model.get(value);
};
return _[method](this.models, iterator, context);
};
});
}
// Backbone.View
// -------------
// Backbone Views are almost more convention than they are actual code. A View
// is simply a JavaScript object that represents a logical chunk of UI in the
// DOM. This might be a single item, an entire list, a sidebar or panel, or
// even the surrounding frame which wraps your whole app. Defining a chunk of
// UI as a **View** allows you to define your DOM events declaratively, without
// having to worry about render order ... and makes it easy for the view to
// react to specific changes in the state of your models.
// Creating a Backbone.View creates its initial element outside of the DOM,
// if an existing element is not provided...
var View = Backbone.View = function(options) {
this.cid = _.uniqueId('view');
if (options) Object.keys(options).forEach(function(key) {
if (viewOptions.indexOf(key) !== -1) this[key] = options[key];
}, this);
this._ensureElement();
this.initialize.apply(this, arguments);
};
// Cached regex to split keys for `delegate`.
var delegateEventSplitter = /^(\S+)\s*(.*)$/;
// List of view options to be merged as properties.
var viewOptions = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName', 'events'];
// Set up all inheritable **Backbone.View** properties and methods.
_.extend(View.prototype, Events, {
// The default `tagName` of a View's element is `"div"`.
tagName: 'div',
// jQuery delegate for element lookup, scoped to DOM elements within the
// current view. This should be preferred to global lookups where possible.
$: function(selector) {
return this.$el.find(selector);
},
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize: function(){},
// **render** is the core function that your view should override, in order
// to populate its element (`this.el`), with the appropriate HTML. The
// convention is for **render** to always return `this`.
render: function() {
return this;
},
// Remove this view by taking the element out of the DOM, and removing any
// applicable Backbone.Events listeners.
remove: function() {
this._removeElement();
this.stopListening();
return this;
},
// Remove this view's element from the document and all event listeners
// attached to it. Exposed for subclasses using an alternative DOM
// manipulation API.
_removeElement: function() {
this.$el.remove();
},
// Change the view's element (`this.el` property) and re-delegate the
// view's events on the new element.
setElement: function(element) {
this.undelegateEvents();
this._setElement(element);
this.delegateEvents();
return this;
},
// Creates the `this.el` and `this.$el` references for this view using the
// given `el` and a hash of `attributes`. `el` can be a CSS selector or an
// HTML string, a jQuery context or an element. Subclasses can override
// this to utilize an alternative DOM manipulation API and are only required
// to set the `this.el` property.
_setElement: function(el) {
if (!Backbone.$) throw new Error('You must either include jQuery or override Backbone.View.prototype methods (Google Backbone.NativeView)');
this.$el = el instanceof Backbone.$ ? el : Backbone.$(el);
this.el = this.$el[0];
},
// Set callbacks, where `this.events` is a hash of
//
// *{"event selector": "callback"}*
//
// {
// 'mousedown .title': 'edit',
// 'click .button': 'save',
// 'click .open': function(e) { ... }
// }
//
// pairs. Callbacks will be bound to the view, with `this` set properly.
// Uses event delegation for efficiency.
// Omitting the selector binds the event to `this.el`.
delegateEvents: function(events) {
if (!(events || (events = _.result(this, 'events')))) return this;
this.undelegateEvents();
for (var key in events) {
var method = events[key];
if (typeof method !== 'function') method = this[events[key]];
// if (!method) continue;
var match = key.match(delegateEventSplitter);
this.delegate(match[1], match[2], method.bind(this));
}
return this;
},
// Add a single event listener to the view's element (or a child element
// using `selector`). This only works for delegate-able events: not `focus`,
// `blur`, and not `change`, `submit`, and `reset` in Internet Explorer.
delegate: function(eventName, selector, listener) {
this.$el.on(eventName + '.delegateEvents' + this.cid, selector, listener);
},
// Clears all callbacks previously bound to the view by `delegateEvents`.
// You usually don't need to use this, but may wish to if you have multiple
// Backbone views attached to the same DOM element.
undelegateEvents: function() {
if (this.$el) this.$el.off('.delegateEvents' + this.cid);
return this;
},
// A finer-grained `undelegateEvents` for removing a single delegated event.
// `selector` and `listener` are both optional.
undelegate: function(eventName, selector, listener) {
this.$el.off(eventName + '.delegateEvents' + this.cid, selector, listener);
},
// Produces a DOM element to be assigned to your view. Exposed for
// subclasses using an alternative DOM manipulation API.
_createElement: function(tagName) {
return document.createElement(tagName);
},
// Ensure that the View has a DOM element to render into.
// If `this.el` is a string, pass it through `$()`, take the first
// matching element, and re-assign it to `el`. Otherwise, create
// an element from the `id`, `className` and `tagName` properties.
_ensureElement: function() {
if (!this.el) {
var attrs = _.extend({}, _.result(this, 'attributes'));
if (this.id) attrs.id = _.result(this, 'id');
if (this.className) attrs['class'] = _.result(this, 'className');
this.setElement(this._createElement(_.result(this, 'tagName')));
this._setAttributes(attrs);
} else {
this.setElement(_.result(this, 'el'));
}
},
// Set attributes from a hash on this view's element. Exposed for
// subclasses using an alternative DOM manipulation API.
_setAttributes: function(attributes) {
this.$el.attr(attributes);
}
});
// Backbone.sync
// -------------
// Override this function to change the manner in which Backbone persists
// models to the server. You will be passed the type of request, and the
// model in question. By default, makes a RESTful Ajax request
// to the model's `url()`. Some possible customizations could be:
//
// * Use `setTimeout` to batch rapid-fire updates into a single request.
// * Send up the models as XML instead of JSON.
// * Persist models via WebSockets instead of Ajax.
Backbone.sync = function(method, model, options) {
options || (options = {})
var type = methodMap[method];
// Default JSON-request options.
var params = {type: type, dataType: 'json'};
// Ensure that we have a URL.
if (!options.url) {
params.url = _.result(model, 'url') || urlError();
}
// Ensure that we have the appropriate request data.
if (options.data == null && model && (method === 'create' || method === 'update' || method === 'patch')) {
params.contentType = 'application/json';
params.data = JSON.stringify(options.attrs || model.toJSON(options));
}
// Don't process data on a non-GET request.
if (params.type !== 'GET') {
params.processData = false;
}
// Make the request, allowing the user to override any Ajax options.
var xhr = options.xhr = Backbone.ajax(_.extend(params, options));
model.trigger('request', model, xhr, options);
return xhr;
};
// Map from CRUD to HTTP for our default `Backbone.sync` implementation.
var methodMap = {
'create': 'POST',
'update': 'PUT',
'patch': 'PATCH',
'delete': 'DELETE',
'read': 'GET'
};
// Set the default implementation of `Backbone.ajax` to proxy through to `$`.
// Override this if you'd like to use a different library.
Backbone.ajax = function() {
if (!Backbone.$) throw new Error('You must either include jQuery or override Backbone.ajax (Google Backbone.NativeAjax)');
return Backbone.$.ajax.apply(Backbone.$, arguments);
};
// Backbone.Router
// ---------------
// Routers map faux-URLs to actions, and fire events when routes are
// matched. Creating a new one sets its `routes` hash, if not set statically.
var Router = Backbone.Router = function(options) {
options || (options = {});
if (options.routes) this.routes = options.routes;
this._bindRoutes();
this.initialize.apply(this, arguments);
};
// Cached regular expressions for matching named param parts and splatted
// parts of route strings.
var optionalParam = /\((.*?)\)/g;
var namedParam = /(\(\?)?:\w+/g;
var splatParam = /\*\w+/g;
var escapeRegExp = /[\-{}\[\]+?.,\\\^$|#\s]/g;
var isRegExp = function(value) {
return value ? (typeof value === 'object' && toString.call(value) === '[object RegExp]') : false;
};
// Set up all inheritable **Backbone.Router** properties and methods.
_.extend(Router.prototype, Events, {
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize: function(){},
// Manually bind a single named route to a callback. For example:
//
// this.route('search/:query/p:num', 'search', function(query, num) {
// ...
// });
//
route: function(route, name, callback) {
if (!isRegExp(route)) route = this._routeToRegExp(route);
if (typeof name === 'function') {
callback = name;
name = '';
}
if (!callback) callback = this[name];
var router = this;
Backbone.history.route(route, function(fragment) {
var args = router._extractParameters(route, fragment);
router.execute(callback, args);
router.trigger.apply(router, ['route:' + name].concat(args));
router.trigger('route', name, args);
Backbone.history.trigger('route', router, name, args);
});
return this;
},
// Execute a route handler with the provided parameters. This is an
// excellent place to do pre-route setup or post-route cleanup.
execute: function(callback, args) {
if (callback) callback.apply(this, args);
},
// Simple proxy to `Backbone.history` to save a fragment into the history.
navigate: function(fragment, options) {
Backbone.history.navigate(fragment, options);
return this;
},
// Bind all defined routes to `Backbone.history`. We have to reverse the
// order of the routes here to support behavior where the most general
// routes can be defined at the bottom of the route map.
_bindRoutes: function() {
if (!this.routes) return;
this.routes = _.result(this, 'routes');
var route, routes = Object.keys(this.routes);
while ((route = routes.pop()) != null) {
this.route(route, this.routes[route]);
}
},
// Convert a route string into a regular expression, suitable for matching
// against the current location hash.
_routeToRegExp: function(route) {
route = route.replace(escapeRegExp, '\\$&')
.replace(optionalParam, '(?:$1)?')
.replace(namedParam, function(match, optional) {
return optional ? match : '([^/?]+)';
})
.replace(splatParam, '([^?]*?)');
return new RegExp('^' + route + '(?:\\?([\\s\\S]*))?$');
},
// Given a route, and a URL fragment that it matches, return the array of
// extracted decoded parameters. Empty or unmatched parameters will be
// treated as `null` to normalize cross-browser behavior.
_extractParameters: function(route, fragment) {
var params = route.exec(fragment).slice(1);
return params.map(function(param, i) {
// Don't decode the search params.
if (i === params.length - 1) return param || null;
return param ? decodeURIComponent(param) : null;
});
}
});
// Backbone.History
// ----------------
// Handles cross-browser history management, based on either
// [pushState](http://diveintohtml5.info/history.html) and real URLs, or
// [onhashchange](https://developer.mozilla.org/en-US/docs/DOM/window.onhashchange)
// and URL fragments.
var History = Backbone.History = function() {
this.handlers = [];
this.checkUrl = this.checkUrl.bind(this);
// Ensure that `History` can be used outside of the browser.
if (typeof window !== 'undefined') {
this.location = window.location;
this.history = window.history;
}
};
// Cached regex for stripping a leading hash/slash and trailing space.
var routeStripper = /^[#\/]|\s+$/g;
// Cached regex for stripping leading and trailing slashes.
var rootStripper = /^\/+|\/+$/g;
// Cached regex for removing a trailing slash.
var trailingSlash = /\/$/;
// Cached regex for stripping urls of hash and query.
var pathStripper = /[#].*$/;
// Has the history handling already been started?
History.started = false;
// Set up all inheritable **Backbone.History** properties and methods.
_.extend(History.prototype, Events, {
// Are we at the app root?
atRoot: function() {
return this.location.pathname.replace(/[^\/]$/, '$&/') === this.root;
},
// Gets the true hash value. Cannot use location.hash directly due to bug
// in Firefox where location.hash will always be decoded.
getHash: function(window) {
var match = (window || this).location.href.match(/#(.*)$/);
return match ? match[1] : '';
},
// Get the cross-browser normalized URL fragment, either from the URL,
// the hash, or the override.
getFragment: function(fragment, forcePushState) {
if (fragment == null) {
if (this._wantsPushState || !this._wantsHashChange) {
fragment = decodeURI(this.location.pathname + this.location.search);
var root = this.root.replace(trailingSlash, '');
if (!fragment.indexOf(root)) fragment = fragment.slice(root.length);
} else {
fragment = this.getHash();
}
}
return fragment.replace(routeStripper, '');
},
// Start the hash change handling, returning `true` if the current URL matches
// an existing route, and `false` otherwise.
start: function(options) {
if (History.started) throw new Error("Backbone.history has already been started");
History.started = true;
// Figure out the initial configuration.
// Is pushState desired or should we use hashchange only?
this.options = _.extend({root: '/'}, this.options, options);
this.root = this.options.root;
this._wantsHashChange = this.options.hashChange !== false;
this._wantsPushState = !!this.options.pushState;
var fragment = this.getFragment();
// Normalize root to always include a leading and trailing slash.
this.root = ('/' + this.root + '/').replace(rootStripper, '/');
// Depending on whether we're using pushState or hashes, determine how we
// check the URL state.
if (this._wantsPushState) {
window.addEventListener('popstate', this.checkUrl, false);
} else if (this._wantsHashChange) {
window.addEventListener('hashchange', this.checkUrl, false);
}
// Determine if we need to change the base url, for a pushState link
// opened by a non-pushState browser.
this.fragment = fragment;
var loc = this.location;
// Transition from hashChange to pushState or vice versa if both are
// requested.
if (this._wantsHashChange && this._wantsPushState) {
// If we've started out with a hash-based route, but we're currently
// in a browser where it could be `pushState`-based instead...
if (this.atRoot() && loc.hash) {
this.fragment = this.getHash().replace(routeStripper, '');
this.history.replaceState({}, document.title, this.root + this.fragment);
}
}
if (!this.options.silent) return this.loadUrl();
},
// Disable Backbone.history, perhaps temporarily. Not useful in a real app,
// but possibly useful for unit testing Routers.
stop: function() {
window.removeEventListener('popstate', this.checkUrl);
window.removeEventListener('hashchange', this.checkUrl);
History.started = false;
},
// Add a route to be tested when the fragment changes. Routes added later
// may override previous routes.
route: function(route, callback) {
this.handlers.unshift({route: route, callback: callback});
},
// Checks the current URL to see if it has changed, and if it has,
// calls `loadUrl`.
checkUrl: function() {
var current = this.getFragment();
if (current === this.fragment) return false;
this.loadUrl();
},
// Attempt to load the current URL fragment. If a route succeeds with a
// match, returns `true`. If no defined routes matches the fragment,
// returns `false`.
loadUrl: function(fragment) {
fragment = this.fragment = this.getFragment(fragment);
return this.handlers.some(function(handler) {
if (handler.route.test(fragment)) {
handler.callback(fragment);
return true;
}
});
},
// Save a fragment into the hash history, or replace the URL state if the
// 'replace' option is passed. You are responsible for properly URL-encoding
// the fragment in advance.
//
// The options object can contain `trigger: true` if you wish to have the
// route callback be fired (not usually desirable), or `replace: true`, if
// you wish to modify the current URL without adding an entry to the history.
navigate: function(fragment, options) {
if (!History.started) return false;
if (!options || options === true) options = {trigger: !!options};
var url = this.root + (fragment = this.getFragment(fragment || ''));
// Strip the hash for matching.
fragment = fragment.replace(pathStripper, '');
if (this.fragment === fragment) return;
this.fragment = fragment;
// Don't include a trailing slash on the root.
if (fragment === '' && url !== '/') url = url.slice(0, -1);
// If we're using pushState we use it to set the fragment as a real URL.
if (this._wantsPushState) {
this.history[options.replace ? 'replaceState' : 'pushState']({}, document.title, url);
// If hash changes haven't been explicitly disabled, update the hash
// fragment to store history.
} else if (this._wantsHashChange) {
this._updateHash(this.location, fragment, options.replace);
// If you've told us that you explicitly don't want fallback hashchange-
// based history, then `navigate` becomes a page refresh.
} else {
return this.location.assign(url);
}
if (options.trigger) return this.loadUrl(fragment);
},
// Update the hash location, either replacing the current entry, or adding
// a new one to the browser history.
_updateHash: function(location, fragment, replace) {
if (replace) {
var href = location.href.replace(/(javascript:|#).*$/, '');
location.replace(href + '#' + fragment);
} else {
// Some browsers require that `hash` contains a leading #.
location.hash = '#' + fragment;
}
}
});
// !!!
// Init.
['Model', 'Collection', 'Router', 'View', 'History'].forEach(function(name) {
var item = Backbone[name];
if (item) item.extend = Backbone.extend;
});
// Allow the `Backbone` object to serve as a global event bus, for folks who
// want global "pubsub" in a convenient place.
_.extend(Backbone, Events);
// Create the default Backbone.history if the History module is included.
if (History) Backbone.history = new History();
return Backbone;
});
|
src/propTypes/StyleSheetPropType.js | omeid/react-native-mock | /**
* https://github.com/facebook/react-native/blob/master/Libraries/StyleSheet/StyleSheetPropType.js
*/
import React from 'react';
import flattenStyle from './flattenStyle';
const { PropTypes } = React;
function StyleSheetPropType(shape) {
var shapePropType = PropTypes.shape(shape);
return function (props, propName, componentName, location) {
var newProps = props;
if (props[propName]) {
// Just make a dummy prop object with only the flattened style
newProps = {};
newProps[propName] = flattenStyle(props[propName]);
}
return shapePropType(newProps, propName, componentName, location);
};
}
module.exports = StyleSheetPropType;
|
modules/gui/src/app/home/body/process/recipe/mosaic/panels/aoi/eeTableSection.js | openforis/sepal | import {Form} from 'widget/form/form'
import {Layout} from 'widget/layout'
import {PreviewMap} from './previewMap'
import {RecipeActions} from '../../mosaicRecipe'
import {Subject, map, takeUntil} from 'rxjs'
import {compose} from 'compose'
import {msg} from 'translate'
import {selectFrom} from 'stateUtils'
import {withRecipe} from 'app/home/body/process/recipeContext'
import PropTypes from 'prop-types'
import React from 'react'
import _ from 'lodash'
import api from 'api'
const mapRecipeToProps = recipe => {
return {
columns: selectFrom(recipe, 'ui.eeTable.columns'),
rows: selectFrom(recipe, 'ui.eeTable.rows'),
overlay: selectFrom(recipe, 'layers.overlay'),
featureLayerSources: selectFrom(recipe, 'ui.featureLayerSources'),
}
}
class _EETableSection extends React.Component {
constructor(props) {
super(props)
const {recipeId} = props
this.eeTableChanged$ = new Subject()
this.eeTableColumnChanged$ = new Subject()
this.recipeActions = RecipeActions(recipeId)
}
reset() {
const {inputs: {eeTableColumn, eeTableRow}} = this.props
eeTableColumn.set('')
eeTableRow.set('')
this.recipeActions.setEETableColumns(null).dispatch()
this.recipeActions.setEETableRows(null).dispatch()
this.eeTableChanged$.next()
this.eeTableColumnChanged$.next()
}
render() {
const {allowWholeEETable, inputs: {eeTable}} = this.props
return (
<Layout>
<Form.Input
label={msg('process.mosaic.panel.areaOfInterest.form.eeTable.eeTable.label')}
autoFocus
input={eeTable}
placeholder={msg('process.mosaic.panel.areaOfInterest.form.eeTable.eeTable.placeholder')}
spellCheck={false}
onChangeDebounced={tableId => tableId && this.loadColumns(tableId)}
errorMessage
busyMessage={this.props.stream('LOAD_EE_TABLE_COLUMNS').active && msg('widget.loading')}
/>
{allowWholeEETable ? this.renderFilterOptions() : null}
{this.renderColumnValueRowInputs()}
<PreviewMap/>
</Layout>
)
}
renderFilterOptions() {
const {inputs: {eeTableRowSelection}} = this.props
const options = [
{
value: 'FILTER',
label: msg('process.mosaic.panel.areaOfInterest.form.eeTable.eeTableRowSelection.FILTER')
},
{
value: 'INCLUDE_ALL',
label: msg('process.mosaic.panel.areaOfInterest.form.eeTable.eeTableRowSelection.INCLUDE_ALL')
}
]
return (
<Form.Buttons
input={eeTableRowSelection}
label={msg('process.mosaic.panel.areaOfInterest.form.eeTable.eeTableRowSelection.label')}
options={options}
disabled={!this.hasColumns()}
/>
)
}
renderColumnValueRowInputs() {
const {
stream,
columns,
rows,
inputs: {eeTable, eeTableRowSelection, eeTableColumn, eeTableRow, buffer}
} = this.props
const columnState = stream('LOAD_EE_TABLE_COLUMNS').active
? 'loading'
: this.hasColumns()
? 'loaded'
: 'noEETable'
const rowState = stream('LOAD_EE_TABLE_ROWS').active
? 'loading'
: rows
? (rows.length === 0 ? 'noRows' : 'loaded')
: eeTable.value
? 'noColumn'
: 'noEETable'
const eeTableColumnDisabled = !this.hasColumns() || eeTableRowSelection.value === 'INCLUDE_ALL'
const eeTableRowDisabled = !rows || eeTableColumnDisabled
return (
<React.Fragment>
<Form.Combo
label={msg('process.mosaic.panel.areaOfInterest.form.eeTable.column.label')}
input={eeTableColumn}
busyMessage={stream('LOAD_EE_TABLE_ROWS').active && msg('widget.loading')}
disabled={eeTableColumnDisabled}
placeholder={msg(`process.mosaic.panel.areaOfInterest.form.eeTable.column.placeholder.${columnState}`)}
options={(columns || []).map(column => ({value: column, label: column}))}
onChange={column => {
eeTableRow.set('')
this.recipeActions.setEETableRows(null).dispatch()
this.eeTableColumnChanged$.next()
this.loadDistinctColumnValues(column.value)
}}
errorMessage
/>
<Form.Combo
label={msg('process.mosaic.panel.areaOfInterest.form.eeTable.row.label')}
input={eeTableRow}
disabled={eeTableRowDisabled}
placeholder={msg(`process.mosaic.panel.areaOfInterest.form.eeTable.row.placeholder.${rowState}`)}
options={(rows || []).map(value => ({value, label: value}))}
errorMessage
/>
<Form.Slider
label={msg('process.mosaic.panel.areaOfInterest.form.buffer.label')}
tooltip={msg('process.mosaic.panel.areaOfInterest.form.buffer.tooltip')}
info={buffer => msg('process.mosaic.panel.areaOfInterest.form.buffer.info', {buffer})}
input={buffer}
minValue={0}
maxValue={100}
scale={'log'}
ticks={[0, 1, 2, 5, 10, 20, 50, 100]}
snap
range='none'
/>
</React.Fragment>
)
}
loadColumns(eeTableId) {
this.props.stream('LOAD_EE_TABLE_COLUMNS',
api.gee.loadEETableColumns$(eeTableId).pipe(
takeUntil(this.eeTableChanged$)),
columns => this.recipeActions.setEETableColumns(columns).dispatch(),
error =>
this.props.inputs.eeTable.setInvalid(
error.response
? msg(error.response.messageKey, error.response.messageArgs, error.response.defaultMessage)
: msg('eeTable.failedToLoad')
)
)
}
loadDistinctColumnValues(column) {
this.props.stream('LOAD_EE_TABLE_ROWS',
api.gee.loadEETableColumnValues$(this.props.inputs.eeTable.value, column).pipe(
map(values =>
this.recipeActions.setEETableRows(values).dispatch()
),
takeUntil(this.eeTableColumnChanged$),
takeUntil(this.eeTableChanged$)
)
)
}
hasColumns() {
const {columns} = this.props
return columns && columns.length > 0
}
componentDidMount() {
const {inputs: {eeTable, eeTableColumn}} = this.props
if (eeTable.value) {
this.loadColumns(eeTable.value)
}
if (eeTableColumn.value) {
this.loadDistinctColumnValues(eeTableColumn.value)
}
this.update()
}
componentDidUpdate(prevProps) {
const {inputs: {eeTableRowSelection}} = this.props
if (!prevProps || prevProps.inputs !== this.props.inputs) {
this.update()
}
if (!eeTableRowSelection.value) {
eeTableRowSelection.set('FILTER')
}
}
update() {
const {inputs: {buffer}} = this.props
this.setOverlay()
if (!_.isFinite(buffer.value)) {
buffer.set(0)
}
}
setOverlay() {
const {stream, inputs: {eeTable, eeTableColumn, eeTableRow, buffer}} = this.props
if (!eeTableRow.value) {
return
}
const aoi = {
type: 'EE_TABLE',
id: eeTable.value,
keyColumn: eeTableColumn.value,
key: eeTableRow.value,
buffer: buffer.value
}
const {overlay: prevOverlay, featureLayerSources, recipeActionBuilder} = this.props
const aoiLayerSource = featureLayerSources.find(({type}) => type === 'Aoi')
const overlay = {
featureLayers: [
{
sourceId: aoiLayerSource.id,
layerConfig: {aoi}
}
]
}
if (!_.isEqual(overlay, prevOverlay) && !stream('LOAD_BOUNDS').active) {
recipeActionBuilder('DELETE_MAP_OVERLAY_BOUNDS')
.del('ui.overlay.bounds')
.dispatch()
stream('LOAD_BOUNDS',
api.gee.aoiBounds$(aoi),
bounds => {
recipeActionBuilder('SET_MAP_OVERLAY_BOUNDS')
.set('ui.overlay.bounds', bounds)
.dispatch()
}
)
recipeActionBuilder('SET_MAP_OVERLAY')
.set('layers.overlay', overlay)
.dispatch()
}
}
componentWillUnmount() {
const {recipeActionBuilder} = this.props
recipeActionBuilder('REMOVE_MAP_OVERLAY')
.del('layers.overlay')
.dispatch()
}
}
export const EETableSection = compose(
_EETableSection,
withRecipe(mapRecipeToProps)
)
EETableSection.propTypes = {
inputs: PropTypes.object.isRequired,
recipeId: PropTypes.string.isRequired,
allowWholeEETable: PropTypes.any,
layerIndex: PropTypes.number
}
|
httpdocs/theme/react/hooks-app/opendesktop-home/components/ProductsMyGitContainer.js | KDE/ocs-webserver | import React, { Component } from 'react';
import ProductGit from './ProductGit';
class ProductsMyGitContainer extends React.Component {
constructor(props){
super(props);
this.gitUrl = `/json/gitlab?username=${props.user.username}`;
this.gitUserUrl = '/json/gitlabfetchuser?username=';
this.state = {items:[],user:null};
}
componentDidMount() {
fetch(this.gitUrl)
.then(response => response.json())
.then(data => {
if(data.user)
{
this.setState({user:data.user});
}
if(data.projects)
{
data.projects.map((fi,index) => {
fi.user_avatar_url = data.user.avatar_url;
});
this.setState({items:data.projects});
}
});
}
render(){
let container;
container = <div> <h1> Projects </h1></div>
if (this.state.items){
const items = this.state.items.sort(function(a,b){
return new Date(b.created_at) - new Date(a.created_at);
});
const products = items.map((product,index) => (
<li key={index}>
<ProductGit product={product}/>
</li>
));
container = <ul>{products}</ul>
}
return (
<div className="panelContainer">
<div className="title"> Projects</div>
{container}
</div>
)
}
}
export default ProductsMyGitContainer;
|
lib/ui/src/settings/about.stories.js | storybooks/storybook | import React from 'react';
import { storiesOf } from '@storybook/react';
import { actions as createActions } from '@storybook/addon-actions';
import { AboutScreen } from './about';
const info = {
plain: `- upgrade webpack & babel to latest\n- new addParameters and third argument to .add to pass data to addons\n- added the ability to theme storybook\n- improved ui for mobile devices\n- improved performance of addon-knobs`,
};
const actions = createActions('onClose');
storiesOf('UI/Settings/AboutScreen', module)
.addParameters({
component: AboutScreen,
})
.addDecorator((storyFn) => (
<div
style={{
position: 'relative',
height: '100vh',
width: '100vw',
}}
>
{storyFn()}
</div>
))
.add('up to date', () => (
<AboutScreen latest={{ version: '5.0.0', info }} current={{ version: '5.0.0' }} {...actions} />
))
.add('old version race condition', () => (
<AboutScreen latest={{ version: '5.0.0', info }} current={{ version: '5.0.3' }} {...actions} />
))
.add('new version required', () => (
<AboutScreen latest={{ version: '5.0.3', info }} current={{ version: '5.0.0' }} {...actions} />
))
.add('failed to fetch new version', () => (
<AboutScreen current={{ version: '5.0.0' }} {...actions} />
));
|
ajax/libs/material-ui/5.0.0-alpha.37/node/internal/svg-icons/StarBorder.min.js | cdnjs/cdnjs | "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var React=_interopRequireWildcard(require("react")),_createSvgIcon=_interopRequireDefault(require("../../utils/createSvgIcon")),_jsxRuntime=require("react/jsx-runtime");function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,t=new WeakMap;return(_getRequireWildcardCache=function(e){return e?t:r})(e)}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};r=_getRequireWildcardCache(r);if(r&&r.has(e))return r.get(e);var t,u,i={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(t in e)"default"!==t&&Object.prototype.hasOwnProperty.call(e,t)&&((u=a?Object.getOwnPropertyDescriptor(e,t):null)&&(u.get||u.set)?Object.defineProperty(i,t,u):i[t]=e[t]);return i.default=e,r&&r.set(e,i),i}var _default=(0,_createSvgIcon.default)((0,_jsxRuntime.jsx)("path",{d:"M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"}),"StarBorder");exports.default=_default; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.