path
stringlengths 5
300
| repo_name
stringlengths 6
76
| content
stringlengths 26
1.05M
|
|---|---|---|
stories/RadioGroup/ExamplevAlign.js
|
skyiea/wix-style-react
|
import React from 'react';
import RadioGroup from 'wix-style-react/RadioGroup';
const style = {
display: 'inline-block',
padding: '0 5px',
width: '200px',
lineHeight: '22px'
};
export default () =>
<div>
<div className="ltr" style={style}>vAlign center
<RadioGroup value={1} vAlign="center" >
<RadioGroup.Radio value={1}><div>Option 1</div><small>best option</small></RadioGroup.Radio>
<RadioGroup.Radio value={2}><div>Option 2</div><small>Also pretty good option</small></RadioGroup.Radio>
</RadioGroup>
</div>
<div className="ltr" style={style}>vAlign top
<RadioGroup value={1} vAlign="top" >
<RadioGroup.Radio value={1}><div>Option 1</div><small>best option</small></RadioGroup.Radio>
<RadioGroup.Radio value={2}><div>Option 2</div><small>Also pretty good option</small></RadioGroup.Radio>
</RadioGroup>
</div>
</div>;
|
app/javascript/mastodon/components/avatar_overlay.js
|
nonoz/mastodon
|
import React from 'react';
import PropTypes from 'prop-types';
export default class AvatarOverlay extends React.PureComponent {
static propTypes = {
staticSrc: PropTypes.string.isRequired,
overlaySrc: PropTypes.string.isRequired,
};
render() {
const { staticSrc, overlaySrc } = this.props;
const baseStyle = {
backgroundImage: `url(${staticSrc})`,
};
const overlayStyle = {
backgroundImage: `url(${overlaySrc})`,
};
return (
<div className='account__avatar-overlay'>
<div className='account__avatar-overlay-base' style={baseStyle} />
<div className='account__avatar-overlay-overlay' style={overlayStyle} />
</div>
);
}
}
|
node_modules/react-icons/fa/terminal.js
|
bengimbel/Solstice-React-Contacts-Project
|
import React from 'react'
import Icon from 'react-icon-base'
const FaTerminal = props => (
<Icon viewBox="0 0 40 40" {...props}>
<g><path d="m14.6 21.9l-10.4 10.4q-0.3 0.3-0.6 0.3t-0.5-0.3l-1.1-1.1q-0.2-0.2-0.2-0.5t0.2-0.5l8.8-8.8-8.8-8.7q-0.2-0.3-0.2-0.6t0.2-0.5l1.1-1.1q0.3-0.2 0.5-0.2t0.6 0.2l10.4 10.4q0.2 0.2 0.2 0.5t-0.2 0.5z m24 10.2v1.5q0 0.3-0.2 0.5t-0.5 0.2h-21.4q-0.3 0-0.5-0.2t-0.2-0.5v-1.5q0-0.3 0.2-0.5t0.5-0.2h21.4q0.3 0 0.5 0.2t0.2 0.5z"/></g>
</Icon>
)
export default FaTerminal
|
boilerplates/basic/src/index.js
|
flicker85/react-redux-saga-cli
|
// import 'babel-polyfill';
import React from 'react';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import { Router, browserHistory } from 'react-router';
import { syncHistoryWithStore } from 'react-router-redux';
import configureStore from './store';
import createRoutes from './routes';
const initialState = {};
const store = configureStore(initialState, browserHistory);
const history = syncHistoryWithStore(browserHistory, store);
const routes = createRoutes(store);
render(
<Provider store={store}>
<Router history={ history } routes={ routes } />
</Provider>,
document.getElementById('root')
);
|
ajax/libs/react-cookie/0.2.4/react-cookie.min.js
|
cdnjs/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(require,module,exports){var cookie=require("cookie");var _rawCookies={};var _cookies={};if(typeof document!=="undefined"){setRawCookie(document.cookie)}function load(name,doNotParse){if(doNotParse){return _rawCookies[name]}return _cookies[name]}function save(name,val,opt){_cookies[name]=val;_rawCookies[name]=val;if(typeof val==="object"){_rawCookies[name]=JSON.stringify(val)}if(typeof document!=="undefined"){document.cookie=cookie.serialize(name,_rawCookies[name],opt)}}function remove(name){delete _rawCookies[name];delete _cookies[name];if(typeof document!=="undefined"){document.cookie=name+"=; expires=Thu, 01 Jan 1970 00:00:01 GMT;"}}function setRawCookie(rawCookie){if(!rawCookie){return}var rawCookies=cookie.parse(rawCookie);for(var key in rawCookies){_rawCookies[key]=rawCookies[key];try{_cookies[key]=JSON.parse(rawCookies[key])}catch(e){_cookies[key]=rawCookies[key]}}}var reactCookie={load:load,save:save,remove:remove,setRawCookie:setRawCookie};if(typeof window!=="undefined"){window["reactCookie"]=reactCookie}module.exports=reactCookie},{cookie:2}],2:[function(require,module,exports){var serialize=function(name,val,opt){opt=opt||{};var enc=opt.encode||encode;var pairs=[name+"="+enc(val)];if(null!=opt.maxAge){var maxAge=opt.maxAge-0;if(isNaN(maxAge))throw new Error("maxAge should be a Number");pairs.push("Max-Age="+maxAge)}if(opt.domain)pairs.push("Domain="+opt.domain);if(opt.path)pairs.push("Path="+opt.path);if(opt.expires)pairs.push("Expires="+opt.expires.toUTCString());if(opt.httpOnly)pairs.push("HttpOnly");if(opt.secure)pairs.push("Secure");return pairs.join("; ")};var parse=function(str,opt){opt=opt||{};var obj={};var pairs=str.split(/; */);var dec=opt.decode||decode;pairs.forEach(function(pair){var eq_idx=pair.indexOf("=");if(eq_idx<0){return}var key=pair.substr(0,eq_idx).trim();var val=pair.substr(++eq_idx,pair.length).trim();if('"'==val[0]){val=val.slice(1,-1)}if(undefined==obj[key]){try{obj[key]=dec(val)}catch(e){obj[key]=val}}});return obj};var encode=encodeURIComponent;var decode=decodeURIComponent;module.exports.serialize=serialize;module.exports.parse=parse},{}]},{},[1]);
|
src/docs/examples/HelloWorld/ExampleHelloWorld.js
|
thomashoggard/ps-react-tom
|
import React from 'react';
import HelloWorld from 'ps-react-tom/lib/HelloWorld';
/** Custom Message */
export default function ExampleHelloWorld() {
return <HelloWorld message="Pluralsight viewers!" />
}
|
test/components/Card/Card.spec.js
|
guidiego/webpack-todolist
|
import React from 'react';
import sd from 'skin-deep';
import { Map } from 'immutable';
import Card from 'components/Card/Card';
import CardLabels from 'components/Card/CardLabels';
import CardTitle from 'components/Card/CardTitle';
import CardOptionsButton from 'components/Card/CardOptionsButton';
import CardDate from 'components/Card/CardDate';
import equalJSX from 'chai-equal-jsx';
chai.use(equalJSX);
describe('(components/Card - Card)', () => {
it('Should render Card component with description', () => {
const task = Map({
id: 0,
title: 'Bla bla bla bla',
labels: [
{color: 'red', string: 'atention'}
],
date: new Date(),
description: 'meeeeeeeee'
});
const noRef = () => {};
const tree = sd.shallowRender(<Card task={task} onClick={noRef} />);
const vdom = tree.getRenderOutput();
expect(vdom).to.equalJSX(
<div onClick={noRef} className='card'>
<CardLabels labelList={task.get('labels')} />
<CardTitle title={task.get('title')} />
<CardOptionsButton />
<div className='card-info row'>
<div className='col-sm-3'>
<i className='glyphicon glyphicon-list-alt' />
</div>
<div className='col-sm-9 text-right'>
<CardDate date={task.get('date')} />
</div>
</div>
</div>
);
});
it('Should render Card component without description', () => {
const task = Map({
id: 0,
title: 'Bla bla bla bla',
labels: [
{color: 'red', string: 'atention'}
],
date: new Date(),
description: undefined
});
const noRef = () => {};
const tree = sd.shallowRender(<Card task={task} onClick={noRef} />);
const vdom = tree.getRenderOutput();
expect(vdom).to.equalJSX(
<div onClick={noRef} className='card'>
<CardLabels labelList={task.get('labels')} />
<CardTitle title={task.get('title')} />
<CardOptionsButton />
<div className='card-info row'>
<div className='col-sm-3'>
</div>
<div className='col-sm-9 text-right'>
<CardDate date={task.get('date')} />
</div>
</div>
</div>
);
});
});
|
frontend/src/components/recipes/list/ListPres.js
|
jf248/scrape-the-plate
|
import React from 'react';
import * as Mui from '@material-ui/core';
import {
AppContent,
AppSecondaryToolbar,
AppFabButton,
} from 'components/frame';
import { ListItem, Pagination } from './components';
const styles = theme => ({
list: {
display: 'flex',
flexWrap: 'wrap',
},
content: {
justifyContent: 'center',
},
rightButton: {
marginLeft: theme.spacing.unit,
},
});
class ListPres extends React.PureComponent {
static defaultProps = {
ids: [],
};
render() {
const { classes, ids, page, perPage, push, setPage, total } = this.props;
if (ids.length === 0) {
return (
<AppContent className={classes.content}>
<Mui.Typography variant={'caption'}>
{'No recipes found.'}
</Mui.Typography>
</AppContent>
);
}
return (
<React.Fragment>
<AppSecondaryToolbar>
<Pagination
perPage={perPage}
total={total}
page={page}
onChangePage={setPage}
/>
</AppSecondaryToolbar>
<AppContent className={classes.content}>
<div className={classes.list}>
{ids.map(id => (
<ListItem {...{ key: id, id }} />
))}
</div>
<AppFabButton
extendedText={'Add a recipe'}
variant={'add'}
onClick={() => push(`/recipes/create`)}
tooltipTitle={'Add a recipe'}
/>
</AppContent>
</React.Fragment>
);
}
}
export default Mui.withStyles(styles)(ListPres);
|
ajax/libs/yui/3.11.0/scrollview-base/scrollview-base-coverage.js
|
amoyeh/cdnjs
|
if (typeof __coverage__ === 'undefined') { __coverage__ = {}; }
if (!__coverage__['build/scrollview-base/scrollview-base.js']) {
__coverage__['build/scrollview-base/scrollview-base.js'] = {"path":"build/scrollview-base/scrollview-base.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0,"110":0,"111":0,"112":0,"113":0,"114":0,"115":0,"116":0,"117":0,"118":0,"119":0,"120":0,"121":0,"122":0,"123":0,"124":0,"125":0,"126":0,"127":0,"128":0,"129":0,"130":0,"131":0,"132":0,"133":0,"134":0,"135":0,"136":0,"137":0,"138":0,"139":0,"140":0,"141":0,"142":0,"143":0,"144":0,"145":0,"146":0,"147":0,"148":0,"149":0,"150":0,"151":0,"152":0,"153":0,"154":0,"155":0,"156":0,"157":0,"158":0,"159":0,"160":0,"161":0,"162":0,"163":0,"164":0,"165":0,"166":0,"167":0,"168":0,"169":0,"170":0,"171":0,"172":0,"173":0,"174":0,"175":0,"176":0,"177":0,"178":0,"179":0,"180":0,"181":0,"182":0,"183":0,"184":0,"185":0,"186":0,"187":0,"188":0,"189":0,"190":0,"191":0,"192":0,"193":0,"194":0,"195":0,"196":0,"197":0,"198":0,"199":0,"200":0,"201":0,"202":0,"203":0,"204":0,"205":0,"206":0,"207":0,"208":0,"209":0,"210":0,"211":0,"212":0,"213":0,"214":0,"215":0,"216":0,"217":0,"218":0,"219":0,"220":0,"221":0,"222":0,"223":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0],"18":[0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0],"25":[0,0],"26":[0,0],"27":[0,0],"28":[0,0],"29":[0,0],"30":[0,0],"31":[0,0],"32":[0,0],"33":[0,0],"34":[0,0],"35":[0,0],"36":[0,0],"37":[0,0],"38":[0,0],"39":[0,0],"40":[0,0],"41":[0,0],"42":[0,0],"43":[0,0],"44":[0,0],"45":[0,0],"46":[0,0],"47":[0,0],"48":[0,0],"49":[0,0],"50":[0,0],"51":[0,0,0],"52":[0,0],"53":[0,0],"54":[0,0],"55":[0,0],"56":[0,0],"57":[0,0],"58":[0,0],"59":[0,0],"60":[0,0],"61":[0,0],"62":[0,0],"63":[0,0],"64":[0,0,0],"65":[0,0],"66":[0,0],"67":[0,0],"68":[0,0],"69":[0,0],"70":[0,0],"71":[0,0],"72":[0,0],"73":[0,0],"74":[0,0],"75":[0,0,0,0,0,0],"76":[0,0],"77":[0,0],"78":[0,0],"79":[0,0],"80":[0,0],"81":[0,0],"82":[0,0],"83":[0,0],"84":[0,0],"85":[0,0],"86":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":46}}},"2":{"name":"(anonymous_2)","line":49,"loc":{"start":{"line":49,"column":17},"end":{"line":49,"column":42}}},"3":{"name":"ScrollView","line":62,"loc":{"start":{"line":62,"column":0},"end":{"line":62,"column":22}}},"4":{"name":"(anonymous_4)","line":168,"loc":{"start":{"line":168,"column":17},"end":{"line":168,"column":29}}},"5":{"name":"(anonymous_5)","line":189,"loc":{"start":{"line":189,"column":12},"end":{"line":189,"column":24}}},"6":{"name":"(anonymous_6)","line":237,"loc":{"start":{"line":237,"column":16},"end":{"line":237,"column":28}}},"7":{"name":"(anonymous_7)","line":265,"loc":{"start":{"line":265,"column":15},"end":{"line":265,"column":31}}},"8":{"name":"(anonymous_8)","line":285,"loc":{"start":{"line":285,"column":16},"end":{"line":285,"column":33}}},"9":{"name":"(anonymous_9)","line":308,"loc":{"start":{"line":308,"column":21},"end":{"line":308,"column":43}}},"10":{"name":"(anonymous_10)","line":330,"loc":{"start":{"line":330,"column":12},"end":{"line":330,"column":24}}},"11":{"name":"(anonymous_11)","line":374,"loc":{"start":{"line":374,"column":20},"end":{"line":374,"column":32}}},"12":{"name":"(anonymous_12)","line":417,"loc":{"start":{"line":417,"column":25},"end":{"line":417,"column":37}}},"13":{"name":"(anonymous_13)","line":459,"loc":{"start":{"line":459,"column":16},"end":{"line":459,"column":34}}},"14":{"name":"(anonymous_14)","line":476,"loc":{"start":{"line":476,"column":16},"end":{"line":476,"column":28}}},"15":{"name":"(anonymous_15)","line":499,"loc":{"start":{"line":499,"column":14},"end":{"line":499,"column":54}}},"16":{"name":"(anonymous_16)","line":579,"loc":{"start":{"line":579,"column":16},"end":{"line":579,"column":32}}},"17":{"name":"(anonymous_17)","line":599,"loc":{"start":{"line":599,"column":14},"end":{"line":599,"column":35}}},"18":{"name":"(anonymous_18)","line":616,"loc":{"start":{"line":616,"column":17},"end":{"line":616,"column":29}}},"19":{"name":"(anonymous_19)","line":641,"loc":{"start":{"line":641,"column":25},"end":{"line":641,"column":38}}},"20":{"name":"(anonymous_20)","line":707,"loc":{"start":{"line":707,"column":20},"end":{"line":707,"column":33}}},"21":{"name":"(anonymous_21)","line":749,"loc":{"start":{"line":749,"column":23},"end":{"line":749,"column":36}}},"22":{"name":"(anonymous_22)","line":804,"loc":{"start":{"line":804,"column":12},"end":{"line":804,"column":25}}},"23":{"name":"(anonymous_23)","line":837,"loc":{"start":{"line":837,"column":17},"end":{"line":837,"column":63}}},"24":{"name":"(anonymous_24)","line":900,"loc":{"start":{"line":900,"column":18},"end":{"line":900,"column":30}}},"25":{"name":"(anonymous_25)","line":920,"loc":{"start":{"line":920,"column":17},"end":{"line":920,"column":30}}},"26":{"name":"(anonymous_26)","line":970,"loc":{"start":{"line":970,"column":20},"end":{"line":970,"column":36}}},"27":{"name":"(anonymous_27)","line":993,"loc":{"start":{"line":993,"column":15},"end":{"line":993,"column":27}}},"28":{"name":"(anonymous_28)","line":1025,"loc":{"start":{"line":1025,"column":24},"end":{"line":1025,"column":37}}},"29":{"name":"(anonymous_29)","line":1062,"loc":{"start":{"line":1062,"column":23},"end":{"line":1062,"column":36}}},"30":{"name":"(anonymous_30)","line":1073,"loc":{"start":{"line":1073,"column":26},"end":{"line":1073,"column":39}}},"31":{"name":"(anonymous_31)","line":1085,"loc":{"start":{"line":1085,"column":22},"end":{"line":1085,"column":35}}},"32":{"name":"(anonymous_32)","line":1096,"loc":{"start":{"line":1096,"column":22},"end":{"line":1096,"column":35}}},"33":{"name":"(anonymous_33)","line":1107,"loc":{"start":{"line":1107,"column":21},"end":{"line":1107,"column":33}}},"34":{"name":"(anonymous_34)","line":1118,"loc":{"start":{"line":1118,"column":21},"end":{"line":1118,"column":33}}},"35":{"name":"(anonymous_35)","line":1140,"loc":{"start":{"line":1140,"column":17},"end":{"line":1140,"column":32}}},"36":{"name":"(anonymous_36)","line":1161,"loc":{"start":{"line":1161,"column":17},"end":{"line":1161,"column":31}}},"37":{"name":"(anonymous_37)","line":1179,"loc":{"start":{"line":1179,"column":17},"end":{"line":1179,"column":31}}},"38":{"name":"(anonymous_38)","line":1191,"loc":{"start":{"line":1191,"column":17},"end":{"line":1191,"column":31}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":1456,"column":113}},"2":{"start":{"line":11,"column":0},"end":{"line":51,"column":6}},"3":{"start":{"line":50,"column":8},"end":{"line":50,"column":49}},"4":{"start":{"line":62,"column":0},"end":{"line":64,"column":1}},"5":{"start":{"line":63,"column":4},"end":{"line":63,"column":61}},"6":{"start":{"line":66,"column":0},"end":{"line":1454,"column":3}},"7":{"start":{"line":169,"column":8},"end":{"line":169,"column":22}},"8":{"start":{"line":172,"column":8},"end":{"line":172,"column":38}},"9":{"start":{"line":173,"column":8},"end":{"line":173,"column":37}},"10":{"start":{"line":176,"column":8},"end":{"line":176,"column":33}},"11":{"start":{"line":177,"column":8},"end":{"line":177,"column":37}},"12":{"start":{"line":178,"column":8},"end":{"line":178,"column":48}},"13":{"start":{"line":179,"column":8},"end":{"line":179,"column":49}},"14":{"start":{"line":180,"column":8},"end":{"line":180,"column":52}},"15":{"start":{"line":190,"column":8},"end":{"line":190,"column":22}},"16":{"start":{"line":193,"column":8},"end":{"line":193,"column":37}},"17":{"start":{"line":194,"column":8},"end":{"line":194,"column":35}},"18":{"start":{"line":195,"column":8},"end":{"line":195,"column":33}},"19":{"start":{"line":198,"column":8},"end":{"line":198,"column":24}},"20":{"start":{"line":201,"column":8},"end":{"line":203,"column":9}},"21":{"start":{"line":202,"column":12},"end":{"line":202,"column":44}},"22":{"start":{"line":206,"column":8},"end":{"line":208,"column":9}},"23":{"start":{"line":207,"column":12},"end":{"line":207,"column":60}},"24":{"start":{"line":210,"column":8},"end":{"line":212,"column":9}},"25":{"start":{"line":211,"column":12},"end":{"line":211,"column":56}},"26":{"start":{"line":214,"column":8},"end":{"line":216,"column":9}},"27":{"start":{"line":215,"column":12},"end":{"line":215,"column":46}},"28":{"start":{"line":218,"column":8},"end":{"line":220,"column":9}},"29":{"start":{"line":219,"column":12},"end":{"line":219,"column":58}},"30":{"start":{"line":222,"column":8},"end":{"line":224,"column":9}},"31":{"start":{"line":223,"column":12},"end":{"line":223,"column":58}},"32":{"start":{"line":238,"column":8},"end":{"line":240,"column":50}},"33":{"start":{"line":243,"column":8},"end":{"line":253,"column":11}},"34":{"start":{"line":266,"column":8},"end":{"line":267,"column":24}},"35":{"start":{"line":270,"column":8},"end":{"line":270,"column":31}},"36":{"start":{"line":272,"column":8},"end":{"line":274,"column":9}},"37":{"start":{"line":273,"column":12},"end":{"line":273,"column":89}},"38":{"start":{"line":286,"column":8},"end":{"line":287,"column":24}},"39":{"start":{"line":290,"column":8},"end":{"line":290,"column":32}},"40":{"start":{"line":292,"column":8},"end":{"line":297,"column":9}},"41":{"start":{"line":293,"column":12},"end":{"line":293,"column":69}},"42":{"start":{"line":296,"column":12},"end":{"line":296,"column":39}},"43":{"start":{"line":309,"column":8},"end":{"line":310,"column":24}},"44":{"start":{"line":314,"column":8},"end":{"line":314,"column":37}},"45":{"start":{"line":317,"column":8},"end":{"line":320,"column":9}},"46":{"start":{"line":319,"column":12},"end":{"line":319,"column":71}},"47":{"start":{"line":331,"column":8},"end":{"line":336,"column":51}},"48":{"start":{"line":339,"column":8},"end":{"line":348,"column":9}},"49":{"start":{"line":342,"column":12},"end":{"line":345,"column":14}},"50":{"start":{"line":347,"column":12},"end":{"line":347,"column":37}},"51":{"start":{"line":351,"column":8},"end":{"line":351,"column":66}},"52":{"start":{"line":354,"column":8},"end":{"line":354,"column":41}},"53":{"start":{"line":357,"column":8},"end":{"line":357,"column":33}},"54":{"start":{"line":360,"column":8},"end":{"line":362,"column":9}},"55":{"start":{"line":361,"column":12},"end":{"line":361,"column":27}},"56":{"start":{"line":375,"column":8},"end":{"line":385,"column":17}},"57":{"start":{"line":388,"column":8},"end":{"line":391,"column":9}},"58":{"start":{"line":389,"column":12},"end":{"line":389,"column":46}},"59":{"start":{"line":390,"column":12},"end":{"line":390,"column":47}},"60":{"start":{"line":393,"column":8},"end":{"line":393,"column":48}},"61":{"start":{"line":394,"column":8},"end":{"line":394,"column":38}},"62":{"start":{"line":396,"column":8},"end":{"line":396,"column":29}},"63":{"start":{"line":397,"column":8},"end":{"line":402,"column":10}},"64":{"start":{"line":403,"column":8},"end":{"line":403,"column":43}},"65":{"start":{"line":405,"column":8},"end":{"line":405,"column":48}},"66":{"start":{"line":407,"column":8},"end":{"line":407,"column":20}},"67":{"start":{"line":418,"column":8},"end":{"line":430,"column":60}},"68":{"start":{"line":432,"column":8},"end":{"line":434,"column":9}},"69":{"start":{"line":433,"column":12},"end":{"line":433,"column":48}},"70":{"start":{"line":436,"column":8},"end":{"line":438,"column":9}},"71":{"start":{"line":437,"column":12},"end":{"line":437,"column":46}},"72":{"start":{"line":440,"column":8},"end":{"line":445,"column":11}},"73":{"start":{"line":460,"column":8},"end":{"line":460,"column":22}},"74":{"start":{"line":464,"column":8},"end":{"line":464,"column":43}},"75":{"start":{"line":465,"column":8},"end":{"line":465,"column":43}},"76":{"start":{"line":466,"column":8},"end":{"line":466,"column":43}},"77":{"start":{"line":467,"column":8},"end":{"line":467,"column":43}},"78":{"start":{"line":477,"column":8},"end":{"line":477,"column":22}},"79":{"start":{"line":479,"column":8},"end":{"line":484,"column":10}},"80":{"start":{"line":501,"column":8},"end":{"line":503,"column":9}},"81":{"start":{"line":502,"column":12},"end":{"line":502,"column":19}},"82":{"start":{"line":505,"column":8},"end":{"line":512,"column":22}},"83":{"start":{"line":515,"column":8},"end":{"line":515,"column":33}},"84":{"start":{"line":516,"column":8},"end":{"line":516,"column":42}},"85":{"start":{"line":517,"column":8},"end":{"line":517,"column":26}},"86":{"start":{"line":519,"column":8},"end":{"line":522,"column":9}},"87":{"start":{"line":520,"column":12},"end":{"line":520,"column":42}},"88":{"start":{"line":521,"column":12},"end":{"line":521,"column":24}},"89":{"start":{"line":524,"column":8},"end":{"line":527,"column":9}},"90":{"start":{"line":525,"column":12},"end":{"line":525,"column":42}},"91":{"start":{"line":526,"column":12},"end":{"line":526,"column":24}},"92":{"start":{"line":529,"column":8},"end":{"line":529,"column":46}},"93":{"start":{"line":531,"column":8},"end":{"line":534,"column":9}},"94":{"start":{"line":533,"column":12},"end":{"line":533,"column":80}},"95":{"start":{"line":537,"column":8},"end":{"line":567,"column":9}},"96":{"start":{"line":538,"column":12},"end":{"line":550,"column":13}},"97":{"start":{"line":539,"column":16},"end":{"line":539,"column":54}},"98":{"start":{"line":544,"column":16},"end":{"line":546,"column":17}},"99":{"start":{"line":545,"column":20},"end":{"line":545,"column":51}},"100":{"start":{"line":547,"column":16},"end":{"line":549,"column":17}},"101":{"start":{"line":548,"column":20},"end":{"line":548,"column":50}},"102":{"start":{"line":555,"column":12},"end":{"line":555,"column":39}},"103":{"start":{"line":556,"column":12},"end":{"line":556,"column":50}},"104":{"start":{"line":558,"column":12},"end":{"line":564,"column":13}},"105":{"start":{"line":559,"column":16},"end":{"line":559,"column":49}},"106":{"start":{"line":562,"column":16},"end":{"line":562,"column":44}},"107":{"start":{"line":563,"column":16},"end":{"line":563,"column":43}},"108":{"start":{"line":566,"column":12},"end":{"line":566,"column":50}},"109":{"start":{"line":581,"column":8},"end":{"line":581,"column":57}},"110":{"start":{"line":583,"column":8},"end":{"line":585,"column":9}},"111":{"start":{"line":584,"column":12},"end":{"line":584,"column":37}},"112":{"start":{"line":587,"column":8},"end":{"line":587,"column":20}},"113":{"start":{"line":600,"column":8},"end":{"line":605,"column":9}},"114":{"start":{"line":601,"column":12},"end":{"line":601,"column":62}},"115":{"start":{"line":603,"column":12},"end":{"line":603,"column":40}},"116":{"start":{"line":604,"column":12},"end":{"line":604,"column":39}},"117":{"start":{"line":617,"column":8},"end":{"line":617,"column":22}},"118":{"start":{"line":620,"column":8},"end":{"line":631,"column":9}},"119":{"start":{"line":621,"column":12},"end":{"line":621,"column":27}},"120":{"start":{"line":630,"column":12},"end":{"line":630,"column":35}},"121":{"start":{"line":643,"column":8},"end":{"line":645,"column":9}},"122":{"start":{"line":644,"column":12},"end":{"line":644,"column":25}},"123":{"start":{"line":647,"column":8},"end":{"line":652,"column":32}},"124":{"start":{"line":654,"column":8},"end":{"line":656,"column":9}},"125":{"start":{"line":655,"column":12},"end":{"line":655,"column":31}},"126":{"start":{"line":659,"column":8},"end":{"line":662,"column":9}},"127":{"start":{"line":660,"column":12},"end":{"line":660,"column":30}},"128":{"start":{"line":661,"column":12},"end":{"line":661,"column":29}},"129":{"start":{"line":665,"column":8},"end":{"line":665,"column":31}},"130":{"start":{"line":668,"column":8},"end":{"line":697,"column":10}},"131":{"start":{"line":708,"column":8},"end":{"line":718,"column":32}},"132":{"start":{"line":720,"column":8},"end":{"line":722,"column":9}},"133":{"start":{"line":721,"column":12},"end":{"line":721,"column":31}},"134":{"start":{"line":724,"column":8},"end":{"line":724,"column":48}},"135":{"start":{"line":725,"column":8},"end":{"line":725,"column":48}},"136":{"start":{"line":729,"column":8},"end":{"line":731,"column":9}},"137":{"start":{"line":730,"column":12},"end":{"line":730,"column":97}},"138":{"start":{"line":734,"column":8},"end":{"line":739,"column":9}},"139":{"start":{"line":735,"column":12},"end":{"line":735,"column":54}},"140":{"start":{"line":737,"column":13},"end":{"line":739,"column":9}},"141":{"start":{"line":738,"column":12},"end":{"line":738,"column":54}},"142":{"start":{"line":750,"column":8},"end":{"line":755,"column":18}},"143":{"start":{"line":757,"column":8},"end":{"line":759,"column":9}},"144":{"start":{"line":758,"column":12},"end":{"line":758,"column":31}},"145":{"start":{"line":762,"column":8},"end":{"line":762,"column":37}},"146":{"start":{"line":763,"column":8},"end":{"line":763,"column":37}},"147":{"start":{"line":766,"column":8},"end":{"line":766,"column":39}},"148":{"start":{"line":767,"column":8},"end":{"line":767,"column":42}},"149":{"start":{"line":770,"column":8},"end":{"line":794,"column":9}},"150":{"start":{"line":776,"column":12},"end":{"line":793,"column":13}},"151":{"start":{"line":778,"column":16},"end":{"line":778,"column":44}},"152":{"start":{"line":781,"column":16},"end":{"line":792,"column":17}},"153":{"start":{"line":782,"column":20},"end":{"line":782,"column":35}},"154":{"start":{"line":789,"column":20},"end":{"line":791,"column":21}},"155":{"start":{"line":790,"column":24},"end":{"line":790,"column":41}},"156":{"start":{"line":805,"column":8},"end":{"line":807,"column":9}},"157":{"start":{"line":806,"column":12},"end":{"line":806,"column":25}},"158":{"start":{"line":809,"column":8},"end":{"line":815,"column":45}},"159":{"start":{"line":818,"column":8},"end":{"line":820,"column":9}},"160":{"start":{"line":819,"column":12},"end":{"line":819,"column":38}},"161":{"start":{"line":823,"column":8},"end":{"line":825,"column":9}},"162":{"start":{"line":824,"column":12},"end":{"line":824,"column":68}},"163":{"start":{"line":839,"column":8},"end":{"line":864,"column":20}},"164":{"start":{"line":867,"column":8},"end":{"line":869,"column":9}},"165":{"start":{"line":868,"column":12},"end":{"line":868,"column":34}},"166":{"start":{"line":872,"column":8},"end":{"line":872,"column":61}},"167":{"start":{"line":875,"column":8},"end":{"line":897,"column":9}},"168":{"start":{"line":877,"column":12},"end":{"line":879,"column":13}},"169":{"start":{"line":878,"column":16},"end":{"line":878,"column":34}},"170":{"start":{"line":882,"column":12},"end":{"line":889,"column":13}},"171":{"start":{"line":883,"column":16},"end":{"line":883,"column":33}},"172":{"start":{"line":888,"column":16},"end":{"line":888,"column":31}},"173":{"start":{"line":895,"column":12},"end":{"line":895,"column":109}},"174":{"start":{"line":896,"column":12},"end":{"line":896,"column":42}},"175":{"start":{"line":901,"column":8},"end":{"line":901,"column":22}},"176":{"start":{"line":903,"column":8},"end":{"line":909,"column":9}},"177":{"start":{"line":905,"column":12},"end":{"line":905,"column":35}},"178":{"start":{"line":908,"column":12},"end":{"line":908,"column":33}},"179":{"start":{"line":921,"column":8},"end":{"line":927,"column":72}},"180":{"start":{"line":929,"column":8},"end":{"line":929,"column":80}},"181":{"start":{"line":935,"column":8},"end":{"line":958,"column":9}},"182":{"start":{"line":938,"column":12},"end":{"line":938,"column":35}},"183":{"start":{"line":941,"column":12},"end":{"line":941,"column":40}},"184":{"start":{"line":945,"column":12},"end":{"line":951,"column":13}},"185":{"start":{"line":947,"column":16},"end":{"line":947,"column":40}},"186":{"start":{"line":948,"column":16},"end":{"line":948,"column":38}},"187":{"start":{"line":954,"column":12},"end":{"line":954,"column":29}},"188":{"start":{"line":957,"column":12},"end":{"line":957,"column":31}},"189":{"start":{"line":971,"column":8},"end":{"line":981,"column":37}},"190":{"start":{"line":983,"column":8},"end":{"line":983,"column":118}},"191":{"start":{"line":994,"column":8},"end":{"line":1005,"column":41}},"192":{"start":{"line":1007,"column":8},"end":{"line":1015,"column":9}},"193":{"start":{"line":1008,"column":12},"end":{"line":1008,"column":71}},"194":{"start":{"line":1010,"column":13},"end":{"line":1015,"column":9}},"195":{"start":{"line":1011,"column":12},"end":{"line":1011,"column":71}},"196":{"start":{"line":1014,"column":12},"end":{"line":1014,"column":29}},"197":{"start":{"line":1026,"column":8},"end":{"line":1028,"column":9}},"198":{"start":{"line":1027,"column":12},"end":{"line":1027,"column":25}},"199":{"start":{"line":1030,"column":8},"end":{"line":1034,"column":30}},"200":{"start":{"line":1037,"column":8},"end":{"line":1037,"column":73}},"201":{"start":{"line":1040,"column":8},"end":{"line":1047,"column":9}},"202":{"start":{"line":1041,"column":12},"end":{"line":1041,"column":35}},"203":{"start":{"line":1042,"column":12},"end":{"line":1042,"column":48}},"204":{"start":{"line":1045,"column":12},"end":{"line":1045,"column":48}},"205":{"start":{"line":1046,"column":12},"end":{"line":1046,"column":35}},"206":{"start":{"line":1049,"column":8},"end":{"line":1049,"column":36}},"207":{"start":{"line":1050,"column":8},"end":{"line":1050,"column":34}},"208":{"start":{"line":1052,"column":8},"end":{"line":1052,"column":44}},"209":{"start":{"line":1063,"column":8},"end":{"line":1063,"column":34}},"210":{"start":{"line":1075,"column":8},"end":{"line":1075,"column":35}},"211":{"start":{"line":1086,"column":8},"end":{"line":1086,"column":31}},"212":{"start":{"line":1097,"column":8},"end":{"line":1097,"column":33}},"213":{"start":{"line":1108,"column":8},"end":{"line":1108,"column":35}},"214":{"start":{"line":1119,"column":8},"end":{"line":1119,"column":22}},"215":{"start":{"line":1121,"column":8},"end":{"line":1123,"column":9}},"216":{"start":{"line":1122,"column":12},"end":{"line":1122,"column":30}},"217":{"start":{"line":1143,"column":8},"end":{"line":1148,"column":9}},"218":{"start":{"line":1144,"column":12},"end":{"line":1147,"column":14}},"219":{"start":{"line":1164,"column":8},"end":{"line":1166,"column":9}},"220":{"start":{"line":1165,"column":12},"end":{"line":1165,"column":44}},"221":{"start":{"line":1168,"column":8},"end":{"line":1168,"column":19}},"222":{"start":{"line":1180,"column":8},"end":{"line":1180,"column":43}},"223":{"start":{"line":1192,"column":8},"end":{"line":1192,"column":43}}},"branchMap":{"1":{"line":78,"type":"cond-expr","locations":[{"start":{"line":78,"column":38},"end":{"line":78,"column":42}},{"start":{"line":78,"column":45},"end":{"line":78,"column":50}}]},"2":{"line":201,"type":"if","locations":[{"start":{"line":201,"column":8},"end":{"line":201,"column":8}},{"start":{"line":201,"column":8},"end":{"line":201,"column":8}}]},"3":{"line":206,"type":"if","locations":[{"start":{"line":206,"column":8},"end":{"line":206,"column":8}},{"start":{"line":206,"column":8},"end":{"line":206,"column":8}}]},"4":{"line":210,"type":"if","locations":[{"start":{"line":210,"column":8},"end":{"line":210,"column":8}},{"start":{"line":210,"column":8},"end":{"line":210,"column":8}}]},"5":{"line":214,"type":"if","locations":[{"start":{"line":214,"column":8},"end":{"line":214,"column":8}},{"start":{"line":214,"column":8},"end":{"line":214,"column":8}}]},"6":{"line":218,"type":"if","locations":[{"start":{"line":218,"column":8},"end":{"line":218,"column":8}},{"start":{"line":218,"column":8},"end":{"line":218,"column":8}}]},"7":{"line":222,"type":"if","locations":[{"start":{"line":222,"column":8},"end":{"line":222,"column":8}},{"start":{"line":222,"column":8},"end":{"line":222,"column":8}}]},"8":{"line":272,"type":"if","locations":[{"start":{"line":272,"column":8},"end":{"line":272,"column":8}},{"start":{"line":272,"column":8},"end":{"line":272,"column":8}}]},"9":{"line":292,"type":"if","locations":[{"start":{"line":292,"column":8},"end":{"line":292,"column":8}},{"start":{"line":292,"column":8},"end":{"line":292,"column":8}}]},"10":{"line":317,"type":"if","locations":[{"start":{"line":317,"column":8},"end":{"line":317,"column":8}},{"start":{"line":317,"column":8},"end":{"line":317,"column":8}}]},"11":{"line":339,"type":"if","locations":[{"start":{"line":339,"column":8},"end":{"line":339,"column":8}},{"start":{"line":339,"column":8},"end":{"line":339,"column":8}}]},"12":{"line":360,"type":"if","locations":[{"start":{"line":360,"column":8},"end":{"line":360,"column":8}},{"start":{"line":360,"column":8},"end":{"line":360,"column":8}}]},"13":{"line":388,"type":"if","locations":[{"start":{"line":388,"column":8},"end":{"line":388,"column":8}},{"start":{"line":388,"column":8},"end":{"line":388,"column":8}}]},"14":{"line":427,"type":"cond-expr","locations":[{"start":{"line":427,"column":32},"end":{"line":427,"column":67}},{"start":{"line":427,"column":70},"end":{"line":427,"column":71}}]},"15":{"line":428,"type":"cond-expr","locations":[{"start":{"line":428,"column":32},"end":{"line":428,"column":33}},{"start":{"line":428,"column":36},"end":{"line":428,"column":68}}]},"16":{"line":432,"type":"if","locations":[{"start":{"line":432,"column":8},"end":{"line":432,"column":8}},{"start":{"line":432,"column":8},"end":{"line":432,"column":8}}]},"17":{"line":432,"type":"binary-expr","locations":[{"start":{"line":432,"column":12},"end":{"line":432,"column":18}},{"start":{"line":432,"column":22},"end":{"line":432,"column":30}}]},"18":{"line":436,"type":"if","locations":[{"start":{"line":436,"column":8},"end":{"line":436,"column":8}},{"start":{"line":436,"column":8},"end":{"line":436,"column":8}}]},"19":{"line":436,"type":"binary-expr","locations":[{"start":{"line":436,"column":12},"end":{"line":436,"column":18}},{"start":{"line":436,"column":22},"end":{"line":436,"column":30}}]},"20":{"line":501,"type":"if","locations":[{"start":{"line":501,"column":8},"end":{"line":501,"column":8}},{"start":{"line":501,"column":8},"end":{"line":501,"column":8}}]},"21":{"line":515,"type":"binary-expr","locations":[{"start":{"line":515,"column":19},"end":{"line":515,"column":27}},{"start":{"line":515,"column":31},"end":{"line":515,"column":32}}]},"22":{"line":516,"type":"binary-expr","locations":[{"start":{"line":516,"column":17},"end":{"line":516,"column":23}},{"start":{"line":516,"column":27},"end":{"line":516,"column":41}}]},"23":{"line":517,"type":"binary-expr","locations":[{"start":{"line":517,"column":15},"end":{"line":517,"column":19}},{"start":{"line":517,"column":23},"end":{"line":517,"column":25}}]},"24":{"line":519,"type":"if","locations":[{"start":{"line":519,"column":8},"end":{"line":519,"column":8}},{"start":{"line":519,"column":8},"end":{"line":519,"column":8}}]},"25":{"line":524,"type":"if","locations":[{"start":{"line":524,"column":8},"end":{"line":524,"column":8}},{"start":{"line":524,"column":8},"end":{"line":524,"column":8}}]},"26":{"line":531,"type":"if","locations":[{"start":{"line":531,"column":8},"end":{"line":531,"column":8}},{"start":{"line":531,"column":8},"end":{"line":531,"column":8}}]},"27":{"line":537,"type":"if","locations":[{"start":{"line":537,"column":8},"end":{"line":537,"column":8}},{"start":{"line":537,"column":8},"end":{"line":537,"column":8}}]},"28":{"line":538,"type":"if","locations":[{"start":{"line":538,"column":12},"end":{"line":538,"column":12}},{"start":{"line":538,"column":12},"end":{"line":538,"column":12}}]},"29":{"line":544,"type":"if","locations":[{"start":{"line":544,"column":16},"end":{"line":544,"column":16}},{"start":{"line":544,"column":16},"end":{"line":544,"column":16}}]},"30":{"line":547,"type":"if","locations":[{"start":{"line":547,"column":16},"end":{"line":547,"column":16}},{"start":{"line":547,"column":16},"end":{"line":547,"column":16}}]},"31":{"line":558,"type":"if","locations":[{"start":{"line":558,"column":12},"end":{"line":558,"column":12}},{"start":{"line":558,"column":12},"end":{"line":558,"column":12}}]},"32":{"line":583,"type":"if","locations":[{"start":{"line":583,"column":8},"end":{"line":583,"column":8}},{"start":{"line":583,"column":8},"end":{"line":583,"column":8}}]},"33":{"line":600,"type":"if","locations":[{"start":{"line":600,"column":8},"end":{"line":600,"column":8}},{"start":{"line":600,"column":8},"end":{"line":600,"column":8}}]},"34":{"line":620,"type":"if","locations":[{"start":{"line":620,"column":8},"end":{"line":620,"column":8}},{"start":{"line":620,"column":8},"end":{"line":620,"column":8}}]},"35":{"line":643,"type":"if","locations":[{"start":{"line":643,"column":8},"end":{"line":643,"column":8}},{"start":{"line":643,"column":8},"end":{"line":643,"column":8}}]},"36":{"line":654,"type":"if","locations":[{"start":{"line":654,"column":8},"end":{"line":654,"column":8}},{"start":{"line":654,"column":8},"end":{"line":654,"column":8}}]},"37":{"line":659,"type":"if","locations":[{"start":{"line":659,"column":8},"end":{"line":659,"column":8}},{"start":{"line":659,"column":8},"end":{"line":659,"column":8}}]},"38":{"line":720,"type":"if","locations":[{"start":{"line":720,"column":8},"end":{"line":720,"column":8}},{"start":{"line":720,"column":8},"end":{"line":720,"column":8}}]},"39":{"line":729,"type":"if","locations":[{"start":{"line":729,"column":8},"end":{"line":729,"column":8}},{"start":{"line":729,"column":8},"end":{"line":729,"column":8}}]},"40":{"line":730,"type":"cond-expr","locations":[{"start":{"line":730,"column":83},"end":{"line":730,"column":88}},{"start":{"line":730,"column":91},"end":{"line":730,"column":96}}]},"41":{"line":734,"type":"if","locations":[{"start":{"line":734,"column":8},"end":{"line":734,"column":8}},{"start":{"line":734,"column":8},"end":{"line":734,"column":8}}]},"42":{"line":734,"type":"binary-expr","locations":[{"start":{"line":734,"column":12},"end":{"line":734,"column":34}},{"start":{"line":734,"column":38},"end":{"line":734,"column":45}}]},"43":{"line":737,"type":"if","locations":[{"start":{"line":737,"column":13},"end":{"line":737,"column":13}},{"start":{"line":737,"column":13},"end":{"line":737,"column":13}}]},"44":{"line":737,"type":"binary-expr","locations":[{"start":{"line":737,"column":17},"end":{"line":737,"column":39}},{"start":{"line":737,"column":43},"end":{"line":737,"column":50}}]},"45":{"line":757,"type":"if","locations":[{"start":{"line":757,"column":8},"end":{"line":757,"column":8}},{"start":{"line":757,"column":8},"end":{"line":757,"column":8}}]},"46":{"line":770,"type":"if","locations":[{"start":{"line":770,"column":8},"end":{"line":770,"column":8}},{"start":{"line":770,"column":8},"end":{"line":770,"column":8}}]},"47":{"line":776,"type":"if","locations":[{"start":{"line":776,"column":12},"end":{"line":776,"column":12}},{"start":{"line":776,"column":12},"end":{"line":776,"column":12}}]},"48":{"line":776,"type":"binary-expr","locations":[{"start":{"line":776,"column":16},"end":{"line":776,"column":39}},{"start":{"line":776,"column":43},"end":{"line":776,"column":66}}]},"49":{"line":781,"type":"if","locations":[{"start":{"line":781,"column":16},"end":{"line":781,"column":16}},{"start":{"line":781,"column":16},"end":{"line":781,"column":16}}]},"50":{"line":789,"type":"if","locations":[{"start":{"line":789,"column":20},"end":{"line":789,"column":20}},{"start":{"line":789,"column":20},"end":{"line":789,"column":20}}]},"51":{"line":789,"type":"binary-expr","locations":[{"start":{"line":789,"column":24},"end":{"line":789,"column":33}},{"start":{"line":789,"column":38},"end":{"line":789,"column":46}},{"start":{"line":789,"column":50},"end":{"line":789,"column":83}}]},"52":{"line":805,"type":"if","locations":[{"start":{"line":805,"column":8},"end":{"line":805,"column":8}},{"start":{"line":805,"column":8},"end":{"line":805,"column":8}}]},"53":{"line":814,"type":"cond-expr","locations":[{"start":{"line":814,"column":45},"end":{"line":814,"column":53}},{"start":{"line":814,"column":56},"end":{"line":814,"column":64}}]},"54":{"line":818,"type":"if","locations":[{"start":{"line":818,"column":8},"end":{"line":818,"column":8}},{"start":{"line":818,"column":8},"end":{"line":818,"column":8}}]},"55":{"line":823,"type":"if","locations":[{"start":{"line":823,"column":8},"end":{"line":823,"column":8}},{"start":{"line":823,"column":8},"end":{"line":823,"column":8}}]},"56":{"line":840,"type":"cond-expr","locations":[{"start":{"line":840,"column":45},"end":{"line":840,"column":53}},{"start":{"line":840,"column":56},"end":{"line":840,"column":64}}]},"57":{"line":854,"type":"cond-expr","locations":[{"start":{"line":854,"column":40},"end":{"line":854,"column":57}},{"start":{"line":854,"column":60},"end":{"line":854,"column":77}}]},"58":{"line":855,"type":"cond-expr","locations":[{"start":{"line":855,"column":40},"end":{"line":855,"column":57}},{"start":{"line":855,"column":60},"end":{"line":855,"column":77}}]},"59":{"line":861,"type":"binary-expr","locations":[{"start":{"line":861,"column":30},"end":{"line":861,"column":38}},{"start":{"line":861,"column":43},"end":{"line":861,"column":76}}]},"60":{"line":862,"type":"binary-expr","locations":[{"start":{"line":862,"column":30},"end":{"line":862,"column":38}},{"start":{"line":862,"column":43},"end":{"line":862,"column":76}}]},"61":{"line":867,"type":"if","locations":[{"start":{"line":867,"column":8},"end":{"line":867,"column":8}},{"start":{"line":867,"column":8},"end":{"line":867,"column":8}}]},"62":{"line":867,"type":"binary-expr","locations":[{"start":{"line":867,"column":12},"end":{"line":867,"column":26}},{"start":{"line":867,"column":30},"end":{"line":867,"column":44}}]},"63":{"line":875,"type":"if","locations":[{"start":{"line":875,"column":8},"end":{"line":875,"column":8}},{"start":{"line":875,"column":8},"end":{"line":875,"column":8}}]},"64":{"line":875,"type":"binary-expr","locations":[{"start":{"line":875,"column":12},"end":{"line":875,"column":19}},{"start":{"line":875,"column":23},"end":{"line":875,"column":36}},{"start":{"line":875,"column":40},"end":{"line":875,"column":53}}]},"65":{"line":877,"type":"if","locations":[{"start":{"line":877,"column":12},"end":{"line":877,"column":12}},{"start":{"line":877,"column":12},"end":{"line":877,"column":12}}]},"66":{"line":882,"type":"if","locations":[{"start":{"line":882,"column":12},"end":{"line":882,"column":12}},{"start":{"line":882,"column":12},"end":{"line":882,"column":12}}]},"67":{"line":882,"type":"binary-expr","locations":[{"start":{"line":882,"column":16},"end":{"line":882,"column":24}},{"start":{"line":882,"column":28},"end":{"line":882,"column":36}}]},"68":{"line":903,"type":"if","locations":[{"start":{"line":903,"column":8},"end":{"line":903,"column":8}},{"start":{"line":903,"column":8},"end":{"line":903,"column":8}}]},"69":{"line":927,"type":"cond-expr","locations":[{"start":{"line":927,"column":48},"end":{"line":927,"column":49}},{"start":{"line":927,"column":52},"end":{"line":927,"column":54}}]},"70":{"line":935,"type":"if","locations":[{"start":{"line":935,"column":8},"end":{"line":935,"column":8}},{"start":{"line":935,"column":8},"end":{"line":935,"column":8}}]},"71":{"line":935,"type":"binary-expr","locations":[{"start":{"line":935,"column":12},"end":{"line":935,"column":33}},{"start":{"line":935,"column":37},"end":{"line":935,"column":53}}]},"72":{"line":945,"type":"if","locations":[{"start":{"line":945,"column":12},"end":{"line":945,"column":12}},{"start":{"line":945,"column":12},"end":{"line":945,"column":12}}]},"73":{"line":975,"type":"binary-expr","locations":[{"start":{"line":975,"column":23},"end":{"line":975,"column":24}},{"start":{"line":975,"column":28},"end":{"line":975,"column":44}}]},"74":{"line":976,"type":"binary-expr","locations":[{"start":{"line":976,"column":23},"end":{"line":976,"column":24}},{"start":{"line":976,"column":28},"end":{"line":976,"column":44}}]},"75":{"line":983,"type":"binary-expr","locations":[{"start":{"line":983,"column":16},"end":{"line":983,"column":23}},{"start":{"line":983,"column":28},"end":{"line":983,"column":43}},{"start":{"line":983,"column":47},"end":{"line":983,"column":62}},{"start":{"line":983,"column":69},"end":{"line":983,"column":76}},{"start":{"line":983,"column":81},"end":{"line":983,"column":96}},{"start":{"line":983,"column":100},"end":{"line":983,"column":115}}]},"76":{"line":1007,"type":"if","locations":[{"start":{"line":1007,"column":8},"end":{"line":1007,"column":8}},{"start":{"line":1007,"column":8},"end":{"line":1007,"column":8}}]},"77":{"line":1010,"type":"if","locations":[{"start":{"line":1010,"column":13},"end":{"line":1010,"column":13}},{"start":{"line":1010,"column":13},"end":{"line":1010,"column":13}}]},"78":{"line":1026,"type":"if","locations":[{"start":{"line":1026,"column":8},"end":{"line":1026,"column":8}},{"start":{"line":1026,"column":8},"end":{"line":1026,"column":8}}]},"79":{"line":1040,"type":"if","locations":[{"start":{"line":1040,"column":8},"end":{"line":1040,"column":8}},{"start":{"line":1040,"column":8},"end":{"line":1040,"column":8}}]},"80":{"line":1121,"type":"if","locations":[{"start":{"line":1121,"column":8},"end":{"line":1121,"column":8}},{"start":{"line":1121,"column":8},"end":{"line":1121,"column":8}}]},"81":{"line":1143,"type":"if","locations":[{"start":{"line":1143,"column":8},"end":{"line":1143,"column":8}},{"start":{"line":1143,"column":8},"end":{"line":1143,"column":8}}]},"82":{"line":1145,"type":"cond-expr","locations":[{"start":{"line":1145,"column":37},"end":{"line":1145,"column":41}},{"start":{"line":1145,"column":44},"end":{"line":1145,"column":49}}]},"83":{"line":1146,"type":"cond-expr","locations":[{"start":{"line":1146,"column":37},"end":{"line":1146,"column":41}},{"start":{"line":1146,"column":44},"end":{"line":1146,"column":49}}]},"84":{"line":1164,"type":"if","locations":[{"start":{"line":1164,"column":8},"end":{"line":1164,"column":8}},{"start":{"line":1164,"column":8},"end":{"line":1164,"column":8}}]},"85":{"line":1393,"type":"cond-expr","locations":[{"start":{"line":1393,"column":34},"end":{"line":1393,"column":69}},{"start":{"line":1393,"column":72},"end":{"line":1393,"column":92}}]},"86":{"line":1394,"type":"cond-expr","locations":[{"start":{"line":1394,"column":34},"end":{"line":1394,"column":69}},{"start":{"line":1394,"column":72},"end":{"line":1394,"column":92}}]}},"code":["(function () { YUI.add('scrollview-base', function (Y, NAME) {","","/**"," * The scrollview-base module provides a basic ScrollView Widget, without scrollbar indicators"," *"," * @module scrollview"," * @submodule scrollview-base"," */",""," // Local vars","var getClassName = Y.ClassNameManager.getClassName,"," DOCUMENT = Y.config.doc,"," IE = Y.UA.ie,"," NATIVE_TRANSITIONS = Y.Transition.useNative,"," vendorPrefix = Y.Transition._VENDOR_PREFIX, // Todo: This is a private property, and alternative approaches should be investigated"," 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',"," 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,",""," /**"," * Internal state, defines the minimum amount that the scrollview can be scrolled along the X axis"," *"," * @property _minScrollX"," * @type number"," * @protected"," */"," _minScrollX: null,",""," /**"," * Internal state, defines the maximum amount that the scrollview can be scrolled along the X axis"," *"," * @property _maxScrollX"," * @type number"," * @protected"," */"," _maxScrollX: null,",""," /**"," * Internal state, defines the minimum amount that the scrollview can be scrolled along the Y axis"," *"," * @property _minScrollY"," * @type number"," * @protected"," */"," _minScrollY: null,",""," /**"," * Internal state, defines the maximum amount that the scrollview can be scrolled along the Y axis"," *"," * @property _maxScrollY"," * @type number"," * @protected"," */"," _maxScrollY: null,"," "," /**"," * Designated initializer"," *"," * @method initializer"," * @param {config} Configuration object for the plugin"," */"," initializer: function () {"," 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"," // TODO: This doesn't actually appear to work properly. Fix. #2532743"," 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"," * @return {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,"," minScrollX = (rtl ? Math.min(0, -(scrollWidth - width)) : 0),"," maxScrollX = (rtl ? 0 : Math.max(0, scrollWidth - width)),"," minScrollY = 0,"," maxScrollY = Math.max(0, scrollHeight - height);"," "," if (svAxis && svAxis.x) {"," bb.addClass(CLASS_NAMES.horizontal);"," }",""," if (svAxis && svAxis.y) {"," bb.addClass(CLASS_NAMES.vertical);"," }",""," sv._setBounds({"," minScrollX: minScrollX,"," maxScrollX: maxScrollX,"," minScrollY: minScrollY,"," maxScrollY: maxScrollY"," });"," },",""," /**"," * Set the bounding dimensions of the ScrollView"," *"," * @method _setBounds"," * @protected"," * @param bounds {Object} [duration] ms of the scroll animation. (default is 0)"," * @param {Number} [bounds.minScrollX] The minimum scroll X value"," * @param {Number} [bounds.maxScrollX] The maximum scroll X value"," * @param {Number} [bounds.minScrollY] The minimum scroll Y value"," * @param {Number} [bounds.maxScrollY] The maximum scroll Y value"," */"," _setBounds: function (bounds) {"," var sv = this;"," "," // TODO: Do a check to log if the bounds are invalid",""," sv._minScrollX = bounds.minScrollX;"," sv._maxScrollX = bounds.maxScrollX;"," sv._minScrollY = bounds.minScrollY;"," sv._maxScrollY = bounds.maxScrollY;"," },",""," /**"," * Get the bounding dimensions of the ScrollView"," *"," * @method _getBounds"," * @protected"," */"," _getBounds: function () {"," var sv = this;"," "," return {"," minScrollX: sv._minScrollX,"," maxScrollX: sv._maxScrollX,"," minScrollY: sv._minScrollY,"," maxScrollY: sv._maxScrollY"," };",""," },",""," /**"," * 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 () {"," var sv = this;"," "," // If for some reason we're OOB, snapback"," if (sv._isOutOfBounds()) {"," sv._snapBack();"," }"," else {"," /**"," * 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) {"," sv._cancelFlick();"," sv._onTransEnd();"," }",""," // 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,"," isOOB;",""," 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) {"," "," isOOB = sv._isOutOfBounds();"," "," // If we're out-out-bounds, then snapback"," if (isOOB) {"," sv._snapBack();"," }",""," // Inbounds"," else {"," // Fire scrollEnd unless this is a paginated instance and 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 && !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,"," bounds = sv._getBounds(),",""," // 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 ? bounds.minScrollX : bounds.minScrollY,"," max = flickAxis === DIM_X ? bounds.maxScrollX : bounds.maxScrollY,"," belowMin = (newPosition < min),"," belowMax = (newPosition < max),"," aboveMin = (newPosition > min),"," aboveMax = (newPosition > max),"," belowMinRange = (newPosition < (min - bounceRange)),"," withinMinRange = (belowMin && (newPosition > (min - bounceRange))),"," withinMaxRange = (aboveMax && (newPosition < (max + 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._cancelFlick();"," }",""," // 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);"," }"," },",""," _cancelFlick: function () {"," var sv = this;",""," 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;"," }",""," },",""," /**"," * 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),"," bounds = sv._getBounds(),"," bb = sv._bb,"," scrollOffset = 10, // 10px"," isForward = (e.wheelDelta > 0),"," scrollToY = scrollY - ((isForward ? 1 : -1) * scrollOffset);",""," scrollToY = _constrain(scrollToY, bounds.minScrollY, bounds.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"," * @return {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),"," bounds = sv._getBounds(),"," minX = bounds.minScrollX,"," minY = bounds.minScrollY,"," maxX = bounds.maxScrollX,"," maxY = bounds.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),"," bounds = sv._getBounds(),"," minX = bounds.minScrollX,"," minY = bounds.minScrollY,"," maxX = bounds.maxScrollX,"," maxY = bounds.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 {"," 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 () {"," var sv = this;",""," if (sv._flickAnim) {"," sv._cancelFlick();"," }",""," // 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) {",""," // 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) {",""," // 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: (vendorPrefix ? vendorPrefix + 'TransitionDuration' : 'transitionDuration'),"," PROPERTY: (vendorPrefix ? vendorPrefix + 'TransitionProperty' : '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});","","}());"]};
}
var __cov_cyIK2vRXoVgOuWid4NBKqw = __coverage__['build/scrollview-base/scrollview-base.js'];
__cov_cyIK2vRXoVgOuWid4NBKqw.s['1']++;YUI.add('scrollview-base',function(Y,NAME){__cov_cyIK2vRXoVgOuWid4NBKqw.f['1']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['2']++;var getClassName=Y.ClassNameManager.getClassName,DOCUMENT=Y.config.doc,IE=Y.UA.ie,NATIVE_TRANSITIONS=Y.Transition.useNative,vendorPrefix=Y.Transition._VENDOR_PREFIX,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',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){__cov_cyIK2vRXoVgOuWid4NBKqw.f['2']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['3']++;return Math.min(Math.max(val,min),max);};__cov_cyIK2vRXoVgOuWid4NBKqw.s['4']++;function ScrollView(){__cov_cyIK2vRXoVgOuWid4NBKqw.f['3']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['5']++;ScrollView.superclass.constructor.apply(this,arguments);}__cov_cyIK2vRXoVgOuWid4NBKqw.s['6']++;Y.ScrollView=Y.extend(ScrollView,Y.Widget,{_forceHWTransforms:Y.UA.webkit?(__cov_cyIK2vRXoVgOuWid4NBKqw.b['1'][0]++,true):(__cov_cyIK2vRXoVgOuWid4NBKqw.b['1'][1]++,false),_prevent:{start:false,move:true,end:false},lastScrolledAmt:0,_minScrollX:null,_maxScrollX:null,_minScrollY:null,_maxScrollY:null,initializer:function(){__cov_cyIK2vRXoVgOuWid4NBKqw.f['4']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['7']++;var sv=this;__cov_cyIK2vRXoVgOuWid4NBKqw.s['8']++;sv._bb=sv.get(BOUNDING_BOX);__cov_cyIK2vRXoVgOuWid4NBKqw.s['9']++;sv._cb=sv.get(CONTENT_BOX);__cov_cyIK2vRXoVgOuWid4NBKqw.s['10']++;sv._cAxis=sv.get(AXIS);__cov_cyIK2vRXoVgOuWid4NBKqw.s['11']++;sv._cBounce=sv.get(BOUNCE);__cov_cyIK2vRXoVgOuWid4NBKqw.s['12']++;sv._cBounceRange=sv.get(BOUNCE_RANGE);__cov_cyIK2vRXoVgOuWid4NBKqw.s['13']++;sv._cDeceleration=sv.get(DECELERATION);__cov_cyIK2vRXoVgOuWid4NBKqw.s['14']++;sv._cFrameDuration=sv.get(FRAME_DURATION);},bindUI:function(){__cov_cyIK2vRXoVgOuWid4NBKqw.f['5']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['15']++;var sv=this;__cov_cyIK2vRXoVgOuWid4NBKqw.s['16']++;sv._bindFlick(sv.get(FLICK));__cov_cyIK2vRXoVgOuWid4NBKqw.s['17']++;sv._bindDrag(sv.get(DRAG));__cov_cyIK2vRXoVgOuWid4NBKqw.s['18']++;sv._bindMousewheel(true);__cov_cyIK2vRXoVgOuWid4NBKqw.s['19']++;sv._bindAttrs();__cov_cyIK2vRXoVgOuWid4NBKqw.s['20']++;if(IE){__cov_cyIK2vRXoVgOuWid4NBKqw.b['2'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['21']++;sv._fixIESelect(sv._bb,sv._cb);}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['2'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['22']++;if(ScrollView.SNAP_DURATION){__cov_cyIK2vRXoVgOuWid4NBKqw.b['3'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['23']++;sv.set(SNAP_DURATION,ScrollView.SNAP_DURATION);}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['3'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['24']++;if(ScrollView.SNAP_EASING){__cov_cyIK2vRXoVgOuWid4NBKqw.b['4'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['25']++;sv.set(SNAP_EASING,ScrollView.SNAP_EASING);}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['4'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['26']++;if(ScrollView.EASING){__cov_cyIK2vRXoVgOuWid4NBKqw.b['5'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['27']++;sv.set(EASING,ScrollView.EASING);}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['5'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['28']++;if(ScrollView.FRAME_STEP){__cov_cyIK2vRXoVgOuWid4NBKqw.b['6'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['29']++;sv.set(FRAME_DURATION,ScrollView.FRAME_STEP);}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['6'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['30']++;if(ScrollView.BOUNCE_RANGE){__cov_cyIK2vRXoVgOuWid4NBKqw.b['7'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['31']++;sv.set(BOUNCE_RANGE,ScrollView.BOUNCE_RANGE);}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['7'][1]++;}},_bindAttrs:function(){__cov_cyIK2vRXoVgOuWid4NBKqw.f['6']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['32']++;var sv=this,scrollChangeHandler=sv._afterScrollChange,dimChangeHandler=sv._afterDimChange;__cov_cyIK2vRXoVgOuWid4NBKqw.s['33']++;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});},_bindDrag:function(drag){__cov_cyIK2vRXoVgOuWid4NBKqw.f['7']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['34']++;var sv=this,bb=sv._bb;__cov_cyIK2vRXoVgOuWid4NBKqw.s['35']++;bb.detach(DRAG+'|*');__cov_cyIK2vRXoVgOuWid4NBKqw.s['36']++;if(drag){__cov_cyIK2vRXoVgOuWid4NBKqw.b['8'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['37']++;bb.on(DRAG+'|'+GESTURE_MOVE+START,Y.bind(sv._onGestureMoveStart,sv));}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['8'][1]++;}},_bindFlick:function(flick){__cov_cyIK2vRXoVgOuWid4NBKqw.f['8']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['38']++;var sv=this,bb=sv._bb;__cov_cyIK2vRXoVgOuWid4NBKqw.s['39']++;bb.detach(FLICK+'|*');__cov_cyIK2vRXoVgOuWid4NBKqw.s['40']++;if(flick){__cov_cyIK2vRXoVgOuWid4NBKqw.b['9'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['41']++;bb.on(FLICK+'|'+FLICK,Y.bind(sv._flick,sv),flick);__cov_cyIK2vRXoVgOuWid4NBKqw.s['42']++;sv._bindDrag(sv.get(DRAG));}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['9'][1]++;}},_bindMousewheel:function(mousewheel){__cov_cyIK2vRXoVgOuWid4NBKqw.f['9']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['43']++;var sv=this,bb=sv._bb;__cov_cyIK2vRXoVgOuWid4NBKqw.s['44']++;bb.detach(MOUSEWHEEL+'|*');__cov_cyIK2vRXoVgOuWid4NBKqw.s['45']++;if(mousewheel){__cov_cyIK2vRXoVgOuWid4NBKqw.b['10'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['46']++;Y.one(DOCUMENT).on(MOUSEWHEEL,Y.bind(sv._mousewheel,sv));}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['10'][1]++;}},syncUI:function(){__cov_cyIK2vRXoVgOuWid4NBKqw.f['10']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['47']++;var sv=this,scrollDims=sv._getScrollDims(),width=scrollDims.offsetWidth,height=scrollDims.offsetHeight,scrollWidth=scrollDims.scrollWidth,scrollHeight=scrollDims.scrollHeight;__cov_cyIK2vRXoVgOuWid4NBKqw.s['48']++;if(sv._cAxis===undefined){__cov_cyIK2vRXoVgOuWid4NBKqw.b['11'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['49']++;sv._cAxis={x:scrollWidth>width,y:scrollHeight>height};__cov_cyIK2vRXoVgOuWid4NBKqw.s['50']++;sv._set(AXIS,sv._cAxis);}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['11'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['51']++;sv.rtl=sv._cb.getComputedStyle('direction')==='rtl';__cov_cyIK2vRXoVgOuWid4NBKqw.s['52']++;sv._cDisabled=sv.get(DISABLED);__cov_cyIK2vRXoVgOuWid4NBKqw.s['53']++;sv._uiDimensionsChange();__cov_cyIK2vRXoVgOuWid4NBKqw.s['54']++;if(sv._isOutOfBounds()){__cov_cyIK2vRXoVgOuWid4NBKqw.b['12'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['55']++;sv._snapBack();}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['12'][1]++;}},_getScrollDims:function(){__cov_cyIK2vRXoVgOuWid4NBKqw.f['11']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['56']++;var sv=this,cb=sv._cb,bb=sv._bb,TRANS=ScrollView._TRANSITION,origX=sv.get(SCROLL_X),origY=sv.get(SCROLL_Y),origHWTransform,dims;__cov_cyIK2vRXoVgOuWid4NBKqw.s['57']++;if(NATIVE_TRANSITIONS){__cov_cyIK2vRXoVgOuWid4NBKqw.b['13'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['58']++;cb.setStyle(TRANS.DURATION,ZERO);__cov_cyIK2vRXoVgOuWid4NBKqw.s['59']++;cb.setStyle(TRANS.PROPERTY,EMPTY);}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['13'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['60']++;origHWTransform=sv._forceHWTransforms;__cov_cyIK2vRXoVgOuWid4NBKqw.s['61']++;sv._forceHWTransforms=false;__cov_cyIK2vRXoVgOuWid4NBKqw.s['62']++;sv._moveTo(cb,0,0);__cov_cyIK2vRXoVgOuWid4NBKqw.s['63']++;dims={'offsetWidth':bb.get('offsetWidth'),'offsetHeight':bb.get('offsetHeight'),'scrollWidth':bb.get('scrollWidth'),'scrollHeight':bb.get('scrollHeight')};__cov_cyIK2vRXoVgOuWid4NBKqw.s['64']++;sv._moveTo(cb,-origX,-origY);__cov_cyIK2vRXoVgOuWid4NBKqw.s['65']++;sv._forceHWTransforms=origHWTransform;__cov_cyIK2vRXoVgOuWid4NBKqw.s['66']++;return dims;},_uiDimensionsChange:function(){__cov_cyIK2vRXoVgOuWid4NBKqw.f['12']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['67']++;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,minScrollX=rtl?(__cov_cyIK2vRXoVgOuWid4NBKqw.b['14'][0]++,Math.min(0,-(scrollWidth-width))):(__cov_cyIK2vRXoVgOuWid4NBKqw.b['14'][1]++,0),maxScrollX=rtl?(__cov_cyIK2vRXoVgOuWid4NBKqw.b['15'][0]++,0):(__cov_cyIK2vRXoVgOuWid4NBKqw.b['15'][1]++,Math.max(0,scrollWidth-width)),minScrollY=0,maxScrollY=Math.max(0,scrollHeight-height);__cov_cyIK2vRXoVgOuWid4NBKqw.s['68']++;if((__cov_cyIK2vRXoVgOuWid4NBKqw.b['17'][0]++,svAxis)&&(__cov_cyIK2vRXoVgOuWid4NBKqw.b['17'][1]++,svAxis.x)){__cov_cyIK2vRXoVgOuWid4NBKqw.b['16'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['69']++;bb.addClass(CLASS_NAMES.horizontal);}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['16'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['70']++;if((__cov_cyIK2vRXoVgOuWid4NBKqw.b['19'][0]++,svAxis)&&(__cov_cyIK2vRXoVgOuWid4NBKqw.b['19'][1]++,svAxis.y)){__cov_cyIK2vRXoVgOuWid4NBKqw.b['18'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['71']++;bb.addClass(CLASS_NAMES.vertical);}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['18'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['72']++;sv._setBounds({minScrollX:minScrollX,maxScrollX:maxScrollX,minScrollY:minScrollY,maxScrollY:maxScrollY});},_setBounds:function(bounds){__cov_cyIK2vRXoVgOuWid4NBKqw.f['13']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['73']++;var sv=this;__cov_cyIK2vRXoVgOuWid4NBKqw.s['74']++;sv._minScrollX=bounds.minScrollX;__cov_cyIK2vRXoVgOuWid4NBKqw.s['75']++;sv._maxScrollX=bounds.maxScrollX;__cov_cyIK2vRXoVgOuWid4NBKqw.s['76']++;sv._minScrollY=bounds.minScrollY;__cov_cyIK2vRXoVgOuWid4NBKqw.s['77']++;sv._maxScrollY=bounds.maxScrollY;},_getBounds:function(){__cov_cyIK2vRXoVgOuWid4NBKqw.f['14']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['78']++;var sv=this;__cov_cyIK2vRXoVgOuWid4NBKqw.s['79']++;return{minScrollX:sv._minScrollX,maxScrollX:sv._maxScrollX,minScrollY:sv._minScrollY,maxScrollY:sv._maxScrollY};},scrollTo:function(x,y,duration,easing,node){__cov_cyIK2vRXoVgOuWid4NBKqw.f['15']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['80']++;if(this._cDisabled){__cov_cyIK2vRXoVgOuWid4NBKqw.b['20'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['81']++;return;}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['20'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['82']++;var sv=this,cb=sv._cb,TRANS=ScrollView._TRANSITION,callback=Y.bind(sv._onTransEnd,sv),newX=0,newY=0,transition={},transform;__cov_cyIK2vRXoVgOuWid4NBKqw.s['83']++;duration=(__cov_cyIK2vRXoVgOuWid4NBKqw.b['21'][0]++,duration)||(__cov_cyIK2vRXoVgOuWid4NBKqw.b['21'][1]++,0);__cov_cyIK2vRXoVgOuWid4NBKqw.s['84']++;easing=(__cov_cyIK2vRXoVgOuWid4NBKqw.b['22'][0]++,easing)||(__cov_cyIK2vRXoVgOuWid4NBKqw.b['22'][1]++,sv.get(EASING));__cov_cyIK2vRXoVgOuWid4NBKqw.s['85']++;node=(__cov_cyIK2vRXoVgOuWid4NBKqw.b['23'][0]++,node)||(__cov_cyIK2vRXoVgOuWid4NBKqw.b['23'][1]++,cb);__cov_cyIK2vRXoVgOuWid4NBKqw.s['86']++;if(x!==null){__cov_cyIK2vRXoVgOuWid4NBKqw.b['24'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['87']++;sv.set(SCROLL_X,x,{src:UI});__cov_cyIK2vRXoVgOuWid4NBKqw.s['88']++;newX=-x;}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['24'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['89']++;if(y!==null){__cov_cyIK2vRXoVgOuWid4NBKqw.b['25'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['90']++;sv.set(SCROLL_Y,y,{src:UI});__cov_cyIK2vRXoVgOuWid4NBKqw.s['91']++;newY=-y;}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['25'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['92']++;transform=sv._transform(newX,newY);__cov_cyIK2vRXoVgOuWid4NBKqw.s['93']++;if(NATIVE_TRANSITIONS){__cov_cyIK2vRXoVgOuWid4NBKqw.b['26'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['94']++;node.setStyle(TRANS.DURATION,ZERO).setStyle(TRANS.PROPERTY,EMPTY);}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['26'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['95']++;if(duration===0){__cov_cyIK2vRXoVgOuWid4NBKqw.b['27'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['96']++;if(NATIVE_TRANSITIONS){__cov_cyIK2vRXoVgOuWid4NBKqw.b['28'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['97']++;node.setStyle('transform',transform);}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['28'][1]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['98']++;if(x!==null){__cov_cyIK2vRXoVgOuWid4NBKqw.b['29'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['99']++;node.setStyle(LEFT,newX+PX);}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['29'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['100']++;if(y!==null){__cov_cyIK2vRXoVgOuWid4NBKqw.b['30'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['101']++;node.setStyle(TOP,newY+PX);}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['30'][1]++;}}}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['27'][1]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['102']++;transition.easing=easing;__cov_cyIK2vRXoVgOuWid4NBKqw.s['103']++;transition.duration=duration/1000;__cov_cyIK2vRXoVgOuWid4NBKqw.s['104']++;if(NATIVE_TRANSITIONS){__cov_cyIK2vRXoVgOuWid4NBKqw.b['31'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['105']++;transition.transform=transform;}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['31'][1]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['106']++;transition.left=newX+PX;__cov_cyIK2vRXoVgOuWid4NBKqw.s['107']++;transition.top=newY+PX;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['108']++;node.transition(transition,callback);}},_transform:function(x,y){__cov_cyIK2vRXoVgOuWid4NBKqw.f['16']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['109']++;var prop='translate('+x+'px, '+y+'px)';__cov_cyIK2vRXoVgOuWid4NBKqw.s['110']++;if(this._forceHWTransforms){__cov_cyIK2vRXoVgOuWid4NBKqw.b['32'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['111']++;prop+=' translateZ(0)';}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['32'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['112']++;return prop;},_moveTo:function(node,x,y){__cov_cyIK2vRXoVgOuWid4NBKqw.f['17']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['113']++;if(NATIVE_TRANSITIONS){__cov_cyIK2vRXoVgOuWid4NBKqw.b['33'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['114']++;node.setStyle('transform',this._transform(x,y));}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['33'][1]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['115']++;node.setStyle(LEFT,x+PX);__cov_cyIK2vRXoVgOuWid4NBKqw.s['116']++;node.setStyle(TOP,y+PX);}},_onTransEnd:function(){__cov_cyIK2vRXoVgOuWid4NBKqw.f['18']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['117']++;var sv=this;__cov_cyIK2vRXoVgOuWid4NBKqw.s['118']++;if(sv._isOutOfBounds()){__cov_cyIK2vRXoVgOuWid4NBKqw.b['34'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['119']++;sv._snapBack();}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['34'][1]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['120']++;sv.fire(EV_SCROLL_END);}},_onGestureMoveStart:function(e){__cov_cyIK2vRXoVgOuWid4NBKqw.f['19']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['121']++;if(this._cDisabled){__cov_cyIK2vRXoVgOuWid4NBKqw.b['35'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['122']++;return false;}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['35'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['123']++;var sv=this,bb=sv._bb,currentX=sv.get(SCROLL_X),currentY=sv.get(SCROLL_Y),clientX=e.clientX,clientY=e.clientY;__cov_cyIK2vRXoVgOuWid4NBKqw.s['124']++;if(sv._prevent.start){__cov_cyIK2vRXoVgOuWid4NBKqw.b['36'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['125']++;e.preventDefault();}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['36'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['126']++;if(sv._flickAnim){__cov_cyIK2vRXoVgOuWid4NBKqw.b['37'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['127']++;sv._cancelFlick();__cov_cyIK2vRXoVgOuWid4NBKqw.s['128']++;sv._onTransEnd();}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['37'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['129']++;sv.lastScrolledAmt=0;__cov_cyIK2vRXoVgOuWid4NBKqw.s['130']++;sv._gesture={axis:null,startX:currentX,startY:currentY,startClientX:clientX,startClientY:clientY,endClientX:null,endClientY:null,deltaX:null,deltaY:null,flick:null,onGestureMove:bb.on(DRAG+'|'+GESTURE_MOVE,Y.bind(sv._onGestureMove,sv)),onGestureMoveEnd:bb.on(DRAG+'|'+GESTURE_MOVE+END,Y.bind(sv._onGestureMoveEnd,sv))};},_onGestureMove:function(e){__cov_cyIK2vRXoVgOuWid4NBKqw.f['20']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['131']++;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;__cov_cyIK2vRXoVgOuWid4NBKqw.s['132']++;if(sv._prevent.move){__cov_cyIK2vRXoVgOuWid4NBKqw.b['38'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['133']++;e.preventDefault();}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['38'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['134']++;gesture.deltaX=startClientX-clientX;__cov_cyIK2vRXoVgOuWid4NBKqw.s['135']++;gesture.deltaY=startClientY-clientY;__cov_cyIK2vRXoVgOuWid4NBKqw.s['136']++;if(gesture.axis===null){__cov_cyIK2vRXoVgOuWid4NBKqw.b['39'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['137']++;gesture.axis=Math.abs(gesture.deltaX)>Math.abs(gesture.deltaY)?(__cov_cyIK2vRXoVgOuWid4NBKqw.b['40'][0]++,DIM_X):(__cov_cyIK2vRXoVgOuWid4NBKqw.b['40'][1]++,DIM_Y);}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['39'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['138']++;if((__cov_cyIK2vRXoVgOuWid4NBKqw.b['42'][0]++,gesture.axis===DIM_X)&&(__cov_cyIK2vRXoVgOuWid4NBKqw.b['42'][1]++,svAxisX)){__cov_cyIK2vRXoVgOuWid4NBKqw.b['41'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['139']++;sv.set(SCROLL_X,startX+gesture.deltaX);}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['41'][1]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['140']++;if((__cov_cyIK2vRXoVgOuWid4NBKqw.b['44'][0]++,gesture.axis===DIM_Y)&&(__cov_cyIK2vRXoVgOuWid4NBKqw.b['44'][1]++,svAxisY)){__cov_cyIK2vRXoVgOuWid4NBKqw.b['43'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['141']++;sv.set(SCROLL_Y,startY+gesture.deltaY);}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['43'][1]++;}}},_onGestureMoveEnd:function(e){__cov_cyIK2vRXoVgOuWid4NBKqw.f['21']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['142']++;var sv=this,gesture=sv._gesture,flick=gesture.flick,clientX=e.clientX,clientY=e.clientY,isOOB;__cov_cyIK2vRXoVgOuWid4NBKqw.s['143']++;if(sv._prevent.end){__cov_cyIK2vRXoVgOuWid4NBKqw.b['45'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['144']++;e.preventDefault();}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['45'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['145']++;gesture.endClientX=clientX;__cov_cyIK2vRXoVgOuWid4NBKqw.s['146']++;gesture.endClientY=clientY;__cov_cyIK2vRXoVgOuWid4NBKqw.s['147']++;gesture.onGestureMove.detach();__cov_cyIK2vRXoVgOuWid4NBKqw.s['148']++;gesture.onGestureMoveEnd.detach();__cov_cyIK2vRXoVgOuWid4NBKqw.s['149']++;if(!flick){__cov_cyIK2vRXoVgOuWid4NBKqw.b['46'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['150']++;if((__cov_cyIK2vRXoVgOuWid4NBKqw.b['48'][0]++,gesture.deltaX!==null)&&(__cov_cyIK2vRXoVgOuWid4NBKqw.b['48'][1]++,gesture.deltaY!==null)){__cov_cyIK2vRXoVgOuWid4NBKqw.b['47'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['151']++;isOOB=sv._isOutOfBounds();__cov_cyIK2vRXoVgOuWid4NBKqw.s['152']++;if(isOOB){__cov_cyIK2vRXoVgOuWid4NBKqw.b['49'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['153']++;sv._snapBack();}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['49'][1]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['154']++;if((__cov_cyIK2vRXoVgOuWid4NBKqw.b['51'][0]++,!sv.pages)||(__cov_cyIK2vRXoVgOuWid4NBKqw.b['51'][1]++,sv.pages)&&(__cov_cyIK2vRXoVgOuWid4NBKqw.b['51'][2]++,!sv.pages.get(AXIS)[gesture.axis])){__cov_cyIK2vRXoVgOuWid4NBKqw.b['50'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['155']++;sv._onTransEnd();}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['50'][1]++;}}}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['47'][1]++;}}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['46'][1]++;}},_flick:function(e){__cov_cyIK2vRXoVgOuWid4NBKqw.f['22']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['156']++;if(this._cDisabled){__cov_cyIK2vRXoVgOuWid4NBKqw.b['52'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['157']++;return false;}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['52'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['158']++;var sv=this,svAxis=sv._cAxis,flick=e.flick,flickAxis=flick.axis,flickVelocity=flick.velocity,axisAttr=flickAxis===DIM_X?(__cov_cyIK2vRXoVgOuWid4NBKqw.b['53'][0]++,SCROLL_X):(__cov_cyIK2vRXoVgOuWid4NBKqw.b['53'][1]++,SCROLL_Y),startPosition=sv.get(axisAttr);__cov_cyIK2vRXoVgOuWid4NBKqw.s['159']++;if(sv._gesture){__cov_cyIK2vRXoVgOuWid4NBKqw.b['54'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['160']++;sv._gesture.flick=flick;}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['54'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['161']++;if(svAxis[flickAxis]){__cov_cyIK2vRXoVgOuWid4NBKqw.b['55'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['162']++;sv._flickFrame(flickVelocity,flickAxis,startPosition);}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['55'][1]++;}},_flickFrame:function(velocity,flickAxis,startPosition){__cov_cyIK2vRXoVgOuWid4NBKqw.f['23']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['163']++;var sv=this,axisAttr=flickAxis===DIM_X?(__cov_cyIK2vRXoVgOuWid4NBKqw.b['56'][0]++,SCROLL_X):(__cov_cyIK2vRXoVgOuWid4NBKqw.b['56'][1]++,SCROLL_Y),bounds=sv._getBounds(),bounce=sv._cBounce,bounceRange=sv._cBounceRange,deceleration=sv._cDeceleration,frameDuration=sv._cFrameDuration,newVelocity=velocity*deceleration,newPosition=startPosition-frameDuration*newVelocity,min=flickAxis===DIM_X?(__cov_cyIK2vRXoVgOuWid4NBKqw.b['57'][0]++,bounds.minScrollX):(__cov_cyIK2vRXoVgOuWid4NBKqw.b['57'][1]++,bounds.minScrollY),max=flickAxis===DIM_X?(__cov_cyIK2vRXoVgOuWid4NBKqw.b['58'][0]++,bounds.maxScrollX):(__cov_cyIK2vRXoVgOuWid4NBKqw.b['58'][1]++,bounds.maxScrollY),belowMin=newPosition<min,belowMax=newPosition<max,aboveMin=newPosition>min,aboveMax=newPosition>max,belowMinRange=newPosition<min-bounceRange,withinMinRange=(__cov_cyIK2vRXoVgOuWid4NBKqw.b['59'][0]++,belowMin)&&(__cov_cyIK2vRXoVgOuWid4NBKqw.b['59'][1]++,newPosition>min-bounceRange),withinMaxRange=(__cov_cyIK2vRXoVgOuWid4NBKqw.b['60'][0]++,aboveMax)&&(__cov_cyIK2vRXoVgOuWid4NBKqw.b['60'][1]++,newPosition<max+bounceRange),aboveMaxRange=newPosition>max+bounceRange,tooSlow;__cov_cyIK2vRXoVgOuWid4NBKqw.s['164']++;if((__cov_cyIK2vRXoVgOuWid4NBKqw.b['62'][0]++,withinMinRange)||(__cov_cyIK2vRXoVgOuWid4NBKqw.b['62'][1]++,withinMaxRange)){__cov_cyIK2vRXoVgOuWid4NBKqw.b['61'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['165']++;newVelocity*=bounce;}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['61'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['166']++;tooSlow=Math.abs(newVelocity).toFixed(4)<0.015;__cov_cyIK2vRXoVgOuWid4NBKqw.s['167']++;if((__cov_cyIK2vRXoVgOuWid4NBKqw.b['64'][0]++,tooSlow)||(__cov_cyIK2vRXoVgOuWid4NBKqw.b['64'][1]++,belowMinRange)||(__cov_cyIK2vRXoVgOuWid4NBKqw.b['64'][2]++,aboveMaxRange)){__cov_cyIK2vRXoVgOuWid4NBKqw.b['63'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['168']++;if(sv._flickAnim){__cov_cyIK2vRXoVgOuWid4NBKqw.b['65'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['169']++;sv._cancelFlick();}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['65'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['170']++;if((__cov_cyIK2vRXoVgOuWid4NBKqw.b['67'][0]++,aboveMin)&&(__cov_cyIK2vRXoVgOuWid4NBKqw.b['67'][1]++,belowMax)){__cov_cyIK2vRXoVgOuWid4NBKqw.b['66'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['171']++;sv._onTransEnd();}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['66'][1]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['172']++;sv._snapBack();}}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['63'][1]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['173']++;sv._flickAnim=Y.later(frameDuration,sv,'_flickFrame',[newVelocity,flickAxis,newPosition]);__cov_cyIK2vRXoVgOuWid4NBKqw.s['174']++;sv.set(axisAttr,newPosition);}},_cancelFlick:function(){__cov_cyIK2vRXoVgOuWid4NBKqw.f['24']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['175']++;var sv=this;__cov_cyIK2vRXoVgOuWid4NBKqw.s['176']++;if(sv._flickAnim){__cov_cyIK2vRXoVgOuWid4NBKqw.b['68'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['177']++;sv._flickAnim.cancel();__cov_cyIK2vRXoVgOuWid4NBKqw.s['178']++;delete sv._flickAnim;}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['68'][1]++;}},_mousewheel:function(e){__cov_cyIK2vRXoVgOuWid4NBKqw.f['25']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['179']++;var sv=this,scrollY=sv.get(SCROLL_Y),bounds=sv._getBounds(),bb=sv._bb,scrollOffset=10,isForward=e.wheelDelta>0,scrollToY=scrollY-(isForward?(__cov_cyIK2vRXoVgOuWid4NBKqw.b['69'][0]++,1):(__cov_cyIK2vRXoVgOuWid4NBKqw.b['69'][1]++,-1))*scrollOffset;__cov_cyIK2vRXoVgOuWid4NBKqw.s['180']++;scrollToY=_constrain(scrollToY,bounds.minScrollY,bounds.maxScrollY);__cov_cyIK2vRXoVgOuWid4NBKqw.s['181']++;if((__cov_cyIK2vRXoVgOuWid4NBKqw.b['71'][0]++,bb.contains(e.target))&&(__cov_cyIK2vRXoVgOuWid4NBKqw.b['71'][1]++,sv._cAxis[DIM_Y])){__cov_cyIK2vRXoVgOuWid4NBKqw.b['70'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['182']++;sv.lastScrolledAmt=0;__cov_cyIK2vRXoVgOuWid4NBKqw.s['183']++;sv.set(SCROLL_Y,scrollToY);__cov_cyIK2vRXoVgOuWid4NBKqw.s['184']++;if(sv.scrollbars){__cov_cyIK2vRXoVgOuWid4NBKqw.b['72'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['185']++;sv.scrollbars._update();__cov_cyIK2vRXoVgOuWid4NBKqw.s['186']++;sv.scrollbars.flash();}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['72'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['187']++;sv._onTransEnd();__cov_cyIK2vRXoVgOuWid4NBKqw.s['188']++;e.preventDefault();}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['70'][1]++;}},_isOutOfBounds:function(x,y){__cov_cyIK2vRXoVgOuWid4NBKqw.f['26']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['189']++;var sv=this,svAxis=sv._cAxis,svAxisX=svAxis.x,svAxisY=svAxis.y,currentX=(__cov_cyIK2vRXoVgOuWid4NBKqw.b['73'][0]++,x)||(__cov_cyIK2vRXoVgOuWid4NBKqw.b['73'][1]++,sv.get(SCROLL_X)),currentY=(__cov_cyIK2vRXoVgOuWid4NBKqw.b['74'][0]++,y)||(__cov_cyIK2vRXoVgOuWid4NBKqw.b['74'][1]++,sv.get(SCROLL_Y)),bounds=sv._getBounds(),minX=bounds.minScrollX,minY=bounds.minScrollY,maxX=bounds.maxScrollX,maxY=bounds.maxScrollY;__cov_cyIK2vRXoVgOuWid4NBKqw.s['190']++;return(__cov_cyIK2vRXoVgOuWid4NBKqw.b['75'][0]++,svAxisX)&&((__cov_cyIK2vRXoVgOuWid4NBKqw.b['75'][1]++,currentX<minX)||(__cov_cyIK2vRXoVgOuWid4NBKqw.b['75'][2]++,currentX>maxX))||(__cov_cyIK2vRXoVgOuWid4NBKqw.b['75'][3]++,svAxisY)&&((__cov_cyIK2vRXoVgOuWid4NBKqw.b['75'][4]++,currentY<minY)||(__cov_cyIK2vRXoVgOuWid4NBKqw.b['75'][5]++,currentY>maxY));},_snapBack:function(){__cov_cyIK2vRXoVgOuWid4NBKqw.f['27']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['191']++;var sv=this,currentX=sv.get(SCROLL_X),currentY=sv.get(SCROLL_Y),bounds=sv._getBounds(),minX=bounds.minScrollX,minY=bounds.minScrollY,maxX=bounds.maxScrollX,maxY=bounds.maxScrollY,newY=_constrain(currentY,minY,maxY),newX=_constrain(currentX,minX,maxX),duration=sv.get(SNAP_DURATION),easing=sv.get(SNAP_EASING);__cov_cyIK2vRXoVgOuWid4NBKqw.s['192']++;if(newX!==currentX){__cov_cyIK2vRXoVgOuWid4NBKqw.b['76'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['193']++;sv.set(SCROLL_X,newX,{duration:duration,easing:easing});}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['76'][1]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['194']++;if(newY!==currentY){__cov_cyIK2vRXoVgOuWid4NBKqw.b['77'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['195']++;sv.set(SCROLL_Y,newY,{duration:duration,easing:easing});}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['77'][1]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['196']++;sv._onTransEnd();}}},_afterScrollChange:function(e){__cov_cyIK2vRXoVgOuWid4NBKqw.f['28']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['197']++;if(e.src===ScrollView.UI_SRC){__cov_cyIK2vRXoVgOuWid4NBKqw.b['78'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['198']++;return false;}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['78'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['199']++;var sv=this,duration=e.duration,easing=e.easing,val=e.newVal,scrollToArgs=[];__cov_cyIK2vRXoVgOuWid4NBKqw.s['200']++;sv.lastScrolledAmt=sv.lastScrolledAmt+(e.newVal-e.prevVal);__cov_cyIK2vRXoVgOuWid4NBKqw.s['201']++;if(e.attrName===SCROLL_X){__cov_cyIK2vRXoVgOuWid4NBKqw.b['79'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['202']++;scrollToArgs.push(val);__cov_cyIK2vRXoVgOuWid4NBKqw.s['203']++;scrollToArgs.push(sv.get(SCROLL_Y));}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['79'][1]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['204']++;scrollToArgs.push(sv.get(SCROLL_X));__cov_cyIK2vRXoVgOuWid4NBKqw.s['205']++;scrollToArgs.push(val);}__cov_cyIK2vRXoVgOuWid4NBKqw.s['206']++;scrollToArgs.push(duration);__cov_cyIK2vRXoVgOuWid4NBKqw.s['207']++;scrollToArgs.push(easing);__cov_cyIK2vRXoVgOuWid4NBKqw.s['208']++;sv.scrollTo.apply(sv,scrollToArgs);},_afterFlickChange:function(e){__cov_cyIK2vRXoVgOuWid4NBKqw.f['29']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['209']++;this._bindFlick(e.newVal);},_afterDisabledChange:function(e){__cov_cyIK2vRXoVgOuWid4NBKqw.f['30']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['210']++;this._cDisabled=e.newVal;},_afterAxisChange:function(e){__cov_cyIK2vRXoVgOuWid4NBKqw.f['31']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['211']++;this._cAxis=e.newVal;},_afterDragChange:function(e){__cov_cyIK2vRXoVgOuWid4NBKqw.f['32']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['212']++;this._bindDrag(e.newVal);},_afterDimChange:function(){__cov_cyIK2vRXoVgOuWid4NBKqw.f['33']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['213']++;this._uiDimensionsChange();},_afterScrollEnd:function(){__cov_cyIK2vRXoVgOuWid4NBKqw.f['34']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['214']++;var sv=this;__cov_cyIK2vRXoVgOuWid4NBKqw.s['215']++;if(sv._flickAnim){__cov_cyIK2vRXoVgOuWid4NBKqw.b['80'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['216']++;sv._cancelFlick();}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['80'][1]++;}},_axisSetter:function(val){__cov_cyIK2vRXoVgOuWid4NBKqw.f['35']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['217']++;if(Y.Lang.isString(val)){__cov_cyIK2vRXoVgOuWid4NBKqw.b['81'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['218']++;return{x:val.match(/x/i)?(__cov_cyIK2vRXoVgOuWid4NBKqw.b['82'][0]++,true):(__cov_cyIK2vRXoVgOuWid4NBKqw.b['82'][1]++,false),y:val.match(/y/i)?(__cov_cyIK2vRXoVgOuWid4NBKqw.b['83'][0]++,true):(__cov_cyIK2vRXoVgOuWid4NBKqw.b['83'][1]++,false)};}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['81'][1]++;}},_setScroll:function(val){__cov_cyIK2vRXoVgOuWid4NBKqw.f['36']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['219']++;if(this._cDisabled){__cov_cyIK2vRXoVgOuWid4NBKqw.b['84'][0]++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['220']++;val=Y.Attribute.INVALID_VALUE;}else{__cov_cyIK2vRXoVgOuWid4NBKqw.b['84'][1]++;}__cov_cyIK2vRXoVgOuWid4NBKqw.s['221']++;return val;},_setScrollX:function(val){__cov_cyIK2vRXoVgOuWid4NBKqw.f['37']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['222']++;return this._setScroll(val,DIM_X);},_setScrollY:function(val){__cov_cyIK2vRXoVgOuWid4NBKqw.f['38']++;__cov_cyIK2vRXoVgOuWid4NBKqw.s['223']++;return this._setScroll(val,DIM_Y);}},{NAME:'scrollview',ATTRS:{axis:{setter:'_axisSetter',writeOnce:'initOnly'},scrollX:{value:0,setter:'_setScrollX'},scrollY:{value:0,setter:'_setScrollY'},deceleration:{value:0.93},bounce:{value:0.1},flick:{value:{minDistance:10,minVelocity:0.3}},drag:{value:true},snapDuration:{value:400},snapEasing:{value:'ease-out'},easing:{value:'cubic-bezier(0, 0.1, 0, 1.0)'},frameDuration:{value:15},bounceRange:{value:150}},CLASS_NAMES:CLASS_NAMES,UI_SRC:UI,_TRANSITION:{DURATION:vendorPrefix?(__cov_cyIK2vRXoVgOuWid4NBKqw.b['85'][0]++,vendorPrefix+'TransitionDuration'):(__cov_cyIK2vRXoVgOuWid4NBKqw.b['85'][1]++,'transitionDuration'),PROPERTY:vendorPrefix?(__cov_cyIK2vRXoVgOuWid4NBKqw.b['86'][0]++,vendorPrefix+'TransitionProperty'):(__cov_cyIK2vRXoVgOuWid4NBKqw.b['86'][1]++,'transitionProperty')},BOUNCE_RANGE:false,FRAME_STEP:false,EASING:false,SNAP_EASING:false,SNAP_DURATION:false});},'@VERSION@',{'requires':['widget','event-gestures','event-mousewheel','transition'],'skinnable':true});
|
frontend/src/Pastfiles.js
|
swapnalikadam/cloudprint
|
import React, { Component } from 'react';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import AppBar from 'material-ui/AppBar';
import RaisedButton from 'material-ui/RaisedButton';
import Drawer from 'material-ui/Drawer';
import MenuItem from 'material-ui/MenuItem';
import {List, ListItem} from 'material-ui/List';
import ActionInfo from 'material-ui/svg-icons/action/info';
import Divider from 'material-ui/Divider';
import Subheader from 'material-ui/Subheader';
import Avatar from 'material-ui/Avatar';
import FileFolder from 'material-ui/svg-icons/file/folder';
import ActionAssignment from 'material-ui/svg-icons/action/assignment';
import {blue500, yellow600,red500, greenA200} from 'material-ui/styles/colors';
import EditorInsertChart from 'material-ui/svg-icons/editor/insert-chart';
import Checkbox from 'material-ui/Checkbox';
import './App.css';
import FontIcon from 'material-ui/FontIcon';
var apiBaseUrl = "http://localhost:4000/api/";
/*
Module:superagent
superagent is used to handle post/get requests to server
*/
var request = require('superagent');
export default class PastFiles extends Component {
constructor(props){
super(props);
this.state={
role:'student',
filesPreview:[],
previousfilesList:[],
filesToBePrinted:[]
}
}
componentDidMount(){
var self=this;
var req = request.get(apiBaseUrl + 'fileretrieve');
req.end(function (err,res){
if(err){
console.log("some error ");
}
else{
// console.log("response from server",JSON.stringify(res.body));
if(res.body.code=="200"){
var filestobeDisplayed = res.body.result;
var filenamesDiv=[];
for(var i in filestobeDisplayed){
filenamesDiv.push(
<ListItem
rightAvatar={<Avatar icon={<ActionAssignment />} backgroundColor={blue500} />}
primaryText={filestobeDisplayed[i].name}
leftCheckbox={<Checkbox value={filestobeDisplayed[i].name} onCheck={(event, value) => self.handleFileCheck(event,value)}/>}
/>
)
}
var fileDivContainer=[];
fileDivContainer.push(
<div className="previousfilesContainer">
<center>
<MuiThemeProvider>
<List>
<Subheader inset={true}>Files</Subheader>
{filenamesDiv}
</List>
</MuiThemeProvider>
<MuiThemeProvider>
<RaisedButton disabled={self.state.printButtonDisabled} label="Print Files" primary={true} style={style} onClick={(event) => self.handlePrinting(event)}/>
</MuiThemeProvider>
</center>
</div>
);
self.setState({filesPreview:fileDivContainer,previousfilesList:res.body.result});
}
}
})
}
handleFileCheck(event,value){
var filesToBePrinted = this.state.filesToBePrinted;
if(value){
filesToBePrinted.push({name:event.target.value})
}
else{
for(var i in filesToBePrinted){
if(filesToBePrinted[i].name == event.target.value){
filesToBePrinted.splice(i,1)
}
}
}
// console.log("somename",JSON.stringify(filesToBePrinted));
this.setState({filesToBePrinted})
}
handlePrinting(event){
var filesToBePrinted = this.state.filesToBePrinted
var req = request.post(apiBaseUrl+'pastFilesPrint')
.send({ filesArray: filesToBePrinted })
.set('Accept', 'application/json')
.end(function(err, res){
// Calling the end function will send the request
console.log("response",res);
});
}
render() {
return (
<div className="App">
{this.state.filesPreview}
</div>
)
}
}
const style = {
margin: 15,
};
|
githubprofileviewer/index.ios.js
|
pritamstyz4ever/github-profile-viewer
|
import React, { Component } from 'react';
import { AppRegistry, NavigatorIOS, StyleSheet } from 'react-native';
import Main from './app/components/Main';
export default class App extends Component {
render() {
return (
<NavigatorIOS style={styles.container}
initialRoute = {{
title : "githubprofileviewer",
component: Main
}} />
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#111111'
}
})
AppRegistry.registerComponent('githubprofileviewer', () => App);
|
frontend/List.js
|
StefanKjartansson/sundcloud
|
import React from 'react';
import {GridList, GridTile} from 'material-ui';
import history from './history';
import Actions from './Actions';
import Store from './Store';
export default class SongList extends React.Component {
constructor(props, context) {
super(props, context);
this.state = {
};
}
_getState() {
return {
items: Store.data,
};
}
_onChange() {
this.setState(this._getState());
}
componentDidMount() {
this.changeListener = this._onChange.bind(this);
Store.addChangeListener(this.changeListener);
Actions.refresh();
this.setState(this._getState());
}
render() {
if (!this.state.items) {
return <div>Loading</div>;
}
return (
<GridList>
{
this.state.items.map(tile => <GridTile
key={tile.id}
title={tile.title}
subtitle={<span>by <b>{tile.author}</b></span>}
onClick={() => {
history.push(`/song/${tile.id}`);
}}><img src={tile.img} /></GridTile>)
}
</GridList>
);
}
};
|
cheesecakes/plugins/content-manager/admin/src/components/VariableEditIcon/index.js
|
strapi/strapi-examples
|
/**
*
* VariableEditIcon
*/
import React from 'react';
import PropTypes from 'prop-types';
import cn from 'classnames';
import styles from './styles.scss';
function VariableEditIcon({ onClick, withLongerHeight, ...rest }) {
return (
<span
className={cn(withLongerHeight ? styles.editIconLonger : styles.editIcon)}
onClick={onClick}
{...rest}
/>
);
}
VariableEditIcon.defaultProps = {
onClick: () => {},
withLongerHeight: false,
};
VariableEditIcon.propTypes = {
onClick: PropTypes.func,
withLongerHeight: PropTypes.bool,
};
export default VariableEditIcon;
|
node_modules/babel-helpers/node_modules/babel-traverse/lib/path/lib/virtual-types.js
|
rajendrav5/webpack2.0
|
"use strict";
exports.__esModule = true;
exports.Flow = exports.Pure = exports.Generated = exports.User = exports.Var = exports.BlockScoped = exports.Referenced = exports.Scope = exports.Expression = exports.Statement = exports.BindingIdentifier = exports.ReferencedMemberExpression = exports.ReferencedIdentifier = undefined;
var _babelTypes = require("babel-types");
var t = _interopRequireWildcard(_babelTypes);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
var ReferencedIdentifier = exports.ReferencedIdentifier = {
types: ["Identifier", "JSXIdentifier"],
checkPath: function checkPath(_ref, opts) {
var node = _ref.node,
parent = _ref.parent;
if (!t.isIdentifier(node, opts) && !t.isJSXMemberExpression(parent, opts)) {
if (t.isJSXIdentifier(node, opts)) {
if (_babelTypes.react.isCompatTag(node.name)) return false;
} else {
return false;
}
}
return t.isReferenced(node, parent);
}
};
var ReferencedMemberExpression = exports.ReferencedMemberExpression = {
types: ["MemberExpression"],
checkPath: function checkPath(_ref2) {
var node = _ref2.node,
parent = _ref2.parent;
return t.isMemberExpression(node) && t.isReferenced(node, parent);
}
};
var BindingIdentifier = exports.BindingIdentifier = {
types: ["Identifier"],
checkPath: function checkPath(_ref3) {
var node = _ref3.node,
parent = _ref3.parent;
return t.isIdentifier(node) && t.isBinding(node, parent);
}
};
var Statement = exports.Statement = {
types: ["Statement"],
checkPath: function checkPath(_ref4) {
var node = _ref4.node,
parent = _ref4.parent;
if (t.isStatement(node)) {
if (t.isVariableDeclaration(node)) {
if (t.isForXStatement(parent, { left: node })) return false;
if (t.isForStatement(parent, { init: node })) return false;
}
return true;
} else {
return false;
}
}
};
var Expression = exports.Expression = {
types: ["Expression"],
checkPath: function checkPath(path) {
if (path.isIdentifier()) {
return path.isReferencedIdentifier();
} else {
return t.isExpression(path.node);
}
}
};
var Scope = exports.Scope = {
types: ["Scopable"],
checkPath: function checkPath(path) {
return t.isScope(path.node, path.parent);
}
};
var Referenced = exports.Referenced = {
checkPath: function checkPath(path) {
return t.isReferenced(path.node, path.parent);
}
};
var BlockScoped = exports.BlockScoped = {
checkPath: function checkPath(path) {
return t.isBlockScoped(path.node);
}
};
var Var = exports.Var = {
types: ["VariableDeclaration"],
checkPath: function checkPath(path) {
return t.isVar(path.node);
}
};
var User = exports.User = {
checkPath: function checkPath(path) {
return path.node && !!path.node.loc;
}
};
var Generated = exports.Generated = {
checkPath: function checkPath(path) {
return !path.isUser();
}
};
var Pure = exports.Pure = {
checkPath: function checkPath(path, opts) {
return path.scope.isPure(path.node, opts);
}
};
var Flow = exports.Flow = {
types: ["Flow", "ImportDeclaration", "ExportDeclaration", "ImportSpecifier"],
checkPath: function checkPath(_ref5) {
var node = _ref5.node;
if (t.isFlow(node)) {
return true;
} else if (t.isImportDeclaration(node)) {
return node.importKind === "type" || node.importKind === "typeof";
} else if (t.isExportDeclaration(node)) {
return node.exportKind === "type";
} else if (t.isImportSpecifier(node)) {
return node.importKind === "type" || node.importKind === "typeof";
} else {
return false;
}
}
};
|
src/svg-icons/action/speaker-notes-off.js
|
frnk94/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionSpeakerNotesOff = (props) => (
<SvgIcon {...props}>
<path d="M10.54 11l-.54-.54L7.54 8 6 6.46 2.38 2.84 1.27 1.73 0 3l2.01 2.01L2 22l4-4h9l5.73 5.73L22 22.46 17.54 18l-7-7zM8 14H6v-2h2v2zm-2-3V9l2 2H6zm14-9H4.08L10 7.92V6h8v2h-7.92l1 1H18v2h-4.92l6.99 6.99C21.14 17.95 22 17.08 22 16V4c0-1.1-.9-2-2-2z"/>
</SvgIcon>
);
ActionSpeakerNotesOff = pure(ActionSpeakerNotesOff);
ActionSpeakerNotesOff.displayName = 'ActionSpeakerNotesOff';
ActionSpeakerNotesOff.muiName = 'SvgIcon';
export default ActionSpeakerNotesOff;
|
src/components/Loading/Loading.js
|
labzero/lunch
|
import React from 'react';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './Loading.scss';
const Loading = () => (
<div className={s.root}>
<div><div /></div>
<div><div /></div>
<div><div /></div>
<div><div /></div>
<div><div /></div>
</div>
);
export default withStyles(s)(Loading);
|
fields/types/password/PasswordFilter.js
|
everisARQ/keystone
|
import React from 'react';
import { SegmentedControl } from 'elemental';
const EXISTS_OPTIONS = [
{ label: 'Is Set', value: true },
{ label: 'Is NOT Set', value: false },
];
function getDefaultValue () {
return {
exists: true,
};
}
var PasswordFilter = React.createClass({
propTypes: {
filter: React.PropTypes.shape({
exists: React.PropTypes.oneOf(EXISTS_OPTIONS.map(i => i.value)),
}),
},
statics: {
getDefaultValue: getDefaultValue,
},
getDefaultProps () {
return {
filter: getDefaultValue(),
};
},
toggleExists (value) {
this.props.onChange({ exists: value });
},
render () {
const { filter } = this.props;
return <SegmentedControl equalWidthSegments options={EXISTS_OPTIONS} value={filter.exists} onChange={this.toggleExists} />;
},
});
module.exports = PasswordFilter;
|
src/components/app.js
|
vamsikoduri/udemy_next_level_redux
|
import React, { Component } from 'react';
import SearchBar from '../containers/SearchBar';
import WeatherList from '../containers/weather_list'
export default class App extends Component {
render() {
return (
<div>
<SearchBar />
<WeatherList />
</div>
);
}
}
|
src/pages/about.js
|
evanfrawley/evanfrawley.github.io
|
import React from 'react';
import selfImage from '../../static/me.jpg';
import {Box, Image, Text} from "rebass";
const About = () => (
<Box className={"aboutContainer"}>
<Box className={"imageAndTaglineContainer"}>
<Box className={"imageContainer"}>
<Image src={selfImage} alt={"a picture of Evan Frawley"}/>
</Box>
<Box className={"taglineContainer"}>
<Text className={"motto"}>Personal Motto</Text>
<Text className={"taglineQuote"}>"Don't go to sleep unless you're a better version of yourself than when you woke up."</Text>
</Box>
</Box>
<Box>
<Text>Hiya! I'm Evan. I'm currently a senior at the University of Washington,
studying Informatics focusing in Software Engineering. Coming from internships
at two Seattle startups and project-focused courses at UW, my strong suit is
working with a fast moving team that ships code quickly and efficiently.
On the tech stack side, I am comfortable on both the front and back end,
having built out UIs and REST API services during my internships. In my spare time,
I enjoy being a teaching assistant for coding courses or tinkering with an
array of programming side projects.</Text>
</Box>
</Box>
);
export default About
|
modules/dreamview/frontend/src/components/common/CheckboxItem.js
|
xiaoxq/apollo
|
import React from 'react';
import classNames from 'classnames';
export default class CheckboxItem extends React.Component {
render() {
const {
id, title, isChecked, onClick, disabled, extraClasses,
} = this.props;
return (
<ul className={classNames({
item: true,
disabled,
}, extraClasses)}
>
<li
id={id}
tabIndex="0"
onClick={() => {
if (!disabled) {
onClick();
}
}}
onKeyPress={(event) => {
event.preventDefault();
if (event.key === 'Enter' || event.key === ' ') {
onClick();
}
}}
>
<div className="switch">
<input
type="checkbox"
className="toggle-switch"
name={id}
checked={isChecked}
disabled={disabled}
readOnly
/>
<label className="toggle-switch-label" htmlFor={id} />
</div>
{title && <span>{title}</span>}
</li>
</ul>
);
}
}
|
src/svg-icons/av/replay.js
|
barakmitz/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let AvReplay = (props) => (
<SvgIcon {...props}>
<path d="M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z"/>
</SvgIcon>
);
AvReplay = pure(AvReplay);
AvReplay.displayName = 'AvReplay';
AvReplay.muiName = 'SvgIcon';
export default AvReplay;
|
files/rxjs/2.3.9/rx.lite.extras.js
|
leebyron/jsdelivr
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
;(function (factory) {
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;
}
// Because of build optimizers
if (typeof define === 'function' && define.amd) {
define(['rx', 'exports'], function (Rx, exports) {
root.Rx = factory(root, exports, Rx);
return root.Rx;
});
} else if (typeof module === 'object' && module && module.exports === freeExports) {
module.exports = factory(root, module.exports, require('./rx'));
} else {
root.Rx = factory(root, {}, root.Rx);
}
}.call(this, function (root, exp, Rx, undefined) {
// References
var Observable = Rx.Observable,
observableProto = Observable.prototype,
observableNever = Observable.never,
observableThrow = Observable.throwException,
AnonymousObservable = Rx.AnonymousObservable,
Observer = Rx.Observer,
Subject = Rx.Subject,
internals = Rx.internals,
helpers = Rx.helpers,
ScheduledObserver = internals.ScheduledObserver,
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
CompositeDisposable = Rx.CompositeDisposable,
RefCountDisposable = Rx.RefCountDisposable,
disposableEmpty = Rx.Disposable.empty,
immediateScheduler = Rx.Scheduler.immediate,
defaultKeySerializer = helpers.defaultKeySerializer,
addRef = Rx.internals.addRef,
identity = helpers.identity,
isPromise = helpers.isPromise,
inherits = internals.inherits,
noop = helpers.noop,
isScheduler = helpers.isScheduler,
observableFromPromise = Observable.fromPromise,
slice = Array.prototype.slice;
function argsOrArray(args, idx) {
return args.length === 1 && Array.isArray(args[idx]) ?
args[idx] :
slice.call(args);
}
var argumentOutOfRange = 'Argument out of range';
function ScheduledDisposable(scheduler, disposable) {
this.scheduler = scheduler;
this.disposable = disposable;
this.isDisposed = false;
}
ScheduledDisposable.prototype.dispose = function () {
var parent = this;
this.scheduler.schedule(function () {
if (!parent.isDisposed) {
parent.isDisposed = true;
parent.disposable.dispose();
}
});
};
var CheckedObserver = (function (_super) {
inherits(CheckedObserver, _super);
function CheckedObserver(observer) {
_super.call(this);
this._observer = observer;
this._state = 0; // 0 - idle, 1 - busy, 2 - done
}
var CheckedObserverPrototype = CheckedObserver.prototype;
CheckedObserverPrototype.onNext = function (value) {
this.checkAccess();
try {
this._observer.onNext(value);
} catch (e) {
throw e;
} finally {
this._state = 0;
}
};
CheckedObserverPrototype.onError = function (err) {
this.checkAccess();
try {
this._observer.onError(err);
} catch (e) {
throw e;
} finally {
this._state = 2;
}
};
CheckedObserverPrototype.onCompleted = function () {
this.checkAccess();
try {
this._observer.onCompleted();
} catch (e) {
throw e;
} finally {
this._state = 2;
}
};
CheckedObserverPrototype.checkAccess = function () {
if (this._state === 1) { throw new Error('Re-entrancy detected'); }
if (this._state === 2) { throw new Error('Observer completed'); }
if (this._state === 0) { this._state = 1; }
};
return CheckedObserver;
}(Observer));
/** @private */
var ObserveOnObserver = (function (_super) {
inherits(ObserveOnObserver, _super);
/** @private */
function ObserveOnObserver() {
_super.apply(this, arguments);
}
/** @private */
ObserveOnObserver.prototype.next = function (value) {
_super.prototype.next.call(this, value);
this.ensureActive();
};
/** @private */
ObserveOnObserver.prototype.error = function (e) {
_super.prototype.error.call(this, e);
this.ensureActive();
};
/** @private */
ObserveOnObserver.prototype.completed = function () {
_super.prototype.completed.call(this);
this.ensureActive();
};
return ObserveOnObserver;
})(ScheduledObserver);
/**
* Wraps the source sequence in order to run its observer callbacks on the specified scheduler.
*
* This only invokes observer callbacks on a scheduler. In case the subscription and/or unsubscription actions have side-effects
* that require to be run on a scheduler, use subscribeOn.
*
* @param {Scheduler} scheduler Scheduler to notify observers on.
* @returns {Observable} The source sequence whose observations happen on the specified scheduler.
*/
observableProto.observeOn = function (scheduler) {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(new ObserveOnObserver(scheduler, observer));
});
};
/**
* Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used;
* see the remarks section for more information on the distinction between subscribeOn and observeOn.
* This only performs the side-effects of subscription and unsubscription on the specified scheduler. In order to invoke observer
* callbacks on a scheduler, use observeOn.
* @param {Scheduler} scheduler Scheduler to perform subscription and unsubscription actions on.
* @returns {Observable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
*/
observableProto.subscribeOn = function (scheduler) {
var source = this;
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(), d = new SerialDisposable();
d.setDisposable(m);
m.setDisposable(scheduler.schedule(function () {
d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(observer)));
}));
return d;
});
};
/**
* Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; });
* var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }, Rx.Scheduler.timeout);
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not provided, defaults to Scheduler.currentThread.
* @returns {Observable} The generated sequence.
*/
Observable.generate = function (initialState, condition, iterate, resultSelector, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var first = true, state = initialState;
return scheduler.scheduleRecursive(function (self) {
var hasResult, result;
try {
if (first) {
first = false;
} else {
state = iterate(state);
}
hasResult = condition(state);
if (hasResult) {
result = resultSelector(state);
}
} catch (exception) {
observer.onError(exception);
return;
}
if (hasResult) {
observer.onNext(result);
self();
} else {
observer.onCompleted();
}
});
});
};
/**
* Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime.
*
* @example
* var res = Rx.Observable.using(function () { return new AsyncSubject(); }, function (s) { return s; });
* @param {Function} resourceFactory Factory function to obtain a resource object.
* @param {Function} observableFactory Factory function to obtain an observable sequence that depends on the obtained resource.
* @returns {Observable} An observable sequence whose lifetime controls the lifetime of the dependent resource object.
*/
Observable.using = function (resourceFactory, observableFactory) {
return new AnonymousObservable(function (observer) {
var disposable = disposableEmpty, resource, source;
try {
resource = resourceFactory();
if (resource) {
disposable = resource;
}
source = observableFactory(resource);
} catch (exception) {
return new CompositeDisposable(observableThrow(exception).subscribe(observer), disposable);
}
return new CompositeDisposable(source.subscribe(observer), disposable);
});
};
/**
* Propagates the observable sequence or Promise that reacts first.
* @param {Observable} rightSource Second observable sequence or Promise.
* @returns {Observable} {Observable} An observable sequence that surfaces either of the given sequences, whichever reacted first.
*/
observableProto.amb = function (rightSource) {
var leftSource = this;
return new AnonymousObservable(function (observer) {
var choice,
leftChoice = 'L', rightChoice = 'R',
leftSubscription = new SingleAssignmentDisposable(),
rightSubscription = new SingleAssignmentDisposable();
isPromise(rightSource) && (rightSource = observableFromPromise(rightSource));
function choiceL() {
if (!choice) {
choice = leftChoice;
rightSubscription.dispose();
}
}
function choiceR() {
if (!choice) {
choice = rightChoice;
leftSubscription.dispose();
}
}
leftSubscription.setDisposable(leftSource.subscribe(function (left) {
choiceL();
if (choice === leftChoice) {
observer.onNext(left);
}
}, function (err) {
choiceL();
if (choice === leftChoice) {
observer.onError(err);
}
}, function () {
choiceL();
if (choice === leftChoice) {
observer.onCompleted();
}
}));
rightSubscription.setDisposable(rightSource.subscribe(function (right) {
choiceR();
if (choice === rightChoice) {
observer.onNext(right);
}
}, function (err) {
choiceR();
if (choice === rightChoice) {
observer.onError(err);
}
}, function () {
choiceR();
if (choice === rightChoice) {
observer.onCompleted();
}
}));
return new CompositeDisposable(leftSubscription, rightSubscription);
});
};
/**
* Propagates the observable sequence or Promise that reacts first.
*
* @example
* var = Rx.Observable.amb(xs, ys, zs);
* @returns {Observable} An observable sequence that surfaces any of the given sequences, whichever reacted first.
*/
Observable.amb = function () {
var acc = observableNever(),
items = argsOrArray(arguments, 0);
function func(previous, current) {
return previous.amb(current);
}
for (var i = 0, len = items.length; i < len; i++) {
acc = func(acc, items[i]);
}
return acc;
};
/**
* Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.
* @param {Observable} second Second observable sequence used to produce results after the first sequence terminates.
* @returns {Observable} An observable sequence that concatenates the first and second sequence, even if the first sequence terminates exceptionally.
*/
observableProto.onErrorResumeNext = function (second) {
if (!second) {
throw new Error('Second observable is required');
}
return onErrorResumeNext([this, second]);
};
/**
* Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.
*
* @example
* 1 - res = Rx.Observable.onErrorResumeNext(xs, ys, zs);
* 1 - res = Rx.Observable.onErrorResumeNext([xs, ys, zs]);
* @returns {Observable} An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally.
*/
var onErrorResumeNext = Observable.onErrorResumeNext = function () {
var sources = argsOrArray(arguments, 0);
return new AnonymousObservable(function (observer) {
var pos = 0, subscription = new SerialDisposable(),
cancelable = immediateScheduler.scheduleRecursive(function (self) {
var current, d;
if (pos < sources.length) {
current = sources[pos++];
isPromise(current) && (current = observableFromPromise(current));
d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(current.subscribe(observer.onNext.bind(observer), function () {
self();
}, function () {
self();
}));
} else {
observer.onCompleted();
}
});
return new CompositeDisposable(subscription, cancelable);
});
};
/**
* 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;
});
};
/**
* Projects each element of an observable sequence into zero or more windows which are produced based on element count information.
*
* var res = xs.windowWithCount(10);
* var res = xs.windowWithCount(10, 1);
* @param {Number} count Length of each window.
* @param {Number} [skip] Number of elements to skip between creation of consecutive windows. If not specified, defaults to the count.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.windowWithCount = function (count, skip) {
var source = this;
if (count <= 0) {
throw new Error(argumentOutOfRange);
}
if (arguments.length === 1) {
skip = count;
}
if (skip <= 0) {
throw new Error(argumentOutOfRange);
}
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(),
refCountDisposable = new RefCountDisposable(m),
n = 0,
q = [],
createWindow = function () {
var s = new Subject();
q.push(s);
observer.onNext(addRef(s, refCountDisposable));
};
createWindow();
m.setDisposable(source.subscribe(function (x) {
var s;
for (var i = 0, len = q.length; i < len; i++) {
q[i].onNext(x);
}
var c = n - count + 1;
if (c >= 0 && c % skip === 0) {
s = q.shift();
s.onCompleted();
}
n++;
if (n % skip === 0) {
createWindow();
}
}, function (exception) {
while (q.length > 0) {
q.shift().onError(exception);
}
observer.onError(exception);
}, function () {
while (q.length > 0) {
q.shift().onCompleted();
}
observer.onCompleted();
}));
return refCountDisposable;
});
};
/**
* Returns an array with the specified number of contiguous elements from the end of an observable sequence.
*
* @description
* This operator accumulates a buffer with a length enough to store count elements. Upon completion of the
* source sequence, this buffer is produced on the result sequence.
* @param {Number} count Number of elements to take from the end of the source sequence.
* @returns {Observable} An observable sequence containing a single array with the specified number of elements from the end of the source sequence.
*/
observableProto.takeLastBuffer = function (count) {
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && q.shift();
}, observer.onError.bind(observer), function () {
observer.onNext(q);
observer.onCompleted();
});
});
};
/**
* Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty.
*
* var res = obs = xs.defaultIfEmpty();
* 2 - obs = xs.defaultIfEmpty(false);
*
* @memberOf Observable#
* @param defaultValue The value to return if the sequence is empty. If not provided, this defaults to null.
* @returns {Observable} An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself.
*/
observableProto.defaultIfEmpty = function (defaultValue) {
var source = this;
if (defaultValue === undefined) {
defaultValue = null;
}
return new AnonymousObservable(function (observer) {
var found = false;
return source.subscribe(function (x) {
found = true;
observer.onNext(x);
}, observer.onError.bind(observer), function () {
if (!found) {
observer.onNext(defaultValue);
}
observer.onCompleted();
});
});
};
// Swap out for Array.findIndex
function arrayIndexOfComparer(array, item, comparer) {
for (var i = 0, len = array.length; i < len; i++) {
if (comparer(array[i], item)) { return i; }
}
return -1;
}
function HashSet(comparer) {
this.comparer = comparer;
this.set = [];
}
HashSet.prototype.push = function(value) {
var retValue = arrayIndexOfComparer(this.set, value, this.comparer) === -1;
retValue && this.set.push(value);
return retValue;
};
/**
* Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer.
* Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.
*
* @example
* var res = obs = xs.distinct();
* 2 - obs = xs.distinct(function (x) { return x.id; });
* 2 - obs = xs.distinct(function (x) { return x.id; }, function (a,b) { return a === b; });
* @param {Function} [keySelector] A function to compute the comparison key for each element.
* @param {Function} [comparer] Used to compare items in the collection.
* @returns {Observable} An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.
*/
observableProto.distinct = function (keySelector, comparer) {
var source = this;
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (observer) {
var hashSet = new HashSet(comparer);
return source.subscribe(function (x) {
var key = x;
if (keySelector) {
try {
key = keySelector(x);
} catch (e) {
observer.onError(e);
return;
}
}
hashSet.push(key) && observer.onNext(x);
},
observer.onError.bind(observer),
observer.onCompleted.bind(observer));
});
};
return Rx;
}));
|
packages/material-ui-icons/src/GolfCourseSharp.js
|
allanalexandre/material-ui
|
import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path fill="none" d="M0 0h24v24H0V0z" /><circle cx="19.5" cy="19.5" r="1.5" /><path d="M17 5.92L9 2v18H7v-1.73c-1.79.35-3 .99-3 1.73 0 1.1 2.69 2 6 2s6-.9 6-2c0-.99-2.16-1.81-5-1.97V8.98l6-3.06z" /></React.Fragment>
, 'GolfCourseSharp');
|
internals/templates/containers/LanguageProvider/index.js
|
ledminh/css-pages
|
/*
*
* LanguageProvider
*
* this component connects the redux state language locale to the
* IntlProvider component and i18n messages (loaded from `app/translations`)
*/
import React from 'react';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import { IntlProvider } from 'react-intl';
import { makeSelectLocale } from './selectors';
export class LanguageProvider extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
render() {
return (
<IntlProvider locale={this.props.locale} key={this.props.locale} messages={this.props.messages[this.props.locale]}>
{React.Children.only(this.props.children)}
</IntlProvider>
);
}
}
LanguageProvider.propTypes = {
locale: React.PropTypes.string,
messages: React.PropTypes.object,
children: React.PropTypes.element.isRequired,
};
const mapStateToProps = createSelector(
makeSelectLocale(),
(locale) => ({ locale })
);
function mapDispatchToProps(dispatch) {
return {
dispatch,
};
}
export default connect(mapStateToProps, mapDispatchToProps)(LanguageProvider);
|
src/components/Teaser/index.js
|
iris-dni/iris-frontend
|
import React from 'react';
import { Link } from 'react-router';
import styles from './teaser.scss';
import TeaserFooter from 'components/TeaserFooter';
import PetitionTags from 'components/PetitionTags';
import ImageContainer from 'components/ImageContainer';
const Teaser = (props) => (
<article className={styles.root}>
<Link to={props.link} className={styles.link}>
<div className={styles.tags}>
<PetitionTags isTeaser {...props.tags} />
</div>
{props.image && props.image.src &&
<div className={styles.image}>
<ImageContainer
{...props.image}
attrs={{ w: 400, h: 200 }}
srcSet={[400, 800]}
sizes={'(min-width: 900px) 320px, (min-width: 600px) 50vw, 100vw'}
/>
</div>
}
<h2 className={styles.title}>
{props.title}
</h2>
<div className={styles.footer}>
<TeaserFooter
city={props.city}
owner={props.owner}
metrics={props.metrics}
/>
</div>
</Link>
</article>
);
export default Teaser;
|
NotificationHubSample/app/DrawerContent.js
|
Azure/azure-notificationhubs-samples
|
import React from 'react';
import {
SafeAreaView,
StyleSheet,
ScrollView,
View,
StatusBar,
Button,
Image,
} from 'react-native';
import { Avatar, Title, Caption, Paragraph, Drawer } from 'react-native-paper';
import { DrawerContentScrollView, DrawerItem } from '@react-navigation/drawer';
import FontAwesome from 'react-native-vector-icons/FontAwesome';
const glbcolor = '#000';
const glbsize = 60;
import { useDispatch } from 'react-redux';
import { logoutUser } from './data/reducers/auth.reducer';
export default function DrawerContent(props) {
const dispatch = useDispatch();
const [isDarkTheme, setIsDarkTheme] = React.useState(false);
const getActiveRouteState = function (routes, index, name) {
return routes[index].name.toLowerCase().indexOf(name.toLowerCase()) >= 0;
};
return (
<View style={{ flex: 1, backgroundColor: 'linear-gradient(0deg, rgba(117, 83, 169, 1), rgba(117, 83, 169, 1)), #7553A9' }}>
<DrawerContentScrollView {...props}>
<View style={styles.drawerContent}>
<Drawer.Section style={styles.drawerSection}>
<DrawerItem
icon={({ color, size }) => (
<Image
style={{ resizeMode: 'contain', height: 35, width: 35 }}
source={require('./Pages/Icons/Logo.png')}
/>
)}
labelStyle={{ fontWeight: '600', fontSize: 18, lineHeight: 18, color: '#ffffff', marginLeft: -20 }}
label="Contoso LS"
onPress={() => {
props.navigation.navigate('Users');
}}
/>
</Drawer.Section>
<Drawer.Section style={styles.drawerSection}>
<DrawerItem
activeBackgroundColor='#6A499E'
focused={getActiveRouteState(
props.state.routes,
props.state.index,
'Users'
)}
icon={({ color, size }) => (
<Image
style={styles.Imageitem}
source={require('./Pages/Icons/user.png')}
/>
)}
labelStyle={styles.labelStyle}
label="Users"
onPress={() => {
props.navigation.navigate('Users');
}}
/>
<DrawerItem
activeBackgroundColor='#6A499E'
focused={getActiveRouteState(
props.state.routes,
props.state.index,
'Groups'
)}
icon={({ color, size }) => (
<Image
style={styles.Imageitem}
source={require('./Pages/Icons/group.png')}
/>
)}
labelStyle={styles.labelStyle}
label="Groups"
onPress={() => {
props.navigation.navigate('Groups');
}}
/>
<DrawerItem
activeBackgroundColor='#6A499E'
focused={getActiveRouteState(
props.state.routes,
props.state.index,
'Notifications'
)}
icon={({ color, size }) => (
<Image
style={styles.Imageitem}
source={require('./Pages/Icons/history.png')}
/>
)}
labelStyle={styles.labelStyle}
label="Notifications"
onPress={() => {
props.navigation.navigate('Notifications');
}}
/>
<DrawerItem
activeBackgroundColor='#6A499E'
focused={getActiveRouteState(
props.state.routes,
props.state.index,
'Statistics'
)}
icon={({ color, size }) => (
<Image
style={styles.Imageitem}
source={require('./Pages/Icons/statistics.png')}
/>
)}
labelStyle={styles.labelStyle}
label="Statistics"
onPress={() => {
props.navigation.navigate('Statistics');
}}
/>
</Drawer.Section>
</View>
</DrawerContentScrollView>
<Drawer.Section style={styles.bottomDrawerSection}>
<DrawerItem
icon={({ color, size }) => (
<Image
style={styles.Imageitem}
source={require('./Pages/Icons/logout.png')}
/>
)}
labelStyle={styles.labelStyle}
label="Sign Out"
onPress={() => {
dispatch(logoutUser());
}}
/>
</Drawer.Section>
</View>
);
}
const styles = StyleSheet.create({
drawerContent: {
flex: 1,
},
caption: {
fontSize: 14,
lineHeight: 14,
},
row: {
marginTop: 20,
flexDirection: 'row',
alignItems: 'center',
},
drawerSection: {
marginTop: 0,
},
bottomDrawerSection: {
marginBottom: 0,
borderTopColor: '#f4f4f4',
borderTopWidth: 1,
},
Imageitem: {
resizeMode: 'contain',
height: 20,
width: 20,
},
labelStyle: {
color: '#ffffff',
fontWeight: 'normal',
fontSize: 14,
paddingLeft: 0,
marginLeft: -12,
}
});
|
src/svg-icons/places/hot-tub.js
|
ichiohta/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let PlacesHotTub = (props) => (
<SvgIcon {...props}>
<circle cx="7" cy="6" r="2"/><path d="M11.15 12c-.31-.22-.59-.46-.82-.72l-1.4-1.55c-.19-.21-.43-.38-.69-.5-.29-.14-.62-.23-.96-.23h-.03C6.01 9 5 10.01 5 11.25V12H2v8c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2v-8H11.15zM7 20H5v-6h2v6zm4 0H9v-6h2v6zm4 0h-2v-6h2v6zm4 0h-2v-6h2v6zm-.35-14.14l-.07-.07c-.57-.62-.82-1.41-.67-2.2L18 3h-1.89l-.06.43c-.2 1.36.27 2.71 1.3 3.72l.07.06c.57.62.82 1.41.67 2.2l-.11.59h1.91l.06-.43c.21-1.36-.27-2.71-1.3-3.71zm-4 0l-.07-.07c-.57-.62-.82-1.41-.67-2.2L14 3h-1.89l-.06.43c-.2 1.36.27 2.71 1.3 3.72l.07.06c.57.62.82 1.41.67 2.2l-.11.59h1.91l.06-.43c.21-1.36-.27-2.71-1.3-3.71z"/>
</SvgIcon>
);
PlacesHotTub = pure(PlacesHotTub);
PlacesHotTub.displayName = 'PlacesHotTub';
PlacesHotTub.muiName = 'SvgIcon';
export default PlacesHotTub;
|
src/svg-icons/content/content-copy.js
|
pancho111203/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ContentContentCopy = (props) => (
<SvgIcon {...props}>
<path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/>
</SvgIcon>
);
ContentContentCopy = pure(ContentContentCopy);
ContentContentCopy.displayName = 'ContentContentCopy';
ContentContentCopy.muiName = 'SvgIcon';
export default ContentContentCopy;
|
tutorials06/App.js
|
Ivanwangcy/webpack-tutorials
|
import React, { Component } from 'react';
export default class App extends Component {
render() {
return (
<h1>Hello ES6, Hello React, Hello World</h1>
);
}
}
|
src/components/Footer/index.js
|
radubrehar/evanghelic.ro
|
import React from 'react';
import Text from '@app/Text';
import { primaryColorDark } from '@app/colors';
import ExternalLink from '@app/ExternalLink';
import { css } from 'glamor';
const timeStyle = {
display: 'inline-block',
marginTop: 2
};
const Footer = () => {
return (
<div
css={{
flex: 'none',
color: 'white',
width: '100%',
marginTop: 20,
padding: '1.45rem 0px',
background: primaryColorDark
}}
className={'container-fluid'}
>
<div className="row">
<div className="container">
<div
className="row justify-content-center"
style={{ textAlign: 'end' }}
>
<div className="col-4" />
<div className="col-4">
<Text
size={'std-large'}
block
style={{ paddingBottom: 10 }}
color="white"
>
Întâlniri:
</Text>
<Text size={'std'} block color="white">
<code css={timeStyle}>
Duminică: 9:30 – 12:00 & 18:00 – 20:00
</code>
</Text>
<Text size={'std'} block color="white">
<code css={timeStyle}>Joi: 18:00 – 19:30</code>
</Text>
</div>
<div className="col-4">
<Text
size={'std-large'}
block
style={{ paddingBottom: 10 }}
color="white"
>
Adresa:
</Text>
<ExternalLink
href="https://maps.google.com/maps?ll=46.778774,23.622164&z=16&t=m&hl=ro-RO&gl=RO&mapclient=embed&cid=5720872781647931140"
color="white"
>
<Text
size={'std'}
css={{
paddingBottom: 2
}}
color="white"
>
str Crișului nr 9, Cluj-Napoca, România
</Text>{' '}
</ExternalLink>
</div>
</div>
</div>
</div>
</div>
);
};
export default Footer;
|
ajax/libs/semantic-ui-react/0.62.0/semantic-ui-react.min.js
|
jonobr1/cdnjs
|
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("ReactDOM")):"function"==typeof define&&define.amd?define(["React","ReactDOM"],t):"object"==typeof exports?exports.semanticUIReact=t(require("React"),require("ReactDOM")):e.semanticUIReact=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="/",t(0)}([/*!********************!*\
!*** ./src/umd.js ***!
\********************/
function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=r(/*! ./index */319),s=n(a);e.exports=o({},s)},/*!************************!*\
!*** external "React" ***!
\************************/
function(t,r){t.exports=e},/*!**************************!*\
!*** ./src/lib/index.js ***!
\**************************/
function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.objectDiff=t.numberToWord=t.numberToWordMap=t.keyboardKey=t.SUI=t.META=t.leven=t.isBrowser=t.getElementType=t.getUnhandledProps=t.makeDebugger=t.debug=t.customPropTypes=t.useVerticalAlignProp=t.useTextAlignProp=t.useWidthProp=t.useKeyOrValueAndKey=t.useValueAndKey=t.useKeyOnly=t.childrenUtils=t.AutoControlledComponent=void 0;var a=r(/*! ./AutoControlledComponent */320);Object.defineProperty(t,"AutoControlledComponent",{enumerable:!0,get:function(){return o(a).default}});var s=r(/*! ./classNameBuilders */324);Object.defineProperty(t,"useKeyOnly",{enumerable:!0,get:function(){return s.useKeyOnly}}),Object.defineProperty(t,"useValueAndKey",{enumerable:!0,get:function(){return s.useValueAndKey}}),Object.defineProperty(t,"useKeyOrValueAndKey",{enumerable:!0,get:function(){return s.useKeyOrValueAndKey}}),Object.defineProperty(t,"useWidthProp",{enumerable:!0,get:function(){return s.useWidthProp}}),Object.defineProperty(t,"useTextAlignProp",{enumerable:!0,get:function(){return s.useTextAlignProp}}),Object.defineProperty(t,"useVerticalAlignProp",{enumerable:!0,get:function(){return s.useVerticalAlignProp}});var l=r(/*! ./debug */326);Object.defineProperty(t,"debug",{enumerable:!0,get:function(){return l.debug}}),Object.defineProperty(t,"makeDebugger",{enumerable:!0,get:function(){return l.makeDebugger}});var u=r(/*! ./factories */327);Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}})});var i=r(/*! ./getUnhandledProps */329);Object.defineProperty(t,"getUnhandledProps",{enumerable:!0,get:function(){return o(i).default}});var c=r(/*! ./getElementType */328);Object.defineProperty(t,"getElementType",{enumerable:!0,get:function(){return o(c).default}});var p=r(/*! ./isBrowser */179);Object.defineProperty(t,"isBrowser",{enumerable:!0,get:function(){return o(p).default}});var d=r(/*! ./leven */180);Object.defineProperty(t,"leven",{enumerable:!0,get:function(){return o(d).default}});var f=r(/*! ./keyboardKey */330);Object.defineProperty(t,"keyboardKey",{enumerable:!0,get:function(){return o(f).default}});var y=r(/*! ./numberToWord */91);Object.defineProperty(t,"numberToWordMap",{enumerable:!0,get:function(){return y.numberToWordMap}}),Object.defineProperty(t,"numberToWord",{enumerable:!0,get:function(){return y.numberToWord}});var m=r(/*! ./objectDiff */331);Object.defineProperty(t,"objectDiff",{enumerable:!0,get:function(){return m.objectDiff}});var h=r(/*! ./childrenUtils */323),v=n(h),b=r(/*! ./customPropTypes */325),g=n(b),P=r(/*! ./META */321),T=n(P),O=r(/*! ./SUI */322),_=n(O);t.childrenUtils=v,t.customPropTypes=g,t.META=T,t.SUI=_},/*!*******************************!*\
!*** ./~/classnames/index.js ***!
\*******************************/
function(e,t,r){var n,o;/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
!function(){"use strict";function r(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var o=typeof n;if("string"===o||"number"===o)e.push(n);else if(Array.isArray(n))e.push(r.apply(null,n));else if("object"===o)for(var s in n)a.call(n,s)&&n[s]&&e.push(s)}}return e.join(" ")}var a={}.hasOwnProperty;"undefined"!=typeof e&&e.exports?e.exports=r:(n=[],o=function(){return r}.apply(t,n),!(void 0!==o&&(e.exports=o)))}()},/*!*****************************!*\
!*** ./~/lodash/isArray.js ***!
\*****************************/
function(e,t){var r=Array.isArray;e.exports=r},/*!************************************!*\
!*** ./~/lodash/fp/placeholder.js ***!
\************************************/
function(e,t){e.exports={}},/*!********************************!*\
!*** ./~/lodash/fp/convert.js ***!
\********************************/
function(e,t,r){function n(e,t,r){return o(a,e,t,r)}var o=r(/*! ./_baseConvert */492),a=r(/*! ./_util */494);e.exports=n},/*!*****************************!*\
!*** ./~/lodash/without.js ***!
\*****************************/
function(e,t,r){var n=r(/*! ./_baseDifference */229),o=r(/*! ./_baseRest */18),a=r(/*! ./isArrayLikeObject */76),s=o(function(e,t){return a(e)?n(e,t):[]});e.exports=s},/*!************************************!*\
!*** ./src/elements/Icon/index.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Icon */46),a=n(o);t.default=a.default},/*!*************************!*\
!*** ./~/lodash/map.js ***!
\*************************/
function(e,t,r){function n(e,t){var r=l(e)?o:s;return r(e,a(t,3))}var o=r(/*! ./_arrayMap */17),a=r(/*! ./_baseIteratee */13),s=r(/*! ./_baseMap */233),l=r(/*! ./isArray */4);e.exports=n},/*!**************************!*\
!*** ./~/lodash/keys.js ***!
\**************************/
function(e,t,r){function n(e){return s(e)?o(e):a(e)}var o=r(/*! ./_arrayLikeKeys */225),a=r(/*! ./_baseKeys */118),s=r(/*! ./isArrayLike */14);e.exports=n},/*!***************************!*\
!*** ./~/lodash/_root.js ***!
\***************************/
function(e,t,r){var n=r(/*! ./_freeGlobal */244),o="object"==typeof self&&self&&self.Object===Object&&self,a=n||o||Function("return this")();e.exports=a},/*!******************************!*\
!*** ./~/lodash/isObject.js ***!
\******************************/
function(e,t){function r(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}e.exports=r},/*!***********************************!*\
!*** ./~/lodash/_baseIteratee.js ***!
\***********************************/
function(e,t,r){function n(e){return"function"==typeof e?e:null==e?s:"object"==typeof e?l(e)?a(e[0],e[1]):o(e):u(e)}var o=r(/*! ./_baseMatches */384),a=r(/*! ./_baseMatchesProperty */385),s=r(/*! ./identity */23),l=r(/*! ./isArray */4),u=r(/*! ./property */521);e.exports=n},/*!*********************************!*\
!*** ./~/lodash/isArrayLike.js ***!
\*********************************/
function(e,t,r){function n(e){return null!=e&&a(e.length)&&!o(e)}var o=r(/*! ./isFunction */28),a=r(/*! ./isLength */131);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/isObjectLike.js ***!
\**********************************/
function(e,t){function r(e){return null!=e&&"object"==typeof e}e.exports=r},/*!*******************************************!*\
!*** ./src/collections/Form/FormField.js ***!
\*******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.control,s=e.disabled,p=e.error,f=e.inline,m=e.label,h=e.required,v=e.type,b=e.width,g=(0,l.default)((0,c.useKeyOnly)(s,"disabled"),(0,c.useKeyOnly)(p,"error"),(0,c.useKeyOnly)(f,"inline"),(0,c.useKeyOnly)(h,"required"),(0,c.useWidthProp)(b,"wide"),"field",r),P=(0,c.getUnhandledProps)(o,e),T=(0,c.getElementType)(o,e);if(!n)return m?i.default.createElement(T,a({},P,{className:g}),(0,c.createHTMLLabel)(m)):i.default.createElement(T,a({},P,{className:g}),t);var O=a({},P,{children:t,required:h,type:v});return"input"!==n||"checkbox"!==v&&"radio"!==v?n===d.default||n===y.default?i.default.createElement(T,{className:g},(0,u.createElement)(n,a({},O,{label:m}))):i.default.createElement(T,{className:g},(0,c.createHTMLLabel)(m),(0,u.createElement)(n,O)):i.default.createElement(T,{className:g},i.default.createElement("label",null,(0,u.createElement)(n,O)," ",m))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ../../modules/Checkbox */50),d=n(p),f=r(/*! ../../addons/Radio */81),y=n(f);o._meta={name:"FormField",parent:"Form",type:c.META.TYPES.COLLECTION,props:{width:c.SUI.WIDTHS,control:["button","input","select","textarea"]}},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,control:c.customPropTypes.some([u.PropTypes.func,u.PropTypes.oneOf(o._meta.props.control)]),disabled:u.PropTypes.bool,error:u.PropTypes.bool,inline:u.PropTypes.bool,label:u.PropTypes.oneOfType([u.PropTypes.node,u.PropTypes.object]),required:c.customPropTypes.every([c.customPropTypes.demand(["label"]),u.PropTypes.bool]),type:c.customPropTypes.every([c.customPropTypes.demand(["control"])]),width:u.PropTypes.oneOf(o._meta.props.width)},t.default=o},/*!*******************************!*\
!*** ./~/lodash/_arrayMap.js ***!
\*******************************/
function(e,t){function r(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o}e.exports=r},/*!*******************************!*\
!*** ./~/lodash/_baseRest.js ***!
\*******************************/
function(e,t,r){function n(e,t){return s(a(e,t,o),e+"")}var o=r(/*! ./identity */23),a=r(/*! ./_overRest */255),s=r(/*! ./_setToString */126);e.exports=n},/*!**************************************!*\
!*** ./~/lodash/fp/_falseOptions.js ***!
\**************************************/
function(e,t){e.exports={cap:!1,curry:!1,fixed:!1,immutable:!1,rearg:!1}},/*!*******************************!*\
!*** ./~/lodash/toInteger.js ***!
\*******************************/
function(e,t,r){function n(e){var t=o(e),r=t%1;return t===t?r?t-r:t:0}var o=r(/*! ./toFinite */281);e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_baseGetTag.js ***!
\*********************************/
function(e,t,r){function n(e){return null==e?void 0===e?u:l:(e=Object(e),i&&i in e?a(e):s(e))}var o=r(/*! ./_Symbol */31),a=r(/*! ./_getRawTag */433),s=r(/*! ./_objectToString */464),l="[object Null]",u="[object Undefined]",i=o?o.toStringTag:void 0;e.exports=n},/*!****************************!*\
!*** ./~/lodash/_toKey.js ***!
\****************************/
function(e,t,r){function n(e){if("string"==typeof e||o(e))return e;var t=e+"";return"0"==t&&1/e==-a?"-0":t}var o=r(/*! ./isSymbol */29),a=1/0;e.exports=n},/*!******************************!*\
!*** ./~/lodash/identity.js ***!
\******************************/
function(e,t){function r(e){return e}e.exports=r},/*!******************************!*\
!*** ./~/lodash/toString.js ***!
\******************************/
function(e,t,r){function n(e){return null==e?"":o(e)}var o=r(/*! ./_baseToString */236);e.exports=n},/*!*******************************!*\
!*** ./~/lodash/_castPath.js ***!
\*******************************/
function(e,t,r){function n(e,t){return o(e)?e:a(e,t)?[e]:s(l(e))}var o=r(/*! ./isArray */4),a=r(/*! ./_isKey */124),s=r(/*! ./_stringToPath */260),l=r(/*! ./toString */24);e.exports=n},/*!********************************!*\
!*** ./~/lodash/_getNative.js ***!
\********************************/
function(e,t,r){function n(e,t){var r=a(e,t);return o(r)?r:void 0}var o=r(/*! ./_baseIsNative */380),a=r(/*! ./_getValue */434);e.exports=n},/*!*************************!*\
!*** ./~/lodash/has.js ***!
\*************************/
function(e,t,r){function n(e,t){return null!=e&&a(e,t,o)}var o=r(/*! ./_baseHas */371),a=r(/*! ./_hasPath */248);e.exports=n},/*!********************************!*\
!*** ./~/lodash/isFunction.js ***!
\********************************/
function(e,t,r){function n(e){if(!a(e))return!1;var t=o(e);return t==l||t==u||t==s||t==i}var o=r(/*! ./_baseGetTag */21),a=r(/*! ./isObject */12),s="[object AsyncFunction]",l="[object Function]",u="[object GeneratorFunction]",i="[object Proxy]";e.exports=n},/*!******************************!*\
!*** ./~/lodash/isSymbol.js ***!
\******************************/
function(e,t,r){function n(e){return"symbol"==typeof e||a(e)&&o(e)==s}var o=r(/*! ./_baseGetTag */21),a=r(/*! ./isObjectLike */15),s="[object Symbol]";e.exports=n},/*!*************************************!*\
!*** ./src/elements/Image/index.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Image */168),a=n(o);t.default=a.default},/*!*****************************!*\
!*** ./~/lodash/_Symbol.js ***!
\*****************************/
function(e,t,r){var n=r(/*! ./_root */11),o=n.Symbol;e.exports=o},/*!*******************************!*\
!*** ./~/lodash/_baseEach.js ***!
\*******************************/
function(e,t,r){var n=r(/*! ./_baseForOwn */116),o=r(/*! ./_createBaseEach */417),a=o(n);e.exports=a},/*!*********************************!*\
!*** ./~/lodash/_copyObject.js ***!
\*********************************/
function(e,t,r){function n(e,t,r,n){var s=!r;r||(r={});for(var l=-1,u=t.length;++l<u;){var i=t[l],c=n?n(r[i],e[i],i,r,e):void 0;void 0===c&&(c=e[i]),s?a(r,i,c):o(r,i,c)}return r}var o=r(/*! ./_assignValue */57),a=r(/*! ./_baseAssignValue */114);e.exports=n},/*!*************************!*\
!*** ./~/lodash/get.js ***!
\*************************/
function(e,t,r){function n(e,t,r){var n=null==e?void 0:o(e,t);return void 0===n?r:n}var o=r(/*! ./_baseGet */60);e.exports=n},/*!******************************!*\
!*** ./~/process/browser.js ***!
\******************************/
function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function o(e){if(c===setTimeout)return setTimeout(e,0);if((c===r||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function a(e){if(p===clearTimeout)return clearTimeout(e);if((p===n||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(e);try{return p(e)}catch(t){try{return p.call(null,e)}catch(t){return p.call(this,e)}}}function s(){m&&f&&(m=!1,f.length?y=f.concat(y):h=-1,y.length&&l())}function l(){if(!m){var e=o(s);m=!0;for(var t=y.length;t;){for(f=y,y=[];++h<t;)f&&f[h].run();h=-1,t=y.length}f=null,m=!1,a(e)}}function u(e,t){this.fun=e,this.array=t}function i(){}var c,p,d=e.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:r}catch(e){c=r}try{p="function"==typeof clearTimeout?clearTimeout:n}catch(e){p=n}}();var f,y=[],m=!1,h=-1;d.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];y.push(new u(e,t)),1!==y.length||m||o(l)},u.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=i,d.addListener=i,d.once=i,d.off=i,d.removeListener=i,d.removeAllListeners=i,d.emit=i,d.binding=function(e){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(e){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},/*!********************************!*\
!*** ./~/lodash/_arrayEach.js ***!
\********************************/
function(e,t){function r(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}e.exports=r},/*!*********************************!*\
!*** ./~/lodash/_baseCreate.js ***!
\*********************************/
function(e,t,r){var n=r(/*! ./isObject */12),o=Object.create,a=function(){function e(){}return function(t){if(!n(t))return{};if(o)return o(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();e.exports=a},/*!*********************************!*\
!*** ./~/lodash/_createWrap.js ***!
\*********************************/
function(e,t,r){function n(e,t,r,n,O,_,E,j){var w=t&h;if(!w&&"function"!=typeof e)throw new TypeError(y);var S=n?n.length:0;if(S||(t&=~(g|P),n=O=void 0),E=void 0===E?E:T(f(E),0),j=void 0===j?j:f(j),S-=O?O.length:0,t&P){var M=n,x=O;n=O=void 0}var N=w?void 0:i(e),A=[e,t,r,n,O,M,x,_,E,j];if(N&&c(A,N),e=A[0],t=A[1],r=A[2],n=A[3],O=A[4],j=A[9]=null==A[9]?w?0:e.length:T(A[9]-S,0),!j&&t&(v|b)&&(t&=~(v|b)),t&&t!=m)C=t==v||t==b?s(e,t,j):t!=g&&t!=(m|g)||O.length?l.apply(void 0,A):u(e,t,r,n);else var C=a(e,t,r);var k=N?o:p;return d(k(C,A),e,t)}var o=r(/*! ./_baseSetData */234),a=r(/*! ./_createBind */419),s=r(/*! ./_createCurry */422),l=r(/*! ./_createHybrid */240),u=r(/*! ./_createPartial */425),i=r(/*! ./_getData */121),c=r(/*! ./_mergeData */460),p=r(/*! ./_setData */257),d=r(/*! ./_setWrapToString */258),f=r(/*! ./toInteger */20),y="Expected a function",m=1,h=2,v=8,b=16,g=32,P=64,T=Math.max;e.exports=n},/*!******************************!*\
!*** ./~/lodash/_isIndex.js ***!
\******************************/
function(e,t){function r(e,t){return t=null==t?n:t,!!t&&("number"==typeof e||o.test(e))&&e>-1&&e%1==0&&e<t}var n=9007199254740991,o=/^(?:0|[1-9]\d*)$/;e.exports=r},/*!**********************************!*\
!*** ./~/lodash/_isPrototype.js ***!
\**********************************/
function(e,t){function r(e){var t=e&&e.constructor,r="function"==typeof t&&t.prototype||n;return e===r}var n=Object.prototype;e.exports=r},/*!*************************************!*\
!*** ./~/lodash/_replaceHolders.js ***!
\*************************************/
function(e,t){function r(e,t){for(var r=-1,o=e.length,a=0,s=[];++r<o;){var l=e[r];l!==t&&l!==n||(e[r]=n,s[a++]=r)}return s}var n="__lodash_placeholder__";e.exports=r},/*!************************!*\
!*** ./~/lodash/eq.js ***!
\************************/
function(e,t){function r(e,t){return e===t||e!==e&&t!==t}e.exports=r},/*!******************************!*\
!*** ./~/lodash/isBuffer.js ***!
\******************************/
function(e,t,r){(function(e){var n=r(/*! ./_root */11),o=r(/*! ./stubFalse */526),a="object"==typeof t&&t&&!t.nodeType&&t,s=a&&"object"==typeof e&&e&&!e.nodeType&&e,l=s&&s.exports===a,u=l?n.Buffer:void 0,i=u?u.isBuffer:void 0,c=i||o;e.exports=c}).call(t,r(/*! ./../webpack/buildin/module.js */135)(e))},/*!************************************!*\
!*** ./src/addons/Portal/index.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Portal */284),a=n(o);t.default=a.default},/*!********************************************!*\
!*** ./src/collections/Table/TableCell.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.active,r=e.children,n=e.className,s=e.collapsing,u=e.content,p=e.disabled,f=e.error,y=e.icon,m=e.negative,h=e.positive,v=e.selectable,b=e.singleLine,g=e.textAlign,P=e.verticalAlign,T=e.warning,O=e.width,_=(0,l.default)((0,c.useKeyOnly)(t,"active"),(0,c.useKeyOnly)(s,"collapsing"),(0,c.useKeyOnly)(p,"disabled"),(0,c.useKeyOnly)(f,"error"),(0,c.useKeyOnly)(m,"negative"),(0,c.useKeyOnly)(h,"positive"),(0,c.useKeyOnly)(v,"selectable"),(0,c.useKeyOnly)(b,"single line"),(0,c.useKeyOnly)(T,"warning"),(0,c.useTextAlignProp)(g),(0,c.useVerticalAlignProp)(P),(0,c.useWidthProp)(O,"wide"),n),E=(0,c.getUnhandledProps)(o,e),j=(0,c.getElementType)(o,e);return r?i.default.createElement(j,a({},E,{className:_}),r):i.default.createElement(j,a({},E,{className:_}),d.default.create(y),u)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ../../elements/Icon */8),d=n(p);o._meta={name:"TableCell",type:c.META.TYPES.COLLECTION,parent:"Table",props:{textAlign:c.SUI.TEXT_ALIGNMENTS,verticalAlign:c.SUI.VERTICAL_ALIGNMENTS,width:c.SUI.WIDTHS}},o.defaultProps={as:"td"},o.propTypes={as:c.customPropTypes.as,active:u.PropTypes.bool,children:u.PropTypes.node,className:u.PropTypes.string,collapsing:u.PropTypes.bool,content:c.customPropTypes.contentShorthand,disabled:u.PropTypes.bool,error:u.PropTypes.bool,icon:c.customPropTypes.itemShorthand,negative:u.PropTypes.bool,positive:u.PropTypes.bool,selectable:u.PropTypes.bool,singleLine:u.PropTypes.bool,textAlign:u.PropTypes.oneOf(o._meta.props.textAlign),verticalAlign:u.PropTypes.oneOf(o._meta.props.verticalAlign),warning:u.PropTypes.bool,width:u.PropTypes.oneOf(o._meta.props.width)},o.create=(0,c.createShorthandFactory)(o,function(e){return{content:e}}),t.default=o},/*!***********************************!*\
!*** ./src/elements/Icon/Icon.js ***!
\***********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.bordered,r=e.className,n=e.circular,a=e.color,s=e.corner,u=e.disabled,c=e.fitted,f=e.flipped,y=e.inverted,m=e.link,h=e.loading,v=e.name,b=e.rotated,g=e.size,P=(0,i.default)(g,a,(0,d.useKeyOnly)(t,"bordered"),(0,d.useKeyOnly)(n,"circular"),(0,d.useKeyOnly)(s,"corner"),(0,d.useKeyOnly)(u,"disabled"),(0,d.useKeyOnly)(c,"fitted"),(0,d.useValueAndKey)(f,"flipped"),(0,d.useKeyOnly)(y,"inverted"),(0,d.useKeyOnly)(m,"link"),(0,d.useKeyOnly)(h,"loading"),(0,d.useValueAndKey)(b,"rotated"),v,r,"icon"),T=(0,d.getUnhandledProps)(o,e),O=(0,d.getElementType)(o,e);return p.default.createElement(O,l({},T,{className:P}))}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/without */7),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2),f=r(/*! ./IconGroup */167),y=n(f);o.Group=y.default,o._meta={name:"Icon",type:d.META.TYPES.ELEMENT,props:{color:d.SUI.COLORS,flipped:["horizontally","vertically"],name:d.SUI.ICONS_AND_ALIASES,rotated:["clockwise","counterclockwise"],size:(0,s.default)(d.SUI.SIZES,"medium")}},o.propTypes={as:d.customPropTypes.as,bordered:c.PropTypes.bool,className:c.PropTypes.string,circular:c.PropTypes.bool,color:c.PropTypes.oneOf(o._meta.props.color),corner:c.PropTypes.bool,disabled:c.PropTypes.bool,fitted:c.PropTypes.bool,flipped:c.PropTypes.oneOf(o._meta.props.flipped),inverted:c.PropTypes.bool,name:d.customPropTypes.suggest(o._meta.props.name),link:c.PropTypes.bool,loading:c.PropTypes.bool,rotated:c.PropTypes.oneOf(o._meta.props.rotated),size:c.PropTypes.oneOf(o._meta.props.size)},o.defaultProps={as:"i"},o.create=(0,d.createShorthandFactory)(o,function(e){return{name:e}}),t.default=o},/*!*************************************!*\
!*** ./src/elements/Label/index.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Label */86),a=n(o);t.default=a.default},/*!**********************************************!*\
!*** ./src/elements/List/ListDescription.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l.default)(r,"description"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i.default.createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ListDescription",parent:"List",type:c.META.TYPES.ELEMENT},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},o.create=(0,c.createShorthandFactory)(o,function(e){return{content:e}}),t.default=o},/*!*****************************************!*\
!*** ./src/elements/List/ListHeader.js ***!
\*****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l.default)(r,"header"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i.default.createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ListHeader",parent:"List",type:c.META.TYPES.ELEMENT},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},o.create=(0,c.createShorthandFactory)(o,function(e){return{content:e}}),t.default=o},/*!***************************************!*\
!*** ./src/modules/Checkbox/index.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Checkbox */333),a=n(o);t.default=a.default},/*!************************************!*\
!*** ./src/views/Feed/FeedDate.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l.default)(r,"date"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i.default.createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"FeedDate",parent:"Feed",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},t.default=o},/*!********************************!*\
!*** ./~/lodash/_ListCache.js ***!
\********************************/
function(e,t,r){function n(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}var o=r(/*! ./_listCacheClear */449),a=r(/*! ./_listCacheDelete */450),s=r(/*! ./_listCacheGet */451),l=r(/*! ./_listCacheHas */452),u=r(/*! ./_listCacheSet */453);n.prototype.clear=o,n.prototype.delete=a,n.prototype.get=s,n.prototype.has=l,n.prototype.set=u,e.exports=n},/*!*******************************!*\
!*** ./~/lodash/_SetCache.js ***!
\*******************************/
function(e,t,r){function n(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new o;++t<r;)this.add(e[t])}var o=r(/*! ./_MapCache */110),a=r(/*! ./_setCacheAdd */467),s=r(/*! ./_setCacheHas */468);n.prototype.add=n.prototype.push=a,n.prototype.has=s,e.exports=n},/*!****************************!*\
!*** ./~/lodash/_apply.js ***!
\****************************/
function(e,t){function r(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}e.exports=r},/*!************************************!*\
!*** ./~/lodash/_arrayIncludes.js ***!
\************************************/
function(e,t,r){function n(e,t){var r=null==e?0:e.length;return!!r&&o(e,t,0)>-1}var o=r(/*! ./_baseIndexOf */232);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_arrayReduce.js ***!
\**********************************/
function(e,t){function r(e,t,r,n){var o=-1,a=null==e?0:e.length;for(n&&a&&(r=e[++o]);++o<a;)r=t(r,e[o],o,e);return r}e.exports=r},/*!**********************************!*\
!*** ./~/lodash/_assignValue.js ***!
\**********************************/
function(e,t,r){function n(e,t,r){var n=e[t];l.call(e,t)&&a(n,r)&&(void 0!==r||t in e)||o(e,t,r)}var o=r(/*! ./_baseAssignValue */114),a=r(/*! ./eq */42),s=Object.prototype,l=s.hasOwnProperty;e.exports=n},/*!***********************************!*\
!*** ./~/lodash/_assocIndexOf.js ***!
\***********************************/
function(e,t,r){function n(e,t){for(var r=e.length;r--;)if(o(e[r][0],t))return r;return-1}var o=r(/*! ./eq */42);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_baseFlatten.js ***!
\**********************************/
function(e,t,r){function n(e,t,r,s,l){var u=-1,i=e.length;for(r||(r=a),l||(l=[]);++u<i;){var c=e[u];t>0&&r(c)?t>1?n(c,t-1,r,s,l):o(l,c):s||(l[l.length]=c)}return l}var o=r(/*! ./_arrayPush */113),a=r(/*! ./_isFlattenable */446);e.exports=n},/*!******************************!*\
!*** ./~/lodash/_baseGet.js ***!
\******************************/
function(e,t,r){function n(e,t){t=o(t,e);for(var r=0,n=t.length;null!=e&&r<n;)e=e[a(t[r++])];return r&&r==n?e:void 0}var o=r(/*! ./_castPath */25),a=r(/*! ./_toKey */22);e.exports=n},/*!********************************!*\
!*** ./~/lodash/_baseSlice.js ***!
\********************************/
function(e,t){function r(e,t,r){var n=-1,o=e.length;t<0&&(t=-t>o?0:o+t),r=r>o?o:r,r<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(o);++n<o;)a[n]=e[n+t];return a}e.exports=r},/*!********************************!*\
!*** ./~/lodash/_baseUnary.js ***!
\********************************/
function(e,t){function r(e){return function(t){return e(t)}}e.exports=r},/*!*******************************!*\
!*** ./~/lodash/_cacheHas.js ***!
\*******************************/
function(e,t){function r(e,t){return e.has(t)}e.exports=r},/*!********************************!*\
!*** ./~/lodash/_copyArray.js ***!
\********************************/
function(e,t){function r(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}e.exports=r},/*!*********************************!*\
!*** ./~/lodash/_createCtor.js ***!
\*********************************/
function(e,t,r){function n(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=o(e.prototype),n=e.apply(r,t);return a(n)?n:r}}var o=r(/*! ./_baseCreate */37),a=r(/*! ./isObject */12);e.exports=n},/*!*******************************!*\
!*** ./~/lodash/_flatRest.js ***!
\*******************************/
function(e,t,r){function n(e){return s(a(e,void 0,o),e+"")}var o=r(/*! ./flatten */489),a=r(/*! ./_overRest */255),s=r(/*! ./_setToString */126);e.exports=n},/*!********************************!*\
!*** ./~/lodash/_getHolder.js ***!
\********************************/
function(e,t){function r(e){var t=e;return t.placeholder}e.exports=r},/*!*********************************!*\
!*** ./~/lodash/_getMapData.js ***!
\*********************************/
function(e,t,r){function n(e,t){var r=e.__data__;return o(t)?r["string"==typeof t?"string":"hash"]:r.map}var o=r(/*! ./_isKeyable */447);e.exports=n},/*!***********************************!*\
!*** ./~/lodash/_getPrototype.js ***!
\***********************************/
function(e,t,r){var n=r(/*! ./_overArg */125),o=n(Object.getPrototypeOf,Object);e.exports=o},/*!*************************************!*\
!*** ./~/lodash/_isIterateeCall.js ***!
\*************************************/
function(e,t,r){function n(e,t,r){if(!l(r))return!1;var n=typeof t;return!!("number"==n?a(r)&&s(t,r.length):"string"==n&&t in r)&&o(r[t],e)}var o=r(/*! ./eq */42),a=r(/*! ./isArrayLike */14),s=r(/*! ./_isIndex */39),l=r(/*! ./isObject */12);e.exports=n},/*!***********************************!*\
!*** ./~/lodash/_nativeCreate.js ***!
\***********************************/
function(e,t,r){var n=r(/*! ./_getNative */26),o=n(Object,"create");e.exports=o},/*!*********************************!*\
!*** ./~/lodash/_setToArray.js ***!
\*********************************/
function(e,t){function r(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}e.exports=r},/*!**************************!*\
!*** ./~/lodash/each.js ***!
\**************************/
function(e,t,r){e.exports=r(/*! ./forEach */491)},/*!******************************!*\
!*** ./~/lodash/includes.js ***!
\******************************/
function(e,t,r){function n(e,t,r,n){e=a(e)?e:u(e),r=r&&!n?l(r):0;var c=e.length;return r<0&&(r=i(c+r,0)),s(e)?r<=c&&e.indexOf(t,r)>-1:!!c&&o(e,t,r)>-1}var o=r(/*! ./_baseIndexOf */232),a=r(/*! ./isArrayLike */14),s=r(/*! ./isString */272),l=r(/*! ./toInteger */20),u=r(/*! ./values */134),i=Math.max;e.exports=n},/*!*********************************!*\
!*** ./~/lodash/isArguments.js ***!
\*********************************/
function(e,t,r){var n=r(/*! ./_baseIsArguments */376),o=r(/*! ./isObjectLike */15),a=Object.prototype,s=a.hasOwnProperty,l=a.propertyIsEnumerable,u=n(function(){return arguments}())?n:function(e){return o(e)&&s.call(e,"callee")&&!l.call(e,"callee")};e.exports=u},/*!***************************************!*\
!*** ./~/lodash/isArrayLikeObject.js ***!
\***************************************/
function(e,t,r){function n(e){return a(e)&&o(e)}var o=r(/*! ./isArrayLike */14),a=r(/*! ./isObjectLike */15);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/isTypedArray.js ***!
\**********************************/
function(e,t,r){var n=r(/*! ./_baseIsTypedArray */381),o=r(/*! ./_baseUnary */62),a=r(/*! ./_nodeUtil */463),s=a&&a.isTypedArray,l=s?o(s):n;e.exports=l},/*!**************************!*\
!*** ./~/lodash/omit.js ***!
\**************************/
function(e,t,r){var n=r(/*! ./_arrayMap */17),o=r(/*! ./_baseClone */115),a=r(/*! ./_baseUnset */399),s=r(/*! ./_castPath */25),l=r(/*! ./_copyObject */33),u=r(/*! ./_flatRest */66),i=r(/*! ./_getAllKeysIn */245),c=1,p=2,d=4,f=u(function(e,t){var r={};if(null==e)return r;var u=!1;t=n(t,function(t){return t=s(t,e),u||(u=t.length>1),t}),l(e,i(e),r),u&&(r=o(r,c|p|d));for(var f=t.length;f--;)a(r,t[f]);return r});e.exports=f},/*!**************************!*\
!*** ./~/lodash/pick.js ***!
\**************************/
function(e,t,r){var n=r(/*! ./_basePick */387),o=r(/*! ./_flatRest */66),a=o(function(e,t){return null==e?{}:n(e,t)});e.exports=a},/*!******************************!*\
!*** ./~/lodash/toNumber.js ***!
\******************************/
function(e,t,r){function n(e){if("number"==typeof e)return e;if(a(e))return s;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(l,"");var r=i.test(e);return r||c.test(e)?p(e.slice(2),r?2:8):u.test(e)?s:+e}var o=r(/*! ./isObject */12),a=r(/*! ./isSymbol */29),s=NaN,l=/^\s+|\s+$/g,u=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,c=/^0o[0-7]+$/i,p=parseInt;e.exports=n},/*!***********************************!*\
!*** ./src/addons/Radio/index.js ***!
\***********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Radio */285),a=n(o);t.default=a.default},/*!************************************************!*\
!*** ./src/collections/Message/MessageItem.js ***!
\************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=(0,l.default)("content",r),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i.default.createElement(u,a({},s,{className:n}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"MessageItem",parent:"Message",type:c.META.TYPES.COLLECTION},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string},o.defaultProps={as:"li"},t.default=o},/*!**********************************************!*\
!*** ./src/collections/Table/TableHeader.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.fullWidth,s=(0,l.default)((0,c.useKeyOnly)(n,"full-width"),r),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i.default.createElement(p,a({},u,{className:s}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"TableHeader",type:c.META.TYPES.COLLECTION,parent:"Table"},o.defaultProps={as:"thead"},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,fullWidth:u.PropTypes.bool},t.default=o},/*!**************************************!*\
!*** ./src/elements/Button/index.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Button */160),a=n(o);t.default=a.default},/*!*************************************!*\
!*** ./src/elements/Input/index.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Input */307),a=n(o);t.default=a.default},/*!*************************************!*\
!*** ./src/elements/Label/Label.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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)}Object.defineProperty(t,"__esModule",{value:!0});var l=r(/*! lodash/isUndefined */133),u=n(l),i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),p=r(/*! classnames */3),d=n(p),f=r(/*! react */1),y=n(f),m=r(/*! ../../lib */2),h=r(/*! ../Icon/Icon */46),v=n(h),b=r(/*! ../Image/Image */168),g=n(b),P=r(/*! ./LabelDetail */170),T=n(P),O=r(/*! ./LabelGroup */171),_=n(O),E={name:"Label",type:m.META.TYPES.ELEMENT,props:{attached:["top","bottom","top right","top left","bottom left","bottom right"],color:m.SUI.COLORS,corner:["left","right"],pointing:["above","below","left","right"],ribbon:["right"],size:m.SUI.SIZES}},j=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.handleClick=function(e){var t=n.props.onClick;t&&t(e,n.props)},n.handleRemove=function(e){var t=n.props.onRemove;t&&t(e,n.props)},s=r,a(n,s)}return s(t,e),c(t,[{key:"render",value:function(){var e=this.props,r=e.active,n=e.attached,o=e.basic,a=e.children,s=e.circular,l=e.className,c=e.color,p=e.content,f=e.corner,h=e.detail,b=e.empty,P=e.floating,O=e.horizontal,_=e.icon,E=e.image,j=e.onRemove,w=e.pointing,S=e.removeIcon,M=e.ribbon,x=e.size,N=e.tag,A=w===!0&&"pointing"||("left"===w||"right"===w)&&w+" pointing"||("above"===w||"below"===w)&&"pointing "+w,C=(0,d.default)("ui",c,A,x,(0,m.useKeyOnly)(r,"active"),(0,m.useKeyOnly)(o,"basic"),(0,m.useKeyOnly)(s,"circular"),(0,m.useKeyOnly)(b,"empty"),(0,m.useKeyOnly)(P,"floating"),(0,m.useKeyOnly)(O,"horizontal"),(0,m.useKeyOnly)(E===!0,"image"),(0,m.useKeyOnly)(N,"tag"),(0,m.useKeyOrValueAndKey)(f,"corner"),(0,m.useKeyOrValueAndKey)(M,"ribbon"),(0,m.useValueAndKey)(n,"attached"),"label",l),k=(0,m.getUnhandledProps)(t,this.props),I=(0,m.getElementType)(t,this.props);if(a)return y.default.createElement(I,i({},k,{className:C,onClick:this.handleClick}),a);var K=(0,u.default)(S)?"delete":S;return y.default.createElement(I,i({className:C,onClick:this.handleClick},k),v.default.create(_),"boolean"!=typeof E&&g.default.create(E),p,(0,m.createShorthand)(T.default,function(e){return{content:e}},h),j&&v.default.create(K,{onClick:this.handleRemove}))}}]),t}(f.Component);j.propTypes={as:m.customPropTypes.as,active:f.PropTypes.bool,attached:f.PropTypes.oneOf(E.props.attached),basic:f.PropTypes.bool,children:f.PropTypes.node,circular:f.PropTypes.bool,className:f.PropTypes.string,color:f.PropTypes.oneOf(E.props.color),content:m.customPropTypes.contentShorthand,corner:f.PropTypes.oneOfType([f.PropTypes.bool,f.PropTypes.oneOf(E.props.corner)]),detail:m.customPropTypes.itemShorthand,empty:m.customPropTypes.every([m.customPropTypes.demand(["circular"]),f.PropTypes.bool]),floating:f.PropTypes.bool,horizontal:f.PropTypes.bool,icon:m.customPropTypes.itemShorthand,image:f.PropTypes.oneOfType([f.PropTypes.bool,m.customPropTypes.itemShorthand]),pointing:f.PropTypes.oneOfType([f.PropTypes.bool,f.PropTypes.oneOf(E.props.pointing)]),onClick:f.PropTypes.func,onRemove:f.PropTypes.func,removeIcon:m.customPropTypes.itemShorthand,ribbon:f.PropTypes.oneOfType([f.PropTypes.bool,f.PropTypes.oneOf(E.props.ribbon)]),size:f.PropTypes.oneOf(E.props.size),tag:f.PropTypes.bool},j._meta=E,j.Detail=T.default,j.Group=_.default,t.default=j,j.create=(0,m.createShorthandFactory)(j,function(e){return{content:e}})},/*!******************************************!*\
!*** ./src/elements/List/ListContent.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,s=e.description,u=e.floated,p=e.header,f=e.verticalAlign,m=(0,l.default)((0,c.useValueAndKey)(u,"floated"),(0,c.useVerticalAlignProp)(f),"content",r),h=(0,c.getUnhandledProps)(o,e),v=(0,c.getElementType)(o,e);return t?i.default.createElement(v,a({},h,{className:m}),t):i.default.createElement(v,a({},h,{className:m}),y.default.create(p),d.default.create(s),n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ./ListDescription */48),d=n(p),f=r(/*! ./ListHeader */49),y=n(f);o._meta={name:"ListContent",parent:"List",type:c.META.TYPES.ELEMENT,props:{floated:c.SUI.FLOATS,verticalAlign:c.SUI.VERTICAL_ALIGNMENTS}},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand,description:c.customPropTypes.itemShorthand,floated:u.PropTypes.oneOf(o._meta.props.floated),header:c.customPropTypes.itemShorthand,verticalAlign:u.PropTypes.oneOf(o._meta.props.verticalAlign)},o.create=(0,c.createShorthandFactory)(o,function(e){return{content:e}}),t.default=o},/*!***************************************!*\
!*** ./src/elements/List/ListIcon.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.className,r=e.verticalAlign,n=(0,l.default)((0,c.useVerticalAlignProp)(r),t),s=(0,c.getUnhandledProps)(o,e);return i.default.createElement(d.default,a({},s,{className:n}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ../Icon/Icon */46),d=n(p);o._meta={name:"ListIcon",parent:"List",type:c.META.TYPES.ELEMENT,props:{verticalAlign:c.SUI.VERTICAL_ALIGNMENTS}},o.propTypes={className:u.PropTypes.string,verticalAlign:u.PropTypes.oneOf(o._meta.props.verticalAlign)},o.create=(0,c.createShorthandFactory)(o,function(e){return{name:e}}),t.default=o},/*!**********************************************!*\
!*** ./src/elements/Step/StepDescription.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.description,s=(0,l.default)(r,"description"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i.default.createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"StepDescription",parent:"Step",type:c.META.TYPES.ELEMENT},o.propTypes={as:c.customPropTypes.as,className:u.PropTypes.string,children:u.PropTypes.node,description:c.customPropTypes.contentShorthand},t.default=o},/*!****************************************!*\
!*** ./src/elements/Step/StepTitle.js ***!
\****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.title,s=(0,l.default)(r,"title"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i.default.createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"StepTitle",parent:"Step",type:c.META.TYPES.ELEMENT},o.propTypes={as:c.customPropTypes.as,className:u.PropTypes.string,children:u.PropTypes.node,title:c.customPropTypes.contentShorthand},t.default=o},/*!*********************************!*\
!*** ./src/lib/numberToWord.js ***!
\*********************************/
function(e,t){"use strict";function r(e){var t="undefined"==typeof e?"undefined":n(e);return"string"===t||"number"===t?o[e]||e:""}Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.numberToWord=r;var o=t.numberToWordMap={1:"one",2:"two",3:"three",4:"four",5:"five",6:"six",7:"seven",8:"eight",9:"nine",10:"ten",11:"eleven",12:"twelve",13:"thirteen",14:"fourteen",15:"fifteen",16:"sixteen"}},/*!***************************************!*\
!*** ./src/modules/Dropdown/index.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Dropdown */335),a=n(o);t.default=a.default},/*!*******************************************!*\
!*** ./src/views/Card/CardDescription.js ***!
\*******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l.default)(r,"description"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i.default.createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"CardDescription",parent:"Card",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},t.default=o},/*!**************************************!*\
!*** ./src/views/Card/CardHeader.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l.default)(r,"header"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i.default.createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"CardHeader",parent:"Card",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},t.default=o},/*!************************************!*\
!*** ./src/views/Card/CardMeta.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l.default)(r,"meta"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i.default.createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"CardMeta",parent:"Card",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},t.default=o},/*!***************************************!*\
!*** ./src/views/Feed/FeedContent.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,s=e.extraImages,u=e.extraText,p=e.date,f=e.meta,m=e.summary,v=(0,l.default)(r,"content"),g=(0,c.getUnhandledProps)(o,e),P=(0,c.getElementType)(o,e);return t?i.default.createElement(P,a({},g,{className:v}),t):i.default.createElement(P,a({},g,{className:v}),(0,c.createShorthand)(d.default,function(e){return{content:e}},p),(0,c.createShorthand)(b.default,function(e){return{content:e}},m),n,(0,c.createShorthand)(y.default,function(e){return{text:!0,content:e}},u),(0,c.createShorthand)(y.default,function(e){return{images:e}},s),(0,c.createShorthand)(h.default,function(e){return{content:e}},f))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ./FeedDate */51),d=n(p),f=r(/*! ./FeedExtra */97),y=n(f),m=r(/*! ./FeedMeta */100),h=n(m),v=r(/*! ./FeedSummary */101),b=n(v);o._meta={name:"FeedContent",parent:"Feed",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand,date:c.customPropTypes.itemShorthand,extraImages:y.default.propTypes.images,extraText:c.customPropTypes.itemShorthand,meta:c.customPropTypes.itemShorthand,summary:c.customPropTypes.itemShorthand},t.default=o},/*!*************************************!*\
!*** ./src/views/Feed/FeedExtra.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,a=e.images,u=e.text,c=(0,i.default)(r,(0,d.useKeyOnly)(a,"images"),(0,d.useKeyOnly)(n||u,"text"),"extra"),f=(0,d.getUnhandledProps)(o,e),y=(0,d.getElementType)(o,e);if(t)return p.default.createElement(y,l({},f,{className:c}),t);var m=(0,s.default)(a,function(e,t){var r=[t,e].join("-");return(0,d.createHTMLImage)(e,{key:r})});return p.default.createElement(y,l({},f,{className:c}),n,m)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/map */9),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2);o._meta={name:"FeedExtra",parent:"Feed",type:d.META.TYPES.VIEW},o.propTypes={as:d.customPropTypes.as,children:c.PropTypes.node,className:c.PropTypes.string,content:d.customPropTypes.contentShorthand,images:d.customPropTypes.every([d.customPropTypes.disallow(["text"]),c.PropTypes.oneOfType([c.PropTypes.bool,d.customPropTypes.collectionShorthand])]),text:c.PropTypes.bool},t.default=o},/*!*************************************!*\
!*** ./src/views/Feed/FeedLabel.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,s=e.icon,u=e.image,p=(0,l.default)(r,"label"),f=(0,c.getUnhandledProps)(o,e),y=(0,c.getElementType)(o,e);return t?i.default.createElement(y,a({},f,{className:p}),t):i.default.createElement(y,a({},f,{className:p}),n,d.default.create(s),(0,c.createHTMLImage)(u))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ../../elements/Icon */8),d=n(p);o._meta={name:"FeedLabel",parent:"Feed",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand,icon:c.customPropTypes.itemShorthand,image:c.customPropTypes.itemShorthand},t.default=o},/*!************************************!*\
!*** ./src/views/Feed/FeedLike.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,s=e.icon,u=(0,l.default)(r,"like"),p=(0,c.getUnhandledProps)(o,e),f=(0,c.getElementType)(o,e);return t?i.default.createElement(f,a({},p,{className:u}),t):i.default.createElement(f,a({},p,{className:u}),d.default.create(s),n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ../../elements/Icon */8),d=n(p);o._meta={name:"FeedLike",parent:"Feed",type:c.META.TYPES.VIEW},o.defaultProps={as:"a"},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand,icon:c.customPropTypes.itemShorthand},t.default=o},/*!************************************!*\
!*** ./src/views/Feed/FeedMeta.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,s=e.like,u=(0,l.default)(r,"meta"),p=(0,c.getUnhandledProps)(o,e),f=(0,c.getElementType)(o,e);return t?i.default.createElement(f,a({},p,{className:u}),t):i.default.createElement(f,a({},p,{className:u}),(0,c.createShorthand)(d.default,function(e){return{content:e}},s),n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ./FeedLike */99),d=n(p);o._meta={name:"FeedMeta",parent:"Feed",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand,like:c.customPropTypes.itemShorthand},t.default=o},/*!***************************************!*\
!*** ./src/views/Feed/FeedSummary.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,s=e.date,u=e.user,p=(0,l.default)(r,"summary"),f=(0,c.getUnhandledProps)(o,e),m=(0,c.getElementType)(o,e);return t?i.default.createElement(m,a({},f,{className:p}),t):i.default.createElement(m,a({},f,{className:p}),(0,c.createShorthand)(y.default,function(e){return{content:e}},u),n,(0,c.createShorthand)(d.default,function(e){return{content:e}},s))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ./FeedDate */51),d=n(p),f=r(/*! ./FeedUser */102),y=n(f);o._meta={name:"FeedSummary",parent:"Feed",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand,date:c.customPropTypes.itemShorthand,user:c.customPropTypes.itemShorthand},t.default=o},/*!************************************!*\
!*** ./src/views/Feed/FeedUser.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l.default)(r,"user"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i.default.createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"FeedUser",parent:"Feed",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},o.defaultProps={as:"a"},t.default=o},/*!*******************************************!*\
!*** ./src/views/Item/ItemDescription.js ***!
\*******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l.default)(r,"description"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i.default.createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ItemDescription",parent:"Item",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},t.default=o},/*!*************************************!*\
!*** ./src/views/Item/ItemExtra.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l.default)(r,"extra"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i.default.createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ItemExtra",parent:"Item",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},t.default=o},/*!**************************************!*\
!*** ./src/views/Item/ItemHeader.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l.default)(r,"header"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i.default.createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ItemHeader",parent:"Item",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},t.default=o},/*!************************************!*\
!*** ./src/views/Item/ItemMeta.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l.default)(r,"meta"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i.default.createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ItemMeta",parent:"Item",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},t.default=o},/*!**********************************!*\
!*** ./~/lodash/_LazyWrapper.js ***!
\**********************************/
function(e,t,r){function n(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=s,this.__views__=[]}var o=r(/*! ./_baseCreate */37),a=r(/*! ./_baseLodash */119),s=4294967295;n.prototype=o(a.prototype),n.prototype.constructor=n,e.exports=n},/*!************************************!*\
!*** ./~/lodash/_LodashWrapper.js ***!
\************************************/
function(e,t,r){function n(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}var o=r(/*! ./_baseCreate */37),a=r(/*! ./_baseLodash */119);n.prototype=o(a.prototype),n.prototype.constructor=n,e.exports=n},/*!**************************!*\
!*** ./~/lodash/_Map.js ***!
\**************************/
function(e,t,r){var n=r(/*! ./_getNative */26),o=r(/*! ./_root */11),a=n(o,"Map");e.exports=a},/*!*******************************!*\
!*** ./~/lodash/_MapCache.js ***!
\*******************************/
function(e,t,r){function n(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}var o=r(/*! ./_mapCacheClear */454),a=r(/*! ./_mapCacheDelete */455),s=r(/*! ./_mapCacheGet */456),l=r(/*! ./_mapCacheHas */457),u=r(/*! ./_mapCacheSet */458);n.prototype.clear=o,n.prototype.delete=a,n.prototype.get=s,n.prototype.has=l,n.prototype.set=u,e.exports=n},/*!****************************!*\
!*** ./~/lodash/_Stack.js ***!
\****************************/
function(e,t,r){function n(e){var t=this.__data__=new o(e);this.size=t.size}var o=r(/*! ./_ListCache */52),a=r(/*! ./_stackClear */469),s=r(/*! ./_stackDelete */470),l=r(/*! ./_stackGet */471),u=r(/*! ./_stackHas */472),i=r(/*! ./_stackSet */473);n.prototype.clear=a,n.prototype.delete=s,n.prototype.get=l,n.prototype.has=u,n.prototype.set=i,e.exports=n},/*!****************************************!*\
!*** ./~/lodash/_arrayIncludesWith.js ***!
\****************************************/
function(e,t){function r(e,t,r){for(var n=-1,o=null==e?0:e.length;++n<o;)if(r(t,e[n]))return!0;return!1}e.exports=r},/*!********************************!*\
!*** ./~/lodash/_arrayPush.js ***!
\********************************/
function(e,t){function r(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e}e.exports=r},/*!**************************************!*\
!*** ./~/lodash/_baseAssignValue.js ***!
\**************************************/
function(e,t,r){function n(e,t,r){"__proto__"==t&&o?o(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var o=r(/*! ./_defineProperty */242);e.exports=n},/*!********************************!*\
!*** ./~/lodash/_baseClone.js ***!
\********************************/
function(e,t,r){function n(e,t,r,S,M,x){var N,k=t&_,I=t&E,L=t&j;if(r&&(N=M?r(e,S,M,x):r(e)),void 0!==N)return N;if(!T(e))return e;var U=g(e);if(U){if(N=h(e),!k)return c(e,N)}else{var D=m(e),R=D==A||D==C;if(P(e))return i(e,k);if(D==K||D==w||R&&!M){if(N=I||R?{}:b(e),!k)return I?d(e,u(N,e)):p(e,l(N,e))}else{if(!J[D])return M?e:{};N=v(e,D,n,k)}}x||(x=new o);var z=x.get(e);if(z)return z;x.set(e,N);var W=L?I?y:f:I?keysIn:O,F=U?void 0:W(e);return a(F||e,function(o,a){F&&(a=o,o=e[a]),s(N,a,n(o,t,r,a,e,x))}),N}var o=r(/*! ./_Stack */111),a=r(/*! ./_arrayEach */36),s=r(/*! ./_assignValue */57),l=r(/*! ./_baseAssign */227),u=r(/*! ./_baseAssignIn */366),i=r(/*! ./_cloneBuffer */403),c=r(/*! ./_copyArray */64),p=r(/*! ./_copySymbols */412),d=r(/*! ./_copySymbolsIn */413),f=r(/*! ./_getAllKeys */431),y=r(/*! ./_getAllKeysIn */245),m=r(/*! ./_getTag */123),h=r(/*! ./_initCloneArray */442),v=r(/*! ./_initCloneByTag */443),b=r(/*! ./_initCloneObject */444),g=r(/*! ./isArray */4),P=r(/*! ./isBuffer */43),T=r(/*! ./isObject */12),O=r(/*! ./keys */10),_=1,E=2,j=4,w="[object Arguments]",S="[object Array]",M="[object Boolean]",x="[object Date]",N="[object Error]",A="[object Function]",C="[object GeneratorFunction]",k="[object Map]",I="[object Number]",K="[object Object]",L="[object RegExp]",U="[object Set]",D="[object String]",R="[object Symbol]",z="[object WeakMap]",W="[object ArrayBuffer]",F="[object DataView]",V="[object Float32Array]",B="[object Float64Array]",Y="[object Int8Array]",q="[object Int16Array]",H="[object Int32Array]",G="[object Uint8Array]",Z="[object Uint8ClampedArray]",$="[object Uint16Array]",X="[object Uint32Array]",J={};J[w]=J[S]=J[W]=J[F]=J[M]=J[x]=J[V]=J[B]=J[Y]=J[q]=J[H]=J[k]=J[I]=J[K]=J[L]=J[U]=J[D]=J[R]=J[G]=J[Z]=J[$]=J[X]=!0,J[N]=J[A]=J[z]=!1,e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_baseForOwn.js ***!
\*********************************/
function(e,t,r){function n(e,t){return e&&o(e,t,a)}var o=r(/*! ./_baseFor */370),a=r(/*! ./keys */10);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_baseIsEqual.js ***!
\**********************************/
function(e,t,r){function n(e,t,r,l,u){return e===t||(null==e||null==t||!a(e)&&!s(t)?e!==e&&t!==t:o(e,t,r,l,n,u))}var o=r(/*! ./_baseIsEqualDeep */377),a=r(/*! ./isObject */12),s=r(/*! ./isObjectLike */15);e.exports=n},/*!*******************************!*\
!*** ./~/lodash/_baseKeys.js ***!
\*******************************/
function(e,t,r){function n(e){if(!o(e))return a(e);var t=[];for(var r in Object(e))l.call(e,r)&&"constructor"!=r&&t.push(r);return t}var o=r(/*! ./_isPrototype */40),a=r(/*! ./_nativeKeys */461),s=Object.prototype,l=s.hasOwnProperty;e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_baseLodash.js ***!
\*********************************/
function(e,t){function r(){}e.exports=r},/*!***************************************!*\
!*** ./~/lodash/_cloneArrayBuffer.js ***!
\***************************************/
function(e,t,r){function n(e){var t=new e.constructor(e.byteLength);return new o(t).set(new o(e)),t}var o=r(/*! ./_Uint8Array */223);e.exports=n},/*!******************************!*\
!*** ./~/lodash/_getData.js ***!
\******************************/
function(e,t,r){var n=r(/*! ./_metaMap */254),o=r(/*! ./noop */275),a=n?function(e){return n.get(e)}:o;e.exports=a},/*!*********************************!*\
!*** ./~/lodash/_getSymbols.js ***!
\*********************************/
function(e,t,r){var n=r(/*! ./_overArg */125),o=r(/*! ./stubArray */279),a=Object.getOwnPropertySymbols,s=a?n(a,Object):o;e.exports=s},/*!*****************************!*\
!*** ./~/lodash/_getTag.js ***!
\*****************************/
function(e,t,r){var n=r(/*! ./_DataView */357),o=r(/*! ./_Map */109),a=r(/*! ./_Promise */359),s=r(/*! ./_Set */222),l=r(/*! ./_WeakMap */224),u=r(/*! ./_baseGetTag */21),i=r(/*! ./_toSource */261),c="[object Map]",p="[object Object]",d="[object Promise]",f="[object Set]",y="[object WeakMap]",m="[object DataView]",h=i(n),v=i(o),b=i(a),g=i(s),P=i(l),T=u;(n&&T(new n(new ArrayBuffer(1)))!=m||o&&T(new o)!=c||a&&T(a.resolve())!=d||s&&T(new s)!=f||l&&T(new l)!=y)&&(T=function(e){var t=u(e),r=t==p?e.constructor:void 0,n=r?i(r):"";if(n)switch(n){case h:return m;case v:return c;case b:return d;case g:return f;case P:return y}return t}),e.exports=T},/*!****************************!*\
!*** ./~/lodash/_isKey.js ***!
\****************************/
function(e,t,r){function n(e,t){if(o(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!a(e))||(l.test(e)||!s.test(e)||null!=t&&e in Object(t))}var o=r(/*! ./isArray */4),a=r(/*! ./isSymbol */29),s=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,l=/^\w*$/;e.exports=n},/*!******************************!*\
!*** ./~/lodash/_overArg.js ***!
\******************************/
function(e,t){function r(e,t){return function(r){return e(t(r))}}e.exports=r},/*!**********************************!*\
!*** ./~/lodash/_setToString.js ***!
\**********************************/
function(e,t,r){var n=r(/*! ./_baseSetToString */394),o=r(/*! ./_shortOut */259),a=o(n);e.exports=a},/*!****************************!*\
!*** ./~/lodash/filter.js ***!
\****************************/
function(e,t,r){function n(e,t){var r=l(e)?o:a;return r(e,s(t,3))}var o=r(/*! ./_arrayFilter */363),a=r(/*! ./_baseFilter */369),s=r(/*! ./_baseIteratee */13),l=r(/*! ./isArray */4);e.exports=n},/*!**************************!*\
!*** ./~/lodash/find.js ***!
\**************************/
function(e,t,r){var n=r(/*! ./_createFind */423),o=r(/*! ./findIndex */265),a=n(o);e.exports=a},/*!*****************************!*\
!*** ./~/lodash/isEmpty.js ***!
\*****************************/
function(e,t,r){function n(e){if(null==e)return!0;if(u(e)&&(l(e)||"string"==typeof e||"function"==typeof e.splice||i(e)||p(e)||s(e)))return!e.length;var t=a(e);if(t==d||t==f)return!e.size;if(c(e))return!o(e).length;for(var r in e)if(m.call(e,r))return!1;return!0}var o=r(/*! ./_baseKeys */118),a=r(/*! ./_getTag */123),s=r(/*! ./isArguments */75),l=r(/*! ./isArray */4),u=r(/*! ./isArrayLike */14),i=r(/*! ./isBuffer */43),c=r(/*! ./_isPrototype */40),p=r(/*! ./isTypedArray */77),d="[object Map]",f="[object Set]",y=Object.prototype,m=y.hasOwnProperty;e.exports=n},/*!*****************************!*\
!*** ./~/lodash/isEqual.js ***!
\*****************************/
function(e,t,r){function n(e,t){return o(e,t)}var o=r(/*! ./_baseIsEqual */117);e.exports=n},/*!******************************!*\
!*** ./~/lodash/isLength.js ***!
\******************************/
function(e,t){function r(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}var n=9007199254740991;e.exports=r},/*!***********************************!*\
!*** ./~/lodash/isPlainObject.js ***!
\***********************************/
function(e,t,r){function n(e){if(!s(e)||o(e)!=l)return!1;var t=a(e);if(null===t)return!0;var r=p.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&c.call(r)==d}var o=r(/*! ./_baseGetTag */21),a=r(/*! ./_getPrototype */69),s=r(/*! ./isObjectLike */15),l="[object Object]",u=Function.prototype,i=Object.prototype,c=u.toString,p=i.hasOwnProperty,d=c.call(Object);e.exports=n},/*!*********************************!*\
!*** ./~/lodash/isUndefined.js ***!
\*********************************/
function(e,t){function r(e){return void 0===e}e.exports=r},/*!****************************!*\
!*** ./~/lodash/values.js ***!
\****************************/
function(e,t,r){function n(e){return null==e?[]:o(e,a(e))}var o=r(/*! ./_baseValues */400),a=r(/*! ./keys */10);e.exports=n},/*!***********************************!*\
!*** (webpack)/buildin/module.js ***!
\***********************************/
function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children=[],e.webpackPolyfill=1),e}},/*!************************************!*\
!*** ./src/addons/Select/index.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Select */286),a=n(o);t.default=a.default},/*!**************************************!*\
!*** ./src/addons/TextArea/index.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./TextArea */287),a=n(o);t.default=a.default},/*!*********************************************************!*\
!*** ./src/collections/Breadcrumb/BreadcrumbDivider.js ***!
\*********************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.content,n=e.icon,s=e.className,u=(0,l.default)(s,"divider"),p=(0,c.getUnhandledProps)(o,e),f=(0,c.getElementType)(o,e);return n?d.default.create(n,a({},p,{className:u})):i.default.createElement(f,a({},p,{className:u}),r||t||"/")}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ../../elements/Icon */8),d=n(p);o._meta={name:"BreadcrumbDivider",type:c.META.TYPES.COLLECTION,parent:"Breadcrumb"},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand,icon:c.customPropTypes.itemShorthand},o.create=(0,c.createShorthandFactory)(o,function(e){return{icon:e}}),t.default=o},/*!*********************************************************!*\
!*** ./src/collections/Breadcrumb/BreadcrumbSection.js ***!
\*********************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(/*! classnames */3),c=n(i),p=r(/*! react */1),d=n(p),f=r(/*! ../../lib */2),y=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.handleClick=function(e){var t=n.props.onClick;t&&t(e,n.props)},s=r,a(n,s)}return s(t,e),u(t,[{key:"render",value:function(){var e=this.props,r=e.active,n=e.children,o=e.className,a=e.content,s=e.href,u=e.link,i=e.onClick,p=(0,c.default)((0,f.useKeyOnly)(r,"active"),"section",o),y=(0,f.getUnhandledProps)(t,this.props),m=(0,f.getElementType)(t,this.props,function(){if(u||i)return"a"});return d.default.createElement(m,l({},y,{className:p,href:s,onClick:this.handleClick}),n||a)}}]),t}(p.Component);y.propTypes={as:f.customPropTypes.as,active:p.PropTypes.bool,children:p.PropTypes.node,className:p.PropTypes.string,content:f.customPropTypes.contentShorthand,link:f.customPropTypes.every([f.customPropTypes.disallow(["href"]),p.PropTypes.bool]),href:f.customPropTypes.every([f.customPropTypes.disallow(["link"]),p.PropTypes.string]),onClick:p.PropTypes.func},y._meta={name:"BreadcrumbSection",type:f.META.TYPES.COLLECTION,parent:"Breadcrumb"},t.default=y,y.create=(0,f.createShorthandFactory)(y,function(e){return{content:e,link:!0}})},/*!********************************************!*\
!*** ./src/collections/Form/FormButton.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.control,r=(0,u.getUnhandledProps)(o,e),n=(0,u.getElementType)(o,e);return l.default.createElement(n,a({},r,{control:t}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! ../../lib */2),i=r(/*! ../../elements/Button */84),c=n(i),p=r(/*! ./FormField */16),d=n(p);o._meta={name:"FormButton",parent:"Form",type:u.META.TYPES.COLLECTION},o.propTypes={as:u.customPropTypes.as,control:d.default.propTypes.control},o.defaultProps={as:d.default,control:c.default},t.default=o},/*!**********************************************!*\
!*** ./src/collections/Form/FormCheckbox.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.control,r=(0,u.getUnhandledProps)(o,e),n=(0,u.getElementType)(o,e);return l.default.createElement(n,a({},r,{control:t}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! ../../lib */2),i=r(/*! ../../modules/Checkbox */50),c=n(i),p=r(/*! ./FormField */16),d=n(p);o._meta={name:"FormCheckbox",parent:"Form",type:u.META.TYPES.COLLECTION},o.propTypes={as:u.customPropTypes.as,control:d.default.propTypes.control},o.defaultProps={as:d.default,control:c.default},t.default=o},/*!**********************************************!*\
!*** ./src/collections/Form/FormDropdown.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.control,r=(0,u.getUnhandledProps)(o,e),n=(0,u.getElementType)(o,e);return l.default.createElement(n,a({},r,{control:t}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! ../../lib */2),i=r(/*! ../../modules/Dropdown */92),c=n(i),p=r(/*! ./FormField */16),d=n(p);o._meta={name:"FormDropdown",parent:"Form",type:u.META.TYPES.COLLECTION},o.propTypes={as:u.customPropTypes.as,control:d.default.propTypes.control},o.defaultProps={as:d.default,control:c.default},t.default=o},/*!*******************************************!*\
!*** ./src/collections/Form/FormGroup.js ***!
\*******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function a(e){var t=e.children,r=e.className,n=e.grouped,o=e.inline,l=e.widths,i=(0,c.default)((0,p.useWidthProp)(l,null,!0),(0,p.useKeyOnly)(o,"inline"),(0,p.useKeyOnly)(n,"grouped"),"fields",r),d=(0,p.getUnhandledProps)(a,e),f=(0,p.getElementType)(a,e);return u.default.createElement(f,s({},d,{className:i}),t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l=r(/*! react */1),u=n(l),i=r(/*! classnames */3),c=n(i),p=r(/*! ../../lib */2);a._meta={name:"FormGroup",parent:"Form",type:p.META.TYPES.COLLECTION,props:{widths:[].concat(o(p.SUI.WIDTHS),["equal"])}},a.propTypes={as:p.customPropTypes.as,children:l.PropTypes.node,className:l.PropTypes.string,grouped:p.customPropTypes.every([p.customPropTypes.disallow(["inline"]),l.PropTypes.bool]),inline:p.customPropTypes.every([p.customPropTypes.disallow(["grouped"]),l.PropTypes.bool]),widths:l.PropTypes.oneOf(a._meta.props.widths)},a.defaultProps={as:"div"},t.default=a},/*!*******************************************!*\
!*** ./src/collections/Form/FormInput.js ***!
\*******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.control,r=(0,u.getUnhandledProps)(o,e),n=(0,u.getElementType)(o,e);return l.default.createElement(n,a({},r,{control:t}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! ../../lib */2),i=r(/*! ../../elements/Input */85),c=n(i),p=r(/*! ./FormField */16),d=n(p);o._meta={name:"FormInput",parent:"Form",type:u.META.TYPES.COLLECTION},o.propTypes={as:u.customPropTypes.as,control:d.default.propTypes.control},o.defaultProps={as:d.default,control:c.default},t.default=o},/*!*******************************************!*\
!*** ./src/collections/Form/FormRadio.js ***!
\*******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.control,r=(0,u.getUnhandledProps)(o,e),n=(0,u.getElementType)(o,e);return l.default.createElement(n,a({},r,{control:t}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! ../../lib */2),i=r(/*! ../../addons/Radio */81),c=n(i),p=r(/*! ./FormField */16),d=n(p);o._meta={name:"FormRadio",parent:"Form",type:u.META.TYPES.COLLECTION},o.propTypes={as:u.customPropTypes.as,control:d.default.propTypes.control},o.defaultProps={as:d.default,control:c.default},t.default=o},/*!********************************************!*\
!*** ./src/collections/Form/FormSelect.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.control,r=(0,u.getUnhandledProps)(o,e),n=(0,u.getElementType)(o,e);return l.default.createElement(n,a({},r,{control:t}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! ../../lib */2),i=r(/*! ../../addons/Select */136),c=n(i),p=r(/*! ./FormField */16),d=n(p);o._meta={name:"FormSelect",parent:"Form",type:u.META.TYPES.COLLECTION},o.propTypes={as:u.customPropTypes.as,control:d.default.propTypes.control},o.defaultProps={as:d.default,control:c.default},t.default=o},/*!**********************************************!*\
!*** ./src/collections/Form/FormTextArea.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.control,r=(0,u.getUnhandledProps)(o,e),n=(0,u.getElementType)(o,e);return l.default.createElement(n,a({},r,{control:t}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! ../../lib */2),i=r(/*! ../../addons/TextArea */137),c=n(i),p=r(/*! ./FormField */16),d=n(p);o._meta={name:"FormTextArea",parent:"Form",type:u.META.TYPES.COLLECTION},o.propTypes={as:u.customPropTypes.as,control:d.default.propTypes.control},o.defaultProps={as:d.default,control:c.default},t.default=o},/*!********************************************!*\
!*** ./src/collections/Grid/GridColumn.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.computer,s=e.color,u=e.floated,p=e.largeScreen,d=e.mobile,f=e.only,y=e.stretched,m=e.tablet,h=e.textAlign,v=e.verticalAlign,b=e.widescreen,g=e.width,P=(0,l.default)(s,(0,c.useKeyOnly)(y,"stretched"),(0,c.useTextAlignProp)(h),(0,c.useValueAndKey)(u,"floated"),(0,c.useValueAndKey)(f,"only"),(0,c.useVerticalAlignProp)(v),(0,c.useWidthProp)(n,"wide computer"),(0,c.useWidthProp)(p,"wide large screen"),(0,c.useWidthProp)(d,"wide mobile"),(0,c.useWidthProp)(m,"wide tablet"),(0,c.useWidthProp)(b,"wide widescreen"),(0,c.useWidthProp)(g,"wide"),"column",r),T=(0,c.getUnhandledProps)(o,e),O=(0,c.getElementType)(o,e);return i.default.createElement(O,a({},T,{className:P}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"GridColumn",parent:"Grid",type:c.META.TYPES.COLLECTION,props:{color:c.SUI.COLORS,computer:c.SUI.WIDTHS,floated:c.SUI.FLOATS,largeScreen:c.SUI.WIDTHS,mobile:c.SUI.WIDTHS,only:["computer","large screen","mobile","tablet mobile","tablet","widescreen"],tablet:c.SUI.WIDTHS,textAlign:c.SUI.TEXT_ALIGNMENTS,verticalAlign:c.SUI.VERTICAL_ALIGNMENTS,widescreen:c.SUI.WIDTHS,width:c.SUI.WIDTHS}},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,computer:u.PropTypes.oneOf(o._meta.props.width),color:u.PropTypes.oneOf(o._meta.props.color),floated:u.PropTypes.oneOf(o._meta.props.floated),largeScreen:u.PropTypes.oneOf(o._meta.props.width),mobile:u.PropTypes.oneOf(o._meta.props.width),only:u.PropTypes.oneOf(o._meta.props.only),stretched:u.PropTypes.bool,tablet:u.PropTypes.oneOf(o._meta.props.width),textAlign:u.PropTypes.oneOf(o._meta.props.textAlign),verticalAlign:u.PropTypes.oneOf(o._meta.props.verticalAlign),widescreen:u.PropTypes.oneOf(o._meta.props.width),width:u.PropTypes.oneOf(o._meta.props.width)},t.default=o},/*!*****************************************!*\
!*** ./src/collections/Grid/GridRow.js ***!
\*****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function a(e){var t=e.centered,r=e.children,n=e.className,o=e.color,l=e.columns,i=e.divided,d=e.only,f=e.reversed,y=e.stretched,m=e.textAlign,h=e.verticalAlign,v=(0,u.default)(o,(0,p.useKeyOnly)(t,"centered"),(0,p.useKeyOnly)(i,"divided"),(0,p.useKeyOnly)(y,"stretched"),(0,p.useTextAlignProp)(m),(0,p.useValueAndKey)(d,"only"),(0,p.useValueAndKey)(f,"reversed"),(0,p.useVerticalAlignProp)(h),(0,p.useWidthProp)(l,"column",!0),"row",n),b=(0,p.getUnhandledProps)(a,e),g=(0,p.getElementType)(a,e);return c.default.createElement(g,s({},b,{className:v}),r)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l=r(/*! classnames */3),u=n(l),i=r(/*! react */1),c=n(i),p=r(/*! ../../lib */2);a._meta={name:"GridRow",parent:"Grid",type:p.META.TYPES.COLLECTION,props:{color:p.SUI.COLORS,columns:[].concat(o(p.SUI.WIDTHS),["equal"]),only:["computer","large screen","mobile","tablet mobile","tablet","widescreen"],reversed:["computer","computer vertically","mobile","mobile vertically","tablet","tablet vertically"],textAlign:p.SUI.TEXT_ALIGNMENTS,verticalAlign:p.SUI.VERTICAL_ALIGNMENTS}},a.propTypes={as:p.customPropTypes.as,centered:i.PropTypes.bool,children:i.PropTypes.node,className:i.PropTypes.string,color:i.PropTypes.oneOf(a._meta.props.color),columns:i.PropTypes.oneOf(a._meta.props.columns),divided:i.PropTypes.bool,only:i.PropTypes.oneOf(a._meta.props.only),reversed:i.PropTypes.oneOf(a._meta.props.reversed),stretched:i.PropTypes.bool,textAlign:i.PropTypes.oneOf(a._meta.props.textAlign),verticalAlign:i.PropTypes.oneOf(a._meta.props.verticalAlign)},t.default=a},/*!********************************************!*\
!*** ./src/collections/Menu/MenuHeader.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l.default)(r,"header"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i.default.createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"MenuHeader",type:c.META.TYPES.COLLECTION,parent:"Menu"},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},t.default=o},/*!******************************************!*\
!*** ./src/collections/Menu/MenuItem.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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)}Object.defineProperty(t,"__esModule",{value:!0});var l=r(/*! lodash/startCase */525),u=n(l),i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),p=r(/*! classnames */3),d=n(p),f=r(/*! react */1),y=n(f),m=r(/*! ../../lib */2),h=r(/*! ../../elements/Icon */8),v=n(h),b={name:"MenuItem",type:m.META.TYPES.COLLECTION,parent:"Menu",props:{color:m.SUI.COLORS,fitted:["horizontally","vertically"],position:["right"]}},g=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.handleClick=function(e){var t=n.props.onClick;t&&t(e,n.props)},s=r,a(n,s)}return s(t,e),c(t,[{key:"render",value:function(){var e=this.props,r=e.active,n=e.children,o=e.className,a=e.color,s=e.content,l=e.fitted,c=e.header,p=e.icon,f=e.link,h=e.name,b=e.onClick,g=e.position,P=(0,d.default)(a,g,(0,m.useKeyOnly)(r,"active"),(0,m.useKeyOnly)(p===!0||p&&!(h||s),"icon"),(0,m.useKeyOnly)(c,"header"),(0,m.useKeyOnly)(f,"link"),(0,m.useKeyOrValueAndKey)(l,"fitted"),"item",o),T=(0,m.getElementType)(t,this.props,function(){if(b)return"a"}),O=(0,m.getUnhandledProps)(t,this.props);return n?y.default.createElement(T,i({},O,{className:P,onClick:this.handleClick}),n):y.default.createElement(T,i({},O,{className:P,onClick:this.handleClick}),v.default.create(p),s||(0,u.default)(h))}}]),t}(f.Component);g.propTypes={as:m.customPropTypes.as,active:f.PropTypes.bool,children:f.PropTypes.node,className:f.PropTypes.string,color:f.PropTypes.oneOf(b.props.color),content:m.customPropTypes.contentShorthand,fitted:f.PropTypes.oneOfType([f.PropTypes.bool,f.PropTypes.oneOf(b.props.fitted)]),header:f.PropTypes.bool,icon:f.PropTypes.oneOfType([f.PropTypes.bool,m.customPropTypes.itemShorthand]),index:f.PropTypes.number,link:f.PropTypes.bool,name:f.PropTypes.string,onClick:f.PropTypes.func,position:f.PropTypes.oneOf(b.props.position)},g._meta=b,t.default=g},/*!******************************************!*\
!*** ./src/collections/Menu/MenuMenu.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.position,s=(0,l.default)(r,n,"menu"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i.default.createElement(p,a({},u,{className:s}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"MenuMenu",type:c.META.TYPES.COLLECTION,parent:"Menu",props:{position:["right"]}},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,position:u.PropTypes.oneOf(o._meta.props.position)},t.default=o},/*!***************************************************!*\
!*** ./src/collections/Message/MessageContent.js ***!
\***************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=(0,l.default)("content",r),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i.default.createElement(u,a({},s,{className:n}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"MessageContent",parent:"Message",type:c.META.TYPES.COLLECTION},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string},t.default=o},/*!**************************************************!*\
!*** ./src/collections/Message/MessageHeader.js ***!
\**************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=(0,l.default)("header",r),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i.default.createElement(u,a({},s,{className:n}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"MessageHeader",parent:"Message",type:c.META.TYPES.COLLECTION},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string},t.default=o},/*!************************************************!*\
!*** ./src/collections/Message/MessageList.js ***!
\************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.items,a=(0,i.default)("list",r),u=(0,d.getUnhandledProps)(o,e),c=(0,d.getElementType)(o,e);if(t)return p.default.createElement(c,l({},u,{className:a}),t);var f=(0,s.default)(n,function(e){return p.default.createElement(y.default,{key:e},e)});return p.default.createElement(c,l({},u,{className:a}),f)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/map */9),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2),f=r(/*! ./MessageItem */82),y=n(f);o._meta={name:"MessageList",parent:"Message",type:d.META.TYPES.COLLECTION},o.propTypes={as:d.customPropTypes.as,children:c.PropTypes.node,className:c.PropTypes.string,items:c.PropTypes.arrayOf(c.PropTypes.string)},o.defaultProps={as:"ul"},t.default=o},/*!********************************************!*\
!*** ./src/collections/Table/TableBody.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=(0,l.default)(r),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i.default.createElement(u,a({},s,{className:n}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"TableBody",type:c.META.TYPES.COLLECTION,parent:"Table"},o.defaultProps={as:"tbody"},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string},t.default=o},/*!**********************************************!*\
!*** ./src/collections/Table/TableFooter.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return s.default.createElement(i.default,e)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! react */1),s=n(a),l=r(/*! ../../lib */2),u=r(/*! ./TableHeader */83),i=n(u);o._meta={name:"TableFooter",type:l.META.TYPES.COLLECTION,parent:"Table"},o.defaultProps={as:"tfoot"},t.default=o},/*!**************************************************!*\
!*** ./src/collections/Table/TableHeaderCell.js ***!
\**************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return s.default.createElement(i.default,e)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! react */1),s=n(a),l=r(/*! ../../lib */2),u=r(/*! ./TableCell */45),i=n(u);o._meta={name:"TableHeaderCell",type:l.META.TYPES.COLLECTION,parent:"Table"},o.defaultProps={as:"th"},t.default=o},/*!*******************************************!*\
!*** ./src/collections/Table/TableRow.js ***!
\*******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.active,r=e.cellAs,n=e.cells,a=e.children,u=e.className,c=e.disabled,f=e.error,m=e.negative,h=e.positive,v=e.textAlign,b=e.verticalAlign,g=e.warning,P=(0,i.default)((0,d.useKeyOnly)(t,"active"),(0,d.useKeyOnly)(c,"disabled"),(0,d.useKeyOnly)(f,"error"),(0,d.useKeyOnly)(m,"negative"),(0,d.useKeyOnly)(h,"positive"),(0,d.useKeyOnly)(g,"warning"),(0,d.useTextAlignProp)(v),(0,d.useVerticalAlignProp)(b),u),T=(0,d.getUnhandledProps)(o,e),O=(0,d.getElementType)(o,e);return a?p.default.createElement(O,l({},T,{className:P}),a):p.default.createElement(O,l({},T,{className:P}),(0,s.default)(n,function(e){return y.default.create(e,{as:r})}))}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/map */9),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2),f=r(/*! ./TableCell */45),y=n(f);o._meta={name:"TableRow",type:d.META.TYPES.COLLECTION,parent:"Table",props:{textAlign:d.SUI.TEXT_ALIGNMENTS,verticalAlign:d.SUI.VERTICAL_ALIGNMENTS}},o.defaultProps={as:"tr",cellAs:"td"},o.propTypes={as:d.customPropTypes.as,active:c.PropTypes.bool,cellAs:d.customPropTypes.as,cells:d.customPropTypes.collectionShorthand,children:c.PropTypes.node,className:c.PropTypes.string,disabled:c.PropTypes.bool,error:c.PropTypes.bool,negative:c.PropTypes.bool,positive:c.PropTypes.bool,textAlign:c.PropTypes.oneOf(o._meta.props.textAlign),verticalAlign:c.PropTypes.oneOf(o._meta.props.verticalAlign),warning:c.PropTypes.bool},o.create=(0,d.createShorthandFactory)(o,function(e){return{cells:e}}),t.default=o},/*!***************************************!*\
!*** ./src/elements/Button/Button.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 l(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),c=r(/*! classnames */3),p=n(c),d=r(/*! react */1),f=n(d),y=r(/*! ../../lib */2),m=r(/*! ../Icon/Icon */46),h=n(m),v=r(/*! ../Label/Label */86),b=n(v),g=r(/*! ./ButtonContent */161),P=n(g),T=r(/*! ./ButtonGroup */162),O=n(T),_=r(/*! ./ButtonOr */163),E=n(_),j=(0,y.makeDebugger)("button"),w={name:"Button",type:y.META.TYPES.ELEMENT,props:{animated:["fade","vertical"],attached:["left","right","top","bottom"],color:[].concat(l(y.SUI.COLORS),["facebook","twitter","google plus","vk","linkedin","instagram","youtube"]),floated:y.SUI.FLOATS,labelPosition:["right","left"],size:y.SUI.SIZES}},S=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.handleClick=function(e){var t=n.props,r=t.disabled,o=t.onClick;return r?void e.preventDefault():void(o&&o(e,n.props))},s=r,a(n,s)}return s(t,e),i(t,[{key:"render",value:function(){var e=this.props,r=e.active,n=e.animated,o=e.attached,a=e.basic,s=e.children,l=e.circular,i=e.className,c=e.color,d=e.compact,m=e.content,v=e.disabled,g=e.floated,P=e.fluid,T=e.icon,O=e.inverted,_=e.label,E=e.labelPosition,w=e.loading,S=e.negative,M=e.positive,x=e.primary,N=e.secondary,A=e.size,C=e.toggle,k=(0,p.default)((0,y.useKeyOrValueAndKey)(E||!!_,"labeled")),I=(0,p.default)(c,A,(0,y.useKeyOnly)(r,"active"),(0,y.useKeyOrValueAndKey)(n,"animated"),(0,y.useKeyOrValueAndKey)(o,"attached"),(0,y.useKeyOnly)(a,"basic"),(0,y.useKeyOnly)(l,"circular"),(0,y.useKeyOnly)(d,"compact"),(0,y.useKeyOnly)(v,"disabled"),(0,y.useValueAndKey)(g,"floated"),(0,y.useKeyOnly)(P,"fluid"),(0,y.useKeyOnly)(T===!0||T&&(E||!s&&!m),"icon"),(0,y.useKeyOnly)(O,"inverted"),(0,y.useKeyOnly)(w,"loading"),(0,y.useKeyOnly)(S,"negative"),(0,y.useKeyOnly)(M,"positive"),(0,y.useKeyOnly)(x,"primary"),(0,y.useKeyOnly)(N,"secondary"),(0,y.useKeyOnly)(C,"toggle")),K=(0,y.getUnhandledProps)(t,this.props),L=(0,y.getElementType)(t,this.props,function(){if(_||o)return"div"}),U="div"===L?0:void 0;if(s){var D=(0,p.default)("ui",I,k,"button",i);return j("render children:",{classes:D}),f.default.createElement(L,u({},K,{className:D,tabIndex:U,onClick:this.handleClick}),s)}if(_){var R=(0,p.default)("ui",I,"button",i),z=(0,p.default)("ui",k,"button",i);j("render label:",{classes:R,containerClasses:z},this.props);var W=b.default.create(_,{basic:!0,pointing:"left"===E?"right":"left"});return f.default.createElement(L,u({},K,{className:z,onClick:this.handleClick}),"left"===E&&W,f.default.createElement("button",{className:R},h.default.create(T)," ",m),("right"===E||!E)&&W)}if(T&&!_){var F=(0,p.default)("ui",k,I,"button",i);return j("render icon && !label:",{classes:F}),f.default.createElement(L,u({},K,{className:F,tabIndex:U,onClick:this.handleClick}),h.default.create(T)," ",m)}var V=(0,p.default)("ui",k,I,"button",i);return j("render default:",{classes:V}),f.default.createElement(L,u({},K,{className:V,tabIndex:U,onClick:this.handleClick}),m)}}]),t}(d.Component);S.propTypes={as:y.customPropTypes.as,active:d.PropTypes.bool,animated:d.PropTypes.oneOfType([d.PropTypes.bool,d.PropTypes.oneOf(w.props.animated)]),attached:d.PropTypes.oneOf(w.props.attached),basic:d.PropTypes.bool,children:y.customPropTypes.every([d.PropTypes.node,y.customPropTypes.disallow(["label"]),y.customPropTypes.givenProps({icon:d.PropTypes.oneOfType([d.PropTypes.string.isRequired,d.PropTypes.object.isRequired,d.PropTypes.element.isRequired])},y.customPropTypes.disallow(["icon"]))]),circular:d.PropTypes.bool,className:d.PropTypes.string,content:y.customPropTypes.contentShorthand,color:d.PropTypes.oneOf(w.props.color),compact:d.PropTypes.bool,disabled:d.PropTypes.bool,floated:d.PropTypes.oneOf(w.props.floated),fluid:d.PropTypes.bool,icon:y.customPropTypes.some([d.PropTypes.bool,d.PropTypes.string,d.PropTypes.object,d.PropTypes.element]),inverted:d.PropTypes.bool,labelPosition:d.PropTypes.oneOf(w.props.labelPosition),label:y.customPropTypes.some([d.PropTypes.string,d.PropTypes.object,d.PropTypes.element]),loading:d.PropTypes.bool,negative:d.PropTypes.bool,onClick:d.PropTypes.func,positive:d.PropTypes.bool,primary:d.PropTypes.bool,secondary:d.PropTypes.bool,toggle:d.PropTypes.bool,size:d.PropTypes.oneOf(w.props.size)},S.defaultProps={as:"button"},S._meta=w,S.Content=P.default,S.Group=O.default,S.Or=E.default,S.create=(0,y.createShorthandFactory)(S,function(e){return{content:e}}),t.default=S},/*!**********************************************!*\
!*** ./src/elements/Button/ButtonContent.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.hidden,s=e.visible,u=(0,l.default)((0,c.useKeyOnly)(s,"visible"),(0,c.useKeyOnly)(n,"hidden"),"content",r),p=(0,c.getUnhandledProps)(o,e),d=(0,c.getElementType)(o,e);return i.default.createElement(d,a({},p,{className:u}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ButtonContent",parent:"Button",type:c.META.TYPES.ELEMENT},o.propTypes={as:c.customPropTypes.as,className:u.PropTypes.string,children:u.PropTypes.node,hidden:u.PropTypes.bool,visible:u.PropTypes.bool},t.default=o},/*!********************************************!*\
!*** ./src/elements/Button/ButtonGroup.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.attached,r=e.basic,n=e.children,s=e.className,u=e.color,p=e.compact,d=e.fluid,f=e.icon,y=e.inverted,m=e.labeled,h=e.negative,v=e.positive,b=e.primary,g=e.secondary,P=e.size,T=e.toggle,O=e.vertical,_=e.widths,E=(0,l.default)("ui",P,u,(0,c.useValueAndKey)(t,"attached"),(0,c.useKeyOnly)(r,"basic"),(0,c.useKeyOnly)(p,"compact"),(0,c.useKeyOnly)(d,"fluid"),(0,c.useKeyOnly)(f,"icon"),(0,c.useKeyOnly)(y,"inverted"),(0,c.useKeyOnly)(m,"labeled"),(0,c.useKeyOnly)(h,"negative"),(0,c.useKeyOnly)(v,"positive"),(0,c.useKeyOnly)(b,"primary"),(0,c.useKeyOnly)(g,"secondary"),(0,c.useKeyOnly)(T,"toggle"),(0,c.useKeyOnly)(O,"vertical"),(0,c.useWidthProp)(_),"buttons",s),j=(0,c.getUnhandledProps)(o,e),w=(0,c.getElementType)(o,e);return i.default.createElement(w,a({},j,{className:E}),n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ButtonGroup",parent:"Button",type:c.META.TYPES.ELEMENT,props:{attached:["left","right","top","bottom"],color:c.SUI.COLORS,size:c.SUI.SIZES,widths:c.SUI.WIDTHS}},o.propTypes={as:c.customPropTypes.as,attached:u.PropTypes.oneOf(o._meta.props.attached),basic:u.PropTypes.bool,className:u.PropTypes.string,children:u.PropTypes.node,color:u.PropTypes.oneOf(o._meta.props.color),compact:u.PropTypes.bool,fluid:u.PropTypes.bool,icon:u.PropTypes.bool,inverted:u.PropTypes.bool,labeled:u.PropTypes.bool,negative:u.PropTypes.bool,positive:u.PropTypes.bool,primary:u.PropTypes.bool,secondary:u.PropTypes.bool,size:u.PropTypes.oneOf(o._meta.props.size),toggle:u.PropTypes.bool,vertical:u.PropTypes.bool,widths:u.PropTypes.oneOf(o._meta.props.widths)},t.default=o},/*!*****************************************!*\
!*** ./src/elements/Button/ButtonOr.js ***!
\*****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.className,r=(0,l.default)("or",t),n=(0,c.getUnhandledProps)(o,e),s=(0,c.getElementType)(o,e);return i.default.createElement(s,a({},n,{className:r}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ButtonOr",parent:"Button",type:c.META.TYPES.ELEMENT},o.propTypes={as:c.customPropTypes.as,className:u.PropTypes.string},t.default=o},/*!************************************!*\
!*** ./src/elements/Flag/index.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Flag */304),a=n(o);t.default=a.default},/*!**********************************************!*\
!*** ./src/elements/Header/HeaderContent.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=(0,l.default)(r,"content"),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i.default.createElement(u,a({},s,{className:n}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"HeaderContent",parent:"Header",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string},t.default=o},/*!************************************************!*\
!*** ./src/elements/Header/HeaderSubheader.js ***!
\************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l.default)("sub header",r),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i.default.createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"HeaderSubheader",parent:"Header",type:c.META.TYPES.ELEMENT},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},o.create=(0,c.createShorthandFactory)(o,function(e){return{content:e}}),t.default=o},/*!****************************************!*\
!*** ./src/elements/Icon/IconGroup.js ***!
\****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.size,s=(0,l.default)(n,"icons",r),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i.default.createElement(p,a({},u,{className:s}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"IconGroup",parent:"Icon",type:c.META.TYPES.ELEMENT,props:{size:c.SUI.SIZES}},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,size:u.PropTypes.oneOf(o._meta.props.size)},o.defaultProps={as:"i"},t.default=o},/*!*************************************!*\
!*** ./src/elements/Image/Image.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.alt,r=e.avatar,n=e.bordered,s=e.centered,u=e.children,p=e.className,f=e.dimmer,m=e.disabled,h=e.floated,v=e.fluid,b=e.height,g=e.hidden,P=e.href,T=e.inline,O=e.label,_=e.shape,E=e.size,j=e.spaced,w=e.src,S=e.verticalAlign,M=e.width,x=e.wrapped,N=e.ui,A=(0,l.default)((0,c.useKeyOnly)(N,"ui"),E,_,(0,c.useKeyOnly)(r,"avatar"),(0,c.useKeyOnly)(n,"bordered"),(0,c.useKeyOnly)(s,"centered"),(0,c.useKeyOnly)(m,"disabled"),(0,c.useKeyOnly)(v,"fluid"),(0,c.useKeyOnly)(g,"hidden"),(0,c.useKeyOnly)(T,"inline"),(0,c.useKeyOrValueAndKey)(j,"spaced"),(0,c.useValueAndKey)(h,"floated"),(0,c.useVerticalAlignProp)(S,"aligned"),"image",p),C=(0,c.getUnhandledProps)(o,e),k=(0,c.getElementType)(o,e,function(){if(f||O||x||u)return"div"});if(u)return i.default.createElement(k,a({},C,{className:A}),u);var I=a({},C,{className:A}),K={alt:t,src:w,height:b,width:M};return"img"===k?i.default.createElement(k,a({},I,K)):i.default.createElement(k,a({},I,{href:P}),d.default.create(f),y.default.create(O),i.default.createElement("img",K))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ../../modules/Dimmer */184),d=n(p),f=r(/*! ../Label/Label */86),y=n(f),m=r(/*! ./ImageGroup */169),h=n(m);o.Group=h.default,o._meta={name:"Image",type:c.META.TYPES.ELEMENT,props:{verticalAlign:c.SUI.VERTICAL_ALIGNMENTS,floated:c.SUI.FLOATS,shape:["rounded","circular"],size:c.SUI.SIZES,spaced:["left","right"]}},o.propTypes={as:c.customPropTypes.as,alt:u.PropTypes.string,avatar:u.PropTypes.bool,bordered:u.PropTypes.bool,centered:u.PropTypes.bool,children:u.PropTypes.node,className:u.PropTypes.string,disabled:u.PropTypes.bool,dimmer:c.customPropTypes.itemShorthand,floated:u.PropTypes.oneOf(o._meta.props.floated),fluid:c.customPropTypes.every([u.PropTypes.bool,c.customPropTypes.disallow(["size"])]),height:u.PropTypes.oneOfType([u.PropTypes.string,u.PropTypes.number]),hidden:u.PropTypes.bool,href:u.PropTypes.string,inline:u.PropTypes.bool,label:c.customPropTypes.itemShorthand,shape:u.PropTypes.oneOf(o._meta.props.shape),size:u.PropTypes.oneOf(o._meta.props.size),spaced:u.PropTypes.oneOfType([u.PropTypes.bool,u.PropTypes.oneOf(o._meta.props.spaced)]),src:u.PropTypes.string,ui:u.PropTypes.bool,verticalAlign:u.PropTypes.oneOf(o._meta.props.verticalAlign),width:u.PropTypes.oneOfType([u.PropTypes.string,u.PropTypes.number]),wrapped:c.customPropTypes.every([u.PropTypes.bool,c.customPropTypes.disallow(["href"])])},o.defaultProps={as:"img",ui:!0},o.create=(0,c.createShorthandFactory)(o,function(e){return{src:e}}),t.default=o},/*!******************************************!*\
!*** ./src/elements/Image/ImageGroup.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.size,s=(0,i.default)("ui",n,r,"images"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return l.default.createElement(p,a({},u,{className:s}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! classnames */3),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ImageGroup",parent:"Image",type:c.META.TYPES.ELEMENT,props:{size:c.SUI.SIZES}},o.propTypes={as:c.customPropTypes.as,children:s.PropTypes.node,className:s.PropTypes.string,size:s.PropTypes.oneOf(o._meta.props.size)},t.default=o},/*!*******************************************!*\
!*** ./src/elements/Label/LabelDetail.js ***!
\*******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l.default)("detail",r),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i.default.createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"LabelDetail",parent:"Label",type:c.META.TYPES.ELEMENT},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},t.default=o},/*!******************************************!*\
!*** ./src/elements/Label/LabelGroup.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.circular,n=e.className,s=e.color,u=e.size,p=e.tag,d=(0,l.default)("ui",s,u,(0,c.useKeyOnly)(r,"circular"),(0,c.useKeyOnly)(p,"tag"),"labels",n),f=(0,c.getUnhandledProps)(o,e),y=(0,c.getElementType)(o,e);return i.default.createElement(y,a({},f,{className:d}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"LabelGroup",parent:"Label",type:c.META.TYPES.ELEMENT,props:{color:c.SUI.COLORS,size:c.SUI.SIZES}},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,circular:u.PropTypes.bool,className:u.PropTypes.string,color:u.PropTypes.oneOf(o._meta.props.color),size:u.PropTypes.oneOf(o._meta.props.size),tag:u.PropTypes.bool},t.default=o},/*!***************************************!*\
!*** ./src/elements/List/ListItem.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.active,r=e.children,n=e.className,a=e.content,u=e.description,f=e.disabled,m=e.header,v=e.icon,g=e.image,T=e.value,_=(0,d.getElementType)(o,e),E=(0,i.default)((0,d.useKeyOnly)(t,"active"),(0,d.useKeyOnly)(f,"disabled"),(0,d.useKeyOnly)("li"!==_,"item"),n),j=(0,d.getUnhandledProps)(o,e),w="li"===_?{value:T}:{"data-value":T};if(r)return p.default.createElement(_,l({},j,{className:E},w),r);var S=O.default.create(v),M=y.default.create(g);if(!(0,c.isValidElement)(a)&&(0,s.default)(a))return p.default.createElement(_,l({},j,{className:E},w),S||M,h.default.create(a,{header:m,description:u}));var x=P.default.create(m),N=b.default.create(u);return S||M?p.default.createElement(_,l({},j,{className:E},w),S||M,(a||x||N)&&p.default.createElement(h.default,null,x,N,a)):p.default.createElement(_,l({},j,{className:E},w),x,N,a)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/isPlainObject */132),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2),f=r(/*! ../../elements/Image */30),y=n(f),m=r(/*! ./ListContent */87),h=n(m),v=r(/*! ./ListDescription */48),b=n(v),g=r(/*! ./ListHeader */49),P=n(g),T=r(/*! ./ListIcon */88),O=n(T);o._meta={name:"ListItem",parent:"List",type:d.META.TYPES.ELEMENT},o.propTypes={as:d.customPropTypes.as,active:c.PropTypes.bool,children:c.PropTypes.node,className:c.PropTypes.string,content:d.customPropTypes.itemShorthand,description:d.customPropTypes.itemShorthand,disabled:c.PropTypes.bool,header:d.customPropTypes.itemShorthand,icon:d.customPropTypes.every([d.customPropTypes.disallow(["image"]),d.customPropTypes.itemShorthand]),image:d.customPropTypes.every([d.customPropTypes.disallow(["icon"]),d.customPropTypes.itemShorthand]),value:c.PropTypes.string},o.create=(0,d.createShorthandFactory)(o,function(e){return{content:e}}),t.default=o},/*!***************************************!*\
!*** ./src/elements/List/ListList.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=(0,c.getUnhandledProps)(o,e),s=(0,c.getElementType)(o,e),u=(0,l.default)((0,c.useKeyOnly)("ul"!==s&&"ol"!==s,"list"),r);return i.default.createElement(s,a({},n,{className:u}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ListList",parent:"List",type:c.META.TYPES.ELEMENT},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string},t.default=o},/*!**********************************************!*\
!*** ./src/elements/Reveal/RevealContent.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.hidden,s=e.visible,u=(0,l.default)("ui",(0,c.useKeyOnly)(n,"hidden"),(0,c.useKeyOnly)(s,"visible"),"content",r),p=(0,c.getUnhandledProps)(o,e),d=(0,c.getElementType)(o,e);return i.default.createElement(d,a({},p,{className:u}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"RevealContent",parent:"Reveal",type:c.META.TYPES.ELEMENT},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,hidden:u.PropTypes.bool,visible:u.PropTypes.bool},t.default=o},/*!**********************************************!*\
!*** ./src/elements/Segment/SegmentGroup.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.compact,a=e.horizontal,s=e.piled,u=e.raised,c=e.size,f=e.stacked,y=(0,i.default)("ui",c,(0,d.useKeyOnly)(a,"horizontal"),(0,d.useKeyOnly)(n,"compact"),(0,d.useKeyOnly)(s,"piled"),(0,d.useKeyOnly)(u,"raised"),(0,d.useKeyOnly)(f,"stacked"),r,"segments"),m=(0,d.getUnhandledProps)(o,e),h=(0,d.getElementType)(o,e);return p.default.createElement(h,l({},m,{className:y}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/without */7),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2);o._meta={name:"SegmentGroup",parent:"Segment",type:d.META.TYPES.ELEMENT,props:{size:(0,s.default)(d.SUI.SIZES,"medium")}},o.propTypes={as:d.customPropTypes.as,className:c.PropTypes.string,children:c.PropTypes.node,compact:c.PropTypes.bool,horizontal:c.PropTypes.bool,piled:c.PropTypes.bool,raised:c.PropTypes.bool,size:c.PropTypes.oneOf(o._meta.props.size),stacked:c.PropTypes.bool},t.default=o},/*!***********************************!*\
!*** ./src/elements/Step/Step.js ***!
\***********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(/*! classnames */3),c=n(i),p=r(/*! react */1),d=n(p),f=r(/*! ../../lib */2),y=r(/*! ../../elements/Icon */8),m=n(y),h=r(/*! ./StepContent */177),v=n(h),b=r(/*! ./StepDescription */89),g=n(b),P=r(/*! ./StepGroup */178),T=n(P),O=r(/*! ./StepTitle */90),_=n(O),E=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.handleClick=function(e){var t=n.props.onClick;t&&t(e,n.props)},s=r,a(n,s)}return s(t,e),u(t,[{key:"render",value:function(){var e=this.props,r=e.active,n=e.children,o=e.className,a=e.completed,s=e.description,u=e.disabled,i=e.href,p=e.icon,y=e.link,h=e.onClick,b=e.title,g=(0,c.default)((0,f.useKeyOnly)(r,"active"),(0,f.useKeyOnly)(a,"completed"),(0,f.useKeyOnly)(u,"disabled"),(0,f.useKeyOnly)(y,"link"),"step",o),P=(0,f.getUnhandledProps)(t,this.props),T=(0,f.getElementType)(t,this.props,function(){if(h)return"a"});return n?d.default.createElement(T,l({},P,{className:g,href:i,onClick:this.handleClick}),n):d.default.createElement(T,l({},P,{className:g,href:i,onClick:this.handleClick}),m.default.create(p),d.default.createElement(v.default,{description:s,title:b}))}}]),t}(p.Component);E.propTypes={as:f.customPropTypes.as,active:p.PropTypes.bool,className:p.PropTypes.string,children:p.PropTypes.node,completed:p.PropTypes.bool,description:f.customPropTypes.itemShorthand,disabled:p.PropTypes.bool,icon:f.customPropTypes.itemShorthand,link:p.PropTypes.bool,href:p.PropTypes.string,onClick:p.PropTypes.func,ordered:p.PropTypes.bool,title:f.customPropTypes.itemShorthand},E._meta={name:"Step",type:f.META.TYPES.ELEMENT},E.Content=v.default,E.Description=g.default,E.Group=T.default,E.Title=_.default,t.default=E},/*!******************************************!*\
!*** ./src/elements/Step/StepContent.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.description,s=e.title,u=(0,i.default)(r,"content"),p=(0,c.getUnhandledProps)(o,e),f=(0,c.getElementType)(o,e);return t?l.default.createElement(f,a({},p,{className:u}),t):l.default.createElement(f,a({},p,{className:u}),(0,c.createShorthand)(y.default,function(e){return{title:e}},s),(0,c.createShorthand)(d.default,function(e){return{description:e}},n))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! classnames */3),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ./StepDescription */89),d=n(p),f=r(/*! ./StepTitle */90),y=n(f);o._meta={name:"StepContent",parent:"Step",type:c.META.TYPES.ELEMENT},o.propTypes={as:c.customPropTypes.as,className:s.PropTypes.string,children:s.PropTypes.node,description:c.customPropTypes.itemShorthand,title:c.customPropTypes.itemShorthand},t.default=o},/*!****************************************!*\
!*** ./src/elements/Step/StepGroup.js ***!
\****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.fluid,a=e.items,s=e.ordered,l=e.size,c=e.stackable,d=e.vertical,m=(0,p.default)("ui",(0,y.useKeyOnly)(n,"fluid"),(0,y.useKeyOnly)(s,"ordered"),(0,y.useValueAndKey)(c,"stackable"),(0,y.useKeyOnly)(d,"vertical"),l,r,"steps"),v=(0,y.getUnhandledProps)(o,e),b=(0,y.getElementType)(o,e);if(t)return f.default.createElement(b,i({},v,{className:m}),t);var g=(0,u.default)(a,function(e){var t=e.key||[e.title,e.description].join("-");return f.default.createElement(h.default,i({key:t},e))});return f.default.createElement(b,i({},v,{className:m}),g)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/without */7),s=n(a),l=r(/*! lodash/map */9),u=n(l),i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=r(/*! classnames */3),p=n(c),d=r(/*! react */1),f=n(d),y=r(/*! ../../lib */2),m=r(/*! ./Step */176),h=n(m);o._meta={name:"StepGroup",parent:"Step",props:{sizes:(0,s.default)(y.SUI.SIZES,"medium"),stackable:["tablet"]},type:y.META.TYPES.ELEMENT},o.propTypes={as:y.customPropTypes.as,className:d.PropTypes.string,children:d.PropTypes.node,fluid:d.PropTypes.bool,items:y.customPropTypes.collectionShorthand,ordered:d.PropTypes.bool,size:d.PropTypes.oneOf(o._meta.props.sizes),stackable:d.PropTypes.oneOf(o._meta.props.stackable),vertical:d.PropTypes.bool},t.default=o},/*!******************************!*\
!*** ./src/lib/isBrowser.js ***!
\******************************/
function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n="object"===("undefined"==typeof document?"undefined":r(document))&&null!==document,o="object"===("undefined"==typeof window?"undefined":r(window))&&null!==window&&window.self===window;t.default=n&&o},/*!**************************!*\
!*** ./src/lib/leven.js ***!
\**************************/
function(e,t,r){(function(e){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){return 0};"production"!==e.env.NODE_ENV&&!function(){var e=[],t=[];r=function(r,n){if(r===n)return 0;var o=r.length,a=n.length;if(0===o)return a;if(0===a)return o;for(var s=void 0,l=void 0,u=void 0,i=void 0,c=0,p=0;c<o;)t[c]=r.charCodeAt(c),e[c]=++c;for(;p<a;)for(s=n.charCodeAt(p),u=p++,l=p,c=0;c<o;c++)i=s===t[c]?u:u+1,u=e[c],l=e[c]=u>l?i>l?l+1:i:i>u?u+1:i;return l}}(),t.default=r}).call(t,r(/*! ./~/process/browser.js */35))},/*!***************************************************!*\
!*** ./src/modules/Accordion/AccordionContent.js ***!
\***************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.active,r=e.children,n=e.className,s=(0,i.default)("content",(0,c.useKeyOnly)(t,"active"),n),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return l.default.createElement(p,a({},u,{className:s}),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! classnames */3),i=n(u),c=r(/*! ../../lib */2);o.displayName="AccordionContent",o.propTypes={as:c.customPropTypes.as,active:s.PropTypes.bool,children:s.PropTypes.node,className:s.PropTypes.string},o._meta={name:"AccordionContent",type:c.META.TYPES.MODULE,parent:"Accordion"},t.default=o},/*!*************************************************!*\
!*** ./src/modules/Accordion/AccordionTitle.js ***!
\*************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(/*! classnames */3),c=n(i),p=r(/*! react */1),d=n(p),f=r(/*! ../../lib */2),y=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.handleClick=function(e){var t=n.props.onClick;t&&t(e,n.props)},s=r,a(n,s)}return s(t,e),u(t,[{key:"render",value:function(){var e=this.props,r=e.active,n=e.children,o=e.className,a=(0,c.default)((0,f.useKeyOnly)(r,"active"),"title",o),s=(0,f.getUnhandledProps)(t,this.props),u=(0,f.getElementType)(t,this.props);return d.default.createElement(u,l({},s,{className:a,onClick:this.handleClick}),n)}}]),t}(p.Component);y.displayName="AccordionTitle",y.propTypes={as:f.customPropTypes.as,active:p.PropTypes.bool,children:p.PropTypes.node,className:p.PropTypes.string,onClick:p.PropTypes.func},y._meta={name:"AccordionTitle",type:f.META.TYPES.MODULE,parent:"Accordion"},t.default=y},/*!**********************************************!*\
!*** ./src/modules/Dimmer/DimmerDimmable.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.blurring,r=e.className,n=e.children,s=e.dimmed,u=(0,l.default)((0,c.useKeyOnly)(t,"blurring"),(0,c.useKeyOnly)(s,"dimmed"),"dimmable",r),p=(0,c.getUnhandledProps)(o,e),d=(0,c.getElementType)(o,e);return i.default.createElement(d,a({},p,{className:u}),n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"DimmerDimmable",type:c.META.TYPES.MODULE,parent:"Dimmer"},o.propTypes={as:c.customPropTypes.as,blurring:u.PropTypes.bool,children:u.PropTypes.node,className:u.PropTypes.string,dimmed:u.PropTypes.bool},t.default=o},/*!*************************************!*\
!*** ./src/modules/Dimmer/index.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Dimmer */334),a=n(o);t.default=a.default},/*!*************************************************!*\
!*** ./src/modules/Dropdown/DropdownDivider.js ***!
\*************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.className,r=(0,l.default)("divider",t),n=(0,c.getUnhandledProps)(o,e),s=(0,c.getElementType)(o,e);return i.default.createElement(s,a({},n,{className:r}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"DropdownDivider",parent:"Dropdown",type:c.META.TYPES.MODULE},o.propTypes={as:c.customPropTypes.as,className:u.PropTypes.string},t.default=o},/*!************************************************!*\
!*** ./src/modules/Dropdown/DropdownHeader.js ***!
\************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,s=e.icon,u=(0,l.default)("header",r),p=(0,c.getUnhandledProps)(o,e),f=(0,c.getElementType)(o,e);return t?i.default.createElement(f,a({},p,{className:u}),t):i.default.createElement(f,a({},p,{className:u}),d.default.create(s),n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ../../elements/Icon */8),d=n(p);o._meta={name:"DropdownHeader",parent:"Dropdown",type:c.META.TYPES.MODULE},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand,icon:c.customPropTypes.itemShorthand},t.default=o},/*!**********************************************!*\
!*** ./src/modules/Dropdown/DropdownItem.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(/*! classnames */3),c=n(i),p=r(/*! react */1),d=n(p),f=r(/*! ../../lib */2),y=r(/*! ../../elements/Flag */164),m=n(y),h=r(/*! ../../elements/Icon */8),v=n(h),b=r(/*! ../../elements/Image */30),g=n(b),P=r(/*! ../../elements/Label */47),T=n(P),O=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.handleClick=function(e){var t=n.props.onClick;t&&t(e,n.props)},s=r,a(n,s)}return s(t,e),u(t,[{key:"render",value:function(){var e=this.props,r=e.active,n=e.children,o=e.className,a=e.content,s=e.disabled,u=e.description,i=e.flag,p=e.icon,y=e.image,h=e.label,b=e.selected,P=e.text,O=(0,c.default)((0,f.useKeyOnly)(r,"active"),(0,f.useKeyOnly)(s,"disabled"),(0,f.useKeyOnly)(b,"selected"),"item",o),_=p||f.childrenUtils.someByType(n,"DropdownMenu")&&"dropdown",E=(0,f.getUnhandledProps)(t,this.props),j=(0,f.getElementType)(t,this.props);if(n)return d.default.createElement(j,l({},E,{className:O,onClick:this.handleClick}),n);var w=m.default.create(i),S=v.default.create(_),M=g.default.create(y),x=T.default.create(h),N=(0,f.createShorthand)("span",function(e){return{className:"description",children:e}},u);return N?d.default.createElement(j,l({},E,{className:O,onClick:this.handleClick}),M,S,w,x,N,(0,f.createShorthand)("span",function(e){return{className:"text",children:e}},a||P)):d.default.createElement(j,l({},E,{className:O,onClick:this.handleClick}),M,S,w,x,a||P)}}]),t}(p.Component);O.propTypes={as:f.customPropTypes.as,active:p.PropTypes.bool,children:p.PropTypes.node,className:p.PropTypes.string,content:f.customPropTypes.contentShorthand,description:f.customPropTypes.itemShorthand,disabled:p.PropTypes.bool,flag:f.customPropTypes.itemShorthand,icon:f.customPropTypes.itemShorthand,image:f.customPropTypes.itemShorthand,label:f.customPropTypes.itemShorthand,selected:p.PropTypes.bool,text:f.customPropTypes.contentShorthand,value:p.PropTypes.oneOfType([p.PropTypes.number,p.PropTypes.string]),onClick:p.PropTypes.func},O._meta={name:"DropdownItem",parent:"Dropdown",type:f.META.TYPES.MODULE},t.default=O},/*!**********************************************!*\
!*** ./src/modules/Dropdown/DropdownMenu.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.scrolling,s=(0,i.default)((0,c.useKeyOnly)(n,"scrolling"),"menu transition",r),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return l.default.createElement(p,a({},u,{className:s}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! classnames */3),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"DropdownMenu",parent:"Dropdown",type:c.META.TYPES.MODULE},o.propTypes={as:c.customPropTypes.as,children:s.PropTypes.node,className:s.PropTypes.string,scrolling:s.PropTypes.bool},t.default=o},/*!*******************************************!*\
!*** ./src/modules/Modal/ModalActions.js ***!
\*******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=(0,i.default)(r,"actions"),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return l.default.createElement(u,a({},s,{className:n}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! classnames */3),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ModalActions",type:c.META.TYPES.MODULE,parent:"Modal"},o.propTypes={as:c.customPropTypes.as,children:s.PropTypes.node,className:s.PropTypes.string},t.default=o},/*!*******************************************!*\
!*** ./src/modules/Modal/ModalContent.js ***!
\*******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.image,n=e.className,s=(0,i.default)(n,(0,c.useKeyOnly)(r,"image"),"content"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return l.default.createElement(p,a({},u,{className:s}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! classnames */3),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ModalContent",type:c.META.TYPES.MODULE,parent:"Modal"},o.propTypes={as:c.customPropTypes.as,children:s.PropTypes.node,className:s.PropTypes.string,image:s.PropTypes.bool},t.default=o},/*!***********************************************!*\
!*** ./src/modules/Modal/ModalDescription.js ***!
\***********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=(0,i.default)(r,"description"),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return l.default.createElement(u,a({},s,{className:n}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! classnames */3),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ModalDescription",type:c.META.TYPES.MODULE,parent:"Modal"},o.propTypes={as:c.customPropTypes.as,children:s.PropTypes.node,className:s.PropTypes.string},t.default=o},/*!******************************************!*\
!*** ./src/modules/Modal/ModalHeader.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=(0,i.default)(r,"header"),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return l.default.createElement(u,a({},s,{className:n}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! classnames */3),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ModalHeader",type:c.META.TYPES.MODULE,parent:"Modal"},o.propTypes={as:c.customPropTypes.as,children:s.PropTypes.node,className:s.PropTypes.string},t.default=o},/*!************************************!*\
!*** ./src/modules/Modal/index.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Modal */338),a=n(o);t.default=a.default},/*!*******************************************!*\
!*** ./src/modules/Popup/PopupContent.js ***!
\*******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=(0,i.default)("content",r),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return l.default.createElement(u,a({},s,{className:n}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.default=o;var s=r(/*! react */1),l=n(s),u=r(/*! classnames */3),i=n(u),c=r(/*! ../../lib */2);o.create=(0,c.createShorthandFactory)(o,function(e){return{children:e}}),o.propTypes={children:s.PropTypes.node,className:s.PropTypes.string},o._meta={name:"PopupContent",type:c.META.TYPES.MODULE,parent:"Popup"}},/*!******************************************!*\
!*** ./src/modules/Popup/PopupHeader.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=(0,i.default)("header",r),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return l.default.createElement(u,a({},s,{className:n}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.default=o;var s=r(/*! react */1),l=n(s),u=r(/*! classnames */3),i=n(u),c=r(/*! ../../lib */2);o.create=(0,c.createShorthandFactory)(o,function(e){return{children:e}}),o.propTypes={children:s.PropTypes.node,className:s.PropTypes.string},o._meta={name:"PopupHeader",type:c.META.TYPES.MODULE,parent:"Popup"}},/*!******************************************!*\
!*** ./src/modules/Rating/RatingIcon.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(/*! classnames */3),c=n(i),p=r(/*! react */1),d=n(p),f=r(/*! ../../lib */2),y=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.defaultProps={as:"i"},n.handleClick=function(e){var t=n.props.onClick;t&&t(e,n.props)},n.handleKeyUp=function(e){var t=n.props,r=t.onClick,o=t.onKeyUp;if(o&&o(e,n.props),r)switch(f.keyboardKey.getCode(e)){case f.keyboardKey.Enter:case f.keyboardKey.Spacebar:e.preventDefault(),r(e,n.props);break;default:return}},n.handleMouseEnter=function(e){var t=n.props.onMouseEnter;t&&t(e,n.props)},s=r,a(n,s)}return s(t,e),u(t,[{key:"render",value:function(){var e=this.props,r=e.active,n=e.className,o=e.selected,a=(0,c.default)((0,f.useKeyOnly)(r,"active"),(0,f.useKeyOnly)(o,"selected"),"icon",n),s=(0,f.getUnhandledProps)(t,this.props),u=(0,f.getElementType)(t,this.props);return d.default.createElement(u,l({role:"radio",tabIndex:0},s,{className:a,onKeyUp:this.handleKeyUp,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter}))}}]),t}(p.Component);y.propTypes={active:p.PropTypes.bool,as:f.customPropTypes.as,className:p.PropTypes.string,index:p.PropTypes.number,onClick:p.PropTypes.func,onKeyUp:p.PropTypes.func,onMouseEnter:p.PropTypes.func,selected:p.PropTypes.bool},y._meta={name:"RatingIcon",parent:"Rating",type:f.META.TYPES.MODULE},t.default=y},/*!**********************************************!*\
!*** ./src/modules/Search/SearchCategory.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.active,r=e.children,n=e.className,s=e.renderer,u=(0,i.default)((0,c.useKeyOnly)(t,"active"),"category",n),d=(0,c.getUnhandledProps)(o,e),f=(0,c.getElementType)(o,e);return l.default.createElement(f,a({},d,{className:u}),l.default.createElement("div",{className:"name"},s?s(e):p(e)),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! classnames */3),i=n(u),c=r(/*! ../../lib */2),p=function(e){var t=e.name;return t};o._meta={name:"SearchCategory",parent:"Search",type:c.META.TYPES.MODULE},o.propTypes={as:c.customPropTypes.as,active:s.PropTypes.bool,children:s.PropTypes.node,className:s.PropTypes.string,name:s.PropTypes.string,renderer:s.PropTypes.func,results:s.PropTypes.array},t.default=o},/*!********************************************!*\
!*** ./src/modules/Search/SearchResult.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(/*! react */1),c=n(i),p=r(/*! classnames */3),d=n(p),f=r(/*! ../../lib */2),y=function(e){var t=e.image,r=e.price,n=e.title,o=e.description;return[t&&c.default.createElement("div",{key:"image",className:"image"},(0,f.createHTMLImage)(t)),c.default.createElement("div",{key:"content",className:"content"},r&&c.default.createElement("div",{className:"price"},r),n&&c.default.createElement("div",{className:"title"},n),o&&c.default.createElement("div",{className:"description"},o))]},m=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.handleClick=function(e){var t=n.props.onClick;t&&t(e,n.props)},s=r,a(n,s)}return s(t,e),u(t,[{key:"render",value:function(){var e=this.props,r=e.active,n=e.className,o=e.renderer,a=(0,d.default)((0,f.useKeyOnly)(r,"active"),"result",n),s=(0,f.getUnhandledProps)(t,this.props),u=(0,f.getElementType)(t,this.props);return c.default.createElement(u,l({},s,{className:a,onClick:this.handleClick}),o?o(this.props):y(this.props))}}]),t}(i.Component);m.propTypes={as:f.customPropTypes.as,active:i.PropTypes.bool,className:i.PropTypes.string,description:i.PropTypes.string,id:i.PropTypes.number,image:i.PropTypes.string,onClick:i.PropTypes.func,price:i.PropTypes.string,renderer:i.PropTypes.func,title:i.PropTypes.string},m._meta={name:"SearchResult",parent:"Search",type:f.META.TYPES.MODULE},t.default=m},/*!*********************************************!*\
!*** ./src/modules/Search/SearchResults.js ***!
\*********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=(0,i.default)("results transition",r),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return l.default.createElement(u,a({},s,{className:n}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! classnames */3),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"SearchResults",parent:"Search",type:c.META.TYPES.MODULE},o.propTypes={as:c.customPropTypes.as,children:s.PropTypes.node,className:s.PropTypes.string},t.default=o},/*!************************************************!*\
!*** ./src/modules/Sidebar/SidebarPushable.js ***!
\************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.className,r=e.children,n=(0,l.default)("pushable",t),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i.default.createElement(u,a({},s,{className:n}),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"SidebarPushable",type:c.META.TYPES.MODULE,parent:"Sidebar"},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string},t.default=o},/*!**********************************************!*\
!*** ./src/modules/Sidebar/SidebarPusher.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.className,r=e.dimmed,n=e.children,s=(0,l.default)("pusher",(0,c.useKeyOnly)(r,"dimmed"),t),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i.default.createElement(p,a({},u,{className:s}),n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"SidebarPusher",type:c.META.TYPES.MODULE,parent:"Sidebar"},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,dimmed:u.PropTypes.bool},t.default=o},/*!********************************!*\
!*** ./src/views/Card/Card.js ***!
\********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(/*! classnames */3),c=n(i),p=r(/*! react */1),d=n(p),f=r(/*! ../../lib */2),y=r(/*! ../../elements/Image */30),m=n(y),h=r(/*! ./CardContent */203),v=n(h),b=r(/*! ./CardDescription */93),g=n(b),P=r(/*! ./CardGroup */204),T=n(P),O=r(/*! ./CardHeader */94),_=n(O),E=r(/*! ./CardMeta */95),j=n(E),w={name:"Card",type:f.META.TYPES.VIEW,props:{color:f.SUI.COLORS}},S=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.handleClick=function(e){var t=n.props.onClick;t&&t(e,n.props)},s=r,a(n,s)}return s(t,e),u(t,[{key:"render",value:function(){var e=this.props,r=e.centered,n=e.children,o=e.className,a=e.color,s=e.description,u=e.extra,i=e.fluid,p=e.header,y=e.href,h=e.image,b=e.meta,g=e.onClick,P=e.raised,T=(0,c.default)("ui",a,(0,f.useKeyOnly)(r,"centered"),(0,f.useKeyOnly)(i,"fluid"),(0,f.useKeyOnly)(P,"raised"),"card",o),O=(0,f.getUnhandledProps)(t,this.props),_=(0,f.getElementType)(t,this.props,function(){if(g)return"a"});return n?d.default.createElement(_,l({},O,{className:T,href:y,onClick:this.handleClick}),n):d.default.createElement(_,l({},O,{className:T,href:y,onClick:this.handleClick}),m.default.create(h),(s||p||b)&&d.default.createElement(v.default,{description:s,header:p,meta:b}),u&&d.default.createElement(v.default,{extra:!0},u))}}]),t}(p.Component);S.propTypes={as:f.customPropTypes.as,centered:p.PropTypes.bool,children:p.PropTypes.node,className:p.PropTypes.string,color:p.PropTypes.oneOf(w.props.color),description:f.customPropTypes.itemShorthand,extra:f.customPropTypes.contentShorthand,fluid:p.PropTypes.bool,header:f.customPropTypes.itemShorthand,href:p.PropTypes.string,image:f.customPropTypes.itemShorthand,meta:f.customPropTypes.itemShorthand,onClick:p.PropTypes.func,raised:p.PropTypes.bool},S._meta=w,S.Content=v.default,S.Description=g.default,S.Group=T.default,S.Header=_.default,S.Meta=j.default,t.default=S},/*!***************************************!*\
!*** ./src/views/Card/CardContent.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.description,s=e.extra,u=e.header,p=e.meta,f=(0,l.default)(r,(0,c.useKeyOnly)(s,"extra"),"content"),m=(0,c.getUnhandledProps)(o,e),v=(0,c.getElementType)(o,e);return t?i.default.createElement(v,a({},m,{className:f}),t):i.default.createElement(v,a({},m,{className:f}),(0,c.createShorthand)(y.default,function(e){return{content:e}},u),(0,c.createShorthand)(h.default,function(e){return{content:e}},p),(0,c.createShorthand)(d.default,function(e){return{content:e}},n))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ./CardDescription */93),d=n(p),f=r(/*! ./CardHeader */94),y=n(f),m=r(/*! ./CardMeta */95),h=n(m);o._meta={name:"CardContent",parent:"Card",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,description:c.customPropTypes.itemShorthand,extra:u.PropTypes.bool,header:c.customPropTypes.itemShorthand,meta:c.customPropTypes.itemShorthand},t.default=o},/*!*************************************!*\
!*** ./src/views/Card/CardGroup.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.doubling,a=e.items,u=e.itemsPerRow,c=e.stackable,f=(0,i.default)("ui",(0,d.useWidthProp)(u),(0,d.useKeyOnly)(n,"doubling"),(0,d.useKeyOnly)(c,"stackable"),r,"cards"),m=(0,d.getUnhandledProps)(o,e),h=(0,d.getElementType)(o,e);if(t)return p.default.createElement(h,l({},m,{className:f}),t);var v=(0,s.default)(a,function(e){var t=e.key||[e.header,e.description].join("-");return p.default.createElement(y.default,l({key:t},e))});return p.default.createElement(h,l({},m,{className:f}),v)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/map */9),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2),f=r(/*! ./Card */202),y=n(f);o._meta={name:"CardGroup",parent:"Card",props:{itemsPerRow:d.SUI.WIDTHS},type:d.META.TYPES.VIEW},o.propTypes={as:d.customPropTypes.as,children:c.PropTypes.node,className:c.PropTypes.string,doubling:c.PropTypes.bool,items:d.customPropTypes.collectionShorthand,itemsPerRow:c.PropTypes.oneOf(o._meta.props.itemsPerRow),stackable:c.PropTypes.bool},t.default=o},/*!********************************************!*\
!*** ./src/views/Comment/CommentAction.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.active,r=e.className,n=e.children,s=(0,l.default)((0,c.useKeyOnly)(t,"active"),r),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i.default.createElement(p,a({},u,{className:s}),n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"CommentAction",parent:"Comment",type:c.META.TYPES.VIEW},o.defaultProps={as:"a"},o.propTypes={as:c.customPropTypes.as,active:u.PropTypes.bool,children:u.PropTypes.node,className:u.PropTypes.string},t.default=o},/*!*********************************************!*\
!*** ./src/views/Comment/CommentActions.js ***!
\*********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.className,r=e.children,n=(0,l.default)("actions",t),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i.default.createElement(u,a({},s,{className:n}),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"CommentActions",parent:"Comment",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string},t.default=o},/*!********************************************!*\
!*** ./src/views/Comment/CommentAuthor.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.className,r=e.children,n=(0,l.default)("author",t),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i.default.createElement(u,a({},s,{className:n}),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"CommentAuthor",parent:"Comment",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string},t.default=o},/*!********************************************!*\
!*** ./src/views/Comment/CommentAvatar.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.className,r=e.src,n=(0,l.default)("avatar",t),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i.default.createElement(u,a({},s,{className:n}),(0,c.createHTMLImage)(r))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"CommentAvatar",parent:"Comment",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,className:u.PropTypes.string,src:u.PropTypes.string},t.default=o},/*!*********************************************!*\
!*** ./src/views/Comment/CommentContent.js ***!
\*********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.className,r=e.children,n=(0,l.default)("content",t),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i.default.createElement(u,a({},s,{className:n}),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"CommentContent",parent:"Comment",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string},t.default=o},/*!*******************************************!*\
!*** ./src/views/Comment/CommentGroup.js ***!
\*******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.className,r=e.children,n=e.collapsed,s=e.minimal,u=e.threaded,p=(0,l.default)("ui",(0,c.useKeyOnly)(n,"collapsed"),(0,c.useKeyOnly)(s,"minimal"),(0,c.useKeyOnly)(u,"threaded"),"comments",t),d=(0,c.getUnhandledProps)(o,e),f=(0,c.getElementType)(o,e);return i.default.createElement(f,a({},d,{className:p}),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"CommentGroup",parent:"Comment",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,collapsed:u.PropTypes.bool,minimal:u.PropTypes.bool,threaded:u.PropTypes.bool},t.default=o},/*!**********************************************!*\
!*** ./src/views/Comment/CommentMetadata.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.className,r=e.children,n=(0,l.default)("metadata",t),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i.default.createElement(u,a({},s,{className:n}),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"CommentMetadata",parent:"Comment",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string},t.default=o},/*!******************************************!*\
!*** ./src/views/Comment/CommentText.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.className,r=e.children,n=(0,l.default)("text",t),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i.default.createElement(u,a({},s,{className:n}),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"CommentText",parent:"Comment",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string},t.default=o},/*!*************************************!*\
!*** ./src/views/Feed/FeedEvent.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.content,r=e.children,n=e.className,s=e.date,u=e.extraImages,p=e.extraText,f=e.image,m=e.icon,h=e.meta,v=e.summary,b=(0,l.default)(n,"event"),g=(0,c.getUnhandledProps)(o,e),P=(0,c.getElementType)(o,e),T=t||s||u||p||h||v,O={content:t,date:s,extraImages:u,extraText:p,meta:h,summary:v};return i.default.createElement(P,a({},g,{className:b}),(0,c.createShorthand)(y.default,function(e){return{icon:e}},m),(0,c.createShorthand)(y.default,function(e){return{image:e}},f),T&&i.default.createElement(d.default,O),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ./FeedContent */96),d=n(p),f=r(/*! ./FeedLabel */98),y=n(f);o._meta={name:"FeedEvent",parent:"Feed",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:d.default.propTypes.content,date:d.default.propTypes.date,extraImages:d.default.propTypes.extraImages,extraText:d.default.propTypes.extraText,icon:c.customPropTypes.itemShorthand,image:c.customPropTypes.itemShorthand,meta:d.default.propTypes.meta,summary:d.default.propTypes.summary},t.default=o},/*!********************************!*\
!*** ./src/views/Item/Item.js ***!
\********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,s=e.description,u=e.extra,p=e.header,f=e.image,y=e.meta,m=(0,l.default)(r,"item"),h=(0,c.getUnhandledProps)(o,e),v=(0,c.getElementType)(o,e);return t?i.default.createElement(v,a({},h,{className:m}),t):i.default.createElement(v,a({},h,{className:m}),(0,c.createShorthand)(O.default,function(e){return{src:e}},f),i.default.createElement(d.default,{content:n,description:s,extra:u,header:p,meta:y}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ./ItemContent */215),d=n(p),f=r(/*! ./ItemDescription */103),y=n(f),m=r(/*! ./ItemExtra */104),h=n(m),v=r(/*! ./ItemGroup */216),b=n(v),g=r(/*! ./ItemHeader */105),P=n(g),T=r(/*! ./ItemImage */217),O=n(T),_=r(/*! ./ItemMeta */106),E=n(_);o._meta={name:"Item",type:c.META.TYPES.VIEW},o.Content=d.default,o.Description=y.default,o.Extra=h.default,o.Group=b.default,o.Header=P.default,o.Image=O.default,o.Meta=E.default,o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand,description:c.customPropTypes.itemShorthand,extra:c.customPropTypes.itemShorthand,image:c.customPropTypes.itemShorthand,header:c.customPropTypes.itemShorthand,meta:c.customPropTypes.itemShorthand},t.default=o},/*!***************************************!*\
!*** ./src/views/Item/ItemContent.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,s=e.description,u=e.extra,p=e.header,f=e.meta,m=e.verticalAlign,v=(0,l.default)(r,(0,c.useVerticalAlignProp)(m),"content"),g=(0,c.getUnhandledProps)(o,e),P=(0,c.getElementType)(o,e);return t?i.default.createElement(P,a({},g,{className:v}),t):i.default.createElement(P,a({},g,{className:v}),(0,c.createShorthand)(d.default,function(e){return{content:e}},p),(0,c.createShorthand)(b.default,function(e){return{content:e}},f),(0,c.createShorthand)(y.default,function(e){return{content:e}},s),(0,c.createShorthand)(h.default,function(e){return{content:e}},u),n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ./ItemHeader */105),d=n(p),f=r(/*! ./ItemDescription */103),y=n(f),m=r(/*! ./ItemExtra */104),h=n(m),v=r(/*! ./ItemMeta */106),b=n(v);o._meta={name:"ItemContent",parent:"Item",type:c.META.TYPES.VIEW,props:{verticalAlign:c.SUI.VERTICAL_ALIGNMENTS}},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand,description:c.customPropTypes.itemShorthand,extra:c.customPropTypes.itemShorthand,header:c.customPropTypes.itemShorthand,meta:c.customPropTypes.itemShorthand,verticalAlign:u.PropTypes.oneOf(o._meta.props.verticalAlign)},t.default=o},/*!*************************************!*\
!*** ./src/views/Item/ItemGroup.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function a(e){var t=e.children,r=e.className,n=e.divided,s=e.items,i=e.link,p=e.relaxed,y=(0,c.default)("ui",r,(0,f.useKeyOnly)(n,"divided"),(0,f.useKeyOnly)(i,"link"),(0,f.useKeyOrValueAndKey)(p,"relaxed"),"items"),h=(0,f.getUnhandledProps)(a,e),v=(0,f.getElementType)(a,e);if(t)return d.default.createElement(v,u({},h,{className:y}),t);var b=(0,l.default)(s,function(e){var t=e.childKey,r=o(e,["childKey"]),n=t||[r.content,r.description,r.header,r.meta].join("-");return d.default.createElement(m.default,u({},r,{key:n}))});return d.default.createElement(v,u({},h,{className:y}),b)}Object.defineProperty(t,"__esModule",{value:!0});var s=r(/*! lodash/map */9),l=n(s),u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i=r(/*! classnames */3),c=n(i),p=r(/*! react */1),d=n(p),f=r(/*! ../../lib */2),y=r(/*! ./Item */214),m=n(y);a._meta={name:"ItemGroup",type:f.META.TYPES.VIEW,parent:"Item",props:{relaxed:["very"]}},a.propTypes={as:f.customPropTypes.as,children:p.PropTypes.node,className:p.PropTypes.string,divided:p.PropTypes.bool,items:f.customPropTypes.collectionShorthand,link:p.PropTypes.bool,relaxed:p.PropTypes.oneOfType([p.PropTypes.bool,p.PropTypes.oneOf(a._meta.props.relaxed)])},t.default=a},/*!*************************************!*\
!*** ./src/views/Item/ItemImage.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.size,r=(0,u.getUnhandledProps)(o,e);return l.default.createElement(c.default,a({},r,{size:t,ui:!!t,wrapped:!0}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! ../../lib */2),i=r(/*! ../../elements/Image */30),c=n(i);o._meta={name:"ItemImage",parent:"Item",type:u.META.TYPES.VIEW},o.propTypes={size:s.PropTypes.oneOf(c.default._meta.props.size)},t.default=o},/*!******************************************!*\
!*** ./src/views/Statistic/Statistic.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.color,a=e.floated,s=e.horizontal,u=e.inverted,c=e.label,f=e.size,y=e.text,m=e.value,v=(0,i.default)("ui",n,(0,d.useValueAndKey)(a,"floated"),(0,d.useKeyOnly)(s,"horizontal"),(0,d.useKeyOnly)(u,"inverted"),f,r,"statistic"),g=(0,d.getUnhandledProps)(o,e),P=(0,d.getElementType)(o,e);return t?p.default.createElement(P,l({},g,{className:v}),t):p.default.createElement(P,l({},g,{className:v}),p.default.createElement(b.default,{text:y,value:m}),p.default.createElement(h.default,{label:c}))}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/without */7),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2),f=r(/*! ./StatisticGroup */219),y=n(f),m=r(/*! ./StatisticLabel */220),h=n(m),v=r(/*! ./StatisticValue */221),b=n(v);o._meta={name:"Statistic",type:d.META.TYPES.VIEW,props:{color:d.SUI.COLORS,floated:d.SUI.FLOATS,size:(0,s.default)(d.SUI.SIZES,"big","massive","medium")}},o.propTypes={as:d.customPropTypes.as,children:c.PropTypes.node,className:c.PropTypes.string,color:c.PropTypes.oneOf(o._meta.props.color),floated:c.PropTypes.oneOf(o._meta.props.floated),horizontal:c.PropTypes.bool,inverted:c.PropTypes.bool,label:d.customPropTypes.contentShorthand,size:c.PropTypes.oneOf(o._meta.props.size),text:c.PropTypes.bool,value:d.customPropTypes.contentShorthand},o.Group=y.default,o.Label=h.default,o.Value=b.default,t.default=o},/*!***********************************************!*\
!*** ./src/views/Statistic/StatisticGroup.js ***!
\***********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.color,a=e.horizontal,s=e.inverted,l=e.items,c=e.size,d=e.widths,m=(0,p.default)("ui",n,(0,y.useKeyOnly)(a,"horizontal"),(0,y.useKeyOnly)(s,"inverted"),(0,y.useWidthProp)(d),c,"statistics",r),v=(0,y.getUnhandledProps)(o,e),b=(0,y.getElementType)(o,e);if(t)return f.default.createElement(b,i({},v,{className:m}),t);var g=(0,u.default)(l,function(e){return f.default.createElement(h.default,i({key:e.childKey||[e.label,e.title].join("-")},e))});return f.default.createElement(b,i({},v,{className:m}),g)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/without */7),s=n(a),l=r(/*! lodash/map */9),u=n(l),i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=r(/*! classnames */3),p=n(c),d=r(/*! react */1),f=n(d),y=r(/*! ../../lib */2),m=r(/*! ./Statistic */218),h=n(m);o._meta={name:"StatisticGroup",type:y.META.TYPES.VIEW,parent:"Statistic",props:{color:y.SUI.COLORS,size:(0,s.default)(y.SUI.SIZES,"big","massive","medium"),widths:y.SUI.WIDTHS}},o.propTypes={as:y.customPropTypes.as,children:d.PropTypes.node,className:d.PropTypes.string,color:d.PropTypes.oneOf(o._meta.props.color),horizontal:d.PropTypes.bool,inverted:d.PropTypes.bool,items:y.customPropTypes.collectionShorthand,size:d.PropTypes.oneOf(o._meta.props.size),widths:d.PropTypes.oneOf(o._meta.props.widths)},t.default=o},/*!***********************************************!*\
!*** ./src/views/Statistic/StatisticLabel.js ***!
\***********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.label,s=(0,l.default)(r,"label"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i.default.createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"StatisticLabel",parent:"Statistic",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,label:c.customPropTypes.contentShorthand},t.default=o},/*!***********************************************!*\
!*** ./src/views/Statistic/StatisticValue.js ***!
\***********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.text,s=e.value,u=(0,l.default)((0,c.useKeyOnly)(n,"text"),r,"value"),p=(0,c.getUnhandledProps)(o,e),d=(0,c.getElementType)(o,e);return i.default.createElement(d,a({},p,{className:u}),t||s)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"StatisticValue",parent:"Statistic",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,text:u.PropTypes.bool,value:c.customPropTypes.contentShorthand},t.default=o},/*!**************************!*\
!*** ./~/lodash/_Set.js ***!
\**************************/
function(e,t,r){var n=r(/*! ./_getNative */26),o=r(/*! ./_root */11),a=n(o,"Set");e.exports=a},/*!*********************************!*\
!*** ./~/lodash/_Uint8Array.js ***!
\*********************************/
function(e,t,r){var n=r(/*! ./_root */11),o=n.Uint8Array;e.exports=o},/*!******************************!*\
!*** ./~/lodash/_WeakMap.js ***!
\******************************/
function(e,t,r){var n=r(/*! ./_getNative */26),o=r(/*! ./_root */11),a=n(o,"WeakMap");e.exports=a},/*!************************************!*\
!*** ./~/lodash/_arrayLikeKeys.js ***!
\************************************/
function(e,t,r){function n(e,t){var r=s(e),n=!r&&a(e),c=!r&&!n&&l(e),d=!r&&!n&&!c&&i(e),f=r||n||c||d,y=f?o(e.length,String):[],m=y.length;for(var h in e)!t&&!p.call(e,h)||f&&("length"==h||c&&("offset"==h||"parent"==h)||d&&("buffer"==h||"byteLength"==h||"byteOffset"==h)||u(h,m))||y.push(h);return y}var o=r(/*! ./_baseTimes */235),a=r(/*! ./isArguments */75),s=r(/*! ./isArray */4),l=r(/*! ./isBuffer */43),u=r(/*! ./_isIndex */39),i=r(/*! ./isTypedArray */77),c=Object.prototype,p=c.hasOwnProperty;e.exports=n},/*!********************************!*\
!*** ./~/lodash/_arraySome.js ***!
\********************************/
function(e,t){function r(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}e.exports=r},/*!*********************************!*\
!*** ./~/lodash/_baseAssign.js ***!
\*********************************/
function(e,t,r){function n(e,t){return e&&o(t,a(t),e)}var o=r(/*! ./_copyObject */33),a=r(/*! ./keys */10);e.exports=n},/*!********************************!*\
!*** ./~/lodash/_baseClamp.js ***!
\********************************/
function(e,t){function r(e,t,r){return e===e&&(void 0!==r&&(e=e<=r?e:r),void 0!==t&&(e=e>=t?e:t)),e}e.exports=r},/*!*************************************!*\
!*** ./~/lodash/_baseDifference.js ***!
\*************************************/
function(e,t,r){function n(e,t,r,n){var p=-1,d=a,f=!0,y=e.length,m=[],h=t.length;if(!y)return m;r&&(t=l(t,u(r))),n?(d=s,f=!1):t.length>=c&&(d=i,f=!1,t=new o(t));e:for(;++p<y;){var v=e[p],b=null==r?v:r(v);if(v=n||0!==v?v:0,f&&b===b){for(var g=h;g--;)if(t[g]===b)continue e;m.push(v)}else d(t,b,n)||m.push(v)}return m}var o=r(/*! ./_SetCache */53),a=r(/*! ./_arrayIncludes */55),s=r(/*! ./_arrayIncludesWith */112),l=r(/*! ./_arrayMap */17),u=r(/*! ./_baseUnary */62),i=r(/*! ./_cacheHas */63),c=200;e.exports=n},/*!************************************!*\
!*** ./~/lodash/_baseFindIndex.js ***!
\************************************/
function(e,t){function r(e,t,r,n){for(var o=e.length,a=r+(n?1:-1);n?a--:++a<o;)if(t(e[a],a,e))return a;return-1}e.exports=r},/*!*************************************!*\
!*** ./~/lodash/_baseGetAllKeys.js ***!
\*************************************/
function(e,t,r){function n(e,t,r){var n=t(e);return a(e)?n:o(n,r(e))}var o=r(/*! ./_arrayPush */113),a=r(/*! ./isArray */4);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_baseIndexOf.js ***!
\**********************************/
function(e,t,r){function n(e,t,r){return t===t?s(e,t,r):o(e,a,r)}var o=r(/*! ./_baseFindIndex */230),a=r(/*! ./_baseIsNaN */379),s=r(/*! ./_strictIndexOf */474);e.exports=n},/*!******************************!*\
!*** ./~/lodash/_baseMap.js ***!
\******************************/
function(e,t,r){function n(e,t){var r=-1,n=a(e)?Array(e.length):[];return o(e,function(e,o,a){n[++r]=t(e,o,a)}),n}var o=r(/*! ./_baseEach */32),a=r(/*! ./isArrayLike */14);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_baseSetData.js ***!
\**********************************/
function(e,t,r){var n=r(/*! ./identity */23),o=r(/*! ./_metaMap */254),a=o?function(e,t){return o.set(e,t),e}:n;e.exports=a},/*!********************************!*\
!*** ./~/lodash/_baseTimes.js ***!
\********************************/
function(e,t){function r(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}e.exports=r},/*!***********************************!*\
!*** ./~/lodash/_baseToString.js ***!
\***********************************/
function(e,t,r){function n(e){if("string"==typeof e)return e;if(s(e))return a(e,n)+"";if(l(e))return c?c.call(e):"";var t=e+"";return"0"==t&&1/e==-u?"-0":t}var o=r(/*! ./_Symbol */31),a=r(/*! ./_arrayMap */17),s=r(/*! ./isArray */4),l=r(/*! ./isSymbol */29),u=1/0,i=o?o.prototype:void 0,c=i?i.toString:void 0;e.exports=n},/*!***********************************!*\
!*** ./~/lodash/_castFunction.js ***!
\***********************************/
function(e,t,r){function n(e){return"function"==typeof e?e:o}var o=r(/*! ./identity */23);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_composeArgs.js ***!
\**********************************/
function(e,t){function r(e,t,r,o){for(var a=-1,s=e.length,l=r.length,u=-1,i=t.length,c=n(s-l,0),p=Array(i+c),d=!o;++u<i;)p[u]=t[u];for(;++a<l;)(d||a<s)&&(p[r[a]]=e[a]);for(;c--;)p[u++]=e[a++];return p}var n=Math.max;e.exports=r},/*!***************************************!*\
!*** ./~/lodash/_composeArgsRight.js ***!
\***************************************/
function(e,t){function r(e,t,r,o){for(var a=-1,s=e.length,l=-1,u=r.length,i=-1,c=t.length,p=n(s-u,0),d=Array(p+c),f=!o;++a<p;)d[a]=e[a];for(var y=a;++i<c;)d[y+i]=t[i];for(;++l<u;)(f||a<s)&&(d[y+r[l]]=e[a++]);return d}var n=Math.max;e.exports=r},/*!***********************************!*\
!*** ./~/lodash/_createHybrid.js ***!
\***********************************/
function(e,t,r){function n(e,t,r,g,P,T,O,_,E,j){function w(){for(var f=arguments.length,y=Array(f),m=f;m--;)y[m]=arguments[m];if(N)var h=i(w),v=s(y,h);if(g&&(y=o(y,g,P,N)),T&&(y=a(y,T,O,N)),f-=v,N&&f<j){var b=p(y,h);return u(e,t,n,w.placeholder,r,y,b,_,E,j-f)}var k=M?r:this,I=x?k[e]:e;return f=y.length,_?y=c(y,_):A&&f>1&&y.reverse(),S&&E<f&&(y.length=E),this&&this!==d&&this instanceof w&&(I=C||l(I)),I.apply(k,y)}var S=t&v,M=t&f,x=t&y,N=t&(m|h),A=t&b,C=x?void 0:l(e);return w}var o=r(/*! ./_composeArgs */238),a=r(/*! ./_composeArgsRight */239),s=r(/*! ./_countHolders */415),l=r(/*! ./_createCtor */65),u=r(/*! ./_createRecurry */241),i=r(/*! ./_getHolder */67),c=r(/*! ./_reorder */466),p=r(/*! ./_replaceHolders */41),d=r(/*! ./_root */11),f=1,y=2,m=8,h=16,v=128,b=512;e.exports=n},/*!************************************!*\
!*** ./~/lodash/_createRecurry.js ***!
\************************************/
function(e,t,r){function n(e,t,r,n,f,y,m,h,v,b){var g=t&c,P=g?m:void 0,T=g?void 0:m,O=g?y:void 0,_=g?void 0:y;t|=g?p:d,t&=~(g?d:p),t&i||(t&=~(l|u));var E=[e,t,f,O,P,_,T,h,v,b],j=r.apply(void 0,E);return o(e)&&a(j,E),j.placeholder=n,s(j,e,t)}var o=r(/*! ./_isLaziable */250),a=r(/*! ./_setData */257),s=r(/*! ./_setWrapToString */258),l=1,u=2,i=4,c=8,p=32,d=64;e.exports=n},/*!*************************************!*\
!*** ./~/lodash/_defineProperty.js ***!
\*************************************/
function(e,t,r){var n=r(/*! ./_getNative */26),o=function(){try{var e=n(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},/*!**********************************!*\
!*** ./~/lodash/_equalArrays.js ***!
\**********************************/
function(e,t,r){function n(e,t,r,n,i,c){var p=r&l,d=e.length,f=t.length;if(d!=f&&!(p&&f>d))return!1;var y=c.get(e);if(y&&c.get(t))return y==t;var m=-1,h=!0,v=r&u?new o:void 0;for(c.set(e,t),c.set(t,e);++m<d;){var b=e[m],g=t[m];if(n)var P=p?n(g,b,m,t,e,c):n(b,g,m,e,t,c);if(void 0!==P){if(P)continue;h=!1;break}if(v){if(!a(t,function(e,t){if(!s(v,t)&&(b===e||i(b,e,r,n,c)))return v.push(t)})){h=!1;break}}else if(b!==g&&!i(b,g,r,n,c)){h=!1;break}}return c.delete(e),c.delete(t),h}var o=r(/*! ./_SetCache */53),a=r(/*! ./_arraySome */226),s=r(/*! ./_cacheHas */63),l=1,u=2;e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_freeGlobal.js ***!
\*********************************/
function(e,t){(function(t){var r="object"==typeof t&&t&&t.Object===Object&&t;e.exports=r}).call(t,function(){return this}())},/*!***********************************!*\
!*** ./~/lodash/_getAllKeysIn.js ***!
\***********************************/
function(e,t,r){function n(e){return o(e,s,a)}var o=r(/*! ./_baseGetAllKeys */231),a=r(/*! ./_getSymbolsIn */247),s=r(/*! ./keysIn */273);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_getFuncName.js ***!
\**********************************/
function(e,t,r){function n(e){for(var t=e.name+"",r=o[t],n=s.call(o,t)?r.length:0;n--;){var a=r[n],l=a.func;if(null==l||l==e)return a.name}return t}var o=r(/*! ./_realNames */465),a=Object.prototype,s=a.hasOwnProperty;e.exports=n},/*!***********************************!*\
!*** ./~/lodash/_getSymbolsIn.js ***!
\***********************************/
function(e,t,r){var n=r(/*! ./_arrayPush */113),o=r(/*! ./_getPrototype */69),a=r(/*! ./_getSymbols */122),s=r(/*! ./stubArray */279),l=Object.getOwnPropertySymbols,u=l?function(e){for(var t=[];e;)n(t,a(e)),e=o(e);return t}:s;e.exports=u},/*!******************************!*\
!*** ./~/lodash/_hasPath.js ***!
\******************************/
function(e,t,r){function n(e,t,r){t=o(t,e);for(var n=-1,c=t.length,p=!1;++n<c;){var d=i(t[n]);if(!(p=null!=e&&r(e,d)))break;e=e[d]}return p||++n!=c?p:(c=null==e?0:e.length,!!c&&u(c)&&l(d,c)&&(s(e)||a(e)))}var o=r(/*! ./_castPath */25),a=r(/*! ./isArguments */75),s=r(/*! ./isArray */4),l=r(/*! ./_isIndex */39),u=r(/*! ./isLength */131),i=r(/*! ./_toKey */22);e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_hasUnicode.js ***!
\*********************************/
function(e,t){function r(e){return c.test(e)}var n="\\ud800-\\udfff",o="\\u0300-\\u036f",a="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",l=o+a+s,u="\\ufe0e\\ufe0f",i="\\u200d",c=RegExp("["+i+n+l+u+"]");e.exports=r},/*!*********************************!*\
!*** ./~/lodash/_isLaziable.js ***!
\*********************************/
function(e,t,r){function n(e){var t=s(e),r=l[t];if("function"!=typeof r||!(t in o.prototype))return!1;if(e===r)return!0;var n=a(r);return!!n&&e===n[0]}var o=r(/*! ./_LazyWrapper */107),a=r(/*! ./_getData */121),s=r(/*! ./_getFuncName */246),l=r(/*! ./wrapperLodash */534);e.exports=n},/*!*****************************************!*\
!*** ./~/lodash/_isStrictComparable.js ***!
\*****************************************/
function(e,t,r){function n(e){return e===e&&!o(e)}var o=r(/*! ./isObject */12);e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_mapToArray.js ***!
\*********************************/
function(e,t){function r(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}e.exports=r},/*!**********************************************!*\
!*** ./~/lodash/_matchesStrictComparable.js ***!
\**********************************************/
function(e,t){function r(e,t){return function(r){return null!=r&&(r[e]===t&&(void 0!==t||e in Object(r)))}}e.exports=r},/*!******************************!*\
!*** ./~/lodash/_metaMap.js ***!
\******************************/
function(e,t,r){var n=r(/*! ./_WeakMap */224),o=n&&new n;e.exports=o},/*!*******************************!*\
!*** ./~/lodash/_overRest.js ***!
\*******************************/
function(e,t,r){function n(e,t,r){return t=a(void 0===t?e.length-1:t,0),function(){for(var n=arguments,s=-1,l=a(n.length-t,0),u=Array(l);++s<l;)u[s]=n[t+s];s=-1;for(var i=Array(t+1);++s<t;)i[s]=n[s];return i[t]=r(u),o(e,this,i)}}var o=r(/*! ./_apply */54),a=Math.max;e.exports=n},/*!*****************************!*\
!*** ./~/lodash/_parent.js ***!
\*****************************/
function(e,t,r){function n(e,t){return t.length<2?e:o(e,a(t,0,-1))}var o=r(/*! ./_baseGet */60),a=r(/*! ./_baseSlice */61);e.exports=n},/*!******************************!*\
!*** ./~/lodash/_setData.js ***!
\******************************/
function(e,t,r){var n=r(/*! ./_baseSetData */234),o=r(/*! ./_shortOut */259),a=o(n);e.exports=a},/*!**************************************!*\
!*** ./~/lodash/_setWrapToString.js ***!
\**************************************/
function(e,t,r){function n(e,t,r){var n=t+"";return s(e,a(n,l(o(n),r)))}var o=r(/*! ./_getWrapDetails */435),a=r(/*! ./_insertWrapDetails */445),s=r(/*! ./_setToString */126),l=r(/*! ./_updateWrapDetails */478);e.exports=n},/*!*******************************!*\
!*** ./~/lodash/_shortOut.js ***!
\*******************************/
function(e,t){function r(e){var t=0,r=0;return function(){var s=a(),l=o-(s-r);if(r=s,l>0){if(++t>=n)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var n=800,o=16,a=Date.now;e.exports=r},/*!***********************************!*\
!*** ./~/lodash/_stringToPath.js ***!
\***********************************/
function(e,t,r){var n=r(/*! ./_memoizeCapped */459),o=/^\./,a=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,s=/\\(\\)?/g,l=n(function(e){var t=[];return o.test(e)&&t.push(""),e.replace(a,function(e,r,n,o){t.push(n?o.replace(s,"$1"):r||e)}),t});e.exports=l},/*!*******************************!*\
!*** ./~/lodash/_toSource.js ***!
\*******************************/
function(e,t){function r(e){if(null!=e){try{return o.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var n=Function.prototype,o=n.toString;e.exports=r},/*!*****************************!*\
!*** ./~/lodash/compact.js ***!
\*****************************/
function(e,t){function r(e){for(var t=-1,r=null==e?0:e.length,n=0,o=[];++t<r;){var a=e[t];a&&(o[n++]=a)}return o}e.exports=r},/*!***************************!*\
!*** ./~/lodash/curry.js ***!
\***************************/
function(e,t,r){function n(e,t,r){t=r?void 0:t;var s=o(e,a,void 0,void 0,void 0,void 0,void 0,t);return s.placeholder=n.placeholder,s}var o=r(/*! ./_createWrap */38),a=8;n.placeholder={},e.exports=n},/*!***************************!*\
!*** ./~/lodash/every.js ***!
\***************************/
function(e,t,r){function n(e,t,r){var n=l(e)?o:a;return r&&u(e,t,r)&&(t=void 0),n(e,s(t,3))}var o=r(/*! ./_arrayEvery */362),a=r(/*! ./_baseEvery */367),s=r(/*! ./_baseIteratee */13),l=r(/*! ./isArray */4),u=r(/*! ./_isIterateeCall */70);e.exports=n},/*!*******************************!*\
!*** ./~/lodash/findIndex.js ***!
\*******************************/
function(e,t,r){function n(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var u=null==r?0:s(r);return u<0&&(u=l(n+u,0)),o(e,a(t,3),u)}var o=r(/*! ./_baseFindIndex */230),a=r(/*! ./_baseIteratee */13),s=r(/*! ./toInteger */20),l=Math.max;e.exports=n},/*!*****************************!*\
!*** ./~/lodash/fp/flow.js ***!
\*****************************/
function(e,t,r){var n=r(/*! ./convert */6),o=n("flow",r(/*! ../flow */490));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!*********************************!*\
!*** ./~/lodash/fp/includes.js ***!
\*********************************/
function(e,t,r){var n=r(/*! ./convert */6),o=n("includes",r(/*! ../includes */74));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!***************************!*\
!*** ./~/lodash/hasIn.js ***!
\***************************/
function(e,t,r){function n(e,t){return null!=e&&a(e,t,o)}var o=r(/*! ./_baseHasIn */372),a=r(/*! ./_hasPath */248);e.exports=n},/*!****************************!*\
!*** ./~/lodash/invoke.js ***!
\****************************/
function(e,t,r){var n=r(/*! ./_baseInvoke */375),o=r(/*! ./_baseRest */18),a=o(n);e.exports=a},/*!***************************!*\
!*** ./~/lodash/isNil.js ***!
\***************************/
function(e,t){function r(e){return null==e}e.exports=r},/*!******************************!*\
!*** ./~/lodash/isNumber.js ***!
\******************************/
function(e,t,r){function n(e){return"number"==typeof e||a(e)&&o(e)==s}var o=r(/*! ./_baseGetTag */21),a=r(/*! ./isObjectLike */15),s="[object Number]";e.exports=n},/*!******************************!*\
!*** ./~/lodash/isString.js ***!
\******************************/
function(e,t,r){function n(e){return"string"==typeof e||!a(e)&&s(e)&&o(e)==l}var o=r(/*! ./_baseGetTag */21),a=r(/*! ./isArray */4),s=r(/*! ./isObjectLike */15),l="[object String]";e.exports=n},/*!****************************!*\
!*** ./~/lodash/keysIn.js ***!
\****************************/
function(e,t,r){function n(e){return s(e)?o(e,!0):a(e)}var o=r(/*! ./_arrayLikeKeys */225),a=r(/*! ./_baseKeysIn */382),s=r(/*! ./isArrayLike */14);e.exports=n},/*!**************************!*\
!*** ./~/lodash/last.js ***!
\**************************/
function(e,t){function r(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}e.exports=r},/*!**************************!*\
!*** ./~/lodash/noop.js ***!
\**************************/
function(e,t){function r(){}e.exports=r},/*!****************************!*\
!*** ./~/lodash/reduce.js ***!
\****************************/
function(e,t,r){function n(e,t,r){var n=u(e)?o:l,i=arguments.length<3;return n(e,s(t,4),r,i,a)}var o=r(/*! ./_arrayReduce */56),a=r(/*! ./_baseEach */32),s=r(/*! ./_baseIteratee */13),l=r(/*! ./_baseReduce */392),u=r(/*! ./isArray */4);e.exports=n},/*!**************************!*\
!*** ./~/lodash/some.js ***!
\**************************/
function(e,t,r){function n(e,t,r){var n=l(e)?o:s;return r&&u(e,t,r)&&(t=void 0),n(e,a(t,3))}var o=r(/*! ./_arraySome */226),a=r(/*! ./_baseIteratee */13),s=r(/*! ./_baseSome */395),l=r(/*! ./isArray */4),u=r(/*! ./_isIterateeCall */70);e.exports=n},/*!********************************!*\
!*** ./~/lodash/startsWith.js ***!
\********************************/
function(e,t,r){function n(e,t,r){return e=l(e),r=o(s(r),0,e.length),t=a(t),e.slice(r,r+t.length)==t}var o=r(/*! ./_baseClamp */228),a=r(/*! ./_baseToString */236),s=r(/*! ./toInteger */20),l=r(/*! ./toString */24);e.exports=n},/*!*******************************!*\
!*** ./~/lodash/stubArray.js ***!
\*******************************/
function(e,t){function r(){return[]}e.exports=r},/*!***************************!*\
!*** ./~/lodash/times.js ***!
\***************************/
function(e,t,r){function n(e,t){if(e=s(e),e<1||e>l)return[];var r=u,n=i(e,u);t=a(t),e-=u;for(var c=o(n,t);++r<e;)t(r);return c}var o=r(/*! ./_baseTimes */235),a=r(/*! ./_castFunction */237),s=r(/*! ./toInteger */20),l=9007199254740991,u=4294967295,i=Math.min;e.exports=n},/*!******************************!*\
!*** ./~/lodash/toFinite.js ***!
\******************************/
function(e,t,r){function n(e){if(!e)return 0===e?e:0;if(e=o(e),e===a||e===-a){var t=e<0?-1:1;return t*s}return e===e?e:0}var o=r(/*! ./toNumber */80),a=1/0,s=1.7976931348623157e308;e.exports=n},/*!***************************************!*\
!*** ./src/addons/Confirm/Confirm.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.open,r=e.cancelButton,n=e.confirmButton,a=e.header,u=e.content,p=e.onConfirm,f=e.onCancel,m=(0,c.getUnhandledProps)(o,e),h={};return(0,s.default)(e,"open")&&(h.open=t),i.default.createElement(y.default,l({},h,{size:"small",onClose:f},m),a&&i.default.createElement(y.default.Header,null,a),u&&i.default.createElement(y.default.Content,null,u),i.default.createElement(y.default.Actions,null,i.default.createElement(d.default,{onClick:f},r),i.default.createElement(d.default,{primary:!0,onClick:p},n)))}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/has */27),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ../../elements/Button */84),d=n(p),f=r(/*! ../../modules/Modal */193),y=n(f);o._meta={name:"Confirm",type:c.META.TYPES.ADDON},o.propTypes={open:u.PropTypes.bool,cancelButton:u.PropTypes.string,confirmButton:u.PropTypes.string,header:u.PropTypes.string,content:u.PropTypes.string,onConfirm:u.PropTypes.func,onCancel:u.PropTypes.func},o.defaultProps={cancelButton:"Cancel",confirmButton:"OK",content:"Are you sure?"},t.default=o},/*!*************************************!*\
!*** ./src/addons/Confirm/index.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Confirm */282),a=n(o);t.default=a.default},/*!*************************************!*\
!*** ./src/addons/Portal/Portal.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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)}Object.defineProperty(t,"__esModule",{value:!0});var l=r(/*! lodash/invoke */269),u=n(l),i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),p=r(/*! react */1),d=n(p),f=r(/*! react-dom */536),y=n(f),m=r(/*! ../../lib */2),h=(0,m.makeDebugger)("portal"),v={name:"Portal",type:m.META.TYPES.ADDON},b=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,c=Array(l),p=0;p<l;p++)c[p]=arguments[p];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),n.state={},n.handleDocumentClick=function(e){var t=n.props,r=t.closeOnDocumentClick,o=t.closeOnRootNodeClick;n.node&&n.portal&&!n.portal.contains(e.target)&&(r||o&&n.node.contains(e.target))&&(h("handleDocumentClick()"),e.stopPropagation(),n.close(e))},n.handleEscape=function(e){n.props.closeOnEscape&&m.keyboardKey.getCode(e)===m.keyboardKey.Escape&&(h("handleEscape()"),e.preventDefault(),n.close(e))},n.handlePortalMouseLeave=function(e){var t=n.props,r=t.closeOnPortalMouseLeave,o=t.mouseLeaveDelay;r&&(h("handlePortalMouseLeave()"),n.mouseLeaveTimer=n.closeWithTimeout(e,o))},n.handlePortalMouseOver=function(e){var t=n.props.closeOnPortalMouseLeave;t&&(h("handlePortalMouseOver()"),clearTimeout(n.mouseLeaveTimer))},n.handleTriggerBlur=function(e){var t=n.props,r=t.trigger,o=t.closeOnTriggerBlur;(0,u.default)(r,"props.onBlur",e),o&&(h("handleTriggerBlur()"),n.close(e))},n.handleTriggerClick=function(e){var t=n.props,r=t.trigger,o=t.closeOnTriggerClick,a=t.openOnTriggerClick,s=n.state.open;(0,u.default)(r,"props.onClick",e),s&&o?(h("handleTriggerClick() - close"),e.stopPropagation(),n.close(e)):!s&&a&&(h("handleTriggerClick() - open"),e.stopPropagation(),n.open(e)),e.nativeEvent.stopImmediatePropagation()},n.handleTriggerFocus=function(e){var t=n.props,r=t.trigger,o=t.openOnTriggerFocus;(0,u.default)(r,"props.onFocus",e),o&&(h("handleTriggerFocus()"),n.open(e))},n.handleTriggerMouseLeave=function(e){clearTimeout(n.mouseOverTimer);var t=n.props,r=t.trigger,o=t.closeOnTriggerMouseLeave,a=t.mouseLeaveDelay;(0,u.default)(r,"props.onMouseLeave",e),o&&(h("handleTriggerMouseLeave()"),n.mouseLeaveTimer=n.closeWithTimeout(e,a))},n.handleTriggerMouseOver=function(e){clearTimeout(n.mouseLeaveTimer);var t=n.props,r=t.trigger,o=t.mouseOverDelay,a=t.openOnTriggerMouseOver;(0,u.default)(r,"props.onMouseOver",e),a&&(h("handleTriggerMouseOver()"),n.mouseOverTimer=n.openWithTimeout(e,o))},n.open=function(e){h("open()");var t=n.props.onOpen;t&&t(e,n.props),n.trySetState({open:!0})},n.openWithTimeout=function(e,t){var r=i({},e);return setTimeout(function(){return n.open(r)},t||0)},n.close=function(e){h("close()");var t=n.props.onClose;t&&t(e,n.props),n.trySetState({open:!1})},n.closeWithTimeout=function(e,t){var r=i({},e);return setTimeout(function(){return n.close(r)},t||0)},n.mountPortal=function(){if(m.isBrowser&&!n.node){h("mountPortal()");var e=n.props,t=e.mountNode,r=e.prepend;n.node=document.createElement("div"),r?t.insertBefore(n.node,t.firstElementChild):t.appendChild(n.node),document.addEventListener("click",n.handleDocumentClick),document.addEventListener("keydown",n.handleEscape);var o=n.props.onMount;o&&o(null,n.props)}},n.unmountPortal=function(){if(m.isBrowser&&n.node){h("unmountPortal()"),y.default.unmountComponentAtNode(n.node),n.node.parentNode.removeChild(n.node),n.portal.removeEventListener("mouseleave",n.handlePortalMouseLeave),n.portal.removeEventListener("mouseover",n.handlePortalMouseOver),n.node=null,n.portal=null,document.removeEventListener("click",n.handleDocumentClick),document.removeEventListener("keydown",n.handleEscape);var e=n.props.onUnmount;e&&e(null,n.props)}},s=r,a(n,s)}return s(t,e),c(t,[{key:"componentDidMount",value:function(){this.renderPortal()}},{key:"componentDidUpdate",value:function(e,t){this.renderPortal(),t.open&&!this.state.open&&(h("portal closed"),this.unmountPortal())}},{key:"componentWillUnmount",value:function(){this.unmountPortal(),clearTimeout(this.mouseOverTimer),clearTimeout(this.mouseLeaveTimer)}},{key:"renderPortal",value:function(){if(this.state.open){h("renderPortal()");var e=this.props,t=e.children,r=e.className;if(this.mountPortal(),!m.isBrowser)return null;this.node.className=r||"",this.portal&&(this.portal.removeEventListener("mouseleave",this.handlePortalMouseLeave),this.portal.removeEventListener("mouseover",this.handlePortalMouseOver)),y.default.unstable_renderSubtreeIntoContainer(this,p.Children.only(t),this.node),this.portal=this.node.firstElementChild,this.portal.addEventListener("mouseleave",this.handlePortalMouseLeave),this.portal.addEventListener("mouseover",this.handlePortalMouseOver)}}},{key:"render",value:function(){var e=this.props.trigger;return e?d.default.cloneElement(e,{onBlur:this.handleTriggerBlur,onClick:this.handleTriggerClick,onFocus:this.handleTriggerFocus,onMouseLeave:this.handleTriggerMouseLeave,onMouseOver:this.handleTriggerMouseOver}):null}}]),t}(m.AutoControlledComponent);b.propTypes={children:p.PropTypes.node.isRequired,className:p.PropTypes.string,closeOnRootNodeClick:m.customPropTypes.every([m.customPropTypes.disallow(["closeOnDocumentClick"]),p.PropTypes.bool]),closeOnDocumentClick:m.customPropTypes.every([m.customPropTypes.disallow(["closeOnRootNodeClick"]),p.PropTypes.bool]),closeOnEscape:p.PropTypes.bool,closeOnPortalMouseLeave:p.PropTypes.bool,closeOnTriggerBlur:p.PropTypes.bool,closeOnTriggerClick:p.PropTypes.bool,closeOnTriggerMouseLeave:p.PropTypes.bool,defaultOpen:p.PropTypes.bool,mountNode:p.PropTypes.any,mouseLeaveDelay:p.PropTypes.number,mouseOverDelay:p.PropTypes.number,onClose:p.PropTypes.func,onMount:p.PropTypes.func,onOpen:p.PropTypes.func,onUnmount:p.PropTypes.func,open:p.PropTypes.bool,openOnTriggerClick:p.PropTypes.bool,openOnTriggerFocus:p.PropTypes.bool,openOnTriggerMouseOver:p.PropTypes.bool,prepend:p.PropTypes.bool,trigger:p.PropTypes.node},b.defaultProps={closeOnDocumentClick:!0,closeOnEscape:!0,openOnTriggerClick:!0,mountNode:m.isBrowser?document.body:null},b.autoControlledProps=["open"],b._meta=v,t.default=b},/*!***********************************!*\
!*** ./src/addons/Radio/Radio.js ***!
\***********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.slider,r=e.toggle,n=e.type,s=(0,u.getUnhandledProps)(o,e),i=!(t||r)||void 0;return l.default.createElement(c.default,a({},s,{type:n,radio:i,slider:t,toggle:r}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! ../../lib */2),i=r(/*! ../../modules/Checkbox */50),c=n(i);o._meta={name:"Radio",type:u.META.TYPES.ADDON,props:{type:c.default._meta.props.type}},o.propTypes={slider:c.default.propTypes.slider,toggle:c.default.propTypes.toggle,type:s.PropTypes.oneOf(o._meta.props.type)},o.defaultProps={type:"radio"},t.default=o},/*!*************************************!*\
!*** ./src/addons/Select/Select.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return l.default.createElement(c.default,a({},e,{selection:!0}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! ../../lib */2),i=r(/*! ../../modules/Dropdown */92),c=n(i);o._meta={name:"Select",type:u.META.TYPES.ADDON},o.Divider=c.default.Divider,o.Header=c.default.Header,o.Item=c.default.Item,o.Menu=c.default.Menu,t.default=o},/*!*****************************************!*\
!*** ./src/addons/TextArea/TextArea.js ***!
\*****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(/*! react */1),c=n(i),p=r(/*! ../../lib */2),d=function(e){function t(){var e,r,n,s;o(this,t);for(var u=arguments.length,i=Array(u),c=0;c<u;c++)i[c]=arguments[c];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),n.handleChange=function(e){var t=n.props.onChange;t&&t(e,l({},n.props,{value:e.target&&e.target.value}))},s=r,a(n,s)}return s(t,e),u(t,[{key:"render",value:function(){var e=(0,p.getUnhandledProps)(t,this.props),r=(0,p.getElementType)(t,this.props);return c.default.createElement(r,l({},e,{onChange:this.handleChange}))}}]),t}(i.Component);d._meta={name:"TextArea",type:p.META.TYPES.ADDON},d.propTypes={as:p.customPropTypes.as,onChange:i.PropTypes.func},d.defaultProps={as:"textarea"},t.default=d},/*!**************************************************!*\
!*** ./src/collections/Breadcrumb/Breadcrumb.js ***!
\**************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.divider,a=e.icon,s=e.size,l=e.sections,i=(0,f.default)("ui",r,s,"breadcrumb"),d=(0,h.getUnhandledProps)(o,e),y=(0,h.getElementType)(o,e);if(t)return m.default.createElement(y,p({},d,{className:i}),t);var v=[];return(0,c.default)(l,function(e,t){var r=P.default.create(e);if(v.push(r),t!==l.length-1){var o=void 0;o=e.key?e.key+"_divider":(0,u.default)(r.props,function(e,t){return t+"="+("function"==typeof e?e.name||"func":e)}).join("|"),v.push(b.default.create({content:n,icon:a,key:o}))}}),m.default.createElement(y,p({},d,{className:i}),v)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/without */7),s=n(a),l=r(/*! lodash/map */9),u=n(l),i=r(/*! lodash/each */73),c=n(i),p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},d=r(/*! classnames */3),f=n(d),y=r(/*! react */1),m=n(y),h=r(/*! ../../lib */2),v=r(/*! ./BreadcrumbDivider */138),b=n(v),g=r(/*! ./BreadcrumbSection */139),P=n(g);o._meta={name:"Breadcrumb",type:h.META.TYPES.COLLECTION,props:{size:(0,s.default)(h.SUI.SIZES,"medium")}},o.propTypes={as:h.customPropTypes.as,children:y.PropTypes.node,className:y.PropTypes.string,divider:h.customPropTypes.every([h.customPropTypes.disallow(["icon"]),h.customPropTypes.contentShorthand]),icon:h.customPropTypes.every([h.customPropTypes.disallow(["divider"]),h.customPropTypes.itemShorthand]),sections:h.customPropTypes.collectionShorthand,size:y.PropTypes.oneOf(o._meta.props.size)},o.Divider=b.default,o.Section=P.default,t.default=o},/*!*********************************************!*\
!*** ./src/collections/Breadcrumb/index.js ***!
\*********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Breadcrumb */288),a=n(o);t.default=a.default},/*!**************************************!*\
!*** ./src/collections/Form/Form.js ***!
\**************************************/
function(e,t,r){(function(e){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(t){B("formSerializer()");var r={};return t?((0,b.default)(t.querySelectorAll('input[type="checkbox"]'),function(n,o,a){var s=Y(n),l=(0,h.default)(a,{name:s});if(1===l.length)return r[s]=n.checked&&"on"!==n.value?n.value:n.checked,void q(r,s,n);if(Array.isArray(r[s])||(r[s]=[]),n.checked&&r[s].push(n.value),q(r,s,n),"production"!==e.NODE_ENV&&"on"===n.value){var u=["Encountered a checkbox in a group with the default browser value 'on'.","Each checkbox in a group should have a unique value.","Otherwise, the checkbox value will serialize as ['on', ...]."].join(" ");console.error(u,n,t)}}),(0,b.default)(t.querySelectorAll('input[type="radio"]'),function(n,o,a){var s=Y(n),l=(0,y.default)(a,{name:s,checked:!0});if(l?r[s]=l.value:r[s]=null,q(r,s,n),"production"!==e.NODE_ENV&&"on"===n.value){var u=["Encountered a radio with the default browser value 'on'.","Each radio should have a unique value.","Otherwise, the radio value will serialize as { [name]: 'on' }."].join(" ");console.error(u,n,t)}}),(0,b.default)(t.querySelectorAll('input:not([type="radio"]):not([type="checkbox"])'),function(e){var t=Y(e);r[t]=e.value,q(r,t,e)}),(0,b.default)(t.querySelectorAll("textarea"),function(e){var t=Y(e);r[t]=e.value,q(r,t,e)}),(0,b.default)(t.querySelectorAll("select"),function(e){var t=Y(e);e.multiple?r[t]=(0,d.default)((0,h.default)(e.querySelectorAll("option"),"selected"),"value"):r[t]=e.value,q(r,t,e)}),r):r}Object.defineProperty(t,"__esModule",{value:!0});var i=r(/*! lodash/without */7),c=n(i),p=r(/*! lodash/map */9),d=n(p),f=r(/*! lodash/find */128),y=n(f),m=r(/*! lodash/filter */127),h=n(m),v=r(/*! lodash/each */73),b=n(v),g=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},P=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),T=r(/*! classnames */3),O=n(T),_=r(/*! react */1),E=n(_),j=r(/*! ../../lib */2),w=r(/*! ./FormButton */140),S=n(w),M=r(/*! ./FormCheckbox */141),x=n(M),N=r(/*! ./FormDropdown */142),A=n(N),C=r(/*! ./FormField */16),k=n(C),I=r(/*! ./FormGroup */143),K=n(I),L=r(/*! ./FormInput */144),U=n(L),D=r(/*! ./FormRadio */145),R=n(D),z=r(/*! ./FormSelect */146),W=n(z),F=r(/*! ./FormTextArea */147),V=n(F),B=(0,j.makeDebugger)("form"),Y=function(e){var t=e.name;return t},q=function(){};"production"!==e.NODE_ENV&&(q=function(e,t,r){B("serialized "+JSON.stringify(l({},t,e[t]))+" from:",r)},Y=function(e){var t=e.name;if(!t){var r=["Encountered a form control node without a name attribute.","Each node in a group should have a name.",'Otherwise, the node will serialize as { "undefined": <value> }.'].join(" ");console.error(r,e)}return t});var H={name:"Form",type:j.META.TYPES.COLLECTION,props:{widths:["equal"],size:(0,c.default)(j.SUI.SIZES,"medium")}},G=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n._form=null,n.handleRef=function(e){return n._form=n._form||e},n.handleSubmit=function(e){var t=n.props,r=t.onSubmit,o=t.serializer;r&&r(e,g({},n.props,{formData:o(n._form)}))},s=r,a(n,s)}return s(t,e),P(t,[{key:"render",value:function(){var e=this.props,r=e.children,n=e.className,o=e.error,a=e.loading,s=e.reply,l=e.size,u=e.success,i=e.warning,c=e.widths,p=(0,O.default)("ui",l,(0,j.useKeyOnly)(o,"error"),(0,j.useKeyOnly)(a,"loading"),(0,j.useKeyOnly)(s,"reply"),(0,j.useKeyOnly)(u,"success"),(0,j.useKeyOnly)(i,"warning"),(0,j.useWidthProp)(c,null,!0),"form",n),d=(0,j.getUnhandledProps)(t,this.props),f=(0,j.getElementType)(t,this.props);return E.default.createElement(f,g({},d,{className:p,ref:this.handleRef,onSubmit:this.handleSubmit}),r)}}]),t}(_.Component);G.defaultProps={as:"form",serializer:u},G.propTypes={as:j.customPropTypes.as,children:_.PropTypes.node,className:_.PropTypes.string,error:_.PropTypes.bool,loading:_.PropTypes.bool,onSubmit:_.PropTypes.func,reply:_.PropTypes.bool,serializer:_.PropTypes.func,size:_.PropTypes.oneOf(H.props.size),success:_.PropTypes.bool,warning:_.PropTypes.bool,widths:_.PropTypes.oneOf(H.props.widths)},G._meta=H,G.Field=k.default,G.Button=S.default,G.Checkbox=x.default,G.Dropdown=A.default,G.Group=K.default,G.Input=U.default,G.Radio=R.default,G.Select=W.default,G.TextArea=V.default,t.default=G}).call(t,r(/*! ./~/process/browser.js */35))},/*!***************************************!*\
!*** ./src/collections/Form/index.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Form */290),a=n(o);t.default=a.default},/*!**************************************!*\
!*** ./src/collections/Grid/Grid.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function a(e){var t=e.celled,r=e.centered,n=e.children,o=e.className,l=e.columns,i=e.divided,d=e.doubling,f=e.padded,y=e.relaxed,m=e.reversed,h=e.stackable,v=e.stretched,b=e.textAlign,g=e.verticalAlign,P=(0,u.default)("ui",(0,p.useKeyOnly)(r,"centered"),(0,p.useKeyOnly)(d,"doubling"),(0,p.useKeyOnly)(h,"stackable"),(0,p.useKeyOnly)(v,"stretched"),(0,p.useKeyOrValueAndKey)(t,"celled"),(0,p.useKeyOrValueAndKey)(i,"divided"),(0,p.useKeyOrValueAndKey)(f,"padded"),(0,p.useKeyOrValueAndKey)(y,"relaxed"),(0,p.useTextAlignProp)(b),(0,p.useValueAndKey)(m,"reversed"),(0,p.useVerticalAlignProp)(g),(0,p.useWidthProp)(l,"column",!0),"grid",o),T=(0,p.getUnhandledProps)(a,e),O=(0,p.getElementType)(a,e);return c.default.createElement(O,s({},T,{className:P}),n)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l=r(/*! classnames */3),u=n(l),i=r(/*! react */1),c=n(i),p=r(/*! ../../lib */2),d=r(/*! ./GridColumn */148),f=n(d),y=r(/*! ./GridRow */149),m=n(y);a.Column=f.default,a.Row=m.default,a._meta={name:"Grid",type:p.META.TYPES.COLLECTION,props:{celled:["internally"],columns:[].concat(o(p.SUI.WIDTHS),["equal"]),divided:["vertically"],padded:["horizontally","vertically"],relaxed:["very"],reversed:["computer","computer vertically","mobile","mobile vertically","tablet","tablet vertically"],textAlign:p.SUI.TEXT_ALIGNMENTS,verticalAlign:p.SUI.VERTICAL_ALIGNMENTS}},a.propTypes={as:p.customPropTypes.as,celled:i.PropTypes.oneOfType([i.PropTypes.bool,i.PropTypes.oneOf(a._meta.props.celled)]),centered:i.PropTypes.bool,children:i.PropTypes.node,className:i.PropTypes.string,columns:i.PropTypes.oneOf(a._meta.props.columns),divided:i.PropTypes.oneOfType([i.PropTypes.bool,i.PropTypes.oneOf(a._meta.props.divided)]),doubling:i.PropTypes.bool,padded:i.PropTypes.oneOfType([i.PropTypes.bool,i.PropTypes.oneOf(a._meta.props.padded)]),relaxed:i.PropTypes.oneOfType([i.PropTypes.bool,i.PropTypes.oneOf(a._meta.props.relaxed)]),reversed:i.PropTypes.oneOf(a._meta.props.reversed),stackable:i.PropTypes.bool,stretched:i.PropTypes.bool,textAlign:i.PropTypes.oneOf(a._meta.props.textAlign),verticalAlign:i.PropTypes.oneOf(f.default._meta.props.verticalAlign)},t.default=a},/*!***************************************!*\
!*** ./src/collections/Grid/index.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Grid */292),a=n(o);t.default=a.default},/*!**************************************!*\
!*** ./src/collections/Menu/Menu.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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)}Object.defineProperty(t,"__esModule",{value:!0});var l=r(/*! lodash/map */9),u=n(l),i=r(/*! lodash/get */34),c=n(i),p=r(/*! lodash/without */7),d=n(p),f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},y=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),m=r(/*! classnames */3),h=n(m),v=r(/*! react */1),b=n(v),g=r(/*! ../../lib */2),P=r(/*! ./MenuHeader */150),T=n(P),O=r(/*! ./MenuItem */151),_=n(O),E=r(/*! ./MenuMenu */152),j=n(E),w={name:"Menu",type:g.META.TYPES.COLLECTION,props:{attached:["top","bottom"],color:g.SUI.COLORS,floated:["right"],icon:["labeled"],fixed:["left","right","bottom","top"],size:(0,d.default)(g.SUI.SIZES,"medium","big"),tabular:["right"],widths:g.SUI.WIDTHS}},S=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.handleItemClick=function(e,t){var r=t.index;n.trySetState({activeIndex:r});var o=n.props,a=o.items,s=o.onItemClick;(0,c.default)(a[r],"onClick")&&a[r].onClick(e,t),s&&s(e,t)},s=r,a(n,s)}return s(t,e),y(t,[{key:"renderItems",value:function(){var e=this,t=this.props.items,r=this.state.activeIndex;return(0,u.default)(t,function(t,n){return(0,g.createShorthand)(_.default,function(e){return{content:e,name:e}},t,{active:r===n,childKey:function(e){var t=e.content,r=e.name;return[t,r].join("-")},index:n,onClick:e.handleItemClick})})}},{key:"render",value:function(){var e=this.props,r=e.attached,n=e.borderless,o=e.children,a=e.className,s=e.color,l=e.compact,u=e.fixed,i=e.floated,c=e.fluid,p=e.icon,d=e.inverted,y=e.pagination,m=e.pointing,v=e.secondary,P=e.stackable,T=e.tabular,O=e.text,_=e.vertical,E=e.size,j=e.widths,w=(0,h.default)("ui",s,E,(0,g.useWidthProp)(j,"item"),(0,g.useKeyOrValueAndKey)(r,"attached"),(0,g.useKeyOnly)(n,"borderless"),(0,g.useKeyOnly)(l,"compact"),(0,g.useValueAndKey)(u,"fixed"),(0,g.useKeyOrValueAndKey)(i,"floated"),(0,g.useKeyOnly)(c,"fluid"),(0,g.useKeyOrValueAndKey)(p,"icon"),(0,g.useKeyOnly)(d,"inverted"),(0,g.useKeyOnly)(y,"pagination"),(0,g.useKeyOnly)(m,"pointing"),(0,g.useKeyOnly)(v,"secondary"),(0,g.useKeyOnly)(P,"stackable"),(0,g.useKeyOrValueAndKey)(T,"tabular"),(0,g.useKeyOnly)(O,"text"),(0,g.useKeyOnly)(_,"vertical"),a,"menu"),S=(0,g.getUnhandledProps)(t,this.props),M=(0,g.getElementType)(t,this.props);return b.default.createElement(M,f({},S,{className:w}),o||this.renderItems())}}]),t}(g.AutoControlledComponent);S.propTypes={as:g.customPropTypes.as,activeIndex:v.PropTypes.number,attached:v.PropTypes.oneOfType([v.PropTypes.bool,v.PropTypes.oneOf(w.props.attached)]),borderless:v.PropTypes.bool,children:v.PropTypes.node,className:v.PropTypes.string,color:v.PropTypes.oneOf(w.props.color),compact:v.PropTypes.bool,defaultActiveIndex:v.PropTypes.number,fixed:v.PropTypes.oneOf(w.props.fixed),floated:v.PropTypes.oneOfType([v.PropTypes.bool,v.PropTypes.oneOf(w.props.floated)]),fluid:v.PropTypes.bool,icon:v.PropTypes.oneOfType([v.PropTypes.bool,v.PropTypes.oneOf(w.props.icon)]),inverted:v.PropTypes.bool,items:g.customPropTypes.collectionShorthand,onItemClick:g.customPropTypes.every([g.customPropTypes.disallow(["children"]),v.PropTypes.func]),pagination:v.PropTypes.bool,pointing:v.PropTypes.bool,secondary:v.PropTypes.bool,stackable:v.PropTypes.bool,tabular:v.PropTypes.oneOfType([v.PropTypes.bool,v.PropTypes.oneOf(w.props.tabular)]),text:v.PropTypes.bool,vertical:v.PropTypes.bool,size:v.PropTypes.oneOf(w.props.size),widths:v.PropTypes.oneOf(w.props.widths)},S._meta=w,S.autoControlledProps=["activeIndex"],S.Header=T.default,S.Item=_.default,S.Menu=j.default,t.default=S},/*!***************************************!*\
!*** ./src/collections/Menu/index.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Menu */294),a=n(o);t.default=a.default},/*!********************************************!*\
!*** ./src/collections/Message/Message.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.children,r=e.className,n=e.content,a=e.header,s=e.icon,u=e.list,c=e.onDismiss,f=e.hidden,m=e.visible,v=e.floating,g=e.compact,T=e.attached,O=e.warning,_=e.info,E=e.positive,j=e.success,w=e.negative,S=e.error,M=e.color,x=e.size,N=(0,p.default)("ui",x,M,(0,d.useKeyOnly)(s,"icon"),(0,d.useKeyOnly)(f,"hidden"),(0,d.useKeyOnly)(m,"visible"),(0,d.useKeyOnly)(v,"floating"),(0,d.useKeyOnly)(g,"compact"),(0,d.useKeyOrValueAndKey)(T,"attached"),(0,d.useKeyOnly)(O,"warning"),(0,d.useKeyOnly)(_,"info"),(0,d.useKeyOnly)(E,"positive"),(0,d.useKeyOnly)(j,"success"),(0,d.useKeyOnly)(w,"negative"),(0,d.useKeyOnly)(S,"error"),"message",r),A=c&&i.default.createElement(y.default,{name:"close",onClick:c}),C=(0,d.getUnhandledProps)(o,e),k=(0,d.getElementType)(o,e);return t?i.default.createElement(k,l({},C,{className:N}),A,t):i.default.createElement(k,l({},C,{className:N}),A,y.default.create(s),(a||n||u)&&i.default.createElement(h.default,null,(0,d.createShorthand)(b.default,function(e){return{children:e}},a),(0,d.createShorthand)(P.default,function(e){return{items:e}},u),(0,d.createShorthand)("p",function(e){return{children:e}},n)))}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/without */7),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! react */1),i=n(u),c=r(/*! classnames */3),p=n(c),d=r(/*! ../../lib */2),f=r(/*! ../../elements/Icon */8),y=n(f),m=r(/*! ./MessageContent */153),h=n(m),v=r(/*! ./MessageHeader */154),b=n(v),g=r(/*! ./MessageList */155),P=n(g),T=r(/*! ./MessageItem */82),O=n(T);o._meta={name:"Message",type:d.META.TYPES.COLLECTION,props:{attached:["bottom"],color:d.SUI.COLORS,size:(0,s.default)(d.SUI.SIZES,"medium")}},o.propTypes={as:d.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:d.customPropTypes.contentShorthand,header:d.customPropTypes.itemShorthand,icon:u.PropTypes.oneOfType([u.PropTypes.bool,d.customPropTypes.itemShorthand]),list:d.customPropTypes.collectionShorthand,onDismiss:u.PropTypes.func,hidden:u.PropTypes.bool,visible:u.PropTypes.bool,floating:u.PropTypes.bool,compact:u.PropTypes.bool,attached:u.PropTypes.oneOfType([u.PropTypes.bool,u.PropTypes.oneOf(o._meta.props.attached)]),warning:u.PropTypes.bool,info:u.PropTypes.bool,positive:u.PropTypes.bool,success:u.PropTypes.bool,negative:u.PropTypes.bool,error:u.PropTypes.bool,color:u.PropTypes.oneOf(o._meta.props.color),size:u.PropTypes.oneOf(o._meta.props.size)},o.Content=h.default,o.Header=b.default,o.List=P.default,o.Item=O.default,t.default=o},/*!******************************************!*\
!*** ./src/collections/Message/index.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Message */296),a=n(o);t.default=a.default},/*!****************************************!*\
!*** ./src/collections/Table/Table.js ***!
\****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.basic,r=e.attached,n=e.renderBodyRow,a=e.celled,s=e.children,l=e.className,c=e.collapsing,d=e.color,m=e.columns,v=e.compact,b=e.definition,g=e.fixed,T=e.footerRow,_=e.headerRow,E=e.inverted,j=e.padded,S=e.selectable,M=e.singleLine,x=e.size,N=e.stackable,A=e.striped,C=e.structured,k=e.tableData,I=e.unstackable,K=(0,p.default)("ui",d,x,(0,y.useKeyOrValueAndKey)(r,"attached"),(0,y.useKeyOrValueAndKey)(t,"basic"),(0,y.useKeyOnly)(a,"celled"),(0,y.useKeyOnly)(c,"collapsing"),(0,y.useKeyOrValueAndKey)(v,"compact"),(0,y.useKeyOnly)(b,"definition"),(0,y.useKeyOnly)(g,"fixed"),(0,y.useKeyOnly)(E,"inverted"),(0,y.useKeyOrValueAndKey)(j,"padded"),(0,y.useKeyOnly)(S,"selectable"),(0,y.useKeyOnly)(M,"single line"),(0,y.useKeyOnly)(N,"stackable"),(0,y.useKeyOnly)(A,"striped"),(0,y.useKeyOnly)(C,"structured"),(0,y.useKeyOnly)(I,"unstackable"),(0,y.useWidthProp)(m,"column"),l,"table"),L=(0,y.getUnhandledProps)(o,e),U=(0,y.getElementType)(o,e);return s?f.default.createElement(U,i({},L,{className:K}),s):f.default.createElement(U,i({},L,{className:K}),_&&f.default.createElement(O.default,null,w.default.create(_,{cellAs:"th"})),f.default.createElement(h.default,null,n&&(0,u.default)(k,function(e,t){return w.default.create(n(e,t))})),T&&f.default.createElement(P.default,null,w.default.create(T)))}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/without */7),s=n(a),l=r(/*! lodash/map */9),u=n(l),i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=r(/*! classnames */3),p=n(c),d=r(/*! react */1),f=n(d),y=r(/*! ../../lib */2),m=r(/*! ./TableBody */156),h=n(m),v=r(/*! ./TableCell */45),b=n(v),g=r(/*! ./TableFooter */157),P=n(g),T=r(/*! ./TableHeader */83),O=n(T),_=r(/*! ./TableHeaderCell */158),E=n(_),j=r(/*! ./TableRow */159),w=n(j);o._meta={name:"Table",type:y.META.TYPES.COLLECTION,props:{attached:["top","bottom"],basic:["very"],color:y.SUI.COLORS,columns:y.SUI.WIDTHS,compact:["very"],padded:["very"],size:(0,s.default)(y.SUI.SIZES,"mini","tiny","medium","big","huge","massive")}},o.defaultProps={as:"table"},o.propTypes={as:y.customPropTypes.as,attached:d.PropTypes.oneOfType([d.PropTypes.oneOf(o._meta.props.attached),d.PropTypes.bool]),basic:d.PropTypes.oneOfType([d.PropTypes.bool,d.PropTypes.oneOf(o._meta.props.basic)]),celled:d.PropTypes.bool,children:d.PropTypes.node,className:d.PropTypes.string,collapsing:d.PropTypes.bool,color:d.PropTypes.oneOf(o._meta.props.color),columns:d.PropTypes.oneOf(o._meta.props.columns),compact:d.PropTypes.oneOfType([d.PropTypes.bool,d.PropTypes.oneOf(o._meta.props.compact)]),definition:d.PropTypes.bool,fixed:d.PropTypes.bool,footerRow:y.customPropTypes.itemShorthand,headerRow:y.customPropTypes.itemShorthand,inverted:d.PropTypes.bool,padded:d.PropTypes.oneOfType([d.PropTypes.bool,d.PropTypes.oneOf(o._meta.props.padded)]),renderBodyRow:y.customPropTypes.every([y.customPropTypes.disallow(["children"]),y.customPropTypes.demand(["tableData"]),d.PropTypes.func]),selectable:d.PropTypes.bool,singleLine:d.PropTypes.bool,size:d.PropTypes.oneOf(o._meta.props.size),stackable:d.PropTypes.bool,striped:d.PropTypes.bool,structured:d.PropTypes.bool,tableData:y.customPropTypes.every([y.customPropTypes.disallow(["children"]),y.customPropTypes.demand(["renderBodyRow"]),d.PropTypes.array]),unstackable:d.PropTypes.bool},o.Body=h.default,o.Cell=b.default,o.Footer=P.default,o.Header=O.default,o.HeaderCell=E.default,o.Row=w.default,t.default=o},/*!****************************************!*\
!*** ./src/collections/Table/index.js ***!
\****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Table */298),a=n(o);t.default=a.default},/*!*********************************************!*\
!*** ./src/elements/Container/Container.js ***!
\*********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.text,r=e.textAlign,n=e.fluid,s=e.children,u=e.className,p=(0,l.default)("ui",(0,c.useKeyOnly)(t,"text"),(0,c.useKeyOnly)(n,"fluid"),(0,c.useTextAlignProp)(r),"container",u),d=(0,c.getUnhandledProps)(o,e),f=(0,c.getElementType)(o,e);return i.default.createElement(f,a({},d,{className:p}),s)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"Container",type:c.META.TYPES.ELEMENT,props:{textAlign:c.SUI.TEXT_ALIGNMENTS}},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,text:u.PropTypes.bool,fluid:u.PropTypes.bool,textAlign:u.PropTypes.oneOf(o._meta.props.textAlign)},t.default=o},/*!*****************************************!*\
!*** ./src/elements/Container/index.js ***!
\*****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Container */300),a=n(o);t.default=a.default},/*!*****************************************!*\
!*** ./src/elements/Divider/Divider.js ***!
\*****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.horizontal,r=e.vertical,n=e.inverted,s=e.fitted,u=e.hidden,p=e.section,d=e.clearing,f=e.children,y=e.className,m=(0,l.default)("ui",(0,c.useKeyOnly)(t,"horizontal"),(0,c.useKeyOnly)(r,"vertical"),(0,c.useKeyOnly)(n,"inverted"),(0,c.useKeyOnly)(s,"fitted"),(0,c.useKeyOnly)(u,"hidden"),(0,c.useKeyOnly)(p,"section"),(0,c.useKeyOnly)(d,"clearing"),"divider",y),h=(0,c.getUnhandledProps)(o,e),v=(0,c.getElementType)(o,e);return i.default.createElement(v,a({},h,{className:m}),f)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"Divider",type:c.META.TYPES.ELEMENT},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,horizontal:u.PropTypes.bool,vertical:u.PropTypes.bool,inverted:u.PropTypes.bool,fitted:u.PropTypes.bool,hidden:u.PropTypes.bool,section:u.PropTypes.bool,clearing:u.PropTypes.bool},t.default=o},/*!***************************************!*\
!*** ./src/elements/Divider/index.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Divider */302),a=n(o);t.default=a.default},/*!***********************************!*\
!*** ./src/elements/Flag/Flag.js ***!
\***********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.className,r=e.name,n=(0,l.default)(r,t,"flag"),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i.default.createElement(u,a({},s,{className:n}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=["ad","andorra","ae","united arab emirates","uae","af","afghanistan","ag","antigua","ai","anguilla","al","albania","am","armenia","an","netherlands antilles","ao","angola","ar","argentina","as","american samoa","at","austria","au","australia","aw","aruba","ax","aland islands","az","azerbaijan","ba","bosnia","bb","barbados","bd","bangladesh","be","belgium","bf","burkina faso","bg","bulgaria","bh","bahrain","bi","burundi","bj","benin","bm","bermuda","bn","brunei","bo","bolivia","br","brazil","bs","bahamas","bt","bhutan","bv","bouvet island","bw","botswana","by","belarus","bz","belize","ca","canada","cc","cocos islands","cd","congo","cf","central african republic","cg","congo brazzaville","ch","switzerland","ci","cote divoire","ck","cook islands","cl","chile","cm","cameroon","cn","china","co","colombia","cr","costa rica","cs","cu","cuba","cv","cape verde","cx","christmas island","cy","cyprus","cz","czech republic","de","germany","dj","djibouti","dk","denmark","dm","dominica","do","dominican republic","dz","algeria","ec","ecuador","ee","estonia","eg","egypt","eh","western sahara","er","eritrea","es","spain","et","ethiopia","eu","european union","fi","finland","fj","fiji","fk","falkland islands","fm","micronesia","fo","faroe islands","fr","france","ga","gabon","gb","united kingdom","gd","grenada","ge","georgia","gf","french guiana","gh","ghana","gi","gibraltar","gl","greenland","gm","gambia","gn","guinea","gp","guadeloupe","gq","equatorial guinea","gr","greece","gs","sandwich islands","gt","guatemala","gu","guam","gw","guinea-bissau","gy","guyana","hk","hong kong","hm","heard island","hn","honduras","hr","croatia","ht","haiti","hu","hungary","id","indonesia","ie","ireland","il","israel","in","india","io","indian ocean territory","iq","iraq","ir","iran","is","iceland","it","italy","jm","jamaica","jo","jordan","jp","japan","ke","kenya","kg","kyrgyzstan","kh","cambodia","ki","kiribati","km","comoros","kn","saint kitts and nevis","kp","north korea","kr","south korea","kw","kuwait","ky","cayman islands","kz","kazakhstan","la","laos","lb","lebanon","lc","saint lucia","li","liechtenstein","lk","sri lanka","lr","liberia","ls","lesotho","lt","lithuania","lu","luxembourg","lv","latvia","ly","libya","ma","morocco","mc","monaco","md","moldova","me","montenegro","mg","madagascar","mh","marshall islands","mk","macedonia","ml","mali","mm","myanmar","burma","mn","mongolia","mo","macau","mp","northern mariana islands","mq","martinique","mr","mauritania","ms","montserrat","mt","malta","mu","mauritius","mv","maldives","mw","malawi","mx","mexico","my","malaysia","mz","mozambique","na","namibia","nc","new caledonia","ne","niger","nf","norfolk island","ng","nigeria","ni","nicaragua","nl","netherlands","no","norway","np","nepal","nr","nauru","nu","niue","nz","new zealand","om","oman","pa","panama","pe","peru","pf","french polynesia","pg","new guinea","ph","philippines","pk","pakistan","pl","poland","pm","saint pierre","pn","pitcairn islands","pr","puerto rico","ps","palestine","pt","portugal","pw","palau","py","paraguay","qa","qatar","re","reunion","ro","romania","rs","serbia","ru","russia","rw","rwanda","sa","saudi arabia","sb","solomon islands","sc","seychelles","gb sct","scotland","sd","sudan","se","sweden","sg","singapore","sh","saint helena","si","slovenia","sj","svalbard","jan mayen","sk","slovakia","sl","sierra leone","sm","san marino","sn","senegal","so","somalia","sr","suriname","st","sao tome","sv","el salvador","sy","syria","sz","swaziland","tc","caicos islands","td","chad","tf","french territories","tg","togo","th","thailand","tj","tajikistan","tk","tokelau","tl","timorleste","tm","turkmenistan","tn","tunisia","to","tonga","tr","turkey","tt","trinidad","tv","tuvalu","tw","taiwan","tz","tanzania","ua","ukraine","ug","uganda","um","us minor islands","us","america","united states","uy","uruguay","uz","uzbekistan","va","vatican city","vc","saint vincent","ve","venezuela","vg","british virgin islands","vi","us virgin islands","vn","vietnam","vu","vanuatu","gb wls","wales","wf","wallis and futuna","ws","samoa","ye","yemen","yt","mayotte","za","south africa","zm","zambia","zw","zimbabwe"];o._meta={name:"Flag",type:c.META.TYPES.ELEMENT,props:{name:p}},o.propTypes={as:c.customPropTypes.as,className:u.PropTypes.string,name:c.customPropTypes.suggest(o._meta.props.name)},o.defaultProps={as:"i"},o.create=(0,c.createShorthandFactory)(o,function(e){return{name:e}}),t.default=o},/*!***************************************!*\
!*** ./src/elements/Header/Header.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.color,r=e.content,n=e.dividing,a=e.block,s=e.attached,u=e.floated,c=e.inverted,f=e.disabled,m=e.sub,v=e.size,g=e.textAlign,T=e.icon,O=e.image,_=e.children,E=e.className,j=e.subheader,w=(0,i.default)("ui",v,t,(0,d.useKeyOrValueAndKey)(s,"attached"),(0,d.useKeyOnly)(a,"block"),(0,d.useKeyOnly)(f,"disabled"),(0,d.useKeyOnly)(n,"dividing"),(0,d.useValueAndKey)(u,"floated"),(0,d.useKeyOnly)(T===!0,"icon"),(0,d.useKeyOnly)(O===!0,"image"),(0,d.useKeyOnly)(c,"inverted"),(0,d.useKeyOnly)(m,"sub"),(0,d.useTextAlignProp)(g),E,"header"),S=(0,d.getUnhandledProps)(o,e),M=(0,d.getElementType)(o,e);if(_)return p.default.createElement(M,l({},S,{className:w}),_);var x=y.default.create(T),N=h.default.create(O),A=b.default.create(j,{className:"sub header"});return x||N?p.default.createElement(M,l({},S,{className:w}),x||N,(r||A)&&p.default.createElement(P.default,null,r,A)):p.default.createElement(M,l({},S,{className:w}),r,A)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/without */7),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2),f=r(/*! ../../elements/Icon */8),y=n(f),m=r(/*! ../../elements/Image */30),h=n(m),v=r(/*! ./HeaderSubheader */166),b=n(v),g=r(/*! ./HeaderContent */165),P=n(g);o._meta={name:"Header",type:d.META.TYPES.ELEMENT,props:{attached:["top","bottom"],color:d.SUI.COLORS,size:(0,s.default)(d.SUI.SIZES,"big","massive"),floated:d.SUI.FLOATS,textAlign:d.SUI.TEXT_ALIGNMENTS}},o.propTypes={as:d.customPropTypes.as,className:c.PropTypes.string,children:c.PropTypes.node,content:d.customPropTypes.contentShorthand,icon:d.customPropTypes.every([d.customPropTypes.disallow(["image"]),c.PropTypes.oneOfType([c.PropTypes.bool,d.customPropTypes.itemShorthand])]),image:d.customPropTypes.every([d.customPropTypes.disallow(["icon"]),c.PropTypes.oneOfType([c.PropTypes.bool,d.customPropTypes.itemShorthand])]),color:c.PropTypes.oneOf(o._meta.props.color),dividing:c.PropTypes.bool,block:c.PropTypes.bool,attached:c.PropTypes.oneOfType([c.PropTypes.oneOf(o._meta.props.attached),c.PropTypes.bool]),floated:c.PropTypes.oneOf(o._meta.props.floated),inverted:c.PropTypes.bool,disabled:c.PropTypes.bool,sub:c.PropTypes.bool,size:c.PropTypes.oneOf(o._meta.props.size),subheader:d.customPropTypes.itemShorthand,textAlign:c.PropTypes.oneOf(o._meta.props.textAlign)},o.Content=P.default,o.Subheader=b.default,t.default=o},/*!**************************************!*\
!*** ./src/elements/Header/index.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Header */305),a=n(o);t.default=a.default},/*!*************************************!*\
!*** ./src/elements/Input/Input.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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)}Object.defineProperty(t,"__esModule",{value:!0}),t.htmlInputPropNames=void 0;var l=r(/*! lodash/includes */74),u=n(l),i=r(/*! lodash/pick */79),c=n(i),p=r(/*! lodash/omit */78),d=n(p),f=r(/*! lodash/get */34),y=n(f),m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},h=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),v=r(/*! react */1),b=n(v),g=r(/*! classnames */3),P=n(g),T=r(/*! ../../lib */2),O=r(/*! ../../elements/Button */84),_=n(O),E=r(/*! ../../elements/Icon */8),j=n(E),w=r(/*! ../../elements/Label */47),S=n(w),M=t.htmlInputPropNames=["selected","defaultValue","defaultChecked","autoComplete","autoFocus","checked","form","max","maxLength","min","name","pattern","placeholder","readOnly","required","step","type","value","onKeyDown","onKeyPress","onKeyUp","onFocus","onBlur","onChange","onInput","onClick","onContextMenu","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onSelect","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],x={name:"Input",type:T.META.TYPES.ELEMENT,props:{actionPosition:["left"],iconPosition:["left"],labelPosition:["left","right","left corner","right corner"],size:T.SUI.SIZES}},N=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.handleChange=function(e){var t=(0,y.default)(e,"target.value"),r=n.props.onChange;r&&r(e,m({},n.props,{value:t}))},s=r,a(n,s)}return s(t,e),h(t,[{key:"render",value:function(){var e=this.props,r=e.action,n=e.actionPosition,o=e.children,a=e.className,s=e.disabled,l=e.error,i=e.focus,p=e.fluid,f=e.icon,y=e.iconPosition,h=e.inverted,g=e.label,O=e.labelPosition,E=e.loading,w=e.onChange,x=e.size,N=e.type,A=e.input,C=e.transparent,k=(0,P.default)("ui",x,(0,T.useValueAndKey)(n,"action")||(0,T.useKeyOnly)(r,"action"),(0,T.useKeyOnly)(s,"disabled"),(0,T.useKeyOnly)(l,"error"),(0,T.useKeyOnly)(i,"focus"),(0,T.useKeyOnly)(p,"fluid"),(0,T.useKeyOnly)(h,"inverted"),(0,T.useValueAndKey)(O,"labeled")||(0,T.useKeyOnly)(g,"labeled"),(0,T.useKeyOnly)(E,"loading"),(0,T.useKeyOnly)(C,"transparent"),(0,T.useValueAndKey)(y,"icon")||(0,T.useKeyOnly)(f,"icon"),a,"input"),I=(0,T.getUnhandledProps)(t,this.props),K=(0,d.default)(I,M),L=(0,c.default)(this.props,M);w&&(L.onChange=this.handleChange);var U=(0,T.getElementType)(t,this.props);if(o){var D=v.Children.map(o,function(e){return"input"!==e.type?e:(0,v.cloneElement)(e,m({},L,e.props))});return b.default.createElement(U,m({},K,{className:k}),D)}var R=_.default.create(r,function(e){return{className:(0,P.default)(!(0,u.default)(e.className,"button")&&"button")}}),z=j.default.create(f),W=S.default.create(g,function(e){return{className:(0,P.default)(!(0,u.default)(e.className,"label")&&"label",(0,u.default)(O,"corner")&&O)}});return b.default.createElement(U,m({},K,{className:k}),"left"===n&&R,"left"===y&&z,"right"!==O&&W,(0,T.createHTMLInput)(A||N,L),"left"!==n&&R,"left"!==y&&z,"right"===O&&W)}}]),t}(v.Component);N.propTypes={as:T.customPropTypes.as,action:v.PropTypes.oneOfType([v.PropTypes.bool,T.customPropTypes.itemShorthand]),actionPosition:v.PropTypes.oneOf(x.props.actionPosition),children:v.PropTypes.node,className:v.PropTypes.string,disabled:v.PropTypes.bool,error:v.PropTypes.bool,focus:v.PropTypes.bool,fluid:v.PropTypes.bool,icon:v.PropTypes.oneOfType([v.PropTypes.bool,T.customPropTypes.itemShorthand]),iconPosition:v.PropTypes.oneOf(x.props.iconPosition),inverted:v.PropTypes.bool,input:T.customPropTypes.itemShorthand,label:T.customPropTypes.itemShorthand,labelPosition:v.PropTypes.oneOf(x.props.labelPosition),loading:v.PropTypes.bool,onChange:v.PropTypes.func,size:v.PropTypes.oneOf(x.props.size),transparent:v.PropTypes.bool,type:v.PropTypes.string},N.defaultProps={type:"text"},N._meta=x,t.default=N},/*!***********************************!*\
!*** ./src/elements/List/List.js ***!
\***********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.animated,r=e.bulleted,n=e.celled,a=e.children,u=e.className,c=e.divided,f=e.floated,y=e.horizontal,m=e.inverted,h=e.items,v=e.link,b=e.ordered,g=e.relaxed,P=e.size,T=e.selection,_=e.verticalAlign,E=(0,i.default)("ui",P,(0,d.useKeyOnly)(t,"animated"),(0,d.useKeyOnly)(r,"bulleted"),(0,d.useKeyOnly)(n,"celled"),(0,d.useKeyOnly)(c,"divided"),(0,d.useKeyOnly)(y,"horizontal"),(0,d.useKeyOnly)(m,"inverted"),(0,d.useKeyOnly)(v,"link"),(0,d.useKeyOnly)(b,"ordered"),(0,d.useKeyOnly)(T,"selection"),(0,d.useKeyOrValueAndKey)(g,"relaxed"),(0,d.useValueAndKey)(f,"floated"),(0,d.useVerticalAlignProp)(_),"list",u),j=(0,d.getUnhandledProps)(o,e),w=(0,d.getElementType)(o,e);return a?p.default.createElement(w,l({},j,{className:E}),a):p.default.createElement(w,l({},j,{className:E}),(0,s.default)(h,function(e){return O.default.create(e)}))}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/map */9),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2),f=r(/*! ./ListContent */87),y=n(f),m=r(/*! ./ListDescription */48),h=n(m),v=r(/*! ./ListHeader */49),b=n(v),g=r(/*! ./ListIcon */88),P=n(g),T=r(/*! ./ListItem */172),O=n(T),_=r(/*! ./ListList */173),E=n(_);o._meta={name:"List",type:d.META.TYPES.ELEMENT,props:{floated:d.SUI.FLOATS,relaxed:["very"],size:d.SUI.SIZES,verticalAlign:d.SUI.VERTICAL_ALIGNMENTS}},o.propTypes={as:d.customPropTypes.as,animated:c.PropTypes.bool,bulleted:c.PropTypes.bool,celled:c.PropTypes.bool,children:c.PropTypes.node,className:c.PropTypes.string,divided:c.PropTypes.bool,floated:c.PropTypes.oneOf(o._meta.props.floated),horizontal:c.PropTypes.bool,inverted:c.PropTypes.bool,items:d.customPropTypes.collectionShorthand,link:c.PropTypes.bool,ordered:c.PropTypes.bool,relaxed:c.PropTypes.oneOfType([c.PropTypes.bool,c.PropTypes.oneOf(o._meta.props.relaxed)]),selection:c.PropTypes.bool,size:c.PropTypes.oneOf(o._meta.props.size),verticalAlign:c.PropTypes.oneOf(o._meta.props.verticalAlign)},o.Content=y.default,o.Description=h.default,o.Header=b.default,o.Icon=P.default,o.Item=O.default,o.List=E.default,t.default=o},/*!************************************!*\
!*** ./src/elements/List/index.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./List */308),a=n(o);t.default=a.default},/*!***************************************!*\
!*** ./src/elements/Loader/Loader.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.active,r=e.children,n=e.className,s=e.content,u=e.disabled,p=e.indeterminate,d=e.inline,f=e.inverted,y=e.size,m=(0,l.default)("ui",y,(0,c.useKeyOnly)(t,"active"),(0,c.useKeyOnly)(u,"disabled"),(0,c.useKeyOnly)(p,"indeterminate"),(0,c.useKeyOnly)(f,"inverted"),(0,c.useKeyOnly)(r||s,"text"),(0,c.useKeyOrValueAndKey)(d,"inline"),"loader",n),h=(0,c.getUnhandledProps)(o,e),v=(0,c.getElementType)(o,e);return i.default.createElement(v,a({},h,{className:m}),r||s)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"Loader",type:c.META.TYPES.ELEMENT,props:{inline:["centered"],size:c.SUI.SIZES}},o.propTypes={as:c.customPropTypes.as,active:u.PropTypes.bool,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand,disabled:u.PropTypes.bool,indeterminate:u.PropTypes.bool,inline:u.PropTypes.oneOfType([u.PropTypes.bool,u.PropTypes.oneOf(o._meta.props.inline)]),inverted:u.PropTypes.bool,size:u.PropTypes.oneOf(o._meta.props.size)},t.default=o},/*!**************************************!*\
!*** ./src/elements/Loader/index.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Loader */310),a=n(o);t.default=a.default},/*!***********************************!*\
!*** ./src/elements/Rail/Rail.js ***!
\***********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.attached,r=e.children,n=e.className,a=e.close,s=e.dividing,u=e.internal,c=e.position,f=e.size,y=(0,i.default)("ui",c,f,(0,d.useKeyOnly)(t,"attached"),(0,d.useKeyOnly)(s,"dividing"),(0,d.useKeyOnly)(u,"internal"),(0,d.useKeyOrValueAndKey)(a,"close"),"rail",n),m=(0,d.getUnhandledProps)(o,e),h=(0,d.getElementType)(o,e);return p.default.createElement(h,l({},m,{className:y}),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/without */7),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2);o._meta={name:"Rail",type:d.META.TYPES.ELEMENT,props:{close:["very"],position:d.SUI.FLOATS,size:(0,s.default)(d.SUI.SIZES,"medium")}},o.propTypes={as:d.customPropTypes.as,attached:c.PropTypes.bool,children:c.PropTypes.node,className:c.PropTypes.string,close:c.PropTypes.oneOfType([c.PropTypes.bool,c.PropTypes.oneOf(o._meta.props.close)]),dividing:c.PropTypes.bool,internal:c.PropTypes.bool,position:c.PropTypes.oneOf(o._meta.props.position).isRequired,size:c.PropTypes.oneOf(o._meta.props.size)},t.default=o},/*!************************************!*\
!*** ./src/elements/Rail/index.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Rail */312),a=n(o);t.default=a.default},/*!***************************************!*\
!*** ./src/elements/Reveal/Reveal.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.active,r=e.animated,n=e.children,s=e.className,u=e.disabled,p=e.instant,d=(0,l.default)("ui",r,(0,c.useKeyOnly)(t,"active"),(0,c.useKeyOnly)(u,"disabled"),(0,c.useKeyOnly)(p,"instant"),"reveal",s),f=(0,c.getUnhandledProps)(o,e),y=(0,c.getElementType)(o,e);return i.default.createElement(y,a({},f,{className:d}),n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ./RevealContent */174),d=n(p);o._meta={name:"Reveal",type:c.META.TYPES.ELEMENT,props:{animated:["fade","small fade","move","move right","move up","move down","rotate","rotate left"]}},o.propTypes={as:c.customPropTypes.as,active:u.PropTypes.bool,children:u.PropTypes.node,className:u.PropTypes.string,disabled:u.PropTypes.bool,animated:u.PropTypes.oneOf(o._meta.props.animated),instant:u.PropTypes.bool},o.Content=d.default,t.default=o},/*!**************************************!*\
!*** ./src/elements/Reveal/index.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Reveal */314),a=n(o);t.default=a.default},/*!*****************************************!*\
!*** ./src/elements/Segment/Segment.js ***!
\*****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.attached,r=e.basic,n=e.children,a=e.circular,s=e.className,u=e.clearing,c=e.color,f=e.compact,y=e.disabled,m=e.floated,h=e.inverted,v=e.loading,b=e.padded,g=e.piled,P=e.raised,T=e.secondary,O=e.size,_=e.stacked,E=e.tertiary,j=e.textAlign,w=e.vertical,S=(0,i.default)("ui",c,O,(0,d.useKeyOrValueAndKey)(t,"attached"),(0,d.useKeyOnly)(r,"basic"),(0,d.useKeyOnly)(a,"circular"),(0,d.useKeyOnly)(u,"clearing"),(0,d.useKeyOnly)(f,"compact"),(0,d.useKeyOnly)(y,"disabled"),(0,d.useValueAndKey)(m,"floated"),(0,d.useKeyOnly)(h,"inverted"),(0,d.useKeyOnly)(v,"loading"),(0,d.useKeyOrValueAndKey)(b,"padded"),(0,d.useKeyOnly)(g,"piled"),(0,d.useKeyOnly)(P,"raised"),(0,d.useKeyOnly)(T,"secondary"),(0,d.useKeyOnly)(_,"stacked"),(0,d.useKeyOnly)(E,"tertiary"),(0,d.useTextAlignProp)(j),(0,d.useKeyOnly)(w,"vertical"),s,"segment"),M=(0,d.getUnhandledProps)(o,e),x=(0,d.getElementType)(o,e);return p.default.createElement(x,l({},M,{className:S}),n)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/without */7),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2),f=r(/*! ./SegmentGroup */175),y=n(f);o.Group=y.default,o._meta={name:"Segment",type:d.META.TYPES.ELEMENT,props:{attached:["top","bottom"],color:d.SUI.COLORS,floated:d.SUI.FLOATS,padded:["very"],size:(0,s.default)(d.SUI.SIZES,"medium"),textAlign:d.SUI.TEXT_ALIGNMENTS}},o.propTypes={as:d.customPropTypes.as,attached:c.PropTypes.oneOfType([c.PropTypes.oneOf(o._meta.props.attached),c.PropTypes.bool]),basic:c.PropTypes.bool,children:c.PropTypes.node,circular:c.PropTypes.bool,className:c.PropTypes.string,clearing:c.PropTypes.bool,color:c.PropTypes.oneOf(o._meta.props.color),compact:c.PropTypes.bool,disabled:c.PropTypes.bool,floated:c.PropTypes.oneOf(o._meta.props.floated),inverted:c.PropTypes.bool,loading:c.PropTypes.bool,padded:c.PropTypes.oneOfType([c.PropTypes.bool,c.PropTypes.oneOf(o._meta.props.padded)]),piled:c.PropTypes.bool,raised:c.PropTypes.bool,secondary:c.PropTypes.bool,size:c.PropTypes.oneOf(o._meta.props.size),stacked:c.PropTypes.bool,tertiary:c.PropTypes.bool,textAlign:c.PropTypes.oneOf(o._meta.props.textAlign),vertical:c.PropTypes.bool},t.default=o},/*!***************************************!*\
!*** ./src/elements/Segment/index.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Segment */316),a=n(o);t.default=a.default},/*!************************************!*\
!*** ./src/elements/Step/index.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Step */176),a=n(o);t.default=a.default},/*!**********************!*\
!*** ./src/index.js ***!
\**********************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(/*! ./addons/Confirm */283);Object.defineProperty(t,"Confirm",{enumerable:!0,get:function(){return n(o).default}});var a=r(/*! ./addons/Portal */44);Object.defineProperty(t,"Portal",{enumerable:!0,get:function(){return n(a).default}});var s=r(/*! ./addons/Radio */81);Object.defineProperty(t,"Radio",{enumerable:!0,get:function(){return n(s).default}});var l=r(/*! ./addons/Select */136);Object.defineProperty(t,"Select",{enumerable:!0,get:function(){return n(l).default}});var u=r(/*! ./addons/TextArea */137);Object.defineProperty(t,"TextArea",{enumerable:!0,get:function(){return n(u).default}});var i=r(/*! ./collections/Breadcrumb */289);Object.defineProperty(t,"Breadcrumb",{enumerable:!0,get:function(){return n(i).default}});var c=r(/*! ./collections/Breadcrumb/BreadcrumbDivider */138);Object.defineProperty(t,"BreadcrumbDivider",{enumerable:!0,get:function(){return n(c).default}});var p=r(/*! ./collections/Breadcrumb/BreadcrumbSection */139);Object.defineProperty(t,"BreadcrumbSection",{enumerable:!0,get:function(){return n(p).default}});var d=r(/*! ./collections/Form */291);Object.defineProperty(t,"Form",{enumerable:!0,get:function(){return n(d).default}});var f=r(/*! ./collections/Form/FormButton */140);Object.defineProperty(t,"FormButton",{enumerable:!0,get:function(){return n(f).default}});var y=r(/*! ./collections/Form/FormCheckbox */141);Object.defineProperty(t,"FormCheckbox",{enumerable:!0,get:function(){return n(y).default}});var m=r(/*! ./collections/Form/FormDropdown */142);Object.defineProperty(t,"FormDropdown",{enumerable:!0,get:function(){return n(m).default}});var h=r(/*! ./collections/Form/FormField */16);Object.defineProperty(t,"FormField",{enumerable:!0,get:function(){return n(h).default}});var v=r(/*! ./collections/Form/FormGroup */143);Object.defineProperty(t,"FormGroup",{enumerable:!0,get:function(){return n(v).default}});var b=r(/*! ./collections/Form/FormInput */144);Object.defineProperty(t,"FormInput",{enumerable:!0,get:function(){return n(b).default}});var g=r(/*! ./collections/Form/FormRadio */145);Object.defineProperty(t,"FormRadio",{enumerable:!0,get:function(){return n(g).default}});var P=r(/*! ./collections/Form/FormSelect */146);Object.defineProperty(t,"FormSelect",{enumerable:!0,get:function(){return n(P).default}});var T=r(/*! ./collections/Form/FormTextArea */147);Object.defineProperty(t,"FormTextArea",{enumerable:!0,get:function(){return n(T).default}});var O=r(/*! ./collections/Grid */293);Object.defineProperty(t,"Grid",{enumerable:!0,get:function(){return n(O).default}});var _=r(/*! ./collections/Grid/GridColumn */148);Object.defineProperty(t,"GridColumn",{enumerable:!0,get:function(){return n(_).default}});var E=r(/*! ./collections/Grid/GridRow */149);Object.defineProperty(t,"GridRow",{enumerable:!0,get:function(){return n(E).default}});var j=r(/*! ./collections/Menu */295);Object.defineProperty(t,"Menu",{enumerable:!0,get:function(){return n(j).default}});var w=r(/*! ./collections/Menu/MenuHeader */150);Object.defineProperty(t,"MenuHeader",{enumerable:!0,get:function(){return n(w).default}});var S=r(/*! ./collections/Menu/MenuItem */151);Object.defineProperty(t,"MenuItem",{enumerable:!0,get:function(){return n(S).default}});var M=r(/*! ./collections/Menu/MenuMenu */152);Object.defineProperty(t,"MenuMenu",{enumerable:!0,get:function(){return n(M).default}});var x=r(/*! ./collections/Message */297);Object.defineProperty(t,"Message",{enumerable:!0,get:function(){return n(x).default}});var N=r(/*! ./collections/Message/MessageContent */153);Object.defineProperty(t,"MessageContent",{enumerable:!0,get:function(){return n(N).default}});var A=r(/*! ./collections/Message/MessageHeader */154);Object.defineProperty(t,"MessageHeader",{enumerable:!0,get:function(){return n(A).default}});var C=r(/*! ./collections/Message/MessageItem */82);Object.defineProperty(t,"MessageItem",{enumerable:!0,get:function(){return n(C).default}});var k=r(/*! ./collections/Message/MessageList */155);Object.defineProperty(t,"MessageList",{enumerable:!0,get:function(){return n(k).default}});var I=r(/*! ./collections/Table */299);Object.defineProperty(t,"Table",{enumerable:!0,get:function(){return n(I).default}});var K=r(/*! ./collections/Table/TableBody */156);Object.defineProperty(t,"TableBody",{enumerable:!0,get:function(){return n(K).default}});var L=r(/*! ./collections/Table/TableCell */45);Object.defineProperty(t,"TableCell",{enumerable:!0,get:function(){return n(L).default}});var U=r(/*! ./collections/Table/TableFooter */157);Object.defineProperty(t,"TableFooter",{enumerable:!0,get:function(){return n(U).default}});var D=r(/*! ./collections/Table/TableHeader */83);Object.defineProperty(t,"TableHeader",{enumerable:!0,get:function(){return n(D).default}});var R=r(/*! ./collections/Table/TableHeaderCell */158);Object.defineProperty(t,"TableHeaderCell",{enumerable:!0,get:function(){return n(R).default}});var z=r(/*! ./collections/Table/TableRow */159);Object.defineProperty(t,"TableRow",{enumerable:!0,get:function(){return n(z).default}});var W=r(/*! ./elements/Button/Button */160);Object.defineProperty(t,"Button",{enumerable:!0,get:function(){return n(W).default}});var F=r(/*! ./elements/Button/ButtonContent */161);Object.defineProperty(t,"ButtonContent",{enumerable:!0,get:function(){return n(F).default}});var V=r(/*! ./elements/Button/ButtonGroup */162);Object.defineProperty(t,"ButtonGroup",{enumerable:!0,get:function(){return n(V).default}});var B=r(/*! ./elements/Button/ButtonOr */163);Object.defineProperty(t,"ButtonOr",{enumerable:!0,get:function(){return n(B).default}});var Y=r(/*! ./elements/Container */301);Object.defineProperty(t,"Container",{enumerable:!0,get:function(){return n(Y).default}});var q=r(/*! ./elements/Divider */303);Object.defineProperty(t,"Divider",{enumerable:!0,get:function(){return n(q).default}});var H=r(/*! ./elements/Flag */164);Object.defineProperty(t,"Flag",{enumerable:!0,get:function(){return n(H).default}});var G=r(/*! ./elements/Header */306);Object.defineProperty(t,"Header",{enumerable:!0,get:function(){return n(G).default}});var Z=r(/*! ./elements/Header/HeaderContent */165);Object.defineProperty(t,"HeaderContent",{enumerable:!0,get:function(){return n(Z).default}});var $=r(/*! ./elements/Header/HeaderSubheader */166);Object.defineProperty(t,"HeaderSubheader",{enumerable:!0,get:function(){return n($).default}});var X=r(/*! ./elements/Icon */8);Object.defineProperty(t,"Icon",{enumerable:!0,get:function(){return n(X).default}});var J=r(/*! ./elements/Icon/IconGroup */167);Object.defineProperty(t,"IconGroup",{enumerable:!0,get:function(){return n(J).default}});var Q=r(/*! ./elements/Image */30);Object.defineProperty(t,"Image",{enumerable:!0,get:function(){return n(Q).default}});var ee=r(/*! ./elements/Image/ImageGroup */169);Object.defineProperty(t,"ImageGroup",{enumerable:!0,get:function(){return n(ee).default}});var te=r(/*! ./elements/Input */85);Object.defineProperty(t,"Input",{enumerable:!0,get:function(){return n(te).default}});var re=r(/*! ./elements/Label */47);Object.defineProperty(t,"Label",{enumerable:!0,get:function(){return n(re).default}});var ne=r(/*! ./elements/Label/LabelDetail */170);Object.defineProperty(t,"LabelDetail",{enumerable:!0,get:function(){return n(ne).default}});var oe=r(/*! ./elements/Label/LabelGroup */171);Object.defineProperty(t,"LabelGroup",{enumerable:!0,get:function(){return n(oe).default}});var ae=r(/*! ./elements/List */309);Object.defineProperty(t,"List",{enumerable:!0,get:function(){return n(ae).default}});var se=r(/*! ./elements/List/ListContent */87);Object.defineProperty(t,"ListContent",{enumerable:!0,get:function(){return n(se).default}});var le=r(/*! ./elements/List/ListDescription */48);Object.defineProperty(t,"ListDescription",{enumerable:!0,get:function(){return n(le).default}});var ue=r(/*! ./elements/List/ListHeader */49);Object.defineProperty(t,"ListHeader",{enumerable:!0,get:function(){return n(ue).default}});var ie=r(/*! ./elements/List/ListIcon */88);Object.defineProperty(t,"ListIcon",{enumerable:!0,get:function(){return n(ie).default}});var ce=r(/*! ./elements/List/ListItem */172);Object.defineProperty(t,"ListItem",{enumerable:!0,get:function(){return n(ce).default}});var pe=r(/*! ./elements/List/ListList */173);Object.defineProperty(t,"ListList",{enumerable:!0,get:function(){return n(pe).default}});var de=r(/*! ./elements/Loader */311);Object.defineProperty(t,"Loader",{enumerable:!0,get:function(){return n(de).default}});var fe=r(/*! ./elements/Rail */313);Object.defineProperty(t,"Rail",{enumerable:!0,get:function(){return n(fe).default}});var ye=r(/*! ./elements/Reveal */315);Object.defineProperty(t,"Reveal",{enumerable:!0,get:function(){return n(ye).default}});var me=r(/*! ./elements/Reveal/RevealContent */174);Object.defineProperty(t,"RevealContent",{enumerable:!0,get:function(){return n(me).default}});var he=r(/*! ./elements/Segment */317);Object.defineProperty(t,"Segment",{enumerable:!0,get:function(){return n(he).default}});var ve=r(/*! ./elements/Segment/SegmentGroup */175);Object.defineProperty(t,"SegmentGroup",{enumerable:!0,get:function(){return n(ve).default}});var be=r(/*! ./elements/Step */318);Object.defineProperty(t,"Step",{enumerable:!0,get:function(){return n(be).default}});var ge=r(/*! ./elements/Step/StepContent */177);Object.defineProperty(t,"StepContent",{enumerable:!0,get:function(){return n(ge).default}});var Pe=r(/*! ./elements/Step/StepDescription */89);Object.defineProperty(t,"StepDescription",{enumerable:!0,get:function(){return n(Pe).default}});var Te=r(/*! ./elements/Step/StepGroup */178);Object.defineProperty(t,"StepGroup",{enumerable:!0,get:function(){return n(Te).default}});var Oe=r(/*! ./elements/Step/StepTitle */90);Object.defineProperty(t,"StepTitle",{enumerable:!0,get:function(){return n(Oe).default}});var _e=r(/*! ./modules/Accordion/Accordion */332);Object.defineProperty(t,"Accordion",{enumerable:!0,get:function(){return n(_e).default}});var Ee=r(/*! ./modules/Accordion/AccordionContent */181);Object.defineProperty(t,"AccordionContent",{enumerable:!0,get:function(){return n(Ee).default}});var je=r(/*! ./modules/Accordion/AccordionTitle */182);Object.defineProperty(t,"AccordionTitle",{enumerable:!0,get:function(){return n(je).default}});var we=r(/*! ./modules/Checkbox */50);Object.defineProperty(t,"Checkbox",{enumerable:!0,get:function(){return n(we).default}});var Se=r(/*! ./modules/Dimmer */184);Object.defineProperty(t,"Dimmer",{enumerable:!0,get:function(){return n(Se).default}});var Me=r(/*! ./modules/Dimmer/DimmerDimmable */183);Object.defineProperty(t,"DimmerDimmable",{enumerable:!0,get:function(){return n(Me).default}});var xe=r(/*! ./modules/Dropdown */92);Object.defineProperty(t,"Dropdown",{enumerable:!0,get:function(){return n(xe).default}});var Ne=r(/*! ./modules/Dropdown/DropdownDivider */185);Object.defineProperty(t,"DropdownDivider",{enumerable:!0,get:function(){return n(Ne).default}});var Ae=r(/*! ./modules/Dropdown/DropdownHeader */186);Object.defineProperty(t,"DropdownHeader",{enumerable:!0,get:function(){return n(Ae).default}});var Ce=r(/*! ./modules/Dropdown/DropdownItem */187);Object.defineProperty(t,"DropdownItem",{enumerable:!0,get:function(){return n(Ce).default}});var ke=r(/*! ./modules/Dropdown/DropdownMenu */188);Object.defineProperty(t,"DropdownMenu",{enumerable:!0,get:function(){return n(ke).default}});var Ie=r(/*! ./modules/Embed */337);Object.defineProperty(t,"Embed",{enumerable:!0,get:function(){return n(Ie).default}});var Ke=r(/*! ./modules/Modal */193);Object.defineProperty(t,"Modal",{enumerable:!0,get:function(){return n(Ke).default}});var Le=r(/*! ./modules/Modal/ModalActions */189);Object.defineProperty(t,"ModalActions",{enumerable:!0,get:function(){return n(Le).default}});var Ue=r(/*! ./modules/Modal/ModalContent */190);Object.defineProperty(t,"ModalContent",{enumerable:!0,get:function(){return n(Ue).default}});var De=r(/*! ./modules/Modal/ModalDescription */191);Object.defineProperty(t,"ModalDescription",{enumerable:!0,get:function(){return n(De).default}});var Re=r(/*! ./modules/Modal/ModalHeader */192);Object.defineProperty(t,"ModalHeader",{enumerable:!0,get:function(){return n(Re).default}});var ze=r(/*! ./modules/Popup */340);Object.defineProperty(t,"Popup",{enumerable:!0,get:function(){return n(ze).default}});var We=r(/*! ./modules/Popup/PopupContent */194);Object.defineProperty(t,"PopupContent",{enumerable:!0,get:function(){return n(We).default}});var Fe=r(/*! ./modules/Popup/PopupHeader */195);Object.defineProperty(t,"PopupHeader",{enumerable:!0,get:function(){return n(Fe).default}});var Ve=r(/*! ./modules/Progress */342);Object.defineProperty(t,"Progress",{enumerable:!0,get:function(){return n(Ve).default}});var Be=r(/*! ./modules/Rating */344);Object.defineProperty(t,"Rating",{enumerable:!0,get:function(){return n(Be).default}});var Ye=r(/*! ./modules/Rating/RatingIcon */196);Object.defineProperty(t,"RatingIcon",{enumerable:!0,get:function(){return n(Ye).default}});var qe=r(/*! ./modules/Search */346);Object.defineProperty(t,"Search",{enumerable:!0,get:function(){return n(qe).default}});var He=r(/*! ./modules/Search/SearchCategory */197);Object.defineProperty(t,"SearchCategory",{enumerable:!0,get:function(){return n(He).default}});var Ge=r(/*! ./modules/Search/SearchResult */198);Object.defineProperty(t,"SearchResult",{enumerable:!0,get:function(){return n(Ge).default}});var Ze=r(/*! ./modules/Search/SearchResults */199);Object.defineProperty(t,"SearchResults",{enumerable:!0,get:function(){return n(Ze).default}});var $e=r(/*! ./modules/Sidebar */348);Object.defineProperty(t,"Sidebar",{enumerable:!0,get:function(){return n($e).default}});var Xe=r(/*! ./modules/Sidebar/SidebarPushable */200);Object.defineProperty(t,"SidebarPushable",{enumerable:!0,get:function(){return n(Xe).default}});var Je=r(/*! ./modules/Sidebar/SidebarPusher */201);Object.defineProperty(t,"SidebarPusher",{enumerable:!0,get:function(){return n(Je).default}});var Qe=r(/*! ./views/Card/Card */202);Object.defineProperty(t,"Card",{enumerable:!0,get:function(){return n(Qe).default}});var et=r(/*! ./views/Card/CardContent */203);Object.defineProperty(t,"CardContent",{enumerable:!0,get:function(){return n(et).default}});var tt=r(/*! ./views/Card/CardDescription */93);Object.defineProperty(t,"CardDescription",{enumerable:!0,get:function(){return n(tt).default}});var rt=r(/*! ./views/Card/CardGroup */204);Object.defineProperty(t,"CardGroup",{enumerable:!0,get:function(){return n(rt).default}});var nt=r(/*! ./views/Card/CardHeader */94);Object.defineProperty(t,"CardHeader",{enumerable:!0,get:function(){return n(nt).default}});var ot=r(/*! ./views/Card/CardMeta */95);Object.defineProperty(t,"CardMeta",{enumerable:!0,get:function(){return n(ot).default}});var at=r(/*! ./views/Comment */350);Object.defineProperty(t,"Comment",{enumerable:!0,get:function(){return n(at).default}});var st=r(/*! ./views/Comment/CommentAction */205);Object.defineProperty(t,"CommentAction",{enumerable:!0,get:function(){return n(st).default}});var lt=r(/*! ./views/Comment/CommentActions */206);Object.defineProperty(t,"CommentActions",{enumerable:!0,get:function(){return n(lt).default}});var ut=r(/*! ./views/Comment/CommentAuthor */207);Object.defineProperty(t,"CommentAuthor",{enumerable:!0,get:function(){return n(ut).default}});var it=r(/*! ./views/Comment/CommentAvatar */208);Object.defineProperty(t,"CommentAvatar",{enumerable:!0,get:function(){return n(it).default}});var ct=r(/*! ./views/Comment/CommentContent */209);Object.defineProperty(t,"CommentContent",{enumerable:!0,get:function(){return n(ct).default}});var pt=r(/*! ./views/Comment/CommentGroup */210);Object.defineProperty(t,"CommentGroup",{enumerable:!0,get:function(){return n(pt).default}});var dt=r(/*! ./views/Comment/CommentMetadata */211);Object.defineProperty(t,"CommentMetadata",{enumerable:!0,get:function(){return n(dt).default}});var ft=r(/*! ./views/Comment/CommentText */212);Object.defineProperty(t,"CommentText",{enumerable:!0,get:function(){return n(ft).default}});var yt=r(/*! ./views/Feed */352);Object.defineProperty(t,"Feed",{enumerable:!0,get:function(){return n(yt).default}});var mt=r(/*! ./views/Feed/FeedContent */96);Object.defineProperty(t,"FeedContent",{enumerable:!0,get:function(){return n(mt).default}});var ht=r(/*! ./views/Feed/FeedDate */51);Object.defineProperty(t,"FeedDate",{enumerable:!0,get:function(){return n(ht).default}});var vt=r(/*! ./views/Feed/FeedEvent */213);Object.defineProperty(t,"FeedEvent",{enumerable:!0,get:function(){return n(vt).default}});var bt=r(/*! ./views/Feed/FeedExtra */97);Object.defineProperty(t,"FeedExtra",{enumerable:!0,get:function(){return n(bt).default}});var gt=r(/*! ./views/Feed/FeedLabel */98);Object.defineProperty(t,"FeedLabel",{enumerable:!0,get:function(){return n(gt).default}});var Pt=r(/*! ./views/Feed/FeedLike */99);Object.defineProperty(t,"FeedLike",{enumerable:!0,get:function(){return n(Pt).default}});var Tt=r(/*! ./views/Feed/FeedMeta */100);Object.defineProperty(t,"FeedMeta",{enumerable:!0,get:function(){return n(Tt).default}});var Ot=r(/*! ./views/Feed/FeedSummary */101);Object.defineProperty(t,"FeedSummary",{enumerable:!0,get:function(){return n(Ot).default}});var _t=r(/*! ./views/Feed/FeedUser */102);Object.defineProperty(t,"FeedUser",{enumerable:!0,get:function(){return n(_t).default}});var Et=r(/*! ./views/Item */353);Object.defineProperty(t,"Item",{enumerable:!0,get:function(){return n(Et).default}});var jt=r(/*! ./views/Item/ItemContent */215);Object.defineProperty(t,"ItemContent",{enumerable:!0,get:function(){return n(jt).default}});var wt=r(/*! ./views/Item/ItemDescription */103);Object.defineProperty(t,"ItemDescription",{enumerable:!0,get:function(){return n(wt).default}});var St=r(/*! ./views/Item/ItemExtra */104);Object.defineProperty(t,"ItemExtra",{enumerable:!0,get:function(){return n(St).default}});var Mt=r(/*! ./views/Item/ItemGroup */216);Object.defineProperty(t,"ItemGroup",{enumerable:!0,get:function(){return n(Mt).default}});var xt=r(/*! ./views/Item/ItemHeader */105);Object.defineProperty(t,"ItemHeader",{enumerable:!0,get:function(){return n(xt).default}});var Nt=r(/*! ./views/Item/ItemImage */217);Object.defineProperty(t,"ItemImage",{enumerable:!0,get:function(){return n(Nt).default}});var At=r(/*! ./views/Item/ItemMeta */106);Object.defineProperty(t,"ItemMeta",{enumerable:!0,get:function(){return n(At).default}});var Ct=r(/*! ./views/Statistic */354);Object.defineProperty(t,"Statistic",{enumerable:!0,get:function(){return n(Ct).default}});var kt=r(/*! ./views/Statistic/StatisticGroup */219);Object.defineProperty(t,"StatisticGroup",{enumerable:!0,get:function(){return n(kt).default}});var It=r(/*! ./views/Statistic/StatisticLabel */220);Object.defineProperty(t,"StatisticLabel",{enumerable:!0,get:function(){return n(It).default}});var Kt=r(/*! ./views/Statistic/StatisticValue */221);Object.defineProperty(t,"StatisticValue",{enumerable:!0,get:function(){return n(Kt).default}})},/*!********************************************!*\
!*** ./src/lib/AutoControlledComponent.js ***!
\********************************************/
function(e,t,r){(function(e){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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)}Object.defineProperty(t,"__esModule",{value:!0}),t.getAutoControlledStateValue=void 0;var l=r(/*! lodash/difference */486),u=n(l),i=r(/*! lodash/isUndefined */133),c=n(i),p=r(/*! lodash/startsWith */278),d=n(p),f=r(/*! lodash/filter */127),y=n(f),m=r(/*! lodash/isEmpty */129),h=n(m),v=r(/*! lodash/keys */10),b=n(v),g=r(/*! lodash/intersection */514),P=n(g),T=r(/*! lodash/has */27),O=n(T),_=r(/*! lodash/each */73),E=n(_),j=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},w=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),S=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var s=o.get;if(void 0!==s)return s.call(n)},M=r(/*! react */1),x=function(e){return"default"+(e[0].toUpperCase()+e.slice(1))},N=t.getAutoControlledStateValue=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=x(t),o=e[t],a=e[n],s=void 0!==o,l=void 0!==a;return r&&!s&&l?a:s?o:"checked"!==t&&("value"===t?e.multiple?[]:"":void 0)},A=function(t){function r(){var t,n,s,l;o(this,r);for(var i=arguments.length,c=Array(i),p=0;p<i;p++)c[p]=arguments[p];return n=s=a(this,(t=r.__proto__||Object.getPrototypeOf(r)).call.apply(t,[this].concat(c))),s.trySetState=function(t,r){var n=s.constructor.autoControlledProps;if("production"!==e.env.NODE_ENV){var o=s.constructor.name,a=(0,u.default)((0,b.default)(t),n);(0,h.default)(a)||console.error([o+' called trySetState() with controlled props: "'+a+'".',"State will not be set.","Only props in static autoControlledProps will be set on state."].join(" "))}var l=Object.keys(t).reduce(function(e,r){return void 0!==s.props[r]?e:n.indexOf(r)===-1?e:(e[r]=t[r],e)},{});r&&(l=j({},l,r)),Object.keys(l).length>0&&s.setState(l)},l=n,a(s,l)}return s(r,t),w(r,[{key:"componentWillMount",value:function(){var t=this;S(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"componentWillMount",this)&&S(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"componentWillMount",this).call(this);var n=this.constructor.autoControlledProps;"production"!==e.env.NODE_ENV&&!function(){var e=t.constructor,r=e.defaultProps,o=e.name,a=e.propTypes;n||console.error("Auto controlled "+o+" must specify a static autoControlledProps array."),(0,E.default)(n,function(e){var t=x(e);(0,O.default)(a,t)||console.error(o+' is missing "'+t+'" propTypes validation for auto controlled prop "'+e+'".'),(0,O.default)(a,e)||console.error(o+' is missing propTypes validation for auto controlled prop "'+e+'".')});var s=(0,P.default)(n,(0,b.default)(r));(0,h.default)(s)||console.error(["Do not set defaultProps for autoControlledProps,","use trySetState() in constructor() or componentWillMount() instead.","See "+o+' props: "'+s+'".'].join(" "));var l=(0,y.default)(n,function(e){return(0,d.default)(e,"default")});(0,h.default)(l)||console.error(["Do not add default props to autoControlledProps.","Default props are automatically handled.","See "+o+' autoControlledProps: "'+l+'".'].join(" "))}(),this.state=n.reduce(function(r,n){if(r[n]=N(t.props,n,!0),"production"!==e.env.NODE_ENV){var o=x(n),a=t.constructor.name;o in t.props&&n in t.props&&console.error(a+' prop "'+n+'" is auto controlled. Specify either '+o+" or "+n+", but not both.")}return r},{})}},{key:"componentWillReceiveProps",value:function(e){var t=this;S(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"componentWillReceiveProps",this)&&S(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"componentWillReceiveProps",this).call(this,e);var n=this.constructor.autoControlledProps,o=n.reduce(function(r,n){var o=(0,c.default)(e[n]),a=!(0,c.default)(t.props[n])&&o;return o?a&&(r[n]=N(e,n)):r[n]=e[n],r},{});Object.keys(o).length>0&&this.setState(o)}}]),r}(M.Component);t.default=A}).call(t,r(/*! ./~/process/browser.js */35))},/*!*************************!*\
!*** ./src/lib/META.js ***!
\*************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.isPrivate=t.isChild=t.isParent=t.isModule=t.isView=t.isElement=t.isCollection=t.isAddon=t.isType=t.isMeta=t.TYPES=void 0;var o=r(/*! lodash/fp/startsWith */509),a=n(o),s=r(/*! lodash/fp/has */499),l=n(s),u=r(/*! lodash/fp/eq */497),i=n(u),c=r(/*! lodash/fp/flow */266),p=n(c),d=r(/*! lodash/fp/curry */496),f=n(d),y=r(/*! lodash/fp/get */498),m=n(y),h=r(/*! lodash/fp/includes */267),v=n(h),b=r(/*! lodash/fp/values */512),g=n(b),P=t.TYPES={ADDON:"addon",COLLECTION:"collection",ELEMENT:"element",VIEW:"view",MODULE:"module"},T=(0,g.default)(P),O=t.isMeta=function(e){return(0,v.default)((0,m.default)("type",e),T)},_=function(e){return O(e)?e:O((0,m.default)("_meta",e))?e._meta:O((0,m.default)("constructor._meta",e))?e.constructor._meta:void 0},E=(0,f.default)(function(e,t,r){return(0,p.default)(_,(0,m.default)(e),(0,i.default)(t))(r)}),j=t.isType=E("type");t.isAddon=j(P.ADDON),t.isCollection=j(P.COLLECTION),t.isElement=j(P.ELEMENT),t.isView=j(P.VIEW),t.isModule=j(P.MODULE),t.isParent=(0,p.default)(_,(0,l.default)("parent"),(0,i.default)(!1)),t.isChild=(0,p.default)(_,(0,l.default)("parent")),t.isPrivate=(0,p.default)(_,(0,m.default)("name"),(0,a.default)("_"))},/*!************************!*\
!*** ./src/lib/SUI.js ***!
\************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.ICONS_AND_ALIASES=t.ICON_ALIASES=t.ICONS=t.NETWORKS_AND_WEBSITE_ICONS=t.PAYMENT_OPTIONS_ICONS=t.CURRENCY_ICONS=t.TEXT_EDITOR_ICONS=t.TABLES_ICONS=t.MAP_LOCATIONS_TRANSPORTATION_ICONS=t.AUDIO_ICONS=t.RATING_ICONS=t.TECHNOLOGIES_ICONS=t.FILE_SYSTEM_ICONS=t.COMPUTER_ICONS=t.MOBILE_ICONS=t.POINTERS_ICONS=t.MEDIA_ICONS=t.ITEM_SELECTION_ICONS=t.SHAPES_ICONS=t.LITERAL_OBJECTS_ICONS=t.VIEW_ADJUSTMENT_ICONS=t.ACCESSIBILITY_ICONS=t.GENDER_SEXUALITY_ICONS=t.USERS_ICONS=t.MESSAGES_ICONS=t.USER_ACTIONS_ICONS=t.WEB_CONTENT_ICONS=t.WIDTHS=t.VERTICAL_ALIGNMENTS=t.TEXT_ALIGNMENTS=t.SIZES=t.FLOATS=t.COLORS=void 0;var a=r(/*! lodash/values */134),s=n(a),l=r(/*! lodash/keys */10),u=n(l),i=r(/*! ./numberToWord */91),c=(t.COLORS=["red","orange","yellow","olive","green","teal","blue","violet","purple","pink","brown","grey","black"],t.FLOATS=["left","right"],t.SIZES=["mini","tiny","small","medium","large","big","huge","massive"],t.TEXT_ALIGNMENTS=["left","center","right","justified"],t.VERTICAL_ALIGNMENTS=["bottom","middle","top"],t.WIDTHS=[].concat(o((0,u.default)(i.numberToWordMap)),o((0,u.default)(i.numberToWordMap).map(Number)),o((0,s.default)(i.numberToWordMap))),t.WEB_CONTENT_ICONS=["search","mail outline","signal","setting","home","inbox","browser","tag","tags","image","calendar","comment","shop","comments","external","privacy","settings","comments","external","trophy","payment","feed","alarm outline","tasks","cloud","lab","mail","dashboard","comment outline","comments outline","sitemap","idea","alarm","terminal","code","protect","calendar outline","ticket","external square","bug","mail square","history","options","text telephone","find","wifi","alarm mute","alarm mute outline","copyright","at","eyedropper","paint brush","heartbeat","mouse pointer","hourglass empty","hourglass start","hourglass half","hourglass end","hourglass full","hand pointer","trademark","registered","creative commons","add to calendar","remove from calendar","delete calendar","checked calendar","industry","shopping bag","shopping basket","hashtag","percent"]),p=t.USER_ACTIONS_ICONS=["wait","download","repeat","refresh","lock","bookmark","print","write","adjust","theme","edit","external share","ban","mail forward","share","expand","compress","unhide","hide","random","retweet","sign out","pin","sign in","upload","call","remove bookmark","call square","unlock","configure","filter","wizard","undo","exchange","cloud download","cloud upload","reply","reply all","erase","unlock alternate","write square","share square","archive","translate","recycle","send","send outline","share alternate","share alternate square","add to cart","in cart","add user","remove user","object group","object ungroup","clone","talk","talk outline"],d=t.MESSAGES_ICONS=["help circle","info circle","warning circle","warning sign","announcement","help","info","warning","birthday","help circle outline"],f=t.USERS_ICONS=["user","users","doctor","handicap","student","child","spy"],y=t.GENDER_SEXUALITY_ICONS=["female","male","woman","man","non binary transgender","intergender","transgender","lesbian","gay","heterosexual","other gender","other gender vertical","other gender horizontal","neuter","genderless"],m=t.ACCESSIBILITY_ICONS=["universal access","wheelchair","blind","audio description","volume control phone","braille","asl","assistive listening systems","deafness","sign language","low vision"],h=t.VIEW_ADJUSTMENT_ICONS=["block layout","grid layout","list layout","zoom","zoom out","resize vertical","resize horizontal","maximize","crop"],v=t.LITERAL_OBJECTS_ICONS=["cocktail","road","flag","book","gift","leaf","fire","plane","magnet","lemon","world","travel","shipping","money","legal","lightning","umbrella","treatment","suitcase","bar","flag outline","flag checkered","puzzle","fire extinguisher","rocket","anchor","bullseye","sun","moon","fax","life ring","bomb","soccer","calculator","diamond","sticky note","sticky note outline","law","hand peace","hand rock","hand paper","hand scissors","hand lizard","hand spock","tv"],b=t.SHAPES_ICONS=["crosshairs","asterisk","square outline","certificate","square","quote left","quote right","spinner","circle","ellipsis horizontal","ellipsis vertical","cube","cubes","circle notched","circle thin"],g=t.ITEM_SELECTION_ICONS=["checkmark","remove","checkmark box","move","add circle","minus circle","remove circle","check circle","remove circle outline","check circle outline","plus","minus","add square","radio","minus square","minus square outline","check square","selected radio","plus square outline","toggle off","toggle on"],P=t.MEDIA_ICONS=["film","sound","photo","bar chart","camera retro","newspaper","area chart","pie chart","line chart"],T=t.POINTERS_ICONS=["arrow circle outline down","arrow circle outline up","chevron left","chevron right","arrow left","arrow right","arrow up","arrow down","chevron up","chevron down","pointing right","pointing left","pointing up","pointing down","arrow circle left","arrow circle right","arrow circle up","arrow circle down","caret down","caret up","caret left","caret right","angle double left","angle double right","angle double up","angle double down","angle left","angle right","angle up","angle down","chevron circle left","chevron circle right","chevron circle up","chevron circle down","toggle down","toggle up","toggle right","long arrow down","long arrow up","long arrow left","long arrow right","arrow circle outline right","arrow circle outline left","toggle left"],O=t.MOBILE_ICONS=["tablet","mobile","battery full","battery high","battery medium","battery low","battery empty"],_=t.COMPUTER_ICONS=["power","trash outline","disk outline","desktop","laptop","game","keyboard","plug"],E=t.FILE_SYSTEM_ICONS=["trash","file outline","folder","folder open","file text outline","folder outline","folder open outline","level up","level down","file","file text","file pdf outline","file word outline","file excel outline","file powerpoint outline","file image outline","file archive outline","file audio outline","file video outline","file code outline"],j=t.TECHNOLOGIES_ICONS=["qrcode","barcode","rss","fork","html5","css3","rss square","openid","database","server","usb","bluetooth","bluetooth alternative"],w=t.RATING_ICONS=["heart","star","empty star","thumbs outline up","thumbs outline down","star half","empty heart","smile","frown","meh","star half empty","thumbs up","thumbs down"],S=t.AUDIO_ICONS=["music","video play outline","volume off","volume down","volume up","record","step backward","fast backward","backward","play","pause","stop","forward","fast forward","step forward","eject","unmute","mute","video play","closed captioning","pause circle","pause circle outline","stop circle","stop circle outline"],M=t.MAP_LOCATIONS_TRANSPORTATION_ICONS=["marker","coffee","food","building outline","hospital","emergency","first aid","military","h","location arrow","compass","space shuttle","university","building","paw","spoon","car","taxi","tree","bicycle","bus","ship","motorcycle","street view","hotel","train","subway","map pin","map signs","map outline","map"],x=t.TABLES_ICONS=["table","columns","sort","sort descending","sort ascending","sort alphabet ascending","sort alphabet descending","sort content ascending","sort content descending","sort numeric ascending","sort numeric descending"],N=t.TEXT_EDITOR_ICONS=["font","bold","italic","text height","text width","align left","align center","align right","align justify","list","outdent","indent","linkify","cut","copy","attach","save","content","unordered list","ordered list","strikethrough","underline","paste","unlinkify","superscript","subscript","header","paragraph","text cursor"],A=t.CURRENCY_ICONS=["euro","pound","dollar","rupee","yen","ruble","won","bitcoin","lira","shekel"],C=t.PAYMENT_OPTIONS_ICONS=["paypal","google wallet","visa","mastercard","discover","american express","paypal card","stripe","japan credit bureau","diners club","credit card alternative"],k=t.NETWORKS_AND_WEBSITE_ICONS=["twitter square","facebook square","linkedin square","github square","twitter","facebook f","github","pinterest","pinterest square","google plus square","google plus","linkedin","github alternate","maxcdn","youtube square","youtube","xing","xing square","youtube play","dropbox","stack overflow","instagram","flickr","adn","bitbucket","bitbucket square","tumblr","tumblr square","apple","windows","android","linux","dribble","skype","foursquare","trello","gittip","vk","weibo","renren","pagelines","stack exchange","vimeo square","slack","wordpress","yahoo","google","reddit","reddit square","stumbleupon circle","stumbleupon","delicious","digg","pied piper","pied piper alternate","drupal","joomla","behance","behance square","steam","steam square","spotify","deviantart","soundcloud","vine","codepen","jsfiddle","rebel","empire","git square","git","hacker news","tencent weibo","qq","wechat","slideshare","twitch","yelp","lastfm","lastfm square","ioxhost","angellist","meanpath","buysellads","connectdevelop","dashcube","forumbee","leanpub","sellsy","shirtsinbulk","simplybuilt","skyatlas","facebook","pinterest","whatsapp","viacoin","medium","y combinator","optinmonster","opencart","expeditedssl","gg","gg circle","tripadvisor","odnoklassniki","odnoklassniki square","pocket","wikipedia","safari","chrome","firefox","opera","internet explorer","contao","500px","amazon","houzz","vimeo","black tie","fonticons","reddit alien","microsoft edge","codiepie","modx","fort awesome","product hunt","mixcloud","scribd","gitlab","wpbeginner","wpforms","envira gallery","glide","glide g","viadeo","viadeo square","snapchat","snapchat ghost","snapchat square","pied piper hat","first order","yoast","themeisle","google plus circle","font awesome"],I=t.ICONS=[].concat(c,p,d,f,y,m,h,v,b,g,P,T,O,_,E,j,w,S,M,x,N,A,C,k),K=t.ICON_ALIASES=["like","favorite","video","check","close","cancel","delete","x","zoom in","magnify","shutdown","clock","time","play circle outline","headphone","camera","video camera","picture","pencil","compose","point","tint","signup","plus circle","question circle","dont","minimize","add","exclamation circle","attention","eye","exclamation triangle","shuffle","chat","cart","shopping cart","bar graph","key","cogs","discussions","like outline","dislike outline","heart outline","log out","thumb tack","winner","phone","bookmark outline","phone square","credit card","hdd outline","bullhorn","bell outline","hand outline right","hand outline left","hand outline up","hand outline down","globe","wrench","briefcase","group","linkify","chain","flask","sidebar","bars","list ul","list ol","numbered list","magic","truck","currency","triangle down","dropdown","triangle up","triangle left","triangle right","envelope","conversation","rain","clipboard","lightbulb","bell","ambulance","medkit","fighter jet","beer","plus square","computer","circle outline","gamepad","star half full","broken chain","question","exclamation","eraser","microphone","microphone slash","shield","target","play circle","pencil square","eur","gbp","usd","inr","cny","rmb","jpy","rouble","rub","krw","btc","gratipay","zip","dot circle outline","try","graduation","circle outline","sliders","weixin","tty","teletype","binoculars","power cord","wifi","visa card","mastercard card","discover card","amex","american express card","stripe card","bell slash","bell slash outline","area graph","pie graph","line graph","cc","sheqel","ils","plus cart","arrow down cart","detective","venus","mars","mercury","intersex","venus double","female homosexual","mars double","male homosexual","venus mars","mars stroke","mars alternate","mars vertical","mars stroke vertical","mars horizontal","mars stroke horizontal","asexual","facebook official","user plus","user times","user close","user cancel","user delete","user x","bed","yc","ycombinator","battery four","battery three","battery three quarters","battery two","battery half","battery one","battery quarter","battery zero","i cursor","jcb","japan credit bureau card","diners club card","balance","hourglass outline","hourglass zero","hourglass one","hourglass two","hourglass three","hourglass four","grab","hand victory","tm","r circle","television","five hundred pixels","calendar plus","calendar minus","calendar times","calendar check","factory","commenting","commenting outline","edge","ms edge","wordpress beginner","wordpress forms","envira","question circle outline","assistive listening devices","als","ald","asl interpreting","deaf","american sign language interpreting","hard of hearing","signing","new pied piper","theme isle","google plus official","fa"];t.ICONS_AND_ALIASES=[].concat(o(I),K)},/*!**********************************!*\
!*** ./src/lib/childrenUtils.js ***!
\**********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.findByType=t.someByType=void 0;var o=r(/*! lodash/find */128),a=n(o),s=r(/*! lodash/some */277),l=n(s),u=r(/*! react */1);t.someByType=function(e,t){return(0,l.default)(u.Children.toArray(e),{type:t})},t.findByType=function(e,t){return(0,a.default)(u.Children.toArray(e),{type:t})}},/*!**************************************!*\
!*** ./src/lib/classNameBuilders.js ***!
\**************************************/
function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useVerticalAlignProp=t.useTextAlignProp=t.useWidthProp=t.useKeyOrValueAndKey=t.useValueAndKey=t.useKeyOnly=void 0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=r(/*! ./numberToWord */91),a=(t.useKeyOnly=function(e,t){return e&&t},t.useValueAndKey=function(e,t){return e&&e!==!0&&e+" "+t});t.useKeyOrValueAndKey=function(e,t){return e&&(e===!0?t:e+" "+t)},t.useWidthProp=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(r&&"equal"===e)return"equal width";var a="undefined"==typeof e?"undefined":n(e);return"string"!==a&&"number"!==a||!t?(0,o.numberToWord)(e):(0,o.numberToWord)(e)+" "+t},t.useTextAlignProp=function(e){return"justified"===e?"justified":a(e,"aligned")},t.useVerticalAlignProp=function(e){return a(e,"aligned")}},/*!************************************!*\
!*** ./src/lib/customPropTypes.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.deprecate=t.collectionShorthand=t.itemShorthand=t.contentShorthand=t.demand=t.givenProps=t.some=t.every=t.disallow=t.suggest=t.as=void 0;var a=r(/*! lodash/fp/isObject */502),s=n(a),l=r(/*! lodash/fp/pick */507),u=n(l),i=r(/*! lodash/fp/keys */504),c=n(i),p=r(/*! lodash/fp/isPlainObject */503),d=n(p),f=r(/*! lodash/fp/isFunction */500),y=n(f),m=r(/*! lodash/fp/compact */495),h=n(m),v=r(/*! lodash/fp/take */511),b=n(v),g=r(/*! lodash/fp/sortBy */508),P=n(g),T=r(/*! lodash/fp/sum */510),O=n(T),_=r(/*! lodash/fp/min */506),E=n(_),j=r(/*! lodash/fp/map */505),w=n(j),S=r(/*! lodash/fp/flow */266),M=n(S),x=r(/*! lodash/fp/includes */267),N=n(x),A=r(/*! lodash/fp/isNil */501),C=n(A),k=r(/*! react */1),I=r(/*! ./leven */180),K=n(I),L=function(){var e;return(e=Object.prototype.toString).call.apply(e,arguments)},U=(t.as=function(){return k.PropTypes.oneOfType([k.PropTypes.string,k.PropTypes.func]).apply(void 0,arguments)},t.suggest=function(e){return function(t,r,n){if(!Array.isArray(e))throw new Error(["Invalid argument supplied to suggest, expected an instance of array."," See `"+r+"` prop in `"+n+"`."].join(""));var o=t[r];if(!(0,C.default)(o)&&o!==!1&&!(0,N.default)(o,e)){var a=o.split(" "),s=(0,M.default)((0,w.default)(function(e){var t=e.split(" "),r=(0,M.default)((0,w.default)(function(e){return(0,w.default)(function(t){return(0,K.default)(e,t)},t)}),(0,w.default)(E.default),O.default)(a),n=(0,M.default)((0,w.default)(function(e){return(0,w.default)(function(t){return(0,K.default)(e,t)},a)}),(0,w.default)(E.default),O.default)(t);return{suggestion:e,score:r+n}}),(0,P.default)(["score","suggestion"]),(0,b.default)(3))(e);if(!s.some(function(e){return 0===e.score}))return new Error(["Invalid prop `"+r+"` of value `"+o+"` supplied to `"+n+"`.","\n\nInstead of `"+o+"`, did you mean:",s.map(function(e){return"\n - "+e.suggestion}).join(""),"\n"].join(""))}}},t.disallow=function(e){return function(t,r,n){if(!Array.isArray(e))throw new Error(["Invalid argument supplied to disallow, expected an instance of array."," See `"+r+"` prop in `"+n+"`."].join(""));if(!(0,C.default)(t[r])&&t[r]!==!1){var a=e.reduce(function(e,r){return(0,C.default)(t[r])||t[r]===!1?e:[].concat(o(e),[r])},[]);return a.length>0?new Error(["Prop `"+r+"` in `"+n+"` conflicts with props: `"+a.join("`, `")+"`.","They cannot be defined together, choose one or the other."].join(" ")):void 0}}}),D=t.every=function(e){return function(t,r,n){for(var o=arguments.length,a=Array(o>3?o-3:0),s=3;s<o;s++)a[s-3]=arguments[s];if(!Array.isArray(e))throw new Error(["Invalid argument supplied to every, expected an instance of array.","See `"+r+"` prop in `"+n+"`."].join(" "));var l=(0,M.default)((0,w.default)(function(e){if("function"!=typeof e)throw new Error('every() argument "validators" should contain functions, found: '+L(e)+".");return e.apply(void 0,[t,r,n].concat(a))}),h.default)(e);return l[0]}},R=(t.some=function(e){return function(t,r,n){for(var o=arguments.length,a=Array(o>3?o-3:0),s=3;s<o;s++)a[s-3]=arguments[s];if(!Array.isArray(e))throw new Error(["Invalid argument supplied to some, expected an instance of array.","See `"+r+"` prop in `"+n+"`."].join(" "));var l=(0,h.default)((0,w.default)(e,function(e){if(!(0,y.default)(e))throw new Error('some() argument "validators" should contain functions, found: '+L(e)+".");return e.apply(void 0,[t,r,n].concat(a))}));if(l.length===e.length){var u=new Error("One of these validators must pass:");return u.message+="\n"+(0,w.default)(l,function(e,t){return"["+(t+1)+"]: "+e.message}).join("\n"),u}}},t.givenProps=function(e,t){return function(r,n,o){for(var a=arguments.length,l=Array(a>3?a-3:0),i=3;i<a;i++)l[i-3]=arguments[i];if(!(0,d.default)(e))throw new Error(["Invalid argument supplied to givenProps, expected an object.","See `"+n+"` prop in `"+o+"`."].join(" "));if("function"!=typeof t)throw new Error(["Invalid argument supplied to givenProps, expected a function.","See `"+n+"` prop in `"+o+"`."].join(" "));var p=(0,c.default)(e).every(function(t){var a=e[t];return"function"==typeof a?!a.apply(void 0,[r,t,o].concat(l)):a===r[n]});if(p){var f=t.apply(void 0,[r,n,o].concat(l));if(f){var y="{ "+(0,c.default)((0,u.default)((0,c.default)(e),r)).map(function(e){var t=r[e],n=t;return"string"==typeof t?n='"'+t+'"':Array.isArray(t)?n="["+t.join(", ")+"]":(0,s.default)(t)&&(n="{...}"),e+": "+n}).join(", ")+" }";return f.message="Given props "+y+": "+f.message,f}}}},t.demand=function(e){return function(t,r,n){if(!Array.isArray(e))throw new Error(["Invalid `requiredProps` argument supplied to require, expected an instance of array."," See `"+r+"` prop in `"+n+"`."].join(""));if(void 0!==t[r]){var o=e.filter(function(e){return void 0===t[e]});return o.length>0?new Error("`"+r+"` prop in `"+n+"` requires props: `"+o.join("`, `")+"`."):void 0}}},t.contentShorthand=function(){return D([U(["children"]),k.PropTypes.node]).apply(void 0,arguments)},t.itemShorthand=function(){return D([U(["children"]),k.PropTypes.oneOfType([k.PropTypes.node,k.PropTypes.object])]).apply(void 0,arguments)});t.collectionShorthand=function(){return D([U(["children"]),k.PropTypes.arrayOf(R)]).apply(void 0,arguments)},t.deprecate=function(e,t){return function(r,n,o){for(var a=arguments.length,s=Array(a>3?a-3:0),l=3;l<a;l++)s[l-3]=arguments[l];if("string"!=typeof e)throw new Error(["Invalid `help` argument supplied to deprecate, expected a string.","See `"+n+"` prop in `"+o+"`."].join(" "));if(void 0!==r[n]){var u=new Error("The `"+n+"` prop in `"+o+"` is deprecated.");if(e&&(u.message+=" "+e),t){if("function"!=typeof t)throw new Error(["Invalid argument supplied to deprecate, expected a function.","See `"+n+"` prop in `"+o+"`."].join(" "));var i=t.apply(void 0,[r,n,o].concat(s));i&&(u.message=u.message+" "+i.message)}return u}}}},/*!**************************!*\
!*** ./src/lib/debug.js ***!
\**************************/
function(e,t,r){(function(e){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.debug=t.makeDebugger=void 0;var o=r(/*! ./isBrowser */179),a=n(o),s=void 0,l=function(){};if(a.default&&"production"!==e.env.NODE_ENV&&"test"!==e.env.NODE_ENV){var u=void 0;try{u=window.localStorage.debug}catch(e){console.error("Semantic-UI-React could not enable debug."),console.error(e)}s=r(/*! debug */355),s.enable(u)}else s=function(){return l};var i=t.makeDebugger=function(e){return s("semanticUIReact:"+e)};t.debug=i("log")}).call(t,r(/*! ./~/process/browser.js */35))},/*!******************************!*\
!*** ./src/lib/factories.js ***!
\******************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function a(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("function"!=typeof e&&"string"!=typeof e)throw new Error("createShorthandFactory() Component must be a string or function.");if(null===r)return null;var o=void 0,a={};(0,E.isValidElement)(r)?(o="element",a=r.props):(0,h.default)(r)?(o="props",a=r):((0,y.default)(r)||(0,d.default)(r)||(0,c.default)(r))&&(o="literal",a=t(r)),n=(0,b.default)(n)?n(a):n;var s=w(n,a);return"element"===o?(0,E.cloneElement)(r,s):"props"===o||"literal"===o?j.default.createElement(e,s):null}function s(e,t){if("function"!=typeof e&&"string"!=typeof e)throw new Error("createShorthandFactory() Component must be a string or function.");return(0,u.default)(a,e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.createHTMLLabel=t.createHTMLInput=t.createHTMLImage=void 0;var l=r(/*! lodash/partial */519),u=n(l),i=r(/*! lodash/isArray */4),c=n(i),p=r(/*! lodash/isNumber */271),d=n(p),f=r(/*! lodash/isString */272),y=n(f),m=r(/*! lodash/isPlainObject */132),h=n(m),v=r(/*! lodash/isFunction */28),b=n(v),g=r(/*! lodash/has */27),P=n(g),T=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.createShorthand=a,t.createShorthandFactory=s;var O=r(/*! classnames */3),_=n(O),E=r(/*! react */1),j=n(E),w=function(e,t){var r=T({},e,t),n=r.childKey,a=o(r,["childKey"]);return((0,P.default)(t,"className")||(0,P.default)(e.className))&&(a.className=(0,_.default)(e.className,t.className)),!a.key&&n&&(a.key=(0,b.default)(n)?n(a):n),a};t.createHTMLImage=s("img",function(e){return{src:e}}),t.createHTMLInput=s("input",function(e){return{type:e}}),t.createHTMLLabel=s("label",function(e){return{children:e}})},/*!***********************************!*\
!*** ./src/lib/getElementType.js ***!
\***********************************/
function(e,t){"use strict";function r(e,t,r){var n=e.defaultProps,o=void 0===n?{}:n;if(t.as&&t.as!==o.as)return t.as;if(r){var a=r();if(a)return a}return t.href?"a":o.as||"div"}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},/*!**************************************!*\
!*** ./src/lib/getUnhandledProps.js ***!
\**************************************/
function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){return e.forEach(function(e){t.indexOf(e)===-1&&t.push(e)})},n=function(e,t){var n=e.autoControlledProps,o=e.defaultProps,a=e.propTypes,s=e.handledProps;return s||(s=[],n&&r(n,s),o&&r(Object.keys(o),s),a&&r(Object.keys(a),s),e.handledProps=s),Object.keys(t).reduce(function(e,r){return s.indexOf(r)===-1&&(e[r]=t[r]),e},{})};t.default=n},/*!********************************!*\
!*** ./src/lib/keyboardKey.js ***!
\********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(/*! lodash/isObject */12),a=n(o),s=r(/*! lodash/times */280),l=n(s),u={3:"Cancel",6:"Help",8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",28:"Convert",29:"NonConvert",30:"Accept",31:"ModeChange",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",41:"Select",42:"Print",43:"Execute",44:"PrintScreen",45:"Insert",46:"Delete",48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],91:"OS",93:"ContextMenu",144:"NumLock",145:"ScrollLock",181:"VolumeMute",182:"VolumeDown",183:"VolumeUp",186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"'],224:"Meta",225:"AltGraph",246:"Attn",247:"CrSel",248:"ExSel",249:"EraseEof",250:"Play",251:"ZoomOut"};(0,l.default)(24,function(e){return u[112+e]="F"+(e+1)}),(0,l.default)(26,function(e){var t=e+65;u[t]=[String.fromCharCode(t+32),String.fromCharCode(t)]});var i={codes:u,getCode:function(e){return(0,a.default)(e)?e.keyCode||e.which||this[e.key]:this[e]},getName:function(e){var t=(0,a.default)(e),r=u[t?e.keyCode||e.which:e];return Array.isArray(r)&&(r=t?r[e.shiftKey?1:0]:r[0]),r},Cancel:3,Help:6,Backspace:8,Tab:9,Clear:12,Enter:13,Shift:16,Control:17,Alt:18,Pause:19,CapsLock:20,Escape:27,Convert:28,NonConvert:29,Accept:30,ModeChange:31," ":32,PageUp:33,PageDown:34,End:35,Home:36,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Select:41,Print:42,Execute:43,PrintScreen:44,Insert:45,Delete:46,0:48,")":48,1:49,"!":49,2:50,"@":50,3:51,"#":51,4:52,$:52,5:53,"%":53,6:54,"^":54,7:55,"&":55,8:56,"*":56,9:57,"(":57,a:65,A:65,b:66,B:66,c:67,C:67,d:68,D:68,e:69,E:69,f:70,F:70,g:71,G:71,h:72,H:72,i:73,I:73,j:74,J:74,k:75,K:75,l:76,L:76,m:77,M:77,n:78,N:78,o:79,O:79,p:80,P:80,q:81,Q:81,r:82,R:82,s:83,S:83,t:84,T:84,u:85,U:85,v:86,V:86,w:87,W:87,x:88,X:88,y:89,Y:89,z:90,Z:90,OS:91,ContextMenu:93,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,F13:124,F14:125,F15:126,F16:127,F17:128,F18:129,F19:130,F20:131,F21:132,F22:133,F23:134,F24:135,NumLock:144,ScrollLock:145,VolumeMute:181,VolumeDown:182,VolumeUp:183,";":186,":":186,"=":187,"+":187,",":188,"<":188,"-":189,_:189,".":190,">":190,"/":191,"?":191,"`":192,"~":192,"[":219,"{":219,"\\":220,"|":220,"]":221,"}":221,"'":222,'"':222,Meta:224,AltGraph:225,Attn:246,CrSel:247,ExSel:248,EraseEof:249,Play:250,ZoomOut:251};i.Spacebar=i[" "],i.Digit0=i[0],i.Digit1=i[1],i.Digit2=i[2],i.Digit3=i[3],i.Digit4=i[4],i.Digit5=i[5],i.Digit6=i[6],i.Digit7=i[7],i.Digit8=i[8],i.Digit9=i[9],i.Tilde=i["~"],i.GraveAccent=i["`"],i.ExclamationPoint=i["!"],i.AtSign=i["@"],i.PoundSign=i["#"],i.PercentSign=i["%"],i.Caret=i["^"],i.Ampersand=i["&"],i.PlusSign=i["+"],i.MinusSign=i["-"],i.EqualsSign=i["="],i.DivisionSign=i["/"],i.MultiplicationSign=i["*"],i.Comma=i[","],i.Decimal=i["."],i.Colon=i[":"],i.Semicolon=i[";"],i.Pipe=i["|"],i.BackSlash=i["\\"],i.QuestionMark=i["?"],i.SingleQuote=i['"'],i.DoubleQuote=i['"'],i.LeftCurlyBrace=i["{"],i.RightCurlyBrace=i["}"],i.LeftParenthesis=i["("],i.RightParenthesis=i[")"],i.LeftAngleBracket=i["<"],i.RightAngleBracket=i[">"],i.LeftSquareBracket=i["["],i.RightSquareBracket=i["]"],t.default=i},/*!*******************************!*\
!*** ./src/lib/objectDiff.js ***!
\*******************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.objectDiff=void 0;var o=r(/*! lodash/isEqual */130),a=n(o),s=r(/*! lodash/has */27),l=n(s),u=r(/*! lodash/transform */530),i=n(u);t.objectDiff=function(e,t){return(0,i.default)(e,function(e,r,n){(0,l.default)(t,n)?(0,a.default)(r,t[n])||(e[n]=t[n]):e[n]="[DELETED]"},{})}},/*!********************************************!*\
!*** ./src/modules/Accordion/Accordion.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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)}Object.defineProperty(t,"__esModule",{value:!0});var l=r(/*! lodash/keys */10),u=n(l),i=r(/*! lodash/omit */78),c=n(i),p=r(/*! lodash/each */73),d=n(p),f=r(/*! lodash/has */27),y=n(f),m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},v=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),b=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var s=o.get;if(void 0!==s)return s.call(n)},g=r(/*! classnames */3),P=n(g),T=r(/*! react */1),O=n(T),_=r(/*! ../../lib */2),E=r(/*! ../../elements/Icon */8),j=n(E),w=r(/*! ./AccordionContent */181),S=n(w),M=r(/*! ./AccordionTitle */182),x=n(M),N=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.state={},n.handleTitleClick=function(e,t){var r=n.props.onTitleClick,o=n.state.activeIndex;n.trySetState({activeIndex:t===o?-1:t}),r&&r(e,t)},n.renderChildren=function(){var e=n.props.children,t=n.state.activeIndex,r=0,o=0;return T.Children.map(e,function(e){var a=e.type===x.default,s=e.type===S.default;if(a){var l=function(){var o=r,a=(0,y.default)(e,"props.active")?e.props.active:t===o,s=function(t){n.handleTitleClick(t,o),e.props.onClick&&e.props.onClick(t,o)};return r++,{v:(0,T.cloneElement)(e,h({},e.props,{active:a,onClick:s}))}}();if("object"===("undefined"==typeof l?"undefined":m(l)))return l.v}if(s){var u=o,i=(0,y.default)(e,"props.active")?e.props.active:t===u;return o++,(0,T.cloneElement)(e,h({},e.props,{active:i}))}return e})},n.renderPanels=function(){var e=n.props.panels,t=n.state.activeIndex,r=[];return(0,d.default)(e,function(e,o){var a=(0,y.default)(e,"active")?e.active:t===o,s=function(t){n.handleTitleClick(t,o),e.onClick&&e.onClick(t,o)};r.push(O.default.createElement(x.default,{key:e.title+"-title",active:a,onClick:s},O.default.createElement(j.default,{name:"dropdown"}),e.title)),r.push(O.default.createElement(S.default,{key:e.title+"-content",active:a},e.content))}),r},s=r,a(n,s)}return s(t,e),v(t,[{key:"componentWillMount",value:function(){b(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentWillMount",this).call(this),"undefined"==typeof this.props.defaultActiveIndex&&this.trySetState({activeIndex:-1})}},{key:"render",value:function(){var e=this.props,r=e.className,n=e.fluid,o=e.inverted,a=e.panels,s=e.styled,l=(0,P.default)("ui",(0,_.useKeyOnly)(n,"fluid"),(0,_.useKeyOnly)(o,"inverted"),(0,_.useKeyOnly)(s,"styled"),"accordion",r),i=(0,c.default)(this.props,(0,u.default)(t.propTypes)),p=(0,_.getElementType)(t,this.props);return O.default.createElement(p,h({},i,{className:l}),a?this.renderPanels():this.renderChildren())}}]),t}(_.AutoControlledComponent);N.autoControlledProps=["activeIndex"],N.propTypes={as:_.customPropTypes.as,activeIndex:T.PropTypes.number,children:T.PropTypes.node,className:T.PropTypes.string,defaultActiveIndex:T.PropTypes.number,fluid:T.PropTypes.bool,inverted:T.PropTypes.bool,onTitleClick:T.PropTypes.func,panels:_.customPropTypes.every([_.customPropTypes.disallow(["children"]),T.PropTypes.arrayOf(T.PropTypes.shape({active:T.PropTypes.bool,title:T.PropTypes.string,content:_.customPropTypes.contentShorthand,onClick:T.PropTypes.func}))]),styled:T.PropTypes.bool},N._meta={name:"Accordion",type:_.META.TYPES.MODULE},N.Content=S.default,N.Title=x.default,t.default=N},/*!******************************************!*\
!*** ./src/modules/Checkbox/Checkbox.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(/*! classnames */3),c=n(i),p=r(/*! react */1),d=n(p),f=r(/*! ../../lib */2),y=(0,f.makeDebugger)("checkbox"),m={name:"Checkbox",type:f.META.TYPES.MODULE,props:{type:["checkbox","radio"]}},h=function(e){function t(){var e,r,n,s;o(this,t);for(var u=arguments.length,i=Array(u),c=0;c<u;c++)i[c]=arguments[c];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),n.state={},n.canToggle=function(){var e=n.props,t=e.disabled,r=e.radio,o=e.readOnly,a=n.state.checked;return!(t||o||r&&a)},n.handleClick=function(e){y("handleClick()");var t=n.props,r=t.onChange,o=t.onClick,a=n.state.checked;n.canToggle()&&(o&&o(e,l({},n.props,{checked:!!a})),r&&r(e,l({},n.props,{checked:!a})),n.trySetState({checked:!a}))},s=r,a(n,s)}return s(t,e),u(t,[{key:"render",value:function(){var e=this.props,r=e.className,n=e.disabled,o=e.label,a=e.name,s=e.radio,u=e.readOnly,i=e.slider,p=e.toggle,y=e.type,m=e.value,h=this.state.checked,v=(0,c.default)("ui",(0,f.useKeyOnly)(h,"checked"),(0,f.useKeyOnly)(n,"disabled"),(0,f.useKeyOnly)(!o,"fitted"),(0,f.useKeyOnly)(s,"radio"),(0,f.useKeyOnly)(u,"read-only"),(0,f.useKeyOnly)(i,"slider"),(0,f.useKeyOnly)(p,"toggle"),"checkbox",r),b=(0,f.getUnhandledProps)(t,this.props),g=(0,f.getElementType)(t,this.props);return d.default.createElement(g,l({},b,{className:v,onClick:this.handleClick,onChange:this.handleClick}),d.default.createElement("input",{checked:h,className:"hidden",name:a,readOnly:!0,tabIndex:0,type:y,value:m}),(0,f.createHTMLLabel)(o)||d.default.createElement("label",null))}}]),t}(f.AutoControlledComponent);h.propTypes={as:f.customPropTypes.as,checked:p.PropTypes.bool,className:p.PropTypes.string,defaultChecked:p.PropTypes.bool,disabled:p.PropTypes.bool,fitted:p.PropTypes.bool,label:f.customPropTypes.itemShorthand,name:p.PropTypes.string,onChange:p.PropTypes.func,onClick:p.PropTypes.func,radio:f.customPropTypes.every([p.PropTypes.bool,f.customPropTypes.disallow(["slider","toggle"])]),readOnly:p.PropTypes.bool,slider:f.customPropTypes.every([p.PropTypes.bool,f.customPropTypes.disallow(["radio","toggle"])]),toggle:f.customPropTypes.every([p.PropTypes.bool,f.customPropTypes.disallow(["radio","slider"])]),type:p.PropTypes.oneOf(m.props.type),value:p.PropTypes.string},h.defaultProps={type:"checkbox"},h.autoControlledProps=["checked"],h._meta=m,t.default=h},/*!**************************************!*\
!*** ./src/modules/Dimmer/Dimmer.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(/*! classnames */3),c=n(i),p=r(/*! react */1),d=n(p),f=r(/*! ../../lib */2),y=r(/*! ../../addons/Portal */44),m=n(y),h=r(/*! ./DimmerDimmable */183),v=n(h),b={name:"Dimmer",type:f.META.TYPES.MODULE},g=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.handlePortalMount=function(){f.isBrowser&&document.body.classList.add("dimmed","dimmable")},n.handlePortalUnmount=function(){f.isBrowser&&document.body.classList.remove("dimmed","dimmable")},n.handleClick=function(e){var t=n.props,r=t.onClick,o=t.onClickOutside;r&&r(e,n.props),n.center&&n.center!==e.target&&n.center.contains(e.target)||o&&o(e,n.props)},s=r,a(n,s)}return s(t,e),u(t,[{key:"render",value:function(){var e=this,r=this.props,n=r.active,o=r.children,a=r.className,s=r.content,u=r.disabled,i=r.inverted,p=r.page,y=r.simple,h=(0,c.default)("ui",(0,f.useKeyOnly)(n,"active transition visible"),(0,f.useKeyOnly)(u,"disabled"),(0,f.useKeyOnly)(i,"inverted"),(0,f.useKeyOnly)(p,"page"),(0,f.useKeyOnly)(y,"simple"),"dimmer",a),v=(0,f.getUnhandledProps)(t,this.props),b=(0,f.getElementType)(t,this.props),g=(o||s)&&d.default.createElement("div",{className:"content"},d.default.createElement("div",{className:"center",ref:function(t){return e.center=t}},o||s));return p?d.default.createElement(m.default,{closeOnEscape:!1,closeOnDocumentClick:!1,onMount:this.handlePortalMount,onUnmount:this.handlePortalUnmount,open:n,openOnTriggerClick:!1},d.default.createElement(b,l({},v,{className:h,onClick:this.handleClick}),g)):d.default.createElement(b,l({},v,{className:h,onClick:this.handleClick}),g)}}]),t}(p.Component);g.propTypes={as:f.customPropTypes.as,active:p.PropTypes.bool,children:p.PropTypes.node,className:p.PropTypes.string,content:f.customPropTypes.contentShorthand,disabled:p.PropTypes.bool,onClick:p.PropTypes.func,onClickOutside:p.PropTypes.func,inverted:p.PropTypes.bool,page:p.PropTypes.bool,simple:p.PropTypes.bool},g._meta=b,g.Dimmable=v.default,t.default=g,g.create=(0,f.createShorthandFactory)(g,function(e){return{content:e}})},/*!******************************************!*\
!*** ./src/modules/Dropdown/Dropdown.js ***!
\******************************************/
function(e,t,r){(function(e){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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)}Object.defineProperty(t,"__esModule",{value:!0});var l=r(/*! lodash/compact */262),u=n(l),i=r(/*! lodash/map */9),c=n(i),p=r(/*! lodash/isNil */270),d=n(p),f=r(/*! lodash/every */264),y=n(f),m=r(/*! lodash/without */7),h=n(m),v=r(/*! lodash/findIndex */265),b=n(v),g=r(/*! lodash/find */128),P=n(g),T=r(/*! lodash/reduce */276),O=n(T),_=r(/*! lodash/escapeRegExp */488),E=n(_),j=r(/*! lodash/filter */127),w=n(j),S=r(/*! lodash/isFunction */28),M=n(S),x=r(/*! lodash/dropRight */487),N=n(x),A=r(/*! lodash/isEmpty */129),C=n(A),k=r(/*! lodash/union */531),I=n(k),K=r(/*! lodash/some */277),L=n(K),U=r(/*! lodash/get */34),D=n(U),R=r(/*! lodash/includes */74),z=n(R),W=r(/*! lodash/has */27),F=n(W),V=r(/*! lodash/isEqual */130),B=n(V),Y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},q=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),H=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var s=o.get;if(void 0!==s)return s.call(n)},G=r(/*! classnames */3),Z=n(G),$=r(/*! react */1),X=n($),J=r(/*! ../../lib */2),Q=r(/*! ../../elements/Icon */8),ee=n(Q),te=r(/*! ../../elements/Label */47),re=n(te),ne=r(/*! ./DropdownDivider */185),oe=n(ne),ae=r(/*! ./DropdownItem */187),se=n(ae),le=r(/*! ./DropdownHeader */186),ue=n(le),ie=r(/*! ./DropdownMenu */188),ce=n(ie),pe=(0,J.makeDebugger)("dropdown"),de={name:"Dropdown",type:J.META.TYPES.MODULE,props:{pointing:["left","right","top","top left","top right","bottom","bottom left","bottom right"],additionPosition:["top","bottom"]}},fe=function(t){function r(){var e,t,n,s;o(this,r);for(var l=arguments.length,i=Array(l),p=0;p<l;p++)i[p]=arguments[p];return t=n=a(this,(e=r.__proto__||Object.getPrototypeOf(r)).call.apply(e,[this].concat(i))),n.handleChange=function(e,t){pe("handleChange()"),pe(t);var r=n.props.onChange;r&&r(e,Y({},n.props,{value:t}))},n.closeOnEscape=function(e){J.keyboardKey.getCode(e)===J.keyboardKey.Escape&&(e.preventDefault(),n.close())},n.moveSelectionOnKeyDown=function(e){switch(pe("moveSelectionOnKeyDown()"),pe(J.keyboardKey.getName(e)),J.keyboardKey.getCode(e)){case J.keyboardKey.ArrowDown:e.preventDefault(),n.moveSelectionBy(1);break;case J.keyboardKey.ArrowUp:e.preventDefault(),n.moveSelectionBy(-1)}},n.openOnSpace=function(e){pe("openOnSpace()"),J.keyboardKey.getCode(e)===J.keyboardKey.Spacebar&&(n.state.open||(e.preventDefault(),n.open(e)))},n.openOnArrow=function(e){pe("openOnArrow()");var t=J.keyboardKey.getCode(e);(0,z.default)([J.keyboardKey.ArrowDown,J.keyboardKey.ArrowUp],t)&&(n.state.open||(e.preventDefault(),n.open(e)))},n.selectHighlightedItem=function(e){var t=n.state.open,r=n.props,o=r.multiple,a=r.onAddItem,s=r.options,l=(0,D.default)(n.getSelectedItem(),"value");if(l&&t)if(a&&!(0,L.default)(s,{text:l})&&a(e,Y({},n.props,{value:l})),o){var u=(0,I.default)(n.state.value,[l]);n.setValue(u),n.handleChange(e,u)}else n.setValue(l),n.handleChange(e,l),n.close()},n.selectItemOnEnter=function(e){pe("selectItemOnEnter()"),pe(J.keyboardKey.getName(e)),J.keyboardKey.getCode(e)===J.keyboardKey.Enter&&(e.preventDefault(),n.selectHighlightedItem(e))},n.removeItemOnBackspace=function(e){if(pe("removeItemOnBackspace()"),pe(J.keyboardKey.getName(e)),J.keyboardKey.getCode(e)===J.keyboardKey.Backspace){var t=n.props,r=t.multiple,o=t.search,a=n.state,s=a.searchQuery,l=a.value;if(!s&&o&&r&&!(0,C.default)(l)){e.preventDefault();var u=(0,N.default)(l);n.setValue(u),n.handleChange(e,u)}}},n.closeOnDocumentClick=function(e){pe("closeOnDocumentClick()"),pe(e),n._dropdown&&(0,M.default)(n._dropdown.contains)&&n._dropdown.contains(e.target)||n.close()},n.handleMouseDown=function(e){pe("handleMouseDown()");var t=n.props.onMouseDown;t&&t(e,n.props),n.isMouseDown=!0,J.isBrowser&&document.addEventListener("mouseup",n.handleDocumentMouseUp)},n.handleDocumentMouseUp=function(){pe("handleDocumentMouseUp()"),n.isMouseDown=!1,J.isBrowser&&document.removeEventListener("mouseup",n.handleDocumentMouseUp)},n.handleClick=function(e){pe("handleClick()",e);var t=n.props.onClick;t&&t(e,n.props),e.stopPropagation(),n.toggle(e)},n.handleItemClick=function(e,t){pe("handleItemClick()"),pe(t);var r=n.props,o=r.multiple,a=r.onAddItem,s=r.options,l=t.value;if(e.stopPropagation(),(o||t.disabled)&&e.nativeEvent.stopImmediatePropagation(),!t.disabled)if(a&&!(0,L.default)(s,{text:l})&&a(e,Y({},n.props,{value:l})),o){var u=(0,I.default)(n.state.value,[l]);n.setValue(u),n.handleChange(e,u)}else n.setValue(l),n.handleChange(e,l),n.close()},n.handleFocus=function(e){pe("handleFocus()");var t=n.props.onFocus;t&&t(e,n.props),n.setState({focus:!0})},n.handleBlur=function(e){pe("handleBlur()");var t=n.props,r=t.multiple,o=t.onBlur,a=t.selectOnBlur;n.isMouseDown||(o&&o(e,n.props),a&&!r&&n.selectHighlightedItem(e),n.setState({focus:!1}))},n.handleSearchChange=function(e){pe("handleSearchChange()"),pe(e.target.value),e.stopPropagation();var t=n.props,r=t.search,o=t.onSearchChange,a=n.state.open,s=e.target.value;o&&o(e,s),r&&s&&!a&&n.open(),n.setState({selectedIndex:n.getEnabledIndices()[0],searchQuery:s})},n.getMenuOptions=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.state.value,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.props.options,r=n.props,o=r.multiple,a=r.search,s=r.allowAdditions,l=r.additionPosition,u=r.additionLabel,i=n.state.searchQuery,c=t;if(o&&(c=(0,w.default)(c,function(t){return!(0,z.default)(e,t.value)})),a&&i&&((0,M.default)(a)?c=a(c,i):!function(){var e=new RegExp((0,E.default)(i),"i");c=(0,w.default)(c,function(t){return e.test(t.text)})}()),s&&a&&i&&!(0,L.default)(c,{text:i})){var p=X.default.isValidElement(u)?X.default.cloneElement(u,{key:"label"}):u||"",d={text:[p,X.default.createElement("b",{key:"addition"},i)],value:i,className:"addition"};"top"===l?c.unshift(d):c.push(d)}return c},n.getSelectedItem=function(){var e=n.state.selectedIndex,t=n.getMenuOptions();return(0,D.default)(t,"["+e+"]")},n.getEnabledIndices=function(e){var t=e||n.getMenuOptions();return(0,O.default)(t,function(e,t,r){return t.disabled||e.push(r),e},[])},n.getItemByValue=function(e){var t=n.props.options;return(0,P.default)(t,{value:e})},n.getMenuItemIndexByValue=function(e,t){var r=t||n.getMenuOptions();return(0,b.default)(r,["value",e])},n.setValue=function(e){pe("setValue()"),pe("value",e);var t={searchQuery:""};n.trySetState({value:e},t),n.setSelectedIndex(e)},n.setSelectedIndex=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.state.value,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.props.options,r=n.props.multiple,o=n.state.selectedIndex,a=n.getMenuOptions(e,t),s=n.getEnabledIndices(a),l=void 0;if(!o||o<0){var u=s[0];l=r?u:n.getMenuItemIndexByValue(e,a)||s[0]}else if(r)o>=a.length-1&&(l=s[s.length-1]);else{var i=n.getMenuItemIndexByValue(e,a);l=(0,z.default)(s,i)?i:void 0}(!l||l<0)&&(l=s[0]),n.setState({selectedIndex:l})},n.handleLabelClick=function(e,t){pe("handleLabelClick()"),e.stopPropagation(),n.setState({selectedLabel:t.value});var r=n.props.onLabelClick;r&&r(e,t)},n.handleLabelRemove=function(e,t){pe("handleLabelRemove()"),e.stopPropagation();var r=n.state.value,o=(0,h.default)(r,t.value);pe("label props:",t),pe("current value:",r),pe("remove value:",t.value),pe("new value:",o),n.setValue(o),n.handleChange(e,o)},n.moveSelectionBy=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.state.selectedIndex;pe("moveSelectionBy()"),pe("offset: "+e);var r=n.getMenuOptions(),o=r.length-1;if(!(0,y.default)(r,"disabled")){var a=t+e;if(a>o?a=0:a<0&&(a=o),r[a].disabled)return n.moveSelectionBy(e,a);n.setState({selectedIndex:a}),n.scrollSelectedItemIntoView()}},n.scrollSelectedItemIntoView=function(){if(pe("scrollSelectedItemIntoView()"),J.isBrowser){var e=document.querySelector(".ui.dropdown.active.visible .menu.visible"),t=e.querySelector(".item.selected");pe("menu: "+e),pe("item: "+t);var r=t.offsetTop<e.scrollTop,n=t.offsetTop+t.clientHeight>e.scrollTop+e.clientHeight;r?e.scrollTop=t.offsetTop:n&&(e.scrollTop=t.offsetTop+t.clientHeight-e.clientHeight)}},n.open=function(e){pe("open()");var t=n.props,r=t.disabled,o=t.onOpen,a=t.search;r||(a&&n._search.focus(),o&&o(e,n.props),n.trySetState({open:!0}))},n.close=function(e){pe("close()");var t=n.props.onClose;t&&t(e,n.props),n.trySetState({open:!1})},n.handleClose=function(){pe("handleClose()"),n._dropdown.blur(),n.setState({focus:!1})},n.toggle=function(e){return n.state.open?n.close(e):n.open(e)},n.renderText=function(){var e=n.props,t=e.multiple,r=e.placeholder,o=e.search,a=e.text,s=n.state,l=s.searchQuery,u=s.value,i=s.open,c=t?!(0,C.default)(u):!(0,d.default)(u)&&""!==u,p=(0,Z.default)(r&&!c&&"default","text",o&&l&&"filtered"),f=r;return l?f=null:a?f=a:i&&!t?f=(0,D.default)(n.getSelectedItem(),"text"):c&&(f=(0,D.default)(n.getItemByValue(u),"text")),X.default.createElement("div",{className:p},f)},n.renderHiddenInput=function(){pe("renderHiddenInput()");var e=n.state.value,t=n.props,r=t.multiple,o=t.name,a=t.options,s=t.selection;return pe("name: "+o),pe("selection: "+s),pe("value: "+e),s?X.default.createElement("select",{type:"hidden",name:o,value:e,multiple:r},X.default.createElement("option",{key:"empty",value:""}),(0,c.default)(a,function(e){return X.default.createElement("option",{key:e.value,value:e.value},e.text)})):null},n.renderSearchInput=function(){var e=n.props,t=e.search,r=e.name,o=e.tabIndex,a=n.state.searchQuery;if(!t)return null;var s=void 0;return n._sizer&&a&&(n._sizer.style.display="inline",n._sizer.textContent=a,s=Math.ceil(n._sizer.getBoundingClientRect().width),n._sizer.style.removeProperty("display")),X.default.createElement("input",{value:a,onChange:n.handleSearchChange,className:"search",name:[r,"search"].join("-"),autoComplete:"off",tabIndex:o,style:{width:s},ref:function(e){return n._search=e}})},n.renderSearchSizer=function(){var e=n.props,t=e.search,r=e.multiple;return t&&r?X.default.createElement("span",{className:"sizer",ref:function(e){return n._sizer=e}}):null},n.renderLabels=function(){pe("renderLabels()");var e=n.props,t=e.multiple,r=e.renderLabel,o=n.state,a=o.selectedLabel,s=o.value;if(t&&!(0,C.default)(s)){var l=(0,c.default)(s,n.getItemByValue);return pe("selectedItems",l),(0,c.default)((0,u.default)(l),function(e,t){var o={active:e.value===a,as:"a",key:e.value,onClick:n.handleLabelClick,onRemove:n.handleLabelRemove,value:e.value};return re.default.create(r(e,t,o),o)})}},n.renderOptions=function(){var e=n.props,t=e.multiple,r=e.search,o=e.noResultsMessage,a=n.state,s=a.selectedIndex,l=a.value,u=n.getMenuOptions();if(r&&(0,C.default)(u))return X.default.createElement("div",{className:"message"},o);var i=t?function(e){return(0,z.default)(l,e)}:function(e){return e===l};return(0,c.default)(u,function(e,t){return X.default.createElement(se.default,Y({key:e.value+"-"+t,active:i(e.value),onClick:n.handleItemClick,selected:s===t},e,{style:Y({},e.style,{pointerEvents:"all"})}))})},n.renderMenu=function(){var e=n.props,t=e.children,r=e.header,o=n.state.open,a=o?"visible":"";if(t){var s=$.Children.only(t),l=(0,Z.default)(a,s.props.className);return(0,$.cloneElement)(s,{className:l})}return X.default.createElement(ce.default,{className:a},(0,J.createShorthand)(ue.default,function(e){return{content:e}},r),n.renderOptions())},s=t,a(n,s)}return s(r,t),q(r,[{key:"componentWillMount",value:function(){H(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"componentWillMount",this)&&H(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"componentWillMount",this).call(this),pe("componentWillMount()");var e=this.state,t=e.open,n=e.value;this.setValue(n),t&&this.open()}},{key:"shouldComponentUpdate",value:function(e,t){return!(0,B.default)(e,this.props)||!(0,B.default)(t,this.state)}},{key:"componentWillReceiveProps",value:function(t){if(H(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"componentWillReceiveProps",this).call(this,t),pe("componentWillReceiveProps()"),pe("to props:",(0,J.objectDiff)(this.props,t)),"production"!==e.env.NODE_ENV){var n=Array.isArray(t.value),o=(0,F.default)(t,"value");o&&t.multiple&&!n?console.error("Dropdown `value` must be an array when `multiple` is set."+(" Received type: `"+Object.prototype.toString.call(t.value)+"`.")):o&&!t.multiple&&n&&console.error("Dropdown `value` must not be an array when `multiple` is not set. Either set `multiple={true}` or use a string or number value.")}(0,B.default)(t.value,this.props.value)||(pe("value changed, setting",t.value),this.setValue(t.value)),(0,B.default)(t.options,this.props.options)||this.setSelectedIndex(void 0,t.options)}},{key:"componentDidUpdate",value:function(e,t){pe("componentDidUpdate()"),pe("to state:",(0,J.objectDiff)(t,this.state)),J.isBrowser&&(!t.focus&&this.state.focus?(pe("dropdown focused"),this.isMouseDown||(pe("mouse is not down, opening"),this.open()),this.state.open?(document.addEventListener("keydown",this.moveSelectionOnKeyDown),document.addEventListener("keydown",this.selectItemOnEnter),document.addEventListener("keydown",this.removeItemOnBackspace)):(document.addEventListener("keydown",this.openOnArrow),document.addEventListener("keydown",this.openOnSpace))):t.focus&&!this.state.focus&&(pe("dropdown blurred"),this.isMouseDown||(pe("mouse is not down, closing"),this.close()),document.removeEventListener("keydown",this.openOnArrow),document.removeEventListener("keydown",this.openOnSpace),document.removeEventListener("keydown",this.moveSelectionOnKeyDown),document.removeEventListener("keydown",this.selectItemOnEnter),document.removeEventListener("keydown",this.removeItemOnBackspace)),!t.open&&this.state.open?(pe("dropdown opened"),document.addEventListener("keydown",this.closeOnEscape),document.addEventListener("keydown",this.moveSelectionOnKeyDown),document.addEventListener("keydown",this.selectItemOnEnter),document.addEventListener("keydown",this.removeItemOnBackspace),document.addEventListener("click",this.closeOnDocumentClick),document.removeEventListener("keydown",this.openOnArrow),document.removeEventListener("keydown",this.openOnSpace)):t.open&&!this.state.open&&(pe("dropdown closed"),this.handleClose(),document.removeEventListener("keydown",this.closeOnEscape),document.removeEventListener("keydown",this.moveSelectionOnKeyDown),document.removeEventListener("keydown",this.selectItemOnEnter),document.removeEventListener("keydown",this.removeItemOnBackspace),document.removeEventListener("click",this.closeOnDocumentClick)))}},{key:"componentWillUnmount",value:function(){pe("componentWillUnmount()"),J.isBrowser&&(document.removeEventListener("keydown",this.openOnArrow),document.removeEventListener("keydown",this.openOnSpace),document.removeEventListener("keydown",this.moveSelectionOnKeyDown),document.removeEventListener("keydown",this.selectItemOnEnter),document.removeEventListener("keydown",this.removeItemOnBackspace),document.removeEventListener("keydown",this.closeOnEscape),document.removeEventListener("click",this.closeOnDocumentClick))}},{key:"render",value:function(){var e=this;pe("render()"),pe("props",this.props),pe("state",this.state);var t=this.state.open,n=this.props,o=n.basic,a=n.button,s=n.className,l=n.compact,u=n.fluid,i=n.floating,c=n.icon,p=n.inline,d=n.labeled,f=n.multiple,y=n.pointing,m=n.search,h=n.selection,v=n.simple,b=n.loading,g=n.error,P=n.disabled,T=n.scrolling,O=n.tabIndex,_=n.trigger,E=(0,Z.default)("ui",(0,J.useKeyOnly)(t,"active visible"),(0,J.useKeyOnly)(P,"disabled"),(0,J.useKeyOnly)(g,"error"),(0,J.useKeyOnly)(b,"loading"),(0,J.useKeyOnly)(o,"basic"),(0,J.useKeyOnly)(a,"button"),(0,J.useKeyOnly)(l,"compact"),(0,J.useKeyOnly)(u,"fluid"),(0,J.useKeyOnly)(i,"floating"),(0,J.useKeyOnly)(p,"inline"),(0,J.useKeyOnly)(d,"labeled"),(0,J.useKeyOnly)(f,"multiple"),(0,J.useKeyOnly)(m,"search"),(0,J.useKeyOnly)(h,"selection"),(0,J.useKeyOnly)(v,"simple"),(0,J.useKeyOnly)(T,"scrolling"),(0,J.useKeyOrValueAndKey)(y,"pointing"),s,"dropdown"),j=(0,J.getUnhandledProps)(r,this.props),w=(0,J.getElementType)(r,this.props);return X.default.createElement(w,Y({},j,{className:E,onBlur:this.handleBlur,onClick:this.handleClick,onMouseDown:this.handleMouseDown,onFocus:this.handleFocus,onChange:this.handleChange,tabIndex:P||m?void 0:O,ref:function(t){return e._dropdown=t}}),this.renderHiddenInput(),this.renderLabels(),this.renderSearchInput(),this.renderSearchSizer(),_||this.renderText(),ee.default.create(c),this.renderMenu())}}]),r}(J.AutoControlledComponent);fe.propTypes={allowAdditions:J.customPropTypes.every([J.customPropTypes.demand(["options","selection","search"]),$.PropTypes.bool]),additionPosition:$.PropTypes.oneOf(de.props.additionPosition),additionLabel:$.PropTypes.oneOfType([$.PropTypes.element,$.PropTypes.string]),as:J.customPropTypes.as,basic:$.PropTypes.bool,button:$.PropTypes.bool,children:J.customPropTypes.every([J.customPropTypes.disallow(["options","selection"]),J.customPropTypes.givenProps({children:$.PropTypes.any.isRequired},X.default.PropTypes.element.isRequired)]),className:$.PropTypes.string,compact:$.PropTypes.bool,defaultOpen:$.PropTypes.bool,defaultSelectedLabel:J.customPropTypes.every([J.customPropTypes.demand(["multiple"]),$.PropTypes.oneOfType([$.PropTypes.string,$.PropTypes.number])]),defaultValue:$.PropTypes.oneOfType([$.PropTypes.string,$.PropTypes.number,$.PropTypes.arrayOf($.PropTypes.oneOfType([$.PropTypes.string,$.PropTypes.number]))]),disabled:$.PropTypes.bool,error:$.PropTypes.bool,floating:$.PropTypes.bool,fluid:$.PropTypes.bool,header:$.PropTypes.node,icon:$.PropTypes.oneOfType([$.PropTypes.node,$.PropTypes.object]),inline:$.PropTypes.bool,labeled:$.PropTypes.bool,loading:$.PropTypes.bool,multiple:$.PropTypes.bool,name:$.PropTypes.string,noResultsMessage:$.PropTypes.string,onAddItem:$.PropTypes.func,onBlur:$.PropTypes.func,onChange:$.PropTypes.func,onClose:$.PropTypes.func,onLabelClick:$.PropTypes.func,onOpen:$.PropTypes.func,onSearchChange:$.PropTypes.func,onClick:$.PropTypes.func,onFocus:$.PropTypes.func,onMouseDown:$.PropTypes.func,open:$.PropTypes.bool,options:J.customPropTypes.every([J.customPropTypes.disallow(["children"]),$.PropTypes.arrayOf($.PropTypes.shape(se.default.propTypes))]),placeholder:$.PropTypes.string,pointing:$.PropTypes.oneOfType([$.PropTypes.bool,$.PropTypes.oneOf(de.props.pointing)]),renderLabel:$.PropTypes.func,scrolling:$.PropTypes.bool,search:$.PropTypes.oneOfType([$.PropTypes.bool,$.PropTypes.func]),selectedLabel:J.customPropTypes.every([J.customPropTypes.demand(["multiple"]),$.PropTypes.oneOfType([$.PropTypes.string,$.PropTypes.number])]),selection:J.customPropTypes.every([J.customPropTypes.disallow(["children"]),J.customPropTypes.demand(["options"]),$.PropTypes.bool]),selectOnBlur:$.PropTypes.bool,simple:$.PropTypes.bool,tabIndex:$.PropTypes.string,text:$.PropTypes.string,trigger:J.customPropTypes.every([J.customPropTypes.disallow(["selection","text"]),$.PropTypes.node]),value:$.PropTypes.oneOfType([$.PropTypes.string,$.PropTypes.number,$.PropTypes.arrayOf($.PropTypes.oneOfType([$.PropTypes.string,$.PropTypes.number]))])},fe.defaultProps={additionLabel:"Add ",additionPosition:"top",icon:"dropdown",noResultsMessage:"No results found.",renderLabel:function(e){var t=e.text;return t},selectOnBlur:!0,tabIndex:"0"},fe.autoControlledProps=["open","value","selectedLabel"],fe._meta=de,fe.Divider=oe.default,fe.Header=ue.default,fe.Item=se.default,fe.Menu=ce.default,t.default=fe}).call(t,r(/*! ./~/process/browser.js */35))},/*!************************************!*\
!*** ./src/modules/Embed/Embed.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(/*! classnames */3),c=n(i),p=r(/*! react */1),d=n(p),f=r(/*! ../../lib */2),y=r(/*! ../../elements/Icon */8),m=n(y),h={name:"Embed",type:f.META.TYPES.MODULE,props:{aspectRatio:["4:3","16:9","21:9"],source:["youtube","vimeo"]}},v=function(e){function t(){var e,r,n,s;o(this,t);for(var u=arguments.length,i=Array(u),c=0;c<u;c++)i[c]=arguments[c];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),n.state={},n.handleClick=function(e){var t=n.props.onClick,r=n.state.active;t&&t(e,l({},n.props,{active:!0})),r||n.trySetState({active:!0})},s=r,a(n,s)}return s(t,e),u(t,[{key:"getSrc",value:function(){var e=this.props,t=e.autoplay,r=void 0===t||t,n=e.brandedUI,o=void 0!==n&&n,a=e.color,s=void 0===a?"#444444":a,l=e.hd,u=void 0===l||l,i=e.id,c=e.source,p=e.url;return"youtube"===c?["//www.youtube.com/embed/"+i,"?autohide=true","&autoplay="+r,"&color="+encodeURIComponent(s),"&hq="+u,"&jsapi=false","&modestbranding="+o].join(""):"vimeo"===c?["//player.vimeo.com/video/"+i,"?api=false","&autoplay="+r,"&byline=false","&color="+encodeURIComponent(s),"&portrait=false","&title=false"].join(""):p}},{key:"render",value:function(){var e=this.props,r=e.aspectRatio,n=e.className,o=e.icon,a=e.placeholder,s=this.state.active,u=(0,c.default)("ui",r,(0,f.useKeyOnly)(s,"active"),"embed",n),i=(0,f.getUnhandledProps)(t,this.props),p=(0,f.getElementType)(t,this.props);return d.default.createElement(p,l({},i,{className:u,onClick:this.handleClick}),m.default.create(o),a&&d.default.createElement("img",{className:"placeholder",src:a}),this.renderEmbed())}},{key:"renderEmbed",value:function(){var e=this.props.children,t=this.state.active;return t?e?d.default.createElement("div",{className:"embed"},e):d.default.createElement("div",{className:"embed"},d.default.createElement("iframe",{allowFullScreen:"",frameBorder:"0",height:"100%",scrolling:"no",src:this.getSrc(),width:"100%"})):null}}]),t}(f.AutoControlledComponent);v.autoControlledProps=["active"],v.defaultProps={icon:"video play"},v._meta=h,v.propTypes={as:f.customPropTypes.as,active:p.PropTypes.bool,autoplay:f.customPropTypes.every([f.customPropTypes.demand(["source"]),p.PropTypes.bool]),aspectRatio:p.PropTypes.oneOf(h.props.aspectRatio),brandedUI:f.customPropTypes.every([f.customPropTypes.demand(["source"]),p.PropTypes.bool]),children:p.PropTypes.node,className:p.PropTypes.string,color:f.customPropTypes.every([f.customPropTypes.demand(["source"]),p.PropTypes.string]),defaultActive:p.PropTypes.bool,hd:f.customPropTypes.every([f.customPropTypes.demand(["source"]),p.PropTypes.bool]),id:f.customPropTypes.every([f.customPropTypes.demand(["source"]),p.PropTypes.string]),icon:f.customPropTypes.itemShorthand,onClick:p.PropTypes.func,placeholder:p.PropTypes.string,source:f.customPropTypes.every([f.customPropTypes.disallow(["sourceUrl"]),p.PropTypes.oneOf(h.props.source)]),url:f.customPropTypes.every([f.customPropTypes.disallow(["source"]),p.PropTypes.string])},t.default=v},/*!************************************!*\
!*** ./src/modules/Embed/index.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Embed */336),a=n(o);t.default=a.default},/*!************************************!*\
!*** ./src/modules/Modal/Modal.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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)}Object.defineProperty(t,"__esModule",{value:!0});var l=r(/*! lodash/pick */79),u=n(l),i=r(/*! lodash/omit */78),c=n(i),p=r(/*! lodash/keys */10),d=n(p),f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},y=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),m=r(/*! react */1),h=n(m),v=r(/*! classnames */3),b=n(v),g=r(/*! ./ModalHeader */192),P=n(g),T=r(/*! ./ModalContent */190),O=n(T),_=r(/*! ./ModalActions */189),E=n(_),j=r(/*! ./ModalDescription */191),w=n(j),S=r(/*! ../../elements/Icon */8),M=n(S),x=r(/*! ../../addons/Portal */44),N=n(x),A=r(/*! ../../lib */2),C=(0,A.makeDebugger)("modal"),k={name:"Modal",type:A.META.TYPES.MODULE,props:{size:["fullscreen","large","small"],dimmer:["inverted","blurring"]}},I=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.state={},n.handleClose=function(e){C("close()");var t=n.props.onClose;t&&t(e,n.props),n.trySetState({open:!1})},n.handleOpen=function(e){C("open()");var t=n.props.onOpen;t&&t(e,n.props),n.trySetState({open:!0})},n.handlePortalMount=function(e){C("handlePortalMount()");var t=n.props,r=t.dimmer,o=t.mountNode;r&&(C("adding dimmer"),o.classList.add("dimmable","dimmed"),"blurring"===r&&(C("adding blurred dimmer"),o.classList.add("blurring"))),n.setPosition();var a=n.props.onMount;a&&a(e,n.props)},n.handlePortalUnmount=function(e){C("handlePortalUnmount()");var t=n.props.mountNode;t.classList.remove("blurring","dimmable","dimmed","scrollable"),cancelAnimationFrame(n.animationRequestId);var r=n.props.onUnmount;r&&r(e,n.props)},n.setPosition=function(){if(n._modalNode){var e=n.props.mountNode,t=n._modalNode.getBoundingClientRect(),r=t.height,o=-Math.round(r/2),a=r>=window.innerHeight,s={};n.state.marginTop!==o&&(s.marginTop=o),n.state.scrolling!==a&&(s.scrolling=a,a?e.classList.add("scrolling"):e.classList.remove("scrolling")),Object.keys(s).length>0&&n.setState(s)}n.animationRequestId=requestAnimationFrame(n.setPosition)},s=r,a(n,s)}return s(t,e),y(t,[{key:"componentWillUnmount",value:function(){C("componentWillUnmount()"),this.handlePortalUnmount()}},{key:"render",value:function(){var e=this,r=this.state.open,n=this.props,o=n.basic,a=n.children,s=n.className,l=n.closeIcon,i=n.dimmer,p=n.mountNode,y=n.size;if(!A.isBrowser)return null;var m=this.state,v=m.marginTop,g=m.scrolling,P=(0,b.default)("ui",y,(0,A.useKeyOnly)(o,"basic"),(0,A.useKeyOnly)(g,"scrolling"),"modal transition visible active",s),T=(0,A.getUnhandledProps)(t,this.props),O=(0,d.default)(N.default.propTypes),_=(0,c.default)(T,O),E=(0,u.default)(T,O),j=(0,A.getElementType)(t,this.props),w=l===!0?"close":l,S=h.default.createElement(j,f({},_,{className:P,style:{marginTop:v},ref:function(t){return e._modalNode=t}}),M.default.create(w,{onClick:this.handleClose}),a),x=i?(0,b.default)("ui","inverted"===i&&"inverted","page modals dimmer transition visible active"):null;return h.default.createElement(N.default,f({closeOnRootNodeClick:!0,closeOnDocumentClick:!1},E,{className:x,mountNode:p,onClose:this.handleClose,onMount:this.handlePortalMount,onOpen:this.handleOpen,onUnmount:this.handlePortalUnmount,open:r}),S)}}]),t}(A.AutoControlledComponent);I.propTypes={as:A.customPropTypes.as,children:m.PropTypes.node,className:m.PropTypes.string,closeIcon:m.PropTypes.oneOfType([m.PropTypes.node,m.PropTypes.object,m.PropTypes.bool]),basic:m.PropTypes.bool,defaultOpen:m.PropTypes.bool,dimmer:m.PropTypes.oneOfType([m.PropTypes.bool,m.PropTypes.oneOf(k.props.dimmer)]),mountNode:m.PropTypes.any,onClose:m.PropTypes.func,onMount:m.PropTypes.func,onOpen:m.PropTypes.func,onUnmount:m.PropTypes.func,open:m.PropTypes.bool,size:m.PropTypes.oneOf(k.props.size)},I.defaultProps={dimmer:!0,mountNode:A.isBrowser?document.body:null},I.autoControlledProps=["open"],I._meta=k,I.Header=P.default,I.Content=O.default,I.Description=w.default,I.Actions=E.default,t.default=I},/*!************************************!*\
!*** ./src/modules/Popup/Popup.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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)}Object.defineProperty(t,"__esModule",{value:!0});var l=r(/*! lodash/pick */79),u=n(l),i=r(/*! lodash/omit */78),c=n(i),p=r(/*! lodash/keys */10),d=n(p),f=r(/*! lodash/assign */481),y=n(f),m=r(/*! lodash/mapValues */516),h=n(m),v=r(/*! lodash/isNumber */271),b=n(v),g=r(/*! lodash/includes */74),P=n(g),T=r(/*! lodash/without */7),O=n(T),_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},E=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),j=r(/*! react */1),w=n(j),S=r(/*! classnames */3),M=n(S),x=r(/*! ../../lib */2),N=r(/*! ../../addons/Portal */44),A=n(N),C=r(/*! ./PopupContent */194),k=n(C),I=r(/*! ./PopupHeader */195),K=n(I),L=(0,x.makeDebugger)("popup"),U={name:"Popup",type:x.META.TYPES.MODULE,props:{on:["hover","click","focus"],positioning:["top left","top right","bottom right","bottom left","right center","left center","top center","bottom center"],size:(0,O.default)(x.SUI.SIZES,"medium","big","massive"),wide:[!0,!1,"very"]}},D=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.state={},n.hideOnScroll=function(e){n.setState({closed:!0}),window.removeEventListener("scroll",n.hideOnScroll),setTimeout(function(){return n.setState({closed:!1})},50)},n.handleClose=function(e){L("handleClose()");var t=n.props.onClose;t&&t(e,n.props)},n.handleOpen=function(e){L("handleOpen()"),n.coords=e.currentTarget.getBoundingClientRect();var t=n.props.onOpen;t&&t(e,n.props)},n.handlePortalMount=function(e){L("handlePortalMount()"),n.props.hideOnScroll&&window.addEventListener("scroll",n.hideOnScroll);var t=n.props.onMount;t&&t(e,n.props)},n.handlePortalUnmount=function(e){L("handlePortalUnmount()");var t=n.props.onUnmount;t&&t(e,n.props)},n.popupMounted=function(e){L("popupMounted()"),n.popupCoords=e?e.getBoundingClientRect():null,n.setPopupStyle()},s=r,a(n,s)}return s(t,e),E(t,[{key:"computePopupStyle",value:function(e){var t={position:"absolute"};if(!x.isBrowser)return t;var r=this.props.offset,n=window,o=n.pageYOffset,a=n.pageXOffset,s=document.documentElement,l=s.clientWidth,u=s.clientHeight;if((0,P.default)(e,"right"))t.right=Math.round(l-(this.coords.right+a)),t.left="auto";else if((0,P.default)(e,"left"))t.left=Math.round(this.coords.left+a),t.right="auto";else{var i=(this.coords.width-this.popupCoords.width)/2;t.left=Math.round(this.coords.left+i+a),t.right="auto"}if((0,P.default)(e,"top"))t.bottom=Math.round(u-(this.coords.top+o)),t.top="auto";else if((0,P.default)(e,"bottom"))t.top=Math.round(this.coords.bottom+o),t.bottom="auto";else{var c=(this.coords.height+this.popupCoords.height)/2;t.top=Math.round(this.coords.bottom+o-c),t.bottom="auto";var p=this.popupCoords.width+8;(0,P.default)(e,"right")?t.right-=p:t.left-=p}return r&&((0,b.default)(t.right)?t.right-=r:t.left-=r),t}},{key:"isStyleInViewport",value:function(e){var t=window,r=t.pageYOffset,n=t.pageXOffset,o=document.documentElement,a=o.clientWidth,s=o.clientHeight,l={top:e.top,left:e.left,width:this.popupCoords.width,height:this.popupCoords.height};return(0,b.default)(e.right)&&(l.left=a-e.right-l.width),(0,b.default)(e.bottom)&&(l.top=s-e.bottom-l.height),!(l.top<r)&&(!(l.top+l.height>r+s)&&(!(l.left<n)&&!(l.left+l.width>n+a)))}},{key:"setPopupStyle",value:function(){if(this.coords&&this.popupCoords){for(var e=this.props.positioning,t=this.computePopupStyle(e),r=(0,O.default)(U.props.positioning,e),n=0;!this.isStyleInViewport(t)&&n<r.length;n++)t=this.computePopupStyle(r[n]),e=r[n];t=(0,h.default)(t,function(e){return(0,b.default)(e)?e+"px":e}),this.setState({style:t,positioning:e})}}},{key:"getPortalProps",value:function(){var e={},t=this.props,r=t.on,n=t.hoverable;return n&&(e.closeOnPortalMouseLeave=!0,e.mouseLeaveDelay=300),"click"===r?(e.openOnTriggerClick=!0,e.closeOnTriggerClick=!0,e.closeOnDocumentClick=!0):"focus"===r?(e.openOnTriggerFocus=!0,e.closeOnTriggerBlur=!0):"hover"===r&&(e.openOnTriggerMouseOver=!0,e.closeOnTriggerMouseLeave=!0,e.mouseLeaveDelay=70,e.mouseOverDelay=50),e}},{key:"render",value:function(){var e=this.props,r=e.basic,n=e.children,o=e.className,a=e.content,s=e.flowing,l=e.header,i=e.inverted,p=e.size,f=e.trigger,m=e.wide,h=this.state,v=h.positioning,b=h.closed,g=(0,y.default)({},this.state.style,this.props.style),P=(0,M.default)("ui",v,p,(0,x.useKeyOrValueAndKey)(m,"wide"),(0,x.useKeyOnly)(r,"basic"),(0,x.useKeyOnly)(s,"flowing"),(0,x.useKeyOnly)(i,"inverted"),"popup transition visible",o);if(b)return f;var T=(0,x.getUnhandledProps)(t,this.props),O=(0,d.default)(A.default.propTypes),E=(0,c.default)(T,O),j=(0,u.default)(T,O),S=(0,x.getElementType)(t,this.props),N=w.default.createElement(S,_({},E,{className:P,style:g,ref:this.popupMounted}),n,!n&&K.default.create(l),!n&&k.default.create(a)),C=_({},this.getPortalProps(),j);return L("portal props:",C),w.default.createElement(A.default,_({},C,{trigger:f,onClose:this.handleClose,onMount:this.handlePortalMount,onOpen:this.handleOpen,onUnmount:this.handlePortalUnmount}),N)}}]),t}(j.Component);D.propTypes={basic:j.PropTypes.bool,children:j.PropTypes.node,className:j.PropTypes.string,content:j.PropTypes.node,flowing:j.PropTypes.bool,header:j.PropTypes.string,hoverable:j.PropTypes.bool,inverted:j.PropTypes.bool,hideOnScroll:j.PropTypes.bool,offset:j.PropTypes.number,on:j.PropTypes.oneOf(U.props.on),onClose:j.PropTypes.func,onMount:j.PropTypes.func,onOpen:j.PropTypes.func,onUnmount:j.PropTypes.func,positioning:j.PropTypes.oneOf(U.props.positioning),size:j.PropTypes.oneOf(U.props.size),style:j.PropTypes.object,trigger:j.PropTypes.node,wide:j.PropTypes.oneOf(U.props.wide)},D.defaultProps={positioning:"top left",on:"hover"},D._meta=U,D.Content=k.default,D.Header=K.default,t.default=D},/*!************************************!*\
!*** ./src/modules/Popup/index.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Popup */339),a=n(o);t.default=a.default},/*!******************************************!*\
!*** ./src/modules/Progress/Progress.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.active,r=e.attached,n=e.autoSuccess,a=e.color,s=e.children,l=e.className,i=e.disabled,p=e.error,f=e.indicating,h=e.inverted,b=e.label,T=e.percent,O=e.precision,_=e.progress,E=e.size,j=e.success,w=e.total,S=e.value,M=e.warning,x=n&&(T>=100||S>=w),N=_||b||!(0,y.default)(O)||!(0,d.default)([w,S],y.default),A=void 0;(0,y.default)(T)?(0,y.default)(w)||(0,y.default)(S)||(A=S/w*100):A=T,A=(0,c.default)(A,0,100),(0,y.default)(O)||(A=(0,u.default)(A,O));var C=void 0;"percent"===b||b===!0||(0,y.default)(b)?C=A+"%":"ratio"===b&&(C=S+"/"+w);var k=(0,v.default)("ui",E,a,(0,P.useKeyOnly)(t||f,"active"),(0,P.useKeyOnly)(x||j,"success"),(0,P.useKeyOnly)(M,"warning"),(0,P.useKeyOnly)(p,"error"),(0,P.useKeyOnly)(i,"disabled"),(0,P.useKeyOnly)(f,"indicating"),(0,P.useKeyOnly)(h,"inverted"),(0,P.useValueAndKey)(r,"attached"),l,"progress"),I=(0,P.getUnhandledProps)(o,e),K=(0,P.getElementType)(o,e);return g.default.createElement(K,m({},I,{className:k}),g.default.createElement("div",{className:"bar",style:{width:A+"%"}},N&&g.default.createElement("div",{className:"progress"},C)),s&&g.default.createElement("div",{className:"label"},s))}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/without */7),s=n(a),l=r(/*! lodash/round */523),u=n(l),i=r(/*! lodash/clamp */482),c=n(i),p=r(/*! lodash/every */264),d=n(p),f=r(/*! lodash/isUndefined */133),y=n(f),m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},h=r(/*! classnames */3),v=n(h),b=r(/*! react */1),g=n(b),P=r(/*! ../../lib */2);o._meta={name:"Progress",type:P.META.TYPES.MODULE,props:{attached:["top","bottom"],color:P.SUI.COLORS,label:["ratio","percent"],size:(0,s.default)(P.SUI.SIZES,"mini","huge","massive")}},o.propTypes={as:P.customPropTypes.as,active:b.PropTypes.bool,attached:b.PropTypes.oneOf(o._meta.props.attached),autoSuccess:b.PropTypes.bool,color:b.PropTypes.oneOf(o._meta.props.color),children:b.PropTypes.node,className:b.PropTypes.string,disabled:b.PropTypes.bool,error:b.PropTypes.bool,indicating:b.PropTypes.bool,inverted:b.PropTypes.bool,label:P.customPropTypes.every([P.customPropTypes.some([P.customPropTypes.demand(["percent"]),P.customPropTypes.demand(["total","value"])]),b.PropTypes.oneOfType([b.PropTypes.bool,b.PropTypes.oneOf(o._meta.props.label)])]),percent:P.customPropTypes.every([P.customPropTypes.disallow(["total","value"]),b.PropTypes.oneOfType([b.PropTypes.string,b.PropTypes.number])]),progress:b.PropTypes.bool,precision:b.PropTypes.number,size:b.PropTypes.oneOf(o._meta.props.size),success:b.PropTypes.bool,total:P.customPropTypes.every([P.customPropTypes.demand(["value"]),P.customPropTypes.disallow(["percent"]),b.PropTypes.oneOfType([b.PropTypes.string,b.PropTypes.number])]),value:P.customPropTypes.every([P.customPropTypes.demand(["total"]),P.customPropTypes.disallow(["percent"]),b.PropTypes.oneOfType([b.PropTypes.string,b.PropTypes.number])]),warning:b.PropTypes.bool},t.default=o},/*!***************************************!*\
!*** ./src/modules/Progress/index.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Progress */341),a=n(o);t.default=a.default},/*!**************************************!*\
!*** ./src/modules/Rating/Rating.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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)}Object.defineProperty(t,"__esModule",{value:!0});var l=r(/*! lodash/times */280),u=n(l),i=r(/*! lodash/invoke */269),c=n(i),p=r(/*! lodash/without */7),d=n(p),f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},y=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),m=r(/*! classnames */3),h=n(m),v=r(/*! react */1),b=n(v),g=r(/*! ../../lib */2),P=r(/*! ./RatingIcon */196),T=n(P),O={name:"Rating",type:g.META.TYPES.MODULE,props:{clearable:["auto"],icon:["star","heart"],size:(0,d.default)(g.SUI.SIZES,"medium","big")}},_=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),E.call(n),s=r,a(n,s)}return s(t,e),y(t,[{key:"render",value:function(){var e=this,r=this.props,n=r.className,o=r.disabled,a=r.icon,s=r.maxRating,l=r.size,i=this.state,c=i.rating,p=i.selectedIndex,d=i.isSelecting,y=(0,h.default)("ui",a,l,(0,g.useKeyOnly)(o,"disabled"),(0,g.useKeyOnly)(d&&!o&&p>=0,"selected"),"rating",n),m=(0,g.getUnhandledProps)(t,this.props),v=(0,g.getElementType)(t,this.props);return b.default.createElement(v,f({},m,{className:y,role:"radiogroup",onMouseLeave:this.handleMouseLeave}),(0,u.default)(s,function(t){return b.default.createElement(T.default,{active:c>=t+1,index:t,key:t,"aria-checked":c===t+1,"aria-posinset":t+1,"aria-setsize":s,onClick:e.handleIconClick,onMouseEnter:e.handleIconMouseEnter,selected:p>=t&&d})}))}}]),t}(g.AutoControlledComponent);_.autoControlledProps=["rating"],_.defaultProps={clearable:"auto",maxRating:1},_.propTypes={as:g.customPropTypes.as,className:v.PropTypes.string,clearable:v.PropTypes.oneOfType([v.PropTypes.oneOf(O.props.clearable),v.PropTypes.bool]),defaultRating:v.PropTypes.oneOfType([v.PropTypes.string,v.PropTypes.number]),disabled:v.PropTypes.bool,icon:v.PropTypes.oneOf(O.props.icon),maxRating:v.PropTypes.oneOfType([v.PropTypes.string,v.PropTypes.number]),onRate:v.PropTypes.func,rating:v.PropTypes.oneOfType([v.PropTypes.string,v.PropTypes.number]),size:v.PropTypes.oneOf(O.props.size)},_._meta=O,_.Icon=T.default;var E=function(){var e=this;this.handleIconClick=function(t,r){var n=r.index,o=e.props,a=o.clearable,s=o.disabled,l=o.maxRating,u=o.onRate,i=e.state.rating;if(!s){var c=n+1;"auto"===a&&1===l?c=+!i:a===!0&&c===i&&(c=0),e.trySetState({rating:c},{isSelecting:!1}),u&&u(t,f({},e.props,{rating:c}))}},this.handleIconMouseEnter=function(t,r){var n=r.index;e.props.disabled||e.setState({selectedIndex:n,isSelecting:!0})},this.handleMouseLeave=function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];c.default.apply(void 0,[e.props,"onMouseLeave"].concat(r)),e.props.disabled||e.setState({selectedIndex:-1,isSelecting:!1})}};t.default=_},/*!*************************************!*\
!*** ./src/modules/Rating/index.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Rating */343),a=n(o);t.default=a.default},/*!**************************************!*\
!*** ./src/modules/Search/Search.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(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 u=r(/*! lodash/isEmpty */129),i=n(u),c=r(/*! lodash/partialRight */520),p=n(c),d=r(/*! lodash/inRange */513),f=n(d),y=r(/*! lodash/map */9),m=n(y),h=r(/*! lodash/get */34),v=n(h),b=r(/*! lodash/reduce */276),g=n(b),P=r(/*! lodash/isEqual */130),T=n(P),O=r(/*! lodash/without */7),_=n(O),E=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},j=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),w=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var s=o.get;if(void 0!==s)return s.call(n)},S=r(/*! classnames */3),M=n(S),x=r(/*! react */1),N=n(x),A=r(/*! ../../lib */2),C=r(/*! ../../elements/Input */85),k=n(C),I=r(/*! ./SearchCategory */197),K=n(I),L=r(/*! ./SearchResult */198),U=n(L),D=r(/*! ./SearchResults */199),R=n(D),z=(0,A.makeDebugger)("search"),W={name:"Search",type:A.META.TYPES.MODULE,props:{size:(0,_.default)(A.SUI.SIZES,"medium")}},F=function(e){function t(){var e,r,n,l;a(this,t);for(var u=arguments.length,c=Array(u),d=0;d<u;d++)c[d]=arguments[d];return r=n=s(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),n.handleResultSelect=function(e,t){z("handleResultSelect()"),z(t);var r=n.props.onResultSelect;r&&r(e,t)},n.closeOnEscape=function(e){A.keyboardKey.getCode(e)===A.keyboardKey.Escape&&(e.preventDefault(),n.close())},n.moveSelectionOnKeyDown=function(e){switch(z("moveSelectionOnKeyDown()"),z(A.keyboardKey.getName(e)),A.keyboardKey.getCode(e)){case A.keyboardKey.ArrowDown:e.preventDefault(),n.moveSelectionBy(1);break;case A.keyboardKey.ArrowUp:e.preventDefault(),n.moveSelectionBy(-1)}},n.selectItemOnEnter=function(e){if(z("selectItemOnEnter()"),z(A.keyboardKey.getName(e)),A.keyboardKey.getCode(e)===A.keyboardKey.Enter){e.preventDefault();var t=n.getSelectedResult();t&&(n.setValue(t.title),n.handleResultSelect(e,t),n.close())}},n.closeOnDocumentClick=function(e){z("closeOnDocumentClick()"),z(e),n.close()},n.handleMouseDown=function(e){z("handleMouseDown()");var t=n.props.onMouseDown;t&&t(e,n.props),n.isMouseDown=!0,A.isBrowser&&document.addEventListener("mouseup",n.handleDocumentMouseUp)},n.handleDocumentMouseUp=function(){z("handleDocumentMouseUp()"),n.isMouseDown=!1,A.isBrowser&&document.removeEventListener("mouseup",n.handleDocumentMouseUp)},n.handleInputClick=function(e){z("handleInputClick()",e),e.nativeEvent.stopImmediatePropagation(),n.tryOpen()},n.handleItemClick=function(e,t){var r=t.id;z("handleItemClick()"),z(r);var o=n.getSelectedResult(r);e.nativeEvent.stopImmediatePropagation(),n.setValue(o.title),n.handleResultSelect(e,o),n.close()},n.handleFocus=function(e){z("handleFocus()");var t=n.props.onFocus;t&&t(e,n.props),n.setState({focus:!0})},n.handleBlur=function(e){z("handleBlur()");var t=n.props.onBlur;t&&t(e,n.props),n.setState({focus:!1})},n.handleSearchChange=function(e){z("handleSearchChange()"),z(e.target.value),e.stopPropagation();var t=n.props,r=t.onSearchChange,o=t.minCharacters,a=n.state.open,s=e.target.value;r&&r(e,s),s.length<o?n.close():a||n.tryOpen(s),n.setValue(s)},n.getFlattenedResults=function(){var e=n.props,t=e.category,r=e.results;return t?(0,g.default)(r,function(e,t){return e.concat(t.results)},[]):r},n.getSelectedResult=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.state.selectedIndex,t=n.getFlattenedResults();return(0,v.default)(t,e)},n.setValue=function(e){z("setValue()"),z("value",e);var t=n.props.selectFirstResult;n.trySetState({value:e},{selectedIndex:t?0:-1})},n.moveSelectionBy=function(e){z("moveSelectionBy()"),z("offset: "+e);var t=n.state.selectedIndex,r=n.getFlattenedResults(),o=r.length-1,a=t+e;a>o?a=0:a<0&&(a=o),n.setState({selectedIndex:a}),n.scrollSelectedItemIntoView()},n.scrollSelectedItemIntoView=function(){if(z("scrollSelectedItemIntoView()"),A.isBrowser){var e=document.querySelector(".ui.search.active.visible .results.visible"),t=e.querySelector(".result.active");z("menu (results): "+e),z("item (result): "+t);var r=t.offsetTop<e.scrollTop,n=t.offsetTop+t.clientHeight>e.scrollTop+e.clientHeight;r?e.scrollTop=t.offsetTop:n&&(e.scrollTop=t.offsetTop+t.clientHeight-e.clientHeight)}},n.tryOpen=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.state.value;z("open()");var t=n.props.minCharacters;e.length<t||n.open()},n.open=function(){z("open()"),n.trySetState({open:!0})},n.close=function(){z("close()"),n.trySetState({open:!1})},n.renderSearchInput=function(){var e=n.props,t=e.icon,r=e.placeholder,o=n.state.value;return N.default.createElement(k.default,{value:o,placeholder:r,onBlur:n.handleBlur,onChange:n.handleSearchChange,onFocus:n.handleFocus,onClick:n.handleInputClick,input:{className:"prompt",tabIndex:"0",autoComplete:"off"},icon:t})},n.renderNoResults=function(){var e=n.props,t=e.noResultsMessage,r=e.noResultsDescription;return N.default.createElement("div",{className:"message empty"},N.default.createElement("div",{className:"header"},t),r&&N.default.createElement("div",{className:"description"},r))},n.renderResult=function(e,t,r){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=e.childKey,l=o(e,["childKey"]),u=n.props.resultRenderer,i=n.state.selectedIndex,c=t+a;return N.default.createElement(U.default,E({key:s||l.title,active:i===c,onClick:n.handleItemClick,renderer:u},l,{id:c}))},n.renderResults=function(){var e=n.props.results;return(0,m.default)(e,n.renderResult)},n.renderCategories=function(){var e=n.props,t=e.categoryRenderer,r=e.results,a=n.state.selectedIndex,s=0;return(0,m.default)(r,function(e,r,l){var u=e.childKey,i=o(e,["childKey"]),c=E({key:u||i.name,active:(0,f.default)(a,s,s+i.results.length),renderer:t},i),d=(0,p.default)(n.renderResult,s);return s+=i.results.length,N.default.createElement(K.default,c,i.results.map(d))})},n.renderMenuContent=function(){var e=n.props,t=e.category,r=e.showNoResults,o=e.results;return(0,i.default)(o)?r?n.renderNoResults():null:t?n.renderCategories():n.renderResults()},n.renderResultsMenu=function(){var e=n.state.open,t=e?"visible":"",r=n.renderMenuContent();if(r)return N.default.createElement(R.default,{className:t},r)},l=r,s(n,l)}return l(t,e),j(t,[{key:"componentWillMount",value:function(){w(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentWillMount",this)&&w(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentWillMount",this).call(this),z("componentWillMount()");var e=this.state,r=e.open,n=e.value;this.setValue(n),r&&this.open()}},{key:"shouldComponentUpdate",value:function(e,t){return!(0,T.default)(e,this.props)||!(0,T.default)(t,this.state)}},{key:"componentWillReceiveProps",value:function(e){w(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentWillReceiveProps",this).call(this,e),z("componentWillReceiveProps()"),z("changed props:",(0,A.objectDiff)(e,this.props)),(0,T.default)(e.value,this.props.value)||(z("value changed, setting",e.value),this.setValue(e.value))}},{key:"componentDidUpdate",value:function(e,t){z("componentDidUpdate()"),z("to state:",(0,A.objectDiff)(t,this.state)),A.isBrowser&&(!t.focus&&this.state.focus?(z("search focused"),this.isMouseDown||(z("mouse is not down, opening"),this.tryOpen()),this.state.open&&(document.addEventListener("keydown",this.moveSelectionOnKeyDown),document.addEventListener("keydown",this.selectItemOnEnter))):t.focus&&!this.state.focus&&(z("search blurred"),this.isMouseDown||(z("mouse is not down, closing"),this.close()),document.removeEventListener("keydown",this.moveSelectionOnKeyDown),document.removeEventListener("keydown",this.selectItemOnEnter)),!t.open&&this.state.open?(z("search opened"),this.open(),document.addEventListener("keydown",this.closeOnEscape),document.addEventListener("keydown",this.moveSelectionOnKeyDown),document.addEventListener("keydown",this.selectItemOnEnter),document.addEventListener("click",this.closeOnDocumentClick)):t.open&&!this.state.open&&(z("search closed"),this.close(),document.removeEventListener("keydown",this.closeOnEscape),document.removeEventListener("keydown",this.moveSelectionOnKeyDown),document.removeEventListener("keydown",this.selectItemOnEnter),document.removeEventListener("click",this.closeOnDocumentClick)))}},{key:"componentWillUnmount",value:function(){z("componentWillUnmount()"),A.isBrowser&&(document.removeEventListener("keydown",this.moveSelectionOnKeyDown),document.removeEventListener("keydown",this.selectItemOnEnter),document.removeEventListener("keydown",this.closeOnEscape),document.removeEventListener("click",this.closeOnDocumentClick))}},{key:"render",value:function(){z("render()"),z("props",this.props),z("state",this.state);var e=this.state,r=e.searchClasses,n=e.focus,o=e.open,a=this.props,s=a.aligned,l=a.category,u=a.className,i=a.fluid,c=a.loading,p=a.size,d=(0,M.default)("ui",o&&"active visible",p,r,(0,A.useKeyOnly)(c,"loading"),(0,A.useValueAndKey)(s,"aligned"),(0,A.useKeyOnly)(l,"category"),(0,A.useKeyOnly)(n,"focus"),(0,A.useKeyOnly)(i,"fluid"),u,"search"),f=(0,A.getUnhandledProps)(t,this.props),y=(0,A.getElementType)(t,this.props);return N.default.createElement(y,E({},f,{className:d,onBlur:this.handleBlur,onFocus:this.handleFocus,onMouseDown:this.handleMouseDown}),this.renderSearchInput(),this.renderResultsMenu())}}]),t}(A.AutoControlledComponent);F.propTypes={as:A.customPropTypes.as,icon:x.PropTypes.oneOfType([x.PropTypes.node,x.PropTypes.object]),results:x.PropTypes.oneOfType([x.PropTypes.arrayOf(x.PropTypes.shape(U.default.propTypes)),x.PropTypes.object]),open:x.PropTypes.bool,defaultOpen:x.PropTypes.bool,value:x.PropTypes.string,defaultValue:x.PropTypes.string,placeholder:x.PropTypes.string,minCharacters:x.PropTypes.number,noResultsMessage:x.PropTypes.string,noResultsDescription:x.PropTypes.string,selectFirstResult:x.PropTypes.bool,showNoResults:x.PropTypes.bool,categoryRenderer:x.PropTypes.func,resultRenderer:x.PropTypes.func,onBlur:x.PropTypes.func,onResultSelect:x.PropTypes.func,onSearchChange:x.PropTypes.func,onFocus:x.PropTypes.func,onMouseDown:x.PropTypes.func,aligned:x.PropTypes.string,category:x.PropTypes.bool,className:x.PropTypes.string,fluid:x.PropTypes.bool,size:x.PropTypes.oneOf(W.props.size),loading:x.PropTypes.bool},F.defaultProps={icon:"search",minCharacters:1,noResultsMessage:"No results found.",showNoResults:!0},F.autoControlledProps=["open","value"],F._meta=W,F.Result=U.default,F.Results=R.default,F.Category=K.default,t.default=F},/*!*************************************!*\
!*** ./src/modules/Search/index.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Search */345),a=n(o);t.default=a.default},/*!****************************************!*\
!*** ./src/modules/Sidebar/Sidebar.js ***!
\****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(/*! classnames */3),c=n(i),p=r(/*! react */1),d=n(p),f=r(/*! ../../lib */2),y=r(/*! ./SidebarPushable */200),m=n(y),h=r(/*! ./SidebarPusher */201),v=n(h),b={name:"Sidebar",type:f.META.TYPES.MODULE,props:{animation:["overlay","push","scale down","uncover","slide out","slide along"],direction:["top","right","bottom","left"],width:["very thin","thin","wide","very wide"]}},g=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.state={},n.startAnimating=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:500;clearTimeout(n.stopAnimatingTimer),n.setState({animating:!0}),n.stopAnimatingTimer=setTimeout(function(){return n.setState({animating:!1})},e)},s=r,a(n,s)}return s(t,e),u(t,[{key:"componentWillReceiveProps",value:function(e){e.visible!==this.props.visible&&this.startAnimating()}},{key:"render",value:function(){var e=this.state.animating,r=this.props,n=r.animation,o=r.className,a=r.children,s=r.direction,u=r.visible,i=r.width,p=(0,c.default)("ui","sidebar",(0,f.useKeyOnly)(e,"animating"),s,i,n,(0,f.useKeyOnly)(u,"visible"),o),y=(0,f.getUnhandledProps)(t,this.props),m=(0,f.getElementType)(t,this.props);return d.default.createElement(m,l({},y,{className:p}),a)}}]),t}(f.AutoControlledComponent);g._meta=b,g.propTypes={as:f.customPropTypes.as,animation:p.PropTypes.oneOf(g._meta.props.animation),children:p.PropTypes.node,className:p.PropTypes.string,defaultVisible:p.PropTypes.bool,direction:p.PropTypes.oneOf(g._meta.props.direction),visible:p.PropTypes.bool,width:p.PropTypes.oneOf(g._meta.props.width)},g.Pushable=m.default,g.Pusher=v.default,g.defaultProps={direction:"left"},g.autoControlledProps=["visible"],t.default=g},/*!**************************************!*\
!*** ./src/modules/Sidebar/index.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Sidebar */347),a=n(o);t.default=a.default},/*!**************************************!*\
!*** ./src/views/Comment/Comment.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.className,r=e.children,n=e.collapsed,s=(0,l.default)((0,c.useKeyOnly)(n,"collapsed"),"comment",t),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i.default.createElement(p,a({},u,{className:s}),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ./CommentAction */205),d=n(p),f=r(/*! ./CommentActions */206),y=n(f),m=r(/*! ./CommentAuthor */207),h=n(m),v=r(/*! ./CommentAvatar */208),b=n(v),g=r(/*! ./CommentContent */209),P=n(g),T=r(/*! ./CommentGroup */210),O=n(T),_=r(/*! ./CommentMetadata */211),E=n(_),j=r(/*! ./CommentText */212),w=n(j);o._meta={name:"Comment",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,collapsed:u.PropTypes.bool},o.Author=h.default,o.Action=d.default,o.Actions=y.default,o.Avatar=b.default,o.Content=P.default,o.Group=O.default,o.Metadata=E.default,o.Text=w.default,t.default=o},/*!************************************!*\
!*** ./src/views/Comment/index.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Comment */349),a=n(o);t.default=a.default},/*!********************************!*\
!*** ./src/views/Feed/Feed.js ***!
\********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function a(e){var t=e.children,r=e.className,n=e.events,s=e.size,l=(0,d.default)("ui",r,s,"feed"),u=(0,m.getUnhandledProps)(a,e),p=(0,m.getElementType)(a,e);if(t)return y.default.createElement(p,c({},u,{className:l}),t);var f=(0,i.default)(n,function(e){var t=e.childKey,r=e.date,n=e.meta,a=e.summary,s=o(e,["childKey","date","meta","summary"]),l=t||[r,n,a].join("-");return y.default.createElement(T.default,c({date:r,key:l,meta:n,summary:a},s))});return y.default.createElement(p,c({},u,{className:l}),f)}Object.defineProperty(t,"__esModule",{value:!0});var s=r(/*! lodash/without */7),l=n(s),u=r(/*! lodash/map */9),i=n(u),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},p=r(/*! classnames */3),d=n(p),f=r(/*! react */1),y=n(f),m=r(/*! ../../lib */2),h=r(/*! ./FeedContent */96),v=n(h),b=r(/*! ./FeedDate */51),g=n(b),P=r(/*! ./FeedEvent */213),T=n(P),O=r(/*! ./FeedExtra */97),_=n(O),E=r(/*! ./FeedLabel */98),j=n(E),w=r(/*! ./FeedLike */99),S=n(w),M=r(/*! ./FeedMeta */100),x=n(M),N=r(/*! ./FeedSummary */101),A=n(N),C=r(/*! ./FeedUser */102),k=n(C);a._meta={name:"Feed",type:m.META.TYPES.VIEW,props:{size:(0,l.default)(m.SUI.SIZES,"mini","tiny","medium","big","huge","massive")}},a.propTypes={as:m.customPropTypes.as,children:f.PropTypes.node,className:f.PropTypes.string,events:m.customPropTypes.collectionShorthand,size:f.PropTypes.oneOf(a._meta.props.size)},a.Content=v.default,a.Date=g.default,a.Event=T.default,a.Extra=_.default,a.Label=j.default,a.Like=S.default,a.Meta=x.default,a.Summary=A.default,a.User=k.default,t.default=a},/*!*********************************!*\
!*** ./src/views/Feed/index.js ***!
\*********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Feed */351),a=n(o);t.default=a.default},/*!*********************************!*\
!*** ./src/views/Item/index.js ***!
\*********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Item */214),a=n(o);t.default=a.default},/*!**************************************!*\
!*** ./src/views/Statistic/index.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(/*! ./Statistic */218),a=n(o);t.default=a.default},/*!****************************!*\
!*** ./~/debug/browser.js ***!
\****************************/
function(e,t,r){(function(n){function o(){return"undefined"!=typeof document&&"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function a(){var e=arguments,r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),!r)return e;var n="color: "+this.color;e=[e[0],n,"color: inherit"].concat(Array.prototype.slice.call(e,1));var o=0,a=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(o++,"%c"===e&&(a=o))}),e.splice(a,0,n),e}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function l(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function u(){try{return t.storage.debug}catch(e){}if("undefined"!=typeof n&&"env"in n)return n.env.DEBUG}function i(){try{return window.localStorage}catch(e){}}t=e.exports=r(/*! ./debug */356),t.log=s,t.formatArgs=a,t.save=l,t.load=u,t.useColors=o,t.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:i(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(u())}).call(t,r(/*! ./~/process/browser.js */35))},/*!**************************!*\
!*** ./~/debug/debug.js ***!
\**************************/
function(e,t,r){function n(){return t.colors[c++%t.colors.length]}function o(e){function r(){}function o(){var e=o,r=+new Date,a=r-(i||r);e.diff=a,e.prev=i,e.curr=r,i=r,null==e.useColors&&(e.useColors=t.useColors()),null==e.color&&e.useColors&&(e.color=n());for(var s=new Array(arguments.length),l=0;l<s.length;l++)s[l]=arguments[l];s[0]=t.coerce(s[0]),"string"!=typeof s[0]&&(s=["%o"].concat(s));var u=0;s[0]=s[0].replace(/%([a-z%])/g,function(r,n){if("%%"===r)return r;u++;var o=t.formatters[n];if("function"==typeof o){var a=s[u];r=o.call(e,a),s.splice(u,1),u--}return r}),s=t.formatArgs.apply(e,s);var c=o.log||t.log||console.log.bind(console);c.apply(e,s)}r.enabled=!1,o.enabled=!0;var a=t.enabled(e)?o:r;return a.namespace=e,a}function a(e){t.save(e);for(var r=(e||"").split(/[\s,]+/),n=r.length,o=0;o<n;o++)r[o]&&(e=r[o].replace(/[\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*/g,".*?"),"-"===e[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))}function s(){t.enable("")}function l(e){var r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1}function u(e){return e instanceof Error?e.stack||e.message:e}t=e.exports=o.debug=o,t.coerce=u,t.disable=s,t.enable=a,t.enabled=l,t.humanize=r(/*! ms */535),t.names=[],t.skips=[],t.formatters={};var i,c=0},/*!*******************************!*\
!*** ./~/lodash/_DataView.js ***!
\*******************************/
function(e,t,r){var n=r(/*! ./_getNative */26),o=r(/*! ./_root */11),a=n(o,"DataView");e.exports=a},/*!***************************!*\
!*** ./~/lodash/_Hash.js ***!
\***************************/
function(e,t,r){function n(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}var o=r(/*! ./_hashClear */437),a=r(/*! ./_hashDelete */438),s=r(/*! ./_hashGet */439),l=r(/*! ./_hashHas */440),u=r(/*! ./_hashSet */441);n.prototype.clear=o,n.prototype.delete=a,n.prototype.get=s,n.prototype.has=l,n.prototype.set=u,e.exports=n},/*!******************************!*\
!*** ./~/lodash/_Promise.js ***!
\******************************/
function(e,t,r){var n=r(/*! ./_getNative */26),o=r(/*! ./_root */11),a=n(o,"Promise");e.exports=a},/*!**********************************!*\
!*** ./~/lodash/_addMapEntry.js ***!
\**********************************/
function(e,t){function r(e,t){return e.set(t[0],t[1]),e}e.exports=r},/*!**********************************!*\
!*** ./~/lodash/_addSetEntry.js ***!
\**********************************/
function(e,t){function r(e,t){return e.add(t),e}e.exports=r},/*!*********************************!*\
!*** ./~/lodash/_arrayEvery.js ***!
\*********************************/
function(e,t){function r(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(!t(e[r],r,e))return!1;return!0}e.exports=r},/*!**********************************!*\
!*** ./~/lodash/_arrayFilter.js ***!
\**********************************/
function(e,t){function r(e,t){for(var r=-1,n=null==e?0:e.length,o=0,a=[];++r<n;){var s=e[r];t(s,r,e)&&(a[o++]=s)}return a}e.exports=r},/*!***********************************!*\
!*** ./~/lodash/_asciiToArray.js ***!
\***********************************/
function(e,t){function r(e){return e.split("")}e.exports=r},/*!*********************************!*\
!*** ./~/lodash/_asciiWords.js ***!
\*********************************/
function(e,t){function r(e){return e.match(n)||[]}var n=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;e.exports=r},/*!***********************************!*\
!*** ./~/lodash/_baseAssignIn.js ***!
\***********************************/
function(e,t,r){function n(e,t){return e&&o(t,a(t),e)}var o=r(/*! ./_copyObject */33),a=r(/*! ./keysIn */273);e.exports=n},/*!********************************!*\
!*** ./~/lodash/_baseEvery.js ***!
\********************************/
function(e,t,r){function n(e,t){var r=!0;return o(e,function(e,n,o){return r=!!t(e,n,o)}),r}var o=r(/*! ./_baseEach */32);e.exports=n},/*!***********************************!*\
!*** ./~/lodash/_baseExtremum.js ***!
\***********************************/
function(e,t,r){function n(e,t,r){for(var n=-1,a=e.length;++n<a;){var s=e[n],l=t(s);if(null!=l&&(void 0===u?l===l&&!o(l):r(l,u)))var u=l,i=s}return i}var o=r(/*! ./isSymbol */29);e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_baseFilter.js ***!
\*********************************/
function(e,t,r){function n(e,t){var r=[];return o(e,function(e,n,o){t(e,n,o)&&r.push(e)}),r}var o=r(/*! ./_baseEach */32);e.exports=n},/*!******************************!*\
!*** ./~/lodash/_baseFor.js ***!
\******************************/
function(e,t,r){var n=r(/*! ./_createBaseFor */418),o=n();e.exports=o},/*!******************************!*\
!*** ./~/lodash/_baseHas.js ***!
\******************************/
function(e,t){function r(e,t){return null!=e&&o.call(e,t)}var n=Object.prototype,o=n.hasOwnProperty;e.exports=r},/*!********************************!*\
!*** ./~/lodash/_baseHasIn.js ***!
\********************************/
function(e,t){function r(e,t){return null!=e&&t in Object(e)}e.exports=r},/*!**********************************!*\
!*** ./~/lodash/_baseInRange.js ***!
\**********************************/
function(e,t){function r(e,t,r){return e>=o(t,r)&&e<n(t,r)}var n=Math.max,o=Math.min;e.exports=r},/*!***************************************!*\
!*** ./~/lodash/_baseIntersection.js ***!
\***************************************/
function(e,t,r){function n(e,t,r){for(var n=r?s:a,p=e[0].length,d=e.length,f=d,y=Array(d),m=1/0,h=[];f--;){var v=e[f];f&&t&&(v=l(v,u(t))),m=c(v.length,m),y[f]=!r&&(t||p>=120&&v.length>=120)?new o(f&&v):void 0}v=e[0];var b=-1,g=y[0];e:for(;++b<p&&h.length<m;){var P=v[b],T=t?t(P):P;if(P=r||0!==P?P:0,!(g?i(g,T):n(h,T,r))){for(f=d;--f;){var O=y[f];if(!(O?i(O,T):n(e[f],T,r)))continue e}g&&g.push(T),h.push(P)}}return h}var o=r(/*! ./_SetCache */53),a=r(/*! ./_arrayIncludes */55),s=r(/*! ./_arrayIncludesWith */112),l=r(/*! ./_arrayMap */17),u=r(/*! ./_baseUnary */62),i=r(/*! ./_cacheHas */63),c=Math.min;e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_baseInvoke.js ***!
\*********************************/
function(e,t,r){function n(e,t,r){t=a(t,e),e=l(e,t);var n=null==e?e:e[u(s(t))];return null==n?void 0:o(n,e,r)}var o=r(/*! ./_apply */54),a=r(/*! ./_castPath */25),s=r(/*! ./last */274),l=r(/*! ./_parent */256),u=r(/*! ./_toKey */22);e.exports=n},/*!**************************************!*\
!*** ./~/lodash/_baseIsArguments.js ***!
\**************************************/
function(e,t,r){function n(e){return a(e)&&o(e)==s}var o=r(/*! ./_baseGetTag */21),a=r(/*! ./isObjectLike */15),s="[object Arguments]";e.exports=n},/*!**************************************!*\
!*** ./~/lodash/_baseIsEqualDeep.js ***!
\**************************************/
function(e,t,r){function n(e,t,r,n,h,b){var g=i(e),P=i(t),T=y,O=y;g||(T=u(e),T=T==f?m:T),P||(O=u(t),O=O==f?m:O);var _=T==m,E=O==m,j=T==O;if(j&&c(e)){if(!c(t))return!1;g=!0,_=!1}if(j&&!_)return b||(b=new o),g||p(e)?a(e,t,r,n,h,b):s(e,t,T,r,n,h,b);if(!(r&d)){var w=_&&v.call(e,"__wrapped__"),S=E&&v.call(t,"__wrapped__");if(w||S){var M=w?e.value():e,x=S?t.value():t;return b||(b=new o),h(M,x,r,n,b)}}return!!j&&(b||(b=new o),l(e,t,r,n,h,b))}var o=r(/*! ./_Stack */111),a=r(/*! ./_equalArrays */243),s=r(/*! ./_equalByTag */429),l=r(/*! ./_equalObjects */430),u=r(/*! ./_getTag */123),i=r(/*! ./isArray */4),c=r(/*! ./isBuffer */43),p=r(/*! ./isTypedArray */77),d=1,f="[object Arguments]",y="[object Array]",m="[object Object]",h=Object.prototype,v=h.hasOwnProperty;e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_baseIsMatch.js ***!
\**********************************/
function(e,t,r){function n(e,t,r,n){var u=r.length,i=u,c=!n;if(null==e)return!i;for(e=Object(e);u--;){var p=r[u];if(c&&p[2]?p[1]!==e[p[0]]:!(p[0]in e))return!1}for(;++u<i;){p=r[u];var d=p[0],f=e[d],y=p[1];if(c&&p[2]){if(void 0===f&&!(d in e))return!1}else{var m=new o;if(n)var h=n(f,y,d,e,t,m);if(!(void 0===h?a(y,f,s|l,n,m):h))return!1}}return!0}var o=r(/*! ./_Stack */111),a=r(/*! ./_baseIsEqual */117),s=1,l=2;e.exports=n},/*!********************************!*\
!*** ./~/lodash/_baseIsNaN.js ***!
\********************************/
function(e,t){function r(e){return e!==e}e.exports=r},/*!***********************************!*\
!*** ./~/lodash/_baseIsNative.js ***!
\***********************************/
function(e,t,r){function n(e){if(!s(e)||a(e))return!1;var t=o(e)?y:i;return t.test(l(e))}var o=r(/*! ./isFunction */28),a=r(/*! ./_isMasked */448),s=r(/*! ./isObject */12),l=r(/*! ./_toSource */261),u=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,c=Function.prototype,p=Object.prototype,d=c.toString,f=p.hasOwnProperty,y=RegExp("^"+d.call(f).replace(u,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=n},/*!***************************************!*\
!*** ./~/lodash/_baseIsTypedArray.js ***!
\***************************************/
function(e,t,r){function n(e){return s(e)&&a(e.length)&&!!A[o(e)]}var o=r(/*! ./_baseGetTag */21),a=r(/*! ./isLength */131),s=r(/*! ./isObjectLike */15),l="[object Arguments]",u="[object Array]",i="[object Boolean]",c="[object Date]",p="[object Error]",d="[object Function]",f="[object Map]",y="[object Number]",m="[object Object]",h="[object RegExp]",v="[object Set]",b="[object String]",g="[object WeakMap]",P="[object ArrayBuffer]",T="[object DataView]",O="[object Float32Array]",_="[object Float64Array]",E="[object Int8Array]",j="[object Int16Array]",w="[object Int32Array]",S="[object Uint8Array]",M="[object Uint8ClampedArray]",x="[object Uint16Array]",N="[object Uint32Array]",A={};A[O]=A[_]=A[E]=A[j]=A[w]=A[S]=A[M]=A[x]=A[N]=!0,A[l]=A[u]=A[P]=A[i]=A[T]=A[c]=A[p]=A[d]=A[f]=A[y]=A[m]=A[h]=A[v]=A[b]=A[g]=!1,e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_baseKeysIn.js ***!
\*********************************/
function(e,t,r){function n(e){if(!o(e))return s(e);var t=a(e),r=[];for(var n in e)("constructor"!=n||!t&&u.call(e,n))&&r.push(n);return r}var o=r(/*! ./isObject */12),a=r(/*! ./_isPrototype */40),s=r(/*! ./_nativeKeysIn */462),l=Object.prototype,u=l.hasOwnProperty;e.exports=n},/*!*****************************!*\
!*** ./~/lodash/_baseLt.js ***!
\*****************************/
function(e,t){function r(e,t){return e<t}e.exports=r},/*!**********************************!*\
!*** ./~/lodash/_baseMatches.js ***!
\**********************************/
function(e,t,r){function n(e){var t=a(e);return 1==t.length&&t[0][2]?s(t[0][0],t[0][1]):function(r){return r===e||o(r,e,t)}}var o=r(/*! ./_baseIsMatch */378),a=r(/*! ./_getMatchData */432),s=r(/*! ./_matchesStrictComparable */253);e.exports=n},/*!******************************************!*\
!*** ./~/lodash/_baseMatchesProperty.js ***!
\******************************************/
function(e,t,r){function n(e,t){return l(e)&&u(t)?i(c(e),t):function(r){var n=a(r,e);return void 0===n&&n===t?s(r,e):o(t,n,p|d)}}var o=r(/*! ./_baseIsEqual */117),a=r(/*! ./get */34),s=r(/*! ./hasIn */268),l=r(/*! ./_isKey */124),u=r(/*! ./_isStrictComparable */251),i=r(/*! ./_matchesStrictComparable */253),c=r(/*! ./_toKey */22),p=1,d=2;e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_baseOrderBy.js ***!
\**********************************/
function(e,t,r){function n(e,t,r){var n=-1;t=o(t.length?t:[c],u(a));var p=s(e,function(e,r,a){var s=o(t,function(t){return t(e)});return{criteria:s,index:++n,value:e}});return l(p,function(e,t){return i(e,t,r)})}var o=r(/*! ./_arrayMap */17),a=r(/*! ./_baseIteratee */13),s=r(/*! ./_baseMap */233),l=r(/*! ./_baseSortBy */396),u=r(/*! ./_baseUnary */62),i=r(/*! ./_compareMultiple */411),c=r(/*! ./identity */23);e.exports=n},/*!*******************************!*\
!*** ./~/lodash/_basePick.js ***!
\*******************************/
function(e,t,r){function n(e,t){return e=Object(e),o(e,t,function(t,r){return a(e,r)})}var o=r(/*! ./_basePickBy */388),a=r(/*! ./hasIn */268);e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_basePickBy.js ***!
\*********************************/
function(e,t,r){function n(e,t,r){for(var n=-1,l=t.length,u={};++n<l;){var i=t[n],c=o(e,i);r(c,i)&&a(u,s(i,e),c)}return u}var o=r(/*! ./_baseGet */60),a=r(/*! ./_baseSet */393),s=r(/*! ./_castPath */25);e.exports=n},/*!***********************************!*\
!*** ./~/lodash/_baseProperty.js ***!
\***********************************/
function(e,t){function r(e){return function(t){return null==t?void 0:t[e]}}e.exports=r},/*!***************************************!*\
!*** ./~/lodash/_basePropertyDeep.js ***!
\***************************************/
function(e,t,r){function n(e){return function(t){return o(t,e)}}var o=r(/*! ./_baseGet */60);e.exports=n},/*!*************************************!*\
!*** ./~/lodash/_basePropertyOf.js ***!
\*************************************/
function(e,t){function r(e){return function(t){return null==e?void 0:e[t]}}e.exports=r},/*!*********************************!*\
!*** ./~/lodash/_baseReduce.js ***!
\*********************************/
function(e,t){function r(e,t,r,n,o){return o(e,function(e,o,a){r=n?(n=!1,e):t(r,e,o,a)}),r}e.exports=r},/*!******************************!*\
!*** ./~/lodash/_baseSet.js ***!
\******************************/
function(e,t,r){function n(e,t,r,n){if(!l(e))return e;t=a(t,e);for(var i=-1,c=t.length,p=c-1,d=e;null!=d&&++i<c;){var f=u(t[i]),y=r;if(i!=p){var m=d[f];y=n?n(m,f,d):void 0,void 0===y&&(y=l(m)?m:s(t[i+1])?[]:{})}o(d,f,y),d=d[f]}return e}var o=r(/*! ./_assignValue */57),a=r(/*! ./_castPath */25),s=r(/*! ./_isIndex */39),l=r(/*! ./isObject */12),u=r(/*! ./_toKey */22);e.exports=n},/*!**************************************!*\
!*** ./~/lodash/_baseSetToString.js ***!
\**************************************/
function(e,t,r){var n=r(/*! ./constant */484),o=r(/*! ./_defineProperty */242),a=r(/*! ./identity */23),s=o?function(e,t){return o(e,"toString",{configurable:!0,enumerable:!1,value:n(t),writable:!0})}:a;e.exports=s},/*!*******************************!*\
!*** ./~/lodash/_baseSome.js ***!
\*******************************/
function(e,t,r){function n(e,t){var r;return o(e,function(e,n,o){return r=t(e,n,o),!r}),!!r}var o=r(/*! ./_baseEach */32);e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_baseSortBy.js ***!
\*********************************/
function(e,t){function r(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}e.exports=r},/*!******************************!*\
!*** ./~/lodash/_baseSum.js ***!
\******************************/
function(e,t){function r(e,t){for(var r,n=-1,o=e.length;++n<o;){var a=t(e[n]);void 0!==a&&(r=void 0===r?a:r+a)}return r}e.exports=r},/*!*******************************!*\
!*** ./~/lodash/_baseUniq.js ***!
\*******************************/
function(e,t,r){function n(e,t,r){var n=-1,p=a,d=e.length,f=!0,y=[],m=y;if(r)f=!1,p=s;else if(d>=c){var h=t?null:u(e);if(h)return i(h);f=!1,p=l,m=new o}else m=t?[]:y;e:for(;++n<d;){var v=e[n],b=t?t(v):v;if(v=r||0!==v?v:0,f&&b===b){for(var g=m.length;g--;)if(m[g]===b)continue e;t&&m.push(b),y.push(v)}else p(m,b,r)||(m!==y&&m.push(b),y.push(v))}return y}var o=r(/*! ./_SetCache */53),a=r(/*! ./_arrayIncludes */55),s=r(/*! ./_arrayIncludesWith */112),l=r(/*! ./_cacheHas */63),u=r(/*! ./_createSet */427),i=r(/*! ./_setToArray */72),c=200;e.exports=n},/*!********************************!*\
!*** ./~/lodash/_baseUnset.js ***!
\********************************/
function(e,t,r){function n(e,t){return t=o(t,e),e=s(e,t),null==e||delete e[l(a(t))]}var o=r(/*! ./_castPath */25),a=r(/*! ./last */274),s=r(/*! ./_parent */256),l=r(/*! ./_toKey */22);e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_baseValues.js ***!
\*********************************/
function(e,t,r){function n(e,t){return o(t,function(t){return e[t]})}var o=r(/*! ./_arrayMap */17);e.exports=n},/*!******************************************!*\
!*** ./~/lodash/_castArrayLikeObject.js ***!
\******************************************/
function(e,t,r){function n(e){return o(e)?e:[]}var o=r(/*! ./isArrayLikeObject */76);e.exports=n},/*!********************************!*\
!*** ./~/lodash/_castSlice.js ***!
\********************************/
function(e,t,r){function n(e,t,r){var n=e.length;return r=void 0===r?n:r,!t&&r>=n?e:o(e,t,r)}var o=r(/*! ./_baseSlice */61);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_cloneBuffer.js ***!
\**********************************/
function(e,t,r){(function(e){function n(e,t){if(t)return e.slice();var r=e.length,n=i?i(r):new e.constructor(r);return e.copy(n),n}var o=r(/*! ./_root */11),a="object"==typeof t&&t&&!t.nodeType&&t,s=a&&"object"==typeof e&&e&&!e.nodeType&&e,l=s&&s.exports===a,u=l?o.Buffer:void 0,i=u?u.allocUnsafe:void 0;e.exports=n}).call(t,r(/*! ./../webpack/buildin/module.js */135)(e))},/*!************************************!*\
!*** ./~/lodash/_cloneDataView.js ***!
\************************************/
function(e,t,r){function n(e,t){var r=t?o(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var o=r(/*! ./_cloneArrayBuffer */120);e.exports=n},/*!*******************************!*\
!*** ./~/lodash/_cloneMap.js ***!
\*******************************/
function(e,t,r){function n(e,t,r){var n=t?r(s(e),l):s(e);return a(n,o,new e.constructor)}var o=r(/*! ./_addMapEntry */360),a=r(/*! ./_arrayReduce */56),s=r(/*! ./_mapToArray */252),l=1;e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_cloneRegExp.js ***!
\**********************************/
function(e,t){function r(e){var t=new e.constructor(e.source,n.exec(e));return t.lastIndex=e.lastIndex,t}var n=/\w*$/;e.exports=r},/*!*******************************!*\
!*** ./~/lodash/_cloneSet.js ***!
\*******************************/
function(e,t,r){function n(e,t,r){var n=t?r(s(e),l):s(e);return a(n,o,new e.constructor)}var o=r(/*! ./_addSetEntry */361),a=r(/*! ./_arrayReduce */56),s=r(/*! ./_setToArray */72),l=1;e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_cloneSymbol.js ***!
\**********************************/
function(e,t,r){function n(e){return s?Object(s.call(e)):{}}var o=r(/*! ./_Symbol */31),a=o?o.prototype:void 0,s=a?a.valueOf:void 0;e.exports=n},/*!**************************************!*\
!*** ./~/lodash/_cloneTypedArray.js ***!
\**************************************/
function(e,t,r){function n(e,t){var r=t?o(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var o=r(/*! ./_cloneArrayBuffer */120);e.exports=n},/*!***************************************!*\
!*** ./~/lodash/_compareAscending.js ***!
\***************************************/
function(e,t,r){function n(e,t){if(e!==t){var r=void 0!==e,n=null===e,a=e===e,s=o(e),l=void 0!==t,u=null===t,i=t===t,c=o(t);if(!u&&!c&&!s&&e>t||s&&l&&i&&!u&&!c||n&&l&&i||!r&&i||!a)return 1;if(!n&&!s&&!c&&e<t||c&&r&&a&&!n&&!s||u&&r&&a||!l&&a||!i)return-1}return 0}var o=r(/*! ./isSymbol */29);e.exports=n},/*!**************************************!*\
!*** ./~/lodash/_compareMultiple.js ***!
\**************************************/
function(e,t,r){function n(e,t,r){for(var n=-1,a=e.criteria,s=t.criteria,l=a.length,u=r.length;++n<l;){var i=o(a[n],s[n]);if(i){if(n>=u)return i;var c=r[n];return i*("desc"==c?-1:1)}}return e.index-t.index}var o=r(/*! ./_compareAscending */410);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_copySymbols.js ***!
\**********************************/
function(e,t,r){function n(e,t){return o(e,a(e),t)}var o=r(/*! ./_copyObject */33),a=r(/*! ./_getSymbols */122);e.exports=n},/*!************************************!*\
!*** ./~/lodash/_copySymbolsIn.js ***!
\************************************/
function(e,t,r){function n(e,t){return o(e,a(e),t)}var o=r(/*! ./_copyObject */33),a=r(/*! ./_getSymbolsIn */247);e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_coreJsData.js ***!
\*********************************/
function(e,t,r){var n=r(/*! ./_root */11),o=n["__core-js_shared__"];e.exports=o},/*!***********************************!*\
!*** ./~/lodash/_countHolders.js ***!
\***********************************/
function(e,t){function r(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}e.exports=r},/*!*************************************!*\
!*** ./~/lodash/_createAssigner.js ***!
\*************************************/
function(e,t,r){function n(e){return o(function(t,r){var n=-1,o=r.length,s=o>1?r[o-1]:void 0,l=o>2?r[2]:void 0;for(s=e.length>3&&"function"==typeof s?(o--,s):void 0,l&&a(r[0],r[1],l)&&(s=o<3?void 0:s,o=1),t=Object(t);++n<o;){var u=r[n];u&&e(t,u,n,s)}return t})}var o=r(/*! ./_baseRest */18),a=r(/*! ./_isIterateeCall */70);e.exports=n},/*!*************************************!*\
!*** ./~/lodash/_createBaseEach.js ***!
\*************************************/
function(e,t,r){function n(e,t){return function(r,n){if(null==r)return r;if(!o(r))return e(r,n);for(var a=r.length,s=t?a:-1,l=Object(r);(t?s--:++s<a)&&n(l[s],s,l)!==!1;);return r}}var o=r(/*! ./isArrayLike */14);e.exports=n},/*!************************************!*\
!*** ./~/lodash/_createBaseFor.js ***!
\************************************/
function(e,t){function r(e){return function(t,r,n){for(var o=-1,a=Object(t),s=n(t),l=s.length;l--;){var u=s[e?l:++o];if(r(a[u],u,a)===!1)break}return t}}e.exports=r},/*!*********************************!*\
!*** ./~/lodash/_createBind.js ***!
\*********************************/
function(e,t,r){function n(e,t,r){function n(){var t=this&&this!==a&&this instanceof n?u:e;return t.apply(l?r:this,arguments)}var l=t&s,u=o(e);return n}var o=r(/*! ./_createCtor */65),a=r(/*! ./_root */11),s=1;e.exports=n},/*!**************************************!*\
!*** ./~/lodash/_createCaseFirst.js ***!
\**************************************/
function(e,t,r){function n(e){return function(t){t=l(t);var r=a(t)?s(t):void 0,n=r?r[0]:t.charAt(0),u=r?o(r,1).join(""):t.slice(1);return n[e]()+u}}var o=r(/*! ./_castSlice */402),a=r(/*! ./_hasUnicode */249),s=r(/*! ./_stringToArray */475),l=r(/*! ./toString */24);e.exports=n},/*!***************************************!*\
!*** ./~/lodash/_createCompounder.js ***!
\***************************************/
function(e,t,r){function n(e){return function(t){return o(s(a(t).replace(u,"")),e,"")}}var o=r(/*! ./_arrayReduce */56),a=r(/*! ./deburr */485),s=r(/*! ./words */533),l="['’]",u=RegExp(l,"g");e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_createCurry.js ***!
\**********************************/
function(e,t,r){function n(e,t,r){function n(){for(var a=arguments.length,d=Array(a),f=a,y=u(n);f--;)d[f]=arguments[f];var m=a<3&&d[0]!==y&&d[a-1]!==y?[]:i(d,y);if(a-=m.length,a<r)return l(e,t,s,n.placeholder,void 0,d,m,void 0,void 0,r-a);var h=this&&this!==c&&this instanceof n?p:e;return o(h,this,d)}var p=a(e);return n}var o=r(/*! ./_apply */54),a=r(/*! ./_createCtor */65),s=r(/*! ./_createHybrid */240),l=r(/*! ./_createRecurry */241),u=r(/*! ./_getHolder */67),i=r(/*! ./_replaceHolders */41),c=r(/*! ./_root */11);e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_createFind.js ***!
\*********************************/
function(e,t,r){function n(e){return function(t,r,n){var l=Object(t);if(!a(t)){var u=o(r,3);t=s(t),r=function(e){return u(l[e],e,l)}}var i=e(t,r,n);return i>-1?l[u?t[i]:i]:void 0}}var o=r(/*! ./_baseIteratee */13),a=r(/*! ./isArrayLike */14),s=r(/*! ./keys */10);e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_createFlow.js ***!
\*********************************/
function(e,t,r){function n(e){return a(function(t){var r=t.length,n=r,a=o.prototype.thru;for(e&&t.reverse();n--;){var h=t[n];if("function"!=typeof h)throw new TypeError(p);if(a&&!v&&"wrapper"==l(h))var v=new o([],!0)}for(n=v?n:r;++n<r;){h=t[n];var b=l(h),g="wrapper"==b?s(h):void 0;v=g&&i(g[0])&&g[1]==(y|d|f|m)&&!g[4].length&&1==g[9]?v[l(g[0])].apply(v,g[3]):1==h.length&&i(h)?v[b]():v.thru(h)}return function(){var e=arguments,n=e[0];if(v&&1==e.length&&u(n)&&n.length>=c)return v.plant(n).value();for(var o=0,a=r?t[o].apply(this,e):n;++o<r;)a=t[o].call(this,a);return a}})}var o=r(/*! ./_LodashWrapper */108),a=r(/*! ./_flatRest */66),s=r(/*! ./_getData */121),l=r(/*! ./_getFuncName */246),u=r(/*! ./isArray */4),i=r(/*! ./_isLaziable */250),c=200,p="Expected a function",d=8,f=32,y=128,m=256;e.exports=n},/*!************************************!*\
!*** ./~/lodash/_createPartial.js ***!
\************************************/
function(e,t,r){function n(e,t,r,n){function u(){for(var t=-1,a=arguments.length,l=-1,p=n.length,d=Array(p+a),f=this&&this!==s&&this instanceof u?c:e;++l<p;)d[l]=n[l];for(;a--;)d[l++]=arguments[++t];return o(f,i?r:this,d)}var i=t&l,c=a(e);return u}var o=r(/*! ./_apply */54),a=r(/*! ./_createCtor */65),s=r(/*! ./_root */11),l=1;e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_createRound.js ***!
\**********************************/
function(e,t,r){function n(e){var t=Math[e];return function(e,r){if(e=a(e),r=l(o(r),292)){var n=(s(e)+"e").split("e"),u=t(n[0]+"e"+(+n[1]+r));return n=(s(u)+"e").split("e"),+(n[0]+"e"+(+n[1]-r))}return t(e)}}var o=r(/*! ./toInteger */20),a=r(/*! ./toNumber */80),s=r(/*! ./toString */24),l=Math.min;e.exports=n},/*!********************************!*\
!*** ./~/lodash/_createSet.js ***!
\********************************/
function(e,t,r){var n=r(/*! ./_Set */222),o=r(/*! ./noop */275),a=r(/*! ./_setToArray */72),s=1/0,l=n&&1/a(new n([,-0]))[1]==s?function(e){return new n(e)}:o;e.exports=l},/*!***********************************!*\
!*** ./~/lodash/_deburrLetter.js ***!
\***********************************/
function(e,t,r){var n=r(/*! ./_basePropertyOf */391),o={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"},a=n(o);e.exports=a},/*!*********************************!*\
!*** ./~/lodash/_equalByTag.js ***!
\*********************************/
function(e,t,r){function n(e,t,r,n,o,_,j){switch(r){case O:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case T:return!(e.byteLength!=t.byteLength||!_(new a(e),new a(t)));case d:case f:case h:return s(+e,+t);case y:return e.name==t.name&&e.message==t.message;case v:case g:return e==t+"";case m:var w=u;case b:var S=n&c;if(w||(w=i),e.size!=t.size&&!S)return!1;var M=j.get(e);if(M)return M==t;n|=p,j.set(e,t);var x=l(w(e),w(t),n,o,_,j);return j.delete(e),x;case P:if(E)return E.call(e)==E.call(t)}return!1}var o=r(/*! ./_Symbol */31),a=r(/*! ./_Uint8Array */223),s=r(/*! ./eq */42),l=r(/*! ./_equalArrays */243),u=r(/*! ./_mapToArray */252),i=r(/*! ./_setToArray */72),c=1,p=2,d="[object Boolean]",f="[object Date]",y="[object Error]",m="[object Map]",h="[object Number]",v="[object RegExp]",b="[object Set]",g="[object String]",P="[object Symbol]",T="[object ArrayBuffer]",O="[object DataView]",_=o?o.prototype:void 0,E=_?_.valueOf:void 0;e.exports=n},/*!***********************************!*\
!*** ./~/lodash/_equalObjects.js ***!
\***********************************/
function(e,t,r){function n(e,t,r,n,s,u){var i=r&a,c=o(e),p=c.length,d=o(t),f=d.length;if(p!=f&&!i)return!1;for(var y=p;y--;){var m=c[y];if(!(i?m in t:l.call(t,m)))return!1}var h=u.get(e);if(h&&u.get(t))return h==t;var v=!0;u.set(e,t),u.set(t,e);for(var b=i;++y<p;){m=c[y];var g=e[m],P=t[m];if(n)var T=i?n(P,g,m,t,e,u):n(g,P,m,e,t,u);if(!(void 0===T?g===P||s(g,P,r,n,u):T)){v=!1;break}b||(b="constructor"==m)}if(v&&!b){var O=e.constructor,_=t.constructor;O!=_&&"constructor"in e&&"constructor"in t&&!("function"==typeof O&&O instanceof O&&"function"==typeof _&&_ instanceof _)&&(v=!1)}return u.delete(e),u.delete(t),v}var o=r(/*! ./keys */10),a=1,s=Object.prototype,l=s.hasOwnProperty;e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_getAllKeys.js ***!
\*********************************/
function(e,t,r){function n(e){return o(e,s,a)}var o=r(/*! ./_baseGetAllKeys */231),a=r(/*! ./_getSymbols */122),s=r(/*! ./keys */10);e.exports=n},/*!***********************************!*\
!*** ./~/lodash/_getMatchData.js ***!
\***********************************/
function(e,t,r){function n(e){for(var t=a(e),r=t.length;r--;){var n=t[r],s=e[n];t[r]=[n,s,o(s)]}return t}var o=r(/*! ./_isStrictComparable */251),a=r(/*! ./keys */10);e.exports=n},/*!********************************!*\
!*** ./~/lodash/_getRawTag.js ***!
\********************************/
function(e,t,r){function n(e){var t=s.call(e,u),r=e[u];try{e[u]=void 0;var n=!0}catch(e){}var o=l.call(e);return n&&(t?e[u]=r:delete e[u]),o}var o=r(/*! ./_Symbol */31),a=Object.prototype,s=a.hasOwnProperty,l=a.toString,u=o?o.toStringTag:void 0;e.exports=n},/*!*******************************!*\
!*** ./~/lodash/_getValue.js ***!
\*******************************/
function(e,t){function r(e,t){return null==e?void 0:e[t]}e.exports=r},/*!*************************************!*\
!*** ./~/lodash/_getWrapDetails.js ***!
\*************************************/
function(e,t){function r(e){var t=e.match(n);return t?t[1].split(o):[]}var n=/\{\n\/\* \[wrapped with (.+)\] \*/,o=/,? & /;e.exports=r},/*!*************************************!*\
!*** ./~/lodash/_hasUnicodeWord.js ***!
\*************************************/
function(e,t){function r(e){return n.test(e)}var n=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;e.exports=r},/*!********************************!*\
!*** ./~/lodash/_hashClear.js ***!
\********************************/
function(e,t,r){function n(){this.__data__=o?o(null):{},this.size=0}var o=r(/*! ./_nativeCreate */71);e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_hashDelete.js ***!
\*********************************/
function(e,t){function r(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}e.exports=r},/*!******************************!*\
!*** ./~/lodash/_hashGet.js ***!
\******************************/
function(e,t,r){function n(e){var t=this.__data__;if(o){var r=t[e];return r===a?void 0:r}return l.call(t,e)?t[e]:void 0}var o=r(/*! ./_nativeCreate */71),a="__lodash_hash_undefined__",s=Object.prototype,l=s.hasOwnProperty;e.exports=n},/*!******************************!*\
!*** ./~/lodash/_hashHas.js ***!
\******************************/
function(e,t,r){function n(e){var t=this.__data__;return o?void 0!==t[e]:s.call(t,e)}var o=r(/*! ./_nativeCreate */71),a=Object.prototype,s=a.hasOwnProperty;e.exports=n},/*!******************************!*\
!*** ./~/lodash/_hashSet.js ***!
\******************************/
function(e,t,r){function n(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=o&&void 0===t?a:t,this}var o=r(/*! ./_nativeCreate */71),a="__lodash_hash_undefined__";e.exports=n},/*!*************************************!*\
!*** ./~/lodash/_initCloneArray.js ***!
\*************************************/
function(e,t){function r(e){var t=e.length,r=e.constructor(t);return t&&"string"==typeof e[0]&&o.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var n=Object.prototype,o=n.hasOwnProperty;e.exports=r},/*!*************************************!*\
!*** ./~/lodash/_initCloneByTag.js ***!
\*************************************/
function(e,t,r){function n(e,t,r,n){var N=e.constructor;switch(t){case g:return o(e);case p:case d:return new N(+e);case P:return a(e,n);case T:case O:case _:case E:case j:case w:case S:case M:case x:return c(e,n);case f:return s(e,n,r);case y:case v:return new N(e);case m:return l(e);case h:return u(e,n,r);case b:return i(e)}}var o=r(/*! ./_cloneArrayBuffer */120),a=r(/*! ./_cloneDataView */404),s=r(/*! ./_cloneMap */405),l=r(/*! ./_cloneRegExp */406),u=r(/*! ./_cloneSet */407),i=r(/*! ./_cloneSymbol */408),c=r(/*! ./_cloneTypedArray */409),p="[object Boolean]",d="[object Date]",f="[object Map]",y="[object Number]",m="[object RegExp]",h="[object Set]",v="[object String]",b="[object Symbol]",g="[object ArrayBuffer]",P="[object DataView]",T="[object Float32Array]",O="[object Float64Array]",_="[object Int8Array]",E="[object Int16Array]",j="[object Int32Array]",w="[object Uint8Array]",S="[object Uint8ClampedArray]",M="[object Uint16Array]",x="[object Uint32Array]";e.exports=n},/*!**************************************!*\
!*** ./~/lodash/_initCloneObject.js ***!
\**************************************/
function(e,t,r){function n(e){return"function"!=typeof e.constructor||s(e)?{}:o(a(e))}var o=r(/*! ./_baseCreate */37),a=r(/*! ./_getPrototype */69),s=r(/*! ./_isPrototype */40);e.exports=n},/*!****************************************!*\
!*** ./~/lodash/_insertWrapDetails.js ***!
\****************************************/
function(e,t){function r(e,t){var r=t.length;if(!r)return e;var o=r-1;return t[o]=(r>1?"& ":"")+t[o],t=t.join(r>2?", ":" "),e.replace(n,"{\n/* [wrapped with "+t+"] */\n")}var n=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;e.exports=r},/*!************************************!*\
!*** ./~/lodash/_isFlattenable.js ***!
\************************************/
function(e,t,r){function n(e){return s(e)||a(e)||!!(l&&e&&e[l])}var o=r(/*! ./_Symbol */31),a=r(/*! ./isArguments */75),s=r(/*! ./isArray */4),l=o?o.isConcatSpreadable:void 0;e.exports=n},/*!********************************!*\
!*** ./~/lodash/_isKeyable.js ***!
\********************************/
function(e,t){function r(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}e.exports=r},/*!*******************************!*\
!*** ./~/lodash/_isMasked.js ***!
\*******************************/
function(e,t,r){function n(e){return!!a&&a in e}var o=r(/*! ./_coreJsData */414),a=function(){var e=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();e.exports=n},/*!*************************************!*\
!*** ./~/lodash/_listCacheClear.js ***!
\*************************************/
function(e,t){function r(){this.__data__=[],this.size=0}e.exports=r},/*!**************************************!*\
!*** ./~/lodash/_listCacheDelete.js ***!
\**************************************/
function(e,t,r){function n(e){var t=this.__data__,r=o(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():s.call(t,r,1),--this.size,!0}var o=r(/*! ./_assocIndexOf */58),a=Array.prototype,s=a.splice;e.exports=n},/*!***********************************!*\
!*** ./~/lodash/_listCacheGet.js ***!
\***********************************/
function(e,t,r){function n(e){var t=this.__data__,r=o(t,e);return r<0?void 0:t[r][1]}var o=r(/*! ./_assocIndexOf */58);e.exports=n},/*!***********************************!*\
!*** ./~/lodash/_listCacheHas.js ***!
\***********************************/
function(e,t,r){function n(e){return o(this.__data__,e)>-1}var o=r(/*! ./_assocIndexOf */58);e.exports=n},/*!***********************************!*\
!*** ./~/lodash/_listCacheSet.js ***!
\***********************************/
function(e,t,r){function n(e,t){var r=this.__data__,n=o(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var o=r(/*! ./_assocIndexOf */58);e.exports=n},/*!************************************!*\
!*** ./~/lodash/_mapCacheClear.js ***!
\************************************/
function(e,t,r){function n(){this.size=0,this.__data__={hash:new o,map:new(s||a),string:new o}}var o=r(/*! ./_Hash */358),a=r(/*! ./_ListCache */52),s=r(/*! ./_Map */109);e.exports=n},/*!*************************************!*\
!*** ./~/lodash/_mapCacheDelete.js ***!
\*************************************/
function(e,t,r){function n(e){var t=o(this,e).delete(e);return this.size-=t?1:0,t}var o=r(/*! ./_getMapData */68);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_mapCacheGet.js ***!
\**********************************/
function(e,t,r){function n(e){return o(this,e).get(e)}var o=r(/*! ./_getMapData */68);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_mapCacheHas.js ***!
\**********************************/
function(e,t,r){function n(e){return o(this,e).has(e)}var o=r(/*! ./_getMapData */68);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_mapCacheSet.js ***!
\**********************************/
function(e,t,r){function n(e,t){var r=o(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var o=r(/*! ./_getMapData */68);e.exports=n},/*!************************************!*\
!*** ./~/lodash/_memoizeCapped.js ***!
\************************************/
function(e,t,r){function n(e){var t=o(e,function(e){return r.size===a&&r.clear(),e}),r=t.cache;return t}var o=r(/*! ./memoize */517),a=500;e.exports=n},/*!********************************!*\
!*** ./~/lodash/_mergeData.js ***!
\********************************/
function(e,t,r){function n(e,t){var r=e[1],n=t[1],m=r|n,h=m<(u|i|d),v=n==d&&r==p||n==d&&r==f&&e[7].length<=t[8]||n==(d|f)&&t[7].length<=t[8]&&r==p;if(!h&&!v)return e;n&u&&(e[2]=t[2],m|=r&u?0:c);var b=t[3];if(b){var g=e[3];e[3]=g?o(g,b,t[4]):b,e[4]=g?s(e[3],l):t[4]}return b=t[5],b&&(g=e[5],e[5]=g?a(g,b,t[6]):b,e[6]=g?s(e[5],l):t[6]),b=t[7],b&&(e[7]=b),n&d&&(e[8]=null==e[8]?t[8]:y(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=m,e}var o=r(/*! ./_composeArgs */238),a=r(/*! ./_composeArgsRight */239),s=r(/*! ./_replaceHolders */41),l="__lodash_placeholder__",u=1,i=2,c=4,p=8,d=128,f=256,y=Math.min;e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_nativeKeys.js ***!
\*********************************/
function(e,t,r){var n=r(/*! ./_overArg */125),o=n(Object.keys,Object);e.exports=o},/*!***********************************!*\
!*** ./~/lodash/_nativeKeysIn.js ***!
\***********************************/
function(e,t){function r(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}e.exports=r},/*!*******************************!*\
!*** ./~/lodash/_nodeUtil.js ***!
\*******************************/
function(e,t,r){(function(e){var n=r(/*! ./_freeGlobal */244),o="object"==typeof t&&t&&!t.nodeType&&t,a=o&&"object"==typeof e&&e&&!e.nodeType&&e,s=a&&a.exports===o,l=s&&n.process,u=function(){try{return l&&l.binding&&l.binding("util")}catch(e){}}();e.exports=u}).call(t,r(/*! ./../webpack/buildin/module.js */135)(e))},/*!*************************************!*\
!*** ./~/lodash/_objectToString.js ***!
\*************************************/
function(e,t){function r(e){return o.call(e)}var n=Object.prototype,o=n.toString;e.exports=r},/*!********************************!*\
!*** ./~/lodash/_realNames.js ***!
\********************************/
function(e,t){var r={};e.exports=r},/*!******************************!*\
!*** ./~/lodash/_reorder.js ***!
\******************************/
function(e,t,r){function n(e,t){for(var r=e.length,n=s(t.length,r),l=o(e);n--;){var u=t[n];e[n]=a(u,r)?l[u]:void 0}return e}var o=r(/*! ./_copyArray */64),a=r(/*! ./_isIndex */39),s=Math.min;e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_setCacheAdd.js ***!
\**********************************/
function(e,t){function r(e){return this.__data__.set(e,n),this}var n="__lodash_hash_undefined__";e.exports=r},/*!**********************************!*\
!*** ./~/lodash/_setCacheHas.js ***!
\**********************************/
function(e,t){function r(e){return this.__data__.has(e)}e.exports=r},/*!*********************************!*\
!*** ./~/lodash/_stackClear.js ***!
\*********************************/
function(e,t,r){function n(){this.__data__=new o,this.size=0}var o=r(/*! ./_ListCache */52);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_stackDelete.js ***!
\**********************************/
function(e,t){function r(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}e.exports=r},/*!*******************************!*\
!*** ./~/lodash/_stackGet.js ***!
\*******************************/
function(e,t){function r(e){return this.__data__.get(e)}e.exports=r},/*!*******************************!*\
!*** ./~/lodash/_stackHas.js ***!
\*******************************/
function(e,t){function r(e){return this.__data__.has(e)}e.exports=r},/*!*******************************!*\
!*** ./~/lodash/_stackSet.js ***!
\*******************************/
function(e,t,r){function n(e,t){var r=this.__data__;if(r instanceof o){var n=r.__data__;if(!a||n.length<l-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new s(n)}return r.set(e,t),this.size=r.size,this}var o=r(/*! ./_ListCache */52),a=r(/*! ./_Map */109),s=r(/*! ./_MapCache */110),l=200;e.exports=n},/*!************************************!*\
!*** ./~/lodash/_strictIndexOf.js ***!
\************************************/
function(e,t){function r(e,t,r){for(var n=r-1,o=e.length;++n<o;)if(e[n]===t)return n;return-1}e.exports=r},/*!************************************!*\
!*** ./~/lodash/_stringToArray.js ***!
\************************************/
function(e,t,r){function n(e){return a(e)?s(e):o(e)}var o=r(/*! ./_asciiToArray */364),a=r(/*! ./_hasUnicode */249),s=r(/*! ./_unicodeToArray */476);e.exports=n},/*!*************************************!*\
!*** ./~/lodash/_unicodeToArray.js ***!
\*************************************/
function(e,t){function r(e){return e.match(O)||[]}var n="\\ud800-\\udfff",o="\\u0300-\\u036f",a="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",l=o+a+s,u="\\ufe0e\\ufe0f",i="["+n+"]",c="["+l+"]",p="\\ud83c[\\udffb-\\udfff]",d="(?:"+c+"|"+p+")",f="[^"+n+"]",y="(?:\\ud83c[\\udde6-\\uddff]){2}",m="[\\ud800-\\udbff][\\udc00-\\udfff]",h="\\u200d",v=d+"?",b="["+u+"]?",g="(?:"+h+"(?:"+[f,y,m].join("|")+")"+b+v+")*",P=b+v+g,T="(?:"+[f+c+"?",c,y,m,i].join("|")+")",O=RegExp(p+"(?="+p+")|"+T+P,"g");e.exports=r},/*!***********************************!*\
!*** ./~/lodash/_unicodeWords.js ***!
\***********************************/
function(e,t){function r(e){return e.match(F)||[]}var n="\\ud800-\\udfff",o="\\u0300-\\u036f",a="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",l=o+a+s,u="\\u2700-\\u27bf",i="a-z\\xdf-\\xf6\\xf8-\\xff",c="\\xac\\xb1\\xd7\\xf7",p="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",d="\\u2000-\\u206f",f=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",y="A-Z\\xc0-\\xd6\\xd8-\\xde",m="\\ufe0e\\ufe0f",h=c+p+d+f,v="['’]",b="["+h+"]",g="["+l+"]",P="\\d+",T="["+u+"]",O="["+i+"]",_="[^"+n+h+P+u+i+y+"]",E="\\ud83c[\\udffb-\\udfff]",j="(?:"+g+"|"+E+")",w="[^"+n+"]",S="(?:\\ud83c[\\udde6-\\uddff]){2}",M="[\\ud800-\\udbff][\\udc00-\\udfff]",x="["+y+"]",N="\\u200d",A="(?:"+O+"|"+_+")",C="(?:"+x+"|"+_+")",k="(?:"+v+"(?:d|ll|m|re|s|t|ve))?",I="(?:"+v+"(?:D|LL|M|RE|S|T|VE))?",K=j+"?",L="["+m+"]?",U="(?:"+N+"(?:"+[w,S,M].join("|")+")"+L+K+")*",D="\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)",R="\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)",z=L+K+U,W="(?:"+[T,S,M].join("|")+")"+z,F=RegExp([x+"?"+O+"+"+k+"(?="+[b,x,"$"].join("|")+")",C+"+"+I+"(?="+[b,x+A,"$"].join("|")+")",x+"?"+A+"+"+k,x+"+"+I,R,D,P,W].join("|"),"g");e.exports=r},/*!****************************************!*\
!*** ./~/lodash/_updateWrapDetails.js ***!
\****************************************/
function(e,t,r){function n(e,t){return o(m,function(r){var n="_."+r[0];t&r[1]&&!a(e,n)&&e.push(n)}),e.sort()}var o=r(/*! ./_arrayEach */36),a=r(/*! ./_arrayIncludes */55),s=1,l=2,u=8,i=16,c=32,p=64,d=128,f=256,y=512,m=[["ary",d],["bind",s],["bindKey",l],["curry",u],["curryRight",i],["flip",y],["partial",c],["partialRight",p],["rearg",f]];e.exports=n},/*!***********************************!*\
!*** ./~/lodash/_wrapperClone.js ***!
\***********************************/
function(e,t,r){function n(e){if(e instanceof o)return e.clone();var t=new a(e.__wrapped__,e.__chain__);return t.__actions__=s(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var o=r(/*! ./_LazyWrapper */107),a=r(/*! ./_LodashWrapper */108),s=r(/*! ./_copyArray */64);e.exports=n},/*!*************************!*\
!*** ./~/lodash/ary.js ***!
\*************************/
function(e,t,r){function n(e,t,r){return t=r?void 0:t,t=e&&null==t?e.length:t,o(e,a,void 0,void 0,void 0,void 0,t)}var o=r(/*! ./_createWrap */38),a=128;e.exports=n},/*!****************************!*\
!*** ./~/lodash/assign.js ***!
\****************************/
function(e,t,r){var n=r(/*! ./_assignValue */57),o=r(/*! ./_copyObject */33),a=r(/*! ./_createAssigner */416),s=r(/*! ./isArrayLike */14),l=r(/*! ./_isPrototype */40),u=r(/*! ./keys */10),i=Object.prototype,c=i.hasOwnProperty,p=a(function(e,t){if(l(t)||s(t))return void o(t,u(t),e);for(var r in t)c.call(t,r)&&n(e,r,t[r])});e.exports=p},/*!***************************!*\
!*** ./~/lodash/clamp.js ***!
\***************************/
function(e,t,r){function n(e,t,r){return void 0===r&&(r=t,t=void 0),void 0!==r&&(r=a(r),r=r===r?r:0),void 0!==t&&(t=a(t),t=t===t?t:0),o(a(e),t,r)}var o=r(/*! ./_baseClamp */228),a=r(/*! ./toNumber */80);e.exports=n},/*!***************************!*\
!*** ./~/lodash/clone.js ***!
\***************************/
function(e,t,r){function n(e){return o(e,a)}var o=r(/*! ./_baseClone */115),a=4;e.exports=n},/*!******************************!*\
!*** ./~/lodash/constant.js ***!
\******************************/
function(e,t){function r(e){return function(){return e}}e.exports=r},/*!****************************!*\
!*** ./~/lodash/deburr.js ***!
\****************************/
function(e,t,r){function n(e){return e=a(e),e&&e.replace(s,o).replace(d,"")}var o=r(/*! ./_deburrLetter */428),a=r(/*! ./toString */24),s=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,l="\\u0300-\\u036f",u="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",c=l+u+i,p="["+c+"]",d=RegExp(p,"g");e.exports=n},/*!********************************!*\
!*** ./~/lodash/difference.js ***!
\********************************/
function(e,t,r){var n=r(/*! ./_baseDifference */229),o=r(/*! ./_baseFlatten */59),a=r(/*! ./_baseRest */18),s=r(/*! ./isArrayLikeObject */76),l=a(function(e,t){return s(e)?n(e,o(t,1,s,!0)):[]});e.exports=l},/*!*******************************!*\
!*** ./~/lodash/dropRight.js ***!
\*******************************/
function(e,t,r){function n(e,t,r){var n=null==e?0:e.length;return n?(t=r||void 0===t?1:a(t),t=n-t,o(e,0,t<0?0:t)):[]}var o=r(/*! ./_baseSlice */61),a=r(/*! ./toInteger */20);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/escapeRegExp.js ***!
\**********************************/
function(e,t,r){function n(e){return e=o(e),e&&s.test(e)?e.replace(a,"\\$&"):e}var o=r(/*! ./toString */24),a=/[\\^$.*+?()[\]{}|]/g,s=RegExp(a.source);e.exports=n},/*!*****************************!*\
!*** ./~/lodash/flatten.js ***!
\*****************************/
function(e,t,r){function n(e){var t=null==e?0:e.length;return t?o(e,1):[]}var o=r(/*! ./_baseFlatten */59);e.exports=n},/*!**************************!*\
!*** ./~/lodash/flow.js ***!
\**************************/
function(e,t,r){var n=r(/*! ./_createFlow */424),o=n();e.exports=o},/*!*****************************!*\
!*** ./~/lodash/forEach.js ***!
\*****************************/
function(e,t,r){function n(e,t){var r=l(e)?o:a;return r(e,s(t))}var o=r(/*! ./_arrayEach */36),a=r(/*! ./_baseEach */32),s=r(/*! ./_castFunction */237),l=r(/*! ./isArray */4);e.exports=n},/*!*************************************!*\
!*** ./~/lodash/fp/_baseConvert.js ***!
\*************************************/
function(e,t,r){function n(e,t){return 2==t?function(t,r){return e.apply(void 0,arguments)}:function(t){return e.apply(void 0,arguments)}}function o(e,t){return 2==t?function(t,r){return e(t,r)}:function(t){return e(t)}}function a(e){for(var t=e?e.length:0,r=Array(t);t--;)r[t]=e[t];return r}function s(e){return function(t){return e({},t)}}function l(e,t){return function(){for(var r=arguments.length,n=Array(r);r--;)n[r]=arguments[r];var o=n[t],a=n.length-1,s=n.slice(0,t);return o&&d.apply(s,o),t!=a&&d.apply(s,n.slice(t+1)),e.apply(this,s)}}function u(e,t){return function(){var r=arguments.length;if(r){for(var n=Array(r);r--;)n[r]=arguments[r];var o=n[0]=t.apply(void 0,n);return e.apply(void 0,n),o}}}function i(e,t,r,d){function f(e,t){if(S.cap){var r=c.iterateeRearg[e];if(r)return T(t,r);var n=!j&&c.iterateeAry[e];if(n)return P(t,n)}return t}function y(e,t,r){return M||S.curry&&r>1?U(t,r):t}function m(e,t,r){if(S.fixed&&(x||!c.skipFixed[e])){var n=c.methodSpread[e],o=n&&n.start;return void 0===o?I(t,r):l(t,o)}return t}function h(e,t,r){return S.rearg&&r>1&&(N||!c.skipRearg[e])?F(t,c.methodRearg[e]||c.aryRearg[r]):t}function v(e,t){t=B(t);for(var r=-1,n=t.length,o=n-1,a=L(Object(e)),s=a;null!=s&&++r<n;){var l=t[r],u=s[l];null!=u&&(s[t[r]]=L(r==o?u:Object(u))),s=s[l]}return a}function b(e){return H.runInContext.convert(e)(void 0)}function g(e,t){var r=c.aliasToReal[e]||e,n=c.remap[r]||r,o=d;return function(e){var a=j?C:k,s=j?C[n]:t,l=K(K({},o),e);return i(a,r,s,l)}}function P(e,t){return O(e,function(e){return"function"==typeof e?o(e,t):e})}function T(e,t){return O(e,function(e){var r=t.length;return n(F(o(e,r),t),r)})}function O(e,t){return function(){var r=arguments.length;if(!r)return e();for(var n=Array(r);r--;)n[r]=arguments[r];var o=S.rearg?0:r-1;return n[o]=t(n[o]),e.apply(void 0,n)}}function _(e,t){var r,n=c.aliasToReal[e]||e,o=t,l=q[n];return l?o=l(t):S.immutable&&(c.mutate.array[n]?o=u(t,a):c.mutate.object[n]?o=u(t,s(t)):c.mutate.set[n]&&(o=u(t,v))),D(Y,function(e){return D(c.aryMethod[e],function(t){if(n==t){var a=c.methodSpread[n],s=a&&a.afterRearg;return r=s?m(n,h(n,o,e),e):h(n,m(n,o,e),e),r=f(n,r),r=y(n,r,e),!1}}),!r}),r||(r=o),r==t&&(r=M?U(r,1):function(){return t.apply(this,arguments)}),r.convert=g(n,t),c.placeholder[n]&&(E=!0,r.placeholder=t.placeholder=A),r}var E,j="function"==typeof t,w=t===Object(t);if(w&&(d=r,r=t,t=void 0),null==r)throw new TypeError;d||(d={});var S={cap:!("cap"in d)||d.cap,curry:!("curry"in d)||d.curry,fixed:!("fixed"in d)||d.fixed,immutable:!("immutable"in d)||d.immutable,rearg:!("rearg"in d)||d.rearg},M="curry"in d&&d.curry,x="fixed"in d&&d.fixed,N="rearg"in d&&d.rearg,A=j?r:p,C=j?r.runInContext():void 0,k=j?r:{ary:e.ary,assign:e.assign,clone:e.clone,curry:e.curry,forEach:e.forEach,isArray:e.isArray,isFunction:e.isFunction,iteratee:e.iteratee,keys:e.keys,rearg:e.rearg,toInteger:e.toInteger,toPath:e.toPath},I=k.ary,K=k.assign,L=k.clone,U=k.curry,D=k.forEach,R=k.isArray,z=k.isFunction,W=k.keys,F=k.rearg,V=k.toInteger,B=k.toPath,Y=W(c.aryMethod),q={castArray:function(e){return function(){var t=arguments[0];return R(t)?e(a(t)):e.apply(void 0,arguments)}},iteratee:function(e){return function(){var t=arguments[0],r=arguments[1],n=e(t,r),a=n.length;return S.cap&&"number"==typeof r?(r=r>2?r-2:1,a&&a<=r?n:o(n,r)):n}},mixin:function(e){return function(t){var r=this;if(!z(r))return e(r,Object(t));var n=[];return D(W(t),function(e){z(t[e])&&n.push([e,r.prototype[e]])}),e(r,Object(t)),D(n,function(e){var t=e[1];z(t)?r.prototype[e[0]]=t:delete r.prototype[e[0]]}),r}},nthArg:function(e){return function(t){var r=t<0?1:V(t)+1;return U(e(t),r)}},rearg:function(e){return function(t,r){var n=r?r.length:0;return U(e(t,r),n)}},runInContext:function(t){return function(r){return i(e,t(r),d)}}};if(!w)return _(t,r);var H=r,G=[];return D(Y,function(e){D(c.aryMethod[e],function(e){var t=H[c.remap[e]||e];t&&G.push([e,_(e,t)])})}),D(W(H),function(e){var t=H[e];if("function"==typeof t){for(var r=G.length;r--;)if(G[r][0]==e)return;t.convert=g(e,t),G.push([e,t])}}),D(G,function(e){H[e[0]]=e[1]}),H.convert=b,E&&(H.placeholder=A),D(W(H),function(e){D(c.realToAlias[e]||[],function(t){H[t]=H[e]})}),H}var c=r(/*! ./_mapping */493),p=r(/*! ./placeholder */5),d=Array.prototype.push;e.exports=i},/*!*********************************!*\
!*** ./~/lodash/fp/_mapping.js ***!
\*********************************/
function(e,t){t.aliasToReal={each:"forEach",eachRight:"forEachRight",entries:"toPairs",entriesIn:"toPairsIn",extend:"assignIn",extendAll:"assignInAll",extendAllWith:"assignInAllWith",extendWith:"assignInWith",first:"head",conforms:"conformsTo",matches:"isMatch",property:"get",__:"placeholder",F:"stubFalse",T:"stubTrue",all:"every",allPass:"overEvery",always:"constant",any:"some",anyPass:"overSome",apply:"spread",assoc:"set",assocPath:"set",complement:"negate",compose:"flowRight",contains:"includes",dissoc:"unset",dissocPath:"unset",dropLast:"dropRight",dropLastWhile:"dropRightWhile",equals:"isEqual",identical:"eq",indexBy:"keyBy",init:"initial",invertObj:"invert",juxt:"over",omitAll:"omit",nAry:"ary",path:"get",pathEq:"matchesProperty",pathOr:"getOr",paths:"at",pickAll:"pick",pipe:"flow",pluck:"map",prop:"get",propEq:"matchesProperty",propOr:"getOr",props:"at",symmetricDifference:"xor",symmetricDifferenceBy:"xorBy",symmetricDifferenceWith:"xorWith",takeLast:"takeRight",takeLastWhile:"takeRightWhile",unapply:"rest",unnest:"flatten",useWith:"overArgs",where:"conformsTo",whereEq:"isMatch",zipObj:"zipObject"},t.aryMethod={1:["assignAll","assignInAll","attempt","castArray","ceil","create","curry","curryRight","defaultsAll","defaultsDeepAll","floor","flow","flowRight","fromPairs","invert","iteratee","memoize","method","mergeAll","methodOf","mixin","nthArg","over","overEvery","overSome","rest","reverse","round","runInContext","spread","template","trim","trimEnd","trimStart","uniqueId","words","zipAll"],2:["add","after","ary","assign","assignAllWith","assignIn","assignInAllWith","at","before","bind","bindAll","bindKey","chunk","cloneDeepWith","cloneWith","concat","conformsTo","countBy","curryN","curryRightN","debounce","defaults","defaultsDeep","defaultTo","delay","difference","divide","drop","dropRight","dropRightWhile","dropWhile","endsWith","eq","every","filter","find","findIndex","findKey","findLast","findLastIndex","findLastKey","flatMap","flatMapDeep","flattenDepth","forEach","forEachRight","forIn","forInRight","forOwn","forOwnRight","get","groupBy","gt","gte","has","hasIn","includes","indexOf","intersection","invertBy","invoke","invokeMap","isEqual","isMatch","join","keyBy","lastIndexOf","lt","lte","map","mapKeys","mapValues","matchesProperty","maxBy","meanBy","merge","mergeAllWith","minBy","multiply","nth","omit","omitBy","overArgs","pad","padEnd","padStart","parseInt","partial","partialRight","partition","pick","pickBy","propertyOf","pull","pullAll","pullAt","random","range","rangeRight","rearg","reject","remove","repeat","restFrom","result","sampleSize","some","sortBy","sortedIndex","sortedIndexOf","sortedLastIndex","sortedLastIndexOf","sortedUniqBy","split","spreadFrom","startsWith","subtract","sumBy","take","takeRight","takeRightWhile","takeWhile","tap","throttle","thru","times","trimChars","trimCharsEnd","trimCharsStart","truncate","union","uniqBy","uniqWith","unset","unzipWith","without","wrap","xor","zip","zipObject","zipObjectDeep"],3:["assignInWith","assignWith","clamp","differenceBy","differenceWith","findFrom","findIndexFrom","findLastFrom","findLastIndexFrom","getOr","includesFrom","indexOfFrom","inRange","intersectionBy","intersectionWith","invokeArgs","invokeArgsMap","isEqualWith","isMatchWith","flatMapDepth","lastIndexOfFrom","mergeWith","orderBy","padChars","padCharsEnd","padCharsStart","pullAllBy","pullAllWith","rangeStep","rangeStepRight","reduce","reduceRight","replace","set","slice","sortedIndexBy","sortedLastIndexBy","transform","unionBy","unionWith","update","xorBy","xorWith","zipWith"],4:["fill","setWith","updateWith"]},t.aryRearg={2:[1,0],3:[2,0,1],4:[3,2,0,1]},t.iterateeAry={dropRightWhile:1,dropWhile:1,every:1,filter:1,find:1,findFrom:1,findIndex:1,findIndexFrom:1,findKey:1,findLast:1,findLastFrom:1,findLastIndex:1,findLastIndexFrom:1,findLastKey:1,flatMap:1,flatMapDeep:1,flatMapDepth:1,forEach:1,forEachRight:1,forIn:1,forInRight:1,forOwn:1,forOwnRight:1,map:1,mapKeys:1,mapValues:1,partition:1,reduce:2,reduceRight:2,reject:1,remove:1,some:1,takeRightWhile:1,takeWhile:1,times:1,transform:2},t.iterateeRearg={mapKeys:[1]},t.methodRearg={assignInAllWith:[1,0],assignInWith:[1,2,0],assignAllWith:[1,0],assignWith:[1,2,0],differenceBy:[1,2,0],differenceWith:[1,2,0],getOr:[2,1,0],intersectionBy:[1,2,0],intersectionWith:[1,2,0],isEqualWith:[1,2,0],isMatchWith:[2,1,0],mergeAllWith:[1,0],mergeWith:[1,2,0],padChars:[2,1,0],padCharsEnd:[2,1,0],padCharsStart:[2,1,0],pullAllBy:[2,1,0],pullAllWith:[2,1,0],rangeStep:[1,2,0],rangeStepRight:[1,2,0],setWith:[3,1,2,0],sortedIndexBy:[2,1,0],sortedLastIndexBy:[2,1,0],unionBy:[1,2,0],unionWith:[1,2,0],updateWith:[3,1,2,0],xorBy:[1,2,0],xorWith:[1,2,0],zipWith:[1,2,0]},t.methodSpread={assignAll:{start:0},assignAllWith:{start:0},assignInAll:{start:0},assignInAllWith:{start:0},defaultsAll:{start:0},defaultsDeepAll:{start:0},invokeArgs:{start:2},invokeArgsMap:{start:2},mergeAll:{start:0},mergeAllWith:{start:0},partial:{start:1},partialRight:{start:1},without:{start:1},zipAll:{start:0}},t.mutate={array:{fill:!0,pull:!0,pullAll:!0,pullAllBy:!0,pullAllWith:!0,pullAt:!0,remove:!0,reverse:!0},object:{assign:!0,assignAll:!0,assignAllWith:!0,assignIn:!0,assignInAll:!0,assignInAllWith:!0,assignInWith:!0,assignWith:!0,defaults:!0,defaultsAll:!0,defaultsDeep:!0,defaultsDeepAll:!0,merge:!0,mergeAll:!0,mergeAllWith:!0,mergeWith:!0},set:{set:!0,setWith:!0,unset:!0,update:!0,updateWith:!0}},t.placeholder={bind:!0,bindKey:!0,curry:!0,curryRight:!0,partial:!0,partialRight:!0},t.realToAlias=function(){var e=Object.prototype.hasOwnProperty,r=t.aliasToReal,n={};for(var o in r){var a=r[o];e.call(n,a)?n[a].push(o):n[a]=[o]}return n}(),t.remap={assignAll:"assign",assignAllWith:"assignWith",assignInAll:"assignIn",assignInAllWith:"assignInWith",curryN:"curry",curryRightN:"curryRight",defaultsAll:"defaults",defaultsDeepAll:"defaultsDeep",findFrom:"find",findIndexFrom:"findIndex",findLastFrom:"findLast",findLastIndexFrom:"findLastIndex",getOr:"get",includesFrom:"includes",indexOfFrom:"indexOf",invokeArgs:"invoke",invokeArgsMap:"invokeMap",lastIndexOfFrom:"lastIndexOf",mergeAll:"merge",mergeAllWith:"mergeWith",padChars:"pad",padCharsEnd:"padEnd",padCharsStart:"padStart",propertyOf:"get",rangeStep:"range",rangeStepRight:"rangeRight",restFrom:"rest",spreadFrom:"spread",trimChars:"trim",trimCharsEnd:"trimEnd",trimCharsStart:"trimStart",zipAll:"zip"},t.skipFixed={castArray:!0,flow:!0,flowRight:!0,iteratee:!0,mixin:!0,rearg:!0,runInContext:!0},t.skipRearg={add:!0,assign:!0,assignIn:!0,bind:!0,bindKey:!0,concat:!0,difference:!0,divide:!0,eq:!0,gt:!0,gte:!0,isEqual:!0,lt:!0,lte:!0,matchesProperty:!0,merge:!0,multiply:!0,overArgs:!0,partial:!0,partialRight:!0,propertyOf:!0,random:!0,range:!0,rangeRight:!0,subtract:!0,zip:!0,zipObject:!0,zipObjectDeep:!0}},/*!******************************!*\
!*** ./~/lodash/fp/_util.js ***!
\******************************/
function(e,t,r){e.exports={ary:r(/*! ../ary */480),assign:r(/*! ../_baseAssign */227),clone:r(/*! ../clone */483),curry:r(/*! ../curry */263),forEach:r(/*! ../_arrayEach */36),isArray:r(/*! ../isArray */4),isFunction:r(/*! ../isFunction */28),iteratee:r(/*! ../iteratee */515),keys:r(/*! ../_baseKeys */118),rearg:r(/*! ../rearg */522),toInteger:r(/*! ../toInteger */20),toPath:r(/*! ../toPath */529)}},/*!********************************!*\
!*** ./~/lodash/fp/compact.js ***!
\********************************/
function(e,t,r){var n=r(/*! ./convert */6),o=n("compact",r(/*! ../compact */262),r(/*! ./_falseOptions */19));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!******************************!*\
!*** ./~/lodash/fp/curry.js ***!
\******************************/
function(e,t,r){var n=r(/*! ./convert */6),o=n("curry",r(/*! ../curry */263));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!***************************!*\
!*** ./~/lodash/fp/eq.js ***!
\***************************/
function(e,t,r){var n=r(/*! ./convert */6),o=n("eq",r(/*! ../eq */42));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!****************************!*\
!*** ./~/lodash/fp/get.js ***!
\****************************/
function(e,t,r){var n=r(/*! ./convert */6),o=n("get",r(/*! ../get */34));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!****************************!*\
!*** ./~/lodash/fp/has.js ***!
\****************************/
function(e,t,r){var n=r(/*! ./convert */6),o=n("has",r(/*! ../has */27));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!***********************************!*\
!*** ./~/lodash/fp/isFunction.js ***!
\***********************************/
function(e,t,r){var n=r(/*! ./convert */6),o=n("isFunction",r(/*! ../isFunction */28),r(/*! ./_falseOptions */19));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!******************************!*\
!*** ./~/lodash/fp/isNil.js ***!
\******************************/
function(e,t,r){var n=r(/*! ./convert */6),o=n("isNil",r(/*! ../isNil */270),r(/*! ./_falseOptions */19));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!*********************************!*\
!*** ./~/lodash/fp/isObject.js ***!
\*********************************/
function(e,t,r){var n=r(/*! ./convert */6),o=n("isObject",r(/*! ../isObject */12),r(/*! ./_falseOptions */19));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!**************************************!*\
!*** ./~/lodash/fp/isPlainObject.js ***!
\**************************************/
function(e,t,r){var n=r(/*! ./convert */6),o=n("isPlainObject",r(/*! ../isPlainObject */132),r(/*! ./_falseOptions */19));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!*****************************!*\
!*** ./~/lodash/fp/keys.js ***!
\*****************************/
function(e,t,r){var n=r(/*! ./convert */6),o=n("keys",r(/*! ../keys */10),r(/*! ./_falseOptions */19));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!****************************!*\
!*** ./~/lodash/fp/map.js ***!
\****************************/
function(e,t,r){var n=r(/*! ./convert */6),o=n("map",r(/*! ../map */9));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!****************************!*\
!*** ./~/lodash/fp/min.js ***!
\****************************/
function(e,t,r){var n=r(/*! ./convert */6),o=n("min",r(/*! ../min */518),r(/*! ./_falseOptions */19));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!*****************************!*\
!*** ./~/lodash/fp/pick.js ***!
\*****************************/
function(e,t,r){var n=r(/*! ./convert */6),o=n("pick",r(/*! ../pick */79));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!*******************************!*\
!*** ./~/lodash/fp/sortBy.js ***!
\*******************************/
function(e,t,r){var n=r(/*! ./convert */6),o=n("sortBy",r(/*! ../sortBy */524));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!***********************************!*\
!*** ./~/lodash/fp/startsWith.js ***!
\***********************************/
function(e,t,r){var n=r(/*! ./convert */6),o=n("startsWith",r(/*! ../startsWith */278));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!****************************!*\
!*** ./~/lodash/fp/sum.js ***!
\****************************/
function(e,t,r){var n=r(/*! ./convert */6),o=n("sum",r(/*! ../sum */527),r(/*! ./_falseOptions */19));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!*****************************!*\
!*** ./~/lodash/fp/take.js ***!
\*****************************/
function(e,t,r){var n=r(/*! ./convert */6),o=n("take",r(/*! ../take */528));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!*******************************!*\
!*** ./~/lodash/fp/values.js ***!
\*******************************/
function(e,t,r){var n=r(/*! ./convert */6),o=n("values",r(/*! ../values */134),r(/*! ./_falseOptions */19));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!*****************************!*\
!*** ./~/lodash/inRange.js ***!
\*****************************/
function(e,t,r){function n(e,t,r){return t=a(t),void 0===r?(r=t,t=0):r=a(r),e=s(e),o(e,t,r)}var o=r(/*! ./_baseInRange */373),a=r(/*! ./toFinite */281),s=r(/*! ./toNumber */80);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/intersection.js ***!
\**********************************/
function(e,t,r){var n=r(/*! ./_arrayMap */17),o=r(/*! ./_baseIntersection */374),a=r(/*! ./_baseRest */18),s=r(/*! ./_castArrayLikeObject */401),l=a(function(e){var t=n(e,s);return t.length&&t[0]===e[0]?o(t):[]});e.exports=l},/*!******************************!*\
!*** ./~/lodash/iteratee.js ***!
\******************************/
function(e,t,r){function n(e){return a("function"==typeof e?e:o(e,s))}var o=r(/*! ./_baseClone */115),a=r(/*! ./_baseIteratee */13),s=1;e.exports=n},/*!*******************************!*\
!*** ./~/lodash/mapValues.js ***!
\*******************************/
function(e,t,r){function n(e,t){var r={};return t=s(t,3),a(e,function(e,n,a){o(r,n,t(e,n,a))}),r}var o=r(/*! ./_baseAssignValue */114),a=r(/*! ./_baseForOwn */116),s=r(/*! ./_baseIteratee */13);e.exports=n},/*!*****************************!*\
!*** ./~/lodash/memoize.js ***!
\*****************************/
function(e,t,r){function n(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(a);var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var s=e.apply(this,n);return r.cache=a.set(o,s)||a,s};return r.cache=new(n.Cache||o),r}var o=r(/*! ./_MapCache */110),a="Expected a function";n.Cache=o,e.exports=n},/*!*************************!*\
!*** ./~/lodash/min.js ***!
\*************************/
function(e,t,r){function n(e){return e&&e.length?o(e,s,a):void 0}var o=r(/*! ./_baseExtremum */368),a=r(/*! ./_baseLt */383),s=r(/*! ./identity */23);e.exports=n},/*!*****************************!*\
!*** ./~/lodash/partial.js ***!
\*****************************/
function(e,t,r){var n=r(/*! ./_baseRest */18),o=r(/*! ./_createWrap */38),a=r(/*! ./_getHolder */67),s=r(/*! ./_replaceHolders */41),l=32,u=n(function(e,t){var r=s(t,a(u));return o(e,l,void 0,t,r)});u.placeholder={},e.exports=u},/*!**********************************!*\
!*** ./~/lodash/partialRight.js ***!
\**********************************/
function(e,t,r){var n=r(/*! ./_baseRest */18),o=r(/*! ./_createWrap */38),a=r(/*! ./_getHolder */67),s=r(/*! ./_replaceHolders */41),l=64,u=n(function(e,t){var r=s(t,a(u));return o(e,l,void 0,t,r)});u.placeholder={},e.exports=u},/*!******************************!*\
!*** ./~/lodash/property.js ***!
\******************************/
function(e,t,r){function n(e){return s(e)?o(l(e)):a(e)}var o=r(/*! ./_baseProperty */389),a=r(/*! ./_basePropertyDeep */390),s=r(/*! ./_isKey */124),l=r(/*! ./_toKey */22);e.exports=n},/*!***************************!*\
!*** ./~/lodash/rearg.js ***!
\***************************/
function(e,t,r){var n=r(/*! ./_createWrap */38),o=r(/*! ./_flatRest */66),a=256,s=o(function(e,t){return n(e,a,void 0,void 0,void 0,t)});e.exports=s},/*!***************************!*\
!*** ./~/lodash/round.js ***!
\***************************/
function(e,t,r){var n=r(/*! ./_createRound */426),o=n("round");e.exports=o},/*!****************************!*\
!*** ./~/lodash/sortBy.js ***!
\****************************/
function(e,t,r){var n=r(/*! ./_baseFlatten */59),o=r(/*! ./_baseOrderBy */386),a=r(/*! ./_baseRest */18),s=r(/*! ./_isIterateeCall */70),l=a(function(e,t){if(null==e)return[];var r=t.length;return r>1&&s(e,t[0],t[1])?t=[]:r>2&&s(t[0],t[1],t[2])&&(t=[t[0]]),o(e,n(t,1),[])});e.exports=l},/*!*******************************!*\
!*** ./~/lodash/startCase.js ***!
\*******************************/
function(e,t,r){var n=r(/*! ./_createCompounder */421),o=r(/*! ./upperFirst */532),a=n(function(e,t,r){return e+(r?" ":"")+o(t)});e.exports=a},/*!*******************************!*\
!*** ./~/lodash/stubFalse.js ***!
\*******************************/
function(e,t){function r(){return!1}e.exports=r},/*!*************************!*\
!*** ./~/lodash/sum.js ***!
\*************************/
function(e,t,r){function n(e){return e&&e.length?o(e,a):0}var o=r(/*! ./_baseSum */397),a=r(/*! ./identity */23);e.exports=n},/*!**************************!*\
!*** ./~/lodash/take.js ***!
\**************************/
function(e,t,r){function n(e,t,r){return e&&e.length?(t=r||void 0===t?1:a(t),o(e,0,t<0?0:t)):[]}var o=r(/*! ./_baseSlice */61),a=r(/*! ./toInteger */20);e.exports=n},/*!****************************!*\
!*** ./~/lodash/toPath.js ***!
\****************************/
function(e,t,r){function n(e){return s(e)?o(e,i):l(e)?[e]:a(u(c(e)))}var o=r(/*! ./_arrayMap */17),a=r(/*! ./_copyArray */64),s=r(/*! ./isArray */4),l=r(/*! ./isSymbol */29),u=r(/*! ./_stringToPath */260),i=r(/*! ./_toKey */22),c=r(/*! ./toString */24);e.exports=n},/*!*******************************!*\
!*** ./~/lodash/transform.js ***!
\*******************************/
function(e,t,r){function n(e,t,r){var n=i(e),y=n||c(e)||f(e);if(t=l(t,4),null==r){var m=e&&e.constructor;r=y?n?new m:[]:d(e)&&p(m)?a(u(e)):{}}return(y?o:s)(e,function(e,n,o){return t(r,e,n,o)}),r}var o=r(/*! ./_arrayEach */36),a=r(/*! ./_baseCreate */37),s=r(/*! ./_baseForOwn */116),l=r(/*! ./_baseIteratee */13),u=r(/*! ./_getPrototype */69),i=r(/*! ./isArray */4),c=r(/*! ./isBuffer */43),p=r(/*! ./isFunction */28),d=r(/*! ./isObject */12),f=r(/*! ./isTypedArray */77);e.exports=n},/*!***************************!*\
!*** ./~/lodash/union.js ***!
\***************************/
function(e,t,r){var n=r(/*! ./_baseFlatten */59),o=r(/*! ./_baseRest */18),a=r(/*! ./_baseUniq */398),s=r(/*! ./isArrayLikeObject */76),l=o(function(e){return a(n(e,1,s,!0))});e.exports=l},/*!********************************!*\
!*** ./~/lodash/upperFirst.js ***!
\********************************/
function(e,t,r){var n=r(/*! ./_createCaseFirst */420),o=n("toUpperCase");e.exports=o},/*!***************************!*\
!*** ./~/lodash/words.js ***!
\***************************/
function(e,t,r){function n(e,t,r){return e=s(e),t=r?void 0:t,void 0===t?a(e)?l(e):o(e):e.match(t)||[]}var o=r(/*! ./_asciiWords */365),a=r(/*! ./_hasUnicodeWord */436),s=r(/*! ./toString */24),l=r(/*! ./_unicodeWords */477);e.exports=n},/*!***********************************!*\
!*** ./~/lodash/wrapperLodash.js ***!
\***********************************/
function(e,t,r){function n(e){if(u(e)&&!l(e)&&!(e instanceof o)){if(e instanceof a)return e;if(p.call(e,"__wrapped__"))return i(e)}return new a(e)}var o=r(/*! ./_LazyWrapper */107),a=r(/*! ./_LodashWrapper */108),s=r(/*! ./_baseLodash */119),l=r(/*! ./isArray */4),u=r(/*! ./isObjectLike */15),i=r(/*! ./_wrapperClone */479),c=Object.prototype,p=c.hasOwnProperty;n.prototype=s.prototype,n.prototype.constructor=n,e.exports=n},/*!***********************!*\
!*** ./~/ms/index.js ***!
\***********************/
function(e,t){function r(e){if(e=String(e),!(e.length>1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*c;case"days":case"day":case"d":return r*i;case"hours":case"hour":case"hrs":case"hr":case"h":return r*u;case"minutes":case"minute":case"mins":case"min":case"m":return r*l;case"seconds":case"second":case"secs":case"sec":case"s":return r*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function n(e){return e>=i?Math.round(e/i)+"d":e>=u?Math.round(e/u)+"h":e>=l?Math.round(e/l)+"m":e>=s?Math.round(e/s)+"s":e+"ms"}function o(e){return a(e,i,"day")||a(e,u,"hour")||a(e,l,"minute")||a(e,s,"second")||e+" ms"}function a(e,t,r){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}var s=1e3,l=60*s,u=60*l,i=24*u,c=365.25*i;e.exports=function(e,t){t=t||{};var a=typeof e;if("string"===a&&e.length>0)return r(e);if("number"===a&&isNaN(e)===!1)return t.long?o(e):n(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},/*!***************************!*\
!*** external "ReactDOM" ***!
\***************************/
function(e,r){e.exports=t}])});
|
fields/types/password/PasswordColumn.js
|
vokal/keystone
|
import React from 'react';
import ItemsTableCell from '../../components/ItemsTableCell';
import ItemsTableValue from '../../components/ItemsTableValue';
var PasswordColumn = React.createClass({
displayName: 'PasswordColumn',
propTypes: {
col: React.PropTypes.object,
data: React.PropTypes.object,
},
renderValue () {
const value = this.props.data.fields[this.props.col.path];
return value ? '********' : '';
},
render () {
return (
<ItemsTableCell>
<ItemsTableValue field={this.props.col.type}>
{this.renderValue()}
</ItemsTableValue>
</ItemsTableCell>
);
},
});
module.exports = PasswordColumn;
|
app/javascript/mastodon/features/home_timeline/index.js
|
dwango/mastodon
|
import React from 'react';
import { connect } from 'react-redux';
import { expandHomeTimeline } from '../../actions/timelines';
import PropTypes from 'prop-types';
import StatusListContainer from '../ui/containers/status_list_container';
import Column from '../../components/column';
import ColumnHeader from '../../components/column_header';
import { addColumn, removeColumn, moveColumn } from '../../actions/columns';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import ColumnSettingsContainer from './containers/column_settings_container';
import { Link } from 'react-router-dom';
const messages = defineMessages({
title: { id: 'column.home', defaultMessage: 'Home' },
});
const mapStateToProps = state => ({
hasUnread: state.getIn(['timelines', 'home', 'unread']) > 0,
isPartial: state.getIn(['timelines', 'home', 'items', 0], null) === null,
});
export default @connect(mapStateToProps)
@injectIntl
class HomeTimeline extends React.PureComponent {
static propTypes = {
dispatch: PropTypes.func.isRequired,
shouldUpdateScroll: PropTypes.func,
intl: PropTypes.object.isRequired,
hasUnread: PropTypes.bool,
isPartial: PropTypes.bool,
columnId: PropTypes.string,
multiColumn: PropTypes.bool,
};
handlePin = () => {
const { columnId, dispatch } = this.props;
if (columnId) {
dispatch(removeColumn(columnId));
} else {
dispatch(addColumn('HOME', {}));
}
}
handleMove = (dir) => {
const { columnId, dispatch } = this.props;
dispatch(moveColumn(columnId, dir));
}
handleHeaderClick = () => {
this.column.scrollTop();
}
setRef = c => {
this.column = c;
}
handleLoadMore = maxId => {
this.props.dispatch(expandHomeTimeline({ maxId }));
}
componentDidMount () {
this._checkIfReloadNeeded(false, this.props.isPartial);
}
componentDidUpdate (prevProps) {
this._checkIfReloadNeeded(prevProps.isPartial, this.props.isPartial);
}
componentWillUnmount () {
this._stopPolling();
}
_checkIfReloadNeeded (wasPartial, isPartial) {
const { dispatch } = this.props;
if (wasPartial === isPartial) {
return;
} else if (!wasPartial && isPartial) {
this.polling = setInterval(() => {
dispatch(expandHomeTimeline());
}, 3000);
} else if (wasPartial && !isPartial) {
this._stopPolling();
}
}
_stopPolling () {
if (this.polling) {
clearInterval(this.polling);
this.polling = null;
}
}
render () {
const { intl, shouldUpdateScroll, hasUnread, columnId, multiColumn } = this.props;
const pinned = !!columnId;
return (
<Column ref={this.setRef} label={intl.formatMessage(messages.title)}>
<ColumnHeader
icon='home'
active={hasUnread}
title={intl.formatMessage(messages.title)}
onPin={this.handlePin}
onMove={this.handleMove}
onClick={this.handleHeaderClick}
pinned={pinned}
multiColumn={multiColumn}
>
<ColumnSettingsContainer />
</ColumnHeader>
<StatusListContainer
trackScroll={!pinned}
scrollKey={`home_timeline-${columnId}`}
onLoadMore={this.handleLoadMore}
timelineId='home'
emptyMessage={<FormattedMessage id='empty_column.home' defaultMessage='Your home timeline is empty! Visit {public} or use search to get started and meet other users.' values={{ public: <Link to='/timelines/public'><FormattedMessage id='empty_column.home.public_timeline' defaultMessage='the public timeline' /></Link> }} />}
shouldUpdateScroll={shouldUpdateScroll}
/>
</Column>
);
}
}
|
src/components/Task/PriorityIndicator.js
|
Charlie9830/pounder
|
import React from 'react';
import { withTheme } from '@material-ui/core';
const PriorityIndicator = (props) => {
let { theme } = props;
if (props.isHighPriority === false) {
return null;
}
else {
let priorityStyle = {
width: '8px',
height: '100%',
background: theme.palette.custom.highPriority,
}
return (
<div style={priorityStyle}/>
)
}
};
export default withTheme()(PriorityIndicator);
|
tests/Rules-isAlphanumeric-spec.js
|
lei-clearsky/temp
|
import React from 'react';
import TestUtils from 'react-addons-test-utils';
import Formsy from './..';
import { InputFactory } from './utils/TestInput';
const TestInput = InputFactory({
render() {
return <input value={this.getValue()} readOnly/>;
}
});
const TestForm = React.createClass({
render() {
return (
<Formsy.Form>
<TestInput name="foo" validations="isAlphanumeric" value={this.props.inputValue}/>
</Formsy.Form>
);
}
});
export default {
'should pass with a default value': function (test) {
const form = TestUtils.renderIntoDocument(<TestForm/>);
const inputComponent = TestUtils.findRenderedComponentWithType(form, TestInput);
test.equal(inputComponent.isValid(), true);
test.done();
},
'should pass with a string is only latin letters': function (test) {
const form = TestUtils.renderIntoDocument(<TestForm inputValue="myValue"/>);
const inputComponent = TestUtils.findRenderedComponentWithType(form, TestInput);
test.equal(inputComponent.isValid(), true);
test.done();
},
'should fail with a string with numbers': function (test) {
const form = TestUtils.renderIntoDocument(<TestForm inputValue="myValue42"/>);
const inputComponent = TestUtils.findRenderedComponentWithType(form, TestInput);
test.equal(inputComponent.isValid(), true);
test.done();
},
'should pass with an undefined': function (test) {
const form = TestUtils.renderIntoDocument(<TestForm inputValue={undefined}/>);
const inputComponent = TestUtils.findRenderedComponentWithType(form, TestInput);
test.equal(inputComponent.isValid(), true);
test.done();
},
'should pass with a null': function (test) {
const form = TestUtils.renderIntoDocument(<TestForm inputValue={null}/>);
const inputComponent = TestUtils.findRenderedComponentWithType(form, TestInput);
test.equal(inputComponent.isValid(), true);
test.done();
},
'should pass with an empty string': function (test) {
const form = TestUtils.renderIntoDocument(<TestForm inputValue={''}/>);
const inputComponent = TestUtils.findRenderedComponentWithType(form, TestInput);
test.equal(inputComponent.isValid(), true);
test.done();
},
'should pass with a number': function (test) {
const form = TestUtils.renderIntoDocument(<TestForm inputValue={42}/>);
const inputComponent = TestUtils.findRenderedComponentWithType(form, TestInput);
test.equal(inputComponent.isValid(), true);
test.done();
},
'should fail with a non alpha and number symbols': function (test) {
const value = '!@#$%^&*()';
const form = TestUtils.renderIntoDocument(<TestForm inputValue={value}/>);
const inputComponent = TestUtils.findRenderedComponentWithType(form, TestInput);
test.equal(inputComponent.isValid(), false);
test.done();
}
};
|
app/components/Empty.js
|
cdiezmoran/AlphaStage-desktop
|
// @flow
import React, { Component } from 'react';
import type { Element } from 'react';
class Empty extends Component {
props: {
title: string,
description: Element<*>
}
render() {
const { title, description } = this.props;
return (
<div className="empty-component">
<h3>{title}</h3>
{description}
</div>
);
}
}
export default Empty;
|
ajax/libs/boardgame-io/0.46.0/esm/react.js
|
cdnjs/cdnjs
|
import 'nanoid';
import './Debug-2442efb1.js';
import 'redux';
import './turn-order-21b8f302.js';
import 'immer';
import 'lodash.isplainobject';
import './reducer-f5240269.js';
import 'rfc6902';
import './initialize-c886df92.js';
import './transport-0079de87.js';
import { C as Client$1 } from './client-cb18d220.js';
import 'flatted';
import { M as MCTSBot } from './ai-6a82d805.js';
import { L as LobbyClient } from './client-99609c4d.js';
import React from 'react';
import PropTypes from 'prop-types';
import Cookies from 'react-cookies';
import './base-13e38c3e.js';
import { S as SocketIO, L as Local } from './socketio-fbc37e56.js';
import './master-cf421046.js';
import 'socket.io-client';
/*
* Copyright 2017 The boardgame.io Authors
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
*/
/**
* Client
*
* boardgame.io React client.
*
* @param {...object} game - The return value of `Game`.
* @param {...object} numPlayers - The number of players.
* @param {...object} board - The React component for the game.
* @param {...object} loading - (optional) The React component for the loading state.
* @param {...object} multiplayer - Set to a falsy value or a transportFactory, e.g., SocketIO()
* @param {...object} debug - Enables the Debug UI.
* @param {...object} enhancer - Optional enhancer to send to the Redux store
*
* Returns:
* A React component that wraps board and provides an
* API through props for it to interact with the framework
* and dispatch actions such as MAKE_MOVE, GAME_EVENT, RESET,
* UNDO and REDO.
*/
function Client(opts) {
var _a;
let { game, numPlayers, loading, board, multiplayer, enhancer, debug } = opts;
// Component that is displayed before the client has synced
// with the game master.
if (loading === undefined) {
const Loading = () => React.createElement("div", { className: "bgio-loading" }, "connecting...");
loading = Loading;
}
/*
* WrappedBoard
*
* The main React component that wraps the passed in
* board component and adds the API to its props.
*/
return _a = class WrappedBoard extends React.Component {
constructor(props) {
super(props);
if (debug === undefined) {
debug = props.debug;
}
this.client = Client$1({
game,
debug,
numPlayers,
multiplayer,
matchID: props.matchID,
playerID: props.playerID,
credentials: props.credentials,
enhancer,
});
}
componentDidMount() {
this.unsubscribe = this.client.subscribe(() => this.forceUpdate());
this.client.start();
}
componentWillUnmount() {
this.client.stop();
this.unsubscribe();
}
componentDidUpdate(prevProps) {
if (this.props.matchID != prevProps.matchID) {
this.client.updateMatchID(this.props.matchID);
}
if (this.props.playerID != prevProps.playerID) {
this.client.updatePlayerID(this.props.playerID);
}
if (this.props.credentials != prevProps.credentials) {
this.client.updateCredentials(this.props.credentials);
}
}
render() {
const state = this.client.getState();
if (state === null) {
return React.createElement(loading);
}
let _board = null;
if (board) {
_board = React.createElement(board, {
...state,
...this.props,
isMultiplayer: !!multiplayer,
moves: this.client.moves,
events: this.client.events,
matchID: this.client.matchID,
playerID: this.client.playerID,
reset: this.client.reset,
undo: this.client.undo,
redo: this.client.redo,
log: this.client.log,
matchData: this.client.matchData,
sendChatMessage: this.client.sendChatMessage,
chatMessages: this.client.chatMessages,
});
}
return React.createElement("div", { className: "bgio-client" }, _board);
}
},
_a.propTypes = {
// The ID of a game to connect to.
// Only relevant in multiplayer.
matchID: PropTypes.string,
// The ID of the player associated with this client.
// Only relevant in multiplayer.
playerID: PropTypes.string,
// This client's authentication credentials.
// Only relevant in multiplayer.
credentials: PropTypes.string,
// Enable / disable the Debug UI.
debug: PropTypes.any,
},
_a.defaultProps = {
matchID: 'default',
playerID: null,
credentials: null,
debug: true,
},
_a;
}
/*
* Copyright 2018 The boardgame.io Authors
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
*/
class _LobbyConnectionImpl {
constructor({ server, gameComponents, playerName, playerCredentials, }) {
this.client = new LobbyClient({ server });
this.gameComponents = gameComponents;
this.playerName = playerName || 'Visitor';
this.playerCredentials = playerCredentials;
this.matches = [];
}
async refresh() {
try {
this.matches = [];
const games = await this.client.listGames();
for (const game of games) {
if (!this._getGameComponents(game))
continue;
const { matches } = await this.client.listMatches(game);
this.matches.push(...matches);
}
}
catch (error) {
throw new Error('failed to retrieve list of matches (' + error + ')');
}
}
_getMatchInstance(matchID) {
for (const inst of this.matches) {
if (inst['matchID'] === matchID)
return inst;
}
}
_getGameComponents(gameName) {
for (const comp of this.gameComponents) {
if (comp.game.name === gameName)
return comp;
}
}
_findPlayer(playerName) {
for (const inst of this.matches) {
if (inst.players.some((player) => player.name === playerName))
return inst;
}
}
async join(gameName, matchID, playerID) {
try {
let inst = this._findPlayer(this.playerName);
if (inst) {
throw new Error('player has already joined ' + inst.matchID);
}
inst = this._getMatchInstance(matchID);
if (!inst) {
throw new Error('game instance ' + matchID + ' not found');
}
const json = await this.client.joinMatch(gameName, matchID, {
playerID,
playerName: this.playerName,
});
inst.players[Number.parseInt(playerID)].name = this.playerName;
this.playerCredentials = json.playerCredentials;
}
catch (error) {
throw new Error('failed to join match ' + matchID + ' (' + error + ')');
}
}
async leave(gameName, matchID) {
try {
const inst = this._getMatchInstance(matchID);
if (!inst)
throw new Error('match instance not found');
for (const player of inst.players) {
if (player.name === this.playerName) {
await this.client.leaveMatch(gameName, matchID, {
playerID: player.id.toString(),
credentials: this.playerCredentials,
});
delete player.name;
delete this.playerCredentials;
return;
}
}
throw new Error('player not found in match');
}
catch (error) {
throw new Error('failed to leave match ' + matchID + ' (' + error + ')');
}
}
async disconnect() {
const inst = this._findPlayer(this.playerName);
if (inst) {
await this.leave(inst.gameName, inst.matchID);
}
this.matches = [];
this.playerName = 'Visitor';
}
async create(gameName, numPlayers) {
try {
const comp = this._getGameComponents(gameName);
if (!comp)
throw new Error('game not found');
if (numPlayers < comp.game.minPlayers ||
numPlayers > comp.game.maxPlayers)
throw new Error('invalid number of players ' + numPlayers);
await this.client.createMatch(gameName, { numPlayers });
}
catch (error) {
throw new Error('failed to create match for ' + gameName + ' (' + error + ')');
}
}
}
/**
* LobbyConnection
*
* Lobby model.
*
* @param {string} server - '<host>:<port>' of the server.
* @param {Array} gameComponents - A map of Board and Game objects for the supported games.
* @param {string} playerName - The name of the player.
* @param {string} playerCredentials - The credentials currently used by the player, if any.
*
* Returns:
* A JS object that synchronizes the list of running game instances with the server and provides an API to create/join/start instances.
*/
function LobbyConnection(opts) {
return new _LobbyConnectionImpl(opts);
}
/*
* Copyright 2018 The boardgame.io Authors.
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
*/
class LobbyLoginForm extends React.Component {
constructor() {
super(...arguments);
this.state = {
playerName: this.props.playerName,
nameErrorMsg: '',
};
this.onClickEnter = () => {
if (this.state.playerName === '')
return;
this.props.onEnter(this.state.playerName);
};
this.onKeyPress = (event) => {
if (event.key === 'Enter') {
this.onClickEnter();
}
};
this.onChangePlayerName = (event) => {
const name = event.target.value.trim();
this.setState({
playerName: name,
nameErrorMsg: name.length > 0 ? '' : 'empty player name',
});
};
}
render() {
return (React.createElement("div", null,
React.createElement("p", { className: "phase-title" }, "Choose a player name:"),
React.createElement("input", { type: "text", value: this.state.playerName, onChange: this.onChangePlayerName, onKeyPress: this.onKeyPress }),
React.createElement("span", { className: "buttons" },
React.createElement("button", { className: "buttons", onClick: this.onClickEnter }, "Enter")),
React.createElement("br", null),
React.createElement("span", { className: "error-msg" },
this.state.nameErrorMsg,
React.createElement("br", null))));
}
}
LobbyLoginForm.defaultProps = {
playerName: '',
};
/*
* Copyright 2018 The boardgame.io Authors.
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
*/
class LobbyMatchInstance extends React.Component {
constructor() {
super(...arguments);
this._createSeat = (player) => {
return player.name || '[free]';
};
this._createButtonJoin = (inst, seatId) => (React.createElement("button", { key: 'button-join-' + inst.matchID, onClick: () => this.props.onClickJoin(inst.gameName, inst.matchID, '' + seatId) }, "Join"));
this._createButtonLeave = (inst) => (React.createElement("button", { key: 'button-leave-' + inst.matchID, onClick: () => this.props.onClickLeave(inst.gameName, inst.matchID) }, "Leave"));
this._createButtonPlay = (inst, seatId) => (React.createElement("button", { key: 'button-play-' + inst.matchID, onClick: () => this.props.onClickPlay(inst.gameName, {
matchID: inst.matchID,
playerID: '' + seatId,
numPlayers: inst.players.length,
}) }, "Play"));
this._createButtonSpectate = (inst) => (React.createElement("button", { key: 'button-spectate-' + inst.matchID, onClick: () => this.props.onClickPlay(inst.gameName, {
matchID: inst.matchID,
numPlayers: inst.players.length,
}) }, "Spectate"));
this._createInstanceButtons = (inst) => {
const playerSeat = inst.players.find((player) => player.name === this.props.playerName);
const freeSeat = inst.players.find((player) => !player.name);
if (playerSeat && freeSeat) {
// already seated: waiting for match to start
return this._createButtonLeave(inst);
}
if (freeSeat) {
// at least 1 seat is available
return this._createButtonJoin(inst, freeSeat.id);
}
// match is full
if (playerSeat) {
return (React.createElement("div", null, [
this._createButtonPlay(inst, playerSeat.id),
this._createButtonLeave(inst),
]));
}
// allow spectating
return this._createButtonSpectate(inst);
};
}
render() {
const match = this.props.match;
let status = 'OPEN';
if (!match.players.some((player) => !player.name)) {
status = 'RUNNING';
}
return (React.createElement("tr", { key: 'line-' + match.matchID },
React.createElement("td", { key: 'cell-name-' + match.matchID }, match.gameName),
React.createElement("td", { key: 'cell-status-' + match.matchID }, status),
React.createElement("td", { key: 'cell-seats-' + match.matchID }, match.players.map((player) => this._createSeat(player)).join(', ')),
React.createElement("td", { key: 'cell-buttons-' + match.matchID }, this._createInstanceButtons(match))));
}
}
/*
* Copyright 2018 The boardgame.io Authors.
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
*/
class LobbyCreateMatchForm extends React.Component {
constructor(props) {
super(props);
this.state = {
selectedGame: 0,
numPlayers: 2,
};
this._createGameNameOption = (game, idx) => {
return (React.createElement("option", { key: 'name-option-' + idx, value: idx }, game.game.name));
};
this._createNumPlayersOption = (idx) => {
return (React.createElement("option", { key: 'num-option-' + idx, value: idx }, idx));
};
this._createNumPlayersRange = (game) => {
return Array.from({ length: game.maxPlayers + 1 })
.map((_, i) => i)
.slice(game.minPlayers);
};
this.onChangeNumPlayers = (event) => {
this.setState({
numPlayers: Number.parseInt(event.target.value),
});
};
this.onChangeSelectedGame = (event) => {
const idx = Number.parseInt(event.target.value);
this.setState({
selectedGame: idx,
numPlayers: this.props.games[idx].game.minPlayers,
});
};
this.onClickCreate = () => {
this.props.createMatch(this.props.games[this.state.selectedGame].game.name, this.state.numPlayers);
};
/* fix min and max number of players */
for (const game of props.games) {
const matchDetails = game.game;
if (!matchDetails.minPlayers) {
matchDetails.minPlayers = 1;
}
if (!matchDetails.maxPlayers) {
matchDetails.maxPlayers = 4;
}
console.assert(matchDetails.maxPlayers >= matchDetails.minPlayers);
}
this.state = {
selectedGame: 0,
numPlayers: props.games[0].game.minPlayers,
};
}
render() {
return (React.createElement("div", null,
React.createElement("select", { value: this.state.selectedGame, onChange: (evt) => this.onChangeSelectedGame(evt) }, this.props.games.map((game, index) => this._createGameNameOption(game, index))),
React.createElement("span", null, "Players:"),
React.createElement("select", { value: this.state.numPlayers, onChange: this.onChangeNumPlayers }, this._createNumPlayersRange(this.props.games[this.state.selectedGame].game).map((number) => this._createNumPlayersOption(number))),
React.createElement("span", { className: "buttons" },
React.createElement("button", { onClick: this.onClickCreate }, "Create"))));
}
}
/*
* Copyright 2018 The boardgame.io Authors.
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
*/
var LobbyPhases;
(function (LobbyPhases) {
LobbyPhases["ENTER"] = "enter";
LobbyPhases["PLAY"] = "play";
LobbyPhases["LIST"] = "list";
})(LobbyPhases || (LobbyPhases = {}));
/**
* Lobby
*
* React lobby component.
*
* @param {Array} gameComponents - An array of Board and Game objects for the supported games.
* @param {string} lobbyServer - Address of the lobby server (for example 'localhost:8000').
* If not set, defaults to the server that served the page.
* @param {string} gameServer - Address of the game server (for example 'localhost:8001').
* If not set, defaults to the server that served the page.
* @param {function} clientFactory - Function that is used to create the game clients.
* @param {number} refreshInterval - Interval between server updates (default: 2000ms).
* @param {bool} debug - Enable debug information (default: false).
*
* Returns:
* A React component that provides a UI to create, list, join, leave, play or
* spectate matches (game instances).
*/
class Lobby extends React.Component {
constructor(props) {
super(props);
this.state = {
phase: LobbyPhases.ENTER,
playerName: 'Visitor',
runningMatch: null,
errorMsg: '',
credentialStore: {},
};
this._createConnection = (props) => {
const name = this.state.playerName;
this.connection = LobbyConnection({
server: props.lobbyServer,
gameComponents: props.gameComponents,
playerName: name,
playerCredentials: this.state.credentialStore[name],
});
};
this._updateCredentials = (playerName, credentials) => {
this.setState((prevState) => {
// clone store or componentDidUpdate will not be triggered
const store = Object.assign({}, prevState.credentialStore);
store[playerName] = credentials;
return { credentialStore: store };
});
};
this._updateConnection = async () => {
await this.connection.refresh();
this.forceUpdate();
};
this._enterLobby = (playerName) => {
this.setState({ playerName, phase: LobbyPhases.LIST });
};
this._exitLobby = async () => {
await this.connection.disconnect();
this.setState({ phase: LobbyPhases.ENTER, errorMsg: '' });
};
this._createMatch = async (gameName, numPlayers) => {
try {
await this.connection.create(gameName, numPlayers);
await this.connection.refresh();
// rerender
this.setState({});
}
catch (error) {
this.setState({ errorMsg: error.message });
}
};
this._joinMatch = async (gameName, matchID, playerID) => {
try {
await this.connection.join(gameName, matchID, playerID);
await this.connection.refresh();
this._updateCredentials(this.connection.playerName, this.connection.playerCredentials);
}
catch (error) {
this.setState({ errorMsg: error.message });
}
};
this._leaveMatch = async (gameName, matchID) => {
try {
await this.connection.leave(gameName, matchID);
await this.connection.refresh();
this._updateCredentials(this.connection.playerName, this.connection.playerCredentials);
}
catch (error) {
this.setState({ errorMsg: error.message });
}
};
this._startMatch = (gameName, matchOpts) => {
const gameCode = this.connection._getGameComponents(gameName);
if (!gameCode) {
this.setState({
errorMsg: 'game ' + gameName + ' not supported',
});
return;
}
let multiplayer = undefined;
if (matchOpts.numPlayers > 1) {
multiplayer = this.props.gameServer
? SocketIO({ server: this.props.gameServer })
: SocketIO();
}
if (matchOpts.numPlayers == 1) {
const maxPlayers = gameCode.game.maxPlayers;
const bots = {};
for (let i = 1; i < maxPlayers; i++) {
bots[i + ''] = MCTSBot;
}
multiplayer = Local({ bots });
}
const app = this.props.clientFactory({
game: gameCode.game,
board: gameCode.board,
debug: this.props.debug,
multiplayer,
});
const match = {
app: app,
matchID: matchOpts.matchID,
playerID: matchOpts.numPlayers > 1 ? matchOpts.playerID : '0',
credentials: this.connection.playerCredentials,
};
this.setState({ phase: LobbyPhases.PLAY, runningMatch: match });
};
this._exitMatch = () => {
this.setState({ phase: LobbyPhases.LIST, runningMatch: null });
};
this._getPhaseVisibility = (phase) => {
return this.state.phase !== phase ? 'hidden' : 'phase';
};
this.renderMatches = (matches, playerName) => {
return matches.map((match) => {
const { matchID, gameName, players } = match;
return (React.createElement(LobbyMatchInstance, { key: 'instance-' + matchID, match: { matchID, gameName, players: Object.values(players) }, playerName: playerName, onClickJoin: this._joinMatch, onClickLeave: this._leaveMatch, onClickPlay: this._startMatch }));
});
};
this._createConnection(this.props);
setInterval(this._updateConnection, this.props.refreshInterval);
}
componentDidMount() {
const cookie = Cookies.load('lobbyState') || {};
if (cookie.phase && cookie.phase === LobbyPhases.PLAY) {
cookie.phase = LobbyPhases.LIST;
}
this.setState({
phase: cookie.phase || LobbyPhases.ENTER,
playerName: cookie.playerName || 'Visitor',
credentialStore: cookie.credentialStore || {},
});
}
componentDidUpdate(prevProps, prevState) {
const name = this.state.playerName;
const creds = this.state.credentialStore[name];
if (prevState.phase !== this.state.phase ||
prevState.credentialStore[name] !== creds ||
prevState.playerName !== name) {
this._createConnection(this.props);
this._updateConnection();
const cookie = {
phase: this.state.phase,
playerName: name,
credentialStore: this.state.credentialStore,
};
Cookies.save('lobbyState', cookie, { path: '/' });
}
}
render() {
const { gameComponents, renderer } = this.props;
const { errorMsg, playerName, phase, runningMatch } = this.state;
if (renderer) {
return renderer({
errorMsg,
gameComponents,
matches: this.connection.matches,
phase,
playerName,
runningMatch,
handleEnterLobby: this._enterLobby,
handleExitLobby: this._exitLobby,
handleCreateMatch: this._createMatch,
handleJoinMatch: this._joinMatch,
handleLeaveMatch: this._leaveMatch,
handleExitMatch: this._exitMatch,
handleRefreshMatches: this._updateConnection,
handleStartMatch: this._startMatch,
});
}
return (React.createElement("div", { id: "lobby-view", style: { padding: 50 } },
React.createElement("div", { className: this._getPhaseVisibility(LobbyPhases.ENTER) },
React.createElement(LobbyLoginForm, { key: playerName, playerName: playerName, onEnter: this._enterLobby })),
React.createElement("div", { className: this._getPhaseVisibility(LobbyPhases.LIST) },
React.createElement("p", null,
"Welcome, ",
playerName),
React.createElement("div", { className: "phase-title", id: "match-creation" },
React.createElement("span", null, "Create a match:"),
React.createElement(LobbyCreateMatchForm, { games: gameComponents, createMatch: this._createMatch })),
React.createElement("p", { className: "phase-title" }, "Join a match:"),
React.createElement("div", { id: "instances" },
React.createElement("table", null,
React.createElement("tbody", null, this.renderMatches(this.connection.matches, playerName))),
React.createElement("span", { className: "error-msg" },
errorMsg,
React.createElement("br", null))),
React.createElement("p", { className: "phase-title" }, "Matches that become empty are automatically deleted.")),
React.createElement("div", { className: this._getPhaseVisibility(LobbyPhases.PLAY) },
runningMatch && (React.createElement(runningMatch.app, { matchID: runningMatch.matchID, playerID: runningMatch.playerID, credentials: runningMatch.credentials })),
React.createElement("div", { className: "buttons", id: "match-exit" },
React.createElement("button", { onClick: this._exitMatch }, "Exit match"))),
React.createElement("div", { className: "buttons", id: "lobby-exit" },
React.createElement("button", { onClick: this._exitLobby }, "Exit lobby"))));
}
}
Lobby.propTypes = {
gameComponents: PropTypes.array.isRequired,
lobbyServer: PropTypes.string,
gameServer: PropTypes.string,
debug: PropTypes.bool,
clientFactory: PropTypes.func,
refreshInterval: PropTypes.number,
};
Lobby.defaultProps = {
debug: false,
clientFactory: Client,
refreshInterval: 2000,
};
export { Client, Lobby };
|
ajax/libs/react/0.3.3/JSXTransformer.js
|
emijrp/cdnjs
|
/**
* JSXTransformer v0.3.3
*/
(function(e){if("function"==typeof bootstrap)bootstrap("jsxtransformer",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeJSXTransformer=e}else"undefined"!=typeof window?window.JSXTransformer=e():global.JSXTransformer=e()})(function(){var define,ses,bootstrap,module,exports;
return (function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0].call(u.exports,function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;s<n.length;s++)i(n[s]);return i})({1:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* jshint browser: true */
/* jslint evil: true */
'use strict';
var runScripts;
var transform = require('./fbtransform/lib/transform').transform;
var visitors = require('./fbtransform/visitors').transformVisitors;
var transform = transform.bind(null, visitors.react);
var docblock = require('./fbtransform/lib/docblock');
var headEl = document.getElementsByTagName('head')[0];
exports.transform = transform;
exports.exec = function(code) {
return eval(transform(code));
};
var run = exports.run = function(code) {
var jsx = docblock.parseAsObject(docblock.extract(code)).jsx;
var functionBody = jsx ? transform(code).code : code;
var scriptEl = document.createElement('script');
scriptEl.innerHTML = functionBody;
headEl.appendChild(scriptEl);
};
if (typeof window === "undefined" || window === null) {
return;
}
var load = exports.load = function(url, callback) {
var xhr;
xhr = window.ActiveXObject ? new window.ActiveXObject('Microsoft.XMLHTTP')
: new XMLHttpRequest();
// Disable async since we need to execute scripts in the order they are in the
// DOM to mirror normal script loading.
xhr.open('GET', url, false);
if ('overrideMimeType' in xhr) {
xhr.overrideMimeType('text/plain');
}
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
if (xhr.status === 0 || xhr.status === 200) {
run(xhr.responseText);
} else {
throw new Error("Could not load " + url);
}
if (callback) {
return callback();
}
}
};
return xhr.send(null);
};
runScripts = function() {
var scripts = document.getElementsByTagName('script');
scripts = Array.prototype.slice.call(scripts);
var jsxScripts = scripts.filter(function(script) {
return script.type === 'text/jsx';
});
jsxScripts.forEach(function(script) {
if (script.src) {
load(script.src);
} else {
run(script.innerHTML);
}
});
};
if (window.addEventListener) {
window.addEventListener('DOMContentLoaded', runScripts, false);
} else {
window.attachEvent('onload', runScripts);
}
},{"./fbtransform/lib/transform":2,"./fbtransform/visitors":3,"./fbtransform/lib/docblock":4}],4:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var docblockRe = /^\s*(\/\*\*(.|\n)*?\*\/)/;
var ltrimRe = /^\s*/;
/**
* @param {String} contents
* @return {String}
*/
function extract(contents) {
var match = contents.match(docblockRe);
if (match) {
return match[0].replace(ltrimRe, '') || '';
}
return '';
}
var commentStartRe = /^\/\*\*?/;
var commentEndRe = /\*\/$/;
var wsRe = /[\t ]+/g;
var stringStartRe = /(\n|^) *\*/g;
var multilineRe = /(?:^|\n) *(@[^\n]*?) *\n *([^@\n\s][^@\n]+?) *\n/g;
var propertyRe = /(?:^|\n) *@(\S+) *([^\n]*)/g;
/**
* @param {String} contents
* @return {Array}
*/
function parse(docblock) {
docblock = docblock
.replace(commentStartRe, '')
.replace(commentEndRe, '')
.replace(wsRe, ' ')
.replace(stringStartRe, '$1');
// Normalize multi-line directives
var prev = '';
while (prev != docblock) {
prev = docblock;
docblock = docblock.replace(multilineRe, "\n$1 $2\n");
}
docblock = docblock.trim();
var result = [];
var match;
while (match = propertyRe.exec(docblock)) {
result.push([match[1], match[2]]);
}
return result;
}
/**
* Same as parse but returns an object of prop: value instead of array of paris
* If a property appers more than once the last one will be returned
*
* @param {String} contents
* @return {Object}
*/
function parseAsObject(docblock) {
var pairs = parse(docblock);
var result = {};
for (var i = 0; i < pairs.length; i++) {
result[pairs[i][0]] = pairs[i][1];
}
return result;
}
exports.extract = extract;
exports.parse = parse;
exports.parseAsObject = parseAsObject;
},{}],3:[function(require,module,exports){
(function(){/*global exports:true*/
var classes = require('./transforms/classes');
var react = require('./transforms/react');
var reactDisplayName = require('./transforms/reactDisplayName');
/**
* Map from transformName => orderedListOfVisitors.
*/
var transformVisitors = {
'es6-classes': [
classes.visitClassExpression,
classes.visitClassDeclaration,
classes.visitSuperCall,
classes.visitPrivateProperty
]
};
transformVisitors.react = transformVisitors[
"es6-classes"
].concat([
react.visitReactTag,
reactDisplayName.visitReactDisplayName
]);
/**
* Specifies the order in which each transform should run.
*/
var transformRunOrder = [
'es6-classes',
'react'
];
/**
* Given a list of transform names, return the ordered list of visitors to be
* passed to the transform() function.
*
* @param {array?} excludes
* @return {array}
*/
function getVisitorsList(excludes) {
var ret = [];
for (var i = 0, il = transformRunOrder.length; i < il; i++) {
if (!excludes || excludes.indexOf(transformRunOrder[i]) === -1) {
ret = ret.concat(transformVisitors[transformRunOrder[i]]);
}
}
return ret;
}
exports.getVisitorsList = getVisitorsList;
exports.transformVisitors = transformVisitors;
})()
},{"./transforms/classes":5,"./transforms/react":6,"./transforms/reactDisplayName":7}],8:[function(require,module,exports){
(function(){/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*global exports:true*/
/**
* State represents the given parser state. It has a local and global parts.
* Global contains parser position, source, etc. Local contains scope based
* properties, like current class name. State should contain all the info
* required for transformation. It's the only mandatory object that is being
* passed to every function in transform chain.
*
* @param {String} source
* @param {Object} transformOptions
* @return {Object}
*/
function createState(source, transformOptions) {
return {
/**
* Name of the super class variable
* @type {String}
*/
superVar: '',
/**
* Name of the enclosing class scope
* @type {String}
*/
scopeName: '',
/**
* Global state (not affected by updateState)
* @type {Object}
*/
g: {
/**
* A set of general options that transformations can consider while doing
* a transformation:
*
* - minify
* Specifies that transformation steps should do their best to minify
* the output source when possible. This is useful for places where
* minification optimizations are possible with higher-level context
* info than what jsxmin can provide.
*
* For example, the ES6 class transform will minify munged private
* variables if this flag is set.
*/
opts: transformOptions,
/**
* Current position in the source code
* @type {Number}
*/
position: 0,
/**
* Buffer containing the result
* @type {String}
*/
buffer: '',
/**
* Indentation offset (only negative offset is supported now)
* @type {Number}
*/
indentBy: 0,
/**
* Source that is being transformed
* @type {String}
*/
source: source,
/**
* Cached parsed docblock (see getDocblock)
* @type {object}
*/
docblock: null,
/**
* Whether the thing was used
* @type {Boolean}
*/
tagNamespaceUsed: false,
/**
* If using bolt xjs transformation
* @type {Boolean}
*/
isBolt: undefined,
/**
* Whether to record source map (expensive) or not
* @type {SourceMapGenerator|null}
*/
sourceMap: null,
/**
* Filename of the file being processed. Will be returned as a source
* attribute in the source map
*/
sourceMapFilename: 'source.js',
/**
* Only when source map is used: last line in the source for which
* source map was generated
* @type {Number}
*/
sourceLine: 1,
/**
* Only when source map is used: last line in the buffer for which
* source map was generated
* @type {Number}
*/
bufferLine: 1,
/**
* The top-level Program AST for the original file.
*/
originalProgramAST: null,
sourceColumn: 0,
bufferColumn: 0
}
};
}
/**
* Updates a copy of a given state with "update" and returns an updated state.
*
* @param {Object} state
* @param {Object} update
* @return {Object}
*/
function updateState(state, update) {
return {
g: state.g,
superVar: update.superVar || state.superVar,
scopeName: update.scopeName || state.scopeName
};
}
/**
* Given a state fill the resulting buffer from the original source up to
* the end
* @param {Number} end
* @param {Object} state
* @param {Function?} contentTransformer Optional callback to transform newly
* added content.
*/
function catchup(end, state, contentTransformer) {
if (end < state.g.position) {
// cannot move backwards
return;
}
var source = state.g.source.substring(state.g.position, end);
var transformed = updateIndent(source, state);
if (state.g.sourceMap && transformed) {
// record where we are
state.g.sourceMap.addMapping({
generated: { line: state.g.bufferLine, column: state.g.bufferColumn },
original: { line: state.g.sourceLine, column: state.g.sourceColumn },
source: state.g.sourceMapFilename
});
// record line breaks in transformed source
var sourceLines = source.split('\n');
var transformedLines = transformed.split('\n');
// Add line break mappings between last known mapping and the end of the
// added piece. So for the code piece
// (foo, bar);
// > var x = 2;
// > var b = 3;
// var c =
// only add lines marked with ">": 2, 3.
for (var i = 1; i < sourceLines.length - 1; i++) {
state.g.sourceMap.addMapping({
generated: { line: state.g.bufferLine, column: 0 },
original: { line: state.g.sourceLine, column: 0 },
source: state.g.sourceMapFilename
});
state.g.sourceLine++;
state.g.bufferLine++;
}
// offset for the last piece
if (sourceLines.length > 1) {
state.g.sourceLine++;
state.g.bufferLine++;
state.g.sourceColumn = 0;
state.g.bufferColumn = 0;
}
state.g.sourceColumn += sourceLines[sourceLines.length - 1].length;
state.g.bufferColumn +=
transformedLines[transformedLines.length - 1].length;
}
state.g.buffer +=
contentTransformer ? contentTransformer(transformed) : transformed;
state.g.position = end;
}
/**
* Applies `catchup` but passing in a function that removes any non-whitespace
* characters.
*/
var re = /(\S)/g;
function stripNonWhite(value) {
return value.replace(re, function() {
return '';
});
}
/**
* Catches up as `catchup` but turns each non-white character into a space.
*/
function catchupWhiteSpace(end, state) {
catchup(end, state, stripNonWhite);
}
/**
* Same as catchup but does not touch the buffer
* @param {Number} end
* @param {Object} state
*/
function move(end, state) {
// move the internal cursors
if (state.g.sourceMap) {
if (end < state.g.position) {
state.g.position = 0;
state.g.sourceLine = 1;
state.g.sourceColumn = 0;
}
var source = state.g.source.substring(state.g.position, end);
var sourceLines = source.split('\n');
if (sourceLines.length > 1) {
state.g.sourceLine += sourceLines.length - 1;
state.g.sourceColumn = 0;
}
state.g.sourceColumn += sourceLines[sourceLines.length - 1].length;
}
state.g.position = end;
}
/**
* Appends a string of text to the buffer
* @param {String} string
* @param {Object} state
*/
function append(string, state) {
if (state.g.sourceMap && string) {
state.g.sourceMap.addMapping({
generated: { line: state.g.bufferLine, column: state.g.bufferColumn },
original: { line: state.g.sourceLine, column: state.g.sourceColumn },
source: state.g.sourceMapFilename
});
var transformedLines = string.split('\n');
if (transformedLines.length > 1) {
state.g.bufferLine += transformedLines.length - 1;
state.g.bufferColumn = 0;
}
state.g.bufferColumn +=
transformedLines[transformedLines.length - 1].length;
}
state.g.buffer += string;
}
/**
* Update indent using state.indentBy property. Indent is measured in
* double spaces. Updates a single line only.
*
* @param {String} str
* @param {Object} state
* @return {String}
*/
function updateIndent(str, state) {
for (var i = 0; i < -state.g.indentBy; i++) {
str = str.replace(/(^|\n)( {2}|\t)/g, '$1');
}
return str;
}
/**
* Calculates indent from the beginning of the line until "start" or the first
* character before start.
* @example
* " foo.bar()"
* ^
* start
* indent will be 2
*
* @param {Number} start
* @param {Object} state
* @return {Number}
*/
function indentBefore(start, state) {
var end = start;
start = start - 1;
while (start > 0 && state.g.source[start] != '\n') {
if (!state.g.source[start].match(/[ \t]/)) {
end = start;
}
start--;
}
return state.g.source.substring(start + 1, end);
}
function getDocblock(state) {
if (!state.g.docblock) {
var docblock = require('./docblock');
state.g.docblock =
docblock.parseAsObject(docblock.extract(state.g.source));
}
return state.g.docblock;
}
exports.catchup = catchup;
exports.catchupWhiteSpace = catchupWhiteSpace;
exports.append = append;
exports.move = move;
exports.updateIndent = updateIndent;
exports.indentBefore = indentBefore;
exports.updateState = updateState;
exports.createState = createState;
exports.getDocblock = getDocblock;
})()
},{"./docblock":4}],2:[function(require,module,exports){
(function(){/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*global exports:true*/
/*jslint node: true*/
"use strict";
/**
* Syntax transfomer for javascript. Takes the source in, spits the source
* out. Tries to maintain readability and preserve whitespace and line numbers
* where posssible.
*
* Support
* - ES6 class transformation + private property munging, see ./classes.js
* - React XHP style syntax transformations, see ./react.js
* - Bolt XHP style syntax transformations, see ./bolt.js
*
* The general flow is the following:
* - Parse the source with our customized esprima-parser
* https://github.com/voloko/esprima. We have to customize the parser to
* support non-standard XHP-style syntax. We parse the source range: true
* option that forces esprima to return positions in the source within
* resulting parse tree.
*
* - Traverse resulting syntax tree, trying to apply a set of visitors to each
* node. Each visitor should provide a .test() function that tests if the
* visitor can process a given node.
*
* - Visitor is responsible for code generation for a given syntax node.
* Generated code is stored in state.g.buffer that is passed to every
* visitor. It's up to the visitor to process the code the way it sees fit.
* All of the current visitors however use both the node and the original
* source to generate transformed code. They use nodes to generate new
* code and they copy the original source, preserving whitespace and comments,
* for the parts they don't care about.
*/
var esprima = require('esprima');
var createState = require('./utils').createState;
var catchup = require('./utils').catchup;
/**
* @param {object} object
* @param {function} visitor
* @param {array} path
* @param {object} state
*/
function traverse(object, path, state) {
var key, child;
if (walker(traverse, object, path, state) === false) {
return;
}
path.unshift(object);
for (key in object) {
// skip obviously wrong attributes
if (key === 'range' || key === 'loc') {
continue;
}
if (object.hasOwnProperty(key)) {
child = object[key];
if (typeof child === 'object' && child !== null) {
child.range && catchup(child.range[0], state);
traverse(child, path, state);
child.range && catchup(child.range[1], state);
}
}
}
path.shift();
}
function walker(traverse, object, path, state) {
var visitors = state.g.visitors;
for (var i = 0; i < visitors.length; i++) {
if (visitors[i].test(object, path, state)) {
return visitors[i](traverse, object, path, state);
}
}
}
function runPass(source, visitors, options) {
var ast = esprima.parse(source, { comment: true, loc: true, range: true });
var state = createState(source, options);
state.g.originalProgramAST = ast;
state.g.visitors = visitors;
if (options.sourceMap) {
var SourceMapGenerator = require('source-map').SourceMapGenerator;
state.g.sourceMap = new SourceMapGenerator({ file: 'transformed.js' });
}
traverse(ast, [], state);
catchup(source.length, state);
return state;
}
/**
* Applies all available transformations to the source
* @param {array} visitors
* @param {string} source
* @param {?object} options
* @return {object}
*/
function transform(visitors, source, options) {
options = options || {};
var state = runPass(source, visitors, options);
var sourceMap = state.g.sourceMap;
if (sourceMap) {
return {
sourceMap: sourceMap,
sourceMapFilename: options.filename || 'source.js',
code: state.g.buffer
};
} else {
return {
code: state.g.buffer
};
}
}
exports.transform = transform;
})()
},{"./utils":8,"esprima":9,"source-map":10}],9:[function(require,module,exports){
(function(){/*
Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com>
Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be>
Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>
Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com>
Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com>
Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*jslint bitwise:true plusplus:true */
/*global esprima:true, define:true, exports:true, window: true,
throwError: true, generateStatement: true, peek: true,
parseAssignmentExpression: true, parseBlock: true,
parseClassExpression: true, parseClassDeclaration: true, parseExpression: true,
parseForStatement: true,
parseFunctionDeclaration: true, parseFunctionExpression: true,
parseFunctionSourceElements: true, parseVariableIdentifier: true,
parseImportSpecifier: true,
parseLeftHandSideExpression: true, parseParams: true, validateParam: true,
parseSpreadOrAssignmentExpression: true,
parseStatement: true, parseSourceElement: true, parseModuleBlock: true, parseConciseBody: true,
advanceXJSChild: true, isXJSIdentifierStart: true, isXJSIdentifierPart: true,
scanXJSStringLiteral: true, scanXJSIdentifier: true,
parseXJSAttributeValue: true, parseXJSChild: true, parseXJSElement: true, parseXJSExpression: true,
parseYieldExpression: true
*/
(function (root, factory) {
'use strict';
// Universal Module Definition (UMD) to support AMD, CommonJS/Node.js,
// Rhino, and plain browser loading.
if (typeof define === 'function' && define.amd) {
define(['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.esprima = {}));
}
}(this, function (exports) {
'use strict';
var Token,
TokenName,
FnExprTokens,
Syntax,
PropertyKind,
Messages,
Regex,
SyntaxTreeDelegate,
XHTMLEntities,
ClassPropertyType,
source,
strict,
index,
lineNumber,
lineStart,
length,
delegate,
lookahead,
state,
extra;
Token = {
BooleanLiteral: 1,
EOF: 2,
Identifier: 3,
Keyword: 4,
NullLiteral: 5,
NumericLiteral: 6,
Punctuator: 7,
StringLiteral: 8,
RegularExpression: 9,
Template: 10,
XJSIdentifier: 11,
XJSText: 12
};
TokenName = {};
TokenName[Token.BooleanLiteral] = 'Boolean';
TokenName[Token.EOF] = '<end>';
TokenName[Token.Identifier] = 'Identifier';
TokenName[Token.Keyword] = 'Keyword';
TokenName[Token.NullLiteral] = 'Null';
TokenName[Token.NumericLiteral] = 'Numeric';
TokenName[Token.Punctuator] = 'Punctuator';
TokenName[Token.StringLiteral] = 'String';
TokenName[Token.XJSIdentifier] = 'XJSIdentifier';
TokenName[Token.XJSText] = 'XJSText';
TokenName[Token.RegularExpression] = 'RegularExpression';
// A function following one of those tokens is an expression.
FnExprTokens = ["(", "{", "[", "in", "typeof", "instanceof", "new",
"return", "case", "delete", "throw", "void",
// assignment operators
"=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=",
"&=", "|=", "^=", ",",
// binary/unary operators
"+", "-", "*", "/", "%", "++", "--", "<<", ">>", ">>>", "&",
"|", "^", "!", "~", "&&", "||", "?", ":", "===", "==", ">=",
"<=", "<", ">", "!=", "!=="];
Syntax = {
ArrayExpression: 'ArrayExpression',
ArrayPattern: 'ArrayPattern',
ArrowFunctionExpression: 'ArrowFunctionExpression',
AssignmentExpression: 'AssignmentExpression',
BinaryExpression: 'BinaryExpression',
BlockStatement: 'BlockStatement',
BreakStatement: 'BreakStatement',
CallExpression: 'CallExpression',
CatchClause: 'CatchClause',
ClassBody: 'ClassBody',
ClassDeclaration: 'ClassDeclaration',
ClassExpression: 'ClassExpression',
ClassHeritage: 'ClassHeritage',
ComprehensionBlock: 'ComprehensionBlock',
ComprehensionExpression: 'ComprehensionExpression',
ConditionalExpression: 'ConditionalExpression',
ContinueStatement: 'ContinueStatement',
DebuggerStatement: 'DebuggerStatement',
DoWhileStatement: 'DoWhileStatement',
EmptyStatement: 'EmptyStatement',
ExportDeclaration: 'ExportDeclaration',
ExportSpecifier: 'ExportSpecifier',
ExportSpecifierSet: 'ExportSpecifierSet',
ExpressionStatement: 'ExpressionStatement',
ForInStatement: 'ForInStatement',
ForOfStatement: 'ForOfStatement',
ForStatement: 'ForStatement',
FunctionDeclaration: 'FunctionDeclaration',
FunctionExpression: 'FunctionExpression',
Glob: 'Glob',
Identifier: 'Identifier',
IfStatement: 'IfStatement',
ImportDeclaration: 'ImportDeclaration',
ImportSpecifier: 'ImportSpecifier',
LabeledStatement: 'LabeledStatement',
Literal: 'Literal',
LogicalExpression: 'LogicalExpression',
MemberExpression: 'MemberExpression',
MethodDefinition: 'MethodDefinition',
ModuleDeclaration: 'ModuleDeclaration',
NewExpression: 'NewExpression',
ObjectExpression: 'ObjectExpression',
ObjectPattern: 'ObjectPattern',
Path: 'Path',
Program: 'Program',
Property: 'Property',
ReturnStatement: 'ReturnStatement',
SequenceExpression: 'SequenceExpression',
SpreadElement: 'SpreadElement',
SwitchCase: 'SwitchCase',
SwitchStatement: 'SwitchStatement',
TaggedTemplateExpression: 'TaggedTemplateExpression',
TemplateElement: 'TemplateElement',
TemplateLiteral: 'TemplateLiteral',
ThisExpression: 'ThisExpression',
ThrowStatement: 'ThrowStatement',
TryStatement: 'TryStatement',
UnaryExpression: 'UnaryExpression',
UpdateExpression: 'UpdateExpression',
VariableDeclaration: 'VariableDeclaration',
VariableDeclarator: 'VariableDeclarator',
WhileStatement: 'WhileStatement',
WithStatement: 'WithStatement',
XJSIdentifier: 'XJSIdentifier',
XJSExpression: 'XJSExpression',
XJSElement: 'XJSElement',
XJSClosingElement: 'XJSClosingElement',
XJSOpeningElement: 'XJSOpeningElement',
XJSAttribute: 'XJSAttribute',
XJSText: 'XJSText',
YieldExpression: 'YieldExpression'
};
PropertyKind = {
Data: 1,
Get: 2,
Set: 4
};
ClassPropertyType = {
static: 'static',
prototype: 'prototype'
};
// Error messages should be identical to V8.
Messages = {
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',
IllegalYield: 'Illegal yield expression',
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',
ElementAfterSpreadElement: 'Spread must be the final element of an element list',
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',
NoFromAfterImport: 'Missing from after import',
NoYieldInGenerator: 'Missing yield in generator',
NoUnintializedConst: 'Const must be initialized',
ComprehensionRequiresBlock: 'Comprehension must have at least one block',
ComprehensionError: 'Comprehension Error',
EachNotAllowed: 'Each is not supported',
InvalidXJSTagName: 'XJS tag name can not be empty',
InvalidXJSAttributeValue: 'XJS value should be either an expression or a quoted XJS text',
ExpectedXJSClosingTag: 'Expected corresponding XJS closing tag for %0'
};
// See also tools/generate-unicode-regex.py.
Regex = {
NonAsciiIdentifierStart: new RegExp('[\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\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\u16ee-\u16f0\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\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\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]'),
NonAsciiIdentifierPart: new RegExp('[\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0300-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u0483-\u0487\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u05d0-\u05ea\u05f0-\u05f2\u0610-\u061a\u0620-\u0669\u066e-\u06d3\u06d5-\u06dc\u06df-\u06e8\u06ea-\u06fc\u06ff\u0710-\u074a\u074d-\u07b1\u07c0-\u07f5\u07fa\u0800-\u082d\u0840-\u085b\u08a0\u08a2-\u08ac\u08e4-\u08fe\u0900-\u0963\u0966-\u096f\u0971-\u0977\u0979-\u097f\u0981-\u0983\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bc-\u09c4\u09c7\u09c8\u09cb-\u09ce\u09d7\u09dc\u09dd\u09df-\u09e3\u09e6-\u09f1\u0a01-\u0a03\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a59-\u0a5c\u0a5e\u0a66-\u0a75\u0a81-\u0a83\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abc-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ad0\u0ae0-\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3c-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b5c\u0b5d\u0b5f-\u0b63\u0b66-\u0b6f\u0b71\u0b82\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd0\u0bd7\u0be6-\u0bef\u0c01-\u0c03\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c58\u0c59\u0c60-\u0c63\u0c66-\u0c6f\u0c82\u0c83\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbc-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0cde\u0ce0-\u0ce3\u0ce6-\u0cef\u0cf1\u0cf2\u0d02\u0d03\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d-\u0d44\u0d46-\u0d48\u0d4a-\u0d4e\u0d57\u0d60-\u0d63\u0d66-\u0d6f\u0d7a-\u0d7f\u0d82\u0d83\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e01-\u0e3a\u0e40-\u0e4e\u0e50-\u0e59\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb9\u0ebb-\u0ebd\u0ec0-\u0ec4\u0ec6\u0ec8-\u0ecd\u0ed0-\u0ed9\u0edc-\u0edf\u0f00\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e-\u0f47\u0f49-\u0f6c\u0f71-\u0f84\u0f86-\u0f97\u0f99-\u0fbc\u0fc6\u1000-\u1049\u1050-\u109d\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u135d-\u135f\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176c\u176e-\u1770\u1772\u1773\u1780-\u17d3\u17d7\u17dc\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u1820-\u1877\u1880-\u18aa\u18b0-\u18f5\u1900-\u191c\u1920-\u192b\u1930-\u193b\u1946-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u19d0-\u19d9\u1a00-\u1a1b\u1a20-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1aa7\u1b00-\u1b4b\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1bf3\u1c00-\u1c37\u1c40-\u1c49\u1c4d-\u1c7d\u1cd0-\u1cd2\u1cd4-\u1cf6\u1d00-\u1de6\u1dfc-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u200c\u200d\u203f\u2040\u2054\u2071\u207f\u2090-\u209c\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d7f-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2de0-\u2dff\u2e2f\u3005-\u3007\u3021-\u302f\u3031-\u3035\u3038-\u303c\u3041-\u3096\u3099\u309a\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua62b\ua640-\ua66f\ua674-\ua67d\ua67f-\ua697\ua69f-\ua6f1\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua827\ua840-\ua873\ua880-\ua8c4\ua8d0-\ua8d9\ua8e0-\ua8f7\ua8fb\ua900-\ua92d\ua930-\ua953\ua960-\ua97c\ua980-\ua9c0\ua9cf-\ua9d9\uaa00-\uaa36\uaa40-\uaa4d\uaa50-\uaa59\uaa60-\uaa76\uaa7a\uaa7b\uaa80-\uaac2\uaadb-\uaadd\uaae0-\uaaef\uaaf2-\uaaf6\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabea\uabec\uabed\uabf0-\uabf9\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe00-\ufe0f\ufe20-\ufe26\ufe33\ufe34\ufe4d-\ufe4f\ufe70-\ufe74\ufe76-\ufefc\uff10-\uff19\uff21-\uff3a\uff3f\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]')
};
// Ensure the condition is true, otherwise throw an error.
// This is only to have a better contract semantic, i.e. another safety net
// to catch a logic error. The condition shall be fulfilled in normal case.
// Do NOT use this to enforce a certain condition on any user input.
function assert(condition, message) {
if (!condition) {
throw new Error('ASSERT: ' + message);
}
}
function isDecimalDigit(ch) {
return (ch >= 48 && ch <= 57); // 0..9
}
function isHexDigit(ch) {
return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;
}
function isOctalDigit(ch) {
return '01234567'.indexOf(ch) >= 0;
}
// 7.2 White Space
function isWhiteSpace(ch) {
return (ch === 32) || // space
(ch === 9) || // tab
(ch === 0xB) ||
(ch === 0xC) ||
(ch === 0xA0) ||
(ch >= 0x1680 && '\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\uFEFF'.indexOf(String.fromCharCode(ch)) > 0);
}
// 7.3 Line Terminators
function isLineTerminator(ch) {
return (ch === 10) || (ch === 13) || (ch === 0x2028) || (ch === 0x2029);
}
// 7.6 Identifier Names and Identifiers
function isIdentifierStart(ch) {
return (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore)
(ch >= 65 && ch <= 90) || // A..Z
(ch >= 97 && ch <= 122) || // a..z
(ch === 92) || // \ (backslash)
((ch >= 0x80) && Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch)));
}
function isIdentifierPart(ch) {
return (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore)
(ch >= 65 && ch <= 90) || // A..Z
(ch >= 97 && ch <= 122) || // a..z
(ch >= 48 && ch <= 57) || // 0..9
(ch === 92) || // \ (backslash)
((ch >= 0x80) && Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch)));
}
// 7.6.1.2 Future Reserved Words
function isFutureReservedWord(id) {
switch (id) {
case 'class':
case 'enum':
case 'export':
case 'extends':
case 'import':
case 'super':
return true;
default:
return false;
}
}
function isStrictModeReservedWord(id) {
switch (id) {
case 'implements':
case 'interface':
case 'package':
case 'private':
case 'protected':
case 'public':
case 'static':
case 'yield':
case 'let':
return true;
default:
return false;
}
}
function isRestrictedWord(id) {
return id === 'eval' || id === 'arguments';
}
// 7.6.1.1 Keywords
function isKeyword(id) {
if (strict && isStrictModeReservedWord(id)) {
return true;
}
// 'const' is specialized as Keyword in V8.
// 'yield' and 'let' are for compatiblity with SpiderMonkey and ES.next.
// Some others are from future reserved words.
switch (id.length) {
case 2:
return (id === 'if') || (id === 'in') || (id === 'do');
case 3:
return (id === 'var') || (id === 'for') || (id === 'new') ||
(id === 'try') || (id === 'let');
case 4:
return (id === 'this') || (id === 'else') || (id === 'case') ||
(id === 'void') || (id === 'with') || (id === 'enum');
case 5:
return (id === 'while') || (id === 'break') || (id === 'catch') ||
(id === 'throw') || (id === 'const') || (id === 'yield') ||
(id === 'class') || (id === 'super');
case 6:
return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
(id === 'switch') || (id === 'export') || (id === 'import');
case 7:
return (id === 'default') || (id === 'finally') || (id === 'extends');
case 8:
return (id === 'function') || (id === 'continue') || (id === 'debugger');
case 10:
return (id === 'instanceof');
default:
return false;
}
}
// 7.4 Comments
function skipComment() {
var ch, blockComment, lineComment;
blockComment = false;
lineComment = false;
while (index < length) {
ch = source.charCodeAt(index);
if (lineComment) {
++index;
if (isLineTerminator(ch)) {
lineComment = false;
if (ch === 13 && source.charCodeAt(index) === 10) {
++index;
}
++lineNumber;
lineStart = index;
}
} else if (blockComment) {
if (isLineTerminator(ch)) {
if (ch === 13 && source.charCodeAt(index + 1) === 10) {
++index;
}
++lineNumber;
++index;
lineStart = index;
if (index >= length) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
} else {
ch = source.charCodeAt(index++);
if (index >= length) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
// Block comment ends with '*/' (char #42, char #47).
if (ch === 42) {
ch = source.charCodeAt(index);
if (ch === 47) {
++index;
blockComment = false;
}
}
}
} else if (ch === 47) {
ch = source.charCodeAt(index + 1);
// Line comment starts with '//' (char #47, char #47).
if (ch === 47) {
index += 2;
lineComment = true;
} else if (ch === 42) {
// Block comment starts with '/*' (char #47, char #42).
index += 2;
blockComment = true;
if (index >= length) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
} else {
break;
}
} else if (isWhiteSpace(ch)) {
++index;
} else if (isLineTerminator(ch)) {
++index;
if (ch === 13 && source.charCodeAt(index) === 10) {
++index;
}
++lineNumber;
lineStart = index;
} else {
break;
}
}
}
function scanHexEscape(prefix) {
var i, len, ch, code = 0;
len = (prefix === 'u') ? 4 : 2;
for (i = 0; i < len; ++i) {
if (index < length && isHexDigit(source[index])) {
ch = source[index++];
code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
} else {
return '';
}
}
return String.fromCharCode(code);
}
function scanUnicodeCodePointEscape() {
var ch, code, cu1, cu2;
ch = source[index];
code = 0;
// At least, one hex digit is required.
if (ch === '}') {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
while (index < length) {
ch = source[index++];
if (!isHexDigit(ch)) {
break;
}
code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
}
if (code > 0x10FFFF || ch !== '}') {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
// UTF-16 Encoding
if (code <= 0xFFFF) {
return String.fromCharCode(code);
}
cu1 = ((code - 0x10000) >> 10) + 0xD800;
cu2 = ((code - 0x10000) & 1023) + 0xDC00;
return String.fromCharCode(cu1, cu2);
}
function getEscapedIdentifier() {
var ch, id;
ch = source.charCodeAt(index++);
id = String.fromCharCode(ch);
// '\u' (char #92, char #117) denotes an escaped character.
if (ch === 92) {
if (source.charCodeAt(index) !== 117) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
++index;
ch = scanHexEscape('u');
if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
id = ch;
}
while (index < length) {
ch = source.charCodeAt(index);
if (!isIdentifierPart(ch)) {
break;
}
++index;
id += String.fromCharCode(ch);
// '\u' (char #92, char #117) denotes an escaped character.
if (ch === 92) {
id = id.substr(0, id.length - 1);
if (source.charCodeAt(index) !== 117) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
++index;
ch = scanHexEscape('u');
if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
id += ch;
}
}
return id;
}
function getIdentifier() {
var start, ch;
start = index++;
while (index < length) {
ch = source.charCodeAt(index);
if (ch === 92) {
// Blackslash (char #92) marks Unicode escape sequence.
index = start;
return getEscapedIdentifier();
}
if (isIdentifierPart(ch)) {
++index;
} else {
break;
}
}
return source.slice(start, index);
}
function scanIdentifier() {
var start, id, type;
start = index;
// Backslash (char #92) starts an escaped character.
id = (source.charCodeAt(index) === 92) ? getEscapedIdentifier() : getIdentifier();
// There is no keyword or literal with only one character.
// Thus, it must be an identifier.
if (id.length === 1) {
type = Token.Identifier;
} else if (isKeyword(id)) {
type = Token.Keyword;
} else if (id === 'null') {
type = Token.NullLiteral;
} else if (id === 'true' || id === 'false') {
type = Token.BooleanLiteral;
} else {
type = Token.Identifier;
}
return {
type: type,
value: id,
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
// 7.7 Punctuators
function scanPunctuator() {
var start = index,
code = source.charCodeAt(index),
code2,
ch1 = source[index],
ch2,
ch3,
ch4;
switch (code) {
// Check for most common single-character punctuators.
case 40: // ( open bracket
case 41: // ) close bracket
case 59: // ; semicolon
case 44: // , comma
case 123: // { open curly brace
case 125: // } close curly brace
case 91: // [
case 93: // ]
case 58: // :
case 63: // ?
case 126: // ~
++index;
if (extra.tokenize) {
if (code === 40) {
extra.openParenToken = extra.tokens.length;
} else if (code === 123) {
extra.openCurlyToken = extra.tokens.length;
}
}
return {
type: Token.Punctuator,
value: String.fromCharCode(code),
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
default:
code2 = source.charCodeAt(index + 1);
// '=' (char #61) marks an assignment or comparison operator.
if (code2 === 61) {
switch (code) {
case 37: // %
case 38: // &
case 42: // *:
case 43: // +
case 45: // -
case 47: // /
case 60: // <
case 62: // >
case 94: // ^
case 124: // |
index += 2;
return {
type: Token.Punctuator,
value: String.fromCharCode(code) + String.fromCharCode(code2),
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
case 33: // !
case 61: // =
index += 2;
// !== and ===
if (source.charCodeAt(index) === 61) {
++index;
}
return {
type: Token.Punctuator,
value: source.slice(start, index),
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
default:
break;
}
}
break;
}
// Peek more characters.
ch2 = source[index + 1];
ch3 = source[index + 2];
ch4 = source[index + 3];
// 4-character punctuator: >>>=
if (ch1 === '>' && ch2 === '>' && ch3 === '>') {
if (ch4 === '=') {
index += 4;
return {
type: Token.Punctuator,
value: '>>>=',
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
}
// 3-character punctuators: === !== >>> <<= >>=
if (ch1 === '>' && ch2 === '>' && ch3 === '>') {
index += 3;
return {
type: Token.Punctuator,
value: '>>>',
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
if (ch1 === '<' && ch2 === '<' && ch3 === '=') {
index += 3;
return {
type: Token.Punctuator,
value: '<<=',
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
if (ch1 === '>' && ch2 === '>' && ch3 === '=') {
index += 3;
return {
type: Token.Punctuator,
value: '>>=',
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
if (ch1 === '.' && ch2 === '.' && ch3 === '.') {
index += 3;
return {
type: Token.Punctuator,
value: '...',
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
// Other 2-character punctuators: ++ -- << >> && ||
if (ch1 === ch2 && ('+-<>&|'.indexOf(ch1) >= 0)) {
index += 2;
return {
type: Token.Punctuator,
value: ch1 + ch2,
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
if (ch1 === '=' && ch2 === '>') {
index += 2;
return {
type: Token.Punctuator,
value: '=>',
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) {
++index;
return {
type: Token.Punctuator,
value: ch1,
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
if (ch1 === '.') {
++index;
return {
type: Token.Punctuator,
value: ch1,
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
// 7.8.3 Numeric Literals
function scanHexLiteral(start) {
var number = '';
while (index < length) {
if (!isHexDigit(source[index])) {
break;
}
number += source[index++];
}
if (number.length === 0) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
if (isIdentifierStart(source.charCodeAt(index))) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
return {
type: Token.NumericLiteral,
value: parseInt('0x' + number, 16),
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
function scanOctalLiteral(prefix, start) {
var number, octal;
if (isOctalDigit(prefix)) {
octal = true;
number = '0' + source[index++];
} else {
octal = false;
++index;
number = '';
}
while (index < length) {
if (!isOctalDigit(source[index])) {
break;
}
number += source[index++];
}
if (!octal && number.length === 0) {
// only 0o or 0O
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
return {
type: Token.NumericLiteral,
value: parseInt(number, 8),
octal: octal,
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
function scanNumericLiteral() {
var number, start, ch, octal;
ch = source[index];
assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'),
'Numeric literal must start with a decimal digit or a decimal point');
start = index;
number = '';
if (ch !== '.') {
number = source[index++];
ch = source[index];
// Hex number starts with '0x'.
// Octal number starts with '0'.
// Octal number in ES6 starts with '0o'.
// Binary number in ES6 starts with '0b'.
if (number === '0') {
if (ch === 'x' || ch === 'X') {
++index;
return scanHexLiteral(start);
}
if (ch === 'b' || ch === 'B') {
++index;
number = '';
while (index < length) {
ch = source[index];
if (ch !== '0' && ch !== '1') {
break;
}
number += source[index++];
}
if (number.length === 0) {
// only 0b or 0B
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
if (index < length) {
ch = source.charCodeAt(index);
if (isIdentifierStart(ch) || isDecimalDigit(ch)) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
}
return {
type: Token.NumericLiteral,
value: parseInt(number, 2),
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
if (ch === 'o' || ch === 'O' || isOctalDigit(ch)) {
return scanOctalLiteral(ch, start);
}
// decimal number starts with '0' such as '09' is illegal.
if (ch && isDecimalDigit(ch.charCodeAt(0))) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
}
while (isDecimalDigit(source.charCodeAt(index))) {
number += source[index++];
}
ch = source[index];
}
if (ch === '.') {
number += source[index++];
while (isDecimalDigit(source.charCodeAt(index))) {
number += source[index++];
}
ch = source[index];
}
if (ch === 'e' || ch === 'E') {
number += source[index++];
ch = source[index];
if (ch === '+' || ch === '-') {
number += source[index++];
}
if (isDecimalDigit(source.charCodeAt(index))) {
while (isDecimalDigit(source.charCodeAt(index))) {
number += source[index++];
}
} else {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
}
if (isIdentifierStart(source.charCodeAt(index))) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
return {
type: Token.NumericLiteral,
value: parseFloat(number),
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
// 7.8.4 String Literals
function scanStringLiteral() {
var str = '', quote, start, ch, code, unescaped, restore, octal = false;
quote = source[index];
assert((quote === '\'' || quote === '"'),
'String literal must starts with a quote');
start = index;
++index;
while (index < length) {
ch = source[index++];
if (ch === quote) {
quote = '';
break;
} else if (ch === '\\') {
ch = source[index++];
if (!ch || !isLineTerminator(ch.charCodeAt(0))) {
switch (ch) {
case 'n':
str += '\n';
break;
case 'r':
str += '\r';
break;
case 't':
str += '\t';
break;
case 'u':
case 'x':
if (source[index] === '{') {
++index;
str += scanUnicodeCodePointEscape();
} else {
restore = index;
unescaped = scanHexEscape(ch);
if (unescaped) {
str += unescaped;
} else {
index = restore;
str += ch;
}
}
break;
case 'b':
str += '\b';
break;
case 'f':
str += '\f';
break;
case 'v':
str += '\x0B';
break;
default:
if (isOctalDigit(ch)) {
code = '01234567'.indexOf(ch);
// \0 is not octal escape sequence
if (code !== 0) {
octal = true;
}
if (index < length && isOctalDigit(source[index])) {
octal = true;
code = code * 8 + '01234567'.indexOf(source[index++]);
// 3 digits are only allowed when string starts
// with 0, 1, 2, 3
if ('0123'.indexOf(ch) >= 0 &&
index < length &&
isOctalDigit(source[index])) {
code = code * 8 + '01234567'.indexOf(source[index++]);
}
}
str += String.fromCharCode(code);
} else {
str += ch;
}
break;
}
} else {
++lineNumber;
if (ch === '\r' && source[index] === '\n') {
++index;
}
}
} else if (isLineTerminator(ch.charCodeAt(0))) {
break;
} else {
str += ch;
}
}
if (quote !== '') {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
return {
type: Token.StringLiteral,
value: str,
octal: octal,
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
function scanTemplate() {
var cooked = '', ch, start, terminated, tail, restore, unescaped, code, octal;
terminated = false;
tail = false;
start = index;
++index;
while (index < length) {
ch = source[index++];
if (ch === '`') {
tail = true;
terminated = true;
break;
} else if (ch === '$') {
if (source[index] === '{') {
++index;
terminated = true;
break;
}
cooked += ch;
} else if (ch === '\\') {
ch = source[index++];
if (!isLineTerminator(ch.charCodeAt(0))) {
switch (ch) {
case 'n':
cooked += '\n';
break;
case 'r':
cooked += '\r';
break;
case 't':
cooked += '\t';
break;
case 'u':
case 'x':
if (source[index] === '{') {
++index;
cooked += scanUnicodeCodePointEscape();
} else {
restore = index;
unescaped = scanHexEscape(ch);
if (unescaped) {
cooked += unescaped;
} else {
index = restore;
cooked += ch;
}
}
break;
case 'b':
cooked += '\b';
break;
case 'f':
cooked += '\f';
break;
case 'v':
cooked += '\v';
break;
default:
if (isOctalDigit(ch)) {
code = '01234567'.indexOf(ch);
// \0 is not octal escape sequence
if (code !== 0) {
octal = true;
}
if (index < length && isOctalDigit(source[index])) {
octal = true;
code = code * 8 + '01234567'.indexOf(source[index++]);
// 3 digits are only allowed when string starts
// with 0, 1, 2, 3
if ('0123'.indexOf(ch) >= 0 &&
index < length &&
isOctalDigit(source[index])) {
code = code * 8 + '01234567'.indexOf(source[index++]);
}
}
cooked += String.fromCharCode(code);
} else {
cooked += ch;
}
break;
}
} else {
++lineNumber;
if (ch === '\r' && source[index] === '\n') {
++index;
}
}
} else if (isLineTerminator(ch.charCodeAt(0))) {
++lineNumber;
if (ch === '\r' && source[index] === '\n') {
++index;
}
} else {
cooked += ch;
}
}
if (!terminated) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
return {
type: Token.Template,
value: {
cooked: cooked,
raw: source.slice(start + 1, index - ((tail) ? 1 : 2))
},
tail: tail,
octal: octal,
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
function scanTemplateElement(option) {
var startsWith, template;
lookahead = null;
skipComment();
startsWith = (option.head) ? '`' : '}';
if (source[index] !== startsWith) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
template = scanTemplate();
peek();
return template;
}
function scanRegExp() {
var str, ch, start, pattern, flags, value, classMarker = false, restore, terminated = false;
lookahead = null;
skipComment();
start = index;
ch = source[index];
assert(ch === '/', 'Regular expression literal must start with a slash');
str = source[index++];
while (index < length) {
ch = source[index++];
str += ch;
if (classMarker) {
if (ch === ']') {
classMarker = false;
}
} else {
if (ch === '\\') {
ch = source[index++];
// ECMA-262 7.8.5
if (isLineTerminator(ch.charCodeAt(0))) {
throwError({}, Messages.UnterminatedRegExp);
}
str += ch;
} else if (ch === '/') {
terminated = true;
break;
} else if (ch === '[') {
classMarker = true;
} else if (isLineTerminator(ch.charCodeAt(0))) {
throwError({}, Messages.UnterminatedRegExp);
}
}
}
if (!terminated) {
throwError({}, Messages.UnterminatedRegExp);
}
// Exclude leading and trailing slash.
pattern = str.substr(1, str.length - 2);
flags = '';
while (index < length) {
ch = source[index];
if (!isIdentifierPart(ch.charCodeAt(0))) {
break;
}
++index;
if (ch === '\\' && index < length) {
ch = source[index];
if (ch === 'u') {
++index;
restore = index;
ch = scanHexEscape('u');
if (ch) {
flags += ch;
for (str += '\\u'; restore < index; ++restore) {
str += source[restore];
}
} else {
index = restore;
flags += 'u';
str += '\\u';
}
} else {
str += '\\';
}
} else {
flags += ch;
str += ch;
}
}
try {
value = new RegExp(pattern, flags);
} catch (e) {
throwError({}, Messages.InvalidRegExp);
}
peek();
if (extra.tokenize) {
return {
type: Token.RegularExpression,
value: value,
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
return {
literal: str,
value: value,
range: [start, index]
};
}
function isIdentifierName(token) {
return token.type === Token.Identifier ||
token.type === Token.Keyword ||
token.type === Token.BooleanLiteral ||
token.type === Token.NullLiteral;
}
function advanceSlash() {
var prevToken,
checkToken;
// Using the following algorithm:
// https://github.com/mozilla/sweet.js/wiki/design
prevToken = extra.tokens[extra.tokens.length - 1];
if (!prevToken) {
// Nothing before that: it cannot be a division.
return scanRegExp();
}
if (prevToken.type === "Punctuator") {
if (prevToken.value === ")") {
checkToken = extra.tokens[extra.openParenToken - 1];
if (checkToken &&
checkToken.type === "Keyword" &&
(checkToken.value === "if" ||
checkToken.value === "while" ||
checkToken.value === "for" ||
checkToken.value === "with")) {
return scanRegExp();
}
return scanPunctuator();
}
if (prevToken.value === "}") {
// Dividing a function by anything makes little sense,
// but we have to check for that.
if (extra.tokens[extra.openCurlyToken - 3] &&
extra.tokens[extra.openCurlyToken - 3].type === "Keyword") {
// Anonymous function.
checkToken = extra.tokens[extra.openCurlyToken - 4];
if (!checkToken) {
return scanPunctuator();
}
} else if (extra.tokens[extra.openCurlyToken - 4] &&
extra.tokens[extra.openCurlyToken - 4].type === "Keyword") {
// Named function.
checkToken = extra.tokens[extra.openCurlyToken - 5];
if (!checkToken) {
return scanRegExp();
}
} else {
return scanPunctuator();
}
// checkToken determines whether the function is
// a declaration or an expression.
if (FnExprTokens.indexOf(checkToken.value) >= 0) {
// It is an expression.
return scanPunctuator();
}
// It is a declaration.
return scanRegExp();
}
return scanRegExp();
}
if (prevToken.type === "Keyword") {
return scanRegExp();
}
return scanPunctuator();
}
function advance() {
var ch;
if (state.inXJSChild) {
return advanceXJSChild();
}
skipComment();
if (index >= length) {
return {
type: Token.EOF,
lineNumber: lineNumber,
lineStart: lineStart,
range: [index, index]
};
}
ch = source.charCodeAt(index);
// Very common: ( and ) and ;
if (ch === 40 || ch === 41 || ch === 58) {
return scanPunctuator();
}
// String literal starts with single quote (#39) or double quote (#34).
if (ch === 39 || ch === 34) {
if (state.inXJSTag) {
return scanXJSStringLiteral();
}
return scanStringLiteral();
}
if (state.inXJSTag && isXJSIdentifierStart(ch)) {
return scanXJSIdentifier();
}
if (ch === 96) {
return scanTemplate();
}
if (isIdentifierStart(ch)) {
return scanIdentifier();
}
// Dot (.) char #46 can also start a floating-point number, hence the need
// to check the next character.
if (ch === 46) {
if (isDecimalDigit(source.charCodeAt(index + 1))) {
return scanNumericLiteral();
}
return scanPunctuator();
}
if (isDecimalDigit(ch)) {
return scanNumericLiteral();
}
// Slash (/) char #47 can also start a regex.
if (extra.tokenize && ch === 47) {
return advanceSlash();
}
return scanPunctuator();
}
function lex() {
var token;
token = lookahead;
index = token.range[1];
lineNumber = token.lineNumber;
lineStart = token.lineStart;
lookahead = advance();
index = token.range[1];
lineNumber = token.lineNumber;
lineStart = token.lineStart;
return token;
}
function peek() {
var pos, line, start;
pos = index;
line = lineNumber;
start = lineStart;
lookahead = advance();
index = pos;
lineNumber = line;
lineStart = start;
}
function lookahead2() {
var adv, pos, line, start, result;
// If we are collecting the tokens, don't grab the next one yet.
adv = (typeof extra.advance === 'function') ? extra.advance : advance;
pos = index;
line = lineNumber;
start = lineStart;
// Scan for the next immediate token.
if (lookahead === null) {
lookahead = adv();
}
index = lookahead.range[1];
lineNumber = lookahead.lineNumber;
lineStart = lookahead.lineStart;
// Grab the token right after.
result = adv();
index = pos;
lineNumber = line;
lineStart = start;
return result;
}
SyntaxTreeDelegate = {
name: 'SyntaxTree',
postProcess: function (node) {
return node;
},
createArrayExpression: function (elements) {
return {
type: Syntax.ArrayExpression,
elements: elements
};
},
createAssignmentExpression: function (operator, left, right) {
return {
type: Syntax.AssignmentExpression,
operator: operator,
left: left,
right: right
};
},
createBinaryExpression: function (operator, left, right) {
var type = (operator === '||' || operator === '&&') ? Syntax.LogicalExpression :
Syntax.BinaryExpression;
return {
type: type,
operator: operator,
left: left,
right: right
};
},
createBlockStatement: function (body) {
return {
type: Syntax.BlockStatement,
body: body
};
},
createBreakStatement: function (label) {
return {
type: Syntax.BreakStatement,
label: label
};
},
createCallExpression: function (callee, args) {
return {
type: Syntax.CallExpression,
callee: callee,
'arguments': args
};
},
createCatchClause: function (param, body) {
return {
type: Syntax.CatchClause,
param: param,
body: body
};
},
createConditionalExpression: function (test, consequent, alternate) {
return {
type: Syntax.ConditionalExpression,
test: test,
consequent: consequent,
alternate: alternate
};
},
createContinueStatement: function (label) {
return {
type: Syntax.ContinueStatement,
label: label
};
},
createDebuggerStatement: function () {
return {
type: Syntax.DebuggerStatement
};
},
createDoWhileStatement: function (body, test) {
return {
type: Syntax.DoWhileStatement,
body: body,
test: test
};
},
createEmptyStatement: function () {
return {
type: Syntax.EmptyStatement
};
},
createExpressionStatement: function (expression) {
return {
type: Syntax.ExpressionStatement,
expression: expression
};
},
createForStatement: function (init, test, update, body) {
return {
type: Syntax.ForStatement,
init: init,
test: test,
update: update,
body: body
};
},
createForInStatement: function (left, right, body) {
return {
type: Syntax.ForInStatement,
left: left,
right: right,
body: body,
each: false
};
},
createForOfStatement: function (left, right, body) {
return {
type: Syntax.ForOfStatement,
left: left,
right: right,
body: body,
};
},
createFunctionDeclaration: function (id, params, defaults, body, rest, generator, expression) {
return {
type: Syntax.FunctionDeclaration,
id: id,
params: params,
defaults: defaults,
body: body,
rest: rest,
generator: generator,
expression: expression
};
},
createFunctionExpression: function (id, params, defaults, body, rest, generator, expression) {
return {
type: Syntax.FunctionExpression,
id: id,
params: params,
defaults: defaults,
body: body,
rest: rest,
generator: generator,
expression: expression
};
},
createIdentifier: function (name) {
return {
type: Syntax.Identifier,
name: name
};
},
createXJSAttribute: function (name, value) {
return {
type: Syntax.XJSAttribute,
name: name,
value: value
};
},
createXJSIdentifier: function (name, namespace) {
return {
type: Syntax.XJSIdentifier,
name: name,
namespace: namespace
};
},
createXJSElement: function (openingElement, closingElement, children) {
return {
type: Syntax.XJSElement,
name: openingElement.name,
selfClosing: openingElement.selfClosing,
openingElement: openingElement,
closingElement: closingElement,
attributes: openingElement.attributes,
children: children
};
},
createXJSExpression: function (expression) {
return {
type: Syntax.XJSExpression,
value: expression
};
},
createXJSOpeningElement: function (name, attributes, selfClosing) {
return {
type: Syntax.XJSOpeningElement,
name: name,
selfClosing: selfClosing,
attributes: attributes
};
},
createXJSClosingElement: function (name) {
return {
type: Syntax.XJSClosingElement,
name: name
};
},
createIfStatement: function (test, consequent, alternate) {
return {
type: Syntax.IfStatement,
test: test,
consequent: consequent,
alternate: alternate
};
},
createLabeledStatement: function (label, body) {
return {
type: Syntax.LabeledStatement,
label: label,
body: body
};
},
createLiteral: function (token) {
return {
type: Syntax.Literal,
value: token.value,
raw: source.slice(token.range[0], token.range[1])
};
},
createMemberExpression: function (accessor, object, property) {
return {
type: Syntax.MemberExpression,
computed: accessor === '[',
object: object,
property: property
};
},
createNewExpression: function (callee, args) {
return {
type: Syntax.NewExpression,
callee: callee,
'arguments': args
};
},
createObjectExpression: function (properties) {
return {
type: Syntax.ObjectExpression,
properties: properties
};
},
createPostfixExpression: function (operator, argument) {
return {
type: Syntax.UpdateExpression,
operator: operator,
argument: argument,
prefix: false
};
},
createProgram: function (body) {
return {
type: Syntax.Program,
body: body
};
},
createProperty: function (kind, key, value, method, shorthand) {
return {
type: Syntax.Property,
key: key,
value: value,
kind: kind,
method: method,
shorthand: shorthand
};
},
createReturnStatement: function (argument) {
return {
type: Syntax.ReturnStatement,
argument: argument
};
},
createSequenceExpression: function (expressions) {
return {
type: Syntax.SequenceExpression,
expressions: expressions
};
},
createSwitchCase: function (test, consequent) {
return {
type: Syntax.SwitchCase,
test: test,
consequent: consequent
};
},
createSwitchStatement: function (discriminant, cases) {
return {
type: Syntax.SwitchStatement,
discriminant: discriminant,
cases: cases
};
},
createThisExpression: function () {
return {
type: Syntax.ThisExpression
};
},
createThrowStatement: function (argument) {
return {
type: Syntax.ThrowStatement,
argument: argument
};
},
createTryStatement: function (block, guardedHandlers, handlers, finalizer) {
return {
type: Syntax.TryStatement,
block: block,
guardedHandlers: guardedHandlers,
handlers: handlers,
finalizer: finalizer
};
},
createUnaryExpression: function (operator, argument) {
if (operator === '++' || operator === '--') {
return {
type: Syntax.UpdateExpression,
operator: operator,
argument: argument,
prefix: true
};
}
return {
type: Syntax.UnaryExpression,
operator: operator,
argument: argument
};
},
createVariableDeclaration: function (declarations, kind) {
return {
type: Syntax.VariableDeclaration,
declarations: declarations,
kind: kind
};
},
createVariableDeclarator: function (id, init) {
return {
type: Syntax.VariableDeclarator,
id: id,
init: init
};
},
createWhileStatement: function (test, body) {
return {
type: Syntax.WhileStatement,
test: test,
body: body
};
},
createWithStatement: function (object, body) {
return {
type: Syntax.WithStatement,
object: object,
body: body
};
},
createTemplateElement: function (value, tail) {
return {
type: Syntax.TemplateElement,
value: value,
tail: tail
};
},
createTemplateLiteral: function (quasis, expressions) {
return {
type: Syntax.TemplateLiteral,
quasis: quasis,
expressions: expressions
};
},
createSpreadElement: function (argument) {
return {
type: Syntax.SpreadElement,
argument: argument
};
},
createTaggedTemplateExpression: function (tag, quasi) {
return {
type: Syntax.TaggedTemplateExpression,
tag: tag,
quasi: quasi
};
},
createArrowFunctionExpression: function (params, defaults, body, rest, expression) {
return {
type: Syntax.ArrowFunctionExpression,
id: null,
params: params,
defaults: defaults,
body: body,
rest: rest,
generator: false,
expression: expression
};
},
createMethodDefinition: function (propertyType, kind, key, value) {
return {
type: Syntax.MethodDefinition,
key: key,
value: value,
kind: kind,
'static': propertyType === ClassPropertyType.static
};
},
createClassBody: function (body) {
return {
type: Syntax.ClassBody,
body: body
};
},
createClassExpression: function (id, superClass, body) {
return {
type: Syntax.ClassExpression,
id: id,
superClass: superClass,
body: body
};
},
createClassDeclaration: function (id, superClass, body) {
return {
type: Syntax.ClassDeclaration,
id: id,
superClass: superClass,
body: body
};
},
createPath: function (body) {
return {
type: Syntax.Path,
body: body
};
},
createGlob: function () {
return {
type: Syntax.Glob
};
},
createExportSpecifier: function (id, from) {
return {
type: Syntax.ExportSpecifier,
id: id,
from: from
};
},
createExportSpecifierSet: function (specifiers) {
return {
type: Syntax.ExportSpecifierSet,
specifiers: specifiers
};
},
createExportDeclaration: function (declaration, specifiers) {
return {
type: Syntax.ExportDeclaration,
declaration: declaration,
specifiers: specifiers
};
},
createImportSpecifier: function (id, from) {
return {
type: Syntax.ImportSpecifier,
id: id,
from: from
};
},
createImportDeclaration: function (specifiers, from) {
return {
type: Syntax.ImportDeclaration,
specifiers: specifiers,
from: from
};
},
createYieldExpression: function (argument, delegate) {
return {
type: Syntax.YieldExpression,
argument: argument,
delegate: delegate
};
},
createModuleDeclaration: function (id, from, body) {
return {
type: Syntax.ModuleDeclaration,
id: id,
from: from,
body: body
};
}
};
// Return true if there is a line terminator before the next token.
function peekLineTerminator() {
var pos, line, start, found;
pos = index;
line = lineNumber;
start = lineStart;
skipComment();
found = lineNumber !== line;
index = pos;
lineNumber = line;
lineStart = start;
return found;
}
// Throw an exception
function throwError(token, messageFormat) {
var error,
args = Array.prototype.slice.call(arguments, 2),
msg = messageFormat.replace(
/%(\d)/g,
function (whole, index) {
assert(index < args.length, 'Message reference must be in range');
return args[index];
}
);
if (typeof token.lineNumber === 'number') {
error = new Error('Line ' + token.lineNumber + ': ' + msg);
error.index = token.range[0];
error.lineNumber = token.lineNumber;
error.column = token.range[0] - lineStart + 1;
} else {
error = new Error('Line ' + lineNumber + ': ' + msg);
error.index = index;
error.lineNumber = lineNumber;
error.column = index - lineStart + 1;
}
error.description = msg;
throw error;
}
function throwErrorTolerant() {
try {
throwError.apply(null, arguments);
} catch (e) {
if (extra.errors) {
extra.errors.push(e);
} else {
throw e;
}
}
}
// Throw an exception because of the token.
function throwUnexpected(token) {
if (token.type === Token.EOF) {
throwError(token, Messages.UnexpectedEOS);
}
if (token.type === Token.NumericLiteral) {
throwError(token, Messages.UnexpectedNumber);
}
if (token.type === Token.StringLiteral) {
throwError(token, Messages.UnexpectedString);
}
if (token.type === Token.Identifier) {
throwError(token, Messages.UnexpectedIdentifier);
}
if (token.type === Token.Keyword) {
if (isFutureReservedWord(token.value)) {
throwError(token, Messages.UnexpectedReserved);
} else if (strict && isStrictModeReservedWord(token.value)) {
throwErrorTolerant(token, Messages.StrictReservedWord);
return;
}
throwError(token, Messages.UnexpectedToken, token.value);
}
if (token.type === Token.Template) {
throwError(token, Messages.UnexpectedTemplate, token.value.raw);
}
// BooleanLiteral, NullLiteral, or Punctuator.
throwError(token, Messages.UnexpectedToken, token.value);
}
// Expect the next token to match the specified punctuator.
// If not, an exception will be thrown.
function expect(value) {
var token = lex();
if (token.type !== Token.Punctuator || token.value !== value) {
throwUnexpected(token);
}
}
// Expect the next token to match the specified keyword.
// If not, an exception will be thrown.
function expectKeyword(keyword) {
var token = lex();
if (token.type !== Token.Keyword || token.value !== keyword) {
throwUnexpected(token);
}
}
// Return true if the next token matches the specified punctuator.
function match(value) {
return lookahead.type === Token.Punctuator && lookahead.value === value;
}
// Return true if the next token matches the specified keyword
function matchKeyword(keyword) {
return lookahead.type === Token.Keyword && lookahead.value === keyword;
}
// Return true if the next token matches the specified contextual keyword
function matchContextualKeyword(keyword) {
return lookahead.type === Token.Identifier && lookahead.value === keyword;
}
// Return true if the next token is an assignment operator
function matchAssign() {
var op;
if (lookahead.type !== Token.Punctuator) {
return false;
}
op = lookahead.value;
return op === '=' ||
op === '*=' ||
op === '/=' ||
op === '%=' ||
op === '+=' ||
op === '-=' ||
op === '<<=' ||
op === '>>=' ||
op === '>>>=' ||
op === '&=' ||
op === '^=' ||
op === '|=';
}
function consumeSemicolon() {
var line;
// Catch the very common case first: immediately a semicolon (char #59).
if (source.charCodeAt(index) === 59) {
lex();
return;
}
line = lineNumber;
skipComment();
if (lineNumber !== line) {
return;
}
if (match(';')) {
lex();
return;
}
if (lookahead.type !== Token.EOF && !match('}')) {
throwUnexpected(lookahead);
}
}
// Return true if provided expression is LeftHandSideExpression
function isLeftHandSide(expr) {
return expr.type === Syntax.Identifier || expr.type === Syntax.MemberExpression;
}
function isAssignableLeftHandSide(expr) {
return isLeftHandSide(expr) || expr.type === Syntax.ObjectPattern || expr.type === Syntax.ArrayPattern;
}
// 11.1.4 Array Initialiser
function parseArrayInitialiser() {
var elements = [], blocks = [], filter = null, tmp, possiblecomprehension = true, body;
expect('[');
while (!match(']')) {
if (lookahead.value === 'for' &&
lookahead.type === Token.Keyword) {
if (!possiblecomprehension) {
throwError({}, Messages.ComprehensionError);
}
matchKeyword('for');
tmp = parseForStatement({ignore_body: true});
tmp.of = tmp.type === Syntax.ForOfStatement;
tmp.type = Syntax.ComprehensionBlock;
if (tmp.left.kind) { // can't be let or const
throwError({}, Messages.ComprehensionError);
}
blocks.push(tmp);
} else if (lookahead.value === 'if' &&
lookahead.type === Token.Keyword) {
if (!possiblecomprehension) {
throwError({}, Messages.ComprehensionError);
}
expectKeyword('if');
expect('(');
filter = parseExpression();
expect(')');
} else if (lookahead.value === ',' &&
lookahead.type === Token.Punctuator) {
possiblecomprehension = false; // no longer allowed.
lex();
elements.push(null);
} else {
tmp = parseSpreadOrAssignmentExpression();
elements.push(tmp);
if (tmp && tmp.type === Syntax.SpreadElement) {
if (!match(']')) {
throwError({}, Messages.ElementAfterSpreadElement);
}
} else if (!(match(']') || matchKeyword('for') || matchKeyword('if'))) {
expect(','); // this lexes.
possiblecomprehension = false;
}
}
}
expect(']');
if (filter && !blocks.length) {
throwError({}, Messages.ComprehensionRequiresBlock);
}
if (blocks.length) {
if (elements.length !== 1) {
throwError({}, Messages.ComprehensionError);
}
return {
type: Syntax.ComprehensionExpression,
filter: filter,
blocks: blocks,
body: elements[0]
};
}
return delegate.createArrayExpression(elements);
}
// 11.1.5 Object Initialiser
function parsePropertyFunction(options) {
var previousStrict, previousYieldAllowed, params, body;
previousStrict = strict;
previousYieldAllowed = state.yieldAllowed;
state.yieldAllowed = options.generator;
params = options.params || [];
body = parseConciseBody();
if (options.name && strict && isRestrictedWord(params[0].name)) {
throwErrorTolerant(options.name, Messages.StrictParamName);
}
if (state.yieldAllowed && !state.yieldFound) {
throwError({}, Messages.NoYieldInGenerator);
}
strict = previousStrict;
state.yieldAllowed = previousYieldAllowed;
return delegate.createFunctionExpression(null, params, [], body, options.rest || null, options.generator, body.type !== Syntax.BlockStatement);
}
function parsePropertyMethodFunction(options) {
var previousStrict, tmp, method;
previousStrict = strict;
strict = true;
tmp = parseParams();
if (tmp.stricted) {
throwErrorTolerant(tmp.stricted, tmp.message);
}
method = parsePropertyFunction({
params: tmp.params,
rest: tmp.rest,
generator: options.generator
});
strict = previousStrict;
return method;
}
function parseObjectPropertyKey() {
var token = lex();
// Note: This function is called only from parseObjectProperty(), where
// EOF and Punctuator tokens are already filtered out.
if (token.type === Token.StringLiteral || token.type === Token.NumericLiteral) {
if (strict && token.octal) {
throwErrorTolerant(token, Messages.StrictOctalLiteral);
}
return delegate.createLiteral(token);
}
return delegate.createIdentifier(token.value);
}
function parseObjectProperty() {
var token, key, id, value, param;
token = lookahead;
if (token.type === Token.Identifier) {
id = parseObjectPropertyKey();
// Property Assignment: Getter and Setter.
if (token.value === 'get' && !(match(':') || match('('))) {
key = parseObjectPropertyKey();
expect('(');
expect(')');
return delegate.createProperty('get', key, parsePropertyFunction({ generator: false }), false, false);
}
if (token.value === 'set' && !(match(':') || match('('))) {
key = parseObjectPropertyKey();
expect('(');
token = lookahead;
param = [ parseVariableIdentifier() ];
expect(')');
return delegate.createProperty('set', key, parsePropertyFunction({ params: param, generator: false, name: token }), false, false);
}
if (match(':')) {
lex();
return delegate.createProperty('init', id, parseAssignmentExpression(), false, false);
}
if (match('(')) {
return delegate.createProperty('init', id, parsePropertyMethodFunction({ generator: false }), true, false);
}
return delegate.createProperty('init', id, id, false, true);
}
if (token.type === Token.EOF || token.type === Token.Punctuator) {
if (!match('*')) {
throwUnexpected(token);
}
lex();
id = parseObjectPropertyKey();
if (!match('(')) {
throwUnexpected(lex());
}
return delegate.createProperty('init', id, parsePropertyMethodFunction({ generator: true }), true, false);
}
key = parseObjectPropertyKey();
if (match(':')) {
lex();
return delegate.createProperty('init', key, parseAssignmentExpression(), false, false);
}
if (match('(')) {
return delegate.createProperty('init', key, parsePropertyMethodFunction({ generator: false }), true, false);
}
throwUnexpected(lex());
}
function parseObjectInitialiser() {
var properties = [], property, name, key, kind, map = {}, toString = String;
expect('{');
while (!match('}')) {
property = parseObjectProperty();
if (property.key.type === Syntax.Identifier) {
name = property.key.name;
} else {
name = toString(property.key.value);
}
kind = (property.kind === 'init') ? PropertyKind.Data : (property.kind === 'get') ? PropertyKind.Get : PropertyKind.Set;
key = '$' + name;
if (Object.prototype.hasOwnProperty.call(map, key)) {
if (map[key] === PropertyKind.Data) {
if (strict && kind === PropertyKind.Data) {
throwErrorTolerant({}, Messages.StrictDuplicateProperty);
} else if (kind !== PropertyKind.Data) {
throwErrorTolerant({}, Messages.AccessorDataProperty);
}
} else {
if (kind === PropertyKind.Data) {
throwErrorTolerant({}, Messages.AccessorDataProperty);
} else if (map[key] & kind) {
throwErrorTolerant({}, Messages.AccessorGetSet);
}
}
map[key] |= kind;
} else {
map[key] = kind;
}
properties.push(property);
if (!match('}')) {
expect(',');
}
}
expect('}');
return delegate.createObjectExpression(properties);
}
function parseTemplateElement(option) {
var token = scanTemplateElement(option);
if (strict && token.octal) {
throwError(token, Messages.StrictOctalLiteral);
}
return delegate.createTemplateElement({ raw: token.value.raw, cooked: token.value.cooked }, token.tail);
}
function parseTemplateLiteral() {
var quasi, quasis, expressions;
quasi = parseTemplateElement({ head: true });
quasis = [ quasi ];
expressions = [];
while (!quasi.tail) {
expressions.push(parseExpression());
quasi = parseTemplateElement({ head: false });
quasis.push(quasi);
}
return delegate.createTemplateLiteral(quasis, expressions);
}
// 11.1.6 The Grouping Operator
function parseGroupExpression() {
var expr;
expect('(');
++state.parenthesizedCount;
state.allowArrowFunction = !state.allowArrowFunction;
expr = parseExpression();
state.allowArrowFunction = false;
if (expr.type !== Syntax.ArrowFunctionExpression) {
expect(')');
}
return expr;
}
// 11.1 Primary Expressions
function parsePrimaryExpression() {
var type, token;
token = lookahead;
type = lookahead.type;
if (type === Token.Identifier) {
lex();
return delegate.createIdentifier(token.value);
}
if (type === Token.StringLiteral || type === Token.NumericLiteral) {
if (strict && lookahead.octal) {
throwErrorTolerant(lookahead, Messages.StrictOctalLiteral);
}
return delegate.createLiteral(lex());
}
if (type === Token.Keyword) {
if (matchKeyword('this')) {
lex();
return delegate.createThisExpression();
}
if (matchKeyword('function')) {
return parseFunctionExpression();
}
if (matchKeyword('class')) {
return parseClassExpression();
}
if (matchKeyword('super')) {
lex();
return delegate.createIdentifier('super');
}
}
if (type === Token.BooleanLiteral) {
token = lex();
token.value = (token.value === 'true');
return delegate.createLiteral(token);
}
if (type === Token.NullLiteral) {
token = lex();
token.value = null;
return delegate.createLiteral(token);
}
if (match('[')) {
return parseArrayInitialiser();
}
if (match('{')) {
return parseObjectInitialiser();
}
if (match('(')) {
return parseGroupExpression();
}
if (match('/') || match('/=')) {
return delegate.createLiteral(scanRegExp());
}
if (type === Token.Template) {
return parseTemplateLiteral();
}
if (match('<')) {
return parseXJSElement();
}
return throwUnexpected(lex());
}
// 11.2 Left-Hand-Side Expressions
function parseArguments() {
var args = [], arg;
expect('(');
if (!match(')')) {
while (index < length) {
arg = parseSpreadOrAssignmentExpression();
args.push(arg);
if (match(')')) {
break;
} else if (arg.type === Syntax.SpreadElement) {
throwError({}, Messages.ElementAfterSpreadElement);
}
expect(',');
}
}
expect(')');
return args;
}
function parseSpreadOrAssignmentExpression() {
if (match('...')) {
lex();
return delegate.createSpreadElement(parseAssignmentExpression());
}
return parseAssignmentExpression();
}
function parseNonComputedProperty() {
var token = lex();
if (!isIdentifierName(token)) {
throwUnexpected(token);
}
return delegate.createIdentifier(token.value);
}
function parseNonComputedMember() {
expect('.');
return parseNonComputedProperty();
}
function parseComputedMember() {
var expr;
expect('[');
expr = parseExpression();
expect(']');
return expr;
}
function parseNewExpression() {
var callee, args;
expectKeyword('new');
callee = parseLeftHandSideExpression();
args = match('(') ? parseArguments() : [];
return delegate.createNewExpression(callee, args);
}
function parseLeftHandSideExpressionAllowCall() {
var expr, args, property;
expr = matchKeyword('new') ? parseNewExpression() : parsePrimaryExpression();
while (match('.') || match('[') || match('(') || lookahead.type === Token.Template) {
if (match('(')) {
args = parseArguments();
expr = delegate.createCallExpression(expr, args);
} else if (match('[')) {
expr = delegate.createMemberExpression('[', expr, parseComputedMember());
} else if (match('.')) {
expr = delegate.createMemberExpression('.', expr, parseNonComputedMember());
} else {
expr = delegate.createTaggedTemplateExpression(expr, parseTemplateLiteral());
}
}
return expr;
}
function parseLeftHandSideExpression() {
var expr, property;
expr = matchKeyword('new') ? parseNewExpression() : parsePrimaryExpression();
while (match('.') || match('[') || lookahead.type === Token.Template) {
if (match('[')) {
expr = delegate.createMemberExpression('[', expr, parseComputedMember());
} else if (match('.')) {
expr = delegate.createMemberExpression('.', expr, parseNonComputedMember());
} else {
expr = delegate.createTaggedTemplateExpression(expr, parseTemplateLiteral());
}
}
return expr;
}
// 11.3 Postfix Expressions
function parsePostfixExpression() {
var expr = parseLeftHandSideExpressionAllowCall(),
token = lookahead;
if (lookahead.type !== Token.Punctuator) {
return expr;
}
if ((match('++') || match('--')) && !peekLineTerminator()) {
// 11.3.1, 11.3.2
if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
throwErrorTolerant({}, Messages.StrictLHSPostfix);
}
if (!isLeftHandSide(expr)) {
throwError({}, Messages.InvalidLHSInAssignment);
}
token = lex();
expr = delegate.createPostfixExpression(token.value, expr);
}
return expr;
}
// 11.4 Unary Operators
function parseUnaryExpression() {
var token, expr;
if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {
return parsePostfixExpression();
}
if (match('++') || match('--')) {
token = lex();
expr = parseUnaryExpression();
// 11.4.4, 11.4.5
if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
throwErrorTolerant({}, Messages.StrictLHSPrefix);
}
if (!isLeftHandSide(expr)) {
throwError({}, Messages.InvalidLHSInAssignment);
}
return delegate.createUnaryExpression(token.value, expr);
}
if (match('+') || match('-') || match('~') || match('!')) {
token = lex();
expr = parseUnaryExpression();
return delegate.createUnaryExpression(token.value, expr);
}
if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) {
token = lex();
expr = parseUnaryExpression();
expr = delegate.createUnaryExpression(token.value, expr);
if (strict && expr.operator === 'delete' && expr.argument.type === Syntax.Identifier) {
throwErrorTolerant({}, Messages.StrictDelete);
}
return expr;
}
return parsePostfixExpression();
}
function binaryPrecedence(token, allowIn) {
var prec = 0;
if (token.type !== Token.Punctuator && token.type !== Token.Keyword) {
return 0;
}
switch (token.value) {
case '||':
prec = 1;
break;
case '&&':
prec = 2;
break;
case '|':
prec = 3;
break;
case '^':
prec = 4;
break;
case '&':
prec = 5;
break;
case '==':
case '!=':
case '===':
case '!==':
prec = 6;
break;
case '<':
case '>':
case '<=':
case '>=':
case 'instanceof':
prec = 7;
break;
case 'in':
prec = allowIn ? 7 : 0;
break;
case '<<':
case '>>':
case '>>>':
prec = 8;
break;
case '+':
case '-':
prec = 9;
break;
case '*':
case '/':
case '%':
prec = 11;
break;
default:
break;
}
return prec;
}
// 11.5 Multiplicative Operators
// 11.6 Additive Operators
// 11.7 Bitwise Shift Operators
// 11.8 Relational Operators
// 11.9 Equality Operators
// 11.10 Binary Bitwise Operators
// 11.11 Binary Logical Operators
function parseBinaryExpression() {
var expr, token, prec, previousAllowIn, stack, right, operator, left, i;
previousAllowIn = state.allowIn;
state.allowIn = true;
expr = parseUnaryExpression();
token = lookahead;
prec = binaryPrecedence(token, previousAllowIn);
if (prec === 0) {
return expr;
}
token.prec = prec;
lex();
stack = [expr, token, parseUnaryExpression()];
while ((prec = binaryPrecedence(lookahead, previousAllowIn)) > 0) {
// Reduce: make a binary expression from the three topmost entries.
while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) {
right = stack.pop();
operator = stack.pop().value;
left = stack.pop();
stack.push(delegate.createBinaryExpression(operator, left, right));
}
// Shift.
token = lex();
token.prec = prec;
stack.push(token);
stack.push(parseUnaryExpression());
}
state.allowIn = previousAllowIn;
// Final reduce to clean-up the stack.
i = stack.length - 1;
expr = stack[i];
while (i > 1) {
expr = delegate.createBinaryExpression(stack[i - 1].value, stack[i - 2], expr);
i -= 2;
}
return expr;
}
// 11.12 Conditional Operator
function parseConditionalExpression() {
var expr, previousAllowIn, consequent, alternate;
expr = parseBinaryExpression();
if (match('?')) {
lex();
previousAllowIn = state.allowIn;
state.allowIn = true;
consequent = parseAssignmentExpression();
state.allowIn = previousAllowIn;
expect(':');
alternate = parseAssignmentExpression();
expr = delegate.createConditionalExpression(expr, consequent, alternate);
}
return expr;
}
// 11.13 Assignment Operators
function reinterpretAsAssignmentBindingPattern(expr) {
var i, len, property, element;
if (expr.type === Syntax.ObjectExpression) {
expr.type = Syntax.ObjectPattern;
for (i = 0, len = expr.properties.length; i < len; i += 1) {
property = expr.properties[i];
if (property.kind !== 'init') {
throwError({}, Messages.InvalidLHSInAssignment);
}
reinterpretAsAssignmentBindingPattern(property.value);
}
} else if (expr.type === Syntax.ArrayExpression) {
expr.type = Syntax.ArrayPattern;
for (i = 0, len = expr.elements.length; i < len; i += 1) {
element = expr.elements[i];
if (element) {
reinterpretAsAssignmentBindingPattern(element);
}
}
} else if (expr.type === Syntax.Identifier) {
if (isRestrictedWord(expr.name)) {
throwError({}, Messages.InvalidLHSInAssignment);
}
} else if (expr.type === Syntax.SpreadElement) {
reinterpretAsAssignmentBindingPattern(expr.argument);
if (expr.argument.type === Syntax.ObjectPattern) {
throwError({}, Messages.ObjectPatternAsSpread);
}
} else {
if (expr.type !== Syntax.MemberExpression && expr.type !== Syntax.CallExpression && expr.type !== Syntax.NewExpression) {
throwError({}, Messages.InvalidLHSInAssignment);
}
}
}
function reinterpretAsDestructuredParameter(options, expr) {
var i, len, property, element;
if (expr.type === Syntax.ObjectExpression) {
expr.type = Syntax.ObjectPattern;
for (i = 0, len = expr.properties.length; i < len; i += 1) {
property = expr.properties[i];
if (property.kind !== 'init') {
throwError({}, Messages.InvalidLHSInFormalsList);
}
reinterpretAsDestructuredParameter(options, property.value);
}
} else if (expr.type === Syntax.ArrayExpression) {
expr.type = Syntax.ArrayPattern;
for (i = 0, len = expr.elements.length; i < len; i += 1) {
element = expr.elements[i];
if (element) {
reinterpretAsDestructuredParameter(options, element);
}
}
} else if (expr.type === Syntax.Identifier) {
validateParam(options, expr, expr.name);
} else {
if (expr.type !== Syntax.MemberExpression) {
throwError({}, Messages.InvalidLHSInFormalsList);
}
}
}
function reinterpretAsCoverFormalsList(expressions) {
var i, len, param, params, options, rest;
params = [];
rest = null;
options = {
paramSet: {}
};
for (i = 0, len = expressions.length; i < len; i += 1) {
param = expressions[i];
if (param.type === Syntax.Identifier) {
params.push(param);
validateParam(options, param, param.name);
} else if (param.type === Syntax.ObjectExpression || param.type === Syntax.ArrayExpression) {
reinterpretAsDestructuredParameter(options, param);
params.push(param);
} else if (param.type === Syntax.SpreadElement) {
assert(i === len - 1, "It is guaranteed that SpreadElement is last element by parseExpression");
reinterpretAsDestructuredParameter(options, param.argument);
rest = param.argument;
} else {
return null;
}
}
if (options.firstRestricted) {
throwError(options.firstRestricted, options.message);
}
if (options.stricted) {
throwErrorTolerant(options.stricted, options.message);
}
return { params: params, rest: rest };
}
function parseArrowFunctionExpression(options) {
var previousStrict, previousYieldAllowed, body;
expect('=>');
previousStrict = strict;
previousYieldAllowed = state.yieldAllowed;
strict = true;
state.yieldAllowed = false;
body = parseConciseBody();
strict = previousStrict;
state.yieldAllowed = previousYieldAllowed;
return delegate.createArrowFunctionExpression(options.params, [], body, options.rest, body.type !== Syntax.BlockStatement);
}
function parseAssignmentExpression() {
var expr, token, params, oldParenthesizedCount;
if (matchKeyword('yield')) {
return parseYieldExpression();
}
oldParenthesizedCount = state.parenthesizedCount;
if (match('(')) {
token = lookahead2();
if ((token.type === Token.Punctuator && token.value === ')') || token.value === '...') {
params = parseParams();
if (!match('=>')) {
throwUnexpected(lex());
}
return parseArrowFunctionExpression(params);
}
}
token = lookahead;
expr = parseConditionalExpression();
if (match('=>') && expr.type === Syntax.Identifier) {
if (state.parenthesizedCount === oldParenthesizedCount || state.parenthesizedCount === (oldParenthesizedCount + 1)) {
if (isRestrictedWord(expr.name)) {
throwError({}, Messages.StrictParamName);
}
return parseArrowFunctionExpression({ params: [ expr ], rest: null });
}
}
if (matchAssign()) {
// 11.13.1
if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
throwErrorTolerant(token, Messages.StrictLHSAssignment);
}
// ES.next draf 11.13 Runtime Semantics step 1
if (match('=') && (expr.type === Syntax.ObjectExpression || expr.type === Syntax.ArrayExpression)) {
reinterpretAsAssignmentBindingPattern(expr);
} else if (!isLeftHandSide(expr)) {
throwError({}, Messages.InvalidLHSInAssignment);
}
expr = delegate.createAssignmentExpression(lex().value, expr, parseAssignmentExpression());
}
return expr;
}
// 11.14 Comma Operator
function parseExpression() {
var expr, expressions, sequence, coverFormalsList, spreadFound, token;
expr = parseAssignmentExpression();
expressions = [ expr ];
if (match(',')) {
while (index < length) {
if (!match(',')) {
break;
}
lex();
expr = parseSpreadOrAssignmentExpression();
expressions.push(expr);
if (expr.type === Syntax.SpreadElement) {
spreadFound = true;
if (!match(')')) {
throwError({}, Messages.ElementAfterSpreadElement);
}
break;
}
}
sequence = delegate.createSequenceExpression(expressions);
}
if (state.allowArrowFunction && match(')')) {
token = lookahead2();
if (token.value === '=>') {
lex();
state.allowArrowFunction = false;
expr = expressions;
coverFormalsList = reinterpretAsCoverFormalsList(expr);
if (coverFormalsList) {
return parseArrowFunctionExpression(coverFormalsList);
}
throwUnexpected(token);
}
}
if (spreadFound) {
throwError({}, Messages.IllegalSpread);
}
return sequence || expr;
}
// 12.1 Block
function parseStatementList() {
var list = [],
statement;
while (index < length) {
if (match('}')) {
break;
}
statement = parseSourceElement();
if (typeof statement === 'undefined') {
break;
}
list.push(statement);
}
return list;
}
function parseBlock() {
var block;
expect('{');
block = parseStatementList();
expect('}');
return delegate.createBlockStatement(block);
}
// 12.2 Variable Statement
function parseVariableIdentifier() {
var token = lex();
if (token.type !== Token.Identifier) {
throwUnexpected(token);
}
return delegate.createIdentifier(token.value);
}
function parseVariableDeclaration(kind) {
var id,
init = null;
if (match('{')) {
id = parseObjectInitialiser();
reinterpretAsAssignmentBindingPattern(id);
} else if (match('[')) {
id = parseArrayInitialiser();
reinterpretAsAssignmentBindingPattern(id);
} else {
id = parseVariableIdentifier();
// 12.2.1
if (strict && isRestrictedWord(id.name)) {
throwErrorTolerant({}, Messages.StrictVarName);
}
}
if (kind === 'const') {
if (!match('=')) {
throwError({}, Messages.NoUnintializedConst);
}
expect('=');
init = parseAssignmentExpression();
} else if (match('=')) {
lex();
init = parseAssignmentExpression();
}
return delegate.createVariableDeclarator(id, init);
}
function parseVariableDeclarationList(kind) {
var list = [];
do {
list.push(parseVariableDeclaration(kind));
if (!match(',')) {
break;
}
lex();
} while (index < length);
return list;
}
function parseVariableStatement() {
var declarations;
expectKeyword('var');
declarations = parseVariableDeclarationList();
consumeSemicolon();
return delegate.createVariableDeclaration(declarations, 'var');
}
// kind may be `const` or `let`
// Both are experimental and not in the specification yet.
// see http://wiki.ecmascript.org/doku.php?id=harmony:const
// and http://wiki.ecmascript.org/doku.php?id=harmony:let
function parseConstLetDeclaration(kind) {
var declarations;
expectKeyword(kind);
declarations = parseVariableDeclarationList(kind);
consumeSemicolon();
return delegate.createVariableDeclaration(declarations, kind);
}
// http://wiki.ecmascript.org/doku.php?id=harmony:modules
function parsePath() {
var body = [];
while (true) {
body.push(parseVariableIdentifier());
if (!match('.')) {
break;
}
lex();
}
return delegate.createPath(body);
}
function parseGlob() {
expect('*');
return delegate.createGlob();
}
function parseModuleDeclaration() {
var id, token, from = null;
lex();
id = parseVariableIdentifier();
if (match('{')) {
return delegate.createModuleDeclaration(id, from, parseModuleBlock());
}
expect('=');
token = lookahead;
if (token.type === Token.StringLiteral) {
from = parsePrimaryExpression();
} else {
from = parsePath();
}
consumeSemicolon();
return delegate.createModuleDeclaration(id, from, null);
}
function parseExportSpecifierSetProperty() {
var id, from = null;
id = parseVariableIdentifier();
if (match(':')) {
lex();
from = parsePath();
}
return delegate.createExportSpecifier(id, from);
}
function parseExportSpecifier() {
var specifiers, id, from;
if (match('{')) {
lex();
specifiers = [];
do {
specifiers.push(parseExportSpecifierSetProperty());
} while (match(',') && lex());
expect('}');
return delegate.createExportSpecifierSet(specifiers);
}
from = null;
if (match('*')) {
id = parseGlob();
if (matchContextualKeyword('from')) {
lex();
from = parsePath();
}
} else {
id = parseVariableIdentifier();
}
return delegate.createExportSpecifier(id, from);
}
function parseExportDeclaration() {
var token, specifiers;
expectKeyword('export');
token = lookahead;
if (token.type === Token.Keyword || (token.type === Token.Identifier && token.value === 'module')) {
switch (token.value) {
case 'function':
return delegate.createExportDeclaration(parseFunctionDeclaration(), null);
case 'module':
return delegate.createExportDeclaration(parseModuleDeclaration(), null);
case 'let':
case 'const':
return delegate.createExportDeclaration(parseConstLetDeclaration(token.value), null);
case 'var':
return delegate.createExportDeclaration(parseStatement(), null);
case 'class':
return delegate.createExportDeclaration(parseClassDeclaration(), null);
}
throwUnexpected(lex());
}
specifiers = [ parseExportSpecifier() ];
if (match(',')) {
while (index < length) {
if (!match(',')) {
break;
}
lex();
specifiers.push(parseExportSpecifier());
}
}
consumeSemicolon();
return delegate.createExportDeclaration(null, specifiers);
}
function parseImportDeclaration() {
var specifiers, from;
expectKeyword('import');
if (match('*')) {
specifiers = [parseGlob()];
} else if (match('{')) {
lex();
specifiers = [];
do {
specifiers.push(parseImportSpecifier());
} while (match(',') && lex());
expect('}');
} else {
specifiers = [parseVariableIdentifier()];
}
if (!matchContextualKeyword('from')) {
throwError({}, Messages.NoFromAfterImport);
}
lex();
if (lookahead.type === Token.StringLiteral) {
from = parsePrimaryExpression();
} else {
from = parsePath();
}
consumeSemicolon();
return delegate.createImportDeclaration(specifiers, from);
}
function parseImportSpecifier() {
var id, from;
id = parseVariableIdentifier();
from = null;
if (match(':')) {
lex();
from = parsePath();
}
return delegate.createImportSpecifier(id, from);
}
// 12.3 Empty Statement
function parseEmptyStatement() {
expect(';');
return delegate.createEmptyStatement();
}
// 12.4 Expression Statement
function parseExpressionStatement() {
var expr = parseExpression();
consumeSemicolon();
return delegate.createExpressionStatement(expr);
}
// 12.5 If statement
function parseIfStatement() {
var test, consequent, alternate;
expectKeyword('if');
expect('(');
test = parseExpression();
expect(')');
consequent = parseStatement();
if (matchKeyword('else')) {
lex();
alternate = parseStatement();
} else {
alternate = null;
}
return delegate.createIfStatement(test, consequent, alternate);
}
// 12.6 Iteration Statements
function parseDoWhileStatement() {
var body, test, oldInIteration;
expectKeyword('do');
oldInIteration = state.inIteration;
state.inIteration = true;
body = parseStatement();
state.inIteration = oldInIteration;
expectKeyword('while');
expect('(');
test = parseExpression();
expect(')');
if (match(';')) {
lex();
}
return delegate.createDoWhileStatement(body, test);
}
function parseWhileStatement() {
var test, body, oldInIteration;
expectKeyword('while');
expect('(');
test = parseExpression();
expect(')');
oldInIteration = state.inIteration;
state.inIteration = true;
body = parseStatement();
state.inIteration = oldInIteration;
return delegate.createWhileStatement(test, body);
}
function parseForVariableDeclaration() {
var token = lex(),
declarations = parseVariableDeclarationList();
return delegate.createVariableDeclaration(declarations, token.value);
}
function parseForStatement(opts) {
var init, test, update, left, right, body, operator, oldInIteration;
init = test = update = null;
expectKeyword('for');
// http://wiki.ecmascript.org/doku.php?id=proposals:iterators_and_generators&s=each
if (matchContextualKeyword("each")) {
throwError({}, Messages.EachNotAllowed);
}
expect('(');
if (match(';')) {
lex();
} else {
if (matchKeyword('var') || matchKeyword('let') || matchKeyword('const')) {
state.allowIn = false;
init = parseForVariableDeclaration();
state.allowIn = true;
if (init.declarations.length === 1) {
if (matchKeyword('in') || matchContextualKeyword('of')) {
operator = lookahead;
if (!((operator.value === 'in' || init.kind !== 'var') && init.declarations[0].init)) {
lex();
left = init;
right = parseExpression();
init = null;
}
}
}
} else {
state.allowIn = false;
init = parseExpression();
state.allowIn = true;
if (matchContextualKeyword('of')) {
operator = lex();
left = init;
right = parseExpression();
init = null;
} else if (matchKeyword('in')) {
// LeftHandSideExpression
if (!isAssignableLeftHandSide(init)) {
throwError({}, Messages.InvalidLHSInForIn);
}
operator = lex();
left = init;
right = parseExpression();
init = null;
}
}
if (typeof left === 'undefined') {
expect(';');
}
}
if (typeof left === 'undefined') {
if (!match(';')) {
test = parseExpression();
}
expect(';');
if (!match(')')) {
update = parseExpression();
}
}
expect(')');
oldInIteration = state.inIteration;
state.inIteration = true;
if (!(opts !== undefined && opts.ignore_body)) {
body = parseStatement();
}
state.inIteration = oldInIteration;
if (typeof left === 'undefined') {
return delegate.createForStatement(init, test, update, body);
}
if (operator.value === 'in') {
return delegate.createForInStatement(left, right, body);
}
return delegate.createForOfStatement(left, right, body);
}
// 12.7 The continue statement
function parseContinueStatement() {
var label = null, key;
expectKeyword('continue');
// Optimize the most common form: 'continue;'.
if (source.charCodeAt(index) === 59) {
lex();
if (!state.inIteration) {
throwError({}, Messages.IllegalContinue);
}
return delegate.createContinueStatement(null);
}
if (peekLineTerminator()) {
if (!state.inIteration) {
throwError({}, Messages.IllegalContinue);
}
return delegate.createContinueStatement(null);
}
if (lookahead.type === Token.Identifier) {
label = parseVariableIdentifier();
key = '$' + label.name;
if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {
throwError({}, Messages.UnknownLabel, label.name);
}
}
consumeSemicolon();
if (label === null && !state.inIteration) {
throwError({}, Messages.IllegalContinue);
}
return delegate.createContinueStatement(label);
}
// 12.8 The break statement
function parseBreakStatement() {
var label = null, key;
expectKeyword('break');
// Catch the very common case first: immediately a semicolon (char #59).
if (source.charCodeAt(index) === 59) {
lex();
if (!(state.inIteration || state.inSwitch)) {
throwError({}, Messages.IllegalBreak);
}
return delegate.createBreakStatement(null);
}
if (peekLineTerminator()) {
if (!(state.inIteration || state.inSwitch)) {
throwError({}, Messages.IllegalBreak);
}
return delegate.createBreakStatement(null);
}
if (lookahead.type === Token.Identifier) {
label = parseVariableIdentifier();
key = '$' + label.name;
if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {
throwError({}, Messages.UnknownLabel, label.name);
}
}
consumeSemicolon();
if (label === null && !(state.inIteration || state.inSwitch)) {
throwError({}, Messages.IllegalBreak);
}
return delegate.createBreakStatement(label);
}
// 12.9 The return statement
function parseReturnStatement() {
var argument = null;
expectKeyword('return');
if (!state.inFunctionBody) {
throwErrorTolerant({}, Messages.IllegalReturn);
}
// 'return' followed by a space and an identifier is very common.
if (source.charCodeAt(index) === 32) {
if (isIdentifierStart(source.charCodeAt(index + 1))) {
argument = parseExpression();
consumeSemicolon();
return delegate.createReturnStatement(argument);
}
}
if (peekLineTerminator()) {
return delegate.createReturnStatement(null);
}
if (!match(';')) {
if (!match('}') && lookahead.type !== Token.EOF) {
argument = parseExpression();
}
}
consumeSemicolon();
return delegate.createReturnStatement(argument);
}
// 12.10 The with statement
function parseWithStatement() {
var object, body;
if (strict) {
throwErrorTolerant({}, Messages.StrictModeWith);
}
expectKeyword('with');
expect('(');
object = parseExpression();
expect(')');
body = parseStatement();
return delegate.createWithStatement(object, body);
}
// 12.10 The swith statement
function parseSwitchCase() {
var test,
consequent = [],
sourceElement;
if (matchKeyword('default')) {
lex();
test = null;
} else {
expectKeyword('case');
test = parseExpression();
}
expect(':');
while (index < length) {
if (match('}') || matchKeyword('default') || matchKeyword('case')) {
break;
}
sourceElement = parseSourceElement();
if (typeof sourceElement === 'undefined') {
break;
}
consequent.push(sourceElement);
}
return delegate.createSwitchCase(test, consequent);
}
function parseSwitchStatement() {
var discriminant, cases, clause, oldInSwitch, defaultFound;
expectKeyword('switch');
expect('(');
discriminant = parseExpression();
expect(')');
expect('{');
if (match('}')) {
lex();
return delegate.createSwitchStatement(discriminant);
}
cases = [];
oldInSwitch = state.inSwitch;
state.inSwitch = true;
defaultFound = false;
while (index < length) {
if (match('}')) {
break;
}
clause = parseSwitchCase();
if (clause.test === null) {
if (defaultFound) {
throwError({}, Messages.MultipleDefaultsInSwitch);
}
defaultFound = true;
}
cases.push(clause);
}
state.inSwitch = oldInSwitch;
expect('}');
return delegate.createSwitchStatement(discriminant, cases);
}
// 12.13 The throw statement
function parseThrowStatement() {
var argument;
expectKeyword('throw');
if (peekLineTerminator()) {
throwError({}, Messages.NewlineAfterThrow);
}
argument = parseExpression();
consumeSemicolon();
return delegate.createThrowStatement(argument);
}
// 12.14 The try statement
function parseCatchClause() {
var param, body;
expectKeyword('catch');
expect('(');
if (match(')')) {
throwUnexpected(lookahead);
}
param = parseExpression();
// 12.14.1
if (strict && param.type === Syntax.Identifier && isRestrictedWord(param.name)) {
throwErrorTolerant({}, Messages.StrictCatchVariable);
}
expect(')');
body = parseBlock();
return delegate.createCatchClause(param, body);
}
function parseTryStatement() {
var block, handlers = [], finalizer = null;
expectKeyword('try');
block = parseBlock();
if (matchKeyword('catch')) {
handlers.push(parseCatchClause());
}
if (matchKeyword('finally')) {
lex();
finalizer = parseBlock();
}
if (handlers.length === 0 && !finalizer) {
throwError({}, Messages.NoCatchOrFinally);
}
return delegate.createTryStatement(block, [], handlers, finalizer);
}
// 12.15 The debugger statement
function parseDebuggerStatement() {
expectKeyword('debugger');
consumeSemicolon();
return delegate.createDebuggerStatement();
}
// 12 Statements
function parseStatement() {
var type = lookahead.type,
expr,
labeledBody,
key;
if (type === Token.EOF) {
throwUnexpected(lookahead);
}
if (type === Token.Punctuator) {
switch (lookahead.value) {
case ';':
return parseEmptyStatement();
case '{':
return parseBlock();
case '(':
return parseExpressionStatement();
default:
break;
}
}
if (type === Token.Keyword) {
switch (lookahead.value) {
case 'break':
return parseBreakStatement();
case 'continue':
return parseContinueStatement();
case 'debugger':
return parseDebuggerStatement();
case 'do':
return parseDoWhileStatement();
case 'for':
return parseForStatement();
case 'function':
return parseFunctionDeclaration();
case 'class':
return parseClassDeclaration();
case 'if':
return parseIfStatement();
case 'return':
return parseReturnStatement();
case 'switch':
return parseSwitchStatement();
case 'throw':
return parseThrowStatement();
case 'try':
return parseTryStatement();
case 'var':
return parseVariableStatement();
case 'while':
return parseWhileStatement();
case 'with':
return parseWithStatement();
default:
break;
}
}
expr = parseExpression();
// 12.12 Labelled Statements
if ((expr.type === Syntax.Identifier) && match(':')) {
lex();
key = '$' + expr.name;
if (Object.prototype.hasOwnProperty.call(state.labelSet, key)) {
throwError({}, Messages.Redeclaration, 'Label', expr.name);
}
state.labelSet[key] = true;
labeledBody = parseStatement();
delete state.labelSet[key];
return delegate.createLabeledStatement(expr, labeledBody);
}
consumeSemicolon();
return delegate.createExpressionStatement(expr);
}
// 13 Function Definition
function parseConciseBody() {
if (match('{')) {
return parseFunctionSourceElements();
}
return parseAssignmentExpression();
}
function parseFunctionSourceElements() {
var sourceElement, sourceElements = [], token, directive, firstRestricted,
oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, oldParenthesizedCount;
expect('{');
while (index < length) {
if (lookahead.type !== Token.StringLiteral) {
break;
}
token = lookahead;
sourceElement = parseSourceElement();
sourceElements.push(sourceElement);
if (sourceElement.expression.type !== Syntax.Literal) {
// this is not directive
break;
}
directive = source.slice(token.range[0] + 1, token.range[1] - 1);
if (directive === 'use strict') {
strict = true;
if (firstRestricted) {
throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral);
}
} else {
if (!firstRestricted && token.octal) {
firstRestricted = token;
}
}
}
oldLabelSet = state.labelSet;
oldInIteration = state.inIteration;
oldInSwitch = state.inSwitch;
oldInFunctionBody = state.inFunctionBody;
oldParenthesizedCount = state.parenthesizedCount;
state.labelSet = {};
state.inIteration = false;
state.inSwitch = false;
state.inFunctionBody = true;
state.parenthesizedCount = 0;
while (index < length) {
if (match('}')) {
break;
}
sourceElement = parseSourceElement();
if (typeof sourceElement === 'undefined') {
break;
}
sourceElements.push(sourceElement);
}
expect('}');
state.labelSet = oldLabelSet;
state.inIteration = oldInIteration;
state.inSwitch = oldInSwitch;
state.inFunctionBody = oldInFunctionBody;
state.parenthesizedCount = oldParenthesizedCount;
return delegate.createBlockStatement(sourceElements);
}
function validateParam(options, param, name) {
var key = '$' + name;
if (strict) {
if (isRestrictedWord(name)) {
options.stricted = param;
options.message = Messages.StrictParamName;
}
if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {
options.stricted = param;
options.message = Messages.StrictParamDupe;
}
} else if (!options.firstRestricted) {
if (isRestrictedWord(name)) {
options.firstRestricted = param;
options.message = Messages.StrictParamName;
} else if (isStrictModeReservedWord(name)) {
options.firstRestricted = param;
options.message = Messages.StrictReservedWord;
} else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {
options.firstRestricted = param;
options.message = Messages.StrictParamDupe;
}
}
options.paramSet[key] = true;
}
function parseParam(options) {
var token, rest, param;
token = lookahead;
if (token.value === '...') {
token = lex();
rest = true;
}
if (match('[')) {
param = parseArrayInitialiser();
reinterpretAsDestructuredParameter(options, param);
} else if (match('{')) {
if (rest) {
throwError({}, Messages.ObjectPatternAsRestParameter);
}
param = parseObjectInitialiser();
reinterpretAsDestructuredParameter(options, param);
} else {
param = parseVariableIdentifier();
validateParam(options, token, token.value);
}
if (rest) {
if (!match(')')) {
throwError({}, Messages.ParameterAfterRestParameter);
}
options.rest = param;
return false;
}
options.params.push(param);
return !match(')');
}
function parseParams(firstRestricted) {
var options;
options = {
params: [],
rest: null,
firstRestricted: firstRestricted
};
expect('(');
if (!match(')')) {
options.paramSet = {};
while (index < length) {
if (!parseParam(options)) {
break;
}
expect(',');
}
}
expect(')');
return options;
}
function parseFunctionDeclaration() {
var id, body, token, tmp, firstRestricted, message, previousStrict, previousYieldAllowed, generator, expression;
expectKeyword('function');
generator = false;
if (match('*')) {
lex();
generator = true;
}
token = lookahead;
id = parseVariableIdentifier();
if (strict) {
if (isRestrictedWord(token.value)) {
throwErrorTolerant(token, Messages.StrictFunctionName);
}
} else {
if (isRestrictedWord(token.value)) {
firstRestricted = token;
message = Messages.StrictFunctionName;
} else if (isStrictModeReservedWord(token.value)) {
firstRestricted = token;
message = Messages.StrictReservedWord;
}
}
tmp = parseParams(firstRestricted);
firstRestricted = tmp.firstRestricted;
if (tmp.message) {
message = tmp.message;
}
previousStrict = strict;
previousYieldAllowed = state.yieldAllowed;
state.yieldAllowed = generator;
// here we redo some work in order to set 'expression'
expression = !match('{');
body = parseConciseBody();
if (strict && firstRestricted) {
throwError(firstRestricted, message);
}
if (strict && tmp.stricted) {
throwErrorTolerant(tmp.stricted, message);
}
if (state.yieldAllowed && !state.yieldFound) {
throwError({}, Messages.NoYieldInGenerator);
}
strict = previousStrict;
state.yieldAllowed = previousYieldAllowed;
return delegate.createFunctionDeclaration(id, tmp.params, [], body, tmp.rest, generator, expression);
}
function parseFunctionExpression() {
var token, id = null, firstRestricted, message, tmp, body, previousStrict, previousYieldAllowed, generator, expression;
expectKeyword('function');
generator = false;
if (match('*')) {
lex();
generator = true;
}
if (!match('(')) {
token = lookahead;
id = parseVariableIdentifier();
if (strict) {
if (isRestrictedWord(token.value)) {
throwErrorTolerant(token, Messages.StrictFunctionName);
}
} else {
if (isRestrictedWord(token.value)) {
firstRestricted = token;
message = Messages.StrictFunctionName;
} else if (isStrictModeReservedWord(token.value)) {
firstRestricted = token;
message = Messages.StrictReservedWord;
}
}
}
tmp = parseParams(firstRestricted);
firstRestricted = tmp.firstRestricted;
if (tmp.message) {
message = tmp.message;
}
previousStrict = strict;
previousYieldAllowed = state.yieldAllowed;
state.yieldAllowed = generator;
// here we redo some work in order to set 'expression'
expression = !match('{');
body = parseConciseBody();
if (strict && firstRestricted) {
throwError(firstRestricted, message);
}
if (strict && tmp.stricted) {
throwErrorTolerant(tmp.stricted, message);
}
if (state.yieldAllowed && !state.yieldFound) {
throwError({}, Messages.NoYieldInGenerator);
}
strict = previousStrict;
state.yieldAllowed = previousYieldAllowed;
return delegate.createFunctionExpression(id, tmp.params, [], body, tmp.rest, generator, expression);
}
function parseYieldExpression() {
var delegateFlag, expr, previousYieldAllowed;
expectKeyword('yield');
if (!state.yieldAllowed) {
throwErrorTolerant({}, Messages.IllegalYield);
}
delegateFlag = false;
if (match('*')) {
lex();
delegateFlag = true;
}
// It is a Syntax Error if any AssignmentExpression Contains YieldExpression.
previousYieldAllowed = state.yieldAllowed;
state.yieldAllowed = false;
expr = parseAssignmentExpression();
state.yieldAllowed = previousYieldAllowed;
state.yieldFound = true;
return delegate.createYieldExpression(expr, delegateFlag);
}
// 14 Classes
function parseMethodDefinition(existingPropNames) {
var token, key, param, propType, isValidDuplicateProp = false;
if (lookahead.value === 'static') {
propType = ClassPropertyType.static;
lex();
} else {
propType = ClassPropertyType.prototype;
}
if (match('*')) {
lex();
return delegate.createMethodDefinition(
propType,
'',
parseObjectPropertyKey(),
parsePropertyMethodFunction({ generator: true })
);
}
token = lookahead;
key = parseObjectPropertyKey();
if (token.value === 'get' && !match('(')) {
key = parseObjectPropertyKey();
// It is a syntax error if any other properties have a name
// duplicating this one unless they are a setter
if (existingPropNames[propType].hasOwnProperty(key.name)) {
isValidDuplicateProp =
// There isn't already a getter for this prop
existingPropNames[propType][key.name].get === undefined
// There isn't already a data prop by this name
&& existingPropNames[propType][key.name].data === undefined
// The only existing prop by this name is a setter
&& existingPropNames[propType][key.name].set !== undefined;
if (!isValidDuplicateProp) {
throwError(key, Messages.IllegalDuplicateClassProperty);
}
} else {
existingPropNames[propType][key.name] = {};
}
existingPropNames[propType][key.name].get = true;
expect('(');
expect(')');
return delegate.createMethodDefinition(
propType,
'get',
key,
parsePropertyFunction({ generator: false })
);
}
if (token.value === 'set' && !match('(')) {
key = parseObjectPropertyKey();
// It is a syntax error if any other properties have a name
// duplicating this one unless they are a getter
if (existingPropNames[propType].hasOwnProperty(key.name)) {
isValidDuplicateProp =
// There isn't already a setter for this prop
existingPropNames[propType][key.name].set === undefined
// There isn't already a data prop by this name
&& existingPropNames[propType][key.name].data === undefined
// The only existing prop by this name is a getter
&& existingPropNames[propType][key.name].get !== undefined;
if (!isValidDuplicateProp) {
throwError(key, Messages.IllegalDuplicateClassProperty);
}
} else {
existingPropNames[propType][key.name] = {};
}
existingPropNames[propType][key.name].set = true;
expect('(');
token = lookahead;
param = [ parseVariableIdentifier() ];
expect(')');
return delegate.createMethodDefinition(
propType,
'set',
key,
parsePropertyFunction({ params: param, generator: false, name: token })
);
}
// It is a syntax error if any other properties have the same name as a
// non-getter, non-setter method
if (existingPropNames[propType].hasOwnProperty(key.name)) {
throwError(key, Messages.IllegalDuplicateClassProperty);
} else {
existingPropNames[propType][key.name] = {};
}
existingPropNames[propType][key.name].data = true;
return delegate.createMethodDefinition(
propType,
'',
key,
parsePropertyMethodFunction({ generator: false })
);
}
function parseClassElement(existingProps) {
if (match(';')) {
lex();
return;
}
return parseMethodDefinition(existingProps);
}
function parseClassBody() {
var classElement, classElements = [], existingProps = {};
existingProps[ClassPropertyType.static] = {};
existingProps[ClassPropertyType.prototype] = {};
expect('{');
while (index < length) {
if (match('}')) {
break;
}
classElement = parseClassElement(existingProps);
if (typeof classElement !== 'undefined') {
classElements.push(classElement);
}
}
expect('}');
return delegate.createClassBody(classElements);
}
function parseClassExpression() {
var id, previousYieldAllowed, superClass = null;
expectKeyword('class');
if (!matchKeyword('extends') && !match('{')) {
id = parseVariableIdentifier();
}
if (matchKeyword('extends')) {
expectKeyword('extends');
previousYieldAllowed = state.yieldAllowed;
state.yieldAllowed = false;
superClass = parseAssignmentExpression();
state.yieldAllowed = previousYieldAllowed;
}
return delegate.createClassExpression(id, superClass, parseClassBody());
}
function parseClassDeclaration() {
var token, id, previousYieldAllowed, superClass = null;
expectKeyword('class');
token = lookahead;
id = parseVariableIdentifier();
if (matchKeyword('extends')) {
expectKeyword('extends');
previousYieldAllowed = state.yieldAllowed;
state.yieldAllowed = false;
superClass = parseAssignmentExpression();
state.yieldAllowed = previousYieldAllowed;
}
return delegate.createClassDeclaration(id, superClass, parseClassBody());
}
// 15 Program
function parseSourceElement() {
if (lookahead.type === Token.Keyword) {
switch (lookahead.value) {
case 'const':
case 'let':
return parseConstLetDeclaration(lookahead.value);
case 'function':
return parseFunctionDeclaration();
default:
return parseStatement();
}
}
if (lookahead.type !== Token.EOF) {
return parseStatement();
}
}
function parseProgramElement() {
var lineNumber, token;
if (lookahead.type === Token.Keyword) {
switch (lookahead.value) {
case 'export':
return parseExportDeclaration();
case 'import':
return parseImportDeclaration();
}
}
if (lookahead.value === 'module' && lookahead.type === Token.Identifier) {
lineNumber = lookahead.lineNumber;
token = lookahead2();
if (token.type === Token.Identifier && token.lineNumber === lineNumber) {
return parseModuleDeclaration();
}
}
return parseSourceElement();
}
function parseProgramElements() {
var sourceElement, sourceElements = [], token, directive, firstRestricted;
while (index < length) {
token = lookahead;
if (token.type !== Token.StringLiteral) {
break;
}
sourceElement = parseProgramElement();
sourceElements.push(sourceElement);
if (sourceElement.expression.type !== Syntax.Literal) {
// this is not directive
break;
}
directive = source.slice(token.range[0] + 1, token.range[1] - 1);
if (directive === 'use strict') {
strict = true;
if (firstRestricted) {
throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral);
}
} else {
if (!firstRestricted && token.octal) {
firstRestricted = token;
}
}
}
while (index < length) {
sourceElement = parseProgramElement();
if (typeof sourceElement === 'undefined') {
break;
}
sourceElements.push(sourceElement);
}
return sourceElements;
}
function parseModuleElement() {
return parseProgramElement();
}
function parseModuleElements() {
var list = [],
statement;
while (index < length) {
if (match('}')) {
break;
}
statement = parseModuleElement();
if (typeof statement === 'undefined') {
break;
}
list.push(statement);
}
return list;
}
function parseModuleBlock() {
var block;
expect('{');
block = parseModuleElements();
expect('}');
return delegate.createBlockStatement(block);
}
function parseProgram() {
var body;
strict = false;
peek();
body = parseProgramElements();
return delegate.createProgram(body);
}
// The following functions are needed only when the option to preserve
// the comments is active.
function addComment(type, value, start, end, loc) {
assert(typeof start === 'number', 'Comment must have valid position');
// Because the way the actual token is scanned, often the comments
// (if any) are skipped twice during the lexical analysis.
// Thus, we need to skip adding a comment if the comment array already
// handled it.
if (extra.comments.length > 0) {
if (extra.comments[extra.comments.length - 1].range[1] > start) {
return;
}
}
extra.comments.push({
type: type,
value: value,
range: [start, end],
loc: loc
});
}
function scanComment() {
var comment, ch, loc, start, blockComment, lineComment;
comment = '';
blockComment = false;
lineComment = false;
while (index < length) {
ch = source[index];
if (lineComment) {
ch = source[index++];
if (isLineTerminator(ch.charCodeAt(0))) {
loc.end = {
line: lineNumber,
column: index - lineStart - 1
};
lineComment = false;
addComment('Line', comment, start, index - 1, loc);
if (ch === '\r' && source[index] === '\n') {
++index;
}
++lineNumber;
lineStart = index;
comment = '';
} else if (index >= length) {
lineComment = false;
comment += ch;
loc.end = {
line: lineNumber,
column: length - lineStart
};
addComment('Line', comment, start, length, loc);
} else {
comment += ch;
}
} else if (blockComment) {
if (isLineTerminator(ch.charCodeAt(0))) {
if (ch === '\r' && source[index + 1] === '\n') {
++index;
comment += '\r\n';
} else {
comment += ch;
}
++lineNumber;
++index;
lineStart = index;
if (index >= length) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
} else {
ch = source[index++];
if (index >= length) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
comment += ch;
if (ch === '*') {
ch = source[index];
if (ch === '/') {
comment = comment.substr(0, comment.length - 1);
blockComment = false;
++index;
loc.end = {
line: lineNumber,
column: index - lineStart
};
addComment('Block', comment, start, index, loc);
comment = '';
}
}
}
} else if (ch === '/') {
ch = source[index + 1];
if (ch === '/') {
loc = {
start: {
line: lineNumber,
column: index - lineStart
}
};
start = index;
index += 2;
lineComment = true;
if (index >= length) {
loc.end = {
line: lineNumber,
column: index - lineStart
};
lineComment = false;
addComment('Line', comment, start, index, loc);
}
} else if (ch === '*') {
start = index;
index += 2;
blockComment = true;
loc = {
start: {
line: lineNumber,
column: index - lineStart - 2
}
};
if (index >= length) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
} else {
break;
}
} else if (isWhiteSpace(ch.charCodeAt(0))) {
++index;
} else if (isLineTerminator(ch.charCodeAt(0))) {
++index;
if (ch === '\r' && source[index] === '\n') {
++index;
}
++lineNumber;
lineStart = index;
} else {
break;
}
}
}
function filterCommentLocation() {
var i, entry, comment, comments = [];
for (i = 0; i < extra.comments.length; ++i) {
entry = extra.comments[i];
comment = {
type: entry.type,
value: entry.value
};
if (extra.range) {
comment.range = entry.range;
}
if (extra.loc) {
comment.loc = entry.loc;
}
comments.push(comment);
}
extra.comments = comments;
}
// 16 XJS
XHTMLEntities = {
quot: '\u0022',
amp: '&',
apos: "\u0027",
lt: "<",
gt: ">",
nbsp: "\u00A0",
iexcl: "\u00A1",
cent: "\u00A2",
pound: "\u00A3",
curren: "\u00A4",
yen: "\u00A5",
brvbar: "\u00A6",
sect: "\u00A7",
uml: "\u00A8",
copy: "\u00A9",
ordf: "\u00AA",
laquo: "\u00AB",
not: "\u00AC",
shy: "\u00AD",
reg: "\u00AE",
macr: "\u00AF",
deg: "\u00B0",
plusmn: "\u00B1",
sup2: "\u00B2",
sup3: "\u00B3",
acute: "\u00B4",
micro: "\u00B5",
para: "\u00B6",
middot: "\u00B7",
cedil: "\u00B8",
sup1: "\u00B9",
ordm: "\u00BA",
raquo: "\u00BB",
frac14: "\u00BC",
frac12: "\u00BD",
frac34: "\u00BE",
iquest: "\u00BF",
Agrave: "\u00C0",
Aacute: "\u00C1",
Acirc: "\u00C2",
Atilde: "\u00C3",
Auml: "\u00C4",
Aring: "\u00C5",
AElig: "\u00C6",
Ccedil: "\u00C7",
Egrave: "\u00C8",
Eacute: "\u00C9",
Ecirc: "\u00CA",
Euml: "\u00CB",
Igrave: "\u00CC",
Iacute: "\u00CD",
Icirc: "\u00CE",
Iuml: "\u00CF",
ETH: "\u00D0",
Ntilde: "\u00D1",
Ograve: "\u00D2",
Oacute: "\u00D3",
Ocirc: "\u00D4",
Otilde: "\u00D5",
Ouml: "\u00D6",
times: "\u00D7",
Oslash: "\u00D8",
Ugrave: "\u00D9",
Uacute: "\u00DA",
Ucirc: "\u00DB",
Uuml: "\u00DC",
Yacute: "\u00DD",
THORN: "\u00DE",
szlig: "\u00DF",
agrave: "\u00E0",
aacute: "\u00E1",
acirc: "\u00E2",
atilde: "\u00E3",
auml: "\u00E4",
aring: "\u00E5",
aelig: "\u00E6",
ccedil: "\u00E7",
egrave: "\u00E8",
eacute: "\u00E9",
ecirc: "\u00EA",
euml: "\u00EB",
igrave: "\u00EC",
iacute: "\u00ED",
icirc: "\u00EE",
iuml: "\u00EF",
eth: "\u00F0",
ntilde: "\u00F1",
ograve: "\u00F2",
oacute: "\u00F3",
ocirc: "\u00F4",
otilde: "\u00F5",
ouml: "\u00F6",
divide: "\u00F7",
oslash: "\u00F8",
ugrave: "\u00F9",
uacute: "\u00FA",
ucirc: "\u00FB",
uuml: "\u00FC",
yacute: "\u00FD",
thorn: "\u00FE",
yuml: "\u00FF",
OElig: "\u0152",
oelig: "\u0153",
Scaron: "\u0160",
scaron: "\u0161",
Yuml: "\u0178",
fnof: "\u0192",
circ: "\u02C6",
tilde: "\u02DC",
Alpha: "\u0391",
Beta: "\u0392",
Gamma: "\u0393",
Delta: "\u0394",
Epsilon: "\u0395",
Zeta: "\u0396",
Eta: "\u0397",
Theta: "\u0398",
Iota: "\u0399",
Kappa: "\u039A",
Lambda: "\u039B",
Mu: "\u039C",
Nu: "\u039D",
Xi: "\u039E",
Omicron: "\u039F",
Pi: "\u03A0",
Rho: "\u03A1",
Sigma: "\u03A3",
Tau: "\u03A4",
Upsilon: "\u03A5",
Phi: "\u03A6",
Chi: "\u03A7",
Psi: "\u03A8",
Omega: "\u03A9",
alpha: "\u03B1",
beta: "\u03B2",
gamma: "\u03B3",
delta: "\u03B4",
epsilon: "\u03B5",
zeta: "\u03B6",
eta: "\u03B7",
theta: "\u03B8",
iota: "\u03B9",
kappa: "\u03BA",
lambda: "\u03BB",
mu: "\u03BC",
nu: "\u03BD",
xi: "\u03BE",
omicron: "\u03BF",
pi: "\u03C0",
rho: "\u03C1",
sigmaf: "\u03C2",
sigma: "\u03C3",
tau: "\u03C4",
upsilon: "\u03C5",
phi: "\u03C6",
chi: "\u03C7",
psi: "\u03C8",
omega: "\u03C9",
thetasym: "\u03D1",
upsih: "\u03D2",
piv: "\u03D6",
ensp: "\u2002",
emsp: "\u2003",
thinsp: "\u2009",
zwnj: "\u200C",
zwj: "\u200D",
lrm: "\u200E",
rlm: "\u200F",
ndash: "\u2013",
mdash: "\u2014",
lsquo: "\u2018",
rsquo: "\u2019",
sbquo: "\u201A",
ldquo: "\u201C",
rdquo: "\u201D",
bdquo: "\u201E",
dagger: "\u2020",
Dagger: "\u2021",
bull: "\u2022",
hellip: "\u2026",
permil: "\u2030",
prime: "\u2032",
Prime: "\u2033",
lsaquo: "\u2039",
rsaquo: "\u203A",
oline: "\u203E",
frasl: "\u2044",
euro: "\u20AC",
image: "\u2111",
weierp: "\u2118",
real: "\u211C",
trade: "\u2122",
alefsym: "\u2135",
larr: "\u2190",
uarr: "\u2191",
rarr: "\u2192",
darr: "\u2193",
harr: "\u2194",
crarr: "\u21B5",
lArr: "\u21D0",
uArr: "\u21D1",
rArr: "\u21D2",
dArr: "\u21D3",
hArr: "\u21D4",
forall: "\u2200",
part: "\u2202",
exist: "\u2203",
empty: "\u2205",
nabla: "\u2207",
isin: "\u2208",
notin: "\u2209",
ni: "\u220B",
prod: "\u220F",
sum: "\u2211",
minus: "\u2212",
lowast: "\u2217",
radic: "\u221A",
prop: "\u221D",
infin: "\u221E",
ang: "\u2220",
and: "\u2227",
or: "\u2228",
cap: "\u2229",
cup: "\u222A",
"int": "\u222B",
there4: "\u2234",
sim: "\u223C",
cong: "\u2245",
asymp: "\u2248",
ne: "\u2260",
equiv: "\u2261",
le: "\u2264",
ge: "\u2265",
sub: "\u2282",
sup: "\u2283",
nsub: "\u2284",
sube: "\u2286",
supe: "\u2287",
oplus: "\u2295",
otimes: "\u2297",
perp: "\u22A5",
sdot: "\u22C5",
lceil: "\u2308",
rceil: "\u2309",
lfloor: "\u230A",
rfloor: "\u230B",
lang: "\u2329",
rang: "\u232A",
loz: "\u25CA",
spades: "\u2660",
clubs: "\u2663",
hearts: "\u2665",
diams: "\u2666"
};
function isXJSIdentifierStart(ch) {
// exclude backslash (\)
return (ch !== 92) && isIdentifierStart(ch);
}
function isXJSIdentifierPart(ch) {
// exclude backslash (\) and add hyphen (-)
return (ch !== 92) && (ch === 45 || isIdentifierPart(ch));
}
function scanXJSIdentifier() {
var ch, start, id = '', namespace;
start = index;
while (index < length) {
ch = source.charCodeAt(index);
if (!isXJSIdentifierPart(ch)) {
break;
}
id += source[index++];
}
if (ch === 58) { // :
++index;
namespace = id;
id = '';
while (index < length) {
ch = source.charCodeAt(index);
if (!isXJSIdentifierPart(ch)) {
break;
}
id += source[index++];
}
}
if (!id) {
throwError({}, Messages.InvalidXJSTagName);
}
return {
type: Token.XJSIdentifier,
value: id,
namespace: namespace,
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
function scanXJSEntity() {
var ch, str = '', count = 0, entity;
ch = source[index];
assert(ch === '&', 'Entity must start with an ampersand');
index++;
while (index < length && count++ < 10) {
ch = source[index++];
if (ch === ';') {
break;
}
str += ch;
}
if (str[0] === '#' && str[1] === 'x') {
entity = String.fromCharCode(parseInt(str.substr(2), 16));
} else if (str[0] === '#') {
entity = String.fromCharCode(parseInt(str.substr(1), 10));
} else {
entity = XHTMLEntities[str];
}
return entity;
}
function scanXJSText(stopChars) {
var ch, str = '', start;
start = index;
while (index < length) {
ch = source[index];
if (stopChars.indexOf(ch) !== -1) {
break;
}
if (ch === '&') {
str += scanXJSEntity();
} else {
ch = source[index++];
if (isLineTerminator(ch.charCodeAt(0))) {
++lineNumber;
lineStart = index;
}
str += ch;
}
}
return {
type: Token.XJSText,
value: str,
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
function scanXJSStringLiteral() {
var innerToken, quote, start;
quote = source[index];
assert((quote === '\'' || quote === '"'),
'String literal must starts with a quote');
start = index;
++index;
innerToken = scanXJSText([quote]);
if (quote !== source[index]) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
++index;
innerToken.range = [start, index];
return innerToken;
}
/**
* Between XJS opening and closing tags (e.g. <foo>HERE</foo>), anything that
* is not another XJS tag and is not an expression wrapped by {} is text.
*/
function advanceXJSChild() {
var ch = source.charCodeAt(index);
// { (123) and < (60)
if (ch !== 123 && ch !== 60) {
return scanXJSText(['<', '{']);
}
return scanPunctuator();
}
function parseXJSIdentifier() {
var token;
if (lookahead.type !== Token.XJSIdentifier) {
throwError({}, Messages.InvalidXJSTagName);
}
token = lex();
return delegate.createXJSIdentifier(token.value, token.namespace);
}
function parseXJSAttributeValue() {
var value;
if (lookahead.value === '{') {
value = parseXJSExpression();
} else if (lookahead.type === Token.XJSText) {
value = delegate.createLiteral(lex());
} else {
throwError({}, Messages.InvalidXJSAttributeValue);
}
return value;
}
function parseXJSExpression() {
var value, origInXJSChild, origInXJSTag;
origInXJSChild = state.inXJSChild;
origInXJSTag = state.inXJSTag;
state.inXJSChild = false;
state.inXJSTag = false;
expect('{');
value = parseExpression();
state.inXJSChild = origInXJSChild;
state.inXJSTag = origInXJSTag;
expect('}');
return delegate.createXJSExpression(value);
}
function parseXJSAttribute() {
var token, name, value;
name = parseXJSIdentifier();
// HTML empty attribute
if (match('=')) {
lex();
return delegate.createXJSAttribute(name, parseXJSAttributeValue());
}
return delegate.createXJSAttribute(name);
}
function parseXJSChild() {
var token;
if (lookahead.value === '{') {
token = parseXJSExpression();
} else if (lookahead.type === Token.XJSText) {
token = delegate.createLiteral(lex());
} else {
state.inXJSChild = false;
token = parseXJSElement();
state.inXJSChild = true;
}
return token;
}
function parseXJSClosingElement() {
var name, origInXJSTag;
origInXJSTag = state.inXJSTag;
state.inXJSTag = true;
state.inXJSChild = false;
expect('<');
expect('/');
name = parseXJSIdentifier();
state.inXJSTag = origInXJSTag;
expect('>');
return delegate.createXJSClosingElement(name);
}
function parseXJSOpeningElement() {
var name, attribute, attributes = [], selfClosing = false, origInXJSTag;
origInXJSTag = state.inXJSTag;
state.inXJSTag = true;
expect('<');
name = parseXJSIdentifier();
while (index < length &&
lookahead.value !== '/' &&
lookahead.value !== '>') {
attributes.push(parseXJSAttribute());
}
state.inXJSTag = origInXJSTag;
if (lookahead.value === '/') {
expect('/');
expect('>');
selfClosing = true;
} else {
state.inXJSChild = true;
expect('>');
}
return delegate.createXJSOpeningElement(name, attributes, selfClosing);
}
function parseXJSElement() {
var openingElement, closingElement, children = [], origInXJSChild;
openingElement = parseXJSOpeningElement();
if (!openingElement.selfClosing) {
origInXJSChild = state.inXJSChild;
while (index < length) {
state.inXJSChild = false; // </ should not be considered in the child
if (lookahead.value === '<' && lookahead2().value === '/') {
break;
}
state.inXJSChild = true;
peek(); // reset lookahead token
children.push(parseXJSChild());
}
state.inXJSChild = origInXJSChild;
closingElement = parseXJSClosingElement();
if (closingElement.name.namespace !== openingElement.name.namespace || closingElement.name.name !== openingElement.name.name) {
throwError({}, Messages.ExpectedXJSClosingTag, openingElement.name.namespace ? openingElement.name.namespace + ':' + openingElement.name.name : openingElement.name.name);
}
}
return delegate.createXJSElement(openingElement, closingElement, children);
}
function collectToken() {
var start, loc, token, range, value;
skipComment();
start = index;
loc = {
start: {
line: lineNumber,
column: index - lineStart
}
};
token = extra.advance();
loc.end = {
line: lineNumber,
column: index - lineStart
};
if (token.type !== Token.EOF) {
range = [token.range[0], token.range[1]];
value = source.slice(token.range[0], token.range[1]);
extra.tokens.push({
type: TokenName[token.type],
value: value,
range: range,
loc: loc
});
}
return token;
}
function collectRegex() {
var pos, loc, regex, token;
skipComment();
pos = index;
loc = {
start: {
line: lineNumber,
column: index - lineStart
}
};
regex = extra.scanRegExp();
loc.end = {
line: lineNumber,
column: index - lineStart
};
if (!extra.tokenize) {
// Pop the previous token, which is likely '/' or '/='
if (extra.tokens.length > 0) {
token = extra.tokens[extra.tokens.length - 1];
if (token.range[0] === pos && token.type === 'Punctuator') {
if (token.value === '/' || token.value === '/=') {
extra.tokens.pop();
}
}
}
extra.tokens.push({
type: 'RegularExpression',
value: regex.literal,
range: [pos, index],
loc: loc
});
}
return regex;
}
function filterTokenLocation() {
var i, entry, token, tokens = [];
for (i = 0; i < extra.tokens.length; ++i) {
entry = extra.tokens[i];
token = {
type: entry.type,
value: entry.value
};
if (extra.range) {
token.range = entry.range;
}
if (extra.loc) {
token.loc = entry.loc;
}
tokens.push(token);
}
extra.tokens = tokens;
}
function createLocationMarker() {
var marker = {};
marker.range = [index, index];
marker.loc = {
start: {
line: lineNumber,
column: index - lineStart
},
end: {
line: lineNumber,
column: index - lineStart
}
};
marker.end = function () {
this.range[1] = index;
this.loc.end.line = lineNumber;
this.loc.end.column = index - lineStart;
};
marker.applyGroup = function (node) {
if (extra.range) {
node.groupRange = [this.range[0], this.range[1]];
}
if (extra.loc) {
node.groupLoc = {
start: {
line: this.loc.start.line,
column: this.loc.start.column
},
end: {
line: this.loc.end.line,
column: this.loc.end.column
}
};
node = delegate.postProcess(node);
}
};
marker.apply = function (node) {
var nodeType = typeof node;
assert(nodeType === "object",
"Applying location marker to an unexpected node type: " +
nodeType);
if (extra.range) {
node.range = [this.range[0], this.range[1]];
}
if (extra.loc) {
node.loc = {
start: {
line: this.loc.start.line,
column: this.loc.start.column
},
end: {
line: this.loc.end.line,
column: this.loc.end.column
}
};
node = delegate.postProcess(node);
}
};
return marker;
}
function trackGroupExpression() {
var marker, expr;
skipComment();
marker = createLocationMarker();
expect('(');
++state.parenthesizedCount;
state.allowArrowFunction = !state.allowArrowFunction;
expr = parseExpression();
state.allowArrowFunction = false;
if (expr.type === 'ArrowFunctionExpression') {
marker.end();
marker.apply(expr);
} else {
expect(')');
marker.end();
marker.applyGroup(expr);
}
return expr;
}
function trackLeftHandSideExpression() {
var marker, expr;
skipComment();
marker = createLocationMarker();
expr = matchKeyword('new') ? parseNewExpression() : parsePrimaryExpression();
while (match('.') || match('[') || lookahead.type === Token.Template) {
if (match('[')) {
expr = delegate.createMemberExpression('[', expr, parseComputedMember());
marker.end();
marker.apply(expr);
} else if (match('.')) {
expr = delegate.createMemberExpression('.', expr, parseNonComputedMember());
marker.end();
marker.apply(expr);
} else {
expr = delegate.createTaggedTemplateExpression(expr, parseTemplateLiteral());
marker.end();
marker.apply(expr);
}
}
return expr;
}
function trackLeftHandSideExpressionAllowCall() {
var marker, expr, args;
skipComment();
marker = createLocationMarker();
expr = matchKeyword('new') ? parseNewExpression() : parsePrimaryExpression();
while (match('.') || match('[') || match('(') || lookahead.type === Token.Template) {
if (match('(')) {
args = parseArguments();
expr = delegate.createCallExpression(expr, args);
marker.end();
marker.apply(expr);
} else if (match('[')) {
expr = delegate.createMemberExpression('[', expr, parseComputedMember());
marker.end();
marker.apply(expr);
} else if (match('.')) {
expr = delegate.createMemberExpression('.', expr, parseNonComputedMember());
marker.end();
marker.apply(expr);
} else {
expr = delegate.createTaggedTemplateExpression(expr, parseTemplateLiteral());
marker.end();
marker.apply(expr);
}
}
return expr;
}
function filterGroup(node) {
var n, i, entry;
n = (Object.prototype.toString.apply(node) === '[object Array]') ? [] : {};
for (i in node) {
if (node.hasOwnProperty(i) && i !== 'groupRange' && i !== 'groupLoc') {
entry = node[i];
if (entry === null || typeof entry !== 'object' || entry instanceof RegExp) {
n[i] = entry;
} else {
n[i] = filterGroup(entry);
}
}
}
return n;
}
function wrapTrackingFunction(range, loc, preserveWhitespace) {
return function (parseFunction) {
function isBinary(node) {
return node.type === Syntax.LogicalExpression ||
node.type === Syntax.BinaryExpression;
}
function visit(node) {
var start, end;
if (isBinary(node.left)) {
visit(node.left);
}
if (isBinary(node.right)) {
visit(node.right);
}
if (range) {
if (node.left.groupRange || node.right.groupRange) {
start = node.left.groupRange ? node.left.groupRange[0] : node.left.range[0];
end = node.right.groupRange ? node.right.groupRange[1] : node.right.range[1];
node.range = [start, end];
} else if (typeof node.range === 'undefined') {
start = node.left.range[0];
end = node.right.range[1];
node.range = [start, end];
}
}
if (loc) {
if (node.left.groupLoc || node.right.groupLoc) {
start = node.left.groupLoc ? node.left.groupLoc.start : node.left.loc.start;
end = node.right.groupLoc ? node.right.groupLoc.end : node.right.loc.end;
node.loc = {
start: start,
end: end
};
node = delegate.postProcess(node);
} else if (typeof node.loc === 'undefined') {
node.loc = {
start: node.left.loc.start,
end: node.right.loc.end
};
node = delegate.postProcess(node);
}
}
}
return function () {
var marker, node;
if (!preserveWhitespace) {
skipComment();
}
marker = createLocationMarker();
node = parseFunction.apply(null, arguments);
marker.end();
if (range && typeof node.range === 'undefined') {
marker.apply(node);
}
if (loc && typeof node.loc === 'undefined') {
marker.apply(node);
}
if (isBinary(node)) {
visit(node);
}
return node;
};
};
}
function patch() {
var wrapTracking, wrapTrackingPreserveWhitespace;
if (extra.comments) {
extra.skipComment = skipComment;
skipComment = scanComment;
}
if (extra.range || extra.loc) {
extra.parseGroupExpression = parseGroupExpression;
extra.parseLeftHandSideExpression = parseLeftHandSideExpression;
extra.parseLeftHandSideExpressionAllowCall = parseLeftHandSideExpressionAllowCall;
parseGroupExpression = trackGroupExpression;
parseLeftHandSideExpression = trackLeftHandSideExpression;
parseLeftHandSideExpressionAllowCall = trackLeftHandSideExpressionAllowCall;
wrapTracking = wrapTrackingFunction(extra.range, extra.loc);
wrapTrackingPreserveWhitespace =
wrapTrackingFunction(extra.range, extra.loc, true);
extra.parseAssignmentExpression = parseAssignmentExpression;
extra.parseBinaryExpression = parseBinaryExpression;
extra.parseBlock = parseBlock;
extra.parseFunctionSourceElements = parseFunctionSourceElements;
extra.parseCatchClause = parseCatchClause;
extra.parseComputedMember = parseComputedMember;
extra.parseConditionalExpression = parseConditionalExpression;
extra.parseConstLetDeclaration = parseConstLetDeclaration;
extra.parseExportDeclaration = parseExportDeclaration;
extra.parseExportSpecifier = parseExportSpecifier;
extra.parseExportSpecifierSetProperty = parseExportSpecifierSetProperty;
extra.parseExpression = parseExpression;
extra.parseForVariableDeclaration = parseForVariableDeclaration;
extra.parseFunctionDeclaration = parseFunctionDeclaration;
extra.parseFunctionExpression = parseFunctionExpression;
extra.parseParams = parseParams;
extra.parseGlob = parseGlob;
extra.parseImportDeclaration = parseImportDeclaration;
extra.parseImportSpecifier = parseImportSpecifier;
extra.parseModuleDeclaration = parseModuleDeclaration;
extra.parseModuleBlock = parseModuleBlock;
extra.parseNewExpression = parseNewExpression;
extra.parseNonComputedProperty = parseNonComputedProperty;
extra.parseObjectProperty = parseObjectProperty;
extra.parseObjectPropertyKey = parseObjectPropertyKey;
extra.parsePath = parsePath;
extra.parsePostfixExpression = parsePostfixExpression;
extra.parsePrimaryExpression = parsePrimaryExpression;
extra.parseProgram = parseProgram;
extra.parsePropertyFunction = parsePropertyFunction;
extra.parseSpreadOrAssignmentExpression = parseSpreadOrAssignmentExpression;
extra.parseTemplateElement = parseTemplateElement;
extra.parseTemplateLiteral = parseTemplateLiteral;
extra.parseStatement = parseStatement;
extra.parseSwitchCase = parseSwitchCase;
extra.parseUnaryExpression = parseUnaryExpression;
extra.parseVariableDeclaration = parseVariableDeclaration;
extra.parseVariableIdentifier = parseVariableIdentifier;
extra.parseMethodDefinition = parseMethodDefinition;
extra.parseClassDeclaration = parseClassDeclaration;
extra.parseClassExpression = parseClassExpression;
extra.parseClassBody = parseClassBody;
extra.parseXJSIdentifier = parseXJSIdentifier;
extra.parseXJSChild = parseXJSChild;
extra.parseXJSAttribute = parseXJSAttribute;
extra.parseXJSAttributeValue = parseXJSAttributeValue;
extra.parseXJSExpression = parseXJSExpression;
extra.parseXJSElement = parseXJSElement;
extra.parseXJSClosingElement = parseXJSClosingElement;
extra.parseXJSOpeningElement = parseXJSOpeningElement;
parseAssignmentExpression = wrapTracking(extra.parseAssignmentExpression);
parseBinaryExpression = wrapTracking(extra.parseBinaryExpression);
parseBlock = wrapTracking(extra.parseBlock);
parseFunctionSourceElements = wrapTracking(extra.parseFunctionSourceElements);
parseCatchClause = wrapTracking(extra.parseCatchClause);
parseComputedMember = wrapTracking(extra.parseComputedMember);
parseConditionalExpression = wrapTracking(extra.parseConditionalExpression);
parseConstLetDeclaration = wrapTracking(extra.parseConstLetDeclaration);
parseExportDeclaration = wrapTracking(parseExportDeclaration);
parseExportSpecifier = wrapTracking(parseExportSpecifier);
parseExportSpecifierSetProperty = wrapTracking(parseExportSpecifierSetProperty);
parseExpression = wrapTracking(extra.parseExpression);
parseForVariableDeclaration = wrapTracking(extra.parseForVariableDeclaration);
parseFunctionDeclaration = wrapTracking(extra.parseFunctionDeclaration);
parseFunctionExpression = wrapTracking(extra.parseFunctionExpression);
parseParams = wrapTracking(extra.parseParams);
parseGlob = wrapTracking(extra.parseGlob);
parseImportDeclaration = wrapTracking(extra.parseImportDeclaration);
parseImportSpecifier = wrapTracking(extra.parseImportSpecifier);
parseModuleDeclaration = wrapTracking(extra.parseModuleDeclaration);
parseModuleBlock = wrapTracking(extra.parseModuleBlock);
parseLeftHandSideExpression = wrapTracking(parseLeftHandSideExpression);
parseNewExpression = wrapTracking(extra.parseNewExpression);
parseNonComputedProperty = wrapTracking(extra.parseNonComputedProperty);
parseObjectProperty = wrapTracking(extra.parseObjectProperty);
parseObjectPropertyKey = wrapTracking(extra.parseObjectPropertyKey);
parsePath = wrapTracking(extra.parsePath);
parsePostfixExpression = wrapTracking(extra.parsePostfixExpression);
parsePrimaryExpression = wrapTracking(extra.parsePrimaryExpression);
parseProgram = wrapTracking(extra.parseProgram);
parsePropertyFunction = wrapTracking(extra.parsePropertyFunction);
parseTemplateElement = wrapTracking(extra.parseTemplateElement);
parseTemplateLiteral = wrapTracking(extra.parseTemplateLiteral);
parseSpreadOrAssignmentExpression = wrapTracking(extra.parseSpreadOrAssignmentExpression);
parseStatement = wrapTracking(extra.parseStatement);
parseSwitchCase = wrapTracking(extra.parseSwitchCase);
parseUnaryExpression = wrapTracking(extra.parseUnaryExpression);
parseVariableDeclaration = wrapTracking(extra.parseVariableDeclaration);
parseVariableIdentifier = wrapTracking(extra.parseVariableIdentifier);
parseMethodDefinition = wrapTracking(extra.parseMethodDefinition);
parseClassDeclaration = wrapTracking(extra.parseClassDeclaration);
parseClassExpression = wrapTracking(extra.parseClassExpression);
parseClassBody = wrapTracking(extra.parseClassBody);
parseXJSIdentifier = wrapTracking(extra.parseXJSIdentifier);
parseXJSChild = wrapTrackingPreserveWhitespace(extra.parseXJSChild);
parseXJSAttribute = wrapTracking(extra.parseXJSAttribute);
parseXJSAttributeValue = wrapTracking(extra.parseXJSAttributeValue);
parseXJSExpression = wrapTracking(extra.parseXJSExpression);
parseXJSElement = wrapTracking(extra.parseXJSElement);
parseXJSClosingElement = wrapTracking(extra.parseXJSClosingElement);
parseXJSOpeningElement = wrapTracking(extra.parseXJSOpeningElement);
}
if (typeof extra.tokens !== 'undefined') {
extra.advance = advance;
extra.scanRegExp = scanRegExp;
advance = collectToken;
scanRegExp = collectRegex;
}
}
function unpatch() {
if (typeof extra.skipComment === 'function') {
skipComment = extra.skipComment;
}
if (extra.range || extra.loc) {
parseAssignmentExpression = extra.parseAssignmentExpression;
parseBinaryExpression = extra.parseBinaryExpression;
parseBlock = extra.parseBlock;
parseFunctionSourceElements = extra.parseFunctionSourceElements;
parseCatchClause = extra.parseCatchClause;
parseComputedMember = extra.parseComputedMember;
parseConditionalExpression = extra.parseConditionalExpression;
parseConstLetDeclaration = extra.parseConstLetDeclaration;
parseExportDeclaration = extra.parseExportDeclaration;
parseExportSpecifier = extra.parseExportSpecifier;
parseExportSpecifierSetProperty = extra.parseExportSpecifierSetProperty;
parseExpression = extra.parseExpression;
parseForVariableDeclaration = extra.parseForVariableDeclaration;
parseFunctionDeclaration = extra.parseFunctionDeclaration;
parseFunctionExpression = extra.parseFunctionExpression;
parseGlob = extra.parseGlob;
parseImportDeclaration = extra.parseImportDeclaration;
parseImportSpecifier = extra.parseImportSpecifier;
parseGroupExpression = extra.parseGroupExpression;
parseLeftHandSideExpression = extra.parseLeftHandSideExpression;
parseLeftHandSideExpressionAllowCall = extra.parseLeftHandSideExpressionAllowCall;
parseModuleDeclaration = extra.parseModuleDeclaration;
parseModuleBlock = extra.parseModuleBlock;
parseNewExpression = extra.parseNewExpression;
parseNonComputedProperty = extra.parseNonComputedProperty;
parseObjectProperty = extra.parseObjectProperty;
parseObjectPropertyKey = extra.parseObjectPropertyKey;
parsePath = extra.parsePath;
parsePostfixExpression = extra.parsePostfixExpression;
parsePrimaryExpression = extra.parsePrimaryExpression;
parseProgram = extra.parseProgram;
parsePropertyFunction = extra.parsePropertyFunction;
parseTemplateElement = extra.parseTemplateElement;
parseTemplateLiteral = extra.parseTemplateLiteral;
parseSpreadOrAssignmentExpression = extra.parseSpreadOrAssignmentExpression;
parseStatement = extra.parseStatement;
parseSwitchCase = extra.parseSwitchCase;
parseUnaryExpression = extra.parseUnaryExpression;
parseVariableDeclaration = extra.parseVariableDeclaration;
parseVariableIdentifier = extra.parseVariableIdentifier;
parseMethodDefinition = extra.parseMethodDefinition;
parseClassDeclaration = extra.parseClassDeclaration;
parseClassExpression = extra.parseClassExpression;
parseClassBody = extra.parseClassBody;
parseXJSIdentifier = extra.parseXJSIdentifier;
parseXJSChild = extra.parseXJSChild;
parseXJSAttribute = extra.parseXJSAttribute;
parseXJSAttributeValue = extra.parseXJSAttributeValue;
parseXJSExpression = extra.parseXJSExpression;
parseXJSElement = extra.parseXJSElement;
parseXJSClosingElement = extra.parseXJSClosingElement;
parseXJSOpeningElement = extra.parseXJSOpeningElement;
}
if (typeof extra.scanRegExp === 'function') {
advance = extra.advance;
scanRegExp = extra.scanRegExp;
}
}
// This is used to modify the delegate.
function extend(object, properties) {
var entry, result = {};
for (entry in object) {
if (object.hasOwnProperty(entry)) {
result[entry] = object[entry];
}
}
for (entry in properties) {
if (properties.hasOwnProperty(entry)) {
result[entry] = properties[entry];
}
}
return result;
}
function tokenize(code, options) {
var toString,
token,
tokens;
toString = String;
if (typeof code !== 'string' && !(code instanceof String)) {
code = toString(code);
}
delegate = SyntaxTreeDelegate;
source = code;
index = 0;
lineNumber = (source.length > 0) ? 1 : 0;
lineStart = 0;
length = source.length;
lookahead = null;
state = {
allowIn: true,
labelSet: {},
inFunctionBody: false,
inIteration: false,
inSwitch: false
};
extra = {};
// Options matching.
options = options || {};
// Of course we collect tokens here.
options.tokens = true;
extra.tokens = [];
extra.tokenize = true;
// The following two fields are necessary to compute the Regex tokens.
extra.openParenToken = -1;
extra.openCurlyToken = -1;
extra.range = (typeof options.range === 'boolean') && options.range;
extra.loc = (typeof options.loc === 'boolean') && options.loc;
if (typeof options.comment === 'boolean' && options.comment) {
extra.comments = [];
}
if (typeof options.tolerant === 'boolean' && options.tolerant) {
extra.errors = [];
}
if (length > 0) {
if (typeof source[0] === 'undefined') {
// Try first to convert to a string. This is good as fast path
// for old IE which understands string indexing for string
// literals only and not for string object.
if (code instanceof String) {
source = code.valueOf();
}
}
}
patch();
try {
peek();
if (lookahead.type === Token.EOF) {
return extra.tokens;
}
token = lex();
while (lookahead.type !== Token.EOF) {
try {
token = lex();
} catch (lexError) {
token = lookahead;
if (extra.errors) {
extra.errors.push(lexError);
// We have to break on the first error
// to avoid infinite loops.
break;
} else {
throw lexError;
}
}
}
filterTokenLocation();
tokens = extra.tokens;
if (typeof extra.comments !== 'undefined') {
filterCommentLocation();
tokens.comments = extra.comments;
}
if (typeof extra.errors !== 'undefined') {
tokens.errors = extra.errors;
}
} catch (e) {
throw e;
} finally {
unpatch();
extra = {};
}
return tokens;
}
function parse(code, options) {
var program, toString;
toString = String;
if (typeof code !== 'string' && !(code instanceof String)) {
code = toString(code);
}
delegate = SyntaxTreeDelegate;
source = code;
index = 0;
lineNumber = (source.length > 0) ? 1 : 0;
lineStart = 0;
length = source.length;
lookahead = null;
state = {
allowIn: true,
labelSet: {},
parenthesizedCount: 0,
inFunctionBody: false,
inIteration: false,
inSwitch: false,
yieldAllowed: false,
yieldFound: false
};
extra = {};
if (typeof options !== 'undefined') {
extra.range = (typeof options.range === 'boolean') && options.range;
extra.loc = (typeof options.loc === 'boolean') && options.loc;
if (extra.loc && options.source !== null && options.source !== undefined) {
delegate = extend(delegate, {
'postProcess': function (node) {
node.loc.source = toString(options.source);
return node;
}
});
}
if (typeof options.tokens === 'boolean' && options.tokens) {
extra.tokens = [];
}
if (typeof options.comment === 'boolean' && options.comment) {
extra.comments = [];
}
if (typeof options.tolerant === 'boolean' && options.tolerant) {
extra.errors = [];
}
}
if (length > 0) {
if (typeof source[0] === 'undefined') {
// Try first to convert to a string. This is good as fast path
// for old IE which understands string indexing for string
// literals only and not for string object.
if (code instanceof String) {
source = code.valueOf();
}
}
}
patch();
try {
program = parseProgram();
if (typeof extra.comments !== 'undefined') {
filterCommentLocation();
program.comments = extra.comments;
}
if (typeof extra.tokens !== 'undefined') {
filterTokenLocation();
program.tokens = extra.tokens;
}
if (typeof extra.errors !== 'undefined') {
program.errors = extra.errors;
}
if (extra.range || extra.loc) {
program.body = filterGroup(program.body);
}
} catch (e) {
throw e;
} finally {
unpatch();
extra = {};
}
return program;
}
// Sync with package.json and component.json.
exports.version = '1.1.0-dev-harmony';
exports.tokenize = tokenize;
exports.parse = parse;
// Deep copy.
exports.Syntax = (function () {
var name, types = {};
if (typeof Object.create === 'function') {
types = Object.create(null);
}
for (name in Syntax) {
if (Syntax.hasOwnProperty(name)) {
types[name] = Syntax[name];
}
}
if (typeof Object.freeze === 'function') {
Object.freeze(types);
}
return types;
}());
}));
/* vim: set sw=4 ts=4 et tw=80 : */
})()
},{}],11:[function(require,module,exports){
(function(){/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*global exports:true*/
"use strict";
var catchup = require('../lib/utils').catchup;
var append = require('../lib/utils').append;
var move = require('../lib/utils').move;
var knownTags = {
a: true,
abbr: true,
address: true,
applet: true,
area: true,
article: true,
aside: true,
audio: true,
b: true,
base: true,
bdi: true,
bdo: true,
blockquote: true,
body: true,
br: true,
button: true,
canvas: true,
circle: true,
ellipse: true,
caption: true,
cite: true,
code: true,
col: true,
colgroup: true,
command: true,
data: true,
datalist: true,
dd: true,
del: true,
details: true,
dfn: true,
dialog: true,
div: true,
dl: true,
dt: true,
em: true,
embed: true,
fieldset: true,
figcaption: true,
figure: true,
footer: true,
form: true,
g: true,
h1: true,
h2: true,
h3: true,
h4: true,
h5: true,
h6: true,
head: true,
header: true,
hgroup: true,
hr: true,
html: true,
i: true,
iframe: true,
img: true,
input: true,
ins: true,
kbd: true,
keygen: true,
label: true,
legend: true,
li: true,
line: true,
link: true,
map: true,
mark: true,
marquee: true,
menu: true,
meta: true,
meter: true,
nav: true,
noscript: true,
object: true,
ol: true,
optgroup: true,
option: true,
output: true,
p: true,
path: true,
param: true,
pre: true,
progress: true,
q: true,
rect: true,
rp: true,
rt: true,
ruby: true,
s: true,
samp: true,
script: true,
section: true,
select: true,
small: true,
source: true,
span: true,
strong: true,
style: true,
sub: true,
summary: true,
sup: true,
svg: true,
table: true,
tbody: true,
td: true,
text: true,
textarea: true,
tfoot: true,
th: true,
thead: true,
time: true,
title: true,
tr: true,
track: true,
u: true,
ul: true,
'var': true,
video: true,
wbr: true
};
function safeTrim(string) {
return string.replace(/^[ \t]+/, '').replace(/[ \t]+$/, '');
}
// Replace all trailing whitespace characters with a single space character
function trimWithSingleSpace(string) {
return string.replace(/^[ \t\xA0]{2,}/, ' ').
replace(/[ \t\xA0]{2,}$/, ' ').replace(/^\s+$/, '');
}
/**
* Special handling for multiline string literals
* print lines:
*
* line
* line
*
* as:
*
* "line "+
* "line"
*/
function renderXJSLiteral(object, isLast, state, start, end) {
/** Added blank check filtering and triming*/
var trimmedChildValue = safeTrim(object.value);
if (trimmedChildValue) {
// head whitespace
append(object.value.match(/^[\t ]*/)[0], state);
if (start) {
append(start, state);
}
var trimmedChildValueWithSpace = trimWithSingleSpace(object.value);
/**
*/
var initialLines = trimmedChildValue.split(/\r\n|\n|\r/);
var lines = initialLines.filter(function(line) {
return safeTrim(line).length > 0;
});
var hasInitialNewLine = initialLines[0] !== lines[0];
var hasFinalNewLine =
initialLines[initialLines.length - 1] !== lines[lines.length - 1];
var numLines = lines.length;
lines.forEach(function (line, ii) {
var lastLine = ii === numLines - 1;
var trimmedLine = safeTrim(line);
if (trimmedLine === '' && !lastLine) {
append(line, state);
} else {
var preString = '';
var postString = '';
var leading = '';
if (ii === 0) {
if (hasInitialNewLine) {
preString = ' ';
leading = '\n';
}
if (trimmedChildValueWithSpace.substring(0, 1) === ' ') {
// If this is the first line, and the original content starts with
// whitespace, place a single space at the beginning.
preString = ' ';
}
} else {
leading = line.match(/^[ \t]*/)[0];
}
if (!lastLine || trimmedChildValueWithSpace.substr(
trimmedChildValueWithSpace.length - 1, 1) === ' ' ||
hasFinalNewLine
) {
// If either not on the last line, or the original content ends with
// whitespace, place a single character at the end.
postString = ' ';
}
append(
leading +
JSON.stringify(
preString + trimmedLine + postString
) +
(lastLine ? '' : '+') +
line.match(/[ \t]*$/)[0],
state);
}
if (!lastLine) {
append('\n', state);
}
});
} else {
if (start) {
append(start, state);
}
append('""', state);
}
if (end) {
append(end, state);
}
// add comma before trailing whitespace
if (!isLast) {
append(',', state);
}
// tail whitespace
append(object.value.match(/[ \t]*$/)[0], state);
move(object.range[1], state);
}
function renderXJSExpression(traverse, object, isLast, path, state) {
// Plus 1 to skip `{`.
move(object.range[0] + 1, state);
traverse(object.value, path, state);
if (!isLast) {
// If we need to append a comma, make sure to do so after the expression.
catchup(object.value.range[1], state);
append(',', state);
}
// Minus 1 to skip `}`.
catchup(object.range[1] - 1, state);
move(object.range[1], state);
return false;
}
function quoteAttrName(attr) {
// Quote invalid JS identifiers.
if (!/^[a-z_$][a-z\d_$]*$/i.test(attr)) {
return "'" + attr + "'";
}
return attr;
}
exports.knownTags = knownTags;
exports.renderXJSExpression = renderXJSExpression;
exports.renderXJSLiteral = renderXJSLiteral;
exports.quoteAttrName = quoteAttrName;
})()
},{"../lib/utils":8}],10:[function(require,module,exports){
/*
* Copyright 2009-2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE.txt or:
* http://opensource.org/licenses/BSD-3-Clause
*/
exports.SourceMapGenerator = require('./source-map/source-map-generator').SourceMapGenerator;
exports.SourceMapConsumer = require('./source-map/source-map-consumer').SourceMapConsumer;
exports.SourceNode = require('./source-map/source-node').SourceNode;
},{"./source-map/source-map-generator":12,"./source-map/source-map-consumer":13,"./source-map/source-node":14}],5:[function(require,module,exports){
(function(){/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*global exports:true*/
"use strict";
/**
* Desugarizer for ES6 minimal class proposal. See
* http://wiki.ecmascript.org/doku.php?id=harmony:proposals
*
* Does not require any runtime. Preserves whitespace and comments.
* Supports a class declaration with methods, super calls and inheritance.
* Currently does not support for getters and setters, since there's a very
* low probability we're going to use them anytime soon.
*
* Additional features:
* - Any member with private name (the name with prefix _, such _name) inside
* the class's scope will be munged. This would will to eliminate the case
* of sub-class accidentally overriding the super-class's provate properties
* also discouage people from accessing private members that they should not
* access. However, quoted property names don't get munged.
*
* class SkinnedMesh extends require('THREE').Mesh {
*
* update(camera) {
* camera.code = 'iphone'
* super.update(camera);
* }
*
* /
* * @constructor
* /
* constructor(geometry, materials) {
* super(geometry, materials);
*
* super.update(1);
*
* this.identityMatrix = new THREE.Matrix4();
* this.bones = [];
* this.boneMatrices = [];
* this._name = 'foo';
* }
*
* /
* * some other code
* /
* readMore() {
*
* }
*
* _doSomething() {
*
* }
* }
*
* should be converted to
*
* var SkinnedMesh = (function() {
* var __super = require('parent').Mesh;
*
* /
* * @constructor
* /
* function SkinnedMesh(geometry, materials) {
* __super.call(this, geometry, materials);
*
* __super.prototype.update.call(this, 1);
*
* this.identityMatrix = new THREE.Matrix4();
* this.bones = [];
* this.boneMatrices = [];
* this.$SkinnedMesh_name = 'foo';
* }
* SkinnedMesh.prototype = Object.create(__super.prototype);
* SkinnedMesh.prototype.constructor = SkinnedMesh;
*
* /
* * @param camera
* /
* SkinnedMesh.prototype.update = function(camera) {
* camera.code = 'iphone'
* __super.prototype.update.call(this, camera);
* };
*
* SkinnedMesh.prototype.readMore = function() {
*
* };
*
* SkinnedMesh.prototype.$SkinnedMesh_doSomething = function() {
*
* };
*
* return SkinnedMesh;
* })();
*
*/
var Syntax = require('esprima').Syntax;
var base62 = require('base62');
var catchup = require('../lib/utils').catchup;
var append = require('../lib/utils').append;
var move = require('../lib/utils').move;
var indentBefore = require('../lib/utils').indentBefore;
var updateIndent = require('../lib/utils').updateIndent;
var updateState = require('../lib/utils').updateState;
function findConstructorIndex(object) {
var classElements = object.body && object.body.body || [];
for (var i = 0; i < classElements.length; i++) {
if (classElements[i].type === Syntax.MethodDefinition &&
classElements[i].key.name === 'constructor') {
return i;
}
}
return -1;
}
var _mungedSymbolMaps = {};
function getMungedName(scopeName, name, minify) {
if (minify) {
if (!_mungedSymbolMaps[scopeName]) {
_mungedSymbolMaps[scopeName] = {
symbolMap: {},
identifierUUIDCounter: 0
};
}
var symbolMap = _mungedSymbolMaps[scopeName].symbolMap;
if (!symbolMap[name]) {
symbolMap[name] =
base62.encode(_mungedSymbolMaps[scopeName].identifierUUIDCounter);
_mungedSymbolMaps[scopeName].identifierUUIDCounter++;
}
name = symbolMap[name];
}
return '$' + scopeName + name;
}
function shouldMungeName(scopeName, name, state) {
// only run when @preventMunge is not present in the docblock
if (state.g.preventMunge === undefined) {
var docblock = require('../lib/docblock');
state.g.preventMunge = docblock.parseAsObject(
docblock.extract(state.g.source)).preventMunge !== undefined;
}
// Starts with only a single underscore (i.e. don't count double-underscores)
return !state.g.preventMunge && scopeName ? /^_(?!_)/.test(name) : false;
}
function getProtoOfPrototypeVariableName(superVar) {
return superVar + 'ProtoOfPrototype';
}
function getSuperKeyName(superVar) {
return superVar + 'Key';
}
function getSuperProtoOfPrototypeVariable(superVariableName, indent) {
var string = (indent +
'var $proto = $superName && $superName.prototype ? ' +
'$superName.prototype : $superName;\n'
).replace(/\$proto/g, getProtoOfPrototypeVariableName(superVariableName))
.replace(/\$superName/g, superVariableName);
return string;
}
function getInheritanceSetup(superClassToken, className, indent, superName) {
var string = '';
if (superClassToken) {
string += getStaticMethodsOnConstructorSetup(className, indent, superName);
string += getPrototypeOnConstructorSetup(className, indent, superName);
string += getConstructorPropertySetup(className, indent);
}
return string;
}
function getStaticMethodsOnConstructorSetup(className, indent, superName) {
var string = ( indent +
'for (var $keyName in $superName) {\n' + indent +
' if ($superName.hasOwnProperty($keyName)) {\n' + indent +
' $className[$keyName] = $superName[$keyName];\n' + indent +
' }\n' + indent +
'}\n')
.replace(/\$className/g, className)
.replace(/\$keyName/g, getSuperKeyName(superName))
.replace(/\$superName/g, superName);
return string;
}
function getPrototypeOnConstructorSetup(className, indent, superName) {
var string = ( indent +
'$className.prototype = Object.create($protoPrototype);\n')
.replace(/\$protoPrototype/g, getProtoOfPrototypeVariableName(superName))
.replace(/\$className/g, className);
return string;
}
function getConstructorPropertySetup(className, indent) {
var string = ( indent +
'$className.prototype.constructor = $className;\n')
.replace(/\$className/g, className);
return string;
}
function getSuperConstructorSetup(superClassToken, indent, superName) {
if (!superClassToken) return '';
var string = ( '\n' + indent +
' if ($superName && $superName.prototype) {\n' + indent +
' $superName.apply(this, arguments);\n' + indent +
' }\n' + indent)
.replace(/\$superName/g, superName);
return string;
}
function getMemberFunctionCall(superVar, propertyName, superArgs) {
var string = (
'$superPrototype.$propertyName.call($superArguments)')
.replace(/\$superPrototype/g, getProtoOfPrototypeVariableName(superVar))
.replace(/\$propertyName/g, propertyName)
.replace(/\$superArguments/g, superArgs);
return string;
}
function getCallParams(classElement, state) {
var params = classElement.value.params;
if (!params.length) {
return '';
}
return state.g.source.substring(
params[0].range[0],
params[params.length - 1].range[1]);
}
function getSuperArguments(callExpression, state) {
var args = callExpression.arguments;
if (!args.length) {
return 'this';
}
return 'this, ' + state.g.source.substring(
args[0].range[0],
args[args.length - 1].range[1]);
}
// The seed is used to generate the name for an anonymous class,
// and this seed should be unique per browser's session.
// The value of the seed looks like this: 1229588505.2969012.
var classIDSeed = Date.now() % (60 * 60 * 1000) + Math.random();
/**
* Generates a name for an anonymous class. The generated value looks like
* this: "Classkc6pcn_mniza1yvi"
* @param {String} scopeName
* @return {string} the scope name for Anonymous Class
*/
function generateAnonymousClassName(scopeName) {
classIDSeed++;
return 'Class' +
(classIDSeed).toString(36).replace('.', '_') +
(scopeName || '');
}
function renderMethods(traverse, object, name, path, state) {
var classElements = object.body && object.body.body || [];
move(object.body.range[0] + 1, state);
for (var i = 0; i < classElements.length; i++) {
if (classElements[i].key.name !== 'constructor') {
catchup(classElements[i].range[0], state);
var memberName = classElements[i].key.name;
if (shouldMungeName(state.scopeName, memberName, state)) {
memberName = getMungedName(
state.scopeName,
memberName,
state.g.opts.minify
);
}
var prototypeOrStatic;
if (classElements[i]['static']) {
prototypeOrStatic = '';
} else {
prototypeOrStatic = 'prototype.';
}
append(name + '.' + prototypeOrStatic + memberName + ' = ', state);
renderMethod(traverse, classElements[i], null, path, state);
append(';', state);
}
move(classElements[i].range[1], state);
}
if (classElements.length) {
append('\n', state);
}
move(object.range[1], state);
}
function renderMethod(traverse, method, name, path, state) {
append(name ? 'function ' + name + '(' : 'function(', state);
append(getCallParams(method, state) + ') {', state);
move(method.value.body.range[0] + 1, state);
traverse(method.value.body, path, state);
catchup(method.value.body.range[1] - 1, state);
append('}', state);
}
function renderSuperClass(traverse, superClass, path, state) {
append('var ' + state.superVar + ' = ', state);
move(superClass.range[0], state);
traverse(superClass, path, state);
catchup(superClass.range[1], state);
append(';\n', state);
}
function renderConstructor(traverse, object, name, indent, path, state) {
var classElements = object.body && object.body.body || [];
var constructorIndex = findConstructorIndex(object);
var constructor = constructorIndex === -1 ?
null :
classElements[constructorIndex];
if (constructor) {
move(constructorIndex === 0 ?
object.body.range[0] + 1 :
classElements[constructorIndex - 1].range[1], state);
catchup(constructor.range[0], state);
renderMethod(traverse, constructor, name, path, state);
append('\n', state);
} else {
if (object.superClass) {
append('\n' + indent, state);
}
append('function ', state);
if (object.id) {
move(object.id.range[0], state);
}
append(name, state);
if (object.id) {
move(object.id.range[1], state);
}
append('(){ ', state);
if (object.body) {
move(object.body.range[0], state);
}
append(getSuperConstructorSetup(
object.superClass,
indent,
state.superVar), state);
append('}\n', state);
}
}
var superId = 0;
function renderClassBody(traverse, object, path, state) {
var name = object.id ? object.id.name : 'constructor';
var superClass = object.superClass;
var indent = updateIndent(
indentBefore(object.range[0], state) + ' ',
state);
state = updateState(
state,
{
scopeName: object.id ? object.id.name :
generateAnonymousClassName(state.scopeName),
superVar: superClass ? '__super' + superId++ : ''
});
// super class
if (superClass) {
append(indent, state);
renderSuperClass(traverse, superClass, path, state);
append(getSuperProtoOfPrototypeVariable(state.superVar, indent), state);
}
renderConstructor(traverse, object, name, indent, path, state);
append(getInheritanceSetup(superClass, name, indent, state.superVar), state);
renderMethods(traverse, object, name, path, state);
}
/**
* @public
*/
function visitClassExpression(traverse, object, path, state) {
var indent = updateIndent(
indentBefore(object.range[0], state) + ' ',
state);
var name = object.id ? object.id.name : 'constructor';
append('(function() {\n', state);
renderClassBody(traverse, object, path, state);
append(indent + 'return ' + name + ';\n', state);
append(indent.substring(0, indent.length - 2) + '})()', state);
return false
}
visitClassExpression.test = function(object, path, state) {
return object.type === Syntax.ClassExpression;
};
/**
* @public
*/
function visitClassDeclaration(traverse, object, path, state) {
state.g.indentBy--;
renderClassBody(traverse, object, path, state);
state.g.indentBy++;
return false;
}
visitClassDeclaration.test = function(object, path, state) {
return object.type === Syntax.ClassDeclaration;
};
/**
* @public
*/
function visitSuperCall(traverse, object, path, state) {
if (path[0].type === Syntax.CallExpression) {
append(state.superVar +
'.call(' + getSuperArguments(path[0], state) + ')', state);
move(path[0].range[1], state);
} else if (path[0].type === Syntax.MemberExpression) {
append(getMemberFunctionCall(
state.superVar,
path[0].property.name,
getSuperArguments(path[1], state)), state);
move(path[1].range[1], state);
}
return false;
}
visitSuperCall.test = function(object, path, state) {
return state.superVar && object.type === Syntax.Identifier &&
object.name === 'super';
};
/**
* @public
*/
function visitPrivateProperty(traverse, object, path, state) {
var type = path[0] ? path[0].type : null;
if (type !== Syntax.Property) {
if (type === Syntax.MemberExpression) {
type = path[0].object ? path[0].object.type : null;
if (type === Syntax.Identifier &&
path[0].object.range[0] === object.range[0]) {
// Identifier is a variable that appears "private".
return;
}
} else {
// Other syntax that are neither Property nor MemberExpression.
return;
}
}
var oldName = object.name;
var newName = getMungedName(
state.scopeName,
oldName,
state.g.opts.minify
);
append(newName, state);
move(object.range[1], state);
}
visitPrivateProperty.test = function(object, path, state) {
return object.type === Syntax.Identifier &&
shouldMungeName(state.scopeName, object.name, state);
};
exports.visitClassDeclaration = visitClassDeclaration;
exports.visitClassExpression = visitClassExpression;
exports.visitSuperCall = visitSuperCall;
exports.visitPrivateProperty = visitPrivateProperty;
})()
},{"../lib/utils":8,"../lib/docblock":4,"esprima":9,"base62":15}],6:[function(require,module,exports){
(function(){/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*global exports:true*/
"use strict";
var Syntax = require('esprima').Syntax;
var catchup = require('../lib/utils').catchup;
var append = require('../lib/utils').append;
var move = require('../lib/utils').move;
var getDocblock = require('../lib/utils').getDocblock;
var FALLBACK_TAGS = require('./xjs').knownTags;
var renderXJSExpression = require('./xjs').renderXJSExpression;
var renderXJSLiteral = require('./xjs').renderXJSLiteral;
var quoteAttrName = require('./xjs').quoteAttrName;
/**
* Customized desugar processor.
*
* Currently: (Somewhat tailored to React)
* <X> </X> => X(null, null)
* <X prop="1" /> => X({prop: '1'}, null)
* <X prop="2"><Y /></X> => X({prop:'2'}, Y(null, null))
* <X prop="2"><Y /><Z /></X> => X({prop:'2'}, [Y(null, null), Z(null, null)])
*
* Exceptions to the simple rules above:
* if a property is named "class" it will be changed to "className" in the
* javascript since "class" is not a valid object key in javascript.
*/
var JSX_ATTRIBUTE_RENAMES = {
'class': 'className',
cxName: 'className'
};
var JSX_ATTRIBUTE_TRANSFORMS = {
cxName: function(attr) {
if (attr.value.type !== Syntax.Literal) {
throw new Error("cx only accepts a string literal");
} else {
var classNames = attr.value.value.split(/\s+/g);
return 'cx(' + classNames.map(JSON.stringify).join(',') + ')';
}
}
};
function visitReactTag(traverse, object, path, state) {
var jsxObjIdent = getDocblock(state).jsx;
catchup(object.openingElement.range[0], state);
if (object.name.namespace) {
throw new Error(
'Namespace tags are not supported. ReactJSX is not XML.');
}
var isFallbackTag = FALLBACK_TAGS[object.name.name];
append(
(isFallbackTag ? jsxObjIdent + '.' : '') + (object.name.name) + '(',
state
);
move(object.name.range[1], state);
var childrenToRender = object.children.filter(function(child) {
return !(child.type === Syntax.Literal && !child.value.match(/\S/));
});
// if we don't have any attributes, pass in null
if (object.attributes.length === 0) {
append('null', state);
}
// write attributes
object.attributes.forEach(function(attr, index) {
catchup(attr.range[0], state);
if (attr.name.namespace) {
throw new Error(
'Namespace attributes are not supported. ReactJSX is not XML.');
}
var name = JSX_ATTRIBUTE_RENAMES[attr.name.name] || attr.name.name;
var isFirst = index === 0;
var isLast = index === object.attributes.length - 1;
if (isFirst) {
append('{', state);
}
append(quoteAttrName(name), state);
append(':', state);
if (!attr.value) {
state.g.buffer += 'true';
state.g.position = attr.name.range[1];
if (!isLast) {
append(',', state);
}
} else if (JSX_ATTRIBUTE_TRANSFORMS[attr.name.name]) {
move(attr.value.range[0], state);
append(JSX_ATTRIBUTE_TRANSFORMS[attr.name.name](attr), state);
move(attr.value.range[1], state);
if (!isLast) {
append(',', state);
}
} else if (attr.value.type === Syntax.Literal) {
move(attr.value.range[0], state);
renderXJSLiteral(attr.value, isLast, state);
} else {
move(attr.value.range[0], state);
renderXJSExpression(traverse, attr.value, isLast, path, state);
}
if (isLast) {
append('}', state);
}
catchup(attr.range[1], state);
});
if (!object.selfClosing) {
catchup(object.openingElement.range[1] - 1, state);
move(object.openingElement.range[1], state);
}
// separate props and children arguments
append(', ', state);
// filter out whitespace
if (childrenToRender.length > 0) {
if (childrenToRender.length > 1) {
append('[', state);
}
object.children.forEach(function(child) {
if (child.type === Syntax.Literal && !child.value.match(/\S/)) {
return;
}
catchup(child.range[0], state);
var isLast = child === childrenToRender[childrenToRender.length - 1];
if (child.type === Syntax.Literal) {
renderXJSLiteral(child, isLast, state);
} else if (child.type === Syntax.XJSExpression) {
renderXJSExpression(traverse, child, isLast, path, state);
} else {
traverse(child, path, state);
if (!isLast) {
append(',', state);
state.g.buffer = state.g.buffer.replace(/(\s*),$/, ',$1');
}
}
catchup(child.range[1], state);
});
} else {
append('null', state);
}
if (object.selfClosing) {
// everything up to />
catchup(object.openingElement.range[1] - 2, state);
move(object.openingElement.range[1], state);
} else {
// everything up to </ sdflksjfd>
catchup(object.closingElement.range[0], state);
move(object.closingElement.range[1], state);
}
if (childrenToRender.length > 0) {
if (childrenToRender.length > 1) {
append(']', state);
}
}
append(')', state);
return false;
}
visitReactTag.test = function(object, path, state) {
// only run react when react @jsx namespace is specified in docblock
var jsx = getDocblock(state).jsx;
return object.type === Syntax.XJSElement && jsx && jsx.length;
};
exports.visitReactTag = visitReactTag;
})()
},{"../lib/utils":8,"./xjs":11,"esprima":9}],7:[function(require,module,exports){
(function(){/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*global exports:true*/
"use strict";
var Syntax = require('esprima').Syntax;
var catchup = require('../lib/utils').catchup;
var append = require('../lib/utils').append;
var getDocblock = require('../lib/utils').getDocblock;
/**
* Transforms the following:
*
* var MyComponent = React.createClass({
* render: ...
* });
*
* into:
*
* var MyComponent = React.createClass({
* displayName: 'MyComponent',
* render: ...
* });
*/
function visitReactDisplayName(traverse, object, path, state) {
if (object.id.type === Syntax.Identifier &&
object.init &&
object.init.type === Syntax.CallExpression &&
object.init.callee.type === Syntax.MemberExpression &&
object.init.callee.object.type === Syntax.Identifier &&
object.init.callee.object.name === 'React' &&
object.init.callee.property.type === Syntax.Identifier &&
object.init.callee.property.name === 'createClass' &&
object.init['arguments'].length === 1 &&
object.init['arguments'][0].type === Syntax.ObjectExpression) {
var displayName = object.id.name;
catchup(object.init['arguments'][0].range[0] + 1, state);
append("displayName: '" + displayName + "',", state);
}
}
/**
* Will only run on @jsx files for now.
*/
visitReactDisplayName.test = function(object, path, state) {
return object.type === Syntax.VariableDeclarator && !!getDocblock(state).jsx;
};
exports.visitReactDisplayName = visitReactDisplayName;
})()
},{"../lib/utils":8,"esprima":9}],15:[function(require,module,exports){
var Base62 = (function (my) {
my.chars = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
my.encode = function(i){
if (i === 0) {return '0'}
var s = ''
while (i > 0) {
s = this.chars[i % 62] + s
i = Math.floor(i/62)
}
return s
};
my.decode = function(a,b,c,d){
for (
b = c = (
a === (/\W|_|^$/.test(a += "") || a)
) - 1;
d = a.charCodeAt(c++);
)
b = b * 62 + d - [, 48, 29, 87][d >> 5];
return b
};
return my;
}({}));
module.exports = Base62
},{}],12:[function(require,module,exports){
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module);
}
define(function (require, exports, module) {
var base64VLQ = require('./base64-vlq');
var util = require('./util');
var ArraySet = require('./array-set').ArraySet;
/**
* An instance of the SourceMapGenerator represents a source map which is
* being built incrementally. To create a new one, you must pass an object
* with the following properties:
*
* - file: The filename of the generated source.
* - sourceRoot: An optional root for all URLs in this source map.
*/
function SourceMapGenerator(aArgs) {
this._file = util.getArg(aArgs, 'file');
this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
this._sources = new ArraySet();
this._names = new ArraySet();
this._mappings = [];
this._sourcesContents = null;
}
SourceMapGenerator.prototype._version = 3;
/**
* Creates a new SourceMapGenerator based on a SourceMapConsumer
*
* @param aSourceMapConsumer The SourceMap.
*/
SourceMapGenerator.fromSourceMap =
function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
var sourceRoot = aSourceMapConsumer.sourceRoot;
var generator = new SourceMapGenerator({
file: aSourceMapConsumer.file,
sourceRoot: sourceRoot
});
aSourceMapConsumer.eachMapping(function (mapping) {
var newMapping = {
generated: {
line: mapping.generatedLine,
column: mapping.generatedColumn
}
};
if (mapping.source) {
newMapping.source = mapping.source;
if (sourceRoot) {
newMapping.source = util.relative(sourceRoot, newMapping.source);
}
newMapping.original = {
line: mapping.originalLine,
column: mapping.originalColumn
};
if (mapping.name) {
newMapping.name = mapping.name;
}
}
generator.addMapping(newMapping);
});
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content) {
generator.setSourceContent(sourceFile, content);
}
});
return generator;
};
/**
* Add a single mapping from original source line and column to the generated
* source's line and column for this source map being created. The mapping
* object should have the following properties:
*
* - generated: An object with the generated line and column positions.
* - original: An object with the original line and column positions.
* - source: The original source file (relative to the sourceRoot).
* - name: An optional original token name for this mapping.
*/
SourceMapGenerator.prototype.addMapping =
function SourceMapGenerator_addMapping(aArgs) {
var generated = util.getArg(aArgs, 'generated');
var original = util.getArg(aArgs, 'original', null);
var source = util.getArg(aArgs, 'source', null);
var name = util.getArg(aArgs, 'name', null);
this._validateMapping(generated, original, source, name);
if (source && !this._sources.has(source)) {
this._sources.add(source);
}
if (name && !this._names.has(name)) {
this._names.add(name);
}
this._mappings.push({
generated: generated,
original: original,
source: source,
name: name
});
};
/**
* Set the source content for a source file.
*/
SourceMapGenerator.prototype.setSourceContent =
function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
var source = aSourceFile;
if (this._sourceRoot) {
source = util.relative(this._sourceRoot, source);
}
if (aSourceContent !== null) {
// Add the source content to the _sourcesContents map.
// Create a new _sourcesContents map if the property is null.
if (!this._sourcesContents) {
this._sourcesContents = {};
}
this._sourcesContents[util.toSetString(source)] = aSourceContent;
} else {
// Remove the source file from the _sourcesContents map.
// If the _sourcesContents map is empty, set the property to null.
delete this._sourcesContents[util.toSetString(source)];
if (Object.keys(this._sourcesContents).length === 0) {
this._sourcesContents = null;
}
}
};
/**
* Applies the mappings of a sub-source-map for a specific source file to the
* source map being generated. Each mapping to the supplied source file is
* rewritten using the supplied source map. Note: The resolution for the
* resulting mappings is the minimium of this map and the supplied map.
*
* @param aSourceMapConsumer The source map to be applied.
* @param aSourceFile Optional. The filename of the source file.
* If omitted, SourceMapConsumer's file property will be used.
*/
SourceMapGenerator.prototype.applySourceMap =
function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile) {
// If aSourceFile is omitted, we will use the file property of the SourceMap
if (!aSourceFile) {
aSourceFile = aSourceMapConsumer.file;
}
var sourceRoot = this._sourceRoot;
// Make "aSourceFile" relative if an absolute Url is passed.
if (sourceRoot) {
aSourceFile = util.relative(sourceRoot, aSourceFile);
}
// Applying the SourceMap can add and remove items from the sources and
// the names array.
var newSources = new ArraySet();
var newNames = new ArraySet();
// Find mappings for the "aSourceFile"
this._mappings.forEach(function (mapping) {
if (mapping.source === aSourceFile && mapping.original) {
// Check if it can be mapped by the source map, then update the mapping.
var original = aSourceMapConsumer.originalPositionFor({
line: mapping.original.line,
column: mapping.original.column
});
if (original.source !== null) {
// Copy mapping
if (sourceRoot) {
mapping.source = util.relative(sourceRoot, original.source);
} else {
mapping.source = original.source;
}
mapping.original.line = original.line;
mapping.original.column = original.column;
if (original.name !== null && mapping.name !== null) {
// Only use the identifier name if it's an identifier
// in both SourceMaps
mapping.name = original.name;
}
}
}
var source = mapping.source;
if (source && !newSources.has(source)) {
newSources.add(source);
}
var name = mapping.name;
if (name && !newNames.has(name)) {
newNames.add(name);
}
}, this);
this._sources = newSources;
this._names = newNames;
// Copy sourcesContents of applied map.
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content) {
if (sourceRoot) {
sourceFile = util.relative(sourceRoot, sourceFile);
}
this.setSourceContent(sourceFile, content);
}
}, this);
};
/**
* A mapping can have one of the three levels of data:
*
* 1. Just the generated position.
* 2. The Generated position, original position, and original source.
* 3. Generated and original position, original source, as well as a name
* token.
*
* To maintain consistency, we validate that any new mapping being added falls
* in to one of these categories.
*/
SourceMapGenerator.prototype._validateMapping =
function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
aName) {
if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
&& aGenerated.line > 0 && aGenerated.column >= 0
&& !aOriginal && !aSource && !aName) {
// Case 1.
return;
}
else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
&& aOriginal && 'line' in aOriginal && 'column' in aOriginal
&& aGenerated.line > 0 && aGenerated.column >= 0
&& aOriginal.line > 0 && aOriginal.column >= 0
&& aSource) {
// Cases 2 and 3.
return;
}
else {
throw new Error('Invalid mapping.');
}
};
function cmpLocation(loc1, loc2) {
var cmp = (loc1 && loc1.line) - (loc2 && loc2.line);
return cmp ? cmp : (loc1 && loc1.column) - (loc2 && loc2.column);
}
function strcmp(str1, str2) {
str1 = str1 || '';
str2 = str2 || '';
return (str1 > str2) - (str1 < str2);
}
function cmpMapping(mappingA, mappingB) {
return cmpLocation(mappingA.generated, mappingB.generated) ||
cmpLocation(mappingA.original, mappingB.original) ||
strcmp(mappingA.source, mappingB.source) ||
strcmp(mappingA.name, mappingB.name);
}
/**
* Serialize the accumulated mappings in to the stream of base 64 VLQs
* specified by the source map format.
*/
SourceMapGenerator.prototype._serializeMappings =
function SourceMapGenerator_serializeMappings() {
var previousGeneratedColumn = 0;
var previousGeneratedLine = 1;
var previousOriginalColumn = 0;
var previousOriginalLine = 0;
var previousName = 0;
var previousSource = 0;
var result = '';
var mapping;
// The mappings must be guarenteed to be in sorted order before we start
// serializing them or else the generated line numbers (which are defined
// via the ';' separators) will be all messed up. Note: it might be more
// performant to maintain the sorting as we insert them, rather than as we
// serialize them, but the big O is the same either way.
this._mappings.sort(cmpMapping);
for (var i = 0, len = this._mappings.length; i < len; i++) {
mapping = this._mappings[i];
if (mapping.generated.line !== previousGeneratedLine) {
previousGeneratedColumn = 0;
while (mapping.generated.line !== previousGeneratedLine) {
result += ';';
previousGeneratedLine++;
}
}
else {
if (i > 0) {
if (!cmpMapping(mapping, this._mappings[i - 1])) {
continue;
}
result += ',';
}
}
result += base64VLQ.encode(mapping.generated.column
- previousGeneratedColumn);
previousGeneratedColumn = mapping.generated.column;
if (mapping.source && mapping.original) {
result += base64VLQ.encode(this._sources.indexOf(mapping.source)
- previousSource);
previousSource = this._sources.indexOf(mapping.source);
// lines are stored 0-based in SourceMap spec version 3
result += base64VLQ.encode(mapping.original.line - 1
- previousOriginalLine);
previousOriginalLine = mapping.original.line - 1;
result += base64VLQ.encode(mapping.original.column
- previousOriginalColumn);
previousOriginalColumn = mapping.original.column;
if (mapping.name) {
result += base64VLQ.encode(this._names.indexOf(mapping.name)
- previousName);
previousName = this._names.indexOf(mapping.name);
}
}
}
return result;
};
/**
* Externalize the source map.
*/
SourceMapGenerator.prototype.toJSON =
function SourceMapGenerator_toJSON() {
var map = {
version: this._version,
file: this._file,
sources: this._sources.toArray(),
names: this._names.toArray(),
mappings: this._serializeMappings()
};
if (this._sourceRoot) {
map.sourceRoot = this._sourceRoot;
}
if (this._sourcesContents) {
map.sourcesContent = map.sources.map(function (source) {
if (map.sourceRoot) {
source = util.relative(map.sourceRoot, source);
}
return Object.prototype.hasOwnProperty.call(
this._sourcesContents, util.toSetString(source))
? this._sourcesContents[util.toSetString(source)]
: null;
}, this);
}
return map;
};
/**
* Render the source map being generated to a string.
*/
SourceMapGenerator.prototype.toString =
function SourceMapGenerator_toString() {
return JSON.stringify(this);
};
exports.SourceMapGenerator = SourceMapGenerator;
});
},{"./base64-vlq":16,"./util":17,"./array-set":18,"amdefine":19}],13:[function(require,module,exports){
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module);
}
define(function (require, exports, module) {
var util = require('./util');
var binarySearch = require('./binary-search');
var ArraySet = require('./array-set').ArraySet;
var base64VLQ = require('./base64-vlq');
/**
* A SourceMapConsumer instance represents a parsed source map which we can
* query for information about the original file positions by giving it a file
* position in the generated source.
*
* The only parameter is the raw source map (either as a JSON string, or
* already parsed to an object). According to the spec, source maps have the
* following attributes:
*
* - version: Which version of the source map spec this map is following.
* - sources: An array of URLs to the original source files.
* - names: An array of identifiers which can be referrenced by individual mappings.
* - sourceRoot: Optional. The URL root from which all sources are relative.
* - sourcesContent: Optional. An array of contents of the original source files.
* - mappings: A string of base64 VLQs which contain the actual mappings.
* - file: The generated file this source map is associated with.
*
* Here is an example source map, taken from the source map spec[0]:
*
* {
* version : 3,
* file: "out.js",
* sourceRoot : "",
* sources: ["foo.js", "bar.js"],
* names: ["src", "maps", "are", "fun"],
* mappings: "AA,AB;;ABCDE;"
* }
*
* [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
*/
function SourceMapConsumer(aSourceMap) {
var sourceMap = aSourceMap;
if (typeof aSourceMap === 'string') {
sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
}
var version = util.getArg(sourceMap, 'version');
var sources = util.getArg(sourceMap, 'sources');
var names = util.getArg(sourceMap, 'names');
var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
var mappings = util.getArg(sourceMap, 'mappings');
var file = util.getArg(sourceMap, 'file');
if (version !== this._version) {
throw new Error('Unsupported version: ' + version);
}
this._names = ArraySet.fromArray(names);
this._sources = ArraySet.fromArray(sources);
this.sourceRoot = sourceRoot;
this.sourcesContent = sourcesContent;
this.file = file;
// `this._generatedMappings` and `this._originalMappings` hold the parsed
// mapping coordinates from the source map's "mappings" attribute. Each
// object in the array is of the form
//
// {
// generatedLine: The line number in the generated code,
// generatedColumn: The column number in the generated code,
// source: The path to the original source file that generated this
// chunk of code,
// originalLine: The line number in the original source that
// corresponds to this chunk of generated code,
// originalColumn: The column number in the original source that
// corresponds to this chunk of generated code,
// name: The name of the original symbol which generated this chunk of
// code.
// }
//
// All properties except for `generatedLine` and `generatedColumn` can be
// `null`.
//
// `this._generatedMappings` is ordered by the generated positions.
//
// `this._originalMappings` is ordered by the original positions.
this._generatedMappings = [];
this._originalMappings = [];
this._parseMappings(mappings, sourceRoot);
}
/**
* The version of the source mapping spec that we are consuming.
*/
SourceMapConsumer.prototype._version = 3;
/**
* The list of original sources.
*/
Object.defineProperty(SourceMapConsumer.prototype, 'sources', {
get: function () {
return this._sources.toArray().map(function (s) {
return this.sourceRoot ? util.join(this.sourceRoot, s) : s;
}, this);
}
});
/**
* Parse the mappings in a string in to a data structure which we can easily
* query (an ordered list in this._generatedMappings).
*/
SourceMapConsumer.prototype._parseMappings =
function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
var generatedLine = 1;
var previousGeneratedColumn = 0;
var previousOriginalLine = 0;
var previousOriginalColumn = 0;
var previousSource = 0;
var previousName = 0;
var mappingSeparator = /^[,;]/;
var str = aStr;
var mapping;
var temp;
while (str.length > 0) {
if (str.charAt(0) === ';') {
generatedLine++;
str = str.slice(1);
previousGeneratedColumn = 0;
}
else if (str.charAt(0) === ',') {
str = str.slice(1);
}
else {
mapping = {};
mapping.generatedLine = generatedLine;
// Generated column.
temp = base64VLQ.decode(str);
mapping.generatedColumn = previousGeneratedColumn + temp.value;
previousGeneratedColumn = mapping.generatedColumn;
str = temp.rest;
if (str.length > 0 && !mappingSeparator.test(str.charAt(0))) {
// Original source.
temp = base64VLQ.decode(str);
mapping.source = this._sources.at(previousSource + temp.value);
previousSource += temp.value;
str = temp.rest;
if (str.length === 0 || mappingSeparator.test(str.charAt(0))) {
throw new Error('Found a source, but no line and column');
}
// Original line.
temp = base64VLQ.decode(str);
mapping.originalLine = previousOriginalLine + temp.value;
previousOriginalLine = mapping.originalLine;
// Lines are stored 0-based
mapping.originalLine += 1;
str = temp.rest;
if (str.length === 0 || mappingSeparator.test(str.charAt(0))) {
throw new Error('Found a source and line, but no column');
}
// Original column.
temp = base64VLQ.decode(str);
mapping.originalColumn = previousOriginalColumn + temp.value;
previousOriginalColumn = mapping.originalColumn;
str = temp.rest;
if (str.length > 0 && !mappingSeparator.test(str.charAt(0))) {
// Original name.
temp = base64VLQ.decode(str);
mapping.name = this._names.at(previousName + temp.value);
previousName += temp.value;
str = temp.rest;
}
}
this._generatedMappings.push(mapping);
if (typeof mapping.originalLine === 'number') {
this._originalMappings.push(mapping);
}
}
}
this._originalMappings.sort(this._compareOriginalPositions);
};
/**
* Comparator between two mappings where the original positions are compared.
*/
SourceMapConsumer.prototype._compareOriginalPositions =
function SourceMapConsumer_compareOriginalPositions(mappingA, mappingB) {
if (mappingA.source > mappingB.source) {
return 1;
}
else if (mappingA.source < mappingB.source) {
return -1;
}
else {
var cmp = mappingA.originalLine - mappingB.originalLine;
return cmp === 0
? mappingA.originalColumn - mappingB.originalColumn
: cmp;
}
};
/**
* Comparator between two mappings where the generated positions are compared.
*/
SourceMapConsumer.prototype._compareGeneratedPositions =
function SourceMapConsumer_compareGeneratedPositions(mappingA, mappingB) {
var cmp = mappingA.generatedLine - mappingB.generatedLine;
return cmp === 0
? mappingA.generatedColumn - mappingB.generatedColumn
: cmp;
};
/**
* Find the mapping that best matches the hypothetical "needle" mapping that
* we are searching for in the given "haystack" of mappings.
*/
SourceMapConsumer.prototype._findMapping =
function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,
aColumnName, aComparator) {
// To return the position we are searching for, we must first find the
// mapping for the given position and then return the opposite position it
// points to. Because the mappings are sorted, we can use binary search to
// find the best mapping.
if (aNeedle[aLineName] <= 0) {
throw new TypeError('Line must be greater than or equal to 1, got '
+ aNeedle[aLineName]);
}
if (aNeedle[aColumnName] < 0) {
throw new TypeError('Column must be greater than or equal to 0, got '
+ aNeedle[aColumnName]);
}
return binarySearch.search(aNeedle, aMappings, aComparator);
};
/**
* Returns the original source, line, and column information for the generated
* source's line and column positions provided. The only argument is an object
* with the following properties:
*
* - line: The line number in the generated source.
* - column: The column number in the generated source.
*
* and an object is returned with the following properties:
*
* - source: The original source file, or null.
* - line: The line number in the original source, or null.
* - column: The column number in the original source, or null.
* - name: The original identifier, or null.
*/
SourceMapConsumer.prototype.originalPositionFor =
function SourceMapConsumer_originalPositionFor(aArgs) {
var needle = {
generatedLine: util.getArg(aArgs, 'line'),
generatedColumn: util.getArg(aArgs, 'column')
};
var mapping = this._findMapping(needle,
this._generatedMappings,
"generatedLine",
"generatedColumn",
this._compareGeneratedPositions);
if (mapping) {
var source = util.getArg(mapping, 'source', null);
if (source && this.sourceRoot) {
source = util.join(this.sourceRoot, source);
}
return {
source: source,
line: util.getArg(mapping, 'originalLine', null),
column: util.getArg(mapping, 'originalColumn', null),
name: util.getArg(mapping, 'name', null)
};
}
return {
source: null,
line: null,
column: null,
name: null
};
};
/**
* Returns the original source content. The only argument is
* the url of the original source file. Returns null if no
* original source content is availible.
*/
SourceMapConsumer.prototype.sourceContentFor =
function SourceMapConsumer_sourceContentFor(aSource) {
if (!this.sourcesContent) {
return null;
}
if (this.sourceRoot) {
aSource = util.relative(this.sourceRoot, aSource);
}
if (this._sources.has(aSource)) {
return this.sourcesContent[this._sources.indexOf(aSource)];
}
var url;
if (this.sourceRoot
&& (url = util.urlParse(this.sourceRoot))
&& (!url.path || url.path == "/")
&& this._sources.has("/" + aSource)) {
return this.sourcesContent[this._sources.indexOf("/" + aSource)];
}
throw new Error('"' + aSource + '" is not in the SourceMap.');
};
/**
* Returns the generated line and column information for the original source,
* line, and column positions provided. The only argument is an object with
* the following properties:
*
* - source: The filename of the original source.
* - line: The line number in the original source.
* - column: The column number in the original source.
*
* and an object is returned with the following properties:
*
* - line: The line number in the generated source, or null.
* - column: The column number in the generated source, or null.
*/
SourceMapConsumer.prototype.generatedPositionFor =
function SourceMapConsumer_generatedPositionFor(aArgs) {
var needle = {
source: util.getArg(aArgs, 'source'),
originalLine: util.getArg(aArgs, 'line'),
originalColumn: util.getArg(aArgs, 'column')
};
if (this.sourceRoot) {
needle.source = util.relative(this.sourceRoot, needle.source);
}
var mapping = this._findMapping(needle,
this._originalMappings,
"originalLine",
"originalColumn",
this._compareOriginalPositions);
if (mapping) {
return {
line: util.getArg(mapping, 'generatedLine', null),
column: util.getArg(mapping, 'generatedColumn', null)
};
}
return {
line: null,
column: null
};
};
SourceMapConsumer.GENERATED_ORDER = 1;
SourceMapConsumer.ORIGINAL_ORDER = 2;
/**
* Iterate over each mapping between an original source/line/column and a
* generated line/column in this source map.
*
* @param Function aCallback
* The function that is called with each mapping.
* @param Object aContext
* Optional. If specified, this object will be the value of `this` every
* time that `aCallback` is called.
* @param aOrder
* Either `SourceMapConsumer.GENERATED_ORDER` or
* `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
* iterate over the mappings sorted by the generated file's line/column
* order or the original's source/line/column order, respectively. Defaults to
* `SourceMapConsumer.GENERATED_ORDER`.
*/
SourceMapConsumer.prototype.eachMapping =
function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
var context = aContext || null;
var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
var mappings;
switch (order) {
case SourceMapConsumer.GENERATED_ORDER:
mappings = this._generatedMappings;
break;
case SourceMapConsumer.ORIGINAL_ORDER:
mappings = this._originalMappings;
break;
default:
throw new Error("Unknown order of iteration.");
}
var sourceRoot = this.sourceRoot;
mappings.map(function (mapping) {
var source = mapping.source;
if (source && sourceRoot) {
source = util.join(sourceRoot, source);
}
return {
source: source,
generatedLine: mapping.generatedLine,
generatedColumn: mapping.generatedColumn,
originalLine: mapping.originalLine,
originalColumn: mapping.originalColumn,
name: mapping.name
};
}).forEach(aCallback, context);
};
exports.SourceMapConsumer = SourceMapConsumer;
});
},{"./util":17,"./binary-search":20,"./array-set":18,"./base64-vlq":16,"amdefine":19}],14:[function(require,module,exports){
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module);
}
define(function (require, exports, module) {
var SourceMapGenerator = require('./source-map-generator').SourceMapGenerator;
var util = require('./util');
/**
* SourceNodes provide a way to abstract over interpolating/concatenating
* snippets of generated JavaScript source code while maintaining the line and
* column information associated with the original source code.
*
* @param aLine The original line number.
* @param aColumn The original column number.
* @param aSource The original source's filename.
* @param aChunks Optional. An array of strings which are snippets of
* generated JS, or other SourceNodes.
* @param aName The original identifier.
*/
function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
this.children = [];
this.sourceContents = {};
this.line = aLine === undefined ? null : aLine;
this.column = aColumn === undefined ? null : aColumn;
this.source = aSource === undefined ? null : aSource;
this.name = aName === undefined ? null : aName;
if (aChunks != null) this.add(aChunks);
}
/**
* Creates a SourceNode from generated code and a SourceMapConsumer.
*
* @param aGeneratedCode The generated code
* @param aSourceMapConsumer The SourceMap for the generated code
*/
SourceNode.fromStringWithSourceMap =
function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer) {
// The SourceNode we want to fill with the generated code
// and the SourceMap
var node = new SourceNode();
// The generated code
// Processed fragments are removed from this array.
var remainingLines = aGeneratedCode.split('\n');
// We need to remember the position of "remainingLines"
var lastGeneratedLine = 1, lastGeneratedColumn = 0;
// The generate SourceNodes we need a code range.
// To extract it current and last mapping is used.
// Here we store the last mapping.
var lastMapping = null;
aSourceMapConsumer.eachMapping(function (mapping) {
if (lastMapping === null) {
// We add the generated code until the first mapping
// to the SourceNode without any mapping.
// Each line is added as separate string.
while (lastGeneratedLine < mapping.generatedLine) {
node.add(remainingLines.shift() + "\n");
lastGeneratedLine++;
}
if (lastGeneratedColumn < mapping.generatedColumn) {
var nextLine = remainingLines[0];
node.add(nextLine.substr(0, mapping.generatedColumn));
remainingLines[0] = nextLine.substr(mapping.generatedColumn);
lastGeneratedColumn = mapping.generatedColumn;
}
} else {
// We add the code from "lastMapping" to "mapping":
// First check if there is a new line in between.
if (lastGeneratedLine < mapping.generatedLine) {
var code = "";
// Associate full lines with "lastMapping"
do {
code += remainingLines.shift() + "\n";
lastGeneratedLine++;
lastGeneratedColumn = 0;
} while (lastGeneratedLine < mapping.generatedLine);
// When we reached the correct line, we add code until we
// reach the correct column too.
if (lastGeneratedColumn < mapping.generatedColumn) {
var nextLine = remainingLines[0];
code += nextLine.substr(0, mapping.generatedColumn);
remainingLines[0] = nextLine.substr(mapping.generatedColumn);
lastGeneratedColumn = mapping.generatedColumn;
}
// Create the SourceNode.
addMappingWithCode(lastMapping, code);
} else {
// There is no new line in between.
// Associate the code between "lastGeneratedColumn" and
// "mapping.generatedColumn" with "lastMapping"
var nextLine = remainingLines[0];
var code = nextLine.substr(0, mapping.generatedColumn -
lastGeneratedColumn);
remainingLines[0] = nextLine.substr(mapping.generatedColumn -
lastGeneratedColumn);
lastGeneratedColumn = mapping.generatedColumn;
addMappingWithCode(lastMapping, code);
}
}
lastMapping = mapping;
}, this);
// We have processed all mappings.
// Associate the remaining code in the current line with "lastMapping"
// and add the remaining lines without any mapping
addMappingWithCode(lastMapping, remainingLines.join("\n"));
// Copy sourcesContent into SourceNode
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content) {
node.setSourceContent(sourceFile, content);
}
});
return node;
function addMappingWithCode(mapping, code) {
if (mapping.source === undefined) {
node.add(code);
} else {
node.add(new SourceNode(mapping.originalLine,
mapping.originalColumn,
mapping.source,
code,
mapping.name));
}
}
};
/**
* Add a chunk of generated JS to this source node.
*
* @param aChunk A string snippet of generated JS code, another instance of
* SourceNode, or an array where each member is one of those things.
*/
SourceNode.prototype.add = function SourceNode_add(aChunk) {
if (Array.isArray(aChunk)) {
aChunk.forEach(function (chunk) {
this.add(chunk);
}, this);
}
else if (aChunk instanceof SourceNode || typeof aChunk === "string") {
if (aChunk) {
this.children.push(aChunk);
}
}
else {
throw new TypeError(
"Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
);
}
return this;
};
/**
* Add a chunk of generated JS to the beginning of this source node.
*
* @param aChunk A string snippet of generated JS code, another instance of
* SourceNode, or an array where each member is one of those things.
*/
SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
if (Array.isArray(aChunk)) {
for (var i = aChunk.length-1; i >= 0; i--) {
this.prepend(aChunk[i]);
}
}
else if (aChunk instanceof SourceNode || typeof aChunk === "string") {
this.children.unshift(aChunk);
}
else {
throw new TypeError(
"Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
);
}
return this;
};
/**
* Walk over the tree of JS snippets in this node and its children. The
* walking function is called once for each snippet of JS and is passed that
* snippet and the its original associated source's line/column location.
*
* @param aFn The traversal function.
*/
SourceNode.prototype.walk = function SourceNode_walk(aFn) {
this.children.forEach(function (chunk) {
if (chunk instanceof SourceNode) {
chunk.walk(aFn);
}
else {
if (chunk !== '') {
aFn(chunk, { source: this.source,
line: this.line,
column: this.column,
name: this.name });
}
}
}, this);
};
/**
* Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
* each of `this.children`.
*
* @param aSep The separator.
*/
SourceNode.prototype.join = function SourceNode_join(aSep) {
var newChildren;
var i;
var len = this.children.length;
if (len > 0) {
newChildren = [];
for (i = 0; i < len-1; i++) {
newChildren.push(this.children[i]);
newChildren.push(aSep);
}
newChildren.push(this.children[i]);
this.children = newChildren;
}
return this;
};
/**
* Call String.prototype.replace on the very right-most source snippet. Useful
* for trimming whitespace from the end of a source node, etc.
*
* @param aPattern The pattern to replace.
* @param aReplacement The thing to replace the pattern with.
*/
SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
var lastChild = this.children[this.children.length - 1];
if (lastChild instanceof SourceNode) {
lastChild.replaceRight(aPattern, aReplacement);
}
else if (typeof lastChild === 'string') {
this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
}
else {
this.children.push(''.replace(aPattern, aReplacement));
}
return this;
};
/**
* Set the source content for a source file. This will be added to the SourceMapGenerator
* in the sourcesContent field.
*
* @param aSourceFile The filename of the source file
* @param aSourceContent The content of the source file
*/
SourceNode.prototype.setSourceContent =
function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
};
/**
* Walk over the tree of SourceNodes. The walking function is called for each
* source file content and is passed the filename and source content.
*
* @param aFn The traversal function.
*/
SourceNode.prototype.walkSourceContents =
function SourceNode_walkSourceContents(aFn) {
this.children.forEach(function (chunk) {
if (chunk instanceof SourceNode) {
chunk.walkSourceContents(aFn);
}
}, this);
Object.keys(this.sourceContents).forEach(function (sourceFileKey) {
aFn(util.fromSetString(sourceFileKey), this.sourceContents[sourceFileKey]);
}, this);
};
/**
* Return the string representation of this source node. Walks over the tree
* and concatenates all the various snippets together to one string.
*/
SourceNode.prototype.toString = function SourceNode_toString() {
var str = "";
this.walk(function (chunk) {
str += chunk;
});
return str;
};
/**
* Returns the string representation of this source node along with a source
* map.
*/
SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
var generated = {
code: "",
line: 1,
column: 0
};
var map = new SourceMapGenerator(aArgs);
var sourceMappingActive = false;
this.walk(function (chunk, original) {
generated.code += chunk;
if (original.source !== null
&& original.line !== null
&& original.column !== null) {
map.addMapping({
source: original.source,
original: {
line: original.line,
column: original.column
},
generated: {
line: generated.line,
column: generated.column
},
name: original.name
});
sourceMappingActive = true;
} else if (sourceMappingActive) {
map.addMapping({
generated: {
line: generated.line,
column: generated.column
}
});
sourceMappingActive = false;
}
chunk.split('').forEach(function (ch) {
if (ch === '\n') {
generated.line++;
generated.column = 0;
} else {
generated.column++;
}
});
});
this.walkSourceContents(function (sourceFile, sourceContent) {
map.setSourceContent(sourceFile, sourceContent);
});
return { code: generated.code, map: map };
};
exports.SourceNode = SourceNode;
});
},{"./source-map-generator":12,"./util":17,"amdefine":19}],21:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
process.nextTick = (function () {
var canSetImmediate = typeof window !== 'undefined'
&& window.setImmediate;
var canPost = typeof window !== 'undefined'
&& window.postMessage && window.addEventListener
;
if (canSetImmediate) {
return function (f) { return window.setImmediate(f) };
}
if (canPost) {
var queue = [];
window.addEventListener('message', function (ev) {
if (ev.source === window && ev.data === 'process-tick') {
ev.stopPropagation();
if (queue.length > 0) {
var fn = queue.shift();
fn();
}
}
}, true);
return function nextTick(fn) {
queue.push(fn);
window.postMessage('process-tick', '*');
};
}
return function nextTick(fn) {
setTimeout(fn, 0);
};
})();
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
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');
};
},{}],19:[function(require,module,exports){
(function(process,__filename){/** vim: et:ts=4:sw=4:sts=4
* @license amdefine 0.0.5 Copyright (c) 2011, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/amdefine for details
*/
/*jslint node: true */
/*global module, process */
'use strict';
var path = require('path');
/**
* Creates a define for node.
* @param {Object} module the "module" object that is defined by Node for the
* current module.
* @param {Function} [require]. Node's require function for the current module.
* It only needs to be passed in Node versions before 0.5, when module.require
* did not exist.
* @returns {Function} a define function that is usable for the current node
* module.
*/
function amdefine(module, require) {
var defineCache = {},
loaderCache = {},
alreadyCalled = false,
makeRequire, stringRequire;
/**
* Trims the . and .. from an array of path segments.
* It will keep a leading path segment if a .. will become
* the first path segment, to help with module name lookups,
* which act like paths, but can be remapped. But the end result,
* all paths that use this function should look normalized.
* NOTE: this method MODIFIES the input array.
* @param {Array} ary the array of path segments.
*/
function trimDots(ary) {
var i, part;
for (i = 0; ary[i]; i+= 1) {
part = ary[i];
if (part === '.') {
ary.splice(i, 1);
i -= 1;
} else if (part === '..') {
if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
//End of the line. Keep at least one non-dot
//path segment at the front so it can be mapped
//correctly to disk. Otherwise, there is likely
//no path mapping for a path starting with '..'.
//This can still fail, but catches the most reasonable
//uses of ..
break;
} else if (i > 0) {
ary.splice(i - 1, 2);
i -= 2;
}
}
}
}
function normalize(name, baseName) {
var baseParts;
//Adjust any relative paths.
if (name && name.charAt(0) === '.') {
//If have a base name, try to normalize against it,
//otherwise, assume it is a top-level require that will
//be relative to baseUrl in the end.
if (baseName) {
baseParts = baseName.split('/');
baseParts = baseParts.slice(0, baseParts.length - 1);
baseParts = baseParts.concat(name.split('/'));
trimDots(baseParts);
name = baseParts.join('/');
}
}
return name;
}
/**
* Create the normalize() function passed to a loader plugin's
* normalize method.
*/
function makeNormalize(relName) {
return function (name) {
return normalize(name, relName);
};
}
function makeLoad(id) {
function load(value) {
loaderCache[id] = value;
}
load.fromText = function (id, text) {
//This one is difficult because the text can/probably uses
//define, and any relative paths and requires should be relative
//to that id was it would be found on disk. But this would require
//bootstrapping a module/require fairly deeply from node core.
//Not sure how best to go about that yet.
throw new Error('amdefine does not implement load.fromText');
};
return load;
}
makeRequire = function (systemRequire, exports, module, relId) {
function amdRequire(deps, callback) {
if (typeof deps === 'string') {
//Synchronous, single module require('')
return stringRequire(systemRequire, exports, module, deps, relId);
} else {
//Array of dependencies with a callback.
//Convert the dependencies to modules.
deps = deps.map(function (depName) {
return stringRequire(systemRequire, exports, module, depName, relId);
});
//Wait for next tick to call back the require call.
process.nextTick(function () {
callback.apply(null, deps);
});
}
}
amdRequire.toUrl = function (filePath) {
if (filePath.indexOf('.') === 0) {
return normalize(filePath, path.dirname(module.filename));
} else {
return filePath;
}
};
return amdRequire;
};
//Favor explicit value, passed in if the module wants to support Node 0.4.
require = require || function req() {
return module.require.apply(module, arguments);
};
function runFactory(id, deps, factory) {
var r, e, m, result;
if (id) {
e = loaderCache[id] = {};
m = {
id: id,
uri: __filename,
exports: e
};
r = makeRequire(require, e, m, id);
} else {
//Only support one define call per file
if (alreadyCalled) {
throw new Error('amdefine with no module ID cannot be called more than once per file.');
}
alreadyCalled = true;
//Use the real variables from node
//Use module.exports for exports, since
//the exports in here is amdefine exports.
e = module.exports;
m = module;
r = makeRequire(require, e, m, module.id);
}
//If there are dependencies, they are strings, so need
//to convert them to dependency values.
if (deps) {
deps = deps.map(function (depName) {
return r(depName);
});
}
//Call the factory with the right dependencies.
if (typeof factory === 'function') {
result = factory.apply(module.exports, deps);
} else {
result = factory;
}
if (result !== undefined) {
m.exports = result;
if (id) {
loaderCache[id] = m.exports;
}
}
}
stringRequire = function (systemRequire, exports, module, id, relId) {
//Split the ID by a ! so that
var index = id.indexOf('!'),
originalId = id,
prefix, plugin;
if (index === -1) {
id = normalize(id, relId);
//Straight module lookup. If it is one of the special dependencies,
//deal with it, otherwise, delegate to node.
if (id === 'require') {
return makeRequire(systemRequire, exports, module, relId);
} else if (id === 'exports') {
return exports;
} else if (id === 'module') {
return module;
} else if (loaderCache.hasOwnProperty(id)) {
return loaderCache[id];
} else if (defineCache[id]) {
runFactory.apply(null, defineCache[id]);
return loaderCache[id];
} else {
if(systemRequire) {
return systemRequire(originalId);
} else {
throw new Error('No module with ID: ' + id);
}
}
} else {
//There is a plugin in play.
prefix = id.substring(0, index);
id = id.substring(index + 1, id.length);
plugin = stringRequire(systemRequire, exports, module, prefix, relId);
if (plugin.normalize) {
id = plugin.normalize(id, makeNormalize(relId));
} else {
//Normalize the ID normally.
id = normalize(id, relId);
}
if (loaderCache[id]) {
return loaderCache[id];
} else {
plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
return loaderCache[id];
}
}
};
//Create a define function specific to the module asking for amdefine.
function define(id, deps, factory) {
if (Array.isArray(id)) {
factory = deps;
deps = id;
id = undefined;
} else if (typeof id !== 'string') {
factory = id;
id = deps = undefined;
}
if (deps && !Array.isArray(deps)) {
factory = deps;
deps = undefined;
}
if (!deps) {
deps = ['require', 'exports', 'module'];
}
//Set up properties for this module. If an ID, then use
//internal cache. If no ID, then use the external variables
//for this node module.
if (id) {
//Put the module in deep freeze until there is a
//require call for it.
defineCache[id] = [id, deps, factory];
} else {
runFactory(id, deps, factory);
}
}
//define.require, which has access to all the values in the
//cache. Useful for AMD modules that all have IDs in the file,
//but need to finally export a value to node based on one of those
//IDs.
define.require = function (id) {
if (loaderCache[id]) {
return loaderCache[id];
}
if (defineCache[id]) {
runFactory.apply(null, defineCache[id]);
return loaderCache[id];
}
};
define.amd = {};
return define;
}
module.exports = amdefine;
})(require("__browserify_process"),"/../node_modules/source-map/node_modules/amdefine/amdefine.js")
},{"path":22,"__browserify_process":21}],16:[function(require,module,exports){
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*
* Based on the Base 64 VLQ implementation in Closure Compiler:
* https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
*
* Copyright 2011 The Closure Compiler Authors. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module);
}
define(function (require, exports, module) {
var base64 = require('./base64');
// A single base 64 digit can contain 6 bits of data. For the base 64 variable
// length quantities we use in the source map spec, the first bit is the sign,
// the next four bits are the actual value, and the 6th bit is the
// continuation bit. The continuation bit tells us whether there are more
// digits in this value following this digit.
//
// Continuation
// | Sign
// | |
// V V
// 101011
var VLQ_BASE_SHIFT = 5;
// binary: 100000
var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
// binary: 011111
var VLQ_BASE_MASK = VLQ_BASE - 1;
// binary: 100000
var VLQ_CONTINUATION_BIT = VLQ_BASE;
/**
* Converts from a two-complement value to a value where the sign bit is
* is placed in the least significant bit. For example, as decimals:
* 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
* 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
*/
function toVLQSigned(aValue) {
return aValue < 0
? ((-aValue) << 1) + 1
: (aValue << 1) + 0;
}
/**
* Converts to a two-complement value from a value where the sign bit is
* is placed in the least significant bit. For example, as decimals:
* 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
* 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
*/
function fromVLQSigned(aValue) {
var isNegative = (aValue & 1) === 1;
var shifted = aValue >> 1;
return isNegative
? -shifted
: shifted;
}
/**
* Returns the base 64 VLQ encoded value.
*/
exports.encode = function base64VLQ_encode(aValue) {
var encoded = "";
var digit;
var vlq = toVLQSigned(aValue);
do {
digit = vlq & VLQ_BASE_MASK;
vlq >>>= VLQ_BASE_SHIFT;
if (vlq > 0) {
// There are still more digits in this value, so we must make sure the
// continuation bit is marked.
digit |= VLQ_CONTINUATION_BIT;
}
encoded += base64.encode(digit);
} while (vlq > 0);
return encoded;
};
/**
* Decodes the next base 64 VLQ value from the given string and returns the
* value and the rest of the string.
*/
exports.decode = function base64VLQ_decode(aStr) {
var i = 0;
var strLen = aStr.length;
var result = 0;
var shift = 0;
var continuation, digit;
do {
if (i >= strLen) {
throw new Error("Expected more digits in base 64 VLQ value.");
}
digit = base64.decode(aStr.charAt(i++));
continuation = !!(digit & VLQ_CONTINUATION_BIT);
digit &= VLQ_BASE_MASK;
result = result + (digit << shift);
shift += VLQ_BASE_SHIFT;
} while (continuation);
return {
value: fromVLQSigned(result),
rest: aStr.slice(i)
};
};
});
},{"./base64":23,"amdefine":19}],22:[function(require,module,exports){
(function(process){function filter (xs, fn) {
var res = [];
for (var i = 0; i < xs.length; i++) {
if (fn(xs[i], i, xs)) res.push(xs[i]);
}
return res;
}
// resolves . and .. elements in a path array with directory names there
// must be no slashes, empty elements, or device names (c:\) in the array
// (so also no leading and trailing slashes - it does not distinguish
// relative and absolute paths)
function normalizeArray(parts, allowAboveRoot) {
// if the path tries to go above the root, `up` ends up > 0
var up = 0;
for (var i = parts.length; i >= 0; i--) {
var last = parts[i];
if (last == '.') {
parts.splice(i, 1);
} else if (last === '..') {
parts.splice(i, 1);
up++;
} else if (up) {
parts.splice(i, 1);
up--;
}
}
// if the path is allowed to go above the root, restore leading ..s
if (allowAboveRoot) {
for (; up--; up) {
parts.unshift('..');
}
}
return parts;
}
// Regex to split a filename into [*, dir, basename, ext]
// posix version
var splitPathRe = /^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;
// path.resolve([from ...], to)
// posix version
exports.resolve = function() {
var resolvedPath = '',
resolvedAbsolute = false;
for (var i = arguments.length; i >= -1 && !resolvedAbsolute; i--) {
var path = (i >= 0)
? arguments[i]
: process.cwd();
// Skip empty and invalid entries
if (typeof path !== 'string' || !path) {
continue;
}
resolvedPath = path + '/' + resolvedPath;
resolvedAbsolute = path.charAt(0) === '/';
}
// At this point the path should be resolved to a full absolute path, but
// handle relative paths to be safe (might happen when process.cwd() fails)
// Normalize the path
resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
return !!p;
}), !resolvedAbsolute).join('/');
return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
};
// path.normalize(path)
// posix version
exports.normalize = function(path) {
var isAbsolute = path.charAt(0) === '/',
trailingSlash = path.slice(-1) === '/';
// Normalize the path
path = normalizeArray(filter(path.split('/'), function(p) {
return !!p;
}), !isAbsolute).join('/');
if (!path && !isAbsolute) {
path = '.';
}
if (path && trailingSlash) {
path += '/';
}
return (isAbsolute ? '/' : '') + path;
};
// posix version
exports.join = function() {
var paths = Array.prototype.slice.call(arguments, 0);
return exports.normalize(filter(paths, function(p, index) {
return p && typeof p === 'string';
}).join('/'));
};
exports.dirname = function(path) {
var dir = splitPathRe.exec(path)[1] || '';
var isWindows = false;
if (!dir) {
// No dirname
return '.';
} else if (dir.length === 1 ||
(isWindows && dir.length <= 3 && dir.charAt(1) === ':')) {
// It is just a slash or a drive letter with a slash
return dir;
} else {
// It is a full dirname, strip trailing slash
return dir.substring(0, dir.length - 1);
}
};
exports.basename = function(path, ext) {
var f = splitPathRe.exec(path)[2] || '';
// TODO: make this comparison case-insensitive on windows?
if (ext && f.substr(-1 * ext.length) === ext) {
f = f.substr(0, f.length - ext.length);
}
return f;
};
exports.extname = function(path) {
return splitPathRe.exec(path)[3] || '';
};
exports.relative = function(from, to) {
from = exports.resolve(from).substr(1);
to = exports.resolve(to).substr(1);
function trim(arr) {
var start = 0;
for (; start < arr.length; start++) {
if (arr[start] !== '') break;
}
var end = arr.length - 1;
for (; end >= 0; end--) {
if (arr[end] !== '') break;
}
if (start > end) return [];
return arr.slice(start, end - start + 1);
}
var fromParts = trim(from.split('/'));
var toParts = trim(to.split('/'));
var length = Math.min(fromParts.length, toParts.length);
var samePartsLength = length;
for (var i = 0; i < length; i++) {
if (fromParts[i] !== toParts[i]) {
samePartsLength = i;
break;
}
}
var outputParts = [];
for (var i = samePartsLength; i < fromParts.length; i++) {
outputParts.push('..');
}
outputParts = outputParts.concat(toParts.slice(samePartsLength));
return outputParts.join('/');
};
})(require("__browserify_process"))
},{"__browserify_process":21}],17:[function(require,module,exports){
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module);
}
define(function (require, exports, module) {
/**
* This is a helper function for getting values from parameter/options
* objects.
*
* @param args The object we are extracting values from
* @param name The name of the property we are getting.
* @param defaultValue An optional value to return if the property is missing
* from the object. If this is not specified and the property is missing, an
* error will be thrown.
*/
function getArg(aArgs, aName, aDefaultValue) {
if (aName in aArgs) {
return aArgs[aName];
} else if (arguments.length === 3) {
return aDefaultValue;
} else {
throw new Error('"' + aName + '" is a required argument.');
}
}
exports.getArg = getArg;
var urlRegexp = /([\w+\-.]+):\/\/((\w+:\w+)@)?([\w.]+)?(:(\d+))?(\S+)?/;
function urlParse(aUrl) {
var match = aUrl.match(urlRegexp);
if (!match) {
return null;
}
return {
scheme: match[1],
auth: match[3],
host: match[4],
port: match[6],
path: match[7]
};
}
exports.urlParse = urlParse;
function urlGenerate(aParsedUrl) {
var url = aParsedUrl.scheme + "://";
if (aParsedUrl.auth) {
url += aParsedUrl.auth + "@"
}
if (aParsedUrl.host) {
url += aParsedUrl.host;
}
if (aParsedUrl.port) {
url += ":" + aParsedUrl.port
}
if (aParsedUrl.path) {
url += aParsedUrl.path;
}
return url;
}
exports.urlGenerate = urlGenerate;
function join(aRoot, aPath) {
var url;
if (aPath.match(urlRegexp)) {
return aPath;
}
if (aPath.charAt(0) === '/' && (url = urlParse(aRoot))) {
url.path = aPath;
return urlGenerate(url);
}
return aRoot.replace(/\/$/, '') + '/' + aPath;
}
exports.join = join;
/**
* Because behavior goes wacky when you set `__proto__` on objects, we
* have to prefix all the strings in our set with an arbitrary character.
*
* See https://github.com/mozilla/source-map/pull/31 and
* https://github.com/mozilla/source-map/issues/30
*
* @param String aStr
*/
function toSetString(aStr) {
return '$' + aStr;
}
exports.toSetString = toSetString;
function fromSetString(aStr) {
return aStr.substr(1);
}
exports.fromSetString = fromSetString;
function relative(aRoot, aPath) {
aRoot = aRoot.replace(/\/$/, '');
var url = urlParse(aRoot);
if (aPath.charAt(0) == "/" && url && url.path == "/") {
return aPath.slice(1);
}
return aPath.indexOf(aRoot + '/') === 0
? aPath.substr(aRoot.length + 1)
: aPath;
}
exports.relative = relative;
});
},{"amdefine":19}],18:[function(require,module,exports){
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module);
}
define(function (require, exports, module) {
var util = require('./util');
/**
* A data structure which is a combination of an array and a set. Adding a new
* member is O(1), testing for membership is O(1), and finding the index of an
* element is O(1). Removing elements from the set is not supported. Only
* strings are supported for membership.
*/
function ArraySet() {
this._array = [];
this._set = {};
}
/**
* Static method for creating ArraySet instances from an existing array.
*/
ArraySet.fromArray = function ArraySet_fromArray(aArray) {
var set = new ArraySet();
for (var i = 0, len = aArray.length; i < len; i++) {
set.add(aArray[i]);
}
return set;
};
/**
* Add the given string to this set.
*
* @param String aStr
*/
ArraySet.prototype.add = function ArraySet_add(aStr) {
if (this.has(aStr)) {
// Already a member; nothing to do.
return;
}
var idx = this._array.length;
this._array.push(aStr);
this._set[util.toSetString(aStr)] = idx;
};
/**
* Is the given string a member of this set?
*
* @param String aStr
*/
ArraySet.prototype.has = function ArraySet_has(aStr) {
return Object.prototype.hasOwnProperty.call(this._set,
util.toSetString(aStr));
};
/**
* What is the index of the given string in the array?
*
* @param String aStr
*/
ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
if (this.has(aStr)) {
return this._set[util.toSetString(aStr)];
}
throw new Error('"' + aStr + '" is not in the set.');
};
/**
* What is the element at the given index?
*
* @param Number aIdx
*/
ArraySet.prototype.at = function ArraySet_at(aIdx) {
if (aIdx >= 0 && aIdx < this._array.length) {
return this._array[aIdx];
}
throw new Error('No element indexed by ' + aIdx);
};
/**
* Returns the array representation of this set (which has the proper indices
* indicated by indexOf). Note that this is a copy of the internal array used
* for storing the members so that no one can mess with internal state.
*/
ArraySet.prototype.toArray = function ArraySet_toArray() {
return this._array.slice();
};
exports.ArraySet = ArraySet;
});
},{"./util":17,"amdefine":19}],20:[function(require,module,exports){
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module);
}
define(function (require, exports, module) {
/**
* Recursive implementation of binary search.
*
* @param aLow Indices here and lower do not contain the needle.
* @param aHigh Indices here and higher do not contain the needle.
* @param aNeedle The element being searched for.
* @param aHaystack The non-empty array being searched.
* @param aCompare Function which takes two elements and returns -1, 0, or 1.
*/
function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare) {
// This function terminates when one of the following is true:
//
// 1. We find the exact element we are looking for.
//
// 2. We did not find the exact element, but we can return the next
// closest element that is less than that element.
//
// 3. We did not find the exact element, and there is no next-closest
// element which is less than the one we are searching for, so we
// return null.
var mid = Math.floor((aHigh - aLow) / 2) + aLow;
var cmp = aCompare(aNeedle, aHaystack[mid]);
if (cmp === 0) {
// Found the element we are looking for.
return aHaystack[mid];
}
else if (cmp > 0) {
// aHaystack[mid] is greater than our needle.
if (aHigh - mid > 1) {
// The element is in the upper half.
return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare);
}
// We did not find an exact match, return the next closest one
// (termination case 2).
return aHaystack[mid];
}
else {
// aHaystack[mid] is less than our needle.
if (mid - aLow > 1) {
// The element is in the lower half.
return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare);
}
// The exact needle element was not found in this haystack. Determine if
// we are in termination case (2) or (3) and return the appropriate thing.
return aLow < 0
? null
: aHaystack[aLow];
}
}
/**
* This is an implementation of binary search which will always try and return
* the next lowest value checked if there is no exact hit. This is because
* mappings between original and generated line/col pairs are single points,
* and there is an implicit region between each of them, so a miss just means
* that you aren't on the very start of a region.
*
* @param aNeedle The element you are looking for.
* @param aHaystack The array that is being searched.
* @param aCompare A function which takes the needle and an element in the
* array and returns -1, 0, or 1 depending on whether the needle is less
* than, equal to, or greater than the element, respectively.
*/
exports.search = function search(aNeedle, aHaystack, aCompare) {
return aHaystack.length > 0
? recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, aCompare)
: null;
};
});
},{"amdefine":19}],23:[function(require,module,exports){
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module);
}
define(function (require, exports, module) {
var charToIntMap = {};
var intToCharMap = {};
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
.split('')
.forEach(function (ch, index) {
charToIntMap[ch] = index;
intToCharMap[index] = ch;
});
/**
* Encode an integer in the range of 0 to 63 to a single base 64 digit.
*/
exports.encode = function base64_encode(aNumber) {
if (aNumber in intToCharMap) {
return intToCharMap[aNumber];
}
throw new TypeError("Must be between 0 and 63: " + aNumber);
};
/**
* Decode a single base 64 digit to an integer.
*/
exports.decode = function base64_decode(aChar) {
if (aChar in charToIntMap) {
return charToIntMap[aChar];
}
throw new TypeError("Not a valid base 64 digit: " + aChar);
};
});
},{"amdefine":19}]},{},[1])(1)
});
;
|
ajax/libs/6to5/2.4.9/browser.js
|
koggdal/cdnjs
|
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.to5=e()}}(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){(function(root,mod){if(typeof exports=="object"&&typeof module=="object")return mod(exports);if(typeof define=="function"&&define.amd)return define(["exports"],mod);mod(root.acorn||(root.acorn={}))})(this,function(exports){"use strict";exports.version="0.11.1";var options,input,inputLen,sourceFile;exports.parse=function(inpt,opts){input=String(inpt);inputLen=input.length;setOptions(opts);initTokenState();var startPos=options.locations?[tokPos,curPosition()]:tokPos;initParserState();return parseTopLevel(options.program||startNodeAt(startPos))};var defaultOptions=exports.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};exports.parseExpressionAt=function(inpt,pos,opts){input=String(inpt);inputLen=input.length;setOptions(opts);initTokenState(pos);initParserState();return parseExpression()};var isArray=function(obj){return Object.prototype.toString.call(obj)==="[object Array]"};function setOptions(opts){options={};for(var opt in defaultOptions)options[opt]=opts&&has(opts,opt)?opts[opt]:defaultOptions[opt];sourceFile=options.sourceFile||null;if(isArray(options.onToken)){var tokens=options.onToken;options.onToken=function(token){tokens.push(token)}}if(isArray(options.onComment)){var comments=options.onComment;options.onComment=function(block,text,start,end,startLoc,endLoc){var comment={type:block?"Block":"Line",value:text,start:start,end:end};if(options.locations){comment.loc=new SourceLocation;comment.loc.start=startLoc;comment.loc.end=endLoc}if(options.ranges)comment.range=[start,end];comments.push(comment)}}if(options.strictMode){strict=true}if(options.ecmaVersion>=6){isKeyword=isEcma6Keyword}else{isKeyword=isEcma5AndLessKeyword}}var getLineInfo=exports.getLineInfo=function(input,offset){for(var line=1,cur=0;;){lineBreak.lastIndex=cur;var match=lineBreak.exec(input);if(match&&match.index<offset){++line;cur=match.index+match[0].length}else break}return{line:line,column:offset-cur}};function Token(){this.type=tokType;this.value=tokVal;this.start=tokStart;this.end=tokEnd;if(options.locations){this.loc=new SourceLocation;this.loc.end=tokEndLoc;this.startLoc=tokStartLoc;this.endLoc=tokEndLoc}if(options.ranges)this.range=[tokStart,tokEnd]}exports.Token=Token;exports.tokenize=function(inpt,opts){input=String(inpt);inputLen=input.length;setOptions(opts);initTokenState();skipSpace();function getToken(forceRegexp){lastEnd=tokEnd;readToken(forceRegexp);return new Token}getToken.jumpTo=function(pos,reAllowed){tokPos=pos;if(options.locations){tokCurLine=1;tokLineStart=lineBreak.lastIndex=0;var match;while((match=lineBreak.exec(input))&&match.index<pos){++tokCurLine;tokLineStart=match.index+match[0].length}}tokRegexpAllowed=reAllowed;skipSpace()};getToken.noRegexp=function(){tokRegexpAllowed=false};getToken.options=options;return getToken};var tokPos;var tokStart,tokEnd;var tokStartLoc,tokEndLoc;var tokType,tokVal;var tokRegexpAllowed;var tokCurLine,tokLineStart;var lastStart,lastEnd,lastEndLoc;var inFunction,inGenerator,inAsync,labels,strict,inXJSChild,inXJSTag,inType;var metParenL;var templates;function initParserState(){lastStart=lastEnd=tokPos;if(options.locations)lastEndLoc=new Position;inFunction=inGenerator=inAsync=strict=false;labels=[];skipSpace();readToken()}function raise(pos,message){var loc=getLineInfo(input,pos);message+=" ("+loc.line+":"+loc.column+")";var err=new SyntaxError(message);err.pos=pos;err.loc=loc;err.raisedAt=tokPos;throw err}var empty=[];var _num={type:"num"},_regexp={type:"regexp"},_string={type:"string"};var _name={type:"name"},_eof={type:"eof"};var _xjsName={type:"xjsName"},_xjsText={type:"xjsText"};var _break={keyword:"break"},_case={keyword:"case",beforeExpr:true},_catch={keyword:"catch"};var _continue={keyword:"continue"},_debugger={keyword:"debugger"},_default={keyword:"default"};var _do={keyword:"do",isLoop:true},_else={keyword:"else",beforeExpr:true};var _finally={keyword:"finally"},_for={keyword:"for",isLoop:true},_function={keyword:"function"};var _if={keyword:"if"},_return={keyword:"return",beforeExpr:true},_switch={keyword:"switch"};var _throw={keyword:"throw",beforeExpr:true},_try={keyword:"try"},_var={keyword:"var"};var _let={keyword:"let"},_const={keyword:"const"};var _while={keyword:"while",isLoop:true},_with={keyword:"with"},_new={keyword:"new",beforeExpr:true};var _this={keyword:"this"};var _class={keyword:"class"},_extends={keyword:"extends",beforeExpr:true};var _export={keyword:"export"},_import={keyword:"import"};var _yield={keyword:"yield",beforeExpr:true};var _null={keyword:"null",atomValue:null},_true={keyword:"true",atomValue:true};var _false={keyword:"false",atomValue:false};var _in={keyword:"in",binop:7,beforeExpr:true};var keywordTypes={"break":_break,"case":_case,"catch":_catch,"continue":_continue,"debugger":_debugger,"default":_default,"do":_do,"else":_else,"finally":_finally,"for":_for,"function":_function,"if":_if,"return":_return,"switch":_switch,"throw":_throw,"try":_try,"var":_var,let:_let,"const":_const,"while":_while,"with":_with,"null":_null,"true":_true,"false":_false,"new":_new,"in":_in,"instanceof":{keyword:"instanceof",binop:7,beforeExpr:true},"this":_this,"typeof":{keyword:"typeof",prefix:true,beforeExpr:true},"void":{keyword:"void",prefix:true,beforeExpr:true},"delete":{keyword:"delete",prefix:true,beforeExpr:true},"class":_class,"extends":_extends,"export":_export,"import":_import,"yield":_yield};var _bracketL={type:"[",beforeExpr:true},_bracketR={type:"]"},_braceL={type:"{",beforeExpr:true};var _braceR={type:"}"},_parenL={type:"(",beforeExpr:true},_parenR={type:")"};var _comma={type:",",beforeExpr:true},_semi={type:";",beforeExpr:true};var _colon={type:":",beforeExpr:true},_dot={type:"."},_question={type:"?",beforeExpr:true};var _arrow={type:"=>",beforeExpr:true},_bquote={type:"`"},_dollarBraceL={type:"${",beforeExpr:true};var _ltSlash={type:"</"};var _arrow={type:"=>",beforeExpr:true},_template={type:"template"},_templateContinued={type:"templateContinued"};var _ellipsis={type:"...",prefix:true,beforeExpr:true};var _paamayimNekudotayim={type:"::",beforeExpr:true};var _at={type:"@"};var _hash={type:"#"};var _slash={binop:10,beforeExpr:true},_eq={isAssign:true,beforeExpr:true};var _assign={isAssign:true,beforeExpr:true};var _incDec={postfix:true,prefix:true,isUpdate:true},_prefix={prefix:true,beforeExpr:true};var _logicalOR={binop:1,beforeExpr:true};var _logicalAND={binop:2,beforeExpr:true};var _bitwiseOR={binop:3,beforeExpr:true};var _bitwiseXOR={binop:4,beforeExpr:true};var _bitwiseAND={binop:5,beforeExpr:true};var _equality={binop:6,beforeExpr:true};var _relational={binop:7,beforeExpr:true};var _bitShift={binop:8,beforeExpr:true};var _plusMin={binop:9,prefix:true,beforeExpr:true};var _modulo={binop:10,beforeExpr:true};var _star={binop:10,beforeExpr:true};var _exponent={binop:10,beforeExpr:true};var _lt={binop:7,beforeExpr:true},_gt={binop:7,beforeExpr:true};exports.tokTypes={bracketL:_bracketL,bracketR:_bracketR,braceL:_braceL,braceR:_braceR,parenL:_parenL,parenR:_parenR,comma:_comma,semi:_semi,colon:_colon,dot:_dot,ellipsis:_ellipsis,question:_question,slash:_slash,eq:_eq,name:_name,eof:_eof,num:_num,regexp:_regexp,string:_string,arrow:_arrow,bquote:_bquote,dollarBraceL:_dollarBraceL,star:_star,assign:_assign,xjsName:_xjsName,xjsText:_xjsText,paamayimNekudotayim:_paamayimNekudotayim,exponent:_exponent,at:_at,hash:_hash,template:_template,templateContinued:_templateContinued};for(var kw in keywordTypes)exports.tokTypes["_"+kw]=keywordTypes[kw];function makePredicate(words){words=words.split(" ");var f="",cats=[];out:for(var i=0;i<words.length;++i){for(var j=0;j<cats.length;++j)if(cats[j][0].length==words[i].length){cats[j].push(words[i]);continue out}cats.push([words[i]])}function compareTo(arr){if(arr.length==1)return f+="return str === "+JSON.stringify(arr[0])+";";f+="switch(str){";for(var i=0;i<arr.length;++i)f+="case "+JSON.stringify(arr[i])+":";f+="return true}return false;"}if(cats.length>3){cats.sort(function(a,b){return b.length-a.length});f+="switch(str.length){";for(var i=0;i<cats.length;++i){var cat=cats[i];f+="case "+cat[0].length+":";compareTo(cat)}f+="}"}else{compareTo(words)}return new Function("str",f)}var isReservedWord3=makePredicate("abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile");var isReservedWord5=makePredicate("class enum extends super const export import");var isStrictReservedWord=makePredicate("implements interface let package private protected public static yield");var isStrictBadIdWord=makePredicate("eval arguments");var ecma5AndLessKeywords="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 isEcma5AndLessKeyword=makePredicate(ecma5AndLessKeywords);var ecma6AndLessKeywords=ecma5AndLessKeywords+" let const class extends export import yield";var isEcma6Keyword=makePredicate(ecma6AndLessKeywords);var isKeyword=isEcma5AndLessKeyword;var nonASCIIwhitespace=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;var nonASCIIidentifierStartChars="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";var nonASCIIidentifierChars="̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏ᦰ-ᧀᧈᧉ᧐-᧙ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷼-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-꣄꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︭︳︴﹍-﹏0-9_";var nonASCIIidentifierStart=new RegExp("["+nonASCIIidentifierStartChars+"]");var nonASCIIidentifier=new RegExp("["+nonASCIIidentifierStartChars+nonASCIIidentifierChars+"]");var decimalNumber=/^\d+$/;var hexNumber=/^[\da-fA-F]+$/;var newline=/[\n\r\u2028\u2029]/;function isNewLine(code){return code===10||code===13||code===8232||code==8233}var lineBreak=/\r\n|[\n\r\u2028\u2029]/g;var isIdentifierStart=exports.isIdentifierStart=function(code){if(code<65)return code===36;if(code<91)return true;if(code<97)return code===95;if(code<123)return true;return code>=170&&nonASCIIidentifierStart.test(String.fromCharCode(code))};var isIdentifierChar=exports.isIdentifierChar=function(code){if(code<48)return code===36;if(code<58)return true;if(code<65)return false;if(code<91)return true;if(code<97)return code===95;if(code<123)return true;return code>=170&&nonASCIIidentifier.test(String.fromCharCode(code))};function Position(line,col){this.line=line;this.column=col}Position.prototype.offset=function(n){return new Position(this.line,this.column+n)};function curPosition(){return new Position(tokCurLine,tokPos-tokLineStart)}function initTokenState(pos){if(pos){tokPos=pos;tokLineStart=Math.max(0,input.lastIndexOf("\n",pos));tokCurLine=input.slice(0,tokLineStart).split(newline).length}else{tokCurLine=1;tokPos=tokLineStart=0}tokRegexpAllowed=true;metParenL=0;inType=inXJSChild=inXJSTag=false;templates=[];if(tokPos===0&&options.allowHashBang&&input.slice(0,2)==="#!"){skipLineComment(2)}}function finishToken(type,val,shouldSkipSpace){tokEnd=tokPos;if(options.locations)tokEndLoc=curPosition();tokType=type;if(shouldSkipSpace!==false)skipSpace();tokVal=val;tokRegexpAllowed=type.beforeExpr;if(options.onToken){options.onToken(new Token)}}function skipBlockComment(){var startLoc=options.onComment&&options.locations&&curPosition();var start=tokPos,end=input.indexOf("*/",tokPos+=2);if(end===-1)raise(tokPos-2,"Unterminated comment");tokPos=end+2;if(options.locations){lineBreak.lastIndex=start;var match;while((match=lineBreak.exec(input))&&match.index<tokPos){++tokCurLine;tokLineStart=match.index+match[0].length}}if(options.onComment)options.onComment(true,input.slice(start+2,end),start,tokPos,startLoc,options.locations&&curPosition())}function skipLineComment(startSkip){var start=tokPos;var startLoc=options.onComment&&options.locations&&curPosition();var ch=input.charCodeAt(tokPos+=startSkip);while(tokPos<inputLen&&ch!==10&&ch!==13&&ch!==8232&&ch!==8233){++tokPos;ch=input.charCodeAt(tokPos)}if(options.onComment)options.onComment(false,input.slice(start+startSkip,tokPos),start,tokPos,startLoc,options.locations&&curPosition())}function skipSpace(){while(tokPos<inputLen){var ch=input.charCodeAt(tokPos);if(ch===32){++tokPos}else if(ch===13){++tokPos;var next=input.charCodeAt(tokPos);if(next===10){++tokPos}if(options.locations){++tokCurLine;tokLineStart=tokPos}}else if(ch===10||ch===8232||ch===8233){++tokPos;if(options.locations){++tokCurLine;tokLineStart=tokPos}}else if(ch>8&&ch<14){++tokPos}else if(ch===47){var next=input.charCodeAt(tokPos+1);if(next===42){skipBlockComment()}else if(next===47){skipLineComment(2)}else break}else if(ch===160){++tokPos}else if(ch>=5760&&nonASCIIwhitespace.test(String.fromCharCode(ch))){++tokPos}else{break}}}function readToken_dot(){var next=input.charCodeAt(tokPos+1);if(next>=48&&next<=57)return readNumber(true);var next2=input.charCodeAt(tokPos+2);if(options.playground&&next===63){tokPos+=2;return finishToken(_dotQuestion)}else if(options.ecmaVersion>=6&&next===46&&next2===46){tokPos+=3;return finishToken(_ellipsis)}else{++tokPos;return finishToken(_dot)}}function readToken_slash(){var next=input.charCodeAt(tokPos+1);if(tokRegexpAllowed){++tokPos;return readRegexp()}if(next===61)return finishOp(_assign,2);return finishOp(_slash,1)}function readToken_modulo(){var next=input.charCodeAt(tokPos+1);if(next===61)return finishOp(_assign,2);return finishOp(_modulo,1)}function readToken_mult(){var type=_star;var width=1;var next=input.charCodeAt(tokPos+1);if(options.ecmaVersion>=7&&next===42){width++;next=input.charCodeAt(tokPos+2);type=_exponent}if(next===61){width++;type=_assign}return finishOp(type,width)}function readToken_pipe_amp(code){var next=input.charCodeAt(tokPos+1);if(next===code)return finishOp(code===124?_logicalOR:_logicalAND,2);if(next===61)return finishOp(_assign,2);return finishOp(code===124?_bitwiseOR:_bitwiseAND,1)}function readToken_caret(){var next=input.charCodeAt(tokPos+1);if(next===61)return finishOp(_assign,2);return finishOp(_bitwiseXOR,1)}function readToken_plus_min(code){var next=input.charCodeAt(tokPos+1);if(next===code){if(next==45&&input.charCodeAt(tokPos+2)==62&&newline.test(input.slice(lastEnd,tokPos))){skipLineComment(3);skipSpace();return readToken()}return finishOp(_incDec,2)}if(next===61)return finishOp(_assign,2);return finishOp(_plusMin,1)}function readToken_lt_gt(code){var next=input.charCodeAt(tokPos+1);var size=1;if(!inType&&next===code){size=code===62&&input.charCodeAt(tokPos+2)===62?3:2;if(input.charCodeAt(tokPos+size)===61)return finishOp(_assign,size+1);return finishOp(_bitShift,size)}if(next==33&&code==60&&input.charCodeAt(tokPos+2)==45&&input.charCodeAt(tokPos+3)==45){skipLineComment(4);skipSpace();return readToken()}if(next===61){size=input.charCodeAt(tokPos+2)===61?3:2;return finishOp(_relational,size)}if(next===47){size=2;return finishOp(_ltSlash,size)}return code===60?finishOp(_lt,size):finishOp(_gt,size,!inXJSTag)}function readToken_eq_excl(code){var next=input.charCodeAt(tokPos+1);if(next===61)return finishOp(_equality,input.charCodeAt(tokPos+2)===61?3:2);if(code===61&&next===62&&options.ecmaVersion>=6){tokPos+=2;return finishToken(_arrow)}return finishOp(code===61?_eq:_prefix,1)}function getTemplateToken(code){if(tokType===_string){if(code===96){++tokPos;return finishToken(_bquote)}else if(code===36&&input.charCodeAt(tokPos+1)===123){tokPos+=2;return finishToken(_dollarBraceL)}}return readTmplString()}function getTokenFromCode(code){switch(code){case 46:return readToken_dot();case 40:++tokPos;return finishToken(_parenL);case 41:++tokPos;return finishToken(_parenR);case 59:++tokPos;return finishToken(_semi);case 44:++tokPos;return finishToken(_comma);case 91:++tokPos;return finishToken(_bracketL);case 93:++tokPos;return finishToken(_bracketR);case 123:++tokPos;if(templates.length)++templates[templates.length-1];return finishToken(_braceL);case 125:++tokPos;if(templates.length&&--templates[templates.length-1]===0)return readTemplateString(_templateContinued);else return finishToken(_braceR);case 63:++tokPos;return finishToken(_question);case 64:if(options.playground){++tokPos;return finishToken(_at)}case 35:if(options.playground){++tokPos;return finishToken(_hash)}case 58:++tokPos;if(options.ecmaVersion>=7){var next=input.charCodeAt(tokPos);if(next===58){++tokPos;return finishToken(_paamayimNekudotayim)}}return finishToken(_colon);case 96:if(options.ecmaVersion>=6){++tokPos;return readTemplateString(_template)}case 48:var next=input.charCodeAt(tokPos+1);if(next===120||next===88)return readRadixNumber(16);if(options.ecmaVersion>=6){if(next===111||next===79)return readRadixNumber(8);if(next===98||next===66)return readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return readNumber(false);case 34:case 39:return inXJSTag?readXJSStringLiteral():readString(code);case 47:return readToken_slash();case 37:return readToken_modulo();case 42:return readToken_mult();case 124:case 38:return readToken_pipe_amp(code);case 94:return readToken_caret();case 43:case 45:return readToken_plus_min(code);case 60:case 62:return readToken_lt_gt(code);case 61:case 33:return readToken_eq_excl(code);case 126:return finishOp(_prefix,1)}return false}function readToken(forceRegexp){if(!forceRegexp)tokStart=tokPos;else tokPos=tokStart+1;if(options.locations)tokStartLoc=curPosition();if(forceRegexp)return readRegexp();if(tokPos>=inputLen)return finishToken(_eof);var code=input.charCodeAt(tokPos);if(inXJSChild&&tokType!==_braceL&&code!==60&&code!==123&&code!==125){return readXJSText(["<","{"])}if(isIdentifierStart(code)||code===92)return readWord();var tok=getTokenFromCode(code);if(tok===false){var ch=String.fromCharCode(code);if(ch==="\\"||nonASCIIidentifierStart.test(ch))return readWord();raise(tokPos,"Unexpected character '"+ch+"'")}return tok}function finishOp(type,size,shouldSkipSpace){var str=input.slice(tokPos,tokPos+size);tokPos+=size;finishToken(type,str,shouldSkipSpace)}var regexpUnicodeSupport=false;try{new RegExp("","u");regexpUnicodeSupport=true}catch(e){}function readRegexp(){var content="",escaped,inClass,start=tokPos;for(;;){if(tokPos>=inputLen)raise(start,"Unterminated regular expression");var ch=nextChar();if(newline.test(ch))raise(start,"Unterminated regular expression");if(!escaped){if(ch==="[")inClass=true;else if(ch==="]"&&inClass)inClass=false;else if(ch==="/"&&!inClass)break;escaped=ch==="\\"}else escaped=false;++tokPos}var content=input.slice(start,tokPos);++tokPos;var mods=readWord1();var tmp=content;if(mods){var validFlags=/^[gmsiy]*$/;if(options.ecmaVersion>=6)validFlags=/^[gmsiyu]*$/;if(!validFlags.test(mods))raise(start,"Invalid regular expression flag");if(mods.indexOf("u")>=0&&!regexpUnicodeSupport){tmp=tmp.replace(/\\u\{([0-9a-fA-F]{5,6})\}/g,"x").replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x")}}try{new RegExp(tmp)}catch(e){if(e instanceof SyntaxError)raise(start,"Error parsing regular expression: "+e.message);raise(e)}try{var value=new RegExp(content,mods)}catch(err){value=null}return finishToken(_regexp,{pattern:content,flags:mods,value:value})}function readInt(radix,len){var start=tokPos,total=0;for(var i=0,e=len==null?Infinity:len;i<e;++i){var code=input.charCodeAt(tokPos),val;if(code>=97)val=code-97+10;else if(code>=65)val=code-65+10;else if(code>=48&&code<=57)val=code-48;else val=Infinity;if(val>=radix)break;++tokPos;total=total*radix+val}if(tokPos===start||len!=null&&tokPos-start!==len)return null;return total}function readRadixNumber(radix){tokPos+=2;var val=readInt(radix);if(val==null)raise(tokStart+2,"Expected number in radix "+radix);if(isIdentifierStart(input.charCodeAt(tokPos)))raise(tokPos,"Identifier directly after number");return finishToken(_num,val)}function readNumber(startsWithDot){var start=tokPos,isFloat=false,octal=input.charCodeAt(tokPos)===48;if(!startsWithDot&&readInt(10)===null)raise(start,"Invalid number");if(input.charCodeAt(tokPos)===46){++tokPos;readInt(10);isFloat=true}var next=input.charCodeAt(tokPos);if(next===69||next===101){next=input.charCodeAt(++tokPos);if(next===43||next===45)++tokPos;if(readInt(10)===null)raise(start,"Invalid number");isFloat=true}if(isIdentifierStart(input.charCodeAt(tokPos)))raise(tokPos,"Identifier directly after number");var str=input.slice(start,tokPos),val;if(isFloat)val=parseFloat(str);else if(!octal||str.length===1)val=parseInt(str,10);else if(/[89]/.test(str)||strict)raise(start,"Invalid number");else val=parseInt(str,8);return finishToken(_num,val)}function readCodePoint(){var ch=input.charCodeAt(tokPos),code;if(ch===123){if(options.ecmaVersion<6)unexpected();++tokPos;code=readHexChar(input.indexOf("}",tokPos)-tokPos);++tokPos;if(code>1114111)unexpected()}else{code=readHexChar(4)}if(code<=65535){return String.fromCharCode(code)}var cu1=(code-65536>>10)+55296;var cu2=(code-65536&1023)+56320;return String.fromCharCode(cu1,cu2)}function readString(quote){++tokPos;var out="";for(;;){if(tokPos>=inputLen)raise(tokStart,"Unterminated string constant");var ch=input.charCodeAt(tokPos);if(ch===quote){++tokPos;return finishToken(_string,out)}if(ch===92){out+=readEscapedChar()}else{++tokPos;if(newline.test(String.fromCharCode(ch))){raise(tokStart,"Unterminated string constant")}out+=String.fromCharCode(ch)}}}function readTemplateString(type){if(type==_templateContinued)templates.pop();var out="",start=tokPos;for(;;){if(tokPos>=inputLen)raise(tokStart,"Unterminated template");var ch=input.charAt(tokPos);if(ch==="`"||ch==="$"&&input.charCodeAt(tokPos+1)===123){var raw=input.slice(start,tokPos);++tokPos;if(ch=="$"){++tokPos;templates.push(1)}return finishToken(type,{cooked:out,raw:raw})}if(ch==="\\"){out+=readEscapedChar()}else{++tokPos;if(newline.test(ch)){if(ch==="\r"&&input.charCodeAt(tokPos)===10){++tokPos;ch="\n"}if(options.locations){++tokCurLine;tokLineStart=tokPos}}out+=ch}}}function readEscapedChar(){var ch=input.charCodeAt(++tokPos);var octal=/^[0-7]+/.exec(input.slice(tokPos,tokPos+3));if(octal)octal=octal[0];while(octal&&parseInt(octal,8)>255)octal=octal.slice(0,-1);if(octal==="0")octal=null;++tokPos;if(octal){if(strict)raise(tokPos-2,"Octal literal in strict mode");tokPos+=octal.length-1;return String.fromCharCode(parseInt(octal,8))}else{switch(ch){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(readHexChar(2));case 117:return readCodePoint();case 116:return" ";case 98:return"\b";case 118:return"";case 102:return"\f";case 48:return"\x00";case 13:if(input.charCodeAt(tokPos)===10)++tokPos;case 10:if(options.locations){tokLineStart=tokPos;++tokCurLine}return"";default:return String.fromCharCode(ch)}}}var XHTMLEntities={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 readXJSEntity(){var str="",count=0,entity;var ch=nextChar();if(ch!=="&")raise(tokPos,"Entity must start with an ampersand");var startPos=++tokPos;while(tokPos<inputLen&&count++<10){ch=nextChar();tokPos++;if(ch===";"){if(str[0]==="#"){if(str[1]==="x"){str=str.substr(2);if(hexNumber.test(str)){entity=String.fromCharCode(parseInt(str,16))}}else{str=str.substr(1);if(decimalNumber.test(str)){entity=String.fromCharCode(parseInt(str,10))}}}else{entity=XHTMLEntities[str]}break}str+=ch}if(!entity){tokPos=startPos;return"&"}return entity}function readXJSText(stopChars){var str="";while(tokPos<inputLen){var ch=nextChar();if(stopChars.indexOf(ch)!==-1){break}if(ch==="&"){str+=readXJSEntity()}else{++tokPos;if(ch==="\r"&&nextChar()==="\n"){str+=ch;++tokPos;ch="\n"}if(ch==="\n"&&options.locations){tokLineStart=tokPos;++tokCurLine}str+=ch}}return finishToken(_xjsText,str)}function readXJSStringLiteral(){var quote=input.charCodeAt(tokPos);if(quote!==34&"e!==39){raise("String literal must starts with a quote")}++tokPos;readXJSText([String.fromCharCode(quote)]);if(quote!==input.charCodeAt(tokPos)){unexpected()}++tokPos;return finishToken(tokType,tokVal)}function readHexChar(len){var n=readInt(16,len);if(n===null)raise(tokStart,"Bad character escape sequence");return n}var containsEsc;function readWord1(){containsEsc=false;var word,first=true,start=tokPos;for(;;){var ch=input.charCodeAt(tokPos);if(isIdentifierChar(ch)||inXJSTag&&ch===45){if(containsEsc)word+=nextChar();++tokPos}else if(ch===92&&!inXJSTag){if(!containsEsc)word=input.slice(start,tokPos);containsEsc=true;if(input.charCodeAt(++tokPos)!=117)raise(tokPos,"Expecting Unicode escape sequence \\uXXXX");++tokPos;var esc=readHexChar(4);var escStr=String.fromCharCode(esc);if(!escStr)raise(tokPos-1,"Invalid Unicode escape");if(!(first?isIdentifierStart(esc):isIdentifierChar(esc)))raise(tokPos-4,"Invalid Unicode escape");word+=escStr}else{break}first=false}return containsEsc?word:input.slice(start,tokPos)}function readWord(){var word=readWord1();var type=inXJSTag?_xjsName:_name;if(!containsEsc&&isKeyword(word))type=keywordTypes[word];return finishToken(type,word)}function next(){lastStart=tokStart;lastEnd=tokEnd;lastEndLoc=tokEndLoc;readToken()}function setStrict(strct){strict=strct;tokPos=tokStart;if(options.locations){while(tokPos<tokLineStart){tokLineStart=input.lastIndexOf("\n",tokLineStart-2)+1;--tokCurLine}}skipSpace();readToken()}function Node(){this.type=null;this.start=tokStart;this.end=null}exports.Node=Node;function SourceLocation(){this.start=tokStartLoc;this.end=null;if(sourceFile!==null)this.source=sourceFile}function startNode(){var node=new Node;if(options.locations)node.loc=new SourceLocation;if(options.directSourceFile)node.sourceFile=options.directSourceFile;if(options.ranges)node.range=[tokStart,0];return node}function storeCurrentPos(){return options.locations?[tokStart,tokStartLoc]:tokStart}function startNodeAt(pos){var node=new Node,start=pos;if(options.locations){node.loc=new SourceLocation;node.loc.start=start[1];start=pos[0]}node.start=start;if(options.directSourceFile)node.sourceFile=options.directSourceFile;if(options.ranges)node.range=[start,0];return node}function finishNode(node,type){node.type=type;node.end=lastEnd;if(options.locations)node.loc.end=lastEndLoc;if(options.ranges)node.range[1]=lastEnd;return node}function finishNodeAt(node,type,pos){if(options.locations){node.loc.end=pos[1];pos=pos[0]}node.type=type;node.end=pos;if(options.ranges)node.range[1]=pos;return node}function isUseStrict(stmt){return options.ecmaVersion>=5&&stmt.type==="ExpressionStatement"&&stmt.expression.type==="Literal"&&stmt.expression.value==="use strict"}function eat(type){if(tokType===type){next();return true}else{return false}}function canInsertSemicolon(){return!options.strictSemicolons&&(tokType===_eof||tokType===_braceR||newline.test(input.slice(lastEnd,tokStart)))}function semicolon(){if(!eat(_semi)&&!canInsertSemicolon())unexpected()}function expect(type){eat(type)||unexpected()}function nextChar(){return input.charAt(tokPos)}function unexpected(pos){raise(pos!=null?pos:tokStart,"Unexpected token")}function has(obj,propName){return Object.prototype.hasOwnProperty.call(obj,propName)}function toAssignable(node,allowSpread,checkType){if(options.ecmaVersion>=6&&node){switch(node.type){case"Identifier":case"MemberExpression":break;case"ObjectExpression":node.type="ObjectPattern";for(var i=0;i<node.properties.length;i++){var prop=node.properties[i];if(prop.type==="Property"&&prop.kind!=="init")unexpected(prop.key.start);toAssignable(prop.value,false,checkType)}break;case"ArrayExpression":node.type="ArrayPattern";for(var i=0,lastI=node.elements.length-1;i<=lastI;i++){toAssignable(node.elements[i],i===lastI,checkType)
}break;case"SpreadElement":if(allowSpread){toAssignable(node.argument,false,checkType);checkSpreadAssign(node.argument)}else{unexpected(node.start)}break;default:if(checkType)unexpected(node.start)}}return node}function checkSpreadAssign(node){if(node.type!=="Identifier"&&node.type!=="ArrayPattern")unexpected(node.start)}function checkFunctionParam(param,nameHash){switch(param.type){case"Identifier":if(isStrictReservedWord(param.name)||isStrictBadIdWord(param.name))raise(param.start,"Defining '"+param.name+"' in strict mode");if(has(nameHash,param.name))raise(param.start,"Argument name clash in strict mode");nameHash[param.name]=true;break;case"ObjectPattern":for(var i=0;i<param.properties.length;i++)checkFunctionParam(param.properties[i].value,nameHash);break;case"ArrayPattern":for(var i=0;i<param.elements.length;i++){var elem=param.elements[i];if(elem)checkFunctionParam(elem,nameHash)}break}}function checkPropClash(prop,propHash){if(options.ecmaVersion>=6)return;var key=prop.key,name;switch(key.type){case"Identifier":name=key.name;break;case"Literal":name=String(key.value);break;default:return}var kind=prop.kind||"init",other;if(has(propHash,name)){other=propHash[name];var isGetSet=kind!=="init";if((strict||isGetSet)&&other[kind]||!(isGetSet^other.init))raise(key.start,"Redefinition of property")}else{other=propHash[name]={init:false,get:false,set:false}}other[kind]=true}function checkLVal(expr,isBinding){switch(expr.type){case"Identifier":if(strict&&(isStrictBadIdWord(expr.name)||isStrictReservedWord(expr.name)))raise(expr.start,(isBinding?"Binding ":"Assigning to ")+expr.name+" in strict mode");break;case"MemberExpression":if(isBinding)raise(expr.start,"Binding to member expression");break;case"ObjectPattern":for(var i=0;i<expr.properties.length;i++){var prop=expr.properties[i];if(prop.type==="Property")prop=prop.value;checkLVal(prop,isBinding)}break;case"ArrayPattern":for(var i=0;i<expr.elements.length;i++){var elem=expr.elements[i];if(elem)checkLVal(elem,isBinding)}break;case"SpreadProperty":case"SpreadElement":case"VirtualPropertyExpression":break;default:raise(expr.start,"Assigning to rvalue")}}function parseTopLevel(node){var first=true;if(!node.body)node.body=[];while(tokType!==_eof){var stmt=parseStatement(true);node.body.push(stmt);if(first&&isUseStrict(stmt))setStrict(true);first=false}lastStart=tokStart;lastEnd=tokEnd;lastEndLoc=tokEndLoc;return finishNode(node,"Program")}var loopLabel={kind:"loop"},switchLabel={kind:"switch"};function parseStatement(topLevel){if(tokType===_slash||tokType===_assign&&tokVal=="/=")readToken(true);var starttype=tokType,node=startNode(),start=storeCurrentPos();switch(starttype){case _break:case _continue:return parseBreakContinueStatement(node,starttype.keyword);case _debugger:return parseDebuggerStatement(node);case _do:return parseDoStatement(node);case _for:return parseForStatement(node);case _function:return parseFunctionStatement(node);case _class:return parseClass(node,true);case _if:return parseIfStatement(node);case _return:return parseReturnStatement(node);case _switch:return parseSwitchStatement(node);case _throw:return parseThrowStatement(node);case _try:return parseTryStatement(node);case _var:case _let:case _const:return parseVarStatement(node,starttype.keyword);case _while:return parseWhileStatement(node);case _with:return parseWithStatement(node);case _braceL:return parseBlock();case _semi:return parseEmptyStatement(node);case _export:case _import:if(!topLevel&&!options.allowImportExportEverywhere)raise(tokStart,"'import' and 'export' may only appear at the top level");return starttype===_import?parseImport(node):parseExport(node);default:var maybeName=tokVal,expr=parseExpression(false,false,true);if(expr.type==="FunctionDeclaration")return expr;if(starttype===_name&&expr.type==="Identifier"){if(eat(_colon)){return parseLabeledStatement(node,maybeName,expr)}if(options.ecmaVersion>=7&&expr.name==="private"&&tokType===_name){return parsePrivate(node)}else if(expr.name==="declare"){if(tokType===_class||tokType===_name||tokType===_function||tokType===_var){return parseDeclare(node)}}else if(tokType===_name){if(expr.name==="interface"){return parseInterface(node)}else if(expr.name==="type"){return parseTypeAlias(node)}}}return parseExpressionStatement(node,expr)}}function parseBreakContinueStatement(node,keyword){var isBreak=keyword=="break";next();if(eat(_semi)||canInsertSemicolon())node.label=null;else if(tokType!==_name)unexpected();else{node.label=parseIdent();semicolon()}for(var i=0;i<labels.length;++i){var lab=labels[i];if(node.label==null||lab.name===node.label.name){if(lab.kind!=null&&(isBreak||lab.kind==="loop"))break;if(node.label&&isBreak)break}}if(i===labels.length)raise(node.start,"Unsyntactic "+keyword);return finishNode(node,isBreak?"BreakStatement":"ContinueStatement")}function parseDebuggerStatement(node){next();semicolon();return finishNode(node,"DebuggerStatement")}function parseDoStatement(node){next();labels.push(loopLabel);node.body=parseStatement();labels.pop();expect(_while);node.test=parseParenExpression();if(options.ecmaVersion>=6)eat(_semi);else semicolon();return finishNode(node,"DoWhileStatement")}function parseForStatement(node){next();labels.push(loopLabel);expect(_parenL);if(tokType===_semi)return parseFor(node,null);if(tokType===_var||tokType===_let){var init=startNode(),varKind=tokType.keyword,isLet=tokType===_let;next();parseVar(init,true,varKind);finishNode(init,"VariableDeclaration");if((tokType===_in||options.ecmaVersion>=6&&tokType===_name&&tokVal==="of")&&init.declarations.length===1&&!(isLet&&init.declarations[0].init))return parseForIn(node,init);return parseFor(node,init)}var init=parseExpression(false,true);if(tokType===_in||options.ecmaVersion>=6&&tokType===_name&&tokVal==="of"){checkLVal(init);return parseForIn(node,init)}return parseFor(node,init)}function parseFunctionStatement(node){next();return parseFunction(node,true,false)}function parseIfStatement(node){next();node.test=parseParenExpression();node.consequent=parseStatement();node.alternate=eat(_else)?parseStatement():null;return finishNode(node,"IfStatement")}function parseReturnStatement(node){if(!inFunction&&!options.allowReturnOutsideFunction)raise(tokStart,"'return' outside of function");next();if(eat(_semi)||canInsertSemicolon())node.argument=null;else{node.argument=parseExpression();semicolon()}return finishNode(node,"ReturnStatement")}function parseSwitchStatement(node){next();node.discriminant=parseParenExpression();node.cases=[];expect(_braceL);labels.push(switchLabel);for(var cur,sawDefault;tokType!=_braceR;){if(tokType===_case||tokType===_default){var isCase=tokType===_case;if(cur)finishNode(cur,"SwitchCase");node.cases.push(cur=startNode());cur.consequent=[];next();if(isCase)cur.test=parseExpression();else{if(sawDefault)raise(lastStart,"Multiple default clauses");sawDefault=true;cur.test=null}expect(_colon)}else{if(!cur)unexpected();cur.consequent.push(parseStatement())}}if(cur)finishNode(cur,"SwitchCase");next();labels.pop();return finishNode(node,"SwitchStatement")}function parseThrowStatement(node){next();if(newline.test(input.slice(lastEnd,tokStart)))raise(lastEnd,"Illegal newline after throw");node.argument=parseExpression();semicolon();return finishNode(node,"ThrowStatement")}function parseTryStatement(node){next();node.block=parseBlock();node.handler=null;if(tokType===_catch){var clause=startNode();next();expect(_parenL);clause.param=parseIdent();if(strict&&isStrictBadIdWord(clause.param.name))raise(clause.param.start,"Binding "+clause.param.name+" in strict mode");expect(_parenR);clause.guard=null;clause.body=parseBlock();node.handler=finishNode(clause,"CatchClause")}node.guardedHandlers=empty;node.finalizer=eat(_finally)?parseBlock():null;if(!node.handler&&!node.finalizer)raise(node.start,"Missing catch or finally clause");return finishNode(node,"TryStatement")}function parseVarStatement(node,kind){next();parseVar(node,false,kind);semicolon();return finishNode(node,"VariableDeclaration")}function parseWhileStatement(node){next();node.test=parseParenExpression();labels.push(loopLabel);node.body=parseStatement();labels.pop();return finishNode(node,"WhileStatement")}function parseWithStatement(node){if(strict)raise(tokStart,"'with' in strict mode");next();node.object=parseParenExpression();node.body=parseStatement();return finishNode(node,"WithStatement")}function parseEmptyStatement(node){next();return finishNode(node,"EmptyStatement")}function parseLabeledStatement(node,maybeName,expr){for(var i=0;i<labels.length;++i)if(labels[i].name===maybeName)raise(expr.start,"Label '"+maybeName+"' is already declared");var kind=tokType.isLoop?"loop":tokType===_switch?"switch":null;labels.push({name:maybeName,kind:kind});node.body=parseStatement();labels.pop();node.label=expr;return finishNode(node,"LabeledStatement")}function parseExpressionStatement(node,expr){node.expression=expr;semicolon();return finishNode(node,"ExpressionStatement")}function parseParenExpression(){expect(_parenL);var val=parseExpression();expect(_parenR);return val}function parseBlock(allowStrict){var node=startNode(),first=true,oldStrict;node.body=[];expect(_braceL);while(!eat(_braceR)){var stmt=parseStatement();node.body.push(stmt);if(first&&allowStrict&&isUseStrict(stmt)){oldStrict=strict;setStrict(strict=true)}first=false}if(oldStrict===false)setStrict(false);return finishNode(node,"BlockStatement")}function parseFor(node,init){node.init=init;expect(_semi);node.test=tokType===_semi?null:parseExpression();expect(_semi);node.update=tokType===_parenR?null:parseExpression();expect(_parenR);node.body=parseStatement();labels.pop();return finishNode(node,"ForStatement")}function parseForIn(node,init){var type=tokType===_in?"ForInStatement":"ForOfStatement";next();node.left=init;node.right=parseExpression();expect(_parenR);node.body=parseStatement();labels.pop();return finishNode(node,type)}function parseVar(node,noIn,kind){node.declarations=[];node.kind=kind;for(;;){var decl=startNode();decl.id=options.ecmaVersion>=6?toAssignable(parseExprAtom()):parseIdent();checkLVal(decl.id,true);if(tokType===_colon){decl.id.typeAnnotation=parseTypeAnnotation();finishNode(decl.id,decl.id.type)}decl.init=eat(_eq)?parseExpression(true,noIn):kind===_const.keyword?unexpected():null;node.declarations.push(finishNode(decl,"VariableDeclarator"));if(!eat(_comma))break}return node}function parseExpression(noComma,noIn,isStatement){var start=storeCurrentPos();var expr=parseMaybeAssign(noIn,false,isStatement);if(!noComma&&tokType===_comma){var node=startNodeAt(start);node.expressions=[expr];while(eat(_comma))node.expressions.push(parseMaybeAssign(noIn));return finishNode(node,"SequenceExpression")}return expr}function parseMaybeAssign(noIn,noLess,isStatement){var start=storeCurrentPos();var left=parseMaybeConditional(noIn,noLess,isStatement);if(tokType.isAssign){var node=startNodeAt(start);node.operator=tokVal;node.left=tokType===_eq?toAssignable(left):left;checkLVal(left);next();node.right=parseMaybeAssign(noIn);return finishNode(node,"AssignmentExpression")}return left}function parseMaybeConditional(noIn,noLess,isStatement){var start=storeCurrentPos();var expr=parseExprOps(noIn,noLess,isStatement);if(eat(_question)){var node=startNodeAt(start);if(eat(_eq)){var left=node.left=toAssignable(expr);if(left.type!=="MemberExpression")raise(left.start,"You can only use member expressions in memoization assignment");node.right=parseMaybeAssign(noIn);node.operator="?=";return finishNode(node,"AssignmentExpression")}node.test=expr;node.consequent=parseExpression(true);expect(_colon);node.alternate=parseExpression(true,noIn);return finishNode(node,"ConditionalExpression")}return expr}function parseExprOps(noIn,noLess,isStatement){var start=storeCurrentPos();return parseExprOp(parseMaybeUnary(isStatement),start,-1,noIn,noLess)}function parseExprOp(left,leftStart,minPrec,noIn,noLess){var prec=tokType.binop;if(prec!=null&&(!noIn||tokType!==_in)&&(!noLess||tokType!==_lt)){if(prec>minPrec){var node=startNodeAt(leftStart);node.left=left;node.operator=tokVal;var op=tokType;next();var start=storeCurrentPos();node.right=parseExprOp(parseMaybeUnary(),start,prec,noIn);finishNode(node,op===_logicalOR||op===_logicalAND?"LogicalExpression":"BinaryExpression");return parseExprOp(node,leftStart,minPrec,noIn)}}return left}function parseMaybeUnary(isStatement){if(tokType.prefix){var node=startNode(),update=tokType.isUpdate,nodeType;if(tokType===_ellipsis){nodeType="SpreadElement"}else{nodeType=update?"UpdateExpression":"UnaryExpression";node.operator=tokVal;node.prefix=true}tokRegexpAllowed=true;next();node.argument=parseMaybeUnary();if(update)checkLVal(node.argument);else if(strict&&node.operator==="delete"&&node.argument.type==="Identifier")raise(node.start,"Deleting local variable in strict mode");return finishNode(node,nodeType)}var start=storeCurrentPos();var expr=parseExprSubscripts(isStatement);while(tokType.postfix&&!canInsertSemicolon()){var node=startNodeAt(start);node.operator=tokVal;node.prefix=false;node.argument=expr;checkLVal(expr);next();expr=finishNode(node,"UpdateExpression")}return expr}function parseExprSubscripts(isStatement){var start=storeCurrentPos();return parseSubscripts(parseExprAtom(isStatement),start)}function parseSubscripts(base,start,noCalls){if(options.playground&&eat(_hash)){var node=startNodeAt(start);node.object=base;node.property=parseIdent(true);if(eat(_parenL)){node.arguments=parseExprList(_parenR,false)}else{node.arguments=[]}return parseSubscripts(finishNode(node,"BindMemberExpression"),start,noCalls)}else if(eat(_paamayimNekudotayim)){var node=startNodeAt(start);node.object=base;node.property=parseIdent(true);return parseSubscripts(finishNode(node,"VirtualPropertyExpression"),start,noCalls)}else if(eat(_dot)){var node=startNodeAt(start);node.object=base;node.property=parseIdent(true);node.computed=false;return parseSubscripts(finishNode(node,"MemberExpression"),start,noCalls)}else if(eat(_bracketL)){var node=startNodeAt(start);node.object=base;node.property=parseExpression();node.computed=true;expect(_bracketR);return parseSubscripts(finishNode(node,"MemberExpression"),start,noCalls)}else if(!noCalls&&eat(_parenL)){var node=startNodeAt(start);node.callee=base;node.arguments=parseExprList(_parenR,false);return parseSubscripts(finishNode(node,"CallExpression"),start,noCalls)}else if(tokType===_template){var node=startNodeAt(start);node.tag=base;node.quasi=parseTemplate();return parseSubscripts(finishNode(node,"TaggedTemplateExpression"),start,noCalls)}return base}function parseExprAtom(isStatement){switch(tokType){case _this:var node=startNode();next();return finishNode(node,"ThisExpression");case _at:var start=storeCurrentPos();var node=startNode();var thisNode=startNode();next();node.object=finishNode(thisNode,"ThisExpression");node.property=parseSubscripts(parseIdent(),start);node.computed=false;return finishNode(node,"MemberExpression");case _yield:if(inGenerator)return parseYield();case _name:var start=storeCurrentPos();var node=startNode();var id=parseIdent(tokType!==_name);if(options.ecmaVersion>=7){if(id.name==="async"){if(tokType===_parenL){next();var oldParenL=++metParenL;if(tokType!==_parenR){val=parseExpression();exprList=val.type==="SequenceExpression"?val.expressions:[val]}else{exprList=[]}expect(_parenR);if(metParenL===oldParenL&&eat(_arrow)){return parseArrowExpression(node,exprList,true)}else{node.callee=id;node.arguments=exprList;return parseSubscripts(finishNode(node,"CallExpression"),start)}}else if(tokType===_name){id=parseIdent();if(eat(_arrow)){return parseArrowExpression(node,[id],true)}return id}if(tokType===_function){next();return parseFunction(node,isStatement,true)}}else if(id.name==="await"){if(inAsync)return parseAwait(node)}}if(eat(_arrow)){return parseArrowExpression(node,[id])}return id;case _regexp:var node=startNode();node.regex={pattern:tokVal.pattern,flags:tokVal.flags};node.value=tokVal.value;node.raw=input.slice(tokStart,tokEnd);next();return finishNode(node,"Literal");case _num:case _string:case _xjsText:var node=startNode();node.value=tokVal;node.raw=input.slice(tokStart,tokEnd);next();return finishNode(node,"Literal");case _null:case _true:case _false:var node=startNode();node.value=tokType.atomValue;node.raw=tokType.keyword;next();return finishNode(node,"Literal");case _parenL:var start=storeCurrentPos();var val,exprList;next();if(options.ecmaVersion>=7&&tokType===_for){val=parseComprehension(startNodeAt(start),true)}else{var oldParenL=++metParenL;if(tokType!==_parenR){val=parseExpression();exprList=val.type==="SequenceExpression"?val.expressions:[val]}else{exprList=[]}expect(_parenR);if(metParenL===oldParenL&&eat(_arrow)){val=parseArrowExpression(startNodeAt(start),exprList)}else{if(!val)unexpected(lastStart);if(options.ecmaVersion>=6){for(var i=0;i<exprList.length;i++){if(exprList[i].type==="SpreadElement")unexpected()}}if(options.preserveParens){var par=startNodeAt(start);par.expression=val;val=finishNode(par,"ParenthesizedExpression")}}}return val;case _bracketL:var node=startNode();next();if(options.ecmaVersion>=7&&tokType===_for){return parseComprehension(node,false)}node.elements=parseExprList(_bracketR,true,true);return finishNode(node,"ArrayExpression");case _braceL:return parseObj();case _function:var node=startNode();next();return parseFunction(node,false,false);case _class:return parseClass(startNode(),false);case _new:return parseNew();case _template:return parseTemplate();case _lt:return parseXJSElement();case _hash:return parseBindFunctionExpression();default:unexpected()}}function parseBindFunctionExpression(){var node=startNode();next();var start=storeCurrentPos();node.callee=parseSubscripts(parseExprAtom(),start,true);if(eat(_parenL)){node.arguments=parseExprList(_parenR,false)}else{node.arguments=[]}return finishNode(node,"BindFunctionExpression")}function parseNew(){var node=startNode();next();var start=storeCurrentPos();node.callee=parseSubscripts(parseExprAtom(),start,true);if(eat(_parenL))node.arguments=parseExprList(_parenR,false);else node.arguments=empty;return finishNode(node,"NewExpression")}function parseTemplateElement(){var elem=startNodeAt(options.locations?[tokStart+1,tokStartLoc.offset(1)]:tokStart+1);elem.value=tokVal;elem.tail=input.charCodeAt(tokEnd-1)!==123;next();var endOff=elem.tail?1:2;return finishNodeAt(elem,"TemplateElement",options.locations?[lastEnd-endOff,lastEndLoc.offset(-endOff)]:lastEnd-endOff)}function parseTemplate(){var node=startNode();node.expressions=[];var curElt=parseTemplateElement();node.quasis=[curElt];while(!curElt.tail){node.expressions.push(parseExpression());if(tokType!==_templateContinued)unexpected();node.quasis.push(curElt=parseTemplateElement())}return finishNode(node,"TemplateLiteral")}function parseObj(){var node=startNode(),first=true,propHash={};node.properties=[];next();while(!eat(_braceR)){if(!first){expect(_comma);if(options.allowTrailingCommas&&eat(_braceR))break}else first=false;var prop=startNode(),isGenerator=false,isAsync=false;if(options.ecmaVersion>=7&&tokType===_ellipsis){prop=parseMaybeUnary();prop.type="SpreadProperty";node.properties.push(prop);continue}if(options.ecmaVersion>=6){prop.method=false;prop.shorthand=false;isGenerator=eat(_star)}if(options.ecmaVersion>=7&&tokType===_name&&tokVal==="async"){var asyncId=parseIdent();if(tokType===_colon||tokType===_parenL){prop.key=asyncId}else{isAsync=true;parsePropertyName(prop)}}else{parsePropertyName(prop)}var typeParameters;if(tokType===_lt){typeParameters=parseTypeParameterDeclaration();if(tokType!==_parenL)unexpected()}if(eat(_colon)){prop.value=parseExpression(true);prop.kind="init"}else if(options.ecmaVersion>=6&&tokType===_parenL){prop.kind="init";prop.method=true;prop.value=parseMethod(isGenerator,isAsync)}else if(options.ecmaVersion>=5&&!prop.computed&&prop.key.type==="Identifier"&&(prop.key.name==="get"||prop.key.name==="set"||options.playground&&prop.key.name==="memo")&&(tokType!=_comma&&tokType!=_braceR)){if(isGenerator||isAsync)unexpected();prop.kind=prop.key.name;parsePropertyName(prop);prop.value=parseMethod(false,false)}else if(options.ecmaVersion>=6&&!prop.computed&&prop.key.type==="Identifier"){prop.kind="init";prop.value=prop.key;prop.shorthand=true}else unexpected();prop.value.typeParameters=typeParameters;checkPropClash(prop,propHash);node.properties.push(finishNode(prop,"Property"))}return finishNode(node,"ObjectExpression")}function parsePropertyName(prop){if(options.ecmaVersion>=6){if(eat(_bracketL)){prop.computed=true;prop.key=parseExpression();expect(_bracketR);return}else{prop.computed=false}}prop.key=tokType===_num||tokType===_string?parseExprAtom():parseIdent(true)}function initFunction(node,isAsync){node.id=null;node.params=[];if(options.ecmaVersion>=6){node.defaults=[];node.rest=null;node.generator=false}if(options.ecmaVersion>=7){node.async=isAsync}}function parseFunction(node,isStatement,isAsync,allowExpressionBody){initFunction(node,isAsync);if(options.ecmaVersion>=6){node.generator=eat(_star)}if(isStatement||tokType===_name){node.id=parseIdent()}if(tokType===_lt){node.typeParameters=parseTypeParameterDeclaration()}parseFunctionParams(node);parseFunctionBody(node,allowExpressionBody);return finishNode(node,isStatement?"FunctionDeclaration":"FunctionExpression")}function parseMethod(isGenerator,isAsync){var node=startNode();initFunction(node,isAsync);parseFunctionParams(node);var allowExpressionBody;if(options.ecmaVersion>=6){node.generator=isGenerator;allowExpressionBody=true}else{allowExpressionBody=false}parseFunctionBody(node,allowExpressionBody);return finishNode(node,"FunctionExpression")}function parseArrowExpression(node,params,isAsync){initFunction(node,isAsync);var defaults=node.defaults,hasDefaults=false;for(var i=0,lastI=params.length-1;i<=lastI;i++){var param=params[i];if(param.type==="AssignmentExpression"&¶m.operator==="="){hasDefaults=true;params[i]=param.left;defaults.push(param.right)}else{toAssignable(param,i===lastI,true);defaults.push(null);if(param.type==="SpreadElement"){params.length--;node.rest=param.argument;break}}}node.params=params;if(!hasDefaults)node.defaults=[];parseFunctionBody(node,true);return finishNode(node,"ArrowFunctionExpression")}function parseFunctionParams(node){var defaults=[],hasDefaults=false;expect(_parenL);for(;;){if(eat(_parenR)){break}else if(options.ecmaVersion>=6&&eat(_ellipsis)){node.rest=toAssignable(parseExprAtom(),false,true);checkSpreadAssign(node.rest);parseFunctionParam(node.rest);expect(_parenR);defaults.push(null);break}else{var param=options.ecmaVersion>=6?toAssignable(parseExprAtom(),false,true):parseIdent();parseFunctionParam(param);node.params.push(param);if(options.ecmaVersion>=6){if(eat(_eq)){hasDefaults=true;defaults.push(parseExpression(true))}else{defaults.push(null)}}if(!eat(_comma)){expect(_parenR);break}}}if(hasDefaults)node.defaults=defaults;if(tokType===_colon){node.returnType=parseTypeAnnotation()}}function parseFunctionParam(param){if(tokType===_colon){param.typeAnnotation=parseTypeAnnotation()}else if(eat(_question)){param.optional=true}finishNode(param,param.type)}function parseFunctionBody(node,allowExpression){var isExpression=allowExpression&&tokType!==_braceL;var oldInAsync=inAsync;inAsync=node.async;if(isExpression){node.body=parseExpression(true);node.expression=true}else{var oldInFunc=inFunction,oldInGen=inGenerator,oldLabels=labels;inFunction=true;inGenerator=node.generator;labels=[];node.body=parseBlock(true);node.expression=false;inFunction=oldInFunc;inGenerator=oldInGen;labels=oldLabels}inAsync=oldInAsync;if(strict||!isExpression&&node.body.body.length&&isUseStrict(node.body.body[0])){var nameHash={};if(node.id)checkFunctionParam(node.id,{});for(var i=0;i<node.params.length;i++)checkFunctionParam(node.params[i],nameHash);if(node.rest)checkFunctionParam(node.rest,nameHash)}}function parsePrivate(node){node.declarations=[];do{node.declarations.push(parseIdent())}while(eat(_comma));semicolon();return finishNode(node,"PrivateDeclaration")}function parseClass(node,isStatement){next();node.id=tokType===_name?parseIdent():isStatement?unexpected():null;if(tokType===_lt){node.typeParameters=parseTypeParameterDeclaration()}node.superClass=eat(_extends)?parseMaybeAssign(false,true):null;if(node.superClass&&tokType===_lt){node.superTypeParameters=parseTypeParameterInstantiation()}if(tokType===_name&&tokVal==="implements"){next();node.implements=parseClassImplements()}var classBody=startNode();classBody.body=[];expect(_braceL);while(!eat(_braceR)){if(eat(_semi)){continue}var method=startNode();if(options.ecmaVersion>=7&&tokType===_name&&tokVal==="private"){next();classBody.body.push(parsePrivate(method));continue}if(tokType===_name&&tokVal==="static"){next();method["static"]=true}else{method["static"]=false}var isAsync=false;var isGenerator=eat(_star);if(options.ecmaVersion>=7&&!isGenerator&&tokType===_name&&tokVal==="async"){var asyncId=parseIdent();if(tokType===_colon||tokType===_parenL){method.key=asyncId}else{isAsync=true;parsePropertyName(method)}}else{parsePropertyName(method)}if(tokType!==_parenL&&!method.computed&&method.key.type==="Identifier"&&(method.key.name==="get"||method.key.name==="set"||options.playground&&method.key.name==="memo")){if(isGenerator||isAsync)unexpected();method.kind=method.key.name;parsePropertyName(method)}else{method.kind=""}if(tokType===_colon){if(isGenerator||isAsync)unexpected();method.typeAnnotation=parseTypeAnnotation();semicolon();classBody.body.push(finishNode(method,"ClassProperty"))}else{var typeParameters;if(tokType===_lt){typeParameters=parseTypeParameterDeclaration()}method.value=parseMethod(isGenerator,isAsync);method.value.typeParameters=typeParameters;classBody.body.push(finishNode(method,"MethodDefinition"));eat(_semi)}}node.body=finishNode(classBody,"ClassBody");return finishNode(node,isStatement?"ClassDeclaration":"ClassExpression")}function parseClassImplements(){var implemented=[];do{var node=startNode();node.id=parseIdent();if(tokType===_lt){node.typeParameters=parseTypeParameterInstantiation()}else{node.typeParameters=null}implemented.push(finishNode(node,"ClassImplements"))}while(eat(_comma));return implemented}function parseExprList(close,allowTrailingComma,allowEmpty){var elts=[],first=true;while(!eat(close)){if(!first){expect(_comma);if(allowTrailingComma&&options.allowTrailingCommas&&eat(close))break}else first=false;if(allowEmpty&&tokType===_comma)elts.push(null);else elts.push(parseExpression(true))}return elts}function parseIdent(liberal){var node=startNode();if(liberal&&options.forbidReserved=="everywhere")liberal=false;if(tokType===_name){if(!liberal&&(options.forbidReserved&&(options.ecmaVersion===3?isReservedWord3:isReservedWord5)(tokVal)||strict&&isStrictReservedWord(tokVal))&&input.slice(tokStart,tokEnd).indexOf("\\")==-1)raise(tokStart,"The keyword '"+tokVal+"' is reserved");node.name=tokVal}else if(liberal&&tokType.keyword){node.name=tokType.keyword}else{unexpected()}tokRegexpAllowed=false;next();return finishNode(node,"Identifier")}function parseExport(node){next();if(tokType===_var||tokType===_const||tokType===_let||tokType===_function||tokType===_class||tokType===_name&&tokVal==="async"){node.declaration=parseStatement();node["default"]=false;node.specifiers=null;node.source=null}else if(eat(_default)){var declar=node.declaration=parseExpression(true);if(declar.id){if(declar.type==="FunctionExpression"){declar.type="FunctionDeclaration"}else if(declar.type==="ClassExpression"){declar.type="ClassDeclaration"}}node["default"]=true;node.specifiers=null;node.source=null;semicolon()}else{var isBatch=tokType===_star;node.declaration=null;node["default"]=false;node.specifiers=parseExportSpecifiers();if(tokType===_name&&tokVal==="from"){next();node.source=tokType===_string?parseExprAtom():unexpected()}else{if(isBatch)unexpected();node.source=null}semicolon()}return finishNode(node,"ExportDeclaration")}function parseExportSpecifiers(){var nodes=[],first=true;if(tokType===_star){var node=startNode();next();nodes.push(finishNode(node,"ExportBatchSpecifier"))}else{expect(_braceL);while(!eat(_braceR)){if(!first){expect(_comma);if(options.allowTrailingCommas&&eat(_braceR))break}else first=false;var node=startNode();node.id=parseIdent(tokType===_default);if(tokType===_name&&tokVal==="as"){next();node.name=parseIdent(true)}else{node.name=null}nodes.push(finishNode(node,"ExportSpecifier"))}}return nodes}function parseImport(node){next();if(tokType===_string){node.specifiers=[];node.source=parseExprAtom()}else{node.specifiers=parseImportSpecifiers();if(tokType!==_name||tokVal!=="from")unexpected();next();node.source=tokType===_string?parseExprAtom():unexpected()}semicolon();return finishNode(node,"ImportDeclaration")}function parseImportSpecifiers(){var nodes=[],first=true;if(tokType===_name){var node=startNode();node.id=startNode();node.name=parseIdent();checkLVal(node.name,true);node.id.name="default";finishNode(node.id,"Identifier");nodes.push(finishNode(node,"ImportSpecifier"));if(!eat(_comma))return nodes}if(tokType===_star){var node=startNode();next();if(tokType!==_name||tokVal!=="as")unexpected();next();node.name=parseIdent();checkLVal(node.name,true);nodes.push(finishNode(node,"ImportBatchSpecifier"));return nodes}expect(_braceL);while(!eat(_braceR)){if(!first){expect(_comma);if(options.allowTrailingCommas&&eat(_braceR))break}else first=false;var node=startNode();node.id=parseIdent(true);if(tokType===_name&&tokVal==="as"){next();node.name=parseIdent()}else{node.name=null}checkLVal(node.name||node.id,true);node["default"]=false;nodes.push(finishNode(node,"ImportSpecifier"))}return nodes}function parseYield(){var node=startNode();next();if(eat(_semi)||canInsertSemicolon()){node.delegate=false;node.argument=null}else{node.delegate=eat(_star);node.argument=parseExpression(true)}return finishNode(node,"YieldExpression")}function parseAwait(node){if(eat(_semi)||canInsertSemicolon()){unexpected()}node.delegate=eat(_star);node.argument=parseExpression(true);return finishNode(node,"AwaitExpression")}function parseComprehension(node,isGenerator){node.blocks=[];while(tokType===_for){var block=startNode();next();expect(_parenL);block.left=toAssignable(parseExprAtom());checkLVal(block.left,true);if(tokType!==_name||tokVal!=="of")unexpected();next();block.of=true;block.right=parseExpression();expect(_parenR);node.blocks.push(finishNode(block,"ComprehensionBlock"))}node.filter=eat(_if)?parseParenExpression():null;node.body=parseExpression();expect(isGenerator?_parenR:_bracketR);node.generator=isGenerator;return finishNode(node,"ComprehensionExpression")}function getQualifiedXJSName(object){if(object.type==="XJSIdentifier"){return object.name}if(object.type==="XJSNamespacedName"){return object.namespace.name+":"+object.name.name}if(object.type==="XJSMemberExpression"){return getQualifiedXJSName(object.object)+"."+getQualifiedXJSName(object.property)}}function parseXJSIdentifier(){var node=startNode();if(tokType===_xjsName){node.name=tokVal}else if(tokType.keyword){node.name=tokType.keyword}else{unexpected()}tokRegexpAllowed=false;next();return finishNode(node,"XJSIdentifier")}function parseXJSNamespacedName(){var node=startNode();node.namespace=parseXJSIdentifier();expect(_colon);node.name=parseXJSIdentifier();return finishNode(node,"XJSNamespacedName")}function parseXJSMemberExpression(){var start=storeCurrentPos();var node=parseXJSIdentifier();while(eat(_dot)){var newNode=startNodeAt(start);newNode.object=node;newNode.property=parseXJSIdentifier();node=finishNode(newNode,"XJSMemberExpression")}return node}function parseXJSElementName(){switch(nextChar()){case":":return parseXJSNamespacedName();case".":return parseXJSMemberExpression();default:return parseXJSIdentifier()}}function parseXJSAttributeName(){if(nextChar()===":"){return parseXJSNamespacedName()}return parseXJSIdentifier()}function parseXJSAttributeValue(){switch(tokType){case _braceL:var node=parseXJSExpressionContainer();if(node.expression.type==="XJSEmptyExpression"){raise(node.start,"XJS attributes must only be assigned a non-empty "+"expression")
}return node;case _lt:return parseXJSElement();case _xjsText:return parseExprAtom();default:raise(tokStart,"XJS value should be either an expression or a quoted XJS text")}}function parseXJSEmptyExpression(){if(tokType!==_braceR){unexpected()}var tmp;tmp=tokStart;tokStart=lastEnd;lastEnd=tmp;tmp=tokStartLoc;tokStartLoc=lastEndLoc;lastEndLoc=tmp;return finishNode(startNode(),"XJSEmptyExpression")}function parseXJSExpressionContainer(){var node=startNode();var origInXJSTag=inXJSTag,origInXJSChild=inXJSChild;inXJSTag=false;inXJSChild=false;next();node.expression=tokType===_braceR?parseXJSEmptyExpression():parseExpression();inXJSTag=origInXJSTag;inXJSChild=origInXJSChild;if(inXJSChild){tokPos=tokEnd}expect(_braceR);return finishNode(node,"XJSExpressionContainer")}function parseXJSAttribute(){if(tokType===_braceL){var tokStart1=tokStart,tokStartLoc1=tokStartLoc;var origInXJSTag=inXJSTag;inXJSTag=false;next();if(tokType!==_ellipsis)unexpected();var node=parseMaybeUnary();inXJSTag=origInXJSTag;expect(_braceR);node.type="XJSSpreadAttribute";node.start=tokStart1;node.end=lastEnd;if(options.locations){node.loc.start=tokStartLoc1;node.loc.end=lastEndLoc}if(options.ranges){node.range=[tokStart1,lastEnd]}return node}var node=startNode();node.name=parseXJSAttributeName();if(tokType===_eq){next();node.value=parseXJSAttributeValue()}else{node.value=null}return finishNode(node,"XJSAttribute")}function parseXJSChild(){switch(tokType){case _braceL:return parseXJSExpressionContainer();case _xjsText:return parseExprAtom();default:return parseXJSElement()}}function parseXJSOpeningElement(){var node=startNode(),attributes=node.attributes=[];var origInXJSChild=inXJSChild;var origInXJSTag=inXJSTag;inXJSChild=false;inXJSTag=true;next();node.name=parseXJSElementName();while(tokType!==_eof&&tokType!==_slash&&tokType!==_gt){attributes.push(parseXJSAttribute())}inXJSTag=false;if(node.selfClosing=!!eat(_slash)){inXJSTag=origInXJSTag;inXJSChild=origInXJSChild}else{inXJSChild=true}expect(_gt);return finishNode(node,"XJSOpeningElement")}function parseXJSClosingElement(){var node=startNode();var origInXJSChild=inXJSChild;var origInXJSTag=inXJSTag;inXJSChild=false;inXJSTag=true;tokRegexpAllowed=false;expect(_ltSlash);node.name=parseXJSElementName();skipSpace();inXJSChild=origInXJSChild;inXJSTag=origInXJSTag;tokRegexpAllowed=false;if(inXJSChild){tokPos=tokEnd}expect(_gt);return finishNode(node,"XJSClosingElement")}function parseXJSElement(){var node=startNode();var children=[];var origInXJSChild=inXJSChild;var openingElement=parseXJSOpeningElement();var closingElement=null;if(!openingElement.selfClosing){while(tokType!==_eof&&tokType!==_ltSlash){inXJSChild=true;children.push(parseXJSChild())}inXJSChild=origInXJSChild;closingElement=parseXJSClosingElement();if(getQualifiedXJSName(closingElement.name)!==getQualifiedXJSName(openingElement.name)){raise(closingElement.start,"Expected corresponding XJS closing tag for '"+getQualifiedXJSName(openingElement.name)+"'")}}if(!origInXJSChild&&tokType===_lt){raise(tokStart,"Adjacent XJS elements must be wrapped in an enclosing tag")}node.openingElement=openingElement;node.closingElement=closingElement;node.children=children;return finishNode(node,"XJSElement")}function parseDeclareClass(node){next();parseInterfaceish(node,true);return finishNode(node,"DeclareClass")}function parseDeclareFunction(node){next();var id=node.id=parseIdent();var typeNode=startNode();var typeContainer=startNode();if(tokType===_lt){typeNode.typeParameters=parseTypeParameterDeclaration()}else{typeNode.typeParameters=null}expect(_parenL);var tmp=parseFunctionTypeParams();typeNode.params=tmp.params;typeNode.rest=tmp.rest;expect(_parenR);expect(_colon);typeNode.returnType=parseType();typeContainer.typeAnnotation=finishNode(typeNode,"FunctionTypeAnnotation");id.typeAnnotation=finishNode(typeContainer,"TypeAnnotation");finishNode(id,id.type);semicolon();return finishNode(node,"DeclareFunction")}function parseDeclare(node){if(tokType===_class){return parseDeclareClass(node)}else if(tokType===_function){return parseDeclareFunction(node)}else if(tokType===_var){return parseDeclareVariable(node)}else if(tokType===_name&&tokVal==="module"){return parseDeclareModule(node)}else{unexpected()}}function parseDeclareVariable(node){next();node.id=parseTypeAnnotatableIdentifier();semicolon();return finishNode(node,"DeclareVariable")}function parseDeclareModule(node){next();if(tokType===_string){node.id=parseExprAtom()}else{node.id=parseIdent()}var bodyNode=node.body=startNode();var body=bodyNode.body=[];expect(_braceL);while(tokType!==_braceR){var node2=startNode();next();body.push(parseDeclare(node2))}expect(_braceR);finishNode(bodyNode,"BlockStatement");return finishNode(node,"DeclareModule")}function parseInterfaceish(node,allowStatic){node.id=parseIdent();if(tokType===_lt){node.typeParameters=parseTypeParameterDeclaration()}else{node.typeParameters=null}node.extends=[];if(eat(_extends)){do{node.extends.push(parseInterfaceExtends())}while(eat(_comma))}node.body=parseObjectType(allowStatic)}function parseInterfaceExtends(){var node=startNode();node.id=parseIdent();if(tokType===_lt){node.typeParameters=parseTypeParameterInstantiation()}else{node.typeParameters=null}return finishNode(node,"InterfaceExtends")}function parseInterface(node){parseInterfaceish(node,false);return finishNode(node,"InterfaceDeclaration")}function parseTypeAlias(node){node.id=parseIdent();if(tokType===_lt){node.typeParameters=parseTypeParameterDeclaration()}else{node.typeParameters=null}expect(_eq);node.right=parseType();semicolon();return finishNode(node,"TypeAlias")}function parseTypeParameterDeclaration(){var node=startNode();node.params=[];expect(_lt);while(tokType!==_gt){node.params.push(parseIdent());if(tokType!==_gt){expect(_comma)}}expect(_gt);return finishNode(node,"TypeParameterDeclaration")}function parseTypeParameterInstantiation(){var node=startNode(),oldInType=inType;node.params=[];inType=true;expect(_lt);while(tokType!==_gt){node.params.push(parseType());if(tokType!==_gt){expect(_comma)}}expect(_gt);inType=oldInType;return finishNode(node,"TypeParameterInstantiation")}function parseObjectPropertyKey(){return tokType===_num||tokType===_string?parseExprAtom():parseIdent(true)}function parseObjectTypeIndexer(node,isStatic){node.static=isStatic;expect(_bracketL);node.id=parseObjectPropertyKey();expect(_colon);node.key=parseType();expect(_bracketR);expect(_colon);node.value=parseType();return finishNode(node,"ObjectTypeIndexer")}function parseObjectTypeMethodish(node){node.params=[];node.rest=null;node.typeParameters=null;if(tokType===_lt){node.typeParameters=parseTypeParameterDeclaration()}expect(_parenL);while(tokType===_name){node.params.push(parseFunctionTypeParam());if(tokType!==_parenR){expect(_comma)}}if(eat(_ellipsis)){node.rest=parseFunctionTypeParam()}expect(_parenR);expect(_colon);node.returnType=parseType();return finishNode(node,"FunctionTypeAnnotation")}function parseObjectTypeMethod(start,isStatic,key){var node=startNodeAt(start);node.value=parseObjectTypeMethodish(startNodeAt(start));node.static=isStatic;node.key=key;node.optional=false;return finishNode(node,"ObjectTypeProperty")}function parseObjectTypeCallProperty(node,isStatic){var valueNode=startNode();node.static=isStatic;node.value=parseObjectTypeMethodish(valueNode);return finishNode(node,"ObjectTypeCallProperty")}function parseObjectType(allowStatic){var nodeStart=startNode();var node;var optional=false;var property;var propertyKey;var propertyTypeAnnotation;var token;var isStatic;nodeStart.callProperties=[];nodeStart.properties=[];nodeStart.indexers=[];expect(_braceL);while(tokType!==_braceR){var start=storeCurrentPos();node=startNode();if(allowStatic&&tokType===_name&&tokVal==="static"){next();isStatic=true}if(tokType===_bracketL){nodeStart.indexers.push(parseObjectTypeIndexer(node,isStatic))}else if(tokType===_parenL||tokType===_lt){nodeStart.callProperties.push(parseObjectTypeCallProperty(node,allowStatic))}else{if(isStatic&&tokType===_colon){propertyKey=parseIdent()}else{propertyKey=parseObjectPropertyKey()}if(tokType===_lt||tokType===_parenL){nodeStart.properties.push(parseObjectTypeMethod(start,isStatic,propertyKey))}else{if(eat(_question)){optional=true}expect(_colon);node.key=propertyKey;node.value=parseType();node.optional=optional;node.static=isStatic;nodeStart.properties.push(finishNode(node,"ObjectTypeProperty"))}}if(!eat(_semi)&&tokType!==_braceR){unexpected()}}expect(_braceR);return finishNode(nodeStart,"ObjectTypeAnnotation")}function parseGenericType(start,id){var node=startNodeAt(start);node.typeParameters=null;node.id=id;while(eat(_dot)){var node2=startNodeAt(start);node2.qualification=node.id;node2.id=parseIdent();node.id=finishNode(node2,"QualifiedTypeIdentifier")}if(tokType===_lt){node.typeParameters=parseTypeParameterInstantiation()}return finishNode(node,"GenericTypeAnnotation")}function parseVoidType(){var node=startNode();expect(keywordTypes["void"]);return finishNode(node,"VoidTypeAnnotation")}function parseTypeofType(){var node=startNode();expect(keywordTypes["typeof"]);node.argument=parsePrimaryType();return finishNode(node,"TypeofTypeAnnotation")}function parseTupleType(){var node=startNode();node.types=[];expect(_bracketL);while(tokPos<inputLen&&tokType!==_bracketR){node.types.push(parseType());if(tokType===_bracketR)break;expect(_comma)}expect(_bracketR);return finishNode(node,"TupleTypeAnnotation")}function parseFunctionTypeParam(){var optional=false;var node=startNode();node.name=parseIdent();if(eat(_question)){optional=true}expect(_colon);node.optional=optional;node.typeAnnotation=parseType();return finishNode(node,"FunctionTypeParam")}function parseFunctionTypeParams(){var ret={params:[],rest:null};while(tokType===_name){ret.params.push(parseFunctionTypeParam());if(tokType!==_parenR){expect(_comma)}}if(eat(_ellipsis)){ret.rest=parseFunctionTypeParam()}return ret}function identToTypeAnnotation(start,node,id){switch(id.name){case"any":return finishNode(node,"AnyTypeAnnotation");case"bool":case"boolean":return finishNode(node,"BooleanTypeAnnotation");case"number":return finishNode(node,"NumberTypeAnnotation");case"string":return finishNode(node,"StringTypeAnnotation");default:return parseGenericType(start,id)}}function parsePrimaryType(){var typeIdentifier=null;var params=null;var returnType=null;var start=storeCurrentPos();var node=startNode();var rest=null;var tmp;var typeParameters;var token;var type;var isGroupedType=false;switch(tokType){case _name:return identToTypeAnnotation(start,node,parseIdent());case _braceL:return parseObjectType();case _bracketL:return parseTupleType();case _lt:node.typeParameters=parseTypeParameterDeclaration();expect(_parenL);tmp=parseFunctionTypeParams();node.params=tmp.params;node.rest=tmp.rest;expect(_parenR);expect(_arrow);node.returnType=parseType();return finishNode(node,"FunctionTypeAnnotation");case _parenL:next();var tmpId;if(tokType!==_parenR&&tokType!==_ellipsis){if(tokType===_name){}else{isGroupedType=true}}if(isGroupedType){if(tmpId&&_parenR){type=tmpId}else{type=parseType();expect(_parenR)}if(eat(_arrow)){raise(node,"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 type}tmp=parseFunctionTypeParams();node.params=tmp.params;node.rest=tmp.rest;expect(_parenR);expect(_arrow);node.returnType=parseType();node.typeParameters=null;return finishNode(node,"FunctionTypeAnnotation");case _string:node.value=tokVal;node.raw=input.slice(tokStart,tokEnd);next();return finishNode(node,"StringLiteralTypeAnnotation");default:if(tokType.keyword){switch(tokType.keyword){case"void":return parseVoidType();case"typeof":return parseTypeofType()}}}unexpected()}function parsePostfixType(){var node=startNode();var type=node.elementType=parsePrimaryType();if(tokType===_bracketL){expect(_bracketL);expect(_bracketR);return finishNode(node,"ArrayTypeAnnotation")}return type}function parsePrefixType(){var node=startNode();if(eat(_question)){node.typeAnnotation=parsePrefixType();return finishNode(node,"NullableTypeAnnotation")}return parsePostfixType()}function parseIntersectionType(){var node=startNode();var type=parsePrefixType();node.types=[type];while(eat(_bitwiseAND)){node.types.push(parsePrefixType())}return node.types.length===1?type:finishNode(node,"IntersectionTypeAnnotation")}function parseUnionType(){var node=startNode();var type=parseIntersectionType();node.types=[type];while(eat(_bitwiseOR)){node.types.push(parseIntersectionType())}return node.types.length===1?type:finishNode(node,"UnionTypeAnnotation")}function parseType(){var oldInType=inType;inType=true;var type=parseUnionType();inType=oldInType;return type}function parseTypeAnnotation(){var node=startNode();expect(_colon);node.typeAnnotation=parseType();return finishNode(node,"TypeAnnotation")}function parseTypeAnnotatableIdentifier(requireTypeAnnotation,canBeOptionalParam){var node=startNode();var ident=parseIdent();var isOptionalParam=false;if(canBeOptionalParam&&eat(_question)){expect(_question);isOptionalParam=true}if(requireTypeAnnotation||tokType===_colon){ident.typeAnnotation=parseTypeAnnotation();finishNode(ident,ident.type)}if(isOptionalParam){ident.optional=true;finishNode(ident,ident.type)}return ident}})},{}],2:[function(require,module,exports){(function(global){var transform=module.exports=require("./transformation/transform");transform.transform=transform;transform.run=function(code,opts){opts=opts||{};opts.sourceMap="inline";return new Function(transform(code,opts).code)()};transform.load=function(url,callback,opts,hold){opts=opts||{};opts.filename=opts.filename||url;var xhr=global.ActiveXObject?new global.ActiveXObject("Microsoft.XMLHTTP"):new global.XMLHttpRequest;xhr.open("GET",url,true);if("overrideMimeType"in xhr)xhr.overrideMimeType("text/plain");xhr.onreadystatechange=function(){if(xhr.readyState!==4)return;var status=xhr.status;if(status===0||status===200){var param=[xhr.responseText,opts];if(!hold)transform.run.apply(transform,param);if(callback)callback(param)}else{throw new Error("Could not load "+url)}};xhr.send(null)};var runScripts=function(){var scripts=[];var types=["text/ecmascript-6","text/6to5","module"];var index=0;var exec=function(){var param=scripts[index];if(param instanceof Array){transform.run.apply(transform,param);index++;exec()}};var run=function(script,i){var opts={};if(script.src){transform.load(script.src,function(param){scripts[i]=param;exec()},opts,true)}else{opts.filename="embedded";scripts[i]=[script.innerHTML,opts]}};var _scripts=global.document.getElementsByTagName("script");for(var i=0;i<_scripts.length;++i){var _script=_scripts[i];if(types.indexOf(_script.type)>=0)scripts.push(_script)}for(i in scripts){run(scripts[i],i)}exec()};if(global.addEventListener){global.addEventListener("DOMContentLoaded",runScripts,false)}else if(global.attachEvent){global.attachEvent("onload",runScripts)}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./transformation/transform":31}],3:[function(require,module,exports){module.exports=File;var SHEBANG_REGEX=/^\#\!.*/;var transform=require("./transformation/transform");var generate=require("./generation/generator");var Scope=require("./traverse/scope");var util=require("./util");var t=require("./types");var _=require("lodash");function File(opts){this.dynamicImports=[];this.opts=File.normaliseOptions(opts);this.transformers=this.getTransformers();this.uids={};this.ast={}}File.helpers=["inherits","defaults","prototype-properties","apply-constructor","tagged-template-literal","interop-require","to-array","sliced-to-array","object-without-properties","has-own","slice","define-property","async-to-generator"];File.excludeHelpersFromRuntime=["async-to-generator"];File.normaliseOptions=function(opts){opts=_.cloneDeep(opts||{});_.defaults(opts,{experimental:false,playground:false,whitespace:true,moduleIds:opts.amdModuleIds||false,blacklist:[],whitelist:[],sourceMap:false,optional:[],comments:true,filename:"unknown",modules:"common",runtime:false,code:true,ast:true});opts.filename=opts.filename.replace(/\\/g,"/");opts.blacklist=util.arrayify(opts.blacklist);opts.whitelist=util.arrayify(opts.whitelist);_.defaults(opts,{moduleRoot:opts.sourceRoot});_.defaults(opts,{sourceRoot:opts.moduleRoot});_.defaults(opts,{filenameRelative:opts.filename});_.defaults(opts,{sourceFileName:opts.filenameRelative,sourceMapName:opts.filenameRelative});if(opts.runtime===true){opts.runtime="to5Runtime"}if(opts.playground){opts.experimental=true}transform._ensureTransformerNames("blacklist",opts.blacklist);transform._ensureTransformerNames("whitelist",opts.whitelist);transform._ensureTransformerNames("optional",opts.optional);return opts};File.prototype.getTransformers=function(){var file=this;var transformers=[];var secondPassTransformers=[];_.each(transform.transformers,function(transformer){if(transformer.canRun(file)){transformers.push(transformer);if(transformer.secondPass){secondPassTransformers.push(transformer)}if(transformer.manipulateOptions){transformer.manipulateOptions(file.opts,file)}}});return transformers.concat(secondPassTransformers)};File.prototype.toArray=function(node,i){if(t.isArrayExpression(node)){return node}else if(t.isIdentifier(node)&&node.name==="arguments"){return t.callExpression(t.memberExpression(this.addHelper("slice"),t.identifier("call")),[node])}else{var declarationName="to-array";var args=[node];if(i){args.push(t.literal(i));declarationName="sliced-to-array"}return t.callExpression(this.addHelper(declarationName),args)}};File.prototype.getModuleFormatter=function(type){var ModuleFormatter=_.isFunction(type)?type:transform.moduleFormatters[type];if(!ModuleFormatter){var loc=util.resolve(type);if(loc)ModuleFormatter=require(loc)}if(!ModuleFormatter){throw new ReferenceError("Unknown module formatter type "+JSON.stringify(type))}return new ModuleFormatter(this)};File.prototype.parseShebang=function(code){var shebangMatch=code.match(SHEBANG_REGEX);if(shebangMatch){this.shebang=shebangMatch[0];code=code.replace(SHEBANG_REGEX,"")}return code};File.prototype.addImport=function(id,source){var specifiers=[t.importSpecifier(t.identifier("default"),id)];var declar=t.importDeclaration(specifiers,t.literal(source));declar._blockHoist=3;this.dynamicImports.push(declar)};File.prototype.addHelper=function(name){if(!_.contains(File.helpers,name)){throw new ReferenceError("unknown declaration "+name)}var program=this.ast.program;var declar=program._declarations&&program._declarations[name];if(declar)return declar.id;var ref;var runtimeNamespace=this.opts.runtime;if(runtimeNamespace&&!_.contains(File.excludeHelpersFromRuntime,name)){name=t.identifier(t.toIdentifier(name));return t.memberExpression(t.identifier(runtimeNamespace),name)}else{ref=util.template(name)}var uid=this.generateUidIdentifier(name);this.scope.push({key:name,id:uid,init:ref});return uid};File.prototype.errorWithNode=function(node,msg,Error){Error=Error||SyntaxError;var loc=node.loc.start;var err=new Error("Line "+loc.line+": "+msg);err.loc=loc;return err};File.prototype.addCode=function(code){code=(code||"")+"";this.code=code;return this.parseShebang(code)};File.prototype.parse=function(code){var self=this;code=this.addCode(code);return util.parse(this.opts,code,function(tree){self.transform(tree);return self.generate()})};File.prototype.transform=function(ast){var self=this;this.ast=ast;this.scope=new Scope(ast.program);this.moduleFormatter=this.getModuleFormatter(this.opts.modules);var astRun=function(key){_.each(self.transformers,function(transformer){transformer.astRun(self,key)})};astRun("enter");_.each(this.transformers,function(transformer){transformer.transform(self)});astRun("exit")};File.prototype.generate=function(){var opts=this.opts;var ast=this.ast;var result={code:"",map:null,ast:null};if(opts.ast)result.ast=ast;if(!opts.code)return result;var _result=generate(ast,opts,this.code);result.code=_result.code;result.map=_result.map;if(this.shebang){result.code=this.shebang+"\n"+result.code}if(opts.sourceMap==="inline"){result.code+="\n"+util.sourceMapToComment(result.map)}return result};File.prototype.generateUid=function(name,scope){name=t.toIdentifier(name);scope=scope||this.scope;var uid;do{uid=this._generateUid(name)}while(scope.has(uid));return uid};File.prototype.generateUidIdentifier=function(name,scope){return t.identifier(this.generateUid(name,scope))};File.prototype._generateUid=function(name){var uids=this.uids;var i=uids[name]||1;var id=name;if(i>1)id+=i;uids[name]=i+1;return"_"+id}},{"./generation/generator":5,"./transformation/transform":31,"./traverse/scope":74,"./types":77,"./util":79,lodash:127}],4:[function(require,module,exports){module.exports=Buffer;var util=require("../util");var _=require("lodash");function Buffer(position,format){this.position=position;this._indent=format.indent.base;this.format=format;this.buf=""}Buffer.prototype.get=function(){return util.trimRight(this.buf)};Buffer.prototype.getIndent=function(){if(this.format.compact){return""}else{return util.repeat(this._indent,this.format.indent.style)}};Buffer.prototype.indentSize=function(){return this.getIndent().length};Buffer.prototype.indent=function(){this._indent++};Buffer.prototype.dedent=function(){this._indent--};Buffer.prototype.semicolon=function(){this.push(";")};Buffer.prototype.ensureSemicolon=function(){if(!this.isLast(";"))this.semicolon()};Buffer.prototype.rightBrace=function(){this.newline(true);this.push("}")};Buffer.prototype.keyword=function(name){this.push(name);this.push(" ")};Buffer.prototype.space=function(){if(this.buf&&!this.isLast([" ","\n"])){this.push(" ")}};Buffer.prototype.removeLast=function(cha){if(!this.isLast(cha))return;this.buf=this.buf.slice(0,-1);this.position.unshift(cha)};Buffer.prototype.newline=function(i,removeLast){if(this.format.compact)return;if(_.isBoolean(i)){removeLast=i;i=null}if(_.isNumber(i)){if(this.endsWith("{\n"))i--;if(this.endsWith(util.repeat(i,"\n")))return;var self=this;_.times(i,function(){self.newline(null,removeLast)});return}if(removeLast&&this.isLast("\n"))this.removeLast("\n");this.removeLast(" ");this.buf=this.buf.replace(/\n +$/,"\n");this._push("\n")};Buffer.prototype.push=function(str,noIndent){if(this._indent&&!noIndent&&str!=="\n"){var indent=this.getIndent();str=str.replace(/\n/g,"\n"+indent);if(this.isLast("\n"))str=indent+str}this._push(str)};Buffer.prototype._push=function(str){this.position.push(str);this.buf+=str};Buffer.prototype.endsWith=function(str){return this.buf.slice(-str.length)===str};Buffer.prototype.isLast=function(cha,trimRight){var buf=this.buf;if(trimRight)buf=util.trimRight(buf);var chars=[].concat(cha);return _.contains(chars,_.last(buf))}},{"../util":79,lodash:127}],5:[function(require,module,exports){module.exports=function(ast,opts,code){var gen=new CodeGenerator(ast,opts,code);return gen.generate()};module.exports.CodeGenerator=CodeGenerator;var Whitespace=require("./whitespace");var SourceMap=require("./source-map");var Position=require("./position");var Buffer=require("./buffer");var util=require("../util");var n=require("./node");var t=require("../types");var _=require("lodash");function CodeGenerator(ast,opts,code){opts=opts||{};this.comments=ast.comments||[];this.tokens=ast.tokens||[];this.format=CodeGenerator.normaliseOptions(opts);this.ast=ast;this.whitespace=new Whitespace(this.tokens,this.comments);this.position=new Position;this.map=new SourceMap(this.position,opts,code);this.buffer=new Buffer(this.position,this.format)}_.each(Buffer.prototype,function(fn,key){CodeGenerator.prototype[key]=function(){return fn.apply(this.buffer,arguments)}});CodeGenerator.normaliseOptions=function(opts){return _.merge({parentheses:true,comments:opts.comments==null||opts.comments,compact:false,indent:{adjustMultilineComment:true,style:" ",base:0}},opts.format||{})};CodeGenerator.generators={templateLiterals:require("./generators/template-literals"),comprehensions:require("./generators/comprehensions"),expressions:require("./generators/expressions"),statements:require("./generators/statements"),playground:require("./generators/playground"),classes:require("./generators/classes"),methods:require("./generators/methods"),modules:require("./generators/modules"),types:require("./generators/types"),flow:require("./generators/flow"),base:require("./generators/base"),jsx:require("./generators/jsx")};_.each(CodeGenerator.generators,function(generator){_.extend(CodeGenerator.prototype,generator)});CodeGenerator.prototype.generate=function(){var ast=this.ast;this.print(ast);var comments=[];_.each(ast.comments,function(comment){if(!comment._displayed)comments.push(comment)});this._printComments(comments);return{map:this.map.get(),code:this.buffer.get()}};CodeGenerator.prototype.buildPrint=function(parent){var self=this;var print=function(node,opts){return self.print(node,parent,opts)};print.sequence=function(nodes,opts){opts=opts||{};opts.statement=true;return self.printJoin(print,nodes,opts)};print.join=function(nodes,opts){return self.printJoin(print,nodes,opts)};print.block=function(node){return self.printBlock(print,node)};print.indentOnComments=function(node){return self.printAndIndentOnComments(print,node)};return print};CodeGenerator.prototype.print=function(node,parent,opts){if(!node)return"";var self=this;opts=opts||{};var newline=function(leading){if(!opts.statement&&!n.isUserWhitespacable(node,parent)){return}var lines=0;if(node.start!=null){if(leading){lines=self.whitespace.getNewlinesBefore(node)}else{lines=self.whitespace.getNewlinesAfter(node)}}else{if(!leading)lines++;var needs=n.needsWhitespaceAfter;if(leading)needs=n.needsWhitespaceBefore;lines+=needs(node,parent);if(!self.buffer.get())lines=0}self.newline(lines)};if(this[node.type]){var needsCommentParens=t.isExpression(node)&&node.leadingComments&&node.leadingComments.length;var needsParens=needsCommentParens||n.needsParens(node,parent);if(needsParens)this.push("(");if(needsCommentParens)this.indent();this.printLeadingComments(node,parent);newline(true);if(opts.before)opts.before();this.map.mark(node,"start");this[node.type](node,this.buildPrint(node),parent);if(needsCommentParens){this.newline();this.dedent()}if(needsParens)this.push(")");this.map.mark(node,"end");if(opts.after)opts.after();newline(false);this.printTrailingComments(node,parent)}else{throw new ReferenceError("unknown node of type "+JSON.stringify(node.type)+" with constructor "+JSON.stringify(node&&node.constructor.name))}};CodeGenerator.prototype.printJoin=function(print,nodes,opts){if(!nodes||!nodes.length)return;opts=opts||{};var self=this;var len=nodes.length;if(opts.indent)self.indent();_.each(nodes,function(node,i){print(node,{statement:opts.statement,after:function(){if(opts.iterator){opts.iterator(node,i)}if(opts.separator&&i<len-1){self.push(opts.separator)}}})});if(opts.indent)self.dedent()};CodeGenerator.prototype.printAndIndentOnComments=function(print,node){var indent=!!node.leadingComments;if(indent)this.indent();print(node);if(indent)this.dedent()};CodeGenerator.prototype.printBlock=function(print,node){if(t.isEmptyStatement(node)){this.semicolon()}else{this.push(" ");print(node)}};CodeGenerator.prototype.generateComment=function(comment){var val=comment.value;if(comment.type==="Line"){val="//"+val}else{val="/*"+val+"*/"}return val};CodeGenerator.prototype.printTrailingComments=function(node,parent){this._printComments(this.getComments("trailingComments",node,parent))};CodeGenerator.prototype.printLeadingComments=function(node,parent){this._printComments(this.getComments("leadingComments",node,parent))};CodeGenerator.prototype.getComments=function(key,node,parent){if(t.isExpressionStatement(parent)){return[]}var comments=[];var nodes=[node];var self=this;if(t.isExpressionStatement(node)){nodes.push(node.argument)}_.each(nodes,function(node){comments=comments.concat(self._getComments(key,node))});return comments};CodeGenerator.prototype._getComments=function(key,node){return node&&node[key]||[]};CodeGenerator.prototype._printComments=function(comments){if(this.format.compact)return;if(!this.format.comments)return;if(!comments||!comments.length)return;var self=this;_.each(comments,function(comment){var skip=false;_.each(self.ast.comments,function(origComment){if(origComment.start===comment.start){if(origComment._displayed)skip=true;origComment._displayed=true;return false}});if(skip)return;self.newline(self.whitespace.getNewlinesBefore(comment));var column=self.position.column;var val=self.generateComment(comment);if(column&&!self.isLast(["\n"," ","[","{"])){self._push(" ");column++}if(comment.type==="Block"&&self.format.indent.adjustMultilineComment){var offset=comment.loc.start.column;if(offset){var newlineRegex=new RegExp("\\n\\s{1,"+offset+"}","g");val=val.replace(newlineRegex,"\n")}var indent=Math.max(self.indentSize(),column);val=val.replace(/\n/g,"\n"+util.repeat(indent))}if(column===0){val=self.getIndent()+val}self._push(val);self.newline(self.whitespace.getNewlinesAfter(comment))})}},{"../types":77,"../util":79,"./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:127}],6:[function(require,module,exports){exports.File=function(node,print){print(node.program)};exports.Program=function(node,print){print.sequence(node.body)};exports.BlockStatement=function(node,print){if(node.body.length===0){this.push("{}")}else{this.push("{");this.newline();print.sequence(node.body,{indent:true});this.removeLast("\n");this.rightBrace()}}},{}],7:[function(require,module,exports){exports.ClassExpression=exports.ClassDeclaration=function(node,print){this.push("class");if(node.id){this.space();print(node.id)}if(node.superClass){this.push(" extends ");print(node.superClass)}this.space();print(node.body)};exports.ClassBody=function(node,print){if(node.body.length===0){this.push("{}")}else{this.push("{");this.newline();this.indent();print.sequence(node.body);this.dedent();this.rightBrace()}};exports.MethodDefinition=function(node,print){if(node.static){this.push("static ")}this._method(node,print)}},{}],8:[function(require,module,exports){exports.ComprehensionBlock=function(node,print){this.keyword("for");this.push("(");print(node.left);this.push(" of ");print(node.right);this.push(")")};exports.ComprehensionExpression=function(node,print){this.push(node.generator?"(":"[");print.join(node.blocks,{separator:" "});this.space();if(node.filter){this.keyword("if");this.push("(");print(node.filter);this.push(")");this.space()}print(node.body);this.push(node.generator?")":"]")}},{}],9:[function(require,module,exports){var util=require("../../util");var t=require("../../types");exports.UnaryExpression=function(node,print){var hasSpace=/[a-z]$/.test(node.operator);var arg=node.argument;if(t.isUpdateExpression(arg)||t.isUnaryExpression(arg)){hasSpace=true}if(t.isUnaryExpression(arg)&&arg.operator==="!"){hasSpace=false}this.push(node.operator);if(hasSpace)this.space();print(node.argument)};exports.UpdateExpression=function(node,print){if(node.prefix){this.push(node.operator);print(node.argument)}else{print(node.argument);this.push(node.operator)}};exports.ConditionalExpression=function(node,print){print(node.test);this.push(" ? ");print(node.consequent);this.push(" : ");print(node.alternate)};exports.NewExpression=function(node,print){this.push("new ");print(node.callee);if(node.arguments.length||this.format.parentheses){this.push("(");
print.join(node.arguments,{separator:", "});this.push(")")}};exports.SequenceExpression=function(node,print){print.join(node.expressions,{separator:", "})};exports.ThisExpression=function(){this.push("this")};exports.CallExpression=function(node,print){print(node.callee);this.push("(");print.join(node.arguments,{separator:", "});this.push(")")};var buildYieldAwait=function(keyword){return function(node,print){this.push(keyword);if(node.delegate)this.push("*");if(node.argument){this.space();print(node.argument)}}};exports.YieldExpression=buildYieldAwait("yield");exports.AwaitExpression=buildYieldAwait("await");exports.EmptyStatement=function(){this.semicolon()};exports.ExpressionStatement=function(node,print){print(node.expression);this.semicolon()};exports.BinaryExpression=exports.LogicalExpression=exports.AssignmentExpression=function(node,print){print(node.left);this.push(" "+node.operator+" ");print(node.right)};var SCIENTIFIC_NOTATION=/e/i;exports.MemberExpression=function(node,print){var obj=node.object;print(obj);if(!node.computed&&t.isMemberExpression(node.property)){throw new TypeError("Got a MemberExpression for MemberExpression property")}if(node.computed){this.push("[");print(node.property);this.push("]")}else{if(t.isLiteral(obj)&&util.isInteger(obj.value)&&!SCIENTIFIC_NOTATION.test(obj.value.toString())){this.push(".")}this.push(".");print(node.property)}}},{"../../types":77,"../../util":79}],10:[function(require,module,exports){exports.ClassProperty=function(){throw new Error("not implemented")}},{}],11:[function(require,module,exports){var t=require("../../types");var _=require("lodash");exports.XJSAttribute=function(node,print){print(node.name);if(node.value){this.push("=");print(node.value)}};exports.XJSIdentifier=function(node){this.push(node.name)};exports.XJSNamespacedName=function(node,print){print(node.namespace);this.push(":");print(node.name)};exports.XJSMemberExpression=function(node,print){print(node.object);this.push(".");print(node.property)};exports.XJSSpreadAttribute=function(node,print){this.push("{...");print(node.argument);this.push("}")};exports.XJSExpressionContainer=function(node,print){this.push("{");print(node.expression);this.push("}")};exports.XJSElement=function(node,print){var self=this;var open=node.openingElement;print(open);if(open.selfClosing)return;this.indent();_.each(node.children,function(child){if(t.isLiteral(child)){self.push(child.value)}else{print(child)}});this.dedent();print(node.closingElement)};exports.XJSOpeningElement=function(node,print){this.push("<");print(node.name);if(node.attributes.length>0){this.space();print.join(node.attributes,{separator:" "})}this.push(node.selfClosing?" />":">")};exports.XJSClosingElement=function(node,print){this.push("</");print(node.name);this.push(">")};exports.XJSEmptyExpression=function(){}},{"../../types":77,lodash:127}],12:[function(require,module,exports){var t=require("../../types");exports._params=function(node,print){var self=this;this.push("(");print.join(node.params,{separator:", ",iterator:function(param,i){var def=node.defaults&&node.defaults[i];if(def){self.push(" = ");print(def)}}});if(node.rest){if(node.params.length){this.push(", ")}this.push("...");print(node.rest)}this.push(")")};exports._method=function(node,print){var value=node.value;var kind=node.kind;var key=node.key;if(!kind||kind==="init"){if(value.generator){this.push("*")}}else{this.push(kind+" ")}if(value.async)this.push("async ");if(node.computed){this.push("[");print(key);this.push("]")}else{print(key)}this._params(value,print);this.space();print(value.body)};exports.FunctionDeclaration=exports.FunctionExpression=function(node,print){if(node.async)this.push("async ");this.push("function");if(node.generator)this.push("*");this.space();if(node.id)print(node.id);this._params(node,print);this.space();print(node.body)};exports.ArrowFunctionExpression=function(node,print){if(node.async)this.push("async ");if(node.params.length===1&&!node.defaults.length&&!node.rest&&t.isIdentifier(node.params[0])){print(node.params[0])}else{this._params(node,print)}this.push(" => ");print(node.body)}},{"../../types":77}],13:[function(require,module,exports){var t=require("../../types");var _=require("lodash");exports.ImportSpecifier=function(node,print){if(node.id&&node.id.name==="default"){print(node.name)}else{return exports.ExportSpecifier.apply(this,arguments)}};exports.ExportSpecifier=function(node,print){print(node.id);if(node.name){this.push(" as ");print(node.name)}};exports.ExportBatchSpecifier=function(){this.push("*")};exports.ExportDeclaration=function(node,print){this.push("export ");var specifiers=node.specifiers;if(node.default){this.push("default ")}if(node.declaration){print(node.declaration);if(t.isStatement(node.declaration))return}else{if(specifiers.length===1&&t.isExportBatchSpecifier(specifiers[0])){print(specifiers[0])}else{this.push("{");if(specifiers.length){this.space();print.join(specifiers,{separator:", "});this.space()}this.push("}")}if(node.source){this.push(" from ");print(node.source)}}this.ensureSemicolon()};exports.ImportDeclaration=function(node,print){var self=this;this.push("import ");var specfiers=node.specifiers;if(specfiers&&specfiers.length){var foundImportSpecifier=false;_.each(node.specifiers,function(spec,i){if(+i>0){self.push(", ")}var isDefault=spec.id&&spec.id.name==="default";if(!isDefault&&spec.type!=="ImportBatchSpecifier"&&!foundImportSpecifier){foundImportSpecifier=true;self.push("{ ")}print(spec)});if(foundImportSpecifier){this.push(" }")}this.push(" from ")}print(node.source);this.semicolon()};exports.ImportBatchSpecifier=function(node,print){this.push("* as ");print(node.name)}},{"../../types":77,lodash:127}],14:[function(require,module,exports){var _=require("lodash");_.each(["BindMemberExpression","BindFunctionExpression"],function(type){exports[type]=function(){throw new ReferenceError("Trying to render non-standard playground node "+JSON.stringify(type))}})},{lodash:127}],15:[function(require,module,exports){var t=require("../../types");exports.WithStatement=function(node,print){this.keyword("with");this.push("(");print(node.object);this.push(")");print.block(node.body)};exports.IfStatement=function(node,print){this.keyword("if");this.push("(");print(node.test);this.push(") ");print.indentOnComments(node.consequent);if(node.alternate){if(this.isLast("}"))this.space();this.keyword("else");print.indentOnComments(node.alternate)}};exports.ForStatement=function(node,print){this.keyword("for");this.push("(");print(node.init);this.push(";");if(node.test){this.space();print(node.test)}this.push(";");if(node.update){this.space();print(node.update)}this.push(")");print.block(node.body)};exports.WhileStatement=function(node,print){this.keyword("while");this.push("(");print(node.test);this.push(")");print.block(node.body)};var buildForXStatement=function(op){return function(node,print){this.keyword("for");this.push("(");print(node.left);this.push(" "+op+" ");print(node.right);this.push(")");print.block(node.body)}};exports.ForInStatement=buildForXStatement("in");exports.ForOfStatement=buildForXStatement("of");exports.DoWhileStatement=function(node,print){this.keyword("do");print(node.body);this.space();this.keyword("while");this.push("(");print(node.test);this.push(");")};var buildLabelStatement=function(prefix,key){return function(node,print){this.push(prefix);var label=node[key||"label"];if(label){this.space();print(label)}this.semicolon()}};exports.ContinueStatement=buildLabelStatement("continue");exports.ReturnStatement=buildLabelStatement("return","argument");exports.BreakStatement=buildLabelStatement("break");exports.LabeledStatement=function(node,print){print(node.label);this.push(": ");print(node.body)};exports.TryStatement=function(node,print){this.keyword("try");print(node.block);this.space();print(node.handler);if(node.finalizer){this.space();this.push("finally ");print(node.finalizer)}};exports.CatchClause=function(node,print){this.keyword("catch");this.push("(");print(node.param);this.push(") ");print(node.body)};exports.ThrowStatement=function(node,print){this.push("throw ");print(node.argument);this.semicolon()};exports.SwitchStatement=function(node,print){this.keyword("switch");this.push("(");print(node.discriminant);this.push(") {");print.sequence(node.cases,{indent:true});this.push("}")};exports.SwitchCase=function(node,print){if(node.test){this.push("case ");print(node.test);this.push(":")}else{this.push("default:")}this.newline();print.sequence(node.consequent,{indent:true})};exports.DebuggerStatement=function(){this.push("debugger;")};exports.VariableDeclaration=function(node,print,parent){this.push(node.kind+" ");print.join(node.declarations,{separator:", "});if(!t.isFor(parent)){this.semicolon()}};exports.PrivateDeclaration=function(node,print){this.push("private ");print.join(node.declarations,{separator:", "});this.semicolon()};exports.VariableDeclarator=function(node,print){if(node.init){print(node.id);this.push(" = ");print(node.init)}else{print(node.id)}}},{"../../types":77}],16:[function(require,module,exports){var _=require("lodash");exports.TaggedTemplateExpression=function(node,print){print(node.tag);print(node.quasi)};exports.TemplateElement=function(node){this._push(node.value.raw)};exports.TemplateLiteral=function(node,print){this.push("`");var quasis=node.quasis;var self=this;var len=quasis.length;_.each(quasis,function(quasi,i){print(quasi);if(i+1<len){self.push("${ ");print(node.expressions[i]);self.push(" }")}});this._push("`")}},{lodash:127}],17:[function(require,module,exports){var _=require("lodash");exports.Identifier=function(node){this.push(node.name)};exports.SpreadElement=exports.SpreadProperty=function(node,print){this.push("...");print(node.argument)};exports.VirtualPropertyExpression=function(node,print){print(node.object);this.push("::");print(node.property)};exports.ObjectExpression=exports.ObjectPattern=function(node,print){var props=node.properties;if(props.length){this.push("{");this.space();print.join(props,{separator:", ",indent:true});this.space();this.push("}")}else{this.push("{}")}};exports.Property=function(node,print){if(node.method||node.kind==="get"||node.kind==="set"){this._method(node,print)}else{if(node.computed){this.push("[");print(node.key);this.push("]")}else{print(node.key);if(node.shorthand)return}this.push(": ");print(node.value)}};exports.ArrayExpression=exports.ArrayPattern=function(node,print){var elems=node.elements;var self=this;var len=elems.length;this.push("[");_.each(elems,function(elem,i){if(!elem){self.push(",")}else{if(i>0)self.push(" ");print(elem);if(i<len-1)self.push(",")}});this.push("]")};exports.Literal=function(node){var val=node.value;var type=typeof val;if(type==="string"){val=JSON.stringify(val);val=val.replace(/[\u000A\u000D\u2028\u2029]/g,function(c){return"\\u"+("0000"+c.charCodeAt(0).toString(16)).slice(-4)});this.push(val)}else if(type==="boolean"||type==="number"){this.push(JSON.stringify(val))}else if(node.regex){this.push("/"+node.regex.pattern+"/"+node.regex.flags)}else if(val===null){this.push("null")}}},{lodash:127}],18:[function(require,module,exports){module.exports=Node;var whitespace=require("./whitespace");var parens=require("./parentheses");var t=require("../../types");var _=require("lodash");var find=function(obj,node,parent){var result;_.each(obj,function(fn,type){if(t["is"+type](node)){result=fn(node,parent);if(result!=null)return false}});return result};function Node(node,parent){this.parent=parent;this.node=node}Node.prototype.isUserWhitespacable=function(){return t.isUserWhitespacable(this.node)};Node.prototype.needsWhitespace=function(type){var parent=this.parent;var node=this.node;if(!node)return 0;if(t.isExpressionStatement(node)){node=node.expression}var lines=find(whitespace[type].nodes,node,parent);if(lines)return lines;_.each(find(whitespace[type].list,node,parent),function(expr){lines=Node.needsWhitespace(expr,node,type);if(lines)return false});return lines||0};Node.prototype.needsWhitespaceBefore=function(){return this.needsWhitespace("before")};Node.prototype.needsWhitespaceAfter=function(){return this.needsWhitespace("after")};Node.prototype.needsParens=function(){var parent=this.parent;var node=this.node;if(!parent)return false;if(t.isNewExpression(parent)&&parent.callee===node){return t.isCallExpression(node)||_.some(node,function(val){return t.isCallExpression(val)})}return find(parens,node,parent)};_.each(Node.prototype,function(fn,key){Node[key]=function(node,parent){var n=new Node(node,parent);var args=_.toArray(arguments).slice(2);return n[key].apply(n,args)}})},{"../../types":77,"./parentheses":19,"./whitespace":20,lodash:127}],19:[function(require,module,exports){var t=require("../../types");var _=require("lodash");var PRECEDENCE={};_.each([["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]],function(tier,i){_.each(tier,function(op){PRECEDENCE[op]=i})});exports.Binary=function(node,parent){if(t.isCallExpression(parent)&&parent.callee===node){return true}if(t.isUnaryLike(parent)){return true}if(t.isMemberExpression(parent)&&parent.object===node){return true}if(t.isBinary(parent)){var parentOp=parent.operator;var parentPos=PRECEDENCE[parentOp];var nodeOp=node.operator;var nodePos=PRECEDENCE[nodeOp];if(parentPos>nodePos){return true}if(parentPos===nodePos&&parent.right===node){return true}}};exports.BinaryExpression=function(node,parent){if(node.operator==="in"){if(t.isVariableDeclarator(parent)){return true}if(t.isFor(parent)){return true}}};exports.SequenceExpression=function(node,parent){if(t.isForStatement(parent)){return false}if(t.isExpressionStatement(parent)&&parent.expression===node){return false}return true};exports.YieldExpression=function(node,parent){return t.isBinary(parent)||t.isUnaryLike(parent)||t.isCallExpression(parent)||t.isMemberExpression(parent)||t.isNewExpression(parent)||t.isConditionalExpression(parent)||t.isYieldExpression(parent)};exports.ClassExpression=function(node,parent){return t.isExpressionStatement(parent)};exports.UnaryLike=function(node,parent){return t.isMemberExpression(parent)&&parent.object===node};exports.FunctionExpression=function(node,parent){if(t.isExpressionStatement(parent)){return true}if(t.isMemberExpression(parent)&&parent.object===node){return true}if(t.isCallExpression(parent)&&parent.callee===node){return true}};exports.AssignmentExpression=exports.ConditionalExpression=function(node,parent){if(t.isUnaryLike(parent)){return true}if(t.isBinary(parent)){return true}if(t.isCallExpression(parent)&&parent.callee===node){return true}if(t.isConditionalExpression(parent)&&parent.test===node){return true}if(t.isMemberExpression(parent)&&parent.object===node){return true}return false}},{"../../types":77,lodash:127}],20:[function(require,module,exports){var _=require("lodash");var t=require("../../types");exports.before={nodes:{Property:function(node,parent){if(parent.properties[0]===node){return 1}},SpreadProperty:function(node,parent){return exports.before.nodes.Property(node,parent)},SwitchCase:function(node,parent){if(parent.cases[0]===node){return 1}},CallExpression:function(node){if(t.isFunction(node.callee)){return 1}}}};exports.after={nodes:{AssignmentExpression:function(node){if(t.isFunction(node.right)){return 1}}},list:{VariableDeclaration:function(node){return _.map(node.declarations,"init")},ArrayExpression:function(node){return node.elements},ObjectExpression:function(node){return node.properties}}};_.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(amounts,type){if(_.isNumber(amounts))amounts={after:amounts,before:amounts};_.each(amounts,function(amount,key){exports[key].nodes[type]=function(){return amount}})})},{"../../types":77,lodash:127}],21:[function(require,module,exports){module.exports=Position;var _=require("lodash");function Position(){this.line=1;this.column=0}Position.prototype.push=function(str){var self=this;_.each(str,function(cha){if(cha==="\n"){self.line++;self.column=0}else{self.column++}})};Position.prototype.unshift=function(str){var self=this;_.each(str,function(cha){if(cha==="\n"){self.line--}else{self.column--}})}},{lodash:127}],22:[function(require,module,exports){module.exports=SourceMap;var sourceMap=require("source-map");var t=require("../types");function SourceMap(position,opts,code){this.position=position;this.opts=opts;if(opts.sourceMap){this.map=new sourceMap.SourceMapGenerator({file:opts.sourceMapName,sourceRoot:opts.sourceRoot});this.map.setSourceContent(opts.sourceFileName,code)}else{this.map=null}}SourceMap.prototype.get=function(){var map=this.map;if(map){return map.toJSON()}else{return map}};SourceMap.prototype.mark=function(node,type){var loc=node.loc;if(!loc)return;var map=this.map;if(!map)return;if(t.isProgram(node)||t.isFile(node))return;var position=this.position;var generated={line:position.line,column:position.column};var original=loc[type];if(generated.line===original.line&&generated.column===original.column)return;map.addMapping({source:this.opts.sourceFileName,generated:generated,original:original})}},{"../types":77,"source-map":169}],23:[function(require,module,exports){module.exports=Whitespace;var _=require("lodash");function Whitespace(tokens,comments){this.tokens=_.sortBy(tokens.concat(comments),"start");this.used=[]}Whitespace.prototype.getNewlinesBefore=function(node){var startToken;var endToken;var tokens=this.tokens;_.each(tokens,function(token,i){if(node.start===token.start){startToken=tokens[i-1];endToken=token;return false}});return this.getNewlinesBetween(startToken,endToken)};Whitespace.prototype.getNewlinesAfter=function(node){var startToken;var endToken;var tokens=this.tokens;_.each(tokens,function(token,i){if(node.end===token.end){startToken=token;endToken=tokens[i+1];return false}});if(endToken.type.type==="eof"){return 1}else{return this.getNewlinesBetween(startToken,endToken)}};Whitespace.prototype.getNewlinesBetween=function(startToken,endToken){var start=startToken?startToken.loc.end.line:1;var end=endToken.loc.start.line;var lines=0;for(var line=start;line<end;line++){if(!_.contains(this.used,line)){this.used.push(line);lines++}}return lines}},{lodash:127}],24:[function(require,module,exports){var t=require("./types");var _=require("lodash");var estraverse=require("estraverse");_.extend(estraverse.VisitorKeys,t.VISITOR_KEYS);var types=require("ast-types");var def=types.Type.def;var or=types.Type.or;def("ImportBatchSpecifier").bases("Specifier").build("name").field("name",def("Identifier"));def("VirtualPropertyExpression").bases("Expression").build("object","property").field("object",def("Expression")).field("property",or(def("Identifier"),def("Expression")));def("PrivateDeclaration").bases("Declaration").build("declarations").field("declarations",[def("Identifier")]);def("BindMemberExpression").bases("Expression").build("object","property","arguments").field("object",def("Expression")).field("property",or(def("Identifier"),def("Expression"))).field("arguments",[def("Expression")]);def("BindFunctionExpression").bases("Expression").build("callee","arguments").field("callee",def("Expression")).field("arguments",[def("Expression")]);types.finalize()},{"./types":77,"ast-types":93,estraverse:121,lodash:127}],25:[function(require,module,exports){module.exports=DefaultFormatter;var traverse=require("../../traverse");var util=require("../../util");var t=require("../../types");var _=require("lodash");function DefaultFormatter(file){this.file=file;this.localExports=this.getLocalExports();this.remapAssignments()}DefaultFormatter.prototype.getLocalExports=function(){var localExports={};traverse(this.file.ast,{enter:function(node){var declar=node&&node.declaration;if(t.isExportDeclaration(node)&&declar&&t.isStatement(declar)){_.extend(localExports,t.getIds(declar,true))}}});return localExports};DefaultFormatter.prototype.remapExportAssignment=function(node){return t.assignmentExpression("=",node.left,t.assignmentExpression(node.operator,t.memberExpression(t.identifier("exports"),node.left),node.right))};DefaultFormatter.prototype.remapAssignments=function(){var localExports=this.localExports;var self=this;var isLocalReference=function(node,scope){var name=node.name;return t.isIdentifier(node)&&localExports[name]&&localExports[name]===scope.get(name,true)};traverse(this.file.ast,{enter:function(node,parent,scope){if(t.isUpdateExpression(node)&&isLocalReference(node.argument,scope)){this.skip();var assign=t.assignmentExpression(node.operator[0]+"=",node.argument,t.literal(1));var remapped=self.remapExportAssignment(assign);if(t.isExpressionStatement(parent)||node.prefix){return remapped}var nodes=[];nodes.push(remapped);var operator;if(node.operator==="--"){operator="+"}else{operator="-"}nodes.push(t.binaryExpression(operator,node.argument,t.literal(1)));return t.sequenceExpression(nodes)}if(t.isAssignmentExpression(node)&&isLocalReference(node.left,scope)){this.skip();return self.remapExportAssignment(node)}}})};DefaultFormatter.prototype.getModuleName=function(){var opts=this.file.opts;var filenameRelative=opts.filenameRelative;var moduleName="";if(opts.moduleRoot){moduleName=opts.moduleRoot+"/"}if(!opts.filenameRelative){return moduleName+opts.filename.replace(/^\//,"")}if(opts.sourceRoot){var sourceRootRegEx=new RegExp("^"+opts.sourceRoot+"/?");filenameRelative=filenameRelative.replace(sourceRootRegEx,"")}filenameRelative=filenameRelative.replace(/\.(.*?)$/,"");moduleName+=filenameRelative;return moduleName};DefaultFormatter.prototype._pushStatement=function(ref,nodes){if(t.isClass(ref)||t.isFunction(ref)){if(ref.id){nodes.push(t.toStatement(ref));ref=ref.id}}return ref};DefaultFormatter.prototype._hoistExport=function(declar,assign,priority){if(t.isFunctionDeclaration(declar)){assign._blockHoist=priority||2}return assign};DefaultFormatter.prototype._exportSpecifier=function(getRef,specifier,node,nodes){var inherits=false;if(node.specifiers.length===1)inherits=node;if(node.source){if(t.isExportBatchSpecifier(specifier)){nodes.push(this._exportsWildcard(getRef(),node))}else{nodes.push(this._exportsAssign(t.getSpecifierName(specifier),t.memberExpression(getRef(),specifier.id),node))}}else{nodes.push(this._exportsAssign(t.getSpecifierName(specifier),specifier.id,node))}};DefaultFormatter.prototype._exportsWildcard=function(objectIdentifier){return util.template("exports-wildcard",{OBJECT:objectIdentifier},true)};DefaultFormatter.prototype._exportsAssign=function(id,init){return util.template("exports-assign",{VALUE:init,KEY:id},true)};DefaultFormatter.prototype.exportDeclaration=function(node,nodes){var declar=node.declaration;var id=declar.id;if(node.default){id=t.identifier("default")}var assign;if(t.isVariableDeclaration(declar)){for(var i in declar.declarations){var decl=declar.declarations[i];decl.init=this._exportsAssign(decl.id,decl.init,node).expression;var newDeclar=t.variableDeclaration(declar.kind,[decl]);if(i==="0")t.inherits(newDeclar,declar);nodes.push(newDeclar)}}else{var ref=declar;if(t.isFunctionDeclaration(declar)||t.isClassDeclaration(declar)){ref=declar.id;nodes.push(declar)}assign=this._exportsAssign(id,ref,node);nodes.push(assign);this._hoistExport(declar,assign)}}},{"../../traverse":73,"../../types":77,"../../util":79,lodash:127}],26:[function(require,module,exports){module.exports=AMDFormatter;var DefaultFormatter=require("./_default");var util=require("../../util");var t=require("../../types");var _=require("lodash");function AMDFormatter(){DefaultFormatter.apply(this,arguments);this.ids={}}util.inherits(AMDFormatter,DefaultFormatter);AMDFormatter.prototype.buildDependencyLiterals=function(){var names=[];for(var name in this.ids){names.push(t.literal(name))}return names};AMDFormatter.prototype.transform=function(ast){var program=ast.program;var body=program.body;var names=[t.literal("exports")].concat(this.buildDependencyLiterals());names=t.arrayExpression(names);var params=_.values(this.ids);params.unshift(t.identifier("exports"));var container=t.functionExpression(null,params,t.blockStatement(body));var defineArgs=[names,container];var moduleName=this.getModuleName();if(moduleName)defineArgs.unshift(t.literal(moduleName));var call=t.callExpression(t.identifier("define"),defineArgs);program.body=[t.expressionStatement(call)]};AMDFormatter.prototype.getModuleName=function(){if(this.file.opts.moduleIds){return DefaultFormatter.prototype.getModuleName.apply(this,arguments)}else{return null}};AMDFormatter.prototype._push=function(node){var id=node.source.value;var ids=this.ids;if(ids[id]){return ids[id]}else{return this.ids[id]=this.file.generateUidIdentifier(id)}};AMDFormatter.prototype.importDeclaration=function(node){this._push(node)};AMDFormatter.prototype.importSpecifier=function(specifier,node,nodes){var key=t.getSpecifierName(specifier);var ref=this._push(node);if(t.isImportBatchSpecifier(specifier)){}else if(t.isSpecifierDefault(specifier)&&!this.noInteropRequire){ref=t.callExpression(this.file.addHelper("interop-require"),[ref])}else{ref=t.memberExpression(ref,specifier.id,false)}nodes.push(t.variableDeclaration("var",[t.variableDeclarator(key,ref)]))};AMDFormatter.prototype.exportSpecifier=function(specifier,node,nodes){var self=this;return this._exportSpecifier(function(){return self._push(node)},specifier,node,nodes)}},{"../../types":77,"../../util":79,"./_default":25,lodash:127}],27:[function(require,module,exports){module.exports=CommonJSFormatter;var DefaultFormatter=require("./_default");var traverse=require("../../traverse");var util=require("../../util");var t=require("../../types");function CommonJSFormatter(file){DefaultFormatter.apply(this,arguments);var hasNonDefaultExports=false;traverse(file.ast,{enter:function(node){if(t.isExportDeclaration(node)&&!node.default)hasNonDefaultExports=true}});this.hasNonDefaultExports=hasNonDefaultExports}util.inherits(CommonJSFormatter,DefaultFormatter);CommonJSFormatter.prototype.importSpecifier=function(specifier,node,nodes){var variableName=t.getSpecifierName(specifier);if(t.isSpecifierDefault(specifier)){nodes.push(t.variableDeclaration("var",[t.variableDeclarator(variableName,t.callExpression(this.file.addHelper("interop-require"),[util.template("require",{MODULE_NAME:node.source})]))]))}else{var templateName="require-assign";if(specifier.type!=="ImportBatchSpecifier")templateName+="-key";nodes.push(util.template(templateName,{VARIABLE_NAME:variableName,MODULE_NAME:node.source,KEY:specifier.id}))}};CommonJSFormatter.prototype.importDeclaration=function(node,nodes){nodes.push(util.template("require",{MODULE_NAME:node.source},true))};CommonJSFormatter.prototype.exportDeclaration=function(node,nodes){if(node.default){var declar=node.declaration;var assign;var templateName="exports-default-module";if(this.hasNonDefaultExports)templateName="exports-default-module-override";if(t.isFunction(declar)||!this.hasNonDefaultExports){assign=util.template(templateName,{VALUE:this._pushStatement(declar,nodes)},true);nodes.push(this._hoistExport(declar,assign,3));return}else{assign=util.template("common-export-default-assign",true);assign._blockHoist=0;nodes.push(assign)}}DefaultFormatter.prototype.exportDeclaration.apply(this,arguments)};CommonJSFormatter.prototype.exportSpecifier=function(specifier,node,nodes){this._exportSpecifier(function(){return t.callExpression(t.identifier("require"),[node.source])},specifier,node,nodes)}},{"../../traverse":73,"../../types":77,"../../util":79,"./_default":25}],28:[function(require,module,exports){module.exports=IgnoreFormatter;var t=require("../../types");function IgnoreFormatter(){}IgnoreFormatter.prototype.exportDeclaration=function(node,nodes){var declar=t.toStatement(node.declaration,true);if(declar)nodes.push(t.inherits(declar,node))};IgnoreFormatter.prototype.importDeclaration=IgnoreFormatter.prototype.importSpecifier=IgnoreFormatter.prototype.exportSpecifier=function(){}},{"../../types":77}],29:[function(require,module,exports){module.exports=SystemFormatter;var AMDFormatter=require("./amd");var traverse=require("../../traverse");var util=require("../../util");var t=require("../../types");var _=require("lodash");function SystemFormatter(file){this.exportIdentifier=file.generateUidIdentifier("export");this.noInteropRequire=true;AMDFormatter.apply(this,arguments)}util.inherits(SystemFormatter,AMDFormatter);SystemFormatter.prototype._addImportSource=function(node,exportNode){node._importSource=exportNode.source&&exportNode.source.value;return node};SystemFormatter.prototype._exportsWildcard=function(objectIdentifier,node){var leftIdentifier=this.file.generateUidIdentifier("key");var valIdentifier=t.memberExpression(objectIdentifier,leftIdentifier,true);var left=t.variableDeclaration("var",[t.variableDeclarator(leftIdentifier)]);var right=objectIdentifier;var block=t.blockStatement([this.buildExportCall(leftIdentifier,valIdentifier)]);return this._addImportSource(t.forInStatement(left,right,block),node)};SystemFormatter.prototype._exportsAssign=function(id,init,node){var call=this.buildExportCall(t.literal(id.name),init,true);return this._addImportSource(call,node)};SystemFormatter.prototype.remapExportAssignment=function(node){return this.buildExportCall(t.literal(node.left.name),node)};SystemFormatter.prototype.buildExportCall=function(id,init,isStatement){var call=t.callExpression(this.exportIdentifier,[id,init]);if(isStatement){return t.expressionStatement(call)}else{return call}};SystemFormatter.prototype.importSpecifier=function(specifier,node,nodes){AMDFormatter.prototype.importSpecifier.apply(this,arguments);this._addImportSource(_.last(nodes),node)};SystemFormatter.prototype.buildRunnerSetters=function(block,hoistDeclarators){return t.arrayExpression(_.map(this.ids,function(uid,source){var nodes=[];traverse(block,{enter:function(node){if(node._importSource===source){if(t.isVariableDeclaration(node)){_.each(node.declarations,function(declar){hoistDeclarators.push(t.variableDeclarator(declar.id));nodes.push(t.expressionStatement(t.assignmentExpression("=",declar.id,declar.init)))})}else{nodes.push(node)}this.remove()}}});return t.functionExpression(null,[uid],t.blockStatement(nodes))}))};SystemFormatter.prototype.transform=function(ast){var program=ast.program;var hoistDeclarators=[];var moduleName=this.getModuleName();var moduleNameLiteral=t.literal(moduleName);var block=t.blockStatement(program.body);var runner=util.template("system",{MODULE_NAME:moduleNameLiteral,MODULE_DEPENDENCIES:t.arrayExpression(this.buildDependencyLiterals()),EXPORT_IDENTIFIER:this.exportIdentifier,SETTERS:this.buildRunnerSetters(block,hoistDeclarators),EXECUTE:t.functionExpression(null,[],block)},true);var handlerBody=runner.expression.arguments[2].body.body;if(!moduleName)runner.expression.arguments.shift();var returnStatement=handlerBody.pop();traverse(block,{enter:function(node,parent,scope){if(t.isFunction(node)){return this.skip()}if(t.isVariableDeclaration(node)){if(node.kind!=="var"&&!t.isProgram(parent)){return}var nodes=[];_.each(node.declarations,function(declar){hoistDeclarators.push(t.variableDeclarator(declar.id));if(declar.init){var assign=t.expressionStatement(t.assignmentExpression("=",declar.id,declar.init));nodes.push(assign)}});if(t.isFor(parent)){if(parent.left===node){return node.declarations[0].id}if(parent.init===node){return t.toSequenceExpression(nodes,scope)}}return nodes}}});if(hoistDeclarators.length){var hoistDeclar=t.variableDeclaration("var",hoistDeclarators);hoistDeclar._blockHoist=true;handlerBody.unshift(hoistDeclar)}traverse(block,{enter:function(node){if(t.isFunction(node))this.skip();if(t.isFunctionDeclaration(node)||node._blockHoist){handlerBody.push(node);this.remove()}}});handlerBody.push(returnStatement);program.body=[runner]}},{"../../traverse":73,"../../types":77,"../../util":79,"./amd":26,lodash:127}],30:[function(require,module,exports){module.exports=UMDFormatter;
var AMDFormatter=require("./amd");var util=require("../../util");var t=require("../../types");var _=require("lodash");function UMDFormatter(){AMDFormatter.apply(this,arguments)}util.inherits(UMDFormatter,AMDFormatter);UMDFormatter.prototype.transform=function(ast){var program=ast.program;var body=program.body;var names=[];for(var name in this.ids){names.push(t.literal(name))}var ids=_.values(this.ids);var args=[t.identifier("exports")].concat(ids);var factory=t.functionExpression(null,args,t.blockStatement(body));var defineArgs=[t.arrayExpression([t.literal("exports")].concat(names))];var moduleName=this.getModuleName();if(moduleName)defineArgs.unshift(t.literal(moduleName));var runner=util.template("umd-runner-body",{AMD_ARGUMENTS:defineArgs,COMMON_ARGUMENTS:names.map(function(name){return t.callExpression(t.identifier("require"),[name])})});var call=t.callExpression(runner,[factory]);program.body=[t.expressionStatement(call)]}},{"../../types":77,"../../util":79,"./amd":26,lodash:127}],31:[function(require,module,exports){module.exports=transform;var Transformer=require("./transformer");var File=require("../file");var util=require("../util");var _=require("lodash");function transform(code,opts){var file=new File(opts);return file.parse(code)}transform.fromAst=function(ast,code,opts){ast=util.normaliseAst(ast);var file=new File(opts);file.addCode(code);file.transform(ast);return file.generate()};transform._ensureTransformerNames=function(type,keys){for(var i in keys){var key=keys[i];if(!_.has(transform.transformers,key)){throw new ReferenceError("unknown transformer "+key+" specified in "+type)}}};transform.transformers={};transform.moduleFormatters={common:require("./modules/common"),system:require("./modules/system"),ignore:require("./modules/ignore"),amd:require("./modules/amd"),umd:require("./modules/umd")};_.each({specBlockHoistFunctions:require("./transformers/spec-block-hoist-functions"),specNoForInOfAssignment:require("./transformers/spec-no-for-in-of-assignment"),specNoDuplicateProperties:require("./transformers/spec-no-duplicate-properties"),methodBinding:require("./transformers/playground-method-binding"),memoizationOperator:require("./transformers/playground-memoization-operator"),objectGetterMemoization:require("./transformers/playground-object-getter-memoization"),asyncToGenerator:require("./transformers/optional-async-to-generator"),bluebirdCoroutines:require("./transformers/optional-bluebird-coroutines"),react:require("./transformers/react"),modules:require("./transformers/es6-modules"),propertyNameShorthand:require("./transformers/es6-property-name-shorthand"),arrayComprehension:require("./transformers/es7-array-comprehension"),generatorComprehension:require("./transformers/es7-generator-comprehension"),arrowFunctions:require("./transformers/es6-arrow-functions"),classes:require("./transformers/es6-classes"),computedPropertyNames:require("./transformers/es6-computed-property-names"),objectSpread:require("./transformers/es7-object-spread"),exponentiationOperator:require("./transformers/es7-exponentiation-operator"),spread:require("./transformers/es6-spread"),templateLiterals:require("./transformers/es6-template-literals"),propertyMethodAssignment:require("./transformers/es6-property-method-assignment"),destructuring:require("./transformers/es6-destructuring"),defaultParameters:require("./transformers/es6-default-parameters"),forOf:require("./transformers/es6-for-of"),unicodeRegex:require("./transformers/es6-unicode-regex"),abstractReferences:require("./transformers/es7-abstract-references"),constants:require("./transformers/es6-constants"),letScoping:require("./transformers/es6-let-scoping"),_blockHoist:require("./transformers/_block-hoist"),generators:require("./transformers/es6-generators"),restParameters:require("./transformers/es6-rest-parameters"),protoToAssign:require("./transformers/optional-proto-to-assign"),_declarations:require("./transformers/_declarations"),_aliasFunctions:require("./transformers/_alias-functions"),_moduleFormatter:require("./transformers/_module-formatter"),useStrict:require("./transformers/use-strict"),coreAliasing:require("./transformers/optional-core-aliasing"),undefinedToVoid:require("./transformers/optional-undefined-to-void"),specPropertyLiterals:require("./transformers/spec-property-literals"),specMemberExpressionLiterals:require("./transformers/spec-member-expression-literals")},function(transformer,key){transform.transformers[key]=new Transformer(key,transformer)})},{"../file":3,"../util":79,"./modules/amd":26,"./modules/common":27,"./modules/ignore":28,"./modules/system":29,"./modules/umd":30,"./transformer":32,"./transformers/_alias-functions":33,"./transformers/_block-hoist":34,"./transformers/_declarations":35,"./transformers/_module-formatter":36,"./transformers/es6-arrow-functions":37,"./transformers/es6-classes":38,"./transformers/es6-computed-property-names":39,"./transformers/es6-constants":40,"./transformers/es6-default-parameters":41,"./transformers/es6-destructuring":42,"./transformers/es6-for-of":43,"./transformers/es6-generators":44,"./transformers/es6-let-scoping":45,"./transformers/es6-modules":46,"./transformers/es6-property-method-assignment":47,"./transformers/es6-property-name-shorthand":48,"./transformers/es6-rest-parameters":49,"./transformers/es6-spread":50,"./transformers/es6-template-literals":51,"./transformers/es6-unicode-regex":52,"./transformers/es7-abstract-references":53,"./transformers/es7-array-comprehension":54,"./transformers/es7-exponentiation-operator":55,"./transformers/es7-generator-comprehension":56,"./transformers/es7-object-spread":57,"./transformers/optional-async-to-generator":58,"./transformers/optional-bluebird-coroutines":59,"./transformers/optional-core-aliasing":60,"./transformers/optional-proto-to-assign":61,"./transformers/optional-undefined-to-void":62,"./transformers/playground-memoization-operator":63,"./transformers/playground-method-binding":64,"./transformers/playground-object-getter-memoization":65,"./transformers/react":66,"./transformers/spec-block-hoist-functions":67,"./transformers/spec-member-expression-literals":68,"./transformers/spec-no-duplicate-properties":69,"./transformers/spec-no-for-in-of-assignment":70,"./transformers/spec-property-literals":71,"./transformers/use-strict":72,lodash:127}],32:[function(require,module,exports){module.exports=Transformer;var traverse=require("../traverse");var t=require("../types");var _=require("lodash");function Transformer(key,transformer,opts){this.manipulateOptions=transformer.manipulateOptions;this.experimental=!!transformer.experimental;this.secondPass=!!transformer.secondPass;this.transformer=Transformer.normalise(transformer);this.optional=!!transformer.optional;this.opts=opts||{};this.key=key}Transformer.normalise=function(transformer){if(_.isFunction(transformer)){transformer={ast:transformer}}_.each(transformer,function(fns,type){if(type[0]==="_")return;if(_.isFunction(fns))fns={enter:fns};if(!_.isObject(fns))return;transformer[type]=fns;var aliases=t.FLIPPED_ALIAS_KEYS[type];if(aliases){_.each(aliases,function(alias){transformer[alias]=fns})}});return transformer};Transformer.prototype.astRun=function(file,key){var transformer=this.transformer;if(transformer.ast&&transformer.ast[key]){transformer.ast[key](file.ast,file)}};Transformer.prototype.transform=function(file){var transformer=this.transformer;var build=function(exit){return function(node,parent,scope){var fns=transformer[node.type];if(!fns)return;var fn=fns.enter;if(exit)fn=fns.exit;if(!fn)return;return fn(node,parent,file,scope)}};this.astRun(file,"before");traverse(file.ast,{enter:build(),exit:build(true)});this.astRun(file,"after")};Transformer.prototype.canRun=function(file){var opts=file.opts;var key=this.key;if(key[0]==="_")return true;var blacklist=opts.blacklist;if(blacklist.length&&_.contains(blacklist,key))return false;var whitelist=opts.whitelist;if(whitelist.length&&!_.contains(whitelist,key))return false;if(this.optional&&!_.contains(opts.optional,key))return false;if(this.experimental&&!opts.experimental)return false;return true}},{"../traverse":73,"../types":77,lodash:127}],33:[function(require,module,exports){var traverse=require("../../traverse");var t=require("../../types");var go=function(getBody,node,file,scope){var argumentsId;var thisId;var getArgumentsId=function(){return argumentsId=argumentsId||file.generateUidIdentifier("arguments",scope)};var getThisId=function(){return thisId=thisId||file.generateUidIdentifier("this",scope)};traverse(node,{enter:function(node){if(!node._aliasFunction){if(t.isFunction(node)){return this.skip()}else{return}}traverse(node,{enter:function(node,parent){if(t.isFunction(node)&&!node._aliasFunction){return this.skip()}if(node._ignoreAliasFunctions)return this.skip();var getId;if(t.isIdentifier(node)&&node.name==="arguments"){getId=getArgumentsId}else if(t.isThisExpression(node)){getId=getThisId}else{return}if(t.isReferenced(node,parent))return getId()}});return this.skip()}});var body;var pushDeclaration=function(id,init){body=body||getBody();body.unshift(t.variableDeclaration("var",[t.variableDeclarator(id,init)]))};if(argumentsId){pushDeclaration(argumentsId,t.identifier("arguments"))}if(thisId){pushDeclaration(thisId,t.identifier("this"))}};exports.Program=function(node,parent,file,scope){go(function(){return node.body},node,file,scope)};exports.FunctionDeclaration=exports.FunctionExpression=function(node,parent,file,scope){go(function(){t.ensureBlock(node);return node.body.body},node,file,scope)}},{"../../traverse":73,"../../types":77}],34:[function(require,module,exports){var _=require("lodash");exports.BlockStatement=exports.Program={exit:function(node){var hasChange=false;for(var i in node.body){var bodyNode=node.body[i];if(bodyNode&&bodyNode._blockHoist!=null)hasChange=true}if(!hasChange)return;var nodePriorities=_.groupBy(node.body,function(bodyNode){var priority=bodyNode._blockHoist;if(priority==null)priority=1;if(priority===true)priority=2;return priority});node.body=_.flatten(_.values(nodePriorities).reverse())}}},{lodash:127}],35:[function(require,module,exports){var t=require("../../types");exports.secondPass=true;exports.BlockStatement=exports.Program=function(node){var kinds={};var kind;for(var i in node._declarations){var declar=node._declarations[i];kind=declar.kind||"var";var declarNode=t.variableDeclarator(declar.id,declar.init);if(!declar.init){kinds[kind]=kinds[kind]||[];kinds[kind].push(declarNode)}else{node.body.unshift(t.variableDeclaration(kind,[declarNode]))}}for(kind in kinds){node.body.unshift(t.variableDeclaration(kind,kinds[kind]))}node._declarations=null}},{"../../types":77}],36:[function(require,module,exports){var transform=require("../transform");exports.ast={exit:function(ast,file){if(!transform.transformers.modules.canRun(file))return;if(file.moduleFormatter.transform){file.moduleFormatter.transform(ast)}}}},{"../transform":31}],37:[function(require,module,exports){var t=require("../../types");exports.ArrowFunctionExpression=function(node){t.ensureBlock(node);node._aliasFunction="arrow";node.expression=false;node.type="FunctionExpression";return node}},{"../../types":77}],38:[function(require,module,exports){var traverse=require("../../traverse");var util=require("../../util");var t=require("../../types");exports.ClassDeclaration=function(node,parent,file,scope){var closure=true;if(t.isProgram(parent)||t.isBlockStatement(parent)){closure=false}var factory=new Class(node,file,scope,closure);var newNode=factory.run();if(factory.closure){if(closure){scope.push({kind:"var",key:node.id.key,id:node.id});return t.assignmentExpression("=",node.id,newNode)}else{return t.variableDeclaration("let",[t.variableDeclarator(node.id,newNode)])}}else{return newNode}};exports.ClassExpression=function(node,parent,file,scope){return new Class(node,file,scope,true).run()};function Class(node,file,scope,closure){this.closure=closure;this.scope=scope;this.node=node;this.file=file;this.hasInstanceMutators=false;this.hasStaticMutators=false;this.instanceMutatorMap={};this.staticMutatorMap={};this.hasConstructor=false;this.className=node.id||file.generateUidIdentifier("class",scope);this.superName=node.superClass}Class.prototype.run=function(){var superName=this.superName;var className=this.className;var file=this.file;var body=this.body=[];var constructor=t.functionExpression(null,[],t.blockStatement([]));if(this.node.id)constructor.id=className;this.constructor=constructor;body.push(t.variableDeclaration("let",[t.variableDeclarator(className,constructor)]));if(superName){this.closure=true;var superRef=this.scope.generateUidBasedOnNode(superName,this.file);body.unshift(t.variableDeclaration("var",[t.variableDeclarator(superRef,superName)]));superName=superRef;this.superName=superName;body.push(t.expressionStatement(t.callExpression(file.addHelper("inherits"),[className,superName])))}this.buildBody();t.inheritsComments(body[0],this.node);if(this.closure){if(body.length===1){return constructor}else{body.push(t.returnStatement(className));return t.callExpression(t.functionExpression(null,[],t.blockStatement(body)),[])}}else{return body}};Class.prototype.buildBody=function(){var constructor=this.constructor;var className=this.className;var superName=this.superName;var classBody=this.node.body.body;var body=this.body;var self=this;for(var i in classBody){var node=classBody[i];if(t.isMethodDefinition(node)){self.replaceInstanceSuperReferences(node);if(node.key.name==="constructor"){self.pushConstructor(node)}else{self.pushMethod(node)}}else if(t.isPrivateDeclaration(node)){self.closure=true;body.unshift(node)}}if(!this.hasConstructor&&superName&&!t.isFalsyExpression(superName)){constructor.body.body.push(util.template("class-super-constructor-call",{SUPER_NAME:superName},true))}var instanceProps;var staticProps;if(this.hasInstanceMutators){var protoId=util.template("prototype-identifier",{CLASS_NAME:className});instanceProps=util.buildDefineProperties(this.instanceMutatorMap,protoId)}if(this.hasStaticMutators){staticProps=util.buildDefineProperties(this.staticMutatorMap,className)}if(instanceProps||staticProps){staticProps=staticProps||t.literal(null);var args=[className,staticProps];if(instanceProps)args.push(instanceProps);body.push(t.expressionStatement(t.callExpression(this.file.addHelper("prototype-properties"),args)))}};Class.prototype.pushMethod=function(node){var methodName=node.key;var kind=node.kind;if(kind===""){var className=this.className;if(!node.static)className=t.memberExpression(className,t.identifier("prototype"));methodName=t.memberExpression(className,methodName,node.computed);var expr=t.expressionStatement(t.assignmentExpression("=",methodName,node.value));t.inheritsComments(expr,node);this.body.push(expr)}else{var mutatorMap=this.instanceMutatorMap;if(node.static){this.hasStaticMutators=true;mutatorMap=this.staticMutatorMap}else{this.hasInstanceMutators=true}util.pushMutatorMap(mutatorMap,methodName,kind,node)}};Class.prototype.superIdentifier=function(methodNode,id,parent){var methodName=methodNode.key;var superName=this.superName||t.identifier("Function");if(parent.property===id){return}else if(t.isCallExpression(parent,{callee:id})){parent.arguments.unshift(t.thisExpression());if(methodName.name==="constructor"){return t.memberExpression(superName,t.identifier("call"))}else{id=superName;if(!methodNode.static){id=t.memberExpression(id,t.identifier("prototype"))}id=t.memberExpression(id,methodName,methodNode.computed);return t.memberExpression(id,t.identifier("call"))}}else if(t.isMemberExpression(parent)&&!methodNode.static){return t.memberExpression(superName,t.identifier("prototype"))}else{return superName}};Class.prototype.replaceInstanceSuperReferences=function(methodNode){var method=methodNode.value;var self=this;traverse(method,{enter:function(node,parent){if(t.isIdentifier(node,{name:"super"})){return self.superIdentifier(methodNode,node,parent)}else if(t.isCallExpression(node)){var callee=node.callee;if(!t.isMemberExpression(callee))return;if(callee.object.name!=="super")return;t.appendToMemberExpression(callee,t.identifier("call"));node.arguments.unshift(t.thisExpression())}}})};Class.prototype.pushConstructor=function(method){if(method.kind!==""){throw this.file.errorWithNode(method,"illegal kind for constructor method")}var construct=this.constructor;var fn=method.value;this.hasConstructor=true;t.inherits(construct,fn);t.inheritsComments(construct,method);construct.defaults=fn.defaults;construct.params=fn.params;construct.body=fn.body;construct.rest=fn.rest}},{"../../traverse":73,"../../types":77,"../../util":79}],39:[function(require,module,exports){var t=require("../../types");exports.ObjectExpression=function(node,parent,file,scope){var hasComputed=false;var prop;var key;var i;for(i in node.properties){hasComputed=t.isProperty(node.properties[i],{computed:true});if(hasComputed)break}if(!hasComputed)return;var objId=scope.generateUidBasedOnNode(parent,file);var body=[];var container=t.functionExpression(null,[],t.blockStatement(body));container._aliasFunction=true;var props=node.properties;for(i in props){prop=props[i];key=prop.key;if(!prop.computed&&t.isIdentifier(key)){prop.key=t.literal(key.name)}}var initProps=[];var broken=false;for(i in props){prop=props[i];if(prop.computed){broken=true}if(!broken||t.isLiteral(t.toComputedKey(prop,prop.key),{value:"__proto__"})){initProps.push(prop);props[i]=null}}for(i in props){prop=props[i];if(!prop)continue;key=prop.key;var bodyNode;if(prop.computed&&t.isMemberExpression(key)&&t.isIdentifier(key.object,{name:"Symbol"})){bodyNode=t.assignmentExpression("=",t.memberExpression(objId,key,true),prop.value)}else{bodyNode=t.callExpression(file.addHelper("define-property"),[objId,key,prop.value])}body.push(t.expressionStatement(bodyNode))}if(body.length===1){var first=body[0].expression;if(t.isCallExpression(first)){first.arguments[0]=t.objectExpression(initProps);return first}}body.unshift(t.variableDeclaration("var",[t.variableDeclarator(objId,t.objectExpression(initProps))]));body.push(t.returnStatement(objId));return t.callExpression(container,[])}},{"../../types":77}],40:[function(require,module,exports){var traverse=require("../../traverse");var t=require("../../types");var _=require("lodash");exports.Program=exports.BlockStatement=exports.ForInStatement=exports.ForOfStatement=exports.ForStatement=function(node,parent,file){var hasConstants=false;var constants={};var check=function(parent,names,scope){for(var name in names){var nameNode=names[name];if(!_.has(constants,name))continue;if(parent&&t.isBlockStatement(parent)&&parent!==constants[name])continue;if(scope){var defined=scope.get(name);if(defined&&defined===nameNode)continue}throw file.errorWithNode(nameNode,name+" is read-only")}};var getIds=function(node){return t.getIds(node,true,["MemberExpression"])};_.each(node.body,function(child,parent){if(t.isExportDeclaration(child)){child=child.declaration}if(t.isVariableDeclaration(child,{kind:"const"})){for(var i in child.declarations){var declar=child.declarations[i];var ids=getIds(declar);for(var name in ids){var nameNode=ids[name];var names={};names[name]=nameNode;check(parent,names);constants[name]=parent;hasConstants=true}declar._ignoreConstant=true}child._ignoreConstant=true;child.kind="let"}});if(!hasConstants)return;traverse(node,{enter:function(child,parent,scope){if(child._ignoreConstant)return;if(t.isVariableDeclaration(child))return;if(t.isVariableDeclarator(child)||t.isDeclaration(child)||t.isAssignmentExpression(child)){check(parent,getIds(child),scope)}}})}},{"../../traverse":73,"../../types":77,lodash:127}],41:[function(require,module,exports){var traverse=require("../../traverse");var util=require("../../util");var t=require("../../types");var _=require("lodash");exports.Function=function(node,parent,file,scope){if(!node.defaults||!node.defaults.length)return;t.ensureBlock(node);var ids=node.params.map(function(param){return t.getIds(param)});var iife=false;var i;var def;for(i in node.defaults){def=node.defaults[i];if(!def)continue;var param=node.params[i];_.each(ids.slice(i),function(ids){var check=function(node,parent){if(!t.isIdentifier(node)||!t.isReferenced(node,parent))return;if(ids.indexOf(node.name)>=0){throw file.errorWithNode(node,"Temporal dead zone - accessing a variable before it's initialized")}if(scope.has(node.name)){iife=true}};check(def,node);traverse(def,{enter:check})});var has=scope.get(param.name);if(has&&node.params.indexOf(has)<0){iife=true}}var body=[];for(i in node.defaults){def=node.defaults[i];if(!def)continue;body.push(util.template("if-undefined-set-to",{VARIABLE:node.params[i],DEFAULT:def},true))}if(iife){var container=t.functionExpression(null,[],node.body,node.generator);container._aliasFunction=true;body.push(t.returnStatement(t.callExpression(container,[])));node.body=t.blockStatement(body)}else{node.body.body=body.concat(node.body.body)}node.defaults=[]}},{"../../traverse":73,"../../types":77,"../../util":79,lodash:127}],42:[function(require,module,exports){var t=require("../../types");var buildVariableAssign=function(opts,id,init){var op=opts.operator;if(t.isMemberExpression(id))op="=";if(op){return t.expressionStatement(t.assignmentExpression("=",id,init))}else{return t.variableDeclaration(opts.kind,[t.variableDeclarator(id,init)])}};var push=function(opts,nodes,elem,parentId){if(t.isObjectPattern(elem)){pushObjectPattern(opts,nodes,elem,parentId)}else if(t.isArrayPattern(elem)){pushArrayPattern(opts,nodes,elem,parentId)}else{nodes.push(buildVariableAssign(opts,elem,parentId))}};var pushObjectPattern=function(opts,nodes,pattern,parentId){for(var i in pattern.properties){var prop=pattern.properties[i];if(t.isSpreadProperty(prop)){var keys=[];for(var i2 in pattern.properties){var prop2=pattern.properties[i2];if(i2>=i)break;if(t.isSpreadProperty(prop2))continue;var key=prop2.key;if(t.isIdentifier(key)){key=t.literal(prop2.key.name)}keys.push(key)}keys=t.arrayExpression(keys);var value=t.callExpression(opts.file.addHelper("object-without-properties"),[parentId,keys]);nodes.push(buildVariableAssign(opts,prop.argument,value))}else{var pattern2=prop.value;var patternId2=t.memberExpression(parentId,prop.key,prop.computed);if(t.isPattern(pattern2)){push(opts,nodes,pattern2,patternId2)}else{nodes.push(buildVariableAssign(opts,pattern2,patternId2))}}}};var pushArrayPattern=function(opts,nodes,pattern,parentId){if(!pattern.elements)return;var i;var hasSpreadElement=false;for(i in pattern.elements){if(t.isSpreadElement(pattern.elements[i])){hasSpreadElement=true;break}}var toArray=opts.file.toArray(parentId,!hasSpreadElement&&pattern.elements.length);var _parentId=opts.scope.generateUidBasedOnNode(parentId,opts.file);nodes.push(t.variableDeclaration("var",[t.variableDeclarator(_parentId,toArray)]));parentId=_parentId;for(i in pattern.elements){var elem=pattern.elements[i];if(!elem)continue;i=+i;var newPatternId;if(t.isSpreadElement(elem)){newPatternId=opts.file.toArray(parentId);if(i>0){newPatternId=t.callExpression(t.memberExpression(newPatternId,t.identifier("slice")),[t.literal(i)])}elem=elem.argument}else{newPatternId=t.memberExpression(parentId,t.literal(i),true)}push(opts,nodes,elem,newPatternId)}};var pushPattern=function(opts){var nodes=opts.nodes;var pattern=opts.pattern;var parentId=opts.id;var file=opts.file;var scope=opts.scope;if(!t.isMemberExpression(parentId)&&!t.isIdentifier(parentId)){var key=scope.generateUidBasedOnNode(parentId,file);nodes.push(t.variableDeclaration("var",[t.variableDeclarator(key,parentId)]));parentId=key}push(opts,nodes,pattern,parentId)};exports.ForInStatement=exports.ForOfStatement=function(node,parent,file,scope){var declar=node.left;if(!t.isVariableDeclaration(declar))return;var pattern=declar.declarations[0].id;if(!t.isPattern(pattern))return;var key=file.generateUidIdentifier("ref",scope);node.left=t.variableDeclaration(declar.kind,[t.variableDeclarator(key,null)]);var nodes=[];push({kind:declar.kind,file:file,scope:scope},nodes,pattern,key);t.ensureBlock(node);var block=node.body;block.body=nodes.concat(block.body)};exports.Function=function(node,parent,file,scope){var nodes=[];var hasDestructuring=false;node.params=node.params.map(function(pattern){if(!t.isPattern(pattern))return pattern;hasDestructuring=true;var parentId=file.generateUidIdentifier("ref",scope);pushPattern({kind:"var",nodes:nodes,pattern:pattern,id:parentId,file:file,scope:scope});return parentId});if(!hasDestructuring)return;t.ensureBlock(node);var block=node.body;block.body=nodes.concat(block.body)};exports.ExpressionStatement=function(node,parent,file,scope){var expr=node.expression;if(expr.type!=="AssignmentExpression")return;if(!t.isPattern(expr.left))return;var nodes=[];var ref=file.generateUidIdentifier("ref",scope);nodes.push(t.variableDeclaration("var",[t.variableDeclarator(ref,expr.right)]));push({operator:expr.operator,file:file,scope:scope},nodes,expr.left,ref);return nodes};exports.AssignmentExpression=function(node,parent,file,scope){if(parent.type==="ExpressionStatement")return;if(!t.isPattern(node.left))return;var tempName=file.generateUid("temp",scope);var ref=t.identifier(tempName);scope.push({key:tempName,id:ref});var nodes=[];nodes.push(t.assignmentExpression("=",ref,node.right));push({operator:node.operator,file:file,scope:scope},nodes,node.left,ref);nodes.push(ref);return t.toSequenceExpression(nodes,scope)};exports.VariableDeclaration=function(node,parent,file,scope){if(t.isForInStatement(parent)||t.isForOfStatement(parent))return;var nodes=[];var i;var declar;var hasPattern=false;for(i in node.declarations){declar=node.declarations[i];if(t.isPattern(declar.id)){hasPattern=true;break}}if(!hasPattern)return;for(i in node.declarations){declar=node.declarations[i];var patternId=declar.init;var pattern=declar.id;var opts={kind:node.kind,nodes:nodes,pattern:pattern,id:patternId,file:file,scope:scope};if(t.isPattern(pattern)&&patternId){pushPattern(opts)}else{nodes.push(buildVariableAssign(opts,declar.id,declar.init))}}if(!t.isProgram(parent)&&!t.isBlockStatement(parent)){declar=null;for(i in nodes){node=nodes[i];declar=declar||t.variableDeclaration(node.kind,[]);if(!t.isVariableDeclaration(node)&&declar.kind!==node.kind){throw file.errorWithNode(node,"Cannot use this node within the current parent")}declar.declarations=declar.declarations.concat(node.declarations)}return declar}return nodes}},{"../../types":77}],43:[function(require,module,exports){var util=require("../../util");var t=require("../../types");exports.ForOfStatement=function(node,parent,file,scope){var left=node.left;var declar;var stepKey=file.generateUidIdentifier("step",scope);var stepValue=t.memberExpression(stepKey,t.identifier("value"));if(t.isIdentifier(left)){declar=t.expressionStatement(t.assignmentExpression("=",left,stepValue))}else if(t.isVariableDeclaration(left)){declar=t.variableDeclaration(left.kind,[t.variableDeclarator(left.declarations[0].id,stepValue)])}else{throw file.errorWithNode(left,"Unknown node type "+left.type+" in ForOfStatement")}var node2=util.template("for-of",{ITERATOR_KEY:file.generateUidIdentifier("iterator",scope),STEP_KEY:stepKey,OBJECT:node.right});t.inheritsComments(node2,node);t.ensureBlock(node);var block=node2.body;block.body.push(declar);block.body=block.body.concat(node.body.body);return node2}},{"../../types":77,"../../util":79}],44:[function(require,module,exports){exports.ast={before:require("regenerator").transform}},{regenerator:135}],45:[function(require,module,exports){var traverse=require("../../traverse");var util=require("../../util");var t=require("../../types");var _=require("lodash");var isLet=function(node,parent){if(!t.isVariableDeclaration(node))return false;if(node._let)return true;if(node.kind!=="let")return false;if(!t.isFor(parent)||t.isFor(parent)&&parent.left!==node){_.each(node.declarations,function(declar){declar.init=declar.init||t.identifier("undefined")})}node._let=true;node.kind="var";return true};var isVar=function(node,parent){return t.isVariableDeclaration(node,{kind:"var"})&&!isLet(node,parent)};var standardiseLets=function(declars){for(var i in declars){delete declars[i]._let}};exports.VariableDeclaration=function(node,parent){isLet(node,parent)};exports.Loop=function(node,parent,file,scope){var init=node.left||node.init;if(isLet(init,node)){t.ensureBlock(node);node.body._letDeclars=[init]}if(t.isLabeledStatement(parent)){node.label=parent.label}var letScoping=new LetScoping(node,node.body,parent,file,scope);letScoping.run();if(node.label&&!t.isLabeledStatement(parent)){return t.labeledStatement(node.label,node)}};exports.BlockStatement=function(block,parent,file,scope){if(!t.isLoop(parent)){var letScoping=new LetScoping(false,block,parent,file,scope);letScoping.run()}};function LetScoping(loopParent,block,parent,file,scope){this.loopParent=loopParent;this.parent=parent;this.scope=scope;this.block=block;this.file=file;this.letReferences={};this.body=[]}LetScoping.prototype.run=function(){var block=this.block;if(block._letDone)return;block._letDone=true;this.info=this.getInfo();this.remap();if(t.isFunction(this.parent))return this.noClosure();if(!this.info.keys.length)return this.noClosure();var referencesInClosure=this.getLetReferences();if(!referencesInClosure)return this.noClosure();this.has=this.checkLoop();this.hoistVarDeclarations();standardiseLets(this.info.declarators);var letReferences=_.values(this.letReferences);var fn=t.functionExpression(null,letReferences,t.blockStatement(block.body));fn._aliasFunction=true;block.body=this.body;var params=this.getParams(letReferences);var call=t.callExpression(fn,params);var ret=this.file.generateUidIdentifier("ret",this.scope);var hasYield=traverse.hasType(fn.body,"YieldExpression",t.FUNCTION_TYPES);if(hasYield){fn.generator=true;call=t.yieldExpression(call,true)}this.build(ret,call)};LetScoping.prototype.noClosure=function(){standardiseLets(this.info.declarators)};LetScoping.prototype.remap=function(){var replacements=this.info.duplicates;var block=this.block;if(!this.info.hasDuplicates)return;var replace=function(node,parent,scope){if(!t.isIdentifier(node))return;if(!t.isReferenced(node,parent))return;if(scope&&scope.hasOwn(node.name))return;node.name=replacements[node.name]||node.name};var traverseReplace=function(node,parent){replace(node,parent);traverse(node,{enter:replace})};var loopParent=this.loopParent;if(loopParent){traverseReplace(loopParent.right,loopParent);traverseReplace(loopParent.test,loopParent);traverseReplace(loopParent.update,loopParent)}traverse(block,{enter:replace})};LetScoping.prototype.getInfo=function(){var block=this.block;var scope=this.scope;var file=this.file;var opts={outsideKeys:[],declarators:block._letDeclars||[],duplicates:{},hasDuplicates:false,keys:[]};var duplicates=function(id,key){var has=scope.parentGet(key);if(has&&has!==id){opts.duplicates[key]=id.name=file.generateUid(key,scope);opts.hasDuplicates=true}};var i;var declar;for(i in opts.declarators){declar=opts.declarators[i];opts.declarators.push(declar);var keys=t.getIds(declar,true);_.each(keys,duplicates);keys=Object.keys(keys);opts.outsideKeys=opts.outsideKeys.concat(keys);opts.keys=opts.keys.concat(keys)}for(i in block.body){declar=block.body[i];if(!isLet(declar,block))continue;_.each(t.getIds(declar,true),function(id,key){duplicates(id,key);opts.keys.push(key)})}return opts};LetScoping.prototype.checkLoop=function(){var has={hasContinue:false,hasReturn:false,hasBreak:false};traverse(this.block,{enter:function(node,parent){var replace;if(t.isFunction(node)||t.isLoop(node)){return this.skip()}if(node&&!node.label){if(t.isBreakStatement(node)){if(t.isSwitchCase(parent))return;has.hasBreak=true;replace=t.returnStatement(t.literal("break"))}else if(t.isContinueStatement(node)){has.hasContinue=true;replace=t.returnStatement(t.literal("continue"))}}if(t.isReturnStatement(node)){has.hasReturn=true;replace=t.returnStatement(t.objectExpression([t.property("init",t.identifier("v"),node.argument||t.identifier("undefined"))]))
}if(replace)return t.inherits(replace,node)}});return has};LetScoping.prototype.hoistVarDeclarations=function(){var self=this;traverse(this.block,{enter:function(node,parent){if(t.isForStatement(node)){if(isVar(node.init,node)){node.init=t.sequenceExpression(self.pushDeclar(node.init))}}else if(t.isFor(node)){if(isVar(node.left,node)){node.left=node.left.declarations[0].id}}else if(isVar(node,parent)){return self.pushDeclar(node).map(t.expressionStatement)}else if(t.isFunction(node)){return this.skip()}}})};LetScoping.prototype.getParams=function(params){var info=this.info;params=_.cloneDeep(params);_.each(params,function(param){param.name=info.duplicates[param.name]||param.name});return params};LetScoping.prototype.getLetReferences=function(){var closurify=false;var self=this;traverse(this.block,{enter:function(node,parent,scope){if(t.isFunction(node)){traverse(node,{enter:function(node,parent){if(!t.isIdentifier(node))return;if(!t.isReferenced(node,parent))return;if(scope.hasOwn(node.name))return;closurify=true;if(!_.contains(self.info.outsideKeys,node.name))return;self.letReferences[node.name]=node}});return this.skip()}else if(t.isLoop(node)){return this.skip()}}});return closurify};LetScoping.prototype.pushDeclar=function(node){this.body.push(t.variableDeclaration(node.kind,node.declarations.map(function(declar){return t.variableDeclarator(declar.id)})));var replace=[];for(var i in node.declarations){var declar=node.declarations[i];if(!declar.init)continue;var expr=t.assignmentExpression("=",declar.id,declar.init);replace.push(t.inherits(expr,declar))}return replace};LetScoping.prototype.build=function(ret,call){var has=this.has;if(has.hasReturn||has.hasBreak||has.hasContinue){this.buildHas(ret,call)}else{this.body.push(t.expressionStatement(call))}};LetScoping.prototype.buildHas=function(ret,call){var body=this.body;body.push(t.variableDeclaration("var",[t.variableDeclarator(ret,call)]));var loopParent=this.loopParent;var retCheck;var has=this.has;var cases=[];if(has.hasReturn){retCheck=util.template("let-scoping-return",{RETURN:ret})}if(has.hasBreak||has.hasContinue){var label=loopParent.label=loopParent.label||this.file.generateUidIdentifier("loop",this.scope);if(has.hasBreak){cases.push(t.switchCase(t.literal("break"),[t.breakStatement(label)]))}if(has.hasContinue){cases.push(t.switchCase(t.literal("continue"),[t.continueStatement(label)]))}if(has.hasReturn){cases.push(t.switchCase(null,[retCheck]))}if(cases.length===1){var single=cases[0];body.push(t.ifStatement(t.binaryExpression("===",ret,single.test),single.consequent[0]))}else{body.push(t.switchStatement(ret,cases))}}else{if(has.hasReturn)body.push(retCheck)}}},{"../../traverse":73,"../../types":77,"../../util":79,lodash:127}],46:[function(require,module,exports){var t=require("../../types");exports.ast={before:function(ast,file){ast.program.body=file.dynamicImports.concat(ast.program.body)}};exports.ImportDeclaration=function(node,parent,file){var nodes=[];if(node.specifiers.length){for(var i in node.specifiers){file.moduleFormatter.importSpecifier(node.specifiers[i],node,nodes,parent)}}else{file.moduleFormatter.importDeclaration(node,nodes,parent)}if(nodes.length===1){nodes[0]._blockHoist=node._blockHoist}return nodes};exports.ExportDeclaration=function(node,parent,file){var nodes=[];if(node.declaration){if(t.isVariableDeclaration(node.declaration)){var declar=node.declaration.declarations[0];declar.init=declar.init||t.identifier("undefined")}file.moduleFormatter.exportDeclaration(node,nodes,parent)}else{for(var i in node.specifiers){file.moduleFormatter.exportSpecifier(node.specifiers[i],node,nodes,parent)}}return nodes}},{"../../types":77}],47:[function(require,module,exports){var traverse=require("../../traverse");var util=require("../../util");var t=require("../../types");exports.Property=function(node,parent,file,scope){if(!node.method)return;node.method=false;var key=t.toComputedKey(node,node.key);if(!t.isLiteral(key))return;var id=t.toIdentifier(key.value);key=t.identifier(id);var selfReference=false;var outerDeclar=scope.get(id,true);traverse(node,{enter:function(node,parent,scope){if(!t.isIdentifier(node,{name:id}))return;if(!t.isReferenced(node,parent))return;var localDeclar=scope.get(id,true);if(localDeclar!==outerDeclar)return;selfReference=true;this.stop()}},scope);if(selfReference){node.value=util.template("property-method-assignment-wrapper",{FUNCTION:node.value,FUNCTION_ID:key,FUNCTION_KEY:file.generateUidIdentifier(id,scope),WRAPPER_KEY:file.generateUidIdentifier(id+"Wrapper",scope)})}else{node.value.id=key}};exports.ObjectExpression=function(node,parent,file,scope){var mutatorMap={};var hasAny=false;node.properties=node.properties.filter(function(prop){if(prop.kind==="get"||prop.kind==="set"){hasAny=true;util.pushMutatorMap(mutatorMap,prop.key,prop.kind,prop.value);return false}else{return true}});if(!hasAny)return;if(node.properties.length){var objId=scope.generateUidBasedOnNode(parent,file);return util.template("object-define-properties-closure",{KEY:objId,OBJECT:node,CONTENT:util.template("object-define-properties",{OBJECT:objId,PROPS:util.buildDefineProperties(mutatorMap)})})}else{return util.template("object-define-properties",{OBJECT:node,PROPS:util.buildDefineProperties(mutatorMap)})}}},{"../../traverse":73,"../../types":77,"../../util":79}],48:[function(require,module,exports){var t=require("../../types");var _=require("lodash");exports.Property=function(node){if(!node.shorthand)return;node.shorthand=false;node.key=t.removeComments(_.clone(node.key))}},{"../../types":77,lodash:127}],49:[function(require,module,exports){var t=require("../../types");exports.Function=function(node,parent,file){if(!node.rest)return;var rest=node.rest;delete node.rest;t.ensureBlock(node);var call=file.toArray(t.identifier("arguments"));if(node.params.length){call.arguments.push(t.literal(node.params.length))}call._ignoreAliasFunctions=true;node.body.body.unshift(t.variableDeclaration("var",[t.variableDeclarator(rest,call)]))}},{"../../types":77}],50:[function(require,module,exports){var t=require("../../types");var getSpreadLiteral=function(spread,file){return file.toArray(spread.argument)};var hasSpread=function(nodes){for(var i in nodes){if(t.isSpreadElement(nodes[i])){return true}}return false};var build=function(props,file){var nodes=[];var _props=[];var push=function(){if(!_props.length)return;nodes.push(t.arrayExpression(_props));_props=[]};for(var i in props){var prop=props[i];if(t.isSpreadElement(prop)){push();nodes.push(getSpreadLiteral(prop,file))}else{_props.push(prop)}}push();return nodes};exports.ArrayExpression=function(node,parent,file){var elements=node.elements;if(!hasSpread(elements))return;var nodes=build(elements,file);var first=nodes.shift();if(!t.isArrayExpression(first)){nodes.unshift(first);first=t.arrayExpression([])}return t.callExpression(t.memberExpression(first,t.identifier("concat")),nodes)};exports.CallExpression=function(node,parent,file,scope){var args=node.arguments;if(!hasSpread(args))return;var contextLiteral=t.literal(null);node.arguments=[];var nodes;if(args.length===1&&args[0].argument.name==="arguments"){nodes=[args[0].argument]}else{nodes=build(args,file)}var first=nodes.shift();if(nodes.length){node.arguments.push(t.callExpression(t.memberExpression(first,t.identifier("concat")),nodes))}else{node.arguments.push(first)}var callee=node.callee;if(t.isMemberExpression(callee)){var temp=scope.generateTempBasedOnNode(callee.object,file);if(temp){callee.object=t.assignmentExpression("=",temp,callee.object);contextLiteral=temp}t.appendToMemberExpression(callee,t.identifier("apply"))}else{node.callee=t.memberExpression(node.callee,t.identifier("apply"))}node.arguments.unshift(contextLiteral)};exports.NewExpression=function(node,parent,file){var args=node.arguments;if(!hasSpread(args))return;var nodes=build(args,file);var first=nodes.shift();if(nodes.length){args=t.callExpression(t.memberExpression(first,t.identifier("concat")),nodes)}else{args=first}return t.callExpression(file.addHelper("apply-constructor"),[node.callee,args])}},{"../../types":77}],51:[function(require,module,exports){var t=require("../../types");var buildBinaryExpression=function(left,right){return t.binaryExpression("+",left,right)};exports.TaggedTemplateExpression=function(node,parent,file){var args=[];var quasi=node.quasi;var strings=[];var raw=[];for(var i in quasi.quasis){var elem=quasi.quasis[i];strings.push(t.literal(elem.value.cooked));raw.push(t.literal(elem.value.raw))}args.push(t.callExpression(file.addHelper("tagged-template-literal"),[t.arrayExpression(strings),t.arrayExpression(raw)]));args=args.concat(quasi.expressions);return t.callExpression(node.tag,args)};exports.TemplateLiteral=function(node){var nodes=[];var i;for(i in node.quasis){var elem=node.quasis[i];nodes.push(t.literal(elem.value.cooked));var expr=node.expressions.shift();if(expr)nodes.push(expr)}if(nodes.length>1){var last=nodes[nodes.length-1];if(t.isLiteral(last,{value:""}))nodes.pop();var root=buildBinaryExpression(nodes.shift(),nodes.shift());for(i in nodes){root=buildBinaryExpression(root,nodes[i])}return root}else{return nodes[0]}}},{"../../types":77}],52:[function(require,module,exports){var rewritePattern=require("regexpu/rewrite-pattern");var _=require("lodash");exports.Literal=function(node){var regex=node.regex;if(!regex)return;var flags=regex.flags.split("");if(regex.flags.indexOf("u")<0)return;_.pull(flags,"u");regex.pattern=rewritePattern(regex.pattern,regex.flags);regex.flags=flags.join("")}},{lodash:127,"regexpu/rewrite-pattern":168}],53:[function(require,module,exports){var util=require("../../util");var t=require("../../types");exports.experimental=true;var container=function(parent,call,ret){if(t.isExpressionStatement(parent)){return call}else{var exprs=[];if(t.isSequenceExpression(call)){exprs=call.expressions}else{exprs.push(call)}exprs.push(ret);return t.sequenceExpression(exprs)}};exports.AssignmentExpression=function(node,parent,file,scope){var left=node.left;if(!t.isVirtualPropertyExpression(left))return;var value=node.right;var temp;if(!t.isExpressionStatement(parent)){temp=scope.generateTempBasedOnNode(node.right,file);if(temp)value=temp}if(node.operator!=="="){value=t.binaryExpression(node.operator[0],util.template("abstract-expression-get",{PROPERTY:node.property,OBJECT:node.object}),value)}var call=util.template("abstract-expression-set",{PROPERTY:left.property,OBJECT:left.object,VALUE:value});if(temp){call=t.sequenceExpression([t.assignmentExpression("=",temp,node.right),call])}return container(parent,call,value)};exports.UnaryExpression=function(node,parent){var arg=node.argument;if(!t.isVirtualPropertyExpression(arg))return;if(node.operator!=="delete")return;var call=util.template("abstract-expression-delete",{PROPERTY:arg.property,OBJECT:arg.object});return container(parent,call,t.literal(true))};exports.CallExpression=function(node,parent,file,scope){var callee=node.callee;if(!t.isVirtualPropertyExpression(callee))return;var temp=scope.generateTempBasedOnNode(callee.object,file);var call=util.template("abstract-expression-call",{PROPERTY:callee.property,OBJECT:temp||callee.object});call.arguments=call.arguments.concat(node.arguments);if(temp){return t.sequenceExpression([t.assignmentExpression("=",temp,callee.object),call])}else{return call}};exports.VirtualPropertyExpression=function(node){return util.template("abstract-expression-get",{PROPERTY:node.property,OBJECT:node.object})};exports.PrivateDeclaration=function(node){return t.variableDeclaration("const",node.declarations.map(function(id){return t.variableDeclarator(id,t.newExpression(t.identifier("WeakMap"),[]))}))}},{"../../types":77,"../../util":79}],54:[function(require,module,exports){var traverse=require("../../traverse");var util=require("../../util");var t=require("../../types");exports.experimental=true;var build=function(node,parent,file,scope){var uid=scope.generateUidBasedOnNode(parent,file);var container=util.template("array-comprehension-container",{KEY:uid});container.callee._aliasFunction=true;var block=container.callee.body;var body=block.body;if(traverse.hasType(node,"YieldExpression",t.FUNCTION_TYPES)){container.callee.generator=true;container=t.yieldExpression(container,true)}var returnStatement=body.pop();body.push(exports._build(node,function(){return util.template("array-push",{STATEMENT:node.body,KEY:uid},true)}));body.push(returnStatement);return container};exports._build=function(node,buildBody){var self=node.blocks.shift();if(!self)return;var child=exports._build(node,buildBody);if(!child){child=buildBody();if(node.filter){child=t.ifStatement(node.filter,t.blockStatement([child]))}}return t.forOfStatement(t.variableDeclaration("let",[t.variableDeclarator(self.left)]),self.right,t.blockStatement([child]))};exports.ComprehensionExpression=function(node,parent,file,scope){if(node.generator)return;return build(node,parent,file,scope)}},{"../../traverse":73,"../../types":77,"../../util":79}],55:[function(require,module,exports){exports.experimental=true;var t=require("../../types");var pow=t.memberExpression(t.identifier("Math"),t.identifier("pow"));exports.AssignmentExpression=function(node){if(node.operator!=="**=")return;node.operator="=";node.right=t.callExpression(pow,[node.left,node.right])};exports.BinaryExpression=function(node){if(node.operator!=="**")return;return t.callExpression(pow,[node.left,node.right])}},{"../../types":77}],56:[function(require,module,exports){var arrayComprehension=require("./es7-array-comprehension");var t=require("../../types");exports.experimental=true;exports.ComprehensionExpression=function(node){if(!node.generator)return;var body=[];var container=t.functionExpression(null,[],t.blockStatement(body),true);container._aliasFunction=true;body.push(arrayComprehension._build(node,function(){return t.expressionStatement(t.yieldExpression(node.body))}));return t.callExpression(container,[])}},{"../../types":77,"./es7-array-comprehension":54}],57:[function(require,module,exports){var t=require("../../types");exports.experimental=true;exports.ObjectExpression=function(node){var hasSpread=false;var i;var prop;for(i in node.properties){prop=node.properties[i];if(t.isSpreadProperty(prop)){hasSpread=true;break}}if(!hasSpread)return;var args=[];var props=[];var push=function(){if(!props.length)return;args.push(t.objectExpression(props));props=[]};for(i in node.properties){prop=node.properties[i];if(t.isSpreadProperty(prop)){push();args.push(prop.argument)}else{props.push(prop)}}push();if(!t.isObjectExpression(args[0])){args.unshift(t.objectExpression([]))}return t.callExpression(t.memberExpression(t.identifier("Object"),t.identifier("assign")),args)}},{"../../types":77}],58:[function(require,module,exports){var bluebirdCoroutines=require("./optional-bluebird-coroutines");exports.optional=true;exports.manipulateOptions=bluebirdCoroutines.manipulateOptions;exports.Function=function(node,parent,file){if(!node.async||node.generator)return;return bluebirdCoroutines._Function(node,file.addHelper("async-to-generator"))}},{"./optional-bluebird-coroutines":59}],59:[function(require,module,exports){var traverse=require("../../traverse");var t=require("../../types");exports.manipulateOptions=function(opts){opts.experimental=true;opts.blacklist.push("generators")};exports.optional=true;exports._Function=function(node,callId){node.async=false;node.generator=true;traverse(node,{enter:function(node){if(t.isFunction(node))this.skip();if(t.isAwaitExpression(node)){node.type="YieldExpression"}}});var call=t.callExpression(callId,[node]);if(t.isFunctionDeclaration(node)){var declar=t.variableDeclaration("var",[t.variableDeclarator(node.id,call)]);declar._blockHoist=true;return declar}else{return call}};exports.Function=function(node,parent,file){if(!node.async||node.generator)return;var id=t.identifier("Bluebird");file.addImport(id,"bluebird");return exports._Function(node,t.memberExpression(id,t.identifier("coroutine")))}},{"../../traverse":73,"../../types":77}],60:[function(require,module,exports){var traverse=require("../../traverse");var util=require("../../util");var core=require("core-js/library");var t=require("../../types");var _=require("lodash");var coreHas=function(node){return node.name!=="_"&&_.has(core,node.name)};exports.optional=true;exports.ast={enter:function(ast,file){file._coreId=file.generateUidIdentifier("core");file.addImport(file._coreId,"core-js/library")},exit:function(ast,file){traverse(ast,{enter:function(node,parent){var prop;if(t.isMemberExpression(node)&&t.isReferenced(node,parent)){var obj=node.object;prop=node.property;if(!t.isReferenced(obj,node))return;if(!node.computed&&coreHas(obj)&&_.has(core[obj.name],prop.name)){this.skip();return t.prependToMemberExpression(node,file._coreId)}}else if(t.isIdentifier(node)&&!t.isMemberExpression(parent)&&t.isReferenced(node,parent)&&coreHas(node)){return t.memberExpression(file._coreId,node)}else if(t.isCallExpression(node)){if(node.arguments.length)return;var callee=node.callee;if(!t.isMemberExpression(callee))return;if(!callee.computed)return;prop=callee.property;if(!t.isIdentifier(prop.object,{name:"Symbol"}))return;if(!t.isIdentifier(prop.property,{name:"iterator"}))return;return util.template("corejs-iterator",{CORE_ID:file._coreId,VALUE:callee.object})}}})}}},{"../../traverse":73,"../../types":77,"../../util":79,"core-js/library":120,lodash:127}],61:[function(require,module,exports){var t=require("../../types");var _=require("lodash");var OBJECT_ASSIGN_MEMBER=t.memberExpression(t.identifier("Object"),t.identifier("assign"));var isProtoKey=function(node){return t.isLiteral(t.toComputedKey(node,node.key),{value:"__proto__"})};var isProtoAssignmentExpression=function(node){var left=node.left;return t.isMemberExpression(left)&&t.isLiteral(t.toComputedKey(left,left.property),{value:"__proto__"})};var buildDefaultsCallExpression=function(expr,ref,file){return t.expressionStatement(t.callExpression(file.addHelper("defaults"),[ref,expr.right]))};exports.optional=true;exports.secondPass=true;exports.AssignmentExpression=function(node,parent,file,scope){if(t.isExpressionStatement(parent))return;if(!isProtoAssignmentExpression(node))return;var nodes=[];var left=node.left.object;var temp=scope.generateTempBasedOnNode(node.left.object,file);nodes.push(t.expressionStatement(t.assignmentExpression("=",temp,left)));nodes.push(buildDefaultsCallExpression(node,temp,file));if(temp)nodes.push(temp);return t.toSequenceExpression(nodes)};exports.ExpressionStatement=function(node,parent,file){var expr=node.expression;if(!t.isAssignmentExpression(expr,{operator:"="}))return;if(isProtoAssignmentExpression(expr)){return buildDefaultsCallExpression(expr,expr.left.object,file)}};exports.ObjectExpression=function(node){var proto;for(var i in node.properties){var prop=node.properties[i];if(isProtoKey(prop)){proto=prop.value;_.pull(node.properties,prop)}}if(proto){var args=[t.objectExpression([]),proto];if(node.properties.length)args.push(node);return t.callExpression(OBJECT_ASSIGN_MEMBER,args)}}},{"../../types":77,lodash:127}],62:[function(require,module,exports){var t=require("../../types");exports.optional=true;exports.Identifier=function(node,parent){if(node.name==="undefined"&&t.isReferenced(node,parent)){return t.unaryExpression("void",t.literal(0),true)}}},{"../../types":77}],63:[function(require,module,exports){var t=require("../../types");var isMemo=function(node){var is=t.isAssignmentExpression(node)&&node.operator==="?=";if(is)t.assertMemberExpression(node.left);return is};var getPropRef=function(nodes,prop,file,scope){if(t.isIdentifier(prop)){return t.literal(prop.name)}else{var temp=scope.generateUidBasedOnNode(prop,file);nodes.push(t.variableDeclaration("var",[t.variableDeclarator(temp,prop)]));return temp}};var getObjRef=function(nodes,obj,file,scope){var temp=scope.generateUidBasedOnNode(obj,file);nodes.push(t.variableDeclaration("var",[t.variableDeclarator(temp,obj)]));return temp};var buildHasOwn=function(obj,prop,file){return t.unaryExpression("!",t.callExpression(t.memberExpression(file.addHelper("has-own"),t.identifier("call")),[obj,prop]),true)};var buildAbsoluteRef=function(left,obj,prop){var computed=left.computed||t.isLiteral(prop);return t.memberExpression(obj,prop,computed)};var buildAssignment=function(expr,obj,prop){return t.assignmentExpression("=",buildAbsoluteRef(expr.left,obj,prop),expr.right)};exports.ExpressionStatement=function(node,parent,file,scope){var expr=node.expression;if(!isMemo(expr))return;var nodes=[];var left=expr.left;var obj=getObjRef(nodes,left.object,file,scope);var prop=getPropRef(nodes,left.property,file,scope);nodes.push(t.ifStatement(buildHasOwn(obj,prop,file),t.expressionStatement(buildAssignment(expr,obj,prop))));return nodes};exports.AssignmentExpression=function(node,parent,file,scope){if(t.isExpressionStatement(parent))return;if(!isMemo(node))return;var nodes=[];var left=node.left;var obj=getObjRef(nodes,left.object,file,scope);var prop=getPropRef(nodes,left.property,file,scope);nodes.push(t.logicalExpression("&&",buildHasOwn(obj,prop,file),buildAssignment(node,obj,prop)));nodes.push(buildAbsoluteRef(left,obj,prop));return t.toSequenceExpression(nodes,scope)}},{"../../types":77}],64:[function(require,module,exports){var t=require("../../types");exports.BindMemberExpression=function(node,parent,file,scope){var object=node.object;var prop=node.property;var temp=scope.generateTempBasedOnNode(node.object,file);if(temp)object=temp;var call=t.callExpression(t.memberExpression(t.memberExpression(object,prop),t.identifier("bind")),[object].concat(node.arguments));if(temp){return t.sequenceExpression([t.assignmentExpression("=",temp,node.object),call])}else{return call}};exports.BindFunctionExpression=function(node,parent,file,scope){var buildCall=function(args){var param=file.generateUidIdentifier("val",scope);return t.functionExpression(null,[param],t.blockStatement([t.returnStatement(t.callExpression(t.memberExpression(param,node.callee),args))]))};var temp=scope.generateTemp(file,"args");return t.sequenceExpression([t.assignmentExpression("=",temp,t.arrayExpression(node.arguments)),buildCall(node.arguments.map(function(node,i){return t.memberExpression(temp,t.literal(i),true)}))])}},{"../../types":77}],65:[function(require,module,exports){var traverse=require("../../traverse");var t=require("../../types");exports.Property=exports.MethodDefinition=function(node,parent,file){if(node.kind!=="memo")return;node.kind="get";var value=node.value;t.ensureBlock(value);var key=node.key;if(t.isIdentifier(key)&&!node.computed){key=t.literal(key.name)}traverse(value,{enter:function(node){if(t.isFunction(node))return;if(t.isReturnStatement(node)&&node.argument){node.argument=t.memberExpression(t.callExpression(file.addHelper("define-property"),[t.thisExpression(),key,node.argument]),key,true)}}})}},{"../../traverse":73,"../../types":77}],66:[function(require,module,exports){var esutils=require("esutils");var t=require("../../types");exports.XJSIdentifier=function(node){if(esutils.keyword.isIdentifierName(node.name)){node.type="Identifier"}else{return t.literal(node.name)}};exports.XJSNamespacedName=function(node,parent,file){throw file.errorWithNode(node,"Namespace tags are not supported. ReactJSX is not XML.")};exports.XJSMemberExpression={exit:function(node){node.computed=t.isLiteral(node.property);node.type="MemberExpression"}};exports.XJSExpressionContainer=function(node){return node.expression};exports.XJSAttribute={exit:function(node){var value=node.value||t.literal(true);return t.property("init",node.name,value)}};exports.XJSOpeningElement={exit:function(node){var tagExpr=node.name;var args=[];var tagName;if(t.isIdentifier(tagExpr)){tagName=tagExpr.name}else if(t.isLiteral(tagExpr)){tagName=tagExpr.value}if(tagName&&(/[a-z]/.exec(tagName[0])||tagName.indexOf("-")>=0)){args.push(t.literal(tagName))}else{args.push(tagExpr)}var props=node.attributes;if(props.length){var _props=[];var objs=[];var pushProps=function(){if(!_props.length)return;objs.push(t.objectExpression(_props));_props=[]};while(props.length){var prop=props.shift();if(t.isXJSSpreadAttribute(prop)){pushProps();objs.push(prop.argument)}else{_props.push(prop)}}pushProps();if(objs.length===1){props=objs[0]}else{if(!t.isObjectExpression(objs[0])){objs.unshift(t.objectExpression([]))}props=t.callExpression(t.memberExpression(t.identifier("React"),t.identifier("__spread")),objs)}}else{props=t.literal(null)}args.push(props);tagExpr=t.memberExpression(t.identifier("React"),t.identifier("createElement"));return t.callExpression(tagExpr,args)}};exports.XJSElement={exit:function(node){var callExpr=node.openingElement;var i;for(i in node.children){var child=node.children[i];if(t.isLiteral(child)){var lines=child.value.split(/\r\n|\n|\r/);for(i in lines){var line=lines[i];var isFirstLine=i==="0";var isLastLine=+i===lines.length-1;var trimmedLine=line.replace(/\t/g," ");if(!isFirstLine){trimmedLine=trimmedLine.replace(/^[ ]+/,"")}if(!isLastLine){trimmedLine=trimmedLine.replace(/[ ]+$/,"")}if(trimmedLine){callExpr.arguments.push(t.literal(trimmedLine))}}continue}else if(t.isXJSEmptyExpression(child)){continue}callExpr.arguments.push(child)}return t.inherits(callExpr,node)}};var addDisplayName=function(id,call){if(!call||!t.isCallExpression(call))return;var callee=call.callee;if(!t.isMemberExpression(callee))return;var obj=callee.object;if(!t.isIdentifier(obj,{name:"React"}))return;var prop=callee.property;if(!t.isIdentifier(prop,{name:"createClass"}))return;var args=call.arguments;if(args.length!==1)return;var first=args[0];if(!t.isObjectExpression(first))return;var props=first.properties;var safe=true;for(var i in props){prop=props[i];if(t.isIdentifier(prop.key,{name:"displayName"})){safe=false;break}}if(safe){props.unshift(t.property("init",t.identifier("displayName"),t.literal(id)))}};exports.AssignmentExpression=exports.Property=exports.VariableDeclarator=function(node){var left,right;if(t.isAssignmentExpression(node)){left=node.left;right=node.right}else if(t.isProperty(node)){left=node.key;right=node.value}else if(t.isVariableDeclarator(node)){left=node.id;right=node.init}if(t.isMemberExpression(left)){left=left.property}if(t.isIdentifier(left)){addDisplayName(left.name,right)}}},{"../../types":77,esutils:125}],67:[function(require,module,exports){var t=require("../../types");exports.BlockStatement=function(node,parent){if(t.isFunction(parent))return;node.body=node.body.map(function(node){if(t.isFunction(node)){node.type="FunctionExpression";var declar=t.variableDeclaration("let",[t.variableDeclarator(node.id,node)]);declar._blockHoist=true;return declar}else{return node}})}},{"../../types":77}],68:[function(require,module,exports){var esutils=require("esutils");var t=require("../../types");exports.MemberExpression=function(node){var prop=node.property;if(node.computed&&t.isLiteral(prop)&&t.isValidIdentifier(prop.value)){node.property=t.identifier(prop.value);node.computed=false}else if(!node.computed&&t.isIdentifier(prop)&&esutils.keyword.isKeywordES6(prop.name,true)){node.property=t.literal(prop.name);node.computed=true}}},{"../../types":77,esutils:125}],69:[function(require,module,exports){var t=require("../../types");exports.ObjectExpression=function(node,parent,file){var keys=[];for(var i in node.properties){var prop=node.properties[i];if(prop.computed||prop.kind!=="init")continue;var key=prop.key;if(t.isIdentifier(key)){key=key.name}else if(t.isLiteral(key)){key=key.value}else{continue}if(keys.indexOf(key)>=0){throw file.errorWithNode(prop.key,"Duplicate property key")}else{keys.push(key)}}}},{"../../types":77}],70:[function(require,module,exports){var t=require("../../types");exports.ForInStatement=exports.ForOfStatement=function(node,parent,file){var left=node.left;if(t.isVariableDeclaration(left)){var declar=left.declarations[0];if(declar.init)throw file.errorWithNode(declar,"No assignments allowed in for-in/of head")}}},{"../../types":77}],71:[function(require,module,exports){var esutils=require("esutils");var t=require("../../types");exports.Property=function(node){var key=node.key;if(t.isLiteral(key)&&t.isValidIdentifier(key.value)){node.key=t.identifier(key.value);node.computed=false}else if(!node.computed&&t.isIdentifier(key)&&esutils.keyword.isKeywordES6(key.name,true)){node.key=t.literal(key.name)}}},{"../../types":77,esutils:125}],72:[function(require,module,exports){var t=require("../../types");exports.ast={exit:function(ast){var body=ast.program.body;var first=body[0];var noStrict=!first||!t.isExpressionStatement(first)||!t.isLiteral(first.expression)||first.expression.value!=="use strict";if(noStrict){body.unshift(t.expressionStatement(t.literal("use strict")))}}}},{"../../types":77}],73:[function(require,module,exports){module.exports=traverse;var Scope=require("./scope");var t=require("../types");var _=require("lodash");function traverse(parent,opts,scope){if(!parent)return;if(_.isArray(parent)){_.each(parent,function(node){traverse(node,opts,scope)});return}var keys=t.VISITOR_KEYS[parent.type];if(!keys)return;opts=opts||{};var stopped=false;for(var i in keys){var key=keys[i];var nodes=parent[key];if(!nodes)continue;var flatten=false;var handle=function(obj,key){var node=obj[key];if(!node)return;if(opts.blacklist&&opts.blacklist.indexOf(node.type)>-1)return;var maybeReplace=function(result){if(result===false)return;if(result==null)return;var isArray=_.isArray(result);var inheritTo=result;if(isArray)inheritTo=result[0];if(inheritTo)t.inheritsComments(inheritTo,node);node=obj[key]=result;if(isArray)flatten=true;if(isArray&&_.contains(t.STATEMENT_OR_BLOCK_KEYS,key)&&!t.isBlockStatement(obj)){t.ensureBlock(obj,key)}};var skipped=false;var removed=false;var context={stop:function(){skipped=stopped=true},skip:function(){skipped=true},remove:function(){this.skip();removed=true}};var ourScope=scope;if(t.isScope(node))ourScope=new Scope(node,scope);if(opts.enter){var result=opts.enter.call(context,node,parent,ourScope);maybeReplace(result);if(removed){obj[key]=null;flatten=true}if(skipped)return}traverse(node,opts,ourScope);if(opts.exit){maybeReplace(opts.exit.call(context,node,parent,ourScope))}};if(_.isArray(nodes)){for(i in nodes){handle(nodes,i);if(stopped)return}if(flatten){parent[key]=_.flatten(parent[key]);if(key==="body"){parent[key]=_.compact(parent[key])}}}else{handle(parent,key);if(stopped)return}}}traverse.removeProperties=function(tree){var clear=function(node){delete node._declarations;delete node.extendedRange;delete node._scopeInfo;delete node.tokens;delete node.range;delete node.start;delete node.end;delete node.loc;delete node.raw;clearComments(node.trailingComments);clearComments(node.leadingComments)};var clearComments=function(comments){_.each(comments,clear)};clear(tree);traverse(tree,{enter:clear});return tree};traverse.hasType=function(tree,type,blacklistTypes){blacklistTypes=[].concat(blacklistTypes||[]);var has=false;if(_.contains(blacklistTypes,tree.type))return false;if(tree.type===type)return true;traverse(tree,{blacklist:blacklistTypes,enter:function(node){if(node.type===type){has=true;this.skip()}}});return has}},{"../types":77,"./scope":74,lodash:127}],74:[function(require,module,exports){module.exports=Scope;var traverse=require("./index");var t=require("../types");var _=require("lodash");var FOR_KEYS=["left","init"];function Scope(block,parent){this.parent=parent;this.block=block;var info=this.getInfo();this.references=info.references;this.declarations=info.declarations}var vars=require("jshint/src/vars");Scope.defaultDeclarations=_.flatten([vars.newEcmaIdentifiers,vars.node,vars.ecmaIdentifiers,vars.reservedVars].map(_.keys));Scope.add=function(node,references){if(!node)return;_.defaults(references,t.getIds(node,true))};Scope.prototype.generateTemp=function(file,name){var id=file.generateUidIdentifier(name||"temp",this);this.push({key:id.name,id:id});return id};Scope.prototype.generateUidBasedOnNode=function(parent,file){var node=parent;
if(t.isAssignmentExpression(parent)){node=parent.left}else if(t.isVariableDeclarator(parent)){node=parent.id}var id="ref";if(t.isProperty(node)){node=node.key}if(t.isIdentifier(node)){id=node.name}else if(t.isLiteral(node)){id=node.value}else if(t.isMemberExpression(node)){var parts=[];var add=function(node){if(t.isMemberExpression(node)){add(node.object);add(node.property)}else if(t.isIdentifier(node)){parts.push(node.name)}else if(t.isLiteral(node)){parts.push(node.value)}};add(node);id=parts.join("$")}id=id.replace(/^_/,"");return file.generateUidIdentifier(id,this)};Scope.prototype.generateTempBasedOnNode=function(node,file){if(!t.isIdentifier(node)&&!t.isMemberExpression(node)){throw new TypeError("Invalid node type "+JSON.stringify(node.type)+" passed to Scope.prototype.generateTempBasedOnNode")}if(t.isIdentifier(node)&&this.has(node.name,true)){return null}var id=this.generateUidBasedOnNode(node,file);this.push({key:id.name,id:id});return id};Scope.prototype.getInfo=function(){var block=this.block;if(block._scopeInfo)return block._scopeInfo;var info=block._scopeInfo={};var references=info.references={};var declarations=info.declarations={};var add=function(node,reference){Scope.add(node,references);if(!reference)Scope.add(node,declarations)};if(t.isFor(block)){_.each(FOR_KEYS,function(key){var node=block[key];if(t.isLet(node))add(node)});block=block.body}if(t.isBlockStatement(block)||t.isProgram(block)){_.each(block.body,function(node){if(t.isLet(node))add(node)})}if(t.isCatchClause(block)){add(block.param)}if(t.isProgram(block)||t.isFunction(block)){traverse(block,{enter:function(node,parent,scope){if(t.isFor(node)){_.each(FOR_KEYS,function(key){var declar=node[key];if(t.isVar(declar))add(declar)})}if(t.isFunction(node))return this.skip();if(block.id&&node===block.id)return;if(t.isIdentifier(node)&&t.isReferenced(node,parent)&&!scope.has(node.name)){add(node,true)}if(t.isDeclaration(node)&&!t.isLet(node)){add(node)}}},this)}if(t.isFunction(block)){add(block.rest);_.each(block.params,function(param){add(param)})}return info};Scope.prototype.push=function(opts){var block=this.block;if(t.isFor(block)||t.isCatchClause(block)||t.isFunction(block)){t.ensureBlock(block);block=block.body}if(t.isBlockStatement(block)||t.isProgram(block)){block._declarations=block._declarations||{};block._declarations[opts.key]={kind:opts.kind,id:opts.id,init:opts.init}}else{throw new TypeError("cannot add a declaration here in node type "+block.type)}};Scope.prototype.add=function(node){Scope.add(node,this.references)};Scope.prototype.get=function(id,decl){return id&&(this.getOwn(id,decl)||this.parentGet(id,decl))};Scope.prototype.getOwn=function(id,decl){var refs=this.references;if(decl)refs=this.declarations;return _.has(refs,id)&&refs[id]};Scope.prototype.parentGet=function(id,decl){return this.parent&&this.parent.get(id,decl)};Scope.prototype.has=function(id,decl){return id&&(this.hasOwn(id,decl)||this.parentHas(id,decl))||_.contains(Scope.defaultDeclarations,id)};Scope.prototype.hasOwn=function(id,decl){return!!this.getOwn(id,decl)};Scope.prototype.parentHas=function(id,decl){return this.parent&&this.parent.has(id,decl)}},{"../types":77,"./index":73,"jshint/src/vars":126,lodash:127}],75:[function(require,module,exports){module.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"],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"],Property:["UserWhitespacable"],XJSElement:["UserWhitespacable","Expression"],ArrayExpression:["Expression"],AssignmentExpression:["Expression"],AwaitExpression:["Expression"],BindFunctionExpression:["Expression"],BindMemberExpression:["Expression"],CallExpression:["Expression"],ComprehensionExpression:["Expression"],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"]}},{}],76:[function(require,module,exports){module.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"],Identifier:["name"],IfStatement:["test","consequent","alternate"],ImportDeclaration:["specifiers","source"],ImportSpecifier:["id","name"],Literal:["value"],LogicalExpression:["operator","left","right"],MemberExpression:["object","property","computed"],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"]}},{}],77:[function(require,module,exports){var esutils=require("esutils");var _=require("lodash");var t=exports;var addAssert=function(type,is){t["assert"+type]=function(node,opts){opts=opts||{};if(!is(node,opts)){throw new Error("Expected type "+JSON.stringify(type)+" with option "+JSON.stringify(opts))}}};t.STATEMENT_OR_BLOCK_KEYS=["consequent","body"];t.VISITOR_KEYS=require("./visitor-keys");_.each(t.VISITOR_KEYS,function(keys,type){var is=t["is"+type]=function(node,opts){return node&&node.type===type&&t.shallowEqual(node,opts)};addAssert(type,is)});t.BUILDER_KEYS=_.defaults(require("./builder-keys"),t.VISITOR_KEYS);_.each(t.BUILDER_KEYS,function(keys,type){t[type[0].toLowerCase()+type.slice(1)]=function(){var args=arguments;var node={type:type};_.each(keys,function(key,i){node[key]=args[i]});return node}});t.ALIAS_KEYS=require("./alias-keys");t.FLIPPED_ALIAS_KEYS={};_.each(t.ALIAS_KEYS,function(aliases,type){_.each(aliases,function(alias){var types=t.FLIPPED_ALIAS_KEYS[alias]=t.FLIPPED_ALIAS_KEYS[alias]||[];types.push(type)})});_.each(t.FLIPPED_ALIAS_KEYS,function(types,type){t[type.toUpperCase()+"_TYPES"]=types;var is=t["is"+type]=function(node,opts){return node&&types.indexOf(node.type)>=0&&t.shallowEqual(node,opts)};addAssert(type,is)});t.toComputedKey=function(node,key){if(!node.computed){if(t.isIdentifier(key))key=t.literal(key.name)}return key};t.isFalsyExpression=function(node){if(t.isLiteral(node)){return!node.value}else if(t.isIdentifier(node)){return node.name==="undefined"}return false};t.toSequenceExpression=function(nodes,scope){var exprs=[];_.each(nodes,function(node){if(t.isExpression(node)){exprs.push(node)}if(t.isExpressionStatement(node)){exprs.push(node.expression)}else if(t.isVariableDeclaration(node)){_.each(node.declarations,function(declar){scope.push({kind:node.kind,key:declar.id.name,id:declar.id});exprs.push(t.assignmentExpression("=",declar.id,declar.init))})}});if(exprs.length===1){return exprs[0]}else{return t.sequenceExpression(exprs)}};t.shallowEqual=function(actual,expected){var same=true;if(expected){_.each(expected,function(val,key){if(actual[key]!==val){return same=false}})}return same};t.appendToMemberExpression=function(member,append,computed){member.object=t.memberExpression(member.object,member.property,member.computed);member.property=append;member.computed=!!computed;return member};t.prependToMemberExpression=function(member,append){member.object=t.memberExpression(append,member.object);return member};t.isReferenced=function(node,parent){if(t.isProperty(parent)&&parent.key===node&&!parent.computed)return false;if(t.isVariableDeclarator(parent)&&parent.id===node)return false;var isMemberExpression=t.isMemberExpression(parent);var isComputedProperty=isMemberExpression&&parent.property===node&&parent.computed;var isObject=isMemberExpression&&parent.object===node;if(!isMemberExpression||isComputedProperty||isObject)return true;return false};t.isValidIdentifier=function(name){return _.isString(name)&&esutils.keyword.isIdentifierName(name)&&!esutils.keyword.isKeywordES6(name,true)};t.toIdentifier=function(name){if(t.isIdentifier(name))return name.name;name=name.replace(/[^a-zA-Z0-9$_]/g,"-");name=name.replace(/^[-0-9]+/,"");name=name.replace(/[-_\s]+(.)?/g,function(match,c){return c?c.toUpperCase():""});name=name.replace(/^\_/,"");return name||"_"};t.ensureBlock=function(node,key){key=key||"body";node[key]=t.toBlock(node[key],node)};t.toStatement=function(node,ignore){if(t.isStatement(node)){return node}var mustHaveId=false;var newType;if(t.isClass(node)){mustHaveId=true;newType="ClassDeclaration"}else if(t.isFunction(node)){mustHaveId=true;newType="FunctionDeclaration"}if(mustHaveId&&!node.id){newType=false}if(!newType){if(ignore){return false}else{throw new Error("cannot turn "+node.type+" to a statement")}}node.type=newType;return node};t.toBlock=function(node,parent){if(t.isBlockStatement(node)){return node}if(!_.isArray(node)){if(!t.isStatement(node)){if(t.isFunction(parent)){node=t.returnStatement(node)}else{node=t.expressionStatement(node)}}node=[node]}return t.blockStatement(node)};t.getIds=function(node,map,ignoreTypes){ignoreTypes=ignoreTypes||[];var search=[].concat(node);var ids={};while(search.length){var id=search.shift();if(!id)continue;if(_.contains(ignoreTypes,id.type))continue;var nodeKey=t.getIds.nodes[id.type];var arrKeys=t.getIds.arrays[id.type];if(t.isIdentifier(id)){ids[id.name]=id}else if(nodeKey){if(id[nodeKey])search.push(id[nodeKey])}else if(arrKeys){for(var i in arrKeys){var key=arrKeys[i];search=search.concat(id[key]||[])}}}if(!map)ids=_.keys(ids);return ids};t.getIds.nodes={AssignmentExpression:"left",ImportSpecifier:"name",ExportSpecifier:"name",VariableDeclarator:"id",FunctionDeclaration:"id",ClassDeclaration:"id",MemeberExpression:"object",SpreadElement:"argument",Property:"value"};t.getIds.arrays={ExportDeclaration:["specifiers","declaration"],ImportDeclaration:["specifiers"],VariableDeclaration:["declarations"],ArrayPattern:["elements"],ObjectPattern:["properties"]};t.isLet=function(node){return t.isVariableDeclaration(node)&&(node.kind!=="var"||node._let)};t.isVar=function(node){return t.isVariableDeclaration(node,{kind:"var"})&&!node._let};t.COMMENT_KEYS=["leadingComments","trailingComments"];t.removeComments=function(child){_.each(t.COMMENT_KEYS,function(key){delete child[key]});return child};t.inheritsComments=function(child,parent){_.each(t.COMMENT_KEYS,function(key){child[key]=_.uniq(_.compact([].concat(child[key],parent[key])))});return child};t.inherits=function(child,parent){child.loc=parent.loc;child.end=parent.end;child.range=parent.range;child.start=parent.start;t.inheritsComments(child,parent);return child};t.getSpecifierName=function(specifier){return specifier.name||specifier.id};t.isSpecifierDefault=function(specifier){return t.isIdentifier(specifier.id)&&specifier.id.name==="default"}},{"./alias-keys":75,"./builder-keys":76,"./visitor-keys":78,esutils:125,lodash:127}],78:[function(require,module,exports){module.exports={ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","defaults","rest","body"],AssignmentExpression:["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"],ClassProperty:["key"],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"],XJSAttribute:["name","value"],XJSClosingElement:["name"],XJSElement:["openingElement","closingElement","children"],XJSEmptyExpression:[],XJSExpressionContainer:["expression"],XJSIdentifier:[],XJSMemberExpression:["object","property"],XJSNamespacedName:["namespace","name"],XJSOpeningElement:["name","attributes"],XJSSpreadAttribute:["argument"],YieldExpression:["argument"]}},{}],79:[function(require,module,exports){(function(Buffer,__dirname){require("./patch");var estraverse=require("estraverse");var traverse=require("./traverse");var acorn=require("acorn-6to5");var path=require("path");var util=require("util");var fs=require("fs");var t=require("./types");var _=require("lodash");exports.inherits=util.inherits;exports.canCompile=function(filename,altExts){var exts=altExts||[".js",".jsx",".es6"];var ext=path.extname(filename);return _.contains(exts,ext)};exports.isInteger=function(i){return _.isNumber(i)&&i%1===0};exports.resolve=function(loc){try{return require.resolve(loc)}catch(err){return null}};exports.trimRight=function(str){return str.replace(/[\n\s]+$/g,"")};exports.list=function(val){return val?val.split(","):[]};exports.regexify=function(val){if(!val)return new RegExp(/.^/);if(_.isArray(val))val=val.join("|");if(_.isString(val))return new RegExp(val);if(_.isRegExp(val))return val;throw new TypeError("illegal type for regexify")};exports.arrayify=function(val){if(!val)return[];if(_.isString(val))return exports.list(val);if(_.isArray(val))return val;throw new TypeError("illegal type for arrayify")};exports.isAbsolute=function(loc){if(!loc)return false;if(loc[0]==="/")return true;if(loc[1]===":"&&loc[2]==="\\")return true;return false};exports.sourceMapToComment=function(map){var json=JSON.stringify(map);var base64=new Buffer(json).toString("base64");return"//# sourceMappingURL=data:application/json;base64,"+base64};exports.pushMutatorMap=function(mutatorMap,key,kind,method){var alias;if(t.isIdentifier(key)){alias=key.name;if(method.computed)alias="computed:"+alias}else if(t.isLiteral(key)){alias=String(key.value)}else{alias=JSON.stringify(traverse.removeProperties(_.cloneDeep(key)))}var map;if(_.has(mutatorMap,alias)){map=mutatorMap[alias]}else{map={}}mutatorMap[alias]=map;map._key=key;if(method.computed){map._computed=true}map[kind]=method};exports.buildDefineProperties=function(mutatorMap){var objExpr=t.objectExpression([]);_.each(mutatorMap,function(map){var mapNode=t.objectExpression([]);var propNode=t.property("init",map._key,mapNode,map._computed);map.enumerable=t.literal(true);_.each(map,function(node,key){if(key[0]==="_")return;node=_.clone(node);var inheritNode=node;if(t.isMethodDefinition(node))node=node.value;var prop=t.property("init",t.identifier(key),node);t.inheritsComments(prop,inheritNode);t.removeComments(inheritNode);mapNode.properties.push(prop)});objExpr.properties.push(propNode)});return objExpr};exports.template=function(name,nodes,keepExpression){var template=exports.templates[name];if(!template)throw new ReferenceError("unknown template "+name);if(nodes===true){keepExpression=true;nodes=null}template=_.cloneDeep(template);if(!_.isEmpty(nodes)){traverse(template,{enter:function(node){if(t.isIdentifier(node)&&_.has(nodes,node.name)){return nodes[node.name]}}})}var node=template.body[0];if(!keepExpression&&t.isExpressionStatement(node)){node=node.expression}return node};exports.codeFrame=function(lines,lineNumber,colNumber){colNumber=Math.max(colNumber,0);lines=lines.split("\n");var start=Math.max(lineNumber-3,0);var end=Math.min(lines.length,lineNumber+3);var width=(end+"").length;if(!lineNumber&&!colNumber){start=0;end=lines.length}return"\n"+lines.slice(start,end).map(function(line,i){var curr=i+start+1;var gutter=curr===lineNumber?"> ":" ";var sep=curr+exports.repeat(width+1);gutter+=sep+"| ";var str=gutter+line;if(colNumber&&curr===lineNumber){str+="\n";str+=exports.repeat(gutter.length-2);str+="|"+exports.repeat(colNumber)+"^"}return str}).join("\n")};exports.repeat=function(width,cha){cha=cha||" ";return new Array(width+1).join(cha)};exports.normaliseAst=function(ast,comments,tokens){if(ast&&ast.type==="Program"){return t.file(ast,comments||[],tokens||[])}else{throw new Error("Not a valid ast?")}};exports.parse=function(opts,code,callback){try{var comments=[];var tokens=[];var ast=acorn.parse(code,{allowImportExportEverywhere:true,allowReturnOutsideFunction:true,ecmaVersion:opts.experimental?7:6,playground:opts.playground,strictMode:true,onComment:comments,locations:true,onToken:tokens,ranges:true});estraverse.attachComments(ast,comments,tokens);ast=exports.normaliseAst(ast,comments,tokens);if(callback){return callback(ast)}else{return ast}}catch(err){if(!err._6to5){err._6to5=true;var message=opts.filename+": "+err.message;var loc=err.loc;if(loc){var frame=exports.codeFrame(code,loc.line,loc.column);message+=frame}if(err.stack)err.stack=err.stack.replace(err.message,message);err.message=message}throw err}};exports.parseTemplate=function(loc,code){var ast=exports.parse({filename:loc},code).program;return traverse.removeProperties(ast)};var loadTemplates=function(){var templates={};var templatesLoc=__dirname+"/transformation/templates";if(!fs.existsSync(templatesLoc)){throw new Error("no templates directory - this is most likely the "+"result of a broken `npm publish`. Please report to "+"https://githut.com/6to5/6to5/issues")}_.each(fs.readdirSync(templatesLoc),function(name){if(name[0]===".")return;var key=path.basename(name,path.extname(name));var loc=templatesLoc+"/"+name;var code=fs.readFileSync(loc,"utf8");templates[key]=exports.parseTemplate(loc,code)});return templates};try{exports.templates=require("../../templates.json")}catch(err){if(err.code!=="MODULE_NOT_FOUND")throw err;exports.templates=loadTemplates()}}).call(this,require("buffer").Buffer,"/lib/6to5")},{"../../templates.json":179,"./patch":24,"./traverse":73,"./types":77,"acorn-6to5":1,buffer:96,estraverse:121,fs:94,lodash:127,path:103,util:119}],80:[function(require,module,exports){var types=require("../lib/types");var Type=types.Type;var def=Type.def;var or=Type.or;var builtin=types.builtInTypes;var isString=builtin.string;var isNumber=builtin.number;var isBoolean=builtin.boolean;var isRegExp=builtin.RegExp;var shared=require("../lib/shared");var defaults=shared.defaults;var geq=shared.geq;def("Printable").field("loc",or(def("SourceLocation"),null),defaults["null"],true);def("Node").bases("Printable").field("type",isString);def("SourceLocation").build("start","end","source").field("start",def("Position")).field("end",def("Position")).field("source",or(isString,null),defaults["null"]);def("Position").build("line","column").field("line",geq(1)).field("column",geq(0));def("Program").bases("Node").build("body").field("body",[def("Statement")]).field("comments",or([or(def("Block"),def("Line"))],null),defaults["null"],true);def("Function").bases("Node").field("id",or(def("Identifier"),null),defaults["null"]).field("params",[def("Pattern")]).field("body",or(def("BlockStatement"),def("Expression")));def("Statement").bases("Node");def("EmptyStatement").bases("Statement").build();def("BlockStatement").bases("Statement").build("body").field("body",[def("Statement")]);def("ExpressionStatement").bases("Statement").build("expression").field("expression",def("Expression"));def("IfStatement").bases("Statement").build("test","consequent","alternate").field("test",def("Expression")).field("consequent",def("Statement")).field("alternate",or(def("Statement"),null),defaults["null"]);def("LabeledStatement").bases("Statement").build("label","body").field("label",def("Identifier")).field("body",def("Statement"));def("BreakStatement").bases("Statement").build("label").field("label",or(def("Identifier"),null),defaults["null"]);def("ContinueStatement").bases("Statement").build("label").field("label",or(def("Identifier"),null),defaults["null"]);def("WithStatement").bases("Statement").build("object","body").field("object",def("Expression")).field("body",def("Statement"));def("SwitchStatement").bases("Statement").build("discriminant","cases","lexical").field("discriminant",def("Expression")).field("cases",[def("SwitchCase")]).field("lexical",isBoolean,defaults["false"]);def("ReturnStatement").bases("Statement").build("argument").field("argument",or(def("Expression"),null));def("ThrowStatement").bases("Statement").build("argument").field("argument",def("Expression"));def("TryStatement").bases("Statement").build("block","handler","finalizer").field("block",def("BlockStatement")).field("handler",or(def("CatchClause"),null),function(){return this.handlers&&this.handlers[0]||null}).field("handlers",[def("CatchClause")],function(){return this.handler?[this.handler]:[]},true).field("guardedHandlers",[def("CatchClause")],defaults.emptyArray).field("finalizer",or(def("BlockStatement"),null),defaults["null"]);def("CatchClause").bases("Node").build("param","guard","body").field("param",def("Pattern")).field("guard",or(def("Expression"),null),defaults["null"]).field("body",def("BlockStatement"));def("WhileStatement").bases("Statement").build("test","body").field("test",def("Expression")).field("body",def("Statement"));def("DoWhileStatement").bases("Statement").build("body","test").field("body",def("Statement")).field("test",def("Expression"));def("ForStatement").bases("Statement").build("init","test","update","body").field("init",or(def("VariableDeclaration"),def("Expression"),null)).field("test",or(def("Expression"),null)).field("update",or(def("Expression"),null)).field("body",def("Statement"));def("ForInStatement").bases("Statement").build("left","right","body","each").field("left",or(def("VariableDeclaration"),def("Expression"))).field("right",def("Expression")).field("body",def("Statement")).field("each",isBoolean);def("DebuggerStatement").bases("Statement").build();def("Declaration").bases("Statement");def("FunctionDeclaration").bases("Function","Declaration").build("id","params","body").field("id",def("Identifier"));def("FunctionExpression").bases("Function","Expression").build("id","params","body");def("VariableDeclaration").bases("Declaration").build("kind","declarations").field("kind",or("var","let","const")).field("declarations",[or(def("VariableDeclarator"),def("Identifier"))]);def("VariableDeclarator").bases("Node").build("id","init").field("id",def("Pattern")).field("init",or(def("Expression"),null));def("Expression").bases("Node","Pattern");def("ThisExpression").bases("Expression").build();def("ArrayExpression").bases("Expression").build("elements").field("elements",[or(def("Expression"),null)]);def("ObjectExpression").bases("Expression").build("properties").field("properties",[def("Property")]);def("Property").bases("Node").build("kind","key","value").field("kind",or("init","get","set")).field("key",or(def("Literal"),def("Identifier"))).field("value",def("Expression"));def("SequenceExpression").bases("Expression").build("expressions").field("expressions",[def("Expression")]);var UnaryOperator=or("-","+","!","~","typeof","void","delete");def("UnaryExpression").bases("Expression").build("operator","argument","prefix").field("operator",UnaryOperator).field("argument",def("Expression")).field("prefix",isBoolean,defaults["true"]);var BinaryOperator=or("==","!=","===","!==","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","&","|","^","in","instanceof","..");def("BinaryExpression").bases("Expression").build("operator","left","right").field("operator",BinaryOperator).field("left",def("Expression")).field("right",def("Expression"));var AssignmentOperator=or("=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","^=","&=");def("AssignmentExpression").bases("Expression").build("operator","left","right").field("operator",AssignmentOperator).field("left",def("Pattern")).field("right",def("Expression"));var UpdateOperator=or("++","--");def("UpdateExpression").bases("Expression").build("operator","argument","prefix").field("operator",UpdateOperator).field("argument",def("Expression")).field("prefix",isBoolean);var LogicalOperator=or("||","&&");def("LogicalExpression").bases("Expression").build("operator","left","right").field("operator",LogicalOperator).field("left",def("Expression")).field("right",def("Expression"));def("ConditionalExpression").bases("Expression").build("test","consequent","alternate").field("test",def("Expression")).field("consequent",def("Expression")).field("alternate",def("Expression"));def("NewExpression").bases("Expression").build("callee","arguments").field("callee",def("Expression")).field("arguments",[def("Expression")]);def("CallExpression").bases("Expression").build("callee","arguments").field("callee",def("Expression")).field("arguments",[def("Expression")]);def("MemberExpression").bases("Expression").build("object","property","computed").field("object",def("Expression")).field("property",or(def("Identifier"),def("Expression"))).field("computed",isBoolean);def("Pattern").bases("Node");def("ObjectPattern").bases("Pattern").build("properties").field("properties",[def("PropertyPattern")]);def("PropertyPattern").bases("Pattern").build("key","pattern").field("key",or(def("Literal"),def("Identifier"))).field("pattern",def("Pattern"));def("ArrayPattern").bases("Pattern").build("elements").field("elements",[or(def("Pattern"),null)]);def("SwitchCase").bases("Node").build("test","consequent").field("test",or(def("Expression"),null)).field("consequent",[def("Statement")]);def("Identifier").bases("Node","Expression","Pattern").build("name").field("name",isString);def("Literal").bases("Node","Expression").build("value").field("value",or(isString,isBoolean,null,isNumber,isRegExp));def("Block").bases("Printable").build("loc","value").field("value",isString);def("Line").bases("Printable").build("loc","value").field("value",isString)},{"../lib/shared":91,"../lib/types":92}],81:[function(require,module,exports){require("./core");var types=require("../lib/types");var def=types.Type.def;var or=types.Type.or;var builtin=types.builtInTypes;var isString=builtin.string;var isBoolean=builtin.boolean;def("XMLDefaultDeclaration").bases("Declaration").field("namespace",def("Expression"));def("XMLAnyName").bases("Expression");def("XMLQualifiedIdentifier").bases("Expression").field("left",or(def("Identifier"),def("XMLAnyName"))).field("right",or(def("Identifier"),def("Expression"))).field("computed",isBoolean);def("XMLFunctionQualifiedIdentifier").bases("Expression").field("right",or(def("Identifier"),def("Expression"))).field("computed",isBoolean);def("XMLAttributeSelector").bases("Expression").field("attribute",def("Expression"));def("XMLFilterExpression").bases("Expression").field("left",def("Expression")).field("right",def("Expression"));def("XMLElement").bases("XML","Expression").field("contents",[def("XML")]);def("XMLList").bases("XML","Expression").field("contents",[def("XML")]);def("XML").bases("Node");def("XMLEscape").bases("XML").field("expression",def("Expression"));def("XMLText").bases("XML").field("text",isString);def("XMLStartTag").bases("XML").field("contents",[def("XML")]);def("XMLEndTag").bases("XML").field("contents",[def("XML")]);def("XMLPointTag").bases("XML").field("contents",[def("XML")]);def("XMLName").bases("XML").field("contents",or(isString,[def("XML")]));def("XMLAttribute").bases("XML").field("value",isString);def("XMLCdata").bases("XML").field("contents",isString);def("XMLComment").bases("XML").field("contents",isString);def("XMLProcessingInstruction").bases("XML").field("target",isString).field("contents",or(isString,null))},{"../lib/types":92,"./core":80}],82:[function(require,module,exports){require("./core");var types=require("../lib/types");var def=types.Type.def;var or=types.Type.or;var builtin=types.builtInTypes;var isBoolean=builtin.boolean;var isObject=builtin.object;var isString=builtin.string;var defaults=require("../lib/shared").defaults;def("Function").field("generator",isBoolean,defaults["false"]).field("expression",isBoolean,defaults["false"]).field("defaults",[or(def("Expression"),null)],defaults.emptyArray).field("rest",or(def("Identifier"),null),defaults["null"]);def("FunctionDeclaration").build("id","params","body","generator","expression");def("FunctionExpression").build("id","params","body","generator","expression");def("ArrowFunctionExpression").bases("Function","Expression").build("params","body","expression").field("id",null,defaults["null"]).field("generator",false);def("YieldExpression").bases("Expression").build("argument","delegate").field("argument",or(def("Expression"),null)).field("delegate",isBoolean,defaults["false"]);def("GeneratorExpression").bases("Expression").build("body","blocks","filter").field("body",def("Expression")).field("blocks",[def("ComprehensionBlock")]).field("filter",or(def("Expression"),null));def("ComprehensionExpression").bases("Expression").build("body","blocks","filter").field("body",def("Expression")).field("blocks",[def("ComprehensionBlock")]).field("filter",or(def("Expression"),null));def("ComprehensionBlock").bases("Node").build("left","right","each").field("left",def("Pattern")).field("right",def("Expression")).field("each",isBoolean);
def("ModuleSpecifier").bases("Literal").build("value").field("value",isString);def("Property").field("key",or(def("Literal"),def("Identifier"),def("Expression"))).field("method",isBoolean,defaults["false"]).field("shorthand",isBoolean,defaults["false"]).field("computed",isBoolean,defaults["false"]);def("PropertyPattern").field("key",or(def("Literal"),def("Identifier"),def("Expression"))).field("computed",isBoolean,defaults["false"]);def("MethodDefinition").bases("Declaration").build("kind","key","value").field("kind",or("init","get","set","")).field("key",or(def("Literal"),def("Identifier"),def("Expression"))).field("value",def("Function")).field("computed",isBoolean,defaults["false"]);def("SpreadElement").bases("Node").build("argument").field("argument",def("Expression"));def("ArrayExpression").field("elements",[or(def("Expression"),def("SpreadElement"),null)]);def("NewExpression").field("arguments",[or(def("Expression"),def("SpreadElement"))]);def("CallExpression").field("arguments",[or(def("Expression"),def("SpreadElement"))]);def("SpreadElementPattern").bases("Pattern").build("argument").field("argument",def("Pattern"));var ClassBodyElement=or(def("MethodDefinition"),def("VariableDeclarator"),def("ClassPropertyDefinition"),def("ClassProperty"));def("ClassProperty").bases("Declaration").build("key").field("key",or(def("Literal"),def("Identifier"),def("Expression"))).field("computed",isBoolean,defaults["false"]);def("ClassPropertyDefinition").bases("Declaration").build("definition").field("definition",ClassBodyElement);def("ClassBody").bases("Declaration").build("body").field("body",[ClassBodyElement]);def("ClassDeclaration").bases("Declaration").build("id","body","superClass").field("id",def("Identifier")).field("body",def("ClassBody")).field("superClass",or(def("Expression"),null),defaults["null"]);def("ClassExpression").bases("Expression").build("id","body","superClass").field("id",or(def("Identifier"),null),defaults["null"]).field("body",def("ClassBody")).field("superClass",or(def("Expression"),null),defaults["null"]).field("implements",[def("ClassImplements")],defaults.emptyArray);def("ClassImplements").bases("Node").build("id").field("id",def("Identifier")).field("superClass",or(def("Expression"),null),defaults["null"]);def("Specifier").bases("Node");def("NamedSpecifier").bases("Specifier").field("id",def("Identifier")).field("name",or(def("Identifier"),null),defaults["null"]);def("ExportSpecifier").bases("NamedSpecifier").build("id","name");def("ExportBatchSpecifier").bases("Specifier").build();def("ImportSpecifier").bases("NamedSpecifier").build("id","name");def("ImportNamespaceSpecifier").bases("Specifier").build("id").field("id",def("Identifier"));def("ImportDefaultSpecifier").bases("Specifier").build("id").field("id",def("Identifier"));def("ExportDeclaration").bases("Declaration").build("default","declaration","specifiers","source").field("default",isBoolean).field("declaration",or(def("Declaration"),def("Expression"),null)).field("specifiers",[or(def("ExportSpecifier"),def("ExportBatchSpecifier"))],defaults.emptyArray).field("source",or(def("ModuleSpecifier"),null),defaults["null"]);def("ImportDeclaration").bases("Declaration").build("specifiers","source").field("specifiers",[or(def("ImportSpecifier"),def("ImportNamespaceSpecifier"),def("ImportDefaultSpecifier"))],defaults.emptyArray).field("source",def("ModuleSpecifier"));def("TaggedTemplateExpression").bases("Expression").field("tag",def("Expression")).field("quasi",def("TemplateLiteral"));def("TemplateLiteral").bases("Expression").build("quasis","expressions").field("quasis",[def("TemplateElement")]).field("expressions",[def("Expression")]);def("TemplateElement").bases("Node").build("value","tail").field("value",{cooked:isString,raw:isString}).field("tail",isBoolean)},{"../lib/shared":91,"../lib/types":92,"./core":80}],83:[function(require,module,exports){require("./core");var types=require("../lib/types");var def=types.Type.def;var or=types.Type.or;var builtin=types.builtInTypes;var isBoolean=builtin.boolean;var defaults=require("../lib/shared").defaults;def("Function").field("async",isBoolean,defaults["false"]);def("SpreadProperty").bases("Node").build("argument").field("argument",def("Expression"));def("ObjectExpression").field("properties",[or(def("Property"),def("SpreadProperty"))]);def("SpreadPropertyPattern").bases("Pattern").build("argument").field("argument",def("Pattern"));def("ObjectPattern").field("properties",[or(def("PropertyPattern"),def("SpreadPropertyPattern"))]);def("AwaitExpression").bases("Expression").build("argument","all").field("argument",or(def("Expression"),null)).field("all",isBoolean,defaults["false"])},{"../lib/shared":91,"../lib/types":92,"./core":80}],84:[function(require,module,exports){require("./core");var types=require("../lib/types");var def=types.Type.def;var or=types.Type.or;var builtin=types.builtInTypes;var isString=builtin.string;var isBoolean=builtin.boolean;var defaults=require("../lib/shared").defaults;def("XJSAttribute").bases("Node").build("name","value").field("name",or(def("XJSIdentifier"),def("XJSNamespacedName"))).field("value",or(def("Literal"),def("XJSExpressionContainer"),null),defaults["null"]);def("XJSIdentifier").bases("Node").build("name").field("name",isString);def("XJSNamespacedName").bases("Node").build("namespace","name").field("namespace",def("XJSIdentifier")).field("name",def("XJSIdentifier"));def("XJSMemberExpression").bases("MemberExpression").build("object","property").field("object",or(def("XJSIdentifier"),def("XJSMemberExpression"))).field("property",def("XJSIdentifier")).field("computed",isBoolean,defaults.false);var XJSElementName=or(def("XJSIdentifier"),def("XJSNamespacedName"),def("XJSMemberExpression"));def("XJSSpreadAttribute").bases("Node").build("argument").field("argument",def("Expression"));var XJSAttributes=[or(def("XJSAttribute"),def("XJSSpreadAttribute"))];def("XJSExpressionContainer").bases("Expression").build("expression").field("expression",def("Expression"));def("XJSElement").bases("Expression").build("openingElement","closingElement","children").field("openingElement",def("XJSOpeningElement")).field("closingElement",or(def("XJSClosingElement"),null),defaults["null"]).field("children",[or(def("XJSElement"),def("XJSExpressionContainer"),def("XJSText"),def("Literal"))],defaults.emptyArray).field("name",XJSElementName,function(){return this.openingElement.name}).field("selfClosing",isBoolean,function(){return this.openingElement.selfClosing}).field("attributes",XJSAttributes,function(){return this.openingElement.attributes});def("XJSOpeningElement").bases("Node").build("name","attributes","selfClosing").field("name",XJSElementName).field("attributes",XJSAttributes,defaults.emptyArray).field("selfClosing",isBoolean,defaults["false"]);def("XJSClosingElement").bases("Node").build("name").field("name",XJSElementName);def("XJSText").bases("Literal").build("value").field("value",isString);def("XJSEmptyExpression").bases("Expression").build();def("Type").bases("Node");def("AnyTypeAnnotation").bases("Type");def("VoidTypeAnnotation").bases("Type");def("NumberTypeAnnotation").bases("Type");def("StringTypeAnnotation").bases("Type");def("StringLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",isString).field("raw",isString);def("BooleanTypeAnnotation").bases("Type");def("TypeAnnotation").bases("Node").build("typeAnnotation").field("typeAnnotation",def("Type"));def("NullableTypeAnnotation").bases("Type").build("typeAnnotation").field("typeAnnotation",def("Type"));def("FunctionTypeAnnotation").bases("Type").build("params","returnType","rest","typeParameters").field("params",[def("FunctionTypeParam")]).field("returnType",def("Type")).field("rest",or(def("FunctionTypeParam"),null)).field("typeParameters",or(def("TypeParameterDeclaration"),null));def("FunctionTypeParam").bases("Node").build("name","typeAnnotation","optional").field("name",def("Identifier")).field("typeAnnotation",def("Type")).field("optional",isBoolean);def("ObjectTypeAnnotation").bases("Type").build("properties").field("properties",[def("ObjectTypeProperty")]).field("indexers",[def("ObjectTypeIndexer")],defaults.emptyArray).field("callProperties",[def("ObjectTypeCallProperty")],defaults.emptyArray);def("ObjectTypeProperty").bases("Node").build("key","value","optional").field("key",or(def("Literal"),def("Identifier"))).field("value",def("Type")).field("optional",isBoolean);def("ObjectTypeIndexer").bases("Node").build("id","key","value").field("id",def("Identifier")).field("key",def("Type")).field("value",def("Type"));def("ObjectTypeCallProperty").bases("Node").build("value").field("value",def("FunctionTypeAnnotation")).field("static",isBoolean,false);def("QualifiedTypeIdentifier").bases("Node").build("qualification","id").field("qualification",or(def("Identifier"),def("QualifiedTypeIdentifier"))).field("id",def("Identifier"));def("GenericTypeAnnotation").bases("Type").build("id","typeParameters").field("id",or(def("Identifier"),def("QualifiedTypeIdentifier"))).field("typeParameters",or(def("TypeParameterInstantiation"),null));def("MemberTypeAnnotation").bases("Type").build("object","property").field("object",def("Identifier")).field("property",or(def("MemberTypeAnnotation"),def("GenericTypeAnnotation")));def("UnionTypeAnnotation").bases("Type").build("types").field("types",[def("Type")]);def("IntersectionTypeAnnotation").bases("Type").build("types").field("types",[def("Type")]);def("TypeofTypeAnnotation").bases("Type").build("argument").field("argument",def("Type"));def("Identifier").field("typeAnnotation",or(def("TypeAnnotation"),null),defaults["null"]);def("TypeParameterDeclaration").bases("Node").build("params").field("params",[def("Identifier")]);def("TypeParameterInstantiation").bases("Node").build("params").field("params",[def("Type")]);def("Function").field("returnType",or(def("TypeAnnotation"),null),defaults["null"]).field("typeParameters",or(def("TypeParameterDeclaration"),null),defaults["null"]);def("ClassProperty").build("key","typeAnnotation").field("typeAnnotation",def("TypeAnnotation")).field("static",isBoolean,false);def("ClassImplements").field("typeParameters",or(def("TypeParameterInstantiation"),null),defaults["null"]);def("InterfaceDeclaration").bases("Statement").build("id","body","extends").field("id",def("Identifier")).field("typeParameters",or(def("TypeParameterDeclaration"),null),defaults["null"]).field("body",def("ObjectTypeAnnotation")).field("extends",[def("InterfaceExtends")]);def("InterfaceExtends").bases("Node").build("id").field("id",def("Identifier")).field("typeParameters",or(def("TypeParameterInstantiation"),null));def("TypeAlias").bases("Statement").build("id","typeParameters","right").field("id",def("Identifier")).field("typeParameters",or(def("TypeParameterDeclaration"),null)).field("right",def("Type"));def("TupleTypeAnnotation").bases("Type").build("types").field("types",[def("Type")]);def("DeclareVariable").bases("Statement").build("id").field("id",def("Identifier"));def("DeclareFunction").bases("Statement").build("id").field("id",def("Identifier"));def("DeclareClass").bases("InterfaceDeclaration").build("id");def("DeclareModule").bases("Statement").build("id","body").field("id",or(def("Identifier"),def("Literal"))).field("body",def("BlockStatement"))},{"../lib/shared":91,"../lib/types":92,"./core":80}],85:[function(require,module,exports){require("./core");var types=require("../lib/types");var def=types.Type.def;var or=types.Type.or;var geq=require("../lib/shared").geq;def("ForOfStatement").bases("Statement").build("left","right","body").field("left",or(def("VariableDeclaration"),def("Expression"))).field("right",def("Expression")).field("body",def("Statement"));def("LetStatement").bases("Statement").build("head","body").field("head",[def("VariableDeclarator")]).field("body",def("Statement"));def("LetExpression").bases("Expression").build("head","body").field("head",[def("VariableDeclarator")]).field("body",def("Expression"));def("GraphExpression").bases("Expression").build("index","expression").field("index",geq(0)).field("expression",def("Literal"));def("GraphIndexExpression").bases("Expression").build("index").field("index",geq(0))},{"../lib/shared":91,"../lib/types":92,"./core":80}],86:[function(require,module,exports){var assert=require("assert");var types=require("../main");var getFieldNames=types.getFieldNames;var getFieldValue=types.getFieldValue;var isArray=types.builtInTypes.array;var isObject=types.builtInTypes.object;var isDate=types.builtInTypes.Date;var isRegExp=types.builtInTypes.RegExp;var hasOwn=Object.prototype.hasOwnProperty;function astNodesAreEquivalent(a,b,problemPath){if(isArray.check(problemPath)){problemPath.length=0}else{problemPath=null}return areEquivalent(a,b,problemPath)}astNodesAreEquivalent.assert=function(a,b){var problemPath=[];if(!astNodesAreEquivalent(a,b,problemPath)){if(problemPath.length===0){assert.strictEqual(a,b)}else{assert.ok(false,"Nodes differ in the following path: "+problemPath.map(subscriptForProperty).join(""))}}};function subscriptForProperty(property){if(/[_$a-z][_$a-z0-9]*/i.test(property)){return"."+property}return"["+JSON.stringify(property)+"]"}function areEquivalent(a,b,problemPath){if(a===b){return true}if(isArray.check(a)){return arraysAreEquivalent(a,b,problemPath)}if(isObject.check(a)){return objectsAreEquivalent(a,b,problemPath)}if(isDate.check(a)){return isDate.check(b)&&+a===+b}if(isRegExp.check(a)){return isRegExp.check(b)&&(a.source===b.source&&a.global===b.global&&a.multiline===b.multiline&&a.ignoreCase===b.ignoreCase)}return a==b}function arraysAreEquivalent(a,b,problemPath){isArray.assert(a);var aLength=a.length;if(!isArray.check(b)||b.length!==aLength){if(problemPath){problemPath.push("length")}return false}for(var i=0;i<aLength;++i){if(problemPath){problemPath.push(i)}if(i in a!==i in b){return false}if(!areEquivalent(a[i],b[i],problemPath)){return false}if(problemPath){assert.strictEqual(problemPath.pop(),i)}}return true}function objectsAreEquivalent(a,b,problemPath){isObject.assert(a);if(!isObject.check(b)){return false}if(a.type!==b.type){if(problemPath){problemPath.push("type")}return false}var aNames=getFieldNames(a);var aNameCount=aNames.length;var bNames=getFieldNames(b);var bNameCount=bNames.length;if(aNameCount===bNameCount){for(var i=0;i<aNameCount;++i){var name=aNames[i];var aChild=getFieldValue(a,name);var bChild=getFieldValue(b,name);if(problemPath){problemPath.push(name)}if(!areEquivalent(aChild,bChild,problemPath)){return false}if(problemPath){assert.strictEqual(problemPath.pop(),name)}}return true}if(!problemPath){return false}var seenNames=Object.create(null);for(i=0;i<aNameCount;++i){seenNames[aNames[i]]=true}for(i=0;i<bNameCount;++i){name=bNames[i];if(!hasOwn.call(seenNames,name)){problemPath.push(name);return false}delete seenNames[name]}for(name in seenNames){problemPath.push(name);break}return false}module.exports=astNodesAreEquivalent},{"../main":93,assert:95}],87:[function(require,module,exports){var assert=require("assert");var types=require("./types");var n=types.namedTypes;var b=types.builders;var isNumber=types.builtInTypes.number;var isArray=types.builtInTypes.array;var Path=require("./path");var Scope=require("./scope");function NodePath(value,parentPath,name){assert.ok(this instanceof NodePath);Path.call(this,value,parentPath,name)}require("util").inherits(NodePath,Path);var NPp=NodePath.prototype;Object.defineProperties(NPp,{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}}});NPp.replace=function(){delete this.node;delete this.parent;delete this.scope;return Path.prototype.replace.apply(this,arguments)};NPp.prune=function(){var remainingNodePath=this.parent;this.replace();return cleanUpNodesAfterPrune(remainingNodePath)};NPp._computeNode=function(){var value=this.value;if(n.Node.check(value)){return value}var pp=this.parentPath;return pp&&pp.node||null};NPp._computeParent=function(){var value=this.value;var pp=this.parentPath;if(!n.Node.check(value)){while(pp&&!n.Node.check(pp.value)){pp=pp.parentPath}if(pp){pp=pp.parentPath}}while(pp&&!n.Node.check(pp.value)){pp=pp.parentPath}return pp||null};NPp._computeScope=function(){var value=this.value;var pp=this.parentPath;var scope=pp&&pp.scope;if(n.Node.check(value)&&Scope.isEstablishedBy(value)){scope=new Scope(this,scope)}return scope||null};NPp.getValueProperty=function(name){return types.getFieldValue(this.value,name)};NPp.needsParens=function(assumeExpressionContext){var pp=this.parentPath;if(!pp){return false}var node=this.value;if(!n.Expression.check(node)){return false}if(node.type==="Identifier"){return false}while(!n.Node.check(pp.value)){pp=pp.parentPath;if(!pp){return false}}var parent=pp.value;switch(node.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return parent.type==="MemberExpression"&&this.name==="object"&&parent.object===node;case"BinaryExpression":case"LogicalExpression":switch(parent.type){case"CallExpression":return this.name==="callee"&&parent.callee===node;case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return true;case"MemberExpression":return this.name==="object"&&parent.object===node;case"BinaryExpression":case"LogicalExpression":var po=parent.operator;var pp=PRECEDENCE[po];var no=node.operator;var np=PRECEDENCE[no];if(pp>np){return true}if(pp===np&&this.name==="right"){assert.strictEqual(parent.right,node);return true}default:return false}case"SequenceExpression":switch(parent.type){case"ForStatement":return false;case"ExpressionStatement":return this.name!=="expression";default:return true}case"YieldExpression":switch(parent.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 parent.type==="MemberExpression"&&isNumber.check(node.value)&&this.name==="object"&&parent.object===node;case"AssignmentExpression":case"ConditionalExpression":switch(parent.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":return true;case"CallExpression":return this.name==="callee"&&parent.callee===node;case"ConditionalExpression":return this.name==="test"&&parent.test===node;case"MemberExpression":return this.name==="object"&&parent.object===node;default:return false}default:if(parent.type==="NewExpression"&&this.name==="callee"&&parent.callee===node){return containsCallExpression(node)}}if(assumeExpressionContext!==true&&!this.canBeFirstInStatement()&&this.firstInStatement())return true;return false};function isBinary(node){return n.BinaryExpression.check(node)||n.LogicalExpression.check(node)}function isUnaryLike(node){return n.UnaryExpression.check(node)||n.SpreadElement&&n.SpreadElement.check(node)||n.SpreadProperty&&n.SpreadProperty.check(node)}var PRECEDENCE={};[["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]].forEach(function(tier,i){tier.forEach(function(op){PRECEDENCE[op]=i})});function containsCallExpression(node){if(n.CallExpression.check(node)){return true}if(isArray.check(node)){return node.some(containsCallExpression)}if(n.Node.check(node)){return types.someField(node,function(name,child){return containsCallExpression(child)})}return false}NPp.canBeFirstInStatement=function(){var node=this.node;return!n.FunctionExpression.check(node)&&!n.ObjectExpression.check(node)};NPp.firstInStatement=function(){return firstInStatement(this)};function firstInStatement(path){for(var node,parent;path.parent;path=path.parent){node=path.node;parent=path.parent.node;if(n.BlockStatement.check(parent)&&path.parent.name==="body"&&path.name===0){assert.strictEqual(parent.body[0],node);return true}if(n.ExpressionStatement.check(parent)&&path.name==="expression"){assert.strictEqual(parent.expression,node);return true}if(n.SequenceExpression.check(parent)&&path.parent.name==="expressions"&&path.name===0){assert.strictEqual(parent.expressions[0],node);continue}if(n.CallExpression.check(parent)&&path.name==="callee"){assert.strictEqual(parent.callee,node);continue}if(n.MemberExpression.check(parent)&&path.name==="object"){assert.strictEqual(parent.object,node);continue}if(n.ConditionalExpression.check(parent)&&path.name==="test"){assert.strictEqual(parent.test,node);continue}if(isBinary(parent)&&path.name==="left"){assert.strictEqual(parent.left,node);continue}if(n.UnaryExpression.check(parent)&&!parent.prefix&&path.name==="argument"){assert.strictEqual(parent.argument,node);continue}return false}return true}function cleanUpNodesAfterPrune(remainingNodePath){if(n.VariableDeclaration.check(remainingNodePath.node)){var declarations=remainingNodePath.get("declarations").value;if(!declarations||declarations.length===0){return remainingNodePath.prune()}}else if(n.ExpressionStatement.check(remainingNodePath.node)){if(!remainingNodePath.get("expression").value){return remainingNodePath.prune()}}else if(n.IfStatement.check(remainingNodePath.node)){cleanUpIfStatementAfterPrune(remainingNodePath)}return remainingNodePath}function cleanUpIfStatementAfterPrune(ifStatement){var testExpression=ifStatement.get("test").value;var alternate=ifStatement.get("alternate").value;var consequent=ifStatement.get("consequent").value;if(!consequent&&!alternate){var testExpressionStatement=b.expressionStatement(testExpression);ifStatement.replace(testExpressionStatement)}else if(!consequent&&alternate){var negatedTestExpression=b.unaryExpression("!",testExpression,true);if(n.UnaryExpression.check(testExpression)&&testExpression.operator==="!"){negatedTestExpression=testExpression.argument}ifStatement.get("test").replace(negatedTestExpression);ifStatement.get("consequent").replace(alternate);ifStatement.get("alternate").replace()}}module.exports=NodePath},{"./path":89,"./scope":90,"./types":92,assert:95,util:119}],88:[function(require,module,exports){var assert=require("assert");var types=require("./types");var NodePath=require("./node-path");var Node=types.namedTypes.Node;var isArray=types.builtInTypes.array;var isObject=types.builtInTypes.object;var isFunction=types.builtInTypes.function;var hasOwn=Object.prototype.hasOwnProperty;var undefined;function PathVisitor(){assert.ok(this instanceof PathVisitor);this._reusableContextStack=[];this._methodNameTable=computeMethodNameTable(this);this.Context=makeContextConstructor(this);this._visiting=false;this._changeReported=false}function computeMethodNameTable(visitor){var typeNames=Object.create(null);for(var methodName in visitor){if(/^visit[A-Z]/.test(methodName)){typeNames[methodName.slice("visit".length)]=true}}var supertypeTable=types.computeSupertypeLookupTable(typeNames);var methodNameTable=Object.create(null);var typeNames=Object.keys(supertypeTable);var typeNameCount=typeNames.length;for(var i=0;i<typeNameCount;++i){var typeName=typeNames[i];methodName="visit"+supertypeTable[typeName];if(isFunction.check(visitor[methodName])){methodNameTable[typeName]=methodName}}return methodNameTable}PathVisitor.fromMethodsObject=function fromMethodsObject(methods){if(methods instanceof PathVisitor){return methods}if(!isObject.check(methods)){return new PathVisitor}function Visitor(){assert.ok(this instanceof Visitor);PathVisitor.call(this)}var Vp=Visitor.prototype=Object.create(PVp);Vp.constructor=Visitor;extend(Vp,methods);extend(Visitor,PathVisitor);isFunction.assert(Visitor.fromMethodsObject);isFunction.assert(Visitor.visit);return new Visitor};function extend(target,source){for(var property in source){if(hasOwn.call(source,property)){target[property]=source[property]}}return target}PathVisitor.visit=function visit(node,methods){var visitor=PathVisitor.fromMethodsObject(methods);if(node instanceof NodePath){visitor.visit(node);return node.value}var rootPath=new NodePath({root:node});visitor.visit(rootPath.get("root"));return rootPath.value.root};var PVp=PathVisitor.prototype;var recursiveVisitWarning=["Recursively calling visitor.visit(path) resets visitor state.","Try this.visit(path) or this.traverse(path) instead."].join(" ");PVp.visit=function(path){assert.ok(!this._visiting,recursiveVisitWarning);this._visiting=true;this._changeReported=false;this.reset.apply(this,arguments);try{return this.visitWithoutReset(path)}finally{this._visiting=false}};PVp.reset=function(path){};PVp.visitWithoutReset=function(path){if(this instanceof this.Context){return this.visitor.visitWithoutReset(path)}assert.ok(path instanceof NodePath);var value=path.value;var methodName=Node.check(value)&&this._methodNameTable[value.type];if(methodName){var context=this.acquireContext(path);try{context.invokeVisitorMethod(methodName)}finally{this.releaseContext(context)}}else{visitChildren(path,this)}};function visitChildren(path,visitor){assert.ok(path instanceof NodePath);assert.ok(visitor instanceof PathVisitor);var value=path.value;if(isArray.check(value)){path.each(visitor.visitWithoutReset,visitor)}else if(!isObject.check(value)){}else{var childNames=types.getFieldNames(value);var childCount=childNames.length;var childPaths=[];for(var i=0;i<childCount;++i){var childName=childNames[i];if(!hasOwn.call(value,childName)){value[childName]=types.getFieldValue(value,childName)}childPaths.push(path.get(childName))}for(var i=0;i<childCount;++i){visitor.visitWithoutReset(childPaths[i])}}}PVp.acquireContext=function(path){if(this._reusableContextStack.length===0){return new this.Context(path)}return this._reusableContextStack.pop().reset(path)};PVp.releaseContext=function(context){assert.ok(context instanceof this.Context);this._reusableContextStack.push(context);context.currentPath=null};PVp.reportChanged=function(){this._changeReported=true};PVp.wasChangeReported=function(){return this._changeReported};function makeContextConstructor(visitor){function Context(path){assert.ok(this instanceof Context);assert.ok(this instanceof PathVisitor);assert.ok(path instanceof NodePath);Object.defineProperty(this,"visitor",{value:visitor,writable:false,enumerable:true,configurable:false});this.currentPath=path;this.needToCallTraverse=true;Object.seal(this)}assert.ok(visitor instanceof PathVisitor);var Cp=Context.prototype=Object.create(visitor);Cp.constructor=Context;extend(Cp,sharedContextProtoMethods);return Context}var sharedContextProtoMethods=Object.create(null);sharedContextProtoMethods.reset=function reset(path){assert.ok(this instanceof this.Context);assert.ok(path instanceof NodePath);this.currentPath=path;this.needToCallTraverse=true;return this};sharedContextProtoMethods.invokeVisitorMethod=function invokeVisitorMethod(methodName){assert.ok(this instanceof this.Context);assert.ok(this.currentPath instanceof NodePath);var result=this.visitor[methodName].call(this,this.currentPath);if(result===false){this.needToCallTraverse=false}else if(result!==undefined){this.currentPath=this.currentPath.replace(result)[0];if(this.needToCallTraverse){this.traverse(this.currentPath)}}assert.strictEqual(this.needToCallTraverse,false,"Must either call this.traverse or return false in "+methodName)};sharedContextProtoMethods.traverse=function traverse(path,newVisitor){assert.ok(this instanceof this.Context);assert.ok(path instanceof NodePath);assert.ok(this.currentPath instanceof NodePath);this.needToCallTraverse=false;visitChildren(path,PathVisitor.fromMethodsObject(newVisitor||this.visitor))};sharedContextProtoMethods.visit=function visit(path,newVisitor){assert.ok(this instanceof this.Context);assert.ok(path instanceof NodePath);assert.ok(this.currentPath instanceof NodePath);this.needToCallTraverse=false;PathVisitor.fromMethodsObject(newVisitor||this.visitor).visitWithoutReset(path)};sharedContextProtoMethods.reportChanged=function reportChanged(){this.visitor.reportChanged()};module.exports=PathVisitor},{"./node-path":87,"./types":92,assert:95}],89:[function(require,module,exports){var assert=require("assert");var Op=Object.prototype;var hasOwn=Op.hasOwnProperty;var types=require("./types");var isArray=types.builtInTypes.array;var isNumber=types.builtInTypes.number;var Ap=Array.prototype;var slice=Ap.slice;var map=Ap.map;function Path(value,parentPath,name){assert.ok(this instanceof Path);if(parentPath){assert.ok(parentPath instanceof Path)}else{parentPath=null;name=null}this.value=value;this.parentPath=parentPath;this.name=name;this.__childCache=null}var Pp=Path.prototype;function getChildCache(path){return path.__childCache||(path.__childCache=Object.create(null))}function getChildPath(path,name){var cache=getChildCache(path);var actualChildValue=path.getValueProperty(name);var childPath=cache[name];if(!hasOwn.call(cache,name)||childPath.value!==actualChildValue){childPath=cache[name]=new path.constructor(actualChildValue,path,name)}return childPath}Pp.getValueProperty=function getValueProperty(name){return this.value[name]};Pp.get=function get(name){var path=this;var names=arguments;var count=names.length;for(var i=0;i<count;++i){path=getChildPath(path,names[i])}return path};Pp.each=function each(callback,context){var childPaths=[];var len=this.value.length;var i=0;for(var i=0;i<len;++i){if(hasOwn.call(this.value,i)){childPaths[i]=this.get(i)}}context=context||this;for(i=0;i<len;++i){if(hasOwn.call(childPaths,i)){callback.call(context,childPaths[i])}}};Pp.map=function map(callback,context){var result=[];this.each(function(childPath){result.push(callback.call(this,childPath))},context);return result};Pp.filter=function filter(callback,context){var result=[];this.each(function(childPath){if(callback.call(this,childPath)){result.push(childPath)}},context);return result};function emptyMoves(){}function getMoves(path,offset,start,end){isArray.assert(path.value);if(offset===0){return emptyMoves}var length=path.value.length;if(length<1){return emptyMoves}var argc=arguments.length;if(argc===2){start=0;end=length}else if(argc===3){start=Math.max(start,0);end=length}else{start=Math.max(start,0);end=Math.min(end,length)}isNumber.assert(start);isNumber.assert(end);var moves=Object.create(null);var cache=getChildCache(path);for(var i=start;i<end;++i){if(hasOwn.call(path.value,i)){var childPath=path.get(i);assert.strictEqual(childPath.name,i);var newIndex=i+offset;childPath.name=newIndex;moves[newIndex]=childPath;delete cache[i]}}delete cache.length;return function(){for(var newIndex in moves){var childPath=moves[newIndex];assert.strictEqual(childPath.name,+newIndex);cache[newIndex]=childPath;path.value[newIndex]=childPath.value}}}Pp.shift=function shift(){var move=getMoves(this,-1);var result=this.value.shift();move();return result};Pp.unshift=function unshift(node){var move=getMoves(this,arguments.length);var result=this.value.unshift.apply(this.value,arguments);move();return result};Pp.push=function push(node){isArray.assert(this.value);delete getChildCache(this).length;return this.value.push.apply(this.value,arguments)};Pp.pop=function pop(){isArray.assert(this.value);var cache=getChildCache(this);delete cache[this.value.length-1];delete cache.length;return this.value.pop()};Pp.insertAt=function insertAt(index,node){var argc=arguments.length;var move=getMoves(this,argc-1,index);if(move===emptyMoves){return this}index=Math.max(index,0);for(var i=1;i<argc;++i){this.value[index+i-1]=arguments[i]}move();return this};Pp.insertBefore=function insertBefore(node){var pp=this.parentPath;var argc=arguments.length;var insertAtArgs=[this.name];for(var i=0;i<argc;++i){insertAtArgs.push(arguments[i])}return pp.insertAt.apply(pp,insertAtArgs)};Pp.insertAfter=function insertAfter(node){var pp=this.parentPath;
var argc=arguments.length;var insertAtArgs=[this.name+1];for(var i=0;i<argc;++i){insertAtArgs.push(arguments[i])}return pp.insertAt.apply(pp,insertAtArgs)};function repairRelationshipWithParent(path){assert.ok(path instanceof Path);var pp=path.parentPath;if(!pp){return path}var parentValue=pp.value;var parentCache=getChildCache(pp);if(parentValue[path.name]===path.value){parentCache[path.name]=path}else if(isArray.check(parentValue)){var i=parentValue.indexOf(path.value);if(i>=0){parentCache[path.name=i]=path}}else{parentValue[path.name]=path.value;parentCache[path.name]=path}assert.strictEqual(parentValue[path.name],path.value);assert.strictEqual(path.parentPath.get(path.name),path);return path}Pp.replace=function replace(replacement){var results=[];var parentValue=this.parentPath.value;var parentCache=getChildCache(this.parentPath);var count=arguments.length;repairRelationshipWithParent(this);if(isArray.check(parentValue)){var originalLength=parentValue.length;var move=getMoves(this.parentPath,count-1,this.name+1);var spliceArgs=[this.name,1];for(var i=0;i<count;++i){spliceArgs.push(arguments[i])}var splicedOut=parentValue.splice.apply(parentValue,spliceArgs);assert.strictEqual(splicedOut[0],this.value);assert.strictEqual(parentValue.length,originalLength-1+count);move();if(count===0){delete this.value;delete parentCache[this.name];this.__childCache=null}else{assert.strictEqual(parentValue[this.name],replacement);if(this.value!==replacement){this.value=replacement;this.__childCache=null}for(i=0;i<count;++i){results.push(this.parentPath.get(this.name+i))}assert.strictEqual(results[0],this)}}else if(count===1){if(this.value!==replacement){this.__childCache=null}this.value=parentValue[this.name]=replacement;results.push(this)}else if(count===0){delete parentValue[this.name];delete this.value;this.__childCache=null}else{assert.ok(false,"Could not replace path")}return results};module.exports=Path},{"./types":92,assert:95}],90:[function(require,module,exports){var assert=require("assert");var types=require("./types");var Type=types.Type;var namedTypes=types.namedTypes;var Node=namedTypes.Node;var Expression=namedTypes.Expression;var isArray=types.builtInTypes.array;var hasOwn=Object.prototype.hasOwnProperty;var b=types.builders;function Scope(path,parentScope){assert.ok(this instanceof Scope);assert.ok(path instanceof require("./node-path"));ScopeType.assert(path.value);var depth;if(parentScope){assert.ok(parentScope instanceof Scope);depth=parentScope.depth+1}else{parentScope=null;depth=0}Object.defineProperties(this,{path:{value:path},node:{value:path.value},isGlobal:{value:!parentScope,enumerable:true},depth:{value:depth},parent:{value:parentScope},bindings:{value:{}}})}var scopeTypes=[namedTypes.Program,namedTypes.Function,namedTypes.CatchClause];var ScopeType=Type.or.apply(Type,scopeTypes);Scope.isEstablishedBy=function(node){return ScopeType.check(node)};var Sp=Scope.prototype;Sp.didScan=false;Sp.declares=function(name){this.scan();return hasOwn.call(this.bindings,name)};Sp.declareTemporary=function(prefix){if(prefix){assert.ok(/^[a-z$_]/i.test(prefix),prefix)}else{prefix="t$"}prefix+=this.depth.toString(36)+"$";this.scan();var index=0;while(this.declares(prefix+index)){++index}var name=prefix+index;return this.bindings[name]=types.builders.identifier(name)};Sp.injectTemporary=function(identifier,init){identifier||(identifier=this.declareTemporary());var bodyPath=this.path.get("body");if(namedTypes.BlockStatement.check(bodyPath.value)){bodyPath=bodyPath.get("body")}bodyPath.unshift(b.variableDeclaration("var",[b.variableDeclarator(identifier,init||null)]));return identifier};Sp.scan=function(force){if(force||!this.didScan){for(var name in this.bindings){delete this.bindings[name]}scanScope(this.path,this.bindings);this.didScan=true}};Sp.getBindings=function(){this.scan();return this.bindings};function scanScope(path,bindings){var node=path.value;ScopeType.assert(node);if(namedTypes.CatchClause.check(node)){addPattern(path.get("param"),bindings)}else{recursiveScanScope(path,bindings)}}function recursiveScanScope(path,bindings){var node=path.value;if(path.parent&&namedTypes.FunctionExpression.check(path.parent.node)&&path.parent.node.id){addPattern(path.parent.get("id"),bindings)}if(!node){}else if(isArray.check(node)){path.each(function(childPath){recursiveScanChild(childPath,bindings)})}else if(namedTypes.Function.check(node)){path.get("params").each(function(paramPath){addPattern(paramPath,bindings)});recursiveScanChild(path.get("body"),bindings)}else if(namedTypes.VariableDeclarator.check(node)){addPattern(path.get("id"),bindings);recursiveScanChild(path.get("init"),bindings)}else if(node.type==="ImportSpecifier"||node.type==="ImportNamespaceSpecifier"||node.type==="ImportDefaultSpecifier"){addPattern(node.name?path.get("name"):path.get("id"),bindings)}else if(Node.check(node)&&!Expression.check(node)){types.eachField(node,function(name,child){var childPath=path.get(name);assert.strictEqual(childPath.value,child);recursiveScanChild(childPath,bindings)})}}function recursiveScanChild(path,bindings){var node=path.value;if(!node||Expression.check(node)){}else if(namedTypes.FunctionDeclaration.check(node)){addPattern(path.get("id"),bindings)}else if(namedTypes.ClassDeclaration&&namedTypes.ClassDeclaration.check(node)){addPattern(path.get("id"),bindings)}else if(ScopeType.check(node)){if(namedTypes.CatchClause.check(node)){var catchParamName=node.param.name;var hadBinding=hasOwn.call(bindings,catchParamName);recursiveScanScope(path.get("body"),bindings);if(!hadBinding){delete bindings[catchParamName]}}}else{recursiveScanScope(path,bindings)}}function addPattern(patternPath,bindings){var pattern=patternPath.value;namedTypes.Pattern.assert(pattern);if(namedTypes.Identifier.check(pattern)){if(hasOwn.call(bindings,pattern.name)){bindings[pattern.name].push(patternPath)}else{bindings[pattern.name]=[patternPath]}}else if(namedTypes.SpreadElement&&namedTypes.SpreadElement.check(pattern)){addPattern(patternPath.get("argument"),bindings)}}Sp.lookup=function(name){for(var scope=this;scope;scope=scope.parent)if(scope.declares(name))break;return scope};Sp.getGlobalScope=function(){var scope=this;while(!scope.isGlobal)scope=scope.parent;return scope};module.exports=Scope},{"./node-path":87,"./types":92,assert:95}],91:[function(require,module,exports){var types=require("../lib/types");var Type=types.Type;var builtin=types.builtInTypes;var isNumber=builtin.number;exports.geq=function(than){return new Type(function(value){return isNumber.check(value)&&value>=than},isNumber+" >= "+than)};exports.defaults={"null":function(){return null},emptyArray:function(){return[]},"false":function(){return false},"true":function(){return true},undefined:function(){}};var naiveIsPrimitive=Type.or(builtin.string,builtin.number,builtin.boolean,builtin.null,builtin.undefined);exports.isPrimitive=new Type(function(value){if(value===null)return true;var type=typeof value;return!(type==="object"||type==="function")},naiveIsPrimitive.toString())},{"../lib/types":92}],92:[function(require,module,exports){var assert=require("assert");var Ap=Array.prototype;var slice=Ap.slice;var map=Ap.map;var each=Ap.forEach;var Op=Object.prototype;var objToStr=Op.toString;var funObjStr=objToStr.call(function(){});var strObjStr=objToStr.call("");var hasOwn=Op.hasOwnProperty;function Type(check,name){var self=this;assert.ok(self instanceof Type,self);assert.strictEqual(objToStr.call(check),funObjStr,check+" is not a function");var nameObjStr=objToStr.call(name);assert.ok(nameObjStr===funObjStr||nameObjStr===strObjStr,name+" is neither a function nor a string");Object.defineProperties(self,{name:{value:name},check:{value:function(value,deep){var result=check.call(self,value,deep);if(!result&&deep&&objToStr.call(deep)===funObjStr)deep(self,value);return result}}})}var Tp=Type.prototype;exports.Type=Type;Tp.assert=function(value,deep){if(!this.check(value,deep)){var str=shallowStringify(value);assert.ok(false,str+" does not match type "+this);return false}return true};function shallowStringify(value){if(isObject.check(value))return"{"+Object.keys(value).map(function(key){return key+": "+value[key]}).join(", ")+"}";if(isArray.check(value))return"["+value.map(shallowStringify).join(", ")+"]";return JSON.stringify(value)}Tp.toString=function(){var name=this.name;if(isString.check(name))return name;if(isFunction.check(name))return name.call(this)+"";return name+" type"};var builtInTypes={};exports.builtInTypes=builtInTypes;function defBuiltInType(example,name){var objStr=objToStr.call(example);Object.defineProperty(builtInTypes,name,{enumerable:true,value:new Type(function(value){return objToStr.call(value)===objStr},name)});return builtInTypes[name]}var isString=defBuiltInType("","string");var isFunction=defBuiltInType(function(){},"function");var isArray=defBuiltInType([],"array");var isObject=defBuiltInType({},"object");var isRegExp=defBuiltInType(/./,"RegExp");var isDate=defBuiltInType(new Date,"Date");var isNumber=defBuiltInType(3,"number");var isBoolean=defBuiltInType(true,"boolean");var isNull=defBuiltInType(null,"null");var isUndefined=defBuiltInType(void 0,"undefined");function toType(from,name){if(from instanceof Type)return from;if(from instanceof Def)return from.type;if(isArray.check(from))return Type.fromArray(from);if(isObject.check(from))return Type.fromObject(from);if(isFunction.check(from))return new Type(from,name);return new Type(function(value){return value===from},isUndefined.check(name)?function(){return from+""}:name)}Type.or=function(){var types=[];var len=arguments.length;for(var i=0;i<len;++i)types.push(toType(arguments[i]));return new Type(function(value,deep){for(var i=0;i<len;++i)if(types[i].check(value,deep))return true;return false},function(){return types.join(" | ")})};Type.fromArray=function(arr){assert.ok(isArray.check(arr));assert.strictEqual(arr.length,1,"only one element type is permitted for typed arrays");return toType(arr[0]).arrayOf()};Tp.arrayOf=function(){var elemType=this;return new Type(function(value,deep){return isArray.check(value)&&value.every(function(elem){return elemType.check(elem,deep)})},function(){return"["+elemType+"]"})};Type.fromObject=function(obj){var fields=Object.keys(obj).map(function(name){return new Field(name,obj[name])});return new Type(function(value,deep){return isObject.check(value)&&fields.every(function(field){return field.type.check(value[field.name],deep)})},function(){return"{ "+fields.join(", ")+" }"})};function Field(name,type,defaultFn,hidden){var self=this;assert.ok(self instanceof Field);isString.assert(name);type=toType(type);var properties={name:{value:name},type:{value:type},hidden:{value:!!hidden}};if(isFunction.check(defaultFn)){properties.defaultFn={value:defaultFn}}Object.defineProperties(self,properties)}var Fp=Field.prototype;Fp.toString=function(){return JSON.stringify(this.name)+": "+this.type};Fp.getValue=function(obj){var value=obj[this.name];if(!isUndefined.check(value))return value;if(this.defaultFn)value=this.defaultFn.call(obj);return value};Type.def=function(typeName){isString.assert(typeName);return hasOwn.call(defCache,typeName)?defCache[typeName]:defCache[typeName]=new Def(typeName)};var defCache=Object.create(null);function Def(typeName){var self=this;assert.ok(self instanceof Def);Object.defineProperties(self,{typeName:{value:typeName},baseNames:{value:[]},ownFields:{value:Object.create(null)},allSupertypes:{value:Object.create(null)},supertypeList:{value:[]},allFields:{value:Object.create(null)},fieldNames:{value:[]},type:{value:new Type(function(value,deep){return self.check(value,deep)},typeName)}})}Def.fromValue=function(value){if(value&&typeof value==="object"){var type=value.type;if(typeof type==="string"&&hasOwn.call(defCache,type)){var d=defCache[type];if(d.finalized){return d}}}return null};var Dp=Def.prototype;Dp.isSupertypeOf=function(that){if(that instanceof Def){assert.strictEqual(this.finalized,true);assert.strictEqual(that.finalized,true);return hasOwn.call(that.allSupertypes,this.typeName)}else{assert.ok(false,that+" is not a Def")}};exports.getSupertypeNames=function(typeName){assert.ok(hasOwn.call(defCache,typeName));var d=defCache[typeName];assert.strictEqual(d.finalized,true);return d.supertypeList.slice(1)};exports.computeSupertypeLookupTable=function(candidates){var table={};var typeNames=Object.keys(defCache);var typeNameCount=typeNames.length;for(var i=0;i<typeNameCount;++i){var typeName=typeNames[i];var d=defCache[typeName];assert.strictEqual(d.finalized,true);for(var j=0;j<d.supertypeList.length;++j){var superTypeName=d.supertypeList[j];if(hasOwn.call(candidates,superTypeName)){table[typeName]=superTypeName;break}}}return table};Dp.checkAllFields=function(value,deep){var allFields=this.allFields;assert.strictEqual(this.finalized,true);function checkFieldByName(name){var field=allFields[name];var type=field.type;var child=field.getValue(value);return type.check(child,deep)}return isObject.check(value)&&Object.keys(allFields).every(checkFieldByName)};Dp.check=function(value,deep){assert.strictEqual(this.finalized,true,"prematurely checking unfinalized type "+this.typeName);if(!isObject.check(value))return false;var vDef=Def.fromValue(value);if(!vDef){if(this.typeName==="SourceLocation"||this.typeName==="Position"){return this.checkAllFields(value,deep)}return false}if(deep&&vDef===this)return this.checkAllFields(value,deep);if(!this.isSupertypeOf(vDef))return false;if(!deep)return true;return vDef.checkAllFields(value,deep)&&this.checkAllFields(value,false)};Dp.bases=function(){var bases=this.baseNames;assert.strictEqual(this.finalized,false);each.call(arguments,function(baseName){isString.assert(baseName);if(bases.indexOf(baseName)<0)bases.push(baseName)});return this};Object.defineProperty(Dp,"buildable",{value:false});var builders={};exports.builders=builders;var nodePrototype={};exports.defineMethod=function(name,func){var old=nodePrototype[name];if(isUndefined.check(func)){delete nodePrototype[name]}else{isFunction.assert(func);Object.defineProperty(nodePrototype,name,{enumerable:true,configurable:true,value:func})}return old};Dp.build=function(){var self=this;Object.defineProperty(self,"buildParams",{value:slice.call(arguments),writable:false,enumerable:false,configurable:true});assert.strictEqual(self.finalized,false);isString.arrayOf().assert(self.buildParams);if(self.buildable){return self}self.field("type",self.typeName,function(){return self.typeName});Object.defineProperty(self,"buildable",{value:true});Object.defineProperty(builders,getBuilderName(self.typeName),{enumerable:true,value:function(){var args=arguments;var argc=args.length;var built=Object.create(nodePrototype);assert.ok(self.finalized,"attempting to instantiate unfinalized type "+self.typeName);function add(param,i){if(hasOwn.call(built,param))return;var all=self.allFields;assert.ok(hasOwn.call(all,param),param);var field=all[param];var type=field.type;var value;if(isNumber.check(i)&&i<argc){value=args[i]}else if(field.defaultFn){value=field.defaultFn.call(built)}else{var message="no value or default function given for field "+JSON.stringify(param)+" of "+self.typeName+"("+self.buildParams.map(function(name){return all[name]}).join(", ")+")";assert.ok(false,message)}if(!type.check(value)){assert.ok(false,shallowStringify(value)+" does not match field "+field+" of type "+self.typeName)}built[param]=value}self.buildParams.forEach(function(param,i){add(param,i)});Object.keys(self.allFields).forEach(function(param){add(param)});assert.strictEqual(built.type,self.typeName);return built}});return self};function getBuilderName(typeName){return typeName.replace(/^[A-Z]+/,function(upperCasePrefix){var len=upperCasePrefix.length;switch(len){case 0:return"";case 1:return upperCasePrefix.toLowerCase();default:return upperCasePrefix.slice(0,len-1).toLowerCase()+upperCasePrefix.charAt(len-1)}})}Dp.field=function(name,type,defaultFn,hidden){assert.strictEqual(this.finalized,false);this.ownFields[name]=new Field(name,type,defaultFn,hidden);return this};var namedTypes={};exports.namedTypes=namedTypes;function getFieldNames(object){var d=Def.fromValue(object);if(d){return d.fieldNames.slice(0)}if("type"in object){assert.ok(false,"did not recognize object of type "+JSON.stringify(object.type))}return Object.keys(object)}exports.getFieldNames=getFieldNames;function getFieldValue(object,fieldName){var d=Def.fromValue(object);if(d){var field=d.allFields[fieldName];if(field){return field.getValue(object)}}return object[fieldName]}exports.getFieldValue=getFieldValue;exports.eachField=function(object,callback,context){getFieldNames(object).forEach(function(name){callback.call(this,name,getFieldValue(object,name))},context)};exports.someField=function(object,callback,context){return getFieldNames(object).some(function(name){return callback.call(this,name,getFieldValue(object,name))},context)};Object.defineProperty(Dp,"finalized",{value:false});Dp.finalize=function(){if(!this.finalized){var allFields=this.allFields;var allSupertypes=this.allSupertypes;this.baseNames.forEach(function(name){var def=defCache[name];def.finalize();extend(allFields,def.allFields);extend(allSupertypes,def.allSupertypes)});extend(allFields,this.ownFields);allSupertypes[this.typeName]=this;this.fieldNames.length=0;for(var fieldName in allFields){if(hasOwn.call(allFields,fieldName)&&!allFields[fieldName].hidden){this.fieldNames.push(fieldName)}}Object.defineProperty(namedTypes,this.typeName,{enumerable:true,value:this.type});Object.defineProperty(this,"finalized",{value:true});populateSupertypeList(this.typeName,this.supertypeList)}};function populateSupertypeList(typeName,list){list.length=0;list.push(typeName);var lastSeen=Object.create(null);for(var pos=0;pos<list.length;++pos){typeName=list[pos];var d=defCache[typeName];assert.strictEqual(d.finalized,true);if(hasOwn.call(lastSeen,typeName)){delete list[lastSeen[typeName]]}lastSeen[typeName]=pos;list.push.apply(list,d.baseNames)}for(var to=0,from=to,len=list.length;from<len;++from){if(hasOwn.call(list,from)){list[to++]=list[from]}}list.length=to}function extend(into,from){Object.keys(from).forEach(function(name){into[name]=from[name]});return into}exports.finalize=function(){Object.keys(defCache).forEach(function(name){defCache[name].finalize()})}},{assert:95}],93:[function(require,module,exports){var types=require("./lib/types");require("./def/core");require("./def/es6");require("./def/es7");require("./def/mozilla");require("./def/e4x");require("./def/fb-harmony");types.finalize();exports.Type=types.Type;exports.builtInTypes=types.builtInTypes;exports.namedTypes=types.namedTypes;exports.builders=types.builders;exports.defineMethod=types.defineMethod;exports.getFieldNames=types.getFieldNames;exports.getFieldValue=types.getFieldValue;exports.eachField=types.eachField;exports.someField=types.someField;exports.getSupertypeNames=types.getSupertypeNames;exports.astNodesAreEquivalent=require("./lib/equiv");exports.finalize=types.finalize;exports.NodePath=require("./lib/node-path");exports.PathVisitor=require("./lib/path-visitor");exports.visit=exports.PathVisitor.visit},{"./def/core":80,"./def/e4x":81,"./def/es6":82,"./def/es7":83,"./def/fb-harmony":84,"./def/mozilla":85,"./lib/equiv":86,"./lib/node-path":87,"./lib/path-visitor":88,"./lib/types":92}],94:[function(require,module,exports){},{}],95:[function(require,module,exports){var util=require("util/");var pSlice=Array.prototype.slice;var hasOwn=Object.prototype.hasOwnProperty;var assert=module.exports=ok;assert.AssertionError=function AssertionError(options){this.name="AssertionError";this.actual=options.actual;this.expected=options.expected;this.operator=options.operator;if(options.message){this.message=options.message;this.generatedMessage=false}else{this.message=getMessage(this);this.generatedMessage=true}var stackStartFunction=options.stackStartFunction||fail;if(Error.captureStackTrace){Error.captureStackTrace(this,stackStartFunction)}else{var err=new Error;if(err.stack){var out=err.stack;var fn_name=stackStartFunction.name;var idx=out.indexOf("\n"+fn_name);if(idx>=0){var next_line=out.indexOf("\n",idx+1);out=out.substring(next_line+1)}this.stack=out}}};util.inherits(assert.AssertionError,Error);function replacer(key,value){if(util.isUndefined(value)){return""+value}if(util.isNumber(value)&&(isNaN(value)||!isFinite(value))){return value.toString()}if(util.isFunction(value)||util.isRegExp(value)){return value.toString()}return value}function truncate(s,n){if(util.isString(s)){return s.length<n?s:s.slice(0,n)}else{return s}}function getMessage(self){return truncate(JSON.stringify(self.actual,replacer),128)+" "+self.operator+" "+truncate(JSON.stringify(self.expected,replacer),128)}function fail(actual,expected,message,operator,stackStartFunction){throw new assert.AssertionError({message:message,actual:actual,expected:expected,operator:operator,stackStartFunction:stackStartFunction})}assert.fail=fail;function ok(value,message){if(!value)fail(value,true,message,"==",assert.ok)}assert.ok=ok;assert.equal=function equal(actual,expected,message){if(actual!=expected)fail(actual,expected,message,"==",assert.equal)};assert.notEqual=function notEqual(actual,expected,message){if(actual==expected){fail(actual,expected,message,"!=",assert.notEqual)}};assert.deepEqual=function deepEqual(actual,expected,message){if(!_deepEqual(actual,expected)){fail(actual,expected,message,"deepEqual",assert.deepEqual)}};function _deepEqual(actual,expected){if(actual===expected){return true}else if(util.isBuffer(actual)&&util.isBuffer(expected)){if(actual.length!=expected.length)return false;for(var i=0;i<actual.length;i++){if(actual[i]!==expected[i])return false}return true}else if(util.isDate(actual)&&util.isDate(expected)){return actual.getTime()===expected.getTime()}else if(util.isRegExp(actual)&&util.isRegExp(expected)){return actual.source===expected.source&&actual.global===expected.global&&actual.multiline===expected.multiline&&actual.lastIndex===expected.lastIndex&&actual.ignoreCase===expected.ignoreCase}else if(!util.isObject(actual)&&!util.isObject(expected)){return actual==expected}else{return objEquiv(actual,expected)}}function isArguments(object){return Object.prototype.toString.call(object)=="[object Arguments]"}function objEquiv(a,b){if(util.isNullOrUndefined(a)||util.isNullOrUndefined(b))return false;if(a.prototype!==b.prototype)return false;if(isArguments(a)){if(!isArguments(b)){return false}a=pSlice.call(a);b=pSlice.call(b);return _deepEqual(a,b)}try{var ka=objectKeys(a),kb=objectKeys(b),key,i}catch(e){return false}if(ka.length!=kb.length)return false;ka.sort();kb.sort();for(i=ka.length-1;i>=0;i--){if(ka[i]!=kb[i])return false}for(i=ka.length-1;i>=0;i--){key=ka[i];if(!_deepEqual(a[key],b[key]))return false}return true}assert.notDeepEqual=function notDeepEqual(actual,expected,message){if(_deepEqual(actual,expected)){fail(actual,expected,message,"notDeepEqual",assert.notDeepEqual)}};assert.strictEqual=function strictEqual(actual,expected,message){if(actual!==expected){fail(actual,expected,message,"===",assert.strictEqual)}};assert.notStrictEqual=function notStrictEqual(actual,expected,message){if(actual===expected){fail(actual,expected,message,"!==",assert.notStrictEqual)}};function expectedException(actual,expected){if(!actual||!expected){return false}if(Object.prototype.toString.call(expected)=="[object RegExp]"){return expected.test(actual)}else if(actual instanceof expected){return true}else if(expected.call({},actual)===true){return true}return false}function _throws(shouldThrow,block,expected,message){var actual;if(util.isString(expected)){message=expected;expected=null}try{block()}catch(e){actual=e}message=(expected&&expected.name?" ("+expected.name+").":".")+(message?" "+message:".");if(shouldThrow&&!actual){fail(actual,expected,"Missing expected exception"+message)}if(!shouldThrow&&expectedException(actual,expected)){fail(actual,expected,"Got unwanted exception"+message)}if(shouldThrow&&actual&&expected&&!expectedException(actual,expected)||!shouldThrow&&actual){throw actual}}assert.throws=function(block,error,message){_throws.apply(this,[true].concat(pSlice.call(arguments)))};assert.doesNotThrow=function(block,message){_throws.apply(this,[false].concat(pSlice.call(arguments)))};assert.ifError=function(err){if(err){throw err}};var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj){if(hasOwn.call(obj,key))keys.push(key)}return keys}},{"util/":119}],96:[function(require,module,exports){var base64=require("base64-js");var ieee754=require("ieee754");var isArray=require("is-array");exports.Buffer=Buffer;exports.SlowBuffer=Buffer;exports.INSPECT_MAX_BYTES=50;Buffer.poolSize=8192;var kMaxLength=1073741823;Buffer.TYPED_ARRAY_SUPPORT=function(){try{var buf=new ArrayBuffer(0);var arr=new Uint8Array(buf);arr.foo=function(){return 42};return 42===arr.foo()&&typeof arr.subarray==="function"&&new Uint8Array(1).subarray(1,1).byteLength===0}catch(e){return false}}();function Buffer(subject,encoding,noZero){if(!(this instanceof Buffer))return new Buffer(subject,encoding,noZero);var type=typeof subject;var length;if(type==="number")length=subject>0?subject>>>0:0;else if(type==="string"){if(encoding==="base64")subject=base64clean(subject);length=Buffer.byteLength(subject,encoding)}else if(type==="object"&&subject!==null){if(subject.type==="Buffer"&&isArray(subject.data))subject=subject.data;length=+subject.length>0?Math.floor(+subject.length):0}else throw new TypeError("must start with number, buffer, array or string");if(this.length>kMaxLength)throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+kMaxLength.toString(16)+" bytes");var buf;if(Buffer.TYPED_ARRAY_SUPPORT){buf=Buffer._augment(new Uint8Array(length))}else{buf=this;buf.length=length;buf._isBuffer=true}var i;if(Buffer.TYPED_ARRAY_SUPPORT&&typeof subject.byteLength==="number"){buf._set(subject)}else if(isArrayish(subject)){if(Buffer.isBuffer(subject)){for(i=0;i<length;i++)buf[i]=subject.readUInt8(i)}else{for(i=0;i<length;i++)buf[i]=(subject[i]%256+256)%256}}else if(type==="string"){buf.write(subject,0,encoding)}else if(type==="number"&&!Buffer.TYPED_ARRAY_SUPPORT&&!noZero){for(i=0;i<length;i++){buf[i]=0}}return buf}Buffer.isBuffer=function(b){return!!(b!=null&&b._isBuffer)};Buffer.compare=function(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b))throw new TypeError("Arguments must be Buffers");var x=a.length;var y=b.length;for(var i=0,len=Math.min(x,y);i<len&&a[i]===b[i];i++){}if(i!==len){x=a[i];y=b[i]}if(x<y)return-1;if(y<x)return 1;return 0};Buffer.isEncoding=function(encoding){switch(String(encoding).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}};Buffer.concat=function(list,totalLength){if(!isArray(list))throw new TypeError("Usage: Buffer.concat(list[, length])");if(list.length===0){return new Buffer(0)}else if(list.length===1){return list[0]}var i;if(totalLength===undefined){totalLength=0;for(i=0;i<list.length;i++){totalLength+=list[i].length}}var buf=new Buffer(totalLength);var pos=0;for(i=0;i<list.length;i++){var item=list[i];item.copy(buf,pos);pos+=item.length}return buf};Buffer.byteLength=function(str,encoding){var ret;str=str+"";switch(encoding||"utf8"){case"ascii":case"binary":case"raw":ret=str.length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":ret=str.length*2;break;case"hex":ret=str.length>>>1;break;case"utf8":case"utf-8":ret=utf8ToBytes(str).length;break;case"base64":ret=base64ToBytes(str).length;break;default:ret=str.length}return ret};Buffer.prototype.length=undefined;Buffer.prototype.parent=undefined;Buffer.prototype.toString=function(encoding,start,end){var loweredCase=false;start=start>>>0;end=end===undefined||end===Infinity?this.length:end>>>0;if(!encoding)encoding="utf8";if(start<0)start=0;if(end>this.length)end=this.length;if(end<=start)return"";while(true){switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"binary":return binarySlice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase();loweredCase=true}}};Buffer.prototype.equals=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return Buffer.compare(this,b)===0};Buffer.prototype.inspect=function(){var str="";var max=exports.INSPECT_MAX_BYTES;if(this.length>0){str=this.toString("hex",0,max).match(/.{2}/g).join(" ");if(this.length>max)str+=" ... "}return"<Buffer "+str+">"};Buffer.prototype.compare=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return Buffer.compare(this,b)};Buffer.prototype.get=function(offset){console.log(".get() is deprecated. Access using array indexes instead.");return this.readUInt8(offset)};Buffer.prototype.set=function(v,offset){console.log(".set() is deprecated. Access using array indexes instead.");return this.writeUInt8(v,offset)};function hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}var strLen=string.length;if(strLen%2!==0)throw new Error("Invalid hex string");if(length>strLen/2){length=strLen/2}for(var i=0;i<length;i++){var byte=parseInt(string.substr(i*2,2),16);if(isNaN(byte))throw new Error("Invalid hex string");buf[offset+i]=byte}return i}function utf8Write(buf,string,offset,length){var charsWritten=blitBuffer(utf8ToBytes(string),buf,offset,length);return charsWritten}function asciiWrite(buf,string,offset,length){var charsWritten=blitBuffer(asciiToBytes(string),buf,offset,length);return charsWritten}function binaryWrite(buf,string,offset,length){return asciiWrite(buf,string,offset,length)}function base64Write(buf,string,offset,length){var charsWritten=blitBuffer(base64ToBytes(string),buf,offset,length);return charsWritten}function utf16leWrite(buf,string,offset,length){var charsWritten=blitBuffer(utf16leToBytes(string),buf,offset,length,2);return charsWritten}Buffer.prototype.write=function(string,offset,length,encoding){if(isFinite(offset)){if(!isFinite(length)){encoding=length;length=undefined}}else{var swap=encoding;encoding=offset;offset=length;length=swap}offset=Number(offset)||0;var remaining=this.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}encoding=String(encoding||"utf8").toLowerCase();var ret;switch(encoding){case"hex":ret=hexWrite(this,string,offset,length);break;case"utf8":case"utf-8":ret=utf8Write(this,string,offset,length);break;case"ascii":ret=asciiWrite(this,string,offset,length);break;case"binary":ret=binaryWrite(this,string,offset,length);break;case"base64":ret=base64Write(this,string,offset,length);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":ret=utf16leWrite(this,string,offset,length);break;default:throw new TypeError("Unknown encoding: "+encoding)}return ret};Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf)}else{return base64.fromByteArray(buf.slice(start,end))}}function utf8Slice(buf,start,end){var res="";var tmp="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){if(buf[i]<=127){res+=decodeUtf8Char(tmp)+String.fromCharCode(buf[i]);tmp=""}else{tmp+="%"+buf[i].toString(16)}}return res+decodeUtf8Char(tmp)}function asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){ret+=String.fromCharCode(buf[i])}return ret}function binarySlice(buf,start,end){return asciiSlice(buf,start,end)
}function hexSlice(buf,start,end){var len=buf.length;if(!start||start<0)start=0;if(!end||end<0||end>len)end=len;var out="";for(var i=start;i<end;i++){out+=toHex(buf[i])}return out}function utf16leSlice(buf,start,end){var bytes=buf.slice(start,end);var res="";for(var i=0;i<bytes.length;i+=2){res+=String.fromCharCode(bytes[i]+bytes[i+1]*256)}return res}Buffer.prototype.slice=function(start,end){var len=this.length;start=~~start;end=end===undefined?len:~~end;if(start<0){start+=len;if(start<0)start=0}else if(start>len){start=len}if(end<0){end+=len;if(end<0)end=0}else if(end>len){end=len}if(end<start)end=start;if(Buffer.TYPED_ARRAY_SUPPORT){return Buffer._augment(this.subarray(start,end))}else{var sliceLen=end-start;var newBuf=new Buffer(sliceLen,undefined,true);for(var i=0;i<sliceLen;i++){newBuf[i]=this[i+start]}return newBuf}};function checkOffset(offset,ext,length){if(offset%1!==0||offset<0)throw new RangeError("offset is not uint");if(offset+ext>length)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUInt8=function(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer.prototype.readUInt16LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer.prototype.readUInt16BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer.prototype.readUInt32LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer.prototype.readUInt32BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer.prototype.readInt8=function(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer.prototype.readInt16LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt16BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt32LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer.prototype.readInt32BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer.prototype.readFloatLE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4)};Buffer.prototype.readFloatBE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4)};Buffer.prototype.readDoubleLE=function(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8)};Buffer.prototype.readDoubleBE=function(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8)};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError("buffer must be a Buffer instance");if(value>max||value<min)throw new TypeError("value is out of bounds");if(offset+ext>buf.length)throw new TypeError("index out of range")}Buffer.prototype.writeUInt8=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,255,0);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);this[offset]=value;return offset+1};function objectWriteUInt16(buf,value,offset,littleEndian){if(value<0)value=65535+value+1;for(var i=0,j=Math.min(buf.length-offset,2);i<j;i++){buf[offset+i]=(value&255<<8*(littleEndian?i:1-i))>>>(littleEndian?i:1-i)*8}}Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8}else objectWriteUInt16(this,value,offset,true);return offset+2};Buffer.prototype.writeUInt16BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value}else objectWriteUInt16(this,value,offset,false);return offset+2};function objectWriteUInt32(buf,value,offset,littleEndian){if(value<0)value=4294967295+value+1;for(var i=0,j=Math.min(buf.length-offset,4);i<j;i++){buf[offset+i]=value>>>(littleEndian?i:3-i)*8&255}}Buffer.prototype.writeUInt32LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value}else objectWriteUInt32(this,value,offset,true);return offset+4};Buffer.prototype.writeUInt32BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value}else objectWriteUInt32(this,value,offset,false);return offset+4};Buffer.prototype.writeInt8=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,127,-128);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);if(value<0)value=255+value+1;this[offset]=value;return offset+1};Buffer.prototype.writeInt16LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8}else objectWriteUInt16(this,value,offset,true);return offset+2};Buffer.prototype.writeInt16BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value}else objectWriteUInt16(this,value,offset,false);return offset+2};Buffer.prototype.writeInt32LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24}else objectWriteUInt32(this,value,offset,true);return offset+4};Buffer.prototype.writeInt32BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value}else objectWriteUInt32(this,value,offset,false);return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(value>max||value<min)throw new TypeError("value is out of bounds");if(offset+ext>buf.length)throw new TypeError("index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){if(!noAssert)checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38);ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4}Buffer.prototype.writeFloatLE=function(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert)};function writeDouble(buf,value,offset,littleEndian,noAssert){if(!noAssert)checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308);ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8}Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.copy=function(target,target_start,start,end){var source=this;if(!start)start=0;if(!end&&end!==0)end=this.length;if(!target_start)target_start=0;if(end===start)return;if(target.length===0||source.length===0)return;if(end<start)throw new TypeError("sourceEnd < sourceStart");if(target_start<0||target_start>=target.length)throw new TypeError("targetStart out of bounds");if(start<0||start>=source.length)throw new TypeError("sourceStart out of bounds");if(end<0||end>source.length)throw new TypeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-target_start<end-start)end=target.length-target_start+start;var len=end-start;if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT){for(var i=0;i<len;i++){target[i+target_start]=this[i+start]}}else{target._set(this.subarray(start,start+len),target_start)}};Buffer.prototype.fill=function(value,start,end){if(!value)value=0;if(!start)start=0;if(!end)end=this.length;if(end<start)throw new TypeError("end < start");if(end===start)return;if(this.length===0)return;if(start<0||start>=this.length)throw new TypeError("start out of bounds");if(end<0||end>this.length)throw new TypeError("end out of bounds");var i;if(typeof value==="number"){for(i=start;i<end;i++){this[i]=value}}else{var bytes=utf8ToBytes(value.toString());var len=bytes.length;for(i=start;i<end;i++){this[i]=bytes[i%len]}}return this};Buffer.prototype.toArrayBuffer=function(){if(typeof Uint8Array!=="undefined"){if(Buffer.TYPED_ARRAY_SUPPORT){return new Buffer(this).buffer}else{var buf=new Uint8Array(this.length);for(var i=0,len=buf.length;i<len;i+=1){buf[i]=this[i]}return buf.buffer}}else{throw new TypeError("Buffer.toArrayBuffer not supported in this browser")}};var BP=Buffer.prototype;Buffer._augment=function(arr){arr.constructor=Buffer;arr._isBuffer=true;arr._get=arr.get;arr._set=arr.set;arr.get=BP.get;arr.set=BP.set;arr.write=BP.write;arr.toString=BP.toString;arr.toLocaleString=BP.toString;arr.toJSON=BP.toJSON;arr.equals=BP.equals;arr.compare=BP.compare;arr.copy=BP.copy;arr.slice=BP.slice;arr.readUInt8=BP.readUInt8;arr.readUInt16LE=BP.readUInt16LE;arr.readUInt16BE=BP.readUInt16BE;arr.readUInt32LE=BP.readUInt32LE;arr.readUInt32BE=BP.readUInt32BE;arr.readInt8=BP.readInt8;arr.readInt16LE=BP.readInt16LE;arr.readInt16BE=BP.readInt16BE;arr.readInt32LE=BP.readInt32LE;arr.readInt32BE=BP.readInt32BE;arr.readFloatLE=BP.readFloatLE;arr.readFloatBE=BP.readFloatBE;arr.readDoubleLE=BP.readDoubleLE;arr.readDoubleBE=BP.readDoubleBE;arr.writeUInt8=BP.writeUInt8;arr.writeUInt16LE=BP.writeUInt16LE;arr.writeUInt16BE=BP.writeUInt16BE;arr.writeUInt32LE=BP.writeUInt32LE;arr.writeUInt32BE=BP.writeUInt32BE;arr.writeInt8=BP.writeInt8;arr.writeInt16LE=BP.writeInt16LE;arr.writeInt16BE=BP.writeInt16BE;arr.writeInt32LE=BP.writeInt32LE;arr.writeInt32BE=BP.writeInt32BE;arr.writeFloatLE=BP.writeFloatLE;arr.writeFloatBE=BP.writeFloatBE;arr.writeDoubleLE=BP.writeDoubleLE;arr.writeDoubleBE=BP.writeDoubleBE;arr.fill=BP.fill;arr.inspect=BP.inspect;arr.toArrayBuffer=BP.toArrayBuffer;return arr};var INVALID_BASE64_RE=/[^+\/0-9A-z]/g;function base64clean(str){str=stringtrim(str).replace(INVALID_BASE64_RE,"");while(str.length%4!==0){str=str+"="}return str}function stringtrim(str){if(str.trim)return str.trim();return str.replace(/^\s+|\s+$/g,"")}function isArrayish(subject){return isArray(subject)||Buffer.isBuffer(subject)||subject&&typeof subject==="object"&&typeof subject.length==="number"}function toHex(n){if(n<16)return"0"+n.toString(16);return n.toString(16)}function utf8ToBytes(str){var byteArray=[];for(var i=0;i<str.length;i++){var b=str.charCodeAt(i);if(b<=127){byteArray.push(b)}else{var start=i;if(b>=55296&&b<=57343)i++;var h=encodeURIComponent(str.slice(start,i+1)).substr(1).split("%");for(var j=0;j<h.length;j++){byteArray.push(parseInt(h[j],16))}}}return byteArray}function asciiToBytes(str){var byteArray=[];for(var i=0;i<str.length;i++){byteArray.push(str.charCodeAt(i)&255)}return byteArray}function utf16leToBytes(str){var c,hi,lo;var byteArray=[];for(var i=0;i<str.length;i++){c=str.charCodeAt(i);hi=c>>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return base64.toByteArray(str)}function blitBuffer(src,dst,offset,length,unitSize){if(unitSize)length-=length%unitSize;for(var i=0;i<length;i++){if(i+offset>=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}function decodeUtf8Char(str){try{return decodeURIComponent(str)}catch(err){return String.fromCharCode(65533)}}},{"base64-js":97,ieee754:98,"is-array":99}],97:[function(require,module,exports){var lookup="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(exports){"use strict";var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var PLUS="+".charCodeAt(0);var SLASH="/".charCodeAt(0);var NUMBER="0".charCodeAt(0);var LOWER="a".charCodeAt(0);var UPPER="A".charCodeAt(0);function decode(elt){var code=elt.charCodeAt(0);if(code===PLUS)return 62;if(code===SLASH)return 63;if(code<NUMBER)return-1;if(code<NUMBER+10)return code-NUMBER+26+26;if(code<UPPER+26)return code-UPPER;if(code<LOWER+26)return code-LOWER+26}function b64ToByteArray(b64){var i,j,l,tmp,placeHolders,arr;if(b64.length%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var len=b64.length;placeHolders="="===b64.charAt(len-2)?2:"="===b64.charAt(len-1)?1:0;arr=new Arr(b64.length*3/4-placeHolders);l=placeHolders>0?b64.length-4:b64.length;var L=0;function push(v){arr[L++]=v}for(i=0,j=0;i<l;i+=4,j+=3){tmp=decode(b64.charAt(i))<<18|decode(b64.charAt(i+1))<<12|decode(b64.charAt(i+2))<<6|decode(b64.charAt(i+3));push((tmp&16711680)>>16);push((tmp&65280)>>8);push(tmp&255)}if(placeHolders===2){tmp=decode(b64.charAt(i))<<2|decode(b64.charAt(i+1))>>4;push(tmp&255)}else if(placeHolders===1){tmp=decode(b64.charAt(i))<<10|decode(b64.charAt(i+1))<<4|decode(b64.charAt(i+2))>>2;push(tmp>>8&255);push(tmp&255)}return arr}function uint8ToBase64(uint8){var i,extraBytes=uint8.length%3,output="",temp,length;function encode(num){return lookup.charAt(num)}function tripletToBase64(num){return encode(num>>18&63)+encode(num>>12&63)+encode(num>>6&63)+encode(num&63)}for(i=0,length=uint8.length-extraBytes;i<length;i+=3){temp=(uint8[i]<<16)+(uint8[i+1]<<8)+uint8[i+2];output+=tripletToBase64(temp)}switch(extraBytes){case 1:temp=uint8[uint8.length-1];output+=encode(temp>>2);output+=encode(temp<<4&63);output+="==";break;case 2:temp=(uint8[uint8.length-2]<<8)+uint8[uint8.length-1];output+=encode(temp>>10);output+=encode(temp>>4&63);output+=encode(temp<<2&63);output+="=";break}return output}exports.toByteArray=b64ToByteArray;exports.fromByteArray=uint8ToBase64})(typeof exports==="undefined"?this.base64js={}:exports)},{}],98:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8);m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8);if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8);e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=s*128}},{}],99:[function(require,module,exports){var isArray=Array.isArray;var str=Object.prototype.toString;module.exports=isArray||function(val){return!!val&&"[object Array]"==str.call(val)}},{}],100:[function(require,module,exports){function EventEmitter(){this._events=this._events||{};this._maxListeners=this._maxListeners||undefined}module.exports=EventEmitter;EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=undefined;EventEmitter.prototype._maxListeners=undefined;EventEmitter.defaultMaxListeners=10;EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||n<0||isNaN(n))throw TypeError("n must be a positive number");this._maxListeners=n;return this};EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(!this._events)this._events={};if(type==="error"){if(!this._events.error||isObject(this._events.error)&&!this._events.error.length){er=arguments[1];if(er instanceof Error){throw er}throw TypeError('Uncaught, unspecified "error" event.')}}handler=this._events[type];if(isUndefined(handler))return false;if(isFunction(handler)){switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:len=arguments.length;args=new Array(len-1);for(i=1;i<len;i++)args[i-1]=arguments[i];handler.apply(this,args)}}else if(isObject(handler)){len=arguments.length;args=new Array(len-1);for(i=1;i<len;i++)args[i-1]=arguments[i];listeners=handler.slice();len=listeners.length;for(i=0;i<len;i++)listeners[i].apply(this,args)}return true};EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events)this._events={};if(this._events.newListener)this.emit("newListener",type,isFunction(listener.listener)?listener.listener:listener);if(!this._events[type])this._events[type]=listener;else if(isObject(this._events[type]))this._events[type].push(listener);else this._events[type]=[this._events[type],listener];if(isObject(this._events[type])&&!this._events[type].warned){var m;if(!isUndefined(this._maxListeners)){m=this._maxListeners}else{m=EventEmitter.defaultMaxListeners}if(m&&m>0&&this._events[type].length>m){this._events[type].warned=true;console.error("(node) warning: possible EventEmitter memory "+"leak detected. %d listeners added. "+"Use emitter.setMaxListeners() to increase limit.",this._events[type].length);if(typeof console.trace==="function"){console.trace()}}}return this};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.once=function(type,listener){if(!isFunction(listener))throw TypeError("listener must be a function");var fired=false;function g(){this.removeListener(type,g);if(!fired){fired=true;listener.apply(this,arguments)}}g.listener=listener;this.on(type,g);return this};EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;list=this._events[type];length=list.length;position=-1;if(list===listener||isFunction(list.listener)&&list.listener===listener){delete this._events[type];if(this._events.removeListener)this.emit("removeListener",type,listener)}else if(isObject(list)){for(i=length;i-->0;){if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}}if(position<0)return this;if(list.length===1){list.length=0;delete this._events[type]}else{list.splice(position,1)}if(this._events.removeListener)this.emit("removeListener",type,listener)}return this};EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener){if(arguments.length===0)this._events={};else if(this._events[type])delete this._events[type];return this}if(arguments.length===0){for(key in this._events){if(key==="removeListener")continue;this.removeAllListeners(key)}this.removeAllListeners("removeListener");this._events={};return this}listeners=this._events[type];if(isFunction(listeners)){this.removeListener(type,listeners)}else{while(listeners.length)this.removeListener(type,listeners[listeners.length-1])}delete this._events[type];return this};EventEmitter.prototype.listeners=function(type){var ret;if(!this._events||!this._events[type])ret=[];else if(isFunction(this._events[type]))ret=[this._events[type]];else ret=this._events[type].slice();return ret};EventEmitter.listenerCount=function(emitter,type){var ret;if(!emitter._events||!emitter._events[type])ret=0;else if(isFunction(emitter._events[type]))ret=1;else ret=emitter._events[type].length;return ret};function isFunction(arg){return typeof arg==="function"}function isNumber(arg){return typeof arg==="number"}function isObject(arg){return typeof arg==="object"&&arg!==null}function isUndefined(arg){return arg===void 0}},{}],101:[function(require,module,exports){if(typeof Object.create==="function"){module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})}}else{module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}}},{}],102:[function(require,module,exports){module.exports=Array.isArray||function(arr){return Object.prototype.toString.call(arr)=="[object Array]"}},{}],103:[function(require,module,exports){(function(process){function normalizeArray(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up--;up){parts.unshift("..")}}return parts}var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var splitPath=function(filename){return splitPathRe.exec(filename).slice(1)};exports.resolve=function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();if(typeof path!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){continue}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=path.charAt(0)==="/"}resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."};exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==="/";path=normalizeArray(filter(path.split("/"),function(p){return!!p}),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path};exports.isAbsolute=function(path){return path.charAt(0)==="/"};exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if(typeof p!=="string"){throw new TypeError("Arguments to path.join must be strings")}return p}).join("/"))};exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..")}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/")};exports.sep="/";exports.delimiter=":";exports.dirname=function(path){var result=splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir};exports.basename=function(path,ext){var f=splitPath(path)[2];if(ext&&f.substr(-1*ext.length)===ext){f=f.substr(0,f.length-ext.length)}return f};exports.extname=function(path){return splitPath(path)[3]};function filter(xs,f){if(xs.filter)return xs.filter(f);var res=[];for(var i=0;i<xs.length;i++){if(f(xs[i],i,xs))res.push(xs[i])}return res}var substr="ab".substr(-1)==="b"?function(str,start,len){return str.substr(start,len)}:function(str,start,len){if(start<0)start=str.length+start;return str.substr(start,len)}}).call(this,require("_process"))},{_process:104}],104:[function(require,module,exports){var process=module.exports={};process.nextTick=function(){var canSetImmediate=typeof window!=="undefined"&&window.setImmediate;var canMutationObserver=typeof window!=="undefined"&&window.MutationObserver;var canPost=typeof window!=="undefined"&&window.postMessage&&window.addEventListener;if(canSetImmediate){return function(f){return window.setImmediate(f)}}var queue=[];if(canMutationObserver){var hiddenDiv=document.createElement("div");var observer=new MutationObserver(function(){var queueList=queue.slice();queue.length=0;queueList.forEach(function(fn){fn()})});observer.observe(hiddenDiv,{attributes:true});return function nextTick(fn){if(!queue.length){hiddenDiv.setAttribute("yes","no")}queue.push(fn)}}if(canPost){window.addEventListener("message",function(ev){var source=ev.source;if((source===window||source===null)&&ev.data==="process-tick"){ev.stopPropagation();if(queue.length>0){var fn=queue.shift();fn()}}},true);return function nextTick(fn){queue.push(fn);window.postMessage("process-tick","*")}}return function nextTick(fn){setTimeout(fn,0)}}();process.title="browser";process.browser=true;process.env={};process.argv=[];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")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")}},{}],105:[function(require,module,exports){module.exports=require("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":106}],106:[function(require,module,exports){(function(process){module.exports=Duplex;var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj)keys.push(key);return keys};var util=require("core-util-is");util.inherits=require("inherits");var Readable=require("./_stream_readable");var Writable=require("./_stream_writable");util.inherits(Duplex,Readable);forEach(objectKeys(Writable.prototype),function(method){if(!Duplex.prototype[method])Duplex.prototype[method]=Writable.prototype[method]});function Duplex(options){if(!(this instanceof Duplex))return new Duplex(options);Readable.call(this,options);Writable.call(this,options);if(options&&options.readable===false)this.readable=false;if(options&&options.writable===false)this.writable=false;this.allowHalfOpen=true;if(options&&options.allowHalfOpen===false)this.allowHalfOpen=false;this.once("end",onend)}function onend(){if(this.allowHalfOpen||this._writableState.ended)return;process.nextTick(this.end.bind(this))}function forEach(xs,f){for(var i=0,l=xs.length;i<l;i++){f(xs[i],i)}}}).call(this,require("_process"))},{"./_stream_readable":108,"./_stream_writable":110,_process:104,"core-util-is":111,inherits:101}],107:[function(require,module,exports){module.exports=PassThrough;var Transform=require("./_stream_transform");var util=require("core-util-is");util.inherits=require("inherits");util.inherits(PassThrough,Transform);function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options)}PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk)}},{"./_stream_transform":109,"core-util-is":111,inherits:101}],108:[function(require,module,exports){(function(process){module.exports=Readable;var isArray=require("isarray");var Buffer=require("buffer").Buffer;Readable.ReadableState=ReadableState;var EE=require("events").EventEmitter;if(!EE.listenerCount)EE.listenerCount=function(emitter,type){return emitter.listeners(type).length};var Stream=require("stream");var util=require("core-util-is");util.inherits=require("inherits");var StringDecoder;util.inherits(Readable,Stream);function ReadableState(options,stream){options=options||{};var hwm=options.highWaterMark;this.highWaterMark=hwm||hwm===0?hwm: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=!!options.objectMode;this.defaultEncoding=options.defaultEncoding||"utf8";this.ranOut=false;this.awaitDrain=0;this.readingMore=false;this.decoder=null;this.encoding=null;if(options.encoding){if(!StringDecoder)StringDecoder=require("string_decoder/").StringDecoder;this.decoder=new StringDecoder(options.encoding);this.encoding=options.encoding}}function Readable(options){if(!(this instanceof Readable))return new Readable(options);this._readableState=new ReadableState(options,this);this.readable=true;Stream.call(this)}Readable.prototype.push=function(chunk,encoding){var state=this._readableState;if(typeof chunk==="string"&&!state.objectMode){encoding=encoding||state.defaultEncoding;if(encoding!==state.encoding){chunk=new Buffer(chunk,encoding);encoding=""}}return readableAddChunk(this,state,chunk,encoding,false)};Readable.prototype.unshift=function(chunk){var state=this._readableState;return readableAddChunk(this,state,chunk,"",true)};function readableAddChunk(stream,state,chunk,encoding,addToFront){var er=chunkInvalid(state,chunk);if(er){stream.emit("error",er)}else if(chunk===null||chunk===undefined){state.reading=false;if(!state.ended)onEofChunk(stream,state)}else if(state.objectMode||chunk&&chunk.length>0){if(state.ended&&!addToFront){var e=new Error("stream.push() after EOF");stream.emit("error",e)}else if(state.endEmitted&&addToFront){var e=new Error("stream.unshift() after end event");stream.emit("error",e)}else{if(state.decoder&&!addToFront&&!encoding)chunk=state.decoder.write(chunk);state.length+=state.objectMode?1:chunk.length;if(addToFront){state.buffer.unshift(chunk)}else{state.reading=false;state.buffer.push(chunk)}if(state.needReadable)emitReadable(stream);maybeReadMore(stream,state)}}else if(!addToFront){state.reading=false}return needMoreData(state)}function needMoreData(state){return!state.ended&&(state.needReadable||state.length<state.highWaterMark||state.length===0)}Readable.prototype.setEncoding=function(enc){if(!StringDecoder)StringDecoder=require("string_decoder/").StringDecoder;this._readableState.decoder=new StringDecoder(enc);this._readableState.encoding=enc};var MAX_HWM=8388608;function roundUpToNextPowerOf2(n){if(n>=MAX_HWM){n=MAX_HWM}else{n--;for(var p=1;p<32;p<<=1)n|=n>>p;n++}return n}function howMuchToRead(n,state){if(state.length===0&&state.ended)return 0;if(state.objectMode)return n===0?0:1;if(n===null||isNaN(n)){if(state.flowing&&state.buffer.length)return state.buffer[0].length;else return state.length}if(n<=0)return 0;if(n>state.highWaterMark)state.highWaterMark=roundUpToNextPowerOf2(n);if(n>state.length){if(!state.ended){state.needReadable=true;return 0}else return state.length}return n}Readable.prototype.read=function(n){var state=this._readableState;state.calledRead=true;var nOrig=n;var ret;if(typeof n!=="number"||n>0)state.emittedReadable=false;if(n===0&&state.needReadable&&(state.length>=state.highWaterMark||state.ended)){emitReadable(this);
return null}n=howMuchToRead(n,state);if(n===0&&state.ended){ret=null;if(state.length>0&&state.decoder){ret=fromList(n,state);state.length-=ret.length}if(state.length===0)endReadable(this);return ret}var doRead=state.needReadable;if(state.length-n<=state.highWaterMark)doRead=true;if(state.ended||state.reading)doRead=false;if(doRead){state.reading=true;state.sync=true;if(state.length===0)state.needReadable=true;this._read(state.highWaterMark);state.sync=false}if(doRead&&!state.reading)n=howMuchToRead(nOrig,state);if(n>0)ret=fromList(n,state);else ret=null;if(ret===null){state.needReadable=true;n=0}state.length-=n;if(state.length===0&&!state.ended)state.needReadable=true;if(state.ended&&!state.endEmitted&&state.length===0)endReadable(this);return ret};function chunkInvalid(state,chunk){var er=null;if(!Buffer.isBuffer(chunk)&&"string"!==typeof chunk&&chunk!==null&&chunk!==undefined&&!state.objectMode){er=new TypeError("Invalid non-string/buffer chunk")}return er}function onEofChunk(stream,state){if(state.decoder&&!state.ended){var chunk=state.decoder.end();if(chunk&&chunk.length){state.buffer.push(chunk);state.length+=state.objectMode?1:chunk.length}}state.ended=true;if(state.length>0)emitReadable(stream);else endReadable(stream)}function emitReadable(stream){var state=stream._readableState;state.needReadable=false;if(state.emittedReadable)return;state.emittedReadable=true;if(state.sync)process.nextTick(function(){emitReadable_(stream)});else emitReadable_(stream)}function emitReadable_(stream){stream.emit("readable")}function maybeReadMore(stream,state){if(!state.readingMore){state.readingMore=true;process.nextTick(function(){maybeReadMore_(stream,state)})}}function maybeReadMore_(stream,state){var len=state.length;while(!state.reading&&!state.flowing&&!state.ended&&state.length<state.highWaterMark){stream.read(0);if(len===state.length)break;else len=state.length}state.readingMore=false}Readable.prototype._read=function(n){this.emit("error",new Error("not implemented"))};Readable.prototype.pipe=function(dest,pipeOpts){var src=this;var state=this._readableState;switch(state.pipesCount){case 0:state.pipes=dest;break;case 1:state.pipes=[state.pipes,dest];break;default:state.pipes.push(dest);break}state.pipesCount+=1;var doEnd=(!pipeOpts||pipeOpts.end!==false)&&dest!==process.stdout&&dest!==process.stderr;var endFn=doEnd?onend:cleanup;if(state.endEmitted)process.nextTick(endFn);else src.once("end",endFn);dest.on("unpipe",onunpipe);function onunpipe(readable){if(readable!==src)return;cleanup()}function onend(){dest.end()}var ondrain=pipeOnDrain(src);dest.on("drain",ondrain);function cleanup(){dest.removeListener("close",onclose);dest.removeListener("finish",onfinish);dest.removeListener("drain",ondrain);dest.removeListener("error",onerror);dest.removeListener("unpipe",onunpipe);src.removeListener("end",onend);src.removeListener("end",cleanup);if(!dest._writableState||dest._writableState.needDrain)ondrain()}function onerror(er){unpipe();dest.removeListener("error",onerror);if(EE.listenerCount(dest,"error")===0)dest.emit("error",er)}if(!dest._events||!dest._events.error)dest.on("error",onerror);else if(isArray(dest._events.error))dest._events.error.unshift(onerror);else dest._events.error=[onerror,dest._events.error];function onclose(){dest.removeListener("finish",onfinish);unpipe()}dest.once("close",onclose);function onfinish(){dest.removeListener("close",onclose);unpipe()}dest.once("finish",onfinish);function unpipe(){src.unpipe(dest)}dest.emit("pipe",src);if(!state.flowing){this.on("readable",pipeOnReadable);state.flowing=true;process.nextTick(function(){flow(src)})}return dest};function pipeOnDrain(src){return function(){var dest=this;var state=src._readableState;state.awaitDrain--;if(state.awaitDrain===0)flow(src)}}function flow(src){var state=src._readableState;var chunk;state.awaitDrain=0;function write(dest,i,list){var written=dest.write(chunk);if(false===written){state.awaitDrain++}}while(state.pipesCount&&null!==(chunk=src.read())){if(state.pipesCount===1)write(state.pipes,0,null);else forEach(state.pipes,write);src.emit("data",chunk);if(state.awaitDrain>0)return}if(state.pipesCount===0){state.flowing=false;if(EE.listenerCount(src,"data")>0)emitDataEvents(src);return}state.ranOut=true}function pipeOnReadable(){if(this._readableState.ranOut){this._readableState.ranOut=false;flow(this)}}Readable.prototype.unpipe=function(dest){var state=this._readableState;if(state.pipesCount===0)return this;if(state.pipesCount===1){if(dest&&dest!==state.pipes)return this;if(!dest)dest=state.pipes;state.pipes=null;state.pipesCount=0;this.removeListener("readable",pipeOnReadable);state.flowing=false;if(dest)dest.emit("unpipe",this);return this}if(!dest){var dests=state.pipes;var len=state.pipesCount;state.pipes=null;state.pipesCount=0;this.removeListener("readable",pipeOnReadable);state.flowing=false;for(var i=0;i<len;i++)dests[i].emit("unpipe",this);return this}var i=indexOf(state.pipes,dest);if(i===-1)return this;state.pipes.splice(i,1);state.pipesCount-=1;if(state.pipesCount===1)state.pipes=state.pipes[0];dest.emit("unpipe",this);return this};Readable.prototype.on=function(ev,fn){var res=Stream.prototype.on.call(this,ev,fn);if(ev==="data"&&!this._readableState.flowing)emitDataEvents(this);if(ev==="readable"&&this.readable){var state=this._readableState;if(!state.readableListening){state.readableListening=true;state.emittedReadable=false;state.needReadable=true;if(!state.reading){this.read(0)}else if(state.length){emitReadable(this,state)}}}return res};Readable.prototype.addListener=Readable.prototype.on;Readable.prototype.resume=function(){emitDataEvents(this);this.read(0);this.emit("resume")};Readable.prototype.pause=function(){emitDataEvents(this,true);this.emit("pause")};function emitDataEvents(stream,startPaused){var state=stream._readableState;if(state.flowing){throw new Error("Cannot switch to old mode now.")}var paused=startPaused||false;var readable=false;stream.readable=true;stream.pipe=Stream.prototype.pipe;stream.on=stream.addListener=Stream.prototype.on;stream.on("readable",function(){readable=true;var c;while(!paused&&null!==(c=stream.read()))stream.emit("data",c);if(c===null){readable=false;stream._readableState.needReadable=true}});stream.pause=function(){paused=true;this.emit("pause")};stream.resume=function(){paused=false;if(readable)process.nextTick(function(){stream.emit("readable")});else this.read(0);this.emit("resume")};stream.emit("readable")}Readable.prototype.wrap=function(stream){var state=this._readableState;var paused=false;var self=this;stream.on("end",function(){if(state.decoder&&!state.ended){var chunk=state.decoder.end();if(chunk&&chunk.length)self.push(chunk)}self.push(null)});stream.on("data",function(chunk){if(state.decoder)chunk=state.decoder.write(chunk);if(state.objectMode&&(chunk===null||chunk===undefined))return;else if(!state.objectMode&&(!chunk||!chunk.length))return;var ret=self.push(chunk);if(!ret){paused=true;stream.pause()}});for(var i in stream){if(typeof stream[i]==="function"&&typeof this[i]==="undefined"){this[i]=function(method){return function(){return stream[method].apply(stream,arguments)}}(i)}}var events=["error","close","destroy","pause","resume"];forEach(events,function(ev){stream.on(ev,self.emit.bind(self,ev))});self._read=function(n){if(paused){paused=false;stream.resume()}};return self};Readable._fromList=fromList;function fromList(n,state){var list=state.buffer;var length=state.length;var stringMode=!!state.decoder;var objectMode=!!state.objectMode;var ret;if(list.length===0)return null;if(length===0)ret=null;else if(objectMode)ret=list.shift();else if(!n||n>=length){if(stringMode)ret=list.join("");else ret=Buffer.concat(list,length);list.length=0}else{if(n<list[0].length){var buf=list[0];ret=buf.slice(0,n);list[0]=buf.slice(n)}else if(n===list[0].length){ret=list.shift()}else{if(stringMode)ret="";else ret=new Buffer(n);var c=0;for(var i=0,l=list.length;i<l&&c<n;i++){var buf=list[0];var cpy=Math.min(n-c,buf.length);if(stringMode)ret+=buf.slice(0,cpy);else buf.copy(ret,c,0,cpy);if(cpy<buf.length)list[0]=buf.slice(cpy);else list.shift();c+=cpy}}}return ret}function endReadable(stream){var state=stream._readableState;if(state.length>0)throw new Error("endReadable called on non-empty stream");if(!state.endEmitted&&state.calledRead){state.ended=true;process.nextTick(function(){if(!state.endEmitted&&state.length===0){state.endEmitted=true;stream.readable=false;stream.emit("end")}})}}function forEach(xs,f){for(var i=0,l=xs.length;i<l;i++){f(xs[i],i)}}function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++){if(xs[i]===x)return i}return-1}}).call(this,require("_process"))},{_process:104,buffer:96,"core-util-is":111,events:100,inherits:101,isarray:102,stream:116,"string_decoder/":117}],109:[function(require,module,exports){module.exports=Transform;var Duplex=require("./_stream_duplex");var util=require("core-util-is");util.inherits=require("inherits");util.inherits(Transform,Duplex);function TransformState(options,stream){this.afterTransform=function(er,data){return afterTransform(stream,er,data)};this.needTransform=false;this.transforming=false;this.writecb=null;this.writechunk=null}function afterTransform(stream,er,data){var ts=stream._transformState;ts.transforming=false;var cb=ts.writecb;if(!cb)return stream.emit("error",new Error("no writecb in Transform class"));ts.writechunk=null;ts.writecb=null;if(data!==null&&data!==undefined)stream.push(data);if(cb)cb(er);var rs=stream._readableState;rs.reading=false;if(rs.needReadable||rs.length<rs.highWaterMark){stream._read(rs.highWaterMark)}}function Transform(options){if(!(this instanceof Transform))return new Transform(options);Duplex.call(this,options);var ts=this._transformState=new TransformState(options,this);var stream=this;this._readableState.needReadable=true;this._readableState.sync=false;this.once("finish",function(){if("function"===typeof this._flush)this._flush(function(er){done(stream,er)});else done(stream)})}Transform.prototype.push=function(chunk,encoding){this._transformState.needTransform=false;return Duplex.prototype.push.call(this,chunk,encoding)};Transform.prototype._transform=function(chunk,encoding,cb){throw new Error("not implemented")};Transform.prototype._write=function(chunk,encoding,cb){var ts=this._transformState;ts.writecb=cb;ts.writechunk=chunk;ts.writeencoding=encoding;if(!ts.transforming){var rs=this._readableState;if(ts.needTransform||rs.needReadable||rs.length<rs.highWaterMark)this._read(rs.highWaterMark)}};Transform.prototype._read=function(n){var ts=this._transformState;if(ts.writechunk!==null&&ts.writecb&&!ts.transforming){ts.transforming=true;this._transform(ts.writechunk,ts.writeencoding,ts.afterTransform)}else{ts.needTransform=true}};function done(stream,er){if(er)return stream.emit("error",er);var ws=stream._writableState;var rs=stream._readableState;var ts=stream._transformState;if(ws.length)throw new Error("calling transform done when ws.length != 0");if(ts.transforming)throw new Error("calling transform done when still transforming");return stream.push(null)}},{"./_stream_duplex":106,"core-util-is":111,inherits:101}],110:[function(require,module,exports){(function(process){module.exports=Writable;var Buffer=require("buffer").Buffer;Writable.WritableState=WritableState;var util=require("core-util-is");util.inherits=require("inherits");var Stream=require("stream");util.inherits(Writable,Stream);function WriteReq(chunk,encoding,cb){this.chunk=chunk;this.encoding=encoding;this.callback=cb}function WritableState(options,stream){options=options||{};var hwm=options.highWaterMark;this.highWaterMark=hwm||hwm===0?hwm:16*1024;this.objectMode=!!options.objectMode;this.highWaterMark=~~this.highWaterMark;this.needDrain=false;this.ending=false;this.ended=false;this.finished=false;var noDecode=options.decodeStrings===false;this.decodeStrings=!noDecode;this.defaultEncoding=options.defaultEncoding||"utf8";this.length=0;this.writing=false;this.sync=true;this.bufferProcessing=false;this.onwrite=function(er){onwrite(stream,er)};this.writecb=null;this.writelen=0;this.buffer=[];this.errorEmitted=false}function Writable(options){var Duplex=require("./_stream_duplex");if(!(this instanceof Writable)&&!(this instanceof Duplex))return new Writable(options);this._writableState=new WritableState(options,this);this.writable=true;Stream.call(this)}Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))};function writeAfterEnd(stream,state,cb){var er=new Error("write after end");stream.emit("error",er);process.nextTick(function(){cb(er)})}function validChunk(stream,state,chunk,cb){var valid=true;if(!Buffer.isBuffer(chunk)&&"string"!==typeof chunk&&chunk!==null&&chunk!==undefined&&!state.objectMode){var er=new TypeError("Invalid non-string/buffer chunk");stream.emit("error",er);process.nextTick(function(){cb(er)});valid=false}return valid}Writable.prototype.write=function(chunk,encoding,cb){var state=this._writableState;var ret=false;if(typeof encoding==="function"){cb=encoding;encoding=null}if(Buffer.isBuffer(chunk))encoding="buffer";else if(!encoding)encoding=state.defaultEncoding;if(typeof cb!=="function")cb=function(){};if(state.ended)writeAfterEnd(this,state,cb);else if(validChunk(this,state,chunk,cb))ret=writeOrBuffer(this,state,chunk,encoding,cb);return ret};function decodeChunk(state,chunk,encoding){if(!state.objectMode&&state.decodeStrings!==false&&typeof chunk==="string"){chunk=new Buffer(chunk,encoding)}return chunk}function writeOrBuffer(stream,state,chunk,encoding,cb){chunk=decodeChunk(state,chunk,encoding);if(Buffer.isBuffer(chunk))encoding="buffer";var len=state.objectMode?1:chunk.length;state.length+=len;var ret=state.length<state.highWaterMark;if(!ret)state.needDrain=true;if(state.writing)state.buffer.push(new WriteReq(chunk,encoding,cb));else doWrite(stream,state,len,chunk,encoding,cb);return ret}function doWrite(stream,state,len,chunk,encoding,cb){state.writelen=len;state.writecb=cb;state.writing=true;state.sync=true;stream._write(chunk,encoding,state.onwrite);state.sync=false}function onwriteError(stream,state,sync,er,cb){if(sync)process.nextTick(function(){cb(er)});else cb(er);stream._writableState.errorEmitted=true;stream.emit("error",er)}function onwriteStateUpdate(state){state.writing=false;state.writecb=null;state.length-=state.writelen;state.writelen=0}function onwrite(stream,er){var state=stream._writableState;var sync=state.sync;var cb=state.writecb;onwriteStateUpdate(state);if(er)onwriteError(stream,state,sync,er,cb);else{var finished=needFinish(stream,state);if(!finished&&!state.bufferProcessing&&state.buffer.length)clearBuffer(stream,state);if(sync){process.nextTick(function(){afterWrite(stream,state,finished,cb)})}else{afterWrite(stream,state,finished,cb)}}}function afterWrite(stream,state,finished,cb){if(!finished)onwriteDrain(stream,state);cb();if(finished)finishMaybe(stream,state)}function onwriteDrain(stream,state){if(state.length===0&&state.needDrain){state.needDrain=false;stream.emit("drain")}}function clearBuffer(stream,state){state.bufferProcessing=true;for(var c=0;c<state.buffer.length;c++){var entry=state.buffer[c];var chunk=entry.chunk;var encoding=entry.encoding;var cb=entry.callback;var len=state.objectMode?1:chunk.length;doWrite(stream,state,len,chunk,encoding,cb);if(state.writing){c++;break}}state.bufferProcessing=false;if(c<state.buffer.length)state.buffer=state.buffer.slice(c);else state.buffer.length=0}Writable.prototype._write=function(chunk,encoding,cb){cb(new Error("not implemented"))};Writable.prototype.end=function(chunk,encoding,cb){var state=this._writableState;if(typeof chunk==="function"){cb=chunk;chunk=null;encoding=null}else if(typeof encoding==="function"){cb=encoding;encoding=null}if(typeof chunk!=="undefined"&&chunk!==null)this.write(chunk,encoding);if(!state.ending&&!state.finished)endWritable(this,state,cb)};function needFinish(stream,state){return state.ending&&state.length===0&&!state.finished&&!state.writing}function finishMaybe(stream,state){var need=needFinish(stream,state);if(need){state.finished=true;stream.emit("finish")}return need}function endWritable(stream,state,cb){state.ending=true;finishMaybe(stream,state);if(cb){if(state.finished)process.nextTick(cb);else stream.once("finish",cb)}state.ended=true}}).call(this,require("_process"))},{"./_stream_duplex":106,_process:104,buffer:96,"core-util-is":111,inherits:101,stream:116}],111:[function(require,module,exports){(function(Buffer){function isArray(ar){return Array.isArray(ar)}exports.isArray=isArray;function isBoolean(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean;function isNull(arg){return arg===null}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==="number"}exports.isNumber=isNumber;function isString(arg){return typeof arg==="string"}exports.isString=isString;function isSymbol(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0}exports.isUndefined=isUndefined;function isRegExp(re){return isObject(re)&&objectToString(re)==="[object RegExp]"}exports.isRegExp=isRegExp;function isObject(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject;function isDate(d){return isObject(d)&&objectToString(d)==="[object Date]"}exports.isDate=isDate;function isError(e){return isObject(e)&&(objectToString(e)==="[object Error]"||e instanceof Error)}exports.isError=isError;function isFunction(arg){return typeof arg==="function"}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg==="undefined"}exports.isPrimitive=isPrimitive;function isBuffer(arg){return Buffer.isBuffer(arg)}exports.isBuffer=isBuffer;function objectToString(o){return Object.prototype.toString.call(o)}}).call(this,require("buffer").Buffer)},{buffer:96}],112:[function(require,module,exports){module.exports=require("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":107}],113:[function(require,module,exports){var Stream=require("stream");exports=module.exports=require("./lib/_stream_readable.js");exports.Stream=Stream;exports.Readable=exports;exports.Writable=require("./lib/_stream_writable.js");exports.Duplex=require("./lib/_stream_duplex.js");exports.Transform=require("./lib/_stream_transform.js");exports.PassThrough=require("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":106,"./lib/_stream_passthrough.js":107,"./lib/_stream_readable.js":108,"./lib/_stream_transform.js":109,"./lib/_stream_writable.js":110,stream:116}],114:[function(require,module,exports){module.exports=require("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":109}],115:[function(require,module,exports){module.exports=require("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":110}],116:[function(require,module,exports){module.exports=Stream;var EE=require("events").EventEmitter;var inherits=require("inherits");inherits(Stream,EE);Stream.Readable=require("readable-stream/readable.js");Stream.Writable=require("readable-stream/writable.js");Stream.Duplex=require("readable-stream/duplex.js");Stream.Transform=require("readable-stream/transform.js");Stream.PassThrough=require("readable-stream/passthrough.js");Stream.Stream=Stream;function Stream(){EE.call(this)}Stream.prototype.pipe=function(dest,options){var source=this;function ondata(chunk){if(dest.writable){if(false===dest.write(chunk)&&source.pause){source.pause()}}}source.on("data",ondata);function ondrain(){if(source.readable&&source.resume){source.resume()}}dest.on("drain",ondrain);if(!dest._isStdio&&(!options||options.end!==false)){source.on("end",onend);source.on("close",onclose)}var didOnEnd=false;function onend(){if(didOnEnd)return;didOnEnd=true;dest.end()}function onclose(){if(didOnEnd)return;didOnEnd=true;if(typeof dest.destroy==="function")dest.destroy()}function onerror(er){cleanup();if(EE.listenerCount(this,"error")===0){throw er}}source.on("error",onerror);dest.on("error",onerror);function cleanup(){source.removeListener("data",ondata);dest.removeListener("drain",ondrain);source.removeListener("end",onend);source.removeListener("close",onclose);source.removeListener("error",onerror);dest.removeListener("error",onerror);source.removeListener("end",cleanup);source.removeListener("close",cleanup);dest.removeListener("close",cleanup)}source.on("end",cleanup);source.on("close",cleanup);dest.on("close",cleanup);dest.emit("pipe",source);return dest}},{events:100,inherits:101,"readable-stream/duplex.js":105,"readable-stream/passthrough.js":112,"readable-stream/readable.js":113,"readable-stream/transform.js":114,"readable-stream/writable.js":115}],117:[function(require,module,exports){var Buffer=require("buffer").Buffer;var isBufferEncoding=Buffer.isEncoding||function(encoding){switch(encoding&&encoding.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 assertEncoding(encoding){if(encoding&&!isBufferEncoding(encoding)){throw new Error("Unknown encoding: "+encoding)}}var StringDecoder=exports.StringDecoder=function(encoding){this.encoding=(encoding||"utf8").toLowerCase().replace(/[-_]/,"");assertEncoding(encoding);switch(this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2;this.detectIncompleteChar=utf16DetectIncompleteChar;break;case"base64":this.surrogateSize=3;this.detectIncompleteChar=base64DetectIncompleteChar;break;default:this.write=passThroughWrite;return}this.charBuffer=new Buffer(6);this.charReceived=0;this.charLength=0};StringDecoder.prototype.write=function(buffer){var charStr="";while(this.charLength){var available=buffer.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:buffer.length;buffer.copy(this.charBuffer,this.charReceived,0,available);this.charReceived+=available;if(this.charReceived<this.charLength){return""}buffer=buffer.slice(available,buffer.length);charStr=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var charCode=charStr.charCodeAt(charStr.length-1);if(charCode>=55296&&charCode<=56319){this.charLength+=this.surrogateSize;charStr="";continue}this.charReceived=this.charLength=0;if(buffer.length===0){return charStr}break}this.detectIncompleteChar(buffer);var end=buffer.length;if(this.charLength){buffer.copy(this.charBuffer,0,buffer.length-this.charReceived,end);end-=this.charReceived}charStr+=buffer.toString(this.encoding,0,end);var end=charStr.length-1;var charCode=charStr.charCodeAt(end);if(charCode>=55296&&charCode<=56319){var size=this.surrogateSize;this.charLength+=size;this.charReceived+=size;this.charBuffer.copy(this.charBuffer,size,0,size);buffer.copy(this.charBuffer,0,0,size);return charStr.substring(0,end)}return charStr};StringDecoder.prototype.detectIncompleteChar=function(buffer){var i=buffer.length>=3?3:buffer.length;for(;i>0;i--){var c=buffer[buffer.length-i];if(i==1&&c>>5==6){this.charLength=2;break}if(i<=2&&c>>4==14){this.charLength=3;break}if(i<=3&&c>>3==30){this.charLength=4;break}}this.charReceived=i};StringDecoder.prototype.end=function(buffer){var res="";if(buffer&&buffer.length)res=this.write(buffer);if(this.charReceived){var cr=this.charReceived;var buf=this.charBuffer;var enc=this.encoding;res+=buf.slice(0,cr).toString(enc)}return res};function passThroughWrite(buffer){return buffer.toString(this.encoding)}function utf16DetectIncompleteChar(buffer){this.charReceived=buffer.length%2;this.charLength=this.charReceived?2:0}function base64DetectIncompleteChar(buffer){this.charReceived=buffer.length%3;this.charLength=this.charReceived?3:0}},{buffer:96}],118:[function(require,module,exports){module.exports=function isBuffer(arg){return arg&&typeof arg==="object"&&typeof arg.copy==="function"&&typeof arg.fill==="function"&&typeof arg.readUInt8==="function"}},{}],119:[function(require,module,exports){(function(process,global){var formatRegExp=/%[sdj%]/g;exports.format=function(f){if(!isString(f)){var objects=[];for(var i=0;i<arguments.length;i++){objects.push(inspect(arguments[i]))}return objects.join(" ")}var i=1;var args=arguments;var len=args.length;var str=String(f).replace(formatRegExp,function(x){if(x==="%%")return"%";if(i>=len)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":try{return JSON.stringify(args[i++])}catch(_){return"[Circular]"}default:return x}});for(var x=args[i];i<len;x=args[++i]){if(isNull(x)||!isObject(x)){str+=" "+x}else{str+=" "+inspect(x)}}return str};exports.deprecate=function(fn,msg){if(isUndefined(global.process)){return function(){return exports.deprecate(fn,msg).apply(this,arguments)}}if(process.noDeprecation===true){return fn}var warned=false;function deprecated(){if(!warned){if(process.throwDeprecation){throw new Error(msg)}else if(process.traceDeprecation){console.trace(msg)}else{console.error(msg)}warned=true}return fn.apply(this,arguments)}return deprecated};var debugs={};var debugEnviron;exports.debuglog=function(set){if(isUndefined(debugEnviron))debugEnviron=process.env.NODE_DEBUG||"";set=set.toUpperCase();if(!debugs[set]){if(new RegExp("\\b"+set+"\\b","i").test(debugEnviron)){var pid=process.pid;debugs[set]=function(){var msg=exports.format.apply(exports,arguments);console.error("%s %d: %s",set,pid,msg)}}else{debugs[set]=function(){}}}return debugs[set]};function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};if(arguments.length>=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean(opts)){ctx.showHidden=opts}else if(opts){exports._extend(ctx,opts)}if(isUndefined(ctx.showHidden))ctx.showHidden=false;if(isUndefined(ctx.depth))ctx.depth=2;if(isUndefined(ctx.colors))ctx.colors=false;if(isUndefined(ctx.customInspect))ctx.customInspect=true;if(ctx.colors)ctx.stylize=stylizeWithColor;return formatValue(ctx,obj,ctx.depth)}exports.inspect=inspect;inspect.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]};inspect.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"};function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style){return"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m"}else{return str}}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};array.forEach(function(val,idx){hash[val]=true});return hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString(ret)){ret=formatValue(ctx,ret,recurseTimes)}return ret}var primitive=formatPrimitive(ctx,value);if(primitive){return primitive}var keys=Object.keys(value);var visibleKeys=arrayToHash(keys);if(ctx.showHidden){keys=Object.getOwnPropertyNames(value)}if(isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0)){return formatError(value)}if(keys.length===0){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}if(isDate(value)){return ctx.stylize(Date.prototype.toString.call(value),"date")}if(isError(value)){return formatError(value)}}var base="",array=false,braces=["{","}"];if(isArray(value)){array=true;braces=["[","]"]}if(isFunction(value)){var n=value.name?": "+value.name:"";base=" [Function"+n+"]"}if(isRegExp(value)){base=" "+RegExp.prototype.toString.call(value)}if(isDate(value)){base=" "+Date.prototype.toUTCString.call(value)}if(isError(value)){base=" "+formatError(value)}if(keys.length===0&&(!array||value.length==0)){return braces[0]+base+braces[1]}if(recurseTimes<0){if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}else{return ctx.stylize("[Object]","special")}}ctx.seen.push(value);var output;if(array){output=formatArray(ctx,value,recurseTimes,visibleKeys,keys)}else{output=keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)})}ctx.seen.pop();return reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}if(isNumber(value))return ctx.stylize(""+value,"number");if(isBoolean(value))return ctx.stylize(""+value,"boolean");if(isNull(value))return ctx.stylize("null","null")}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i=0,l=value.length;i<l;++i){if(hasOwnProperty(value,String(i))){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i),true))}else{output.push("")}}keys.forEach(function(key){if(!key.match(/^\d+$/)){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,true))}});return output}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]};if(desc.get){if(desc.set){str=ctx.stylize("[Getter/Setter]","special")}else{str=ctx.stylize("[Getter]","special")}}else{if(desc.set){str=ctx.stylize("[Setter]","special")}}if(!hasOwnProperty(visibleKeys,key)){name="["+key+"]"}if(!str){if(ctx.seen.indexOf(desc.value)<0){if(isNull(recurseTimes)){str=formatValue(ctx,desc.value,null)}else{str=formatValue(ctx,desc.value,recurseTimes-1)}if(str.indexOf("\n")>-1){if(array){str=str.split("\n").map(function(line){return" "+line}).join("\n").substr(2)}else{str="\n"+str.split("\n").map(function(line){return" "+line}).join("\n")}}}else{str=ctx.stylize("[Circular]","special")}}if(isUndefined(name)){if(array&&key.match(/^\d+$/)){return str}name=JSON.stringify(""+key);if(name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){name=name.substr(1,name.length-2);name=ctx.stylize(name,"name")}else{name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");name=ctx.stylize(name,"string")}}return name+": "+str}function reduceToSingleString(output,base,braces){var numLinesEst=0;var length=output.reduce(function(prev,cur){numLinesEst++;if(cur.indexOf("\n")>=0)numLinesEst++;return prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(length>60){return braces[0]+(base===""?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1]}return braces[0]+base+" "+output.join(", ")+" "+braces[1]}function isArray(ar){return Array.isArray(ar)}exports.isArray=isArray;function isBoolean(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean;function isNull(arg){return arg===null}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==="number"}exports.isNumber=isNumber;function isString(arg){return typeof arg==="string"}exports.isString=isString;function isSymbol(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0}exports.isUndefined=isUndefined;function isRegExp(re){return isObject(re)&&objectToString(re)==="[object RegExp]"}exports.isRegExp=isRegExp;function isObject(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject;function isDate(d){return isObject(d)&&objectToString(d)==="[object Date]"}exports.isDate=isDate;function isError(e){return isObject(e)&&(objectToString(e)==="[object Error]"||e instanceof Error)}exports.isError=isError;
function isFunction(arg){return typeof arg==="function"}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg==="undefined"}exports.isPrimitive=isPrimitive;exports.isBuffer=require("./support/isBuffer");function objectToString(o){return Object.prototype.toString.call(o)}function pad(n){return n<10?"0"+n.toString(10):n.toString(10)}var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp(){var d=new Date;var time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(":");return[d.getDate(),months[d.getMonth()],time].join(" ")}exports.log=function(){console.log("%s - %s",timestamp(),exports.format.apply(exports,arguments))};exports.inherits=require("inherits");exports._extend=function(origin,add){if(!add||!isObject(add))return origin;var keys=Object.keys(add);var i=keys.length;while(i--){origin[keys[i]]=add[keys[i]]}return origin};function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./support/isBuffer":118,_process:104,inherits:101}],120:[function(require,module,exports){!function(returnThis,framework,undefined){"use strict";var global=returnThis(),OBJECT="Object",FUNCTION="Function",ARRAY="Array",STRING="String",NUMBER="Number",REGEXP="RegExp",DATE="Date",MAP="Map",SET="Set",WEAKMAP="WeakMap",WEAKSET="WeakSet",SYMBOL="Symbol",PROMISE="Promise",MATH="Math",ARGUMENTS="Arguments",PROTOTYPE="prototype",CONSTRUCTOR="constructor",TO_STRING="toString",TO_STRING_TAG=TO_STRING+"Tag",TO_LOCALE="toLocaleString",HAS_OWN="hasOwnProperty",FOR_EACH="forEach",ITERATOR="iterator",FF_ITERATOR="@@"+ITERATOR,PROCESS="process",CREATE_ELEMENT="createElement",Function=global[FUNCTION],Object=global[OBJECT],Array=global[ARRAY],String=global[STRING],Number=global[NUMBER],RegExp=global[REGEXP],Date=global[DATE],Map=global[MAP],Set=global[SET],WeakMap=global[WEAKMAP],WeakSet=global[WEAKSET],Symbol=global[SYMBOL],Math=global[MATH],TypeError=global.TypeError,setTimeout=global.setTimeout,setImmediate=global.setImmediate,clearImmediate=global.clearImmediate,process=global[PROCESS],nextTick=process&&process.nextTick,document=global.document,html=document&&document.documentElement,navigator=global.navigator,define=global.define,ArrayProto=Array[PROTOTYPE],ObjectProto=Object[PROTOTYPE],FunctionProto=Function[PROTOTYPE],Infinity=1/0,DOT=".";function isObject(it){return it!=null&&(typeof it=="object"||typeof it=="function")}function isFunction(it){return typeof it=="function"}var isNative=ctx(/./.test,/\[native code\]\s*\}\s*$/,1);var buildIn={Undefined:1,Null:1,Array:1,String:1,Arguments:1,Function:1,Error:1,Boolean:1,Number:1,Date:1,RegExp:1},toString=ObjectProto[TO_STRING];function setToStringTag(it,tag,stat){if(it)has(it=stat?it:it[PROTOTYPE],SYMBOL_TAG)||hidden(it,SYMBOL_TAG,tag)}function cof(it){return it==undefined?it===undefined?"Undefined":"Null":toString.call(it).slice(8,-1)}function classof(it){var klass=cof(it),tag;return klass==OBJECT&&(tag=it[SYMBOL_TAG])?has(buildIn,tag)?"~"+tag:tag:klass}var call=FunctionProto.call,REFERENCE_GET;function part(){var length=arguments.length,args=Array(length),i=0,_=path._,holder=false;while(length>i)if((args[i]=arguments[i++])===_)holder=true;return partial(this,args,length,holder,_,false)}function partial(fn,argsPart,lengthPart,holder,_,bind,context){assertFunction(fn);return function(){var that=bind?context:this,length=arguments.length,i=0,j=0,args;if(!holder&&!length)return invoke(fn,argsPart,that);args=argsPart.slice();if(holder)for(;lengthPart>i;i++)if(args[i]===_)args[i]=arguments[j++];while(length>j)args.push(arguments[j++]);return invoke(fn,args,that)}}function ctx(fn,that,length){assertFunction(fn);if(~length&&that===undefined)return fn;switch(length){case 1:return function(a){return fn.call(that,a)};case 2:return function(a,b){return fn.call(that,a,b)};case 3:return function(a,b,c){return fn.call(that,a,b,c)}}return function(){return fn.apply(that,arguments)}}function invoke(fn,args,that){var un=that===undefined;switch(args.length|0){case 0:return un?fn():fn.call(that);case 1:return un?fn(args[0]):fn.call(that,args[0]);case 2:return un?fn(args[0],args[1]):fn.call(that,args[0],args[1]);case 3:return un?fn(args[0],args[1],args[2]):fn.call(that,args[0],args[1],args[2]);case 4:return un?fn(args[0],args[1],args[2],args[3]):fn.call(that,args[0],args[1],args[2],args[3]);case 5:return un?fn(args[0],args[1],args[2],args[3],args[4]):fn.call(that,args[0],args[1],args[2],args[3],args[4])}return fn.apply(that,args)}var create=Object.create,getPrototypeOf=Object.getPrototypeOf,defineProperty=Object.defineProperty,defineProperties=Object.defineProperties,getOwnDescriptor=Object.getOwnPropertyDescriptor,getKeys=Object.keys,getNames=Object.getOwnPropertyNames,getSymbols=Object.getOwnPropertySymbols,has=ctx(call,ObjectProto[HAS_OWN],2),ES5Object=Object;function get(object,key){if(has(object,key))return object[key]}function ownKeys(it){return getSymbols?getNames(it).concat(getSymbols(it)):getNames(it)}var assign=Object.assign||function(target,source){var T=Object(assertDefined(target)),l=arguments.length,i=1;while(l>i){var S=ES5Object(arguments[i++]),keys=getKeys(S),length=keys.length,j=0,key;while(length>j)T[key=keys[j++]]=S[key]}return T};function keyOf(object,el){var O=ES5Object(object),keys=getKeys(O),length=keys.length,index=0,key;while(length>index)if(O[key=keys[index++]]===el)return key}function array(it){return String(it).split(",")}var push=ArrayProto.push,unshift=ArrayProto.unshift,slice=ArrayProto.slice,splice=ArrayProto.splice,indexOf=ArrayProto.indexOf,forEach=ArrayProto[FOR_EACH];function createArrayMethod(type){var isMap=type==1,isFilter=type==2,isSome=type==3,isEvery=type==4,isFindIndex=type==6,noholes=type==5||isFindIndex;return function(callbackfn,that){var O=Object(assertDefined(this)),self=ES5Object(O),f=ctx(callbackfn,that,3),length=toLength(self.length),index=0,result=isMap?Array(length):isFilter?[]:undefined,val,res;for(;length>index;index++)if(noholes||index in self){val=self[index];res=f(val,index,O);if(type){if(isMap)result[index]=res;else if(res)switch(type){case 3:return true;case 5:return val;case 6:return index;case 2:result.push(val)}else if(isEvery)return false}}return isFindIndex?-1:isSome||isEvery?isEvery:result}}function createArrayContains(isContains){return function(el,fromIndex){var O=ES5Object(assertDefined(this)),length=toLength(O.length),index=toIndex(fromIndex,length);if(isContains&&el!=el){for(;length>index;index++)if(sameNaN(O[index]))return isContains||index}else for(;length>index;index++)if(isContains||index in O){if(O[index]===el)return isContains||index}return!isContains&&-1}}function turn(mapfn,target){assertFunction(mapfn);var memo=target==undefined?[]:Object(target),O=ES5Object(this),length=toLength(O.length),index=0;for(;length>index;index++){if(mapfn(memo,O[index],index,this)===false)break}return memo}function generic(A,B){return typeof A=="function"?A:B}var MAX_SAFE_INTEGER=9007199254740991,ceil=Math.ceil,floor=Math.floor,max=Math.max,min=Math.min,random=Math.random,trunc=Math.trunc||function(it){return(it>0?floor:ceil)(it)};function sameNaN(number){return number!=number}function toInteger(it){return isNaN(it)?0:trunc(it)}function toLength(it){return it>0?min(toInteger(it),MAX_SAFE_INTEGER):0}function toIndex(index,length){var index=toInteger(index);return index<0?max(index+length,0):min(index,length)}function createReplacer(regExp,replace,isStatic){var replacer=isObject(replace)?function(part){return replace[part]}:replace;return function(it){return String(isStatic?it:this).replace(regExp,replacer)}}function createPointAt(toString){return function(pos){var s=String(assertDefined(this)),i=toInteger(pos),l=s.length,a,b;if(i<0||i>=l)return toString?"":undefined;a=s.charCodeAt(i);return a<55296||a>56319||i+1===l||(b=s.charCodeAt(i+1))<56320||b>57343?toString?s.charAt(i):a:toString?s.slice(i,i+2):(a-55296<<10)+(b-56320)+65536}}var REDUCE_ERROR="Reduce of empty object with no initial value";function assert(condition,msg1,msg2){if(!condition)throw TypeError(msg2?msg1+msg2:msg1)}function assertDefined(it){if(it==undefined)throw TypeError("Function called on null or undefined");return it}function assertFunction(it){assert(isFunction(it),it," is not a function!");return it}function assertObject(it){assert(isObject(it),it," is not an object!");return it}function assertInstance(it,Constructor,name){assert(it instanceof Constructor,name,": use the 'new' operator!")}function descriptor(bitmap,value){return{enumerable:!(bitmap&1),configurable:!(bitmap&2),writable:!(bitmap&4),value:value}}function simpleSet(object,key,value){object[key]=value;return object}function createDefiner(bitmap){return DESC?function(object,key,value){return defineProperty(object,key,descriptor(bitmap,value))}:simpleSet}function uid(key){return SYMBOL+"("+key+")_"+(++sid+random())[TO_STRING](36)}function getWellKnownSymbol(name,setter){return Symbol&&Symbol[name]||(setter?Symbol:safeSymbol)(SYMBOL+DOT+name)}var DESC=!!function(){try{return defineProperty({},0,ObjectProto)}catch(e){}}(),sid=0,hidden=createDefiner(1),set=Symbol?simpleSet:hidden,safeSymbol=Symbol||uid;function assignHidden(target,src){for(var key in src)hidden(target,key,src[key]);return target}var SYMBOL_ITERATOR=getWellKnownSymbol(ITERATOR),SYMBOL_TAG=getWellKnownSymbol(TO_STRING_TAG),SUPPORT_FF_ITER=FF_ITERATOR in ArrayProto,ITER=safeSymbol("iter"),KEY=1,VALUE=2,Iterators={},IteratorPrototype={},NATIVE_ITERATORS=SYMBOL_ITERATOR in ArrayProto,BUGGY_ITERATORS="keys"in ArrayProto&&!("next"in[].keys());setIterator(IteratorPrototype,returnThis);function setIterator(O,value){hidden(O,SYMBOL_ITERATOR,value);SUPPORT_FF_ITER&&hidden(O,FF_ITERATOR,value)}function createIterator(Constructor,NAME,next,proto){Constructor[PROTOTYPE]=create(proto||IteratorPrototype,{next:descriptor(1,next)});setToStringTag(Constructor,NAME+" Iterator")}function defineIterator(Constructor,NAME,value,DEFAULT){var proto=Constructor[PROTOTYPE],iter=get(proto,SYMBOL_ITERATOR)||get(proto,FF_ITERATOR)||DEFAULT&&get(proto,DEFAULT)||value;if(framework){setIterator(proto,iter);if(iter!==value){var iterProto=getPrototypeOf(iter.call(new Constructor));setToStringTag(iterProto,NAME+" Iterator",true);has(proto,FF_ITERATOR)&&setIterator(iterProto,returnThis)}}Iterators[NAME]=iter;Iterators[NAME+" Iterator"]=returnThis}function defineStdIterators(Base,NAME,Constructor,next,DEFAULT){function createIter(kind){return function(){return new Constructor(this,kind)}}createIterator(Constructor,NAME,next);defineIterator(Base,NAME,createIter(DEFAULT),DEFAULT==VALUE?"values":"entries");DEFAULT&&$define(PROTO+FORCED*BUGGY_ITERATORS,NAME,{entries:createIter(KEY+VALUE),keys:createIter(KEY),values:createIter(VALUE)})}function iterResult(done,value){return{value:value,done:!!done}}function isIterable(it){var O=Object(it);return SYMBOL_ITERATOR in O||has(Iterators,classof(O))}function getIterator(it){return assertObject((it[SYMBOL_ITERATOR]||Iterators[classof(it)]).call(it))}function stepCall(fn,value,entries){return entries?invoke(fn,value):fn(value)}function forOf(iterable,entries,fn,that){var iterator=getIterator(iterable),f=ctx(fn,that,entries?2:1),step;while(!(step=iterator.next()).done)if(stepCall(f,step.value,entries)===false)return}var NODE=cof(process)==PROCESS,core={},path=framework?global:core,old=global.core,FORCED=1,GLOBAL=2,STATIC=4,PROTO=8,BIND=16,WRAP=32;function $define(type,name,source){var key,own,out,exp,isGlobal=type&GLOBAL,target=isGlobal?global:type&STATIC?global[name]:(global[name]||ObjectProto)[PROTOTYPE],exports=isGlobal?core:core[name]||(core[name]={});if(isGlobal)source=name;for(key in source){own=!(type&FORCED)&&target&&key in target&&(!isFunction(target[key])||isNative(target[key]));out=(own?target:source)[key];if(type&BIND&&own)exp=ctx(out,global);else if(type&WRAP&&!framework&&target[key]==out){exp=function(param){return this instanceof out?new out(param):out(param)};exp[PROTOTYPE]=out[PROTOTYPE]}else exp=type&PROTO&&isFunction(out)?ctx(call,out):out;if(exports[key]!=out)hidden(exports,key,exp);if(framework&&target&&!own){if(isGlobal)target[key]=out;else delete target[key]&&hidden(target,key,out)}}}if(NODE)module.exports=core;if(isFunction(define)&&define.amd)define(function(){return core});if(!NODE||framework){core.noConflict=function(){global.core=old;return core};global.core=core}$define(GLOBAL+FORCED,{global:global});!function(TAG,SymbolRegistry,setter){if(!isNative(Symbol)){Symbol=function(description){assert(!(this instanceof Symbol),SYMBOL+" is not a "+CONSTRUCTOR);var tag=uid(description);setter&&defineProperty(ObjectProto,tag,{configurable:true,set:function(value){hidden(this,tag,value)}});return set(create(Symbol[PROTOTYPE]),TAG,tag)};hidden(Symbol[PROTOTYPE],TO_STRING,function(){return this[TAG]})}$define(GLOBAL+WRAP,{Symbol:Symbol});var symbolStatics={"for":function(key){return has(SymbolRegistry,key+="")?SymbolRegistry[key]:SymbolRegistry[key]=Symbol(key)},iterator:SYMBOL_ITERATOR,keyFor:part.call(keyOf,SymbolRegistry),toStringTag:SYMBOL_TAG=getWellKnownSymbol(TO_STRING_TAG,true),pure:safeSymbol,set:set,useSetter:function(){setter=true},useSimple:function(){setter=false}};forEach.call(array("hasInstance,isConcatSpreadable,match,replace,search,"+"species,split,toPrimitive,unscopables"),function(it){symbolStatics[it]=getWellKnownSymbol(it)});$define(STATIC,SYMBOL,symbolStatics);setToStringTag(Symbol,SYMBOL);$define(GLOBAL,{Reflect:{ownKeys:ownKeys}})}(safeSymbol("tag"),{},true);!function(isFinite,tmp){var RangeError=global.RangeError,isInteger=Number.isInteger||function(it){return!isObject(it)&&isFinite(it)&&floor(it)===it},sign=Math.sign||function sign(it){return(it=+it)==0||it!=it?it:it<0?-1:1},pow=Math.pow,abs=Math.abs,exp=Math.exp,log=Math.log,sqrt=Math.sqrt,fcc=String.fromCharCode,at=createPointAt(true);var objectStatic={assign:assign,is:function(x,y){return x===y?x!==0||1/x===1/y:x!=x&&y!=y}};"__proto__"in ObjectProto&&function(buggy,set){try{set=ctx(call,getOwnDescriptor(ObjectProto,"__proto__").set,2);set({},ArrayProto)}catch(e){buggy=true}objectStatic.setPrototypeOf=function(O,proto){assertObject(O);assert(proto===null||isObject(proto),proto,": can't set as prototype!");if(buggy)O.__proto__=proto;else set(O,proto);return O}}();$define(STATIC,OBJECT,objectStatic);function asinh(x){return!isFinite(x=+x)||x==0?x:x<0?-asinh(-x):log(x+sqrt(x*x+1))}$define(STATIC,NUMBER,{EPSILON:pow(2,-52),isFinite:function(it){return typeof it=="number"&&isFinite(it)},isInteger:isInteger,isNaN:sameNaN,isSafeInteger:function(number){return isInteger(number)&&abs(number)<=MAX_SAFE_INTEGER},MAX_SAFE_INTEGER:MAX_SAFE_INTEGER,MIN_SAFE_INTEGER:-MAX_SAFE_INTEGER,parseFloat:parseFloat,parseInt:parseInt});$define(STATIC,MATH,{acosh:function(x){return x<1?NaN:log(x+sqrt(x*x-1))},asinh:asinh,atanh:function(x){return x==0?+x:log((1+ +x)/(1-x))/2},cbrt:function(x){return sign(x)*pow(abs(x),1/3)},clz32:function(x){return(x>>>=0)?32-x[TO_STRING](2).length:32},cosh:function(x){return(exp(x)+exp(-x))/2},expm1:function(x){return x==0?+x:x>-1e-6&&x<1e-6?+x+x*x/2:exp(x)-1},fround:function(x){return new Float32Array([x])[0]},hypot:function(value1,value2){var sum=0,length=arguments.length,value;while(length--){value=+arguments[length];if(value==Infinity||value==-Infinity)return Infinity;sum+=value*value}return sqrt(sum)},imul:function(x,y){var UInt16=65535,xl=UInt16&x,yl=UInt16&y;return 0|xl*yl+((UInt16&x>>>16)*yl+xl*(UInt16&y>>>16)<<16>>>0)},log1p:function(x){return x>-1e-8&&x<1e-8?x-x*x/2:log(1+ +x)},log10:function(x){return log(x)/Math.LN10},log2:function(x){return log(x)/Math.LN2},sign:sign,sinh:function(x){return x==0?+x:(exp(x)-exp(-x))/2},tanh:function(x){return isFinite(x)?x==0?+x:(exp(x)-exp(-x))/(exp(x)+exp(-x)):sign(x)},trunc:trunc});setToStringTag(Math,MATH,true);function assertNotRegExp(it){if(isObject(it)&&it instanceof RegExp)throw TypeError()}$define(STATIC,STRING,{fromCodePoint:function(){var res=[],len=arguments.length,i=0,code;while(len>i){code=+arguments[i++];if(toIndex(code,1114111)!==code)throw RangeError(code+" is not a valid code point");res.push(code<65536?fcc(code):fcc(((code-=65536)>>10)+55296,code%1024+56320))}return res.join("")},raw:function(callSite){var raw=ES5Object(assertDefined(callSite.raw)),len=toLength(raw.length),sln=arguments.length,res=[],i=0;while(len>i){res.push(String(raw[i++]));if(i<sln)res.push(String(arguments[i]))}return res.join("")}});$define(PROTO,STRING,{codePointAt:createPointAt(false),endsWith:function(searchString,endPosition){assertNotRegExp(searchString);var len=this.length,end=endPosition===undefined?len:min(toLength(endPosition),len);searchString+="";return String(this).slice(end-searchString.length,end)===searchString},includes:function(searchString,position){return!!~String(assertDefined(this)).indexOf(searchString,position)},repeat:function(count){var str=String(assertDefined(this)),res="",n=toInteger(count);if(0>n||n==Infinity)throw RangeError("Count can't be negative");for(;n>0;(n>>>=1)&&(str+=str))if(n&1)res+=str;return res},startsWith:function(searchString,position){assertNotRegExp(searchString);var index=toLength(min(position,this.length));searchString+="";return String(this).slice(index,index+searchString.length)===searchString}});defineStdIterators(String,STRING,function(iterated){set(this,ITER,{o:String(iterated),i:0})},function(){var iter=this[ITER],O=iter.o,index=iter.i,point;if(index>=O.length)return iterResult(1);point=at.call(O,index);iter.i+=point.length;return iterResult(0,point)});$define(STATIC,ARRAY,{from:function(arrayLike,mapfn,that){var O=Object(assertDefined(arrayLike)),result=new(generic(this,Array)),mapping=mapfn!==undefined,f=mapping?ctx(mapfn,that,2):undefined,index=0,length;if(isIterable(O))for(var iter=getIterator(O),step;!(step=iter.next()).done;index++){result[index]=mapping?f(step.value,index):step.value}else for(length=toLength(O.length);length>index;index++){result[index]=mapping?f(O[index],index):O[index]}result.length=index;return result},of:function(){var index=0,length=arguments.length,result=new(generic(this,Array))(length);while(length>index)result[index]=arguments[index++];result.length=length;return result}});$define(PROTO,ARRAY,{copyWithin:function(target,start,end){var O=Object(assertDefined(this)),len=toLength(O.length),to=toIndex(target,len),from=toIndex(start,len),fin=end===undefined?len:toIndex(end,len),count=min(fin-from,len-to),inc=1;if(from<to&&to<from+count){inc=-1;from=from+count-1;to=to+count-1}while(count-->0){if(from in O)O[to]=O[from];else delete O[to];to+=inc;from+=inc}return O},fill:function(value,start,end){var O=Object(assertDefined(this)),length=toLength(O.length),index=toIndex(start,length),endPos=end===undefined?length:toIndex(end,length);while(endPos>index)O[index++]=value;return O},find:createArrayMethod(5),findIndex:createArrayMethod(6)});defineStdIterators(Array,ARRAY,function(iterated,kind){set(this,ITER,{o:ES5Object(iterated),i:0,k:kind})},function(){var iter=this[ITER],O=iter.o,kind=iter.k,index=iter.i++;if(!O||index>=O.length)return iter.o=undefined,iterResult(1);if(kind==KEY)return iterResult(0,index);if(kind==VALUE)return iterResult(0,O[index]);return iterResult(0,[index,O[index]])},VALUE);Iterators[ARGUMENTS]=Iterators[ARRAY];setToStringTag(global.JSON,"JSON",true);if(framework){tmp[SYMBOL_TAG]=DOT;if(cof(tmp)!=DOT)hidden(ObjectProto,TO_STRING,function(){return"[object "+classof(this)+"]"});if(/./g.flags!="g")defineProperty(RegExp[PROTOTYPE],"flags",{configurable:true,get:createReplacer(/^.*\/(\w*)$/,"$1")})}}(isFinite,{});isFunction(setImmediate)&&isFunction(clearImmediate)||function(ONREADYSTATECHANGE){var postMessage=global.postMessage,addEventListener=global.addEventListener,MessageChannel=global.MessageChannel,counter=0,queue={},defer,channel,port;setImmediate=function(fn){var args=[],i=1;while(arguments.length>i)args.push(arguments[i++]);queue[++counter]=function(){invoke(isFunction(fn)?fn:Function(fn),args)};defer(counter);return counter};clearImmediate=function(id){delete queue[id]};function run(id){if(has(queue,id)){var fn=queue[id];delete queue[id];fn()}}function listner(event){run(event.data)}if(NODE){defer=function(id){nextTick(part.call(run,id))}}else if(addEventListener&&isFunction(postMessage)&&!global.importScripts){defer=function(id){postMessage(id,"*")};addEventListener("message",listner,false)}else if(isFunction(MessageChannel)){channel=new MessageChannel;port=channel.port2;channel.port1.onmessage=listner;defer=ctx(port.postMessage,port,1)}else if(document&&ONREADYSTATECHANGE in document[CREATE_ELEMENT]("script")){defer=function(id){html.appendChild(document[CREATE_ELEMENT]("script"))[ONREADYSTATECHANGE]=function(){html.removeChild(this);run(id)}}}else{defer=function(id){setTimeout(part.call(run,id),0)}}}("onreadystatechange");$define(GLOBAL+BIND,{setImmediate:setImmediate,clearImmediate:clearImmediate});!function(Promise,test){isFunction(Promise)&&isFunction(Promise.resolve)&&Promise.resolve(test=new Promise(Function()))==test||function(asap,DEF){function isThenable(o){var then;if(isObject(o))then=o.then;return isFunction(then)?then:false}function notify(def){var chain=def.chain;chain.length&&asap(function(){var msg=def.msg,ok=def.state==1,i=0;while(chain.length>i)!function(react){var cb=ok?react.ok:react.fail,ret,then;try{if(cb){ret=cb===true?msg:cb(msg);if(ret===react.P){react.rej(TypeError(PROMISE+"-chain cycle"))}else if(then=isThenable(ret)){then.call(ret,react.res,react.rej)}else react.res(ret)}else react.rej(msg)}catch(err){react.rej(err)}}(chain[i++]);chain.length=0})}function resolve(msg){var def=this,then,wrapper;if(def.done)return;def.done=true;def=def.def||def;try{if(then=isThenable(msg)){wrapper={def:def,done:false};then.call(msg,ctx(resolve,wrapper,1),ctx(reject,wrapper,1))}else{def.msg=msg;def.state=1;notify(def)}}catch(err){reject.call(wrapper||{def:def,done:false},err)}}function reject(msg){var def=this;if(def.done)return;def.done=true;def=def.def||def;def.msg=msg;def.state=2;notify(def)}Promise=function(executor){assertFunction(executor);assertInstance(this,Promise,PROMISE);var def={chain:[],state:0,done:false,msg:undefined};hidden(this,DEF,def);try{executor(ctx(resolve,def,1),ctx(reject,def,1))}catch(err){reject.call(def,err)}};assignHidden(Promise[PROTOTYPE],{then:function(onFulfilled,onRejected){var react={ok:isFunction(onFulfilled)?onFulfilled:true,fail:isFunction(onRejected)?onRejected:false},P=react.P=new this[CONSTRUCTOR](function(resolve,reject){react.res=assertFunction(resolve);react.rej=assertFunction(reject)}),def=this[DEF];def.chain.push(react);def.state&¬ify(def);return P},"catch":function(onRejected){return this.then(undefined,onRejected)}});assignHidden(Promise,{all:function(iterable){var Promise=this,values=[];return new Promise(function(resolve,reject){forOf(iterable,false,push,values);var remaining=values.length,results=Array(remaining);if(remaining)forEach.call(values,function(promise,index){Promise.resolve(promise).then(function(value){results[index]=value;--remaining||resolve(results)},reject)});else resolve(results)})},race:function(iterable){var Promise=this;return new Promise(function(resolve,reject){forOf(iterable,false,function(promise){Promise.resolve(promise).then(resolve,reject)})})},reject:function(r){return new this(function(resolve,reject){reject(r)})},resolve:function(x){return isObject(x)&&getPrototypeOf(x)===this[PROTOTYPE]?x:new this(function(resolve,reject){resolve(x)})}})}(nextTick||setImmediate,safeSymbol("def"));setToStringTag(Promise,PROMISE);$define(GLOBAL+FORCED*!isNative(Promise),{Promise:Promise})}(global[PROMISE]);!function(){var UID=safeSymbol("uid"),DATA=safeSymbol("data"),WEAK=safeSymbol("weak"),LAST=safeSymbol("last"),FIRST=safeSymbol("first"),SIZE=DESC?safeSymbol("size"):"size",uid=0;function getCollection(C,NAME,methods,commonMethods,isMap,isWeak){var ADDER=isMap?"set":"add",proto=C&&C[PROTOTYPE],O={};function initFromIterable(that,iterable){if(iterable!=undefined)forOf(iterable,isMap,that[ADDER],that);return that}function fixSVZ(key,chain){var method=proto[key];framework&&hidden(proto,key,function(a,b){var result=method.call(this,a===0?0:a,b);return chain?this:result})}if(!isNative(C)||!(isWeak||!BUGGY_ITERATORS&&has(proto,"entries"))){C=isWeak?function(iterable){assertInstance(this,C,NAME);set(this,UID,uid++);initFromIterable(this,iterable)}:function(iterable){var that=this;assertInstance(that,C,NAME);set(that,DATA,create(null));set(that,SIZE,0);set(that,LAST,undefined);set(that,FIRST,undefined);initFromIterable(that,iterable)};assignHidden(assignHidden(C[PROTOTYPE],methods),commonMethods);isWeak||defineProperty(C[PROTOTYPE],"size",{get:function(){return assertDefined(this[SIZE])}})}else{var Native=C,inst=new C,chain=inst[ADDER](isWeak?{}:-0,1),buggyZero;if(!NATIVE_ITERATORS||!C.length){C=function(iterable){assertInstance(this,C,NAME);return initFromIterable(new Native,iterable)};C[PROTOTYPE]=proto}isWeak||inst[FOR_EACH](function(val,key){buggyZero=1/key===-Infinity});if(buggyZero){fixSVZ("delete");fixSVZ("has");isMap&&fixSVZ("get")}if(buggyZero||chain!==inst)fixSVZ(ADDER,true)}setToStringTag(C,NAME);O[NAME]=C;$define(GLOBAL+WRAP+FORCED*!isNative(C),O);isWeak||defineStdIterators(C,NAME,function(iterated,kind){set(this,ITER,{o:iterated,k:kind})},function(){var iter=this[ITER],O=iter.o,kind=iter.k,entry=iter.l;while(entry&&entry.r)entry=entry.p;if(!O||!(iter.l=entry=entry?entry.n:O[FIRST]))return iter.o=undefined,iterResult(1);if(kind==KEY)return iterResult(0,entry.k);if(kind==VALUE)return iterResult(0,entry.v);return iterResult(0,[entry.k,entry.v])},isMap?KEY+VALUE:VALUE);return C}function fastKey(it,create){if(!isObject(it))return(typeof it=="string"?"S":"P")+it;if(!has(it,UID)){if(create)hidden(it,UID,++uid);else return""}return"O"+it[UID]}function def(that,key,value){var index=fastKey(key,true),data=that[DATA],last=that[LAST],entry;if(index in data)data[index].v=value;else{entry=data[index]={k:key,v:value,p:last};if(!that[FIRST])that[FIRST]=entry;if(last)last.n=entry;that[LAST]=entry;that[SIZE]++}return that}function del(that,index){var data=that[DATA],entry=data[index],next=entry.n,prev=entry.p;delete data[index];entry.r=true;if(prev)prev.n=next;if(next)next.p=prev;if(that[FIRST]==entry)that[FIRST]=next;if(that[LAST]==entry)that[LAST]=prev;that[SIZE]--}var collectionMethods={clear:function(){for(var index in this[DATA])del(this,index)},"delete":function(key){var index=fastKey(key),contains=index in this[DATA];if(contains)del(this,index);return contains},forEach:function(callbackfn,that){var f=ctx(callbackfn,that,3),entry;while(entry=entry?entry.n:this[FIRST]){f(entry.v,entry.k,this);while(entry&&entry.r)entry=entry.p}},has:function(key){return fastKey(key)in this[DATA]}};Map=getCollection(Map,MAP,{get:function(key){var entry=this[DATA][fastKey(key)];return entry&&entry.v},set:function(key,value){return def(this,key===0?0:key,value)}},collectionMethods,true);Set=getCollection(Set,SET,{add:function(value){return def(this,value=value===0?0:value,value)}},collectionMethods);function setWeak(that,key,value){has(assertObject(key),WEAK)||hidden(key,WEAK,{});key[WEAK][that[UID]]=value;return that}function hasWeak(key){return isObject(key)&&has(key,WEAK)&&has(key[WEAK],this[UID])}var weakMethods={"delete":function(key){return hasWeak.call(this,key)&&delete key[WEAK][this[UID]]},has:hasWeak};WeakMap=getCollection(WeakMap,WEAKMAP,{get:function(key){if(isObject(key)&&has(key,WEAK))return key[WEAK][this[UID]]},set:function(key,value){return setWeak(this,key,value)}},weakMethods,true,true);WeakSet=getCollection(WeakSet,WEAKSET,{add:function(value){return setWeak(this,value,true)}},weakMethods,false,true)}();!function(){$define(PROTO,ARRAY,{includes:createArrayContains(true)});$define(PROTO,STRING,{at:createPointAt(true)});function createObjectToArray(isEntries){return function(object){var O=ES5Object(object),keys=getKeys(object),length=keys.length,i=0,result=Array(length),key;if(isEntries)while(length>i)result[i]=[key=keys[i++],O[key]];else while(length>i)result[i]=O[keys[i++]];return result}}$define(STATIC,OBJECT,{values:createObjectToArray(false),entries:createObjectToArray(true)});$define(STATIC,REGEXP,{escape:createReplacer(/([\\\-[\]{}()*+?.,^$|])/g,"\\$1",true)})}();!function(REFERENCE){REFERENCE_GET=getWellKnownSymbol(REFERENCE+"Get",true);var REFERENCE_SET=getWellKnownSymbol(REFERENCE+SET,true),REFERENCE_DELETE=getWellKnownSymbol(REFERENCE+"Delete",true);$define(STATIC,SYMBOL,{referenceGet:REFERENCE_GET,referenceSet:REFERENCE_SET,referenceDelete:REFERENCE_DELETE});hidden(FunctionProto,REFERENCE_GET,returnThis);function setMapMethods(Constructor){if(Constructor){var MapProto=Constructor[PROTOTYPE];hidden(MapProto,REFERENCE_GET,MapProto.get);hidden(MapProto,REFERENCE_SET,MapProto.set);hidden(MapProto,REFERENCE_DELETE,MapProto["delete"])}}setMapMethods(Map);setMapMethods(WeakMap)}("reference");!function(DICT){function Dict(iterable){var dict=create(null);if(iterable!=undefined){if(isIterable(iterable)){for(var iter=getIterator(iterable),step,value;!(step=iter.next()).done;){value=step.value;dict[value[0]]=value[1]}}else assign(dict,iterable)}return dict}Dict[PROTOTYPE]=null;function DictIterator(iterated,kind){set(this,ITER,{o:ES5Object(iterated),a:getKeys(iterated),i:0,k:kind})}createIterator(DictIterator,DICT,function(){var iter=this[ITER],O=iter.o,keys=iter.a,kind=iter.k,key;while(true){if(iter.i>=keys.length)return iterResult(1);if(has(O,key=keys[iter.i++]))break}if(kind==KEY)return iterResult(0,key);if(kind==VALUE)return iterResult(0,O[key]);return iterResult(0,[key,O[key]])});function createDictIter(kind){return function(it){return new DictIterator(it,kind)}}function createDictMethod(type){var isMap=type==1,isEvery=type==4;return function(object,callbackfn,that){var f=ctx(callbackfn,that,3),O=ES5Object(object),result=isMap||type==7||type==2?new(generic(this,Dict)):undefined,key,val,res;for(key in O)if(has(O,key)){val=O[key];res=f(val,key,object);if(type){if(isMap)result[key]=res;else if(res)switch(type){case 2:result[key]=val;break;case 3:return true;case 5:return val;case 6:return key;case 7:result[res[0]]=res[1]}else if(isEvery)return false}}return type==3||isEvery?isEvery:result}}function createDictReduce(isTurn){return function(object,mapfn,init){assertFunction(mapfn);var O=ES5Object(object),keys=getKeys(O),length=keys.length,i=0,memo,key,result;if(isTurn)memo=init==undefined?new(generic(this,Dict)):Object(init);else if(arguments.length<3){assert(length,REDUCE_ERROR);memo=O[keys[i++]]}else memo=Object(init);while(length>i)if(has(O,key=keys[i++])){result=mapfn(memo,O[key],key,object);if(isTurn){if(result===false)break}else memo=result}return memo}}var findKey=createDictMethod(6);function includes(object,el){return(el==el?keyOf(object,el):findKey(object,sameNaN))!==undefined}var dictMethods={keys:createDictIter(KEY),values:createDictIter(VALUE),entries:createDictIter(KEY+VALUE),forEach:createDictMethod(0),map:createDictMethod(1),filter:createDictMethod(2),some:createDictMethod(3),every:createDictMethod(4),find:createDictMethod(5),findKey:findKey,mapPairs:createDictMethod(7),reduce:createDictReduce(false),turn:createDictReduce(true),keyOf:keyOf,includes:includes,has:has,get:get,set:createDefiner(0),isDict:function(it){return isObject(it)&&getPrototypeOf(it)===Dict[PROTOTYPE]}};if(REFERENCE_GET)for(var key in dictMethods)!function(fn){function method(){for(var args=[this],i=0;i<arguments.length;)args.push(arguments[i++]);return invoke(fn,args)}fn[REFERENCE_GET]=function(){return method}}(dictMethods[key]);$define(GLOBAL+FORCED,{Dict:assignHidden(Dict,dictMethods)})}("Dict");!function(ENTRIES,FN){function $for(iterable,entries){if(!(this instanceof $for))return new $for(iterable,entries);
this[ITER]=getIterator(iterable);this[ENTRIES]=!!entries}createIterator($for,"Wrapper",function(){return this[ITER].next()});var $forProto=$for[PROTOTYPE];setIterator($forProto,function(){return this[ITER]});function createChainIterator(next){function Iter(I,fn,that){this[ITER]=getIterator(I);this[ENTRIES]=I[ENTRIES];this[FN]=ctx(fn,that,I[ENTRIES]?2:1)}createIterator(Iter,"Chain",next,$forProto);setIterator(Iter[PROTOTYPE],returnThis);return Iter}var MapIter=createChainIterator(function(){var step=this[ITER].next();return step.done?step:iterResult(0,stepCall(this[FN],step.value,this[ENTRIES]))});var FilterIter=createChainIterator(function(){for(;;){var step=this[ITER].next();if(step.done||stepCall(this[FN],step.value,this[ENTRIES]))return step}});assignHidden($forProto,{of:function(fn,that){forOf(this,this[ENTRIES],fn,that)},array:function(fn,that){var result=[];forOf(fn!=undefined?this.map(fn,that):this,false,push,result);return result},filter:function(fn,that){return new FilterIter(this,fn,that)},map:function(fn,that){return new MapIter(this,fn,that)}});$for.isIterable=isIterable;$for.getIterator=getIterator;$define(GLOBAL+FORCED,{$for:$for})}("entries",safeSymbol("fn"));!function(_,toLocaleString){core._=path._=path._||{};$define(PROTO+FORCED,FUNCTION,{part:part,by:function(that){var fn=this,_=path._,holder=false,length=arguments.length,isThat=that===_,i=+!isThat,indent=i,it,args;if(isThat){it=fn;fn=call}else it=that;if(length<2)return ctx(fn,it,-1);args=Array(length-indent);while(length>i)if((args[i-indent]=arguments[i++])===_)holder=true;return partial(fn,args,length,holder,_,true,it)},only:function(numberArguments,that){var fn=assertFunction(this),n=toLength(numberArguments),isThat=arguments.length>1;return function(){var length=min(n,arguments.length),args=Array(length),i=0;while(length>i)args[i]=arguments[i++];return invoke(fn,args,isThat?that:this)}}});function tie(key){var that=this,bound={};return hidden(that,_,function(key){if(key===undefined||!(key in that))return toLocaleString.call(that);return has(bound,key)?bound[key]:bound[key]=ctx(that[key],that,-1)})[_](key)}hidden(path._,TO_STRING,function(){return _});hidden(ObjectProto,_,tie);DESC||hidden(ArrayProto,_,tie)}(DESC?uid("tie"):TO_LOCALE,ObjectProto[TO_LOCALE]);!function(){function define(target,mixin){var keys=ownKeys(ES5Object(mixin)),length=keys.length,i=0,key;while(length>i)defineProperty(target,key=keys[i++],getOwnDescriptor(mixin,key));return target}$define(STATIC+FORCED,OBJECT,{isObject:isObject,classof:classof,define:define,make:function(proto,mixin){return define(create(proto),mixin)}})}();$define(PROTO+FORCED,ARRAY,{turn:turn});!function(){function setArrayStatics(keys,length){$define(STATIC,ARRAY,turn.call(array(keys),function(memo,key){if(key in ArrayProto)memo[key]=ctx(call,ArrayProto[key],length)},{}))}setArrayStatics("pop,reverse,shift,keys,values,entries",1);setArrayStatics("indexOf,every,some,forEach,map,filter,find,findIndex,includes",3);setArrayStatics("join,slice,concat,push,splice,unshift,sort,lastIndexOf,"+"reduce,reduceRight,copyWithin,fill,turn")}();!function(){function NumberIterator(iterated){set(this,ITER,{l:toLength(iterated),i:0})}createIterator(NumberIterator,NUMBER,function(){var iter=this[ITER],i=iter.i++;return i<iter.l?iterResult(0,i):iterResult(1)});defineIterator(Number,NUMBER,function(){return new NumberIterator(this)});$define(PROTO+FORCED,NUMBER,{random:function(lim){var a=+this,b=lim==undefined?0:+lim,m=min(a,b);return random()*(max(a,b)-m)+m}});$define(PROTO+FORCED,NUMBER,turn.call(array("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(memo,key){var fn=Math[key];if(fn)memo[key]=function(){var args=[+this],i=0;while(arguments.length>i)args.push(arguments[i++]);return invoke(fn,args)}},{}))}();!function(){var escapeHTMLDict={"&":"&","<":"<",">":">",'"':""","'":"'"},unescapeHTMLDict={},key;for(key in escapeHTMLDict)unescapeHTMLDict[escapeHTMLDict[key]]=key;$define(PROTO+FORCED,STRING,{escapeHTML:createReplacer(/[&<>"']/g,escapeHTMLDict),unescapeHTML:createReplacer(/&(?:amp|lt|gt|quot|apos);/g,unescapeHTMLDict)})}();!function(formatRegExp,flexioRegExp,locales,current,SECONDS,MINUTES,HOURS,MONTH,YEAR){function createFormat(prefix){return function(template,locale){var that=this,dict=locales[has(locales,locale)?locale:current];function get(unit){return that[prefix+unit]()}return String(template).replace(formatRegExp,function(part){switch(part){case"s":return get(SECONDS);case"ss":return lz(get(SECONDS));case"m":return get(MINUTES);case"mm":return lz(get(MINUTES));case"h":return get(HOURS);case"hh":return lz(get(HOURS));case"D":return get(DATE);case"DD":return lz(get(DATE));case"W":return dict[0][get("Day")];case"N":return get(MONTH)+1;case"NN":return lz(get(MONTH)+1);case"M":return dict[2][get(MONTH)];case"MM":return dict[1][get(MONTH)];case"Y":return get(YEAR);case"YY":return lz(get(YEAR)%100)}return part})}}function lz(num){return num>9?num:"0"+num}function addLocale(lang,locale){function split(index){return turn.call(array(locale.months),function(memo,it){memo.push(it.replace(flexioRegExp,"$"+index))})}locales[lang]=[array(locale.weekdays),split(1),split(2)];return core}$define(PROTO+FORCED,DATE,{format:createFormat("get"),formatUTC:createFormat("getUTC")});addLocale(current,{weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",months:"January,February,March,April,May,June,July,August,September,October,November,December"});addLocale("ru",{weekdays:"Воскресенье,Понедельник,Вторник,Среда,Четверг,Пятница,Суббота",months:"Январ:я|ь,Феврал:я|ь,Март:а|,Апрел:я|ь,Ма:я|й,Июн:я|ь,"+"Июл:я|ь,Август:а|,Сентябр:я|ь,Октябр:я|ь,Ноябр:я|ь,Декабр:я|ь"});core.locale=function(locale){return has(locales,locale)?current=locale:current};core.addLocale=addLocale}(/\b\w\w?\b/g,/:(.*)\|(.*)$/,{},"en","Seconds","Minutes","Hours","Month","FullYear")}(Function("return this"),false)},{}],121:[function(require,module,exports){(function(root,factory){"use strict";if(typeof define==="function"&&define.amd){define(["exports"],factory)}else if(typeof exports!=="undefined"){factory(exports)}else{factory(root.estraverse={})}})(this,function(exports){"use strict";var Syntax,isArray,VisitorOption,VisitorKeys,objectCreate,objectKeys,BREAK,SKIP,REMOVE;function ignoreJSHintError(){}isArray=Array.isArray;if(!isArray){isArray=function isArray(array){return Object.prototype.toString.call(array)==="[object Array]"}}function deepCopy(obj){var ret={},key,val;for(key in obj){if(obj.hasOwnProperty(key)){val=obj[key];if(typeof val==="object"&&val!==null){ret[key]=deepCopy(val)}else{ret[key]=val}}}return ret}function shallowCopy(obj){var ret={},key;for(key in obj){if(obj.hasOwnProperty(key)){ret[key]=obj[key]}}return ret}ignoreJSHintError(shallowCopy);function upperBound(array,func){var diff,len,i,current;len=array.length;i=0;while(len){diff=len>>>1;current=i+diff;if(func(array[current])){len=diff}else{i=current+1;len-=diff+1}}return i}function lowerBound(array,func){var diff,len,i,current;len=array.length;i=0;while(len){diff=len>>>1;current=i+diff;if(func(array[current])){i=current+1;len-=diff+1}else{len=diff}}return i}ignoreJSHintError(lowerBound);objectCreate=Object.create||function(){function F(){}return function(o){F.prototype=o;return new F}}();objectKeys=Object.keys||function(o){var keys=[],key;for(key in o){keys.push(key)}return keys};function extend(to,from){objectKeys(from).forEach(function(key){to[key]=from[key]});return to}Syntax={AssignmentExpression:"AssignmentExpression",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",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"};VisitorKeys={AssignmentExpression:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","defaults","rest","body"],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"]};BREAK={};SKIP={};REMOVE={};VisitorOption={Break:BREAK,Skip:SKIP,Remove:REMOVE};function Reference(parent,key){this.parent=parent;this.key=key}Reference.prototype.replace=function replace(node){this.parent[this.key]=node};Reference.prototype.remove=function remove(){if(isArray(this.parent)){this.parent.splice(this.key,1);return true}else{this.replace(null);return false}};function Element(node,path,wrap,ref){this.node=node;this.path=path;this.wrap=wrap;this.ref=ref}function Controller(){}Controller.prototype.path=function path(){var i,iz,j,jz,result,element;function addToPath(result,path){if(isArray(path)){for(j=0,jz=path.length;j<jz;++j){result.push(path[j])}}else{result.push(path)}}if(!this.__current.path){return null}result=[];for(i=2,iz=this.__leavelist.length;i<iz;++i){element=this.__leavelist[i];addToPath(result,element.path)}addToPath(result,this.__current.path);return result};Controller.prototype.type=function(){var node=this.current();return node.type||this.__current.wrap};Controller.prototype.parents=function parents(){var i,iz,result;result=[];for(i=1,iz=this.__leavelist.length;i<iz;++i){result.push(this.__leavelist[i].node)}return result};Controller.prototype.current=function current(){return this.__current.node};Controller.prototype.__execute=function __execute(callback,element){var previous,result;result=undefined;previous=this.__current;this.__current=element;this.__state=null;if(callback){result=callback.call(this,element.node,this.__leavelist[this.__leavelist.length-1].node)}this.__current=previous;return result};Controller.prototype.notify=function notify(flag){this.__state=flag};Controller.prototype.skip=function(){this.notify(SKIP)};Controller.prototype["break"]=function(){this.notify(BREAK)};Controller.prototype.remove=function(){this.notify(REMOVE)};Controller.prototype.__initialize=function(root,visitor){this.visitor=visitor;this.root=root;this.__worklist=[];this.__leavelist=[];this.__current=null;this.__state=null;this.__fallback=visitor.fallback==="iteration";this.__keys=VisitorKeys;if(visitor.keys){this.__keys=extend(objectCreate(this.__keys),visitor.keys)}};function isNode(node){if(node==null){return false}return typeof node==="object"&&typeof node.type==="string"}function isProperty(nodeType,key){return(nodeType===Syntax.ObjectExpression||nodeType===Syntax.ObjectPattern)&&"properties"===key}Controller.prototype.traverse=function traverse(root,visitor){var worklist,leavelist,element,node,nodeType,ret,key,current,current2,candidates,candidate,sentinel;this.__initialize(root,visitor);sentinel={};worklist=this.__worklist;leavelist=this.__leavelist;worklist.push(new Element(root,null,null,null));leavelist.push(new Element(null,null,null,null));while(worklist.length){element=worklist.pop();if(element===sentinel){element=leavelist.pop();ret=this.__execute(visitor.leave,element);if(this.__state===BREAK||ret===BREAK){return}continue}if(element.node){ret=this.__execute(visitor.enter,element);if(this.__state===BREAK||ret===BREAK){return}worklist.push(sentinel);leavelist.push(element);if(this.__state===SKIP||ret===SKIP){continue}node=element.node;nodeType=element.wrap||node.type;candidates=this.__keys[nodeType];if(!candidates){if(this.__fallback){candidates=objectKeys(node)}else{throw new Error("Unknown node type "+nodeType+".")}}current=candidates.length;while((current-=1)>=0){key=candidates[current];candidate=node[key];if(!candidate){continue}if(isArray(candidate)){current2=candidate.length;while((current2-=1)>=0){if(!candidate[current2]){continue}if(isProperty(nodeType,candidates[current])){element=new Element(candidate[current2],[key,current2],"Property",null)}else if(isNode(candidate[current2])){element=new Element(candidate[current2],[key,current2],null,null)}else{continue}worklist.push(element)}}else if(isNode(candidate)){worklist.push(new Element(candidate,key,null,null))}}}}};Controller.prototype.replace=function replace(root,visitor){function removeElem(element){var i,key,nextElem,parent;if(element.ref.remove()){key=element.ref.key;parent=element.ref.parent;i=worklist.length;while(i--){nextElem=worklist[i];if(nextElem.ref&&nextElem.ref.parent===parent){if(nextElem.ref.key<key){break}--nextElem.ref.key}}}}var worklist,leavelist,node,nodeType,target,element,current,current2,candidates,candidate,sentinel,outer,key;this.__initialize(root,visitor);sentinel={};worklist=this.__worklist;leavelist=this.__leavelist;outer={root:root};element=new Element(root,null,null,new Reference(outer,"root"));worklist.push(element);leavelist.push(element);while(worklist.length){element=worklist.pop();if(element===sentinel){element=leavelist.pop();target=this.__execute(visitor.leave,element);if(target!==undefined&&target!==BREAK&&target!==SKIP&&target!==REMOVE){element.ref.replace(target)}if(this.__state===REMOVE||target===REMOVE){removeElem(element)}if(this.__state===BREAK||target===BREAK){return outer.root}continue}target=this.__execute(visitor.enter,element);if(target!==undefined&&target!==BREAK&&target!==SKIP&&target!==REMOVE){element.ref.replace(target);element.node=target}if(this.__state===REMOVE||target===REMOVE){removeElem(element);element.node=null}if(this.__state===BREAK||target===BREAK){return outer.root}node=element.node;if(!node){continue}worklist.push(sentinel);leavelist.push(element);if(this.__state===SKIP||target===SKIP){continue}nodeType=element.wrap||node.type;candidates=this.__keys[nodeType];if(!candidates){if(this.__fallback){candidates=objectKeys(node)}else{throw new Error("Unknown node type "+nodeType+".")}}current=candidates.length;while((current-=1)>=0){key=candidates[current];candidate=node[key];if(!candidate){continue}if(isArray(candidate)){current2=candidate.length;while((current2-=1)>=0){if(!candidate[current2]){continue}if(isProperty(nodeType,candidates[current])){element=new Element(candidate[current2],[key,current2],"Property",new Reference(candidate,current2))}else if(isNode(candidate[current2])){element=new Element(candidate[current2],[key,current2],null,new Reference(candidate,current2))}else{continue}worklist.push(element)}}else if(isNode(candidate)){worklist.push(new Element(candidate,key,null,new Reference(node,key)))}}}return outer.root};function traverse(root,visitor){var controller=new Controller;return controller.traverse(root,visitor)}function replace(root,visitor){var controller=new Controller;return controller.replace(root,visitor)}function extendCommentRange(comment,tokens){var target;target=upperBound(tokens,function search(token){return token.range[0]>comment.range[0]});comment.extendedRange=[comment.range[0],comment.range[1]];if(target!==tokens.length){comment.extendedRange[1]=tokens[target].range[0]}target-=1;if(target>=0){comment.extendedRange[0]=tokens[target].range[1]}return comment}function attachComments(tree,providedComments,tokens){var comments=[],comment,len,i,cursor;if(!tree.range){throw new Error("attachComments needs range information")}if(!tokens.length){if(providedComments.length){for(i=0,len=providedComments.length;i<len;i+=1){comment=deepCopy(providedComments[i]);comment.extendedRange=[0,tree.range[0]];comments.push(comment)}tree.leadingComments=comments}return tree}for(i=0,len=providedComments.length;i<len;i+=1){comments.push(extendCommentRange(deepCopy(providedComments[i]),tokens))}cursor=0;traverse(tree,{enter:function(node){var comment;while(cursor<comments.length){comment=comments[cursor];if(comment.extendedRange[1]>node.range[0]){break}if(comment.extendedRange[1]===node.range[0]){if(!node.leadingComments){node.leadingComments=[]}node.leadingComments.push(comment);comments.splice(cursor,1)}else{cursor+=1}}if(cursor===comments.length){return VisitorOption.Break}if(comments[cursor].extendedRange[0]>node.range[1]){return VisitorOption.Skip}}});cursor=0;traverse(tree,{leave:function(node){var comment;while(cursor<comments.length){comment=comments[cursor];if(node.range[1]<comment.extendedRange[0]){break}if(node.range[1]===comment.extendedRange[0]){if(!node.trailingComments){node.trailingComments=[]}node.trailingComments.push(comment);comments.splice(cursor,1)}else{cursor+=1}}if(cursor===comments.length){return VisitorOption.Break}if(comments[cursor].extendedRange[0]>node.range[1]){return VisitorOption.Skip}}});return tree}exports.version="1.8.0";exports.Syntax=Syntax;exports.traverse=traverse;exports.replace=replace;exports.attachComments=attachComments;exports.VisitorKeys=VisitorKeys;exports.VisitorOption=VisitorOption;exports.Controller=Controller})},{}],122:[function(require,module,exports){(function(){"use strict";function isExpression(node){if(node==null){return false}switch(node.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 isIterationStatement(node){if(node==null){return false}switch(node.type){case"DoWhileStatement":case"ForInStatement":case"ForStatement":case"WhileStatement":return true}return false}function isStatement(node){if(node==null){return false}switch(node.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 isSourceElement(node){return isStatement(node)||node!=null&&node.type==="FunctionDeclaration"}function trailingStatement(node){switch(node.type){case"IfStatement":if(node.alternate!=null){return node.alternate}return node.consequent;case"LabeledStatement":case"ForStatement":case"ForInStatement":case"WhileStatement":case"WithStatement":return node.body}return null}function isProblematicIfStatement(node){var current;if(node.type!=="IfStatement"){return false}if(node.alternate==null){return false}current=node.consequent;do{if(current.type==="IfStatement"){if(current.alternate==null){return true}}current=trailingStatement(current)}while(current);return false}module.exports={isExpression:isExpression,isStatement:isStatement,isIterationStatement:isIterationStatement,isSourceElement:isSourceElement,isProblematicIfStatement:isProblematicIfStatement,trailingStatement:trailingStatement}})()},{}],123:[function(require,module,exports){(function(){"use strict";var Regex,NON_ASCII_WHITESPACES;Regex={NonAsciiIdentifierStart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),NonAsciiIdentifierPart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԧԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠࢢ-ࢬࣤ-ࣾऀ-ॣ०-९ॱ-ॷॹ-ॿঁ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఁ-ఃఅ-ఌఎ-ఐఒ-నప-ళవ-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಂಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲംഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤜᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶᴀ-ᷦ᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺꩻꪀ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︦︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]")};function isDecimalDigit(ch){return ch>=48&&ch<=57}function isHexDigit(ch){return isDecimalDigit(ch)||97<=ch&&ch<=102||65<=ch&&ch<=70}function isOctalDigit(ch){return ch>=48&&ch<=55}NON_ASCII_WHITESPACES=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279];function isWhiteSpace(ch){return ch===32||ch===9||ch===11||ch===12||ch===160||ch>=5760&&NON_ASCII_WHITESPACES.indexOf(ch)>=0}function isLineTerminator(ch){return ch===10||ch===13||ch===8232||ch===8233}function isIdentifierStart(ch){return ch>=97&&ch<=122||ch>=65&&ch<=90||ch===36||ch===95||ch===92||ch>=128&&Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch))}function isIdentifierPart(ch){return ch>=97&&ch<=122||ch>=65&&ch<=90||ch>=48&&ch<=57||ch===36||ch===95||ch===92||ch>=128&&Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch))}module.exports={isDecimalDigit:isDecimalDigit,isHexDigit:isHexDigit,isOctalDigit:isOctalDigit,isWhiteSpace:isWhiteSpace,isLineTerminator:isLineTerminator,isIdentifierStart:isIdentifierStart,isIdentifierPart:isIdentifierPart}})()},{}],124:[function(require,module,exports){(function(){"use strict";var code=require("./code");function isStrictModeReservedWordES6(id){switch(id){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"let":return true;default:return false}}function isKeywordES5(id,strict){if(!strict&&id==="yield"){return false}return isKeywordES6(id,strict)}function isKeywordES6(id,strict){if(strict&&isStrictModeReservedWordES6(id)){return true}switch(id.length){case 2:return id==="if"||id==="in"||id==="do";case 3:return id==="var"||id==="for"||id==="new"||id==="try";case 4:return id==="this"||id==="else"||id==="case"||id==="void"||id==="with"||id==="enum";case 5:return id==="while"||id==="break"||id==="catch"||id==="throw"||id==="const"||id==="yield"||id==="class"||id==="super";case 6:return id==="return"||id==="typeof"||id==="delete"||id==="switch"||id==="export"||id==="import";case 7:return id==="default"||id==="finally"||id==="extends";case 8:return id==="function"||id==="continue"||id==="debugger";case 10:return id==="instanceof";default:return false}}function isReservedWordES5(id,strict){return id==="null"||id==="true"||id==="false"||isKeywordES5(id,strict)}function isReservedWordES6(id,strict){return id==="null"||id==="true"||id==="false"||isKeywordES6(id,strict)}function isRestrictedWord(id){return id==="eval"||id==="arguments"}function isIdentifierName(id){var i,iz,ch;if(id.length===0){return false}ch=id.charCodeAt(0);if(!code.isIdentifierStart(ch)||ch===92){return false}for(i=1,iz=id.length;i<iz;++i){ch=id.charCodeAt(i);if(!code.isIdentifierPart(ch)||ch===92){return false}}return true}function isIdentifierES5(id,strict){return isIdentifierName(id)&&!isReservedWordES5(id,strict)}function isIdentifierES6(id,strict){return isIdentifierName(id)&&!isReservedWordES6(id,strict)}module.exports={isKeywordES5:isKeywordES5,isKeywordES6:isKeywordES6,isReservedWordES5:isReservedWordES5,isReservedWordES6:isReservedWordES6,isRestrictedWord:isRestrictedWord,isIdentifierName:isIdentifierName,isIdentifierES5:isIdentifierES5,isIdentifierES6:isIdentifierES6}})()},{"./code":123}],125:[function(require,module,exports){(function(){"use strict";exports.ast=require("./ast");exports.code=require("./code");exports.keyword=require("./keyword")})()},{"./ast":122,"./code":123,"./keyword":124}],126:[function(require,module,exports){"use strict";exports.reservedVars={arguments:false,NaN:false};exports.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};exports.newEcmaIdentifiers={Set:false,Map:false,WeakMap:false,WeakSet:false,Proxy:false,Promise:false,Reflect:false,Symbol:false,System:false};exports.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};
exports.devel={alert:false,confirm:false,console:false,Debug:false,opera:false,prompt:false};exports.worker={importScripts:true,postMessage:true,self:true,FileReaderSync:true};exports.nonstandard={escape:false,unescape:false};exports.couch={require:false,respond:false,getRow:false,emit:false,send:false,start:false,sum:false,log:false,exports:false,module:false,provides:false};exports.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};exports.browserify={__filename:false,__dirname:false,global:false,module:false,require:false,Buffer:true,exports:true,process:true};exports.phantom={phantom:true,require:true,WebPage:true,console:true,exports:true};exports.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};exports.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};exports.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};exports.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};exports.wsh={ActiveXObject:true,Enumerator:true,GetObject:true,ScriptEngine:true,ScriptEngineBuildVersion:true,ScriptEngineMajorVersion:true,ScriptEngineMinorVersion:true,VBArray:true,WSH:true,WScript:true,XDomainRequest:true};exports.dojo={dojo:false,dijit:false,dojox:false,define:false,require:false};exports.jquery={$:false,jQuery:false};exports.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};exports.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};exports.yui={YUI:false,Y:false,YUI_config:false};exports.mocha={describe:false,it:false,before:false,after:false,beforeEach:false,afterEach:false,suite:false,test:false,setup:false,teardown:false};exports.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}},{}],127:[function(require,module,exports){(function(global){(function(){var undefined;var arrayPool=[],objectPool=[];var idCounter=0;var keyPrefix=+new Date+"";var largeArraySize=75;var maxPoolSize=40;var whitespace=" \f "+"\n\r\u2028\u2029"+" ";var reEmptyStringLeading=/\b__p \+= '';/g,reEmptyStringMiddle=/\b(__p \+=) '' \+/g,reEmptyStringTrailing=/(__e\(.*?\)|\b__t\)) \+\n'';/g;var reEsTemplate=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;var reFlags=/\w*$/;var reFuncName=/^\s*function[ \n\r\t]+\w/;var reInterpolate=/<%=([\s\S]+?)%>/g;var reLeadingSpacesAndZeros=RegExp("^["+whitespace+"]*0+(?=.$)");var reNoMatch=/($^)/;var reThis=/\bthis\b/;var reUnescapedString=/['\n\r\t\u2028\u2029\\]/g;var contextProps=["Array","Boolean","Date","Function","Math","Number","Object","RegExp","String","_","attachEvent","clearTimeout","isFinite","isNaN","parseInt","setTimeout"];var templateCounter=0;var argsClass="[object Arguments]",arrayClass="[object Array]",boolClass="[object Boolean]",dateClass="[object Date]",funcClass="[object Function]",numberClass="[object Number]",objectClass="[object Object]",regexpClass="[object RegExp]",stringClass="[object String]";var cloneableClasses={};cloneableClasses[funcClass]=false;cloneableClasses[argsClass]=cloneableClasses[arrayClass]=cloneableClasses[boolClass]=cloneableClasses[dateClass]=cloneableClasses[numberClass]=cloneableClasses[objectClass]=cloneableClasses[regexpClass]=cloneableClasses[stringClass]=true;var debounceOptions={leading:false,maxWait:0,trailing:false};var descriptor={configurable:false,enumerable:false,value:null,writable:false};var objectTypes={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false};var stringEscapes={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};var root=objectTypes[typeof window]&&window||this;var freeExports=objectTypes[typeof exports]&&exports&&!exports.nodeType&&exports;var freeModule=objectTypes[typeof module]&&module&&!module.nodeType&&module;var moduleExports=freeModule&&freeModule.exports===freeExports&&freeExports;var freeGlobal=objectTypes[typeof global]&&global;if(freeGlobal&&(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal)){root=freeGlobal}function baseIndexOf(array,value,fromIndex){var index=(fromIndex||0)-1,length=array?array.length:0;while(++index<length){if(array[index]===value){return index}}return-1}function cacheIndexOf(cache,value){var type=typeof value;cache=cache.cache;if(type=="boolean"||value==null){return cache[value]?0:-1}if(type!="number"&&type!="string"){type="object"}var key=type=="number"?value:keyPrefix+value;cache=(cache=cache[type])&&cache[key];return type=="object"?cache&&baseIndexOf(cache,value)>-1?0:-1:cache?0:-1}function cachePush(value){var cache=this.cache,type=typeof value;if(type=="boolean"||value==null){cache[value]=true}else{if(type!="number"&&type!="string"){type="object"}var key=type=="number"?value:keyPrefix+value,typeCache=cache[type]||(cache[type]={});if(type=="object"){(typeCache[key]||(typeCache[key]=[])).push(value)}else{typeCache[key]=true}}}function charAtCallback(value){return value.charCodeAt(0)}function compareAscending(a,b){var ac=a.criteria,bc=b.criteria,index=-1,length=ac.length;while(++index<length){var value=ac[index],other=bc[index];if(value!==other){if(value>other||typeof value=="undefined"){return 1}if(value<other||typeof other=="undefined"){return-1}}}return a.index-b.index}function createCache(array){var index=-1,length=array.length,first=array[0],mid=array[length/2|0],last=array[length-1];if(first&&typeof first=="object"&&mid&&typeof mid=="object"&&last&&typeof last=="object"){return false}var cache=getObject();cache["false"]=cache["null"]=cache["true"]=cache["undefined"]=false;var result=getObject();result.array=array;result.cache=cache;result.push=cachePush;while(++index<length){result.push(array[index])}return result}function escapeStringChar(match){return"\\"+stringEscapes[match]}function getArray(){return arrayPool.pop()||[]}function getObject(){return objectPool.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 releaseArray(array){array.length=0;if(arrayPool.length<maxPoolSize){arrayPool.push(array)}}function releaseObject(object){var cache=object.cache;if(cache){releaseObject(cache)}object.array=object.cache=object.criteria=object.object=object.number=object.string=object.value=null;if(objectPool.length<maxPoolSize){objectPool.push(object)}}function slice(array,start,end){start||(start=0);if(typeof end=="undefined"){end=array?array.length:0}var index=-1,length=end-start||0,result=Array(length<0?0:length);while(++index<length){result[index]=array[start+index]}return result}function runInContext(context){context=context?_.defaults(root.Object(),context,_.pick(root,contextProps)):root;var Array=context.Array,Boolean=context.Boolean,Date=context.Date,Function=context.Function,Math=context.Math,Number=context.Number,Object=context.Object,RegExp=context.RegExp,String=context.String,TypeError=context.TypeError;var arrayRef=[];var objectProto=Object.prototype;var oldDash=context._;var toString=objectProto.toString;var reNative=RegExp("^"+String(toString).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$");var ceil=Math.ceil,clearTimeout=context.clearTimeout,floor=Math.floor,fnToString=Function.prototype.toString,getPrototypeOf=isNative(getPrototypeOf=Object.getPrototypeOf)&&getPrototypeOf,hasOwnProperty=objectProto.hasOwnProperty,push=arrayRef.push,setTimeout=context.setTimeout,splice=arrayRef.splice,unshift=arrayRef.unshift;var defineProperty=function(){try{var o={},func=isNative(func=Object.defineProperty)&&func,result=func(o,o,o)&&func}catch(e){}return result}();var nativeCreate=isNative(nativeCreate=Object.create)&&nativeCreate,nativeIsArray=isNative(nativeIsArray=Array.isArray)&&nativeIsArray,nativeIsFinite=context.isFinite,nativeIsNaN=context.isNaN,nativeKeys=isNative(nativeKeys=Object.keys)&&nativeKeys,nativeMax=Math.max,nativeMin=Math.min,nativeParseInt=context.parseInt,nativeRandom=Math.random;var ctorByClass={};ctorByClass[arrayClass]=Array;ctorByClass[boolClass]=Boolean;ctorByClass[dateClass]=Date;ctorByClass[funcClass]=Function;ctorByClass[objectClass]=Object;ctorByClass[numberClass]=Number;ctorByClass[regexpClass]=RegExp;ctorByClass[stringClass]=String;function lodash(value){return value&&typeof value=="object"&&!isArray(value)&&hasOwnProperty.call(value,"__wrapped__")?value:new lodashWrapper(value)}function lodashWrapper(value,chainAll){this.__chain__=!!chainAll;this.__wrapped__=value}lodashWrapper.prototype=lodash.prototype;var support=lodash.support={};support.funcDecomp=!isNative(context.WinRTError)&&reThis.test(runInContext);support.funcNames=typeof Function.name=="string";lodash.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:reInterpolate,variable:"",imports:{_:lodash}};function baseBind(bindData){var func=bindData[0],partialArgs=bindData[2],thisArg=bindData[4];function bound(){if(partialArgs){var args=slice(partialArgs);push.apply(args,arguments)}if(this instanceof bound){var thisBinding=baseCreate(func.prototype),result=func.apply(thisBinding,args||arguments);return isObject(result)?result:thisBinding}return func.apply(thisArg,args||arguments)}setBindData(bound,bindData);return bound}function baseClone(value,isDeep,callback,stackA,stackB){if(callback){var result=callback(value);if(typeof result!="undefined"){return result}}var isObj=isObject(value);if(isObj){var className=toString.call(value);if(!cloneableClasses[className]){return value}var ctor=ctorByClass[className];switch(className){case boolClass:case dateClass:return new ctor(+value);case numberClass:case stringClass:return new ctor(value);case regexpClass:result=ctor(value.source,reFlags.exec(value));result.lastIndex=value.lastIndex;return result}}else{return value}var isArr=isArray(value);if(isDeep){var initedStack=!stackA;stackA||(stackA=getArray());stackB||(stackB=getArray());var length=stackA.length;while(length--){if(stackA[length]==value){return stackB[length]}}result=isArr?ctor(value.length):{}}else{result=isArr?slice(value):assign({},value)}if(isArr){if(hasOwnProperty.call(value,"index")){result.index=value.index}if(hasOwnProperty.call(value,"input")){result.input=value.input}}if(!isDeep){return result}stackA.push(value);stackB.push(result);(isArr?forEach:forOwn)(value,function(objValue,key){result[key]=baseClone(objValue,isDeep,callback,stackA,stackB)});if(initedStack){releaseArray(stackA);releaseArray(stackB)}return result}function baseCreate(prototype,properties){return isObject(prototype)?nativeCreate(prototype):{}}if(!nativeCreate){baseCreate=function(){function Object(){}return function(prototype){if(isObject(prototype)){Object.prototype=prototype;var result=new Object;Object.prototype=null}return result||context.Object()}}()}function baseCreateCallback(func,thisArg,argCount){if(typeof func!="function"){return identity}if(typeof thisArg=="undefined"||!("prototype"in func)){return func}var bindData=func.__bindData__;if(typeof bindData=="undefined"){if(support.funcNames){bindData=!func.name}bindData=bindData||!support.funcDecomp;if(!bindData){var source=fnToString.call(func);if(!support.funcNames){bindData=!reFuncName.test(source)}if(!bindData){bindData=reThis.test(source);setBindData(func,bindData)}}}if(bindData===false||bindData!==true&&bindData[1]&1){return func}switch(argCount){case 1:return function(value){return func.call(thisArg,value)};case 2:return function(a,b){return func.call(thisArg,a,b)};case 3:return function(value,index,collection){return func.call(thisArg,value,index,collection)};case 4:return function(accumulator,value,index,collection){return func.call(thisArg,accumulator,value,index,collection)}}return bind(func,thisArg)}function baseCreateWrapper(bindData){var func=bindData[0],bitmask=bindData[1],partialArgs=bindData[2],partialRightArgs=bindData[3],thisArg=bindData[4],arity=bindData[5];var isBind=bitmask&1,isBindKey=bitmask&2,isCurry=bitmask&4,isCurryBound=bitmask&8,key=func;function bound(){var thisBinding=isBind?thisArg:this;if(partialArgs){var args=slice(partialArgs);push.apply(args,arguments)}if(partialRightArgs||isCurry){args||(args=slice(arguments));if(partialRightArgs){push.apply(args,partialRightArgs)}if(isCurry&&args.length<arity){bitmask|=16&~32;return baseCreateWrapper([func,isCurryBound?bitmask:bitmask&~3,args,null,thisArg,arity])}}args||(args=arguments);if(isBindKey){func=thisBinding[key]}if(this instanceof bound){thisBinding=baseCreate(func.prototype);var result=func.apply(thisBinding,args);return isObject(result)?result:thisBinding}return func.apply(thisBinding,args)}setBindData(bound,bindData);return bound}function baseDifference(array,values){var index=-1,indexOf=getIndexOf(),length=array?array.length:0,isLarge=length>=largeArraySize&&indexOf===baseIndexOf,result=[];if(isLarge){var cache=createCache(values);if(cache){indexOf=cacheIndexOf;values=cache}else{isLarge=false}}while(++index<length){var value=array[index];if(indexOf(values,value)<0){result.push(value)}}if(isLarge){releaseObject(values)}return result}function baseFlatten(array,isShallow,isStrict,fromIndex){var index=(fromIndex||0)-1,length=array?array.length:0,result=[];while(++index<length){var value=array[index];if(value&&typeof value=="object"&&typeof value.length=="number"&&(isArray(value)||isArguments(value))){if(!isShallow){value=baseFlatten(value,isShallow,isStrict)}var valIndex=-1,valLength=value.length,resIndex=result.length;result.length+=valLength;while(++valIndex<valLength){result[resIndex++]=value[valIndex]}}else if(!isStrict){result.push(value)}}return result}function baseIsEqual(a,b,callback,isWhere,stackA,stackB){if(callback){var result=callback(a,b);if(typeof result!="undefined"){return!!result}}if(a===b){return a!==0||1/a==1/b}var type=typeof a,otherType=typeof b;if(a===a&&!(a&&objectTypes[type])&&!(b&&objectTypes[otherType])){return false}if(a==null||b==null){return a===b}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:return+a==+b;case numberClass:return a!=+a?b!=+b:a==0?1/a==1/b:a==+b;case regexpClass:case stringClass:return a==String(b)}var isArr=className==arrayClass;if(!isArr){var aWrapped=hasOwnProperty.call(a,"__wrapped__"),bWrapped=hasOwnProperty.call(b,"__wrapped__");if(aWrapped||bWrapped){return baseIsEqual(aWrapped?a.__wrapped__:a,bWrapped?b.__wrapped__:b,callback,isWhere,stackA,stackB)}if(className!=objectClass){return false}var ctorA=a.constructor,ctorB=b.constructor;if(ctorA!=ctorB&&!(isFunction(ctorA)&&ctorA instanceof ctorA&&isFunction(ctorB)&&ctorB instanceof ctorB)&&("constructor"in a&&"constructor"in b)){return false}}var initedStack=!stackA;stackA||(stackA=getArray());stackB||(stackB=getArray());var length=stackA.length;while(length--){if(stackA[length]==a){return stackB[length]==b}}var size=0;result=true;stackA.push(a);stackB.push(b);if(isArr){length=a.length;size=b.length;result=size==length;if(result||isWhere){while(size--){var index=length,value=b[size];if(isWhere){while(index--){if(result=baseIsEqual(a[index],value,callback,isWhere,stackA,stackB)){break}}}else if(!(result=baseIsEqual(a[size],value,callback,isWhere,stackA,stackB))){break}}}}else{forIn(b,function(value,key,b){if(hasOwnProperty.call(b,key)){size++;return result=hasOwnProperty.call(a,key)&&baseIsEqual(a[key],value,callback,isWhere,stackA,stackB)}});if(result&&!isWhere){forIn(a,function(value,key,a){if(hasOwnProperty.call(a,key)){return result=--size>-1}})}}stackA.pop();stackB.pop();if(initedStack){releaseArray(stackA);releaseArray(stackB)}return result}function baseMerge(object,source,callback,stackA,stackB){(isArray(source)?forEach:forOwn)(source,function(source,key){var found,isArr,result=source,value=object[key];if(source&&((isArr=isArray(source))||isPlainObject(source))){var stackLength=stackA.length;while(stackLength--){if(found=stackA[stackLength]==source){value=stackB[stackLength];break}}if(!found){var isShallow;if(callback){result=callback(value,source);if(isShallow=typeof result!="undefined"){value=result}}if(!isShallow){value=isArr?isArray(value)?value:[]:isPlainObject(value)?value:{}}stackA.push(source);stackB.push(value);if(!isShallow){baseMerge(value,source,callback,stackA,stackB)}}}else{if(callback){result=callback(value,source);if(typeof result=="undefined"){result=source}}if(typeof result!="undefined"){value=result}}object[key]=value})}function baseRandom(min,max){return min+floor(nativeRandom()*(max-min+1))}function baseUniq(array,isSorted,callback){var index=-1,indexOf=getIndexOf(),length=array?array.length:0,result=[];var isLarge=!isSorted&&length>=largeArraySize&&indexOf===baseIndexOf,seen=callback||isLarge?getArray():result;if(isLarge){var cache=createCache(seen);indexOf=cacheIndexOf;seen=cache}while(++index<length){var value=array[index],computed=callback?callback(value,index,array):value;if(isSorted?!index||seen[seen.length-1]!==computed:indexOf(seen,computed)<0){if(callback||isLarge){seen.push(computed)}result.push(value)}}if(isLarge){releaseArray(seen.array);releaseObject(seen)}else if(callback){releaseArray(seen)}return result}function createAggregator(setter){return function(collection,callback,thisArg){var result={};callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=="number"){while(++index<length){var value=collection[index];setter(result,value,callback(value,index,collection),collection)}}else{forOwn(collection,function(value,key,collection){setter(result,value,callback(value,key,collection),collection)})}return result}}function createWrapper(func,bitmask,partialArgs,partialRightArgs,thisArg,arity){var isBind=bitmask&1,isBindKey=bitmask&2,isCurry=bitmask&4,isCurryBound=bitmask&8,isPartial=bitmask&16,isPartialRight=bitmask&32;if(!isBindKey&&!isFunction(func)){throw new TypeError}if(isPartial&&!partialArgs.length){bitmask&=~16;isPartial=partialArgs=false}if(isPartialRight&&!partialRightArgs.length){bitmask&=~32;isPartialRight=partialRightArgs=false}var bindData=func&&func.__bindData__;if(bindData&&bindData!==true){bindData=slice(bindData);if(bindData[2]){bindData[2]=slice(bindData[2])}if(bindData[3]){bindData[3]=slice(bindData[3])}if(isBind&&!(bindData[1]&1)){bindData[4]=thisArg}if(!isBind&&bindData[1]&1){bitmask|=8}if(isCurry&&!(bindData[1]&4)){bindData[5]=arity}if(isPartial){push.apply(bindData[2]||(bindData[2]=[]),partialArgs)}if(isPartialRight){unshift.apply(bindData[3]||(bindData[3]=[]),partialRightArgs)}bindData[1]|=bitmask;return createWrapper.apply(null,bindData)}var creater=bitmask==1||bitmask===17?baseBind:baseCreateWrapper;return creater([func,bitmask,partialArgs,partialRightArgs,thisArg,arity])}function escapeHtmlChar(match){return htmlEscapes[match]}function getIndexOf(){var result=(result=lodash.indexOf)===indexOf?baseIndexOf:result;return result}function isNative(value){return typeof value=="function"&&reNative.test(value)}var setBindData=!defineProperty?noop:function(func,value){descriptor.value=value;defineProperty(func,"__bindData__",descriptor)};function shimIsPlainObject(value){var ctor,result;if(!(value&&toString.call(value)==objectClass)||(ctor=value.constructor,isFunction(ctor)&&!(ctor instanceof ctor))){return false}forIn(value,function(value,key){result=key});return typeof result=="undefined"||hasOwnProperty.call(value,result)}function unescapeHtmlChar(match){return htmlUnescapes[match]}function isArguments(value){return value&&typeof value=="object"&&typeof value.length=="number"&&toString.call(value)==argsClass||false}var isArray=nativeIsArray||function(value){return value&&typeof value=="object"&&typeof value.length=="number"&&toString.call(value)==arrayClass||false};var shimKeys=function(object){var index,iterable=object,result=[];if(!iterable)return result;if(!objectTypes[typeof object])return result;for(index in iterable){if(hasOwnProperty.call(iterable,index)){result.push(index)}}return result};var keys=!nativeKeys?shimKeys:function(object){if(!isObject(object)){return[]}return nativeKeys(object)};var htmlEscapes={"&":"&","<":"<",">":">",'"':""","'":"'"};var htmlUnescapes=invert(htmlEscapes);var reEscapedHtml=RegExp("("+keys(htmlUnescapes).join("|")+")","g"),reUnescapedHtml=RegExp("["+keys(htmlEscapes).join("")+"]","g");var assign=function(object,source,guard){var index,iterable=object,result=iterable;if(!iterable)return result;var args=arguments,argsIndex=0,argsLength=typeof guard=="number"?2:args.length;if(argsLength>3&&typeof args[argsLength-2]=="function"){var callback=baseCreateCallback(args[--argsLength-1],args[argsLength--],2)}else if(argsLength>2&&typeof args[argsLength-1]=="function"){callback=args[--argsLength]}while(++argsIndex<argsLength){iterable=args[argsIndex];if(iterable&&objectTypes[typeof iterable]){var ownIndex=-1,ownProps=objectTypes[typeof iterable]&&keys(iterable),length=ownProps?ownProps.length:0;while(++ownIndex<length){index=ownProps[ownIndex];result[index]=callback?callback(result[index],iterable[index]):iterable[index]}}}return result};function clone(value,isDeep,callback,thisArg){if(typeof isDeep!="boolean"&&isDeep!=null){thisArg=callback;callback=isDeep;isDeep=false}return baseClone(value,isDeep,typeof callback=="function"&&baseCreateCallback(callback,thisArg,1))}function cloneDeep(value,callback,thisArg){return baseClone(value,true,typeof callback=="function"&&baseCreateCallback(callback,thisArg,1))}function create(prototype,properties){var result=baseCreate(prototype);return properties?assign(result,properties):result}var defaults=function(object,source,guard){var index,iterable=object,result=iterable;if(!iterable)return result;var args=arguments,argsIndex=0,argsLength=typeof guard=="number"?2:args.length;while(++argsIndex<argsLength){iterable=args[argsIndex];if(iterable&&objectTypes[typeof iterable]){var ownIndex=-1,ownProps=objectTypes[typeof iterable]&&keys(iterable),length=ownProps?ownProps.length:0;while(++ownIndex<length){index=ownProps[ownIndex];if(typeof result[index]=="undefined")result[index]=iterable[index]}}}return result};function findKey(object,callback,thisArg){var result;callback=lodash.createCallback(callback,thisArg,3);forOwn(object,function(value,key,object){if(callback(value,key,object)){result=key;return false}});return result}function findLastKey(object,callback,thisArg){var result;callback=lodash.createCallback(callback,thisArg,3);forOwnRight(object,function(value,key,object){if(callback(value,key,object)){result=key;return false}});return result}var forIn=function(collection,callback,thisArg){var index,iterable=collection,result=iterable;if(!iterable)return result;if(!objectTypes[typeof iterable])return result;callback=callback&&typeof thisArg=="undefined"?callback:baseCreateCallback(callback,thisArg,3);for(index in iterable){if(callback(iterable[index],index,collection)===false)return result}return result};function forInRight(object,callback,thisArg){var pairs=[];forIn(object,function(value,key){pairs.push(key,value)});var length=pairs.length;callback=baseCreateCallback(callback,thisArg,3);while(length--){if(callback(pairs[length--],pairs[length],object)===false){break}}return object}var forOwn=function(collection,callback,thisArg){var index,iterable=collection,result=iterable;if(!iterable)return result;if(!objectTypes[typeof iterable])return result;callback=callback&&typeof thisArg=="undefined"?callback:baseCreateCallback(callback,thisArg,3);var ownIndex=-1,ownProps=objectTypes[typeof iterable]&&keys(iterable),length=ownProps?ownProps.length:0;while(++ownIndex<length){index=ownProps[ownIndex];if(callback(iterable[index],index,collection)===false)return result}return result};function forOwnRight(object,callback,thisArg){var props=keys(object),length=props.length;callback=baseCreateCallback(callback,thisArg,3);while(length--){var key=props[length];if(callback(object[key],key,object)===false){break}}return object}function functions(object){var result=[];forIn(object,function(value,key){if(isFunction(value)){result.push(key)}});return result.sort()}function has(object,key){return object?hasOwnProperty.call(object,key):false}function invert(object){var index=-1,props=keys(object),length=props.length,result={};while(++index<length){var key=props[index];result[object[key]]=key}return result}function isBoolean(value){return value===true||value===false||value&&typeof value=="object"&&toString.call(value)==boolClass||false}function isDate(value){return value&&typeof value=="object"&&toString.call(value)==dateClass||false}function isElement(value){return value&&value.nodeType===1||false}function isEmpty(value){var result=true;if(!value){return result}var className=toString.call(value),length=value.length;if(className==arrayClass||className==stringClass||className==argsClass||className==objectClass&&typeof length=="number"&&isFunction(value.splice)){return!length}forOwn(value,function(){return result=false});return result}function isEqual(a,b,callback,thisArg){return baseIsEqual(a,b,typeof callback=="function"&&baseCreateCallback(callback,thisArg,2))}function isFinite(value){return nativeIsFinite(value)&&!nativeIsNaN(parseFloat(value))}function isFunction(value){return typeof value=="function"}function isObject(value){return!!(value&&objectTypes[typeof value])}function isNaN(value){return isNumber(value)&&value!=+value}function isNull(value){return value===null}function isNumber(value){return typeof value=="number"||value&&typeof value=="object"&&toString.call(value)==numberClass||false}var isPlainObject=!getPrototypeOf?shimIsPlainObject:function(value){if(!(value&&toString.call(value)==objectClass)){return false}var valueOf=value.valueOf,objProto=isNative(valueOf)&&(objProto=getPrototypeOf(valueOf))&&getPrototypeOf(objProto);return objProto?value==objProto||getPrototypeOf(value)==objProto:shimIsPlainObject(value)};function isRegExp(value){return value&&typeof value=="object"&&toString.call(value)==regexpClass||false}function isString(value){return typeof value=="string"||value&&typeof value=="object"&&toString.call(value)==stringClass||false}function isUndefined(value){return typeof value=="undefined"}function mapValues(object,callback,thisArg){var result={};callback=lodash.createCallback(callback,thisArg,3);forOwn(object,function(value,key,object){result[key]=callback(value,key,object)});return result}function merge(object){var args=arguments,length=2;if(!isObject(object)){return object}if(typeof args[2]!="number"){length=args.length}if(length>3&&typeof args[length-2]=="function"){var callback=baseCreateCallback(args[--length-1],args[length--],2)}else if(length>2&&typeof args[length-1]=="function"){callback=args[--length]}var sources=slice(arguments,1,length),index=-1,stackA=getArray(),stackB=getArray();while(++index<length){baseMerge(object,sources[index],callback,stackA,stackB)}releaseArray(stackA);releaseArray(stackB);return object}function omit(object,callback,thisArg){var result={};if(typeof callback!="function"){var props=[];forIn(object,function(value,key){props.push(key)});props=baseDifference(props,baseFlatten(arguments,true,false,1));var index=-1,length=props.length;while(++index<length){var key=props[index];result[key]=object[key]}}else{callback=lodash.createCallback(callback,thisArg,3);forIn(object,function(value,key,object){if(!callback(value,key,object)){result[key]=value}})}return result}function pairs(object){var index=-1,props=keys(object),length=props.length,result=Array(length);while(++index<length){var key=props[index];result[index]=[key,object[key]]}return result}function pick(object,callback,thisArg){var result={};if(typeof callback!="function"){var index=-1,props=baseFlatten(arguments,true,false,1),length=isObject(object)?props.length:0;while(++index<length){var key=props[index];if(key in object){result[key]=object[key]}}}else{callback=lodash.createCallback(callback,thisArg,3);forIn(object,function(value,key,object){if(callback(value,key,object)){result[key]=value}})}return result}function transform(object,callback,accumulator,thisArg){var isArr=isArray(object);if(accumulator==null){if(isArr){accumulator=[]}else{var ctor=object&&object.constructor,proto=ctor&&ctor.prototype;accumulator=baseCreate(proto)}}if(callback){callback=lodash.createCallback(callback,thisArg,4);(isArr?forEach:forOwn)(object,function(value,index,object){return callback(accumulator,value,index,object)})}return accumulator}function values(object){var index=-1,props=keys(object),length=props.length,result=Array(length);while(++index<length){result[index]=object[props[index]]}return result}function at(collection){var args=arguments,index=-1,props=baseFlatten(args,true,false,1),length=args[2]&&args[2][args[1]]===collection?1:props.length,result=Array(length);while(++index<length){result[index]=collection[props[index]]}return result}function contains(collection,target,fromIndex){var index=-1,indexOf=getIndexOf(),length=collection?collection.length:0,result=false;fromIndex=(fromIndex<0?nativeMax(0,length+fromIndex):fromIndex)||0;if(isArray(collection)){result=indexOf(collection,target,fromIndex)>-1}else if(typeof length=="number"){result=(isString(collection)?collection.indexOf(target,fromIndex):indexOf(collection,target,fromIndex))>-1}else{forOwn(collection,function(value){if(++index>=fromIndex){return!(result=value===target)}})}return result}var countBy=createAggregator(function(result,value,key){hasOwnProperty.call(result,key)?result[key]++:result[key]=1});function every(collection,callback,thisArg){var result=true;callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=="number"){while(++index<length){if(!(result=!!callback(collection[index],index,collection))){break}}}else{forOwn(collection,function(value,index,collection){return result=!!callback(value,index,collection)
})}return result}function filter(collection,callback,thisArg){var result=[];callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=="number"){while(++index<length){var value=collection[index];if(callback(value,index,collection)){result.push(value)}}}else{forOwn(collection,function(value,index,collection){if(callback(value,index,collection)){result.push(value)}})}return result}function find(collection,callback,thisArg){callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=="number"){while(++index<length){var value=collection[index];if(callback(value,index,collection)){return value}}}else{var result;forOwn(collection,function(value,index,collection){if(callback(value,index,collection)){result=value;return false}});return result}}function findLast(collection,callback,thisArg){var result;callback=lodash.createCallback(callback,thisArg,3);forEachRight(collection,function(value,index,collection){if(callback(value,index,collection)){result=value;return false}});return result}function forEach(collection,callback,thisArg){var index=-1,length=collection?collection.length:0;callback=callback&&typeof thisArg=="undefined"?callback:baseCreateCallback(callback,thisArg,3);if(typeof length=="number"){while(++index<length){if(callback(collection[index],index,collection)===false){break}}}else{forOwn(collection,callback)}return collection}function forEachRight(collection,callback,thisArg){var length=collection?collection.length:0;callback=callback&&typeof thisArg=="undefined"?callback:baseCreateCallback(callback,thisArg,3);if(typeof length=="number"){while(length--){if(callback(collection[length],length,collection)===false){break}}}else{var props=keys(collection);length=props.length;forOwn(collection,function(value,key,collection){key=props?props[--length]:--length;return callback(collection[key],key,collection)})}return collection}var groupBy=createAggregator(function(result,value,key){(hasOwnProperty.call(result,key)?result[key]:result[key]=[]).push(value)});var indexBy=createAggregator(function(result,value,key){result[key]=value});function invoke(collection,methodName){var args=slice(arguments,2),index=-1,isFunc=typeof methodName=="function",length=collection?collection.length:0,result=Array(typeof length=="number"?length:0);forEach(collection,function(value){result[++index]=(isFunc?methodName:value[methodName]).apply(value,args)});return result}function map(collection,callback,thisArg){var index=-1,length=collection?collection.length:0;callback=lodash.createCallback(callback,thisArg,3);if(typeof length=="number"){var result=Array(length);while(++index<length){result[index]=callback(collection[index],index,collection)}}else{result=[];forOwn(collection,function(value,key,collection){result[++index]=callback(value,key,collection)})}return result}function max(collection,callback,thisArg){var computed=-Infinity,result=computed;if(typeof callback!="function"&&thisArg&&thisArg[callback]===collection){callback=null}if(callback==null&&isArray(collection)){var index=-1,length=collection.length;while(++index<length){var value=collection[index];if(value>result){result=value}}}else{callback=callback==null&&isString(collection)?charAtCallback:lodash.createCallback(callback,thisArg,3);forEach(collection,function(value,index,collection){var current=callback(value,index,collection);if(current>computed){computed=current;result=value}})}return result}function min(collection,callback,thisArg){var computed=Infinity,result=computed;if(typeof callback!="function"&&thisArg&&thisArg[callback]===collection){callback=null}if(callback==null&&isArray(collection)){var index=-1,length=collection.length;while(++index<length){var value=collection[index];if(value<result){result=value}}}else{callback=callback==null&&isString(collection)?charAtCallback:lodash.createCallback(callback,thisArg,3);forEach(collection,function(value,index,collection){var current=callback(value,index,collection);if(current<computed){computed=current;result=value}})}return result}var pluck=map;function reduce(collection,callback,accumulator,thisArg){if(!collection)return accumulator;var noaccum=arguments.length<3;callback=lodash.createCallback(callback,thisArg,4);var index=-1,length=collection.length;if(typeof length=="number"){if(noaccum){accumulator=collection[++index]}while(++index<length){accumulator=callback(accumulator,collection[index],index,collection)}}else{forOwn(collection,function(value,index,collection){accumulator=noaccum?(noaccum=false,value):callback(accumulator,value,index,collection)})}return accumulator}function reduceRight(collection,callback,accumulator,thisArg){var noaccum=arguments.length<3;callback=lodash.createCallback(callback,thisArg,4);forEachRight(collection,function(value,index,collection){accumulator=noaccum?(noaccum=false,value):callback(accumulator,value,index,collection)});return accumulator}function reject(collection,callback,thisArg){callback=lodash.createCallback(callback,thisArg,3);return filter(collection,function(value,index,collection){return!callback(value,index,collection)})}function sample(collection,n,guard){if(collection&&typeof collection.length!="number"){collection=values(collection)}if(n==null||guard){return collection?collection[baseRandom(0,collection.length-1)]:undefined}var result=shuffle(collection);result.length=nativeMin(nativeMax(0,n),result.length);return result}function shuffle(collection){var index=-1,length=collection?collection.length:0,result=Array(typeof length=="number"?length:0);forEach(collection,function(value){var rand=baseRandom(0,++index);result[index]=result[rand];result[rand]=value});return result}function size(collection){var length=collection?collection.length:0;return typeof length=="number"?length:keys(collection).length}function some(collection,callback,thisArg){var result;callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=="number"){while(++index<length){if(result=callback(collection[index],index,collection)){break}}}else{forOwn(collection,function(value,index,collection){return!(result=callback(value,index,collection))})}return!!result}function sortBy(collection,callback,thisArg){var index=-1,isArr=isArray(callback),length=collection?collection.length:0,result=Array(typeof length=="number"?length:0);if(!isArr){callback=lodash.createCallback(callback,thisArg,3)}forEach(collection,function(value,key,collection){var object=result[++index]=getObject();if(isArr){object.criteria=map(callback,function(key){return value[key]})}else{(object.criteria=getArray())[0]=callback(value,key,collection)}object.index=index;object.value=value});length=result.length;result.sort(compareAscending);while(length--){var object=result[length];result[length]=object.value;if(!isArr){releaseArray(object.criteria)}releaseObject(object)}return result}function toArray(collection){if(collection&&typeof collection.length=="number"){return slice(collection)}return values(collection)}var where=filter;function compact(array){var index=-1,length=array?array.length:0,result=[];while(++index<length){var value=array[index];if(value){result.push(value)}}return result}function difference(array){return baseDifference(array,baseFlatten(arguments,true,true,1))}function findIndex(array,callback,thisArg){var index=-1,length=array?array.length:0;callback=lodash.createCallback(callback,thisArg,3);while(++index<length){if(callback(array[index],index,array)){return index}}return-1}function findLastIndex(array,callback,thisArg){var length=array?array.length:0;callback=lodash.createCallback(callback,thisArg,3);while(length--){if(callback(array[length],length,array)){return length}}return-1}function first(array,callback,thisArg){var n=0,length=array?array.length:0;if(typeof callback!="number"&&callback!=null){var index=-1;callback=lodash.createCallback(callback,thisArg,3);while(++index<length&&callback(array[index],index,array)){n++}}else{n=callback;if(n==null||thisArg){return array?array[0]:undefined}}return slice(array,0,nativeMin(nativeMax(0,n),length))}function flatten(array,isShallow,callback,thisArg){if(typeof isShallow!="boolean"&&isShallow!=null){thisArg=callback;callback=typeof isShallow!="function"&&thisArg&&thisArg[isShallow]===array?null:isShallow;isShallow=false}if(callback!=null){array=map(array,callback,thisArg)}return baseFlatten(array,isShallow)}function indexOf(array,value,fromIndex){if(typeof fromIndex=="number"){var length=array?array.length:0;fromIndex=fromIndex<0?nativeMax(0,length+fromIndex):fromIndex||0}else if(fromIndex){var index=sortedIndex(array,value);return array[index]===value?index:-1}return baseIndexOf(array,value,fromIndex)}function initial(array,callback,thisArg){var n=0,length=array?array.length:0;if(typeof callback!="number"&&callback!=null){var index=length;callback=lodash.createCallback(callback,thisArg,3);while(index--&&callback(array[index],index,array)){n++}}else{n=callback==null||thisArg?1:callback||n}return slice(array,0,nativeMin(nativeMax(0,length-n),length))}function intersection(){var args=[],argsIndex=-1,argsLength=arguments.length,caches=getArray(),indexOf=getIndexOf(),trustIndexOf=indexOf===baseIndexOf,seen=getArray();while(++argsIndex<argsLength){var value=arguments[argsIndex];if(isArray(value)||isArguments(value)){args.push(value);caches.push(trustIndexOf&&value.length>=largeArraySize&&createCache(argsIndex?args[argsIndex]:seen))}}var array=args[0],index=-1,length=array?array.length:0,result=[];outer:while(++index<length){var cache=caches[0];value=array[index];if((cache?cacheIndexOf(cache,value):indexOf(seen,value))<0){argsIndex=argsLength;(cache||seen).push(value);while(--argsIndex){cache=caches[argsIndex];if((cache?cacheIndexOf(cache,value):indexOf(args[argsIndex],value))<0){continue outer}}result.push(value)}}while(argsLength--){cache=caches[argsLength];if(cache){releaseObject(cache)}}releaseArray(caches);releaseArray(seen);return result}function last(array,callback,thisArg){var n=0,length=array?array.length:0;if(typeof callback!="number"&&callback!=null){var index=length;callback=lodash.createCallback(callback,thisArg,3);while(index--&&callback(array[index],index,array)){n++}}else{n=callback;if(n==null||thisArg){return array?array[length-1]:undefined}}return slice(array,nativeMax(0,length-n))}function lastIndexOf(array,value,fromIndex){var index=array?array.length:0;if(typeof fromIndex=="number"){index=(fromIndex<0?nativeMax(0,index+fromIndex):nativeMin(fromIndex,index-1))+1}while(index--){if(array[index]===value){return index}}return-1}function pull(array){var args=arguments,argsIndex=0,argsLength=args.length,length=array?array.length:0;while(++argsIndex<argsLength){var index=-1,value=args[argsIndex];while(++index<length){if(array[index]===value){splice.call(array,index--,1);length--}}}return array}function range(start,end,step){start=+start||0;step=typeof step=="number"?step:+step||1;if(end==null){end=start;start=0}var index=-1,length=nativeMax(0,ceil((end-start)/(step||1))),result=Array(length);while(++index<length){result[index]=start;start+=step}return result}function remove(array,callback,thisArg){var index=-1,length=array?array.length:0,result=[];callback=lodash.createCallback(callback,thisArg,3);while(++index<length){var value=array[index];if(callback(value,index,array)){result.push(value);splice.call(array,index--,1);length--}}return result}function rest(array,callback,thisArg){if(typeof callback!="number"&&callback!=null){var n=0,index=-1,length=array?array.length:0;callback=lodash.createCallback(callback,thisArg,3);while(++index<length&&callback(array[index],index,array)){n++}}else{n=callback==null||thisArg?1:nativeMax(0,callback)}return slice(array,n)}function sortedIndex(array,value,callback,thisArg){var low=0,high=array?array.length:low;callback=callback?lodash.createCallback(callback,thisArg,1):identity;value=callback(value);while(low<high){var mid=low+high>>>1;callback(array[mid])<value?low=mid+1:high=mid}return low}function union(){return baseUniq(baseFlatten(arguments,true,true))}function uniq(array,isSorted,callback,thisArg){if(typeof isSorted!="boolean"&&isSorted!=null){thisArg=callback;callback=typeof isSorted!="function"&&thisArg&&thisArg[isSorted]===array?null:isSorted;isSorted=false}if(callback!=null){callback=lodash.createCallback(callback,thisArg,3)}return baseUniq(array,isSorted,callback)}function without(array){return baseDifference(array,slice(arguments,1))}function xor(){var index=-1,length=arguments.length;while(++index<length){var array=arguments[index];if(isArray(array)||isArguments(array)){var result=result?baseUniq(baseDifference(result,array).concat(baseDifference(array,result))):array}}return result||[]}function zip(){var array=arguments.length>1?arguments:arguments[0],index=-1,length=array?max(pluck(array,"length")):0,result=Array(length<0?0:length);while(++index<length){result[index]=pluck(array,index)}return result}function zipObject(keys,values){var index=-1,length=keys?keys.length:0,result={};if(!values&&length&&!isArray(keys[0])){values=[]}while(++index<length){var key=keys[index];if(values){result[key]=values[index]}else if(key){result[key[0]]=key[1]}}return result}function after(n,func){if(!isFunction(func)){throw new TypeError}return function(){if(--n<1){return func.apply(this,arguments)}}}function bind(func,thisArg){return arguments.length>2?createWrapper(func,17,slice(arguments,2),null,thisArg):createWrapper(func,1,null,null,thisArg)}function bindAll(object){var funcs=arguments.length>1?baseFlatten(arguments,true,false,1):functions(object),index=-1,length=funcs.length;while(++index<length){var key=funcs[index];object[key]=createWrapper(object[key],1,null,null,object)}return object}function bindKey(object,key){return arguments.length>2?createWrapper(key,19,slice(arguments,2),null,object):createWrapper(key,3,null,null,object)}function compose(){var funcs=arguments,length=funcs.length;while(length--){if(!isFunction(funcs[length])){throw new TypeError}}return function(){var args=arguments,length=funcs.length;while(length--){args=[funcs[length].apply(this,args)]}return args[0]}}function curry(func,arity){arity=typeof arity=="number"?arity:+arity||func.length;return createWrapper(func,4,null,null,null,arity)}function debounce(func,wait,options){var args,maxTimeoutId,result,stamp,thisArg,timeoutId,trailingCall,lastCalled=0,maxWait=false,trailing=true;if(!isFunction(func)){throw new TypeError}wait=nativeMax(0,wait)||0;if(options===true){var leading=true;trailing=false}else if(isObject(options)){leading=options.leading;maxWait="maxWait"in options&&(nativeMax(wait,options.maxWait)||0);trailing="trailing"in options?options.trailing:trailing}var delayed=function(){var remaining=wait-(now()-stamp);if(remaining<=0){if(maxTimeoutId){clearTimeout(maxTimeoutId)}var isCalled=trailingCall;maxTimeoutId=timeoutId=trailingCall=undefined;if(isCalled){lastCalled=now();result=func.apply(thisArg,args);if(!timeoutId&&!maxTimeoutId){args=thisArg=null}}}else{timeoutId=setTimeout(delayed,remaining)}};var maxDelayed=function(){if(timeoutId){clearTimeout(timeoutId)}maxTimeoutId=timeoutId=trailingCall=undefined;if(trailing||maxWait!==wait){lastCalled=now();result=func.apply(thisArg,args);if(!timeoutId&&!maxTimeoutId){args=thisArg=null}}};return function(){args=arguments;stamp=now();thisArg=this;trailingCall=trailing&&(timeoutId||!leading);if(maxWait===false){var leadingCall=leading&&!timeoutId}else{if(!maxTimeoutId&&!leading){lastCalled=stamp}var remaining=maxWait-(stamp-lastCalled),isCalled=remaining<=0;if(isCalled){if(maxTimeoutId){maxTimeoutId=clearTimeout(maxTimeoutId)}lastCalled=stamp;result=func.apply(thisArg,args)}else if(!maxTimeoutId){maxTimeoutId=setTimeout(maxDelayed,remaining)}}if(isCalled&&timeoutId){timeoutId=clearTimeout(timeoutId)}else if(!timeoutId&&wait!==maxWait){timeoutId=setTimeout(delayed,wait)}if(leadingCall){isCalled=true;result=func.apply(thisArg,args)}if(isCalled&&!timeoutId&&!maxTimeoutId){args=thisArg=null}return result}}function defer(func){if(!isFunction(func)){throw new TypeError}var args=slice(arguments,1);return setTimeout(function(){func.apply(undefined,args)},1)}function delay(func,wait){if(!isFunction(func)){throw new TypeError}var args=slice(arguments,2);return setTimeout(function(){func.apply(undefined,args)},wait)}function memoize(func,resolver){if(!isFunction(func)){throw new TypeError}var memoized=function(){var cache=memoized.cache,key=resolver?resolver.apply(this,arguments):keyPrefix+arguments[0];return hasOwnProperty.call(cache,key)?cache[key]:cache[key]=func.apply(this,arguments)};memoized.cache={};return memoized}function once(func){var ran,result;if(!isFunction(func)){throw new TypeError}return function(){if(ran){return result}ran=true;result=func.apply(this,arguments);func=null;return result}}function partial(func){return createWrapper(func,16,slice(arguments,1))}function partialRight(func){return createWrapper(func,32,null,slice(arguments,1))}function throttle(func,wait,options){var leading=true,trailing=true;if(!isFunction(func)){throw new TypeError}if(options===false){leading=false}else if(isObject(options)){leading="leading"in options?options.leading:leading;trailing="trailing"in options?options.trailing:trailing}debounceOptions.leading=leading;debounceOptions.maxWait=wait;debounceOptions.trailing=trailing;return debounce(func,wait,debounceOptions)}function wrap(value,wrapper){return createWrapper(wrapper,16,[value])}function constant(value){return function(){return value}}function createCallback(func,thisArg,argCount){var type=typeof func;if(func==null||type=="function"){return baseCreateCallback(func,thisArg,argCount)}if(type!="object"){return property(func)}var props=keys(func),key=props[0],a=func[key];if(props.length==1&&a===a&&!isObject(a)){return function(object){var b=object[key];return a===b&&(a!==0||1/a==1/b)}}return function(object){var length=props.length,result=false;while(length--){if(!(result=baseIsEqual(object[props[length]],func[props[length]],null,true))){break}}return result}}function escape(string){return string==null?"":String(string).replace(reUnescapedHtml,escapeHtmlChar)}function identity(value){return value}function mixin(object,source,options){var chain=true,methodNames=source&&functions(source);if(!source||!options&&!methodNames.length){if(options==null){options=source}ctor=lodashWrapper;source=object;object=lodash;methodNames=functions(source)}if(options===false){chain=false}else if(isObject(options)&&"chain"in options){chain=options.chain}var ctor=object,isFunc=isFunction(ctor);forEach(methodNames,function(methodName){var func=object[methodName]=source[methodName];if(isFunc){ctor.prototype[methodName]=function(){var chainAll=this.__chain__,value=this.__wrapped__,args=[value];push.apply(args,arguments);var result=func.apply(object,args);if(chain||chainAll){if(value===result&&isObject(result)){return this}result=new ctor(result);result.__chain__=chainAll}return result}}})}function noConflict(){context._=oldDash;return this}function noop(){}var now=isNative(now=Date.now)&&now||function(){return(new Date).getTime()};var parseInt=nativeParseInt(whitespace+"08")==8?nativeParseInt:function(value,radix){return nativeParseInt(isString(value)?value.replace(reLeadingSpacesAndZeros,""):value,radix||0)};function property(key){return function(object){return object[key]}}function random(min,max,floating){var noMin=min==null,noMax=max==null;if(floating==null){if(typeof min=="boolean"&&noMax){floating=min;min=1}else if(!noMax&&typeof max=="boolean"){floating=max;noMax=true}}if(noMin&&noMax){max=1}min=+min||0;if(noMax){max=min;min=0}else{max=+max||0}if(floating||min%1||max%1){var rand=nativeRandom();return nativeMin(min+rand*(max-min+parseFloat("1e-"+((rand+"").length-1))),max)}return baseRandom(min,max)}function result(object,key){if(object){var value=object[key];return isFunction(value)?object[key]():value}}function template(text,data,options){var settings=lodash.templateSettings;text=String(text||"");options=defaults({},options,settings);var imports=defaults({},options.imports,settings.imports),importsKeys=keys(imports),importsValues=values(imports);var isEvaluating,index=0,interpolate=options.interpolate||reNoMatch,source="__p += '";var reDelimiters=RegExp((options.escape||reNoMatch).source+"|"+interpolate.source+"|"+(interpolate===reInterpolate?reEsTemplate:reNoMatch).source+"|"+(options.evaluate||reNoMatch).source+"|$","g");text.replace(reDelimiters,function(match,escapeValue,interpolateValue,esTemplateValue,evaluateValue,offset){interpolateValue||(interpolateValue=esTemplateValue);source+=text.slice(index,offset).replace(reUnescapedString,escapeStringChar);if(escapeValue){source+="' +\n__e("+escapeValue+") +\n'"}if(evaluateValue){isEvaluating=true;source+="';\n"+evaluateValue+";\n__p += '"}if(interpolateValue){source+="' +\n((__t = ("+interpolateValue+")) == null ? '' : __t) +\n'"}index=offset+match.length;return match});source+="';\n";var variable=options.variable,hasVariable=variable;if(!hasVariable){variable="obj";source="with ("+variable+") {\n"+source+"\n}\n"}source=(isEvaluating?source.replace(reEmptyStringLeading,""):source).replace(reEmptyStringMiddle,"$1").replace(reEmptyStringTrailing,"$1;");source="function("+variable+") {\n"+(hasVariable?"":variable+" || ("+variable+" = {});\n")+"var __t, __p = '', __e = _.escape"+(isEvaluating?", __j = Array.prototype.join;\n"+"function print() { __p += __j.call(arguments, '') }\n":";\n")+source+"return __p\n}";var sourceURL="\n/*\n//# sourceURL="+(options.sourceURL||"/lodash/template/source["+templateCounter++ +"]")+"\n*/";try{var result=Function(importsKeys,"return "+source+sourceURL).apply(undefined,importsValues)}catch(e){e.source=source;throw e}if(data){return result(data)}result.source=source;return result}function times(n,callback,thisArg){n=(n=+n)>-1?n:0;var index=-1,result=Array(n);callback=baseCreateCallback(callback,thisArg,1);while(++index<n){result[index]=callback(index)}return result}function unescape(string){return string==null?"":String(string).replace(reEscapedHtml,unescapeHtmlChar)}function uniqueId(prefix){var id=++idCounter;return String(prefix==null?"":prefix)+id}function chain(value){value=new lodashWrapper(value);value.__chain__=true;return value}function tap(value,interceptor){interceptor(value);return value}function wrapperChain(){this.__chain__=true;return this}function wrapperToString(){return String(this.__wrapped__)}function wrapperValueOf(){return this.__wrapped__}lodash.after=after;lodash.assign=assign;lodash.at=at;lodash.bind=bind;lodash.bindAll=bindAll;lodash.bindKey=bindKey;lodash.chain=chain;lodash.compact=compact;lodash.compose=compose;lodash.constant=constant;lodash.countBy=countBy;lodash.create=create;lodash.createCallback=createCallback;lodash.curry=curry;lodash.debounce=debounce;lodash.defaults=defaults;lodash.defer=defer;lodash.delay=delay;lodash.difference=difference;lodash.filter=filter;lodash.flatten=flatten;lodash.forEach=forEach;lodash.forEachRight=forEachRight;lodash.forIn=forIn;lodash.forInRight=forInRight;lodash.forOwn=forOwn;lodash.forOwnRight=forOwnRight;lodash.functions=functions;lodash.groupBy=groupBy;lodash.indexBy=indexBy;lodash.initial=initial;lodash.intersection=intersection;lodash.invert=invert;lodash.invoke=invoke;lodash.keys=keys;lodash.map=map;lodash.mapValues=mapValues;lodash.max=max;lodash.memoize=memoize;lodash.merge=merge;lodash.min=min;lodash.omit=omit;lodash.once=once;lodash.pairs=pairs;lodash.partial=partial;lodash.partialRight=partialRight;lodash.pick=pick;lodash.pluck=pluck;lodash.property=property;lodash.pull=pull;lodash.range=range;lodash.reject=reject;lodash.remove=remove;lodash.rest=rest;lodash.shuffle=shuffle;lodash.sortBy=sortBy;lodash.tap=tap;lodash.throttle=throttle;lodash.times=times;lodash.toArray=toArray;lodash.transform=transform;lodash.union=union;lodash.uniq=uniq;lodash.values=values;lodash.where=where;lodash.without=without;lodash.wrap=wrap;lodash.xor=xor;lodash.zip=zip;lodash.zipObject=zipObject;lodash.collect=map;lodash.drop=rest;lodash.each=forEach;lodash.eachRight=forEachRight;lodash.extend=assign;lodash.methods=functions;lodash.object=zipObject;lodash.select=filter;lodash.tail=rest;lodash.unique=uniq;lodash.unzip=zip;mixin(lodash);lodash.clone=clone;lodash.cloneDeep=cloneDeep;lodash.contains=contains;lodash.escape=escape;lodash.every=every;lodash.find=find;lodash.findIndex=findIndex;lodash.findKey=findKey;lodash.findLast=findLast;lodash.findLastIndex=findLastIndex;lodash.findLastKey=findLastKey;lodash.has=has;lodash.identity=identity;lodash.indexOf=indexOf;lodash.isArguments=isArguments;lodash.isArray=isArray;lodash.isBoolean=isBoolean;lodash.isDate=isDate;lodash.isElement=isElement;lodash.isEmpty=isEmpty;lodash.isEqual=isEqual;lodash.isFinite=isFinite;lodash.isFunction=isFunction;lodash.isNaN=isNaN;lodash.isNull=isNull;lodash.isNumber=isNumber;lodash.isObject=isObject;lodash.isPlainObject=isPlainObject;lodash.isRegExp=isRegExp;lodash.isString=isString;lodash.isUndefined=isUndefined;lodash.lastIndexOf=lastIndexOf;lodash.mixin=mixin;lodash.noConflict=noConflict;lodash.noop=noop;lodash.now=now;lodash.parseInt=parseInt;lodash.random=random;lodash.reduce=reduce;lodash.reduceRight=reduceRight;lodash.result=result;lodash.runInContext=runInContext;lodash.size=size;lodash.some=some;lodash.sortedIndex=sortedIndex;lodash.template=template;lodash.unescape=unescape;lodash.uniqueId=uniqueId;lodash.all=every;lodash.any=some;lodash.detect=find;lodash.findWhere=find;lodash.foldl=reduce;lodash.foldr=reduceRight;lodash.include=contains;lodash.inject=reduce;mixin(function(){var source={};forOwn(lodash,function(func,methodName){if(!lodash.prototype[methodName]){source[methodName]=func}});return source}(),false);lodash.first=first;lodash.last=last;lodash.sample=sample;lodash.take=first;lodash.head=first;forOwn(lodash,function(func,methodName){var callbackable=methodName!=="sample";if(!lodash.prototype[methodName]){lodash.prototype[methodName]=function(n,guard){var chainAll=this.__chain__,result=func(this.__wrapped__,n,guard);return!chainAll&&(n==null||guard&&!(callbackable&&typeof n=="function"))?result:new lodashWrapper(result,chainAll)}}});lodash.VERSION="2.4.1";lodash.prototype.chain=wrapperChain;lodash.prototype.toString=wrapperToString;lodash.prototype.value=wrapperValueOf;lodash.prototype.valueOf=wrapperValueOf;forEach(["join","pop","shift"],function(methodName){var func=arrayRef[methodName];lodash.prototype[methodName]=function(){var chainAll=this.__chain__,result=func.apply(this.__wrapped__,arguments);return chainAll?new lodashWrapper(result,chainAll):result}});forEach(["push","reverse","sort","unshift"],function(methodName){var func=arrayRef[methodName];lodash.prototype[methodName]=function(){func.apply(this.__wrapped__,arguments);return this}});forEach(["concat","slice","splice"],function(methodName){var func=arrayRef[methodName];lodash.prototype[methodName]=function(){return new lodashWrapper(func.apply(this.__wrapped__,arguments),this.__chain__)}});return lodash}var _=runInContext();if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){root._=_;define(function(){return _})}else if(freeExports&&freeModule){if(moduleExports){(freeModule.exports=_)._=_}else{freeExports._=_}}else{root._=_}}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],128:[function(require,module,exports){"use strict";var originalObject=Object;var originalDefProp=Object.defineProperty;var originalCreate=Object.create;function defProp(obj,name,value){if(originalDefProp)try{originalDefProp.call(originalObject,obj,name,{value:value})}catch(definePropertyIsBrokenInIE8){obj[name]=value}else{obj[name]=value}}function makeSafeToCall(fun){if(fun){defProp(fun,"call",fun.call);defProp(fun,"apply",fun.apply)}return fun}makeSafeToCall(originalDefProp);makeSafeToCall(originalCreate);var hasOwn=makeSafeToCall(Object.prototype.hasOwnProperty);var numToStr=makeSafeToCall(Number.prototype.toString);var strSlice=makeSafeToCall(String.prototype.slice);var cloner=function(){};function create(prototype){if(originalCreate){return originalCreate.call(originalObject,prototype)}cloner.prototype=prototype||null;return new cloner}var rand=Math.random;var uniqueKeys=create(null);function makeUniqueKey(){do var uniqueKey=internString(strSlice.call(numToStr.call(rand(),36),2));while(hasOwn.call(uniqueKeys,uniqueKey));return uniqueKeys[uniqueKey]=uniqueKey}function internString(str){var obj={};obj[str]=true;return Object.keys(obj)[0]}defProp(exports,"makeUniqueKey",makeUniqueKey);var originalGetOPNs=Object.getOwnPropertyNames;Object.getOwnPropertyNames=function getOwnPropertyNames(object){for(var names=originalGetOPNs(object),src=0,dst=0,len=names.length;src<len;++src){if(!hasOwn.call(uniqueKeys,names[src])){if(src>dst){names[dst]=names[src]}++dst}}names.length=dst;return names};function defaultCreatorFn(object){return create(null)}function makeAccessor(secretCreatorFn){var brand=makeUniqueKey();var passkey=create(null);secretCreatorFn=secretCreatorFn||defaultCreatorFn;function register(object){var secret;function vault(key,forget){if(key===passkey){return forget?secret=null:secret||(secret=secretCreatorFn(object))}}defProp(object,brand,vault)}function accessor(object){if(!hasOwn.call(object,brand))register(object);return object[brand](passkey)}accessor.forget=function(object){if(hasOwn.call(object,brand))object[brand](passkey,true)};return accessor}defProp(exports,"makeAccessor",makeAccessor)},{}],129:[function(require,module,exports){var assert=require("assert");var types=require("recast").types;var isArray=types.builtInTypes.array;var b=types.builders;var n=types.namedTypes;var leap=require("./leap");var meta=require("./meta");var util=require("./util");var runtimeKeysMethod=util.runtimeProperty("keys");var hasOwn=Object.prototype.hasOwnProperty;function Emitter(contextId){assert.ok(this instanceof Emitter);n.Identifier.assert(contextId);Object.defineProperties(this,{contextId:{value:contextId},listing:{value:[]},marked:{value:[true]},finalLoc:{value:loc()},tryEntries:{value:[]}});Object.defineProperties(this,{leapManager:{value:new leap.LeapManager(this)}})}var Ep=Emitter.prototype;exports.Emitter=Emitter;function loc(){return b.literal(-1)}Ep.mark=function(loc){n.Literal.assert(loc);var index=this.listing.length;if(loc.value===-1){loc.value=index}else{assert.strictEqual(loc.value,index)}this.marked[index]=true;return loc};Ep.emit=function(node){if(n.Expression.check(node))node=b.expressionStatement(node);n.Statement.assert(node);this.listing.push(node)};Ep.emitAssign=function(lhs,rhs){this.emit(this.assign(lhs,rhs));return lhs};Ep.assign=function(lhs,rhs){return b.expressionStatement(b.assignmentExpression("=",lhs,rhs))};Ep.contextProperty=function(name,computed){return b.memberExpression(this.contextId,computed?b.literal(name):b.identifier(name),!!computed)};var volatileContextPropertyNames={prev:true,next:true,sent:true,rval:true};Ep.isVolatileContextProperty=function(expr){if(n.MemberExpression.check(expr)){if(expr.computed){return true}if(n.Identifier.check(expr.object)&&n.Identifier.check(expr.property)&&expr.object.name===this.contextId.name&&hasOwn.call(volatileContextPropertyNames,expr.property.name)){return true}}return false};Ep.stop=function(rval){if(rval){this.setReturnValue(rval)}this.jump(this.finalLoc)};Ep.setReturnValue=function(valuePath){n.Expression.assert(valuePath.value);this.emitAssign(this.contextProperty("rval"),this.explodeExpression(valuePath))};Ep.clearPendingException=function(tryLoc,assignee){n.Literal.assert(tryLoc);var catchCall=b.callExpression(this.contextProperty("catch",true),[tryLoc]);if(assignee){this.emitAssign(assignee,catchCall)}else{this.emit(catchCall)}};Ep.jump=function(toLoc){this.emitAssign(this.contextProperty("next"),toLoc);this.emit(b.breakStatement())};Ep.jumpIf=function(test,toLoc){n.Expression.assert(test);
n.Literal.assert(toLoc);this.emit(b.ifStatement(test,b.blockStatement([this.assign(this.contextProperty("next"),toLoc),b.breakStatement()])))};Ep.jumpIfNot=function(test,toLoc){n.Expression.assert(test);n.Literal.assert(toLoc);var negatedTest;if(n.UnaryExpression.check(test)&&test.operator==="!"){negatedTest=test.argument}else{negatedTest=b.unaryExpression("!",test)}this.emit(b.ifStatement(negatedTest,b.blockStatement([this.assign(this.contextProperty("next"),toLoc),b.breakStatement()])))};var nextTempId=0;Ep.makeTempVar=function(){return this.contextProperty("t"+nextTempId++)};Ep.getContextFunction=function(id){return b.functionExpression(id||null,[this.contextId],b.blockStatement([this.getDispatchLoop()]),false,false)};Ep.getDispatchLoop=function(){var self=this;var cases=[];var current;var alreadyEnded=false;self.listing.forEach(function(stmt,i){if(self.marked.hasOwnProperty(i)){cases.push(b.switchCase(b.literal(i),current=[]));alreadyEnded=false}if(!alreadyEnded){current.push(stmt);if(isSwitchCaseEnder(stmt))alreadyEnded=true}});this.finalLoc.value=this.listing.length;cases.push(b.switchCase(this.finalLoc,[]),b.switchCase(b.literal("end"),[b.returnStatement(b.callExpression(this.contextProperty("stop"),[]))]));return b.whileStatement(b.literal(1),b.switchStatement(b.assignmentExpression("=",this.contextProperty("prev"),this.contextProperty("next")),cases))};function isSwitchCaseEnder(stmt){return n.BreakStatement.check(stmt)||n.ContinueStatement.check(stmt)||n.ReturnStatement.check(stmt)||n.ThrowStatement.check(stmt)}Ep.getTryEntryList=function(){if(this.tryEntries.length===0){return null}var lastLocValue=0;return b.arrayExpression(this.tryEntries.map(function(tryEntry){var thisLocValue=tryEntry.firstLoc.value;assert.ok(thisLocValue>=lastLocValue,"try entries out of order");lastLocValue=thisLocValue;var ce=tryEntry.catchEntry;var fe=tryEntry.finallyEntry;var triple=[tryEntry.firstLoc,ce?ce.firstLoc:null];if(fe){triple[2]=fe.firstLoc}return b.arrayExpression(triple)}))};Ep.explode=function(path,ignoreResult){assert.ok(path instanceof types.NodePath);var node=path.value;var self=this;n.Node.assert(node);if(n.Statement.check(node))return self.explodeStatement(path);if(n.Expression.check(node))return self.explodeExpression(path,ignoreResult);if(n.Declaration.check(node))throw getDeclError(node);switch(node.type){case"Program":return path.get("body").map(self.explodeStatement,self);case"VariableDeclarator":throw getDeclError(node);case"Property":case"SwitchCase":case"CatchClause":throw new Error(node.type+" nodes should be handled by their parents");default:throw new Error("unknown Node of type "+JSON.stringify(node.type))}};function getDeclError(node){return new Error("all declarations should have been transformed into "+"assignments before the Exploder began its work: "+JSON.stringify(node))}Ep.explodeStatement=function(path,labelId){assert.ok(path instanceof types.NodePath);var stmt=path.value;var self=this;n.Statement.assert(stmt);if(labelId){n.Identifier.assert(labelId)}else{labelId=null}if(n.BlockStatement.check(stmt)){return path.get("body").each(self.explodeStatement,self)}if(!meta.containsLeap(stmt)){self.emit(stmt);return}switch(stmt.type){case"ExpressionStatement":self.explodeExpression(path.get("expression"),true);break;case"LabeledStatement":self.explodeStatement(path.get("body"),stmt.label);break;case"WhileStatement":var before=loc();var after=loc();self.mark(before);self.jumpIfNot(self.explodeExpression(path.get("test")),after);self.leapManager.withEntry(new leap.LoopEntry(after,before,labelId),function(){self.explodeStatement(path.get("body"))});self.jump(before);self.mark(after);break;case"DoWhileStatement":var first=loc();var test=loc();var after=loc();self.mark(first);self.leapManager.withEntry(new leap.LoopEntry(after,test,labelId),function(){self.explode(path.get("body"))});self.mark(test);self.jumpIf(self.explodeExpression(path.get("test")),first);self.mark(after);break;case"ForStatement":var head=loc();var update=loc();var after=loc();if(stmt.init){self.explode(path.get("init"),true)}self.mark(head);if(stmt.test){self.jumpIfNot(self.explodeExpression(path.get("test")),after)}else{}self.leapManager.withEntry(new leap.LoopEntry(after,update,labelId),function(){self.explodeStatement(path.get("body"))});self.mark(update);if(stmt.update){self.explode(path.get("update"),true)}self.jump(head);self.mark(after);break;case"ForInStatement":n.Identifier.assert(stmt.left);var head=loc();var after=loc();var keyIterNextFn=self.makeTempVar();self.emitAssign(keyIterNextFn,b.callExpression(runtimeKeysMethod,[self.explodeExpression(path.get("right"))]));self.mark(head);var keyInfoTmpVar=self.makeTempVar();self.jumpIf(b.memberExpression(b.assignmentExpression("=",keyInfoTmpVar,b.callExpression(keyIterNextFn,[])),b.identifier("done"),false),after);self.emitAssign(stmt.left,b.memberExpression(keyInfoTmpVar,b.identifier("value"),false));self.leapManager.withEntry(new leap.LoopEntry(after,head,labelId),function(){self.explodeStatement(path.get("body"))});self.jump(head);self.mark(after);break;case"BreakStatement":self.emitAbruptCompletion({type:"break",target:self.leapManager.getBreakLoc(stmt.label)});break;case"ContinueStatement":self.emitAbruptCompletion({type:"continue",target:self.leapManager.getContinueLoc(stmt.label)});break;case"SwitchStatement":var disc=self.emitAssign(self.makeTempVar(),self.explodeExpression(path.get("discriminant")));var after=loc();var defaultLoc=loc();var condition=defaultLoc;var caseLocs=[];var cases=stmt.cases||[];for(var i=cases.length-1;i>=0;--i){var c=cases[i];n.SwitchCase.assert(c);if(c.test){condition=b.conditionalExpression(b.binaryExpression("===",disc,c.test),caseLocs[i]=loc(),condition)}else{caseLocs[i]=defaultLoc}}self.jump(self.explodeExpression(new types.NodePath(condition,path,"discriminant")));self.leapManager.withEntry(new leap.SwitchEntry(after),function(){path.get("cases").each(function(casePath){var c=casePath.value;var i=casePath.name;self.mark(caseLocs[i]);casePath.get("consequent").each(self.explodeStatement,self)})});self.mark(after);if(defaultLoc.value===-1){self.mark(defaultLoc);assert.strictEqual(after.value,defaultLoc.value)}break;case"IfStatement":var elseLoc=stmt.alternate&&loc();var after=loc();self.jumpIfNot(self.explodeExpression(path.get("test")),elseLoc||after);self.explodeStatement(path.get("consequent"));if(elseLoc){self.jump(after);self.mark(elseLoc);self.explodeStatement(path.get("alternate"))}self.mark(after);break;case"ReturnStatement":self.emitAbruptCompletion({type:"return",value:self.explodeExpression(path.get("argument"))});break;case"WithStatement":throw new Error(node.type+" not supported in generator functions.");case"TryStatement":var after=loc();var handler=stmt.handler;if(!handler&&stmt.handlers){handler=stmt.handlers[0]||null}var catchLoc=handler&&loc();var catchEntry=catchLoc&&new leap.CatchEntry(catchLoc,handler.param);var finallyLoc=stmt.finalizer&&loc();var finallyEntry=finallyLoc&&new leap.FinallyEntry(finallyLoc);var tryEntry=new leap.TryEntry(self.getUnmarkedCurrentLoc(),catchEntry,finallyEntry);self.tryEntries.push(tryEntry);self.updateContextPrevLoc(tryEntry.firstLoc);self.leapManager.withEntry(tryEntry,function(){self.explodeStatement(path.get("block"));if(catchLoc){if(finallyLoc){self.jump(finallyLoc)}else{self.jump(after)}self.updateContextPrevLoc(self.mark(catchLoc));var bodyPath=path.get("handler","body");var safeParam=self.makeTempVar();self.clearPendingException(tryEntry.firstLoc,safeParam);var catchScope=bodyPath.scope;var catchParamName=handler.param.name;n.CatchClause.assert(catchScope.node);assert.strictEqual(catchScope.lookup(catchParamName),catchScope);types.visit(bodyPath,{visitIdentifier:function(path){if(util.isReference(path,catchParamName)&&path.scope.lookup(catchParamName)===catchScope){return safeParam}this.traverse(path)},visitFunction:function(path){if(path.scope.declares(catchParamName)){return false}this.traverse(path)}});self.leapManager.withEntry(catchEntry,function(){self.explodeStatement(bodyPath)})}if(finallyLoc){self.updateContextPrevLoc(self.mark(finallyLoc));self.leapManager.withEntry(finallyEntry,function(){self.explodeStatement(path.get("finalizer"))});self.emit(b.callExpression(self.contextProperty("finish"),[finallyEntry.firstLoc]))}});self.mark(after);break;case"ThrowStatement":self.emit(b.throwStatement(self.explodeExpression(path.get("argument"))));break;default:throw new Error("unknown Statement of type "+JSON.stringify(stmt.type))}};Ep.emitAbruptCompletion=function(record){if(!isValidCompletion(record)){assert.ok(false,"invalid completion record: "+JSON.stringify(record))}assert.notStrictEqual(record.type,"normal","normal completions are not abrupt");var abruptArgs=[b.literal(record.type)];if(record.type==="break"||record.type==="continue"){n.Literal.assert(record.target);abruptArgs[1]=record.target}else if(record.type==="return"||record.type==="throw"){if(record.value){n.Expression.assert(record.value);abruptArgs[1]=record.value}}this.emit(b.returnStatement(b.callExpression(this.contextProperty("abrupt"),abruptArgs)))};function isValidCompletion(record){var type=record.type;if(type==="normal"){return!hasOwn.call(record,"target")}if(type==="break"||type==="continue"){return!hasOwn.call(record,"value")&&n.Literal.check(record.target)}if(type==="return"||type==="throw"){return hasOwn.call(record,"value")&&!hasOwn.call(record,"target")}return false}Ep.getUnmarkedCurrentLoc=function(){return b.literal(this.listing.length)};Ep.updateContextPrevLoc=function(loc){if(loc){n.Literal.assert(loc);if(loc.value===-1){loc.value=this.listing.length}else{assert.strictEqual(loc.value,this.listing.length)}}else{loc=this.getUnmarkedCurrentLoc()}this.emitAssign(this.contextProperty("prev"),loc)};Ep.explodeExpression=function(path,ignoreResult){assert.ok(path instanceof types.NodePath);var expr=path.value;if(expr){n.Expression.assert(expr)}else{return expr}var self=this;var result;function finish(expr){n.Expression.assert(expr);if(ignoreResult){self.emit(expr)}else{return expr}}if(!meta.containsLeap(expr)){return finish(expr)}var hasLeapingChildren=meta.containsLeap.onlyChildren(expr);function explodeViaTempVar(tempVar,childPath,ignoreChildResult){assert.ok(childPath instanceof types.NodePath);assert.ok(!ignoreChildResult||!tempVar,"Ignoring the result of a child expression but forcing it to "+"be assigned to a temporary variable?");var result=self.explodeExpression(childPath,ignoreChildResult);if(ignoreChildResult){}else if(tempVar||hasLeapingChildren&&(self.isVolatileContextProperty(result)||meta.hasSideEffects(result))){result=self.emitAssign(tempVar||self.makeTempVar(),result)}return result}switch(expr.type){case"MemberExpression":return finish(b.memberExpression(self.explodeExpression(path.get("object")),expr.computed?explodeViaTempVar(null,path.get("property")):expr.property,expr.computed));case"CallExpression":var oldCalleePath=path.get("callee");var newCallee=self.explodeExpression(oldCalleePath);if(!n.MemberExpression.check(oldCalleePath.node)&&n.MemberExpression.check(newCallee)){newCallee=b.sequenceExpression([b.literal(0),newCallee])}return finish(b.callExpression(newCallee,path.get("arguments").map(function(argPath){return explodeViaTempVar(null,argPath)})));case"NewExpression":return finish(b.newExpression(explodeViaTempVar(null,path.get("callee")),path.get("arguments").map(function(argPath){return explodeViaTempVar(null,argPath)})));case"ObjectExpression":return finish(b.objectExpression(path.get("properties").map(function(propPath){return b.property(propPath.value.kind,propPath.value.key,explodeViaTempVar(null,propPath.get("value")))})));case"ArrayExpression":return finish(b.arrayExpression(path.get("elements").map(function(elemPath){return explodeViaTempVar(null,elemPath)})));case"SequenceExpression":var lastIndex=expr.expressions.length-1;path.get("expressions").each(function(exprPath){if(exprPath.name===lastIndex){result=self.explodeExpression(exprPath,ignoreResult)}else{self.explodeExpression(exprPath,true)}});return result;case"LogicalExpression":var after=loc();if(!ignoreResult){result=self.makeTempVar()}var left=explodeViaTempVar(result,path.get("left"));if(expr.operator==="&&"){self.jumpIfNot(left,after)}else{assert.strictEqual(expr.operator,"||");self.jumpIf(left,after)}explodeViaTempVar(result,path.get("right"),ignoreResult);self.mark(after);return result;case"ConditionalExpression":var elseLoc=loc();var after=loc();var test=self.explodeExpression(path.get("test"));self.jumpIfNot(test,elseLoc);if(!ignoreResult){result=self.makeTempVar()}explodeViaTempVar(result,path.get("consequent"),ignoreResult);self.jump(after);self.mark(elseLoc);explodeViaTempVar(result,path.get("alternate"),ignoreResult);self.mark(after);return result;case"UnaryExpression":return finish(b.unaryExpression(expr.operator,self.explodeExpression(path.get("argument")),!!expr.prefix));case"BinaryExpression":return finish(b.binaryExpression(expr.operator,explodeViaTempVar(null,path.get("left")),explodeViaTempVar(null,path.get("right"))));case"AssignmentExpression":return finish(b.assignmentExpression(expr.operator,self.explodeExpression(path.get("left")),self.explodeExpression(path.get("right"))));case"UpdateExpression":return finish(b.updateExpression(expr.operator,self.explodeExpression(path.get("argument")),expr.prefix));case"YieldExpression":var after=loc();var arg=expr.argument&&self.explodeExpression(path.get("argument"));if(arg&&expr.delegate){var result=self.makeTempVar();self.emit(b.returnStatement(b.callExpression(self.contextProperty("delegateYield"),[arg,b.literal(result.property.name),after])));self.mark(after);return result}self.emitAssign(self.contextProperty("next"),after);self.emit(b.returnStatement(arg||null));self.mark(after);return self.contextProperty("sent");default:throw new Error("unknown Expression of type "+JSON.stringify(expr.type))}}},{"./leap":131,"./meta":132,"./util":133,assert:95,recast:160}],130:[function(require,module,exports){var assert=require("assert");var types=require("recast").types;var n=types.namedTypes;var b=types.builders;var hasOwn=Object.prototype.hasOwnProperty;exports.hoist=function(funPath){assert.ok(funPath instanceof types.NodePath);n.Function.assert(funPath.value);var vars={};function varDeclToExpr(vdec,includeIdentifiers){n.VariableDeclaration.assert(vdec);var exprs=[];vdec.declarations.forEach(function(dec){vars[dec.id.name]=dec.id;if(dec.init){exprs.push(b.assignmentExpression("=",dec.id,dec.init))}else if(includeIdentifiers){exprs.push(dec.id)}});if(exprs.length===0)return null;if(exprs.length===1)return exprs[0];return b.sequenceExpression(exprs)}types.visit(funPath.get("body"),{visitVariableDeclaration:function(path){var expr=varDeclToExpr(path.value,false);if(expr===null){path.replace()}else{return b.expressionStatement(expr)}return false},visitForStatement:function(path){var init=path.value.init;if(n.VariableDeclaration.check(init)){path.get("init").replace(varDeclToExpr(init,false))}this.traverse(path)},visitForInStatement:function(path){var left=path.value.left;if(n.VariableDeclaration.check(left)){path.get("left").replace(varDeclToExpr(left,true))}this.traverse(path)},visitFunctionDeclaration:function(path){var node=path.value;vars[node.id.name]=node.id;var parentNode=path.parent.node;var assignment=b.expressionStatement(b.assignmentExpression("=",node.id,b.functionExpression(node.id,node.params,node.body,node.generator,node.expression)));if(n.BlockStatement.check(path.parent.node)){path.parent.get("body").unshift(assignment);path.replace()}else{path.replace(assignment)}return false},visitFunctionExpression:function(path){return false}});var paramNames={};funPath.get("params").each(function(paramPath){var param=paramPath.value;if(n.Identifier.check(param)){paramNames[param.name]=param}else{}});var declarations=[];Object.keys(vars).forEach(function(name){if(!hasOwn.call(paramNames,name)){declarations.push(b.variableDeclarator(vars[name],null))}});if(declarations.length===0){return null}return b.variableDeclaration("var",declarations)}},{assert:95,recast:160}],131:[function(require,module,exports){var assert=require("assert");var types=require("recast").types;var n=types.namedTypes;var b=types.builders;var inherits=require("util").inherits;var hasOwn=Object.prototype.hasOwnProperty;function Entry(){assert.ok(this instanceof Entry)}function FunctionEntry(returnLoc){Entry.call(this);n.Literal.assert(returnLoc);Object.defineProperties(this,{returnLoc:{value:returnLoc}})}inherits(FunctionEntry,Entry);exports.FunctionEntry=FunctionEntry;function LoopEntry(breakLoc,continueLoc,label){Entry.call(this);n.Literal.assert(breakLoc);n.Literal.assert(continueLoc);if(label){n.Identifier.assert(label)}else{label=null}Object.defineProperties(this,{breakLoc:{value:breakLoc},continueLoc:{value:continueLoc},label:{value:label}})}inherits(LoopEntry,Entry);exports.LoopEntry=LoopEntry;function SwitchEntry(breakLoc){Entry.call(this);n.Literal.assert(breakLoc);Object.defineProperties(this,{breakLoc:{value:breakLoc}})}inherits(SwitchEntry,Entry);exports.SwitchEntry=SwitchEntry;function TryEntry(firstLoc,catchEntry,finallyEntry){Entry.call(this);n.Literal.assert(firstLoc);if(catchEntry){assert.ok(catchEntry instanceof CatchEntry)}else{catchEntry=null}if(finallyEntry){assert.ok(finallyEntry instanceof FinallyEntry)}else{finallyEntry=null}assert.ok(catchEntry||finallyEntry);Object.defineProperties(this,{firstLoc:{value:firstLoc},catchEntry:{value:catchEntry},finallyEntry:{value:finallyEntry}})}inherits(TryEntry,Entry);exports.TryEntry=TryEntry;function CatchEntry(firstLoc,paramId){Entry.call(this);n.Literal.assert(firstLoc);n.Identifier.assert(paramId);Object.defineProperties(this,{firstLoc:{value:firstLoc},paramId:{value:paramId}})}inherits(CatchEntry,Entry);exports.CatchEntry=CatchEntry;function FinallyEntry(firstLoc){Entry.call(this);n.Literal.assert(firstLoc);Object.defineProperties(this,{firstLoc:{value:firstLoc}})}inherits(FinallyEntry,Entry);exports.FinallyEntry=FinallyEntry;function LeapManager(emitter){assert.ok(this instanceof LeapManager);var Emitter=require("./emit").Emitter;assert.ok(emitter instanceof Emitter);Object.defineProperties(this,{emitter:{value:emitter},entryStack:{value:[new FunctionEntry(emitter.finalLoc)]}})}var LMp=LeapManager.prototype;exports.LeapManager=LeapManager;LMp.withEntry=function(entry,callback){assert.ok(entry instanceof Entry);this.entryStack.push(entry);try{callback.call(this.emitter)}finally{var popped=this.entryStack.pop();assert.strictEqual(popped,entry)}};LMp._findLeapLocation=function(property,label){for(var i=this.entryStack.length-1;i>=0;--i){var entry=this.entryStack[i];var loc=entry[property];if(loc){if(label){if(entry.label&&entry.label.name===label.name){return loc}}else{return loc}}}return null};LMp.getBreakLoc=function(label){return this._findLeapLocation("breakLoc",label)};LMp.getContinueLoc=function(label){return this._findLeapLocation("continueLoc",label)}},{"./emit":129,assert:95,recast:160,util:119}],132:[function(require,module,exports){var assert=require("assert");var m=require("private").makeAccessor();var types=require("recast").types;var isArray=types.builtInTypes.array;var n=types.namedTypes;var hasOwn=Object.prototype.hasOwnProperty;function makePredicate(propertyName,knownTypes){function onlyChildren(node){n.Node.assert(node);var result=false;function check(child){if(result){}else if(isArray.check(child)){child.some(check)}else if(n.Node.check(child)){assert.strictEqual(result,false);result=predicate(child)}return result}types.eachField(node,function(name,child){check(child)});return result}function predicate(node){n.Node.assert(node);var meta=m(node);if(hasOwn.call(meta,propertyName))return meta[propertyName];if(hasOwn.call(opaqueTypes,node.type))return meta[propertyName]=false;if(hasOwn.call(knownTypes,node.type))return meta[propertyName]=true;return meta[propertyName]=onlyChildren(node)}predicate.onlyChildren=onlyChildren;return predicate}var opaqueTypes={FunctionExpression:true};var sideEffectTypes={CallExpression:true,ForInStatement:true,UnaryExpression:true,BinaryExpression:true,AssignmentExpression:true,UpdateExpression:true,NewExpression:true};var leapTypes={YieldExpression:true,BreakStatement:true,ContinueStatement:true,ReturnStatement:true,ThrowStatement:true};for(var type in leapTypes){if(hasOwn.call(leapTypes,type)){sideEffectTypes[type]=leapTypes[type]}}exports.hasSideEffects=makePredicate("hasSideEffects",sideEffectTypes);exports.containsLeap=makePredicate("containsLeap",leapTypes)},{assert:95,"private":128,recast:160}],133:[function(require,module,exports){var assert=require("assert");var types=require("recast").types;var n=types.namedTypes;var b=types.builders;var hasOwn=Object.prototype.hasOwnProperty;exports.defaults=function(obj){var len=arguments.length;var extension;for(var i=1;i<len;++i){if(extension=arguments[i]){for(var key in extension){if(hasOwn.call(extension,key)&&!hasOwn.call(obj,key)){obj[key]=extension[key]}}}}return obj};exports.runtimeProperty=function(name){return b.memberExpression(b.identifier("regeneratorRuntime"),b.identifier(name),false)};exports.isReference=function(path,name){var node=path.value;if(!n.Identifier.check(node)){return false}if(name&&node.name!==name){return false}var parent=path.parent.value;switch(parent.type){case"VariableDeclarator":return path.name==="init";case"MemberExpression":return path.name==="object"||parent.computed&&path.name==="property";case"FunctionExpression":case"FunctionDeclaration":case"ArrowFunctionExpression":if(path.name==="id"){return false}if(parent.params===path.parentPath&&parent.params[path.name]===node){return false}return true;case"ClassDeclaration":case"ClassExpression":return path.name!=="id";case"CatchClause":return path.name!=="param";case"Property":case"MethodDefinition":return path.name!=="key";case"ImportSpecifier":case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":case"LabeledStatement":return false;default:return true}}},{assert:95,recast:160}],134:[function(require,module,exports){var assert=require("assert");var fs=require("fs");var recast=require("recast");var types=recast.types;var n=types.namedTypes;var b=types.builders;var isArray=types.builtInTypes.array;var isObject=types.builtInTypes.object;var NodePath=types.NodePath;var hoist=require("./hoist").hoist;var Emitter=require("./emit").Emitter;var runtimeProperty=require("./util").runtimeProperty;var runtimeWrapMethod=runtimeProperty("wrap");var runtimeMarkMethod=runtimeProperty("mark");var runtimeValuesMethod=runtimeProperty("values");var runtimeAsyncMethod=runtimeProperty("async");exports.transform=function transform(node,options){options=options||{};node=recast.visit(node,visitor);if(options.includeRuntime===true||options.includeRuntime==="if used"&&visitor.wasChangeReported()){injectRuntime(n.File.check(node)?node.program:node)}options.madeChanges=visitor.wasChangeReported();return node};function injectRuntime(program){n.Program.assert(program);var runtimePath=require("..").runtime.path;var runtime=fs.readFileSync(runtimePath,"utf8");var runtimeBody=recast.parse(runtime,{sourceFileName:runtimePath}).program.body;var body=program.body;body.unshift.apply(body,runtimeBody)}var visitor=types.PathVisitor.fromMethodsObject({visitFunction:function(path){this.traverse(path);var node=path.value;if(!node.generator&&!node.async){return}this.reportChanged();node.generator=false;if(node.expression){node.expression=false;node.body=b.blockStatement([b.returnStatement(node.body)])}if(node.async){awaitVisitor.visit(path.get("body"))}var outerFnId=node.id||(node.id=path.scope.parent.declareTemporary("callee$"));var innerFnId=b.identifier(node.id.name+"$");var contextId=path.scope.declareTemporary("context$");var argsId=path.scope.declareTemporary("args$");var shouldAliasArguments=renameArguments(path,argsId);var vars=hoist(path);if(shouldAliasArguments){vars=vars||b.variableDeclaration("var",[]);vars.declarations.push(b.variableDeclarator(argsId,b.identifier("arguments")))}var emitter=new Emitter(contextId);emitter.explode(path.get("body"));var outerBody=[];if(vars&&vars.declarations.length>0){outerBody.push(vars)}var wrapArgs=[emitter.getContextFunction(innerFnId),node.async?b.literal(null):outerFnId,b.thisExpression()];var tryEntryList=emitter.getTryEntryList();if(tryEntryList){wrapArgs.push(tryEntryList)}var wrapCall=b.callExpression(node.async?runtimeAsyncMethod:runtimeWrapMethod,wrapArgs);outerBody.push(b.returnStatement(wrapCall));node.body=b.blockStatement(outerBody);if(node.async){node.async=false;return}if(n.FunctionDeclaration.check(node)){var pp=path.parent;while(pp&&!(n.BlockStatement.check(pp.value)||n.Program.check(pp.value))){pp=pp.parent}if(!pp){return}path.replace();node.type="FunctionExpression";var varDecl=b.variableDeclaration("var",[b.variableDeclarator(node.id,b.callExpression(runtimeMarkMethod,[node]))]);if(node.comments){varDecl.comments=node.comments;node.comments=null}var bodyPath=pp.get("body");var bodyLen=bodyPath.value.length;for(var i=0;i<bodyLen;++i){var firstStmtPath=bodyPath.get(i);if(!shouldNotHoistAbove(firstStmtPath)){firstStmtPath.insertBefore(varDecl);return}}bodyPath.push(varDecl)}else{n.FunctionExpression.assert(node);return b.callExpression(runtimeMarkMethod,[node])}},visitForOfStatement:function(path){this.traverse(path);var node=path.value;var tempIterId=path.scope.declareTemporary("t$");var tempIterDecl=b.variableDeclarator(tempIterId,b.callExpression(runtimeValuesMethod,[node.right]));var tempInfoId=path.scope.declareTemporary("t$");var tempInfoDecl=b.variableDeclarator(tempInfoId,null);var init=node.left;var loopId;if(n.VariableDeclaration.check(init)){loopId=init.declarations[0].id;init.declarations.push(tempIterDecl,tempInfoDecl)}else{loopId=init;init=b.variableDeclaration("var",[tempIterDecl,tempInfoDecl])}n.Identifier.assert(loopId);var loopIdAssignExprStmt=b.expressionStatement(b.assignmentExpression("=",loopId,b.memberExpression(tempInfoId,b.identifier("value"),false)));if(n.BlockStatement.check(node.body)){node.body.body.unshift(loopIdAssignExprStmt)}else{node.body=b.blockStatement([loopIdAssignExprStmt,node.body])}return b.forStatement(init,b.unaryExpression("!",b.memberExpression(b.assignmentExpression("=",tempInfoId,b.callExpression(b.memberExpression(tempIterId,b.identifier("next"),false),[])),b.identifier("done"),false)),null,node.body)}});function shouldNotHoistAbove(stmtPath){var value=stmtPath.value;n.Statement.assert(value);if(n.ExpressionStatement.check(value)&&n.Literal.check(value.expression)&&value.expression.value==="use strict"){return true}if(n.VariableDeclaration.check(value)){for(var i=0;i<value.declarations.length;++i){var decl=value.declarations[i];if(n.CallExpression.check(decl.init)&&types.astNodesAreEquivalent(decl.init.callee,runtimeMarkMethod)){return true}}}return false}function renameArguments(funcPath,argsId){assert.ok(funcPath instanceof types.NodePath);var func=funcPath.value;var didReplaceArguments=false;var hasImplicitArguments=false;recast.visit(funcPath,{visitFunction:function(path){if(path.value===func){hasImplicitArguments=!path.scope.lookup("arguments");this.traverse(path)}else{return false}},visitIdentifier:function(path){if(path.value.name==="arguments"){var isMemberProperty=n.MemberExpression.check(path.parent.node)&&path.name==="property"&&!path.parent.node.computed;if(!isMemberProperty){path.replace(argsId);didReplaceArguments=true;return false}}this.traverse(path)}});return didReplaceArguments&&hasImplicitArguments}var awaitVisitor=types.PathVisitor.fromMethodsObject({visitFunction:function(path){return false},visitAwaitExpression:function(path){return b.yieldExpression(path.value.argument,false)}})},{"..":135,"./emit":129,"./hoist":130,"./util":133,assert:95,fs:94,recast:160}],135:[function(require,module,exports){(function(__dirname){var assert=require("assert");var path=require("path");var fs=require("fs");var through=require("through");var transform=require("./lib/visit").transform;var utils=require("./lib/util");var recast=require("recast");var types=recast.types;var genOrAsyncFunExp=/\bfunction\s*\*|\basync\b/;var blockBindingExp=/\b(let|const)\s+/;function exports(file,options){var data=[];return through(write,end);function write(buf){data.push(buf)}function end(){this.queue(compile(data.join(""),options).code);this.queue(null)}}module.exports=exports;function runtime(){require("./runtime")}exports.runtime=runtime;runtime.path=path.join(__dirname,"runtime.js");function compile(source,options){options=normalizeOptions(options);if(!genOrAsyncFunExp.test(source)){return{code:(options.includeRuntime===true?fs.readFileSync(runtime.path,"utf-8")+"\n":"")+source}}var recastOptions=getRecastOptions(options);var ast=recast.parse(source,recastOptions);var path=new types.NodePath(ast);var programPath=path.get("program");if(shouldVarify(source,options)){varifyAst(programPath.node)}transform(programPath,options);return recast.print(path,recastOptions)}function normalizeOptions(options){options=utils.defaults(options||{},{includeRuntime:false,supportBlockBinding:true});if(!options.esprima){options.esprima=require("esprima-fb")}assert.ok(/harmony/.test(options.esprima.version),"Bad esprima version: "+options.esprima.version);return options}function getRecastOptions(options){var recastOptions={range:true};function copy(name){if(name in options){recastOptions[name]=options[name]}}copy("esprima");copy("sourceFileName");copy("sourceMapName");copy("inputSourceMap");copy("sourceRoot");return recastOptions}function shouldVarify(source,options){var supportBlockBinding=!!options.supportBlockBinding;if(supportBlockBinding){if(!blockBindingExp.test(source)){supportBlockBinding=false}}return supportBlockBinding}function varify(source,options){var recastOptions=getRecastOptions(normalizeOptions(options));var ast=recast.parse(source,recastOptions);varifyAst(ast.program);return recast.print(ast,recastOptions).code}function varifyAst(ast){types.namedTypes.Program.assert(ast);var defsResult=require("defs")(ast,{ast:true,disallowUnknownReferences:false,disallowDuplicated:false,disallowVars:false,loopClosures:"iife"});if(defsResult.errors){throw new Error(defsResult.errors.join("\n"))}return ast}exports.varify=varify;exports.compile=compile;exports.transform=transform}).call(this,"/node_modules/regenerator")},{"./lib/util":133,"./lib/visit":134,"./runtime":162,assert:95,defs:136,"esprima-fb":150,fs:94,path:103,recast:160,through:161}],136:[function(require,module,exports){"use strict";var assert=require("assert");var is=require("simple-is");var fmt=require("simple-fmt");var stringmap=require("stringmap");var stringset=require("stringset");var alter=require("alter");var traverse=require("ast-traverse");var breakable=require("breakable");var Scope=require("./scope");var error=require("./error");var getline=error.getline;var options=require("./options");var Stats=require("./stats");var jshint_vars=require("./jshint_globals/vars.js");function isConstLet(kind){return is.someof(kind,["const","let"])}function isVarConstLet(kind){return is.someof(kind,["var","const","let"])}function isNonFunctionBlock(node){return node.type==="BlockStatement"&&is.noneof(node.$parent.type,["FunctionDeclaration","FunctionExpression"])}function isForWithConstLet(node){return node.type==="ForStatement"&&node.init&&node.init.type==="VariableDeclaration"&&isConstLet(node.init.kind)}function isForInOfWithConstLet(node){return isForInOf(node)&&node.left.type==="VariableDeclaration"&&isConstLet(node.left.kind)}function isForInOf(node){return is.someof(node.type,["ForInStatement","ForOfStatement"])}function isFunction(node){return is.someof(node.type,["FunctionDeclaration","FunctionExpression"])}function isLoop(node){return is.someof(node.type,["ForStatement","ForInStatement","ForOfStatement","WhileStatement","DoWhileStatement"])}function isReference(node){var parent=node.$parent;return node.$refToScope||node.type==="Identifier"&&!(parent.type==="VariableDeclarator"&&parent.id===node)&&!(parent.type==="MemberExpression"&&parent.computed===false&&parent.property===node)&&!(parent.type==="Property"&&parent.key===node)&&!(parent.type==="LabeledStatement"&&parent.label===node)&&!(parent.type==="CatchClause"&&parent.param===node)&&!(isFunction(parent)&&parent.id===node)&&!(isFunction(parent)&&is.someof(node,parent.params))&&true
}function isLvalue(node){return isReference(node)&&(node.$parent.type==="AssignmentExpression"&&node.$parent.left===node||node.$parent.type==="UpdateExpression"&&node.$parent.argument===node)}function createScopes(node,parent){assert(!node.$scope);node.$parent=parent;node.$scope=node.$parent?node.$parent.$scope:null;if(node.type==="Program"){node.$scope=new Scope({kind:"hoist",node:node,parent:null})}else if(isFunction(node)){node.$scope=new Scope({kind:"hoist",node:node,parent:node.$parent.$scope});if(node.id){assert(node.id.type==="Identifier");if(node.type==="FunctionDeclaration"){node.$parent.$scope.add(node.id.name,"fun",node.id,null)}else if(node.type==="FunctionExpression"){node.$scope.add(node.id.name,"fun",node.id,null)}else{assert(false)}}node.params.forEach(function(param){node.$scope.add(param.name,"param",param,null)})}else if(node.type==="VariableDeclaration"){assert(isVarConstLet(node.kind));node.declarations.forEach(function(declarator){assert(declarator.type==="VariableDeclarator");var name=declarator.id.name;if(options.disallowVars&&node.kind==="var"){error(getline(declarator),"var {0} is not allowed (use let or const)",name)}node.$scope.add(name,node.kind,declarator.id,declarator.range[1])})}else if(isForWithConstLet(node)||isForInOfWithConstLet(node)){node.$scope=new Scope({kind:"block",node:node,parent:node.$parent.$scope})}else if(isNonFunctionBlock(node)){node.$scope=new Scope({kind:"block",node:node,parent:node.$parent.$scope})}else if(node.type==="CatchClause"){var identifier=node.param;node.$scope=new Scope({kind:"catch-block",node:node,parent:node.$parent.$scope});node.$scope.add(identifier.name,"caught",identifier,null);node.$scope.closestHoistScope().markPropagates(identifier.name)}}function createTopScope(programScope,environments,globals){function inject(obj){for(var name in obj){var writeable=obj[name];var kind=writeable?"var":"const";if(topScope.hasOwn(name)){topScope.remove(name)}topScope.add(name,kind,{loc:{start:{line:-1}}},-1)}}var topScope=new Scope({kind:"hoist",node:{},parent:null});var complementary={undefined:false,Infinity:false,console:false};inject(complementary);inject(jshint_vars.reservedVars);inject(jshint_vars.ecmaIdentifiers);if(environments){environments.forEach(function(env){if(!jshint_vars[env]){error(-1,'environment "{0}" not found',env)}else{inject(jshint_vars[env])}})}if(globals){inject(globals)}programScope.parent=topScope;topScope.children.push(programScope);return topScope}function setupReferences(ast,allIdentifiers,opts){var analyze=is.own(opts,"analyze")?opts.analyze:true;function visit(node){if(!isReference(node)){return}allIdentifiers.add(node.name);var scope=node.$scope.lookup(node.name);if(analyze&&!scope&&options.disallowUnknownReferences){error(getline(node),"reference to unknown global variable {0}",node.name)}if(analyze&&scope&&is.someof(scope.getKind(node.name),["const","let"])){var allowedFromPos=scope.getFromPos(node.name);var referencedAtPos=node.range[0];assert(is.finitenumber(allowedFromPos));assert(is.finitenumber(referencedAtPos));if(referencedAtPos<allowedFromPos){if(!node.$scope.hasFunctionScopeBetween(scope)){error(getline(node),"{0} is referenced before its declaration",node.name)}}}node.$refToScope=scope}traverse(ast,{pre:visit})}function varify(ast,stats,allIdentifiers,changes){function unique(name){assert(allIdentifiers.has(name));for(var cnt=0;;cnt++){var genName=name+"$"+String(cnt);if(!allIdentifiers.has(genName)){return genName}}}function renameDeclarations(node){if(node.type==="VariableDeclaration"&&isConstLet(node.kind)){var hoistScope=node.$scope.closestHoistScope();var origScope=node.$scope;changes.push({start:node.range[0],end:node.range[0]+node.kind.length,str:"var"});node.declarations.forEach(function(declarator){assert(declarator.type==="VariableDeclarator");var name=declarator.id.name;stats.declarator(node.kind);var rename=origScope!==hoistScope&&(hoistScope.hasOwn(name)||hoistScope.doesPropagate(name));var newName=rename?unique(name):name;origScope.remove(name);hoistScope.add(newName,"var",declarator.id,declarator.range[1]);origScope.moves=origScope.moves||stringmap();origScope.moves.set(name,{name:newName,scope:hoistScope});allIdentifiers.add(newName);if(newName!==name){stats.rename(name,newName,getline(declarator));declarator.id.originalName=name;declarator.id.name=newName;changes.push({start:declarator.id.range[0],end:declarator.id.range[1],str:newName})}});node.kind="var"}}function renameReferences(node){if(!node.$refToScope){return}var move=node.$refToScope.moves&&node.$refToScope.moves.get(node.name);if(!move){return}node.$refToScope=move.scope;if(node.name!==move.name){node.originalName=node.name;node.name=move.name;if(node.alterop){var existingOp=null;for(var i=0;i<changes.length;i++){var op=changes[i];if(op.node===node){existingOp=op;break}}assert(existingOp);existingOp.str=move.name}else{changes.push({start:node.range[0],end:node.range[1],str:move.name})}}}traverse(ast,{pre:renameDeclarations});traverse(ast,{pre:renameReferences});ast.$scope.traverse({pre:function(scope){delete scope.moves}})}function detectLoopClosures(ast){traverse(ast,{pre:visit});function detectIifyBodyBlockers(body,node){return breakable(function(brk){traverse(body,{pre:function(n){if(isFunction(n)){return false}var err=true;var msg="loop-variable {0} is captured by a loop-closure that can't be transformed due to use of {1} at line {2}";if(n.type==="BreakStatement"){error(getline(node),msg,node.name,"break",getline(n))}else if(n.type==="ContinueStatement"){error(getline(node),msg,node.name,"continue",getline(n))}else if(n.type==="ReturnStatement"){error(getline(node),msg,node.name,"return",getline(n))}else if(n.type==="YieldExpression"){error(getline(node),msg,node.name,"yield",getline(n))}else if(n.type==="Identifier"&&n.name==="arguments"){error(getline(node),msg,node.name,"arguments",getline(n))}else if(n.type==="VariableDeclaration"&&n.kind==="var"){error(getline(node),msg,node.name,"var",getline(n))}else{err=false}if(err){brk(true)}}});return false})}function visit(node){var loopNode=null;if(isReference(node)&&node.$refToScope&&isConstLet(node.$refToScope.getKind(node.name))){for(var n=node.$refToScope.node;;){if(isFunction(n)){return}else if(isLoop(n)){loopNode=n;break}n=n.$parent;if(!n){return}}assert(isLoop(loopNode));var defScope=node.$refToScope;var generateIIFE=options.loopClosures==="iife";for(var s=node.$scope;s;s=s.parent){if(s===defScope){return}else if(isFunction(s.node)){if(!generateIIFE){var msg='loop-variable {0} is captured by a loop-closure. Tried "loopClosures": "iife" in defs-config.json?';return error(getline(node),msg,node.name)}if(loopNode.type==="ForStatement"&&defScope.node===loopNode){var declarationNode=defScope.getNode(node.name);return error(getline(declarationNode),"Not yet specced ES6 feature. {0} is declared in for-loop header and then captured in loop closure",declarationNode.name)}if(detectIifyBodyBlockers(loopNode.body,node)){return}loopNode.$iify=true}}}}}function transformLoopClosures(root,ops,options){function insertOp(pos,str,node){var op={start:pos,end:pos,str:str};if(node){op.node=node}ops.push(op)}traverse(root,{pre:function(node){if(!node.$iify){return}var hasBlock=node.body.type==="BlockStatement";var insertHead=hasBlock?node.body.range[0]+1:node.body.range[0];var insertFoot=hasBlock?node.body.range[1]-1:node.body.range[1];var forInName=isForInOf(node)&&node.left.declarations[0].id.name;var iifeHead=fmt("(function({0}){",forInName?forInName:"");var iifeTail=fmt("}).call(this{0});",forInName?", "+forInName:"");var iifeFragment=options.parse(iifeHead+iifeTail);var iifeExpressionStatement=iifeFragment.body[0];var iifeBlockStatement=iifeExpressionStatement.expression.callee.object.body;if(hasBlock){var forBlockStatement=node.body;var tmp=forBlockStatement.body;forBlockStatement.body=[iifeExpressionStatement];iifeBlockStatement.body=tmp}else{var tmp$0=node.body;node.body=iifeExpressionStatement;iifeBlockStatement.body[0]=tmp$0}insertOp(insertHead,iifeHead);if(forInName){insertOp(insertFoot,"}).call(this, ");var args=iifeExpressionStatement.expression.arguments;var iifeArgumentIdentifier=args[1];iifeArgumentIdentifier.alterop=true;insertOp(insertFoot,forInName,iifeArgumentIdentifier);insertOp(insertFoot,");")}else{insertOp(insertFoot,iifeTail)}}})}function detectConstAssignment(ast){traverse(ast,{pre:function(node){if(isLvalue(node)){var scope=node.$scope.lookup(node.name);if(scope&&scope.getKind(node.name)==="const"){error(getline(node),"can't assign to const variable {0}",node.name)}}}})}function detectConstantLets(ast){traverse(ast,{pre:function(node){if(isLvalue(node)){var scope=node.$scope.lookup(node.name);if(scope){scope.markWrite(node.name)}}}});ast.$scope.detectUnmodifiedLets()}function setupScopeAndReferences(root,opts){traverse(root,{pre:createScopes});var topScope=createTopScope(root.$scope,options.environments,options.globals);var allIdentifiers=stringset();topScope.traverse({pre:function(scope){allIdentifiers.addMany(scope.decls.keys())}});setupReferences(root,allIdentifiers,opts);return allIdentifiers}function cleanupTree(root){traverse(root,{pre:function(node){for(var prop in node){if(prop[0]==="$"){delete node[prop]}}}})}function run(src,config){for(var key in config){options[key]=config[key]}var parsed;if(is.object(src)){if(!options.ast){return{errors:["Can't produce string output when input is an AST. "+"Did you forget to set options.ast = true?"]}}parsed=src}else if(is.string(src)){try{parsed=options.parse(src,{loc:true,range:true})}catch(e){return{errors:[fmt("line {0} column {1}: Error during input file parsing\n{2}\n{3}",e.lineNumber,e.column,src.split("\n")[e.lineNumber-1],fmt.repeat(" ",e.column-1)+"^")]}}}else{return{errors:["Input was neither an AST object nor a string."]}}var ast=parsed;error.reset();var allIdentifiers=setupScopeAndReferences(ast,{});detectLoopClosures(ast);detectConstAssignment(ast);var changes=[];transformLoopClosures(ast,changes,options);if(error.errors.length>=1){return{errors:error.errors}}if(changes.length>0){cleanupTree(ast);allIdentifiers=setupScopeAndReferences(ast,{analyze:false})}assert(error.errors.length===0);var stats=new Stats;varify(ast,stats,allIdentifiers,changes);if(options.ast){cleanupTree(ast);return{stats:stats,ast:ast}}else{var transformedSrc=alter(src,changes);return{stats:stats,src:transformedSrc}}}module.exports=run},{"./error":137,"./jshint_globals/vars.js":138,"./options":139,"./scope":140,"./stats":141,alter:142,assert:95,"ast-traverse":144,breakable:145,"simple-fmt":146,"simple-is":147,stringmap:148,stringset:149}],137:[function(require,module,exports){"use strict";var fmt=require("simple-fmt");var assert=require("assert");function error(line,var_args){assert(arguments.length>=2);var msg=arguments.length===2?String(var_args):fmt.apply(fmt,Array.prototype.slice.call(arguments,1));error.errors.push(line===-1?msg:fmt("line {0}: {1}",line,msg))}error.reset=function(){error.errors=[]};error.getline=function(node){if(node&&node.loc&&node.loc.start){return node.loc.start.line}return-1};error.reset();module.exports=error},{assert:95,"simple-fmt":146}],138:[function(require,module,exports){"use strict";exports.reservedVars={arguments:false,NaN:false};exports.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};exports.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};exports.devel={alert:false,confirm:false,console:false,Debug:false,opera:false,prompt:false};exports.worker={importScripts:true,postMessage:true,self:true};exports.nonstandard={escape:false,unescape:false};exports.couch={require:false,respond:false,getRow:false,emit:false,send:false,start:false,sum:false,log:false,exports:false,module:false,provides:false};exports.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};exports.phantom={phantom:true,require:true,WebPage:true};exports.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};exports.wsh={ActiveXObject:true,Enumerator:true,GetObject:true,ScriptEngine:true,ScriptEngineBuildVersion:true,ScriptEngineMajorVersion:true,ScriptEngineMinorVersion:true,VBArray:true,WSH:true,WScript:true,XDomainRequest:true};exports.dojo={dojo:false,dijit:false,dojox:false,define:false,require:false};exports.jquery={$:false,jQuery:false};exports.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};exports.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};exports.yui={YUI:false,Y:false,YUI_config:false}},{}],139:[function(require,module,exports){module.exports={disallowVars:false,disallowDuplicated:true,disallowUnknownReferences:true,parse:require("esprima-fb").parse}},{"esprima-fb":150}],140:[function(require,module,exports){"use strict";var assert=require("assert");var stringmap=require("stringmap");var stringset=require("stringset");var is=require("simple-is");var fmt=require("simple-fmt");var error=require("./error");var getline=error.getline;var options=require("./options");function Scope(args){assert(is.someof(args.kind,["hoist","block","catch-block"]));assert(is.object(args.node));assert(args.parent===null||is.object(args.parent));this.kind=args.kind;this.node=args.node;this.parent=args.parent;this.children=[];this.decls=stringmap();this.written=stringset();this.propagates=this.kind==="hoist"?stringset():null;if(this.parent){this.parent.children.push(this)}}Scope.prototype.print=function(indent){indent=indent||0;var scope=this;var names=this.decls.keys().map(function(name){return fmt("{0} [{1}]",name,scope.decls.get(name).kind)}).join(", ");var propagates=this.propagates?this.propagates.items().join(", "):"";console.log(fmt("{0}{1}: {2}. propagates: {3}",fmt.repeat(" ",indent),this.node.type,names,propagates));this.children.forEach(function(c){c.print(indent+2)})};Scope.prototype.add=function(name,kind,node,referableFromPos){assert(is.someof(kind,["fun","param","var","caught","const","let"]));function isConstLet(kind){return is.someof(kind,["const","let"])}var scope=this;if(is.someof(kind,["fun","param","var"])){while(scope.kind!=="hoist"){if(scope.decls.has(name)&&isConstLet(scope.decls.get(name).kind)){return error(getline(node),"{0} is already declared",name)}scope=scope.parent}}if(scope.decls.has(name)&&(options.disallowDuplicated||isConstLet(scope.decls.get(name).kind)||isConstLet(kind))){return error(getline(node),"{0} is already declared",name)}var declaration={kind:kind,node:node};if(referableFromPos){assert(is.someof(kind,["var","const","let"]));declaration.from=referableFromPos}scope.decls.set(name,declaration)};Scope.prototype.getKind=function(name){assert(is.string(name));var decl=this.decls.get(name);return decl?decl.kind:null};Scope.prototype.getNode=function(name){assert(is.string(name));var decl=this.decls.get(name);return decl?decl.node:null};Scope.prototype.getFromPos=function(name){assert(is.string(name));var decl=this.decls.get(name);return decl?decl.from:null};Scope.prototype.hasOwn=function(name){return this.decls.has(name)};Scope.prototype.remove=function(name){return this.decls.remove(name)};Scope.prototype.doesPropagate=function(name){return this.propagates.has(name)};Scope.prototype.markPropagates=function(name){this.propagates.add(name)};Scope.prototype.closestHoistScope=function(){var scope=this;while(scope.kind!=="hoist"){scope=scope.parent}return scope};Scope.prototype.hasFunctionScopeBetween=function(outer){function isFunction(node){return is.someof(node.type,["FunctionDeclaration","FunctionExpression"])}for(var scope=this;scope;scope=scope.parent){if(scope===outer){return false}if(isFunction(scope.node)){return true}}throw new Error("wasn't inner scope of outer")};Scope.prototype.lookup=function(name){for(var scope=this;scope;scope=scope.parent){if(scope.decls.has(name)){return scope}else if(scope.kind==="hoist"){scope.propagates.add(name)}}return null};Scope.prototype.markWrite=function(name){assert(is.string(name));this.written.add(name)};Scope.prototype.detectUnmodifiedLets=function(){var outmost=this;function detect(scope){if(scope!==outmost){scope.decls.keys().forEach(function(name){if(scope.getKind(name)==="let"&&!scope.written.has(name)){return error(getline(scope.getNode(name)),"{0} is declared as let but never modified so could be const",name)}})}scope.children.forEach(function(childScope){detect(childScope)})}detect(this)};Scope.prototype.traverse=function(options){options=options||{};var pre=options.pre;var post=options.post;function visit(scope){if(pre){pre(scope)}scope.children.forEach(function(childScope){visit(childScope)});if(post){post(scope)}}visit(this)};module.exports=Scope},{"./error":137,"./options":139,assert:95,"simple-fmt":146,"simple-is":147,stringmap:148,stringset:149}],141:[function(require,module,exports){var fmt=require("simple-fmt");var is=require("simple-is");var assert=require("assert");function Stats(){this.lets=0;this.consts=0;this.renames=[]}Stats.prototype.declarator=function(kind){assert(is.someof(kind,["const","let"]));if(kind==="const"){this.consts++}else{this.lets++}};Stats.prototype.rename=function(oldName,newName,line){this.renames.push({oldName:oldName,newName:newName,line:line})};Stats.prototype.toString=function(){var renames=this.renames.map(function(r){return r}).sort(function(a,b){return a.line-b.line});var renameStr=renames.map(function(rename){return fmt("\nline {0}: {1} => {2}",rename.line,rename.oldName,rename.newName)}).join("");var sum=this.consts+this.lets;var constlets=sum===0?"can't calculate const coverage (0 consts, 0 lets)":fmt("{0}% const coverage ({1} consts, {2} lets)",Math.floor(100*this.consts/sum),this.consts,this.lets);return constlets+renameStr+"\n"};module.exports=Stats},{assert:95,"simple-fmt":146,"simple-is":147}],142:[function(require,module,exports){var assert=require("assert");var stableSort=require("stable");function alter(str,fragments){"use strict";var isArray=Array.isArray||function(v){return Object.prototype.toString.call(v)==="[object Array]"};assert(typeof str==="string");assert(isArray(fragments));var sortedFragments=stableSort(fragments,function(a,b){return a.start-b.start});var outs=[];var pos=0;for(var i=0;i<sortedFragments.length;i++){var frag=sortedFragments[i];assert(pos<=frag.start);assert(frag.start<=frag.end);outs.push(str.slice(pos,frag.start));outs.push(frag.str);pos=frag.end}if(pos<str.length){outs.push(str.slice(pos))}return outs.join("")}if(typeof module!=="undefined"&&typeof module.exports!=="undefined"){module.exports=alter}},{assert:95,stable:143}],143:[function(require,module,exports){(function(){var stable=function(arr,comp){return exec(arr.slice(),comp)};stable.inplace=function(arr,comp){var result=exec(arr,comp);if(result!==arr){pass(result,null,arr.length,arr)}return arr};function exec(arr,comp){if(typeof comp!=="function"){comp=function(a,b){return String(a).localeCompare(b)}}var len=arr.length;if(len<=1){return arr}var buffer=new Array(len);for(var chk=1;chk<len;chk*=2){pass(arr,comp,chk,buffer);var tmp=arr;arr=buffer;buffer=tmp}return arr}var pass=function(arr,comp,chk,result){var len=arr.length;var i=0;var dbl=chk*2;var l,r,e;var li,ri;for(l=0;l<len;l+=dbl){r=l+chk;e=r+chk;if(r>len)r=len;if(e>len)e=len;li=l;ri=r;while(true){if(li<r&&ri<e){if(comp(arr[li],arr[ri])<=0){result[i++]=arr[li++]}else{result[i++]=arr[ri++]}}else if(li<r){result[i++]=arr[li++]}else if(ri<e){result[i++]=arr[ri++]}else{break}}}};if(typeof module!=="undefined"){module.exports=stable}else{window.stable=stable}})()},{}],144:[function(require,module,exports){function traverse(root,options){"use strict";options=options||{};var pre=options.pre;var post=options.post;var skipProperty=options.skipProperty;function visit(node,parent,prop,idx){if(!node||typeof node.type!=="string"){return}var res=undefined;if(pre){res=pre(node,parent,prop,idx)}if(res!==false){for(var prop in node){if(skipProperty?skipProperty(prop,node):prop[0]==="$"){continue}var child=node[prop];if(Array.isArray(child)){for(var i=0;i<child.length;i++){visit(child[i],node,prop,i)}}else{visit(child,node,prop)}}}if(post){post(node,parent,prop,idx)}}visit(root,null)}if(typeof module!=="undefined"&&typeof module.exports!=="undefined"){module.exports=traverse}},{}],145:[function(require,module,exports){var breakable=function(){"use strict";function Val(val,brk){this.val=val;this.brk=brk}function make_brk(){return function brk(val){throw new Val(val,brk)}}function breakable(fn){var brk=make_brk();try{return fn(brk)}catch(e){if(e instanceof Val&&e.brk===brk){return e.val}throw e}}return breakable}();if(typeof module!=="undefined"&&typeof module.exports!=="undefined"){module.exports=breakable}},{}],146:[function(require,module,exports){var fmt=function(){"use strict";function fmt(str,var_args){var args=Array.prototype.slice.call(arguments,1);return str.replace(/\{(\d+)\}/g,function(s,match){return match in args?args[match]:s})}function obj(str,obj){return str.replace(/\{([_$a-zA-Z0-9][_$a-zA-Z0-9]*)\}/g,function(s,match){return match in obj?obj[match]:s})}function repeat(str,n){return new Array(n+1).join(str)}fmt.fmt=fmt;fmt.obj=obj;fmt.repeat=repeat;return fmt}();if(typeof module!=="undefined"&&typeof module.exports!=="undefined"){module.exports=fmt}},{}],147:[function(require,module,exports){var is=function(){"use strict";var hasOwnProperty=Object.prototype.hasOwnProperty;var toString=Object.prototype.toString;var _undefined=void 0;return{nan:function(v){return v!==v},"boolean":function(v){return typeof v==="boolean"},number:function(v){return typeof v==="number"},string:function(v){return typeof v==="string"},fn:function(v){return typeof v==="function"},object:function(v){return v!==null&&typeof v==="object"},primitive:function(v){var t=typeof v;return v===null||v===_undefined||t==="boolean"||t==="number"||t==="string"},array:Array.isArray||function(v){return toString.call(v)==="[object Array]"},finitenumber:function(v){return typeof v==="number"&&isFinite(v)},someof:function(v,values){return values.indexOf(v)>=0},noneof:function(v,values){return values.indexOf(v)===-1},own:function(obj,prop){return hasOwnProperty.call(obj,prop)}}}();if(typeof module!=="undefined"&&typeof module.exports!=="undefined"){module.exports=is}},{}],148:[function(require,module,exports){var StringMap=function(){"use strict";var hasOwnProperty=Object.prototype.hasOwnProperty;var create=function(){function hasOwnEnumerableProps(obj){for(var prop in obj){if(hasOwnProperty.call(obj,prop)){return true}}return false}function hasOwnPollutedProps(obj){return hasOwnProperty.call(obj,"__count__")||hasOwnProperty.call(obj,"__parent__")}var useObjectCreate=false;if(typeof Object.create==="function"){if(!hasOwnEnumerableProps(Object.create(null))){useObjectCreate=true}}if(useObjectCreate===false){if(hasOwnEnumerableProps({})){throw new Error("StringMap environment error 0, please file a bug at https://github.com/olov/stringmap/issues")}}var o=useObjectCreate?Object.create(null):{};var useProtoClear=false;if(hasOwnPollutedProps(o)){o.__proto__=null;if(hasOwnEnumerableProps(o)||hasOwnPollutedProps(o)){throw new Error("StringMap environment error 1, please file a bug at https://github.com/olov/stringmap/issues")}useProtoClear=true}return function(){var o=useObjectCreate?Object.create(null):{};if(useProtoClear){o.__proto__=null}return o}}();function stringmap(optional_object){if(!(this instanceof stringmap)){return new stringmap(optional_object)}this.obj=create();this.hasProto=false;this.proto=undefined;if(optional_object){this.setMany(optional_object)}}stringmap.prototype.has=function(key){if(typeof key!=="string"){throw new Error("StringMap expected string key")}return key==="__proto__"?this.hasProto:hasOwnProperty.call(this.obj,key)};stringmap.prototype.get=function(key){if(typeof key!=="string"){throw new Error("StringMap expected string key")}return key==="__proto__"?this.proto:hasOwnProperty.call(this.obj,key)?this.obj[key]:undefined};stringmap.prototype.set=function(key,value){if(typeof key!=="string"){throw new Error("StringMap expected string key")}if(key==="__proto__"){this.hasProto=true;this.proto=value}else{this.obj[key]=value}};stringmap.prototype.remove=function(key){if(typeof key!=="string"){throw new Error("StringMap expected string key")}var didExist=this.has(key);if(key==="__proto__"){this.hasProto=false;this.proto=undefined}else{delete this.obj[key]}return didExist};stringmap.prototype["delete"]=stringmap.prototype.remove;stringmap.prototype.isEmpty=function(){for(var key in this.obj){if(hasOwnProperty.call(this.obj,key)){return false}}return!this.hasProto};stringmap.prototype.size=function(){var len=0;for(var key in this.obj){if(hasOwnProperty.call(this.obj,key)){++len}}return this.hasProto?len+1:len};stringmap.prototype.keys=function(){var keys=[];for(var key in this.obj){if(hasOwnProperty.call(this.obj,key)){keys.push(key)}}if(this.hasProto){keys.push("__proto__")}return keys};stringmap.prototype.values=function(){var values=[];for(var key in this.obj){if(hasOwnProperty.call(this.obj,key)){values.push(this.obj[key])}}if(this.hasProto){values.push(this.proto)}return values};stringmap.prototype.items=function(){var items=[];for(var key in this.obj){if(hasOwnProperty.call(this.obj,key)){items.push([key,this.obj[key]])}}if(this.hasProto){items.push(["__proto__",this.proto])}return items};stringmap.prototype.setMany=function(object){if(object===null||typeof object!=="object"&&typeof object!=="function"){throw new Error("StringMap expected Object")}for(var key in object){if(hasOwnProperty.call(object,key)){this.set(key,object[key])}}return this};stringmap.prototype.merge=function(other){var keys=other.keys();for(var i=0;i<keys.length;i++){var key=keys[i];this.set(key,other.get(key))}return this};stringmap.prototype.map=function(fn){var keys=this.keys();for(var i=0;i<keys.length;i++){var key=keys[i];keys[i]=fn(this.get(key),key)}return keys};stringmap.prototype.forEach=function(fn){var keys=this.keys();for(var i=0;i<keys.length;i++){var key=keys[i];fn(this.get(key),key)}};stringmap.prototype.clone=function(){var other=stringmap();return other.merge(this)};stringmap.prototype.toString=function(){var self=this;return"{"+this.keys().map(function(key){return JSON.stringify(key)+":"+JSON.stringify(self.get(key))}).join(",")+"}"};return stringmap}();if(typeof module!=="undefined"&&typeof module.exports!=="undefined"){module.exports=StringMap}},{}],149:[function(require,module,exports){var StringSet=function(){"use strict";var hasOwnProperty=Object.prototype.hasOwnProperty;var create=function(){function hasOwnEnumerableProps(obj){for(var prop in obj){if(hasOwnProperty.call(obj,prop)){return true}}return false}function hasOwnPollutedProps(obj){return hasOwnProperty.call(obj,"__count__")||hasOwnProperty.call(obj,"__parent__")}var useObjectCreate=false;if(typeof Object.create==="function"){if(!hasOwnEnumerableProps(Object.create(null))){useObjectCreate=true}}if(useObjectCreate===false){if(hasOwnEnumerableProps({})){throw new Error("StringSet environment error 0, please file a bug at https://github.com/olov/stringset/issues")}}var o=useObjectCreate?Object.create(null):{};var useProtoClear=false;if(hasOwnPollutedProps(o)){o.__proto__=null;if(hasOwnEnumerableProps(o)||hasOwnPollutedProps(o)){throw new Error("StringSet environment error 1, please file a bug at https://github.com/olov/stringset/issues")}useProtoClear=true}return function(){var o=useObjectCreate?Object.create(null):{};if(useProtoClear){o.__proto__=null}return o}}();function stringset(optional_array){if(!(this instanceof stringset)){return new stringset(optional_array)}this.obj=create();this.hasProto=false;if(optional_array){this.addMany(optional_array)
}}stringset.prototype.has=function(item){if(typeof item!=="string"){throw new Error("StringSet expected string item")}return item==="__proto__"?this.hasProto:hasOwnProperty.call(this.obj,item)};stringset.prototype.add=function(item){if(typeof item!=="string"){throw new Error("StringSet expected string item")}if(item==="__proto__"){this.hasProto=true}else{this.obj[item]=true}};stringset.prototype.remove=function(item){if(typeof item!=="string"){throw new Error("StringSet expected string item")}var didExist=this.has(item);if(item==="__proto__"){this.hasProto=false}else{delete this.obj[item]}return didExist};stringset.prototype["delete"]=stringset.prototype.remove;stringset.prototype.isEmpty=function(){for(var item in this.obj){if(hasOwnProperty.call(this.obj,item)){return false}}return!this.hasProto};stringset.prototype.size=function(){var len=0;for(var item in this.obj){if(hasOwnProperty.call(this.obj,item)){++len}}return this.hasProto?len+1:len};stringset.prototype.items=function(){var items=[];for(var item in this.obj){if(hasOwnProperty.call(this.obj,item)){items.push(item)}}if(this.hasProto){items.push("__proto__")}return items};stringset.prototype.addMany=function(items){if(!Array.isArray(items)){throw new Error("StringSet expected array")}for(var i=0;i<items.length;i++){this.add(items[i])}return this};stringset.prototype.merge=function(other){this.addMany(other.items());return this};stringset.prototype.clone=function(){var other=stringset();return other.merge(this)};stringset.prototype.toString=function(){return"{"+this.items().map(JSON.stringify).join(",")+"}"};return stringset}();if(typeof module!=="undefined"&&typeof module.exports!=="undefined"){module.exports=StringSet}},{}],150:[function(require,module,exports){(function(root,factory){"use strict";if(typeof define==="function"&&define.amd){define(["exports"],factory)}else if(typeof exports!=="undefined"){factory(exports)}else{factory(root.esprima={})}})(this,function(exports){"use strict";var Token,TokenName,FnExprTokens,Syntax,PropertyKind,Messages,Regex,SyntaxTreeDelegate,XHTMLEntities,ClassPropertyType,source,strict,index,lineNumber,lineStart,length,delegate,lookahead,state,extra;Token={BooleanLiteral:1,EOF:2,Identifier:3,Keyword:4,NullLiteral:5,NumericLiteral:6,Punctuator:7,StringLiteral:8,RegularExpression:9,Template:10,XJSIdentifier:11,XJSText:12};TokenName={};TokenName[Token.BooleanLiteral]="Boolean";TokenName[Token.EOF]="<end>";TokenName[Token.Identifier]="Identifier";TokenName[Token.Keyword]="Keyword";TokenName[Token.NullLiteral]="Null";TokenName[Token.NumericLiteral]="Numeric";TokenName[Token.Punctuator]="Punctuator";TokenName[Token.StringLiteral]="String";TokenName[Token.XJSIdentifier]="XJSIdentifier";TokenName[Token.XJSText]="XJSText";TokenName[Token.RegularExpression]="RegularExpression";FnExprTokens=["(","{","[","in","typeof","instanceof","new","return","case","delete","throw","void","=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","&=","|=","^=",",","+","-","*","/","%","++","--","<<",">>",">>>","&","|","^","!","~","&&","||","?",":","===","==",">=","<=","<",">","!=","!=="];Syntax={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"};PropertyKind={Data:1,Get:2,Set:4};ClassPropertyType={"static":"static",prototype:"prototype"};Messages={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"};Regex={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 assert(condition,message){if(!condition){throw new Error("ASSERT: "+message)}}function isDecimalDigit(ch){return ch>=48&&ch<=57}function isHexDigit(ch){return"0123456789abcdefABCDEF".indexOf(ch)>=0}function isOctalDigit(ch){return"01234567".indexOf(ch)>=0}function isWhiteSpace(ch){return ch===32||ch===9||ch===11||ch===12||ch===160||ch>=5760&&" ".indexOf(String.fromCharCode(ch))>0}function isLineTerminator(ch){return ch===10||ch===13||ch===8232||ch===8233}function isIdentifierStart(ch){return ch===36||ch===95||ch>=65&&ch<=90||ch>=97&&ch<=122||ch===92||ch>=128&&Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch))}function isIdentifierPart(ch){return ch===36||ch===95||ch>=65&&ch<=90||ch>=97&&ch<=122||ch>=48&&ch<=57||ch===92||ch>=128&&Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch))}function isFutureReservedWord(id){switch(id){case"class":case"enum":case"export":case"extends":case"import":case"super":return true;default:return false}}function isStrictModeReservedWord(id){switch(id){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return true;default:return false}}function isRestrictedWord(id){return id==="eval"||id==="arguments"}function isKeyword(id){if(strict&&isStrictModeReservedWord(id)){return true}switch(id.length){case 2:return id==="if"||id==="in"||id==="do";case 3:return id==="var"||id==="for"||id==="new"||id==="try"||id==="let";case 4:return id==="this"||id==="else"||id==="case"||id==="void"||id==="with"||id==="enum";case 5:return id==="while"||id==="break"||id==="catch"||id==="throw"||id==="const"||id==="class"||id==="super";case 6:return id==="return"||id==="typeof"||id==="delete"||id==="switch"||id==="export"||id==="import";case 7:return id==="default"||id==="finally"||id==="extends";case 8:return id==="function"||id==="continue"||id==="debugger";case 10:return id==="instanceof";default:return false}}function skipComment(){var ch,blockComment,lineComment;blockComment=false;lineComment=false;while(index<length){ch=source.charCodeAt(index);if(lineComment){++index;if(isLineTerminator(ch)){lineComment=false;if(ch===13&&source.charCodeAt(index)===10){++index}++lineNumber;lineStart=index}}else if(blockComment){if(isLineTerminator(ch)){if(ch===13){++index}if(ch!==13||source.charCodeAt(index)===10){++lineNumber;++index;lineStart=index;if(index>=length){throwError({},Messages.UnexpectedToken,"ILLEGAL")}}}else{ch=source.charCodeAt(index++);if(index>=length){throwError({},Messages.UnexpectedToken,"ILLEGAL")}if(ch===42){ch=source.charCodeAt(index);if(ch===47){++index;blockComment=false}}}}else if(ch===47){ch=source.charCodeAt(index+1);if(ch===47){index+=2;lineComment=true}else if(ch===42){index+=2;blockComment=true;if(index>=length){throwError({},Messages.UnexpectedToken,"ILLEGAL")}}else{break}}else if(isWhiteSpace(ch)){++index}else if(isLineTerminator(ch)){++index;if(ch===13&&source.charCodeAt(index)===10){++index}++lineNumber;lineStart=index}else{break}}}function scanHexEscape(prefix){var i,len,ch,code=0;len=prefix==="u"?4:2;for(i=0;i<len;++i){if(index<length&&isHexDigit(source[index])){ch=source[index++];code=code*16+"0123456789abcdef".indexOf(ch.toLowerCase())}else{return""}}return String.fromCharCode(code)}function scanUnicodeCodePointEscape(){var ch,code,cu1,cu2;ch=source[index];code=0;if(ch==="}"){throwError({},Messages.UnexpectedToken,"ILLEGAL")}while(index<length){ch=source[index++];if(!isHexDigit(ch)){break}code=code*16+"0123456789abcdef".indexOf(ch.toLowerCase())}if(code>1114111||ch!=="}"){throwError({},Messages.UnexpectedToken,"ILLEGAL")}if(code<=65535){return String.fromCharCode(code)}cu1=(code-65536>>10)+55296;cu2=(code-65536&1023)+56320;return String.fromCharCode(cu1,cu2)}function getEscapedIdentifier(){var ch,id;ch=source.charCodeAt(index++);id=String.fromCharCode(ch);if(ch===92){if(source.charCodeAt(index)!==117){throwError({},Messages.UnexpectedToken,"ILLEGAL")}++index;ch=scanHexEscape("u");if(!ch||ch==="\\"||!isIdentifierStart(ch.charCodeAt(0))){throwError({},Messages.UnexpectedToken,"ILLEGAL")}id=ch}while(index<length){ch=source.charCodeAt(index);if(!isIdentifierPart(ch)){break}++index;id+=String.fromCharCode(ch);if(ch===92){id=id.substr(0,id.length-1);if(source.charCodeAt(index)!==117){throwError({},Messages.UnexpectedToken,"ILLEGAL")}++index;ch=scanHexEscape("u");if(!ch||ch==="\\"||!isIdentifierPart(ch.charCodeAt(0))){throwError({},Messages.UnexpectedToken,"ILLEGAL")}id+=ch}}return id}function getIdentifier(){var start,ch;start=index++;while(index<length){ch=source.charCodeAt(index);if(ch===92){index=start;return getEscapedIdentifier()}if(isIdentifierPart(ch)){++index}else{break}}return source.slice(start,index)}function scanIdentifier(){var start,id,type;start=index;id=source.charCodeAt(index)===92?getEscapedIdentifier():getIdentifier();if(id.length===1){type=Token.Identifier}else if(isKeyword(id)){type=Token.Keyword}else if(id==="null"){type=Token.NullLiteral}else if(id==="true"||id==="false"){type=Token.BooleanLiteral}else{type=Token.Identifier}return{type:type,value:id,lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}function scanPunctuator(){var start=index,code=source.charCodeAt(index),code2,ch1=source[index],ch2,ch3,ch4;switch(code){case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:++index;if(extra.tokenize){if(code===40){extra.openParenToken=extra.tokens.length}else if(code===123){extra.openCurlyToken=extra.tokens.length}}return{type:Token.Punctuator,value:String.fromCharCode(code),lineNumber:lineNumber,lineStart:lineStart,range:[start,index]};default:code2=source.charCodeAt(index+1);if(code2===61){switch(code){case 37:case 38:case 42:case 43:case 45:case 47:case 60:case 62:case 94:case 124:index+=2;return{type:Token.Punctuator,value:String.fromCharCode(code)+String.fromCharCode(code2),lineNumber:lineNumber,lineStart:lineStart,range:[start,index]};case 33:case 61:index+=2;if(source.charCodeAt(index)===61){++index}return{type:Token.Punctuator,value:source.slice(start,index),lineNumber:lineNumber,lineStart:lineStart,range:[start,index]};default:break}}break}ch2=source[index+1];ch3=source[index+2];ch4=source[index+3];if(ch1===">"&&ch2===">"&&ch3===">"){if(ch4==="="){index+=4;return{type:Token.Punctuator,value:">>>=",lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}}if(ch1===">"&&ch2===">"&&ch3===">"){index+=3;return{type:Token.Punctuator,value:">>>",lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}if(ch1==="<"&&ch2==="<"&&ch3==="="){index+=3;return{type:Token.Punctuator,value:"<<=",lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}if(ch1===">"&&ch2===">"&&ch3==="="){index+=3;return{type:Token.Punctuator,value:">>=",lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}if(ch1==="."&&ch2==="."&&ch3==="."){index+=3;return{type:Token.Punctuator,value:"...",lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}if(ch1===ch2&&"+-<>&|".indexOf(ch1)>=0&&!state.inType){index+=2;return{type:Token.Punctuator,value:ch1+ch2,lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}if(ch1==="="&&ch2===">"){index+=2;return{type:Token.Punctuator,value:"=>",lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}if("<>=!+-*%&|^/".indexOf(ch1)>=0){++index;return{type:Token.Punctuator,value:ch1,lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}if(ch1==="."){++index;return{type:Token.Punctuator,value:ch1,lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}throwError({},Messages.UnexpectedToken,"ILLEGAL")}function scanHexLiteral(start){var number="";while(index<length){if(!isHexDigit(source[index])){break}number+=source[index++]}if(number.length===0){throwError({},Messages.UnexpectedToken,"ILLEGAL")}if(isIdentifierStart(source.charCodeAt(index))){throwError({},Messages.UnexpectedToken,"ILLEGAL")}return{type:Token.NumericLiteral,value:parseInt("0x"+number,16),lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}function scanOctalLiteral(prefix,start){var number,octal;if(isOctalDigit(prefix)){octal=true;number="0"+source[index++]}else{octal=false;++index;number=""}while(index<length){if(!isOctalDigit(source[index])){break}number+=source[index++]}if(!octal&&number.length===0){throwError({},Messages.UnexpectedToken,"ILLEGAL")}if(isIdentifierStart(source.charCodeAt(index))||isDecimalDigit(source.charCodeAt(index))){throwError({},Messages.UnexpectedToken,"ILLEGAL")}return{type:Token.NumericLiteral,value:parseInt(number,8),octal:octal,lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}function scanNumericLiteral(){var number,start,ch,octal;ch=source[index];assert(isDecimalDigit(ch.charCodeAt(0))||ch===".","Numeric literal must start with a decimal digit or a decimal point");start=index;number="";if(ch!=="."){number=source[index++];ch=source[index];if(number==="0"){if(ch==="x"||ch==="X"){++index;return scanHexLiteral(start)}if(ch==="b"||ch==="B"){++index;number="";while(index<length){ch=source[index];if(ch!=="0"&&ch!=="1"){break}number+=source[index++]}if(number.length===0){throwError({},Messages.UnexpectedToken,"ILLEGAL")}if(index<length){ch=source.charCodeAt(index);if(isIdentifierStart(ch)||isDecimalDigit(ch)){throwError({},Messages.UnexpectedToken,"ILLEGAL")}}return{type:Token.NumericLiteral,value:parseInt(number,2),lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}if(ch==="o"||ch==="O"||isOctalDigit(ch)){return scanOctalLiteral(ch,start)}if(ch&&isDecimalDigit(ch.charCodeAt(0))){throwError({},Messages.UnexpectedToken,"ILLEGAL")}}while(isDecimalDigit(source.charCodeAt(index))){number+=source[index++]}ch=source[index]}if(ch==="."){number+=source[index++];while(isDecimalDigit(source.charCodeAt(index))){number+=source[index++]}ch=source[index]}if(ch==="e"||ch==="E"){number+=source[index++];ch=source[index];if(ch==="+"||ch==="-"){number+=source[index++]}if(isDecimalDigit(source.charCodeAt(index))){while(isDecimalDigit(source.charCodeAt(index))){number+=source[index++]}}else{throwError({},Messages.UnexpectedToken,"ILLEGAL")}}if(isIdentifierStart(source.charCodeAt(index))){throwError({},Messages.UnexpectedToken,"ILLEGAL")}return{type:Token.NumericLiteral,value:parseFloat(number),lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}function scanStringLiteral(){var str="",quote,start,ch,code,unescaped,restore,octal=false;quote=source[index];assert(quote==="'"||quote==='"',"String literal must starts with a quote");start=index;++index;while(index<length){ch=source[index++];if(ch===quote){quote="";break}else if(ch==="\\"){ch=source[index++];if(!ch||!isLineTerminator(ch.charCodeAt(0))){switch(ch){case"n":str+="\n";break;case"r":str+="\r";break;case"t":str+=" ";break;case"u":case"x":if(source[index]==="{"){++index;str+=scanUnicodeCodePointEscape()}else{restore=index;unescaped=scanHexEscape(ch);if(unescaped){str+=unescaped}else{index=restore;str+=ch}}break;case"b":str+="\b";break;case"f":str+="\f";break;case"v":str+="";break;default:if(isOctalDigit(ch)){code="01234567".indexOf(ch);if(code!==0){octal=true}if(index<length&&isOctalDigit(source[index])){octal=true;code=code*8+"01234567".indexOf(source[index++]);if("0123".indexOf(ch)>=0&&index<length&&isOctalDigit(source[index])){code=code*8+"01234567".indexOf(source[index++])}}str+=String.fromCharCode(code)}else{str+=ch}break}}else{++lineNumber;if(ch==="\r"&&source[index]==="\n"){++index}lineStart=index}}else if(isLineTerminator(ch.charCodeAt(0))){break}else{str+=ch}}if(quote!==""){throwError({},Messages.UnexpectedToken,"ILLEGAL")}return{type:Token.StringLiteral,value:str,octal:octal,lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}function scanTemplate(){var cooked="",ch,start,terminated,tail,restore,unescaped,code,octal;terminated=false;tail=false;start=index;++index;while(index<length){ch=source[index++];if(ch==="`"){tail=true;terminated=true;break}else if(ch==="$"){if(source[index]==="{"){++index;terminated=true;break}cooked+=ch}else if(ch==="\\"){ch=source[index++];if(!isLineTerminator(ch.charCodeAt(0))){switch(ch){case"n":cooked+="\n";break;case"r":cooked+="\r";break;case"t":cooked+=" ";break;case"u":case"x":if(source[index]==="{"){++index;cooked+=scanUnicodeCodePointEscape()}else{restore=index;unescaped=scanHexEscape(ch);if(unescaped){cooked+=unescaped}else{index=restore;cooked+=ch}}break;case"b":cooked+="\b";break;case"f":cooked+="\f";break;case"v":cooked+="";break;default:if(isOctalDigit(ch)){code="01234567".indexOf(ch);if(code!==0){octal=true}if(index<length&&isOctalDigit(source[index])){octal=true;code=code*8+"01234567".indexOf(source[index++]);if("0123".indexOf(ch)>=0&&index<length&&isOctalDigit(source[index])){code=code*8+"01234567".indexOf(source[index++])}}cooked+=String.fromCharCode(code)}else{cooked+=ch}break}}else{++lineNumber;if(ch==="\r"&&source[index]==="\n"){++index}lineStart=index}}else if(isLineTerminator(ch.charCodeAt(0))){++lineNumber;if(ch==="\r"&&source[index]==="\n"){++index}lineStart=index;cooked+="\n"}else{cooked+=ch}}if(!terminated){throwError({},Messages.UnexpectedToken,"ILLEGAL")}return{type:Token.Template,value:{cooked:cooked,raw:source.slice(start+1,index-(tail?1:2))},tail:tail,octal:octal,lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}function scanTemplateElement(option){var startsWith,template;lookahead=null;skipComment();startsWith=option.head?"`":"}";if(source[index]!==startsWith){throwError({},Messages.UnexpectedToken,"ILLEGAL")}template=scanTemplate();peek();return template}function scanRegExp(){var str,ch,start,pattern,flags,value,classMarker=false,restore,terminated=false,tmp;lookahead=null;skipComment();start=index;ch=source[index];assert(ch==="/","Regular expression literal must start with a slash");str=source[index++];while(index<length){ch=source[index++];str+=ch;if(classMarker){if(ch==="]"){classMarker=false}}else{if(ch==="\\"){ch=source[index++];if(isLineTerminator(ch.charCodeAt(0))){throwError({},Messages.UnterminatedRegExp)}str+=ch}else if(ch==="/"){terminated=true;break}else if(ch==="["){classMarker=true}else if(isLineTerminator(ch.charCodeAt(0))){throwError({},Messages.UnterminatedRegExp)}}}if(!terminated){throwError({},Messages.UnterminatedRegExp)}pattern=str.substr(1,str.length-2);flags="";while(index<length){ch=source[index];if(!isIdentifierPart(ch.charCodeAt(0))){break}++index;if(ch==="\\"&&index<length){ch=source[index];if(ch==="u"){++index;restore=index;ch=scanHexEscape("u");if(ch){flags+=ch;for(str+="\\u";restore<index;++restore){str+=source[restore]}}else{index=restore;flags+="u";str+="\\u"}}else{str+="\\"}}else{flags+=ch;str+=ch}}tmp=pattern;if(flags.indexOf("u")>=0){tmp=tmp.replace(/\\u\{([0-9a-fA-F]{5,6})\}/g,"x").replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x")}try{value=new RegExp(tmp)}catch(e){throwError({},Messages.InvalidRegExp)}try{value=new RegExp(pattern,flags)}catch(exception){value=null}peek();if(extra.tokenize){return{type:Token.RegularExpression,value:value,regex:{pattern:pattern,flags:flags},lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}return{literal:str,value:value,regex:{pattern:pattern,flags:flags},range:[start,index]}}function isIdentifierName(token){return token.type===Token.Identifier||token.type===Token.Keyword||token.type===Token.BooleanLiteral||token.type===Token.NullLiteral}function advanceSlash(){var prevToken,checkToken;prevToken=extra.tokens[extra.tokens.length-1];if(!prevToken){return scanRegExp()}if(prevToken.type==="Punctuator"){if(prevToken.value===")"){checkToken=extra.tokens[extra.openParenToken-1];if(checkToken&&checkToken.type==="Keyword"&&(checkToken.value==="if"||checkToken.value==="while"||checkToken.value==="for"||checkToken.value==="with")){return scanRegExp()}return scanPunctuator()}if(prevToken.value==="}"){if(extra.tokens[extra.openCurlyToken-3]&&extra.tokens[extra.openCurlyToken-3].type==="Keyword"){checkToken=extra.tokens[extra.openCurlyToken-4];if(!checkToken){return scanPunctuator()}}else if(extra.tokens[extra.openCurlyToken-4]&&extra.tokens[extra.openCurlyToken-4].type==="Keyword"){checkToken=extra.tokens[extra.openCurlyToken-5];if(!checkToken){return scanRegExp()}}else{return scanPunctuator()}if(FnExprTokens.indexOf(checkToken.value)>=0){return scanPunctuator()}return scanRegExp()}return scanRegExp()}if(prevToken.type==="Keyword"){return scanRegExp()}return scanPunctuator()}function advance(){var ch;if(!state.inXJSChild){skipComment()}if(index>=length){return{type:Token.EOF,lineNumber:lineNumber,lineStart:lineStart,range:[index,index]}}if(state.inXJSChild){return advanceXJSChild()}ch=source.charCodeAt(index);if(ch===40||ch===41||ch===58){return scanPunctuator()}if(ch===39||ch===34){if(state.inXJSTag){return scanXJSStringLiteral()}return scanStringLiteral()}if(state.inXJSTag&&isXJSIdentifierStart(ch)){return scanXJSIdentifier()}if(ch===96){return scanTemplate()}if(isIdentifierStart(ch)){return scanIdentifier()}if(ch===46){if(isDecimalDigit(source.charCodeAt(index+1))){return scanNumericLiteral()}return scanPunctuator()}if(isDecimalDigit(ch)){return scanNumericLiteral()}if(extra.tokenize&&ch===47){return advanceSlash()}return scanPunctuator()}function lex(){var token;token=lookahead;index=token.range[1];lineNumber=token.lineNumber;lineStart=token.lineStart;lookahead=advance();index=token.range[1];lineNumber=token.lineNumber;lineStart=token.lineStart;return token}function peek(){var pos,line,start;pos=index;line=lineNumber;start=lineStart;lookahead=advance();index=pos;lineNumber=line;lineStart=start}function lookahead2(){var adv,pos,line,start,result;adv=typeof extra.advance==="function"?extra.advance:advance;pos=index;line=lineNumber;start=lineStart;if(lookahead===null){lookahead=adv()}index=lookahead.range[1];lineNumber=lookahead.lineNumber;lineStart=lookahead.lineStart;result=adv();index=pos;lineNumber=line;lineStart=start;return result}function rewind(token){index=token.range[0];lineNumber=token.lineNumber;lineStart=token.lineStart;lookahead=token}function markerCreate(){if(!extra.loc&&!extra.range){return undefined}skipComment();return{offset:index,line:lineNumber,col:index-lineStart}}function markerCreatePreserveWhitespace(){if(!extra.loc&&!extra.range){return undefined}return{offset:index,line:lineNumber,col:index-lineStart}}function processComment(node){var lastChild,trailingComments,bottomRight=extra.bottomRightStack,last=bottomRight[bottomRight.length-1];if(node.type===Syntax.Program){if(node.body.length>0){return}}if(extra.trailingComments.length>0){if(extra.trailingComments[0].range[0]>=node.range[1]){trailingComments=extra.trailingComments;extra.trailingComments=[]}else{extra.trailingComments.length=0}}else{if(last&&last.trailingComments&&last.trailingComments[0].range[0]>=node.range[1]){trailingComments=last.trailingComments;delete last.trailingComments}}if(last){while(last&&last.range[0]>=node.range[0]){lastChild=last;last=bottomRight.pop()}}if(lastChild){if(lastChild.leadingComments&&lastChild.leadingComments[lastChild.leadingComments.length-1].range[1]<=node.range[0]){node.leadingComments=lastChild.leadingComments;
delete lastChild.leadingComments}}else if(extra.leadingComments.length>0&&extra.leadingComments[extra.leadingComments.length-1].range[1]<=node.range[0]){node.leadingComments=extra.leadingComments;extra.leadingComments=[]}if(trailingComments){node.trailingComments=trailingComments}bottomRight.push(node)}function markerApply(marker,node){if(extra.range){node.range=[marker.offset,index]}if(extra.loc){node.loc={start:{line:marker.line,column:marker.col},end:{line:lineNumber,column:index-lineStart}};node=delegate.postProcess(node)}if(extra.attachComment){processComment(node)}return node}SyntaxTreeDelegate={name:"SyntaxTree",postProcess:function(node){return node},createArrayExpression:function(elements){return{type:Syntax.ArrayExpression,elements:elements}},createAssignmentExpression:function(operator,left,right){return{type:Syntax.AssignmentExpression,operator:operator,left:left,right:right}},createBinaryExpression:function(operator,left,right){var type=operator==="||"||operator==="&&"?Syntax.LogicalExpression:Syntax.BinaryExpression;return{type:type,operator:operator,left:left,right:right}},createBlockStatement:function(body){return{type:Syntax.BlockStatement,body:body}},createBreakStatement:function(label){return{type:Syntax.BreakStatement,label:label}},createCallExpression:function(callee,args){return{type:Syntax.CallExpression,callee:callee,arguments:args}},createCatchClause:function(param,body){return{type:Syntax.CatchClause,param:param,body:body}},createConditionalExpression:function(test,consequent,alternate){return{type:Syntax.ConditionalExpression,test:test,consequent:consequent,alternate:alternate}},createContinueStatement:function(label){return{type:Syntax.ContinueStatement,label:label}},createDebuggerStatement:function(){return{type:Syntax.DebuggerStatement}},createDoWhileStatement:function(body,test){return{type:Syntax.DoWhileStatement,body:body,test:test}},createEmptyStatement:function(){return{type:Syntax.EmptyStatement}},createExpressionStatement:function(expression){return{type:Syntax.ExpressionStatement,expression:expression}},createForStatement:function(init,test,update,body){return{type:Syntax.ForStatement,init:init,test:test,update:update,body:body}},createForInStatement:function(left,right,body){return{type:Syntax.ForInStatement,left:left,right:right,body:body,each:false}},createForOfStatement:function(left,right,body){return{type:Syntax.ForOfStatement,left:left,right:right,body:body}},createFunctionDeclaration:function(id,params,defaults,body,rest,generator,expression,isAsync,returnType,typeParameters){var funDecl={type:Syntax.FunctionDeclaration,id:id,params:params,defaults:defaults,body:body,rest:rest,generator:generator,expression:expression,returnType:returnType,typeParameters:typeParameters};if(isAsync){funDecl.async=true}return funDecl},createFunctionExpression:function(id,params,defaults,body,rest,generator,expression,isAsync,returnType,typeParameters){var funExpr={type:Syntax.FunctionExpression,id:id,params:params,defaults:defaults,body:body,rest:rest,generator:generator,expression:expression,returnType:returnType,typeParameters:typeParameters};if(isAsync){funExpr.async=true}return funExpr},createIdentifier:function(name){return{type:Syntax.Identifier,name:name,typeAnnotation:undefined,optional:undefined}},createTypeAnnotation:function(typeAnnotation){return{type:Syntax.TypeAnnotation,typeAnnotation:typeAnnotation}},createFunctionTypeAnnotation:function(params,returnType,rest,typeParameters){return{type:Syntax.FunctionTypeAnnotation,params:params,returnType:returnType,rest:rest,typeParameters:typeParameters}},createFunctionTypeParam:function(name,typeAnnotation,optional){return{type:Syntax.FunctionTypeParam,name:name,typeAnnotation:typeAnnotation,optional:optional}},createNullableTypeAnnotation:function(typeAnnotation){return{type:Syntax.NullableTypeAnnotation,typeAnnotation:typeAnnotation}},createArrayTypeAnnotation:function(elementType){return{type:Syntax.ArrayTypeAnnotation,elementType:elementType}},createGenericTypeAnnotation:function(id,typeParameters){return{type:Syntax.GenericTypeAnnotation,id:id,typeParameters:typeParameters}},createQualifiedTypeIdentifier:function(qualification,id){return{type:Syntax.QualifiedTypeIdentifier,qualification:qualification,id:id}},createTypeParameterDeclaration:function(params){return{type:Syntax.TypeParameterDeclaration,params:params}},createTypeParameterInstantiation:function(params){return{type:Syntax.TypeParameterInstantiation,params:params}},createAnyTypeAnnotation:function(){return{type:Syntax.AnyTypeAnnotation}},createBooleanTypeAnnotation:function(){return{type:Syntax.BooleanTypeAnnotation}},createNumberTypeAnnotation:function(){return{type:Syntax.NumberTypeAnnotation}},createStringTypeAnnotation:function(){return{type:Syntax.StringTypeAnnotation}},createStringLiteralTypeAnnotation:function(token){return{type:Syntax.StringLiteralTypeAnnotation,value:token.value,raw:source.slice(token.range[0],token.range[1])}},createVoidTypeAnnotation:function(){return{type:Syntax.VoidTypeAnnotation}},createTypeofTypeAnnotation:function(argument){return{type:Syntax.TypeofTypeAnnotation,argument:argument}},createTupleTypeAnnotation:function(types){return{type:Syntax.TupleTypeAnnotation,types:types}},createObjectTypeAnnotation:function(properties,indexers,callProperties){return{type:Syntax.ObjectTypeAnnotation,properties:properties,indexers:indexers,callProperties:callProperties}},createObjectTypeIndexer:function(id,key,value,isStatic){return{type:Syntax.ObjectTypeIndexer,id:id,key:key,value:value,"static":isStatic}},createObjectTypeCallProperty:function(value,isStatic){return{type:Syntax.ObjectTypeCallProperty,value:value,"static":isStatic}},createObjectTypeProperty:function(key,value,optional,isStatic){return{type:Syntax.ObjectTypeProperty,key:key,value:value,optional:optional,"static":isStatic}},createUnionTypeAnnotation:function(types){return{type:Syntax.UnionTypeAnnotation,types:types}},createIntersectionTypeAnnotation:function(types){return{type:Syntax.IntersectionTypeAnnotation,types:types}},createTypeAlias:function(id,typeParameters,right){return{type:Syntax.TypeAlias,id:id,typeParameters:typeParameters,right:right}},createInterface:function(id,typeParameters,body,extended){return{type:Syntax.InterfaceDeclaration,id:id,typeParameters:typeParameters,body:body,"extends":extended}},createInterfaceExtends:function(id,typeParameters){return{type:Syntax.InterfaceExtends,id:id,typeParameters:typeParameters}},createDeclareFunction:function(id){return{type:Syntax.DeclareFunction,id:id}},createDeclareVariable:function(id){return{type:Syntax.DeclareVariable,id:id}},createDeclareModule:function(id,body){return{type:Syntax.DeclareModule,id:id,body:body}},createXJSAttribute:function(name,value){return{type:Syntax.XJSAttribute,name:name,value:value||null}},createXJSSpreadAttribute:function(argument){return{type:Syntax.XJSSpreadAttribute,argument:argument}},createXJSIdentifier:function(name){return{type:Syntax.XJSIdentifier,name:name}},createXJSNamespacedName:function(namespace,name){return{type:Syntax.XJSNamespacedName,namespace:namespace,name:name}},createXJSMemberExpression:function(object,property){return{type:Syntax.XJSMemberExpression,object:object,property:property}},createXJSElement:function(openingElement,closingElement,children){return{type:Syntax.XJSElement,openingElement:openingElement,closingElement:closingElement,children:children}},createXJSEmptyExpression:function(){return{type:Syntax.XJSEmptyExpression}},createXJSExpressionContainer:function(expression){return{type:Syntax.XJSExpressionContainer,expression:expression}},createXJSOpeningElement:function(name,attributes,selfClosing){return{type:Syntax.XJSOpeningElement,name:name,selfClosing:selfClosing,attributes:attributes}},createXJSClosingElement:function(name){return{type:Syntax.XJSClosingElement,name:name}},createIfStatement:function(test,consequent,alternate){return{type:Syntax.IfStatement,test:test,consequent:consequent,alternate:alternate}},createLabeledStatement:function(label,body){return{type:Syntax.LabeledStatement,label:label,body:body}},createLiteral:function(token){var object={type:Syntax.Literal,value:token.value,raw:source.slice(token.range[0],token.range[1])};if(token.regex){object.regex=token.regex}return object},createMemberExpression:function(accessor,object,property){return{type:Syntax.MemberExpression,computed:accessor==="[",object:object,property:property}},createNewExpression:function(callee,args){return{type:Syntax.NewExpression,callee:callee,arguments:args}},createObjectExpression:function(properties){return{type:Syntax.ObjectExpression,properties:properties}},createPostfixExpression:function(operator,argument){return{type:Syntax.UpdateExpression,operator:operator,argument:argument,prefix:false}},createProgram:function(body){return{type:Syntax.Program,body:body}},createProperty:function(kind,key,value,method,shorthand,computed){return{type:Syntax.Property,key:key,value:value,kind:kind,method:method,shorthand:shorthand,computed:computed}},createReturnStatement:function(argument){return{type:Syntax.ReturnStatement,argument:argument}},createSequenceExpression:function(expressions){return{type:Syntax.SequenceExpression,expressions:expressions}},createSwitchCase:function(test,consequent){return{type:Syntax.SwitchCase,test:test,consequent:consequent}},createSwitchStatement:function(discriminant,cases){return{type:Syntax.SwitchStatement,discriminant:discriminant,cases:cases}},createThisExpression:function(){return{type:Syntax.ThisExpression}},createThrowStatement:function(argument){return{type:Syntax.ThrowStatement,argument:argument}},createTryStatement:function(block,guardedHandlers,handlers,finalizer){return{type:Syntax.TryStatement,block:block,guardedHandlers:guardedHandlers,handlers:handlers,finalizer:finalizer}},createUnaryExpression:function(operator,argument){if(operator==="++"||operator==="--"){return{type:Syntax.UpdateExpression,operator:operator,argument:argument,prefix:true}}return{type:Syntax.UnaryExpression,operator:operator,argument:argument,prefix:true}},createVariableDeclaration:function(declarations,kind){return{type:Syntax.VariableDeclaration,declarations:declarations,kind:kind}},createVariableDeclarator:function(id,init){return{type:Syntax.VariableDeclarator,id:id,init:init}},createWhileStatement:function(test,body){return{type:Syntax.WhileStatement,test:test,body:body}},createWithStatement:function(object,body){return{type:Syntax.WithStatement,object:object,body:body}},createTemplateElement:function(value,tail){return{type:Syntax.TemplateElement,value:value,tail:tail}},createTemplateLiteral:function(quasis,expressions){return{type:Syntax.TemplateLiteral,quasis:quasis,expressions:expressions}},createSpreadElement:function(argument){return{type:Syntax.SpreadElement,argument:argument}},createSpreadProperty:function(argument){return{type:Syntax.SpreadProperty,argument:argument}},createTaggedTemplateExpression:function(tag,quasi){return{type:Syntax.TaggedTemplateExpression,tag:tag,quasi:quasi}},createArrowFunctionExpression:function(params,defaults,body,rest,expression,isAsync){var arrowExpr={type:Syntax.ArrowFunctionExpression,id:null,params:params,defaults:defaults,body:body,rest:rest,generator:false,expression:expression};if(isAsync){arrowExpr.async=true}return arrowExpr},createMethodDefinition:function(propertyType,kind,key,value){return{type:Syntax.MethodDefinition,key:key,value:value,kind:kind,"static":propertyType===ClassPropertyType.static}},createClassProperty:function(key,typeAnnotation,computed,isStatic){return{type:Syntax.ClassProperty,key:key,typeAnnotation:typeAnnotation,computed:computed,"static":isStatic}},createClassBody:function(body){return{type:Syntax.ClassBody,body:body}},createClassImplements:function(id,typeParameters){return{type:Syntax.ClassImplements,id:id,typeParameters:typeParameters}},createClassExpression:function(id,superClass,body,typeParameters,superTypeParameters,implemented){return{type:Syntax.ClassExpression,id:id,superClass:superClass,body:body,typeParameters:typeParameters,superTypeParameters:superTypeParameters,"implements":implemented}},createClassDeclaration:function(id,superClass,body,typeParameters,superTypeParameters,implemented){return{type:Syntax.ClassDeclaration,id:id,superClass:superClass,body:body,typeParameters:typeParameters,superTypeParameters:superTypeParameters,"implements":implemented}},createModuleSpecifier:function(token){return{type:Syntax.ModuleSpecifier,value:token.value,raw:source.slice(token.range[0],token.range[1])}},createExportSpecifier:function(id,name){return{type:Syntax.ExportSpecifier,id:id,name:name}},createExportBatchSpecifier:function(){return{type:Syntax.ExportBatchSpecifier}},createImportDefaultSpecifier:function(id){return{type:Syntax.ImportDefaultSpecifier,id:id}},createImportNamespaceSpecifier:function(id){return{type:Syntax.ImportNamespaceSpecifier,id:id}},createExportDeclaration:function(isDefault,declaration,specifiers,source){return{type:Syntax.ExportDeclaration,"default":!!isDefault,declaration:declaration,specifiers:specifiers,source:source}},createImportSpecifier:function(id,name){return{type:Syntax.ImportSpecifier,id:id,name:name}},createImportDeclaration:function(specifiers,source){return{type:Syntax.ImportDeclaration,specifiers:specifiers,source:source}},createYieldExpression:function(argument,delegate){return{type:Syntax.YieldExpression,argument:argument,delegate:delegate}},createAwaitExpression:function(argument){return{type:Syntax.AwaitExpression,argument:argument}},createComprehensionExpression:function(filter,blocks,body){return{type:Syntax.ComprehensionExpression,filter:filter,blocks:blocks,body:body}}};function peekLineTerminator(){var pos,line,start,found;pos=index;line=lineNumber;start=lineStart;skipComment();found=lineNumber!==line;index=pos;lineNumber=line;lineStart=start;return found}function throwError(token,messageFormat){var error,args=Array.prototype.slice.call(arguments,2),msg=messageFormat.replace(/%(\d)/g,function(whole,index){assert(index<args.length,"Message reference must be in range");return args[index]});if(typeof token.lineNumber==="number"){error=new Error("Line "+token.lineNumber+": "+msg);error.index=token.range[0];error.lineNumber=token.lineNumber;error.column=token.range[0]-lineStart+1}else{error=new Error("Line "+lineNumber+": "+msg);error.index=index;error.lineNumber=lineNumber;error.column=index-lineStart+1}error.description=msg;throw error}function throwErrorTolerant(){try{throwError.apply(null,arguments)}catch(e){if(extra.errors){extra.errors.push(e)}else{throw e}}}function throwUnexpected(token){if(token.type===Token.EOF){throwError(token,Messages.UnexpectedEOS)}if(token.type===Token.NumericLiteral){throwError(token,Messages.UnexpectedNumber)}if(token.type===Token.StringLiteral||token.type===Token.XJSText){throwError(token,Messages.UnexpectedString)}if(token.type===Token.Identifier){throwError(token,Messages.UnexpectedIdentifier)}if(token.type===Token.Keyword){if(isFutureReservedWord(token.value)){throwError(token,Messages.UnexpectedReserved)}else if(strict&&isStrictModeReservedWord(token.value)){throwErrorTolerant(token,Messages.StrictReservedWord);return}throwError(token,Messages.UnexpectedToken,token.value)}if(token.type===Token.Template){throwError(token,Messages.UnexpectedTemplate,token.value.raw)}throwError(token,Messages.UnexpectedToken,token.value)}function expect(value){var token=lex();if(token.type!==Token.Punctuator||token.value!==value){throwUnexpected(token)}}function expectKeyword(keyword,contextual){var token=lex();if(token.type!==(contextual?Token.Identifier:Token.Keyword)||token.value!==keyword){throwUnexpected(token)}}function expectContextualKeyword(keyword){return expectKeyword(keyword,true)}function match(value){return lookahead.type===Token.Punctuator&&lookahead.value===value}function matchKeyword(keyword,contextual){var expectedType=contextual?Token.Identifier:Token.Keyword;return lookahead.type===expectedType&&lookahead.value===keyword}function matchContextualKeyword(keyword){return matchKeyword(keyword,true)}function matchAssign(){var op;if(lookahead.type!==Token.Punctuator){return false}op=lookahead.value;return op==="="||op==="*="||op==="/="||op==="%="||op==="+="||op==="-="||op==="<<="||op===">>="||op===">>>="||op==="&="||op==="^="||op==="|="}function matchYield(){return state.yieldAllowed&&matchKeyword("yield",!strict)}function matchAsync(){var backtrackToken=lookahead,matches=false;if(matchContextualKeyword("async")){lex();matches=!peekLineTerminator();rewind(backtrackToken)}return matches}function matchAwait(){return state.awaitAllowed&&matchContextualKeyword("await")}function consumeSemicolon(){var line,oldIndex=index,oldLineNumber=lineNumber,oldLineStart=lineStart,oldLookahead=lookahead;if(source.charCodeAt(index)===59){lex();return}line=lineNumber;skipComment();if(lineNumber!==line){index=oldIndex;lineNumber=oldLineNumber;lineStart=oldLineStart;lookahead=oldLookahead;return}if(match(";")){lex();return}if(lookahead.type!==Token.EOF&&!match("}")){throwUnexpected(lookahead)}}function isLeftHandSide(expr){return expr.type===Syntax.Identifier||expr.type===Syntax.MemberExpression}function isAssignableLeftHandSide(expr){return isLeftHandSide(expr)||expr.type===Syntax.ObjectPattern||expr.type===Syntax.ArrayPattern}function parseArrayInitialiser(){var elements=[],blocks=[],filter=null,tmp,possiblecomprehension=true,body,marker=markerCreate();expect("[");while(!match("]")){if(lookahead.value==="for"&&lookahead.type===Token.Keyword){if(!possiblecomprehension){throwError({},Messages.ComprehensionError)}matchKeyword("for");tmp=parseForStatement({ignoreBody:true});tmp.of=tmp.type===Syntax.ForOfStatement;tmp.type=Syntax.ComprehensionBlock;if(tmp.left.kind){throwError({},Messages.ComprehensionError)}blocks.push(tmp)}else if(lookahead.value==="if"&&lookahead.type===Token.Keyword){if(!possiblecomprehension){throwError({},Messages.ComprehensionError)}expectKeyword("if");expect("(");filter=parseExpression();expect(")")}else if(lookahead.value===","&&lookahead.type===Token.Punctuator){possiblecomprehension=false;lex();elements.push(null)}else{tmp=parseSpreadOrAssignmentExpression();elements.push(tmp);if(tmp&&tmp.type===Syntax.SpreadElement){if(!match("]")){throwError({},Messages.ElementAfterSpreadElement)}}else if(!(match("]")||matchKeyword("for")||matchKeyword("if"))){expect(",");possiblecomprehension=false}}}expect("]");if(filter&&!blocks.length){throwError({},Messages.ComprehensionRequiresBlock)}if(blocks.length){if(elements.length!==1){throwError({},Messages.ComprehensionError)}return markerApply(marker,delegate.createComprehensionExpression(filter,blocks,elements[0]))}return markerApply(marker,delegate.createArrayExpression(elements))}function parsePropertyFunction(options){var previousStrict,previousYieldAllowed,previousAwaitAllowed,params,defaults,body,marker=markerCreate();previousStrict=strict;previousYieldAllowed=state.yieldAllowed;state.yieldAllowed=options.generator;previousAwaitAllowed=state.awaitAllowed;state.awaitAllowed=options.async;params=options.params||[];defaults=options.defaults||[];body=parseConciseBody();if(options.name&&strict&&isRestrictedWord(params[0].name)){throwErrorTolerant(options.name,Messages.StrictParamName)}strict=previousStrict;state.yieldAllowed=previousYieldAllowed;state.awaitAllowed=previousAwaitAllowed;return markerApply(marker,delegate.createFunctionExpression(null,params,defaults,body,options.rest||null,options.generator,body.type!==Syntax.BlockStatement,options.async,options.returnType,options.typeParameters))}function parsePropertyMethodFunction(options){var previousStrict,tmp,method;previousStrict=strict;strict=true;tmp=parseParams();if(tmp.stricted){throwErrorTolerant(tmp.stricted,tmp.message)}method=parsePropertyFunction({params:tmp.params,defaults:tmp.defaults,rest:tmp.rest,generator:options.generator,async:options.async,returnType:tmp.returnType,typeParameters:options.typeParameters});strict=previousStrict;return method}function parseObjectPropertyKey(){var marker=markerCreate(),token=lex(),propertyKey,result;if(token.type===Token.StringLiteral||token.type===Token.NumericLiteral){if(strict&&token.octal){throwErrorTolerant(token,Messages.StrictOctalLiteral)}return markerApply(marker,delegate.createLiteral(token))}if(token.type===Token.Punctuator&&token.value==="["){marker=markerCreate();propertyKey=parseAssignmentExpression();result=markerApply(marker,propertyKey);expect("]");return result}return markerApply(marker,delegate.createIdentifier(token.value))}function parseObjectProperty(){var token,key,id,value,param,expr,computed,marker=markerCreate(),returnType;token=lookahead;computed=token.value==="[";if(token.type===Token.Identifier||computed||matchAsync()){id=parseObjectPropertyKey();if(match(":")){lex();return markerApply(marker,delegate.createProperty("init",id,parseAssignmentExpression(),false,false,computed))}if(match("(")){return markerApply(marker,delegate.createProperty("init",id,parsePropertyMethodFunction({generator:false,async:false}),true,false,computed))}if(token.value==="get"){computed=lookahead.value==="[";key=parseObjectPropertyKey();expect("(");expect(")");if(match(":")){returnType=parseTypeAnnotation()}return markerApply(marker,delegate.createProperty("get",key,parsePropertyFunction({generator:false,async:false,returnType:returnType}),false,false,computed))}if(token.value==="set"){computed=lookahead.value==="[";key=parseObjectPropertyKey();expect("(");token=lookahead;param=[parseTypeAnnotatableIdentifier()];expect(")");if(match(":")){returnType=parseTypeAnnotation()}return markerApply(marker,delegate.createProperty("set",key,parsePropertyFunction({params:param,generator:false,async:false,name:token,returnType:returnType}),false,false,computed))}if(token.value==="async"){computed=lookahead.value==="[";key=parseObjectPropertyKey();return markerApply(marker,delegate.createProperty("init",key,parsePropertyMethodFunction({generator:false,async:true}),true,false,computed))}if(computed){throwUnexpected(lookahead)}return markerApply(marker,delegate.createProperty("init",id,id,false,true,false))}if(token.type===Token.EOF||token.type===Token.Punctuator){if(!match("*")){throwUnexpected(token)}lex();computed=lookahead.type===Token.Punctuator&&lookahead.value==="[";id=parseObjectPropertyKey();if(!match("(")){throwUnexpected(lex())}return markerApply(marker,delegate.createProperty("init",id,parsePropertyMethodFunction({generator:true}),true,false,computed))}key=parseObjectPropertyKey();if(match(":")){lex();return markerApply(marker,delegate.createProperty("init",key,parseAssignmentExpression(),false,false,false))}if(match("(")){return markerApply(marker,delegate.createProperty("init",key,parsePropertyMethodFunction({generator:false}),true,false,false))}throwUnexpected(lex())}function parseObjectSpreadProperty(){var marker=markerCreate();expect("...");return markerApply(marker,delegate.createSpreadProperty(parseAssignmentExpression()))}function parseObjectInitialiser(){var properties=[],property,name,key,kind,map={},toString=String,marker=markerCreate();expect("{");while(!match("}")){if(match("...")){property=parseObjectSpreadProperty()}else{property=parseObjectProperty();if(property.key.type===Syntax.Identifier){name=property.key.name}else{name=toString(property.key.value)}kind=property.kind==="init"?PropertyKind.Data:property.kind==="get"?PropertyKind.Get:PropertyKind.Set;key="$"+name;if(Object.prototype.hasOwnProperty.call(map,key)){if(map[key]===PropertyKind.Data){if(strict&&kind===PropertyKind.Data){throwErrorTolerant({},Messages.StrictDuplicateProperty)}else if(kind!==PropertyKind.Data){throwErrorTolerant({},Messages.AccessorDataProperty)}}else{if(kind===PropertyKind.Data){throwErrorTolerant({},Messages.AccessorDataProperty)}else if(map[key]&kind){throwErrorTolerant({},Messages.AccessorGetSet)}}map[key]|=kind}else{map[key]=kind}}properties.push(property);if(!match("}")){expect(",")}}expect("}");return markerApply(marker,delegate.createObjectExpression(properties))}function parseTemplateElement(option){var marker=markerCreate(),token=scanTemplateElement(option);if(strict&&token.octal){throwError(token,Messages.StrictOctalLiteral)}return markerApply(marker,delegate.createTemplateElement({raw:token.value.raw,cooked:token.value.cooked},token.tail))}function parseTemplateLiteral(){var quasi,quasis,expressions,marker=markerCreate();quasi=parseTemplateElement({head:true});quasis=[quasi];expressions=[];while(!quasi.tail){expressions.push(parseExpression());quasi=parseTemplateElement({head:false});quasis.push(quasi)}return markerApply(marker,delegate.createTemplateLiteral(quasis,expressions))}function parseGroupExpression(){var expr;expect("(");++state.parenthesizedCount;expr=parseExpression();expect(")");return expr}function matchAsyncFuncExprOrDecl(){var token;if(matchAsync()){token=lookahead2();if(token.type===Token.Keyword&&token.value==="function"){return true}}return false}function parsePrimaryExpression(){var marker,type,token,expr;type=lookahead.type;if(type===Token.Identifier){marker=markerCreate();return markerApply(marker,delegate.createIdentifier(lex().value))}if(type===Token.StringLiteral||type===Token.NumericLiteral){if(strict&&lookahead.octal){throwErrorTolerant(lookahead,Messages.StrictOctalLiteral)}marker=markerCreate();return markerApply(marker,delegate.createLiteral(lex()))}if(type===Token.Keyword){if(matchKeyword("this")){marker=markerCreate();lex();return markerApply(marker,delegate.createThisExpression())}if(matchKeyword("function")){return parseFunctionExpression()}if(matchKeyword("class")){return parseClassExpression()}if(matchKeyword("super")){marker=markerCreate();lex();return markerApply(marker,delegate.createIdentifier("super"))}}if(type===Token.BooleanLiteral){marker=markerCreate();token=lex();token.value=token.value==="true";return markerApply(marker,delegate.createLiteral(token))}if(type===Token.NullLiteral){marker=markerCreate();token=lex();token.value=null;return markerApply(marker,delegate.createLiteral(token))}if(match("[")){return parseArrayInitialiser()}if(match("{")){return parseObjectInitialiser()}if(match("(")){return parseGroupExpression()}if(match("/")||match("/=")){marker=markerCreate();return markerApply(marker,delegate.createLiteral(scanRegExp()))}if(type===Token.Template){return parseTemplateLiteral()}if(match("<")){return parseXJSElement()}throwUnexpected(lex())}function parseArguments(){var args=[],arg;expect("(");if(!match(")")){while(index<length){arg=parseSpreadOrAssignmentExpression();args.push(arg);if(match(")")){break}else if(arg.type===Syntax.SpreadElement){throwError({},Messages.ElementAfterSpreadElement)}expect(",")}}expect(")");return args}function parseSpreadOrAssignmentExpression(){if(match("...")){var marker=markerCreate();lex();return markerApply(marker,delegate.createSpreadElement(parseAssignmentExpression()))}return parseAssignmentExpression()}function parseNonComputedProperty(){var marker=markerCreate(),token=lex();if(!isIdentifierName(token)){throwUnexpected(token)}return markerApply(marker,delegate.createIdentifier(token.value))}function parseNonComputedMember(){expect(".");return parseNonComputedProperty()}function parseComputedMember(){var expr;expect("[");expr=parseExpression();expect("]");return expr}function parseNewExpression(){var callee,args,marker=markerCreate();expectKeyword("new");callee=parseLeftHandSideExpression();args=match("(")?parseArguments():[];return markerApply(marker,delegate.createNewExpression(callee,args))}function parseLeftHandSideExpressionAllowCall(){var expr,args,marker=markerCreate();expr=matchKeyword("new")?parseNewExpression():parsePrimaryExpression();while(match(".")||match("[")||match("(")||lookahead.type===Token.Template){if(match("(")){args=parseArguments();expr=markerApply(marker,delegate.createCallExpression(expr,args))}else if(match("[")){expr=markerApply(marker,delegate.createMemberExpression("[",expr,parseComputedMember()))}else if(match(".")){expr=markerApply(marker,delegate.createMemberExpression(".",expr,parseNonComputedMember()))}else{expr=markerApply(marker,delegate.createTaggedTemplateExpression(expr,parseTemplateLiteral()))}}return expr}function parseLeftHandSideExpression(){var expr,marker=markerCreate();expr=matchKeyword("new")?parseNewExpression():parsePrimaryExpression();while(match(".")||match("[")||lookahead.type===Token.Template){if(match("[")){expr=markerApply(marker,delegate.createMemberExpression("[",expr,parseComputedMember()))}else if(match(".")){expr=markerApply(marker,delegate.createMemberExpression(".",expr,parseNonComputedMember()))}else{expr=markerApply(marker,delegate.createTaggedTemplateExpression(expr,parseTemplateLiteral()))}}return expr}function parsePostfixExpression(){var marker=markerCreate(),expr=parseLeftHandSideExpressionAllowCall(),token;if(lookahead.type!==Token.Punctuator){return expr}if((match("++")||match("--"))&&!peekLineTerminator()){if(strict&&expr.type===Syntax.Identifier&&isRestrictedWord(expr.name)){throwErrorTolerant({},Messages.StrictLHSPostfix)}if(!isLeftHandSide(expr)){throwError({},Messages.InvalidLHSInAssignment)}token=lex();expr=markerApply(marker,delegate.createPostfixExpression(token.value,expr))}return expr}function parseUnaryExpression(){var marker,token,expr;if(lookahead.type!==Token.Punctuator&&lookahead.type!==Token.Keyword){return parsePostfixExpression()}if(match("++")||match("--")){marker=markerCreate();token=lex();expr=parseUnaryExpression();if(strict&&expr.type===Syntax.Identifier&&isRestrictedWord(expr.name)){throwErrorTolerant({},Messages.StrictLHSPrefix)}if(!isLeftHandSide(expr)){throwError({},Messages.InvalidLHSInAssignment)}return markerApply(marker,delegate.createUnaryExpression(token.value,expr))}if(match("+")||match("-")||match("~")||match("!")){marker=markerCreate();token=lex();expr=parseUnaryExpression();return markerApply(marker,delegate.createUnaryExpression(token.value,expr))}if(matchKeyword("delete")||matchKeyword("void")||matchKeyword("typeof")){marker=markerCreate();token=lex();expr=parseUnaryExpression();expr=markerApply(marker,delegate.createUnaryExpression(token.value,expr));if(strict&&expr.operator==="delete"&&expr.argument.type===Syntax.Identifier){throwErrorTolerant({},Messages.StrictDelete)}return expr}return parsePostfixExpression()}function binaryPrecedence(token,allowIn){var prec=0;if(token.type!==Token.Punctuator&&token.type!==Token.Keyword){return 0}switch(token.value){case"||":prec=1;break;case"&&":prec=2;break;case"|":prec=3;break;case"^":prec=4;break;case"&":prec=5;break;case"==":case"!=":case"===":case"!==":prec=6;break;case"<":case">":case"<=":case">=":case"instanceof":prec=7;break;case"in":prec=allowIn?7:0;break;case"<<":case">>":case">>>":prec=8;break;case"+":case"-":prec=9;break;case"*":case"/":case"%":prec=11;break;default:break}return prec}function parseBinaryExpression(){var expr,token,prec,previousAllowIn,stack,right,operator,left,i,marker,markers;previousAllowIn=state.allowIn;state.allowIn=true;marker=markerCreate();left=parseUnaryExpression();token=lookahead;prec=binaryPrecedence(token,previousAllowIn);if(prec===0){return left}token.prec=prec;lex();markers=[marker,markerCreate()];right=parseUnaryExpression();stack=[left,token,right];while((prec=binaryPrecedence(lookahead,previousAllowIn))>0){while(stack.length>2&&prec<=stack[stack.length-2].prec){right=stack.pop();operator=stack.pop().value;left=stack.pop();expr=delegate.createBinaryExpression(operator,left,right);markers.pop();marker=markers.pop();markerApply(marker,expr);stack.push(expr);markers.push(marker)}token=lex();token.prec=prec;stack.push(token);markers.push(markerCreate());expr=parseUnaryExpression();stack.push(expr)}state.allowIn=previousAllowIn;i=stack.length-1;expr=stack[i];markers.pop();while(i>1){expr=delegate.createBinaryExpression(stack[i-1].value,stack[i-2],expr);i-=2;marker=markers.pop();markerApply(marker,expr)}return expr}function parseConditionalExpression(){var expr,previousAllowIn,consequent,alternate,marker=markerCreate();
expr=parseBinaryExpression();if(match("?")){lex();previousAllowIn=state.allowIn;state.allowIn=true;consequent=parseAssignmentExpression();state.allowIn=previousAllowIn;expect(":");alternate=parseAssignmentExpression();expr=markerApply(marker,delegate.createConditionalExpression(expr,consequent,alternate))}return expr}function reinterpretAsAssignmentBindingPattern(expr){var i,len,property,element;if(expr.type===Syntax.ObjectExpression){expr.type=Syntax.ObjectPattern;for(i=0,len=expr.properties.length;i<len;i+=1){property=expr.properties[i];if(property.type===Syntax.SpreadProperty){if(i<len-1){throwError({},Messages.PropertyAfterSpreadProperty)}reinterpretAsAssignmentBindingPattern(property.argument)}else{if(property.kind!=="init"){throwError({},Messages.InvalidLHSInAssignment)}reinterpretAsAssignmentBindingPattern(property.value)}}}else if(expr.type===Syntax.ArrayExpression){expr.type=Syntax.ArrayPattern;for(i=0,len=expr.elements.length;i<len;i+=1){element=expr.elements[i];if(element){reinterpretAsAssignmentBindingPattern(element)}}}else if(expr.type===Syntax.Identifier){if(isRestrictedWord(expr.name)){throwError({},Messages.InvalidLHSInAssignment)}}else if(expr.type===Syntax.SpreadElement){reinterpretAsAssignmentBindingPattern(expr.argument);if(expr.argument.type===Syntax.ObjectPattern){throwError({},Messages.ObjectPatternAsSpread)}}else{if(expr.type!==Syntax.MemberExpression&&expr.type!==Syntax.CallExpression&&expr.type!==Syntax.NewExpression){throwError({},Messages.InvalidLHSInAssignment)}}}function reinterpretAsDestructuredParameter(options,expr){var i,len,property,element;if(expr.type===Syntax.ObjectExpression){expr.type=Syntax.ObjectPattern;for(i=0,len=expr.properties.length;i<len;i+=1){property=expr.properties[i];if(property.type===Syntax.SpreadProperty){if(i<len-1){throwError({},Messages.PropertyAfterSpreadProperty)}reinterpretAsDestructuredParameter(options,property.argument)}else{if(property.kind!=="init"){throwError({},Messages.InvalidLHSInFormalsList)}reinterpretAsDestructuredParameter(options,property.value)}}}else if(expr.type===Syntax.ArrayExpression){expr.type=Syntax.ArrayPattern;for(i=0,len=expr.elements.length;i<len;i+=1){element=expr.elements[i];if(element){reinterpretAsDestructuredParameter(options,element)}}}else if(expr.type===Syntax.Identifier){validateParam(options,expr,expr.name)}else{if(expr.type!==Syntax.MemberExpression){throwError({},Messages.InvalidLHSInFormalsList)}}}function reinterpretAsCoverFormalsList(expressions){var i,len,param,params,defaults,defaultCount,options,rest;params=[];defaults=[];defaultCount=0;rest=null;options={paramSet:{}};for(i=0,len=expressions.length;i<len;i+=1){param=expressions[i];if(param.type===Syntax.Identifier){params.push(param);defaults.push(null);validateParam(options,param,param.name)}else if(param.type===Syntax.ObjectExpression||param.type===Syntax.ArrayExpression){reinterpretAsDestructuredParameter(options,param);params.push(param);defaults.push(null)}else if(param.type===Syntax.SpreadElement){assert(i===len-1,"It is guaranteed that SpreadElement is last element by parseExpression");reinterpretAsDestructuredParameter(options,param.argument);rest=param.argument}else if(param.type===Syntax.AssignmentExpression){params.push(param.left);defaults.push(param.right);++defaultCount;validateParam(options,param.left,param.left.name)}else{return null}}if(options.message===Messages.StrictParamDupe){throwError(strict?options.stricted:options.firstRestricted,options.message)}if(defaultCount===0){defaults=[]}return{params:params,defaults:defaults,rest:rest,stricted:options.stricted,firstRestricted:options.firstRestricted,message:options.message}}function parseArrowFunctionExpression(options,marker){var previousStrict,previousYieldAllowed,previousAwaitAllowed,body;expect("=>");previousStrict=strict;previousYieldAllowed=state.yieldAllowed;state.yieldAllowed=false;previousAwaitAllowed=state.awaitAllowed;state.awaitAllowed=!!options.async;body=parseConciseBody();if(strict&&options.firstRestricted){throwError(options.firstRestricted,options.message)}if(strict&&options.stricted){throwErrorTolerant(options.stricted,options.message)}strict=previousStrict;state.yieldAllowed=previousYieldAllowed;state.awaitAllowed=previousAwaitAllowed;return markerApply(marker,delegate.createArrowFunctionExpression(options.params,options.defaults,body,options.rest,body.type!==Syntax.BlockStatement,!!options.async))}function parseAssignmentExpression(){var marker,expr,token,params,oldParenthesizedCount,backtrackToken=lookahead,possiblyAsync=false;if(matchYield()){return parseYieldExpression()}if(matchAwait()){return parseAwaitExpression()}oldParenthesizedCount=state.parenthesizedCount;marker=markerCreate();if(matchAsyncFuncExprOrDecl()){return parseFunctionExpression()}if(matchAsync()){possiblyAsync=true;lex()}if(match("(")){token=lookahead2();if(token.type===Token.Punctuator&&token.value===")"||token.value==="..."){params=parseParams();if(!match("=>")){throwUnexpected(lex())}params.async=possiblyAsync;return parseArrowFunctionExpression(params,marker)}}token=lookahead;if(possiblyAsync&&!match("(")&&token.type!==Token.Identifier){possiblyAsync=false;rewind(backtrackToken)}expr=parseConditionalExpression();if(match("=>")&&(state.parenthesizedCount===oldParenthesizedCount||state.parenthesizedCount===oldParenthesizedCount+1)){if(expr.type===Syntax.Identifier){params=reinterpretAsCoverFormalsList([expr])}else if(expr.type===Syntax.SequenceExpression){params=reinterpretAsCoverFormalsList(expr.expressions)}if(params){params.async=possiblyAsync;return parseArrowFunctionExpression(params,marker)}}if(possiblyAsync){possiblyAsync=false;rewind(backtrackToken);expr=parseConditionalExpression()}if(matchAssign()){if(strict&&expr.type===Syntax.Identifier&&isRestrictedWord(expr.name)){throwErrorTolerant(token,Messages.StrictLHSAssignment)}if(match("=")&&(expr.type===Syntax.ObjectExpression||expr.type===Syntax.ArrayExpression)){reinterpretAsAssignmentBindingPattern(expr)}else if(!isLeftHandSide(expr)){throwError({},Messages.InvalidLHSInAssignment)}expr=markerApply(marker,delegate.createAssignmentExpression(lex().value,expr,parseAssignmentExpression()))}return expr}function parseExpression(){var marker,expr,expressions,sequence,coverFormalsList,spreadFound,oldParenthesizedCount;oldParenthesizedCount=state.parenthesizedCount;marker=markerCreate();expr=parseAssignmentExpression();expressions=[expr];if(match(",")){while(index<length){if(!match(",")){break}lex();expr=parseSpreadOrAssignmentExpression();expressions.push(expr);if(expr.type===Syntax.SpreadElement){spreadFound=true;if(!match(")")){throwError({},Messages.ElementAfterSpreadElement)}break}}sequence=markerApply(marker,delegate.createSequenceExpression(expressions))}if(match("=>")){if(state.parenthesizedCount===oldParenthesizedCount||state.parenthesizedCount===oldParenthesizedCount+1){expr=expr.type===Syntax.SequenceExpression?expr.expressions:expressions;coverFormalsList=reinterpretAsCoverFormalsList(expr);if(coverFormalsList){return parseArrowFunctionExpression(coverFormalsList,marker)}}throwUnexpected(lex())}if(spreadFound&&lookahead2().value!=="=>"){throwError({},Messages.IllegalSpread)}return sequence||expr}function parseStatementList(){var list=[],statement;while(index<length){if(match("}")){break}statement=parseSourceElement();if(typeof statement==="undefined"){break}list.push(statement)}return list}function parseBlock(){var block,marker=markerCreate();expect("{");block=parseStatementList();expect("}");return markerApply(marker,delegate.createBlockStatement(block))}function parseTypeParameterDeclaration(){var marker=markerCreate(),paramTypes=[];expect("<");while(!match(">")){paramTypes.push(parseVariableIdentifier());if(!match(">")){expect(",")}}expect(">");return markerApply(marker,delegate.createTypeParameterDeclaration(paramTypes))}function parseTypeParameterInstantiation(){var marker=markerCreate(),oldInType=state.inType,paramTypes=[];state.inType=true;expect("<");while(!match(">")){paramTypes.push(parseType());if(!match(">")){expect(",")}}expect(">");state.inType=oldInType;return markerApply(marker,delegate.createTypeParameterInstantiation(paramTypes))}function parseObjectTypeIndexer(marker,isStatic){var id,key,value;expect("[");id=parseObjectPropertyKey();expect(":");key=parseType();expect("]");expect(":");value=parseType();return markerApply(marker,delegate.createObjectTypeIndexer(id,key,value,isStatic))}function parseObjectTypeMethodish(marker){var params=[],rest=null,returnType,typeParameters=null;if(match("<")){typeParameters=parseTypeParameterDeclaration()}expect("(");while(lookahead.type===Token.Identifier){params.push(parseFunctionTypeParam());if(!match(")")){expect(",")}}if(match("...")){lex();rest=parseFunctionTypeParam()}expect(")");expect(":");returnType=parseType();return markerApply(marker,delegate.createFunctionTypeAnnotation(params,returnType,rest,typeParameters))}function parseObjectTypeMethod(marker,isStatic,key){var optional=false,value;value=parseObjectTypeMethodish(marker);return markerApply(marker,delegate.createObjectTypeProperty(key,value,optional,isStatic))}function parseObjectTypeCallProperty(marker,isStatic){var valueMarker=markerCreate();return markerApply(marker,delegate.createObjectTypeCallProperty(parseObjectTypeMethodish(valueMarker),isStatic))}function parseObjectType(allowStatic){var callProperties=[],indexers=[],marker,optional=false,properties=[],property,propertyKey,propertyTypeAnnotation,token,isStatic;expect("{");while(!match("}")){marker=markerCreate();if(allowStatic&&matchContextualKeyword("static")){token=lex();isStatic=true}if(match("[")){indexers.push(parseObjectTypeIndexer(marker,isStatic))}else if(match("(")||match("<")){callProperties.push(parseObjectTypeCallProperty(marker,allowStatic))}else{if(isStatic&&match(":")){propertyKey=markerApply(marker,delegate.createIdentifier(token));throwErrorTolerant(token,Messages.StrictReservedWord)}else{propertyKey=parseObjectPropertyKey()}if(match("<")||match("(")){properties.push(parseObjectTypeMethod(marker,isStatic,propertyKey))}else{if(match("?")){lex();optional=true}expect(":");propertyTypeAnnotation=parseType();properties.push(markerApply(marker,delegate.createObjectTypeProperty(propertyKey,propertyTypeAnnotation,optional,isStatic)))}}if(match(";")){lex()}else if(!match("}")){throwUnexpected(lookahead)}}expect("}");return delegate.createObjectTypeAnnotation(properties,indexers,callProperties)}function parseGenericType(){var marker=markerCreate(),returnType=null,typeParameters=null,typeIdentifier,typeIdentifierMarker=markerCreate;typeIdentifier=parseVariableIdentifier();while(match(".")){expect(".");typeIdentifier=markerApply(marker,delegate.createQualifiedTypeIdentifier(typeIdentifier,parseVariableIdentifier()))}if(match("<")){typeParameters=parseTypeParameterInstantiation()}return markerApply(marker,delegate.createGenericTypeAnnotation(typeIdentifier,typeParameters))}function parseVoidType(){var marker=markerCreate();expectKeyword("void");return markerApply(marker,delegate.createVoidTypeAnnotation())}function parseTypeofType(){var argument,marker=markerCreate();expectKeyword("typeof");argument=parsePrimaryType();return markerApply(marker,delegate.createTypeofTypeAnnotation(argument))}function parseTupleType(){var marker=markerCreate(),types=[];expect("[");while(index<length&&!match("]")){types.push(parseType());if(match("]")){break}expect(",")}expect("]");return markerApply(marker,delegate.createTupleTypeAnnotation(types))}function parseFunctionTypeParam(){var marker=markerCreate(),name,optional=false,typeAnnotation;name=parseVariableIdentifier();if(match("?")){lex();optional=true}expect(":");typeAnnotation=parseType();return markerApply(marker,delegate.createFunctionTypeParam(name,typeAnnotation,optional))}function parseFunctionTypeParams(){var ret={params:[],rest:null};while(lookahead.type===Token.Identifier){ret.params.push(parseFunctionTypeParam());if(!match(")")){expect(",")}}if(match("...")){lex();ret.rest=parseFunctionTypeParam()}return ret}function parsePrimaryType(){var typeIdentifier=null,params=null,returnType=null,marker=markerCreate(),rest=null,tmp,typeParameters,token,type,isGroupedType=false;switch(lookahead.type){case Token.Identifier:switch(lookahead.value){case"any":lex();return markerApply(marker,delegate.createAnyTypeAnnotation());case"bool":case"boolean":lex();return markerApply(marker,delegate.createBooleanTypeAnnotation());case"number":lex();return markerApply(marker,delegate.createNumberTypeAnnotation());case"string":lex();return markerApply(marker,delegate.createStringTypeAnnotation())}return markerApply(marker,parseGenericType());case Token.Punctuator:switch(lookahead.value){case"{":return markerApply(marker,parseObjectType());case"[":return parseTupleType();case"<":typeParameters=parseTypeParameterDeclaration();expect("(");tmp=parseFunctionTypeParams();params=tmp.params;rest=tmp.rest;expect(")");expect("=>");returnType=parseType();return markerApply(marker,delegate.createFunctionTypeAnnotation(params,returnType,rest,typeParameters));case"(":lex();if(!match(")")&&!match("...")){if(lookahead.type===Token.Identifier){token=lookahead2();isGroupedType=token.value!=="?"&&token.value!==":"}else{isGroupedType=true}}if(isGroupedType){type=parseType();expect(")");if(match("=>")){throwError({},Messages.ConfusedAboutFunctionType)}return type}tmp=parseFunctionTypeParams();params=tmp.params;rest=tmp.rest;expect(")");expect("=>");returnType=parseType();return markerApply(marker,delegate.createFunctionTypeAnnotation(params,returnType,rest,null))}break;case Token.Keyword:switch(lookahead.value){case"void":return markerApply(marker,parseVoidType());case"typeof":return markerApply(marker,parseTypeofType())}break;case Token.StringLiteral:token=lex();if(token.octal){throwError(token,Messages.StrictOctalLiteral)}return markerApply(marker,delegate.createStringLiteralTypeAnnotation(token))}throwUnexpected(lookahead)}function parsePostfixType(){var marker=markerCreate(),t=parsePrimaryType();if(match("[")){expect("[");expect("]");return markerApply(marker,delegate.createArrayTypeAnnotation(t))}return t}function parsePrefixType(){var marker=markerCreate();if(match("?")){lex();return markerApply(marker,delegate.createNullableTypeAnnotation(parsePrefixType()))}return parsePostfixType()}function parseIntersectionType(){var marker=markerCreate(),type,types;type=parsePrefixType();types=[type];while(match("&")){lex();types.push(parsePrefixType())}return types.length===1?type:markerApply(marker,delegate.createIntersectionTypeAnnotation(types))}function parseUnionType(){var marker=markerCreate(),type,types;type=parseIntersectionType();types=[type];while(match("|")){lex();types.push(parseIntersectionType())}return types.length===1?type:markerApply(marker,delegate.createUnionTypeAnnotation(types))}function parseType(){var oldInType=state.inType,type;state.inType=true;type=parseUnionType();state.inType=oldInType;return type}function parseTypeAnnotation(){var marker=markerCreate(),type;expect(":");type=parseType();return markerApply(marker,delegate.createTypeAnnotation(type))}function parseVariableIdentifier(){var marker=markerCreate(),token=lex();if(token.type!==Token.Identifier){throwUnexpected(token)}return markerApply(marker,delegate.createIdentifier(token.value))}function parseTypeAnnotatableIdentifier(requireTypeAnnotation,canBeOptionalParam){var marker=markerCreate(),ident=parseVariableIdentifier(),isOptionalParam=false;if(canBeOptionalParam&&match("?")){expect("?");isOptionalParam=true}if(requireTypeAnnotation||match(":")){ident.typeAnnotation=parseTypeAnnotation();ident=markerApply(marker,ident)}if(isOptionalParam){ident.optional=true;ident=markerApply(marker,ident)}return ident}function parseVariableDeclaration(kind){var id,marker=markerCreate(),init=null,typeAnnotationMarker=markerCreate();if(match("{")){id=parseObjectInitialiser();reinterpretAsAssignmentBindingPattern(id);if(match(":")){id.typeAnnotation=parseTypeAnnotation();markerApply(typeAnnotationMarker,id)}}else if(match("[")){id=parseArrayInitialiser();reinterpretAsAssignmentBindingPattern(id);if(match(":")){id.typeAnnotation=parseTypeAnnotation();markerApply(typeAnnotationMarker,id)}}else{id=state.allowKeyword?parseNonComputedProperty():parseTypeAnnotatableIdentifier();if(strict&&isRestrictedWord(id.name)){throwErrorTolerant({},Messages.StrictVarName)}}if(kind==="const"){if(!match("=")){throwError({},Messages.NoUnintializedConst)}expect("=");init=parseAssignmentExpression()}else if(match("=")){lex();init=parseAssignmentExpression()}return markerApply(marker,delegate.createVariableDeclarator(id,init))}function parseVariableDeclarationList(kind){var list=[];do{list.push(parseVariableDeclaration(kind));if(!match(",")){break}lex()}while(index<length);return list}function parseVariableStatement(){var declarations,marker=markerCreate();expectKeyword("var");declarations=parseVariableDeclarationList();consumeSemicolon();return markerApply(marker,delegate.createVariableDeclaration(declarations,"var"))}function parseConstLetDeclaration(kind){var declarations,marker=markerCreate();expectKeyword(kind);declarations=parseVariableDeclarationList(kind);consumeSemicolon();return markerApply(marker,delegate.createVariableDeclaration(declarations,kind))}function parseModuleSpecifier(){var marker=markerCreate(),specifier;if(lookahead.type!==Token.StringLiteral){throwError({},Messages.InvalidModuleSpecifier)}specifier=delegate.createModuleSpecifier(lookahead);lex();return markerApply(marker,specifier)}function parseExportBatchSpecifier(){var marker=markerCreate();expect("*");return markerApply(marker,delegate.createExportBatchSpecifier())}function parseExportSpecifier(){var id,name=null,marker=markerCreate(),from;if(matchKeyword("default")){lex();id=markerApply(marker,delegate.createIdentifier("default"))}else{id=parseVariableIdentifier()}if(matchContextualKeyword("as")){lex();name=parseNonComputedProperty()}return markerApply(marker,delegate.createExportSpecifier(id,name))}function parseExportDeclaration(){var backtrackToken,id,previousAllowKeyword,declaration=null,isExportFromIdentifier,src=null,specifiers=[],marker=markerCreate();expectKeyword("export");if(matchKeyword("default")){lex();if(matchKeyword("function")||matchKeyword("class")){backtrackToken=lookahead;lex();if(isIdentifierName(lookahead)){id=parseNonComputedProperty();rewind(backtrackToken);return markerApply(marker,delegate.createExportDeclaration(true,parseSourceElement(),[id],null))}rewind(backtrackToken);switch(lookahead.value){case"class":return markerApply(marker,delegate.createExportDeclaration(true,parseClassExpression(),[],null));case"function":return markerApply(marker,delegate.createExportDeclaration(true,parseFunctionExpression(),[],null))}}if(matchContextualKeyword("from")){throwError({},Messages.UnexpectedToken,lookahead.value)}if(match("{")){declaration=parseObjectInitialiser()}else if(match("[")){declaration=parseArrayInitialiser()}else{declaration=parseAssignmentExpression()}consumeSemicolon();return markerApply(marker,delegate.createExportDeclaration(true,declaration,[],null))}if(lookahead.type===Token.Keyword){switch(lookahead.value){case"let":case"const":case"var":case"class":case"function":return markerApply(marker,delegate.createExportDeclaration(false,parseSourceElement(),specifiers,null))}}if(match("*")){specifiers.push(parseExportBatchSpecifier());if(!matchContextualKeyword("from")){throwError({},lookahead.value?Messages.UnexpectedToken:Messages.MissingFromClause,lookahead.value)}lex();src=parseModuleSpecifier();consumeSemicolon();return markerApply(marker,delegate.createExportDeclaration(false,null,specifiers,src))}expect("{");do{isExportFromIdentifier=isExportFromIdentifier||matchKeyword("default");specifiers.push(parseExportSpecifier())}while(match(",")&&lex());expect("}");if(matchContextualKeyword("from")){lex();src=parseModuleSpecifier();consumeSemicolon()}else if(isExportFromIdentifier){throwError({},lookahead.value?Messages.UnexpectedToken:Messages.MissingFromClause,lookahead.value)}else{consumeSemicolon()}return markerApply(marker,delegate.createExportDeclaration(false,declaration,specifiers,src))}function parseImportSpecifier(){var id,name=null,marker=markerCreate();id=parseNonComputedProperty();if(matchContextualKeyword("as")){lex();name=parseVariableIdentifier()}return markerApply(marker,delegate.createImportSpecifier(id,name))}function parseNamedImports(){var specifiers=[];expect("{");do{specifiers.push(parseImportSpecifier())}while(match(",")&&lex());expect("}");return specifiers}function parseImportDefaultSpecifier(){var id,marker=markerCreate();id=parseNonComputedProperty();return markerApply(marker,delegate.createImportDefaultSpecifier(id))}function parseImportNamespaceSpecifier(){var id,marker=markerCreate();expect("*");if(!matchContextualKeyword("as")){throwError({},Messages.NoAsAfterImportNamespace)}lex();id=parseNonComputedProperty();return markerApply(marker,delegate.createImportNamespaceSpecifier(id))}function parseImportDeclaration(){var specifiers,src,marker=markerCreate();expectKeyword("import");specifiers=[];if(lookahead.type===Token.StringLiteral){src=parseModuleSpecifier();consumeSemicolon();return markerApply(marker,delegate.createImportDeclaration(specifiers,src))}if(!matchKeyword("default")&&isIdentifierName(lookahead)){specifiers.push(parseImportDefaultSpecifier());if(match(",")){lex()}}if(match("*")){specifiers.push(parseImportNamespaceSpecifier())}else if(match("{")){specifiers=specifiers.concat(parseNamedImports())}if(!matchContextualKeyword("from")){throwError({},lookahead.value?Messages.UnexpectedToken:Messages.MissingFromClause,lookahead.value)}lex();src=parseModuleSpecifier();consumeSemicolon();return markerApply(marker,delegate.createImportDeclaration(specifiers,src))}function parseEmptyStatement(){var marker=markerCreate();expect(";");return markerApply(marker,delegate.createEmptyStatement())}function parseExpressionStatement(){var marker=markerCreate(),expr=parseExpression();consumeSemicolon();return markerApply(marker,delegate.createExpressionStatement(expr))}function parseIfStatement(){var test,consequent,alternate,marker=markerCreate();expectKeyword("if");expect("(");test=parseExpression();expect(")");consequent=parseStatement();if(matchKeyword("else")){lex();alternate=parseStatement()}else{alternate=null}return markerApply(marker,delegate.createIfStatement(test,consequent,alternate))}function parseDoWhileStatement(){var body,test,oldInIteration,marker=markerCreate();expectKeyword("do");oldInIteration=state.inIteration;state.inIteration=true;body=parseStatement();state.inIteration=oldInIteration;expectKeyword("while");expect("(");test=parseExpression();expect(")");if(match(";")){lex()}return markerApply(marker,delegate.createDoWhileStatement(body,test))}function parseWhileStatement(){var test,body,oldInIteration,marker=markerCreate();expectKeyword("while");expect("(");test=parseExpression();expect(")");oldInIteration=state.inIteration;state.inIteration=true;body=parseStatement();state.inIteration=oldInIteration;return markerApply(marker,delegate.createWhileStatement(test,body))}function parseForVariableDeclaration(){var marker=markerCreate(),token=lex(),declarations=parseVariableDeclarationList();return markerApply(marker,delegate.createVariableDeclaration(declarations,token.value))}function parseForStatement(opts){var init,test,update,left,right,body,operator,oldInIteration,marker=markerCreate();init=test=update=null;expectKeyword("for");if(matchContextualKeyword("each")){throwError({},Messages.EachNotAllowed)}expect("(");if(match(";")){lex()}else{if(matchKeyword("var")||matchKeyword("let")||matchKeyword("const")){state.allowIn=false;init=parseForVariableDeclaration();state.allowIn=true;if(init.declarations.length===1){if(matchKeyword("in")||matchContextualKeyword("of")){operator=lookahead;if(!((operator.value==="in"||init.kind!=="var")&&init.declarations[0].init)){lex();left=init;right=parseExpression();init=null}}}}else{state.allowIn=false;init=parseExpression();state.allowIn=true;if(matchContextualKeyword("of")){operator=lex();left=init;right=parseExpression();init=null}else if(matchKeyword("in")){if(!isAssignableLeftHandSide(init)){throwError({},Messages.InvalidLHSInForIn)}operator=lex();left=init;right=parseExpression();init=null}}if(typeof left==="undefined"){expect(";")}}if(typeof left==="undefined"){if(!match(";")){test=parseExpression()}expect(";");if(!match(")")){update=parseExpression()}}expect(")");oldInIteration=state.inIteration;state.inIteration=true;if(!(opts!==undefined&&opts.ignoreBody)){body=parseStatement()}state.inIteration=oldInIteration;if(typeof left==="undefined"){return markerApply(marker,delegate.createForStatement(init,test,update,body))}if(operator.value==="in"){return markerApply(marker,delegate.createForInStatement(left,right,body))}return markerApply(marker,delegate.createForOfStatement(left,right,body))}function parseContinueStatement(){var label=null,key,marker=markerCreate();expectKeyword("continue");if(source.charCodeAt(index)===59){lex();if(!state.inIteration){throwError({},Messages.IllegalContinue)}return markerApply(marker,delegate.createContinueStatement(null))}if(peekLineTerminator()){if(!state.inIteration){throwError({},Messages.IllegalContinue)}return markerApply(marker,delegate.createContinueStatement(null))}if(lookahead.type===Token.Identifier){label=parseVariableIdentifier();key="$"+label.name;if(!Object.prototype.hasOwnProperty.call(state.labelSet,key)){throwError({},Messages.UnknownLabel,label.name)}}consumeSemicolon();if(label===null&&!state.inIteration){throwError({},Messages.IllegalContinue)}return markerApply(marker,delegate.createContinueStatement(label))}function parseBreakStatement(){var label=null,key,marker=markerCreate();expectKeyword("break");if(source.charCodeAt(index)===59){lex();if(!(state.inIteration||state.inSwitch)){throwError({},Messages.IllegalBreak)}return markerApply(marker,delegate.createBreakStatement(null))}if(peekLineTerminator()){if(!(state.inIteration||state.inSwitch)){throwError({},Messages.IllegalBreak)}return markerApply(marker,delegate.createBreakStatement(null))}if(lookahead.type===Token.Identifier){label=parseVariableIdentifier();key="$"+label.name;if(!Object.prototype.hasOwnProperty.call(state.labelSet,key)){throwError({},Messages.UnknownLabel,label.name)}}consumeSemicolon();if(label===null&&!(state.inIteration||state.inSwitch)){throwError({},Messages.IllegalBreak)}return markerApply(marker,delegate.createBreakStatement(label))}function parseReturnStatement(){var argument=null,marker=markerCreate();expectKeyword("return");if(!state.inFunctionBody){throwErrorTolerant({},Messages.IllegalReturn)}if(source.charCodeAt(index)===32){if(isIdentifierStart(source.charCodeAt(index+1))){argument=parseExpression();consumeSemicolon();return markerApply(marker,delegate.createReturnStatement(argument))}}if(peekLineTerminator()){return markerApply(marker,delegate.createReturnStatement(null))}if(!match(";")){if(!match("}")&&lookahead.type!==Token.EOF){argument=parseExpression()}}consumeSemicolon();return markerApply(marker,delegate.createReturnStatement(argument))}function parseWithStatement(){var object,body,marker=markerCreate();if(strict){throwErrorTolerant({},Messages.StrictModeWith)}expectKeyword("with");expect("(");object=parseExpression();expect(")");body=parseStatement();return markerApply(marker,delegate.createWithStatement(object,body))}function parseSwitchCase(){var test,consequent=[],sourceElement,marker=markerCreate();if(matchKeyword("default")){lex();test=null}else{expectKeyword("case");test=parseExpression()}expect(":");while(index<length){if(match("}")||matchKeyword("default")||matchKeyword("case")){break}sourceElement=parseSourceElement();if(typeof sourceElement==="undefined"){break}consequent.push(sourceElement)}return markerApply(marker,delegate.createSwitchCase(test,consequent))}function parseSwitchStatement(){var discriminant,cases,clause,oldInSwitch,defaultFound,marker=markerCreate();expectKeyword("switch");expect("(");discriminant=parseExpression();expect(")");expect("{");cases=[];if(match("}")){lex();return markerApply(marker,delegate.createSwitchStatement(discriminant,cases))}oldInSwitch=state.inSwitch;state.inSwitch=true;defaultFound=false;while(index<length){if(match("}")){break}clause=parseSwitchCase();if(clause.test===null){if(defaultFound){throwError({},Messages.MultipleDefaultsInSwitch)}defaultFound=true}cases.push(clause)}state.inSwitch=oldInSwitch;expect("}");return markerApply(marker,delegate.createSwitchStatement(discriminant,cases))}function parseThrowStatement(){var argument,marker=markerCreate();expectKeyword("throw");if(peekLineTerminator()){throwError({},Messages.NewlineAfterThrow)}argument=parseExpression();consumeSemicolon();return markerApply(marker,delegate.createThrowStatement(argument))}function parseCatchClause(){var param,body,marker=markerCreate();expectKeyword("catch");expect("(");if(match(")")){throwUnexpected(lookahead)}param=parseExpression();if(strict&¶m.type===Syntax.Identifier&&isRestrictedWord(param.name)){throwErrorTolerant({},Messages.StrictCatchVariable)}expect(")");body=parseBlock();return markerApply(marker,delegate.createCatchClause(param,body))}function parseTryStatement(){var block,handlers=[],finalizer=null,marker=markerCreate();expectKeyword("try");block=parseBlock();if(matchKeyword("catch")){handlers.push(parseCatchClause())}if(matchKeyword("finally")){lex();finalizer=parseBlock()}if(handlers.length===0&&!finalizer){throwError({},Messages.NoCatchOrFinally)}return markerApply(marker,delegate.createTryStatement(block,[],handlers,finalizer))}function parseDebuggerStatement(){var marker=markerCreate();expectKeyword("debugger");consumeSemicolon();return markerApply(marker,delegate.createDebuggerStatement())}function parseStatement(){var type=lookahead.type,marker,expr,labeledBody,key;if(type===Token.EOF){throwUnexpected(lookahead)}if(type===Token.Punctuator){switch(lookahead.value){case";":return parseEmptyStatement();case"{":return parseBlock();case"(":return parseExpressionStatement();default:break}}if(type===Token.Keyword){switch(lookahead.value){case"break":return parseBreakStatement();case"continue":return parseContinueStatement();case"debugger":return parseDebuggerStatement();case"do":return parseDoWhileStatement();case"for":return parseForStatement();case"function":return parseFunctionDeclaration();case"class":return parseClassDeclaration();case"if":return parseIfStatement();case"return":return parseReturnStatement();case"switch":return parseSwitchStatement();case"throw":return parseThrowStatement();case"try":return parseTryStatement();case"var":return parseVariableStatement();case"while":return parseWhileStatement();case"with":return parseWithStatement();default:break}}if(matchAsyncFuncExprOrDecl()){return parseFunctionDeclaration()}marker=markerCreate();expr=parseExpression();if(expr.type===Syntax.Identifier&&match(":")){lex();key="$"+expr.name;if(Object.prototype.hasOwnProperty.call(state.labelSet,key)){throwError({},Messages.Redeclaration,"Label",expr.name)}state.labelSet[key]=true;labeledBody=parseStatement();delete state.labelSet[key];return markerApply(marker,delegate.createLabeledStatement(expr,labeledBody))}consumeSemicolon();return markerApply(marker,delegate.createExpressionStatement(expr))}function parseConciseBody(){if(match("{")){return parseFunctionSourceElements()}return parseAssignmentExpression()}function parseFunctionSourceElements(){var sourceElement,sourceElements=[],token,directive,firstRestricted,oldLabelSet,oldInIteration,oldInSwitch,oldInFunctionBody,oldParenthesizedCount,marker=markerCreate();expect("{");while(index<length){if(lookahead.type!==Token.StringLiteral){break}token=lookahead;sourceElement=parseSourceElement();sourceElements.push(sourceElement);if(sourceElement.expression.type!==Syntax.Literal){break}directive=source.slice(token.range[0]+1,token.range[1]-1);if(directive==="use strict"){strict=true;
if(firstRestricted){throwErrorTolerant(firstRestricted,Messages.StrictOctalLiteral)}}else{if(!firstRestricted&&token.octal){firstRestricted=token}}}oldLabelSet=state.labelSet;oldInIteration=state.inIteration;oldInSwitch=state.inSwitch;oldInFunctionBody=state.inFunctionBody;oldParenthesizedCount=state.parenthesizedCount;state.labelSet={};state.inIteration=false;state.inSwitch=false;state.inFunctionBody=true;state.parenthesizedCount=0;while(index<length){if(match("}")){break}sourceElement=parseSourceElement();if(typeof sourceElement==="undefined"){break}sourceElements.push(sourceElement)}expect("}");state.labelSet=oldLabelSet;state.inIteration=oldInIteration;state.inSwitch=oldInSwitch;state.inFunctionBody=oldInFunctionBody;state.parenthesizedCount=oldParenthesizedCount;return markerApply(marker,delegate.createBlockStatement(sourceElements))}function validateParam(options,param,name){var key="$"+name;if(strict){if(isRestrictedWord(name)){options.stricted=param;options.message=Messages.StrictParamName}if(Object.prototype.hasOwnProperty.call(options.paramSet,key)){options.stricted=param;options.message=Messages.StrictParamDupe}}else if(!options.firstRestricted){if(isRestrictedWord(name)){options.firstRestricted=param;options.message=Messages.StrictParamName}else if(isStrictModeReservedWord(name)){options.firstRestricted=param;options.message=Messages.StrictReservedWord}else if(Object.prototype.hasOwnProperty.call(options.paramSet,key)){options.firstRestricted=param;options.message=Messages.StrictParamDupe}}options.paramSet[key]=true}function parseParam(options){var marker,token,rest,param,def;token=lookahead;if(token.value==="..."){token=lex();rest=true}if(match("[")){marker=markerCreate();param=parseArrayInitialiser();reinterpretAsDestructuredParameter(options,param);if(match(":")){param.typeAnnotation=parseTypeAnnotation();markerApply(marker,param)}}else if(match("{")){marker=markerCreate();if(rest){throwError({},Messages.ObjectPatternAsRestParameter)}param=parseObjectInitialiser();reinterpretAsDestructuredParameter(options,param);if(match(":")){param.typeAnnotation=parseTypeAnnotation();markerApply(marker,param)}}else{param=rest?parseTypeAnnotatableIdentifier(false,false):parseTypeAnnotatableIdentifier(false,true);validateParam(options,token,token.value)}if(match("=")){if(rest){throwErrorTolerant(lookahead,Messages.DefaultRestParameter)}lex();def=parseAssignmentExpression();++options.defaultCount}if(rest){if(!match(")")){throwError({},Messages.ParameterAfterRestParameter)}options.rest=param;return false}options.params.push(param);options.defaults.push(def);return!match(")")}function parseParams(firstRestricted){var options,marker=markerCreate();options={params:[],defaultCount:0,defaults:[],rest:null,firstRestricted:firstRestricted};expect("(");if(!match(")")){options.paramSet={};while(index<length){if(!parseParam(options)){break}expect(",")}}expect(")");if(options.defaultCount===0){options.defaults=[]}if(match(":")){options.returnType=parseTypeAnnotation()}return markerApply(marker,options)}function parseFunctionDeclaration(){var id,body,token,tmp,firstRestricted,message,generator,isAsync,previousStrict,previousYieldAllowed,previousAwaitAllowed,marker=markerCreate(),typeParameters;isAsync=false;if(matchAsync()){lex();isAsync=true}expectKeyword("function");generator=false;if(match("*")){lex();generator=true}token=lookahead;id=parseVariableIdentifier();if(match("<")){typeParameters=parseTypeParameterDeclaration()}if(strict){if(isRestrictedWord(token.value)){throwErrorTolerant(token,Messages.StrictFunctionName)}}else{if(isRestrictedWord(token.value)){firstRestricted=token;message=Messages.StrictFunctionName}else if(isStrictModeReservedWord(token.value)){firstRestricted=token;message=Messages.StrictReservedWord}}tmp=parseParams(firstRestricted);firstRestricted=tmp.firstRestricted;if(tmp.message){message=tmp.message}previousStrict=strict;previousYieldAllowed=state.yieldAllowed;state.yieldAllowed=generator;previousAwaitAllowed=state.awaitAllowed;state.awaitAllowed=isAsync;body=parseFunctionSourceElements();if(strict&&firstRestricted){throwError(firstRestricted,message)}if(strict&&tmp.stricted){throwErrorTolerant(tmp.stricted,message)}strict=previousStrict;state.yieldAllowed=previousYieldAllowed;state.awaitAllowed=previousAwaitAllowed;return markerApply(marker,delegate.createFunctionDeclaration(id,tmp.params,tmp.defaults,body,tmp.rest,generator,false,isAsync,tmp.returnType,typeParameters))}function parseFunctionExpression(){var token,id=null,firstRestricted,message,tmp,body,generator,isAsync,previousStrict,previousYieldAllowed,previousAwaitAllowed,marker=markerCreate(),typeParameters;isAsync=false;if(matchAsync()){lex();isAsync=true}expectKeyword("function");generator=false;if(match("*")){lex();generator=true}if(!match("(")){if(!match("<")){token=lookahead;id=parseVariableIdentifier();if(strict){if(isRestrictedWord(token.value)){throwErrorTolerant(token,Messages.StrictFunctionName)}}else{if(isRestrictedWord(token.value)){firstRestricted=token;message=Messages.StrictFunctionName}else if(isStrictModeReservedWord(token.value)){firstRestricted=token;message=Messages.StrictReservedWord}}}if(match("<")){typeParameters=parseTypeParameterDeclaration()}}tmp=parseParams(firstRestricted);firstRestricted=tmp.firstRestricted;if(tmp.message){message=tmp.message}previousStrict=strict;previousYieldAllowed=state.yieldAllowed;state.yieldAllowed=generator;previousAwaitAllowed=state.awaitAllowed;state.awaitAllowed=isAsync;body=parseFunctionSourceElements();if(strict&&firstRestricted){throwError(firstRestricted,message)}if(strict&&tmp.stricted){throwErrorTolerant(tmp.stricted,message)}strict=previousStrict;state.yieldAllowed=previousYieldAllowed;state.awaitAllowed=previousAwaitAllowed;return markerApply(marker,delegate.createFunctionExpression(id,tmp.params,tmp.defaults,body,tmp.rest,generator,false,isAsync,tmp.returnType,typeParameters))}function parseYieldExpression(){var delegateFlag,expr,marker=markerCreate();expectKeyword("yield",!strict);delegateFlag=false;if(match("*")){lex();delegateFlag=true}expr=parseAssignmentExpression();return markerApply(marker,delegate.createYieldExpression(expr,delegateFlag))}function parseAwaitExpression(){var expr,marker=markerCreate();expectContextualKeyword("await");expr=parseAssignmentExpression();return markerApply(marker,delegate.createAwaitExpression(expr))}function parseMethodDefinition(existingPropNames,key,isStatic,generator,computed){var token,param,propType,isValidDuplicateProp=false,isAsync,typeParameters,tokenValue,returnType,annotationMarker;propType=isStatic?ClassPropertyType.static:ClassPropertyType.prototype;if(generator){return delegate.createMethodDefinition(propType,"",key,parsePropertyMethodFunction({generator:true}))}tokenValue=key.type==="Identifier"&&key.name;if(tokenValue==="get"&&!match("(")){key=parseObjectPropertyKey();if(existingPropNames[propType].hasOwnProperty(key.name)){isValidDuplicateProp=existingPropNames[propType][key.name].get===undefined&&existingPropNames[propType][key.name].data===undefined&&existingPropNames[propType][key.name].set!==undefined;if(!isValidDuplicateProp){throwError(key,Messages.IllegalDuplicateClassProperty)}}else{existingPropNames[propType][key.name]={}}existingPropNames[propType][key.name].get=true;expect("(");expect(")");if(match(":")){returnType=parseTypeAnnotation()}return delegate.createMethodDefinition(propType,"get",key,parsePropertyFunction({generator:false,returnType:returnType}))}if(tokenValue==="set"&&!match("(")){key=parseObjectPropertyKey();if(existingPropNames[propType].hasOwnProperty(key.name)){isValidDuplicateProp=existingPropNames[propType][key.name].set===undefined&&existingPropNames[propType][key.name].data===undefined&&existingPropNames[propType][key.name].get!==undefined;if(!isValidDuplicateProp){throwError(key,Messages.IllegalDuplicateClassProperty)}}else{existingPropNames[propType][key.name]={}}existingPropNames[propType][key.name].set=true;expect("(");token=lookahead;param=[parseTypeAnnotatableIdentifier()];expect(")");if(match(":")){returnType=parseTypeAnnotation()}return delegate.createMethodDefinition(propType,"set",key,parsePropertyFunction({params:param,generator:false,name:token,returnType:returnType}))}if(match("<")){typeParameters=parseTypeParameterDeclaration()}isAsync=tokenValue==="async"&&!match("(");if(isAsync){key=parseObjectPropertyKey()}if(existingPropNames[propType].hasOwnProperty(key.name)){throwError(key,Messages.IllegalDuplicateClassProperty)}else{existingPropNames[propType][key.name]={}}existingPropNames[propType][key.name].data=true;return delegate.createMethodDefinition(propType,"",key,parsePropertyMethodFunction({generator:false,async:isAsync,typeParameters:typeParameters}))}function parseClassProperty(existingPropNames,key,computed,isStatic){var typeAnnotation;typeAnnotation=parseTypeAnnotation();expect(";");return delegate.createClassProperty(key,typeAnnotation,computed,isStatic)}function parseClassElement(existingProps){var computed,generator=false,key,marker=markerCreate(),isStatic=false;if(match(";")){lex();return}if(lookahead.value==="static"){lex();isStatic=true}if(match("*")){lex();generator=true}computed=lookahead.value==="[";key=parseObjectPropertyKey();if(!generator&&lookahead.value===":"){return markerApply(marker,parseClassProperty(existingProps,key,computed,isStatic))}return markerApply(marker,parseMethodDefinition(existingProps,key,isStatic,generator,computed))}function parseClassBody(){var classElement,classElements=[],existingProps={},marker=markerCreate();existingProps[ClassPropertyType.static]={};existingProps[ClassPropertyType.prototype]={};expect("{");while(index<length){if(match("}")){break}classElement=parseClassElement(existingProps);if(typeof classElement!=="undefined"){classElements.push(classElement)}}expect("}");return markerApply(marker,delegate.createClassBody(classElements))}function parseClassImplements(){var id,implemented=[],marker,typeParameters;expectContextualKeyword("implements");while(index<length){marker=markerCreate();id=parseVariableIdentifier();if(match("<")){typeParameters=parseTypeParameterInstantiation()}else{typeParameters=null}implemented.push(markerApply(marker,delegate.createClassImplements(id,typeParameters)));if(!match(",")){break}expect(",")}return implemented}function parseClassExpression(){var id,implemented,previousYieldAllowed,superClass=null,superTypeParameters,marker=markerCreate(),typeParameters;expectKeyword("class");if(!matchKeyword("extends")&&!matchContextualKeyword("implements")&&!match("{")){id=parseVariableIdentifier()}if(match("<")){typeParameters=parseTypeParameterDeclaration()}if(matchKeyword("extends")){expectKeyword("extends");previousYieldAllowed=state.yieldAllowed;state.yieldAllowed=false;superClass=parseLeftHandSideExpressionAllowCall();if(match("<")){superTypeParameters=parseTypeParameterInstantiation()}state.yieldAllowed=previousYieldAllowed}if(matchContextualKeyword("implements")){implemented=parseClassImplements()}return markerApply(marker,delegate.createClassExpression(id,superClass,parseClassBody(),typeParameters,superTypeParameters,implemented))}function parseClassDeclaration(){var id,implemented,previousYieldAllowed,superClass=null,superTypeParameters,marker=markerCreate(),typeParameters;expectKeyword("class");id=parseVariableIdentifier();if(match("<")){typeParameters=parseTypeParameterDeclaration()}if(matchKeyword("extends")){expectKeyword("extends");previousYieldAllowed=state.yieldAllowed;state.yieldAllowed=false;superClass=parseLeftHandSideExpressionAllowCall();if(match("<")){superTypeParameters=parseTypeParameterInstantiation()}state.yieldAllowed=previousYieldAllowed}if(matchContextualKeyword("implements")){implemented=parseClassImplements()}return markerApply(marker,delegate.createClassDeclaration(id,superClass,parseClassBody(),typeParameters,superTypeParameters,implemented))}function parseSourceElement(){var token;if(lookahead.type===Token.Keyword){switch(lookahead.value){case"const":case"let":return parseConstLetDeclaration(lookahead.value);case"function":return parseFunctionDeclaration();default:return parseStatement()}}if(matchContextualKeyword("type")&&lookahead2().type===Token.Identifier){return parseTypeAlias()}if(matchContextualKeyword("interface")&&lookahead2().type===Token.Identifier){return parseInterface()}if(matchContextualKeyword("declare")){token=lookahead2();if(token.type===Token.Keyword){switch(token.value){case"class":return parseDeclareClass();case"function":return parseDeclareFunction();case"var":return parseDeclareVariable()}}else if(token.type===Token.Identifier&&token.value==="module"){return parseDeclareModule()}}if(lookahead.type!==Token.EOF){return parseStatement()}}function parseProgramElement(){if(lookahead.type===Token.Keyword){switch(lookahead.value){case"export":return parseExportDeclaration();case"import":return parseImportDeclaration()}}return parseSourceElement()}function parseProgramElements(){var sourceElement,sourceElements=[],token,directive,firstRestricted;while(index<length){token=lookahead;if(token.type!==Token.StringLiteral){break}sourceElement=parseProgramElement();sourceElements.push(sourceElement);if(sourceElement.expression.type!==Syntax.Literal){break}directive=source.slice(token.range[0]+1,token.range[1]-1);if(directive==="use strict"){strict=true;if(firstRestricted){throwErrorTolerant(firstRestricted,Messages.StrictOctalLiteral)}}else{if(!firstRestricted&&token.octal){firstRestricted=token}}}while(index<length){sourceElement=parseProgramElement();if(typeof sourceElement==="undefined"){break}sourceElements.push(sourceElement)}return sourceElements}function parseProgram(){var body,marker=markerCreate();strict=false;peek();body=parseProgramElements();return markerApply(marker,delegate.createProgram(body))}function addComment(type,value,start,end,loc){var comment;assert(typeof start==="number","Comment must have valid position");if(state.lastCommentStart>=start){return}state.lastCommentStart=start;comment={type:type,value:value};if(extra.range){comment.range=[start,end]}if(extra.loc){comment.loc=loc}extra.comments.push(comment);if(extra.attachComment){extra.leadingComments.push(comment);extra.trailingComments.push(comment)}}function scanComment(){var comment,ch,loc,start,blockComment,lineComment;comment="";blockComment=false;lineComment=false;while(index<length){ch=source[index];if(lineComment){ch=source[index++];if(isLineTerminator(ch.charCodeAt(0))){loc.end={line:lineNumber,column:index-lineStart-1};lineComment=false;addComment("Line",comment,start,index-1,loc);if(ch==="\r"&&source[index]==="\n"){++index}++lineNumber;lineStart=index;comment=""}else if(index>=length){lineComment=false;comment+=ch;loc.end={line:lineNumber,column:length-lineStart};addComment("Line",comment,start,length,loc)}else{comment+=ch}}else if(blockComment){if(isLineTerminator(ch.charCodeAt(0))){if(ch==="\r"){++index;comment+="\r"}if(ch!=="\r"||source[index]==="\n"){comment+=source[index];++lineNumber;++index;lineStart=index;if(index>=length){throwError({},Messages.UnexpectedToken,"ILLEGAL")}}}else{ch=source[index++];if(index>=length){throwError({},Messages.UnexpectedToken,"ILLEGAL")}comment+=ch;if(ch==="*"){ch=source[index];if(ch==="/"){comment=comment.substr(0,comment.length-1);blockComment=false;++index;loc.end={line:lineNumber,column:index-lineStart};addComment("Block",comment,start,index,loc);comment=""}}}}else if(ch==="/"){ch=source[index+1];if(ch==="/"){loc={start:{line:lineNumber,column:index-lineStart}};start=index;index+=2;lineComment=true;if(index>=length){loc.end={line:lineNumber,column:index-lineStart};lineComment=false;addComment("Line",comment,start,index,loc)}}else if(ch==="*"){start=index;index+=2;blockComment=true;loc={start:{line:lineNumber,column:index-lineStart-2}};if(index>=length){throwError({},Messages.UnexpectedToken,"ILLEGAL")}}else{break}}else if(isWhiteSpace(ch.charCodeAt(0))){++index}else if(isLineTerminator(ch.charCodeAt(0))){++index;if(ch==="\r"&&source[index]==="\n"){++index}++lineNumber;lineStart=index}else{break}}}XHTMLEntities={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 getQualifiedXJSName(object){if(object.type===Syntax.XJSIdentifier){return object.name}if(object.type===Syntax.XJSNamespacedName){return object.namespace.name+":"+object.name.name}if(object.type===Syntax.XJSMemberExpression){return getQualifiedXJSName(object.object)+"."+getQualifiedXJSName(object.property)}}function isXJSIdentifierStart(ch){return ch!==92&&isIdentifierStart(ch)}function isXJSIdentifierPart(ch){return ch!==92&&(ch===45||isIdentifierPart(ch))}function scanXJSIdentifier(){var ch,start,value="";start=index;while(index<length){ch=source.charCodeAt(index);if(!isXJSIdentifierPart(ch)){break}value+=source[index++]}return{type:Token.XJSIdentifier,value:value,lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}function scanXJSEntity(){var ch,str="",start=index,count=0,code;ch=source[index];assert(ch==="&","Entity must start with an ampersand");index++;while(index<length&&count++<10){ch=source[index++];if(ch===";"){break}str+=ch}if(ch===";"){if(str[0]==="#"){if(str[1]==="x"){code=+("0"+str.substr(1))}else{code=+str.substr(1).replace(Regex.LeadingZeros,"")}if(!isNaN(code)){return String.fromCharCode(code)}}else if(XHTMLEntities[str]){return XHTMLEntities[str]}}index=start+1;return"&"}function scanXJSText(stopChars){var ch,str="",start;start=index;while(index<length){ch=source[index];if(stopChars.indexOf(ch)!==-1){break}if(ch==="&"){str+=scanXJSEntity()}else{index++;if(ch==="\r"&&source[index]==="\n"){str+=ch;ch=source[index];index++}if(isLineTerminator(ch.charCodeAt(0))){++lineNumber;lineStart=index}str+=ch}}return{type:Token.XJSText,value:str,lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}function scanXJSStringLiteral(){var innerToken,quote,start;quote=source[index];assert(quote==="'"||quote==='"',"String literal must starts with a quote");start=index;++index;innerToken=scanXJSText([quote]);if(quote!==source[index]){throwError({},Messages.UnexpectedToken,"ILLEGAL")}++index;innerToken.range=[start,index];return innerToken}function advanceXJSChild(){var ch=source.charCodeAt(index);if(ch!==123&&ch!==60){return scanXJSText(["<","{"])}return scanPunctuator()}function parseXJSIdentifier(){var token,marker=markerCreate();if(lookahead.type!==Token.XJSIdentifier){throwUnexpected(lookahead)}token=lex();return markerApply(marker,delegate.createXJSIdentifier(token.value))}function parseXJSNamespacedName(){var namespace,name,marker=markerCreate();namespace=parseXJSIdentifier();expect(":");name=parseXJSIdentifier();return markerApply(marker,delegate.createXJSNamespacedName(namespace,name))}function parseXJSMemberExpression(){var marker=markerCreate(),expr=parseXJSIdentifier();while(match(".")){lex();expr=markerApply(marker,delegate.createXJSMemberExpression(expr,parseXJSIdentifier()))}return expr}function parseXJSElementName(){if(lookahead2().value===":"){return parseXJSNamespacedName()}if(lookahead2().value==="."){return parseXJSMemberExpression()}return parseXJSIdentifier()}function parseXJSAttributeName(){if(lookahead2().value===":"){return parseXJSNamespacedName()}return parseXJSIdentifier()}function parseXJSAttributeValue(){var value,marker;if(match("{")){value=parseXJSExpressionContainer();if(value.expression.type===Syntax.XJSEmptyExpression){throwError(value,"XJS attributes must only be assigned a non-empty "+"expression")}}else if(match("<")){value=parseXJSElement()}else if(lookahead.type===Token.XJSText){marker=markerCreate();value=markerApply(marker,delegate.createLiteral(lex()))}else{throwError({},Messages.InvalidXJSAttributeValue)}return value}function parseXJSEmptyExpression(){var marker=markerCreatePreserveWhitespace();while(source.charAt(index)!=="}"){index++}return markerApply(marker,delegate.createXJSEmptyExpression())}function parseXJSExpressionContainer(){var expression,origInXJSChild,origInXJSTag,marker=markerCreate();origInXJSChild=state.inXJSChild;origInXJSTag=state.inXJSTag;state.inXJSChild=false;state.inXJSTag=false;expect("{");if(match("}")){expression=parseXJSEmptyExpression()}else{expression=parseExpression()}state.inXJSChild=origInXJSChild;state.inXJSTag=origInXJSTag;expect("}");return markerApply(marker,delegate.createXJSExpressionContainer(expression))}function parseXJSSpreadAttribute(){var expression,origInXJSChild,origInXJSTag,marker=markerCreate();origInXJSChild=state.inXJSChild;origInXJSTag=state.inXJSTag;state.inXJSChild=false;state.inXJSTag=false;expect("{");expect("...");expression=parseAssignmentExpression();state.inXJSChild=origInXJSChild;state.inXJSTag=origInXJSTag;expect("}");return markerApply(marker,delegate.createXJSSpreadAttribute(expression))}function parseXJSAttribute(){var name,marker;if(match("{")){return parseXJSSpreadAttribute()}marker=markerCreate();name=parseXJSAttributeName();if(match("=")){lex();return markerApply(marker,delegate.createXJSAttribute(name,parseXJSAttributeValue()))}return markerApply(marker,delegate.createXJSAttribute(name))}function parseXJSChild(){var token,marker;if(match("{")){token=parseXJSExpressionContainer()}else if(lookahead.type===Token.XJSText){marker=markerCreatePreserveWhitespace();token=markerApply(marker,delegate.createLiteral(lex()))}else{token=parseXJSElement()}return token}function parseXJSClosingElement(){var name,origInXJSChild,origInXJSTag,marker=markerCreate();origInXJSChild=state.inXJSChild;origInXJSTag=state.inXJSTag;state.inXJSChild=false;state.inXJSTag=true;expect("<");expect("/");name=parseXJSElementName();state.inXJSChild=origInXJSChild;state.inXJSTag=origInXJSTag;expect(">");return markerApply(marker,delegate.createXJSClosingElement(name))}function parseXJSOpeningElement(){var name,attribute,attributes=[],selfClosing=false,origInXJSChild,origInXJSTag,marker=markerCreate();origInXJSChild=state.inXJSChild;origInXJSTag=state.inXJSTag;state.inXJSChild=false;state.inXJSTag=true;expect("<");name=parseXJSElementName();while(index<length&&lookahead.value!=="/"&&lookahead.value!==">"){attributes.push(parseXJSAttribute())}state.inXJSTag=origInXJSTag;if(lookahead.value==="/"){expect("/");state.inXJSChild=origInXJSChild;expect(">");selfClosing=true}else{state.inXJSChild=true;expect(">")}return markerApply(marker,delegate.createXJSOpeningElement(name,attributes,selfClosing))}function parseXJSElement(){var openingElement,closingElement=null,children=[],origInXJSChild,origInXJSTag,marker=markerCreate();origInXJSChild=state.inXJSChild;origInXJSTag=state.inXJSTag;openingElement=parseXJSOpeningElement();if(!openingElement.selfClosing){while(index<length){state.inXJSChild=false;if(lookahead.value==="<"&&lookahead2().value==="/"){break}state.inXJSChild=true;children.push(parseXJSChild())}state.inXJSChild=origInXJSChild;state.inXJSTag=origInXJSTag;closingElement=parseXJSClosingElement();if(getQualifiedXJSName(closingElement.name)!==getQualifiedXJSName(openingElement.name)){throwError({},Messages.ExpectedXJSClosingTag,getQualifiedXJSName(openingElement.name))}}if(!origInXJSChild&&match("<")){throwError(lookahead,Messages.AdjacentXJSElements)}return markerApply(marker,delegate.createXJSElement(openingElement,closingElement,children))}function parseTypeAlias(){var id,marker=markerCreate(),typeParameters=null,right;expectContextualKeyword("type");id=parseVariableIdentifier();if(match("<")){typeParameters=parseTypeParameterDeclaration()}expect("=");right=parseType();consumeSemicolon();return markerApply(marker,delegate.createTypeAlias(id,typeParameters,right))}function parseInterfaceExtends(){var marker=markerCreate(),id,typeParameters=null;id=parseVariableIdentifier();if(match("<")){typeParameters=parseTypeParameterInstantiation()}return markerApply(marker,delegate.createInterfaceExtends(id,typeParameters))}function parseInterfaceish(marker,allowStatic){var body,bodyMarker,extended=[],id,typeParameters=null;id=parseVariableIdentifier();if(match("<")){typeParameters=parseTypeParameterDeclaration()}if(matchKeyword("extends")){expectKeyword("extends");while(index<length){extended.push(parseInterfaceExtends());if(!match(",")){break}expect(",")}}bodyMarker=markerCreate();body=markerApply(bodyMarker,parseObjectType(allowStatic));return markerApply(marker,delegate.createInterface(id,typeParameters,body,extended))}function parseInterface(){var body,bodyMarker,extended=[],id,marker=markerCreate(),typeParameters=null;expectContextualKeyword("interface");return parseInterfaceish(marker,false)}function parseDeclareClass(){var marker=markerCreate(),ret;expectContextualKeyword("declare");expectKeyword("class");ret=parseInterfaceish(marker,true);ret.type=Syntax.DeclareClass;return ret}function parseDeclareFunction(){var id,idMarker,marker=markerCreate(),params,returnType,rest,tmp,typeParameters=null,value,valueMarker;expectContextualKeyword("declare");expectKeyword("function");idMarker=markerCreate();id=parseVariableIdentifier();valueMarker=markerCreate();if(match("<")){typeParameters=parseTypeParameterDeclaration()}expect("(");tmp=parseFunctionTypeParams();params=tmp.params;rest=tmp.rest;expect(")");expect(":");returnType=parseType();value=markerApply(valueMarker,delegate.createFunctionTypeAnnotation(params,returnType,rest,typeParameters));id.typeAnnotation=markerApply(valueMarker,delegate.createTypeAnnotation(value));markerApply(idMarker,id);consumeSemicolon();return markerApply(marker,delegate.createDeclareFunction(id))}function parseDeclareVariable(){var id,marker=markerCreate();expectContextualKeyword("declare");expectKeyword("var");id=parseTypeAnnotatableIdentifier();consumeSemicolon();return markerApply(marker,delegate.createDeclareVariable(id))}function parseDeclareModule(){var body=[],bodyMarker,id,idMarker,marker=markerCreate(),token;expectContextualKeyword("declare");expectContextualKeyword("module");if(lookahead.type===Token.StringLiteral){if(strict&&lookahead.octal){throwErrorTolerant(lookahead,Messages.StrictOctalLiteral)}idMarker=markerCreate();id=markerApply(idMarker,delegate.createLiteral(lex()))}else{id=parseVariableIdentifier()}bodyMarker=markerCreate();expect("{");while(index<length&&!match("}")){token=lookahead2();switch(token.value){case"class":body.push(parseDeclareClass());break;case"function":body.push(parseDeclareFunction());break;case"var":body.push(parseDeclareVariable());break;default:throwUnexpected(lookahead)}}expect("}");return markerApply(marker,delegate.createDeclareModule(id,markerApply(bodyMarker,delegate.createBlockStatement(body))))}function collectToken(){var start,loc,token,range,value,entry;if(!state.inXJSChild){skipComment()}start=index;loc={start:{line:lineNumber,column:index-lineStart}};token=extra.advance();loc.end={line:lineNumber,column:index-lineStart};if(token.type!==Token.EOF){range=[token.range[0],token.range[1]];value=source.slice(token.range[0],token.range[1]);entry={type:TokenName[token.type],value:value,range:range,loc:loc};if(token.regex){entry.regex={pattern:token.regex.pattern,flags:token.regex.flags}}extra.tokens.push(entry)}return token}function collectRegex(){var pos,loc,regex,token;skipComment();pos=index;loc={start:{line:lineNumber,column:index-lineStart}};regex=extra.scanRegExp();loc.end={line:lineNumber,column:index-lineStart};if(!extra.tokenize){if(extra.tokens.length>0){token=extra.tokens[extra.tokens.length-1];if(token.range[0]===pos&&token.type==="Punctuator"){if(token.value==="/"||token.value==="/="){extra.tokens.pop()}}}extra.tokens.push({type:"RegularExpression",value:regex.literal,regex:regex.regex,range:[pos,index],loc:loc})}return regex}function filterTokenLocation(){var i,entry,token,tokens=[];for(i=0;i<extra.tokens.length;++i){entry=extra.tokens[i];token={type:entry.type,value:entry.value};if(entry.regex){token.regex={pattern:entry.regex.pattern,flags:entry.regex.flags}}if(extra.range){token.range=entry.range}if(extra.loc){token.loc=entry.loc}tokens.push(token)}extra.tokens=tokens}function patch(){if(extra.comments){extra.skipComment=skipComment;skipComment=scanComment}if(typeof extra.tokens!=="undefined"){extra.advance=advance;extra.scanRegExp=scanRegExp;advance=collectToken;scanRegExp=collectRegex}}function unpatch(){if(typeof extra.skipComment==="function"){skipComment=extra.skipComment}if(typeof extra.scanRegExp==="function"){advance=extra.advance;scanRegExp=extra.scanRegExp}}function extend(object,properties){var entry,result={};for(entry in object){if(object.hasOwnProperty(entry)){result[entry]=object[entry]}}for(entry in properties){if(properties.hasOwnProperty(entry)){result[entry]=properties[entry]}}return result}function tokenize(code,options){var toString,token,tokens;toString=String;if(typeof code!=="string"&&!(code instanceof String)){code=toString(code)}delegate=SyntaxTreeDelegate;source=code;index=0;lineNumber=source.length>0?1:0;lineStart=0;length=source.length;lookahead=null;state={allowKeyword:true,allowIn:true,labelSet:{},inFunctionBody:false,inIteration:false,inSwitch:false,lastCommentStart:-1};extra={};options=options||{};options.tokens=true;extra.tokens=[];extra.tokenize=true;extra.openParenToken=-1;extra.openCurlyToken=-1;extra.range=typeof options.range==="boolean"&&options.range;extra.loc=typeof options.loc==="boolean"&&options.loc;if(typeof options.comment==="boolean"&&options.comment){extra.comments=[]}if(typeof options.tolerant==="boolean"&&options.tolerant){extra.errors=[]}if(length>0){if(typeof source[0]==="undefined"){if(code instanceof String){source=code.valueOf()}}}patch();try{peek();if(lookahead.type===Token.EOF){return extra.tokens}token=lex();while(lookahead.type!==Token.EOF){try{token=lex()}catch(lexError){token=lookahead;if(extra.errors){extra.errors.push(lexError);
break}else{throw lexError}}}filterTokenLocation();tokens=extra.tokens;if(typeof extra.comments!=="undefined"){tokens.comments=extra.comments}if(typeof extra.errors!=="undefined"){tokens.errors=extra.errors}}catch(e){throw e}finally{unpatch();extra={}}return tokens}function parse(code,options){var program,toString;toString=String;if(typeof code!=="string"&&!(code instanceof String)){code=toString(code)}delegate=SyntaxTreeDelegate;source=code;index=0;lineNumber=source.length>0?1:0;lineStart=0;length=source.length;lookahead=null;state={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};extra={};if(typeof options!=="undefined"){extra.range=typeof options.range==="boolean"&&options.range;extra.loc=typeof options.loc==="boolean"&&options.loc;extra.attachComment=typeof options.attachComment==="boolean"&&options.attachComment;if(extra.loc&&options.source!==null&&options.source!==undefined){delegate=extend(delegate,{postProcess:function(node){node.loc.source=toString(options.source);return node}})}if(typeof options.tokens==="boolean"&&options.tokens){extra.tokens=[]}if(typeof options.comment==="boolean"&&options.comment){extra.comments=[]}if(typeof options.tolerant==="boolean"&&options.tolerant){extra.errors=[]}if(extra.attachComment){extra.range=true;extra.comments=[];extra.bottomRightStack=[];extra.trailingComments=[];extra.leadingComments=[]}}if(length>0){if(typeof source[0]==="undefined"){if(code instanceof String){source=code.valueOf()}}}patch();try{program=parseProgram();if(typeof extra.comments!=="undefined"){program.comments=extra.comments}if(typeof extra.tokens!=="undefined"){filterTokenLocation();program.tokens=extra.tokens}if(typeof extra.errors!=="undefined"){program.errors=extra.errors}}catch(e){throw e}finally{unpatch();extra={}}return program}exports.version="8001.1001.0-dev-harmony-fb";exports.tokenize=tokenize;exports.parse=parse;exports.Syntax=function(){var name,types={};if(typeof Object.create==="function"){types=Object.create(null)}for(name in Syntax){if(Syntax.hasOwnProperty(name)){types[name]=Syntax[name]}}if(typeof Object.freeze==="function"){Object.freeze(types)}return types}()})},{}],151:[function(require,module,exports){var assert=require("assert");var types=require("./types");var n=types.namedTypes;var isArray=types.builtInTypes.array;var isObject=types.builtInTypes.object;var linesModule=require("./lines");var fromString=linesModule.fromString;var Lines=linesModule.Lines;var concat=linesModule.concat;var comparePos=require("./util").comparePos;var childNodesCacheKey=require("private").makeUniqueKey();function getSortedChildNodes(node,resultArray){if(!node){return}if(resultArray){if(n.Node.check(node)&&n.SourceLocation.check(node.loc)){for(var i=resultArray.length-1;i>=0;--i){if(comparePos(resultArray[i].loc.end,node.loc.start)<=0){break}}resultArray.splice(i+1,0,node);return}}else if(node[childNodesCacheKey]){return node[childNodesCacheKey]}var names;if(isArray.check(node)){names=Object.keys(node)}else if(isObject.check(node)){names=types.getFieldNames(node)}else{return}if(!resultArray){Object.defineProperty(node,childNodesCacheKey,{value:resultArray=[],enumerable:false})}for(var i=0,nameCount=names.length;i<nameCount;++i){getSortedChildNodes(node[names[i]],resultArray)}return resultArray}function decorateComment(node,comment){var childNodes=getSortedChildNodes(node);var left=0,right=childNodes.length;while(left<right){var middle=left+right>>1;var child=childNodes[middle];if(comparePos(child.loc.start,comment.loc.start)<=0&&comparePos(comment.loc.end,child.loc.end)<=0){decorateComment(comment.enclosingNode=child,comment);return}if(comparePos(child.loc.end,comment.loc.start)<=0){var precedingNode=child;left=middle+1;continue}if(comparePos(comment.loc.end,child.loc.start)<=0){var followingNode=child;right=middle;continue}throw new Error("Comment location overlaps with node location")}if(precedingNode){comment.precedingNode=precedingNode}if(followingNode){comment.followingNode=followingNode}}exports.attach=function(comments,ast,lines){if(!isArray.check(comments)){return}var tiesToBreak=[];comments.forEach(function(comment){comment.loc.lines=lines;decorateComment(ast,comment);var pn=comment.precedingNode;var en=comment.enclosingNode;var fn=comment.followingNode;if(pn&&fn){var tieCount=tiesToBreak.length;if(tieCount>0){var lastTie=tiesToBreak[tieCount-1];assert.strictEqual(lastTie.precedingNode===comment.precedingNode,lastTie.followingNode===comment.followingNode);if(lastTie.followingNode!==comment.followingNode){breakTies(tiesToBreak,lines)}}tiesToBreak.push(comment)}else if(pn){breakTies(tiesToBreak,lines);Comments.forNode(pn).addTrailing(comment)}else if(fn){breakTies(tiesToBreak,lines);Comments.forNode(fn).addLeading(comment)}else if(en){breakTies(tiesToBreak,lines);Comments.forNode(en).addDangling(comment)}else{throw new Error("AST contains no nodes at all?")}});breakTies(tiesToBreak,lines)};function breakTies(tiesToBreak,lines){var tieCount=tiesToBreak.length;if(tieCount===0){return}var pn=tiesToBreak[0].precedingNode;var fn=tiesToBreak[0].followingNode;var gapEndPos=fn.loc.start;for(var indexOfFirstLeadingComment=tieCount;indexOfFirstLeadingComment>0;--indexOfFirstLeadingComment){var comment=tiesToBreak[indexOfFirstLeadingComment-1];assert.strictEqual(comment.precedingNode,pn);assert.strictEqual(comment.followingNode,fn);var gap=lines.sliceString(comment.loc.end,gapEndPos);if(/\S/.test(gap)){break}gapEndPos=comment.loc.start}while(indexOfFirstLeadingComment<=tieCount&&(comment=tiesToBreak[indexOfFirstLeadingComment])&&comment.type==="Line"&&comment.loc.start.column>fn.loc.start.column){++indexOfFirstLeadingComment}tiesToBreak.forEach(function(comment,i){if(i<indexOfFirstLeadingComment){Comments.forNode(pn).addTrailing(comment)}else{Comments.forNode(fn).addLeading(comment)}});tiesToBreak.length=0}function Comments(){assert.ok(this instanceof Comments);this.leading=[];this.dangling=[];this.trailing=[]}var Cp=Comments.prototype;Comments.forNode=function forNode(node){var comments=node.comments;if(!comments){Object.defineProperty(node,"comments",{value:comments=new Comments,enumerable:false})}return comments};Cp.forEach=function forEach(callback,context){this.leading.forEach(callback,context);this.trailing.forEach(callback,context)};Cp.addLeading=function addLeading(comment){this.leading.push(comment)};Cp.addDangling=function addDangling(comment){this.dangling.push(comment)};Cp.addTrailing=function addTrailing(comment){comment.trailing=true;if(comment.type==="Block"){this.trailing.push(comment)}else{this.leading.push(comment)}};function printLeadingComment(comment,options){var loc=comment.loc;var lines=loc&&loc.lines;var parts=[];if(comment.type==="Block"){parts.push("/*",fromString(comment.value,options),"*/")}else if(comment.type==="Line"){parts.push("//",fromString(comment.value,options))}else assert.fail(comment.type);if(comment.trailing){parts.push("\n")}else if(lines instanceof Lines){var trailingSpace=lines.slice(loc.end,lines.skipSpaces(loc.end));if(trailingSpace.length===1){parts.push(trailingSpace)}else{parts.push(new Array(trailingSpace.length).join("\n"))}}else{parts.push("\n")}return concat(parts).stripMargin(loc?loc.start.column:0)}function printTrailingComment(comment,options){var loc=comment.loc;var lines=loc&&loc.lines;var parts=[];if(lines instanceof Lines){var fromPos=lines.skipSpaces(loc.start,true)||lines.firstPos();var leadingSpace=lines.slice(fromPos,loc.start);if(leadingSpace.length===1){parts.push(leadingSpace)}else{parts.push(new Array(leadingSpace.length).join("\n"))}}if(comment.type==="Block"){parts.push("/*",fromString(comment.value,options),"*/")}else if(comment.type==="Line"){parts.push("//",fromString(comment.value,options),"\n")}else assert.fail(comment.type);return concat(parts).stripMargin(loc?loc.start.column:0,true)}exports.printComments=function(comments,innerLines,options){if(innerLines){assert.ok(innerLines instanceof Lines)}else{innerLines=fromString("")}if(!comments||!(comments.leading.length+comments.trailing.length)){return innerLines}var parts=[];comments.leading.forEach(function(comment){parts.push(printLeadingComment(comment,options))});parts.push(innerLines);comments.trailing.forEach(function(comment){assert.strictEqual(comment.type,"Block");parts.push(printTrailingComment(comment,options))});return concat(parts)}},{"./lines":152,"./types":158,"./util":159,assert:95,"private":128}],152:[function(require,module,exports){var assert=require("assert");var sourceMap=require("source-map");var normalizeOptions=require("./options").normalize;var secretKey=require("private").makeUniqueKey();var types=require("./types");var isString=types.builtInTypes.string;var comparePos=require("./util").comparePos;var Mapping=require("./mapping");function getSecret(lines){return lines[secretKey]}function Lines(infos,sourceFileName){assert.ok(this instanceof Lines);assert.ok(infos.length>0);if(sourceFileName){isString.assert(sourceFileName)}else{sourceFileName=null}Object.defineProperty(this,secretKey,{value:{infos:infos,mappings:[],name:sourceFileName,cachedSourceMap:null}});if(sourceFileName){getSecret(this).mappings.push(new Mapping(this,{start:this.firstPos(),end:this.lastPos()}))}}exports.Lines=Lines;var Lp=Lines.prototype;Object.defineProperties(Lp,{length:{get:function(){return getSecret(this).infos.length}},name:{get:function(){return getSecret(this).name}}});function copyLineInfo(info){return{line:info.line,indent:info.indent,sliceStart:info.sliceStart,sliceEnd:info.sliceEnd}}var fromStringCache={};var hasOwn=fromStringCache.hasOwnProperty;var maxCacheKeyLen=10;function countSpaces(spaces,tabWidth){var count=0;var len=spaces.length;for(var i=0;i<len;++i){var ch=spaces.charAt(i);if(ch===" "){count+=1}else if(ch===" "){assert.strictEqual(typeof tabWidth,"number");assert.ok(tabWidth>0);var next=Math.ceil(count/tabWidth)*tabWidth;if(next===count){count+=tabWidth}else{count=next}}else if(ch==="\r"){}else{assert.fail("unexpected whitespace character",ch)}}return count}exports.countSpaces=countSpaces;var leadingSpaceExp=/^\s*/;function fromString(string,options){if(string instanceof Lines)return string;string+="";var tabWidth=options&&options.tabWidth;var tabless=string.indexOf(" ")<0;var cacheable=!options&&tabless&&string.length<=maxCacheKeyLen;assert.ok(tabWidth||tabless,"No tab width specified but encountered tabs in string\n"+string);if(cacheable&&hasOwn.call(fromStringCache,string))return fromStringCache[string];var lines=new Lines(string.split("\n").map(function(line){var spaces=leadingSpaceExp.exec(line)[0];return{line:line,indent:countSpaces(spaces,tabWidth),sliceStart:spaces.length,sliceEnd:line.length}}),normalizeOptions(options).sourceFileName);if(cacheable)fromStringCache[string]=lines;return lines}exports.fromString=fromString;function isOnlyWhitespace(string){return!/\S/.test(string)}Lp.toString=function(options){return this.sliceString(this.firstPos(),this.lastPos(),options)};Lp.getSourceMap=function(sourceMapName,sourceRoot){if(!sourceMapName){return null}var targetLines=this;function updateJSON(json){json=json||{};isString.assert(sourceMapName);json.file=sourceMapName;if(sourceRoot){isString.assert(sourceRoot);json.sourceRoot=sourceRoot}return json}var secret=getSecret(targetLines);if(secret.cachedSourceMap){return updateJSON(secret.cachedSourceMap.toJSON())}var smg=new sourceMap.SourceMapGenerator(updateJSON());var sourcesToContents={};secret.mappings.forEach(function(mapping){var sourceCursor=mapping.sourceLines.skipSpaces(mapping.sourceLoc.start)||mapping.sourceLines.lastPos();var targetCursor=targetLines.skipSpaces(mapping.targetLoc.start)||targetLines.lastPos();while(comparePos(sourceCursor,mapping.sourceLoc.end)<0&&comparePos(targetCursor,mapping.targetLoc.end)<0){var sourceChar=mapping.sourceLines.charAt(sourceCursor);var targetChar=targetLines.charAt(targetCursor);assert.strictEqual(sourceChar,targetChar);var sourceName=mapping.sourceLines.name;smg.addMapping({source:sourceName,original:{line:sourceCursor.line,column:sourceCursor.column},generated:{line:targetCursor.line,column:targetCursor.column}});if(!hasOwn.call(sourcesToContents,sourceName)){var sourceContent=mapping.sourceLines.toString();smg.setSourceContent(sourceName,sourceContent);sourcesToContents[sourceName]=sourceContent}targetLines.nextPos(targetCursor,true);mapping.sourceLines.nextPos(sourceCursor,true)}});secret.cachedSourceMap=smg;return smg.toJSON()};Lp.bootstrapCharAt=function(pos){assert.strictEqual(typeof pos,"object");assert.strictEqual(typeof pos.line,"number");assert.strictEqual(typeof pos.column,"number");var line=pos.line,column=pos.column,strings=this.toString().split("\n"),string=strings[line-1];if(typeof string==="undefined")return"";if(column===string.length&&line<strings.length)return"\n";if(column>=string.length)return"";return string.charAt(column)};Lp.charAt=function(pos){assert.strictEqual(typeof pos,"object");assert.strictEqual(typeof pos.line,"number");assert.strictEqual(typeof pos.column,"number");var line=pos.line,column=pos.column,secret=getSecret(this),infos=secret.infos,info=infos[line-1],c=column;if(typeof info==="undefined"||c<0)return"";var indent=this.getIndentAt(line);if(c<indent)return" ";c+=info.sliceStart-indent;if(c===info.sliceEnd&&line<this.length)return"\n";if(c>=info.sliceEnd)return"";return info.line.charAt(c)};Lp.stripMargin=function(width,skipFirstLine){if(width===0)return this;assert.ok(width>0,"negative margin: "+width);if(skipFirstLine&&this.length===1)return this;var secret=getSecret(this);var lines=new Lines(secret.infos.map(function(info,i){if(info.line&&(i>0||!skipFirstLine)){info=copyLineInfo(info);info.indent=Math.max(0,info.indent-width)}return info}));if(secret.mappings.length>0){var newMappings=getSecret(lines).mappings;assert.strictEqual(newMappings.length,0);secret.mappings.forEach(function(mapping){newMappings.push(mapping.indent(width,skipFirstLine,true))})}return lines};Lp.indent=function(by){if(by===0)return this;var secret=getSecret(this);var lines=new Lines(secret.infos.map(function(info){if(info.line){info=copyLineInfo(info);info.indent+=by}return info}));if(secret.mappings.length>0){var newMappings=getSecret(lines).mappings;assert.strictEqual(newMappings.length,0);secret.mappings.forEach(function(mapping){newMappings.push(mapping.indent(by))})}return lines};Lp.indentTail=function(by){if(by===0)return this;if(this.length<2)return this;var secret=getSecret(this);var lines=new Lines(secret.infos.map(function(info,i){if(i>0&&info.line){info=copyLineInfo(info);info.indent+=by}return info}));if(secret.mappings.length>0){var newMappings=getSecret(lines).mappings;assert.strictEqual(newMappings.length,0);secret.mappings.forEach(function(mapping){newMappings.push(mapping.indent(by,true))})}return lines};Lp.getIndentAt=function(line){assert.ok(line>=1,"no line "+line+" (line numbers start from 1)");var secret=getSecret(this),info=secret.infos[line-1];return Math.max(info.indent,0)};Lp.guessTabWidth=function(){var secret=getSecret(this);if(hasOwn.call(secret,"cachedTabWidth")){return secret.cachedTabWidth}var counts=[];var lastIndent=0;for(var line=1,last=this.length;line<=last;++line){var info=secret.infos[line-1];var sliced=info.line.slice(info.sliceStart,info.sliceEnd);if(isOnlyWhitespace(sliced)){continue}var diff=Math.abs(info.indent-lastIndent);counts[diff]=~~counts[diff]+1;lastIndent=info.indent}var maxCount=-1;var result=2;for(var tabWidth=1;tabWidth<counts.length;tabWidth+=1){if(hasOwn.call(counts,tabWidth)&&counts[tabWidth]>maxCount){maxCount=counts[tabWidth];result=tabWidth}}return secret.cachedTabWidth=result};Lp.isOnlyWhitespace=function(){return isOnlyWhitespace(this.toString())};Lp.isPrecededOnlyByWhitespace=function(pos){var secret=getSecret(this);var info=secret.infos[pos.line-1];var indent=Math.max(info.indent,0);var diff=pos.column-indent;if(diff<=0){return true}var start=info.sliceStart;var end=Math.min(start+diff,info.sliceEnd);var prefix=info.line.slice(start,end);return isOnlyWhitespace(prefix)};Lp.getLineLength=function(line){var secret=getSecret(this),info=secret.infos[line-1];return this.getIndentAt(line)+info.sliceEnd-info.sliceStart};Lp.nextPos=function(pos,skipSpaces){var l=Math.max(pos.line,0),c=Math.max(pos.column,0);if(c<this.getLineLength(l)){pos.column+=1;return skipSpaces?!!this.skipSpaces(pos,false,true):true}if(l<this.length){pos.line+=1;pos.column=0;return skipSpaces?!!this.skipSpaces(pos,false,true):true}return false};Lp.prevPos=function(pos,skipSpaces){var l=pos.line,c=pos.column;if(c<1){l-=1;if(l<1)return false;c=this.getLineLength(l)}else{c=Math.min(c-1,this.getLineLength(l))}pos.line=l;pos.column=c;return skipSpaces?!!this.skipSpaces(pos,true,true):true};Lp.firstPos=function(){return{line:1,column:0}};Lp.lastPos=function(){return{line:this.length,column:this.getLineLength(this.length)}};Lp.skipSpaces=function(pos,backward,modifyInPlace){if(pos){pos=modifyInPlace?pos:{line:pos.line,column:pos.column}}else if(backward){pos=this.lastPos()}else{pos=this.firstPos()}if(backward){while(this.prevPos(pos)){if(!isOnlyWhitespace(this.charAt(pos))&&this.nextPos(pos)){return pos}}return null}else{while(isOnlyWhitespace(this.charAt(pos))){if(!this.nextPos(pos)){return null}}return pos}};Lp.trimLeft=function(){var pos=this.skipSpaces(this.firstPos(),false,true);return pos?this.slice(pos):emptyLines};Lp.trimRight=function(){var pos=this.skipSpaces(this.lastPos(),true,true);return pos?this.slice(this.firstPos(),pos):emptyLines};Lp.trim=function(){var start=this.skipSpaces(this.firstPos(),false,true);if(start===null)return emptyLines;var end=this.skipSpaces(this.lastPos(),true,true);assert.notStrictEqual(end,null);return this.slice(start,end)};Lp.eachPos=function(callback,startPos,skipSpaces){var pos=this.firstPos();if(startPos){pos.line=startPos.line,pos.column=startPos.column}if(skipSpaces&&!this.skipSpaces(pos,false,true)){return}do callback.call(this,pos);while(this.nextPos(pos,skipSpaces))};Lp.bootstrapSlice=function(start,end){var strings=this.toString().split("\n").slice(start.line-1,end.line);strings.push(strings.pop().slice(0,end.column));strings[0]=strings[0].slice(start.column);return fromString(strings.join("\n"))};Lp.slice=function(start,end){if(!end){if(!start){return this}end=this.lastPos()}var secret=getSecret(this);var sliced=secret.infos.slice(start.line-1,end.line);if(start.line===end.line){sliced[0]=sliceInfo(sliced[0],start.column,end.column)}else{assert.ok(start.line<end.line);sliced[0]=sliceInfo(sliced[0],start.column);sliced.push(sliceInfo(sliced.pop(),0,end.column))}var lines=new Lines(sliced);if(secret.mappings.length>0){var newMappings=getSecret(lines).mappings;assert.strictEqual(newMappings.length,0);secret.mappings.forEach(function(mapping){var sliced=mapping.slice(this,start,end);if(sliced){newMappings.push(sliced)}},this)}return lines};function sliceInfo(info,startCol,endCol){var sliceStart=info.sliceStart;var sliceEnd=info.sliceEnd;var indent=Math.max(info.indent,0);var lineLength=indent+sliceEnd-sliceStart;if(typeof endCol==="undefined"){endCol=lineLength}startCol=Math.max(startCol,0);endCol=Math.min(endCol,lineLength);endCol=Math.max(endCol,startCol);if(endCol<indent){indent=endCol;sliceEnd=sliceStart}else{sliceEnd-=lineLength-endCol}lineLength=endCol;lineLength-=startCol;if(startCol<indent){indent-=startCol}else{startCol-=indent;indent=0;sliceStart+=startCol}assert.ok(indent>=0);assert.ok(sliceStart<=sliceEnd);assert.strictEqual(lineLength,indent+sliceEnd-sliceStart);if(info.indent===indent&&info.sliceStart===sliceStart&&info.sliceEnd===sliceEnd){return info}return{line:info.line,indent:indent,sliceStart:sliceStart,sliceEnd:sliceEnd}}Lp.bootstrapSliceString=function(start,end,options){return this.slice(start,end).toString(options)};Lp.sliceString=function(start,end,options){if(!end){if(!start){return this}end=this.lastPos()}options=normalizeOptions(options);var infos=getSecret(this).infos;var parts=[];var tabWidth=options.tabWidth;for(var line=start.line;line<=end.line;++line){var info=infos[line-1];if(line===start.line){if(line===end.line){info=sliceInfo(info,start.column,end.column)}else{info=sliceInfo(info,start.column)}}else if(line===end.line){info=sliceInfo(info,0,end.column)}var indent=Math.max(info.indent,0);var before=info.line.slice(0,info.sliceStart);if(options.reuseWhitespace&&isOnlyWhitespace(before)&&countSpaces(before,options.tabWidth)===indent){parts.push(info.line.slice(0,info.sliceEnd));continue}var tabs=0;var spaces=indent;if(options.useTabs){tabs=Math.floor(indent/tabWidth);spaces-=tabs*tabWidth}var result="";if(tabs>0){result+=new Array(tabs+1).join(" ")}if(spaces>0){result+=new Array(spaces+1).join(" ")}result+=info.line.slice(info.sliceStart,info.sliceEnd);parts.push(result)}return parts.join("\n")};Lp.isEmpty=function(){return this.length<2&&this.getLineLength(1)<1};Lp.join=function(elements){var separator=this;var separatorSecret=getSecret(separator);var infos=[];var mappings=[];var prevInfo;function appendSecret(secret){if(secret===null)return;if(prevInfo){var info=secret.infos[0];var indent=new Array(info.indent+1).join(" ");var prevLine=infos.length;var prevColumn=Math.max(prevInfo.indent,0)+prevInfo.sliceEnd-prevInfo.sliceStart;prevInfo.line=prevInfo.line.slice(0,prevInfo.sliceEnd)+indent+info.line.slice(info.sliceStart,info.sliceEnd);prevInfo.sliceEnd=prevInfo.line.length;if(secret.mappings.length>0){secret.mappings.forEach(function(mapping){mappings.push(mapping.add(prevLine,prevColumn))})}}else if(secret.mappings.length>0){mappings.push.apply(mappings,secret.mappings)}secret.infos.forEach(function(info,i){if(!prevInfo||i>0){prevInfo=copyLineInfo(info);infos.push(prevInfo)}})}function appendWithSeparator(secret,i){if(i>0)appendSecret(separatorSecret);appendSecret(secret)}elements.map(function(elem){var lines=fromString(elem);if(lines.isEmpty())return null;return getSecret(lines)}).forEach(separator.isEmpty()?appendSecret:appendWithSeparator);if(infos.length<1)return emptyLines;var lines=new Lines(infos);getSecret(lines).mappings=mappings;return lines};exports.concat=function(elements){return emptyLines.join(elements)};Lp.concat=function(other){var args=arguments,list=[this];list.push.apply(list,args);assert.strictEqual(list.length,args.length+1);return emptyLines.join(list)};var emptyLines=fromString("")},{"./mapping":153,"./options":154,"./types":158,"./util":159,assert:95,"private":128,"source-map":169}],153:[function(require,module,exports){var assert=require("assert");var types=require("./types");var isString=types.builtInTypes.string;var isNumber=types.builtInTypes.number;var SourceLocation=types.namedTypes.SourceLocation;var Position=types.namedTypes.Position;var linesModule=require("./lines");var comparePos=require("./util").comparePos;function Mapping(sourceLines,sourceLoc,targetLoc){assert.ok(this instanceof Mapping);assert.ok(sourceLines instanceof linesModule.Lines);SourceLocation.assert(sourceLoc);if(targetLoc){assert.ok(isNumber.check(targetLoc.start.line)&&isNumber.check(targetLoc.start.column)&&isNumber.check(targetLoc.end.line)&&isNumber.check(targetLoc.end.column))}else{targetLoc=sourceLoc}Object.defineProperties(this,{sourceLines:{value:sourceLines},sourceLoc:{value:sourceLoc},targetLoc:{value:targetLoc}})}var Mp=Mapping.prototype;module.exports=Mapping;Mp.slice=function(lines,start,end){assert.ok(lines instanceof linesModule.Lines);Position.assert(start);if(end){Position.assert(end)}else{end=lines.lastPos()}var sourceLines=this.sourceLines;var sourceLoc=this.sourceLoc;var targetLoc=this.targetLoc;function skip(name){var sourceFromPos=sourceLoc[name];var targetFromPos=targetLoc[name];var targetToPos=start;if(name==="end"){targetToPos=end}else{assert.strictEqual(name,"start")}return skipChars(sourceLines,sourceFromPos,lines,targetFromPos,targetToPos)}if(comparePos(start,targetLoc.start)<=0){if(comparePos(targetLoc.end,end)<=0){targetLoc={start:subtractPos(targetLoc.start,start.line,start.column),end:subtractPos(targetLoc.end,start.line,start.column)}}else if(comparePos(end,targetLoc.start)<=0){return null}else{sourceLoc={start:sourceLoc.start,end:skip("end")};targetLoc={start:subtractPos(targetLoc.start,start.line,start.column),end:subtractPos(end,start.line,start.column)}}}else{if(comparePos(targetLoc.end,start)<=0){return null}if(comparePos(targetLoc.end,end)<=0){sourceLoc={start:skip("start"),end:sourceLoc.end};targetLoc={start:{line:1,column:0},end:subtractPos(targetLoc.end,start.line,start.column)}}else{sourceLoc={start:skip("start"),end:skip("end")};targetLoc={start:{line:1,column:0},end:subtractPos(end,start.line,start.column)}}}return new Mapping(this.sourceLines,sourceLoc,targetLoc)};Mp.add=function(line,column){return new Mapping(this.sourceLines,this.sourceLoc,{start:addPos(this.targetLoc.start,line,column),end:addPos(this.targetLoc.end,line,column)})};function addPos(toPos,line,column){return{line:toPos.line+line-1,column:toPos.line===1?toPos.column+column:toPos.column}}Mp.subtract=function(line,column){return new Mapping(this.sourceLines,this.sourceLoc,{start:subtractPos(this.targetLoc.start,line,column),end:subtractPos(this.targetLoc.end,line,column)})};function subtractPos(fromPos,line,column){return{line:fromPos.line-line+1,column:fromPos.line===line?fromPos.column-column:fromPos.column}}Mp.indent=function(by,skipFirstLine,noNegativeColumns){if(by===0){return this}var targetLoc=this.targetLoc;var startLine=targetLoc.start.line;var endLine=targetLoc.end.line;if(skipFirstLine&&startLine===1&&endLine===1){return this}targetLoc={start:targetLoc.start,end:targetLoc.end};if(!skipFirstLine||startLine>1){var startColumn=targetLoc.start.column+by;targetLoc.start={line:startLine,column:noNegativeColumns?Math.max(0,startColumn):startColumn}}if(!skipFirstLine||endLine>1){var endColumn=targetLoc.end.column+by;targetLoc.end={line:endLine,column:noNegativeColumns?Math.max(0,endColumn):endColumn}}return new Mapping(this.sourceLines,this.sourceLoc,targetLoc)};function skipChars(sourceLines,sourceFromPos,targetLines,targetFromPos,targetToPos){assert.ok(sourceLines instanceof linesModule.Lines);assert.ok(targetLines instanceof linesModule.Lines);Position.assert(sourceFromPos);Position.assert(targetFromPos);Position.assert(targetToPos);var targetComparison=comparePos(targetFromPos,targetToPos);if(targetComparison===0){return sourceFromPos}if(targetComparison<0){var sourceCursor=sourceLines.skipSpaces(sourceFromPos);var targetCursor=targetLines.skipSpaces(targetFromPos);var lineDiff=targetToPos.line-targetCursor.line;sourceCursor.line+=lineDiff;targetCursor.line+=lineDiff;if(lineDiff>0){sourceCursor.column=0;targetCursor.column=0}else{assert.strictEqual(lineDiff,0)}while(comparePos(targetCursor,targetToPos)<0&&targetLines.nextPos(targetCursor,true)){assert.ok(sourceLines.nextPos(sourceCursor,true));assert.strictEqual(sourceLines.charAt(sourceCursor),targetLines.charAt(targetCursor))}}else{var sourceCursor=sourceLines.skipSpaces(sourceFromPos,true);var targetCursor=targetLines.skipSpaces(targetFromPos,true);var lineDiff=targetToPos.line-targetCursor.line;sourceCursor.line+=lineDiff;targetCursor.line+=lineDiff;if(lineDiff<0){sourceCursor.column=sourceLines.getLineLength(sourceCursor.line);targetCursor.column=targetLines.getLineLength(targetCursor.line)}else{assert.strictEqual(lineDiff,0)}while(comparePos(targetToPos,targetCursor)<0&&targetLines.prevPos(targetCursor,true)){assert.ok(sourceLines.prevPos(sourceCursor,true));assert.strictEqual(sourceLines.charAt(sourceCursor),targetLines.charAt(targetCursor))}}return sourceCursor}},{"./lines":152,"./types":158,"./util":159,assert:95}],154:[function(require,module,exports){var defaults={esprima:require("esprima-fb"),tabWidth:4,useTabs:false,reuseWhitespace:true,wrapColumn:74,sourceFileName:null,sourceMapName:null,sourceRoot:null,inputSourceMap:null,range:false,tolerant:true},hasOwn=defaults.hasOwnProperty;exports.normalize=function(options){options=options||defaults;function get(key){return hasOwn.call(options,key)?options[key]:defaults[key]}return{tabWidth:+get("tabWidth"),useTabs:!!get("useTabs"),reuseWhitespace:!!get("reuseWhitespace"),wrapColumn:Math.max(get("wrapColumn"),0),sourceFileName:get("sourceFileName"),sourceMapName:get("sourceMapName"),sourceRoot:get("sourceRoot"),inputSourceMap:get("inputSourceMap"),esprima:get("esprima"),range:get("range"),tolerant:get("tolerant")}}},{"esprima-fb":150}],155:[function(require,module,exports){var assert=require("assert");var types=require("./types");var n=types.namedTypes;var b=types.builders;var isObject=types.builtInTypes.object;var isArray=types.builtInTypes.array;var isFunction=types.builtInTypes.function;var Patcher=require("./patcher").Patcher;var normalizeOptions=require("./options").normalize;var fromString=require("./lines").fromString;var attachComments=require("./comments").attach;exports.parse=function parse(source,options){options=normalizeOptions(options);var lines=fromString(source,options);var sourceWithoutTabs=lines.toString({tabWidth:options.tabWidth,reuseWhitespace:false,useTabs:false});var program=options.esprima.parse(sourceWithoutTabs,{loc:true,range:options.range,comment:true,tolerant:options.tolerant});var comments=program.comments;delete program.comments;var file=b.file(program);file.loc={lines:lines,indent:0,start:lines.firstPos(),end:lines.lastPos()};var copy=new TreeCopier(lines).copy(file);attachComments(comments,copy.program,lines);return copy};function TreeCopier(lines){assert.ok(this instanceof TreeCopier);this.lines=lines;this.indent=0}var TCp=TreeCopier.prototype;TCp.copy=function(node){if(isArray.check(node)){return node.map(this.copy,this)}if(!isObject.check(node)){return node}if(n.MethodDefinition&&n.MethodDefinition.check(node)||n.Property.check(node)&&(node.method||node.shorthand)){node.value.loc=null;if(n.FunctionExpression.check(node.value)){node.value.id=null}}var copy=Object.create(Object.getPrototypeOf(node),{original:{value:node,configurable:false,enumerable:false,writable:true}});var loc=node.loc;var oldIndent=this.indent;var newIndent=oldIndent;if(loc){if(loc.start.line<1){loc.start.line=1}if(loc.end.line<1){loc.end.line=1}if(this.lines.isPrecededOnlyByWhitespace(loc.start)){newIndent=this.indent=loc.start.column}loc.lines=this.lines;loc.indent=newIndent}var keys=Object.keys(node);var keyCount=keys.length;for(var i=0;i<keyCount;++i){var key=keys[i];if(key==="loc"){copy[key]=node[key]}else if(key==="comments"){}else{copy[key]=this.copy(node[key])}}this.indent=oldIndent;if(node.comments){Object.defineProperty(copy,"comments",{value:node.comments,enumerable:false})}return copy}},{"./comments":151,"./lines":152,"./options":154,"./patcher":156,"./types":158,assert:95}],156:[function(require,module,exports){var assert=require("assert");var linesModule=require("./lines");var types=require("./types");var getFieldValue=types.getFieldValue;var Node=types.namedTypes.Node;var Expression=types.namedTypes.Expression;var SourceLocation=types.namedTypes.SourceLocation;var util=require("./util");var comparePos=util.comparePos;var NodePath=types.NodePath;var isObject=types.builtInTypes.object;var isArray=types.builtInTypes.array;var isString=types.builtInTypes.string;function Patcher(lines){assert.ok(this instanceof Patcher);assert.ok(lines instanceof linesModule.Lines);var self=this,replacements=[];self.replace=function(loc,lines){if(isString.check(lines))lines=linesModule.fromString(lines);replacements.push({lines:lines,start:loc.start,end:loc.end})};self.get=function(loc){loc=loc||{start:{line:1,column:0},end:{line:lines.length,column:lines.getLineLength(lines.length)}};var sliceFrom=loc.start,toConcat=[];function pushSlice(from,to){assert.ok(comparePos(from,to)<=0);toConcat.push(lines.slice(from,to))}replacements.sort(function(a,b){return comparePos(a.start,b.start)}).forEach(function(rep){if(comparePos(sliceFrom,rep.start)>0){}else{pushSlice(sliceFrom,rep.start);
toConcat.push(rep.lines);sliceFrom=rep.end}});pushSlice(sliceFrom,loc.end);return linesModule.concat(toConcat)}}exports.Patcher=Patcher;exports.getReprinter=function(path){assert.ok(path instanceof NodePath);var node=path.value;if(!Node.check(node))return;var orig=node.original;var origLoc=orig&&orig.loc;var lines=origLoc&&origLoc.lines;var reprints=[];if(!lines||!findReprints(path,reprints))return;return function(print){var patcher=new Patcher(lines);reprints.forEach(function(reprint){var old=reprint.oldPath.value;SourceLocation.assert(old.loc,true);patcher.replace(old.loc,print(reprint.newPath).indentTail(old.loc.indent))});return patcher.get(origLoc).indentTail(-orig.loc.indent)}};function findReprints(newPath,reprints){var newNode=newPath.value;Node.assert(newNode);var oldNode=newNode.original;Node.assert(oldNode);assert.deepEqual(reprints,[]);if(newNode.type!==oldNode.type){return false}var oldPath=new NodePath(oldNode);var canReprint=findChildReprints(newPath,oldPath,reprints);if(!canReprint){reprints.length=0}return canReprint}function findAnyReprints(newPath,oldPath,reprints){var newNode=newPath.value;var oldNode=oldPath.value;if(newNode===oldNode)return true;if(isArray.check(newNode))return findArrayReprints(newPath,oldPath,reprints);if(isObject.check(newNode))return findObjectReprints(newPath,oldPath,reprints);return false}function findArrayReprints(newPath,oldPath,reprints){var newNode=newPath.value;var oldNode=oldPath.value;isArray.assert(newNode);var len=newNode.length;if(!(isArray.check(oldNode)&&oldNode.length===len))return false;for(var i=0;i<len;++i)if(!findAnyReprints(newPath.get(i),oldPath.get(i),reprints))return false;return true}function findObjectReprints(newPath,oldPath,reprints){var newNode=newPath.value;isObject.assert(newNode);if(newNode.original===null){return false}var oldNode=oldPath.value;if(!isObject.check(oldNode))return false;if(Node.check(newNode)){if(!Node.check(oldNode)){return false}if(!oldNode.loc){return false}if(newNode.type===oldNode.type){var childReprints=[];if(findChildReprints(newPath,oldPath,childReprints)){reprints.push.apply(reprints,childReprints)}else{reprints.push({newPath:newPath,oldPath:oldPath})}return true}if(Expression.check(newNode)&&Expression.check(oldNode)){reprints.push({newPath:newPath,oldPath:oldPath});return true}return false}return findChildReprints(newPath,oldPath,reprints)}var reusablePos={line:1,column:0};function hasOpeningParen(oldPath){var oldNode=oldPath.value;var loc=oldNode.loc;var lines=loc&&loc.lines;if(lines){var pos=reusablePos;pos.line=loc.start.line;pos.column=loc.start.column;while(lines.prevPos(pos)){var ch=lines.charAt(pos);if(ch==="("){var rootPath=oldPath;while(rootPath.parentPath)rootPath=rootPath.parentPath;return comparePos(rootPath.value.loc.start,pos)<=0}if(ch!==" "){return false}}}return false}function hasClosingParen(oldPath){var oldNode=oldPath.value;var loc=oldNode.loc;var lines=loc&&loc.lines;if(lines){var pos=reusablePos;pos.line=loc.end.line;pos.column=loc.end.column;do{var ch=lines.charAt(pos);if(ch===")"){var rootPath=oldPath;while(rootPath.parentPath)rootPath=rootPath.parentPath;return comparePos(pos,rootPath.value.loc.end)<=0}if(ch!==" "){return false}}while(lines.nextPos(pos))}return false}function hasParens(oldPath){return hasOpeningParen(oldPath)&&hasClosingParen(oldPath)}function findChildReprints(newPath,oldPath,reprints){var newNode=newPath.value;var oldNode=oldPath.value;isObject.assert(newNode);isObject.assert(oldNode);if(newNode.original===null){return false}if(!newPath.canBeFirstInStatement()&&newPath.firstInStatement()&&!hasOpeningParen(oldPath))return false;if(newPath.needsParens(true)&&!hasParens(oldPath)){return false}for(var k in util.getUnionOfKeys(newNode,oldNode)){if(k==="loc")continue;if(!findAnyReprints(newPath.get(k),oldPath.get(k),reprints))return false}return true}},{"./lines":152,"./types":158,"./util":159,assert:95}],157:[function(require,module,exports){var assert=require("assert");var sourceMap=require("source-map");var printComments=require("./comments").printComments;var linesModule=require("./lines");var fromString=linesModule.fromString;var concat=linesModule.concat;var normalizeOptions=require("./options").normalize;var getReprinter=require("./patcher").getReprinter;var types=require("./types");var namedTypes=types.namedTypes;var isString=types.builtInTypes.string;var isObject=types.builtInTypes.object;var NodePath=types.NodePath;var util=require("./util");function PrintResult(code,sourceMap){assert.ok(this instanceof PrintResult);isString.assert(code);this.code=code;if(sourceMap){isObject.assert(sourceMap);this.map=sourceMap}}var PRp=PrintResult.prototype;var warnedAboutToString=false;PRp.toString=function(){if(!warnedAboutToString){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.");warnedAboutToString=true}return this.code};var emptyPrintResult=new PrintResult("");function Printer(originalOptions){assert.ok(this instanceof Printer);var explicitTabWidth=originalOptions&&originalOptions.tabWidth;var options=normalizeOptions(originalOptions);assert.notStrictEqual(options,originalOptions);options.sourceFileName=null;function printWithComments(path){assert.ok(path instanceof NodePath);return printComments(path.node.comments,print(path),options)}function print(path,includeComments){if(includeComments)return printWithComments(path);assert.ok(path instanceof NodePath);if(!explicitTabWidth){var oldTabWidth=options.tabWidth;var loc=path.node.loc;if(loc&&loc.lines&&loc.lines.guessTabWidth){options.tabWidth=loc.lines.guessTabWidth();var lines=maybeReprint(path);options.tabWidth=oldTabWidth;return lines}}return maybeReprint(path)}function maybeReprint(path){var reprinter=getReprinter(path);if(reprinter)return maybeAddParens(path,reprinter(maybeReprint));return printRootGenerically(path)}function printRootGenerically(path){return genericPrint(path,options,printWithComments)}function printGenerically(path){return genericPrint(path,options,printGenerically)}this.print=function(ast){if(!ast){return emptyPrintResult}var path=ast instanceof NodePath?ast:new NodePath(ast);var lines=print(path,true);return new PrintResult(lines.toString(options),util.composeSourceMaps(options.inputSourceMap,lines.getSourceMap(options.sourceMapName,options.sourceRoot)))};this.printGenerically=function(ast){if(!ast){return emptyPrintResult}var path=ast instanceof NodePath?ast:new NodePath(ast);var oldReuseWhitespace=options.reuseWhitespace;options.reuseWhitespace=false;var pr=new PrintResult(printGenerically(path).toString(options));options.reuseWhitespace=oldReuseWhitespace;return pr}}exports.Printer=Printer;function maybeAddParens(path,lines){return path.needsParens()?concat(["(",lines,")"]):lines}function genericPrint(path,options,printPath){assert.ok(path instanceof NodePath);return maybeAddParens(path,genericPrintNoParens(path,options,printPath))}function genericPrintNoParens(path,options,print){var n=path.value;if(!n){return fromString("")}if(typeof n==="string"){return fromString(n,options)}namedTypes.Node.assert(n);switch(n.type){case"File":path=path.get("program");n=path.node;namedTypes.Program.assert(n);case"Program":return maybeAddSemicolon(printStatementSequence(path.get("body"),options,print));case"EmptyStatement":return fromString("");case"ExpressionStatement":return concat([print(path.get("expression")),";"]);case"BinaryExpression":case"LogicalExpression":case"AssignmentExpression":return fromString(" ").join([print(path.get("left")),n.operator,print(path.get("right"))]);case"MemberExpression":var parts=[print(path.get("object"))];if(n.computed)parts.push("[",print(path.get("property")),"]");else parts.push(".",print(path.get("property")));return concat(parts);case"Path":return fromString(".").join(n.body);case"Identifier":return fromString(n.name,options);case"SpreadElement":case"SpreadElementPattern":case"SpreadProperty":case"SpreadPropertyPattern":return concat(["...",print(path.get("argument"))]);case"FunctionDeclaration":case"FunctionExpression":var parts=[];if(n.async)parts.push("async ");parts.push("function");if(n.generator)parts.push("*");if(n.id)parts.push(" ",print(path.get("id")));parts.push("(",printFunctionParams(path,options,print),") ",print(path.get("body")));return concat(parts);case"ArrowFunctionExpression":var parts=[];if(n.async)parts.push("async ");if(n.params.length===1){parts.push(print(path.get("params",0)))}else{parts.push("(",printFunctionParams(path,options,print),")")}parts.push(" => ",print(path.get("body")));return concat(parts);case"MethodDefinition":var parts=[];if(n.static){parts.push("static ")}parts.push(printMethod(n.kind,path.get("key"),path.get("value"),options,print));return concat(parts);case"YieldExpression":var parts=["yield"];if(n.delegate)parts.push("*");if(n.argument)parts.push(" ",print(path.get("argument")));return concat(parts);case"AwaitExpression":var parts=["await"];if(n.all)parts.push("*");if(n.argument)parts.push(" ",print(path.get("argument")));return concat(parts);case"ModuleDeclaration":var parts=["module",print(path.get("id"))];if(n.source){assert.ok(!n.body);parts.push("from",print(path.get("source")))}else{parts.push(print(path.get("body")))}return fromString(" ").join(parts);case"ImportSpecifier":case"ExportSpecifier":var parts=[print(path.get("id"))];if(n.name)parts.push(" as ",print(path.get("name")));return concat(parts);case"ExportBatchSpecifier":return fromString("*");case"ImportNamespaceSpecifier":return concat(["* as ",print(path.get("id"))]);case"ImportDefaultSpecifier":return print(path.get("id"));case"ExportDeclaration":var parts=["export"];if(n["default"]){parts.push(" default")}else if(n.specifiers&&n.specifiers.length>0){if(n.specifiers.length===1&&n.specifiers[0].type==="ExportBatchSpecifier"){parts.push(" *")}else{parts.push(" { ",fromString(", ").join(path.get("specifiers").map(print))," }")}if(n.source)parts.push(" from ",print(path.get("source")));parts.push(";");return concat(parts)}if(n.declaration){if(!namedTypes.Node.check(n.declaration)){console.log(JSON.stringify(n,null,2))}var decLines=print(path.get("declaration"));parts.push(" ",decLines);if(lastNonSpaceCharacter(decLines)!==";"){parts.push(";")}}return concat(parts);case"ImportDeclaration":var parts=["import "];if(n.specifiers&&n.specifiers.length>0){var foundImportSpecifier=false;path.get("specifiers").each(function(sp){if(sp.name>0){parts.push(", ")}if(namedTypes.ImportDefaultSpecifier.check(sp.value)||namedTypes.ImportNamespaceSpecifier.check(sp.value)){assert.strictEqual(foundImportSpecifier,false)}else{namedTypes.ImportSpecifier.assert(sp.value);if(!foundImportSpecifier){foundImportSpecifier=true;parts.push("{")}}parts.push(print(sp))});if(foundImportSpecifier){parts.push("}")}parts.push(" from ")}parts.push(print(path.get("source")),";");return concat(parts);case"BlockStatement":var naked=printStatementSequence(path.get("body"),options,print);if(naked.isEmpty())return fromString("{}");return concat(["{\n",naked.indent(options.tabWidth),"\n}"]);case"ReturnStatement":var parts=["return"];if(n.argument){var argLines=print(path.get("argument"));if(argLines.length>1&&namedTypes.XJSElement&&namedTypes.XJSElement.check(n.argument)){parts.push(" (\n",argLines.indent(options.tabWidth),"\n)")}else{parts.push(" ",argLines)}}parts.push(";");return concat(parts);case"CallExpression":return concat([print(path.get("callee")),printArgumentsList(path,options,print)]);case"ObjectExpression":case"ObjectPattern":var allowBreak=false,len=n.properties.length,parts=[len>0?"{\n":"{"];path.get("properties").map(function(childPath){var prop=childPath.value;var i=childPath.name;var lines=print(childPath).indent(options.tabWidth);var multiLine=lines.length>1;if(multiLine&&allowBreak){parts.push("\n")}parts.push(lines);if(i<len-1){parts.push(multiLine?",\n\n":",\n");allowBreak=!multiLine}});parts.push(len>0?"\n}":"}");return concat(parts);case"PropertyPattern":return concat([print(path.get("key")),": ",print(path.get("pattern"))]);case"Property":if(n.method||n.kind==="get"||n.kind==="set"){return printMethod(n.kind,path.get("key"),path.get("value"),options,print)}if(path.node.shorthand){return print(path.get("key"))}else{return concat([print(path.get("key")),": ",print(path.get("value"))])}case"ArrayExpression":case"ArrayPattern":var elems=n.elements,len=elems.length,parts=["["];path.get("elements").each(function(elemPath){var elem=elemPath.value;if(!elem){parts.push(",")}else{var i=elemPath.name;if(i>0)parts.push(" ");parts.push(print(elemPath));if(i<len-1)parts.push(",")}});parts.push("]");return concat(parts);case"SequenceExpression":return fromString(", ").join(path.get("expressions").map(print));case"ThisExpression":return fromString("this");case"Literal":if(typeof n.value!=="string")return fromString(n.value,options);case"ModuleSpecifier":return fromString(nodeStr(n),options);case"UnaryExpression":var parts=[n.operator];if(/[a-z]$/.test(n.operator))parts.push(" ");parts.push(print(path.get("argument")));return concat(parts);case"UpdateExpression":var parts=[print(path.get("argument")),n.operator];if(n.prefix)parts.reverse();return concat(parts);case"ConditionalExpression":return concat(["(",print(path.get("test"))," ? ",print(path.get("consequent"))," : ",print(path.get("alternate")),")"]);case"NewExpression":var parts=["new ",print(path.get("callee"))];var args=n.arguments;if(args){parts.push(printArgumentsList(path,options,print))}return concat(parts);case"VariableDeclaration":var parts=[n.kind," "];var maxLen=0;var printed=path.get("declarations").map(function(childPath){var lines=print(childPath);maxLen=Math.max(lines.length,maxLen);return lines});if(maxLen===1){parts.push(fromString(", ").join(printed))}else if(printed.length>1){parts.push(fromString(",\n").join(printed).indentTail(n.kind.length+1))}else{parts.push(printed[0])}var parentNode=path.parent&&path.parent.node;if(!namedTypes.ForStatement.check(parentNode)&&!namedTypes.ForInStatement.check(parentNode)&&!(namedTypes.ForOfStatement&&namedTypes.ForOfStatement.check(parentNode))){parts.push(";")}return concat(parts);case"VariableDeclarator":return n.init?fromString(" = ").join([print(path.get("id")),print(path.get("init"))]):print(path.get("id"));case"WithStatement":return concat(["with (",print(path.get("object")),") ",print(path.get("body"))]);case"IfStatement":var con=adjustClause(print(path.get("consequent")),options),parts=["if (",print(path.get("test")),")",con];if(n.alternate)parts.push(endsWithBrace(con)?" else":"\nelse",adjustClause(print(path.get("alternate")),options));return concat(parts);case"ForStatement":var init=print(path.get("init")),sep=init.length>1?";\n":"; ",forParen="for (",indented=fromString(sep).join([init,print(path.get("test")),print(path.get("update"))]).indentTail(forParen.length),head=concat([forParen,indented,")"]),clause=adjustClause(print(path.get("body")),options),parts=[head];if(head.length>1){parts.push("\n");clause=clause.trimLeft()}parts.push(clause);return concat(parts);case"WhileStatement":return concat(["while (",print(path.get("test")),")",adjustClause(print(path.get("body")),options)]);case"ForInStatement":return concat([n.each?"for each (":"for (",print(path.get("left"))," in ",print(path.get("right")),")",adjustClause(print(path.get("body")),options)]);case"ForOfStatement":return concat(["for (",print(path.get("left"))," of ",print(path.get("right")),")",adjustClause(print(path.get("body")),options)]);case"DoWhileStatement":var doBody=concat(["do",adjustClause(print(path.get("body")),options)]),parts=[doBody];if(endsWithBrace(doBody))parts.push(" while");else parts.push("\nwhile");parts.push(" (",print(path.get("test")),");");return concat(parts);case"BreakStatement":var parts=["break"];if(n.label)parts.push(" ",print(path.get("label")));parts.push(";");return concat(parts);case"ContinueStatement":var parts=["continue"];if(n.label)parts.push(" ",print(path.get("label")));parts.push(";");return concat(parts);case"LabeledStatement":return concat([print(path.get("label")),":\n",print(path.get("body"))]);case"TryStatement":var parts=["try ",print(path.get("block"))];path.get("handlers").each(function(handler){parts.push(" ",print(handler))});if(n.finalizer)parts.push(" finally ",print(path.get("finalizer")));return concat(parts);case"CatchClause":var parts=["catch (",print(path.get("param"))];if(n.guard)parts.push(" if ",print(path.get("guard")));parts.push(") ",print(path.get("body")));return concat(parts);case"ThrowStatement":return concat(["throw ",print(path.get("argument")),";"]);case"SwitchStatement":return concat(["switch (",print(path.get("discriminant")),") {\n",fromString("\n").join(path.get("cases").map(print)),"\n}"]);case"SwitchCase":var parts=[];if(n.test)parts.push("case ",print(path.get("test")),":");else parts.push("default:");if(n.consequent.length>0){parts.push("\n",printStatementSequence(path.get("consequent"),options,print).indent(options.tabWidth))}return concat(parts);case"DebuggerStatement":return fromString("debugger;");case"XJSAttribute":var parts=[print(path.get("name"))];if(n.value)parts.push("=",print(path.get("value")));return concat(parts);case"XJSIdentifier":return fromString(n.name,options);case"XJSNamespacedName":return fromString(":").join([print(path.get("namespace")),print(path.get("name"))]);case"XJSMemberExpression":return fromString(".").join([print(path.get("object")),print(path.get("property"))]);case"XJSSpreadAttribute":return concat(["{...",print(path.get("argument")),"}"]);case"XJSExpressionContainer":return concat(["{",print(path.get("expression")),"}"]);case"XJSElement":var openingLines=print(path.get("openingElement"));if(n.openingElement.selfClosing){assert.ok(!n.closingElement);return openingLines}var childLines=concat(path.get("children").map(function(childPath){var child=childPath.value;if(namedTypes.Literal.check(child)&&typeof child.value==="string"){if(/\S/.test(child.value)){return child.value.replace(/^\s+|\s+$/g,"")}else if(/\n/.test(child.value)){return"\n"}}return print(childPath)})).indentTail(options.tabWidth);var closingLines=print(path.get("closingElement"));return concat([openingLines,childLines,closingLines]);case"XJSOpeningElement":var parts=["<",print(path.get("name"))];var attrParts=[];path.get("attributes").each(function(attrPath){attrParts.push(" ",print(attrPath))});var attrLines=concat(attrParts);var needLineWrap=attrLines.length>1||attrLines.getLineLength(1)>options.wrapColumn;if(needLineWrap){attrParts.forEach(function(part,i){if(part===" "){assert.strictEqual(i%2,0);attrParts[i]="\n"}});attrLines=concat(attrParts).indentTail(options.tabWidth)}parts.push(attrLines,n.selfClosing?" />":">");return concat(parts);case"XJSClosingElement":return concat(["</",print(path.get("name")),">"]);case"XJSText":return fromString(n.value,options);case"XJSEmptyExpression":return fromString("");case"TypeAnnotatedIdentifier":var parts=[print(path.get("annotation"))," ",print(path.get("identifier"))];return concat(parts);case"ClassBody":if(n.body.length===0){return fromString("{}")}return concat(["{\n",printStatementSequence(path.get("body"),options,print).indent(options.tabWidth),"\n}"]);case"ClassPropertyDefinition":var parts=["static ",print(path.get("definition"))];if(!namedTypes.MethodDefinition.check(n.definition))parts.push(";");return concat(parts);case"ClassProperty":return concat([print(path.get("id")),";"]);case"ClassDeclaration":case"ClassExpression":var parts=["class"];if(n.id)parts.push(" ",print(path.get("id")));if(n.superClass)parts.push(" extends ",print(path.get("superClass")));parts.push(" ",print(path.get("body")));return concat(parts);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(n.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(n.type))}return p}function printStatementSequence(path,options,print){var inClassBody=path.parent&&namedTypes.ClassBody&&namedTypes.ClassBody.check(path.parent.node);var filtered=path.filter(function(stmtPath){var stmt=stmtPath.value;if(!stmt)return false;if(stmt.type==="EmptyStatement")return false;if(!inClassBody){namedTypes.Statement.assert(stmt)}return true});var prevTrailingSpace=null;var len=filtered.length;var parts=[];filtered.forEach(function(stmtPath,i){var printed=print(stmtPath);var stmt=stmtPath.value;var needSemicolon=true;var multiLine=printed.length>1;var notFirst=i>0;var notLast=i<len-1;var leadingSpace;var trailingSpace;if(inClassBody){var stmt=stmtPath.value;if(namedTypes.MethodDefinition.check(stmt)||namedTypes.ClassPropertyDefinition.check(stmt)&&namedTypes.MethodDefinition.check(stmt.definition)){needSemicolon=false}}if(needSemicolon){printed=maybeAddSemicolon(printed)}var trueLoc=options.reuseWhitespace&&getTrueLoc(stmt);var lines=trueLoc&&trueLoc.lines;if(notFirst){if(lines){var beforeStart=lines.skipSpaces(trueLoc.start,true);var beforeStartLine=beforeStart?beforeStart.line:1;var leadingGap=trueLoc.start.line-beforeStartLine;leadingSpace=Array(leadingGap+1).join("\n")}else{leadingSpace=multiLine?"\n\n":"\n"}}else{leadingSpace=""}if(notLast){if(lines){var afterEnd=lines.skipSpaces(trueLoc.end);var afterEndLine=afterEnd?afterEnd.line:lines.length;var trailingGap=afterEndLine-trueLoc.end.line;trailingSpace=Array(trailingGap+1).join("\n")}else{trailingSpace=multiLine?"\n\n":"\n"}}else{trailingSpace=""}parts.push(maxSpace(prevTrailingSpace,leadingSpace),printed);if(notLast){prevTrailingSpace=trailingSpace}else if(trailingSpace){parts.push(trailingSpace)}});return concat(parts)}function getTrueLoc(node){if(!node.loc){return null}if(!node.comments){return node.loc}var start=node.loc.start;var end=node.loc.end;node.comments.forEach(function(comment){if(comment.loc){if(util.comparePos(comment.loc.start,start)<0){start=comment.loc.start}if(util.comparePos(end,comment.loc.end)<0){end=comment.loc.end}}});return{lines:node.loc.lines,start:start,end:end}}function maxSpace(s1,s2){if(!s1&&!s2){return fromString("")}if(!s1){return fromString(s2)}if(!s2){return fromString(s1)}var spaceLines1=fromString(s1);var spaceLines2=fromString(s2);if(spaceLines2.length>spaceLines1.length){return spaceLines2}return spaceLines1}function printMethod(kind,keyPath,valuePath,options,print){var parts=[];var key=keyPath.value;var value=valuePath.value;namedTypes.FunctionExpression.assert(value);if(value.async){parts.push("async ")}if(!kind||kind==="init"){if(value.generator){parts.push("*")}}else{assert.ok(kind==="get"||kind==="set");parts.push(kind," ")}parts.push(print(keyPath),"(",printFunctionParams(valuePath,options,print),") ",print(valuePath.get("body")));return concat(parts)}function printArgumentsList(path,options,print){var printed=path.get("arguments").map(print);var joined=fromString(", ").join(printed);if(joined.getLineLength(1)>options.wrapColumn){joined=fromString(",\n").join(printed);return concat(["(\n",joined.indent(options.tabWidth),"\n)"])}return concat(["(",joined,")"])}function printFunctionParams(path,options,print){var fun=path.node;namedTypes.Function.assert(fun);var params=path.get("params");var defaults=path.get("defaults");var printed=params.map(defaults.value?function(param){var p=print(param);var d=defaults.get(param.name);return d.value?concat([p,"=",print(d)]):p}:print);if(fun.rest){printed.push(concat(["...",print(path.get("rest"))]))}var joined=fromString(", ").join(printed);if(joined.length>1||joined.getLineLength(1)>options.wrapColumn){joined=fromString(",\n").join(printed);return concat(["\n",joined.indent(options.tabWidth)])}return joined}function adjustClause(clause,options){if(clause.length>1)return concat([" ",clause]);return concat(["\n",maybeAddSemicolon(clause).indent(options.tabWidth)])}function lastNonSpaceCharacter(lines){var pos=lines.lastPos();do{var ch=lines.charAt(pos);if(/\S/.test(ch))return ch}while(lines.prevPos(pos))}function endsWithBrace(lines){return lastNonSpaceCharacter(lines)==="}"}function nodeStr(n){namedTypes.Literal.assert(n);isString.assert(n.value);return JSON.stringify(n.value)}function maybeAddSemicolon(lines){var eoc=lastNonSpaceCharacter(lines);if(!eoc||"\n};".indexOf(eoc)<0)return concat([lines,";"]);return lines}},{"./comments":151,"./lines":152,"./options":154,"./patcher":156,"./types":158,"./util":159,assert:95,"source-map":169}],158:[function(require,module,exports){var types=require("ast-types");var def=types.Type.def;def("File").bases("Node").build("program").field("program",def("Program"));types.finalize();module.exports=types},{"ast-types":93}],159:[function(require,module,exports){var assert=require("assert");var getFieldValue=require("./types").getFieldValue;var sourceMap=require("source-map");var SourceMapConsumer=sourceMap.SourceMapConsumer;var SourceMapGenerator=sourceMap.SourceMapGenerator;var hasOwn=Object.prototype.hasOwnProperty;function getUnionOfKeys(){var result={};var argc=arguments.length;for(var i=0;i<argc;++i){var keys=Object.keys(arguments[i]);var keyCount=keys.length;for(var j=0;j<keyCount;++j){result[keys[j]]=true}}return result}exports.getUnionOfKeys=getUnionOfKeys;function comparePos(pos1,pos2){return pos1.line-pos2.line||pos1.column-pos2.column}exports.comparePos=comparePos;exports.composeSourceMaps=function(formerMap,latterMap){if(formerMap){if(!latterMap){return formerMap}}else{return latterMap||null}var smcFormer=new SourceMapConsumer(formerMap);var smcLatter=new SourceMapConsumer(latterMap);var smg=new SourceMapGenerator({file:latterMap.file,sourceRoot:latterMap.sourceRoot});var sourcesToContents={};smcLatter.eachMapping(function(mapping){var origPos=smcFormer.originalPositionFor({line:mapping.originalLine,column:mapping.originalColumn});var sourceName=origPos.source;if(sourceName===null){return}smg.addMapping({source:sourceName,original:{line:origPos.line,column:origPos.column},generated:{line:mapping.generatedLine,column:mapping.generatedColumn},name:mapping.name});var sourceContent=smcFormer.sourceContentFor(sourceName);if(sourceContent&&!hasOwn.call(sourcesToContents,sourceName)){sourcesToContents[sourceName]=sourceContent;smg.setSourceContent(sourceName,sourceContent)}});return smg.toJSON()}},{"./types":158,assert:95,"source-map":169}],160:[function(require,module,exports){(function(process){var types=require("./lib/types");var parse=require("./lib/parser").parse;var Printer=require("./lib/printer").Printer;function print(node,options){return new Printer(options).print(node)}function prettyPrint(node,options){return new Printer(options).printGenerically(node)}function run(transformer,options){return runFile(process.argv[2],transformer,options)}function runFile(path,transformer,options){require("fs").readFile(path,"utf-8",function(err,code){if(err){console.error(err);return}runString(code,transformer,options)})}function defaultWriteback(output){process.stdout.write(output)}function runString(code,transformer,options){var writeback=options&&options.writeback||defaultWriteback;transformer(parse(code,options),function(node){writeback(print(node,options).code)})}Object.defineProperties(exports,{parse:{enumerable:true,value:parse},visit:{enumerable:true,value:types.visit},print:{enumerable:true,value:print},prettyPrint:{enumerable:false,value:prettyPrint},types:{enumerable:false,value:types},run:{enumerable:false,value:run}})}).call(this,require("_process"))},{"./lib/parser":155,"./lib/printer":157,"./lib/types":158,_process:104,fs:94}],161:[function(require,module,exports){(function(process){var Stream=require("stream");exports=module.exports=through;through.through=through;function through(write,end,opts){write=write||function(data){this.queue(data)};end=end||function(){this.queue(null)};var ended=false,destroyed=false,buffer=[],_ended=false;var stream=new Stream;stream.readable=stream.writable=true;stream.paused=false;stream.autoDestroy=!(opts&&opts.autoDestroy===false);stream.write=function(data){write.call(this,data);return!stream.paused};function drain(){while(buffer.length&&!stream.paused){var data=buffer.shift();if(null===data)return stream.emit("end");else stream.emit("data",data)}}stream.queue=stream.push=function(data){if(_ended)return stream;if(data==null)_ended=true;buffer.push(data);drain();return stream};stream.on("end",function(){stream.readable=false;if(!stream.writable&&stream.autoDestroy)process.nextTick(function(){stream.destroy()})});function _end(){stream.writable=false;end.call(stream);if(!stream.readable&&stream.autoDestroy)stream.destroy()}stream.end=function(data){if(ended)return;ended=true;if(arguments.length)stream.write(data);_end();return stream};stream.destroy=function(){if(destroyed)return;destroyed=true;ended=true;buffer.length=0;stream.writable=stream.readable=false;stream.emit("close");return stream};stream.pause=function(){if(stream.paused)return;stream.paused=true;return stream};stream.resume=function(){if(stream.paused){stream.paused=false;stream.emit("resume")}drain();if(!stream.paused)stream.emit("drain");return stream};return stream}}).call(this,require("_process"))},{_process:104,stream:116}],162:[function(require,module,exports){!function(){var hasOwn=Object.prototype.hasOwnProperty;var undefined;var iteratorSymbol=typeof Symbol==="function"&&Symbol.iterator||"@@iterator";if(typeof regeneratorRuntime==="object"){return}var runtime=regeneratorRuntime=typeof exports==="undefined"?{}:exports;function wrap(innerFn,outerFn,self,tryList){return new Generator(innerFn,outerFn,self||null,tryList||[])}runtime.wrap=wrap;var GenStateSuspendedStart="suspendedStart";var GenStateSuspendedYield="suspendedYield";var GenStateExecuting="executing";var GenStateCompleted="completed";var ContinueSentinel={};function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype;GeneratorFunction.prototype=Gp.constructor=GeneratorFunctionPrototype;GeneratorFunctionPrototype.constructor=GeneratorFunction;GeneratorFunction.displayName="GeneratorFunction";runtime.isGeneratorFunction=function(genFun){var ctor=typeof genFun==="function"&&genFun.constructor;return ctor?ctor===GeneratorFunction||(ctor.displayName||ctor.name)==="GeneratorFunction":false};runtime.mark=function(genFun){genFun.__proto__=GeneratorFunctionPrototype;genFun.prototype=Object.create(Gp);return genFun
};runtime.async=function(innerFn,outerFn,self,tryList){return new Promise(function(resolve,reject){var generator=wrap(innerFn,outerFn,self,tryList);var callNext=step.bind(generator.next);var callThrow=step.bind(generator["throw"]);function step(arg){try{var info=this(arg);var value=info.value}catch(error){return reject(error)}if(info.done){resolve(value)}else{Promise.resolve(value).then(callNext,callThrow)}}callNext()})};function Generator(innerFn,outerFn,self,tryList){var generator=outerFn?Object.create(outerFn.prototype):this;var context=new Context(tryList);var state=GenStateSuspendedStart;function invoke(method,arg){if(state===GenStateExecuting){throw new Error("Generator is already running")}if(state===GenStateCompleted){return doneResult()}while(true){var delegate=context.delegate;if(delegate){try{var info=delegate.iterator[method](arg);method="next";arg=undefined}catch(uncaught){context.delegate=null;method="throw";arg=uncaught;continue}if(info.done){context[delegate.resultName]=info.value;context.next=delegate.nextLoc}else{state=GenStateSuspendedYield;return info}context.delegate=null}if(method==="next"){if(state===GenStateSuspendedStart&&typeof arg!=="undefined"){throw new TypeError("attempt to send "+JSON.stringify(arg)+" to newborn generator")}if(state===GenStateSuspendedYield){context.sent=arg}else{delete context.sent}}else if(method==="throw"){if(state===GenStateSuspendedStart){state=GenStateCompleted;throw arg}if(context.dispatchException(arg)){method="next";arg=undefined}}else if(method==="return"){context.abrupt("return",arg)}state=GenStateExecuting;try{var value=innerFn.call(self,context);state=context.done?GenStateCompleted:GenStateSuspendedYield;var info={value:value,done:context.done};if(value===ContinueSentinel){if(context.delegate&&method==="next"){arg=undefined}}else{return info}}catch(thrown){state=GenStateCompleted;if(method==="next"){context.dispatchException(thrown)}else{arg=thrown}}}}generator.next=invoke.bind(generator,"next");generator["throw"]=invoke.bind(generator,"throw");generator["return"]=invoke.bind(generator,"return");return generator}Gp[iteratorSymbol]=function(){return this};Gp.toString=function(){return"[object Generator]"};function pushTryEntry(triple){var entry={tryLoc:triple[0]};if(1 in triple){entry.catchLoc=triple[1]}if(2 in triple){entry.finallyLoc=triple[2]}this.tryEntries.push(entry)}function resetTryEntry(entry,i){var record=entry.completion||{};record.type=i===0?"normal":"return";delete record.arg;entry.completion=record}function Context(tryList){this.tryEntries=[{tryLoc:"root"}];tryList.forEach(pushTryEntry,this);this.reset()}runtime.keys=function(object){var keys=[];for(var key in object){keys.push(key)}keys.reverse();return function next(){while(keys.length){var key=keys.pop();if(key in object){next.value=key;next.done=false;return next}}next.done=true;return next}};function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod){return iteratorMethod.call(iterable)}if(typeof iterable.next==="function"){return iterable}if(!isNaN(iterable.length)){var i=-1;function next(){while(++i<iterable.length){if(hasOwn.call(iterable,i)){next.value=iterable[i];next.done=false;return next}}next.value=undefined;next.done=true;return next}return next.next=next}}return{next:doneResult}}runtime.values=values;function doneResult(){return{value:undefined,done:true}}Context.prototype={constructor:Context,reset:function(){this.prev=0;this.next=0;this.sent=undefined;this.done=false;this.delegate=null;this.tryEntries.forEach(resetTryEntry);for(var tempIndex=0,tempName;hasOwn.call(this,tempName="t"+tempIndex)||tempIndex<20;++tempIndex){this[tempName]=null}},stop:function(){this.done=true;var rootEntry=this.tryEntries[0];var rootRecord=rootEntry.completion;if(rootRecord.type==="throw"){throw rootRecord.arg}return this.rval},dispatchException:function(exception){if(this.done){throw exception}var context=this;function handle(loc,caught){record.type="throw";record.arg=exception;context.next=loc;return!!caught}for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];var record=entry.completion;if(entry.tryLoc==="root"){return handle("end")}if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc");var hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc){return handle(entry.catchLoc,true)}else if(this.prev<entry.finallyLoc){return handle(entry.finallyLoc)}}else if(hasCatch){if(this.prev<entry.catchLoc){return handle(entry.catchLoc,true)}}else if(hasFinally){if(this.prev<entry.finallyLoc){return handle(entry.finallyLoc)}}else{throw new Error("try statement without catch or finally")}}}},_findFinallyEntry:function(finallyLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&(entry.finallyLoc===finallyLoc||this.prev<entry.finallyLoc)){return entry}}},abrupt:function(type,arg){var entry=this._findFinallyEntry();var record=entry?entry.completion:{};record.type=type;record.arg=arg;if(entry){this.next=entry.finallyLoc}else{this.complete(record)}return ContinueSentinel},complete:function(record){if(record.type==="throw"){throw record.arg}if(record.type==="break"||record.type==="continue"){this.next=record.arg}else if(record.type==="return"){this.rval=record.arg;this.next="end"}return ContinueSentinel},finish:function(finallyLoc){var entry=this._findFinallyEntry(finallyLoc);return this.complete(entry.completion)},"catch":function(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if(record.type==="throw"){var thrown=record.arg;resetTryEntry(entry,i)}return thrown}}throw new Error("illegal catch attempt")},delegateYield:function(iterable,resultName,nextLoc){this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc};return ContinueSentinel}}}()},{}],163:[function(require,module,exports){var regenerate=require("regenerate");exports.REGULAR={d:regenerate().addRange(48,57),D:regenerate().addRange(0,47).addRange(58,65535),s:regenerate(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:regenerate().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:regenerate(95).addRange(48,57).addRange(65,90).addRange(97,122),W:regenerate(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,65535)};exports.UNICODE={d:regenerate().addRange(48,57),D:regenerate().addRange(0,47).addRange(58,1114111),s:regenerate(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:regenerate().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:regenerate(95).addRange(48,57).addRange(65,90).addRange(97,122),W:regenerate(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)};exports.UNICODE_IGNORE_CASE={d:regenerate().addRange(48,57),D:regenerate().addRange(0,47).addRange(58,1114111),s:regenerate(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:regenerate().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:regenerate(95,383,8490).addRange(48,57).addRange(65,90).addRange(97,122),W:regenerate(75,83,96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)}},{regenerate:165}],164:[function(require,module,exports){module.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}},{}],165:[function(require,module,exports){(function(global){(function(root){var freeExports=typeof exports=="object"&&exports;var freeModule=typeof module=="object"&&module&&module.exports==freeExports&&module;var freeGlobal=typeof global=="object"&&global;if(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal){root=freeGlobal}var ERRORS={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 HIGH_SURROGATE_MIN=55296;var HIGH_SURROGATE_MAX=56319;var LOW_SURROGATE_MIN=56320;var LOW_SURROGATE_MAX=57343;var regexNull=/\\x00([^0123456789]|$)/g;var object={};var hasOwnProperty=object.hasOwnProperty;var extend=function(destination,source){var key;for(key in source){if(hasOwnProperty.call(source,key)){destination[key]=source[key]}}return destination};var forEach=function(array,callback){var index=-1;var length=array.length;while(++index<length){callback(array[index],index)}};var toString=object.toString;var isArray=function(value){return toString.call(value)=="[object Array]"};var isNumber=function(value){return typeof value=="number"||toString.call(value)=="[object Number]"};var zeroes="0000";var pad=function(number,totalCharacters){var string=String(number);return string.length<totalCharacters?(zeroes+string).slice(-totalCharacters):string};var hex=function(number){return Number(number).toString(16).toUpperCase()};var slice=[].slice;var dataFromCodePoints=function(codePoints){var index=-1;var length=codePoints.length;var max=length-1;var result=[];var isStart=true;var tmp;var previous=0;while(++index<length){tmp=codePoints[index];if(isStart){result.push(tmp);previous=tmp;isStart=false}else{if(tmp==previous+1){if(index!=max){previous=tmp;continue}else{isStart=true;result.push(tmp+1)}}else{result.push(previous+1,tmp);previous=tmp}}}if(!isStart){result.push(tmp+1)}return result};var dataRemove=function(data,codePoint){var index=0;var start;var end;var length=data.length;while(index<length){start=data[index];end=data[index+1];if(codePoint>=start&&codePoint<end){if(codePoint==start){if(end==start+1){data.splice(index,2);return data}else{data[index]=codePoint+1;return data}}else if(codePoint==end-1){data[index+1]=codePoint;return data}else{data.splice(index,2,start,codePoint,codePoint+1,end);return data}}index+=2}return data};var dataRemoveRange=function(data,rangeStart,rangeEnd){if(rangeEnd<rangeStart){throw Error(ERRORS.rangeOrder)}var index=0;var start;var end;while(index<data.length){start=data[index];end=data[index+1]-1;if(start>rangeEnd){return data}if(rangeStart<=start&&rangeEnd>=end){data.splice(index,2);continue}if(rangeStart>=start&&rangeEnd<end){if(rangeStart==start){data[index]=rangeEnd+1;data[index+1]=end+1;return data}data.splice(index,2,start,rangeStart,rangeEnd+1,end+1);return data}if(rangeStart>=start&&rangeStart<=end){data[index+1]=rangeStart}else if(rangeEnd>=start&&rangeEnd<=end){data[index]=rangeEnd+1;return data}index+=2}return data};var dataAdd=function(data,codePoint){var index=0;var start;var end;var lastIndex=null;var length=data.length;if(codePoint<0||codePoint>1114111){throw RangeError(ERRORS.codePointRange)}while(index<length){start=data[index];end=data[index+1];if(codePoint>=start&&codePoint<end){return data}if(codePoint==start-1){data[index]=codePoint;return data}if(start>codePoint){data.splice(lastIndex!=null?lastIndex+2:0,0,codePoint,codePoint+1);return data}if(codePoint==end){if(codePoint+1==data[index+2]){data.splice(index,4,start,data[index+3]);return data}data[index+1]=codePoint+1;return data}lastIndex=index;index+=2}data.push(codePoint,codePoint+1);return data};var dataAddData=function(dataA,dataB){var index=0;var start;var end;var data=dataA.slice();var length=dataB.length;while(index<length){start=dataB[index];end=dataB[index+1]-1;if(start==end){data=dataAdd(data,start)}else{data=dataAddRange(data,start,end)}index+=2}return data};var dataRemoveData=function(dataA,dataB){var index=0;var start;var end;var data=dataA.slice();var length=dataB.length;while(index<length){start=dataB[index];end=dataB[index+1]-1;if(start==end){data=dataRemove(data,start)}else{data=dataRemoveRange(data,start,end)}index+=2}return data};var dataAddRange=function(data,rangeStart,rangeEnd){if(rangeEnd<rangeStart){throw Error(ERRORS.rangeOrder)}if(rangeStart<0||rangeStart>1114111||rangeEnd<0||rangeEnd>1114111){throw RangeError(ERRORS.codePointRange)}var index=0;var start;var end;var added=false;var length=data.length;while(index<length){start=data[index];end=data[index+1];if(added){if(start==rangeEnd+1){data.splice(index-1,2);return data}if(start>rangeEnd){return data}if(start>=rangeStart&&start<=rangeEnd){if(end>rangeStart&&end-1<=rangeEnd){data.splice(index,2);index-=2}else{data.splice(index-1,2);index-=2}}}else if(start==rangeEnd+1){data[index]=rangeStart;return data}else if(start>rangeEnd){data.splice(index,0,rangeStart,rangeEnd+1);return data}else if(rangeStart>=start&&rangeStart<end&&rangeEnd+1<=end){return data}else if(rangeStart>=start&&rangeStart<end||end==rangeStart){data[index+1]=rangeEnd+1;added=true}else if(rangeStart<=start&&rangeEnd+1>=end){data[index]=rangeStart;data[index+1]=rangeEnd+1;added=true}index+=2}if(!added){data.push(rangeStart,rangeEnd+1)}return data};var dataContains=function(data,codePoint){var index=0;var start;var end;var length=data.length;while(index<length){start=data[index];end=data[index+1];if(codePoint>=start&&codePoint<end){return true}index+=2}return false};var dataIntersection=function(data,codePoints){var index=0;var length=codePoints.length;var codePoint;var result=[];while(index<length){codePoint=codePoints[index];if(dataContains(data,codePoint)){result.push(codePoint)}++index}return dataFromCodePoints(result)};var dataIsEmpty=function(data){return!data.length};var dataIsSingleton=function(data){return data.length==2&&data[0]+1==data[1]};var dataToArray=function(data){var index=0;var start;var end;var result=[];var length=data.length;while(index<length){start=data[index];end=data[index+1];while(start<end){result.push(start);++start}index+=2}return result};var floor=Math.floor;var highSurrogate=function(codePoint){return parseInt(floor((codePoint-65536)/1024)+HIGH_SURROGATE_MIN,10)};var lowSurrogate=function(codePoint){return parseInt((codePoint-65536)%1024+LOW_SURROGATE_MIN,10)};var stringFromCharCode=String.fromCharCode;var codePointToString=function(codePoint){var string;if(codePoint==9){string="\\t"}else if(codePoint==10){string="\\n"}else if(codePoint==12){string="\\f"}else if(codePoint==13){string="\\r"}else if(codePoint==92){string="\\\\"}else if(codePoint==36||codePoint>=40&&codePoint<=43||codePoint==45||codePoint==46||codePoint==63||codePoint>=91&&codePoint<=94||codePoint>=123&&codePoint<=125){string="\\"+stringFromCharCode(codePoint)}else if(codePoint>=32&&codePoint<=126){string=stringFromCharCode(codePoint)}else if(codePoint<=255){string="\\x"+pad(hex(codePoint),2)}else{string="\\u"+pad(hex(codePoint),4)}return string};var symbolToCodePoint=function(symbol){var length=symbol.length;var first=symbol.charCodeAt(0);var second;if(first>=HIGH_SURROGATE_MIN&&first<=HIGH_SURROGATE_MAX&&length>1){second=symbol.charCodeAt(1);return(first-HIGH_SURROGATE_MIN)*1024+second-LOW_SURROGATE_MIN+65536}return first};var createBMPCharacterClasses=function(data){var result="";var index=0;var start;var end;var length=data.length;if(dataIsSingleton(data)){return codePointToString(data[0])}while(index<length){start=data[index];end=data[index+1]-1;if(start==end){result+=codePointToString(start)}else if(start+1==end){result+=codePointToString(start)+codePointToString(end)}else{result+=codePointToString(start)+"-"+codePointToString(end)}index+=2}return"["+result+"]"};var splitAtBMP=function(data){var loneHighSurrogates=[];var bmp=[];var astral=[];var index=0;var start;var end;var length=data.length;while(index<length){start=data[index];end=data[index+1]-1;if(start<=65535&&end<=65535){if(start>=HIGH_SURROGATE_MIN&&start<=HIGH_SURROGATE_MAX){if(end<=HIGH_SURROGATE_MAX){loneHighSurrogates.push(start,end+1)}else{loneHighSurrogates.push(start,HIGH_SURROGATE_MAX+1);bmp.push(HIGH_SURROGATE_MAX+1,end+1)}}else if(end>=HIGH_SURROGATE_MIN&&end<=HIGH_SURROGATE_MAX){bmp.push(start,HIGH_SURROGATE_MIN);loneHighSurrogates.push(HIGH_SURROGATE_MIN,end+1)}else if(start<HIGH_SURROGATE_MIN&&end>HIGH_SURROGATE_MAX){bmp.push(start,HIGH_SURROGATE_MIN,HIGH_SURROGATE_MAX+1,end+1);loneHighSurrogates.push(HIGH_SURROGATE_MIN,HIGH_SURROGATE_MAX+1)}else{bmp.push(start,end+1)}}else if(start<=65535&&end>65535){if(start>=HIGH_SURROGATE_MIN&&start<=HIGH_SURROGATE_MAX){loneHighSurrogates.push(start,HIGH_SURROGATE_MAX+1);bmp.push(HIGH_SURROGATE_MAX+1,65535+1)}else if(start<HIGH_SURROGATE_MIN){bmp.push(start,HIGH_SURROGATE_MIN,HIGH_SURROGATE_MAX+1,65535+1);loneHighSurrogates.push(HIGH_SURROGATE_MIN,HIGH_SURROGATE_MAX+1)}else{bmp.push(start,65535+1)}astral.push(65535+1,end+1)}else{astral.push(start,end+1)}index+=2}return{loneHighSurrogates:loneHighSurrogates,bmp:bmp,astral:astral}};var optimizeSurrogateMappings=function(surrogateMappings){var result=[];var tmpLow=[];var addLow=false;var mapping;var nextMapping;var highSurrogates;var lowSurrogates;var nextHighSurrogates;var nextLowSurrogates;var index=-1;var length=surrogateMappings.length;while(++index<length){mapping=surrogateMappings[index];nextMapping=surrogateMappings[index+1];if(!nextMapping){result.push(mapping);continue}highSurrogates=mapping[0];lowSurrogates=mapping[1];nextHighSurrogates=nextMapping[0];nextLowSurrogates=nextMapping[1];tmpLow=lowSurrogates;while(nextHighSurrogates&&highSurrogates[0]==nextHighSurrogates[0]&&highSurrogates[1]==nextHighSurrogates[1]){if(dataIsSingleton(nextLowSurrogates)){tmpLow=dataAdd(tmpLow,nextLowSurrogates[0])}else{tmpLow=dataAddRange(tmpLow,nextLowSurrogates[0],nextLowSurrogates[1]-1)}++index;mapping=surrogateMappings[index];highSurrogates=mapping[0];lowSurrogates=mapping[1];nextMapping=surrogateMappings[index+1];nextHighSurrogates=nextMapping&&nextMapping[0];nextLowSurrogates=nextMapping&&nextMapping[1];addLow=true}result.push([highSurrogates,addLow?tmpLow:lowSurrogates]);addLow=false}return optimizeByLowSurrogates(result)};var optimizeByLowSurrogates=function(surrogateMappings){if(surrogateMappings.length==1){return surrogateMappings}var index=-1;var innerIndex=-1;while(++index<surrogateMappings.length){var mapping=surrogateMappings[index];var lowSurrogates=mapping[1];var lowSurrogateStart=lowSurrogates[0];var lowSurrogateEnd=lowSurrogates[1];innerIndex=index;while(++innerIndex<surrogateMappings.length){var otherMapping=surrogateMappings[innerIndex];var otherLowSurrogates=otherMapping[1];var otherLowSurrogateStart=otherLowSurrogates[0];var otherLowSurrogateEnd=otherLowSurrogates[1];if(lowSurrogateStart==otherLowSurrogateStart&&lowSurrogateEnd==otherLowSurrogateEnd){if(dataIsSingleton(otherMapping[0])){mapping[0]=dataAdd(mapping[0],otherMapping[0][0])}else{mapping[0]=dataAddRange(mapping[0],otherMapping[0][0],otherMapping[0][1]-1)}surrogateMappings.splice(innerIndex,1);--innerIndex}}}return surrogateMappings};var surrogateSet=function(data){if(!data.length){return[]}var index=0;var start;var end;var startHigh;var startLow;var prevStartHigh=0;var prevEndHigh=0;var tmpLow=[];var endHigh;var endLow;var surrogateMappings=[];var length=data.length;var dataHigh=[];while(index<length){start=data[index];end=data[index+1]-1;startHigh=highSurrogate(start);startLow=lowSurrogate(start);endHigh=highSurrogate(end);endLow=lowSurrogate(end);var startsWithLowestLowSurrogate=startLow==LOW_SURROGATE_MIN;var endsWithHighestLowSurrogate=endLow==LOW_SURROGATE_MAX;var complete=false;if(startHigh==endHigh||startsWithLowestLowSurrogate&&endsWithHighestLowSurrogate){surrogateMappings.push([[startHigh,endHigh+1],[startLow,endLow+1]]);complete=true}else{surrogateMappings.push([[startHigh,startHigh+1],[startLow,LOW_SURROGATE_MAX+1]])}if(!complete&&startHigh+1<endHigh){if(endsWithHighestLowSurrogate){surrogateMappings.push([[startHigh+1,endHigh+1],[LOW_SURROGATE_MIN,endLow+1]]);complete=true}else{surrogateMappings.push([[startHigh+1,endHigh],[LOW_SURROGATE_MIN,LOW_SURROGATE_MAX+1]])}}if(!complete){surrogateMappings.push([[endHigh,endHigh+1],[LOW_SURROGATE_MIN,endLow+1]])}prevStartHigh=startHigh;prevEndHigh=endHigh;index+=2}return optimizeSurrogateMappings(surrogateMappings)};var createSurrogateCharacterClasses=function(surrogateMappings){var result=[];forEach(surrogateMappings,function(surrogateMapping){var highSurrogates=surrogateMapping[0];var lowSurrogates=surrogateMapping[1];result.push(createBMPCharacterClasses(highSurrogates)+createBMPCharacterClasses(lowSurrogates))});return result.join("|")};var createCharacterClassesFromData=function(data){var result=[];var parts=splitAtBMP(data);var loneHighSurrogates=parts.loneHighSurrogates;var bmp=parts.bmp;var astral=parts.astral;var hasAstral=!dataIsEmpty(parts.astral);var hasLoneSurrogates=!dataIsEmpty(loneHighSurrogates);var surrogateMappings=surrogateSet(astral);if(!hasAstral&&hasLoneSurrogates){bmp=dataAddData(bmp,loneHighSurrogates)}if(!dataIsEmpty(bmp)){result.push(createBMPCharacterClasses(bmp))}if(surrogateMappings.length){result.push(createSurrogateCharacterClasses(surrogateMappings))}if(hasAstral&&hasLoneSurrogates){result.push(createBMPCharacterClasses(loneHighSurrogates))}return result.join("|")};var regenerate=function(value){if(arguments.length>1){value=slice.call(arguments)}if(this instanceof regenerate){this.data=[];return value?this.add(value):this}return(new regenerate).add(value)};regenerate.version="1.0.1";var proto=regenerate.prototype;extend(proto,{add:function(value){var $this=this;if(value==null){return $this}if(value instanceof regenerate){$this.data=dataAddData($this.data,value.data);return $this}if(arguments.length>1){value=slice.call(arguments)}if(isArray(value)){forEach(value,function(item){$this.add(item)});return $this}$this.data=dataAdd($this.data,isNumber(value)?value:symbolToCodePoint(value));return $this},remove:function(value){var $this=this;if(value==null){return $this}if(value instanceof regenerate){$this.data=dataRemoveData($this.data,value.data);return $this}if(arguments.length>1){value=slice.call(arguments)}if(isArray(value)){forEach(value,function(item){$this.remove(item)});return $this}$this.data=dataRemove($this.data,isNumber(value)?value:symbolToCodePoint(value));return $this},addRange:function(start,end){var $this=this;$this.data=dataAddRange($this.data,isNumber(start)?start:symbolToCodePoint(start),isNumber(end)?end:symbolToCodePoint(end));return $this},removeRange:function(start,end){var $this=this;var startCodePoint=isNumber(start)?start:symbolToCodePoint(start);var endCodePoint=isNumber(end)?end:symbolToCodePoint(end);$this.data=dataRemoveRange($this.data,startCodePoint,endCodePoint);return $this},intersection:function(argument){var $this=this;var array=argument instanceof regenerate?dataToArray(argument.data):argument;$this.data=dataIntersection($this.data,array);return $this},contains:function(codePoint){return dataContains(this.data,isNumber(codePoint)?codePoint:symbolToCodePoint(codePoint))},clone:function(){var set=new regenerate;set.data=this.data.slice(0);return set},toString:function(){var result=createCharacterClassesFromData(this.data);return result.replace(regexNull,"\\0$1")},toRegExp:function(flags){return RegExp(this.toString(),flags||"")},valueOf:function(){return dataToArray(this.data)}});proto.toArray=proto.valueOf;if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define(function(){return regenerate})}else if(freeExports&&!freeExports.nodeType){if(freeModule){freeModule.exports=regenerate}else{freeExports.regenerate=regenerate}}else{root.regenerate=regenerate}})(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],166:[function(require,module,exports){(function(global){(function(){"use strict";var objectTypes={"function":true,object:true};var root=objectTypes[typeof window]&&window||this;var oldRoot=root;var freeExports=objectTypes[typeof exports]&&exports;var freeModule=objectTypes[typeof module]&&module&&!module.nodeType&&module;var freeGlobal=freeExports&&freeModule&&typeof global=="object"&&global;if(freeGlobal&&(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal||freeGlobal.self===freeGlobal)){root=freeGlobal}var stringFromCharCode=String.fromCharCode;var floor=Math.floor;function fromCodePoint(){var MAX_SIZE=16384;var codeUnits=[];var highSurrogate;var lowSurrogate;var index=-1;var length=arguments.length;if(!length){return""}var result="";while(++index<length){var codePoint=Number(arguments[index]);if(!isFinite(codePoint)||codePoint<0||codePoint>1114111||floor(codePoint)!=codePoint){throw RangeError("Invalid code point: "+codePoint)}if(codePoint<=65535){codeUnits.push(codePoint)}else{codePoint-=65536;highSurrogate=(codePoint>>10)+55296;lowSurrogate=codePoint%1024+56320;codeUnits.push(highSurrogate,lowSurrogate)}if(index+1==length||codeUnits.length>MAX_SIZE){result+=stringFromCharCode.apply(null,codeUnits);codeUnits.length=0}}return result}function assertType(type,expected){if(expected.indexOf("|")==-1){if(type==expected){return}throw Error("Invalid node type: "+type)}expected=assertType.hasOwnProperty(expected)?assertType[expected]:assertType[expected]=RegExp("^(?:"+expected+")$");if(expected.test(type)){return}throw Error("Invalid node type: "+type)}function generate(node){var type=node.type;if(generate.hasOwnProperty(type)&&typeof generate[type]=="function"){return generate[type](node)}throw Error("Invalid node type: "+type)}function generateAlternative(node){assertType(node.type,"alternative");var terms=node.body,length=terms?terms.length:0;if(length==1){return generateTerm(terms[0])}else{var i=-1,result="";while(++i<length){result+=generateTerm(terms[i])}return result}}function generateAnchor(node){assertType(node.type,"anchor");switch(node.kind){case"start":return"^";case"end":return"$";case"boundary":return"\\b";case"not-boundary":return"\\B";default:throw Error("Invalid assertion")}}function generateAtom(node){assertType(node.type,"anchor|characterClass|characterClassEscape|dot|group|reference|value");return generate(node)}function generateCharacterClass(node){assertType(node.type,"characterClass");var classRanges=node.body,length=classRanges?classRanges.length:0;var i=-1,result="[";if(node.negative){result+="^"}while(++i<length){result+=generateClassAtom(classRanges[i])}result+="]";return result}function generateCharacterClassEscape(node){assertType(node.type,"characterClassEscape");return"\\"+node.value}function generateCharacterClassRange(node){assertType(node.type,"characterClassRange");var min=node.min,max=node.max;if(min.type=="characterClassRange"||max.type=="characterClassRange"){throw Error("Invalid character class range")}return generateClassAtom(min)+"-"+generateClassAtom(max)}function generateClassAtom(node){assertType(node.type,"anchor|characterClassEscape|characterClassRange|dot|value");return generate(node)}function generateDisjunction(node){assertType(node.type,"disjunction");var body=node.body,length=body?body.length:0;if(length==0){throw Error("No body")}else if(length==1){return generate(body[0])}else{var i=-1,result="";while(++i<length){if(i!=0){result+="|"}result+=generate(body[i])}return result}}function generateDot(node){assertType(node.type,"dot");return"."}function generateGroup(node){assertType(node.type,"group");var result="(";switch(node.behavior){case"normal":break;case"ignore":result+="?:";break;case"lookahead":result+="?=";break;case"negativeLookahead":result+="?!";break;default:throw Error("Invalid behaviour: "+node.behaviour)}var body=node.body,length=body?body.length:0;if(length==1){result+=generate(body[0])}else{var i=-1;while(++i<length){result+=generate(body[i])}}result+=")";return result}function generateQuantifier(node){assertType(node.type,"quantifier");var quantifier="",min=node.min,max=node.max;switch(max){case undefined:case null:switch(min){case 0:quantifier="*";break;case 1:quantifier="+";break;default:quantifier="{"+min+",}";break}break;default:if(min==max){quantifier="{"+min+"}"}else if(min==0&&max==1){quantifier="?"}else{quantifier="{"+min+","+max+"}"}break}if(!node.greedy){quantifier+="?"}return generateAtom(node.body[0])+quantifier}function generateReference(node){assertType(node.type,"reference");return"\\"+node.matchIndex}function generateTerm(node){assertType(node.type,"anchor|characterClass|characterClassEscape|empty|group|quantifier|reference|value");return generate(node)}function generateValue(node){assertType(node.type,"value");var kind=node.kind,codePoint=node.codePoint;switch(kind){case"controlLetter":return"\\c"+fromCodePoint(codePoint+64);case"hexadecimalEscape":return"\\x"+("00"+codePoint.toString(16).toUpperCase()).slice(-2);case"identifier":return"\\"+fromCodePoint(codePoint);case"null":return"\\"+codePoint;case"octal":return"\\"+codePoint.toString(8);case"singleEscape":switch(codePoint){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: "+codePoint)}case"symbol":return fromCodePoint(codePoint);case"unicodeEscape":return"\\u"+("0000"+codePoint.toString(16).toUpperCase()).slice(-4);case"unicodeCodePointEscape":return"\\u{"+codePoint.toString(16).toUpperCase()+"}";default:throw Error("Unsupported node kind: "+kind)}}generate.alternative=generateAlternative;generate.anchor=generateAnchor;generate.characterClass=generateCharacterClass;generate.characterClassEscape=generateCharacterClassEscape;generate.characterClassRange=generateCharacterClassRange;generate.disjunction=generateDisjunction;generate.dot=generateDot;generate.group=generateGroup;generate.quantifier=generateQuantifier;generate.reference=generateReference;generate.value=generateValue;
if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define(function(){return{generate:generate}})}else if(freeExports&&freeModule){freeExports.generate=generate}else{root.regjsgen={generate:generate}}}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],167:[function(require,module,exports){(function(){function parse(str,flags){var hasUnicodeFlag=(flags||"").indexOf("u")!==-1;var pos=0;var closedCaptureCounter=0;function addRaw(node){node.raw=str.substring(node.range[0],node.range[1]);return node}function updateRawStart(node,start){node.range[0]=start;return addRaw(node)}function createAnchor(kind,rawLength){return addRaw({type:"anchor",kind:kind,range:[pos-rawLength,pos]})}function createValue(kind,codePoint,from,to){return addRaw({type:"value",kind:kind,codePoint:codePoint,range:[from,to]})}function createEscaped(kind,codePoint,value,fromOffset){fromOffset=fromOffset||0;return createValue(kind,codePoint,pos-(value.length+fromOffset),pos)}function createCharacter(matches){var _char=matches[0];var first=_char.charCodeAt(0);if(hasUnicodeFlag){var second;if(_char.length===1&&first>=55296&&first<=56319){second=lookahead().charCodeAt(0);if(second>=56320&&second<=57343){pos++;return createValue("symbol",(first-55296)*1024+second-56320+65536,pos-2,pos)}}}return createValue("symbol",first,pos-1,pos)}function createDisjunction(alternatives,from,to){return addRaw({type:"disjunction",body:alternatives,range:[from,to]})}function createDot(){return addRaw({type:"dot",range:[pos-1,pos]})}function createCharacterClassEscape(value){return addRaw({type:"characterClassEscape",value:value,range:[pos-2,pos]})}function createReference(matchIndex){return addRaw({type:"reference",matchIndex:parseInt(matchIndex,10),range:[pos-1-matchIndex.length,pos]})}function createGroup(behavior,disjunction,from,to){return addRaw({type:"group",behavior:behavior,body:disjunction,range:[from,to]})}function createQuantifier(min,max,from,to){if(to==null){from=pos-1;to=pos}return addRaw({type:"quantifier",min:min,max:max,greedy:true,body:null,range:[from,to]})}function createAlternative(terms,from,to){return addRaw({type:"alternative",body:terms,range:[from,to]})}function createCharacterClass(classRanges,negative,from,to){return addRaw({type:"characterClass",body:classRanges,negative:negative,range:[from,to]})}function createClassRange(min,max,from,to){if(min.codePoint>max.codePoint){throw SyntaxError("invalid range in character class")}return addRaw({type:"characterClassRange",min:min,max:max,range:[from,to]})}function flattenBody(body){if(body.type==="alternative"){return body.body}else{return[body]}}function isEmpty(obj){return obj.type==="empty"}function incr(amount){amount=amount||1;var res=str.substring(pos,pos+amount);pos+=amount||1;return res}function skip(value){if(!match(value)){throw SyntaxError("character: "+value)}}function match(value){if(str.indexOf(value,pos)===pos){return incr(value.length)}}function lookahead(){return str[pos]}function current(value){return str.indexOf(value,pos)===pos}function next(value){return str[pos+1]===value}function matchReg(regExp){var subStr=str.substring(pos);var res=subStr.match(regExp);if(res){res.range=[];res.range[0]=pos;incr(res[0].length);res.range[1]=pos}return res}function parseDisjunction(){var res=[],from=pos;res.push(parseAlternative());while(match("|")){res.push(parseAlternative())}if(res.length===1){return res[0]}return createDisjunction(res,from,pos)}function parseAlternative(){var res=[],from=pos;var term;while(term=parseTerm()){res.push(term)}if(res.length===1){return res[0]}return createAlternative(res,from,pos)}function parseTerm(){if(pos>=str.length||current("|")||current(")")){return null}var anchor=parseAnchor();if(anchor){return anchor}var atom=parseAtom();if(!atom){throw SyntaxError("Expected atom")}var quantifier=parseQuantifier()||false;if(quantifier){quantifier.body=flattenBody(atom);updateRawStart(quantifier,atom.range[0]);return quantifier}return atom}function parseGroup(matchA,typeA,matchB,typeB){var type=null,from=pos;if(match(matchA)){type=typeA}else if(match(matchB)){type=typeB}else{return false}var body=parseDisjunction();if(!body){throw SyntaxError("Expected disjunction")}skip(")");var group=createGroup(type,flattenBody(body),from,pos);if(type=="normal"){closedCaptureCounter++}return group}function parseAnchor(){var res,from=pos;if(match("^")){return createAnchor("start",1)}else if(match("$")){return createAnchor("end",1)}else if(match("\\b")){return createAnchor("boundary",2)}else if(match("\\B")){return createAnchor("not-boundary",2)}else{return parseGroup("(?=","lookahead","(?!","negativeLookahead")}}function parseQuantifier(){var res;var quantifier;var min,max;if(match("*")){quantifier=createQuantifier(0)}else if(match("+")){quantifier=createQuantifier(1)}else if(match("?")){quantifier=createQuantifier(0,1)}else if(res=matchReg(/^\{([0-9]+)\}/)){min=parseInt(res[1],10);quantifier=createQuantifier(min,min,res.range[0],res.range[1])}else if(res=matchReg(/^\{([0-9]+),\}/)){min=parseInt(res[1],10);quantifier=createQuantifier(min,undefined,res.range[0],res.range[1])}else if(res=matchReg(/^\{([0-9]+),([0-9]+)\}/)){min=parseInt(res[1],10);max=parseInt(res[2],10);if(min>max){throw SyntaxError("numbers out of order in {} quantifier")}quantifier=createQuantifier(min,max,res.range[0],res.range[1])}if(quantifier){if(match("?")){quantifier.greedy=false;quantifier.range[1]+=1}}return quantifier}function parseAtom(){var res;if(res=matchReg(/^[^^$\\.*+?(){[|]/)){return createCharacter(res)}else if(match(".")){return createDot()}else if(match("\\")){res=parseAtomEscape();if(!res){throw SyntaxError("atomEscape")}return res}else if(res=parseCharacterClass()){return res}else{return parseGroup("(?:","ignore","(","normal")}}function parseUnicodeSurrogatePairEscape(firstEscape){if(hasUnicodeFlag){var first,second;if(firstEscape.kind=="unicodeEscape"&&(first=firstEscape.codePoint)>=55296&&first<=56319&¤t("\\")&&next("u")){var prevPos=pos;pos++;var secondEscape=parseClassEscape();if(secondEscape.kind=="unicodeEscape"&&(second=secondEscape.codePoint)>=56320&&second<=57343){firstEscape.range[1]=secondEscape.range[1];firstEscape.codePoint=(first-55296)*1024+second-56320+65536;firstEscape.type="value";firstEscape.kind="unicodeCodePointEscape";addRaw(firstEscape)}else{pos=prevPos}}}return firstEscape}function parseClassEscape(){return parseAtomEscape(true)}function parseAtomEscape(insideCharacterClass){var res;res=parseDecimalEscape();if(res){return res}if(insideCharacterClass){if(match("b")){return createEscaped("singleEscape",8,"\\b")}else if(match("B")){throw SyntaxError("\\B not possible inside of CharacterClass")}}res=parseCharacterEscape();return res}function parseDecimalEscape(){var res,match;if(res=matchReg(/^(?!0)\d+/)){match=res[0];var refIdx=parseInt(res[0],10);if(refIdx<=closedCaptureCounter){return createReference(res[0])}else{incr(-res[0].length);if(res=matchReg(/^[0-7]{1,3}/)){return createEscaped("octal",parseInt(res[0],8),res[0],1)}else{res=createCharacter(matchReg(/^[89]/));return updateRawStart(res,res.range[0]-1)}}}else if(res=matchReg(/^[0-7]{1,3}/)){match=res[0];if(/^0{1,3}$/.test(match)){return createEscaped("null",0,"0",match.length+1)}else{return createEscaped("octal",parseInt(match,8),match,1)}}else if(res=matchReg(/^[dDsSwW]/)){return createCharacterClassEscape(res[0])}return false}function parseCharacterEscape(){var res;if(res=matchReg(/^[fnrtv]/)){var codePoint=0;switch(res[0]){case"t":codePoint=9;break;case"n":codePoint=10;break;case"v":codePoint=11;break;case"f":codePoint=12;break;case"r":codePoint=13;break}return createEscaped("singleEscape",codePoint,"\\"+res[0])}else if(res=matchReg(/^c([a-zA-Z])/)){return createEscaped("controlLetter",res[1].charCodeAt(0)%32,res[1],2)}else if(res=matchReg(/^x([0-9a-fA-F]{2})/)){return createEscaped("hexadecimalEscape",parseInt(res[1],16),res[1],2)}else if(res=matchReg(/^u([0-9a-fA-F]{4})/)){return parseUnicodeSurrogatePairEscape(createEscaped("unicodeEscape",parseInt(res[1],16),res[1],2))}else if(hasUnicodeFlag&&(res=matchReg(/^u\{([0-9a-fA-F]{1,})\}/))){return createEscaped("unicodeCodePointEscape",parseInt(res[1],16),res[1],4)}else{return parseIdentityEscape()}}function isIdentifierPart(ch){var NonAsciiIdentifierPart=new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԯԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠ-ࢲࣤ-ॣ०-९ॱ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఀ-ఃఅ-ఌఎ-ఐఒ-నప-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಁ-ಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲഁ-ഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟ෦-෯ෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧ᪰-᪽ᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶ᳸᳹ᴀ-᷵᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚝꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꧠ-ꧾꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︭︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]");return ch===36||ch===95||ch>=65&&ch<=90||ch>=97&&ch<=122||ch>=48&&ch<=57||ch===92||ch>=128&&NonAsciiIdentifierPart.test(String.fromCharCode(ch))}function parseIdentityEscape(){var ZWJ="";var ZWNJ="";var res;var tmp;if(!isIdentifierPart(lookahead())){tmp=incr();return createEscaped("identifier",tmp.charCodeAt(0),tmp,1)}if(match(ZWJ)){return createEscaped("identifier",8204,ZWJ)}else if(match(ZWNJ)){return createEscaped("identifier",8205,ZWNJ)}return null}function parseCharacterClass(){var res,from=pos;if(res=matchReg(/^\[\^/)){res=parseClassRanges();skip("]");return createCharacterClass(res,true,from,pos)}else if(match("[")){res=parseClassRanges();skip("]");return createCharacterClass(res,false,from,pos)}return null}function parseClassRanges(){var res;if(current("]")){return[]}else{res=parseNonemptyClassRanges();if(!res){throw SyntaxError("nonEmptyClassRanges")}return res}}function parseHelperClassRanges(atom){var from,to,res;if(current("-")&&!next("]")){skip("-");res=parseClassAtom();if(!res){throw SyntaxError("classAtom")}to=pos;var classRanges=parseClassRanges();if(!classRanges){throw SyntaxError("classRanges")}from=atom.range[0];if(classRanges.type==="empty"){return[createClassRange(atom,res,from,to)]}return[createClassRange(atom,res,from,to)].concat(classRanges)}res=parseNonemptyClassRangesNoDash();if(!res){throw SyntaxError("nonEmptyClassRangesNoDash")}return[atom].concat(res)}function parseNonemptyClassRanges(){var atom=parseClassAtom();if(!atom){throw SyntaxError("classAtom")}if(current("]")){return[atom]}return parseHelperClassRanges(atom)}function parseNonemptyClassRangesNoDash(){var res=parseClassAtom();if(!res){throw SyntaxError("classAtom")}if(current("]")){return res}return parseHelperClassRanges(res)}function parseClassAtom(){if(match("-")){return createCharacter("-")}else{return parseClassAtomNoDash()}}function parseClassAtomNoDash(){var res;if(res=matchReg(/^[^\\\]-]/)){return createCharacter(res[0])}else if(match("\\")){res=parseClassEscape();if(!res){throw SyntaxError("classEscape")}return parseUnicodeSurrogatePairEscape(res)}}str=String(str);if(str===""){str="(?:)"}var result=parseDisjunction();if(result.range[1]!==str.length){throw SyntaxError("Could not parse entire input - got stuck: "+str)}return result}var regjsparser={parse:parse};if(typeof module!=="undefined"&&module.exports){module.exports=regjsparser}else{window.regjsparser=regjsparser}})()},{}],168:[function(require,module,exports){var generate=require("regjsgen").generate;var parse=require("regjsparser").parse;var regenerate=require("regenerate");var iuMappings=require("./data/iu-mappings.json");var ESCAPE_SETS=require("./data/character-class-escape-sets.js");function getCharacterClassEscapeSet(character){if(unicode){if(ignoreCase){return ESCAPE_SETS.UNICODE_IGNORE_CASE[character]}return ESCAPE_SETS.UNICODE[character]}return ESCAPE_SETS.REGULAR[character]}var object={};var hasOwnProperty=object.hasOwnProperty;function has(object,property){return hasOwnProperty.call(object,property)}var UNICODE_SET=regenerate().addRange(0,1114111);var BMP_SET=regenerate().addRange(0,65535);var DOT_SET_UNICODE=UNICODE_SET.clone().remove(10,13,8232,8233);var DOT_SET=DOT_SET_UNICODE.clone().intersection(BMP_SET);regenerate.prototype.iuAddRange=function(min,max){var $this=this;do{var folded=caseFold(min);if(folded){$this.add(folded)}}while(++min<=max);return $this};function assign(target,source){for(var key in source){target[key]=source[key]}}function update(item,pattern){var tree=parse(pattern,"");switch(tree.type){case"characterClass":case"group":case"value":break;default:tree=wrap(tree,pattern)}assign(item,tree)}function wrap(tree,pattern){return{type:"group",behavior:"ignore",body:[tree],raw:"(?:"+pattern+")"}}function caseFold(codePoint){return has(iuMappings,codePoint)?iuMappings[codePoint]:false}var ignoreCase=false;var unicode=false;function processCharacterClass(characterClassItem){var set=regenerate();var body=characterClassItem.body.forEach(function(item){switch(item.type){case"value":set.add(item.codePoint);if(ignoreCase&&unicode){var folded=caseFold(item.codePoint);if(folded){set.add(folded)}}break;case"characterClassRange":var min=item.min.codePoint;var max=item.max.codePoint;set.addRange(min,max);if(ignoreCase&&unicode){set.iuAddRange(min,max)}break;case"characterClassEscape":set.add(getCharacterClassEscapeSet(item.value));break;default:throw Error("Unknown term type: "+item.type)}});if(characterClassItem.negative){set=(unicode?UNICODE_SET:BMP_SET).clone().remove(set)}update(characterClassItem,set.toString());return characterClassItem}function processTerm(item){switch(item.type){case"dot":update(item,(unicode?DOT_SET_UNICODE:DOT_SET).toString());break;case"characterClass":item=processCharacterClass(item);break;case"characterClassEscape":update(item,getCharacterClassEscapeSet(item.value).toString());break;case"alternative":case"disjunction":case"group":case"quantifier":item.body=item.body.map(processTerm);break;case"value":var codePoint=item.codePoint;var set=regenerate(codePoint);if(ignoreCase&&unicode){var folded=caseFold(codePoint);if(folded){set.add(folded)}}update(item,set.toString());break;case"anchor":case"empty":case"group":case"reference":break;default:throw Error("Unknown term type: "+item.type)}return item}module.exports=function(pattern,flags){var tree=parse(pattern,flags);ignoreCase=flags?flags.indexOf("i")>-1:false;unicode=flags?flags.indexOf("u")>-1:false;assign(tree,processTerm(tree));return generate(tree)}},{"./data/character-class-escape-sets.js":163,"./data/iu-mappings.json":164,regenerate:165,regjsgen:166,regjsparser:167}],169:[function(require,module,exports){exports.SourceMapGenerator=require("./source-map/source-map-generator").SourceMapGenerator;exports.SourceMapConsumer=require("./source-map/source-map-consumer").SourceMapConsumer;exports.SourceNode=require("./source-map/source-node").SourceNode},{"./source-map/source-map-consumer":174,"./source-map/source-map-generator":175,"./source-map/source-node":176}],170:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var util=require("./util");function ArraySet(){this._array=[];this._set={}}ArraySet.fromArray=function ArraySet_fromArray(aArray,aAllowDuplicates){var set=new ArraySet;for(var i=0,len=aArray.length;i<len;i++){set.add(aArray[i],aAllowDuplicates)}return set};ArraySet.prototype.add=function ArraySet_add(aStr,aAllowDuplicates){var isDuplicate=this.has(aStr);var idx=this._array.length;if(!isDuplicate||aAllowDuplicates){this._array.push(aStr)}if(!isDuplicate){this._set[util.toSetString(aStr)]=idx}};ArraySet.prototype.has=function ArraySet_has(aStr){return Object.prototype.hasOwnProperty.call(this._set,util.toSetString(aStr))};ArraySet.prototype.indexOf=function ArraySet_indexOf(aStr){if(this.has(aStr)){return this._set[util.toSetString(aStr)]}throw new Error('"'+aStr+'" is not in the set.')};ArraySet.prototype.at=function ArraySet_at(aIdx){if(aIdx>=0&&aIdx<this._array.length){return this._array[aIdx]}throw new Error("No element indexed by "+aIdx)};ArraySet.prototype.toArray=function ArraySet_toArray(){return this._array.slice()};exports.ArraySet=ArraySet})},{"./util":177,amdefine:178}],171:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var base64=require("./base64");var VLQ_BASE_SHIFT=5;var VLQ_BASE=1<<VLQ_BASE_SHIFT;var VLQ_BASE_MASK=VLQ_BASE-1;var VLQ_CONTINUATION_BIT=VLQ_BASE;function toVLQSigned(aValue){return aValue<0?(-aValue<<1)+1:(aValue<<1)+0}function fromVLQSigned(aValue){var isNegative=(aValue&1)===1;var shifted=aValue>>1;return isNegative?-shifted:shifted}exports.encode=function base64VLQ_encode(aValue){var encoded="";var digit;var vlq=toVLQSigned(aValue);do{digit=vlq&VLQ_BASE_MASK;vlq>>>=VLQ_BASE_SHIFT;if(vlq>0){digit|=VLQ_CONTINUATION_BIT}encoded+=base64.encode(digit)}while(vlq>0);return encoded};exports.decode=function base64VLQ_decode(aStr,aOutParam){var i=0;var strLen=aStr.length;var result=0;var shift=0;var continuation,digit;do{if(i>=strLen){throw new Error("Expected more digits in base 64 VLQ value.")}digit=base64.decode(aStr.charAt(i++));continuation=!!(digit&VLQ_CONTINUATION_BIT);digit&=VLQ_BASE_MASK;result=result+(digit<<shift);shift+=VLQ_BASE_SHIFT}while(continuation);aOutParam.value=fromVLQSigned(result);aOutParam.rest=aStr.slice(i)}})},{"./base64":172,amdefine:178}],172:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var charToIntMap={};var intToCharMap={};"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").forEach(function(ch,index){charToIntMap[ch]=index;intToCharMap[index]=ch});exports.encode=function base64_encode(aNumber){if(aNumber in intToCharMap){return intToCharMap[aNumber]}throw new TypeError("Must be between 0 and 63: "+aNumber)};exports.decode=function base64_decode(aChar){if(aChar in charToIntMap){return charToIntMap[aChar]}throw new TypeError("Not a valid base 64 digit: "+aChar)}})},{amdefine:178}],173:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){function recursiveSearch(aLow,aHigh,aNeedle,aHaystack,aCompare){var mid=Math.floor((aHigh-aLow)/2)+aLow;var cmp=aCompare(aNeedle,aHaystack[mid],true);if(cmp===0){return aHaystack[mid]}else if(cmp>0){if(aHigh-mid>1){return recursiveSearch(mid,aHigh,aNeedle,aHaystack,aCompare)}return aHaystack[mid]}else{if(mid-aLow>1){return recursiveSearch(aLow,mid,aNeedle,aHaystack,aCompare)}return aLow<0?null:aHaystack[aLow]}}exports.search=function search(aNeedle,aHaystack,aCompare){return aHaystack.length>0?recursiveSearch(-1,aHaystack.length,aNeedle,aHaystack,aCompare):null}})},{amdefine:178}],174:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var util=require("./util");var binarySearch=require("./binary-search");var ArraySet=require("./array-set").ArraySet;var base64VLQ=require("./base64-vlq");function SourceMapConsumer(aSourceMap){var sourceMap=aSourceMap;if(typeof aSourceMap==="string"){sourceMap=JSON.parse(aSourceMap.replace(/^\)\]\}'/,""))}var version=util.getArg(sourceMap,"version");var sources=util.getArg(sourceMap,"sources");var names=util.getArg(sourceMap,"names",[]);var sourceRoot=util.getArg(sourceMap,"sourceRoot",null);var sourcesContent=util.getArg(sourceMap,"sourcesContent",null);var mappings=util.getArg(sourceMap,"mappings");var file=util.getArg(sourceMap,"file",null);if(version!=this._version){throw new Error("Unsupported version: "+version)}this._names=ArraySet.fromArray(names,true);this._sources=ArraySet.fromArray(sources,true);this.sourceRoot=sourceRoot;this.sourcesContent=sourcesContent;this._mappings=mappings;this.file=file}SourceMapConsumer.fromSourceMap=function SourceMapConsumer_fromSourceMap(aSourceMap){var smc=Object.create(SourceMapConsumer.prototype);smc._names=ArraySet.fromArray(aSourceMap._names.toArray(),true);smc._sources=ArraySet.fromArray(aSourceMap._sources.toArray(),true);smc.sourceRoot=aSourceMap._sourceRoot;smc.sourcesContent=aSourceMap._generateSourcesContent(smc._sources.toArray(),smc.sourceRoot);smc.file=aSourceMap._file;smc.__generatedMappings=aSourceMap._mappings.slice().sort(util.compareByGeneratedPositions);smc.__originalMappings=aSourceMap._mappings.slice().sort(util.compareByOriginalPositions);return smc};SourceMapConsumer.prototype._version=3;Object.defineProperty(SourceMapConsumer.prototype,"sources",{get:function(){return this._sources.toArray().map(function(s){return this.sourceRoot!=null?util.join(this.sourceRoot,s):s},this)}});SourceMapConsumer.prototype.__generatedMappings=null;Object.defineProperty(SourceMapConsumer.prototype,"_generatedMappings",{get:function(){if(!this.__generatedMappings){this.__generatedMappings=[];this.__originalMappings=[];this._parseMappings(this._mappings,this.sourceRoot)}return this.__generatedMappings}});SourceMapConsumer.prototype.__originalMappings=null;Object.defineProperty(SourceMapConsumer.prototype,"_originalMappings",{get:function(){if(!this.__originalMappings){this.__generatedMappings=[];this.__originalMappings=[];this._parseMappings(this._mappings,this.sourceRoot)}return this.__originalMappings}});SourceMapConsumer.prototype._nextCharIsMappingSeparator=function SourceMapConsumer_nextCharIsMappingSeparator(aStr){var c=aStr.charAt(0);return c===";"||c===","};SourceMapConsumer.prototype._parseMappings=function SourceMapConsumer_parseMappings(aStr,aSourceRoot){var generatedLine=1;var previousGeneratedColumn=0;var previousOriginalLine=0;var previousOriginalColumn=0;var previousSource=0;var previousName=0;var str=aStr;var temp={};var mapping;while(str.length>0){if(str.charAt(0)===";"){generatedLine++;str=str.slice(1);previousGeneratedColumn=0}else if(str.charAt(0)===","){str=str.slice(1)}else{mapping={};mapping.generatedLine=generatedLine;base64VLQ.decode(str,temp);mapping.generatedColumn=previousGeneratedColumn+temp.value;previousGeneratedColumn=mapping.generatedColumn;str=temp.rest;if(str.length>0&&!this._nextCharIsMappingSeparator(str)){base64VLQ.decode(str,temp);mapping.source=this._sources.at(previousSource+temp.value);previousSource+=temp.value;str=temp.rest;if(str.length===0||this._nextCharIsMappingSeparator(str)){throw new Error("Found a source, but no line and column")}base64VLQ.decode(str,temp);mapping.originalLine=previousOriginalLine+temp.value;previousOriginalLine=mapping.originalLine;mapping.originalLine+=1;str=temp.rest;if(str.length===0||this._nextCharIsMappingSeparator(str)){throw new Error("Found a source and line, but no column")}base64VLQ.decode(str,temp);mapping.originalColumn=previousOriginalColumn+temp.value;previousOriginalColumn=mapping.originalColumn;str=temp.rest;if(str.length>0&&!this._nextCharIsMappingSeparator(str)){base64VLQ.decode(str,temp);mapping.name=this._names.at(previousName+temp.value);previousName+=temp.value;str=temp.rest}}this.__generatedMappings.push(mapping);if(typeof mapping.originalLine==="number"){this.__originalMappings.push(mapping)}}}this.__generatedMappings.sort(util.compareByGeneratedPositions);this.__originalMappings.sort(util.compareByOriginalPositions)};SourceMapConsumer.prototype._findMapping=function SourceMapConsumer_findMapping(aNeedle,aMappings,aLineName,aColumnName,aComparator){if(aNeedle[aLineName]<=0){throw new TypeError("Line must be greater than or equal to 1, got "+aNeedle[aLineName])}if(aNeedle[aColumnName]<0){throw new TypeError("Column must be greater than or equal to 0, got "+aNeedle[aColumnName])}return binarySearch.search(aNeedle,aMappings,aComparator)};SourceMapConsumer.prototype.originalPositionFor=function SourceMapConsumer_originalPositionFor(aArgs){var needle={generatedLine:util.getArg(aArgs,"line"),generatedColumn:util.getArg(aArgs,"column")};var mapping=this._findMapping(needle,this._generatedMappings,"generatedLine","generatedColumn",util.compareByGeneratedPositions);if(mapping&&mapping.generatedLine===needle.generatedLine){var source=util.getArg(mapping,"source",null);if(source!=null&&this.sourceRoot!=null){source=util.join(this.sourceRoot,source)}return{source:source,line:util.getArg(mapping,"originalLine",null),column:util.getArg(mapping,"originalColumn",null),name:util.getArg(mapping,"name",null)}}return{source:null,line:null,column:null,name:null}};SourceMapConsumer.prototype.sourceContentFor=function SourceMapConsumer_sourceContentFor(aSource){if(!this.sourcesContent){return null}if(this.sourceRoot!=null){aSource=util.relative(this.sourceRoot,aSource)}if(this._sources.has(aSource)){return this.sourcesContent[this._sources.indexOf(aSource)]}var url;if(this.sourceRoot!=null&&(url=util.urlParse(this.sourceRoot))){var fileUriAbsPath=aSource.replace(/^file:\/\//,"");if(url.scheme=="file"&&this._sources.has(fileUriAbsPath)){return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]}if((!url.path||url.path=="/")&&this._sources.has("/"+aSource)){return this.sourcesContent[this._sources.indexOf("/"+aSource)]}}throw new Error('"'+aSource+'" is not in the SourceMap.')};SourceMapConsumer.prototype.generatedPositionFor=function SourceMapConsumer_generatedPositionFor(aArgs){var needle={source:util.getArg(aArgs,"source"),originalLine:util.getArg(aArgs,"line"),originalColumn:util.getArg(aArgs,"column")};if(this.sourceRoot!=null){needle.source=util.relative(this.sourceRoot,needle.source)}var mapping=this._findMapping(needle,this._originalMappings,"originalLine","originalColumn",util.compareByOriginalPositions);if(mapping){return{line:util.getArg(mapping,"generatedLine",null),column:util.getArg(mapping,"generatedColumn",null)}}return{line:null,column:null}};SourceMapConsumer.GENERATED_ORDER=1;SourceMapConsumer.ORIGINAL_ORDER=2;SourceMapConsumer.prototype.eachMapping=function SourceMapConsumer_eachMapping(aCallback,aContext,aOrder){var context=aContext||null;var order=aOrder||SourceMapConsumer.GENERATED_ORDER;var mappings;switch(order){case SourceMapConsumer.GENERATED_ORDER:mappings=this._generatedMappings;break;case SourceMapConsumer.ORIGINAL_ORDER:mappings=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var sourceRoot=this.sourceRoot;mappings.map(function(mapping){var source=mapping.source;if(source!=null&&sourceRoot!=null){source=util.join(sourceRoot,source)}return{source:source,generatedLine:mapping.generatedLine,generatedColumn:mapping.generatedColumn,originalLine:mapping.originalLine,originalColumn:mapping.originalColumn,name:mapping.name}}).forEach(aCallback,context)};exports.SourceMapConsumer=SourceMapConsumer})},{"./array-set":170,"./base64-vlq":171,"./binary-search":173,"./util":177,amdefine:178}],175:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var base64VLQ=require("./base64-vlq");var util=require("./util");var ArraySet=require("./array-set").ArraySet;function SourceMapGenerator(aArgs){if(!aArgs){aArgs={}}this._file=util.getArg(aArgs,"file",null);this._sourceRoot=util.getArg(aArgs,"sourceRoot",null);this._sources=new ArraySet;this._names=new ArraySet;this._mappings=[];this._sourcesContents=null}SourceMapGenerator.prototype._version=3;SourceMapGenerator.fromSourceMap=function SourceMapGenerator_fromSourceMap(aSourceMapConsumer){var sourceRoot=aSourceMapConsumer.sourceRoot;var generator=new SourceMapGenerator({file:aSourceMapConsumer.file,sourceRoot:sourceRoot});aSourceMapConsumer.eachMapping(function(mapping){var newMapping={generated:{line:mapping.generatedLine,column:mapping.generatedColumn}};if(mapping.source!=null){newMapping.source=mapping.source;if(sourceRoot!=null){newMapping.source=util.relative(sourceRoot,newMapping.source)}newMapping.original={line:mapping.originalLine,column:mapping.originalColumn};if(mapping.name!=null){newMapping.name=mapping.name}}generator.addMapping(newMapping)});aSourceMapConsumer.sources.forEach(function(sourceFile){var content=aSourceMapConsumer.sourceContentFor(sourceFile);if(content!=null){generator.setSourceContent(sourceFile,content)}});return generator};SourceMapGenerator.prototype.addMapping=function SourceMapGenerator_addMapping(aArgs){var generated=util.getArg(aArgs,"generated");var original=util.getArg(aArgs,"original",null);var source=util.getArg(aArgs,"source",null);var name=util.getArg(aArgs,"name",null);this._validateMapping(generated,original,source,name);if(source!=null&&!this._sources.has(source)){this._sources.add(source)}if(name!=null&&!this._names.has(name)){this._names.add(name)}this._mappings.push({generatedLine:generated.line,generatedColumn:generated.column,originalLine:original!=null&&original.line,originalColumn:original!=null&&original.column,source:source,name:name})};SourceMapGenerator.prototype.setSourceContent=function SourceMapGenerator_setSourceContent(aSourceFile,aSourceContent){var source=aSourceFile;if(this._sourceRoot!=null){source=util.relative(this._sourceRoot,source)}if(aSourceContent!=null){if(!this._sourcesContents){this._sourcesContents={}}this._sourcesContents[util.toSetString(source)]=aSourceContent}else if(this._sourcesContents){delete this._sourcesContents[util.toSetString(source)];if(Object.keys(this._sourcesContents).length===0){this._sourcesContents=null}}};SourceMapGenerator.prototype.applySourceMap=function SourceMapGenerator_applySourceMap(aSourceMapConsumer,aSourceFile,aSourceMapPath){var sourceFile=aSourceFile;if(aSourceFile==null){if(aSourceMapConsumer.file==null){throw new Error("SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, "+'or the source map\'s "file" property. Both were omitted.')}sourceFile=aSourceMapConsumer.file}var sourceRoot=this._sourceRoot;if(sourceRoot!=null){sourceFile=util.relative(sourceRoot,sourceFile)}var newSources=new ArraySet;var newNames=new ArraySet;this._mappings.forEach(function(mapping){if(mapping.source===sourceFile&&mapping.originalLine!=null){var original=aSourceMapConsumer.originalPositionFor({line:mapping.originalLine,column:mapping.originalColumn});if(original.source!=null){mapping.source=original.source;if(aSourceMapPath!=null){mapping.source=util.join(aSourceMapPath,mapping.source)}if(sourceRoot!=null){mapping.source=util.relative(sourceRoot,mapping.source)}mapping.originalLine=original.line;mapping.originalColumn=original.column;if(original.name!=null){mapping.name=original.name}}}var source=mapping.source;if(source!=null&&!newSources.has(source)){newSources.add(source)}var name=mapping.name;if(name!=null&&!newNames.has(name)){newNames.add(name)}},this);this._sources=newSources;this._names=newNames;aSourceMapConsumer.sources.forEach(function(sourceFile){var content=aSourceMapConsumer.sourceContentFor(sourceFile);if(content!=null){if(aSourceMapPath!=null){sourceFile=util.join(aSourceMapPath,sourceFile)}if(sourceRoot!=null){sourceFile=util.relative(sourceRoot,sourceFile)}this.setSourceContent(sourceFile,content)}},this)};SourceMapGenerator.prototype._validateMapping=function SourceMapGenerator_validateMapping(aGenerated,aOriginal,aSource,aName){if(aGenerated&&"line"in aGenerated&&"column"in aGenerated&&aGenerated.line>0&&aGenerated.column>=0&&!aOriginal&&!aSource&&!aName){return}else if(aGenerated&&"line"in aGenerated&&"column"in aGenerated&&aOriginal&&"line"in aOriginal&&"column"in aOriginal&&aGenerated.line>0&&aGenerated.column>=0&&aOriginal.line>0&&aOriginal.column>=0&&aSource){return
}else{throw new Error("Invalid mapping: "+JSON.stringify({generated:aGenerated,source:aSource,original:aOriginal,name:aName}))}};SourceMapGenerator.prototype._serializeMappings=function SourceMapGenerator_serializeMappings(){var previousGeneratedColumn=0;var previousGeneratedLine=1;var previousOriginalColumn=0;var previousOriginalLine=0;var previousName=0;var previousSource=0;var result="";var mapping;this._mappings.sort(util.compareByGeneratedPositions);for(var i=0,len=this._mappings.length;i<len;i++){mapping=this._mappings[i];if(mapping.generatedLine!==previousGeneratedLine){previousGeneratedColumn=0;while(mapping.generatedLine!==previousGeneratedLine){result+=";";previousGeneratedLine++}}else{if(i>0){if(!util.compareByGeneratedPositions(mapping,this._mappings[i-1])){continue}result+=","}}result+=base64VLQ.encode(mapping.generatedColumn-previousGeneratedColumn);previousGeneratedColumn=mapping.generatedColumn;if(mapping.source!=null){result+=base64VLQ.encode(this._sources.indexOf(mapping.source)-previousSource);previousSource=this._sources.indexOf(mapping.source);result+=base64VLQ.encode(mapping.originalLine-1-previousOriginalLine);previousOriginalLine=mapping.originalLine-1;result+=base64VLQ.encode(mapping.originalColumn-previousOriginalColumn);previousOriginalColumn=mapping.originalColumn;if(mapping.name!=null){result+=base64VLQ.encode(this._names.indexOf(mapping.name)-previousName);previousName=this._names.indexOf(mapping.name)}}}return result};SourceMapGenerator.prototype._generateSourcesContent=function SourceMapGenerator_generateSourcesContent(aSources,aSourceRoot){return aSources.map(function(source){if(!this._sourcesContents){return null}if(aSourceRoot!=null){source=util.relative(aSourceRoot,source)}var key=util.toSetString(source);return Object.prototype.hasOwnProperty.call(this._sourcesContents,key)?this._sourcesContents[key]:null},this)};SourceMapGenerator.prototype.toJSON=function SourceMapGenerator_toJSON(){var map={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};if(this._file!=null){map.file=this._file}if(this._sourceRoot!=null){map.sourceRoot=this._sourceRoot}if(this._sourcesContents){map.sourcesContent=this._generateSourcesContent(map.sources,map.sourceRoot)}return map};SourceMapGenerator.prototype.toString=function SourceMapGenerator_toString(){return JSON.stringify(this)};exports.SourceMapGenerator=SourceMapGenerator})},{"./array-set":170,"./base64-vlq":171,"./util":177,amdefine:178}],176:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var SourceMapGenerator=require("./source-map-generator").SourceMapGenerator;var util=require("./util");var REGEX_NEWLINE=/(\r?\n)/;var REGEX_CHARACTER=/\r\n|[\s\S]/g;function SourceNode(aLine,aColumn,aSource,aChunks,aName){this.children=[];this.sourceContents={};this.line=aLine==null?null:aLine;this.column=aColumn==null?null:aColumn;this.source=aSource==null?null:aSource;this.name=aName==null?null:aName;if(aChunks!=null)this.add(aChunks)}SourceNode.fromStringWithSourceMap=function SourceNode_fromStringWithSourceMap(aGeneratedCode,aSourceMapConsumer,aRelativePath){var node=new SourceNode;var remainingLines=aGeneratedCode.split(REGEX_NEWLINE);var shiftNextLine=function(){var lineContents=remainingLines.shift();var newLine=remainingLines.shift()||"";return lineContents+newLine};var lastGeneratedLine=1,lastGeneratedColumn=0;var lastMapping=null;aSourceMapConsumer.eachMapping(function(mapping){if(lastMapping!==null){if(lastGeneratedLine<mapping.generatedLine){var code="";addMappingWithCode(lastMapping,shiftNextLine());lastGeneratedLine++;lastGeneratedColumn=0}else{var nextLine=remainingLines[0];var code=nextLine.substr(0,mapping.generatedColumn-lastGeneratedColumn);remainingLines[0]=nextLine.substr(mapping.generatedColumn-lastGeneratedColumn);lastGeneratedColumn=mapping.generatedColumn;addMappingWithCode(lastMapping,code);lastMapping=mapping;return}}while(lastGeneratedLine<mapping.generatedLine){node.add(shiftNextLine());lastGeneratedLine++}if(lastGeneratedColumn<mapping.generatedColumn){var nextLine=remainingLines[0];node.add(nextLine.substr(0,mapping.generatedColumn));remainingLines[0]=nextLine.substr(mapping.generatedColumn);lastGeneratedColumn=mapping.generatedColumn}lastMapping=mapping},this);if(remainingLines.length>0){if(lastMapping){addMappingWithCode(lastMapping,shiftNextLine())}node.add(remainingLines.join(""))}aSourceMapConsumer.sources.forEach(function(sourceFile){var content=aSourceMapConsumer.sourceContentFor(sourceFile);if(content!=null){if(aRelativePath!=null){sourceFile=util.join(aRelativePath,sourceFile)}node.setSourceContent(sourceFile,content)}});return node;function addMappingWithCode(mapping,code){if(mapping===null||mapping.source===undefined){node.add(code)}else{var source=aRelativePath?util.join(aRelativePath,mapping.source):mapping.source;node.add(new SourceNode(mapping.originalLine,mapping.originalColumn,source,code,mapping.name))}}};SourceNode.prototype.add=function SourceNode_add(aChunk){if(Array.isArray(aChunk)){aChunk.forEach(function(chunk){this.add(chunk)},this)}else if(aChunk instanceof SourceNode||typeof aChunk==="string"){if(aChunk){this.children.push(aChunk)}}else{throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+aChunk)}return this};SourceNode.prototype.prepend=function SourceNode_prepend(aChunk){if(Array.isArray(aChunk)){for(var i=aChunk.length-1;i>=0;i--){this.prepend(aChunk[i])}}else if(aChunk instanceof SourceNode||typeof aChunk==="string"){this.children.unshift(aChunk)}else{throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+aChunk)}return this};SourceNode.prototype.walk=function SourceNode_walk(aFn){var chunk;for(var i=0,len=this.children.length;i<len;i++){chunk=this.children[i];if(chunk instanceof SourceNode){chunk.walk(aFn)}else{if(chunk!==""){aFn(chunk,{source:this.source,line:this.line,column:this.column,name:this.name})}}}};SourceNode.prototype.join=function SourceNode_join(aSep){var newChildren;var i;var len=this.children.length;if(len>0){newChildren=[];for(i=0;i<len-1;i++){newChildren.push(this.children[i]);newChildren.push(aSep)}newChildren.push(this.children[i]);this.children=newChildren}return this};SourceNode.prototype.replaceRight=function SourceNode_replaceRight(aPattern,aReplacement){var lastChild=this.children[this.children.length-1];if(lastChild instanceof SourceNode){lastChild.replaceRight(aPattern,aReplacement)}else if(typeof lastChild==="string"){this.children[this.children.length-1]=lastChild.replace(aPattern,aReplacement)}else{this.children.push("".replace(aPattern,aReplacement))}return this};SourceNode.prototype.setSourceContent=function SourceNode_setSourceContent(aSourceFile,aSourceContent){this.sourceContents[util.toSetString(aSourceFile)]=aSourceContent};SourceNode.prototype.walkSourceContents=function SourceNode_walkSourceContents(aFn){for(var i=0,len=this.children.length;i<len;i++){if(this.children[i]instanceof SourceNode){this.children[i].walkSourceContents(aFn)}}var sources=Object.keys(this.sourceContents);for(var i=0,len=sources.length;i<len;i++){aFn(util.fromSetString(sources[i]),this.sourceContents[sources[i]])}};SourceNode.prototype.toString=function SourceNode_toString(){var str="";this.walk(function(chunk){str+=chunk});return str};SourceNode.prototype.toStringWithSourceMap=function SourceNode_toStringWithSourceMap(aArgs){var generated={code:"",line:1,column:0};var map=new SourceMapGenerator(aArgs);var sourceMappingActive=false;var lastOriginalSource=null;var lastOriginalLine=null;var lastOriginalColumn=null;var lastOriginalName=null;this.walk(function(chunk,original){generated.code+=chunk;if(original.source!==null&&original.line!==null&&original.column!==null){if(lastOriginalSource!==original.source||lastOriginalLine!==original.line||lastOriginalColumn!==original.column||lastOriginalName!==original.name){map.addMapping({source:original.source,original:{line:original.line,column:original.column},generated:{line:generated.line,column:generated.column},name:original.name})}lastOriginalSource=original.source;lastOriginalLine=original.line;lastOriginalColumn=original.column;lastOriginalName=original.name;sourceMappingActive=true}else if(sourceMappingActive){map.addMapping({generated:{line:generated.line,column:generated.column}});lastOriginalSource=null;sourceMappingActive=false}chunk.match(REGEX_CHARACTER).forEach(function(ch,idx,array){if(REGEX_NEWLINE.test(ch)){generated.line++;generated.column=0;if(idx+1===array.length){lastOriginalSource=null;sourceMappingActive=false}else if(sourceMappingActive){map.addMapping({source:original.source,original:{line:original.line,column:original.column},generated:{line:generated.line,column:generated.column},name:original.name})}}else{generated.column+=ch.length}})});this.walkSourceContents(function(sourceFile,sourceContent){map.setSourceContent(sourceFile,sourceContent)});return{code:generated.code,map:map}};exports.SourceNode=SourceNode})},{"./source-map-generator":175,"./util":177,amdefine:178}],177:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){function getArg(aArgs,aName,aDefaultValue){if(aName in aArgs){return aArgs[aName]}else if(arguments.length===3){return aDefaultValue}else{throw new Error('"'+aName+'" is a required argument.')}}exports.getArg=getArg;var urlRegexp=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/;var dataUrlRegexp=/^data:.+\,.+$/;function urlParse(aUrl){var match=aUrl.match(urlRegexp);if(!match){return null}return{scheme:match[1],auth:match[2],host:match[3],port:match[4],path:match[5]}}exports.urlParse=urlParse;function urlGenerate(aParsedUrl){var url="";if(aParsedUrl.scheme){url+=aParsedUrl.scheme+":"}url+="//";if(aParsedUrl.auth){url+=aParsedUrl.auth+"@"}if(aParsedUrl.host){url+=aParsedUrl.host}if(aParsedUrl.port){url+=":"+aParsedUrl.port}if(aParsedUrl.path){url+=aParsedUrl.path}return url}exports.urlGenerate=urlGenerate;function normalize(aPath){var path=aPath;var url=urlParse(aPath);if(url){if(!url.path){return aPath}path=url.path}var isAbsolute=path.charAt(0)==="/";var parts=path.split(/\/+/);for(var part,up=0,i=parts.length-1;i>=0;i--){part=parts[i];if(part==="."){parts.splice(i,1)}else if(part===".."){up++}else if(up>0){if(part===""){parts.splice(i+1,up);up=0}else{parts.splice(i,2);up--}}}path=parts.join("/");if(path===""){path=isAbsolute?"/":"."}if(url){url.path=path;return urlGenerate(url)}return path}exports.normalize=normalize;function join(aRoot,aPath){if(aRoot===""){aRoot="."}if(aPath===""){aPath="."}var aPathUrl=urlParse(aPath);var aRootUrl=urlParse(aRoot);if(aRootUrl){aRoot=aRootUrl.path||"/"}if(aPathUrl&&!aPathUrl.scheme){if(aRootUrl){aPathUrl.scheme=aRootUrl.scheme}return urlGenerate(aPathUrl)}if(aPathUrl||aPath.match(dataUrlRegexp)){return aPath}if(aRootUrl&&!aRootUrl.host&&!aRootUrl.path){aRootUrl.host=aPath;return urlGenerate(aRootUrl)}var joined=aPath.charAt(0)==="/"?aPath:normalize(aRoot.replace(/\/+$/,"")+"/"+aPath);if(aRootUrl){aRootUrl.path=joined;return urlGenerate(aRootUrl)}return joined}exports.join=join;function relative(aRoot,aPath){if(aRoot===""){aRoot="."}aRoot=aRoot.replace(/\/$/,"");var url=urlParse(aRoot);if(aPath.charAt(0)=="/"&&url&&url.path=="/"){return aPath.slice(1)}return aPath.indexOf(aRoot+"/")===0?aPath.substr(aRoot.length+1):aPath}exports.relative=relative;function toSetString(aStr){return"$"+aStr}exports.toSetString=toSetString;function fromSetString(aStr){return aStr.substr(1)}exports.fromSetString=fromSetString;function strcmp(aStr1,aStr2){var s1=aStr1||"";var s2=aStr2||"";return(s1>s2)-(s1<s2)}function compareByOriginalPositions(mappingA,mappingB,onlyCompareOriginal){var cmp;cmp=strcmp(mappingA.source,mappingB.source);if(cmp){return cmp}cmp=mappingA.originalLine-mappingB.originalLine;if(cmp){return cmp}cmp=mappingA.originalColumn-mappingB.originalColumn;if(cmp||onlyCompareOriginal){return cmp}cmp=strcmp(mappingA.name,mappingB.name);if(cmp){return cmp}cmp=mappingA.generatedLine-mappingB.generatedLine;if(cmp){return cmp}return mappingA.generatedColumn-mappingB.generatedColumn}exports.compareByOriginalPositions=compareByOriginalPositions;function compareByGeneratedPositions(mappingA,mappingB,onlyCompareGenerated){var cmp;cmp=mappingA.generatedLine-mappingB.generatedLine;if(cmp){return cmp}cmp=mappingA.generatedColumn-mappingB.generatedColumn;if(cmp||onlyCompareGenerated){return cmp}cmp=strcmp(mappingA.source,mappingB.source);if(cmp){return cmp}cmp=mappingA.originalLine-mappingB.originalLine;if(cmp){return cmp}cmp=mappingA.originalColumn-mappingB.originalColumn;if(cmp){return cmp}return strcmp(mappingA.name,mappingB.name)}exports.compareByGeneratedPositions=compareByGeneratedPositions})},{amdefine:178}],178:[function(require,module,exports){(function(process,__filename){"use strict";function amdefine(module,requireFn){"use strict";var defineCache={},loaderCache={},alreadyCalled=false,path=require("path"),makeRequire,stringRequire;function trimDots(ary){var i,part;for(i=0;ary[i];i+=1){part=ary[i];if(part==="."){ary.splice(i,1);i-=1}else if(part===".."){if(i===1&&(ary[2]===".."||ary[0]==="..")){break}else if(i>0){ary.splice(i-1,2);i-=2}}}}function normalize(name,baseName){var baseParts;if(name&&name.charAt(0)==="."){if(baseName){baseParts=baseName.split("/");baseParts=baseParts.slice(0,baseParts.length-1);baseParts=baseParts.concat(name.split("/"));trimDots(baseParts);name=baseParts.join("/")}}return name}function makeNormalize(relName){return function(name){return normalize(name,relName)}}function makeLoad(id){function load(value){loaderCache[id]=value}load.fromText=function(id,text){throw new Error("amdefine does not implement load.fromText")};return load}makeRequire=function(systemRequire,exports,module,relId){function amdRequire(deps,callback){if(typeof deps==="string"){return stringRequire(systemRequire,exports,module,deps,relId)}else{deps=deps.map(function(depName){return stringRequire(systemRequire,exports,module,depName,relId)});process.nextTick(function(){callback.apply(null,deps)})}}amdRequire.toUrl=function(filePath){if(filePath.indexOf(".")===0){return normalize(filePath,path.dirname(module.filename))}else{return filePath}};return amdRequire};requireFn=requireFn||function req(){return module.require.apply(module,arguments)};function runFactory(id,deps,factory){var r,e,m,result;if(id){e=loaderCache[id]={};m={id:id,uri:__filename,exports:e};r=makeRequire(requireFn,e,m,id)}else{if(alreadyCalled){throw new Error("amdefine with no module ID cannot be called more than once per file.")}alreadyCalled=true;e=module.exports;m=module;r=makeRequire(requireFn,e,m,module.id)}if(deps){deps=deps.map(function(depName){return r(depName)})}if(typeof factory==="function"){result=factory.apply(m.exports,deps)}else{result=factory}if(result!==undefined){m.exports=result;if(id){loaderCache[id]=m.exports}}}stringRequire=function(systemRequire,exports,module,id,relId){var index=id.indexOf("!"),originalId=id,prefix,plugin;if(index===-1){id=normalize(id,relId);if(id==="require"){return makeRequire(systemRequire,exports,module,relId)}else if(id==="exports"){return exports}else if(id==="module"){return module}else if(loaderCache.hasOwnProperty(id)){return loaderCache[id]}else if(defineCache[id]){runFactory.apply(null,defineCache[id]);return loaderCache[id]}else{if(systemRequire){return systemRequire(originalId)}else{throw new Error("No module with ID: "+id)}}}else{prefix=id.substring(0,index);id=id.substring(index+1,id.length);plugin=stringRequire(systemRequire,exports,module,prefix,relId);if(plugin.normalize){id=plugin.normalize(id,makeNormalize(relId))}else{id=normalize(id,relId)}if(loaderCache[id]){return loaderCache[id]}else{plugin.load(id,makeRequire(systemRequire,exports,module,relId),makeLoad(id),{});return loaderCache[id]}}};function define(id,deps,factory){if(Array.isArray(id)){factory=deps;deps=id;id=undefined}else if(typeof id!=="string"){factory=id;id=deps=undefined}if(deps&&!Array.isArray(deps)){factory=deps;deps=undefined}if(!deps){deps=["require","exports","module"]}if(id){defineCache[id]=[id,deps,factory]}else{runFactory(id,deps,factory)}}define.require=function(id){if(loaderCache[id]){return loaderCache[id]}if(defineCache[id]){runFactory.apply(null,defineCache[id]);return loaderCache[id]}};define.amd={};return define}module.exports=amdefine}).call(this,require("_process"),"/node_modules/source-map/node_modules/amdefine/amdefine.js")},{_process:104,path:103}],179:[function(require,module,exports){module.exports={"abstract-expression-call":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"PROPERTY"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"referenceGet"},computed:false},computed:true},arguments:[{type:"Identifier",name:"OBJECT"}]},property:{type:"Identifier",name:"call"},computed:false},arguments:[{type:"Identifier",name:"OBJECT"}]}}]},"abstract-expression-delete":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"PROPERTY"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"referenceDelete"},computed:false},computed:true},arguments:[{type:"Identifier",name:"OBJECT"}]}}]},"abstract-expression-get":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"PROPERTY"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"referenceGet"},computed:false},computed:true},arguments:[{type:"Identifier",name:"OBJECT"}]}}]},"abstract-expression-set":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"PROPERTY"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"referenceSet"},computed:false},computed:true},arguments:[{type:"Identifier",name:"OBJECT"},{type:"Identifier",name:"VALUE"}]}}]},"apply-constructor":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"Constructor"},{type:"Identifier",name:"args"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"instance"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"create"},computed:false},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"Constructor"},property:{type:"Identifier",name:"prototype"},computed:false}]}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"result"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Constructor"},property:{type:"Identifier",name:"apply"},computed:false},arguments:[{type:"Identifier",name:"instance"},{type:"Identifier",name:"args"}]}}],kind:"var"},{type:"ReturnStatement",argument:{type:"ConditionalExpression",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"Identifier",name:"result"},operator:"!=",right:{type:"Literal",value:null}},operator:"&&",right:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:true,argument:{type:"Identifier",name:"result"}},operator:"==",right:{type:"Literal",value:"object"}},operator:"||",right:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:true,argument:{type:"Identifier",name:"result"}},operator:"==",right:{type:"Literal",value:"function"}}}},consequent:{type:"Identifier",name:"result"},alternate:{type:"Identifier",name:"instance"}}}]},expression:false}}]},"array-comprehension-container":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,params:[],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"KEY"},init:{type:"ArrayExpression",elements:[]}}],kind:"var"},{type:"ReturnStatement",argument:{type:"Identifier",name:"KEY"}}]},expression:false},arguments:[]}}]},"array-comprehension-for-each":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"ARRAY"},property:{type:"Identifier",name:"forEach"},computed:false},arguments:[{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"KEY"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[]},expression:false}]}}]},"array-from":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"from"},computed:false},arguments:[{type:"Identifier",name:"VALUE"}]}}]},"array-push":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"KEY"},property:{type:"Identifier",name:"push"},computed:false},arguments:[{type:"Identifier",name:"STATEMENT"}]}}]},"async-to-generator":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"fn"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"FunctionExpression",id:null,params:[],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"gen"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"fn"},property:{type:"Identifier",name:"apply"},computed:false},arguments:[{type:"ThisExpression"},{type:"Identifier",name:"arguments"}]}}],kind:"var"},{type:"ReturnStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"Promise"},arguments:[{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"resolve"},{type:"Identifier",name:"reject"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"FunctionDeclaration",id:{type:"Identifier",name:"step"},params:[{type:"Identifier",name:"getNext"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"next"},init:null}],kind:"var"},{type:"TryStatement",block:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"next"},right:{type:"CallExpression",callee:{type:"Identifier",name:"getNext"},arguments:[]}}}]},handler:{type:"CatchClause",param:{type:"Identifier",name:"e"},guard:null,body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"reject"},arguments:[{type:"Identifier",name:"e"}]}},{type:"ReturnStatement",argument:null}]}},guardedHandlers:[],finalizer:null},{type:"IfStatement",test:{type:"MemberExpression",object:{type:"Identifier",name:"next"},property:{type:"Identifier",name:"done"},computed:false},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"resolve"},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"next"},property:{type:"Identifier",name:"value"},computed:false}]}},{type:"ReturnStatement",argument:null}]},alternate:null},{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Promise"},property:{type:"Identifier",name:"resolve"},computed:false},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"next"},property:{type:"Identifier",name:"value"},computed:false}]},property:{type:"Identifier",name:"then"},computed:false},arguments:[{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"v"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"step"},arguments:[{type:"FunctionExpression",id:null,params:[],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"gen"},property:{type:"Identifier",name:"next"},computed:false},arguments:[{type:"Identifier",name:"v"}]}}]},expression:false}]}}]},expression:false},{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"e"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"step"},arguments:[{type:"FunctionExpression",id:null,params:[],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"gen"},property:{type:"Literal",value:"throw"},computed:true},arguments:[{type:"Identifier",name:"e"}]}}]},expression:false}]}}]},expression:false}]}}]},expression:false},{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"step"},arguments:[{type:"FunctionExpression",id:null,params:[],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"gen"},property:{type:"Identifier",name:"next"},computed:false},arguments:[]}}]},expression:false}]}}]},expression:false}]}}]},expression:false}}]},expression:false}}]},call:{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"OBJECT"},property:{type:"Identifier",name:"call"},computed:false},arguments:[{type:"Identifier",name:"CONTEXT"}]}}]},"class-super-constructor-call":{type:"Program",body:[{type:"IfStatement",test:{type:"Identifier",name:"SUPER_NAME"},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"SUPER_NAME"},property:{type:"Identifier",name:"apply"},computed:false},arguments:[{type:"ThisExpression"},{type:"Identifier",name:"arguments"}]}}]},alternate:null}]},"common-export-default-assign":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"module"},property:{type:"Identifier",name:"exports"},computed:false},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"assign"},computed:false},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"exports"},property:{type:"Literal",value:"default"},computed:true},{type:"Identifier",name:"exports"}]}}}]},"corejs-iterator":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"CORE_ID"},property:{type:"Identifier",name:"$for"},computed:false},property:{type:"Identifier",name:"getIterator"},computed:false},arguments:[{type:"Identifier",name:"VALUE"}]}}]},defaults:{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"defaults"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ForInStatement",left:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"key"},init:null}],kind:"var"},right:{type:"Identifier",name:"defaults"},body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"key"},computed:true},operator:"===",right:{type:"Identifier",name:"undefined"}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"key"},computed:true},right:{type:"MemberExpression",object:{type:"Identifier",name:"defaults"},property:{type:"Identifier",name:"key"},computed:true}}}]},alternate:null}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"obj"}}]},expression:false}}]},"define-property":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"key"},{type:"Identifier",name:"value"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"},computed:false},arguments:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"key"},{type:"ObjectExpression",properties:[{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"value"},value:{type:"Identifier",name:"value"},kind:"init"},{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"enumerable"},value:{type:"Literal",value:true},kind:"init"},{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"configurable"},value:{type:"Literal",value:true},kind:"init"},{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"writable"},value:{type:"Literal",value:true},kind:"init"}]}]}}]},expression:false}}]},"exports-assign":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"exports"},property:{type:"Identifier",name:"KEY"},computed:false},right:{type:"Identifier",name:"VALUE"}}}]},"exports-default-module-override":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"exports"},right:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"module"},property:{type:"Identifier",name:"exports"},computed:false},right:{type:"Identifier",name:"VALUE"}}}}]},"exports-default-module":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"module"},property:{type:"Identifier",name:"exports"},computed:false},right:{type:"Identifier",name:"VALUE"}}}]},"exports-wildcard":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"obj"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ForInStatement",left:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:null}],kind:"var"},right:{type:"Identifier",name:"obj"},body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"exports"},property:{type:"Identifier",name:"i"},computed:true},right:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"i"},computed:true}}}]}}]},expression:false},arguments:[{type:"Identifier",name:"OBJECT"}]}}]},"for-of":{type:"Program",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"ITERATOR_KEY"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"OBJECT"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"iterator"},computed:false},computed:true},arguments:[]}},{type:"VariableDeclarator",id:{type:"Identifier",name:"STEP_KEY"},init:null}],kind:"var"},test:{type:"UnaryExpression",operator:"!",prefix:true,argument:{type:"MemberExpression",object:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"STEP_KEY"},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"ITERATOR_KEY"},property:{type:"Identifier",name:"next"},computed:false},arguments:[]}},property:{type:"Identifier",name:"done"},computed:false}},update:null,body:{type:"BlockStatement",body:[]}}]},"has-own":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"prototype"},computed:false},property:{type:"Identifier",name:"hasOwnProperty"},computed:false}}]},"if-undefined-set-to":{type:"Program",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"VARIABLE"},operator:"===",right:{type:"Identifier",name:"undefined"}},consequent:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"VARIABLE"},right:{type:"Identifier",name:"DEFAULT"}}},alternate:null}]},inherits:{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"child"},{type:"Identifier",name:"parent"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"child"},property:{type:"Identifier",name:"prototype"},computed:false},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"create"},computed:false},arguments:[{type:"LogicalExpression",left:{type:"Identifier",name:"parent"},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"parent"},property:{type:"Identifier",name:"prototype"},computed:false}},{type:"ObjectExpression",properties:[{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"constructor"},value:{type:"ObjectExpression",properties:[{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"value"},value:{type:"Identifier",name:"child"},kind:"init"},{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"enumerable"},value:{type:"Literal",value:false},kind:"init"},{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"writable"},value:{type:"Literal",value:true},kind:"init"},{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"configurable"},value:{type:"Literal",value:true},kind:"init"}]},kind:"init"}]}]}}},{type:"IfStatement",test:{type:"Identifier",name:"parent"},consequent:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"child"},property:{type:"Identifier",name:"__proto__"},computed:false},right:{type:"Identifier",name:"parent"}}},alternate:null}]},expression:false}}]},"interop-require":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"obj"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"LogicalExpression",left:{type:"Identifier",name:"obj"},operator:"&&",right:{type:"LogicalExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Literal",value:"default"},computed:true},operator:"||",right:{type:"Identifier",name:"obj"}}}}]},expression:false}}]},"let-scoping-return":{type:"Program",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:true,argument:{type:"Identifier",name:"RETURN"}},operator:"===",right:{type:"Literal",value:"object"}},consequent:{type:"ReturnStatement",argument:{type:"MemberExpression",object:{type:"Identifier",name:"RETURN"},property:{type:"Identifier",name:"v"},computed:false}},alternate:null}]},"object-define-properties":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperties"},computed:false},arguments:[{type:"Identifier",name:"OBJECT"},{type:"Identifier",name:"PROPS"}]}}]},"object-without-properties":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"keys"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"target"},init:{type:"ObjectExpression",properties:[]}}],kind:"var"},{type:"ForInStatement",left:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:null}],kind:"var"},right:{type:"Identifier",name:"obj"},body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"keys"},property:{type:"Identifier",name:"indexOf"},computed:false},arguments:[{type:"Identifier",name:"i"}]},operator:">=",right:{type:"Literal",value:0}},consequent:{type:"ContinueStatement",label:null},alternate:null},{type:"IfStatement",test:{type:"UnaryExpression",operator:"!",prefix:true,argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"prototype"},computed:false},property:{type:"Identifier",name:"hasOwnProperty"},computed:false},property:{type:"Identifier",name:"call"},computed:false},arguments:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"i"}]}},consequent:{type:"ContinueStatement",label:null},alternate:null},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"target"},property:{type:"Identifier",name:"i"},computed:true},right:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"i"},computed:true}}}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"target"}}]},expression:false}}]},"property-method-assignment-wrapper":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"FUNCTION_KEY"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"WRAPPER_KEY"},init:{type:"FunctionExpression",id:{type:"Identifier",name:"FUNCTION_ID"},params:[],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"FUNCTION_KEY"},property:{type:"Identifier",name:"apply"},computed:false},arguments:[{type:"ThisExpression"},{type:"Identifier",name:"arguments"}]}}]},expression:false}}],kind:"var"},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"WRAPPER_KEY"},property:{type:"Identifier",name:"toString"},computed:false},right:{type:"FunctionExpression",id:null,params:[],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"FUNCTION_KEY"},property:{type:"Identifier",name:"toString"},computed:false},arguments:[]}}]},expression:false}}},{type:"ReturnStatement",argument:{type:"Identifier",name:"WRAPPER_KEY"}}]},expression:false},arguments:[{type:"Identifier",name:"FUNCTION"}]}}]},"prototype-identifier":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"MemberExpression",object:{type:"Identifier",name:"CLASS_NAME"},property:{type:"Identifier",name:"prototype"},computed:false}}]},"prototype-properties":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"child"},{type:"Identifier",name:"staticProps"},{type:"Identifier",name:"instanceProps"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"Identifier",name:"staticProps"},consequent:{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperties"},computed:false},arguments:[{type:"Identifier",name:"child"},{type:"Identifier",name:"staticProps"}]}},alternate:null},{type:"IfStatement",test:{type:"Identifier",name:"instanceProps"},consequent:{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperties"},computed:false},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"child"},property:{type:"Identifier",name:"prototype"},computed:false},{type:"Identifier",name:"instanceProps"}]}},alternate:null}]},expression:false}}]},"require-assign-key":{type:"Program",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"VARIABLE_NAME"},init:{type:"MemberExpression",object:{type:"CallExpression",callee:{type:"Identifier",name:"require"},arguments:[{type:"Identifier",name:"MODULE_NAME"}]},property:{type:"Identifier",name:"KEY"},computed:false}}],kind:"var"}]},"require-assign":{type:"Program",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"VARIABLE_NAME"},init:{type:"CallExpression",callee:{type:"Identifier",name:"require"},arguments:[{type:"Identifier",name:"MODULE_NAME"}]}}],kind:"var"}]},require:{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"require"},arguments:[{type:"Identifier",name:"MODULE_NAME"}]}}]},"self-global":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"ConditionalExpression",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:true,argument:{type:"Identifier",name:"global"}},operator:"===",right:{type:"Literal",value:"undefined"}},consequent:{type:"Identifier",name:"self"},alternate:{type:"Identifier",name:"global"}}}]},slice:{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"prototype"},computed:false},property:{type:"Identifier",name:"slice"},computed:false}}]},"sliced-to-array":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"arr"},{type:"Identifier",name:"i"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"isArray"},computed:false},arguments:[{type:"Identifier",name:"arr"}]},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"arr"}}]},alternate:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_arr"},init:{type:"ArrayExpression",elements:[]}}],kind:"var"},{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_iterator"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"arr"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"iterator"},computed:false},computed:true},arguments:[]}},{type:"VariableDeclarator",id:{type:"Identifier",name:"_step"},init:null}],kind:"var"},test:{type:"UnaryExpression",operator:"!",prefix:true,argument:{type:"MemberExpression",object:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"_step"},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"_iterator"},property:{type:"Identifier",name:"next"},computed:false},arguments:[]}},property:{type:"Identifier",name:"done"},computed:false}},update:null,body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"_arr"},property:{type:"Identifier",name:"push"},computed:false},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"_step"},property:{type:"Identifier",name:"value"},computed:false}]}},{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"Identifier",name:"i"},operator:"&&",right:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"_arr"},property:{type:"Identifier",name:"length"},computed:false},operator:"===",right:{type:"Identifier",name:"i"}}},consequent:{type:"BreakStatement",label:null},alternate:null}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"_arr"}}]}}]},expression:false}}]},system:{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"System"},property:{type:"Identifier",name:"register"},computed:false},arguments:[{type:"Identifier",name:"MODULE_NAME"},{type:"Identifier",name:"MODULE_DEPENDENCIES"},{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"EXPORT_IDENTIFIER"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"ObjectExpression",properties:[{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"setters"},value:{type:"Identifier",name:"SETTERS"},kind:"init"},{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"execute"},value:{type:"Identifier",name:"EXECUTE"},kind:"init"}]}}]},expression:false}]}}]},"tagged-template-literal":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"strings"},{type:"Identifier",name:"raw"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"freeze"},computed:false},arguments:[{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperties"},computed:false},arguments:[{type:"Identifier",name:"strings"},{type:"ObjectExpression",properties:[{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"raw"},value:{type:"ObjectExpression",properties:[{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"value"},value:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"freeze"},computed:false},arguments:[{type:"Identifier",name:"raw"}]},kind:"init"}]},kind:"init"}]}]}]}}]},expression:false}}]},"to-array":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"arr"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"ConditionalExpression",test:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"isArray"},computed:false},arguments:[{type:"Identifier",name:"arr"}]},consequent:{type:"Identifier",name:"arr"},alternate:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"from"},computed:false},arguments:[{type:"Identifier",name:"arr"}]}}}]},expression:false}}]},"umd-runner-body":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"factory"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:true,argument:{type:"Identifier",name:"define"}},operator:"===",right:{type:"Literal",value:"function"}},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"define"},property:{type:"Identifier",name:"amd"},computed:false}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"define"},arguments:[{type:"Identifier",name:"AMD_ARGUMENTS"},{type:"Identifier",name:"factory"}]}}]},alternate:{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:true,argument:{type:"Identifier",name:"exports"}},operator:"!==",right:{type:"Literal",value:"undefined"}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"factory"},arguments:[{type:"Identifier",name:"exports"},{type:"Identifier",name:"COMMON_ARGUMENTS"}]}}]},alternate:null}}]},expression:false}}]}}
},{}]},{},[2])(2)});
|
examples/data-fetch/pages/preact.js
|
arunoda/next.js
|
import React from 'react'
import Link from 'next/link'
import 'isomorphic-fetch'
export default class MyPage extends React.Component {
static async getInitialProps () {
// eslint-disable-next-line no-undef
const res = await fetch('https://api.github.com/repos/developit/preact')
const json = await res.json()
return { stars: json.stargazers_count }
}
render () {
return (
<div>
<p>Preact has {this.props.stars} ⭐️</p>
<Link prefetch href='/'><a>I bet next has more stars (?)</a></Link>
</div>
)
}
}
|
ajax/libs/material-ui/4.9.2/es/FormControlLabel/FormControlLabel.js
|
cdnjs/cdnjs
|
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
import React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { refType } from '@material-ui/utils';
import { useFormControl } from '../FormControl';
import withStyles from '../styles/withStyles';
import Typography from '../Typography';
import capitalize from '../utils/capitalize';
export const styles = theme => ({
/* Styles applied to the root element. */
root: {
display: 'inline-flex',
alignItems: 'center',
cursor: 'pointer',
// For correct alignment with the text.
verticalAlign: 'middle',
WebkitTapHighlightColor: 'transparent',
marginLeft: -11,
marginRight: 16,
// used for row presentation of radio/checkbox
'&$disabled': {
cursor: 'default'
}
},
/* Styles applied to the root element if `labelPlacement="start"`. */
labelPlacementStart: {
flexDirection: 'row-reverse',
marginLeft: 16,
// used for row presentation of radio/checkbox
marginRight: -11
},
/* Styles applied to the root element if `labelPlacement="top"`. */
labelPlacementTop: {
flexDirection: 'column-reverse',
marginLeft: 16
},
/* Styles applied to the root element if `labelPlacement="bottom"`. */
labelPlacementBottom: {
flexDirection: 'column',
marginLeft: 16
},
/* Pseudo-class applied to the root element if `disabled={true}`. */
disabled: {},
/* Styles applied to the label's Typography component. */
label: {
'&$disabled': {
color: theme.palette.text.disabled
}
}
});
/**
* Drop in replacement of the `Radio`, `Switch` and `Checkbox` component.
* Use this component if you want to display an extra label.
*/
const FormControlLabel = React.forwardRef(function FormControlLabel(props, ref) {
const {
classes,
className,
control,
disabled: disabledProp,
label,
labelPlacement = 'end'
} = props,
other = _objectWithoutPropertiesLoose(props, ["checked", "classes", "className", "control", "disabled", "inputRef", "label", "labelPlacement", "name", "onChange", "value"]);
const muiFormControl = useFormControl();
let disabled = disabledProp;
if (typeof disabled === 'undefined' && typeof control.props.disabled !== 'undefined') {
disabled = control.props.disabled;
}
if (typeof disabled === 'undefined' && muiFormControl) {
disabled = muiFormControl.disabled;
}
const controlProps = {
disabled
};
['checked', 'name', 'onChange', 'value', 'inputRef'].forEach(key => {
if (typeof control.props[key] === 'undefined' && typeof props[key] !== 'undefined') {
controlProps[key] = props[key];
}
});
return React.createElement("label", _extends({
className: clsx(classes.root, className, labelPlacement !== 'end' && classes[`labelPlacement${capitalize(labelPlacement)}`], disabled && classes.disabled),
ref: ref
}, other), React.cloneElement(control, controlProps), React.createElement(Typography, {
component: "span",
className: clsx(classes.label, disabled && classes.disabled)
}, label));
});
process.env.NODE_ENV !== "production" ? FormControlLabel.propTypes = {
/**
* If `true`, the component appears selected.
*/
checked: PropTypes.bool,
/**
* Override or extend the styles applied to the component.
* See [CSS API](#css) below for more details.
*/
classes: PropTypes.object.isRequired,
/**
* @ignore
*/
className: PropTypes.string,
/**
* A control element. For instance, it can be be a `Radio`, a `Switch` or a `Checkbox`.
*/
control: PropTypes.element,
/**
* If `true`, the control will be disabled.
*/
disabled: PropTypes.bool,
/**
* Pass a ref to the `input` element.
*/
inputRef: refType,
/**
* The text to be used in an enclosing label element.
*/
label: PropTypes.node,
/**
* The position of the label.
*/
labelPlacement: PropTypes.oneOf(['end', 'start', 'top', 'bottom']),
/*
* @ignore
*/
name: PropTypes.string,
/**
* Callback fired when the state is changed.
*
* @param {object} event The event source of the callback.
* You can pull out the new checked state by accessing `event.target.checked` (boolean).
*/
onChange: PropTypes.func,
/**
* The value of the component.
*/
value: PropTypes.any
} : void 0;
export default withStyles(styles, {
name: 'MuiFormControlLabel'
})(FormControlLabel);
|
examples/src/components/GithubUsers.js
|
foxbroadcasting/react-select
|
import React from 'react';
import createClass from 'create-react-class';
import PropTypes from 'prop-types';
import Select from 'react-select';
import fetch from 'isomorphic-fetch';
const GithubUsers = createClass({
displayName: 'GithubUsers',
propTypes: {
label: PropTypes.string,
},
getInitialState () {
return {
backspaceRemoves: true,
multi: true
};
},
onChange (value) {
this.setState({
value: value,
});
},
switchToMulti () {
this.setState({
multi: true,
value: [this.state.value],
});
},
switchToSingle () {
this.setState({
multi: false,
value: this.state.value ? this.state.value[0] : null
});
},
getUsers (input) {
if (!input) {
return Promise.resolve({ options: [] });
}
return fetch(`https://api.github.com/search/users?q=${input}`)
.then((response) => response.json())
.then((json) => {
return { options: json.items };
});
},
gotoUser (value, event) {
window.open(value.html_url);
},
toggleBackspaceRemoves () {
this.setState({
backspaceRemoves: !this.state.backspaceRemoves
});
},
toggleCreatable () {
this.setState({
creatable: !this.state.creatable
});
},
render () {
const AsyncComponent = this.state.creatable
? Select.AsyncCreatable
: Select.Async;
return (
<div className="section">
<h3 className="section-heading">{this.props.label}</h3>
<AsyncComponent multi={this.state.multi} value={this.state.value} onChange={this.onChange} onValueClick={this.gotoUser} valueKey="id" labelKey="login" loadOptions={this.getUsers} backspaceRemoves={this.state.backspaceRemoves} />
<div className="checkbox-list">
<label className="checkbox">
<input type="radio" className="checkbox-control" checked={this.state.multi} onChange={this.switchToMulti}/>
<span className="checkbox-label">Multiselect</span>
</label>
<label className="checkbox">
<input type="radio" className="checkbox-control" checked={!this.state.multi} onChange={this.switchToSingle}/>
<span className="checkbox-label">Single Value</span>
</label>
</div>
<div className="checkbox-list">
<label className="checkbox">
<input type="checkbox" className="checkbox-control" checked={this.state.creatable} onChange={this.toggleCreatable} />
<span className="checkbox-label">Creatable?</span>
</label>
<label className="checkbox">
<input type="checkbox" className="checkbox-control" checked={this.state.backspaceRemoves} onChange={this.toggleBackspaceRemoves} />
<span className="checkbox-label">Backspace Removes?</span>
</label>
</div>
<div className="hint">This example uses fetch.js for showing Async options with Promises</div>
</div>
);
}
});
module.exports = GithubUsers;
|
archive/test-tape/viewTests.js
|
antonycourtney/tabli
|
'use strict'
import * as fs from 'fs'
import * as actions from '../src/js/actions'
import './testHelper'
import test from 'tape'
import React from 'react'
import ReactTestUtils from 'react-dom/test-utils'
import ViewRef from '../src/js/viewRef'
import TabManagerState from '../src/js/tabManagerState'
import TabliPopup from '../src/js/components/Popup'
import SelectablePopup from '../src/js/components/SelectablePopup'
import SearchBar from '../src/js/components/SearchBar'
import TabItem from '../src/js/components/TabItem'
import * as popperJS from 'popper.js'
import * as sinon from 'sinon'
function getWindowSnap () {
const content = fs.readFileSync('test/chromeWindowSnap.json')
const snap = JSON.parse(content)
return snap.chromeWindows
}
function initialWinStore () {
const folderId = 6666
const archiveFolderId = 7777
const baseWinStore = new TabManagerState({folderId, archiveFolderId})
const windowList = getWindowSnap()
const initWinStore = baseWinStore.syncWindowList(windowList)
return initWinStore
}
test('basic load state', (t) => {
const snap = getWindowSnap()
t.equal(snap.length, 3, 'read 3 windows from window snap')
t.end()
})
test('basic window state', (t) => {
const winStore = initialWinStore()
const openTabCount = winStore.countOpenTabs()
const openWinCount = winStore.countOpenWindows()
const savedCount = winStore.countSavedWindows()
// const summarySentence=openTabCount + " Open Tabs, " + openWinCount + " Open Windows, " + savedCount + " Saved Windows"
const summarySentence = 'Tabs: ' + openTabCount + ' Open. Windows: ' + openWinCount + ' Open, ' + savedCount + ' Saved.'
console.log(summarySentence + '\n')
t.equal(openTabCount, 14)
t.equal(openWinCount, 3)
t.equal(savedCount, 0)
t.end()
})
test('basic render test', (t) => {
window.isTesting = true
const winStore = initialWinStore()
t.notEqual(winStore, null, 'initial winStore is not null')
const component = ReactTestUtils.renderIntoDocument(
<TabliPopup storeRef={null} initialWinStore={winStore} noListener={true} />
)
t.notEqual(component, null, 'component from renderIntoDocument is not null')
t.end()
})
/*
* disabling because menu is now handled by our
* custom MenuButton, which uses Popper.js, which doesn't
* play nicely with our fake dom setup. :-(
test('basic event test', (t) => {
// Let's stub out all the stubs in actions libs:
var actionsMock = sinon.mock(actions)
actionsMock.expects('showHelp').once()
const winStore = initialWinStore()
const component = ReactTestUtils.renderIntoDocument(
<TabliPopup storeRef={null} initialWinStore={winStore} noListener={true} />
)
console.log('event test: rendered into document')
const helpButton = ReactTestUtils.findRenderedDOMComponentWithClass(component, 'help-button')
ReactTestUtils.Simulate.click(helpButton)
console.log('simulated help click')
// N.B. verify restores mocked methods:
actionsMock.verify()
console.log('event test done')
t.end()
})
*/
test('isearch test', (t) => {
// Let's stub out all the stubs in actions libs:
var actionsMock = sinon.mock(actions)
const winStore = initialWinStore()
const component = ReactTestUtils.renderIntoDocument(
<TabliPopup storeRef={null} initialWinStore={winStore} noListener={true} />
)
const baseTabItems = ReactTestUtils.scryRenderedComponentsWithType(component, TabItem)
console.log('isearch test: initial tab items found: ', baseTabItems.length)
t.equals(baseTabItems.length, 14, 'Initial tab count')
const selectablePopup = ReactTestUtils.findRenderedComponentWithType(component, SelectablePopup)
const searchInput = selectablePopup.searchInputRef
searchInput.value = 'git'
// const searchBar = ReactTestUtils.findRenderedComponentWithType(component, SearchBar)
// const searchInput = searchBar.refs.searchInput
// searchInput.value = 'git'
// const inputComponents = ReactTestUtils.scryRenderedDOMComponentsWithTag(searchBar,'input')
// console.log("inputComponents: ", inputComponents)
ReactTestUtils.Simulate.change(searchInput); // {target: { value: 'git'}})
const filteredTabItems = ReactTestUtils.scryRenderedComponentsWithType(component, TabItem)
console.log('isearch test: filtered tab items found: ', filteredTabItems.length)
t.equals(filteredTabItems.length, 8, 'filtered tab count')
actionsMock.restore()
t.end()
})
test('search and open test', (t) => {
// Let's stub out all the stubs in actions libs:
var actionsMock = sinon.mock(actions)
actionsMock.expects('activateTab').once()
const winStore = initialWinStore()
const component = ReactTestUtils.renderIntoDocument(
<TabliPopup storeRef={null} initialWinStore={winStore} noListener={true} />
)
const baseTabItems = ReactTestUtils.scryRenderedComponentsWithType(component, TabItem)
console.log('search and open test: initial tab items found: ', baseTabItems.length)
t.equals(baseTabItems.length, 14, 'Initial tab count')
const searchBar = ReactTestUtils.findRenderedComponentWithType(component, SearchBar)
const selectablePopup = ReactTestUtils.findRenderedComponentWithType(component, SelectablePopup)
const searchInput = selectablePopup.searchInputRef
searchInput.value = 'git'
console.log('About to update searchInput.value')
searchInput.value = 'git'
ReactTestUtils.Simulate.change(searchInput)
console.log('simulated input value update applied.')
const filteredTabItems = ReactTestUtils.scryRenderedComponentsWithType(component, TabItem)
console.log('search and open test: filtered tab items found: ', filteredTabItems.length)
t.equals(filteredTabItems.length, 8, 'filtered tab count')
ReactTestUtils.Simulate.keyDown(searchInput, {key: 'Enter', keyCode: 13, which: 13})
actionsMock.verify()
t.end()
})
|
packages/material-ui-icons/src/AccessibleForwardRounded.js
|
Kagami/material-ui
|
import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path fill="none" d="M0 0h24v24H0V0z" /><g><circle cx="18" cy="4.54" r="2" /><path d="M15 17h-2c0 1.65-1.35 3-3 3s-3-1.35-3-3 1.35-3 3-3v-2c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5zm3-3.5h-1.86l1.67-3.67C18.42 8.5 17.44 7 15.96 7h-5.2c-.81 0-1.54.47-1.87 1.2l-.28.76c-.21.56.11 1.17.68 1.33.49.14 1-.11 1.2-.58l.3-.71H13l-1.83 4.1c-.6 1.33.39 2.9 1.85 2.9H18v4c0 .55.45 1 1 1s1-.45 1-1v-4.5c0-1.1-.9-2-2-2z" /></g></React.Fragment>
, 'AccessibleForwardRounded');
|
app/javascript/mastodon/features/account_timeline/containers/header_container.js
|
ambition-vietnam/mastodon
|
import React from 'react';
import { connect } from 'react-redux';
import { makeGetAccount } from '../../../selectors';
import Header from '../components/header';
import {
followAccount,
unfollowAccount,
blockAccount,
unblockAccount,
unmuteAccount,
} from '../../../actions/accounts';
import { mentionCompose } from '../../../actions/compose';
import { initMuteModal } from '../../../actions/mutes';
import { initReport } from '../../../actions/reports';
import { openModal } from '../../../actions/modal';
import { blockDomain, unblockDomain } from '../../../actions/domain_blocks';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { unfollowModal } from '../../../initial_state';
const messages = defineMessages({
unfollowConfirm: { id: 'confirmations.unfollow.confirm', defaultMessage: 'Unfollow' },
blockConfirm: { id: 'confirmations.block.confirm', defaultMessage: 'Block' },
blockDomainConfirm: { id: 'confirmations.domain_block.confirm', defaultMessage: 'Hide entire domain' },
});
const makeMapStateToProps = () => {
const getAccount = makeGetAccount();
const mapStateToProps = (state, { accountId }) => ({
account: getAccount(state, accountId),
});
return mapStateToProps;
};
const mapDispatchToProps = (dispatch, { intl }) => ({
onFollow (account) {
if (account.getIn(['relationship', 'following']) || account.getIn(['relationship', 'requested'])) {
if (unfollowModal) {
dispatch(openModal('CONFIRM', {
message: <FormattedMessage id='confirmations.unfollow.message' defaultMessage='Are you sure you want to unfollow {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
confirm: intl.formatMessage(messages.unfollowConfirm),
onConfirm: () => dispatch(unfollowAccount(account.get('id'))),
}));
} else {
dispatch(unfollowAccount(account.get('id')));
}
} else {
dispatch(followAccount(account.get('id')));
}
},
onBlock (account) {
if (account.getIn(['relationship', 'blocking'])) {
dispatch(unblockAccount(account.get('id')));
} else {
dispatch(openModal('CONFIRM', {
message: <FormattedMessage id='confirmations.block.message' defaultMessage='Are you sure you want to block {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
confirm: intl.formatMessage(messages.blockConfirm),
onConfirm: () => dispatch(blockAccount(account.get('id'))),
}));
}
},
onMention (account, router) {
dispatch(mentionCompose(account, router));
},
onReblogToggle (account) {
if (account.getIn(['relationship', 'showing_reblogs'])) {
dispatch(followAccount(account.get('id'), false));
} else {
dispatch(followAccount(account.get('id'), true));
}
},
onReport (account) {
dispatch(initReport(account));
},
onMute (account) {
if (account.getIn(['relationship', 'muting'])) {
dispatch(unmuteAccount(account.get('id')));
} else {
dispatch(initMuteModal(account));
}
},
onBlockDomain (domain, accountId) {
dispatch(openModal('CONFIRM', {
message: <FormattedMessage id='confirmations.domain_block.message' defaultMessage='Are you really, really sure you want to block the entire {domain}? In most cases a few targeted blocks or mutes are sufficient and preferable.' values={{ domain: <strong>{domain}</strong> }} />,
confirm: intl.formatMessage(messages.blockDomainConfirm),
onConfirm: () => dispatch(blockDomain(domain, accountId)),
}));
},
onUnblockDomain (domain, accountId) {
dispatch(unblockDomain(domain, accountId));
},
});
export default injectIntl(connect(makeMapStateToProps, mapDispatchToProps)(Header));
|
src/svg-icons/action/highlight-off.js
|
pancho111203/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionHighlightOff = (props) => (
<SvgIcon {...props}>
<path d="M14.59 8L12 10.59 9.41 8 8 9.41 10.59 12 8 14.59 9.41 16 12 13.41 14.59 16 16 14.59 13.41 12 16 9.41 14.59 8zM12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/>
</SvgIcon>
);
ActionHighlightOff = pure(ActionHighlightOff);
ActionHighlightOff.displayName = 'ActionHighlightOff';
ActionHighlightOff.muiName = 'SvgIcon';
export default ActionHighlightOff;
|
packages/react-scripts/fixtures/kitchensink/src/features/webpack/CssInclusion.js
|
prometheusresearch/create-react-app
|
/**
* 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.
*/
import React from 'react'
import './assets/style.css'
export default () => (
<p id="feature-css-inclusion">We love useless text.</p>
)
|
ajax/libs/vis/0.7.4/vis.js
|
svenanders/cdnjs
|
/**
* vis.js
* https://github.com/almende/vis
*
* A dynamic, browser-based visualization library.
*
* @version 0.7.4
* @date 2014-04-18
*
* @license
* Copyright (C) 2011-2014 Almende B.V, http://almende.com
*
* 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(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.vis=e()}}(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);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.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){
/**
* vis.js module imports
*/
// Try to load dependencies from the global window object.
// If not available there, load via require.
var moment = (typeof window !== 'undefined') && window['moment'] || require('moment');
var Emitter = require('emitter-component');
var Hammer;
if (typeof window !== 'undefined') {
// load hammer.js only when running in a browser (where window is available)
Hammer = window['Hammer'] || require('hammerjs');
}
else {
Hammer = function () {
throw Error('hammer.js is only available in a browser, not in node.js.');
}
}
var mousetrap;
if (typeof window !== 'undefined') {
// load mousetrap.js only when running in a browser (where window is available)
mousetrap = window['mousetrap'] || require('mousetrap');
}
else {
mousetrap = function () {
throw Error('mouseTrap is only available in a browser, not in node.js.');
}
}
// Internet Explorer 8 and older does not support Array.indexOf, so we define
// it here in that case.
// http://soledadpenades.com/2007/05/17/arrayindexof-in-internet-explorer/
if(!Array.prototype.indexOf) {
Array.prototype.indexOf = function(obj){
for(var i = 0; i < this.length; i++){
if(this[i] == obj){
return i;
}
}
return -1;
};
try {
console.log("Warning: Ancient browser detected. Please update your browser");
}
catch (err) {
}
}
// Internet Explorer 8 and older does not support Array.forEach, so we define
// it here in that case.
// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach
if (!Array.prototype.forEach) {
Array.prototype.forEach = function(fn, scope) {
for(var i = 0, len = this.length; i < len; ++i) {
fn.call(scope || this, this[i], i, this);
}
}
}
// Internet Explorer 8 and older does not support Array.map, so we define it
// here in that case.
// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/map
// Production steps of ECMA-262, Edition 5, 15.4.4.19
// Reference: http://es5.github.com/#x15.4.4.19
if (!Array.prototype.map) {
Array.prototype.map = function(callback, thisArg) {
var T, A, k;
if (this == null) {
throw new TypeError(" this is null or not defined");
}
// 1. Let O be the result of calling ToObject passing the |this| value as the argument.
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;
// 4. If IsCallable(callback) is false, throw a TypeError exception.
// See: http://es5.github.com/#x9.11
if (typeof callback !== "function") {
throw new TypeError(callback + " is not a function");
}
// 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
if (thisArg) {
T = thisArg;
}
// 6. Let A be a new array created as if by the expression new Array(len) where Array is
// the standard built-in constructor with that name and len is the value of len.
A = new Array(len);
// 7. Let k be 0
k = 0;
// 8. Repeat, while k < len
while(k < len) {
var kValue, mappedValue;
// 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
if (k in O) {
// i. Let kValue be the result of calling the Get internal method of O with argument Pk.
kValue = O[ k ];
// ii. Let mappedValue be the result of calling the Call internal method of callback
// with T as the this value and argument list containing kValue, k, and O.
mappedValue = callback.call(T, kValue, k, O);
// iii. Call the DefineOwnProperty internal method of A with arguments
// Pk, Property Descriptor {Value: mappedValue, : true, Enumerable: true, Configurable: true},
// and false.
// In browsers that support Object.defineProperty, use the following:
// Object.defineProperty(A, Pk, { value: mappedValue, writable: true, enumerable: true, configurable: true });
// For best browser support, use the following:
A[ k ] = mappedValue;
}
// d. Increase k by 1.
k++;
}
// 9. return A
return A;
};
}
// Internet Explorer 8 and older does not support Array.filter, so we define it
// here in that case.
// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter
if (!Array.prototype.filter) {
Array.prototype.filter = function(fun /*, thisp */) {
"use strict";
if (this == null) {
throw new TypeError();
}
var t = Object(this);
var len = t.length >>> 0;
if (typeof fun != "function") {
throw new TypeError();
}
var res = [];
var thisp = arguments[1];
for (var i = 0; i < len; i++) {
if (i in t) {
var val = t[i]; // in case fun mutates this
if (fun.call(thisp, val, i, t))
res.push(val);
}
}
return res;
};
}
// Internet Explorer 8 and older does not support Object.keys, so we define it
// here in that case.
// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/keys
if (!Object.keys) {
Object.keys = (function () {
var hasOwnProperty = Object.prototype.hasOwnProperty,
hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),
dontEnums = [
'toString',
'toLocaleString',
'valueOf',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'constructor'
],
dontEnumsLength = dontEnums.length;
return function (obj) {
if (typeof obj !== 'object' && typeof obj !== 'function' || obj === null) {
throw new TypeError('Object.keys called on non-object');
}
var result = [];
for (var prop in obj) {
if (hasOwnProperty.call(obj, prop)) result.push(prop);
}
if (hasDontEnumBug) {
for (var i=0; i < dontEnumsLength; i++) {
if (hasOwnProperty.call(obj, dontEnums[i])) result.push(dontEnums[i]);
}
}
return result;
}
})()
}
// Internet Explorer 8 and older does not support Array.isArray,
// so we define it here in that case.
// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/isArray
if(!Array.isArray) {
Array.isArray = function (vArg) {
return Object.prototype.toString.call(vArg) === "[object Array]";
};
}
// Internet Explorer 8 and older does not support Function.bind,
// so we define it here in that case.
// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind
if (!Function.prototype.bind) {
Function.prototype.bind = function (oThis) {
if (typeof this !== "function") {
// closest thing possible to the ECMAScript 5 internal IsCallable function
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
}
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
fNOP = function () {},
fBound = function () {
return fToBind.apply(this instanceof fNOP && oThis
? this
: oThis,
aArgs.concat(Array.prototype.slice.call(arguments)));
};
fNOP.prototype = this.prototype;
fBound.prototype = new fNOP();
return fBound;
};
}
// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/create
if (!Object.create) {
Object.create = function (o) {
if (arguments.length > 1) {
throw new Error('Object.create implementation only accepts the first parameter.');
}
function F() {}
F.prototype = o;
return new F();
};
}
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind
if (!Function.prototype.bind) {
Function.prototype.bind = function (oThis) {
if (typeof this !== "function") {
// closest thing possible to the ECMAScript 5 internal IsCallable function
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
}
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
fNOP = function () {},
fBound = function () {
return fToBind.apply(this instanceof fNOP && oThis
? this
: oThis,
aArgs.concat(Array.prototype.slice.call(arguments)));
};
fNOP.prototype = this.prototype;
fBound.prototype = new fNOP();
return fBound;
};
}
/**
* utility functions
*/
var util = {};
/**
* Test whether given object is a number
* @param {*} object
* @return {Boolean} isNumber
*/
util.isNumber = function isNumber(object) {
return (object instanceof Number || typeof object == 'number');
};
/**
* Test whether given object is a string
* @param {*} object
* @return {Boolean} isString
*/
util.isString = function isString(object) {
return (object instanceof String || typeof object == 'string');
};
/**
* Test whether given object is a Date, or a String containing a Date
* @param {Date | String} object
* @return {Boolean} isDate
*/
util.isDate = function isDate(object) {
if (object instanceof Date) {
return true;
}
else if (util.isString(object)) {
// test whether this string contains a date
var match = ASPDateRegex.exec(object);
if (match) {
return true;
}
else if (!isNaN(Date.parse(object))) {
return true;
}
}
return false;
};
/**
* Test whether given object is an instance of google.visualization.DataTable
* @param {*} object
* @return {Boolean} isDataTable
*/
util.isDataTable = function isDataTable(object) {
return (typeof (google) !== 'undefined') &&
(google.visualization) &&
(google.visualization.DataTable) &&
(object instanceof google.visualization.DataTable);
};
/**
* Create a semi UUID
* source: http://stackoverflow.com/a/105074/1262753
* @return {String} uuid
*/
util.randomUUID = function randomUUID () {
var S4 = function () {
return Math.floor(
Math.random() * 0x10000 /* 65536 */
).toString(16);
};
return (
S4() + S4() + '-' +
S4() + '-' +
S4() + '-' +
S4() + '-' +
S4() + S4() + S4()
);
};
/**
* Extend object a with the properties of object b or a series of objects
* Only properties with defined values are copied
* @param {Object} a
* @param {... Object} b
* @return {Object} a
*/
util.extend = function (a, b) {
for (var i = 1, len = arguments.length; i < len; i++) {
var other = arguments[i];
for (var prop in other) {
if (other.hasOwnProperty(prop) && other[prop] !== undefined) {
a[prop] = other[prop];
}
}
}
return a;
};
/**
* Convert an object to another type
* @param {Boolean | Number | String | Date | Moment | Null | undefined} object
* @param {String | undefined} type Name of the type. Available types:
* 'Boolean', 'Number', 'String',
* 'Date', 'Moment', ISODate', 'ASPDate'.
* @return {*} object
* @throws Error
*/
util.convert = function convert(object, type) {
var match;
if (object === undefined) {
return undefined;
}
if (object === null) {
return null;
}
if (!type) {
return object;
}
if (!(typeof type === 'string') && !(type instanceof String)) {
throw new Error('Type must be a string');
}
//noinspection FallthroughInSwitchStatementJS
switch (type) {
case 'boolean':
case 'Boolean':
return Boolean(object);
case 'number':
case 'Number':
return Number(object.valueOf());
case 'string':
case 'String':
return String(object);
case 'Date':
if (util.isNumber(object)) {
return new Date(object);
}
if (object instanceof Date) {
return new Date(object.valueOf());
}
else if (moment.isMoment(object)) {
return new Date(object.valueOf());
}
if (util.isString(object)) {
match = ASPDateRegex.exec(object);
if (match) {
// object is an ASP date
return new Date(Number(match[1])); // parse number
}
else {
return moment(object).toDate(); // parse string
}
}
else {
throw new Error(
'Cannot convert object of type ' + util.getType(object) +
' to type Date');
}
case 'Moment':
if (util.isNumber(object)) {
return moment(object);
}
if (object instanceof Date) {
return moment(object.valueOf());
}
else if (moment.isMoment(object)) {
return moment(object);
}
if (util.isString(object)) {
match = ASPDateRegex.exec(object);
if (match) {
// object is an ASP date
return moment(Number(match[1])); // parse number
}
else {
return moment(object); // parse string
}
}
else {
throw new Error(
'Cannot convert object of type ' + util.getType(object) +
' to type Date');
}
case 'ISODate':
if (util.isNumber(object)) {
return new Date(object);
}
else if (object instanceof Date) {
return object.toISOString();
}
else if (moment.isMoment(object)) {
return object.toDate().toISOString();
}
else if (util.isString(object)) {
match = ASPDateRegex.exec(object);
if (match) {
// object is an ASP date
return new Date(Number(match[1])).toISOString(); // parse number
}
else {
return new Date(object).toISOString(); // parse string
}
}
else {
throw new Error(
'Cannot convert object of type ' + util.getType(object) +
' to type ISODate');
}
case 'ASPDate':
if (util.isNumber(object)) {
return '/Date(' + object + ')/';
}
else if (object instanceof Date) {
return '/Date(' + object.valueOf() + ')/';
}
else if (util.isString(object)) {
match = ASPDateRegex.exec(object);
var value;
if (match) {
// object is an ASP date
value = new Date(Number(match[1])).valueOf(); // parse number
}
else {
value = new Date(object).valueOf(); // parse string
}
return '/Date(' + value + ')/';
}
else {
throw new Error(
'Cannot convert object of type ' + util.getType(object) +
' to type ASPDate');
}
default:
throw new Error('Cannot convert object of type ' + util.getType(object) +
' to type "' + type + '"');
}
};
// parse ASP.Net Date pattern,
// for example '/Date(1198908717056)/' or '/Date(1198908717056-0700)/'
// code from http://momentjs.com/
var ASPDateRegex = /^\/?Date\((\-?\d+)/i;
/**
* Get the type of an object, for example util.getType([]) returns 'Array'
* @param {*} object
* @return {String} type
*/
util.getType = function getType(object) {
var type = typeof object;
if (type == 'object') {
if (object == null) {
return 'null';
}
if (object instanceof Boolean) {
return 'Boolean';
}
if (object instanceof Number) {
return 'Number';
}
if (object instanceof String) {
return 'String';
}
if (object instanceof Array) {
return 'Array';
}
if (object instanceof Date) {
return 'Date';
}
return 'Object';
}
else if (type == 'number') {
return 'Number';
}
else if (type == 'boolean') {
return 'Boolean';
}
else if (type == 'string') {
return 'String';
}
return type;
};
/**
* Retrieve the absolute left value of a DOM element
* @param {Element} elem A dom element, for example a div
* @return {number} left The absolute left position of this element
* in the browser page.
*/
util.getAbsoluteLeft = function getAbsoluteLeft (elem) {
var doc = document.documentElement;
var body = document.body;
var left = elem.offsetLeft;
var e = elem.offsetParent;
while (e != null && e != body && e != doc) {
left += e.offsetLeft;
left -= e.scrollLeft;
e = e.offsetParent;
}
return left;
};
/**
* Retrieve the absolute top value of a DOM element
* @param {Element} elem A dom element, for example a div
* @return {number} top The absolute top position of this element
* in the browser page.
*/
util.getAbsoluteTop = function getAbsoluteTop (elem) {
var doc = document.documentElement;
var body = document.body;
var top = elem.offsetTop;
var e = elem.offsetParent;
while (e != null && e != body && e != doc) {
top += e.offsetTop;
top -= e.scrollTop;
e = e.offsetParent;
}
return top;
};
/**
* Get the absolute, vertical mouse position from an event.
* @param {Event} event
* @return {Number} pageY
*/
util.getPageY = function getPageY (event) {
if ('pageY' in event) {
return event.pageY;
}
else {
var clientY;
if (('targetTouches' in event) && event.targetTouches.length) {
clientY = event.targetTouches[0].clientY;
}
else {
clientY = event.clientY;
}
var doc = document.documentElement;
var body = document.body;
return clientY +
( doc && doc.scrollTop || body && body.scrollTop || 0 ) -
( doc && doc.clientTop || body && body.clientTop || 0 );
}
};
/**
* Get the absolute, horizontal mouse position from an event.
* @param {Event} event
* @return {Number} pageX
*/
util.getPageX = function getPageX (event) {
if ('pageY' in event) {
return event.pageX;
}
else {
var clientX;
if (('targetTouches' in event) && event.targetTouches.length) {
clientX = event.targetTouches[0].clientX;
}
else {
clientX = event.clientX;
}
var doc = document.documentElement;
var body = document.body;
return clientX +
( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) -
( doc && doc.clientLeft || body && body.clientLeft || 0 );
}
};
/**
* add a className to the given elements style
* @param {Element} elem
* @param {String} className
*/
util.addClassName = function addClassName(elem, className) {
var classes = elem.className.split(' ');
if (classes.indexOf(className) == -1) {
classes.push(className); // add the class to the array
elem.className = classes.join(' ');
}
};
/**
* add a className to the given elements style
* @param {Element} elem
* @param {String} className
*/
util.removeClassName = function removeClassname(elem, className) {
var classes = elem.className.split(' ');
var index = classes.indexOf(className);
if (index != -1) {
classes.splice(index, 1); // remove the class from the array
elem.className = classes.join(' ');
}
};
/**
* For each method for both arrays and objects.
* In case of an array, the built-in Array.forEach() is applied.
* In case of an Object, the method loops over all properties of the object.
* @param {Object | Array} object An Object or Array
* @param {function} callback Callback method, called for each item in
* the object or array with three parameters:
* callback(value, index, object)
*/
util.forEach = function forEach (object, callback) {
var i,
len;
if (object instanceof Array) {
// array
for (i = 0, len = object.length; i < len; i++) {
callback(object[i], i, object);
}
}
else {
// object
for (i in object) {
if (object.hasOwnProperty(i)) {
callback(object[i], i, object);
}
}
}
};
/**
* Update a property in an object
* @param {Object} object
* @param {String} key
* @param {*} value
* @return {Boolean} changed
*/
util.updateProperty = function updateProp (object, key, value) {
if (object[key] !== value) {
object[key] = value;
return true;
}
else {
return false;
}
};
/**
* Add and event listener. Works for all browsers
* @param {Element} element An html element
* @param {string} action The action, for example "click",
* without the prefix "on"
* @param {function} listener The callback function to be executed
* @param {boolean} [useCapture]
*/
util.addEventListener = function addEventListener(element, action, listener, useCapture) {
if (element.addEventListener) {
if (useCapture === undefined)
useCapture = false;
if (action === "mousewheel" && navigator.userAgent.indexOf("Firefox") >= 0) {
action = "DOMMouseScroll"; // For Firefox
}
element.addEventListener(action, listener, useCapture);
} else {
element.attachEvent("on" + action, listener); // IE browsers
}
};
/**
* Remove an event listener from an element
* @param {Element} element An html dom element
* @param {string} action The name of the event, for example "mousedown"
* @param {function} listener The listener function
* @param {boolean} [useCapture]
*/
util.removeEventListener = function removeEventListener(element, action, listener, useCapture) {
if (element.removeEventListener) {
// non-IE browsers
if (useCapture === undefined)
useCapture = false;
if (action === "mousewheel" && navigator.userAgent.indexOf("Firefox") >= 0) {
action = "DOMMouseScroll"; // For Firefox
}
element.removeEventListener(action, listener, useCapture);
} else {
// IE browsers
element.detachEvent("on" + action, listener);
}
};
/**
* Get HTML element which is the target of the event
* @param {Event} event
* @return {Element} target element
*/
util.getTarget = function getTarget(event) {
// code from http://www.quirksmode.org/js/events_properties.html
if (!event) {
event = window.event;
}
var target;
if (event.target) {
target = event.target;
}
else if (event.srcElement) {
target = event.srcElement;
}
if (target.nodeType != undefined && target.nodeType == 3) {
// defeat Safari bug
target = target.parentNode;
}
return target;
};
/**
* Fake a hammer.js gesture. Event can be a ScrollEvent or MouseMoveEvent
* @param {Element} element
* @param {Event} event
*/
util.fakeGesture = function fakeGesture (element, event) {
var eventType = null;
// for hammer.js 1.0.5
var gesture = Hammer.event.collectEventData(this, eventType, event);
// for hammer.js 1.0.6
//var touches = Hammer.event.getTouchList(event, eventType);
// var gesture = Hammer.event.collectEventData(this, eventType, touches, event);
// on IE in standards mode, no touches are recognized by hammer.js,
// resulting in NaN values for center.pageX and center.pageY
if (isNaN(gesture.center.pageX)) {
gesture.center.pageX = event.pageX;
}
if (isNaN(gesture.center.pageY)) {
gesture.center.pageY = event.pageY;
}
return gesture;
};
util.option = {};
/**
* Convert a value into a boolean
* @param {Boolean | function | undefined} value
* @param {Boolean} [defaultValue]
* @returns {Boolean} bool
*/
util.option.asBoolean = function (value, defaultValue) {
if (typeof value == 'function') {
value = value();
}
if (value != null) {
return (value != false);
}
return defaultValue || null;
};
/**
* Convert a value into a number
* @param {Boolean | function | undefined} value
* @param {Number} [defaultValue]
* @returns {Number} number
*/
util.option.asNumber = function (value, defaultValue) {
if (typeof value == 'function') {
value = value();
}
if (value != null) {
return Number(value) || defaultValue || null;
}
return defaultValue || null;
};
/**
* Convert a value into a string
* @param {String | function | undefined} value
* @param {String} [defaultValue]
* @returns {String} str
*/
util.option.asString = function (value, defaultValue) {
if (typeof value == 'function') {
value = value();
}
if (value != null) {
return String(value);
}
return defaultValue || null;
};
/**
* Convert a size or location into a string with pixels or a percentage
* @param {String | Number | function | undefined} value
* @param {String} [defaultValue]
* @returns {String} size
*/
util.option.asSize = function (value, defaultValue) {
if (typeof value == 'function') {
value = value();
}
if (util.isString(value)) {
return value;
}
else if (util.isNumber(value)) {
return value + 'px';
}
else {
return defaultValue || null;
}
};
/**
* Convert a value into a DOM element
* @param {HTMLElement | function | undefined} value
* @param {HTMLElement} [defaultValue]
* @returns {HTMLElement | null} dom
*/
util.option.asElement = function (value, defaultValue) {
if (typeof value == 'function') {
value = value();
}
return value || defaultValue || null;
};
util.GiveDec = function GiveDec(Hex) {
if (Hex == "A")
Value = 10;
else if (Hex == "B")
Value = 11;
else if (Hex == "C")
Value = 12;
else if (Hex == "D")
Value = 13;
else if (Hex == "E")
Value = 14;
else if (Hex == "F")
Value = 15;
else
Value = eval(Hex)
return Value;
};
util.GiveHex = function GiveHex(Dec) {
if (Dec == 10)
Value = "A";
else if (Dec == 11)
Value = "B";
else if (Dec == 12)
Value = "C";
else if (Dec == 13)
Value = "D";
else if (Dec == 14)
Value = "E";
else if (Dec == 15)
Value = "F";
else
Value = "" + Dec;
return Value;
};
/**
* Parse a color property into an object with border, background, and
* highlight colors
* @param {Object | String} color
* @return {Object} colorObject
*/
util.parseColor = function(color) {
var c;
if (util.isString(color)) {
if (util.isValidHex(color)) {
var hsv = util.hexToHSV(color);
var lighterColorHSV = {h:hsv.h,s:hsv.s * 0.45,v:Math.min(1,hsv.v * 1.05)};
var darkerColorHSV = {h:hsv.h,s:Math.min(1,hsv.v * 1.25),v:hsv.v*0.6};
var darkerColorHex = util.HSVToHex(darkerColorHSV.h ,darkerColorHSV.h ,darkerColorHSV.v);
var lighterColorHex = util.HSVToHex(lighterColorHSV.h,lighterColorHSV.s,lighterColorHSV.v);
c = {
background: color,
border:darkerColorHex,
highlight: {
background:lighterColorHex,
border:darkerColorHex
}
};
}
else {
c = {
background:color,
border:color,
highlight: {
background:color,
border:color
}
};
}
}
else {
c = {};
c.background = color.background || 'white';
c.border = color.border || c.background;
if (util.isString(color.highlight)) {
c.highlight = {
border: color.highlight,
background: color.highlight
}
}
else {
c.highlight = {};
c.highlight.background = color.highlight && color.highlight.background || c.background;
c.highlight.border = color.highlight && color.highlight.border || c.border;
}
}
return c;
};
/**
* http://www.yellowpipe.com/yis/tools/hex-to-rgb/color-converter.php
*
* @param {String} hex
* @returns {{r: *, g: *, b: *}}
*/
util.hexToRGB = function hexToRGB(hex) {
hex = hex.replace("#","").toUpperCase();
var a = util.GiveDec(hex.substring(0, 1));
var b = util.GiveDec(hex.substring(1, 2));
var c = util.GiveDec(hex.substring(2, 3));
var d = util.GiveDec(hex.substring(3, 4));
var e = util.GiveDec(hex.substring(4, 5));
var f = util.GiveDec(hex.substring(5, 6));
var r = (a * 16) + b;
var g = (c * 16) + d;
var b = (e * 16) + f;
return {r:r,g:g,b:b};
};
util.RGBToHex = function RGBToHex(red,green,blue) {
var a = util.GiveHex(Math.floor(red / 16));
var b = util.GiveHex(red % 16);
var c = util.GiveHex(Math.floor(green / 16));
var d = util.GiveHex(green % 16);
var e = util.GiveHex(Math.floor(blue / 16));
var f = util.GiveHex(blue % 16);
var hex = a + b + c + d + e + f;
return "#" + hex;
};
/**
* http://www.javascripter.net/faq/rgb2hsv.htm
*
* @param red
* @param green
* @param blue
* @returns {*}
* @constructor
*/
util.RGBToHSV = function RGBToHSV (red,green,blue) {
red=red/255; green=green/255; blue=blue/255;
var minRGB = Math.min(red,Math.min(green,blue));
var maxRGB = Math.max(red,Math.max(green,blue));
// Black-gray-white
if (minRGB == maxRGB) {
return {h:0,s:0,v:minRGB};
}
// Colors other than black-gray-white:
var d = (red==minRGB) ? green-blue : ((blue==minRGB) ? red-green : blue-red);
var h = (red==minRGB) ? 3 : ((blue==minRGB) ? 1 : 5);
var hue = 60*(h - d/(maxRGB - minRGB))/360;
var saturation = (maxRGB - minRGB)/maxRGB;
var value = maxRGB;
return {h:hue,s:saturation,v:value};
};
/**
* https://gist.github.com/mjijackson/5311256
* @param hue
* @param saturation
* @param value
* @returns {{r: number, g: number, b: number}}
* @constructor
*/
util.HSVToRGB = function HSVToRGB(h, s, v) {
var r, g, b;
var i = Math.floor(h * 6);
var f = h * 6 - i;
var p = v * (1 - s);
var q = v * (1 - f * s);
var t = v * (1 - (1 - f) * s);
switch (i % 6) {
case 0: r = v, g = t, b = p; break;
case 1: r = q, g = v, b = p; break;
case 2: r = p, g = v, b = t; break;
case 3: r = p, g = q, b = v; break;
case 4: r = t, g = p, b = v; break;
case 5: r = v, g = p, b = q; break;
}
return {r:Math.floor(r * 255), g:Math.floor(g * 255), b:Math.floor(b * 255) };
};
util.HSVToHex = function HSVToHex(h, s, v) {
var rgb = util.HSVToRGB(h, s, v);
return util.RGBToHex(rgb.r, rgb.g, rgb.b);
};
util.hexToHSV = function hexToHSV(hex) {
var rgb = util.hexToRGB(hex);
return util.RGBToHSV(rgb.r, rgb.g, rgb.b);
};
util.isValidHex = function isValidHex(hex) {
var isOk = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(hex);
return isOk;
};
util.copyObject = function copyObject(objectFrom, objectTo) {
for (var i in objectFrom) {
if (objectFrom.hasOwnProperty(i)) {
if (typeof objectFrom[i] == "object") {
objectTo[i] = {};
util.copyObject(objectFrom[i], objectTo[i]);
}
else {
objectTo[i] = objectFrom[i];
}
}
}
};
/**
* DataSet
*
* Usage:
* var dataSet = new DataSet({
* fieldId: '_id',
* convert: {
* // ...
* }
* });
*
* dataSet.add(item);
* dataSet.add(data);
* dataSet.update(item);
* dataSet.update(data);
* dataSet.remove(id);
* dataSet.remove(ids);
* var data = dataSet.get();
* var data = dataSet.get(id);
* var data = dataSet.get(ids);
* var data = dataSet.get(ids, options, data);
* dataSet.clear();
*
* A data set can:
* - add/remove/update data
* - gives triggers upon changes in the data
* - can import/export data in various data formats
*
* @param {Object} [options] Available options:
* {String} fieldId Field name of the id in the
* items, 'id' by default.
* {Object.<String, String} convert
* A map with field names as key,
* and the field type as value.
* @constructor DataSet
*/
// TODO: add a DataSet constructor DataSet(data, options)
function DataSet (options) {
this.id = util.randomUUID();
this.options = options || {};
this.data = {}; // map with data indexed by id
this.fieldId = this.options.fieldId || 'id'; // name of the field containing id
this.convert = {}; // field types by field name
this.showInternalIds = this.options.showInternalIds || false; // show internal ids with the get function
if (this.options.convert) {
for (var field in this.options.convert) {
if (this.options.convert.hasOwnProperty(field)) {
var value = this.options.convert[field];
if (value == 'Date' || value == 'ISODate' || value == 'ASPDate') {
this.convert[field] = 'Date';
}
else {
this.convert[field] = value;
}
}
}
}
// event subscribers
this.subscribers = {};
this.internalIds = {}; // internally generated id's
}
/**
* Subscribe to an event, add an event listener
* @param {String} event Event name. Available events: 'put', 'update',
* 'remove'
* @param {function} callback Callback method. Called with three parameters:
* {String} event
* {Object | null} params
* {String | Number} senderId
*/
DataSet.prototype.on = function on (event, callback) {
var subscribers = this.subscribers[event];
if (!subscribers) {
subscribers = [];
this.subscribers[event] = subscribers;
}
subscribers.push({
callback: callback
});
};
// TODO: make this function deprecated (replaced with `on` since version 0.5)
DataSet.prototype.subscribe = DataSet.prototype.on;
/**
* Unsubscribe from an event, remove an event listener
* @param {String} event
* @param {function} callback
*/
DataSet.prototype.off = function off(event, callback) {
var subscribers = this.subscribers[event];
if (subscribers) {
this.subscribers[event] = subscribers.filter(function (listener) {
return (listener.callback != callback);
});
}
};
// TODO: make this function deprecated (replaced with `on` since version 0.5)
DataSet.prototype.unsubscribe = DataSet.prototype.off;
/**
* Trigger an event
* @param {String} event
* @param {Object | null} params
* @param {String} [senderId] Optional id of the sender.
* @private
*/
DataSet.prototype._trigger = function (event, params, senderId) {
if (event == '*') {
throw new Error('Cannot trigger event *');
}
var subscribers = [];
if (event in this.subscribers) {
subscribers = subscribers.concat(this.subscribers[event]);
}
if ('*' in this.subscribers) {
subscribers = subscribers.concat(this.subscribers['*']);
}
for (var i = 0; i < subscribers.length; i++) {
var subscriber = subscribers[i];
if (subscriber.callback) {
subscriber.callback(event, params, senderId || null);
}
}
};
/**
* Add data.
* Adding an item will fail when there already is an item with the same id.
* @param {Object | Array | DataTable} data
* @param {String} [senderId] Optional sender id
* @return {Array} addedIds Array with the ids of the added items
*/
DataSet.prototype.add = function (data, senderId) {
var addedIds = [],
id,
me = this;
if (data instanceof Array) {
// Array
for (var i = 0, len = data.length; i < len; i++) {
id = me._addItem(data[i]);
addedIds.push(id);
}
}
else if (util.isDataTable(data)) {
// Google DataTable
var columns = this._getColumnNames(data);
for (var row = 0, rows = data.getNumberOfRows(); row < rows; row++) {
var item = {};
for (var col = 0, cols = columns.length; col < cols; col++) {
var field = columns[col];
item[field] = data.getValue(row, col);
}
id = me._addItem(item);
addedIds.push(id);
}
}
else if (data instanceof Object) {
// Single item
id = me._addItem(data);
addedIds.push(id);
}
else {
throw new Error('Unknown dataType');
}
if (addedIds.length) {
this._trigger('add', {items: addedIds}, senderId);
}
return addedIds;
};
/**
* Update existing items. When an item does not exist, it will be created
* @param {Object | Array | DataTable} data
* @param {String} [senderId] Optional sender id
* @return {Array} updatedIds The ids of the added or updated items
*/
DataSet.prototype.update = function (data, senderId) {
var addedIds = [],
updatedIds = [],
me = this,
fieldId = me.fieldId;
var addOrUpdate = function (item) {
var id = item[fieldId];
if (me.data[id]) {
// update item
id = me._updateItem(item);
updatedIds.push(id);
}
else {
// add new item
id = me._addItem(item);
addedIds.push(id);
}
};
if (data instanceof Array) {
// Array
for (var i = 0, len = data.length; i < len; i++) {
addOrUpdate(data[i]);
}
}
else if (util.isDataTable(data)) {
// Google DataTable
var columns = this._getColumnNames(data);
for (var row = 0, rows = data.getNumberOfRows(); row < rows; row++) {
var item = {};
for (var col = 0, cols = columns.length; col < cols; col++) {
var field = columns[col];
item[field] = data.getValue(row, col);
}
addOrUpdate(item);
}
}
else if (data instanceof Object) {
// Single item
addOrUpdate(data);
}
else {
throw new Error('Unknown dataType');
}
if (addedIds.length) {
this._trigger('add', {items: addedIds}, senderId);
}
if (updatedIds.length) {
this._trigger('update', {items: updatedIds}, senderId);
}
return addedIds.concat(updatedIds);
};
/**
* Get a data item or multiple items.
*
* Usage:
*
* get()
* get(options: Object)
* get(options: Object, data: Array | DataTable)
*
* get(id: Number | String)
* get(id: Number | String, options: Object)
* get(id: Number | String, options: Object, data: Array | DataTable)
*
* get(ids: Number[] | String[])
* get(ids: Number[] | String[], options: Object)
* get(ids: Number[] | String[], options: Object, data: Array | DataTable)
*
* Where:
*
* {Number | String} id The id of an item
* {Number[] | String{}} ids An array with ids of items
* {Object} options An Object with options. Available options:
* {String} [type] Type of data to be returned. Can
* be 'DataTable' or 'Array' (default)
* {Object.<String, String>} [convert]
* {String[]} [fields] field names to be returned
* {function} [filter] filter items
* {String | function} [order] Order the items by
* a field name or custom sort function.
* {Array | DataTable} [data] If provided, items will be appended to this
* array or table. Required in case of Google
* DataTable.
*
* @throws Error
*/
DataSet.prototype.get = function (args) {
var me = this;
var globalShowInternalIds = this.showInternalIds;
// parse the arguments
var id, ids, options, data;
var firstType = util.getType(arguments[0]);
if (firstType == 'String' || firstType == 'Number') {
// get(id [, options] [, data])
id = arguments[0];
options = arguments[1];
data = arguments[2];
}
else if (firstType == 'Array') {
// get(ids [, options] [, data])
ids = arguments[0];
options = arguments[1];
data = arguments[2];
}
else {
// get([, options] [, data])
options = arguments[0];
data = arguments[1];
}
// determine the return type
var type;
if (options && options.type) {
type = (options.type == 'DataTable') ? 'DataTable' : 'Array';
if (data && (type != util.getType(data))) {
throw new Error('Type of parameter "data" (' + util.getType(data) + ') ' +
'does not correspond with specified options.type (' + options.type + ')');
}
if (type == 'DataTable' && !util.isDataTable(data)) {
throw new Error('Parameter "data" must be a DataTable ' +
'when options.type is "DataTable"');
}
}
else if (data) {
type = (util.getType(data) == 'DataTable') ? 'DataTable' : 'Array';
}
else {
type = 'Array';
}
// we allow the setting of this value for a single get request.
if (options != undefined) {
if (options.showInternalIds != undefined) {
this.showInternalIds = options.showInternalIds;
}
}
// build options
var convert = options && options.convert || this.options.convert;
var filter = options && options.filter;
var items = [], item, itemId, i, len;
// convert items
if (id != undefined) {
// return a single item
item = me._getItem(id, convert);
if (filter && !filter(item)) {
item = null;
}
}
else if (ids != undefined) {
// return a subset of items
for (i = 0, len = ids.length; i < len; i++) {
item = me._getItem(ids[i], convert);
if (!filter || filter(item)) {
items.push(item);
}
}
}
else {
// return all items
for (itemId in this.data) {
if (this.data.hasOwnProperty(itemId)) {
item = me._getItem(itemId, convert);
if (!filter || filter(item)) {
items.push(item);
}
}
}
}
// restore the global value of showInternalIds
this.showInternalIds = globalShowInternalIds;
// order the results
if (options && options.order && id == undefined) {
this._sort(items, options.order);
}
// filter fields of the items
if (options && options.fields) {
var fields = options.fields;
if (id != undefined) {
item = this._filterFields(item, fields);
}
else {
for (i = 0, len = items.length; i < len; i++) {
items[i] = this._filterFields(items[i], fields);
}
}
}
// return the results
if (type == 'DataTable') {
var columns = this._getColumnNames(data);
if (id != undefined) {
// append a single item to the data table
me._appendRow(data, columns, item);
}
else {
// copy the items to the provided data table
for (i = 0, len = items.length; i < len; i++) {
me._appendRow(data, columns, items[i]);
}
}
return data;
}
else {
// return an array
if (id != undefined) {
// a single item
return item;
}
else {
// multiple items
if (data) {
// copy the items to the provided array
for (i = 0, len = items.length; i < len; i++) {
data.push(items[i]);
}
return data;
}
else {
// just return our array
return items;
}
}
}
};
/**
* Get ids of all items or from a filtered set of items.
* @param {Object} [options] An Object with options. Available options:
* {function} [filter] filter items
* {String | function} [order] Order the items by
* a field name or custom sort function.
* @return {Array} ids
*/
DataSet.prototype.getIds = function (options) {
var data = this.data,
filter = options && options.filter,
order = options && options.order,
convert = options && options.convert || this.options.convert,
i,
len,
id,
item,
items,
ids = [];
if (filter) {
// get filtered items
if (order) {
// create ordered list
items = [];
for (id in data) {
if (data.hasOwnProperty(id)) {
item = this._getItem(id, convert);
if (filter(item)) {
items.push(item);
}
}
}
this._sort(items, order);
for (i = 0, len = items.length; i < len; i++) {
ids[i] = items[i][this.fieldId];
}
}
else {
// create unordered list
for (id in data) {
if (data.hasOwnProperty(id)) {
item = this._getItem(id, convert);
if (filter(item)) {
ids.push(item[this.fieldId]);
}
}
}
}
}
else {
// get all items
if (order) {
// create an ordered list
items = [];
for (id in data) {
if (data.hasOwnProperty(id)) {
items.push(data[id]);
}
}
this._sort(items, order);
for (i = 0, len = items.length; i < len; i++) {
ids[i] = items[i][this.fieldId];
}
}
else {
// create unordered list
for (id in data) {
if (data.hasOwnProperty(id)) {
item = data[id];
ids.push(item[this.fieldId]);
}
}
}
}
return ids;
};
/**
* Execute a callback function for every item in the dataset.
* The order of the items is not determined.
* @param {function} callback
* @param {Object} [options] Available options:
* {Object.<String, String>} [convert]
* {String[]} [fields] filter fields
* {function} [filter] filter items
* {String | function} [order] Order the items by
* a field name or custom sort function.
*/
DataSet.prototype.forEach = function (callback, options) {
var filter = options && options.filter,
convert = options && options.convert || this.options.convert,
data = this.data,
item,
id;
if (options && options.order) {
// execute forEach on ordered list
var items = this.get(options);
for (var i = 0, len = items.length; i < len; i++) {
item = items[i];
id = item[this.fieldId];
callback(item, id);
}
}
else {
// unordered
for (id in data) {
if (data.hasOwnProperty(id)) {
item = this._getItem(id, convert);
if (!filter || filter(item)) {
callback(item, id);
}
}
}
}
};
/**
* Map every item in the dataset.
* @param {function} callback
* @param {Object} [options] Available options:
* {Object.<String, String>} [convert]
* {String[]} [fields] filter fields
* {function} [filter] filter items
* {String | function} [order] Order the items by
* a field name or custom sort function.
* @return {Object[]} mappedItems
*/
DataSet.prototype.map = function (callback, options) {
var filter = options && options.filter,
convert = options && options.convert || this.options.convert,
mappedItems = [],
data = this.data,
item;
// convert and filter items
for (var id in data) {
if (data.hasOwnProperty(id)) {
item = this._getItem(id, convert);
if (!filter || filter(item)) {
mappedItems.push(callback(item, id));
}
}
}
// order items
if (options && options.order) {
this._sort(mappedItems, options.order);
}
return mappedItems;
};
/**
* Filter the fields of an item
* @param {Object} item
* @param {String[]} fields Field names
* @return {Object} filteredItem
* @private
*/
DataSet.prototype._filterFields = function (item, fields) {
var filteredItem = {};
for (var field in item) {
if (item.hasOwnProperty(field) && (fields.indexOf(field) != -1)) {
filteredItem[field] = item[field];
}
}
return filteredItem;
};
/**
* Sort the provided array with items
* @param {Object[]} items
* @param {String | function} order A field name or custom sort function.
* @private
*/
DataSet.prototype._sort = function (items, order) {
if (util.isString(order)) {
// order by provided field name
var name = order; // field name
items.sort(function (a, b) {
var av = a[name];
var bv = b[name];
return (av > bv) ? 1 : ((av < bv) ? -1 : 0);
});
}
else if (typeof order === 'function') {
// order by sort function
items.sort(order);
}
// TODO: extend order by an Object {field:String, direction:String}
// where direction can be 'asc' or 'desc'
else {
throw new TypeError('Order must be a function or a string');
}
};
/**
* Remove an object by pointer or by id
* @param {String | Number | Object | Array} id Object or id, or an array with
* objects or ids to be removed
* @param {String} [senderId] Optional sender id
* @return {Array} removedIds
*/
DataSet.prototype.remove = function (id, senderId) {
var removedIds = [],
i, len, removedId;
if (id instanceof Array) {
for (i = 0, len = id.length; i < len; i++) {
removedId = this._remove(id[i]);
if (removedId != null) {
removedIds.push(removedId);
}
}
}
else {
removedId = this._remove(id);
if (removedId != null) {
removedIds.push(removedId);
}
}
if (removedIds.length) {
this._trigger('remove', {items: removedIds}, senderId);
}
return removedIds;
};
/**
* Remove an item by its id
* @param {Number | String | Object} id id or item
* @returns {Number | String | null} id
* @private
*/
DataSet.prototype._remove = function (id) {
if (util.isNumber(id) || util.isString(id)) {
if (this.data[id]) {
delete this.data[id];
delete this.internalIds[id];
return id;
}
}
else if (id instanceof Object) {
var itemId = id[this.fieldId];
if (itemId && this.data[itemId]) {
delete this.data[itemId];
delete this.internalIds[itemId];
return itemId;
}
}
return null;
};
/**
* Clear the data
* @param {String} [senderId] Optional sender id
* @return {Array} removedIds The ids of all removed items
*/
DataSet.prototype.clear = function (senderId) {
var ids = Object.keys(this.data);
this.data = {};
this.internalIds = {};
this._trigger('remove', {items: ids}, senderId);
return ids;
};
/**
* Find the item with maximum value of a specified field
* @param {String} field
* @return {Object | null} item Item containing max value, or null if no items
*/
DataSet.prototype.max = function (field) {
var data = this.data,
max = null,
maxField = null;
for (var id in data) {
if (data.hasOwnProperty(id)) {
var item = data[id];
var itemField = item[field];
if (itemField != null && (!max || itemField > maxField)) {
max = item;
maxField = itemField;
}
}
}
return max;
};
/**
* Find the item with minimum value of a specified field
* @param {String} field
* @return {Object | null} item Item containing max value, or null if no items
*/
DataSet.prototype.min = function (field) {
var data = this.data,
min = null,
minField = null;
for (var id in data) {
if (data.hasOwnProperty(id)) {
var item = data[id];
var itemField = item[field];
if (itemField != null && (!min || itemField < minField)) {
min = item;
minField = itemField;
}
}
}
return min;
};
/**
* Find all distinct values of a specified field
* @param {String} field
* @return {Array} values Array containing all distinct values. If the data
* items do not contain the specified field, an array
* containing a single value undefined is returned.
* The returned array is unordered.
*/
DataSet.prototype.distinct = function (field) {
var data = this.data,
values = [],
fieldType = this.options.convert[field],
count = 0;
for (var prop in data) {
if (data.hasOwnProperty(prop)) {
var item = data[prop];
var value = util.convert(item[field], fieldType);
var exists = false;
for (var i = 0; i < count; i++) {
if (values[i] == value) {
exists = true;
break;
}
}
if (!exists) {
values[count] = value;
count++;
}
}
}
return values;
};
/**
* Add a single item. Will fail when an item with the same id already exists.
* @param {Object} item
* @return {String} id
* @private
*/
DataSet.prototype._addItem = function (item) {
var id = item[this.fieldId];
if (id != undefined) {
// check whether this id is already taken
if (this.data[id]) {
// item already exists
throw new Error('Cannot add item: item with id ' + id + ' already exists');
}
}
else {
// generate an id
id = util.randomUUID();
item[this.fieldId] = id;
this.internalIds[id] = item;
}
var d = {};
for (var field in item) {
if (item.hasOwnProperty(field)) {
var fieldType = this.convert[field]; // type may be undefined
d[field] = util.convert(item[field], fieldType);
}
}
this.data[id] = d;
return id;
};
/**
* Get an item. Fields can be converted to a specific type
* @param {String} id
* @param {Object.<String, String>} [convert] field types to convert
* @return {Object | null} item
* @private
*/
DataSet.prototype._getItem = function (id, convert) {
var field, value;
// get the item from the dataset
var raw = this.data[id];
if (!raw) {
return null;
}
// convert the items field types
var converted = {},
fieldId = this.fieldId,
internalIds = this.internalIds;
if (convert) {
for (field in raw) {
if (raw.hasOwnProperty(field)) {
value = raw[field];
// output all fields, except internal ids
if ((field != fieldId) || (!(value in internalIds) || this.showInternalIds)) {
converted[field] = util.convert(value, convert[field]);
}
}
}
}
else {
// no field types specified, no converting needed
for (field in raw) {
if (raw.hasOwnProperty(field)) {
value = raw[field];
// output all fields, except internal ids
if ((field != fieldId) || (!(value in internalIds) || this.showInternalIds)) {
converted[field] = value;
}
}
}
}
return converted;
};
/**
* Update a single item: merge with existing item.
* Will fail when the item has no id, or when there does not exist an item
* with the same id.
* @param {Object} item
* @return {String} id
* @private
*/
DataSet.prototype._updateItem = function (item) {
var id = item[this.fieldId];
if (id == undefined) {
throw new Error('Cannot update item: item has no id (item: ' + JSON.stringify(item) + ')');
}
var d = this.data[id];
if (!d) {
// item doesn't exist
throw new Error('Cannot update item: no item with id ' + id + ' found');
}
// merge with current item
for (var field in item) {
if (item.hasOwnProperty(field)) {
var fieldType = this.convert[field]; // type may be undefined
d[field] = util.convert(item[field], fieldType);
}
}
return id;
};
/**
* check if an id is an internal or external id
* @param id
* @returns {boolean}
* @private
*/
DataSet.prototype.isInternalId = function(id) {
return (id in this.internalIds);
};
/**
* Get an array with the column names of a Google DataTable
* @param {DataTable} dataTable
* @return {String[]} columnNames
* @private
*/
DataSet.prototype._getColumnNames = function (dataTable) {
var columns = [];
for (var col = 0, cols = dataTable.getNumberOfColumns(); col < cols; col++) {
columns[col] = dataTable.getColumnId(col) || dataTable.getColumnLabel(col);
}
return columns;
};
/**
* Append an item as a row to the dataTable
* @param dataTable
* @param columns
* @param item
* @private
*/
DataSet.prototype._appendRow = function (dataTable, columns, item) {
var row = dataTable.addRow();
for (var col = 0, cols = columns.length; col < cols; col++) {
var field = columns[col];
dataTable.setValue(row, col, item[field]);
}
};
/**
* DataView
*
* a dataview offers a filtered view on a dataset or an other dataview.
*
* @param {DataSet | DataView} data
* @param {Object} [options] Available options: see method get
*
* @constructor DataView
*/
function DataView (data, options) {
this.id = util.randomUUID();
this.data = null;
this.ids = {}; // ids of the items currently in memory (just contains a boolean true)
this.options = options || {};
this.fieldId = 'id'; // name of the field containing id
this.subscribers = {}; // event subscribers
var me = this;
this.listener = function () {
me._onEvent.apply(me, arguments);
};
this.setData(data);
}
// TODO: implement a function .config() to dynamically update things like configured filter
// and trigger changes accordingly
/**
* Set a data source for the view
* @param {DataSet | DataView} data
*/
DataView.prototype.setData = function (data) {
var ids, dataItems, i, len;
if (this.data) {
// unsubscribe from current dataset
if (this.data.unsubscribe) {
this.data.unsubscribe('*', this.listener);
}
// trigger a remove of all items in memory
ids = [];
for (var id in this.ids) {
if (this.ids.hasOwnProperty(id)) {
ids.push(id);
}
}
this.ids = {};
this._trigger('remove', {items: ids});
}
this.data = data;
if (this.data) {
// update fieldId
this.fieldId = this.options.fieldId ||
(this.data && this.data.options && this.data.options.fieldId) ||
'id';
// trigger an add of all added items
ids = this.data.getIds({filter: this.options && this.options.filter});
for (i = 0, len = ids.length; i < len; i++) {
id = ids[i];
this.ids[id] = true;
}
this._trigger('add', {items: ids});
// subscribe to new dataset
if (this.data.on) {
this.data.on('*', this.listener);
}
}
};
/**
* Get data from the data view
*
* Usage:
*
* get()
* get(options: Object)
* get(options: Object, data: Array | DataTable)
*
* get(id: Number)
* get(id: Number, options: Object)
* get(id: Number, options: Object, data: Array | DataTable)
*
* get(ids: Number[])
* get(ids: Number[], options: Object)
* get(ids: Number[], options: Object, data: Array | DataTable)
*
* Where:
*
* {Number | String} id The id of an item
* {Number[] | String{}} ids An array with ids of items
* {Object} options An Object with options. Available options:
* {String} [type] Type of data to be returned. Can
* be 'DataTable' or 'Array' (default)
* {Object.<String, String>} [convert]
* {String[]} [fields] field names to be returned
* {function} [filter] filter items
* {String | function} [order] Order the items by
* a field name or custom sort function.
* {Array | DataTable} [data] If provided, items will be appended to this
* array or table. Required in case of Google
* DataTable.
* @param args
*/
DataView.prototype.get = function (args) {
var me = this;
// parse the arguments
var ids, options, data;
var firstType = util.getType(arguments[0]);
if (firstType == 'String' || firstType == 'Number' || firstType == 'Array') {
// get(id(s) [, options] [, data])
ids = arguments[0]; // can be a single id or an array with ids
options = arguments[1];
data = arguments[2];
}
else {
// get([, options] [, data])
options = arguments[0];
data = arguments[1];
}
// extend the options with the default options and provided options
var viewOptions = util.extend({}, this.options, options);
// create a combined filter method when needed
if (this.options.filter && options && options.filter) {
viewOptions.filter = function (item) {
return me.options.filter(item) && options.filter(item);
}
}
// build up the call to the linked data set
var getArguments = [];
if (ids != undefined) {
getArguments.push(ids);
}
getArguments.push(viewOptions);
getArguments.push(data);
return this.data && this.data.get.apply(this.data, getArguments);
};
/**
* Get ids of all items or from a filtered set of items.
* @param {Object} [options] An Object with options. Available options:
* {function} [filter] filter items
* {String | function} [order] Order the items by
* a field name or custom sort function.
* @return {Array} ids
*/
DataView.prototype.getIds = function (options) {
var ids;
if (this.data) {
var defaultFilter = this.options.filter;
var filter;
if (options && options.filter) {
if (defaultFilter) {
filter = function (item) {
return defaultFilter(item) && options.filter(item);
}
}
else {
filter = options.filter;
}
}
else {
filter = defaultFilter;
}
ids = this.data.getIds({
filter: filter,
order: options && options.order
});
}
else {
ids = [];
}
return ids;
};
/**
* Event listener. Will propagate all events from the connected data set to
* the subscribers of the DataView, but will filter the items and only trigger
* when there are changes in the filtered data set.
* @param {String} event
* @param {Object | null} params
* @param {String} senderId
* @private
*/
DataView.prototype._onEvent = function (event, params, senderId) {
var i, len, id, item,
ids = params && params.items,
data = this.data,
added = [],
updated = [],
removed = [];
if (ids && data) {
switch (event) {
case 'add':
// filter the ids of the added items
for (i = 0, len = ids.length; i < len; i++) {
id = ids[i];
item = this.get(id);
if (item) {
this.ids[id] = true;
added.push(id);
}
}
break;
case 'update':
// determine the event from the views viewpoint: an updated
// item can be added, updated, or removed from this view.
for (i = 0, len = ids.length; i < len; i++) {
id = ids[i];
item = this.get(id);
if (item) {
if (this.ids[id]) {
updated.push(id);
}
else {
this.ids[id] = true;
added.push(id);
}
}
else {
if (this.ids[id]) {
delete this.ids[id];
removed.push(id);
}
else {
// nothing interesting for me :-(
}
}
}
break;
case 'remove':
// filter the ids of the removed items
for (i = 0, len = ids.length; i < len; i++) {
id = ids[i];
if (this.ids[id]) {
delete this.ids[id];
removed.push(id);
}
}
break;
}
if (added.length) {
this._trigger('add', {items: added}, senderId);
}
if (updated.length) {
this._trigger('update', {items: updated}, senderId);
}
if (removed.length) {
this._trigger('remove', {items: removed}, senderId);
}
}
};
// copy subscription functionality from DataSet
DataView.prototype.on = DataSet.prototype.on;
DataView.prototype.off = DataSet.prototype.off;
DataView.prototype._trigger = DataSet.prototype._trigger;
// TODO: make these functions deprecated (replaced with `on` and `off` since version 0.5)
DataView.prototype.subscribe = DataView.prototype.on;
DataView.prototype.unsubscribe = DataView.prototype.off;
/**
* @constructor TimeStep
* The class TimeStep is an iterator for dates. You provide a start date and an
* end date. The class itself determines the best scale (step size) based on the
* provided start Date, end Date, and minimumStep.
*
* If minimumStep is provided, the step size is chosen as close as possible
* to the minimumStep but larger than minimumStep. If minimumStep is not
* provided, the scale is set to 1 DAY.
* The minimumStep should correspond with the onscreen size of about 6 characters
*
* Alternatively, you can set a scale by hand.
* After creation, you can initialize the class by executing first(). Then you
* can iterate from the start date to the end date via next(). You can check if
* the end date is reached with the function hasNext(). After each step, you can
* retrieve the current date via getCurrent().
* The TimeStep has scales ranging from milliseconds, seconds, minutes, hours,
* days, to years.
*
* Version: 1.2
*
* @param {Date} [start] The start date, for example new Date(2010, 9, 21)
* or new Date(2010, 9, 21, 23, 45, 00)
* @param {Date} [end] The end date
* @param {Number} [minimumStep] Optional. Minimum step size in milliseconds
*/
TimeStep = function(start, end, minimumStep) {
// variables
this.current = new Date();
this._start = new Date();
this._end = new Date();
this.autoScale = true;
this.scale = TimeStep.SCALE.DAY;
this.step = 1;
// initialize the range
this.setRange(start, end, minimumStep);
};
/// enum scale
TimeStep.SCALE = {
MILLISECOND: 1,
SECOND: 2,
MINUTE: 3,
HOUR: 4,
DAY: 5,
WEEKDAY: 6,
MONTH: 7,
YEAR: 8
};
/**
* Set a new range
* If minimumStep is provided, the step size is chosen as close as possible
* to the minimumStep but larger than minimumStep. If minimumStep is not
* provided, the scale is set to 1 DAY.
* The minimumStep should correspond with the onscreen size of about 6 characters
* @param {Date} [start] The start date and time.
* @param {Date} [end] The end date and time.
* @param {int} [minimumStep] Optional. Minimum step size in milliseconds
*/
TimeStep.prototype.setRange = function(start, end, minimumStep) {
if (!(start instanceof Date) || !(end instanceof Date)) {
throw "No legal start or end date in method setRange";
}
this._start = (start != undefined) ? new Date(start.valueOf()) : new Date();
this._end = (end != undefined) ? new Date(end.valueOf()) : new Date();
if (this.autoScale) {
this.setMinimumStep(minimumStep);
}
};
/**
* Set the range iterator to the start date.
*/
TimeStep.prototype.first = function() {
this.current = new Date(this._start.valueOf());
this.roundToMinor();
};
/**
* Round the current date to the first minor date value
* This must be executed once when the current date is set to start Date
*/
TimeStep.prototype.roundToMinor = function() {
// round to floor
// IMPORTANT: we have no breaks in this switch! (this is no bug)
//noinspection FallthroughInSwitchStatementJS
switch (this.scale) {
case TimeStep.SCALE.YEAR:
this.current.setFullYear(this.step * Math.floor(this.current.getFullYear() / this.step));
this.current.setMonth(0);
case TimeStep.SCALE.MONTH: this.current.setDate(1);
case TimeStep.SCALE.DAY: // intentional fall through
case TimeStep.SCALE.WEEKDAY: this.current.setHours(0);
case TimeStep.SCALE.HOUR: this.current.setMinutes(0);
case TimeStep.SCALE.MINUTE: this.current.setSeconds(0);
case TimeStep.SCALE.SECOND: this.current.setMilliseconds(0);
//case TimeStep.SCALE.MILLISECOND: // nothing to do for milliseconds
}
if (this.step != 1) {
// round down to the first minor value that is a multiple of the current step size
switch (this.scale) {
case TimeStep.SCALE.MILLISECOND: this.current.setMilliseconds(this.current.getMilliseconds() - this.current.getMilliseconds() % this.step); break;
case TimeStep.SCALE.SECOND: this.current.setSeconds(this.current.getSeconds() - this.current.getSeconds() % this.step); break;
case TimeStep.SCALE.MINUTE: this.current.setMinutes(this.current.getMinutes() - this.current.getMinutes() % this.step); break;
case TimeStep.SCALE.HOUR: this.current.setHours(this.current.getHours() - this.current.getHours() % this.step); break;
case TimeStep.SCALE.WEEKDAY: // intentional fall through
case TimeStep.SCALE.DAY: this.current.setDate((this.current.getDate()-1) - (this.current.getDate()-1) % this.step + 1); break;
case TimeStep.SCALE.MONTH: this.current.setMonth(this.current.getMonth() - this.current.getMonth() % this.step); break;
case TimeStep.SCALE.YEAR: this.current.setFullYear(this.current.getFullYear() - this.current.getFullYear() % this.step); break;
default: break;
}
}
};
/**
* Check if the there is a next step
* @return {boolean} true if the current date has not passed the end date
*/
TimeStep.prototype.hasNext = function () {
return (this.current.valueOf() <= this._end.valueOf());
};
/**
* Do the next step
*/
TimeStep.prototype.next = function() {
var prev = this.current.valueOf();
// Two cases, needed to prevent issues with switching daylight savings
// (end of March and end of October)
if (this.current.getMonth() < 6) {
switch (this.scale) {
case TimeStep.SCALE.MILLISECOND:
this.current = new Date(this.current.valueOf() + this.step); break;
case TimeStep.SCALE.SECOND: this.current = new Date(this.current.valueOf() + this.step * 1000); break;
case TimeStep.SCALE.MINUTE: this.current = new Date(this.current.valueOf() + this.step * 1000 * 60); break;
case TimeStep.SCALE.HOUR:
this.current = new Date(this.current.valueOf() + this.step * 1000 * 60 * 60);
// in case of skipping an hour for daylight savings, adjust the hour again (else you get: 0h 5h 9h ... instead of 0h 4h 8h ...)
var h = this.current.getHours();
this.current.setHours(h - (h % this.step));
break;
case TimeStep.SCALE.WEEKDAY: // intentional fall through
case TimeStep.SCALE.DAY: this.current.setDate(this.current.getDate() + this.step); break;
case TimeStep.SCALE.MONTH: this.current.setMonth(this.current.getMonth() + this.step); break;
case TimeStep.SCALE.YEAR: this.current.setFullYear(this.current.getFullYear() + this.step); break;
default: break;
}
}
else {
switch (this.scale) {
case TimeStep.SCALE.MILLISECOND: this.current = new Date(this.current.valueOf() + this.step); break;
case TimeStep.SCALE.SECOND: this.current.setSeconds(this.current.getSeconds() + this.step); break;
case TimeStep.SCALE.MINUTE: this.current.setMinutes(this.current.getMinutes() + this.step); break;
case TimeStep.SCALE.HOUR: this.current.setHours(this.current.getHours() + this.step); break;
case TimeStep.SCALE.WEEKDAY: // intentional fall through
case TimeStep.SCALE.DAY: this.current.setDate(this.current.getDate() + this.step); break;
case TimeStep.SCALE.MONTH: this.current.setMonth(this.current.getMonth() + this.step); break;
case TimeStep.SCALE.YEAR: this.current.setFullYear(this.current.getFullYear() + this.step); break;
default: break;
}
}
if (this.step != 1) {
// round down to the correct major value
switch (this.scale) {
case TimeStep.SCALE.MILLISECOND: if(this.current.getMilliseconds() < this.step) this.current.setMilliseconds(0); break;
case TimeStep.SCALE.SECOND: if(this.current.getSeconds() < this.step) this.current.setSeconds(0); break;
case TimeStep.SCALE.MINUTE: if(this.current.getMinutes() < this.step) this.current.setMinutes(0); break;
case TimeStep.SCALE.HOUR: if(this.current.getHours() < this.step) this.current.setHours(0); break;
case TimeStep.SCALE.WEEKDAY: // intentional fall through
case TimeStep.SCALE.DAY: if(this.current.getDate() < this.step+1) this.current.setDate(1); break;
case TimeStep.SCALE.MONTH: if(this.current.getMonth() < this.step) this.current.setMonth(0); break;
case TimeStep.SCALE.YEAR: break; // nothing to do for year
default: break;
}
}
// safety mechanism: if current time is still unchanged, move to the end
if (this.current.valueOf() == prev) {
this.current = new Date(this._end.valueOf());
}
};
/**
* Get the current datetime
* @return {Date} current The current date
*/
TimeStep.prototype.getCurrent = function() {
return this.current;
};
/**
* Set a custom scale. Autoscaling will be disabled.
* For example setScale(SCALE.MINUTES, 5) will result
* in minor steps of 5 minutes, and major steps of an hour.
*
* @param {TimeStep.SCALE} newScale
* A scale. Choose from SCALE.MILLISECOND,
* SCALE.SECOND, SCALE.MINUTE, SCALE.HOUR,
* SCALE.WEEKDAY, SCALE.DAY, SCALE.MONTH,
* SCALE.YEAR.
* @param {Number} newStep A step size, by default 1. Choose for
* example 1, 2, 5, or 10.
*/
TimeStep.prototype.setScale = function(newScale, newStep) {
this.scale = newScale;
if (newStep > 0) {
this.step = newStep;
}
this.autoScale = false;
};
/**
* Enable or disable autoscaling
* @param {boolean} enable If true, autoascaling is set true
*/
TimeStep.prototype.setAutoScale = function (enable) {
this.autoScale = enable;
};
/**
* Automatically determine the scale that bests fits the provided minimum step
* @param {Number} [minimumStep] The minimum step size in milliseconds
*/
TimeStep.prototype.setMinimumStep = function(minimumStep) {
if (minimumStep == undefined) {
return;
}
var stepYear = (1000 * 60 * 60 * 24 * 30 * 12);
var stepMonth = (1000 * 60 * 60 * 24 * 30);
var stepDay = (1000 * 60 * 60 * 24);
var stepHour = (1000 * 60 * 60);
var stepMinute = (1000 * 60);
var stepSecond = (1000);
var stepMillisecond= (1);
// find the smallest step that is larger than the provided minimumStep
if (stepYear*1000 > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 1000;}
if (stepYear*500 > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 500;}
if (stepYear*100 > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 100;}
if (stepYear*50 > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 50;}
if (stepYear*10 > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 10;}
if (stepYear*5 > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 5;}
if (stepYear > minimumStep) {this.scale = TimeStep.SCALE.YEAR; this.step = 1;}
if (stepMonth*3 > minimumStep) {this.scale = TimeStep.SCALE.MONTH; this.step = 3;}
if (stepMonth > minimumStep) {this.scale = TimeStep.SCALE.MONTH; this.step = 1;}
if (stepDay*5 > minimumStep) {this.scale = TimeStep.SCALE.DAY; this.step = 5;}
if (stepDay*2 > minimumStep) {this.scale = TimeStep.SCALE.DAY; this.step = 2;}
if (stepDay > minimumStep) {this.scale = TimeStep.SCALE.DAY; this.step = 1;}
if (stepDay/2 > minimumStep) {this.scale = TimeStep.SCALE.WEEKDAY; this.step = 1;}
if (stepHour*4 > minimumStep) {this.scale = TimeStep.SCALE.HOUR; this.step = 4;}
if (stepHour > minimumStep) {this.scale = TimeStep.SCALE.HOUR; this.step = 1;}
if (stepMinute*15 > minimumStep) {this.scale = TimeStep.SCALE.MINUTE; this.step = 15;}
if (stepMinute*10 > minimumStep) {this.scale = TimeStep.SCALE.MINUTE; this.step = 10;}
if (stepMinute*5 > minimumStep) {this.scale = TimeStep.SCALE.MINUTE; this.step = 5;}
if (stepMinute > minimumStep) {this.scale = TimeStep.SCALE.MINUTE; this.step = 1;}
if (stepSecond*15 > minimumStep) {this.scale = TimeStep.SCALE.SECOND; this.step = 15;}
if (stepSecond*10 > minimumStep) {this.scale = TimeStep.SCALE.SECOND; this.step = 10;}
if (stepSecond*5 > minimumStep) {this.scale = TimeStep.SCALE.SECOND; this.step = 5;}
if (stepSecond > minimumStep) {this.scale = TimeStep.SCALE.SECOND; this.step = 1;}
if (stepMillisecond*200 > minimumStep) {this.scale = TimeStep.SCALE.MILLISECOND; this.step = 200;}
if (stepMillisecond*100 > minimumStep) {this.scale = TimeStep.SCALE.MILLISECOND; this.step = 100;}
if (stepMillisecond*50 > minimumStep) {this.scale = TimeStep.SCALE.MILLISECOND; this.step = 50;}
if (stepMillisecond*10 > minimumStep) {this.scale = TimeStep.SCALE.MILLISECOND; this.step = 10;}
if (stepMillisecond*5 > minimumStep) {this.scale = TimeStep.SCALE.MILLISECOND; this.step = 5;}
if (stepMillisecond > minimumStep) {this.scale = TimeStep.SCALE.MILLISECOND; this.step = 1;}
};
/**
* Snap a date to a rounded value.
* The snap intervals are dependent on the current scale and step.
* @param {Date} date the date to be snapped.
* @return {Date} snappedDate
*/
TimeStep.prototype.snap = function(date) {
var clone = new Date(date.valueOf());
if (this.scale == TimeStep.SCALE.YEAR) {
var year = clone.getFullYear() + Math.round(clone.getMonth() / 12);
clone.setFullYear(Math.round(year / this.step) * this.step);
clone.setMonth(0);
clone.setDate(0);
clone.setHours(0);
clone.setMinutes(0);
clone.setSeconds(0);
clone.setMilliseconds(0);
}
else if (this.scale == TimeStep.SCALE.MONTH) {
if (clone.getDate() > 15) {
clone.setDate(1);
clone.setMonth(clone.getMonth() + 1);
// important: first set Date to 1, after that change the month.
}
else {
clone.setDate(1);
}
clone.setHours(0);
clone.setMinutes(0);
clone.setSeconds(0);
clone.setMilliseconds(0);
}
else if (this.scale == TimeStep.SCALE.DAY ||
this.scale == TimeStep.SCALE.WEEKDAY) {
//noinspection FallthroughInSwitchStatementJS
switch (this.step) {
case 5:
case 2:
clone.setHours(Math.round(clone.getHours() / 24) * 24); break;
default:
clone.setHours(Math.round(clone.getHours() / 12) * 12); break;
}
clone.setMinutes(0);
clone.setSeconds(0);
clone.setMilliseconds(0);
}
else if (this.scale == TimeStep.SCALE.HOUR) {
switch (this.step) {
case 4:
clone.setMinutes(Math.round(clone.getMinutes() / 60) * 60); break;
default:
clone.setMinutes(Math.round(clone.getMinutes() / 30) * 30); break;
}
clone.setSeconds(0);
clone.setMilliseconds(0);
} else if (this.scale == TimeStep.SCALE.MINUTE) {
//noinspection FallthroughInSwitchStatementJS
switch (this.step) {
case 15:
case 10:
clone.setMinutes(Math.round(clone.getMinutes() / 5) * 5);
clone.setSeconds(0);
break;
case 5:
clone.setSeconds(Math.round(clone.getSeconds() / 60) * 60); break;
default:
clone.setSeconds(Math.round(clone.getSeconds() / 30) * 30); break;
}
clone.setMilliseconds(0);
}
else if (this.scale == TimeStep.SCALE.SECOND) {
//noinspection FallthroughInSwitchStatementJS
switch (this.step) {
case 15:
case 10:
clone.setSeconds(Math.round(clone.getSeconds() / 5) * 5);
clone.setMilliseconds(0);
break;
case 5:
clone.setMilliseconds(Math.round(clone.getMilliseconds() / 1000) * 1000); break;
default:
clone.setMilliseconds(Math.round(clone.getMilliseconds() / 500) * 500); break;
}
}
else if (this.scale == TimeStep.SCALE.MILLISECOND) {
var step = this.step > 5 ? this.step / 2 : 1;
clone.setMilliseconds(Math.round(clone.getMilliseconds() / step) * step);
}
return clone;
};
/**
* Check if the current value is a major value (for example when the step
* is DAY, a major value is each first day of the MONTH)
* @return {boolean} true if current date is major, else false.
*/
TimeStep.prototype.isMajor = function() {
switch (this.scale) {
case TimeStep.SCALE.MILLISECOND:
return (this.current.getMilliseconds() == 0);
case TimeStep.SCALE.SECOND:
return (this.current.getSeconds() == 0);
case TimeStep.SCALE.MINUTE:
return (this.current.getHours() == 0) && (this.current.getMinutes() == 0);
// Note: this is no bug. Major label is equal for both minute and hour scale
case TimeStep.SCALE.HOUR:
return (this.current.getHours() == 0);
case TimeStep.SCALE.WEEKDAY: // intentional fall through
case TimeStep.SCALE.DAY:
return (this.current.getDate() == 1);
case TimeStep.SCALE.MONTH:
return (this.current.getMonth() == 0);
case TimeStep.SCALE.YEAR:
return false;
default:
return false;
}
};
/**
* Returns formatted text for the minor axislabel, depending on the current
* date and the scale. For example when scale is MINUTE, the current time is
* formatted as "hh:mm".
* @param {Date} [date] custom date. if not provided, current date is taken
*/
TimeStep.prototype.getLabelMinor = function(date) {
if (date == undefined) {
date = this.current;
}
switch (this.scale) {
case TimeStep.SCALE.MILLISECOND: return moment(date).format('SSS');
case TimeStep.SCALE.SECOND: return moment(date).format('s');
case TimeStep.SCALE.MINUTE: return moment(date).format('HH:mm');
case TimeStep.SCALE.HOUR: return moment(date).format('HH:mm');
case TimeStep.SCALE.WEEKDAY: return moment(date).format('ddd D');
case TimeStep.SCALE.DAY: return moment(date).format('D');
case TimeStep.SCALE.MONTH: return moment(date).format('MMM');
case TimeStep.SCALE.YEAR: return moment(date).format('YYYY');
default: return '';
}
};
/**
* Returns formatted text for the major axis label, depending on the current
* date and the scale. For example when scale is MINUTE, the major scale is
* hours, and the hour will be formatted as "hh".
* @param {Date} [date] custom date. if not provided, current date is taken
*/
TimeStep.prototype.getLabelMajor = function(date) {
if (date == undefined) {
date = this.current;
}
//noinspection FallthroughInSwitchStatementJS
switch (this.scale) {
case TimeStep.SCALE.MILLISECOND:return moment(date).format('HH:mm:ss');
case TimeStep.SCALE.SECOND: return moment(date).format('D MMMM HH:mm');
case TimeStep.SCALE.MINUTE:
case TimeStep.SCALE.HOUR: return moment(date).format('ddd D MMMM');
case TimeStep.SCALE.WEEKDAY:
case TimeStep.SCALE.DAY: return moment(date).format('MMMM YYYY');
case TimeStep.SCALE.MONTH: return moment(date).format('YYYY');
case TimeStep.SCALE.YEAR: return '';
default: return '';
}
};
/**
* @constructor Stack
* Stacks items on top of each other.
* @param {ItemSet} itemset
* @param {Object} [options]
*/
function Stack (itemset, options) {
this.itemset = itemset;
this.options = options || {};
this.defaultOptions = {
order: function (a, b) {
//return (b.width - a.width) || (a.left - b.left); // TODO: cleanup
// Order: ranges over non-ranges, ranged ordered by width, and
// lastly ordered by start.
if (a instanceof ItemRange) {
if (b instanceof ItemRange) {
var aInt = (a.data.end - a.data.start);
var bInt = (b.data.end - b.data.start);
return (aInt - bInt) || (a.data.start - b.data.start);
}
else {
return -1;
}
}
else {
if (b instanceof ItemRange) {
return 1;
}
else {
return (a.data.start - b.data.start);
}
}
},
margin: {
item: 10
}
};
this.ordered = []; // ordered items
}
/**
* Set options for the stack
* @param {Object} options Available options:
* {ItemSet} itemset
* {Number} margin
* {function} order Stacking order
*/
Stack.prototype.setOptions = function setOptions (options) {
util.extend(this.options, options);
// TODO: register on data changes at the connected itemset, and update the changed part only and immediately
};
/**
* Stack the items such that they don't overlap. The items will have a minimal
* distance equal to options.margin.item.
*/
Stack.prototype.update = function update() {
this._order();
this._stack();
};
/**
* Order the items. If a custom order function has been provided via the options,
* then this will be used.
* @private
*/
Stack.prototype._order = function _order () {
var items = this.itemset.items;
if (!items) {
throw new Error('Cannot stack items: ItemSet does not contain items');
}
// TODO: store the sorted items, to have less work later on
var ordered = [];
var index = 0;
// items is a map (no array)
util.forEach(items, function (item) {
if (item.visible) {
ordered[index] = item;
index++;
}
});
//if a customer stack order function exists, use it.
var order = this.options.order || this.defaultOptions.order;
if (!(typeof order === 'function')) {
throw new Error('Option order must be a function');
}
ordered.sort(order);
this.ordered = ordered;
};
/**
* Adjust vertical positions of the events such that they don't overlap each
* other.
* @private
*/
Stack.prototype._stack = function _stack () {
var i,
iMax,
ordered = this.ordered,
options = this.options,
orientation = options.orientation || this.defaultOptions.orientation,
axisOnTop = (orientation == 'top'),
margin;
if (options.margin && options.margin.item !== undefined) {
margin = options.margin.item;
}
else {
margin = this.defaultOptions.margin.item
}
// calculate new, non-overlapping positions
for (i = 0, iMax = ordered.length; i < iMax; i++) {
var item = ordered[i];
var collidingItem = null;
do {
// TODO: optimize checking for overlap. when there is a gap without items,
// you only need to check for items from the next item on, not from zero
collidingItem = this.checkOverlap(ordered, i, 0, i - 1, margin);
if (collidingItem != null) {
// There is a collision. Reposition the event above the colliding element
if (axisOnTop) {
item.top = collidingItem.top + collidingItem.height + margin;
}
else {
item.top = collidingItem.top - item.height - margin;
}
}
} while (collidingItem);
}
};
/**
* Check if the destiny position of given item overlaps with any
* of the other items from index itemStart to itemEnd.
* @param {Array} items Array with items
* @param {int} itemIndex Number of the item to be checked for overlap
* @param {int} itemStart First item to be checked.
* @param {int} itemEnd Last item to be checked.
* @return {Object | null} colliding item, or undefined when no collisions
* @param {Number} margin A minimum required margin.
* If margin is provided, the two items will be
* marked colliding when they overlap or
* when the margin between the two is smaller than
* the requested margin.
*/
Stack.prototype.checkOverlap = function checkOverlap (items, itemIndex,
itemStart, itemEnd, margin) {
var collision = this.collision;
// we loop from end to start, as we suppose that the chance of a
// collision is larger for items at the end, so check these first.
var a = items[itemIndex];
for (var i = itemEnd; i >= itemStart; i--) {
var b = items[i];
if (collision(a, b, margin)) {
if (i != itemIndex) {
return b;
}
}
}
return null;
};
/**
* Test if the two provided items collide
* The items must have parameters left, width, top, and height.
* @param {Component} a The first item
* @param {Component} b The second item
* @param {Number} margin A minimum required margin.
* If margin is provided, the two items will be
* marked colliding when they overlap or
* when the margin between the two is smaller than
* the requested margin.
* @return {boolean} true if a and b collide, else false
*/
Stack.prototype.collision = function collision (a, b, margin) {
return ((a.left - margin) < (b.left + b.width) &&
(a.left + a.width + margin) > b.left &&
(a.top - margin) < (b.top + b.height) &&
(a.top + a.height + margin) > b.top);
};
/**
* @constructor Range
* A Range controls a numeric range with a start and end value.
* The Range adjusts the range based on mouse events or programmatic changes,
* and triggers events when the range is changing or has been changed.
* @param {Object} [options] See description at Range.setOptions
* @extends Controller
*/
function Range(options) {
this.id = util.randomUUID();
this.start = null; // Number
this.end = null; // Number
this.options = options || {};
this.setOptions(options);
}
// extend the Range prototype with an event emitter mixin
Emitter(Range.prototype);
/**
* Set options for the range controller
* @param {Object} options Available options:
* {Number} min Minimum value for start
* {Number} max Maximum value for end
* {Number} zoomMin Set a minimum value for
* (end - start).
* {Number} zoomMax Set a maximum value for
* (end - start).
*/
Range.prototype.setOptions = function (options) {
util.extend(this.options, options);
// re-apply range with new limitations
if (this.start !== null && this.end !== null) {
this.setRange(this.start, this.end);
}
};
/**
* Test whether direction has a valid value
* @param {String} direction 'horizontal' or 'vertical'
*/
function validateDirection (direction) {
if (direction != 'horizontal' && direction != 'vertical') {
throw new TypeError('Unknown direction "' + direction + '". ' +
'Choose "horizontal" or "vertical".');
}
}
/**
* Add listeners for mouse and touch events to the component
* @param {Controller} controller
* @param {Component} component Should be a rootpanel
* @param {String} event Available events: 'move', 'zoom'
* @param {String} direction Available directions: 'horizontal', 'vertical'
*/
Range.prototype.subscribe = function (controller, component, event, direction) {
var me = this;
if (event == 'move') {
// drag start listener
controller.on('dragstart', function (event) {
me._onDragStart(event, component);
});
// drag listener
controller.on('drag', function (event) {
me._onDrag(event, component, direction);
});
// drag end listener
controller.on('dragend', function (event) {
me._onDragEnd(event, component);
});
// ignore dragging when holding
controller.on('hold', function (event) {
me._onHold();
});
}
else if (event == 'zoom') {
// mouse wheel
function mousewheel (event) {
me._onMouseWheel(event, component, direction);
}
controller.on('mousewheel', mousewheel);
controller.on('DOMMouseScroll', mousewheel); // For FF
// pinch
controller.on('touch', function (event) {
me._onTouch(event);
});
controller.on('pinch', function (event) {
me._onPinch(event, component, direction);
});
}
else {
throw new TypeError('Unknown event "' + event + '". ' +
'Choose "move" or "zoom".');
}
};
/**
* Set a new start and end range
* @param {Number} [start]
* @param {Number} [end]
*/
Range.prototype.setRange = function(start, end) {
var changed = this._applyRange(start, end);
if (changed) {
var params = {
start: this.start,
end: this.end
};
this.emit('rangechange', params);
this.emit('rangechanged', params);
}
};
/**
* Set a new start and end range. This method is the same as setRange, but
* does not trigger a range change and range changed event, and it returns
* true when the range is changed
* @param {Number} [start]
* @param {Number} [end]
* @return {Boolean} changed
* @private
*/
Range.prototype._applyRange = function(start, end) {
var newStart = (start != null) ? util.convert(start, 'Date').valueOf() : this.start,
newEnd = (end != null) ? util.convert(end, 'Date').valueOf() : this.end,
max = (this.options.max != null) ? util.convert(this.options.max, 'Date').valueOf() : null,
min = (this.options.min != null) ? util.convert(this.options.min, 'Date').valueOf() : null,
diff;
// check for valid number
if (isNaN(newStart) || newStart === null) {
throw new Error('Invalid start "' + start + '"');
}
if (isNaN(newEnd) || newEnd === null) {
throw new Error('Invalid end "' + end + '"');
}
// prevent start < end
if (newEnd < newStart) {
newEnd = newStart;
}
// prevent start < min
if (min !== null) {
if (newStart < min) {
diff = (min - newStart);
newStart += diff;
newEnd += diff;
// prevent end > max
if (max != null) {
if (newEnd > max) {
newEnd = max;
}
}
}
}
// prevent end > max
if (max !== null) {
if (newEnd > max) {
diff = (newEnd - max);
newStart -= diff;
newEnd -= diff;
// prevent start < min
if (min != null) {
if (newStart < min) {
newStart = min;
}
}
}
}
// prevent (end-start) < zoomMin
if (this.options.zoomMin !== null) {
var zoomMin = parseFloat(this.options.zoomMin);
if (zoomMin < 0) {
zoomMin = 0;
}
if ((newEnd - newStart) < zoomMin) {
if ((this.end - this.start) === zoomMin) {
// ignore this action, we are already zoomed to the minimum
newStart = this.start;
newEnd = this.end;
}
else {
// zoom to the minimum
diff = (zoomMin - (newEnd - newStart));
newStart -= diff / 2;
newEnd += diff / 2;
}
}
}
// prevent (end-start) > zoomMax
if (this.options.zoomMax !== null) {
var zoomMax = parseFloat(this.options.zoomMax);
if (zoomMax < 0) {
zoomMax = 0;
}
if ((newEnd - newStart) > zoomMax) {
if ((this.end - this.start) === zoomMax) {
// ignore this action, we are already zoomed to the maximum
newStart = this.start;
newEnd = this.end;
}
else {
// zoom to the maximum
diff = ((newEnd - newStart) - zoomMax);
newStart += diff / 2;
newEnd -= diff / 2;
}
}
}
var changed = (this.start != newStart || this.end != newEnd);
this.start = newStart;
this.end = newEnd;
return changed;
};
/**
* Retrieve the current range.
* @return {Object} An object with start and end properties
*/
Range.prototype.getRange = function() {
return {
start: this.start,
end: this.end
};
};
/**
* Calculate the conversion offset and scale for current range, based on
* the provided width
* @param {Number} width
* @returns {{offset: number, scale: number}} conversion
*/
Range.prototype.conversion = function (width) {
return Range.conversion(this.start, this.end, width);
};
/**
* Static method to calculate the conversion offset and scale for a range,
* based on the provided start, end, and width
* @param {Number} start
* @param {Number} end
* @param {Number} width
* @returns {{offset: number, scale: number}} conversion
*/
Range.conversion = function (start, end, width) {
if (width != 0 && (end - start != 0)) {
return {
offset: start,
scale: width / (end - start)
}
}
else {
return {
offset: 0,
scale: 1
};
}
};
// global (private) object to store drag params
var touchParams = {};
/**
* Start dragging horizontally or vertically
* @param {Event} event
* @param {Object} component
* @private
*/
Range.prototype._onDragStart = function(event, component) {
// refuse to drag when we where pinching to prevent the timeline make a jump
// when releasing the fingers in opposite order from the touch screen
if (touchParams.ignore) return;
// TODO: reckon with option movable
touchParams.start = this.start;
touchParams.end = this.end;
var frame = component.frame;
if (frame) {
frame.style.cursor = 'move';
}
};
/**
* Perform dragging operating.
* @param {Event} event
* @param {Component} component
* @param {String} direction 'horizontal' or 'vertical'
* @private
*/
Range.prototype._onDrag = function (event, component, direction) {
validateDirection(direction);
// TODO: reckon with option movable
// refuse to drag when we where pinching to prevent the timeline make a jump
// when releasing the fingers in opposite order from the touch screen
if (touchParams.ignore) return;
var delta = (direction == 'horizontal') ? event.gesture.deltaX : event.gesture.deltaY,
interval = (touchParams.end - touchParams.start),
width = (direction == 'horizontal') ? component.width : component.height,
diffRange = -delta / width * interval;
this._applyRange(touchParams.start + diffRange, touchParams.end + diffRange);
this.emit('rangechange', {
start: this.start,
end: this.end
});
};
/**
* Stop dragging operating.
* @param {event} event
* @param {Component} component
* @private
*/
Range.prototype._onDragEnd = function (event, component) {
// refuse to drag when we where pinching to prevent the timeline make a jump
// when releasing the fingers in opposite order from the touch screen
if (touchParams.ignore) return;
// TODO: reckon with option movable
if (component.frame) {
component.frame.style.cursor = 'auto';
}
// fire a rangechanged event
this.emit('rangechanged', {
start: this.start,
end: this.end
});
};
/**
* Event handler for mouse wheel event, used to zoom
* Code from http://adomas.org/javascript-mouse-wheel/
* @param {Event} event
* @param {Component} component
* @param {String} direction 'horizontal' or 'vertical'
* @private
*/
Range.prototype._onMouseWheel = function(event, component, direction) {
validateDirection(direction);
// TODO: reckon with option zoomable
// retrieve delta
var delta = 0;
if (event.wheelDelta) { /* IE/Opera. */
delta = event.wheelDelta / 120;
} else if (event.detail) { /* Mozilla case. */
// In Mozilla, sign of delta is different than in IE.
// Also, delta is multiple of 3.
delta = -event.detail / 3;
}
// If delta is nonzero, handle it.
// Basically, delta is now positive if wheel was scrolled up,
// and negative, if wheel was scrolled down.
if (delta) {
// perform the zoom action. Delta is normally 1 or -1
// adjust a negative delta such that zooming in with delta 0.1
// equals zooming out with a delta -0.1
var scale;
if (delta < 0) {
scale = 1 - (delta / 5);
}
else {
scale = 1 / (1 + (delta / 5)) ;
}
// calculate center, the date to zoom around
var gesture = util.fakeGesture(this, event),
pointer = getPointer(gesture.center, component.frame),
pointerDate = this._pointerToDate(component, direction, pointer);
this.zoom(scale, pointerDate);
}
// Prevent default actions caused by mouse wheel
// (else the page and timeline both zoom and scroll)
event.preventDefault();
};
/**
* Start of a touch gesture
* @private
*/
Range.prototype._onTouch = function (event) {
touchParams.start = this.start;
touchParams.end = this.end;
touchParams.ignore = false;
touchParams.center = null;
// don't move the range when dragging a selected event
// TODO: it's not so neat to have to know about the state of the ItemSet
var item = ItemSet.itemFromTarget(event);
if (item && item.selected && this.options.editable) {
touchParams.ignore = true;
}
};
/**
* On start of a hold gesture
* @private
*/
Range.prototype._onHold = function () {
touchParams.ignore = true;
};
/**
* Handle pinch event
* @param {Event} event
* @param {Component} component
* @param {String} direction 'horizontal' or 'vertical'
* @private
*/
Range.prototype._onPinch = function (event, component, direction) {
touchParams.ignore = true;
// TODO: reckon with option zoomable
if (event.gesture.touches.length > 1) {
if (!touchParams.center) {
touchParams.center = getPointer(event.gesture.center, component.frame);
}
var scale = 1 / event.gesture.scale,
initDate = this._pointerToDate(component, direction, touchParams.center),
center = getPointer(event.gesture.center, component.frame),
date = this._pointerToDate(component, direction, center),
delta = date - initDate; // TODO: utilize delta
// calculate new start and end
var newStart = parseInt(initDate + (touchParams.start - initDate) * scale);
var newEnd = parseInt(initDate + (touchParams.end - initDate) * scale);
// apply new range
this.setRange(newStart, newEnd);
}
};
/**
* Helper function to calculate the center date for zooming
* @param {Component} component
* @param {{x: Number, y: Number}} pointer
* @param {String} direction 'horizontal' or 'vertical'
* @return {number} date
* @private
*/
Range.prototype._pointerToDate = function (component, direction, pointer) {
var conversion;
if (direction == 'horizontal') {
var width = component.width;
conversion = this.conversion(width);
return pointer.x / conversion.scale + conversion.offset;
}
else {
var height = component.height;
conversion = this.conversion(height);
return pointer.y / conversion.scale + conversion.offset;
}
};
/**
* Get the pointer location relative to the location of the dom element
* @param {{pageX: Number, pageY: Number}} touch
* @param {Element} element HTML DOM element
* @return {{x: Number, y: Number}} pointer
* @private
*/
function getPointer (touch, element) {
return {
x: touch.pageX - vis.util.getAbsoluteLeft(element),
y: touch.pageY - vis.util.getAbsoluteTop(element)
};
}
/**
* Zoom the range the given scale in or out. Start and end date will
* be adjusted, and the timeline will be redrawn. You can optionally give a
* date around which to zoom.
* For example, try scale = 0.9 or 1.1
* @param {Number} scale Scaling factor. Values above 1 will zoom out,
* values below 1 will zoom in.
* @param {Number} [center] Value representing a date around which will
* be zoomed.
*/
Range.prototype.zoom = function(scale, center) {
// if centerDate is not provided, take it half between start Date and end Date
if (center == null) {
center = (this.start + this.end) / 2;
}
// calculate new start and end
var newStart = center + (this.start - center) * scale;
var newEnd = center + (this.end - center) * scale;
this.setRange(newStart, newEnd);
};
/**
* Move the range with a given delta to the left or right. Start and end
* value will be adjusted. For example, try delta = 0.1 or -0.1
* @param {Number} delta Moving amount. Positive value will move right,
* negative value will move left
*/
Range.prototype.move = function(delta) {
// zoom start Date and end Date relative to the centerDate
var diff = (this.end - this.start);
// apply new values
var newStart = this.start + diff * delta;
var newEnd = this.end + diff * delta;
// TODO: reckon with min and max range
this.start = newStart;
this.end = newEnd;
};
/**
* Move the range to a new center point
* @param {Number} moveTo New center point of the range
*/
Range.prototype.moveTo = function(moveTo) {
var center = (this.start + this.end) / 2;
var diff = center - moveTo;
// calculate new start and end
var newStart = this.start - diff;
var newEnd = this.end - diff;
this.setRange(newStart, newEnd);
};
/**
* @constructor Controller
*
* A Controller controls the reflows and repaints of all components,
* and is used as an event bus for all components.
*/
function Controller () {
var me = this;
this.id = util.randomUUID();
this.components = {};
/**
* Listen for a 'request-reflow' event. The controller will schedule a reflow
* @param {Boolean} [force] If true, an immediate reflow is forced. Default
* is false.
*/
var reflowTimer = null;
this.on('request-reflow', function requestReflow(force) {
if (force) {
me.reflow();
}
else {
if (!reflowTimer) {
reflowTimer = setTimeout(function () {
reflowTimer = null;
me.reflow();
}, 0);
}
}
});
/**
* Request a repaint. The controller will schedule a repaint
* @param {Boolean} [force] If true, an immediate repaint is forced. Default
* is false.
*/
var repaintTimer = null;
this.on('request-repaint', function requestRepaint(force) {
if (force) {
me.repaint();
}
else {
if (!repaintTimer) {
repaintTimer = setTimeout(function () {
repaintTimer = null;
me.repaint();
}, 0);
}
}
});
}
// Extend controller with Emitter mixin
Emitter(Controller.prototype);
/**
* Add a component to the controller
* @param {Component} component
*/
Controller.prototype.add = function add(component) {
// validate the component
if (component.id == undefined) {
throw new Error('Component has no field id');
}
if (!(component instanceof Component) && !(component instanceof Controller)) {
throw new TypeError('Component must be an instance of ' +
'prototype Component or Controller');
}
// add the component
component.setController(this);
this.components[component.id] = component;
};
/**
* Remove a component from the controller
* @param {Component | String} component
*/
Controller.prototype.remove = function remove(component) {
var id;
for (id in this.components) {
if (this.components.hasOwnProperty(id)) {
if (id == component || this.components[id] === component) {
break;
}
}
}
if (id) {
// unregister the controller (gives the component the ability to unregister
// event listeners and clean up other stuff)
this.components[id].setController(null);
delete this.components[id];
}
};
/**
* Repaint all components
*/
Controller.prototype.repaint = function repaint() {
var changed = false;
// cancel any running repaint request
if (this.repaintTimer) {
clearTimeout(this.repaintTimer);
this.repaintTimer = undefined;
}
var done = {};
function repaint(component, id) {
if (!(id in done)) {
// first repaint the components on which this component is dependent
if (component.depends) {
component.depends.forEach(function (dep) {
repaint(dep, dep.id);
});
}
if (component.parent) {
repaint(component.parent, component.parent.id);
}
// repaint the component itself and mark as done
changed = component.repaint() || changed;
done[id] = true;
}
}
util.forEach(this.components, repaint);
this.emit('repaint');
// immediately reflow when needed
if (changed) {
this.reflow();
}
// TODO: limit the number of nested reflows/repaints, prevent loop
};
/**
* Reflow all components
*/
Controller.prototype.reflow = function reflow() {
var resized = false;
// cancel any running repaint request
if (this.reflowTimer) {
clearTimeout(this.reflowTimer);
this.reflowTimer = undefined;
}
var done = {};
function reflow(component, id) {
if (!(id in done)) {
// first reflow the components on which this component is dependent
if (component.depends) {
component.depends.forEach(function (dep) {
reflow(dep, dep.id);
});
}
if (component.parent) {
reflow(component.parent, component.parent.id);
}
// reflow the component itself and mark as done
resized = component.reflow() || resized;
done[id] = true;
}
}
util.forEach(this.components, reflow);
this.emit('reflow');
// immediately repaint when needed
if (resized) {
this.repaint();
}
// TODO: limit the number of nested reflows/repaints, prevent loop
};
/**
* Prototype for visual components
*/
function Component () {
this.id = null;
this.parent = null;
this.depends = null;
this.controller = null;
this.options = null;
this.frame = null; // main DOM element
this.top = 0;
this.left = 0;
this.width = 0;
this.height = 0;
}
/**
* Set parameters for the frame. Parameters will be merged in current parameter
* set.
* @param {Object} options Available parameters:
* {String | function} [className]
* {String | Number | function} [left]
* {String | Number | function} [top]
* {String | Number | function} [width]
* {String | Number | function} [height]
*/
Component.prototype.setOptions = function setOptions(options) {
if (options) {
util.extend(this.options, options);
if (this.controller) {
this.requestRepaint();
this.requestReflow();
}
}
};
/**
* Get an option value by name
* The function will first check this.options object, and else will check
* this.defaultOptions.
* @param {String} name
* @return {*} value
*/
Component.prototype.getOption = function getOption(name) {
var value;
if (this.options) {
value = this.options[name];
}
if (value === undefined && this.defaultOptions) {
value = this.defaultOptions[name];
}
return value;
};
/**
* Set controller for this component, or remove current controller by passing
* null as parameter value.
* @param {Controller | null} controller
*/
Component.prototype.setController = function setController (controller) {
this.controller = controller || null;
};
/**
* Get controller of this component
* @return {Controller} controller
*/
Component.prototype.getController = function getController () {
return this.controller;
};
/**
* Get the container element of the component, which can be used by a child to
* add its own widgets. Not all components do have a container for childs, in
* that case null is returned.
* @returns {HTMLElement | null} container
*/
// TODO: get rid of the getContainer and getFrame methods, provide these via the options
Component.prototype.getContainer = function getContainer() {
// should be implemented by the component
return null;
};
/**
* Get the frame element of the component, the outer HTML DOM element.
* @returns {HTMLElement | null} frame
*/
Component.prototype.getFrame = function getFrame() {
return this.frame;
};
/**
* Repaint the component
* @return {Boolean} changed
*/
Component.prototype.repaint = function repaint() {
// should be implemented by the component
return false;
};
/**
* Reflow the component
* @return {Boolean} resized
*/
Component.prototype.reflow = function reflow() {
// should be implemented by the component
return false;
};
/**
* Hide the component from the DOM
* @return {Boolean} changed
*/
Component.prototype.hide = function hide() {
if (this.frame && this.frame.parentNode) {
this.frame.parentNode.removeChild(this.frame);
return true;
}
else {
return false;
}
};
/**
* Show the component in the DOM (when not already visible).
* A repaint will be executed when the component is not visible
* @return {Boolean} changed
*/
Component.prototype.show = function show() {
if (!this.frame || !this.frame.parentNode) {
return this.repaint();
}
else {
return false;
}
};
/**
* Request a repaint. The controller will schedule a repaint
*/
Component.prototype.requestRepaint = function requestRepaint() {
if (this.controller) {
this.controller.emit('request-repaint');
}
else {
throw new Error('Cannot request a repaint: no controller configured');
// TODO: just do a repaint when no parent is configured?
}
};
/**
* Request a reflow. The controller will schedule a reflow
*/
Component.prototype.requestReflow = function requestReflow() {
if (this.controller) {
this.controller.emit('request-reflow');
}
else {
throw new Error('Cannot request a reflow: no controller configured');
// TODO: just do a reflow when no parent is configured?
}
};
/**
* A panel can contain components
* @param {Component} [parent]
* @param {Component[]} [depends] Components on which this components depends
* (except for the parent)
* @param {Object} [options] Available parameters:
* {String | Number | function} [left]
* {String | Number | function} [top]
* {String | Number | function} [width]
* {String | Number | function} [height]
* {String | function} [className]
* @constructor Panel
* @extends Component
*/
function Panel(parent, depends, options) {
this.id = util.randomUUID();
this.parent = parent;
this.depends = depends;
this.options = options || {};
}
Panel.prototype = new Component();
/**
* Set options. Will extend the current options.
* @param {Object} [options] Available parameters:
* {String | function} [className]
* {String | Number | function} [left]
* {String | Number | function} [top]
* {String | Number | function} [width]
* {String | Number | function} [height]
*/
Panel.prototype.setOptions = Component.prototype.setOptions;
/**
* Get the container element of the panel, which can be used by a child to
* add its own widgets.
* @returns {HTMLElement} container
*/
Panel.prototype.getContainer = function () {
return this.frame;
};
/**
* Repaint the component
* @return {Boolean} changed
*/
Panel.prototype.repaint = function () {
var changed = 0,
update = util.updateProperty,
asSize = util.option.asSize,
options = this.options,
frame = this.frame;
if (!frame) {
frame = document.createElement('div');
frame.className = 'vpanel';
var className = options.className;
if (className) {
if (typeof className == 'function') {
util.addClassName(frame, String(className()));
}
else {
util.addClassName(frame, String(className));
}
}
this.frame = frame;
changed += 1;
}
if (!frame.parentNode) {
if (!this.parent) {
throw new Error('Cannot repaint panel: no parent attached');
}
var parentContainer = this.parent.getContainer();
if (!parentContainer) {
throw new Error('Cannot repaint panel: parent has no container element');
}
parentContainer.appendChild(frame);
changed += 1;
}
changed += update(frame.style, 'top', asSize(options.top, '0px'));
changed += update(frame.style, 'left', asSize(options.left, '0px'));
changed += update(frame.style, 'width', asSize(options.width, '100%'));
changed += update(frame.style, 'height', asSize(options.height, '100%'));
return (changed > 0);
};
/**
* Reflow the component
* @return {Boolean} resized
*/
Panel.prototype.reflow = function () {
var changed = 0,
update = util.updateProperty,
frame = this.frame;
if (frame) {
changed += update(this, 'top', frame.offsetTop);
changed += update(this, 'left', frame.offsetLeft);
changed += update(this, 'width', frame.offsetWidth);
changed += update(this, 'height', frame.offsetHeight);
}
else {
changed += 1;
}
return (changed > 0);
};
/**
* A root panel can hold components. The root panel must be initialized with
* a DOM element as container.
* @param {HTMLElement} container
* @param {Object} [options] Available parameters: see RootPanel.setOptions.
* @constructor RootPanel
* @extends Panel
*/
function RootPanel(container, options) {
this.id = util.randomUUID();
this.container = container;
// create functions to be used as DOM event listeners
var me = this;
this.hammer = null;
// create listeners for all interesting events, these events will be emitted
// via the controller
var events = [
'touch', 'pinch', 'tap', 'doubletap', 'hold',
'dragstart', 'drag', 'dragend',
'mousewheel', 'DOMMouseScroll' // DOMMouseScroll is for Firefox
];
this.listeners = {};
events.forEach(function (event) {
me.listeners[event] = function () {
var args = [event].concat(Array.prototype.slice.call(arguments, 0));
me.controller.emit.apply(me.controller, args);
};
});
this.options = options || {};
this.defaultOptions = {
autoResize: true
};
}
RootPanel.prototype = new Panel();
/**
* Set options. Will extend the current options.
* @param {Object} [options] Available parameters:
* {String | function} [className]
* {String | Number | function} [left]
* {String | Number | function} [top]
* {String | Number | function} [width]
* {String | Number | function} [height]
* {Boolean | function} [autoResize]
*/
RootPanel.prototype.setOptions = Component.prototype.setOptions;
/**
* Repaint the component
* @return {Boolean} changed
*/
RootPanel.prototype.repaint = function () {
var changed = 0,
update = util.updateProperty,
asSize = util.option.asSize,
options = this.options,
frame = this.frame;
if (!frame) {
frame = document.createElement('div');
this.frame = frame;
this._registerListeners();
changed += 1;
}
if (!frame.parentNode) {
if (!this.container) {
throw new Error('Cannot repaint root panel: no container attached');
}
this.container.appendChild(frame);
changed += 1;
}
frame.className = 'vis timeline rootpanel ' + options.orientation +
(options.editable ? ' editable' : '');
var className = options.className;
if (className) {
util.addClassName(frame, util.option.asString(className));
}
changed += update(frame.style, 'top', asSize(options.top, '0px'));
changed += update(frame.style, 'left', asSize(options.left, '0px'));
changed += update(frame.style, 'width', asSize(options.width, '100%'));
changed += update(frame.style, 'height', asSize(options.height, '100%'));
this._updateWatch();
return (changed > 0);
};
/**
* Reflow the component
* @return {Boolean} resized
*/
RootPanel.prototype.reflow = function () {
var changed = 0,
update = util.updateProperty,
frame = this.frame;
if (frame) {
changed += update(this, 'top', frame.offsetTop);
changed += update(this, 'left', frame.offsetLeft);
changed += update(this, 'width', frame.offsetWidth);
changed += update(this, 'height', frame.offsetHeight);
}
else {
changed += 1;
}
return (changed > 0);
};
/**
* Update watching for resize, depending on the current option
* @private
*/
RootPanel.prototype._updateWatch = function () {
var autoResize = this.getOption('autoResize');
if (autoResize) {
this._watch();
}
else {
this._unwatch();
}
};
/**
* Watch for changes in the size of the frame. On resize, the Panel will
* automatically redraw itself.
* @private
*/
RootPanel.prototype._watch = function () {
var me = this;
this._unwatch();
var checkSize = function () {
var autoResize = me.getOption('autoResize');
if (!autoResize) {
// stop watching when the option autoResize is changed to false
me._unwatch();
return;
}
if (me.frame) {
// check whether the frame is resized
if ((me.frame.clientWidth != me.width) ||
(me.frame.clientHeight != me.height)) {
me.requestReflow();
}
}
};
// TODO: automatically cleanup the event listener when the frame is deleted
util.addEventListener(window, 'resize', checkSize);
this.watchTimer = setInterval(checkSize, 1000);
};
/**
* Stop watching for a resize of the frame.
* @private
*/
RootPanel.prototype._unwatch = function () {
if (this.watchTimer) {
clearInterval(this.watchTimer);
this.watchTimer = undefined;
}
// TODO: remove event listener on window.resize
};
/**
* Set controller for this component, or remove current controller by passing
* null as parameter value.
* @param {Controller | null} controller
*/
RootPanel.prototype.setController = function setController (controller) {
this.controller = controller || null;
if (this.controller) {
this._registerListeners();
}
else {
this._unregisterListeners();
}
};
/**
* Register event emitters emitted by the rootpanel
* @private
*/
RootPanel.prototype._registerListeners = function () {
if (this.frame && this.controller && !this.hammer) {
this.hammer = Hammer(this.frame, {
prevent_default: true
});
for (var event in this.listeners) {
if (this.listeners.hasOwnProperty(event)) {
this.hammer.on(event, this.listeners[event]);
}
}
}
};
/**
* Unregister event emitters from the rootpanel
* @private
*/
RootPanel.prototype._unregisterListeners = function () {
if (this.hammer) {
for (var event in this.listeners) {
if (this.listeners.hasOwnProperty(event)) {
this.hammer.off(event, this.listeners[event]);
}
}
this.hammer = null;
}
};
/**
* A horizontal time axis
* @param {Component} parent
* @param {Component[]} [depends] Components on which this components depends
* (except for the parent)
* @param {Object} [options] See TimeAxis.setOptions for the available
* options.
* @constructor TimeAxis
* @extends Component
*/
function TimeAxis (parent, depends, options) {
this.id = util.randomUUID();
this.parent = parent;
this.depends = depends;
this.dom = {
majorLines: [],
majorTexts: [],
minorLines: [],
minorTexts: [],
redundant: {
majorLines: [],
majorTexts: [],
minorLines: [],
minorTexts: []
}
};
this.props = {
range: {
start: 0,
end: 0,
minimumStep: 0
},
lineTop: 0
};
this.options = options || {};
this.defaultOptions = {
orientation: 'bottom', // supported: 'top', 'bottom'
// TODO: implement timeaxis orientations 'left' and 'right'
showMinorLabels: true,
showMajorLabels: true
};
this.conversion = null;
this.range = null;
}
TimeAxis.prototype = new Component();
// TODO: comment options
TimeAxis.prototype.setOptions = Component.prototype.setOptions;
/**
* Set a range (start and end)
* @param {Range | Object} range A Range or an object containing start and end.
*/
TimeAxis.prototype.setRange = function (range) {
if (!(range instanceof Range) && (!range || !range.start || !range.end)) {
throw new TypeError('Range must be an instance of Range, ' +
'or an object containing start and end.');
}
this.range = range;
};
/**
* Convert a position on screen (pixels) to a datetime
* @param {int} x Position on the screen in pixels
* @return {Date} time The datetime the corresponds with given position x
*/
TimeAxis.prototype.toTime = function(x) {
var conversion = this.conversion;
return new Date(x / conversion.scale + conversion.offset);
};
/**
* Convert a datetime (Date object) into a position on the screen
* @param {Date} time A date
* @return {int} x The position on the screen in pixels which corresponds
* with the given date.
* @private
*/
TimeAxis.prototype.toScreen = function(time) {
var conversion = this.conversion;
return (time.valueOf() - conversion.offset) * conversion.scale;
};
/**
* Repaint the component
* @return {Boolean} changed
*/
TimeAxis.prototype.repaint = function () {
var changed = 0,
update = util.updateProperty,
asSize = util.option.asSize,
options = this.options,
orientation = this.getOption('orientation'),
props = this.props,
step = this.step;
var frame = this.frame;
if (!frame) {
frame = document.createElement('div');
this.frame = frame;
changed += 1;
}
frame.className = 'axis';
// TODO: custom className?
if (!frame.parentNode) {
if (!this.parent) {
throw new Error('Cannot repaint time axis: no parent attached');
}
var parentContainer = this.parent.getContainer();
if (!parentContainer) {
throw new Error('Cannot repaint time axis: parent has no container element');
}
parentContainer.appendChild(frame);
changed += 1;
}
var parent = frame.parentNode;
if (parent) {
var beforeChild = frame.nextSibling;
parent.removeChild(frame); // take frame offline while updating (is almost twice as fast)
var defaultTop = (orientation == 'bottom' && this.props.parentHeight && this.height) ?
(this.props.parentHeight - this.height) + 'px' :
'0px';
changed += update(frame.style, 'top', asSize(options.top, defaultTop));
changed += update(frame.style, 'left', asSize(options.left, '0px'));
changed += update(frame.style, 'width', asSize(options.width, '100%'));
changed += update(frame.style, 'height', asSize(options.height, this.height + 'px'));
// get characters width and height
this._repaintMeasureChars();
if (this.step) {
this._repaintStart();
step.first();
var xFirstMajorLabel = undefined;
var max = 0;
while (step.hasNext() && max < 1000) {
max++;
var cur = step.getCurrent(),
x = this.toScreen(cur),
isMajor = step.isMajor();
// TODO: lines must have a width, such that we can create css backgrounds
if (this.getOption('showMinorLabels')) {
this._repaintMinorText(x, step.getLabelMinor());
}
if (isMajor && this.getOption('showMajorLabels')) {
if (x > 0) {
if (xFirstMajorLabel == undefined) {
xFirstMajorLabel = x;
}
this._repaintMajorText(x, step.getLabelMajor());
}
this._repaintMajorLine(x);
}
else {
this._repaintMinorLine(x);
}
step.next();
}
// create a major label on the left when needed
if (this.getOption('showMajorLabels')) {
var leftTime = this.toTime(0),
leftText = step.getLabelMajor(leftTime),
widthText = leftText.length * (props.majorCharWidth || 10) + 10; // upper bound estimation
if (xFirstMajorLabel == undefined || widthText < xFirstMajorLabel) {
this._repaintMajorText(0, leftText);
}
}
this._repaintEnd();
}
this._repaintLine();
// put frame online again
if (beforeChild) {
parent.insertBefore(frame, beforeChild);
}
else {
parent.appendChild(frame)
}
}
return (changed > 0);
};
/**
* Start a repaint. Move all DOM elements to a redundant list, where they
* can be picked for re-use, or can be cleaned up in the end
* @private
*/
TimeAxis.prototype._repaintStart = function () {
var dom = this.dom,
redundant = dom.redundant;
redundant.majorLines = dom.majorLines;
redundant.majorTexts = dom.majorTexts;
redundant.minorLines = dom.minorLines;
redundant.minorTexts = dom.minorTexts;
dom.majorLines = [];
dom.majorTexts = [];
dom.minorLines = [];
dom.minorTexts = [];
};
/**
* End a repaint. Cleanup leftover DOM elements in the redundant list
* @private
*/
TimeAxis.prototype._repaintEnd = function () {
util.forEach(this.dom.redundant, function (arr) {
while (arr.length) {
var elem = arr.pop();
if (elem && elem.parentNode) {
elem.parentNode.removeChild(elem);
}
}
});
};
/**
* Create a minor label for the axis at position x
* @param {Number} x
* @param {String} text
* @private
*/
TimeAxis.prototype._repaintMinorText = function (x, text) {
// reuse redundant label
var label = this.dom.redundant.minorTexts.shift();
if (!label) {
// create new label
var content = document.createTextNode('');
label = document.createElement('div');
label.appendChild(content);
label.className = 'text minor';
this.frame.appendChild(label);
}
this.dom.minorTexts.push(label);
label.childNodes[0].nodeValue = text;
label.style.left = x + 'px';
label.style.top = this.props.minorLabelTop + 'px';
//label.title = title; // TODO: this is a heavy operation
};
/**
* Create a Major label for the axis at position x
* @param {Number} x
* @param {String} text
* @private
*/
TimeAxis.prototype._repaintMajorText = function (x, text) {
// reuse redundant label
var label = this.dom.redundant.majorTexts.shift();
if (!label) {
// create label
var content = document.createTextNode(text);
label = document.createElement('div');
label.className = 'text major';
label.appendChild(content);
this.frame.appendChild(label);
}
this.dom.majorTexts.push(label);
label.childNodes[0].nodeValue = text;
label.style.top = this.props.majorLabelTop + 'px';
label.style.left = x + 'px';
//label.title = title; // TODO: this is a heavy operation
};
/**
* Create a minor line for the axis at position x
* @param {Number} x
* @private
*/
TimeAxis.prototype._repaintMinorLine = function (x) {
// reuse redundant line
var line = this.dom.redundant.minorLines.shift();
if (!line) {
// create vertical line
line = document.createElement('div');
line.className = 'grid vertical minor';
this.frame.appendChild(line);
}
this.dom.minorLines.push(line);
var props = this.props;
line.style.top = props.minorLineTop + 'px';
line.style.height = props.minorLineHeight + 'px';
line.style.left = (x - props.minorLineWidth / 2) + 'px';
};
/**
* Create a Major line for the axis at position x
* @param {Number} x
* @private
*/
TimeAxis.prototype._repaintMajorLine = function (x) {
// reuse redundant line
var line = this.dom.redundant.majorLines.shift();
if (!line) {
// create vertical line
line = document.createElement('DIV');
line.className = 'grid vertical major';
this.frame.appendChild(line);
}
this.dom.majorLines.push(line);
var props = this.props;
line.style.top = props.majorLineTop + 'px';
line.style.left = (x - props.majorLineWidth / 2) + 'px';
line.style.height = props.majorLineHeight + 'px';
};
/**
* Repaint the horizontal line for the axis
* @private
*/
TimeAxis.prototype._repaintLine = function() {
var line = this.dom.line,
frame = this.frame,
options = this.options;
// line before all axis elements
if (this.getOption('showMinorLabels') || this.getOption('showMajorLabels')) {
if (line) {
// put this line at the end of all childs
frame.removeChild(line);
frame.appendChild(line);
}
else {
// create the axis line
line = document.createElement('div');
line.className = 'grid horizontal major';
frame.appendChild(line);
this.dom.line = line;
}
line.style.top = this.props.lineTop + 'px';
}
else {
if (line && line.parentElement) {
frame.removeChild(line.line);
delete this.dom.line;
}
}
};
/**
* Create characters used to determine the size of text on the axis
* @private
*/
TimeAxis.prototype._repaintMeasureChars = function () {
// calculate the width and height of a single character
// this is used to calculate the step size, and also the positioning of the
// axis
var dom = this.dom,
text;
if (!dom.measureCharMinor) {
text = document.createTextNode('0');
var measureCharMinor = document.createElement('DIV');
measureCharMinor.className = 'text minor measure';
measureCharMinor.appendChild(text);
this.frame.appendChild(measureCharMinor);
dom.measureCharMinor = measureCharMinor;
}
if (!dom.measureCharMajor) {
text = document.createTextNode('0');
var measureCharMajor = document.createElement('DIV');
measureCharMajor.className = 'text major measure';
measureCharMajor.appendChild(text);
this.frame.appendChild(measureCharMajor);
dom.measureCharMajor = measureCharMajor;
}
};
/**
* Reflow the component
* @return {Boolean} resized
*/
TimeAxis.prototype.reflow = function () {
var changed = 0,
update = util.updateProperty,
frame = this.frame,
range = this.range;
if (!range) {
throw new Error('Cannot repaint time axis: no range configured');
}
if (frame) {
changed += update(this, 'top', frame.offsetTop);
changed += update(this, 'left', frame.offsetLeft);
// calculate size of a character
var props = this.props,
showMinorLabels = this.getOption('showMinorLabels'),
showMajorLabels = this.getOption('showMajorLabels'),
measureCharMinor = this.dom.measureCharMinor,
measureCharMajor = this.dom.measureCharMajor;
if (measureCharMinor) {
props.minorCharHeight = measureCharMinor.clientHeight;
props.minorCharWidth = measureCharMinor.clientWidth;
}
if (measureCharMajor) {
props.majorCharHeight = measureCharMajor.clientHeight;
props.majorCharWidth = measureCharMajor.clientWidth;
}
var parentHeight = frame.parentNode ? frame.parentNode.offsetHeight : 0;
if (parentHeight != props.parentHeight) {
props.parentHeight = parentHeight;
changed += 1;
}
switch (this.getOption('orientation')) {
case 'bottom':
props.minorLabelHeight = showMinorLabels ? props.minorCharHeight : 0;
props.majorLabelHeight = showMajorLabels ? props.majorCharHeight : 0;
props.minorLabelTop = 0;
props.majorLabelTop = props.minorLabelTop + props.minorLabelHeight;
props.minorLineTop = -this.top;
props.minorLineHeight = Math.max(this.top + props.majorLabelHeight, 0);
props.minorLineWidth = 1; // TODO: really calculate width
props.majorLineTop = -this.top;
props.majorLineHeight = Math.max(this.top + props.minorLabelHeight + props.majorLabelHeight, 0);
props.majorLineWidth = 1; // TODO: really calculate width
props.lineTop = 0;
break;
case 'top':
props.minorLabelHeight = showMinorLabels ? props.minorCharHeight : 0;
props.majorLabelHeight = showMajorLabels ? props.majorCharHeight : 0;
props.majorLabelTop = 0;
props.minorLabelTop = props.majorLabelTop + props.majorLabelHeight;
props.minorLineTop = props.minorLabelTop;
props.minorLineHeight = Math.max(parentHeight - props.majorLabelHeight - this.top);
props.minorLineWidth = 1; // TODO: really calculate width
props.majorLineTop = 0;
props.majorLineHeight = Math.max(parentHeight - this.top);
props.majorLineWidth = 1; // TODO: really calculate width
props.lineTop = props.majorLabelHeight + props.minorLabelHeight;
break;
default:
throw new Error('Unkown orientation "' + this.getOption('orientation') + '"');
}
var height = props.minorLabelHeight + props.majorLabelHeight;
changed += update(this, 'width', frame.offsetWidth);
changed += update(this, 'height', height);
// calculate range and step
this._updateConversion();
var start = util.convert(range.start, 'Number'),
end = util.convert(range.end, 'Number'),
minimumStep = this.toTime((props.minorCharWidth || 10) * 5).valueOf()
-this.toTime(0).valueOf();
this.step = new TimeStep(new Date(start), new Date(end), minimumStep);
changed += update(props.range, 'start', start);
changed += update(props.range, 'end', end);
changed += update(props.range, 'minimumStep', minimumStep.valueOf());
}
return (changed > 0);
};
/**
* Calculate the scale and offset to convert a position on screen to the
* corresponding date and vice versa.
* After the method _updateConversion is executed once, the methods toTime
* and toScreen can be used.
* @private
*/
TimeAxis.prototype._updateConversion = function() {
var range = this.range;
if (!range) {
throw new Error('No range configured');
}
if (range.conversion) {
this.conversion = range.conversion(this.width);
}
else {
this.conversion = Range.conversion(range.start, range.end, this.width);
}
};
/**
* Snap a date to a rounded value.
* The snap intervals are dependent on the current scale and step.
* @param {Date} date the date to be snapped.
* @return {Date} snappedDate
*/
TimeAxis.prototype.snap = function snap (date) {
return this.step.snap(date);
};
/**
* A current time bar
* @param {Component} parent
* @param {Component[]} [depends] Components on which this components depends
* (except for the parent)
* @param {Object} [options] Available parameters:
* {Boolean} [showCurrentTime]
* @constructor CurrentTime
* @extends Component
*/
function CurrentTime (parent, depends, options) {
this.id = util.randomUUID();
this.parent = parent;
this.depends = depends;
this.options = options || {};
this.defaultOptions = {
showCurrentTime: false
};
}
CurrentTime.prototype = new Component();
CurrentTime.prototype.setOptions = Component.prototype.setOptions;
/**
* Get the container element of the bar, which can be used by a child to
* add its own widgets.
* @returns {HTMLElement} container
*/
CurrentTime.prototype.getContainer = function () {
return this.frame;
};
/**
* Repaint the component
* @return {Boolean} changed
*/
CurrentTime.prototype.repaint = function () {
var bar = this.frame,
parent = this.parent,
parentContainer = parent.parent.getContainer();
if (!parent) {
throw new Error('Cannot repaint bar: no parent attached');
}
if (!parentContainer) {
throw new Error('Cannot repaint bar: parent has no container element');
}
if (!this.getOption('showCurrentTime')) {
if (bar) {
parentContainer.removeChild(bar);
delete this.frame;
}
return false;
}
if (!bar) {
bar = document.createElement('div');
bar.className = 'currenttime';
bar.style.position = 'absolute';
bar.style.top = '0px';
bar.style.height = '100%';
parentContainer.appendChild(bar);
this.frame = bar;
}
if (!parent.conversion) {
parent._updateConversion();
}
var now = new Date();
var x = parent.toScreen(now);
bar.style.left = x + 'px';
bar.title = 'Current time: ' + now;
// start a timer to adjust for the new time
if (this.currentTimeTimer !== undefined) {
clearTimeout(this.currentTimeTimer);
delete this.currentTimeTimer;
}
var timeline = this;
var interval = 1 / parent.conversion.scale / 2;
if (interval < 30) {
interval = 30;
}
this.currentTimeTimer = setTimeout(function() {
timeline.repaint();
}, interval);
return false;
};
/**
* A custom time bar
* @param {Component} parent
* @param {Component[]} [depends] Components on which this components depends
* (except for the parent)
* @param {Object} [options] Available parameters:
* {Boolean} [showCustomTime]
* @constructor CustomTime
* @extends Component
*/
function CustomTime (parent, depends, options) {
this.id = util.randomUUID();
this.parent = parent;
this.depends = depends;
this.options = options || {};
this.defaultOptions = {
showCustomTime: false
};
this.customTime = new Date();
this.eventParams = {}; // stores state parameters while dragging the bar
}
CustomTime.prototype = new Component();
Emitter(CustomTime.prototype);
CustomTime.prototype.setOptions = Component.prototype.setOptions;
/**
* Get the container element of the bar, which can be used by a child to
* add its own widgets.
* @returns {HTMLElement} container
*/
CustomTime.prototype.getContainer = function () {
return this.frame;
};
/**
* Repaint the component
* @return {Boolean} changed
*/
CustomTime.prototype.repaint = function () {
var bar = this.frame,
parent = this.parent;
if (!parent) {
throw new Error('Cannot repaint bar: no parent attached');
}
var parentContainer = parent.parent.getContainer();
if (!parentContainer) {
throw new Error('Cannot repaint bar: parent has no container element');
}
if (!this.getOption('showCustomTime')) {
if (bar) {
parentContainer.removeChild(bar);
delete this.frame;
}
return false;
}
if (!bar) {
bar = document.createElement('div');
bar.className = 'customtime';
bar.style.position = 'absolute';
bar.style.top = '0px';
bar.style.height = '100%';
parentContainer.appendChild(bar);
var drag = document.createElement('div');
drag.style.position = 'relative';
drag.style.top = '0px';
drag.style.left = '-10px';
drag.style.height = '100%';
drag.style.width = '20px';
bar.appendChild(drag);
this.frame = bar;
// attach event listeners
this.hammer = Hammer(bar, {
prevent_default: true
});
this.hammer.on('dragstart', this._onDragStart.bind(this));
this.hammer.on('drag', this._onDrag.bind(this));
this.hammer.on('dragend', this._onDragEnd.bind(this));
}
if (!parent.conversion) {
parent._updateConversion();
}
var x = parent.toScreen(this.customTime);
bar.style.left = x + 'px';
bar.title = 'Time: ' + this.customTime;
return false;
};
/**
* Set custom time.
* @param {Date} time
*/
CustomTime.prototype.setCustomTime = function(time) {
this.customTime = new Date(time.valueOf());
this.repaint();
};
/**
* Retrieve the current custom time.
* @return {Date} customTime
*/
CustomTime.prototype.getCustomTime = function() {
return new Date(this.customTime.valueOf());
};
/**
* Start moving horizontally
* @param {Event} event
* @private
*/
CustomTime.prototype._onDragStart = function(event) {
this.eventParams.customTime = this.customTime;
event.stopPropagation();
event.preventDefault();
};
/**
* Perform moving operating.
* @param {Event} event
* @private
*/
CustomTime.prototype._onDrag = function (event) {
var deltaX = event.gesture.deltaX,
x = this.parent.toScreen(this.eventParams.customTime) + deltaX,
time = this.parent.toTime(x);
this.setCustomTime(time);
// fire a timechange event
if (this.controller) {
this.controller.emit('timechange', {
time: this.customTime
})
}
event.stopPropagation();
event.preventDefault();
};
/**
* Stop moving operating.
* @param {event} event
* @private
*/
CustomTime.prototype._onDragEnd = function (event) {
// fire a timechanged event
if (this.controller) {
this.controller.emit('timechanged', {
time: this.customTime
})
}
event.stopPropagation();
event.preventDefault();
};
/**
* An ItemSet holds a set of items and ranges which can be displayed in a
* range. The width is determined by the parent of the ItemSet, and the height
* is determined by the size of the items.
* @param {Component} parent
* @param {Component[]} [depends] Components on which this components depends
* (except for the parent)
* @param {Object} [options] See ItemSet.setOptions for the available
* options.
* @constructor ItemSet
* @extends Panel
*/
// TODO: improve performance by replacing all Array.forEach with a for loop
function ItemSet(parent, depends, options) {
this.id = util.randomUUID();
this.parent = parent;
this.depends = depends;
// event listeners
this.eventListeners = {
dragstart: this._onDragStart.bind(this),
drag: this._onDrag.bind(this),
dragend: this._onDragEnd.bind(this)
};
// one options object is shared by this itemset and all its items
this.options = options || {};
this.defaultOptions = {
type: 'box',
align: 'center',
orientation: 'bottom',
margin: {
axis: 20,
item: 10
},
padding: 5
};
this.dom = {};
var me = this;
this.itemsData = null; // DataSet
this.range = null; // Range or Object {start: number, end: number}
// data change listeners
this.listeners = {
'add': function (event, params, senderId) {
if (senderId != me.id) {
me._onAdd(params.items);
}
},
'update': function (event, params, senderId) {
if (senderId != me.id) {
me._onUpdate(params.items);
}
},
'remove': function (event, params, senderId) {
if (senderId != me.id) {
me._onRemove(params.items);
}
}
};
this.items = {}; // object with an Item for every data item
this.selection = []; // list with the ids of all selected nodes
this.queue = {}; // queue with id/actions: 'add', 'update', 'delete'
this.stack = new Stack(this, Object.create(this.options));
this.conversion = null;
this.touchParams = {}; // stores properties while dragging
// TODO: ItemSet should also attach event listeners for rangechange and rangechanged, like timeaxis
}
ItemSet.prototype = new Panel();
// available item types will be registered here
ItemSet.types = {
box: ItemBox,
range: ItemRange,
rangeoverflow: ItemRangeOverflow,
point: ItemPoint
};
/**
* Set options for the ItemSet. Existing options will be extended/overwritten.
* @param {Object} [options] The following options are available:
* {String | function} [className]
* class name for the itemset
* {String} [type]
* Default type for the items. Choose from 'box'
* (default), 'point', or 'range'. The default
* Style can be overwritten by individual items.
* {String} align
* Alignment for the items, only applicable for
* ItemBox. Choose 'center' (default), 'left', or
* 'right'.
* {String} orientation
* Orientation of the item set. Choose 'top' or
* 'bottom' (default).
* {Number} margin.axis
* Margin between the axis and the items in pixels.
* Default is 20.
* {Number} margin.item
* Margin between items in pixels. Default is 10.
* {Number} padding
* Padding of the contents of an item in pixels.
* Must correspond with the items css. Default is 5.
* {Function} snap
* Function to let items snap to nice dates when
* dragging items.
*/
ItemSet.prototype.setOptions = Component.prototype.setOptions;
/**
* Set controller for this component
* @param {Controller | null} controller
*/
ItemSet.prototype.setController = function setController (controller) {
var event;
// unregister old event listeners
if (this.controller) {
for (event in this.eventListeners) {
if (this.eventListeners.hasOwnProperty(event)) {
this.controller.off(event, this.eventListeners[event]);
}
}
}
this.controller = controller || null;
// register new event listeners
if (this.controller) {
for (event in this.eventListeners) {
if (this.eventListeners.hasOwnProperty(event)) {
this.controller.on(event, this.eventListeners[event]);
}
}
}
};
// attach event listeners for dragging items to the controller
(function (me) {
var _controller = null;
var _onDragStart = null;
var _onDrag = null;
var _onDragEnd = null;
Object.defineProperty(me, 'controller', {
get: function () {
return _controller;
},
set: function (controller) {
}
});
}) (this);
/**
* Set range (start and end).
* @param {Range | Object} range A Range or an object containing start and end.
*/
ItemSet.prototype.setRange = function setRange(range) {
if (!(range instanceof Range) && (!range || !range.start || !range.end)) {
throw new TypeError('Range must be an instance of Range, ' +
'or an object containing start and end.');
}
this.range = range;
};
/**
* Set selected items by their id. Replaces the current selection
* Unknown id's are silently ignored.
* @param {Array} [ids] An array with zero or more id's of the items to be
* selected. If ids is an empty array, all items will be
* unselected.
*/
ItemSet.prototype.setSelection = function setSelection(ids) {
var i, ii, id, item, selection;
if (ids) {
if (!Array.isArray(ids)) {
throw new TypeError('Array expected');
}
// unselect currently selected items
for (i = 0, ii = this.selection.length; i < ii; i++) {
id = this.selection[i];
item = this.items[id];
if (item) item.unselect();
}
// select items
this.selection = [];
for (i = 0, ii = ids.length; i < ii; i++) {
id = ids[i];
item = this.items[id];
if (item) {
this.selection.push(id);
item.select();
}
}
if (this.controller) {
this.requestRepaint();
}
}
};
/**
* Get the selected items by their id
* @return {Array} ids The ids of the selected items
*/
ItemSet.prototype.getSelection = function getSelection() {
return this.selection.concat([]);
};
/**
* Deselect a selected item
* @param {String | Number} id
* @private
*/
ItemSet.prototype._deselect = function _deselect(id) {
var selection = this.selection;
for (var i = 0, ii = selection.length; i < ii; i++) {
if (selection[i] == id) { // non-strict comparison!
selection.splice(i, 1);
break;
}
}
};
/**
* Repaint the component
* @return {Boolean} changed
*/
ItemSet.prototype.repaint = function repaint() {
var changed = 0,
update = util.updateProperty,
asSize = util.option.asSize,
options = this.options,
orientation = this.getOption('orientation'),
defaultOptions = this.defaultOptions,
frame = this.frame;
if (!frame) {
frame = document.createElement('div');
frame.className = 'itemset';
frame['timeline-itemset'] = this;
var className = options.className;
if (className) {
util.addClassName(frame, util.option.asString(className));
}
// create background panel
var background = document.createElement('div');
background.className = 'background';
frame.appendChild(background);
this.dom.background = background;
// create foreground panel
var foreground = document.createElement('div');
foreground.className = 'foreground';
frame.appendChild(foreground);
this.dom.foreground = foreground;
// create axis panel
var axis = document.createElement('div');
axis.className = 'itemset-axis';
//frame.appendChild(axis);
this.dom.axis = axis;
this.frame = frame;
changed += 1;
}
if (!this.parent) {
throw new Error('Cannot repaint itemset: no parent attached');
}
var parentContainer = this.parent.getContainer();
if (!parentContainer) {
throw new Error('Cannot repaint itemset: parent has no container element');
}
if (!frame.parentNode) {
parentContainer.appendChild(frame);
changed += 1;
}
if (!this.dom.axis.parentNode) {
parentContainer.appendChild(this.dom.axis);
changed += 1;
}
// reposition frame
changed += update(frame.style, 'left', asSize(options.left, '0px'));
changed += update(frame.style, 'top', asSize(options.top, '0px'));
changed += update(frame.style, 'width', asSize(options.width, '100%'));
changed += update(frame.style, 'height', asSize(options.height, this.height + 'px'));
// reposition axis
changed += update(this.dom.axis.style, 'left', asSize(options.left, '0px'));
changed += update(this.dom.axis.style, 'width', asSize(options.width, '100%'));
if (orientation == 'bottom') {
changed += update(this.dom.axis.style, 'top', (this.height + this.top) + 'px');
}
else { // orientation == 'top'
changed += update(this.dom.axis.style, 'top', this.top + 'px');
}
this._updateConversion();
var me = this,
queue = this.queue,
itemsData = this.itemsData,
items = this.items,
dataOptions = {
// TODO: cleanup
// fields: [(itemsData && itemsData.fieldId || 'id'), 'start', 'end', 'content', 'type', 'className']
};
// show/hide added/changed/removed items
for (var id in queue) {
if (queue.hasOwnProperty(id)) {
var entry = queue[id],
item = items[id],
action = entry.action;
//noinspection FallthroughInSwitchStatementJS
switch (action) {
case 'add':
case 'update':
var itemData = itemsData && itemsData.get(id, dataOptions);
if (itemData) {
var type = itemData.type ||
(itemData.start && itemData.end && 'range') ||
options.type ||
'box';
var constructor = ItemSet.types[type];
// TODO: how to handle items with invalid data? hide them and give a warning? or throw an error?
if (item) {
// update item
if (!constructor || !(item instanceof constructor)) {
// item type has changed, hide and delete the item
changed += item.hide();
item = null;
}
else {
item.data = itemData; // TODO: create a method item.setData ?
changed++;
}
}
if (!item) {
// create item
if (constructor) {
item = new constructor(me, itemData, options, defaultOptions);
item.id = entry.id; // we take entry.id, as id itself is stringified
changed++;
}
else {
throw new TypeError('Unknown item type "' + type + '"');
}
}
// force a repaint (not only a reposition)
item.repaint();
items[id] = item;
}
// update queue
delete queue[id];
break;
case 'remove':
if (item) {
// remove the item from the set selected items
if (item.selected) {
me._deselect(id);
}
// remove DOM of the item
changed += item.hide();
}
// update lists
delete items[id];
delete queue[id];
break;
default:
console.log('Error: unknown action "' + action + '"');
}
}
}
// reposition all items. Show items only when in the visible area
util.forEach(this.items, function (item) {
if (item.visible) {
changed += item.show();
item.reposition();
}
else {
changed += item.hide();
}
});
return (changed > 0);
};
/**
* Get the foreground container element
* @return {HTMLElement} foreground
*/
ItemSet.prototype.getForeground = function getForeground() {
return this.dom.foreground;
};
/**
* Get the background container element
* @return {HTMLElement} background
*/
ItemSet.prototype.getBackground = function getBackground() {
return this.dom.background;
};
/**
* Get the axis container element
* @return {HTMLElement} axis
*/
ItemSet.prototype.getAxis = function getAxis() {
return this.dom.axis;
};
/**
* Reflow the component
* @return {Boolean} resized
*/
ItemSet.prototype.reflow = function reflow () {
var changed = 0,
options = this.options,
marginAxis = (options.margin && 'axis' in options.margin) ? options.margin.axis : this.defaultOptions.margin.axis,
marginItem = (options.margin && 'item' in options.margin) ? options.margin.item : this.defaultOptions.margin.item,
update = util.updateProperty,
asNumber = util.option.asNumber,
asSize = util.option.asSize,
frame = this.frame;
if (frame) {
this._updateConversion();
util.forEach(this.items, function (item) {
changed += item.reflow();
});
// TODO: stack.update should be triggered via an event, in stack itself
// TODO: only update the stack when there are changed items
this.stack.update();
var maxHeight = asNumber(options.maxHeight);
var fixedHeight = (asSize(options.height) != null);
var height;
if (fixedHeight) {
height = frame.offsetHeight;
}
else {
// height is not specified, determine the height from the height and positioned items
var visibleItems = this.stack.ordered; // TODO: not so nice way to get the filtered items
if (visibleItems.length) {
var min = visibleItems[0].top;
var max = visibleItems[0].top + visibleItems[0].height;
util.forEach(visibleItems, function (item) {
min = Math.min(min, item.top);
max = Math.max(max, (item.top + item.height));
});
height = (max - min) + marginAxis + marginItem;
}
else {
height = marginAxis + marginItem;
}
}
if (maxHeight != null) {
height = Math.min(height, maxHeight);
}
changed += update(this, 'height', height);
// calculate height from items
changed += update(this, 'top', frame.offsetTop);
changed += update(this, 'left', frame.offsetLeft);
changed += update(this, 'width', frame.offsetWidth);
}
else {
changed += 1;
}
return (changed > 0);
};
/**
* Hide this component from the DOM
* @return {Boolean} changed
*/
ItemSet.prototype.hide = function hide() {
var changed = false;
// remove the DOM
if (this.frame && this.frame.parentNode) {
this.frame.parentNode.removeChild(this.frame);
changed = true;
}
if (this.dom.axis && this.dom.axis.parentNode) {
this.dom.axis.parentNode.removeChild(this.dom.axis);
changed = true;
}
return changed;
};
/**
* Set items
* @param {vis.DataSet | null} items
*/
ItemSet.prototype.setItems = function setItems(items) {
var me = this,
ids,
oldItemsData = this.itemsData;
// replace the dataset
if (!items) {
this.itemsData = null;
}
else if (items instanceof DataSet || items instanceof DataView) {
this.itemsData = items;
}
else {
throw new TypeError('Data must be an instance of DataSet');
}
if (oldItemsData) {
// unsubscribe from old dataset
util.forEach(this.listeners, function (callback, event) {
oldItemsData.unsubscribe(event, callback);
});
// remove all drawn items
ids = oldItemsData.getIds();
this._onRemove(ids);
}
if (this.itemsData) {
// subscribe to new dataset
var id = this.id;
util.forEach(this.listeners, function (callback, event) {
me.itemsData.on(event, callback, id);
});
// draw all new items
ids = this.itemsData.getIds();
this._onAdd(ids);
}
};
/**
* Get the current items items
* @returns {vis.DataSet | null}
*/
ItemSet.prototype.getItems = function getItems() {
return this.itemsData;
};
/**
* Remove an item by its id
* @param {String | Number} id
*/
ItemSet.prototype.removeItem = function removeItem (id) {
var item = this.itemsData.get(id),
dataset = this._myDataSet();
if (item) {
// confirm deletion
this.options.onRemove(item, function (item) {
if (item) {
dataset.remove(item);
}
});
}
};
/**
* Handle updated items
* @param {Number[]} ids
* @private
*/
ItemSet.prototype._onUpdate = function _onUpdate(ids) {
this._toQueue('update', ids);
};
/**
* Handle changed items
* @param {Number[]} ids
* @private
*/
ItemSet.prototype._onAdd = function _onAdd(ids) {
this._toQueue('add', ids);
};
/**
* Handle removed items
* @param {Number[]} ids
* @private
*/
ItemSet.prototype._onRemove = function _onRemove(ids) {
this._toQueue('remove', ids);
};
/**
* Put items in the queue to be added/updated/remove
* @param {String} action can be 'add', 'update', 'remove'
* @param {Number[]} ids
*/
ItemSet.prototype._toQueue = function _toQueue(action, ids) {
var queue = this.queue;
ids.forEach(function (id) {
queue[id] = {
id: id,
action: action
};
});
if (this.controller) {
//this.requestReflow();
this.requestRepaint();
}
};
/**
* Calculate the scale and offset to convert a position on screen to the
* corresponding date and vice versa.
* After the method _updateConversion is executed once, the methods toTime
* and toScreen can be used.
* @private
*/
ItemSet.prototype._updateConversion = function _updateConversion() {
var range = this.range;
if (!range) {
throw new Error('No range configured');
}
if (range.conversion) {
this.conversion = range.conversion(this.width);
}
else {
this.conversion = Range.conversion(range.start, range.end, this.width);
}
};
/**
* Convert a position on screen (pixels) to a datetime
* Before this method can be used, the method _updateConversion must be
* executed once.
* @param {int} x Position on the screen in pixels
* @return {Date} time The datetime the corresponds with given position x
*/
ItemSet.prototype.toTime = function toTime(x) {
var conversion = this.conversion;
return new Date(x / conversion.scale + conversion.offset);
};
/**
* Convert a datetime (Date object) into a position on the screen
* Before this method can be used, the method _updateConversion must be
* executed once.
* @param {Date} time A date
* @return {int} x The position on the screen in pixels which corresponds
* with the given date.
*/
ItemSet.prototype.toScreen = function toScreen(time) {
var conversion = this.conversion;
return (time.valueOf() - conversion.offset) * conversion.scale;
};
/**
* Start dragging the selected events
* @param {Event} event
* @private
*/
ItemSet.prototype._onDragStart = function (event) {
if (!this.options.editable) {
return;
}
var item = ItemSet.itemFromTarget(event),
me = this;
if (item && item.selected) {
var dragLeftItem = event.target.dragLeftItem;
var dragRightItem = event.target.dragRightItem;
if (dragLeftItem) {
this.touchParams.itemProps = [{
item: dragLeftItem,
start: item.data.start.valueOf()
}];
}
else if (dragRightItem) {
this.touchParams.itemProps = [{
item: dragRightItem,
end: item.data.end.valueOf()
}];
}
else {
this.touchParams.itemProps = this.getSelection().map(function (id) {
var item = me.items[id];
var props = {
item: item
};
if ('start' in item.data) {
props.start = item.data.start.valueOf()
}
if ('end' in item.data) {
props.end = item.data.end.valueOf()
}
return props;
});
}
event.stopPropagation();
}
};
/**
* Drag selected items
* @param {Event} event
* @private
*/
ItemSet.prototype._onDrag = function (event) {
if (this.touchParams.itemProps) {
var snap = this.options.snap || null,
deltaX = event.gesture.deltaX,
offset = deltaX / this.conversion.scale;
// move
this.touchParams.itemProps.forEach(function (props) {
if ('start' in props) {
var start = new Date(props.start + offset);
props.item.data.start = snap ? snap(start) : start;
}
if ('end' in props) {
var end = new Date(props.end + offset);
props.item.data.end = snap ? snap(end) : end;
}
});
// TODO: implement onMoving handler
// TODO: implement dragging from one group to another
this.requestReflow();
event.stopPropagation();
}
};
/**
* End of dragging selected items
* @param {Event} event
* @private
*/
ItemSet.prototype._onDragEnd = function (event) {
if (this.touchParams.itemProps) {
// prepare a change set for the changed items
var changes = [],
me = this,
dataset = this._myDataSet(),
type;
this.touchParams.itemProps.forEach(function (props) {
var id = props.item.id,
item = me.itemsData.get(id);
var changed = false;
if ('start' in props.item.data) {
changed = (props.start != props.item.data.start.valueOf());
item.start = util.convert(props.item.data.start, dataset.convert['start']);
}
if ('end' in props.item.data) {
changed = changed || (props.end != props.item.data.end.valueOf());
item.end = util.convert(props.item.data.end, dataset.convert['end']);
}
// only apply changes when start or end is actually changed
if (changed) {
me.options.onMove(item, function (item) {
if (item) {
// apply changes
changes.push(item);
}
else {
// restore original values
if ('start' in props) props.item.data.start = props.start;
if ('end' in props) props.item.data.end = props.end;
me.requestReflow();
}
});
}
});
this.touchParams.itemProps = null;
// apply the changes to the data (if there are changes)
if (changes.length) {
dataset.update(changes);
}
event.stopPropagation();
}
};
/**
* Find an item from an event target:
* searches for the attribute 'timeline-item' in the event target's element tree
* @param {Event} event
* @return {Item | null} item
*/
ItemSet.itemFromTarget = function itemFromTarget (event) {
var target = event.target;
while (target) {
if (target.hasOwnProperty('timeline-item')) {
return target['timeline-item'];
}
target = target.parentNode;
}
return null;
};
/**
* Find the ItemSet from an event target:
* searches for the attribute 'timeline-itemset' in the event target's element tree
* @param {Event} event
* @return {ItemSet | null} item
*/
ItemSet.itemSetFromTarget = function itemSetFromTarget (event) {
var target = event.target;
while (target) {
if (target.hasOwnProperty('timeline-itemset')) {
return target['timeline-itemset'];
}
target = target.parentNode;
}
return null;
};
/**
* Find the DataSet to which this ItemSet is connected
* @returns {null | DataSet} dataset
* @private
*/
ItemSet.prototype._myDataSet = function _myDataSet() {
// find the root DataSet
var dataset = this.itemsData;
while (dataset instanceof DataView) {
dataset = dataset.data;
}
return dataset;
};
/**
* @constructor Item
* @param {ItemSet} parent
* @param {Object} data Object containing (optional) parameters type,
* start, end, content, group, className.
* @param {Object} [options] Options to set initial property values
* @param {Object} [defaultOptions] default options
* // TODO: describe available options
*/
function Item (parent, data, options, defaultOptions) {
this.parent = parent;
this.data = data;
this.dom = null;
this.options = options || {};
this.defaultOptions = defaultOptions || {};
this.selected = false;
this.visible = false;
this.top = 0;
this.left = 0;
this.width = 0;
this.height = 0;
this.offset = 0;
}
/**
* Select current item
*/
Item.prototype.select = function select() {
this.selected = true;
if (this.visible) this.repaint();
};
/**
* Unselect current item
*/
Item.prototype.unselect = function unselect() {
this.selected = false;
if (this.visible) this.repaint();
};
/**
* Show the Item in the DOM (when not already visible)
* @return {Boolean} changed
*/
Item.prototype.show = function show() {
return false;
};
/**
* Hide the Item from the DOM (when visible)
* @return {Boolean} changed
*/
Item.prototype.hide = function hide() {
return false;
};
/**
* Repaint the item
* @return {Boolean} changed
*/
Item.prototype.repaint = function repaint() {
// should be implemented by the item
return false;
};
/**
* Reflow the item
* @return {Boolean} resized
*/
Item.prototype.reflow = function reflow() {
// should be implemented by the item
return false;
};
/**
* Give the item a display offset in pixels
* @param {Number} offset Offset on screen in pixels
*/
Item.prototype.setOffset = function setOffset(offset) {
this.offset = offset;
};
/**
* Repaint a delete button on the top right of the item when the item is selected
* @param {HTMLElement} anchor
* @private
*/
Item.prototype._repaintDeleteButton = function (anchor) {
if (this.selected && this.options.editable && !this.dom.deleteButton) {
// create and show button
var parent = this.parent;
var id = this.id;
var deleteButton = document.createElement('div');
deleteButton.className = 'delete';
deleteButton.title = 'Delete this item';
Hammer(deleteButton, {
preventDefault: true
}).on('tap', function (event) {
parent.removeItem(id);
event.stopPropagation();
});
anchor.appendChild(deleteButton);
this.dom.deleteButton = deleteButton;
}
else if (!this.selected && this.dom.deleteButton) {
// remove button
if (this.dom.deleteButton.parentNode) {
this.dom.deleteButton.parentNode.removeChild(this.dom.deleteButton);
}
this.dom.deleteButton = null;
}
};
/**
* @constructor ItemBox
* @extends Item
* @param {ItemSet} parent
* @param {Object} data Object containing parameters start
* content, className.
* @param {Object} [options] Options to set initial property values
* @param {Object} [defaultOptions] default options
* // TODO: describe available options
*/
function ItemBox (parent, data, options, defaultOptions) {
this.props = {
dot: {
left: 0,
top: 0,
width: 0,
height: 0
},
line: {
top: 0,
left: 0,
width: 0,
height: 0
}
};
Item.call(this, parent, data, options, defaultOptions);
}
ItemBox.prototype = new Item (null, null);
/**
* Repaint the item
* @return {Boolean} changed
*/
ItemBox.prototype.repaint = function repaint() {
// TODO: make an efficient repaint
var changed = false;
var dom = this.dom;
if (!dom) {
this._create();
dom = this.dom;
changed = true;
}
if (dom) {
if (!this.parent) {
throw new Error('Cannot repaint item: no parent attached');
}
if (!dom.box.parentNode) {
var foreground = this.parent.getForeground();
if (!foreground) {
throw new Error('Cannot repaint time axis: ' +
'parent has no foreground container element');
}
foreground.appendChild(dom.box);
changed = true;
}
if (!dom.line.parentNode) {
var background = this.parent.getBackground();
if (!background) {
throw new Error('Cannot repaint time axis: ' +
'parent has no background container element');
}
background.appendChild(dom.line);
changed = true;
}
if (!dom.dot.parentNode) {
var axis = this.parent.getAxis();
if (!background) {
throw new Error('Cannot repaint time axis: ' +
'parent has no axis container element');
}
axis.appendChild(dom.dot);
changed = true;
}
this._repaintDeleteButton(dom.box);
// update contents
if (this.data.content != this.content) {
this.content = this.data.content;
if (this.content instanceof Element) {
dom.content.innerHTML = '';
dom.content.appendChild(this.content);
}
else if (this.data.content != undefined) {
dom.content.innerHTML = this.content;
}
else {
throw new Error('Property "content" missing in item ' + this.data.id);
}
changed = true;
}
// update class
var className = (this.data.className? ' ' + this.data.className : '') +
(this.selected ? ' selected' : '');
if (this.className != className) {
this.className = className;
dom.box.className = 'item box' + className;
dom.line.className = 'item line' + className;
dom.dot.className = 'item dot' + className;
changed = true;
}
}
return changed;
};
/**
* Show the item in the DOM (when not already visible). The items DOM will
* be created when needed.
* @return {Boolean} changed
*/
ItemBox.prototype.show = function show() {
if (!this.dom || !this.dom.box.parentNode) {
return this.repaint();
}
else {
return false;
}
};
/**
* Hide the item from the DOM (when visible)
* @return {Boolean} changed
*/
ItemBox.prototype.hide = function hide() {
var changed = false,
dom = this.dom;
if (dom) {
if (dom.box.parentNode) {
dom.box.parentNode.removeChild(dom.box);
changed = true;
}
if (dom.line.parentNode) {
dom.line.parentNode.removeChild(dom.line);
}
if (dom.dot.parentNode) {
dom.dot.parentNode.removeChild(dom.dot);
}
}
return changed;
};
/**
* Reflow the item: calculate its actual size and position from the DOM
* @return {boolean} resized returns true if the axis is resized
* @override
*/
ItemBox.prototype.reflow = function reflow() {
var changed = 0,
update,
dom,
props,
options,
margin,
start,
align,
orientation,
top,
left,
data,
range;
if (this.data.start == undefined) {
throw new Error('Property "start" missing in item ' + this.data.id);
}
data = this.data;
range = this.parent && this.parent.range;
if (data && range) {
// TODO: account for the width of the item
var interval = (range.end - range.start);
this.visible = (data.start > range.start - interval) && (data.start < range.end + interval);
}
else {
this.visible = false;
}
if (this.visible) {
dom = this.dom;
if (dom) {
update = util.updateProperty;
props = this.props;
options = this.options;
start = this.parent.toScreen(this.data.start) + this.offset;
align = options.align || this.defaultOptions.align;
margin = options.margin && options.margin.axis || this.defaultOptions.margin.axis;
orientation = options.orientation || this.defaultOptions.orientation;
changed += update(props.dot, 'height', dom.dot.offsetHeight);
changed += update(props.dot, 'width', dom.dot.offsetWidth);
changed += update(props.line, 'width', dom.line.offsetWidth);
changed += update(props.line, 'height', dom.line.offsetHeight);
changed += update(props.line, 'top', dom.line.offsetTop);
changed += update(this, 'width', dom.box.offsetWidth);
changed += update(this, 'height', dom.box.offsetHeight);
if (align == 'right') {
left = start - this.width;
}
else if (align == 'left') {
left = start;
}
else {
// default or 'center'
left = start - this.width / 2;
}
changed += update(this, 'left', left);
changed += update(props.line, 'left', start - props.line.width / 2);
changed += update(props.dot, 'left', start - props.dot.width / 2);
changed += update(props.dot, 'top', -props.dot.height / 2);
if (orientation == 'top') {
top = margin;
changed += update(this, 'top', top);
}
else {
// default or 'bottom'
var parentHeight = this.parent.height;
top = parentHeight - this.height - margin;
changed += update(this, 'top', top);
}
}
else {
changed += 1;
}
}
return (changed > 0);
};
/**
* Create an items DOM
* @private
*/
ItemBox.prototype._create = function _create() {
var dom = this.dom;
if (!dom) {
this.dom = dom = {};
// create the box
dom.box = document.createElement('DIV');
// className is updated in repaint()
// contents box (inside the background box). used for making margins
dom.content = document.createElement('DIV');
dom.content.className = 'content';
dom.box.appendChild(dom.content);
// line to axis
dom.line = document.createElement('DIV');
dom.line.className = 'line';
// dot on axis
dom.dot = document.createElement('DIV');
dom.dot.className = 'dot';
// attach this item as attribute
dom.box['timeline-item'] = this;
}
};
/**
* Reposition the item, recalculate its left, top, and width, using the current
* range and size of the items itemset
* @override
*/
ItemBox.prototype.reposition = function reposition() {
var dom = this.dom,
props = this.props,
orientation = this.options.orientation || this.defaultOptions.orientation;
if (dom) {
var box = dom.box,
line = dom.line,
dot = dom.dot;
box.style.left = this.left + 'px';
box.style.top = this.top + 'px';
line.style.left = props.line.left + 'px';
if (orientation == 'top') {
line.style.top = 0 + 'px';
line.style.height = this.top + 'px';
}
else {
// orientation 'bottom'
line.style.top = (this.top + this.height) + 'px';
line.style.height = Math.max(this.parent.height - this.top - this.height +
this.props.dot.height / 2, 0) + 'px';
}
dot.style.left = props.dot.left + 'px';
dot.style.top = props.dot.top + 'px';
}
};
/**
* @constructor ItemPoint
* @extends Item
* @param {ItemSet} parent
* @param {Object} data Object containing parameters start
* content, className.
* @param {Object} [options] Options to set initial property values
* @param {Object} [defaultOptions] default options
* // TODO: describe available options
*/
function ItemPoint (parent, data, options, defaultOptions) {
this.props = {
dot: {
top: 0,
width: 0,
height: 0
},
content: {
height: 0,
marginLeft: 0
}
};
Item.call(this, parent, data, options, defaultOptions);
}
ItemPoint.prototype = new Item (null, null);
/**
* Repaint the item
* @return {Boolean} changed
*/
ItemPoint.prototype.repaint = function repaint() {
// TODO: make an efficient repaint
var changed = false;
var dom = this.dom;
if (!dom) {
this._create();
dom = this.dom;
changed = true;
}
if (dom) {
if (!this.parent) {
throw new Error('Cannot repaint item: no parent attached');
}
var foreground = this.parent.getForeground();
if (!foreground) {
throw new Error('Cannot repaint time axis: ' +
'parent has no foreground container element');
}
if (!dom.point.parentNode) {
foreground.appendChild(dom.point);
foreground.appendChild(dom.point);
changed = true;
}
// update contents
if (this.data.content != this.content) {
this.content = this.data.content;
if (this.content instanceof Element) {
dom.content.innerHTML = '';
dom.content.appendChild(this.content);
}
else if (this.data.content != undefined) {
dom.content.innerHTML = this.content;
}
else {
throw new Error('Property "content" missing in item ' + this.data.id);
}
changed = true;
}
this._repaintDeleteButton(dom.point);
// update class
var className = (this.data.className? ' ' + this.data.className : '') +
(this.selected ? ' selected' : '');
if (this.className != className) {
this.className = className;
dom.point.className = 'item point' + className;
changed = true;
}
}
return changed;
};
/**
* Show the item in the DOM (when not already visible). The items DOM will
* be created when needed.
* @return {Boolean} changed
*/
ItemPoint.prototype.show = function show() {
if (!this.dom || !this.dom.point.parentNode) {
return this.repaint();
}
else {
return false;
}
};
/**
* Hide the item from the DOM (when visible)
* @return {Boolean} changed
*/
ItemPoint.prototype.hide = function hide() {
var changed = false,
dom = this.dom;
if (dom) {
if (dom.point.parentNode) {
dom.point.parentNode.removeChild(dom.point);
changed = true;
}
}
return changed;
};
/**
* Reflow the item: calculate its actual size from the DOM
* @return {boolean} resized returns true if the axis is resized
* @override
*/
ItemPoint.prototype.reflow = function reflow() {
var changed = 0,
update,
dom,
props,
options,
margin,
orientation,
start,
top,
data,
range;
if (this.data.start == undefined) {
throw new Error('Property "start" missing in item ' + this.data.id);
}
data = this.data;
range = this.parent && this.parent.range;
if (data && range) {
// TODO: account for the width of the item
var interval = (range.end - range.start);
this.visible = (data.start > range.start - interval) && (data.start < range.end);
}
else {
this.visible = false;
}
if (this.visible) {
dom = this.dom;
if (dom) {
update = util.updateProperty;
props = this.props;
options = this.options;
orientation = options.orientation || this.defaultOptions.orientation;
margin = options.margin && options.margin.axis || this.defaultOptions.margin.axis;
start = this.parent.toScreen(this.data.start) + this.offset;
changed += update(this, 'width', dom.point.offsetWidth);
changed += update(this, 'height', dom.point.offsetHeight);
changed += update(props.dot, 'width', dom.dot.offsetWidth);
changed += update(props.dot, 'height', dom.dot.offsetHeight);
changed += update(props.content, 'height', dom.content.offsetHeight);
if (orientation == 'top') {
top = margin;
}
else {
// default or 'bottom'
var parentHeight = this.parent.height;
top = Math.max(parentHeight - this.height - margin, 0);
}
changed += update(this, 'top', top);
changed += update(this, 'left', start - props.dot.width / 2);
changed += update(props.content, 'marginLeft', 1.5 * props.dot.width);
//changed += update(props.content, 'marginRight', 0.5 * props.dot.width); // TODO
changed += update(props.dot, 'top', (this.height - props.dot.height) / 2);
}
else {
changed += 1;
}
}
return (changed > 0);
};
/**
* Create an items DOM
* @private
*/
ItemPoint.prototype._create = function _create() {
var dom = this.dom;
if (!dom) {
this.dom = dom = {};
// background box
dom.point = document.createElement('div');
// className is updated in repaint()
// contents box, right from the dot
dom.content = document.createElement('div');
dom.content.className = 'content';
dom.point.appendChild(dom.content);
// dot at start
dom.dot = document.createElement('div');
dom.dot.className = 'dot';
dom.point.appendChild(dom.dot);
// attach this item as attribute
dom.point['timeline-item'] = this;
}
};
/**
* Reposition the item, recalculate its left, top, and width, using the current
* range and size of the items itemset
* @override
*/
ItemPoint.prototype.reposition = function reposition() {
var dom = this.dom,
props = this.props;
if (dom) {
dom.point.style.top = this.top + 'px';
dom.point.style.left = this.left + 'px';
dom.content.style.marginLeft = props.content.marginLeft + 'px';
//dom.content.style.marginRight = props.content.marginRight + 'px'; // TODO
dom.dot.style.top = props.dot.top + 'px';
}
};
/**
* @constructor ItemRange
* @extends Item
* @param {ItemSet} parent
* @param {Object} data Object containing parameters start, end
* content, className.
* @param {Object} [options] Options to set initial property values
* @param {Object} [defaultOptions] default options
* // TODO: describe available options
*/
function ItemRange (parent, data, options, defaultOptions) {
this.props = {
content: {
left: 0,
width: 0
}
};
Item.call(this, parent, data, options, defaultOptions);
}
ItemRange.prototype = new Item (null, null);
/**
* Repaint the item
* @return {Boolean} changed
*/
ItemRange.prototype.repaint = function repaint() {
// TODO: make an efficient repaint
var changed = false;
var dom = this.dom;
if (!dom) {
this._create();
dom = this.dom;
changed = true;
}
if (dom) {
if (!this.parent) {
throw new Error('Cannot repaint item: no parent attached');
}
var foreground = this.parent.getForeground();
if (!foreground) {
throw new Error('Cannot repaint time axis: ' +
'parent has no foreground container element');
}
if (!dom.box.parentNode) {
foreground.appendChild(dom.box);
changed = true;
}
// update content
if (this.data.content != this.content) {
this.content = this.data.content;
if (this.content instanceof Element) {
dom.content.innerHTML = '';
dom.content.appendChild(this.content);
}
else if (this.data.content != undefined) {
dom.content.innerHTML = this.content;
}
else {
throw new Error('Property "content" missing in item ' + this.data.id);
}
changed = true;
}
this._repaintDeleteButton(dom.box);
this._repaintDragLeft();
this._repaintDragRight();
// update class
var className = (this.data.className ? (' ' + this.data.className) : '') +
(this.selected ? ' selected' : '');
if (this.className != className) {
this.className = className;
dom.box.className = 'item range' + className;
changed = true;
}
}
return changed;
};
/**
* Show the item in the DOM (when not already visible). The items DOM will
* be created when needed.
* @return {Boolean} changed
*/
ItemRange.prototype.show = function show() {
if (!this.dom || !this.dom.box.parentNode) {
return this.repaint();
}
else {
return false;
}
};
/**
* Hide the item from the DOM (when visible)
* @return {Boolean} changed
*/
ItemRange.prototype.hide = function hide() {
var changed = false,
dom = this.dom;
if (dom) {
if (dom.box.parentNode) {
dom.box.parentNode.removeChild(dom.box);
changed = true;
}
}
return changed;
};
/**
* Reflow the item: calculate its actual size from the DOM
* @return {boolean} resized returns true if the axis is resized
* @override
*/
ItemRange.prototype.reflow = function reflow() {
var changed = 0,
dom,
props,
options,
margin,
padding,
parent,
start,
end,
data,
range,
update,
box,
parentWidth,
contentLeft,
orientation,
top;
if (this.data.start == undefined) {
throw new Error('Property "start" missing in item ' + this.data.id);
}
if (this.data.end == undefined) {
throw new Error('Property "end" missing in item ' + this.data.id);
}
data = this.data;
range = this.parent && this.parent.range;
if (data && range) {
// TODO: account for the width of the item. Take some margin
this.visible = (data.start < range.end) && (data.end > range.start);
}
else {
this.visible = false;
}
if (this.visible) {
dom = this.dom;
if (dom) {
props = this.props;
options = this.options;
parent = this.parent;
start = parent.toScreen(this.data.start) + this.offset;
end = parent.toScreen(this.data.end) + this.offset;
update = util.updateProperty;
box = dom.box;
parentWidth = parent.width;
orientation = options.orientation || this.defaultOptions.orientation;
margin = options.margin && options.margin.axis || this.defaultOptions.margin.axis;
padding = options.padding || this.defaultOptions.padding;
changed += update(props.content, 'width', dom.content.offsetWidth);
changed += update(this, 'height', box.offsetHeight);
// limit the width of the this, as browsers cannot draw very wide divs
if (start < -parentWidth) {
start = -parentWidth;
}
if (end > 2 * parentWidth) {
end = 2 * parentWidth;
}
// when range exceeds left of the window, position the contents at the left of the visible area
if (start < 0) {
contentLeft = Math.min(-start,
(end - start - props.content.width - 2 * padding));
// TODO: remove the need for options.padding. it's terrible.
}
else {
contentLeft = 0;
}
changed += update(props.content, 'left', contentLeft);
if (orientation == 'top') {
top = margin;
changed += update(this, 'top', top);
}
else {
// default or 'bottom'
top = parent.height - this.height - margin;
changed += update(this, 'top', top);
}
changed += update(this, 'left', start);
changed += update(this, 'width', Math.max(end - start, 1)); // TODO: reckon with border width;
}
else {
changed += 1;
}
}
return (changed > 0);
};
/**
* Create an items DOM
* @private
*/
ItemRange.prototype._create = function _create() {
var dom = this.dom;
if (!dom) {
this.dom = dom = {};
// background box
dom.box = document.createElement('div');
// className is updated in repaint()
// contents box
dom.content = document.createElement('div');
dom.content.className = 'content';
dom.box.appendChild(dom.content);
// attach this item as attribute
dom.box['timeline-item'] = this;
}
};
/**
* Reposition the item, recalculate its left, top, and width, using the current
* range and size of the items itemset
* @override
*/
ItemRange.prototype.reposition = function reposition() {
var dom = this.dom,
props = this.props;
if (dom) {
dom.box.style.top = this.top + 'px';
dom.box.style.left = this.left + 'px';
dom.box.style.width = this.width + 'px';
dom.content.style.left = props.content.left + 'px';
}
};
/**
* Repaint a drag area on the left side of the range when the range is selected
* @private
*/
ItemRange.prototype._repaintDragLeft = function () {
if (this.selected && this.options.editable && !this.dom.dragLeft) {
// create and show drag area
var dragLeft = document.createElement('div');
dragLeft.className = 'drag-left';
dragLeft.dragLeftItem = this;
// TODO: this should be redundant?
Hammer(dragLeft, {
preventDefault: true
}).on('drag', function () {
//console.log('drag left')
});
this.dom.box.appendChild(dragLeft);
this.dom.dragLeft = dragLeft;
}
else if (!this.selected && this.dom.dragLeft) {
// delete drag area
if (this.dom.dragLeft.parentNode) {
this.dom.dragLeft.parentNode.removeChild(this.dom.dragLeft);
}
this.dom.dragLeft = null;
}
};
/**
* Repaint a drag area on the right side of the range when the range is selected
* @private
*/
ItemRange.prototype._repaintDragRight = function () {
if (this.selected && this.options.editable && !this.dom.dragRight) {
// create and show drag area
var dragRight = document.createElement('div');
dragRight.className = 'drag-right';
dragRight.dragRightItem = this;
// TODO: this should be redundant?
Hammer(dragRight, {
preventDefault: true
}).on('drag', function () {
//console.log('drag right')
});
this.dom.box.appendChild(dragRight);
this.dom.dragRight = dragRight;
}
else if (!this.selected && this.dom.dragRight) {
// delete drag area
if (this.dom.dragRight.parentNode) {
this.dom.dragRight.parentNode.removeChild(this.dom.dragRight);
}
this.dom.dragRight = null;
}
};
/**
* @constructor ItemRangeOverflow
* @extends ItemRange
* @param {ItemSet} parent
* @param {Object} data Object containing parameters start, end
* content, className.
* @param {Object} [options] Options to set initial property values
* @param {Object} [defaultOptions] default options
* // TODO: describe available options
*/
function ItemRangeOverflow (parent, data, options, defaultOptions) {
this.props = {
content: {
left: 0,
width: 0
}
};
// define a private property _width, which is the with of the range box
// adhering to the ranges start and end date. The property width has a
// getter which returns the max of border width and content width
this._width = 0;
Object.defineProperty(this, 'width', {
get: function () {
return (this.props.content && this._width < this.props.content.width) ?
this.props.content.width :
this._width;
},
set: function (width) {
this._width = width;
}
});
ItemRange.call(this, parent, data, options, defaultOptions);
}
ItemRangeOverflow.prototype = new ItemRange (null, null);
/**
* Repaint the item
* @return {Boolean} changed
*/
ItemRangeOverflow.prototype.repaint = function repaint() {
// TODO: make an efficient repaint
var changed = false;
var dom = this.dom;
if (!dom) {
this._create();
dom = this.dom;
changed = true;
}
if (dom) {
if (!this.parent) {
throw new Error('Cannot repaint item: no parent attached');
}
var foreground = this.parent.getForeground();
if (!foreground) {
throw new Error('Cannot repaint time axis: ' +
'parent has no foreground container element');
}
if (!dom.box.parentNode) {
foreground.appendChild(dom.box);
changed = true;
}
// update content
if (this.data.content != this.content) {
this.content = this.data.content;
if (this.content instanceof Element) {
dom.content.innerHTML = '';
dom.content.appendChild(this.content);
}
else if (this.data.content != undefined) {
dom.content.innerHTML = this.content;
}
else {
throw new Error('Property "content" missing in item ' + this.id);
}
changed = true;
}
this._repaintDeleteButton(dom.box);
this._repaintDragLeft();
this._repaintDragRight();
// update class
var className = (this.data.className? ' ' + this.data.className : '') +
(this.selected ? ' selected' : '');
if (this.className != className) {
this.className = className;
dom.box.className = 'item rangeoverflow' + className;
changed = true;
}
}
return changed;
};
/**
* Reposition the item, recalculate its left, top, and width, using the current
* range and size of the items itemset
* @override
*/
ItemRangeOverflow.prototype.reposition = function reposition() {
var dom = this.dom,
props = this.props;
if (dom) {
dom.box.style.top = this.top + 'px';
dom.box.style.left = this.left + 'px';
dom.box.style.width = this._width + 'px';
dom.content.style.left = props.content.left + 'px';
}
};
/**
* @constructor Group
* @param {GroupSet} parent
* @param {Number | String} groupId
* @param {Object} [options] Options to set initial property values
* // TODO: describe available options
* @extends Component
*/
function Group (parent, groupId, options) {
this.id = util.randomUUID();
this.parent = parent;
this.groupId = groupId;
this.itemset = null; // ItemSet
this.options = options || {};
this.options.top = 0;
this.props = {
label: {
width: 0,
height: 0
}
};
this.top = 0;
this.left = 0;
this.width = 0;
this.height = 0;
}
Group.prototype = new Component();
// TODO: comment
Group.prototype.setOptions = Component.prototype.setOptions;
/**
* Get the container element of the panel, which can be used by a child to
* add its own widgets.
* @returns {HTMLElement} container
*/
Group.prototype.getContainer = function () {
return this.parent.getContainer();
};
/**
* Set item set for the group. The group will create a view on the itemset,
* filtered by the groups id.
* @param {DataSet | DataView} items
*/
Group.prototype.setItems = function setItems(items) {
if (this.itemset) {
// remove current item set
this.itemset.hide();
this.itemset.setItems();
this.parent.controller.remove(this.itemset);
this.itemset = null;
}
if (items) {
var groupId = this.groupId;
var itemsetOptions = Object.create(this.options);
this.itemset = new ItemSet(this, null, itemsetOptions);
this.itemset.setRange(this.parent.range);
this.view = new DataView(items, {
filter: function (item) {
return item.group == groupId;
}
});
this.itemset.setItems(this.view);
this.parent.controller.add(this.itemset);
}
};
/**
* Set selected items by their id. Replaces the current selection.
* Unknown id's are silently ignored.
* @param {Array} [ids] An array with zero or more id's of the items to be
* selected. If ids is an empty array, all items will be
* unselected.
*/
Group.prototype.setSelection = function setSelection(ids) {
if (this.itemset) this.itemset.setSelection(ids);
};
/**
* Get the selected items by their id
* @return {Array} ids The ids of the selected items
*/
Group.prototype.getSelection = function getSelection() {
return this.itemset ? this.itemset.getSelection() : [];
};
/**
* Repaint the item
* @return {Boolean} changed
*/
Group.prototype.repaint = function repaint() {
return false;
};
/**
* Reflow the item
* @return {Boolean} resized
*/
Group.prototype.reflow = function reflow() {
var changed = 0,
update = util.updateProperty;
changed += update(this, 'top', this.itemset ? this.itemset.top : 0);
changed += update(this, 'height', this.itemset ? this.itemset.height : 0);
// TODO: reckon with the height of the group label
if (this.label) {
var inner = this.label.firstChild;
changed += update(this.props.label, 'width', inner.clientWidth);
changed += update(this.props.label, 'height', inner.clientHeight);
}
else {
changed += update(this.props.label, 'width', 0);
changed += update(this.props.label, 'height', 0);
}
return (changed > 0);
};
/**
* An GroupSet holds a set of groups
* @param {Component} parent
* @param {Component[]} [depends] Components on which this components depends
* (except for the parent)
* @param {Object} [options] See GroupSet.setOptions for the available
* options.
* @constructor GroupSet
* @extends Panel
*/
function GroupSet(parent, depends, options) {
this.id = util.randomUUID();
this.parent = parent;
this.depends = depends;
this.options = options || {};
this.range = null; // Range or Object {start: number, end: number}
this.itemsData = null; // DataSet with items
this.groupsData = null; // DataSet with groups
this.groups = {}; // map with groups
this.dom = {};
this.props = {
labels: {
width: 0
}
};
// TODO: implement right orientation of the labels
// changes in groups are queued key/value map containing id/action
this.queue = {};
var me = this;
this.listeners = {
'add': function (event, params) {
me._onAdd(params.items);
},
'update': function (event, params) {
me._onUpdate(params.items);
},
'remove': function (event, params) {
me._onRemove(params.items);
}
};
}
GroupSet.prototype = new Panel();
/**
* Set options for the GroupSet. Existing options will be extended/overwritten.
* @param {Object} [options] The following options are available:
* {String | function} groupsOrder
* TODO: describe options
*/
GroupSet.prototype.setOptions = Component.prototype.setOptions;
GroupSet.prototype.setRange = function (range) {
// TODO: implement setRange
};
/**
* Set items
* @param {vis.DataSet | null} items
*/
GroupSet.prototype.setItems = function setItems(items) {
this.itemsData = items;
for (var id in this.groups) {
if (this.groups.hasOwnProperty(id)) {
var group = this.groups[id];
group.setItems(items);
}
}
};
/**
* Get items
* @return {vis.DataSet | null} items
*/
GroupSet.prototype.getItems = function getItems() {
return this.itemsData;
};
/**
* Set range (start and end).
* @param {Range | Object} range A Range or an object containing start and end.
*/
GroupSet.prototype.setRange = function setRange(range) {
this.range = range;
};
/**
* Set groups
* @param {vis.DataSet} groups
*/
GroupSet.prototype.setGroups = function setGroups(groups) {
var me = this,
ids;
// unsubscribe from current dataset
if (this.groupsData) {
util.forEach(this.listeners, function (callback, event) {
me.groupsData.unsubscribe(event, callback);
});
// remove all drawn groups
ids = this.groupsData.getIds();
this._onRemove(ids);
}
// replace the dataset
if (!groups) {
this.groupsData = null;
}
else if (groups instanceof DataSet) {
this.groupsData = groups;
}
else {
this.groupsData = new DataSet({
convert: {
start: 'Date',
end: 'Date'
}
});
this.groupsData.add(groups);
}
if (this.groupsData) {
// subscribe to new dataset
var id = this.id;
util.forEach(this.listeners, function (callback, event) {
me.groupsData.on(event, callback, id);
});
// draw all new groups
ids = this.groupsData.getIds();
this._onAdd(ids);
}
};
/**
* Get groups
* @return {vis.DataSet | null} groups
*/
GroupSet.prototype.getGroups = function getGroups() {
return this.groupsData;
};
/**
* Set selected items by their id. Replaces the current selection.
* Unknown id's are silently ignored.
* @param {Array} [ids] An array with zero or more id's of the items to be
* selected. If ids is an empty array, all items will be
* unselected.
*/
GroupSet.prototype.setSelection = function setSelection(ids) {
var selection = [],
groups = this.groups;
// iterate over each of the groups
for (var id in groups) {
if (groups.hasOwnProperty(id)) {
var group = groups[id];
group.setSelection(ids);
}
}
return selection;
};
/**
* Get the selected items by their id
* @return {Array} ids The ids of the selected items
*/
GroupSet.prototype.getSelection = function getSelection() {
var selection = [],
groups = this.groups;
// iterate over each of the groups
for (var id in groups) {
if (groups.hasOwnProperty(id)) {
var group = groups[id];
selection = selection.concat(group.getSelection());
}
}
return selection;
};
/**
* Repaint the component
* @return {Boolean} changed
*/
GroupSet.prototype.repaint = function repaint() {
var changed = 0,
i, id, group, label,
update = util.updateProperty,
asSize = util.option.asSize,
asElement = util.option.asElement,
options = this.options,
frame = this.dom.frame,
labels = this.dom.labels,
labelSet = this.dom.labelSet;
// create frame
if (!this.parent) {
throw new Error('Cannot repaint groupset: no parent attached');
}
var parentContainer = this.parent.getContainer();
if (!parentContainer) {
throw new Error('Cannot repaint groupset: parent has no container element');
}
if (!frame) {
frame = document.createElement('div');
frame.className = 'groupset';
frame['timeline-groupset'] = this;
this.dom.frame = frame;
var className = options.className;
if (className) {
util.addClassName(frame, util.option.asString(className));
}
changed += 1;
}
if (!frame.parentNode) {
parentContainer.appendChild(frame);
changed += 1;
}
// create labels
var labelContainer = asElement(options.labelContainer);
if (!labelContainer) {
throw new Error('Cannot repaint groupset: option "labelContainer" not defined');
}
if (!labels) {
labels = document.createElement('div');
labels.className = 'labels';
this.dom.labels = labels;
}
if (!labelSet) {
labelSet = document.createElement('div');
labelSet.className = 'label-set';
labels.appendChild(labelSet);
this.dom.labelSet = labelSet;
}
if (!labels.parentNode || labels.parentNode != labelContainer) {
if (labels.parentNode) {
labels.parentNode.removeChild(labels.parentNode);
}
labelContainer.appendChild(labels);
}
// reposition frame
changed += update(frame.style, 'height', asSize(options.height, this.height + 'px'));
changed += update(frame.style, 'top', asSize(options.top, '0px'));
changed += update(frame.style, 'left', asSize(options.left, '0px'));
changed += update(frame.style, 'width', asSize(options.width, '100%'));
// reposition labels
changed += update(labelSet.style, 'top', asSize(options.top, '0px'));
changed += update(labelSet.style, 'height', asSize(options.height, this.height + 'px'));
var me = this,
queue = this.queue,
groups = this.groups,
groupsData = this.groupsData;
// show/hide added/changed/removed groups
var ids = Object.keys(queue);
if (ids.length) {
ids.forEach(function (id) {
var action = queue[id];
var group = groups[id];
//noinspection FallthroughInSwitchStatementJS
switch (action) {
case 'add':
case 'update':
if (!group) {
var groupOptions = Object.create(me.options);
util.extend(groupOptions, {
height: null,
maxHeight: null
});
group = new Group(me, id, groupOptions);
group.setItems(me.itemsData); // attach items data
groups[id] = group;
me.controller.add(group);
}
// TODO: update group data
group.data = groupsData.get(id);
delete queue[id];
break;
case 'remove':
if (group) {
group.setItems(); // detach items data
delete groups[id];
me.controller.remove(group);
}
// update lists
delete queue[id];
break;
default:
console.log('Error: unknown action "' + action + '"');
}
});
// the groupset depends on each of the groups
//this.depends = this.groups; // TODO: gives a circular reference through the parent
// TODO: apply dependencies of the groupset
// update the top positions of the groups in the correct order
var orderedGroups = this.groupsData.getIds({
order: this.options.groupOrder
});
for (i = 0; i < orderedGroups.length; i++) {
(function (group, prevGroup) {
var top = 0;
if (prevGroup) {
top = function () {
// TODO: top must reckon with options.maxHeight
return prevGroup.top + prevGroup.height;
}
}
group.setOptions({
top: top
});
})(groups[orderedGroups[i]], groups[orderedGroups[i - 1]]);
}
// (re)create the labels
while (labelSet.firstChild) {
labelSet.removeChild(labelSet.firstChild);
}
for (i = 0; i < orderedGroups.length; i++) {
id = orderedGroups[i];
label = this._createLabel(id);
labelSet.appendChild(label);
}
changed++;
}
// reposition the labels
// TODO: labels are not displayed correctly when orientation=='top'
// TODO: width of labelPanel is not immediately updated on a change in groups
for (id in groups) {
if (groups.hasOwnProperty(id)) {
group = groups[id];
label = group.label;
if (label) {
label.style.top = group.top + 'px';
label.style.height = group.height + 'px';
}
}
}
return (changed > 0);
};
/**
* Create a label for group with given id
* @param {Number} id
* @return {Element} label
* @private
*/
GroupSet.prototype._createLabel = function(id) {
var group = this.groups[id];
var label = document.createElement('div');
label.className = 'vlabel';
var inner = document.createElement('div');
inner.className = 'inner';
label.appendChild(inner);
var content = group.data && group.data.content;
if (content instanceof Element) {
inner.appendChild(content);
}
else if (content != undefined) {
inner.innerHTML = content;
}
var className = group.data && group.data.className;
if (className) {
util.addClassName(label, className);
}
group.label = label; // TODO: not so nice, parking labels in the group this way!!!
return label;
};
/**
* Get container element
* @return {HTMLElement} container
*/
GroupSet.prototype.getContainer = function getContainer() {
return this.dom.frame;
};
/**
* Get the width of the group labels
* @return {Number} width
*/
GroupSet.prototype.getLabelsWidth = function getContainer() {
return this.props.labels.width;
};
/**
* Reflow the component
* @return {Boolean} resized
*/
GroupSet.prototype.reflow = function reflow() {
var changed = 0,
id, group,
options = this.options,
update = util.updateProperty,
asNumber = util.option.asNumber,
asSize = util.option.asSize,
frame = this.dom.frame;
if (frame) {
var maxHeight = asNumber(options.maxHeight);
var fixedHeight = (asSize(options.height) != null);
var height;
if (fixedHeight) {
height = frame.offsetHeight;
}
else {
// height is not specified, calculate the sum of the height of all groups
height = 0;
for (id in this.groups) {
if (this.groups.hasOwnProperty(id)) {
group = this.groups[id];
height += group.height;
}
}
}
if (maxHeight != null) {
height = Math.min(height, maxHeight);
}
changed += update(this, 'height', height);
changed += update(this, 'top', frame.offsetTop);
changed += update(this, 'left', frame.offsetLeft);
changed += update(this, 'width', frame.offsetWidth);
}
// calculate the maximum width of the labels
var width = 0;
for (id in this.groups) {
if (this.groups.hasOwnProperty(id)) {
group = this.groups[id];
var labelWidth = group.props && group.props.label && group.props.label.width || 0;
width = Math.max(width, labelWidth);
}
}
changed += update(this.props.labels, 'width', width);
return (changed > 0);
};
/**
* Hide the component from the DOM
* @return {Boolean} changed
*/
GroupSet.prototype.hide = function hide() {
if (this.dom.frame && this.dom.frame.parentNode) {
this.dom.frame.parentNode.removeChild(this.dom.frame);
return true;
}
else {
return false;
}
};
/**
* Show the component in the DOM (when not already visible).
* A repaint will be executed when the component is not visible
* @return {Boolean} changed
*/
GroupSet.prototype.show = function show() {
if (!this.dom.frame || !this.dom.frame.parentNode) {
return this.repaint();
}
else {
return false;
}
};
/**
* Handle updated groups
* @param {Number[]} ids
* @private
*/
GroupSet.prototype._onUpdate = function _onUpdate(ids) {
this._toQueue(ids, 'update');
};
/**
* Handle changed groups
* @param {Number[]} ids
* @private
*/
GroupSet.prototype._onAdd = function _onAdd(ids) {
this._toQueue(ids, 'add');
};
/**
* Handle removed groups
* @param {Number[]} ids
* @private
*/
GroupSet.prototype._onRemove = function _onRemove(ids) {
this._toQueue(ids, 'remove');
};
/**
* Put groups in the queue to be added/updated/remove
* @param {Number[]} ids
* @param {String} action can be 'add', 'update', 'remove'
*/
GroupSet.prototype._toQueue = function _toQueue(ids, action) {
var queue = this.queue;
ids.forEach(function (id) {
queue[id] = action;
});
if (this.controller) {
//this.requestReflow();
this.requestRepaint();
}
};
/**
* Find the Group from an event target:
* searches for the attribute 'timeline-groupset' in the event target's element
* tree, then finds the right group in this groupset
* @param {Event} event
* @return {Group | null} group
*/
GroupSet.groupFromTarget = function groupFromTarget (event) {
var groupset,
target = event.target;
while (target) {
if (target.hasOwnProperty('timeline-groupset')) {
groupset = target['timeline-groupset'];
break;
}
target = target.parentNode;
}
if (groupset) {
for (var groupId in groupset.groups) {
if (groupset.groups.hasOwnProperty(groupId)) {
var group = groupset.groups[groupId];
if (group.itemset && ItemSet.itemSetFromTarget(event) == group.itemset) {
return group;
}
}
}
}
return null;
};
/**
* Create a timeline visualization
* @param {HTMLElement} container
* @param {vis.DataSet | Array | google.visualization.DataTable} [items]
* @param {Object} [options] See Timeline.setOptions for the available options.
* @constructor
*/
function Timeline (container, items, options) {
var me = this;
var now = moment().hours(0).minutes(0).seconds(0).milliseconds(0);
this.options = {
orientation: 'bottom',
autoResize: true,
editable: false,
selectable: true,
snap: null, // will be specified after timeaxis is created
min: null,
max: null,
zoomMin: 10, // milliseconds
zoomMax: 1000 * 60 * 60 * 24 * 365 * 10000, // milliseconds
// moveable: true, // TODO: option moveable
// zoomable: true, // TODO: option zoomable
showMinorLabels: true,
showMajorLabels: true,
showCurrentTime: false,
showCustomTime: false,
onAdd: function (item, callback) {
callback(item);
},
onUpdate: function (item, callback) {
callback(item);
},
onMove: function (item, callback) {
callback(item);
},
onRemove: function (item, callback) {
callback(item);
}
};
// controller
this.controller = new Controller();
// root panel
if (!container) {
throw new Error('No container element provided');
}
var rootOptions = Object.create(this.options);
rootOptions.height = function () {
// TODO: change to height
if (me.options.height) {
// fixed height
return me.options.height;
}
else {
// auto height
return (me.timeaxis.height + me.content.height) + 'px';
}
};
this.rootPanel = new RootPanel(container, rootOptions);
this.controller.add(this.rootPanel);
// single select (or unselect) when tapping an item
this.controller.on('tap', this._onSelectItem.bind(this));
// multi select when holding mouse/touch, or on ctrl+click
this.controller.on('hold', this._onMultiSelectItem.bind(this));
// add item on doubletap
this.controller.on('doubletap', this._onAddItem.bind(this));
// item panel
var itemOptions = Object.create(this.options);
itemOptions.left = function () {
return me.labelPanel.width;
};
itemOptions.width = function () {
return me.rootPanel.width - me.labelPanel.width;
};
itemOptions.top = null;
itemOptions.height = null;
this.itemPanel = new Panel(this.rootPanel, [], itemOptions);
this.controller.add(this.itemPanel);
// label panel
var labelOptions = Object.create(this.options);
labelOptions.top = null;
labelOptions.left = null;
labelOptions.height = null;
labelOptions.width = function () {
if (me.content && typeof me.content.getLabelsWidth === 'function') {
return me.content.getLabelsWidth();
}
else {
return 0;
}
};
this.labelPanel = new Panel(this.rootPanel, [], labelOptions);
this.controller.add(this.labelPanel);
// range
var rangeOptions = Object.create(this.options);
this.range = new Range(rangeOptions);
this.range.setRange(
now.clone().add('days', -3).valueOf(),
now.clone().add('days', 4).valueOf()
);
this.range.subscribe(this.controller, this.rootPanel, 'move', 'horizontal');
this.range.subscribe(this.controller, this.rootPanel, 'zoom', 'horizontal');
this.range.on('rangechange', function (properties) {
var force = true;
me.controller.emit('rangechange', properties);
me.controller.emit('request-reflow', force);
});
this.range.on('rangechanged', function (properties) {
var force = true;
me.controller.emit('rangechanged', properties);
me.controller.emit('request-reflow', force);
});
// time axis
var timeaxisOptions = Object.create(rootOptions);
timeaxisOptions.range = this.range;
timeaxisOptions.left = null;
timeaxisOptions.top = null;
timeaxisOptions.width = '100%';
timeaxisOptions.height = null;
this.timeaxis = new TimeAxis(this.itemPanel, [], timeaxisOptions);
this.timeaxis.setRange(this.range);
this.controller.add(this.timeaxis);
this.options.snap = this.timeaxis.snap.bind(this.timeaxis);
// current time bar
this.currenttime = new CurrentTime(this.timeaxis, [], rootOptions);
this.controller.add(this.currenttime);
// custom time bar
this.customtime = new CustomTime(this.timeaxis, [], rootOptions);
this.controller.add(this.customtime);
// create groupset
this.setGroups(null);
this.itemsData = null; // DataSet
this.groupsData = null; // DataSet
// apply options
if (options) {
this.setOptions(options);
}
// create itemset and groupset
if (items) {
this.setItems(items);
}
}
/**
* Add an event listener to the timeline
* @param {String} event Available events: select, rangechange, rangechanged,
* timechange, timechanged
* @param {function} callback
*/
Timeline.prototype.on = function on (event, callback) {
this.controller.on(event, callback);
};
/**
* Add an event listener from the timeline
* @param {String} event
* @param {function} callback
*/
Timeline.prototype.off = function off (event, callback) {
this.controller.off(event, callback);
};
/**
* Set options
* @param {Object} options TODO: describe the available options
*/
Timeline.prototype.setOptions = function (options) {
util.extend(this.options, options);
// force update of range (apply new min/max etc.)
// both start and end are optional
this.range.setRange(options.start, options.end);
if ('editable' in options || 'selectable' in options) {
if (this.options.selectable) {
// force update of selection
this.setSelection(this.getSelection());
}
else {
// remove selection
this.setSelection([]);
}
}
// validate the callback functions
var validateCallback = (function (fn) {
if (!(this.options[fn] instanceof Function) || this.options[fn].length != 2) {
throw new Error('option ' + fn + ' must be a function ' + fn + '(item, callback)');
}
}).bind(this);
['onAdd', 'onUpdate', 'onRemove', 'onMove'].forEach(validateCallback);
this.controller.reflow();
this.controller.repaint();
};
/**
* Set a custom time bar
* @param {Date} time
*/
Timeline.prototype.setCustomTime = function (time) {
if (!this.customtime) {
throw new Error('Cannot get custom time: Custom time bar is not enabled');
}
this.customtime.setCustomTime(time);
};
/**
* Retrieve the current custom time.
* @return {Date} customTime
*/
Timeline.prototype.getCustomTime = function() {
if (!this.customtime) {
throw new Error('Cannot get custom time: Custom time bar is not enabled');
}
return this.customtime.getCustomTime();
};
/**
* Set items
* @param {vis.DataSet | Array | google.visualization.DataTable | null} items
*/
Timeline.prototype.setItems = function(items) {
var initialLoad = (this.itemsData == null);
// convert to type DataSet when needed
var newDataSet;
if (!items) {
newDataSet = null;
}
else if (items instanceof DataSet) {
newDataSet = items;
}
if (!(items instanceof DataSet)) {
newDataSet = new DataSet({
convert: {
start: 'Date',
end: 'Date'
}
});
newDataSet.add(items);
}
// set items
this.itemsData = newDataSet;
this.content.setItems(newDataSet);
if (initialLoad && (this.options.start == undefined || this.options.end == undefined)) {
// apply the data range as range
var dataRange = this.getItemRange();
// add 5% space on both sides
var start = dataRange.min;
var end = dataRange.max;
if (start != null && end != null) {
var interval = (end.valueOf() - start.valueOf());
if (interval <= 0) {
// prevent an empty interval
interval = 24 * 60 * 60 * 1000; // 1 day
}
start = new Date(start.valueOf() - interval * 0.05);
end = new Date(end.valueOf() + interval * 0.05);
}
// override specified start and/or end date
if (this.options.start != undefined) {
start = util.convert(this.options.start, 'Date');
}
if (this.options.end != undefined) {
end = util.convert(this.options.end, 'Date');
}
// apply range if there is a min or max available
if (start != null || end != null) {
this.range.setRange(start, end);
}
}
};
/**
* Set groups
* @param {vis.DataSet | Array | google.visualization.DataTable} groups
*/
Timeline.prototype.setGroups = function(groups) {
var me = this;
this.groupsData = groups;
// switch content type between ItemSet or GroupSet when needed
var Type = this.groupsData ? GroupSet : ItemSet;
if (!(this.content instanceof Type)) {
// remove old content set
if (this.content) {
this.content.hide();
if (this.content.setItems) {
this.content.setItems(); // disconnect from items
}
if (this.content.setGroups) {
this.content.setGroups(); // disconnect from groups
}
this.controller.remove(this.content);
}
// create new content set
var options = Object.create(this.options);
util.extend(options, {
top: function () {
if (me.options.orientation == 'top') {
return me.timeaxis.height;
}
else {
return me.itemPanel.height - me.timeaxis.height - me.content.height;
}
},
left: null,
width: '100%',
height: function () {
if (me.options.height) {
// fixed height
return me.itemPanel.height - me.timeaxis.height;
}
else {
// auto height
return null;
}
},
maxHeight: function () {
// TODO: change maxHeight to be a css string like '100%' or '300px'
if (me.options.maxHeight) {
if (!util.isNumber(me.options.maxHeight)) {
throw new TypeError('Number expected for property maxHeight');
}
return me.options.maxHeight - me.timeaxis.height;
}
else {
return null;
}
},
labelContainer: function () {
return me.labelPanel.getContainer();
}
});
this.content = new Type(this.itemPanel, [this.timeaxis], options);
if (this.content.setRange) {
this.content.setRange(this.range);
}
if (this.content.setItems) {
this.content.setItems(this.itemsData);
}
if (this.content.setGroups) {
this.content.setGroups(this.groupsData);
}
this.controller.add(this.content);
}
};
/**
* Get the data range of the item set.
* @returns {{min: Date, max: Date}} range A range with a start and end Date.
* When no minimum is found, min==null
* When no maximum is found, max==null
*/
Timeline.prototype.getItemRange = function getItemRange() {
// calculate min from start filed
var itemsData = this.itemsData,
min = null,
max = null;
if (itemsData) {
// calculate the minimum value of the field 'start'
var minItem = itemsData.min('start');
min = minItem ? minItem.start.valueOf() : null;
// calculate maximum value of fields 'start' and 'end'
var maxStartItem = itemsData.max('start');
if (maxStartItem) {
max = maxStartItem.start.valueOf();
}
var maxEndItem = itemsData.max('end');
if (maxEndItem) {
if (max == null) {
max = maxEndItem.end.valueOf();
}
else {
max = Math.max(max, maxEndItem.end.valueOf());
}
}
}
return {
min: (min != null) ? new Date(min) : null,
max: (max != null) ? new Date(max) : null
};
};
/**
* Set selected items by their id. Replaces the current selection
* Unknown id's are silently ignored.
* @param {Array} [ids] An array with zero or more id's of the items to be
* selected. If ids is an empty array, all items will be
* unselected.
*/
Timeline.prototype.setSelection = function setSelection (ids) {
if (this.content) this.content.setSelection(ids);
};
/**
* Get the selected items by their id
* @return {Array} ids The ids of the selected items
*/
Timeline.prototype.getSelection = function getSelection() {
return this.content ? this.content.getSelection() : [];
};
/**
* Set the visible window. Both parameters are optional, you can change only
* start or only end.
* @param {Date | Number | String} [start] Start date of visible window
* @param {Date | Number | String} [end] End date of visible window
*/
Timeline.prototype.setWindow = function setWindow(start, end) {
this.range.setRange(start, end);
};
/**
* Get the visible window
* @return {{start: Date, end: Date}} Visible range
*/
Timeline.prototype.getWindow = function setWindow() {
var range = this.range.getRange();
return {
start: new Date(range.start),
end: new Date(range.end)
};
};
/**
* Handle selecting/deselecting an item when tapping it
* @param {Event} event
* @private
*/
// TODO: move this function to ItemSet
Timeline.prototype._onSelectItem = function (event) {
if (!this.options.selectable) return;
var ctrlKey = event.gesture.srcEvent && event.gesture.srcEvent.ctrlKey;
var shiftKey = event.gesture.srcEvent && event.gesture.srcEvent.shiftKey;
if (ctrlKey || shiftKey) {
this._onMultiSelectItem(event);
return;
}
var item = ItemSet.itemFromTarget(event);
var selection = item ? [item.id] : [];
this.setSelection(selection);
this.controller.emit('select', {
items: this.getSelection()
});
event.stopPropagation();
};
/**
* Handle creation and updates of an item on double tap
* @param event
* @private
*/
Timeline.prototype._onAddItem = function (event) {
if (!this.options.selectable) return;
if (!this.options.editable) return;
var me = this,
item = ItemSet.itemFromTarget(event);
if (item) {
// update item
// execute async handler to update the item (or cancel it)
var itemData = me.itemsData.get(item.id); // get a clone of the data from the dataset
this.options.onUpdate(itemData, function (itemData) {
if (itemData) {
me.itemsData.update(itemData);
}
});
}
else {
// add item
var xAbs = vis.util.getAbsoluteLeft(this.rootPanel.frame);
var x = event.gesture.center.pageX - xAbs;
var newItem = {
start: this.timeaxis.snap(this._toTime(x)),
content: 'new item'
};
var id = util.randomUUID();
newItem[this.itemsData.fieldId] = id;
var group = GroupSet.groupFromTarget(event);
if (group) {
newItem.group = group.groupId;
}
// execute async handler to customize (or cancel) adding an item
this.options.onAdd(newItem, function (item) {
if (item) {
me.itemsData.add(newItem);
// select the created item after it is repainted
me.controller.once('repaint', function () {
me.setSelection([id]);
me.controller.emit('select', {
items: me.getSelection()
});
}.bind(me));
}
});
}
};
/**
* Handle selecting/deselecting multiple items when holding an item
* @param {Event} event
* @private
*/
// TODO: move this function to ItemSet
Timeline.prototype._onMultiSelectItem = function (event) {
if (!this.options.selectable) return;
var selection,
item = ItemSet.itemFromTarget(event);
if (item) {
// multi select items
selection = this.getSelection(); // current selection
var index = selection.indexOf(item.id);
if (index == -1) {
// item is not yet selected -> select it
selection.push(item.id);
}
else {
// item is already selected -> deselect it
selection.splice(index, 1);
}
this.setSelection(selection);
this.controller.emit('select', {
items: this.getSelection()
});
event.stopPropagation();
}
};
/**
* Convert a position on screen (pixels) to a datetime
* @param {int} x Position on the screen in pixels
* @return {Date} time The datetime the corresponds with given position x
* @private
*/
Timeline.prototype._toTime = function _toTime(x) {
var conversion = this.range.conversion(this.content.width);
return new Date(x / conversion.scale + conversion.offset);
};
/**
* Convert a datetime (Date object) into a position on the screen
* @param {Date} time A date
* @return {int} x The position on the screen in pixels which corresponds
* with the given date.
* @private
*/
Timeline.prototype._toScreen = function _toScreen(time) {
var conversion = this.range.conversion(this.content.width);
return (time.valueOf() - conversion.offset) * conversion.scale;
};
(function(exports) {
/**
* Parse a text source containing data in DOT language into a JSON object.
* The object contains two lists: one with nodes and one with edges.
*
* DOT language reference: http://www.graphviz.org/doc/info/lang.html
*
* @param {String} data Text containing a graph in DOT-notation
* @return {Object} graph An object containing two parameters:
* {Object[]} nodes
* {Object[]} edges
*/
function parseDOT (data) {
dot = data;
return parseGraph();
}
// token types enumeration
var TOKENTYPE = {
NULL : 0,
DELIMITER : 1,
IDENTIFIER: 2,
UNKNOWN : 3
};
// map with all delimiters
var DELIMITERS = {
'{': true,
'}': true,
'[': true,
']': true,
';': true,
'=': true,
',': true,
'->': true,
'--': true
};
var dot = ''; // current dot file
var index = 0; // current index in dot file
var c = ''; // current token character in expr
var token = ''; // current token
var tokenType = TOKENTYPE.NULL; // type of the token
/**
* Get the first character from the dot file.
* The character is stored into the char c. If the end of the dot file is
* reached, the function puts an empty string in c.
*/
function first() {
index = 0;
c = dot.charAt(0);
}
/**
* Get the next character from the dot file.
* The character is stored into the char c. If the end of the dot file is
* reached, the function puts an empty string in c.
*/
function next() {
index++;
c = dot.charAt(index);
}
/**
* Preview the next character from the dot file.
* @return {String} cNext
*/
function nextPreview() {
return dot.charAt(index + 1);
}
/**
* Test whether given character is alphabetic or numeric
* @param {String} c
* @return {Boolean} isAlphaNumeric
*/
var regexAlphaNumeric = /[a-zA-Z_0-9.:#]/;
function isAlphaNumeric(c) {
return regexAlphaNumeric.test(c);
}
/**
* Merge all properties of object b into object b
* @param {Object} a
* @param {Object} b
* @return {Object} a
*/
function merge (a, b) {
if (!a) {
a = {};
}
if (b) {
for (var name in b) {
if (b.hasOwnProperty(name)) {
a[name] = b[name];
}
}
}
return a;
}
/**
* Set a value in an object, where the provided parameter name can be a
* path with nested parameters. For example:
*
* var obj = {a: 2};
* setValue(obj, 'b.c', 3); // obj = {a: 2, b: {c: 3}}
*
* @param {Object} obj
* @param {String} path A parameter name or dot-separated parameter path,
* like "color.highlight.border".
* @param {*} value
*/
function setValue(obj, path, value) {
var keys = path.split('.');
var o = obj;
while (keys.length) {
var key = keys.shift();
if (keys.length) {
// this isn't the end point
if (!o[key]) {
o[key] = {};
}
o = o[key];
}
else {
// this is the end point
o[key] = value;
}
}
}
/**
* Add a node to a graph object. If there is already a node with
* the same id, their attributes will be merged.
* @param {Object} graph
* @param {Object} node
*/
function addNode(graph, node) {
var i, len;
var current = null;
// find root graph (in case of subgraph)
var graphs = [graph]; // list with all graphs from current graph to root graph
var root = graph;
while (root.parent) {
graphs.push(root.parent);
root = root.parent;
}
// find existing node (at root level) by its id
if (root.nodes) {
for (i = 0, len = root.nodes.length; i < len; i++) {
if (node.id === root.nodes[i].id) {
current = root.nodes[i];
break;
}
}
}
if (!current) {
// this is a new node
current = {
id: node.id
};
if (graph.node) {
// clone default attributes
current.attr = merge(current.attr, graph.node);
}
}
// add node to this (sub)graph and all its parent graphs
for (i = graphs.length - 1; i >= 0; i--) {
var g = graphs[i];
if (!g.nodes) {
g.nodes = [];
}
if (g.nodes.indexOf(current) == -1) {
g.nodes.push(current);
}
}
// merge attributes
if (node.attr) {
current.attr = merge(current.attr, node.attr);
}
}
/**
* Add an edge to a graph object
* @param {Object} graph
* @param {Object} edge
*/
function addEdge(graph, edge) {
if (!graph.edges) {
graph.edges = [];
}
graph.edges.push(edge);
if (graph.edge) {
var attr = merge({}, graph.edge); // clone default attributes
edge.attr = merge(attr, edge.attr); // merge attributes
}
}
/**
* Create an edge to a graph object
* @param {Object} graph
* @param {String | Number | Object} from
* @param {String | Number | Object} to
* @param {String} type
* @param {Object | null} attr
* @return {Object} edge
*/
function createEdge(graph, from, to, type, attr) {
var edge = {
from: from,
to: to,
type: type
};
if (graph.edge) {
edge.attr = merge({}, graph.edge); // clone default attributes
}
edge.attr = merge(edge.attr || {}, attr); // merge attributes
return edge;
}
/**
* Get next token in the current dot file.
* The token and token type are available as token and tokenType
*/
function getToken() {
tokenType = TOKENTYPE.NULL;
token = '';
// skip over whitespaces
while (c == ' ' || c == '\t' || c == '\n' || c == '\r') { // space, tab, enter
next();
}
do {
var isComment = false;
// skip comment
if (c == '#') {
// find the previous non-space character
var i = index - 1;
while (dot.charAt(i) == ' ' || dot.charAt(i) == '\t') {
i--;
}
if (dot.charAt(i) == '\n' || dot.charAt(i) == '') {
// the # is at the start of a line, this is indeed a line comment
while (c != '' && c != '\n') {
next();
}
isComment = true;
}
}
if (c == '/' && nextPreview() == '/') {
// skip line comment
while (c != '' && c != '\n') {
next();
}
isComment = true;
}
if (c == '/' && nextPreview() == '*') {
// skip block comment
while (c != '') {
if (c == '*' && nextPreview() == '/') {
// end of block comment found. skip these last two characters
next();
next();
break;
}
else {
next();
}
}
isComment = true;
}
// skip over whitespaces
while (c == ' ' || c == '\t' || c == '\n' || c == '\r') { // space, tab, enter
next();
}
}
while (isComment);
// check for end of dot file
if (c == '') {
// token is still empty
tokenType = TOKENTYPE.DELIMITER;
return;
}
// check for delimiters consisting of 2 characters
var c2 = c + nextPreview();
if (DELIMITERS[c2]) {
tokenType = TOKENTYPE.DELIMITER;
token = c2;
next();
next();
return;
}
// check for delimiters consisting of 1 character
if (DELIMITERS[c]) {
tokenType = TOKENTYPE.DELIMITER;
token = c;
next();
return;
}
// check for an identifier (number or string)
// TODO: more precise parsing of numbers/strings (and the port separator ':')
if (isAlphaNumeric(c) || c == '-') {
token += c;
next();
while (isAlphaNumeric(c)) {
token += c;
next();
}
if (token == 'false') {
token = false; // convert to boolean
}
else if (token == 'true') {
token = true; // convert to boolean
}
else if (!isNaN(Number(token))) {
token = Number(token); // convert to number
}
tokenType = TOKENTYPE.IDENTIFIER;
return;
}
// check for a string enclosed by double quotes
if (c == '"') {
next();
while (c != '' && (c != '"' || (c == '"' && nextPreview() == '"'))) {
token += c;
if (c == '"') { // skip the escape character
next();
}
next();
}
if (c != '"') {
throw newSyntaxError('End of string " expected');
}
next();
tokenType = TOKENTYPE.IDENTIFIER;
return;
}
// something unknown is found, wrong characters, a syntax error
tokenType = TOKENTYPE.UNKNOWN;
while (c != '') {
token += c;
next();
}
throw new SyntaxError('Syntax error in part "' + chop(token, 30) + '"');
}
/**
* Parse a graph.
* @returns {Object} graph
*/
function parseGraph() {
var graph = {};
first();
getToken();
// optional strict keyword
if (token == 'strict') {
graph.strict = true;
getToken();
}
// graph or digraph keyword
if (token == 'graph' || token == 'digraph') {
graph.type = token;
getToken();
}
// optional graph id
if (tokenType == TOKENTYPE.IDENTIFIER) {
graph.id = token;
getToken();
}
// open angle bracket
if (token != '{') {
throw newSyntaxError('Angle bracket { expected');
}
getToken();
// statements
parseStatements(graph);
// close angle bracket
if (token != '}') {
throw newSyntaxError('Angle bracket } expected');
}
getToken();
// end of file
if (token !== '') {
throw newSyntaxError('End of file expected');
}
getToken();
// remove temporary default properties
delete graph.node;
delete graph.edge;
delete graph.graph;
return graph;
}
/**
* Parse a list with statements.
* @param {Object} graph
*/
function parseStatements (graph) {
while (token !== '' && token != '}') {
parseStatement(graph);
if (token == ';') {
getToken();
}
}
}
/**
* Parse a single statement. Can be a an attribute statement, node
* statement, a series of node statements and edge statements, or a
* parameter.
* @param {Object} graph
*/
function parseStatement(graph) {
// parse subgraph
var subgraph = parseSubgraph(graph);
if (subgraph) {
// edge statements
parseEdge(graph, subgraph);
return;
}
// parse an attribute statement
var attr = parseAttributeStatement(graph);
if (attr) {
return;
}
// parse node
if (tokenType != TOKENTYPE.IDENTIFIER) {
throw newSyntaxError('Identifier expected');
}
var id = token; // id can be a string or a number
getToken();
if (token == '=') {
// id statement
getToken();
if (tokenType != TOKENTYPE.IDENTIFIER) {
throw newSyntaxError('Identifier expected');
}
graph[id] = token;
getToken();
// TODO: implement comma separated list with "a_list: ID=ID [','] [a_list] "
}
else {
parseNodeStatement(graph, id);
}
}
/**
* Parse a subgraph
* @param {Object} graph parent graph object
* @return {Object | null} subgraph
*/
function parseSubgraph (graph) {
var subgraph = null;
// optional subgraph keyword
if (token == 'subgraph') {
subgraph = {};
subgraph.type = 'subgraph';
getToken();
// optional graph id
if (tokenType == TOKENTYPE.IDENTIFIER) {
subgraph.id = token;
getToken();
}
}
// open angle bracket
if (token == '{') {
getToken();
if (!subgraph) {
subgraph = {};
}
subgraph.parent = graph;
subgraph.node = graph.node;
subgraph.edge = graph.edge;
subgraph.graph = graph.graph;
// statements
parseStatements(subgraph);
// close angle bracket
if (token != '}') {
throw newSyntaxError('Angle bracket } expected');
}
getToken();
// remove temporary default properties
delete subgraph.node;
delete subgraph.edge;
delete subgraph.graph;
delete subgraph.parent;
// register at the parent graph
if (!graph.subgraphs) {
graph.subgraphs = [];
}
graph.subgraphs.push(subgraph);
}
return subgraph;
}
/**
* parse an attribute statement like "node [shape=circle fontSize=16]".
* Available keywords are 'node', 'edge', 'graph'.
* The previous list with default attributes will be replaced
* @param {Object} graph
* @returns {String | null} keyword Returns the name of the parsed attribute
* (node, edge, graph), or null if nothing
* is parsed.
*/
function parseAttributeStatement (graph) {
// attribute statements
if (token == 'node') {
getToken();
// node attributes
graph.node = parseAttributeList();
return 'node';
}
else if (token == 'edge') {
getToken();
// edge attributes
graph.edge = parseAttributeList();
return 'edge';
}
else if (token == 'graph') {
getToken();
// graph attributes
graph.graph = parseAttributeList();
return 'graph';
}
return null;
}
/**
* parse a node statement
* @param {Object} graph
* @param {String | Number} id
*/
function parseNodeStatement(graph, id) {
// node statement
var node = {
id: id
};
var attr = parseAttributeList();
if (attr) {
node.attr = attr;
}
addNode(graph, node);
// edge statements
parseEdge(graph, id);
}
/**
* Parse an edge or a series of edges
* @param {Object} graph
* @param {String | Number} from Id of the from node
*/
function parseEdge(graph, from) {
while (token == '->' || token == '--') {
var to;
var type = token;
getToken();
var subgraph = parseSubgraph(graph);
if (subgraph) {
to = subgraph;
}
else {
if (tokenType != TOKENTYPE.IDENTIFIER) {
throw newSyntaxError('Identifier or subgraph expected');
}
to = token;
addNode(graph, {
id: to
});
getToken();
}
// parse edge attributes
var attr = parseAttributeList();
// create edge
var edge = createEdge(graph, from, to, type, attr);
addEdge(graph, edge);
from = to;
}
}
/**
* Parse a set with attributes,
* for example [label="1.000", shape=solid]
* @return {Object | null} attr
*/
function parseAttributeList() {
var attr = null;
while (token == '[') {
getToken();
attr = {};
while (token !== '' && token != ']') {
if (tokenType != TOKENTYPE.IDENTIFIER) {
throw newSyntaxError('Attribute name expected');
}
var name = token;
getToken();
if (token != '=') {
throw newSyntaxError('Equal sign = expected');
}
getToken();
if (tokenType != TOKENTYPE.IDENTIFIER) {
throw newSyntaxError('Attribute value expected');
}
var value = token;
setValue(attr, name, value); // name can be a path
getToken();
if (token ==',') {
getToken();
}
}
if (token != ']') {
throw newSyntaxError('Bracket ] expected');
}
getToken();
}
return attr;
}
/**
* Create a syntax error with extra information on current token and index.
* @param {String} message
* @returns {SyntaxError} err
*/
function newSyntaxError(message) {
return new SyntaxError(message + ', got "' + chop(token, 30) + '" (char ' + index + ')');
}
/**
* Chop off text after a maximum length
* @param {String} text
* @param {Number} maxLength
* @returns {String}
*/
function chop (text, maxLength) {
return (text.length <= maxLength) ? text : (text.substr(0, 27) + '...');
}
/**
* Execute a function fn for each pair of elements in two arrays
* @param {Array | *} array1
* @param {Array | *} array2
* @param {function} fn
*/
function forEach2(array1, array2, fn) {
if (array1 instanceof Array) {
array1.forEach(function (elem1) {
if (array2 instanceof Array) {
array2.forEach(function (elem2) {
fn(elem1, elem2);
});
}
else {
fn(elem1, array2);
}
});
}
else {
if (array2 instanceof Array) {
array2.forEach(function (elem2) {
fn(array1, elem2);
});
}
else {
fn(array1, array2);
}
}
}
/**
* Convert a string containing a graph in DOT language into a map containing
* with nodes and edges in the format of graph.
* @param {String} data Text containing a graph in DOT-notation
* @return {Object} graphData
*/
function DOTToGraph (data) {
// parse the DOT file
var dotData = parseDOT(data);
var graphData = {
nodes: [],
edges: [],
options: {}
};
// copy the nodes
if (dotData.nodes) {
dotData.nodes.forEach(function (dotNode) {
var graphNode = {
id: dotNode.id,
label: String(dotNode.label || dotNode.id)
};
merge(graphNode, dotNode.attr);
if (graphNode.image) {
graphNode.shape = 'image';
}
graphData.nodes.push(graphNode);
});
}
// copy the edges
if (dotData.edges) {
/**
* Convert an edge in DOT format to an edge with VisGraph format
* @param {Object} dotEdge
* @returns {Object} graphEdge
*/
function convertEdge(dotEdge) {
var graphEdge = {
from: dotEdge.from,
to: dotEdge.to
};
merge(graphEdge, dotEdge.attr);
graphEdge.style = (dotEdge.type == '->') ? 'arrow' : 'line';
return graphEdge;
}
dotData.edges.forEach(function (dotEdge) {
var from, to;
if (dotEdge.from instanceof Object) {
from = dotEdge.from.nodes;
}
else {
from = {
id: dotEdge.from
}
}
if (dotEdge.to instanceof Object) {
to = dotEdge.to.nodes;
}
else {
to = {
id: dotEdge.to
}
}
if (dotEdge.from instanceof Object && dotEdge.from.edges) {
dotEdge.from.edges.forEach(function (subEdge) {
var graphEdge = convertEdge(subEdge);
graphData.edges.push(graphEdge);
});
}
forEach2(from, to, function (from, to) {
var subEdge = createEdge(graphData, from.id, to.id, dotEdge.type, dotEdge.attr);
var graphEdge = convertEdge(subEdge);
graphData.edges.push(graphEdge);
});
if (dotEdge.to instanceof Object && dotEdge.to.edges) {
dotEdge.to.edges.forEach(function (subEdge) {
var graphEdge = convertEdge(subEdge);
graphData.edges.push(graphEdge);
});
}
});
}
// copy the options
if (dotData.attr) {
graphData.options = dotData.attr;
}
return graphData;
}
// exports
exports.parseDOT = parseDOT;
exports.DOTToGraph = DOTToGraph;
})(typeof util !== 'undefined' ? util : exports);
/**
* Canvas shapes used by the Graph
*/
if (typeof CanvasRenderingContext2D !== 'undefined') {
/**
* Draw a circle shape
*/
CanvasRenderingContext2D.prototype.circle = function(x, y, r) {
this.beginPath();
this.arc(x, y, r, 0, 2*Math.PI, false);
};
/**
* Draw a square shape
* @param {Number} x horizontal center
* @param {Number} y vertical center
* @param {Number} r size, width and height of the square
*/
CanvasRenderingContext2D.prototype.square = function(x, y, r) {
this.beginPath();
this.rect(x - r, y - r, r * 2, r * 2);
};
/**
* Draw a triangle shape
* @param {Number} x horizontal center
* @param {Number} y vertical center
* @param {Number} r radius, half the length of the sides of the triangle
*/
CanvasRenderingContext2D.prototype.triangle = function(x, y, r) {
// http://en.wikipedia.org/wiki/Equilateral_triangle
this.beginPath();
var s = r * 2;
var s2 = s / 2;
var ir = Math.sqrt(3) / 6 * s; // radius of inner circle
var h = Math.sqrt(s * s - s2 * s2); // height
this.moveTo(x, y - (h - ir));
this.lineTo(x + s2, y + ir);
this.lineTo(x - s2, y + ir);
this.lineTo(x, y - (h - ir));
this.closePath();
};
/**
* Draw a triangle shape in downward orientation
* @param {Number} x horizontal center
* @param {Number} y vertical center
* @param {Number} r radius
*/
CanvasRenderingContext2D.prototype.triangleDown = function(x, y, r) {
// http://en.wikipedia.org/wiki/Equilateral_triangle
this.beginPath();
var s = r * 2;
var s2 = s / 2;
var ir = Math.sqrt(3) / 6 * s; // radius of inner circle
var h = Math.sqrt(s * s - s2 * s2); // height
this.moveTo(x, y + (h - ir));
this.lineTo(x + s2, y - ir);
this.lineTo(x - s2, y - ir);
this.lineTo(x, y + (h - ir));
this.closePath();
};
/**
* Draw a star shape, a star with 5 points
* @param {Number} x horizontal center
* @param {Number} y vertical center
* @param {Number} r radius, half the length of the sides of the triangle
*/
CanvasRenderingContext2D.prototype.star = function(x, y, r) {
// http://www.html5canvastutorials.com/labs/html5-canvas-star-spinner/
this.beginPath();
for (var n = 0; n < 10; n++) {
var radius = (n % 2 === 0) ? r * 1.3 : r * 0.5;
this.lineTo(
x + radius * Math.sin(n * 2 * Math.PI / 10),
y - radius * Math.cos(n * 2 * Math.PI / 10)
);
}
this.closePath();
};
/**
* http://stackoverflow.com/questions/1255512/how-to-draw-a-rounded-rectangle-on-html-canvas
*/
CanvasRenderingContext2D.prototype.roundRect = function(x, y, w, h, r) {
var r2d = Math.PI/180;
if( w - ( 2 * r ) < 0 ) { r = ( w / 2 ); } //ensure that the radius isn't too large for x
if( h - ( 2 * r ) < 0 ) { r = ( h / 2 ); } //ensure that the radius isn't too large for y
this.beginPath();
this.moveTo(x+r,y);
this.lineTo(x+w-r,y);
this.arc(x+w-r,y+r,r,r2d*270,r2d*360,false);
this.lineTo(x+w,y+h-r);
this.arc(x+w-r,y+h-r,r,0,r2d*90,false);
this.lineTo(x+r,y+h);
this.arc(x+r,y+h-r,r,r2d*90,r2d*180,false);
this.lineTo(x,y+r);
this.arc(x+r,y+r,r,r2d*180,r2d*270,false);
};
/**
* http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas
*/
CanvasRenderingContext2D.prototype.ellipse = function(x, y, w, h) {
var kappa = .5522848,
ox = (w / 2) * kappa, // control point offset horizontal
oy = (h / 2) * kappa, // control point offset vertical
xe = x + w, // x-end
ye = y + h, // y-end
xm = x + w / 2, // x-middle
ym = y + h / 2; // y-middle
this.beginPath();
this.moveTo(x, ym);
this.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y);
this.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym);
this.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye);
this.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym);
};
/**
* http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas
*/
CanvasRenderingContext2D.prototype.database = function(x, y, w, h) {
var f = 1/3;
var wEllipse = w;
var hEllipse = h * f;
var kappa = .5522848,
ox = (wEllipse / 2) * kappa, // control point offset horizontal
oy = (hEllipse / 2) * kappa, // control point offset vertical
xe = x + wEllipse, // x-end
ye = y + hEllipse, // y-end
xm = x + wEllipse / 2, // x-middle
ym = y + hEllipse / 2, // y-middle
ymb = y + (h - hEllipse/2), // y-midlle, bottom ellipse
yeb = y + h; // y-end, bottom ellipse
this.beginPath();
this.moveTo(xe, ym);
this.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye);
this.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym);
this.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y);
this.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym);
this.lineTo(xe, ymb);
this.bezierCurveTo(xe, ymb + oy, xm + ox, yeb, xm, yeb);
this.bezierCurveTo(xm - ox, yeb, x, ymb + oy, x, ymb);
this.lineTo(x, ym);
};
/**
* Draw an arrow point (no line)
*/
CanvasRenderingContext2D.prototype.arrow = function(x, y, angle, length) {
// tail
var xt = x - length * Math.cos(angle);
var yt = y - length * Math.sin(angle);
// inner tail
// TODO: allow to customize different shapes
var xi = x - length * 0.9 * Math.cos(angle);
var yi = y - length * 0.9 * Math.sin(angle);
// left
var xl = xt + length / 3 * Math.cos(angle + 0.5 * Math.PI);
var yl = yt + length / 3 * Math.sin(angle + 0.5 * Math.PI);
// right
var xr = xt + length / 3 * Math.cos(angle - 0.5 * Math.PI);
var yr = yt + length / 3 * Math.sin(angle - 0.5 * Math.PI);
this.beginPath();
this.moveTo(x, y);
this.lineTo(xl, yl);
this.lineTo(xi, yi);
this.lineTo(xr, yr);
this.closePath();
};
/**
* Sets up the dashedLine functionality for drawing
* Original code came from http://stackoverflow.com/questions/4576724/dotted-stroke-in-canvas
* @author David Jordan
* @date 2012-08-08
*/
CanvasRenderingContext2D.prototype.dashedLine = function(x,y,x2,y2,dashArray){
if (!dashArray) dashArray=[10,5];
if (dashLength==0) dashLength = 0.001; // Hack for Safari
var dashCount = dashArray.length;
this.moveTo(x, y);
var dx = (x2-x), dy = (y2-y);
var slope = dy/dx;
var distRemaining = Math.sqrt( dx*dx + dy*dy );
var dashIndex=0, draw=true;
while (distRemaining>=0.1){
var dashLength = dashArray[dashIndex++%dashCount];
if (dashLength > distRemaining) dashLength = distRemaining;
var xStep = Math.sqrt( dashLength*dashLength / (1 + slope*slope) );
if (dx<0) xStep = -xStep;
x += xStep;
y += slope*xStep;
this[draw ? 'lineTo' : 'moveTo'](x,y);
distRemaining -= dashLength;
draw = !draw;
}
};
// TODO: add diamond shape
}
/**
* @class Node
* A node. A node can be connected to other nodes via one or multiple edges.
* @param {object} properties An object containing properties for the node. All
* properties are optional, except for the id.
* {number} id Id of the node. Required
* {string} label Text label for the node
* {number} x Horizontal position of the node
* {number} y Vertical position of the node
* {string} shape Node shape, available:
* "database", "circle", "ellipse",
* "box", "image", "text", "dot",
* "star", "triangle", "triangleDown",
* "square"
* {string} image An image url
* {string} title An title text, can be HTML
* {anytype} group A group name or number
* @param {Graph.Images} imagelist A list with images. Only needed
* when the node has an image
* @param {Graph.Groups} grouplist A list with groups. Needed for
* retrieving group properties
* @param {Object} constants An object with default values for
* example for the color
*
*/
function Node(properties, imagelist, grouplist, constants) {
this.selected = false;
this.edges = []; // all edges connected to this node
this.dynamicEdges = [];
this.reroutedEdges = {};
this.group = constants.nodes.group;
this.fontSize = constants.nodes.fontSize;
this.fontFace = constants.nodes.fontFace;
this.fontColor = constants.nodes.fontColor;
this.fontDrawThreshold = 3;
this.color = constants.nodes.color;
// set defaults for the properties
this.id = undefined;
this.shape = constants.nodes.shape;
this.image = constants.nodes.image;
this.x = null;
this.y = null;
this.xFixed = false;
this.yFixed = false;
this.horizontalAlignLeft = true; // these are for the navigation controls
this.verticalAlignTop = true; // these are for the navigation controls
this.radius = constants.nodes.radius;
this.baseRadiusValue = constants.nodes.radius;
this.radiusFixed = false;
this.radiusMin = constants.nodes.radiusMin;
this.radiusMax = constants.nodes.radiusMax;
this.level = -1;
this.preassignedLevel = false;
this.imagelist = imagelist;
this.grouplist = grouplist;
// physics properties
this.fx = 0.0; // external force x
this.fy = 0.0; // external force y
this.vx = 0.0; // velocity x
this.vy = 0.0; // velocity y
this.minForce = constants.minForce;
this.damping = constants.physics.damping;
this.mass = 1; // kg
this.fixedData = {x:null,y:null};
this.setProperties(properties, constants);
// creating the variables for clustering
this.resetCluster();
this.dynamicEdgesLength = 0;
this.clusterSession = 0;
this.clusterSizeWidthFactor = constants.clustering.nodeScaling.width;
this.clusterSizeHeightFactor = constants.clustering.nodeScaling.height;
this.clusterSizeRadiusFactor = constants.clustering.nodeScaling.radius;
this.maxNodeSizeIncrements = constants.clustering.maxNodeSizeIncrements;
this.growthIndicator = 0;
// variables to tell the node about the graph.
this.graphScaleInv = 1;
this.graphScale = 1;
this.canvasTopLeft = {"x": -300, "y": -300};
this.canvasBottomRight = {"x": 300, "y": 300};
this.parentEdgeId = null;
}
/**
* (re)setting the clustering variables and objects
*/
Node.prototype.resetCluster = function() {
// clustering variables
this.formationScale = undefined; // this is used to determine when to open the cluster
this.clusterSize = 1; // this signifies the total amount of nodes in this cluster
this.containedNodes = {};
this.containedEdges = {};
this.clusterSessions = [];
};
/**
* Attach a edge to the node
* @param {Edge} edge
*/
Node.prototype.attachEdge = function(edge) {
if (this.edges.indexOf(edge) == -1) {
this.edges.push(edge);
}
if (this.dynamicEdges.indexOf(edge) == -1) {
this.dynamicEdges.push(edge);
}
this.dynamicEdgesLength = this.dynamicEdges.length;
};
/**
* Detach a edge from the node
* @param {Edge} edge
*/
Node.prototype.detachEdge = function(edge) {
var index = this.edges.indexOf(edge);
if (index != -1) {
this.edges.splice(index, 1);
this.dynamicEdges.splice(index, 1);
}
this.dynamicEdgesLength = this.dynamicEdges.length;
};
/**
* Set or overwrite properties for the node
* @param {Object} properties an object with properties
* @param {Object} constants and object with default, global properties
*/
Node.prototype.setProperties = function(properties, constants) {
if (!properties) {
return;
}
this.originalLabel = undefined;
// basic properties
if (properties.id !== undefined) {this.id = properties.id;}
if (properties.label !== undefined) {this.label = properties.label; this.originalLabel = properties.label;}
if (properties.title !== undefined) {this.title = properties.title;}
if (properties.group !== undefined) {this.group = properties.group;}
if (properties.x !== undefined) {this.x = properties.x;}
if (properties.y !== undefined) {this.y = properties.y;}
if (properties.value !== undefined) {this.value = properties.value;}
if (properties.level !== undefined) {this.level = properties.level; this.preassignedLevel = true;}
// physics
if (properties.mass !== undefined) {this.mass = properties.mass;}
// navigation controls properties
if (properties.horizontalAlignLeft !== undefined) {this.horizontalAlignLeft = properties.horizontalAlignLeft;}
if (properties.verticalAlignTop !== undefined) {this.verticalAlignTop = properties.verticalAlignTop;}
if (properties.triggerFunction !== undefined) {this.triggerFunction = properties.triggerFunction;}
if (this.id === undefined) {
throw "Node must have an id";
}
// copy group properties
if (this.group) {
var groupObj = this.grouplist.get(this.group);
for (var prop in groupObj) {
if (groupObj.hasOwnProperty(prop)) {
this[prop] = groupObj[prop];
}
}
}
// individual shape properties
if (properties.shape !== undefined) {this.shape = properties.shape;}
if (properties.image !== undefined) {this.image = properties.image;}
if (properties.radius !== undefined) {this.radius = properties.radius;}
if (properties.color !== undefined) {this.color = util.parseColor(properties.color);}
if (properties.fontColor !== undefined) {this.fontColor = properties.fontColor;}
if (properties.fontSize !== undefined) {this.fontSize = properties.fontSize;}
if (properties.fontFace !== undefined) {this.fontFace = properties.fontFace;}
if (this.image !== undefined && this.image != "") {
if (this.imagelist) {
this.imageObj = this.imagelist.load(this.image);
}
else {
throw "No imagelist provided";
}
}
this.xFixed = this.xFixed || (properties.x !== undefined && !properties.allowedToMoveX);
this.yFixed = this.yFixed || (properties.y !== undefined && !properties.allowedToMoveY);
this.radiusFixed = this.radiusFixed || (properties.radius !== undefined);
if (this.shape == 'image') {
this.radiusMin = constants.nodes.widthMin;
this.radiusMax = constants.nodes.widthMax;
}
// choose draw method depending on the shape
switch (this.shape) {
case 'database': this.draw = this._drawDatabase; this.resize = this._resizeDatabase; break;
case 'box': this.draw = this._drawBox; this.resize = this._resizeBox; break;
case 'circle': this.draw = this._drawCircle; this.resize = this._resizeCircle; break;
case 'ellipse': this.draw = this._drawEllipse; this.resize = this._resizeEllipse; break;
// TODO: add diamond shape
case 'image': this.draw = this._drawImage; this.resize = this._resizeImage; break;
case 'text': this.draw = this._drawText; this.resize = this._resizeText; break;
case 'dot': this.draw = this._drawDot; this.resize = this._resizeShape; break;
case 'square': this.draw = this._drawSquare; this.resize = this._resizeShape; break;
case 'triangle': this.draw = this._drawTriangle; this.resize = this._resizeShape; break;
case 'triangleDown': this.draw = this._drawTriangleDown; this.resize = this._resizeShape; break;
case 'star': this.draw = this._drawStar; this.resize = this._resizeShape; break;
default: this.draw = this._drawEllipse; this.resize = this._resizeEllipse; break;
}
// reset the size of the node, this can be changed
this._reset();
};
/**
* select this node
*/
Node.prototype.select = function() {
this.selected = true;
this._reset();
};
/**
* unselect this node
*/
Node.prototype.unselect = function() {
this.selected = false;
this._reset();
};
/**
* Reset the calculated size of the node, forces it to recalculate its size
*/
Node.prototype.clearSizeCache = function() {
this._reset();
};
/**
* Reset the calculated size of the node, forces it to recalculate its size
* @private
*/
Node.prototype._reset = function() {
this.width = undefined;
this.height = undefined;
};
/**
* get the title of this node.
* @return {string} title The title of the node, or undefined when no title
* has been set.
*/
Node.prototype.getTitle = function() {
return typeof this.title === "function" ? this.title() : this.title;
};
/**
* Calculate the distance to the border of the Node
* @param {CanvasRenderingContext2D} ctx
* @param {Number} angle Angle in radians
* @returns {number} distance Distance to the border in pixels
*/
Node.prototype.distanceToBorder = function (ctx, angle) {
var borderWidth = 1;
if (!this.width) {
this.resize(ctx);
}
switch (this.shape) {
case 'circle':
case 'dot':
return this.radius + borderWidth;
case 'ellipse':
var a = this.width / 2;
var b = this.height / 2;
var w = (Math.sin(angle) * a);
var h = (Math.cos(angle) * b);
return a * b / Math.sqrt(w * w + h * h);
// TODO: implement distanceToBorder for database
// TODO: implement distanceToBorder for triangle
// TODO: implement distanceToBorder for triangleDown
case 'box':
case 'image':
case 'text':
default:
if (this.width) {
return Math.min(
Math.abs(this.width / 2 / Math.cos(angle)),
Math.abs(this.height / 2 / Math.sin(angle))) + borderWidth;
// TODO: reckon with border radius too in case of box
}
else {
return 0;
}
}
// TODO: implement calculation of distance to border for all shapes
};
/**
* Set forces acting on the node
* @param {number} fx Force in horizontal direction
* @param {number} fy Force in vertical direction
*/
Node.prototype._setForce = function(fx, fy) {
this.fx = fx;
this.fy = fy;
};
/**
* Add forces acting on the node
* @param {number} fx Force in horizontal direction
* @param {number} fy Force in vertical direction
* @private
*/
Node.prototype._addForce = function(fx, fy) {
this.fx += fx;
this.fy += fy;
};
/**
* Perform one discrete step for the node
* @param {number} interval Time interval in seconds
*/
Node.prototype.discreteStep = function(interval) {
if (!this.xFixed) {
var dx = this.damping * this.vx; // damping force
var ax = (this.fx - dx) / this.mass; // acceleration
this.vx += ax * interval; // velocity
this.x += this.vx * interval; // position
}
if (!this.yFixed) {
var dy = this.damping * this.vy; // damping force
var ay = (this.fy - dy) / this.mass; // acceleration
this.vy += ay * interval; // velocity
this.y += this.vy * interval; // position
}
};
/**
* Perform one discrete step for the node
* @param {number} interval Time interval in seconds
*/
Node.prototype.discreteStepLimited = function(interval, maxVelocity) {
if (!this.xFixed) {
var dx = this.damping * this.vx; // damping force
var ax = (this.fx - dx) / this.mass; // acceleration
this.vx += ax * interval; // velocity
this.vx = (Math.abs(this.vx) > maxVelocity) ? ((this.vx > 0) ? maxVelocity : -maxVelocity) : this.vx;
this.x += this.vx * interval; // position
}
else {
this.fx = 0;
}
if (!this.yFixed) {
var dy = this.damping * this.vy; // damping force
var ay = (this.fy - dy) / this.mass; // acceleration
this.vy += ay * interval; // velocity
this.vy = (Math.abs(this.vy) > maxVelocity) ? ((this.vy > 0) ? maxVelocity : -maxVelocity) : this.vy;
this.y += this.vy * interval; // position
}
else {
this.fy = 0;
}
};
/**
* Check if this node has a fixed x and y position
* @return {boolean} true if fixed, false if not
*/
Node.prototype.isFixed = function() {
return (this.xFixed && this.yFixed);
};
/**
* Check if this node is moving
* @param {number} vmin the minimum velocity considered as "moving"
* @return {boolean} true if moving, false if it has no velocity
*/
// TODO: replace this method with calculating the kinetic energy
Node.prototype.isMoving = function(vmin) {
return (Math.abs(this.vx) > vmin || Math.abs(this.vy) > vmin);
};
/**
* check if this node is selecte
* @return {boolean} selected True if node is selected, else false
*/
Node.prototype.isSelected = function() {
return this.selected;
};
/**
* Retrieve the value of the node. Can be undefined
* @return {Number} value
*/
Node.prototype.getValue = function() {
return this.value;
};
/**
* Calculate the distance from the nodes location to the given location (x,y)
* @param {Number} x
* @param {Number} y
* @return {Number} value
*/
Node.prototype.getDistance = function(x, y) {
var dx = this.x - x,
dy = this.y - y;
return Math.sqrt(dx * dx + dy * dy);
};
/**
* Adjust the value range of the node. The node will adjust it's radius
* based on its value.
* @param {Number} min
* @param {Number} max
*/
Node.prototype.setValueRange = function(min, max) {
if (!this.radiusFixed && this.value !== undefined) {
if (max == min) {
this.radius = (this.radiusMin + this.radiusMax) / 2;
}
else {
var scale = (this.radiusMax - this.radiusMin) / (max - min);
this.radius = (this.value - min) * scale + this.radiusMin;
}
}
this.baseRadiusValue = this.radius;
};
/**
* Draw this node in the given canvas
* The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d");
* @param {CanvasRenderingContext2D} ctx
*/
Node.prototype.draw = function(ctx) {
throw "Draw method not initialized for node";
};
/**
* Recalculate the size of this node in the given canvas
* The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d");
* @param {CanvasRenderingContext2D} ctx
*/
Node.prototype.resize = function(ctx) {
throw "Resize method not initialized for node";
};
/**
* Check if this object is overlapping with the provided object
* @param {Object} obj an object with parameters left, top, right, bottom
* @return {boolean} True if location is located on node
*/
Node.prototype.isOverlappingWith = function(obj) {
return (this.left < obj.right &&
this.left + this.width > obj.left &&
this.top < obj.bottom &&
this.top + this.height > obj.top);
};
Node.prototype._resizeImage = function (ctx) {
// TODO: pre calculate the image size
if (!this.width || !this.height) { // undefined or 0
var width, height;
if (this.value) {
this.radius = this.baseRadiusValue;
var scale = this.imageObj.height / this.imageObj.width;
if (scale !== undefined) {
width = this.radius || this.imageObj.width;
height = this.radius * scale || this.imageObj.height;
}
else {
width = 0;
height = 0;
}
}
else {
width = this.imageObj.width;
height = this.imageObj.height;
}
this.width = width;
this.height = height;
this.growthIndicator = 0;
if (this.width > 0 && this.height > 0) {
this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeWidthFactor;
this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeHeightFactor;
this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeRadiusFactor;
this.growthIndicator = this.width - width;
}
}
};
Node.prototype._drawImage = function (ctx) {
this._resizeImage(ctx);
this.left = this.x - this.width / 2;
this.top = this.y - this.height / 2;
var yLabel;
if (this.imageObj.width != 0 ) {
// draw the shade
if (this.clusterSize > 1) {
var lineWidth = ((this.clusterSize > 1) ? 10 : 0.0);
lineWidth *= this.graphScaleInv;
lineWidth = Math.min(0.2 * this.width,lineWidth);
ctx.globalAlpha = 0.5;
ctx.drawImage(this.imageObj, this.left - lineWidth, this.top - lineWidth, this.width + 2*lineWidth, this.height + 2*lineWidth);
}
// draw the image
ctx.globalAlpha = 1.0;
ctx.drawImage(this.imageObj, this.left, this.top, this.width, this.height);
yLabel = this.y + this.height / 2;
}
else {
// image still loading... just draw the label for now
yLabel = this.y;
}
this._label(ctx, this.label, this.x, yLabel, undefined, "top");
};
Node.prototype._resizeBox = function (ctx) {
if (!this.width) {
var margin = 5;
var textSize = this.getTextSize(ctx);
this.width = textSize.width + 2 * margin;
this.height = textSize.height + 2 * margin;
this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeWidthFactor;
this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeHeightFactor;
this.growthIndicator = this.width - (textSize.width + 2 * margin);
// this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeRadiusFactor;
}
};
Node.prototype._drawBox = function (ctx) {
this._resizeBox(ctx);
this.left = this.x - this.width / 2;
this.top = this.y - this.height / 2;
var clusterLineWidth = 2.5;
var selectionLineWidth = 2;
ctx.strokeStyle = this.selected ? this.color.highlight.border : this.color.border;
// draw the outer border
if (this.clusterSize > 1) {
ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0);
ctx.lineWidth *= this.graphScaleInv;
ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth);
ctx.roundRect(this.left-2*ctx.lineWidth, this.top-2*ctx.lineWidth, this.width+4*ctx.lineWidth, this.height+4*ctx.lineWidth, this.radius);
ctx.stroke();
}
ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0);
ctx.lineWidth *= this.graphScaleInv;
ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth);
ctx.fillStyle = this.selected ? this.color.highlight.background : this.color.background;
ctx.roundRect(this.left, this.top, this.width, this.height, this.radius);
ctx.fill();
ctx.stroke();
this._label(ctx, this.label, this.x, this.y);
};
Node.prototype._resizeDatabase = function (ctx) {
if (!this.width) {
var margin = 5;
var textSize = this.getTextSize(ctx);
var size = textSize.width + 2 * margin;
this.width = size;
this.height = size;
// scaling used for clustering
this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeWidthFactor;
this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeHeightFactor;
this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeRadiusFactor;
this.growthIndicator = this.width - size;
}
};
Node.prototype._drawDatabase = function (ctx) {
this._resizeDatabase(ctx);
this.left = this.x - this.width / 2;
this.top = this.y - this.height / 2;
var clusterLineWidth = 2.5;
var selectionLineWidth = 2;
ctx.strokeStyle = this.selected ? this.color.highlight.border : this.color.border;
// draw the outer border
if (this.clusterSize > 1) {
ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0);
ctx.lineWidth *= this.graphScaleInv;
ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth);
ctx.database(this.x - this.width/2 - 2*ctx.lineWidth, this.y - this.height*0.5 - 2*ctx.lineWidth, this.width + 4*ctx.lineWidth, this.height + 4*ctx.lineWidth);
ctx.stroke();
}
ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0);
ctx.lineWidth *= this.graphScaleInv;
ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth);
ctx.fillStyle = this.selected ? this.color.highlight.background : this.color.background;
ctx.database(this.x - this.width/2, this.y - this.height*0.5, this.width, this.height);
ctx.fill();
ctx.stroke();
this._label(ctx, this.label, this.x, this.y);
};
Node.prototype._resizeCircle = function (ctx) {
if (!this.width) {
var margin = 5;
var textSize = this.getTextSize(ctx);
var diameter = Math.max(textSize.width, textSize.height) + 2 * margin;
this.radius = diameter / 2;
this.width = diameter;
this.height = diameter;
// scaling used for clustering
// this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeWidthFactor;
// this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeHeightFactor;
this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeRadiusFactor;
this.growthIndicator = this.radius - 0.5*diameter;
}
};
Node.prototype._drawCircle = function (ctx) {
this._resizeCircle(ctx);
this.left = this.x - this.width / 2;
this.top = this.y - this.height / 2;
var clusterLineWidth = 2.5;
var selectionLineWidth = 2;
ctx.strokeStyle = this.selected ? this.color.highlight.border : this.color.border;
// draw the outer border
if (this.clusterSize > 1) {
ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0);
ctx.lineWidth *= this.graphScaleInv;
ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth);
ctx.circle(this.x, this.y, this.radius+2*ctx.lineWidth);
ctx.stroke();
}
ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0);
ctx.lineWidth *= this.graphScaleInv;
ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth);
ctx.fillStyle = this.selected ? this.color.highlight.background : this.color.background;
ctx.circle(this.x, this.y, this.radius);
ctx.fill();
ctx.stroke();
this._label(ctx, this.label, this.x, this.y);
};
Node.prototype._resizeEllipse = function (ctx) {
if (!this.width) {
var textSize = this.getTextSize(ctx);
this.width = textSize.width * 1.5;
this.height = textSize.height * 2;
if (this.width < this.height) {
this.width = this.height;
}
var defaultSize = this.width;
// scaling used for clustering
this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeWidthFactor;
this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeHeightFactor;
this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeRadiusFactor;
this.growthIndicator = this.width - defaultSize;
}
};
Node.prototype._drawEllipse = function (ctx) {
this._resizeEllipse(ctx);
this.left = this.x - this.width / 2;
this.top = this.y - this.height / 2;
var clusterLineWidth = 2.5;
var selectionLineWidth = 2;
ctx.strokeStyle = this.selected ? this.color.highlight.border : this.color.border;
// draw the outer border
if (this.clusterSize > 1) {
ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0);
ctx.lineWidth *= this.graphScaleInv;
ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth);
ctx.ellipse(this.left-2*ctx.lineWidth, this.top-2*ctx.lineWidth, this.width+4*ctx.lineWidth, this.height+4*ctx.lineWidth);
ctx.stroke();
}
ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0);
ctx.lineWidth *= this.graphScaleInv;
ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth);
ctx.fillStyle = this.selected ? this.color.highlight.background : this.color.background;
ctx.ellipse(this.left, this.top, this.width, this.height);
ctx.fill();
ctx.stroke();
this._label(ctx, this.label, this.x, this.y);
};
Node.prototype._drawDot = function (ctx) {
this._drawShape(ctx, 'circle');
};
Node.prototype._drawTriangle = function (ctx) {
this._drawShape(ctx, 'triangle');
};
Node.prototype._drawTriangleDown = function (ctx) {
this._drawShape(ctx, 'triangleDown');
};
Node.prototype._drawSquare = function (ctx) {
this._drawShape(ctx, 'square');
};
Node.prototype._drawStar = function (ctx) {
this._drawShape(ctx, 'star');
};
Node.prototype._resizeShape = function (ctx) {
if (!this.width) {
this.radius = this.baseRadiusValue;
var size = 2 * this.radius;
this.width = size;
this.height = size;
// scaling used for clustering
this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeWidthFactor;
this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeHeightFactor;
this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * 0.5 * this.clusterSizeRadiusFactor;
this.growthIndicator = this.width - size;
}
};
Node.prototype._drawShape = function (ctx, shape) {
this._resizeShape(ctx);
this.left = this.x - this.width / 2;
this.top = this.y - this.height / 2;
var clusterLineWidth = 2.5;
var selectionLineWidth = 2;
var radiusMultiplier = 2;
// choose draw method depending on the shape
switch (shape) {
case 'dot': radiusMultiplier = 2; break;
case 'square': radiusMultiplier = 2; break;
case 'triangle': radiusMultiplier = 3; break;
case 'triangleDown': radiusMultiplier = 3; break;
case 'star': radiusMultiplier = 4; break;
}
ctx.strokeStyle = this.selected ? this.color.highlight.border : this.color.border;
// draw the outer border
if (this.clusterSize > 1) {
ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0);
ctx.lineWidth *= this.graphScaleInv;
ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth);
ctx[shape](this.x, this.y, this.radius + radiusMultiplier * ctx.lineWidth);
ctx.stroke();
}
ctx.lineWidth = (this.selected ? selectionLineWidth : 1.0) + ((this.clusterSize > 1) ? clusterLineWidth : 0.0);
ctx.lineWidth *= this.graphScaleInv;
ctx.lineWidth = Math.min(0.1 * this.width,ctx.lineWidth);
ctx.fillStyle = this.selected ? this.color.highlight.background : this.color.background;
ctx[shape](this.x, this.y, this.radius);
ctx.fill();
ctx.stroke();
if (this.label) {
this._label(ctx, this.label, this.x, this.y + this.height / 2, undefined, 'top');
}
};
Node.prototype._resizeText = function (ctx) {
if (!this.width) {
var margin = 5;
var textSize = this.getTextSize(ctx);
this.width = textSize.width + 2 * margin;
this.height = textSize.height + 2 * margin;
// scaling used for clustering
this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeWidthFactor;
this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeHeightFactor;
this.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeRadiusFactor;
this.growthIndicator = this.width - (textSize.width + 2 * margin);
}
};
Node.prototype._drawText = function (ctx) {
this._resizeText(ctx);
this.left = this.x - this.width / 2;
this.top = this.y - this.height / 2;
this._label(ctx, this.label, this.x, this.y);
};
Node.prototype._label = function (ctx, text, x, y, align, baseline) {
if (text && this.fontSize * this.graphScale > this.fontDrawThreshold) {
ctx.font = (this.selected ? "bold " : "") + this.fontSize + "px " + this.fontFace;
ctx.fillStyle = this.fontColor || "black";
ctx.textAlign = align || "center";
ctx.textBaseline = baseline || "middle";
var lines = text.split('\n'),
lineCount = lines.length,
fontSize = (this.fontSize + 4),
yLine = y + (1 - lineCount) / 2 * fontSize;
for (var i = 0; i < lineCount; i++) {
ctx.fillText(lines[i], x, yLine);
yLine += fontSize;
}
}
};
Node.prototype.getTextSize = function(ctx) {
if (this.label !== undefined) {
ctx.font = (this.selected ? "bold " : "") + this.fontSize + "px " + this.fontFace;
var lines = this.label.split('\n'),
height = (this.fontSize + 4) * lines.length,
width = 0;
for (var i = 0, iMax = lines.length; i < iMax; i++) {
width = Math.max(width, ctx.measureText(lines[i]).width);
}
return {"width": width, "height": height};
}
else {
return {"width": 0, "height": 0};
}
};
/**
* this is used to determine if a node is visible at all. this is used to determine when it needs to be drawn.
* there is a safety margin of 0.3 * width;
*
* @returns {boolean}
*/
Node.prototype.inArea = function() {
if (this.width !== undefined) {
return (this.x + this.width*this.graphScaleInv >= this.canvasTopLeft.x &&
this.x - this.width*this.graphScaleInv < this.canvasBottomRight.x &&
this.y + this.height*this.graphScaleInv >= this.canvasTopLeft.y &&
this.y - this.height*this.graphScaleInv < this.canvasBottomRight.y);
}
else {
return true;
}
};
/**
* checks if the core of the node is in the display area, this is used for opening clusters around zoom
* @returns {boolean}
*/
Node.prototype.inView = function() {
return (this.x >= this.canvasTopLeft.x &&
this.x < this.canvasBottomRight.x &&
this.y >= this.canvasTopLeft.y &&
this.y < this.canvasBottomRight.y);
};
/**
* This allows the zoom level of the graph to influence the rendering
* We store the inverted scale and the coordinates of the top left, and bottom right points of the canvas
*
* @param scale
* @param canvasTopLeft
* @param canvasBottomRight
*/
Node.prototype.setScaleAndPos = function(scale,canvasTopLeft,canvasBottomRight) {
this.graphScaleInv = 1.0/scale;
this.graphScale = scale;
this.canvasTopLeft = canvasTopLeft;
this.canvasBottomRight = canvasBottomRight;
};
/**
* This allows the zoom level of the graph to influence the rendering
*
* @param scale
*/
Node.prototype.setScale = function(scale) {
this.graphScaleInv = 1.0/scale;
this.graphScale = scale;
};
/**
* set the velocity at 0. Is called when this node is contained in another during clustering
*/
Node.prototype.clearVelocity = function() {
this.vx = 0;
this.vy = 0;
};
/**
* Basic preservation of (kinectic) energy
*
* @param massBeforeClustering
*/
Node.prototype.updateVelocity = function(massBeforeClustering) {
var energyBefore = this.vx * this.vx * massBeforeClustering;
//this.vx = (this.vx < 0) ? -Math.sqrt(energyBefore/this.mass) : Math.sqrt(energyBefore/this.mass);
this.vx = Math.sqrt(energyBefore/this.mass);
energyBefore = this.vy * this.vy * massBeforeClustering;
//this.vy = (this.vy < 0) ? -Math.sqrt(energyBefore/this.mass) : Math.sqrt(energyBefore/this.mass);
this.vy = Math.sqrt(energyBefore/this.mass);
};
/**
* @class Edge
*
* A edge connects two nodes
* @param {Object} properties Object with properties. Must contain
* At least properties from and to.
* Available properties: from (number),
* to (number), label (string, color (string),
* width (number), style (string),
* length (number), title (string)
* @param {Graph} graph A graph object, used to find and edge to
* nodes.
* @param {Object} constants An object with default values for
* example for the color
*/
function Edge (properties, graph, constants) {
if (!graph) {
throw "No graph provided";
}
this.graph = graph;
// initialize constants
this.widthMin = constants.edges.widthMin;
this.widthMax = constants.edges.widthMax;
// initialize variables
this.id = undefined;
this.fromId = undefined;
this.toId = undefined;
this.style = constants.edges.style;
this.title = undefined;
this.width = constants.edges.width;
this.value = undefined;
this.length = constants.physics.springLength;
this.customLength = false;
this.selected = false;
this.smooth = constants.smoothCurves;
this.from = null; // a node
this.to = null; // a node
this.via = null; // a temp node
// we use this to be able to reconnect the edge to a cluster if its node is put into a cluster
// by storing the original information we can revert to the original connection when the cluser is opened.
this.originalFromId = [];
this.originalToId = [];
this.connected = false;
// Added to support dashed lines
// David Jordan
// 2012-08-08
this.dash = util.extend({}, constants.edges.dash); // contains properties length, gap, altLength
this.color = {color:constants.edges.color.color,
highlight:constants.edges.color.highlight};
this.widthFixed = false;
this.lengthFixed = false;
this.setProperties(properties, constants);
}
/**
* Set or overwrite properties for the edge
* @param {Object} properties an object with properties
* @param {Object} constants and object with default, global properties
*/
Edge.prototype.setProperties = function(properties, constants) {
if (!properties) {
return;
}
if (properties.from !== undefined) {this.fromId = properties.from;}
if (properties.to !== undefined) {this.toId = properties.to;}
if (properties.id !== undefined) {this.id = properties.id;}
if (properties.style !== undefined) {this.style = properties.style;}
if (properties.label !== undefined) {this.label = properties.label;}
if (this.label) {
this.fontSize = constants.edges.fontSize;
this.fontFace = constants.edges.fontFace;
this.fontColor = constants.edges.fontColor;
this.fontFill = constants.edges.fontFill;
if (properties.fontColor !== undefined) {this.fontColor = properties.fontColor;}
if (properties.fontSize !== undefined) {this.fontSize = properties.fontSize;}
if (properties.fontFace !== undefined) {this.fontFace = properties.fontFace;}
if (properties.fontFill !== undefined) {this.fontFill = properties.fontFill;}
}
if (properties.title !== undefined) {this.title = properties.title;}
if (properties.width !== undefined) {this.width = properties.width;}
if (properties.value !== undefined) {this.value = properties.value;}
if (properties.length !== undefined) {this.length = properties.length;
this.customLength = true;}
// Added to support dashed lines
// David Jordan
// 2012-08-08
if (properties.dash) {
if (properties.dash.length !== undefined) {this.dash.length = properties.dash.length;}
if (properties.dash.gap !== undefined) {this.dash.gap = properties.dash.gap;}
if (properties.dash.altLength !== undefined) {this.dash.altLength = properties.dash.altLength;}
}
if (properties.color !== undefined) {
if (util.isString(properties.color)) {
this.color.color = properties.color;
this.color.highlight = properties.color;
}
else {
if (properties.color.color !== undefined) {this.color.color = properties.color.color;}
if (properties.color.highlight !== undefined) {this.color.highlight = properties.color.highlight;}
}
}
// A node is connected when it has a from and to node.
this.connect();
this.widthFixed = this.widthFixed || (properties.width !== undefined);
this.lengthFixed = this.lengthFixed || (properties.length !== undefined);
// set draw method based on style
switch (this.style) {
case 'line': this.draw = this._drawLine; break;
case 'arrow': this.draw = this._drawArrow; break;
case 'arrow-center': this.draw = this._drawArrowCenter; break;
case 'dash-line': this.draw = this._drawDashLine; break;
default: this.draw = this._drawLine; break;
}
};
/**
* Connect an edge to its nodes
*/
Edge.prototype.connect = function () {
this.disconnect();
this.from = this.graph.nodes[this.fromId] || null;
this.to = this.graph.nodes[this.toId] || null;
this.connected = (this.from && this.to);
if (this.connected) {
this.from.attachEdge(this);
this.to.attachEdge(this);
}
else {
if (this.from) {
this.from.detachEdge(this);
}
if (this.to) {
this.to.detachEdge(this);
}
}
};
/**
* Disconnect an edge from its nodes
*/
Edge.prototype.disconnect = function () {
if (this.from) {
this.from.detachEdge(this);
this.from = null;
}
if (this.to) {
this.to.detachEdge(this);
this.to = null;
}
this.connected = false;
};
/**
* get the title of this edge.
* @return {string} title The title of the edge, or undefined when no title
* has been set.
*/
Edge.prototype.getTitle = function() {
return typeof this.title === "function" ? this.title() : this.title;
};
/**
* Retrieve the value of the edge. Can be undefined
* @return {Number} value
*/
Edge.prototype.getValue = function() {
return this.value;
};
/**
* Adjust the value range of the edge. The edge will adjust it's width
* based on its value.
* @param {Number} min
* @param {Number} max
*/
Edge.prototype.setValueRange = function(min, max) {
if (!this.widthFixed && this.value !== undefined) {
var scale = (this.widthMax - this.widthMin) / (max - min);
this.width = (this.value - min) * scale + this.widthMin;
}
};
/**
* Redraw a edge
* Draw this edge in the given canvas
* The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d");
* @param {CanvasRenderingContext2D} ctx
*/
Edge.prototype.draw = function(ctx) {
throw "Method draw not initialized in edge";
};
/**
* Check if this object is overlapping with the provided object
* @param {Object} obj an object with parameters left, top
* @return {boolean} True if location is located on the edge
*/
Edge.prototype.isOverlappingWith = function(obj) {
if (this.connected) {
var distMax = 10;
var xFrom = this.from.x;
var yFrom = this.from.y;
var xTo = this.to.x;
var yTo = this.to.y;
var xObj = obj.left;
var yObj = obj.top;
var dist = this._getDistanceToEdge(xFrom, yFrom, xTo, yTo, xObj, yObj);
return (dist < distMax);
}
else {
return false
}
};
/**
* Redraw a edge as a line
* Draw this edge in the given canvas
* The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d");
* @param {CanvasRenderingContext2D} ctx
* @private
*/
Edge.prototype._drawLine = function(ctx) {
// set style
if (this.selected == true) {ctx.strokeStyle = this.color.highlight;}
else {ctx.strokeStyle = this.color.color;}
ctx.lineWidth = this._getLineWidth();
if (this.from != this.to) {
// draw line
this._line(ctx);
// draw label
var point;
if (this.label) {
if (this.smooth == true) {
var midpointX = 0.5*(0.5*(this.from.x + this.via.x) + 0.5*(this.to.x + this.via.x));
var midpointY = 0.5*(0.5*(this.from.y + this.via.y) + 0.5*(this.to.y + this.via.y));
point = {x:midpointX, y:midpointY};
}
else {
point = this._pointOnLine(0.5);
}
this._label(ctx, this.label, point.x, point.y);
}
}
else {
var x, y;
var radius = this.length / 4;
var node = this.from;
if (!node.width) {
node.resize(ctx);
}
if (node.width > node.height) {
x = node.x + node.width / 2;
y = node.y - radius;
}
else {
x = node.x + radius;
y = node.y - node.height / 2;
}
this._circle(ctx, x, y, radius);
point = this._pointOnCircle(x, y, radius, 0.5);
this._label(ctx, this.label, point.x, point.y);
}
};
/**
* Get the line width of the edge. Depends on width and whether one of the
* connected nodes is selected.
* @return {Number} width
* @private
*/
Edge.prototype._getLineWidth = function() {
if (this.selected == true) {
return Math.min(this.width * 2, this.widthMax)*this.graphScaleInv;
}
else {
return this.width*this.graphScaleInv;
}
};
/**
* Draw a line between two nodes
* @param {CanvasRenderingContext2D} ctx
* @private
*/
Edge.prototype._line = function (ctx) {
// draw a straight line
ctx.beginPath();
ctx.moveTo(this.from.x, this.from.y);
if (this.smooth == true) {
ctx.quadraticCurveTo(this.via.x,this.via.y,this.to.x, this.to.y);
}
else {
ctx.lineTo(this.to.x, this.to.y);
}
ctx.stroke();
};
/**
* Draw a line from a node to itself, a circle
* @param {CanvasRenderingContext2D} ctx
* @param {Number} x
* @param {Number} y
* @param {Number} radius
* @private
*/
Edge.prototype._circle = function (ctx, x, y, radius) {
// draw a circle
ctx.beginPath();
ctx.arc(x, y, radius, 0, 2 * Math.PI, false);
ctx.stroke();
};
/**
* Draw label with white background and with the middle at (x, y)
* @param {CanvasRenderingContext2D} ctx
* @param {String} text
* @param {Number} x
* @param {Number} y
* @private
*/
Edge.prototype._label = function (ctx, text, x, y) {
if (text) {
// TODO: cache the calculated size
ctx.font = ((this.from.selected || this.to.selected) ? "bold " : "") +
this.fontSize + "px " + this.fontFace;
ctx.fillStyle = this.fontFill;
var width = ctx.measureText(text).width;
var height = this.fontSize;
var left = x - width / 2;
var top = y - height / 2;
ctx.fillRect(left, top, width, height);
// draw text
ctx.fillStyle = this.fontColor || "black";
ctx.textAlign = "left";
ctx.textBaseline = "top";
ctx.fillText(text, left, top);
}
};
/**
* Redraw a edge as a dashed line
* Draw this edge in the given canvas
* @author David Jordan
* @date 2012-08-08
* The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d");
* @param {CanvasRenderingContext2D} ctx
* @private
*/
Edge.prototype._drawDashLine = function(ctx) {
// set style
if (this.selected == true) {ctx.strokeStyle = this.color.highlight;}
else {ctx.strokeStyle = this.color.color;}
ctx.lineWidth = this._getLineWidth();
// only firefox and chrome support this method, else we use the legacy one.
if (ctx.mozDash !== undefined || ctx.setLineDash !== undefined) {
ctx.beginPath();
ctx.moveTo(this.from.x, this.from.y);
// configure the dash pattern
var pattern = [0];
if (this.dash.length !== undefined && this.dash.gap !== undefined) {
pattern = [this.dash.length,this.dash.gap];
}
else {
pattern = [5,5];
}
// set dash settings for chrome or firefox
if (typeof ctx.setLineDash !== 'undefined') { //Chrome
ctx.setLineDash(pattern);
ctx.lineDashOffset = 0;
} else { //Firefox
ctx.mozDash = pattern;
ctx.mozDashOffset = 0;
}
// draw the line
if (this.smooth == true) {
ctx.quadraticCurveTo(this.via.x,this.via.y,this.to.x, this.to.y);
}
else {
ctx.lineTo(this.to.x, this.to.y);
}
ctx.stroke();
// restore the dash settings.
if (typeof ctx.setLineDash !== 'undefined') { //Chrome
ctx.setLineDash([0]);
ctx.lineDashOffset = 0;
} else { //Firefox
ctx.mozDash = [0];
ctx.mozDashOffset = 0;
}
}
else { // unsupporting smooth lines
// draw dashed line
ctx.beginPath();
ctx.lineCap = 'round';
if (this.dash.altLength !== undefined) //If an alt dash value has been set add to the array this value
{
ctx.dashedLine(this.from.x,this.from.y,this.to.x,this.to.y,
[this.dash.length,this.dash.gap,this.dash.altLength,this.dash.gap]);
}
else if (this.dash.length !== undefined && this.dash.gap !== undefined) //If a dash and gap value has been set add to the array this value
{
ctx.dashedLine(this.from.x,this.from.y,this.to.x,this.to.y,
[this.dash.length,this.dash.gap]);
}
else //If all else fails draw a line
{
ctx.moveTo(this.from.x, this.from.y);
ctx.lineTo(this.to.x, this.to.y);
}
ctx.stroke();
}
// draw label
if (this.label) {
var point;
if (this.smooth == true) {
var midpointX = 0.5*(0.5*(this.from.x + this.via.x) + 0.5*(this.to.x + this.via.x));
var midpointY = 0.5*(0.5*(this.from.y + this.via.y) + 0.5*(this.to.y + this.via.y));
point = {x:midpointX, y:midpointY};
}
else {
point = this._pointOnLine(0.5);
}
this._label(ctx, this.label, point.x, point.y);
}
};
/**
* Get a point on a line
* @param {Number} percentage. Value between 0 (line start) and 1 (line end)
* @return {Object} point
* @private
*/
Edge.prototype._pointOnLine = function (percentage) {
return {
x: (1 - percentage) * this.from.x + percentage * this.to.x,
y: (1 - percentage) * this.from.y + percentage * this.to.y
}
};
/**
* Get a point on a circle
* @param {Number} x
* @param {Number} y
* @param {Number} radius
* @param {Number} percentage. Value between 0 (line start) and 1 (line end)
* @return {Object} point
* @private
*/
Edge.prototype._pointOnCircle = function (x, y, radius, percentage) {
var angle = (percentage - 3/8) * 2 * Math.PI;
return {
x: x + radius * Math.cos(angle),
y: y - radius * Math.sin(angle)
}
};
/**
* Redraw a edge as a line with an arrow halfway the line
* Draw this edge in the given canvas
* The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d");
* @param {CanvasRenderingContext2D} ctx
* @private
*/
Edge.prototype._drawArrowCenter = function(ctx) {
var point;
// set style
if (this.selected == true) {ctx.strokeStyle = this.color.highlight; ctx.fillStyle = this.color.highlight;}
else {ctx.strokeStyle = this.color.color; ctx.fillStyle = this.color.color;}
ctx.lineWidth = this._getLineWidth();
if (this.from != this.to) {
// draw line
this._line(ctx);
var angle = Math.atan2((this.to.y - this.from.y), (this.to.x - this.from.x));
var length = 10 + 5 * this.width; // TODO: make customizable?
// draw an arrow halfway the line
if (this.smooth == true) {
var midpointX = 0.5*(0.5*(this.from.x + this.via.x) + 0.5*(this.to.x + this.via.x));
var midpointY = 0.5*(0.5*(this.from.y + this.via.y) + 0.5*(this.to.y + this.via.y));
point = {x:midpointX, y:midpointY};
}
else {
point = this._pointOnLine(0.5);
}
ctx.arrow(point.x, point.y, angle, length);
ctx.fill();
ctx.stroke();
// draw label
if (this.label) {
this._label(ctx, this.label, point.x, point.y);
}
}
else {
// draw circle
var x, y;
var radius = 0.25 * Math.max(100,this.length);
var node = this.from;
if (!node.width) {
node.resize(ctx);
}
if (node.width > node.height) {
x = node.x + node.width * 0.5;
y = node.y - radius;
}
else {
x = node.x + radius;
y = node.y - node.height * 0.5;
}
this._circle(ctx, x, y, radius);
// draw all arrows
var angle = 0.2 * Math.PI;
var length = 10 + 5 * this.width; // TODO: make customizable?
point = this._pointOnCircle(x, y, radius, 0.5);
ctx.arrow(point.x, point.y, angle, length);
ctx.fill();
ctx.stroke();
// draw label
if (this.label) {
point = this._pointOnCircle(x, y, radius, 0.5);
this._label(ctx, this.label, point.x, point.y);
}
}
};
/**
* Redraw a edge as a line with an arrow
* Draw this edge in the given canvas
* The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d");
* @param {CanvasRenderingContext2D} ctx
* @private
*/
Edge.prototype._drawArrow = function(ctx) {
// set style
if (this.selected == true) {ctx.strokeStyle = this.color.highlight; ctx.fillStyle = this.color.highlight;}
else {ctx.strokeStyle = this.color.color; ctx.fillStyle = this.color.color;}
ctx.lineWidth = this._getLineWidth();
var angle, length;
//draw a line
if (this.from != this.to) {
angle = Math.atan2((this.to.y - this.from.y), (this.to.x - this.from.x));
var dx = (this.to.x - this.from.x);
var dy = (this.to.y - this.from.y);
var edgeSegmentLength = Math.sqrt(dx * dx + dy * dy);
var fromBorderDist = this.from.distanceToBorder(ctx, angle + Math.PI);
var fromBorderPoint = (edgeSegmentLength - fromBorderDist) / edgeSegmentLength;
var xFrom = (fromBorderPoint) * this.from.x + (1 - fromBorderPoint) * this.to.x;
var yFrom = (fromBorderPoint) * this.from.y + (1 - fromBorderPoint) * this.to.y;
if (this.smooth == true) {
angle = Math.atan2((this.to.y - this.via.y), (this.to.x - this.via.x));
dx = (this.to.x - this.via.x);
dy = (this.to.y - this.via.y);
edgeSegmentLength = Math.sqrt(dx * dx + dy * dy);
}
var toBorderDist = this.to.distanceToBorder(ctx, angle);
var toBorderPoint = (edgeSegmentLength - toBorderDist) / edgeSegmentLength;
var xTo,yTo;
if (this.smooth == true) {
xTo = (1 - toBorderPoint) * this.via.x + toBorderPoint * this.to.x;
yTo = (1 - toBorderPoint) * this.via.y + toBorderPoint * this.to.y;
}
else {
xTo = (1 - toBorderPoint) * this.from.x + toBorderPoint * this.to.x;
yTo = (1 - toBorderPoint) * this.from.y + toBorderPoint * this.to.y;
}
ctx.beginPath();
ctx.moveTo(xFrom,yFrom);
if (this.smooth == true) {
ctx.quadraticCurveTo(this.via.x,this.via.y,xTo, yTo);
}
else {
ctx.lineTo(xTo, yTo);
}
ctx.stroke();
// draw arrow at the end of the line
length = 10 + 5 * this.width;
ctx.arrow(xTo, yTo, angle, length);
ctx.fill();
ctx.stroke();
// draw label
if (this.label) {
var point;
if (this.smooth == true) {
var midpointX = 0.5*(0.5*(this.from.x + this.via.x) + 0.5*(this.to.x + this.via.x));
var midpointY = 0.5*(0.5*(this.from.y + this.via.y) + 0.5*(this.to.y + this.via.y));
point = {x:midpointX, y:midpointY};
}
else {
point = this._pointOnLine(0.5);
}
this._label(ctx, this.label, point.x, point.y);
}
}
else {
// draw circle
var node = this.from;
var x, y, arrow;
var radius = 0.25 * Math.max(100,this.length);
if (!node.width) {
node.resize(ctx);
}
if (node.width > node.height) {
x = node.x + node.width * 0.5;
y = node.y - radius;
arrow = {
x: x,
y: node.y,
angle: 0.9 * Math.PI
};
}
else {
x = node.x + radius;
y = node.y - node.height * 0.5;
arrow = {
x: node.x,
y: y,
angle: 0.6 * Math.PI
};
}
ctx.beginPath();
// TODO: similarly, for a line without arrows, draw to the border of the nodes instead of the center
ctx.arc(x, y, radius, 0, 2 * Math.PI, false);
ctx.stroke();
// draw all arrows
length = 10 + 5 * this.width; // TODO: make customizable?
ctx.arrow(arrow.x, arrow.y, arrow.angle, length);
ctx.fill();
ctx.stroke();
// draw label
if (this.label) {
point = this._pointOnCircle(x, y, radius, 0.5);
this._label(ctx, this.label, point.x, point.y);
}
}
};
/**
* Calculate the distance between a point (x3,y3) and a line segment from
* (x1,y1) to (x2,y2).
* http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment
* @param {number} x1
* @param {number} y1
* @param {number} x2
* @param {number} y2
* @param {number} x3
* @param {number} y3
* @private
*/
Edge.prototype._getDistanceToEdge = function (x1,y1, x2,y2, x3,y3) { // x3,y3 is the point
if (this.smooth == true) {
var minDistance = 1e9;
var i,t,x,y,dx,dy;
for (i = 0; i < 10; i++) {
t = 0.1*i;
x = Math.pow(1-t,2)*x1 + (2*t*(1 - t))*this.via.x + Math.pow(t,2)*x2;
y = Math.pow(1-t,2)*y1 + (2*t*(1 - t))*this.via.y + Math.pow(t,2)*y2;
dx = Math.abs(x3-x);
dy = Math.abs(y3-y);
minDistance = Math.min(minDistance,Math.sqrt(dx*dx + dy*dy));
}
return minDistance
}
else {
var px = x2-x1,
py = y2-y1,
something = px*px + py*py,
u = ((x3 - x1) * px + (y3 - y1) * py) / something;
if (u > 1) {
u = 1;
}
else if (u < 0) {
u = 0;
}
var x = x1 + u * px,
y = y1 + u * py,
dx = x - x3,
dy = y - y3;
//# Note: If the actual distance does not matter,
//# if you only want to compare what this function
//# returns to other results of this function, you
//# can just return the squared distance instead
//# (i.e. remove the sqrt) to gain a little performance
return Math.sqrt(dx*dx + dy*dy);
}
};
/**
* This allows the zoom level of the graph to influence the rendering
*
* @param scale
*/
Edge.prototype.setScale = function(scale) {
this.graphScaleInv = 1.0/scale;
};
Edge.prototype.select = function() {
this.selected = true;
};
Edge.prototype.unselect = function() {
this.selected = false;
};
Edge.prototype.positionBezierNode = function() {
if (this.via !== null) {
this.via.x = 0.5 * (this.from.x + this.to.x);
this.via.y = 0.5 * (this.from.y + this.to.y);
}
};
/**
* Popup is a class to create a popup window with some text
* @param {Element} container The container object.
* @param {Number} [x]
* @param {Number} [y]
* @param {String} [text]
* @param {Object} [style] An object containing borderColor,
* backgroundColor, etc.
*/
function Popup(container, x, y, text, style) {
if (container) {
this.container = container;
}
else {
this.container = document.body;
}
// x, y and text are optional, see if a style object was passed in their place
if (style === undefined) {
if (typeof x === "object") {
style = x;
x = undefined;
} else if (typeof text === "object") {
style = text;
text = undefined;
} else {
// for backwards compatibility, in case clients other than Graph are creating Popup directly
style = {
fontColor: 'black',
fontSize: 14, // px
fontFace: 'verdana',
color: {
border: '#666',
background: '#FFFFC6'
}
}
}
}
this.x = 0;
this.y = 0;
this.padding = 5;
if (x !== undefined && y !== undefined ) {
this.setPosition(x, y);
}
if (text !== undefined) {
this.setText(text);
}
// create the frame
this.frame = document.createElement("div");
var styleAttr = this.frame.style;
styleAttr.position = "absolute";
styleAttr.visibility = "hidden";
styleAttr.border = "1px solid " + style.color.border;
styleAttr.color = style.fontColor;
styleAttr.fontSize = style.fontSize + "px";
styleAttr.fontFamily = style.fontFace;
styleAttr.padding = this.padding + "px";
styleAttr.backgroundColor = style.color.background;
styleAttr.borderRadius = "3px";
styleAttr.MozBorderRadius = "3px";
styleAttr.WebkitBorderRadius = "3px";
styleAttr.boxShadow = "3px 3px 10px rgba(128, 128, 128, 0.5)";
styleAttr.whiteSpace = "nowrap";
this.container.appendChild(this.frame);
}
/**
* @param {number} x Horizontal position of the popup window
* @param {number} y Vertical position of the popup window
*/
Popup.prototype.setPosition = function(x, y) {
this.x = parseInt(x);
this.y = parseInt(y);
};
/**
* Set the text for the popup window. This can be HTML code
* @param {string} text
*/
Popup.prototype.setText = function(text) {
this.frame.innerHTML = text;
};
/**
* Show the popup window
* @param {boolean} show Optional. Show or hide the window
*/
Popup.prototype.show = function (show) {
if (show === undefined) {
show = true;
}
if (show) {
var height = this.frame.clientHeight;
var width = this.frame.clientWidth;
var maxHeight = this.frame.parentNode.clientHeight;
var maxWidth = this.frame.parentNode.clientWidth;
var top = (this.y - height);
if (top + height + this.padding > maxHeight) {
top = maxHeight - height - this.padding;
}
if (top < this.padding) {
top = this.padding;
}
var left = this.x;
if (left + width + this.padding > maxWidth) {
left = maxWidth - width - this.padding;
}
if (left < this.padding) {
left = this.padding;
}
this.frame.style.left = left + "px";
this.frame.style.top = top + "px";
this.frame.style.visibility = "visible";
}
else {
this.hide();
}
};
/**
* Hide the popup window
*/
Popup.prototype.hide = function () {
this.frame.style.visibility = "hidden";
};
/**
* @class Groups
* This class can store groups and properties specific for groups.
*/
Groups = function () {
this.clear();
this.defaultIndex = 0;
};
/**
* default constants for group colors
*/
Groups.DEFAULT = [
{border: "#2B7CE9", background: "#97C2FC", highlight: {border: "#2B7CE9", background: "#D2E5FF"}}, // blue
{border: "#FFA500", background: "#FFFF00", highlight: {border: "#FFA500", background: "#FFFFA3"}}, // yellow
{border: "#FA0A10", background: "#FB7E81", highlight: {border: "#FA0A10", background: "#FFAFB1"}}, // red
{border: "#41A906", background: "#7BE141", highlight: {border: "#41A906", background: "#A1EC76"}}, // green
{border: "#E129F0", background: "#EB7DF4", highlight: {border: "#E129F0", background: "#F0B3F5"}}, // magenta
{border: "#7C29F0", background: "#AD85E4", highlight: {border: "#7C29F0", background: "#D3BDF0"}}, // purple
{border: "#C37F00", background: "#FFA807", highlight: {border: "#C37F00", background: "#FFCA66"}}, // orange
{border: "#4220FB", background: "#6E6EFD", highlight: {border: "#4220FB", background: "#9B9BFD"}}, // darkblue
{border: "#FD5A77", background: "#FFC0CB", highlight: {border: "#FD5A77", background: "#FFD1D9"}}, // pink
{border: "#4AD63A", background: "#C2FABC", highlight: {border: "#4AD63A", background: "#E6FFE3"}} // mint
];
/**
* Clear all groups
*/
Groups.prototype.clear = function () {
this.groups = {};
this.groups.length = function()
{
var i = 0;
for ( var p in this ) {
if (this.hasOwnProperty(p)) {
i++;
}
}
return i;
}
};
/**
* get group properties of a groupname. If groupname is not found, a new group
* is added.
* @param {*} groupname Can be a number, string, Date, etc.
* @return {Object} group The created group, containing all group properties
*/
Groups.prototype.get = function (groupname) {
var group = this.groups[groupname];
if (group == undefined) {
// create new group
var index = this.defaultIndex % Groups.DEFAULT.length;
this.defaultIndex++;
group = {};
group.color = Groups.DEFAULT[index];
this.groups[groupname] = group;
}
return group;
};
/**
* Add a custom group style
* @param {String} groupname
* @param {Object} style An object containing borderColor,
* backgroundColor, etc.
* @return {Object} group The created group object
*/
Groups.prototype.add = function (groupname, style) {
this.groups[groupname] = style;
if (style.color) {
style.color = util.parseColor(style.color);
}
return style;
};
/**
* @class Images
* This class loads images and keeps them stored.
*/
Images = function () {
this.images = {};
this.callback = undefined;
};
/**
* Set an onload callback function. This will be called each time an image
* is loaded
* @param {function} callback
*/
Images.prototype.setOnloadCallback = function(callback) {
this.callback = callback;
};
/**
*
* @param {string} url Url of the image
* @return {Image} img The image object
*/
Images.prototype.load = function(url) {
var img = this.images[url];
if (img == undefined) {
// create the image
var images = this;
img = new Image();
this.images[url] = img;
img.onload = function() {
if (images.callback) {
images.callback(this);
}
};
img.src = url;
}
return img;
};
/**
* Created by Alex on 2/6/14.
*/
var physicsMixin = {
/**
* Toggling barnes Hut calculation on and off.
*
* @private
*/
_toggleBarnesHut: function () {
this.constants.physics.barnesHut.enabled = !this.constants.physics.barnesHut.enabled;
this._loadSelectedForceSolver();
this.moving = true;
this.start();
},
/**
* This loads the node force solver based on the barnes hut or repulsion algorithm
*
* @private
*/
_loadSelectedForceSolver: function () {
// this overloads the this._calculateNodeForces
if (this.constants.physics.barnesHut.enabled == true) {
this._clearMixin(repulsionMixin);
this._clearMixin(hierarchalRepulsionMixin);
this.constants.physics.centralGravity = this.constants.physics.barnesHut.centralGravity;
this.constants.physics.springLength = this.constants.physics.barnesHut.springLength;
this.constants.physics.springConstant = this.constants.physics.barnesHut.springConstant;
this.constants.physics.damping = this.constants.physics.barnesHut.damping;
this._loadMixin(barnesHutMixin);
}
else if (this.constants.physics.hierarchicalRepulsion.enabled == true) {
this._clearMixin(barnesHutMixin);
this._clearMixin(repulsionMixin);
this.constants.physics.centralGravity = this.constants.physics.hierarchicalRepulsion.centralGravity;
this.constants.physics.springLength = this.constants.physics.hierarchicalRepulsion.springLength;
this.constants.physics.springConstant = this.constants.physics.hierarchicalRepulsion.springConstant;
this.constants.physics.damping = this.constants.physics.hierarchicalRepulsion.damping;
this._loadMixin(hierarchalRepulsionMixin);
}
else {
this._clearMixin(barnesHutMixin);
this._clearMixin(hierarchalRepulsionMixin);
this.barnesHutTree = undefined;
this.constants.physics.centralGravity = this.constants.physics.repulsion.centralGravity;
this.constants.physics.springLength = this.constants.physics.repulsion.springLength;
this.constants.physics.springConstant = this.constants.physics.repulsion.springConstant;
this.constants.physics.damping = this.constants.physics.repulsion.damping;
this._loadMixin(repulsionMixin);
}
},
/**
* Before calculating the forces, we check if we need to cluster to keep up performance and we check
* if there is more than one node. If it is just one node, we dont calculate anything.
*
* @private
*/
_initializeForceCalculation: function () {
// stop calculation if there is only one node
if (this.nodeIndices.length == 1) {
this.nodes[this.nodeIndices[0]]._setForce(0, 0);
}
else {
// if there are too many nodes on screen, we cluster without repositioning
if (this.nodeIndices.length > this.constants.clustering.clusterThreshold && this.constants.clustering.enabled == true) {
this.clusterToFit(this.constants.clustering.reduceToNodes, false);
}
// we now start the force calculation
this._calculateForces();
}
},
/**
* Calculate the external forces acting on the nodes
* Forces are caused by: edges, repulsing forces between nodes, gravity
* @private
*/
_calculateForces: function () {
// Gravity is required to keep separated groups from floating off
// the forces are reset to zero in this loop by using _setForce instead
// of _addForce
this._calculateGravitationalForces();
this._calculateNodeForces();
if (this.constants.smoothCurves == true) {
this._calculateSpringForcesWithSupport();
}
else {
this._calculateSpringForces();
}
},
/**
* Smooth curves are created by adding invisible nodes in the center of the edges. These nodes are also
* handled in the calculateForces function. We then use a quadratic curve with the center node as control.
* This function joins the datanodes and invisible (called support) nodes into one object.
* We do this so we do not contaminate this.nodes with the support nodes.
*
* @private
*/
_updateCalculationNodes: function () {
if (this.constants.smoothCurves == true) {
this.calculationNodes = {};
this.calculationNodeIndices = [];
for (var nodeId in this.nodes) {
if (this.nodes.hasOwnProperty(nodeId)) {
this.calculationNodes[nodeId] = this.nodes[nodeId];
}
}
var supportNodes = this.sectors['support']['nodes'];
for (var supportNodeId in supportNodes) {
if (supportNodes.hasOwnProperty(supportNodeId)) {
if (this.edges.hasOwnProperty(supportNodes[supportNodeId].parentEdgeId)) {
this.calculationNodes[supportNodeId] = supportNodes[supportNodeId];
}
else {
supportNodes[supportNodeId]._setForce(0, 0);
}
}
}
for (var idx in this.calculationNodes) {
if (this.calculationNodes.hasOwnProperty(idx)) {
this.calculationNodeIndices.push(idx);
}
}
}
else {
this.calculationNodes = this.nodes;
this.calculationNodeIndices = this.nodeIndices;
}
},
/**
* this function applies the central gravity effect to keep groups from floating off
*
* @private
*/
_calculateGravitationalForces: function () {
var dx, dy, distance, node, i;
var nodes = this.calculationNodes;
var gravity = this.constants.physics.centralGravity;
var gravityForce = 0;
for (i = 0; i < this.calculationNodeIndices.length; i++) {
node = nodes[this.calculationNodeIndices[i]];
node.damping = this.constants.physics.damping; // possibly add function to alter damping properties of clusters.
// gravity does not apply when we are in a pocket sector
if (this._sector() == "default" && gravity != 0) {
dx = -node.x;
dy = -node.y;
distance = Math.sqrt(dx * dx + dy * dy);
gravityForce = (distance == 0) ? 0 : (gravity / distance);
node.fx = dx * gravityForce;
node.fy = dy * gravityForce;
}
else {
node.fx = 0;
node.fy = 0;
}
}
},
/**
* this function calculates the effects of the springs in the case of unsmooth curves.
*
* @private
*/
_calculateSpringForces: function () {
var edgeLength, edge, edgeId;
var dx, dy, fx, fy, springForce, length;
var edges = this.edges;
// forces caused by the edges, modelled as springs
for (edgeId in edges) {
if (edges.hasOwnProperty(edgeId)) {
edge = edges[edgeId];
if (edge.connected) {
// only calculate forces if nodes are in the same sector
if (this.nodes.hasOwnProperty(edge.toId) && this.nodes.hasOwnProperty(edge.fromId)) {
edgeLength = edge.customLength ? edge.length : this.constants.physics.springLength;
// this implies that the edges between big clusters are longer
edgeLength += (edge.to.clusterSize + edge.from.clusterSize - 2) * this.constants.clustering.edgeGrowth;
dx = (edge.from.x - edge.to.x);
dy = (edge.from.y - edge.to.y);
length = Math.sqrt(dx * dx + dy * dy);
if (length == 0) {
length = 0.01;
}
springForce = this.constants.physics.springConstant * (edgeLength - length) / length;
fx = dx * springForce;
fy = dy * springForce;
edge.from.fx += fx;
edge.from.fy += fy;
edge.to.fx -= fx;
edge.to.fy -= fy;
}
}
}
}
},
/**
* This function calculates the springforces on the nodes, accounting for the support nodes.
*
* @private
*/
_calculateSpringForcesWithSupport: function () {
var edgeLength, edge, edgeId, combinedClusterSize;
var edges = this.edges;
// forces caused by the edges, modelled as springs
for (edgeId in edges) {
if (edges.hasOwnProperty(edgeId)) {
edge = edges[edgeId];
if (edge.connected) {
// only calculate forces if nodes are in the same sector
if (this.nodes.hasOwnProperty(edge.toId) && this.nodes.hasOwnProperty(edge.fromId)) {
if (edge.via != null) {
var node1 = edge.to;
var node2 = edge.via;
var node3 = edge.from;
edgeLength = edge.customLength ? edge.length : this.constants.physics.springLength;
combinedClusterSize = node1.clusterSize + node3.clusterSize - 2;
// this implies that the edges between big clusters are longer
edgeLength += combinedClusterSize * this.constants.clustering.edgeGrowth;
this._calculateSpringForce(node1, node2, 0.5 * edgeLength);
this._calculateSpringForce(node2, node3, 0.5 * edgeLength);
}
}
}
}
}
},
/**
* This is the code actually performing the calculation for the function above. It is split out to avoid repetition.
*
* @param node1
* @param node2
* @param edgeLength
* @private
*/
_calculateSpringForce: function (node1, node2, edgeLength) {
var dx, dy, fx, fy, springForce, length;
dx = (node1.x - node2.x);
dy = (node1.y - node2.y);
length = Math.sqrt(dx * dx + dy * dy);
if (length == 0) {
length = 0.01;
}
springForce = this.constants.physics.springConstant * (edgeLength - length) / length;
fx = dx * springForce;
fy = dy * springForce;
node1.fx += fx;
node1.fy += fy;
node2.fx -= fx;
node2.fy -= fy;
},
/**
* Load the HTML for the physics config and bind it
* @private
*/
_loadPhysicsConfiguration: function () {
if (this.physicsConfiguration === undefined) {
this.backupConstants = {};
util.copyObject(this.constants, this.backupConstants);
var hierarchicalLayoutDirections = ["LR", "RL", "UD", "DU"];
this.physicsConfiguration = document.createElement('div');
this.physicsConfiguration.className = "PhysicsConfiguration";
this.physicsConfiguration.innerHTML = '' +
'<table><tr><td><b>Simulation Mode:</b></td></tr>' +
'<tr>' +
'<td width="120px"><input type="radio" name="graph_physicsMethod" id="graph_physicsMethod1" value="BH" checked="checked">Barnes Hut</td>' +
'<td width="120px"><input type="radio" name="graph_physicsMethod" id="graph_physicsMethod2" value="R">Repulsion</td>' +
'<td width="120px"><input type="radio" name="graph_physicsMethod" id="graph_physicsMethod3" value="H">Hierarchical</td>' +
'</tr>' +
'</table>' +
'<table id="graph_BH_table" style="display:none">' +
'<tr><td><b>Barnes Hut</b></td></tr>' +
'<tr>' +
'<td width="150px">gravitationalConstant</td><td>0</td><td><input type="range" min="500" max="20000" value="' + (-1 * this.constants.physics.barnesHut.gravitationalConstant) + '" step="25" style="width:300px" id="graph_BH_gc"></td><td width="50px">-20000</td><td><input value="' + (-1 * this.constants.physics.barnesHut.gravitationalConstant) + '" id="graph_BH_gc_value" style="width:60px"></td>' +
'</tr>' +
'<tr>' +
'<td width="150px">centralGravity</td><td>0</td><td><input type="range" min="0" max="3" value="' + this.constants.physics.barnesHut.centralGravity + '" step="0.05" style="width:300px" id="graph_BH_cg"></td><td>3</td><td><input value="' + this.constants.physics.barnesHut.centralGravity + '" id="graph_BH_cg_value" style="width:60px"></td>' +
'</tr>' +
'<tr>' +
'<td width="150px">springLength</td><td>0</td><td><input type="range" min="0" max="500" value="' + this.constants.physics.barnesHut.springLength + '" step="1" style="width:300px" id="graph_BH_sl"></td><td>500</td><td><input value="' + this.constants.physics.barnesHut.springLength + '" id="graph_BH_sl_value" style="width:60px"></td>' +
'</tr>' +
'<tr>' +
'<td width="150px">springConstant</td><td>0</td><td><input type="range" min="0" max="0.5" value="' + this.constants.physics.barnesHut.springConstant + '" step="0.001" style="width:300px" id="graph_BH_sc"></td><td>0.5</td><td><input value="' + this.constants.physics.barnesHut.springConstant + '" id="graph_BH_sc_value" style="width:60px"></td>' +
'</tr>' +
'<tr>' +
'<td width="150px">damping</td><td>0</td><td><input type="range" min="0" max="0.3" value="' + this.constants.physics.barnesHut.damping + '" step="0.005" style="width:300px" id="graph_BH_damp"></td><td>0.3</td><td><input value="' + this.constants.physics.barnesHut.damping + '" id="graph_BH_damp_value" style="width:60px"></td>' +
'</tr>' +
'</table>' +
'<table id="graph_R_table" style="display:none">' +
'<tr><td><b>Repulsion</b></td></tr>' +
'<tr>' +
'<td width="150px">nodeDistance</td><td>0</td><td><input type="range" min="0" max="300" value="' + this.constants.physics.repulsion.nodeDistance + '" step="1" style="width:300px" id="graph_R_nd"></td><td width="50px">300</td><td><input value="' + this.constants.physics.repulsion.nodeDistance + '" id="graph_R_nd_value" style="width:60px"></td>' +
'</tr>' +
'<tr>' +
'<td width="150px">centralGravity</td><td>0</td><td><input type="range" min="0" max="3" value="' + this.constants.physics.repulsion.centralGravity + '" step="0.05" style="width:300px" id="graph_R_cg"></td><td>3</td><td><input value="' + this.constants.physics.repulsion.centralGravity + '" id="graph_R_cg_value" style="width:60px"></td>' +
'</tr>' +
'<tr>' +
'<td width="150px">springLength</td><td>0</td><td><input type="range" min="0" max="500" value="' + this.constants.physics.repulsion.springLength + '" step="1" style="width:300px" id="graph_R_sl"></td><td>500</td><td><input value="' + this.constants.physics.repulsion.springLength + '" id="graph_R_sl_value" style="width:60px"></td>' +
'</tr>' +
'<tr>' +
'<td width="150px">springConstant</td><td>0</td><td><input type="range" min="0" max="0.5" value="' + this.constants.physics.repulsion.springConstant + '" step="0.001" style="width:300px" id="graph_R_sc"></td><td>0.5</td><td><input value="' + this.constants.physics.repulsion.springConstant + '" id="graph_R_sc_value" style="width:60px"></td>' +
'</tr>' +
'<tr>' +
'<td width="150px">damping</td><td>0</td><td><input type="range" min="0" max="0.3" value="' + this.constants.physics.repulsion.damping + '" step="0.005" style="width:300px" id="graph_R_damp"></td><td>0.3</td><td><input value="' + this.constants.physics.repulsion.damping + '" id="graph_R_damp_value" style="width:60px"></td>' +
'</tr>' +
'</table>' +
'<table id="graph_H_table" style="display:none">' +
'<tr><td width="150"><b>Hierarchical</b></td></tr>' +
'<tr>' +
'<td width="150px">nodeDistance</td><td>0</td><td><input type="range" min="0" max="300" value="' + this.constants.physics.hierarchicalRepulsion.nodeDistance + '" step="1" style="width:300px" id="graph_H_nd"></td><td width="50px">300</td><td><input value="' + this.constants.physics.hierarchicalRepulsion.nodeDistance + '" id="graph_H_nd_value" style="width:60px"></td>' +
'</tr>' +
'<tr>' +
'<td width="150px">centralGravity</td><td>0</td><td><input type="range" min="0" max="3" value="' + this.constants.physics.hierarchicalRepulsion.centralGravity + '" step="0.05" style="width:300px" id="graph_H_cg"></td><td>3</td><td><input value="' + this.constants.physics.hierarchicalRepulsion.centralGravity + '" id="graph_H_cg_value" style="width:60px"></td>' +
'</tr>' +
'<tr>' +
'<td width="150px">springLength</td><td>0</td><td><input type="range" min="0" max="500" value="' + this.constants.physics.hierarchicalRepulsion.springLength + '" step="1" style="width:300px" id="graph_H_sl"></td><td>500</td><td><input value="' + this.constants.physics.hierarchicalRepulsion.springLength + '" id="graph_H_sl_value" style="width:60px"></td>' +
'</tr>' +
'<tr>' +
'<td width="150px">springConstant</td><td>0</td><td><input type="range" min="0" max="0.5" value="' + this.constants.physics.hierarchicalRepulsion.springConstant + '" step="0.001" style="width:300px" id="graph_H_sc"></td><td>0.5</td><td><input value="' + this.constants.physics.hierarchicalRepulsion.springConstant + '" id="graph_H_sc_value" style="width:60px"></td>' +
'</tr>' +
'<tr>' +
'<td width="150px">damping</td><td>0</td><td><input type="range" min="0" max="0.3" value="' + this.constants.physics.hierarchicalRepulsion.damping + '" step="0.005" style="width:300px" id="graph_H_damp"></td><td>0.3</td><td><input value="' + this.constants.physics.hierarchicalRepulsion.damping + '" id="graph_H_damp_value" style="width:60px"></td>' +
'</tr>' +
'<tr>' +
'<td width="150px">direction</td><td>1</td><td><input type="range" min="0" max="3" value="' + hierarchicalLayoutDirections.indexOf(this.constants.hierarchicalLayout.direction) + '" step="1" style="width:300px" id="graph_H_direction"></td><td>4</td><td><input value="' + this.constants.hierarchicalLayout.direction + '" id="graph_H_direction_value" style="width:60px"></td>' +
'</tr>' +
'<tr>' +
'<td width="150px">levelSeparation</td><td>1</td><td><input type="range" min="0" max="500" value="' + this.constants.hierarchicalLayout.levelSeparation + '" step="1" style="width:300px" id="graph_H_levsep"></td><td>500</td><td><input value="' + this.constants.hierarchicalLayout.levelSeparation + '" id="graph_H_levsep_value" style="width:60px"></td>' +
'</tr>' +
'<tr>' +
'<td width="150px">nodeSpacing</td><td>1</td><td><input type="range" min="0" max="500" value="' + this.constants.hierarchicalLayout.nodeSpacing + '" step="1" style="width:300px" id="graph_H_nspac"></td><td>500</td><td><input value="' + this.constants.hierarchicalLayout.nodeSpacing + '" id="graph_H_nspac_value" style="width:60px"></td>' +
'</tr>' +
'</table>' +
'<table><tr><td><b>Options:</b></td></tr>' +
'<tr>' +
'<td width="180px"><input type="button" id="graph_toggleSmooth" value="Toggle smoothCurves" style="width:150px"></td>' +
'<td width="180px"><input type="button" id="graph_repositionNodes" value="Reinitialize" style="width:150px"></td>' +
'<td width="180px"><input type="button" id="graph_generateOptions" value="Generate Options" style="width:150px"></td>' +
'</tr>' +
'</table>'
this.containerElement.parentElement.insertBefore(this.physicsConfiguration, this.containerElement);
this.optionsDiv = document.createElement("div");
this.optionsDiv.style.fontSize = "14px";
this.optionsDiv.style.fontFamily = "verdana";
this.containerElement.parentElement.insertBefore(this.optionsDiv, this.containerElement);
var rangeElement;
rangeElement = document.getElementById('graph_BH_gc');
rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_gc', -1, "physics_barnesHut_gravitationalConstant");
rangeElement = document.getElementById('graph_BH_cg');
rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_cg', 1, "physics_centralGravity");
rangeElement = document.getElementById('graph_BH_sc');
rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_sc', 1, "physics_springConstant");
rangeElement = document.getElementById('graph_BH_sl');
rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_sl', 1, "physics_springLength");
rangeElement = document.getElementById('graph_BH_damp');
rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_damp', 1, "physics_damping");
rangeElement = document.getElementById('graph_R_nd');
rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_nd', 1, "physics_repulsion_nodeDistance");
rangeElement = document.getElementById('graph_R_cg');
rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_cg', 1, "physics_centralGravity");
rangeElement = document.getElementById('graph_R_sc');
rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_sc', 1, "physics_springConstant");
rangeElement = document.getElementById('graph_R_sl');
rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_sl', 1, "physics_springLength");
rangeElement = document.getElementById('graph_R_damp');
rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_damp', 1, "physics_damping");
rangeElement = document.getElementById('graph_H_nd');
rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_nd', 1, "physics_hierarchicalRepulsion_nodeDistance");
rangeElement = document.getElementById('graph_H_cg');
rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_cg', 1, "physics_centralGravity");
rangeElement = document.getElementById('graph_H_sc');
rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_sc', 1, "physics_springConstant");
rangeElement = document.getElementById('graph_H_sl');
rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_sl', 1, "physics_springLength");
rangeElement = document.getElementById('graph_H_damp');
rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_damp', 1, "physics_damping");
rangeElement = document.getElementById('graph_H_direction');
rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_direction', hierarchicalLayoutDirections, "hierarchicalLayout_direction");
rangeElement = document.getElementById('graph_H_levsep');
rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_levsep', 1, "hierarchicalLayout_levelSeparation");
rangeElement = document.getElementById('graph_H_nspac');
rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_nspac', 1, "hierarchicalLayout_nodeSpacing");
var radioButton1 = document.getElementById("graph_physicsMethod1");
var radioButton2 = document.getElementById("graph_physicsMethod2");
var radioButton3 = document.getElementById("graph_physicsMethod3");
radioButton2.checked = true;
if (this.constants.physics.barnesHut.enabled) {
radioButton1.checked = true;
}
if (this.constants.hierarchicalLayout.enabled) {
radioButton3.checked = true;
}
var graph_toggleSmooth = document.getElementById("graph_toggleSmooth");
var graph_repositionNodes = document.getElementById("graph_repositionNodes");
var graph_generateOptions = document.getElementById("graph_generateOptions");
graph_toggleSmooth.onclick = graphToggleSmoothCurves.bind(this);
graph_repositionNodes.onclick = graphRepositionNodes.bind(this);
graph_generateOptions.onclick = graphGenerateOptions.bind(this);
if (this.constants.smoothCurves == true) {
graph_toggleSmooth.style.background = "#A4FF56";
}
else {
graph_toggleSmooth.style.background = "#FF8532";
}
switchConfigurations.apply(this);
radioButton1.onchange = switchConfigurations.bind(this);
radioButton2.onchange = switchConfigurations.bind(this);
radioButton3.onchange = switchConfigurations.bind(this);
}
},
_overWriteGraphConstants: function (constantsVariableName, value) {
var nameArray = constantsVariableName.split("_");
if (nameArray.length == 1) {
this.constants[nameArray[0]] = value;
}
else if (nameArray.length == 2) {
this.constants[nameArray[0]][nameArray[1]] = value;
}
else if (nameArray.length == 3) {
this.constants[nameArray[0]][nameArray[1]][nameArray[2]] = value;
}
}
};
function graphToggleSmoothCurves () {
this.constants.smoothCurves = !this.constants.smoothCurves;
var graph_toggleSmooth = document.getElementById("graph_toggleSmooth");
if (this.constants.smoothCurves == true) {graph_toggleSmooth.style.background = "#A4FF56";}
else {graph_toggleSmooth.style.background = "#FF8532";}
this._configureSmoothCurves(false);
};
function graphRepositionNodes () {
for (var nodeId in this.calculationNodes) {
if (this.calculationNodes.hasOwnProperty(nodeId)) {
this.calculationNodes[nodeId].vx = 0; this.calculationNodes[nodeId].vy = 0;
this.calculationNodes[nodeId].fx = 0; this.calculationNodes[nodeId].fy = 0;
}
}
if (this.constants.hierarchicalLayout.enabled == true) {
this._setupHierarchicalLayout();
}
else {
this.repositionNodes();
}
this.moving = true;
this.start();
};
function graphGenerateOptions () {
var options = "No options are required, default values used.";
var optionsSpecific = [];
var radioButton1 = document.getElementById("graph_physicsMethod1");
var radioButton2 = document.getElementById("graph_physicsMethod2");
if (radioButton1.checked == true) {
if (this.constants.physics.barnesHut.gravitationalConstant != this.backupConstants.physics.barnesHut.gravitationalConstant) {optionsSpecific.push("gravitationalConstant: " + this.constants.physics.barnesHut.gravitationalConstant);}
if (this.constants.physics.centralGravity != this.backupConstants.physics.barnesHut.centralGravity) {optionsSpecific.push("centralGravity: " + this.constants.physics.centralGravity);}
if (this.constants.physics.springLength != this.backupConstants.physics.barnesHut.springLength) {optionsSpecific.push("springLength: " + this.constants.physics.springLength);}
if (this.constants.physics.springConstant != this.backupConstants.physics.barnesHut.springConstant) {optionsSpecific.push("springConstant: " + this.constants.physics.springConstant);}
if (this.constants.physics.damping != this.backupConstants.physics.barnesHut.damping) {optionsSpecific.push("damping: " + this.constants.physics.damping);}
if (optionsSpecific.length != 0) {
options = "var options = {";
options += "physics: {barnesHut: {";
for (var i = 0; i < optionsSpecific.length; i++) {
options += optionsSpecific[i];
if (i < optionsSpecific.length - 1) {
options += ", "
}
}
options += '}}'
}
if (this.constants.smoothCurves != this.backupConstants.smoothCurves) {
if (optionsSpecific.length == 0) {options = "var options = {";}
else {options += ", "}
options += "smoothCurves: " + this.constants.smoothCurves;
}
if (options != "No options are required, default values used.") {
options += '};'
}
}
else if (radioButton2.checked == true) {
options = "var options = {";
options += "physics: {barnesHut: {enabled: false}";
if (this.constants.physics.repulsion.nodeDistance != this.backupConstants.physics.repulsion.nodeDistance) {optionsSpecific.push("nodeDistance: " + this.constants.physics.repulsion.nodeDistance);}
if (this.constants.physics.centralGravity != this.backupConstants.physics.repulsion.centralGravity) {optionsSpecific.push("centralGravity: " + this.constants.physics.centralGravity);}
if (this.constants.physics.springLength != this.backupConstants.physics.repulsion.springLength) {optionsSpecific.push("springLength: " + this.constants.physics.springLength);}
if (this.constants.physics.springConstant != this.backupConstants.physics.repulsion.springConstant) {optionsSpecific.push("springConstant: " + this.constants.physics.springConstant);}
if (this.constants.physics.damping != this.backupConstants.physics.repulsion.damping) {optionsSpecific.push("damping: " + this.constants.physics.damping);}
if (optionsSpecific.length != 0) {
options += ", repulsion: {";
for (var i = 0; i < optionsSpecific.length; i++) {
options += optionsSpecific[i];
if (i < optionsSpecific.length - 1) {
options += ", "
}
}
options += '}}'
}
if (optionsSpecific.length == 0) {options += "}"}
if (this.constants.smoothCurves != this.backupConstants.smoothCurves) {
options += ", smoothCurves: " + this.constants.smoothCurves;
}
options += '};'
}
else {
options = "var options = {";
if (this.constants.physics.hierarchicalRepulsion.nodeDistance != this.backupConstants.physics.hierarchicalRepulsion.nodeDistance) {optionsSpecific.push("nodeDistance: " + this.constants.physics.hierarchicalRepulsion.nodeDistance);}
if (this.constants.physics.centralGravity != this.backupConstants.physics.hierarchicalRepulsion.centralGravity) {optionsSpecific.push("centralGravity: " + this.constants.physics.centralGravity);}
if (this.constants.physics.springLength != this.backupConstants.physics.hierarchicalRepulsion.springLength) {optionsSpecific.push("springLength: " + this.constants.physics.springLength);}
if (this.constants.physics.springConstant != this.backupConstants.physics.hierarchicalRepulsion.springConstant) {optionsSpecific.push("springConstant: " + this.constants.physics.springConstant);}
if (this.constants.physics.damping != this.backupConstants.physics.hierarchicalRepulsion.damping) {optionsSpecific.push("damping: " + this.constants.physics.damping);}
if (optionsSpecific.length != 0) {
options += "physics: {hierarchicalRepulsion: {";
for (var i = 0; i < optionsSpecific.length; i++) {
options += optionsSpecific[i];
if (i < optionsSpecific.length - 1) {
options += ", ";
}
}
options += '}},';
}
options += 'hierarchicalLayout: {';
optionsSpecific = [];
if (this.constants.hierarchicalLayout.direction != this.backupConstants.hierarchicalLayout.direction) {optionsSpecific.push("direction: " + this.constants.hierarchicalLayout.direction);}
if (Math.abs(this.constants.hierarchicalLayout.levelSeparation) != this.backupConstants.hierarchicalLayout.levelSeparation) {optionsSpecific.push("levelSeparation: " + this.constants.hierarchicalLayout.levelSeparation);}
if (this.constants.hierarchicalLayout.nodeSpacing != this.backupConstants.hierarchicalLayout.nodeSpacing) {optionsSpecific.push("nodeSpacing: " + this.constants.hierarchicalLayout.nodeSpacing);}
if (optionsSpecific.length != 0) {
for (var i = 0; i < optionsSpecific.length; i++) {
options += optionsSpecific[i];
if (i < optionsSpecific.length - 1) {
options += ", "
}
}
options += '}'
}
else {
options += "enabled:true}";
}
options += '};'
}
this.optionsDiv.innerHTML = options;
};
function switchConfigurations () {
var ids = ["graph_BH_table", "graph_R_table", "graph_H_table"];
var radioButton = document.querySelector('input[name="graph_physicsMethod"]:checked').value;
var tableId = "graph_" + radioButton + "_table";
var table = document.getElementById(tableId);
table.style.display = "block";
for (var i = 0; i < ids.length; i++) {
if (ids[i] != tableId) {
table = document.getElementById(ids[i]);
table.style.display = "none";
}
}
this._restoreNodes();
if (radioButton == "R") {
this.constants.hierarchicalLayout.enabled = false;
this.constants.physics.hierarchicalRepulsion.enabled = false;
this.constants.physics.barnesHut.enabled = false;
}
else if (radioButton == "H") {
this.constants.hierarchicalLayout.enabled = true;
this.constants.physics.hierarchicalRepulsion.enabled = true;
this.constants.physics.barnesHut.enabled = false;
this._setupHierarchicalLayout();
}
else {
this.constants.hierarchicalLayout.enabled = false;
this.constants.physics.hierarchicalRepulsion.enabled = false;
this.constants.physics.barnesHut.enabled = true;
}
this._loadSelectedForceSolver();
var graph_toggleSmooth = document.getElementById("graph_toggleSmooth");
if (this.constants.smoothCurves == true) {graph_toggleSmooth.style.background = "#A4FF56";}
else {graph_toggleSmooth.style.background = "#FF8532";}
this.moving = true;
this.start();
}
function showValueOfRange (id,map,constantsVariableName) {
var valueId = id + "_value";
var rangeValue = document.getElementById(id).value;
if (map instanceof Array) {
document.getElementById(valueId).value = map[parseInt(rangeValue)];
this._overWriteGraphConstants(constantsVariableName,map[parseInt(rangeValue)]);
}
else {
document.getElementById(valueId).value = parseInt(map) * parseFloat(rangeValue);
this._overWriteGraphConstants(constantsVariableName, parseInt(map) * parseFloat(rangeValue));
}
if (constantsVariableName == "hierarchicalLayout_direction" ||
constantsVariableName == "hierarchicalLayout_levelSeparation" ||
constantsVariableName == "hierarchicalLayout_nodeSpacing") {
this._setupHierarchicalLayout();
}
this.moving = true;
this.start();
};
/**
* Created by Alex on 2/10/14.
*/
var hierarchalRepulsionMixin = {
/**
* Calculate the forces the nodes apply on eachother based on a repulsion field.
* This field is linearly approximated.
*
* @private
*/
_calculateNodeForces: function () {
var dx, dy, distance, fx, fy, combinedClusterSize,
repulsingForce, node1, node2, i, j;
var nodes = this.calculationNodes;
var nodeIndices = this.calculationNodeIndices;
// approximation constants
var b = 5;
var a_base = 0.5 * -b;
// repulsing forces between nodes
var nodeDistance = this.constants.physics.hierarchicalRepulsion.nodeDistance;
var minimumDistance = nodeDistance;
// we loop from i over all but the last entree in the array
// j loops from i+1 to the last. This way we do not double count any of the indices, nor i == j
for (i = 0; i < nodeIndices.length - 1; i++) {
node1 = nodes[nodeIndices[i]];
for (j = i + 1; j < nodeIndices.length; j++) {
node2 = nodes[nodeIndices[j]];
dx = node2.x - node1.x;
dy = node2.y - node1.y;
distance = Math.sqrt(dx * dx + dy * dy);
var a = a_base / minimumDistance;
if (distance < 2 * minimumDistance) {
repulsingForce = a * distance + b; // linear approx of 1 / (1 + Math.exp((distance / minimumDistance - 1) * steepness))
// normalize force with
if (distance == 0) {
distance = 0.01;
}
else {
repulsingForce = repulsingForce / distance;
}
fx = dx * repulsingForce;
fy = dy * repulsingForce;
node1.fx -= fx;
node1.fy -= fy;
node2.fx += fx;
node2.fy += fy;
}
}
}
}
};
/**
* Created by Alex on 2/10/14.
*/
var barnesHutMixin = {
/**
* This function calculates the forces the nodes apply on eachother based on a gravitational model.
* The Barnes Hut method is used to speed up this N-body simulation.
*
* @private
*/
_calculateNodeForces : function() {
if (this.constants.physics.barnesHut.gravitationalConstant != 0) {
var node;
var nodes = this.calculationNodes;
var nodeIndices = this.calculationNodeIndices;
var nodeCount = nodeIndices.length;
this._formBarnesHutTree(nodes,nodeIndices);
var barnesHutTree = this.barnesHutTree;
// place the nodes one by one recursively
for (var i = 0; i < nodeCount; i++) {
node = nodes[nodeIndices[i]];
// starting with root is irrelevant, it never passes the BarnesHut condition
this._getForceContribution(barnesHutTree.root.children.NW,node);
this._getForceContribution(barnesHutTree.root.children.NE,node);
this._getForceContribution(barnesHutTree.root.children.SW,node);
this._getForceContribution(barnesHutTree.root.children.SE,node);
}
}
},
/**
* This function traverses the barnesHutTree. It checks when it can approximate distant nodes with their center of mass.
* If a region contains a single node, we check if it is not itself, then we apply the force.
*
* @param parentBranch
* @param node
* @private
*/
_getForceContribution : function(parentBranch,node) {
// we get no force contribution from an empty region
if (parentBranch.childrenCount > 0) {
var dx,dy,distance;
// get the distance from the center of mass to the node.
dx = parentBranch.centerOfMass.x - node.x;
dy = parentBranch.centerOfMass.y - node.y;
distance = Math.sqrt(dx * dx + dy * dy);
// BarnesHut condition
// original condition : s/d < theta = passed === d/s > 1/theta = passed
// calcSize = 1/s --> d * 1/s > 1/theta = passed
if (distance * parentBranch.calcSize > this.constants.physics.barnesHut.theta) {
// duplicate code to reduce function calls to speed up program
if (distance == 0) {
distance = 0.1*Math.random();
dx = distance;
}
var gravityForce = this.constants.physics.barnesHut.gravitationalConstant * parentBranch.mass * node.mass / (distance * distance * distance);
var fx = dx * gravityForce;
var fy = dy * gravityForce;
node.fx += fx;
node.fy += fy;
}
else {
// Did not pass the condition, go into children if available
if (parentBranch.childrenCount == 4) {
this._getForceContribution(parentBranch.children.NW,node);
this._getForceContribution(parentBranch.children.NE,node);
this._getForceContribution(parentBranch.children.SW,node);
this._getForceContribution(parentBranch.children.SE,node);
}
else { // parentBranch must have only one node, if it was empty we wouldnt be here
if (parentBranch.children.data.id != node.id) { // if it is not self
// duplicate code to reduce function calls to speed up program
if (distance == 0) {
distance = 0.5*Math.random();
dx = distance;
}
var gravityForce = this.constants.physics.barnesHut.gravitationalConstant * parentBranch.mass * node.mass / (distance * distance * distance);
var fx = dx * gravityForce;
var fy = dy * gravityForce;
node.fx += fx;
node.fy += fy;
}
}
}
}
},
/**
* This function constructs the barnesHut tree recursively. It creates the root, splits it and starts placing the nodes.
*
* @param nodes
* @param nodeIndices
* @private
*/
_formBarnesHutTree : function(nodes,nodeIndices) {
var node;
var nodeCount = nodeIndices.length;
var minX = Number.MAX_VALUE,
minY = Number.MAX_VALUE,
maxX =-Number.MAX_VALUE,
maxY =-Number.MAX_VALUE;
// get the range of the nodes
for (var i = 0; i < nodeCount; i++) {
var x = nodes[nodeIndices[i]].x;
var y = nodes[nodeIndices[i]].y;
if (x < minX) { minX = x; }
if (x > maxX) { maxX = x; }
if (y < minY) { minY = y; }
if (y > maxY) { maxY = y; }
}
// make the range a square
var sizeDiff = Math.abs(maxX - minX) - Math.abs(maxY - minY); // difference between X and Y
if (sizeDiff > 0) {minY -= 0.5 * sizeDiff; maxY += 0.5 * sizeDiff;} // xSize > ySize
else {minX += 0.5 * sizeDiff; maxX -= 0.5 * sizeDiff;} // xSize < ySize
var minimumTreeSize = 1e-5;
var rootSize = Math.max(minimumTreeSize,Math.abs(maxX - minX));
var halfRootSize = 0.5 * rootSize;
var centerX = 0.5 * (minX + maxX), centerY = 0.5 * (minY + maxY);
// construct the barnesHutTree
var barnesHutTree = {root:{
centerOfMass:{x:0,y:0}, // Center of Mass
mass:0,
range: {minX:centerX-halfRootSize,maxX:centerX+halfRootSize,
minY:centerY-halfRootSize,maxY:centerY+halfRootSize},
size: rootSize,
calcSize: 1 / rootSize,
children: {data:null},
maxWidth: 0,
level: 0,
childrenCount: 4
}};
this._splitBranch(barnesHutTree.root);
// place the nodes one by one recursively
for (i = 0; i < nodeCount; i++) {
node = nodes[nodeIndices[i]];
this._placeInTree(barnesHutTree.root,node);
}
// make global
this.barnesHutTree = barnesHutTree
},
_updateBranchMass : function(parentBranch, node) {
var totalMass = parentBranch.mass + node.mass;
var totalMassInv = 1/totalMass;
parentBranch.centerOfMass.x = parentBranch.centerOfMass.x * parentBranch.mass + node.x * node.mass;
parentBranch.centerOfMass.x *= totalMassInv;
parentBranch.centerOfMass.y = parentBranch.centerOfMass.y * parentBranch.mass + node.y * node.mass;
parentBranch.centerOfMass.y *= totalMassInv;
parentBranch.mass = totalMass;
var biggestSize = Math.max(Math.max(node.height,node.radius),node.width);
parentBranch.maxWidth = (parentBranch.maxWidth < biggestSize) ? biggestSize : parentBranch.maxWidth;
},
_placeInTree : function(parentBranch,node,skipMassUpdate) {
if (skipMassUpdate != true || skipMassUpdate === undefined) {
// update the mass of the branch.
this._updateBranchMass(parentBranch,node);
}
if (parentBranch.children.NW.range.maxX > node.x) { // in NW or SW
if (parentBranch.children.NW.range.maxY > node.y) { // in NW
this._placeInRegion(parentBranch,node,"NW");
}
else { // in SW
this._placeInRegion(parentBranch,node,"SW");
}
}
else { // in NE or SE
if (parentBranch.children.NW.range.maxY > node.y) { // in NE
this._placeInRegion(parentBranch,node,"NE");
}
else { // in SE
this._placeInRegion(parentBranch,node,"SE");
}
}
},
_placeInRegion : function(parentBranch,node,region) {
switch (parentBranch.children[region].childrenCount) {
case 0: // place node here
parentBranch.children[region].children.data = node;
parentBranch.children[region].childrenCount = 1;
this._updateBranchMass(parentBranch.children[region],node);
break;
case 1: // convert into children
// if there are two nodes exactly overlapping (on init, on opening of cluster etc.)
// we move one node a pixel and we do not put it in the tree.
if (parentBranch.children[region].children.data.x == node.x &&
parentBranch.children[region].children.data.y == node.y) {
node.x += Math.random();
node.y += Math.random();
}
else {
this._splitBranch(parentBranch.children[region]);
this._placeInTree(parentBranch.children[region],node);
}
break;
case 4: // place in branch
this._placeInTree(parentBranch.children[region],node);
break;
}
},
/**
* this function splits a branch into 4 sub branches. If the branch contained a node, we place it in the subbranch
* after the split is complete.
*
* @param parentBranch
* @private
*/
_splitBranch : function(parentBranch) {
// if the branch is filled with a node, replace the node in the new subset.
var containedNode = null;
if (parentBranch.childrenCount == 1) {
containedNode = parentBranch.children.data;
parentBranch.mass = 0; parentBranch.centerOfMass.x = 0; parentBranch.centerOfMass.y = 0;
}
parentBranch.childrenCount = 4;
parentBranch.children.data = null;
this._insertRegion(parentBranch,"NW");
this._insertRegion(parentBranch,"NE");
this._insertRegion(parentBranch,"SW");
this._insertRegion(parentBranch,"SE");
if (containedNode != null) {
this._placeInTree(parentBranch,containedNode);
}
},
/**
* This function subdivides the region into four new segments.
* Specifically, this inserts a single new segment.
* It fills the children section of the parentBranch
*
* @param parentBranch
* @param region
* @param parentRange
* @private
*/
_insertRegion : function(parentBranch, region) {
var minX,maxX,minY,maxY;
var childSize = 0.5 * parentBranch.size;
switch (region) {
case "NW":
minX = parentBranch.range.minX;
maxX = parentBranch.range.minX + childSize;
minY = parentBranch.range.minY;
maxY = parentBranch.range.minY + childSize;
break;
case "NE":
minX = parentBranch.range.minX + childSize;
maxX = parentBranch.range.maxX;
minY = parentBranch.range.minY;
maxY = parentBranch.range.minY + childSize;
break;
case "SW":
minX = parentBranch.range.minX;
maxX = parentBranch.range.minX + childSize;
minY = parentBranch.range.minY + childSize;
maxY = parentBranch.range.maxY;
break;
case "SE":
minX = parentBranch.range.minX + childSize;
maxX = parentBranch.range.maxX;
minY = parentBranch.range.minY + childSize;
maxY = parentBranch.range.maxY;
break;
}
parentBranch.children[region] = {
centerOfMass:{x:0,y:0},
mass:0,
range:{minX:minX,maxX:maxX,minY:minY,maxY:maxY},
size: 0.5 * parentBranch.size,
calcSize: 2 * parentBranch.calcSize,
children: {data:null},
maxWidth: 0,
level: parentBranch.level+1,
childrenCount: 0
};
},
/**
* This function is for debugging purposed, it draws the tree.
*
* @param ctx
* @param color
* @private
*/
_drawTree : function(ctx,color) {
if (this.barnesHutTree !== undefined) {
ctx.lineWidth = 1;
this._drawBranch(this.barnesHutTree.root,ctx,color);
}
},
/**
* This function is for debugging purposes. It draws the branches recursively.
*
* @param branch
* @param ctx
* @param color
* @private
*/
_drawBranch : function(branch,ctx,color) {
if (color === undefined) {
color = "#FF0000";
}
if (branch.childrenCount == 4) {
this._drawBranch(branch.children.NW,ctx);
this._drawBranch(branch.children.NE,ctx);
this._drawBranch(branch.children.SE,ctx);
this._drawBranch(branch.children.SW,ctx);
}
ctx.strokeStyle = color;
ctx.beginPath();
ctx.moveTo(branch.range.minX,branch.range.minY);
ctx.lineTo(branch.range.maxX,branch.range.minY);
ctx.stroke();
ctx.beginPath();
ctx.moveTo(branch.range.maxX,branch.range.minY);
ctx.lineTo(branch.range.maxX,branch.range.maxY);
ctx.stroke();
ctx.beginPath();
ctx.moveTo(branch.range.maxX,branch.range.maxY);
ctx.lineTo(branch.range.minX,branch.range.maxY);
ctx.stroke();
ctx.beginPath();
ctx.moveTo(branch.range.minX,branch.range.maxY);
ctx.lineTo(branch.range.minX,branch.range.minY);
ctx.stroke();
/*
if (branch.mass > 0) {
ctx.circle(branch.centerOfMass.x, branch.centerOfMass.y, 3*branch.mass);
ctx.stroke();
}
*/
}
};
/**
* Created by Alex on 2/10/14.
*/
var repulsionMixin = {
/**
* Calculate the forces the nodes apply on eachother based on a repulsion field.
* This field is linearly approximated.
*
* @private
*/
_calculateNodeForces: function () {
var dx, dy, angle, distance, fx, fy, combinedClusterSize,
repulsingForce, node1, node2, i, j;
var nodes = this.calculationNodes;
var nodeIndices = this.calculationNodeIndices;
// approximation constants
var a_base = -2 / 3;
var b = 4 / 3;
// repulsing forces between nodes
var nodeDistance = this.constants.physics.repulsion.nodeDistance;
var minimumDistance = nodeDistance;
// we loop from i over all but the last entree in the array
// j loops from i+1 to the last. This way we do not double count any of the indices, nor i == j
for (i = 0; i < nodeIndices.length - 1; i++) {
node1 = nodes[nodeIndices[i]];
for (j = i + 1; j < nodeIndices.length; j++) {
node2 = nodes[nodeIndices[j]];
combinedClusterSize = node1.clusterSize + node2.clusterSize - 2;
dx = node2.x - node1.x;
dy = node2.y - node1.y;
distance = Math.sqrt(dx * dx + dy * dy);
minimumDistance = (combinedClusterSize == 0) ? nodeDistance : (nodeDistance * (1 + combinedClusterSize * this.constants.clustering.distanceAmplification));
var a = a_base / minimumDistance;
if (distance < 2 * minimumDistance) {
if (distance < 0.5 * minimumDistance) {
repulsingForce = 1.0;
}
else {
repulsingForce = a * distance + b; // linear approx of 1 / (1 + Math.exp((distance / minimumDistance - 1) * steepness))
}
// amplify the repulsion for clusters.
repulsingForce *= (combinedClusterSize == 0) ? 1 : 1 + combinedClusterSize * this.constants.clustering.forceAmplification;
repulsingForce = repulsingForce / distance;
fx = dx * repulsingForce;
fy = dy * repulsingForce;
node1.fx -= fx;
node1.fy -= fy;
node2.fx += fx;
node2.fy += fy;
}
}
}
}
};
var HierarchicalLayoutMixin = {
_resetLevels : function() {
for (var nodeId in this.nodes) {
if (this.nodes.hasOwnProperty(nodeId)) {
var node = this.nodes[nodeId];
if (node.preassignedLevel == false) {
node.level = -1;
}
}
}
},
/**
* This is the main function to layout the nodes in a hierarchical way.
* It checks if the node details are supplied correctly
*
* @private
*/
_setupHierarchicalLayout : function() {
if (this.constants.hierarchicalLayout.enabled == true) {
if (this.constants.hierarchicalLayout.direction == "RL" || this.constants.hierarchicalLayout.direction == "DU") {
this.constants.hierarchicalLayout.levelSeparation *= -1;
}
else {
this.constants.hierarchicalLayout.levelSeparation = Math.abs(this.constants.hierarchicalLayout.levelSeparation);
}
// get the size of the largest hubs and check if the user has defined a level for a node.
var hubsize = 0;
var node, nodeId;
var definedLevel = false;
var undefinedLevel = false;
for (nodeId in this.nodes) {
if (this.nodes.hasOwnProperty(nodeId)) {
node = this.nodes[nodeId];
if (node.level != -1) {
definedLevel = true;
}
else {
undefinedLevel = true;
}
if (hubsize < node.edges.length) {
hubsize = node.edges.length;
}
}
}
// if the user defined some levels but not all, alert and run without hierarchical layout
if (undefinedLevel == true && definedLevel == true) {
alert("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.");
this.zoomExtent(true,this.constants.clustering.enabled);
if (!this.constants.clustering.enabled) {
this.start();
}
}
else {
// setup the system to use hierarchical method.
this._changeConstants();
// define levels if undefined by the users. Based on hubsize
if (undefinedLevel == true) {
this._determineLevels(hubsize);
}
// check the distribution of the nodes per level.
var distribution = this._getDistribution();
// place the nodes on the canvas. This also stablilizes the system.
this._placeNodesByHierarchy(distribution);
// start the simulation.
this.start();
}
}
},
/**
* This function places the nodes on the canvas based on the hierarchial distribution.
*
* @param {Object} distribution | obtained by the function this._getDistribution()
* @private
*/
_placeNodesByHierarchy : function(distribution) {
var nodeId, node;
// start placing all the level 0 nodes first. Then recursively position their branches.
for (nodeId in distribution[0].nodes) {
if (distribution[0].nodes.hasOwnProperty(nodeId)) {
node = distribution[0].nodes[nodeId];
if (this.constants.hierarchicalLayout.direction == "UD" || this.constants.hierarchicalLayout.direction == "DU") {
if (node.xFixed) {
node.x = distribution[0].minPos;
node.xFixed = false;
distribution[0].minPos += distribution[0].nodeSpacing;
}
}
else {
if (node.yFixed) {
node.y = distribution[0].minPos;
node.yFixed = false;
distribution[0].minPos += distribution[0].nodeSpacing;
}
}
this._placeBranchNodes(node.edges,node.id,distribution,node.level);
}
}
// stabilize the system after positioning. This function calls zoomExtent.
this._stabilize();
},
/**
* This function get the distribution of levels based on hubsize
*
* @returns {Object}
* @private
*/
_getDistribution : function() {
var distribution = {};
var nodeId, node;
// we fix Y because the hierarchy is vertical, we fix X so we do not give a node an x position for a second time.
// the fix of X is removed after the x value has been set.
for (nodeId in this.nodes) {
if (this.nodes.hasOwnProperty(nodeId)) {
node = this.nodes[nodeId];
node.xFixed = true;
node.yFixed = true;
if (this.constants.hierarchicalLayout.direction == "UD" || this.constants.hierarchicalLayout.direction == "DU") {
node.y = this.constants.hierarchicalLayout.levelSeparation*node.level;
}
else {
node.x = this.constants.hierarchicalLayout.levelSeparation*node.level;
}
if (!distribution.hasOwnProperty(node.level)) {
distribution[node.level] = {amount: 0, nodes: {}, minPos:0, nodeSpacing:0};
}
distribution[node.level].amount += 1;
distribution[node.level].nodes[node.id] = node;
}
}
// determine the largest amount of nodes of all levels
var maxCount = 0;
for (var level in distribution) {
if (distribution.hasOwnProperty(level)) {
if (maxCount < distribution[level].amount) {
maxCount = distribution[level].amount;
}
}
}
// set the initial position and spacing of each nodes accordingly
for (var level in distribution) {
if (distribution.hasOwnProperty(level)) {
distribution[level].nodeSpacing = (maxCount + 1) * this.constants.hierarchicalLayout.nodeSpacing;
distribution[level].nodeSpacing /= (distribution[level].amount + 1);
distribution[level].minPos = distribution[level].nodeSpacing - (0.5 * (distribution[level].amount + 1) * distribution[level].nodeSpacing);
}
}
return distribution;
},
/**
* this function allocates nodes in levels based on the recursive branching from the largest hubs.
*
* @param hubsize
* @private
*/
_determineLevels : function(hubsize) {
var nodeId, node;
// determine hubs
for (nodeId in this.nodes) {
if (this.nodes.hasOwnProperty(nodeId)) {
node = this.nodes[nodeId];
if (node.edges.length == hubsize) {
node.level = 0;
}
}
}
// branch from hubs
for (nodeId in this.nodes) {
if (this.nodes.hasOwnProperty(nodeId)) {
node = this.nodes[nodeId];
if (node.level == 0) {
this._setLevel(1,node.edges,node.id);
}
}
}
},
/**
* Since hierarchical layout does not support:
* - smooth curves (based on the physics),
* - clustering (based on dynamic node counts)
*
* We disable both features so there will be no problems.
*
* @private
*/
_changeConstants : function() {
this.constants.clustering.enabled = false;
this.constants.physics.barnesHut.enabled = false;
this.constants.physics.hierarchicalRepulsion.enabled = true;
this._loadSelectedForceSolver();
this.constants.smoothCurves = false;
this._configureSmoothCurves();
},
/**
* This is a recursively called function to enumerate the branches from the largest hubs and place the nodes
* on a X position that ensures there will be no overlap.
*
* @param edges
* @param parentId
* @param distribution
* @param parentLevel
* @private
*/
_placeBranchNodes : function(edges, parentId, distribution, parentLevel) {
for (var i = 0; i < edges.length; i++) {
var childNode = null;
if (edges[i].toId == parentId) {
childNode = edges[i].from;
}
else {
childNode = edges[i].to;
}
// if a node is conneceted to another node on the same level (or higher (means lower level))!, this is not handled here.
var nodeMoved = false;
if (this.constants.hierarchicalLayout.direction == "UD" || this.constants.hierarchicalLayout.direction == "DU") {
if (childNode.xFixed && childNode.level > parentLevel) {
childNode.xFixed = false;
childNode.x = distribution[childNode.level].minPos;
nodeMoved = true;
}
}
else {
if (childNode.yFixed && childNode.level > parentLevel) {
childNode.yFixed = false;
childNode.y = distribution[childNode.level].minPos;
nodeMoved = true;
}
}
if (nodeMoved == true) {
distribution[childNode.level].minPos += distribution[childNode.level].nodeSpacing;
if (childNode.edges.length > 1) {
this._placeBranchNodes(childNode.edges,childNode.id,distribution,childNode.level);
}
}
}
},
/**
* this function is called recursively to enumerate the barnches of the largest hubs and give each node a level.
*
* @param level
* @param edges
* @param parentId
* @private
*/
_setLevel : function(level, edges, parentId) {
for (var i = 0; i < edges.length; i++) {
var childNode = null;
if (edges[i].toId == parentId) {
childNode = edges[i].from;
}
else {
childNode = edges[i].to;
}
if (childNode.level == -1 || childNode.level > level) {
childNode.level = level;
if (edges.length > 1) {
this._setLevel(level+1, childNode.edges, childNode.id);
}
}
}
},
/**
* Unfix nodes
*
* @private
*/
_restoreNodes : function() {
for (nodeId in this.nodes) {
if (this.nodes.hasOwnProperty(nodeId)) {
this.nodes[nodeId].xFixed = false;
this.nodes[nodeId].yFixed = false;
}
}
}
};
/**
* Created by Alex on 2/4/14.
*/
var manipulationMixin = {
/**
* clears the toolbar div element of children
*
* @private
*/
_clearManipulatorBar : function() {
while (this.manipulationDiv.hasChildNodes()) {
this.manipulationDiv.removeChild(this.manipulationDiv.firstChild);
}
},
/**
* Manipulation UI temporarily overloads certain functions to extend or replace them. To be able to restore
* these functions to their original functionality, we saved them in this.cachedFunctions.
* This function restores these functions to their original function.
*
* @private
*/
_restoreOverloadedFunctions : function() {
for (var functionName in this.cachedFunctions) {
if (this.cachedFunctions.hasOwnProperty(functionName)) {
this[functionName] = this.cachedFunctions[functionName];
}
}
},
/**
* Enable or disable edit-mode.
*
* @private
*/
_toggleEditMode : function() {
this.editMode = !this.editMode;
var toolbar = document.getElementById("graph-manipulationDiv");
var closeDiv = document.getElementById("graph-manipulation-closeDiv");
var editModeDiv = document.getElementById("graph-manipulation-editMode");
if (this.editMode == true) {
toolbar.style.display="block";
closeDiv.style.display="block";
editModeDiv.style.display="none";
closeDiv.onclick = this._toggleEditMode.bind(this);
}
else {
toolbar.style.display="none";
closeDiv.style.display="none";
editModeDiv.style.display="block";
closeDiv.onclick = null;
}
this._createManipulatorBar()
},
/**
* main function, creates the main toolbar. Removes functions bound to the select event. Binds all the buttons of the toolbar.
*
* @private
*/
_createManipulatorBar : function() {
// remove bound functions
if (this.boundFunction) {
this.off('select', this.boundFunction);
}
// restore overloaded functions
this._restoreOverloadedFunctions();
// resume calculation
this.freezeSimulation = false;
// reset global variables
this.blockConnectingEdgeSelection = false;
this.forceAppendSelection = false;
if (this.editMode == true) {
while (this.manipulationDiv.hasChildNodes()) {
this.manipulationDiv.removeChild(this.manipulationDiv.firstChild);
}
// add the icons to the manipulator div
this.manipulationDiv.innerHTML = "" +
"<span class='graph-manipulationUI add' id='graph-manipulate-addNode'>" +
"<span class='graph-manipulationLabel'>"+this.constants.labels['add'] +"</span></span>" +
"<div class='graph-seperatorLine'></div>" +
"<span class='graph-manipulationUI connect' id='graph-manipulate-connectNode'>" +
"<span class='graph-manipulationLabel'>"+this.constants.labels['link'] +"</span></span>";
if (this._getSelectedNodeCount() == 1 && this.triggerFunctions.edit) {
this.manipulationDiv.innerHTML += "" +
"<div class='graph-seperatorLine'></div>" +
"<span class='graph-manipulationUI edit' id='graph-manipulate-editNode'>" +
"<span class='graph-manipulationLabel'>"+this.constants.labels['editNode'] +"</span></span>";
}
if (this._selectionIsEmpty() == false) {
this.manipulationDiv.innerHTML += "" +
"<div class='graph-seperatorLine'></div>" +
"<span class='graph-manipulationUI delete' id='graph-manipulate-delete'>" +
"<span class='graph-manipulationLabel'>"+this.constants.labels['del'] +"</span></span>";
}
// bind the icons
var addNodeButton = document.getElementById("graph-manipulate-addNode");
addNodeButton.onclick = this._createAddNodeToolbar.bind(this);
var addEdgeButton = document.getElementById("graph-manipulate-connectNode");
addEdgeButton.onclick = this._createAddEdgeToolbar.bind(this);
if (this._getSelectedNodeCount() == 1 && this.triggerFunctions.edit) {
var editButton = document.getElementById("graph-manipulate-editNode");
editButton.onclick = this._editNode.bind(this);
}
if (this._selectionIsEmpty() == false) {
var deleteButton = document.getElementById("graph-manipulate-delete");
deleteButton.onclick = this._deleteSelected.bind(this);
}
var closeDiv = document.getElementById("graph-manipulation-closeDiv");
closeDiv.onclick = this._toggleEditMode.bind(this);
this.boundFunction = this._createManipulatorBar.bind(this);
this.on('select', this.boundFunction);
}
else {
this.editModeDiv.innerHTML = "" +
"<span class='graph-manipulationUI edit editmode' id='graph-manipulate-editModeButton'>" +
"<span class='graph-manipulationLabel'>" + this.constants.labels['edit'] + "</span></span>";
var editModeButton = document.getElementById("graph-manipulate-editModeButton");
editModeButton.onclick = this._toggleEditMode.bind(this);
}
},
/**
* Create the toolbar for adding Nodes
*
* @private
*/
_createAddNodeToolbar : function() {
// clear the toolbar
this._clearManipulatorBar();
if (this.boundFunction) {
this.off('select', this.boundFunction);
}
// create the toolbar contents
this.manipulationDiv.innerHTML = "" +
"<span class='graph-manipulationUI back' id='graph-manipulate-back'>" +
"<span class='graph-manipulationLabel'>" + this.constants.labels['back'] + " </span></span>" +
"<div class='graph-seperatorLine'></div>" +
"<span class='graph-manipulationUI none' id='graph-manipulate-back'>" +
"<span id='graph-manipulatorLabel' class='graph-manipulationLabel'>" + this.constants.labels['addDescription'] + "</span></span>";
// bind the icon
var backButton = document.getElementById("graph-manipulate-back");
backButton.onclick = this._createManipulatorBar.bind(this);
// we use the boundFunction so we can reference it when we unbind it from the "select" event.
this.boundFunction = this._addNode.bind(this);
this.on('select', this.boundFunction);
},
/**
* create the toolbar to connect nodes
*
* @private
*/
_createAddEdgeToolbar : function() {
// clear the toolbar
this._clearManipulatorBar();
this._unselectAll(true);
this.freezeSimulation = true;
if (this.boundFunction) {
this.off('select', this.boundFunction);
}
this._unselectAll();
this.forceAppendSelection = false;
this.blockConnectingEdgeSelection = true;
this.manipulationDiv.innerHTML = "" +
"<span class='graph-manipulationUI back' id='graph-manipulate-back'>" +
"<span class='graph-manipulationLabel'>" + this.constants.labels['back'] + " </span></span>" +
"<div class='graph-seperatorLine'></div>" +
"<span class='graph-manipulationUI none' id='graph-manipulate-back'>" +
"<span id='graph-manipulatorLabel' class='graph-manipulationLabel'>" + this.constants.labels['linkDescription'] + "</span></span>";
// bind the icon
var backButton = document.getElementById("graph-manipulate-back");
backButton.onclick = this._createManipulatorBar.bind(this);
// we use the boundFunction so we can reference it when we unbind it from the "select" event.
this.boundFunction = this._handleConnect.bind(this);
this.on('select', this.boundFunction);
// temporarily overload functions
this.cachedFunctions["_handleTouch"] = this._handleTouch;
this.cachedFunctions["_handleOnRelease"] = this._handleOnRelease;
this._handleTouch = this._handleConnect;
this._handleOnRelease = this._finishConnect;
// redraw to show the unselect
this._redraw();
},
/**
* the function bound to the selection event. It checks if you want to connect a cluster and changes the description
* to walk the user through the process.
*
* @private
*/
_handleConnect : function(pointer) {
if (this._getSelectedNodeCount() == 0) {
var node = this._getNodeAt(pointer);
if (node != null) {
if (node.clusterSize > 1) {
alert("Cannot create edges to a cluster.")
}
else {
this._selectObject(node,false);
// create a node the temporary line can look at
this.sectors['support']['nodes']['targetNode'] = new Node({id:'targetNode'},{},{},this.constants);
this.sectors['support']['nodes']['targetNode'].x = node.x;
this.sectors['support']['nodes']['targetNode'].y = node.y;
this.sectors['support']['nodes']['targetViaNode'] = new Node({id:'targetViaNode'},{},{},this.constants);
this.sectors['support']['nodes']['targetViaNode'].x = node.x;
this.sectors['support']['nodes']['targetViaNode'].y = node.y;
this.sectors['support']['nodes']['targetViaNode'].parentEdgeId = "connectionEdge";
// create a temporary edge
this.edges['connectionEdge'] = new Edge({id:"connectionEdge",from:node.id,to:this.sectors['support']['nodes']['targetNode'].id}, this, this.constants);
this.edges['connectionEdge'].from = node;
this.edges['connectionEdge'].connected = true;
this.edges['connectionEdge'].smooth = true;
this.edges['connectionEdge'].selected = true;
this.edges['connectionEdge'].to = this.sectors['support']['nodes']['targetNode'];
this.edges['connectionEdge'].via = this.sectors['support']['nodes']['targetViaNode'];
this.cachedFunctions["_handleOnDrag"] = this._handleOnDrag;
this._handleOnDrag = function(event) {
var pointer = this._getPointer(event.gesture.center);
this.sectors['support']['nodes']['targetNode'].x = this._canvasToX(pointer.x);
this.sectors['support']['nodes']['targetNode'].y = this._canvasToY(pointer.y);
this.sectors['support']['nodes']['targetViaNode'].x = 0.5 * (this._canvasToX(pointer.x) + this.edges['connectionEdge'].from.x);
this.sectors['support']['nodes']['targetViaNode'].y = this._canvasToY(pointer.y);
};
this.moving = true;
this.start();
}
}
}
},
_finishConnect : function(pointer) {
if (this._getSelectedNodeCount() == 1) {
// restore the drag function
this._handleOnDrag = this.cachedFunctions["_handleOnDrag"];
delete this.cachedFunctions["_handleOnDrag"];
// remember the edge id
var connectFromId = this.edges['connectionEdge'].fromId;
// remove the temporary nodes and edge
delete this.edges['connectionEdge'];
delete this.sectors['support']['nodes']['targetNode'];
delete this.sectors['support']['nodes']['targetViaNode'];
var node = this._getNodeAt(pointer);
if (node != null) {
if (node.clusterSize > 1) {
alert("Cannot create edges to a cluster.")
}
else {
this._createEdge(connectFromId,node.id);
this._createManipulatorBar();
}
}
this._unselectAll();
}
},
/**
* Adds a node on the specified location
*
* @param {Object} pointer
*/
_addNode : function() {
if (this._selectionIsEmpty() && this.editMode == true) {
var positionObject = this._pointerToPositionObject(this.pointerPosition);
var defaultData = {id:util.randomUUID(),x:positionObject.left,y:positionObject.top,label:"new",allowedToMoveX:true,allowedToMoveY:true};
if (this.triggerFunctions.add) {
if (this.triggerFunctions.add.length == 2) {
var me = this;
this.triggerFunctions.add(defaultData, function(finalizedData) {
me.nodesData.add(finalizedData);
me._createManipulatorBar();
me.moving = true;
me.start();
});
}
else {
alert(this.constants.labels['addError']);
this._createManipulatorBar();
this.moving = true;
this.start();
}
}
else {
this.nodesData.add(defaultData);
this._createManipulatorBar();
this.moving = true;
this.start();
}
}
},
/**
* connect two nodes with a new edge.
*
* @private
*/
_createEdge : function(sourceNodeId,targetNodeId) {
if (this.editMode == true) {
var defaultData = {from:sourceNodeId, to:targetNodeId};
if (this.triggerFunctions.connect) {
if (this.triggerFunctions.connect.length == 2) {
var me = this;
this.triggerFunctions.connect(defaultData, function(finalizedData) {
me.edgesData.add(finalizedData);
me.moving = true;
me.start();
});
}
else {
alert(this.constants.labels["linkError"]);
this.moving = true;
this.start();
}
}
else {
this.edgesData.add(defaultData);
this.moving = true;
this.start();
}
}
},
/**
* Create the toolbar to edit the selected node. The label and the color can be changed. Other colors are derived from the chosen color.
*
* @private
*/
_editNode : function() {
if (this.triggerFunctions.edit && this.editMode == true) {
var node = this._getSelectedNode();
var data = {id:node.id,
label: node.label,
group: node.group,
shape: node.shape,
color: {
background:node.color.background,
border:node.color.border,
highlight: {
background:node.color.highlight.background,
border:node.color.highlight.border
}
}};
if (this.triggerFunctions.edit.length == 2) {
var me = this;
this.triggerFunctions.edit(data, function (finalizedData) {
me.nodesData.update(finalizedData);
me._createManipulatorBar();
me.moving = true;
me.start();
});
}
else {
alert(this.constants.labels["editError"]);
}
}
else {
alert(this.constants.labels["editBoundError"]);
}
},
/**
* delete everything in the selection
*
* @private
*/
_deleteSelected : function() {
if (!this._selectionIsEmpty() && this.editMode == true) {
if (!this._clusterInSelection()) {
var selectedNodes = this.getSelectedNodes();
var selectedEdges = this.getSelectedEdges();
if (this.triggerFunctions.del) {
var me = this;
var data = {nodes: selectedNodes, edges: selectedEdges};
if (this.triggerFunctions.del.length = 2) {
this.triggerFunctions.del(data, function (finalizedData) {
me.edgesData.remove(finalizedData.edges);
me.nodesData.remove(finalizedData.nodes);
me._unselectAll();
me.moving = true;
me.start();
});
}
else {
alert(this.constants.labels["deleteError"])
}
}
else {
this.edgesData.remove(selectedEdges);
this.nodesData.remove(selectedNodes);
this._unselectAll();
this.moving = true;
this.start();
}
}
else {
alert(this.constants.labels["deleteClusterError"]);
}
}
}
};
/**
* Creation of the SectorMixin var.
*
* This contains all the functions the Graph object can use to employ the sector system.
* The sector system is always used by Graph, though the benefits only apply to the use of clustering.
* If clustering is not used, there is no overhead except for a duplicate object with references to nodes and edges.
*
* Alex de Mulder
* 21-01-2013
*/
var SectorMixin = {
/**
* This function is only called by the setData function of the Graph object.
* This loads the global references into the active sector. This initializes the sector.
*
* @private
*/
_putDataInSector : function() {
this.sectors["active"][this._sector()].nodes = this.nodes;
this.sectors["active"][this._sector()].edges = this.edges;
this.sectors["active"][this._sector()].nodeIndices = this.nodeIndices;
},
/**
* /**
* This function sets the global references to nodes, edges and nodeIndices back to
* those of the supplied (active) sector. If a type is defined, do the specific type
*
* @param {String} sectorId
* @param {String} [sectorType] | "active" or "frozen"
* @private
*/
_switchToSector : function(sectorId, sectorType) {
if (sectorType === undefined || sectorType == "active") {
this._switchToActiveSector(sectorId);
}
else {
this._switchToFrozenSector(sectorId);
}
},
/**
* This function sets the global references to nodes, edges and nodeIndices back to
* those of the supplied active sector.
*
* @param sectorId
* @private
*/
_switchToActiveSector : function(sectorId) {
this.nodeIndices = this.sectors["active"][sectorId]["nodeIndices"];
this.nodes = this.sectors["active"][sectorId]["nodes"];
this.edges = this.sectors["active"][sectorId]["edges"];
},
/**
* This function sets the global references to nodes, edges and nodeIndices back to
* those of the supplied active sector.
*
* @param sectorId
* @private
*/
_switchToSupportSector : function() {
this.nodeIndices = this.sectors["support"]["nodeIndices"];
this.nodes = this.sectors["support"]["nodes"];
this.edges = this.sectors["support"]["edges"];
},
/**
* This function sets the global references to nodes, edges and nodeIndices back to
* those of the supplied frozen sector.
*
* @param sectorId
* @private
*/
_switchToFrozenSector : function(sectorId) {
this.nodeIndices = this.sectors["frozen"][sectorId]["nodeIndices"];
this.nodes = this.sectors["frozen"][sectorId]["nodes"];
this.edges = this.sectors["frozen"][sectorId]["edges"];
},
/**
* This function sets the global references to nodes, edges and nodeIndices back to
* those of the currently active sector.
*
* @private
*/
_loadLatestSector : function() {
this._switchToSector(this._sector());
},
/**
* This function returns the currently active sector Id
*
* @returns {String}
* @private
*/
_sector : function() {
return this.activeSector[this.activeSector.length-1];
},
/**
* This function returns the previously active sector Id
*
* @returns {String}
* @private
*/
_previousSector : function() {
if (this.activeSector.length > 1) {
return this.activeSector[this.activeSector.length-2];
}
else {
throw new TypeError('there are not enough sectors in the this.activeSector array.');
}
},
/**
* We add the active sector at the end of the this.activeSector array
* This ensures it is the currently active sector returned by _sector() and it reaches the top
* of the activeSector stack. When we reverse our steps we move from the end to the beginning of this stack.
*
* @param newId
* @private
*/
_setActiveSector : function(newId) {
this.activeSector.push(newId);
},
/**
* We remove the currently active sector id from the active sector stack. This happens when
* we reactivate the previously active sector
*
* @private
*/
_forgetLastSector : function() {
this.activeSector.pop();
},
/**
* This function creates a new active sector with the supplied newId. This newId
* is the expanding node id.
*
* @param {String} newId | Id of the new active sector
* @private
*/
_createNewSector : function(newId) {
// create the new sector
this.sectors["active"][newId] = {"nodes":{},
"edges":{},
"nodeIndices":[],
"formationScale": this.scale,
"drawingNode": undefined};
// create the new sector render node. This gives visual feedback that you are in a new sector.
this.sectors["active"][newId]['drawingNode'] = new Node(
{id:newId,
color: {
background: "#eaefef",
border: "495c5e"
}
},{},{},this.constants);
this.sectors["active"][newId]['drawingNode'].clusterSize = 2;
},
/**
* This function removes the currently active sector. This is called when we create a new
* active sector.
*
* @param {String} sectorId | Id of the active sector that will be removed
* @private
*/
_deleteActiveSector : function(sectorId) {
delete this.sectors["active"][sectorId];
},
/**
* This function removes the currently active sector. This is called when we reactivate
* the previously active sector.
*
* @param {String} sectorId | Id of the active sector that will be removed
* @private
*/
_deleteFrozenSector : function(sectorId) {
delete this.sectors["frozen"][sectorId];
},
/**
* Freezing an active sector means moving it from the "active" object to the "frozen" object.
* We copy the references, then delete the active entree.
*
* @param sectorId
* @private
*/
_freezeSector : function(sectorId) {
// we move the set references from the active to the frozen stack.
this.sectors["frozen"][sectorId] = this.sectors["active"][sectorId];
// we have moved the sector data into the frozen set, we now remove it from the active set
this._deleteActiveSector(sectorId);
},
/**
* This is the reverse operation of _freezeSector. Activating means moving the sector from the "frozen"
* object to the "active" object.
*
* @param sectorId
* @private
*/
_activateSector : function(sectorId) {
// we move the set references from the frozen to the active stack.
this.sectors["active"][sectorId] = this.sectors["frozen"][sectorId];
// we have moved the sector data into the active set, we now remove it from the frozen stack
this._deleteFrozenSector(sectorId);
},
/**
* This function merges the data from the currently active sector with a frozen sector. This is used
* in the process of reverting back to the previously active sector.
* The data that is placed in the frozen (the previously active) sector is the node that has been removed from it
* upon the creation of a new active sector.
*
* @param sectorId
* @private
*/
_mergeThisWithFrozen : function(sectorId) {
// copy all nodes
for (var nodeId in this.nodes) {
if (this.nodes.hasOwnProperty(nodeId)) {
this.sectors["frozen"][sectorId]["nodes"][nodeId] = this.nodes[nodeId];
}
}
// copy all edges (if not fully clustered, else there are no edges)
for (var edgeId in this.edges) {
if (this.edges.hasOwnProperty(edgeId)) {
this.sectors["frozen"][sectorId]["edges"][edgeId] = this.edges[edgeId];
}
}
// merge the nodeIndices
for (var i = 0; i < this.nodeIndices.length; i++) {
this.sectors["frozen"][sectorId]["nodeIndices"].push(this.nodeIndices[i]);
}
},
/**
* This clusters the sector to one cluster. It was a single cluster before this process started so
* we revert to that state. The clusterToFit function with a maximum size of 1 node does this.
*
* @private
*/
_collapseThisToSingleCluster : function() {
this.clusterToFit(1,false);
},
/**
* We create a new active sector from the node that we want to open.
*
* @param node
* @private
*/
_addSector : function(node) {
// this is the currently active sector
var sector = this._sector();
// // this should allow me to select nodes from a frozen set.
// if (this.sectors['active'][sector]["nodes"].hasOwnProperty(node.id)) {
// console.log("the node is part of the active sector");
// }
// else {
// console.log("I dont know what happened!!");
// }
// when we switch to a new sector, we remove the node that will be expanded from the current nodes list.
delete this.nodes[node.id];
var unqiueIdentifier = util.randomUUID();
// we fully freeze the currently active sector
this._freezeSector(sector);
// we create a new active sector. This sector has the Id of the node to ensure uniqueness
this._createNewSector(unqiueIdentifier);
// we add the active sector to the sectors array to be able to revert these steps later on
this._setActiveSector(unqiueIdentifier);
// we redirect the global references to the new sector's references. this._sector() now returns unqiueIdentifier
this._switchToSector(this._sector());
// finally we add the node we removed from our previous active sector to the new active sector
this.nodes[node.id] = node;
},
/**
* We close the sector that is currently open and revert back to the one before.
* If the active sector is the "default" sector, nothing happens.
*
* @private
*/
_collapseSector : function() {
// the currently active sector
var sector = this._sector();
// we cannot collapse the default sector
if (sector != "default") {
if ((this.nodeIndices.length == 1) ||
(this.sectors["active"][sector]["drawingNode"].width*this.scale < this.constants.clustering.screenSizeThreshold * this.frame.canvas.clientWidth) ||
(this.sectors["active"][sector]["drawingNode"].height*this.scale < this.constants.clustering.screenSizeThreshold * this.frame.canvas.clientHeight)) {
var previousSector = this._previousSector();
// we collapse the sector back to a single cluster
this._collapseThisToSingleCluster();
// we move the remaining nodes, edges and nodeIndices to the previous sector.
// This previous sector is the one we will reactivate
this._mergeThisWithFrozen(previousSector);
// the previously active (frozen) sector now has all the data from the currently active sector.
// we can now delete the active sector.
this._deleteActiveSector(sector);
// we activate the previously active (and currently frozen) sector.
this._activateSector(previousSector);
// we load the references from the newly active sector into the global references
this._switchToSector(previousSector);
// we forget the previously active sector because we reverted to the one before
this._forgetLastSector();
// finally, we update the node index list.
this._updateNodeIndexList();
// we refresh the list with calulation nodes and calculation node indices.
this._updateCalculationNodes();
}
}
},
/**
* This runs a function in all active sectors. This is used in _redraw() and the _initializeForceCalculation().
*
* @param {String} runFunction | This is the NAME of a function we want to call in all active sectors
* | we dont pass the function itself because then the "this" is the window object
* | instead of the Graph object
* @param {*} [argument] | Optional: arguments to pass to the runFunction
* @private
*/
_doInAllActiveSectors : function(runFunction,argument) {
if (argument === undefined) {
for (var sector in this.sectors["active"]) {
if (this.sectors["active"].hasOwnProperty(sector)) {
// switch the global references to those of this sector
this._switchToActiveSector(sector);
this[runFunction]();
}
}
}
else {
for (var sector in this.sectors["active"]) {
if (this.sectors["active"].hasOwnProperty(sector)) {
// switch the global references to those of this sector
this._switchToActiveSector(sector);
var args = Array.prototype.splice.call(arguments, 1);
if (args.length > 1) {
this[runFunction](args[0],args[1]);
}
else {
this[runFunction](argument);
}
}
}
}
// we revert the global references back to our active sector
this._loadLatestSector();
},
/**
* This runs a function in all active sectors. This is used in _redraw() and the _initializeForceCalculation().
*
* @param {String} runFunction | This is the NAME of a function we want to call in all active sectors
* | we dont pass the function itself because then the "this" is the window object
* | instead of the Graph object
* @param {*} [argument] | Optional: arguments to pass to the runFunction
* @private
*/
_doInSupportSector : function(runFunction,argument) {
if (argument === undefined) {
this._switchToSupportSector();
this[runFunction]();
}
else {
this._switchToSupportSector();
var args = Array.prototype.splice.call(arguments, 1);
if (args.length > 1) {
this[runFunction](args[0],args[1]);
}
else {
this[runFunction](argument);
}
}
// we revert the global references back to our active sector
this._loadLatestSector();
},
/**
* This runs a function in all frozen sectors. This is used in the _redraw().
*
* @param {String} runFunction | This is the NAME of a function we want to call in all active sectors
* | we don't pass the function itself because then the "this" is the window object
* | instead of the Graph object
* @param {*} [argument] | Optional: arguments to pass to the runFunction
* @private
*/
_doInAllFrozenSectors : function(runFunction,argument) {
if (argument === undefined) {
for (var sector in this.sectors["frozen"]) {
if (this.sectors["frozen"].hasOwnProperty(sector)) {
// switch the global references to those of this sector
this._switchToFrozenSector(sector);
this[runFunction]();
}
}
}
else {
for (var sector in this.sectors["frozen"]) {
if (this.sectors["frozen"].hasOwnProperty(sector)) {
// switch the global references to those of this sector
this._switchToFrozenSector(sector);
var args = Array.prototype.splice.call(arguments, 1);
if (args.length > 1) {
this[runFunction](args[0],args[1]);
}
else {
this[runFunction](argument);
}
}
}
}
this._loadLatestSector();
},
/**
* This runs a function in all sectors. This is used in the _redraw().
*
* @param {String} runFunction | This is the NAME of a function we want to call in all active sectors
* | we don't pass the function itself because then the "this" is the window object
* | instead of the Graph object
* @param {*} [argument] | Optional: arguments to pass to the runFunction
* @private
*/
_doInAllSectors : function(runFunction,argument) {
var args = Array.prototype.splice.call(arguments, 1);
if (argument === undefined) {
this._doInAllActiveSectors(runFunction);
this._doInAllFrozenSectors(runFunction);
}
else {
if (args.length > 1) {
this._doInAllActiveSectors(runFunction,args[0],args[1]);
this._doInAllFrozenSectors(runFunction,args[0],args[1]);
}
else {
this._doInAllActiveSectors(runFunction,argument);
this._doInAllFrozenSectors(runFunction,argument);
}
}
},
/**
* This clears the nodeIndices list. We cannot use this.nodeIndices = [] because we would break the link with the
* active sector. Thus we clear the nodeIndices in the active sector, then reconnect the this.nodeIndices to it.
*
* @private
*/
_clearNodeIndexList : function() {
var sector = this._sector();
this.sectors["active"][sector]["nodeIndices"] = [];
this.nodeIndices = this.sectors["active"][sector]["nodeIndices"];
},
/**
* Draw the encompassing sector node
*
* @param ctx
* @param sectorType
* @private
*/
_drawSectorNodes : function(ctx,sectorType) {
var minY = 1e9, maxY = -1e9, minX = 1e9, maxX = -1e9, node;
for (var sector in this.sectors[sectorType]) {
if (this.sectors[sectorType].hasOwnProperty(sector)) {
if (this.sectors[sectorType][sector]["drawingNode"] !== undefined) {
this._switchToSector(sector,sectorType);
minY = 1e9; maxY = -1e9; minX = 1e9; maxX = -1e9;
for (var nodeId in this.nodes) {
if (this.nodes.hasOwnProperty(nodeId)) {
node = this.nodes[nodeId];
node.resize(ctx);
if (minX > node.x - 0.5 * node.width) {minX = node.x - 0.5 * node.width;}
if (maxX < node.x + 0.5 * node.width) {maxX = node.x + 0.5 * node.width;}
if (minY > node.y - 0.5 * node.height) {minY = node.y - 0.5 * node.height;}
if (maxY < node.y + 0.5 * node.height) {maxY = node.y + 0.5 * node.height;}
}
}
node = this.sectors[sectorType][sector]["drawingNode"];
node.x = 0.5 * (maxX + minX);
node.y = 0.5 * (maxY + minY);
node.width = 2 * (node.x - minX);
node.height = 2 * (node.y - minY);
node.radius = Math.sqrt(Math.pow(0.5*node.width,2) + Math.pow(0.5*node.height,2));
node.setScale(this.scale);
node._drawCircle(ctx);
}
}
}
},
_drawAllSectorNodes : function(ctx) {
this._drawSectorNodes(ctx,"frozen");
this._drawSectorNodes(ctx,"active");
this._loadLatestSector();
}
};
/**
* Creation of the ClusterMixin var.
*
* This contains all the functions the Graph object can use to employ clustering
*
* Alex de Mulder
* 21-01-2013
*/
var ClusterMixin = {
/**
* This is only called in the constructor of the graph object
*
*/
startWithClustering : function() {
// cluster if the data set is big
this.clusterToFit(this.constants.clustering.initialMaxNodes, true);
// updates the lables after clustering
this.updateLabels();
// this is called here because if clusterin is disabled, the start and stabilize are called in
// the setData function.
if (this.stabilize) {
this._stabilize();
}
this.start();
},
/**
* This function clusters until the initialMaxNodes has been reached
*
* @param {Number} maxNumberOfNodes
* @param {Boolean} reposition
*/
clusterToFit : function(maxNumberOfNodes, reposition) {
var numberOfNodes = this.nodeIndices.length;
var maxLevels = 50;
var level = 0;
// we first cluster the hubs, then we pull in the outliers, repeat
while (numberOfNodes > maxNumberOfNodes && level < maxLevels) {
if (level % 3 == 0) {
this.forceAggregateHubs(true);
this.normalizeClusterLevels();
}
else {
this.increaseClusterLevel(); // this also includes a cluster normalization
}
numberOfNodes = this.nodeIndices.length;
level += 1;
}
// after the clustering we reposition the nodes to reduce the initial chaos
if (level > 0 && reposition == true) {
this.repositionNodes();
}
this._updateCalculationNodes();
},
/**
* This function can be called to open up a specific cluster. It is only called by
* It will unpack the cluster back one level.
*
* @param node | Node object: cluster to open.
*/
openCluster : function(node) {
var isMovingBeforeClustering = this.moving;
if (node.clusterSize > this.constants.clustering.sectorThreshold && this._nodeInActiveArea(node) &&
!(this._sector() == "default" && this.nodeIndices.length == 1)) {
// this loads a new sector, loads the nodes and edges and nodeIndices of it.
this._addSector(node);
var level = 0;
// we decluster until we reach a decent number of nodes
while ((this.nodeIndices.length < this.constants.clustering.initialMaxNodes) && (level < 10)) {
this.decreaseClusterLevel();
level += 1;
}
}
else {
this._expandClusterNode(node,false,true);
// update the index list, dynamic edges and labels
this._updateNodeIndexList();
this._updateDynamicEdges();
this._updateCalculationNodes();
this.updateLabels();
}
// if the simulation was settled, we restart the simulation if a cluster has been formed or expanded
if (this.moving != isMovingBeforeClustering) {
this.start();
}
},
/**
* This calls the updateClustes with default arguments
*/
updateClustersDefault : function() {
if (this.constants.clustering.enabled == true) {
this.updateClusters(0,false,false);
}
},
/**
* This function can be called to increase the cluster level. This means that the nodes with only one edge connection will
* be clustered with their connected node. This can be repeated as many times as needed.
* This can be called externally (by a keybind for instance) to reduce the complexity of big datasets.
*/
increaseClusterLevel : function() {
this.updateClusters(-1,false,true);
},
/**
* This function can be called to decrease the cluster level. This means that the nodes with only one edge connection will
* be unpacked if they are a cluster. This can be repeated as many times as needed.
* This can be called externally (by a key-bind for instance) to look into clusters without zooming.
*/
decreaseClusterLevel : function() {
this.updateClusters(1,false,true);
},
/**
* This is the main clustering function. It clusters and declusters on zoom or forced
* This function clusters on zoom, it can be called with a predefined zoom direction
* If out, check if we can form clusters, if in, check if we can open clusters.
* This function is only called from _zoom()
*
* @param {Number} zoomDirection | -1 / 0 / +1 for zoomOut / determineByZoom / zoomIn
* @param {Boolean} recursive | enabled or disable recursive calling of the opening of clusters
* @param {Boolean} force | enabled or disable forcing
*
*/
updateClusters : function(zoomDirection,recursive,force,doNotStart) {
var isMovingBeforeClustering = this.moving;
var amountOfNodes = this.nodeIndices.length;
// on zoom out collapse the sector if the scale is at the level the sector was made
if (this.previousScale > this.scale && zoomDirection == 0) {
this._collapseSector();
}
// check if we zoom in or out
if (this.previousScale > this.scale || zoomDirection == -1) { // zoom out
// forming clusters when forced pulls outliers in. When not forced, the edge length of the
// outer nodes determines if it is being clustered
this._formClusters(force);
}
else if (this.previousScale < this.scale || zoomDirection == 1) { // zoom in
if (force == true) {
// _openClusters checks for each node if the formationScale of the cluster is smaller than
// the current scale and if so, declusters. When forced, all clusters are reduced by one step
this._openClusters(recursive,force);
}
else {
// if a cluster takes up a set percentage of the active window
this._openClustersBySize();
}
}
this._updateNodeIndexList();
// if a cluster was NOT formed and the user zoomed out, we try clustering by hubs
if (this.nodeIndices.length == amountOfNodes && (this.previousScale > this.scale || zoomDirection == -1)) {
this._aggregateHubs(force);
this._updateNodeIndexList();
}
// we now reduce chains.
if (this.previousScale > this.scale || zoomDirection == -1) { // zoom out
this.handleChains();
this._updateNodeIndexList();
}
this.previousScale = this.scale;
// rest of the update the index list, dynamic edges and labels
this._updateDynamicEdges();
this.updateLabels();
// if a cluster was formed, we increase the clusterSession
if (this.nodeIndices.length < amountOfNodes) { // this means a clustering operation has taken place
this.clusterSession += 1;
// if clusters have been made, we normalize the cluster level
this.normalizeClusterLevels();
}
if (doNotStart == false || doNotStart === undefined) {
// if the simulation was settled, we restart the simulation if a cluster has been formed or expanded
if (this.moving != isMovingBeforeClustering) {
this.start();
}
}
this._updateCalculationNodes();
},
/**
* This function handles the chains. It is called on every updateClusters().
*/
handleChains : function() {
// after clustering we check how many chains there are
var chainPercentage = this._getChainFraction();
if (chainPercentage > this.constants.clustering.chainThreshold) {
this._reduceAmountOfChains(1 - this.constants.clustering.chainThreshold / chainPercentage)
}
},
/**
* this functions starts clustering by hubs
* The minimum hub threshold is set globally
*
* @private
*/
_aggregateHubs : function(force) {
this._getHubSize();
this._formClustersByHub(force,false);
},
/**
* This function is fired by keypress. It forces hubs to form.
*
*/
forceAggregateHubs : function(doNotStart) {
var isMovingBeforeClustering = this.moving;
var amountOfNodes = this.nodeIndices.length;
this._aggregateHubs(true);
// update the index list, dynamic edges and labels
this._updateNodeIndexList();
this._updateDynamicEdges();
this.updateLabels();
// if a cluster was formed, we increase the clusterSession
if (this.nodeIndices.length != amountOfNodes) {
this.clusterSession += 1;
}
if (doNotStart == false || doNotStart === undefined) {
// if the simulation was settled, we restart the simulation if a cluster has been formed or expanded
if (this.moving != isMovingBeforeClustering) {
this.start();
}
}
},
/**
* If a cluster takes up more than a set percentage of the screen, open the cluster
*
* @private
*/
_openClustersBySize : function() {
for (var nodeId in this.nodes) {
if (this.nodes.hasOwnProperty(nodeId)) {
var node = this.nodes[nodeId];
if (node.inView() == true) {
if ((node.width*this.scale > this.constants.clustering.screenSizeThreshold * this.frame.canvas.clientWidth) ||
(node.height*this.scale > this.constants.clustering.screenSizeThreshold * this.frame.canvas.clientHeight)) {
this.openCluster(node);
}
}
}
}
},
/**
* This function loops over all nodes in the nodeIndices list. For each node it checks if it is a cluster and if it
* has to be opened based on the current zoom level.
*
* @private
*/
_openClusters : function(recursive,force) {
for (var i = 0; i < this.nodeIndices.length; i++) {
var node = this.nodes[this.nodeIndices[i]];
this._expandClusterNode(node,recursive,force);
this._updateCalculationNodes();
}
},
/**
* This function checks if a node has to be opened. This is done by checking the zoom level.
* If the node contains child nodes, this function is recursively called on the child nodes as well.
* This recursive behaviour is optional and can be set by the recursive argument.
*
* @param {Node} parentNode | to check for cluster and expand
* @param {Boolean} recursive | enabled or disable recursive calling
* @param {Boolean} force | enabled or disable forcing
* @param {Boolean} [openAll] | This will recursively force all nodes in the parent to be released
* @private
*/
_expandClusterNode : function(parentNode, recursive, force, openAll) {
// first check if node is a cluster
if (parentNode.clusterSize > 1) {
// this means that on a double tap event or a zoom event, the cluster fully unpacks if it is smaller than 20
if (parentNode.clusterSize < this.constants.clustering.sectorThreshold) {
openAll = true;
}
recursive = openAll ? true : recursive;
// if the last child has been added on a smaller scale than current scale decluster
if (parentNode.formationScale < this.scale || force == true) {
// we will check if any of the contained child nodes should be removed from the cluster
for (var containedNodeId in parentNode.containedNodes) {
if (parentNode.containedNodes.hasOwnProperty(containedNodeId)) {
var childNode = parentNode.containedNodes[containedNodeId];
// force expand will expand the largest cluster size clusters. Since we cluster from outside in, we assume that
// the largest cluster is the one that comes from outside
if (force == true) {
if (childNode.clusterSession == parentNode.clusterSessions[parentNode.clusterSessions.length-1]
|| openAll) {
this._expelChildFromParent(parentNode,containedNodeId,recursive,force,openAll);
}
}
else {
if (this._nodeInActiveArea(parentNode)) {
this._expelChildFromParent(parentNode,containedNodeId,recursive,force,openAll);
}
}
}
}
}
}
},
/**
* ONLY CALLED FROM _expandClusterNode
*
* This function will expel a child_node from a parent_node. This is to de-cluster the node. This function will remove
* the child node from the parent contained_node object and put it back into the global nodes object.
* The same holds for the edge that was connected to the child node. It is moved back into the global edges object.
*
* @param {Node} parentNode | the parent node
* @param {String} containedNodeId | child_node id as it is contained in the containedNodes object of the parent node
* @param {Boolean} recursive | This will also check if the child needs to be expanded.
* With force and recursive both true, the entire cluster is unpacked
* @param {Boolean} force | This will disregard the zoom level and will expel this child from the parent
* @param {Boolean} openAll | This will recursively force all nodes in the parent to be released
* @private
*/
_expelChildFromParent : function(parentNode, containedNodeId, recursive, force, openAll) {
var childNode = parentNode.containedNodes[containedNodeId];
// if child node has been added on smaller scale than current, kick out
if (childNode.formationScale < this.scale || force == true) {
// unselect all selected items
this._unselectAll();
// put the child node back in the global nodes object
this.nodes[containedNodeId] = childNode;
// release the contained edges from this childNode back into the global edges
this._releaseContainedEdges(parentNode,childNode);
// reconnect rerouted edges to the childNode
this._connectEdgeBackToChild(parentNode,childNode);
// validate all edges in dynamicEdges
this._validateEdges(parentNode);
// undo the changes from the clustering operation on the parent node
parentNode.mass -= childNode.mass;
parentNode.clusterSize -= childNode.clusterSize;
parentNode.fontSize = Math.min(this.constants.clustering.maxFontSize, this.constants.nodes.fontSize + this.constants.clustering.fontSizeMultiplier*parentNode.clusterSize);
parentNode.dynamicEdgesLength = parentNode.dynamicEdges.length;
// place the child node near the parent, not at the exact same location to avoid chaos in the system
childNode.x = parentNode.x + parentNode.growthIndicator * (0.5 - Math.random());
childNode.y = parentNode.y + parentNode.growthIndicator * (0.5 - Math.random());
// remove node from the list
delete parentNode.containedNodes[containedNodeId];
// check if there are other childs with this clusterSession in the parent.
var othersPresent = false;
for (var childNodeId in parentNode.containedNodes) {
if (parentNode.containedNodes.hasOwnProperty(childNodeId)) {
if (parentNode.containedNodes[childNodeId].clusterSession == childNode.clusterSession) {
othersPresent = true;
break;
}
}
}
// if there are no others, remove the cluster session from the list
if (othersPresent == false) {
parentNode.clusterSessions.pop();
}
this._repositionBezierNodes(childNode);
// this._repositionBezierNodes(parentNode);
// remove the clusterSession from the child node
childNode.clusterSession = 0;
// recalculate the size of the node on the next time the node is rendered
parentNode.clearSizeCache();
// restart the simulation to reorganise all nodes
this.moving = true;
}
// check if a further expansion step is possible if recursivity is enabled
if (recursive == true) {
this._expandClusterNode(childNode,recursive,force,openAll);
}
},
/**
* position the bezier nodes at the center of the edges
*
* @param node
* @private
*/
_repositionBezierNodes : function(node) {
for (var i = 0; i < node.dynamicEdges.length; i++) {
node.dynamicEdges[i].positionBezierNode();
}
},
/**
* This function checks if any nodes at the end of their trees have edges below a threshold length
* This function is called only from updateClusters()
* forceLevelCollapse ignores the length of the edge and collapses one level
* This means that a node with only one edge will be clustered with its connected node
*
* @private
* @param {Boolean} force
*/
_formClusters : function(force) {
if (force == false) {
this._formClustersByZoom();
}
else {
this._forceClustersByZoom();
}
},
/**
* This function handles the clustering by zooming out, this is based on a minimum edge distance
*
* @private
*/
_formClustersByZoom : function() {
var dx,dy,length,
minLength = this.constants.clustering.clusterEdgeThreshold/this.scale;
// check if any edges are shorter than minLength and start the clustering
// the clustering favours the node with the larger mass
for (var edgeId in this.edges) {
if (this.edges.hasOwnProperty(edgeId)) {
var edge = this.edges[edgeId];
if (edge.connected) {
if (edge.toId != edge.fromId) {
dx = (edge.to.x - edge.from.x);
dy = (edge.to.y - edge.from.y);
length = Math.sqrt(dx * dx + dy * dy);
if (length < minLength) {
// first check which node is larger
var parentNode = edge.from;
var childNode = edge.to;
if (edge.to.mass > edge.from.mass) {
parentNode = edge.to;
childNode = edge.from;
}
if (childNode.dynamicEdgesLength == 1) {
this._addToCluster(parentNode,childNode,false);
}
else if (parentNode.dynamicEdgesLength == 1) {
this._addToCluster(childNode,parentNode,false);
}
}
}
}
}
}
},
/**
* This function forces the graph to cluster all nodes with only one connecting edge to their
* connected node.
*
* @private
*/
_forceClustersByZoom : function() {
for (var nodeId in this.nodes) {
// another node could have absorbed this child.
if (this.nodes.hasOwnProperty(nodeId)) {
var childNode = this.nodes[nodeId];
// the edges can be swallowed by another decrease
if (childNode.dynamicEdgesLength == 1 && childNode.dynamicEdges.length != 0) {
var edge = childNode.dynamicEdges[0];
var parentNode = (edge.toId == childNode.id) ? this.nodes[edge.fromId] : this.nodes[edge.toId];
// group to the largest node
if (childNode.id != parentNode.id) {
if (parentNode.mass > childNode.mass) {
this._addToCluster(parentNode,childNode,true);
}
else {
this._addToCluster(childNode,parentNode,true);
}
}
}
}
}
},
/**
* To keep the nodes of roughly equal size we normalize the cluster levels.
* This function clusters a node to its smallest connected neighbour.
*
* @param node
* @private
*/
_clusterToSmallestNeighbour : function(node) {
var smallestNeighbour = -1;
var smallestNeighbourNode = null;
for (var i = 0; i < node.dynamicEdges.length; i++) {
if (node.dynamicEdges[i] !== undefined) {
var neighbour = null;
if (node.dynamicEdges[i].fromId != node.id) {
neighbour = node.dynamicEdges[i].from;
}
else if (node.dynamicEdges[i].toId != node.id) {
neighbour = node.dynamicEdges[i].to;
}
if (neighbour != null && smallestNeighbour > neighbour.clusterSessions.length) {
smallestNeighbour = neighbour.clusterSessions.length;
smallestNeighbourNode = neighbour;
}
}
}
if (neighbour != null && this.nodes[neighbour.id] !== undefined) {
this._addToCluster(neighbour, node, true);
}
},
/**
* This function forms clusters from hubs, it loops over all nodes
*
* @param {Boolean} force | Disregard zoom level
* @param {Boolean} onlyEqual | This only clusters a hub with a specific number of edges
* @private
*/
_formClustersByHub : function(force, onlyEqual) {
// we loop over all nodes in the list
for (var nodeId in this.nodes) {
// we check if it is still available since it can be used by the clustering in this loop
if (this.nodes.hasOwnProperty(nodeId)) {
this._formClusterFromHub(this.nodes[nodeId],force,onlyEqual);
}
}
},
/**
* This function forms a cluster from a specific preselected hub node
*
* @param {Node} hubNode | the node we will cluster as a hub
* @param {Boolean} force | Disregard zoom level
* @param {Boolean} onlyEqual | This only clusters a hub with a specific number of edges
* @param {Number} [absorptionSizeOffset] |
* @private
*/
_formClusterFromHub : function(hubNode, force, onlyEqual, absorptionSizeOffset) {
if (absorptionSizeOffset === undefined) {
absorptionSizeOffset = 0;
}
// we decide if the node is a hub
if ((hubNode.dynamicEdgesLength >= this.hubThreshold && onlyEqual == false) ||
(hubNode.dynamicEdgesLength == this.hubThreshold && onlyEqual == true)) {
// initialize variables
var dx,dy,length;
var minLength = this.constants.clustering.clusterEdgeThreshold/this.scale;
var allowCluster = false;
// we create a list of edges because the dynamicEdges change over the course of this loop
var edgesIdarray = [];
var amountOfInitialEdges = hubNode.dynamicEdges.length;
for (var j = 0; j < amountOfInitialEdges; j++) {
edgesIdarray.push(hubNode.dynamicEdges[j].id);
}
// if the hub clustering is not forces, we check if one of the edges connected
// to a cluster is small enough based on the constants.clustering.clusterEdgeThreshold
if (force == false) {
allowCluster = false;
for (j = 0; j < amountOfInitialEdges; j++) {
var edge = this.edges[edgesIdarray[j]];
if (edge !== undefined) {
if (edge.connected) {
if (edge.toId != edge.fromId) {
dx = (edge.to.x - edge.from.x);
dy = (edge.to.y - edge.from.y);
length = Math.sqrt(dx * dx + dy * dy);
if (length < minLength) {
allowCluster = true;
break;
}
}
}
}
}
}
// start the clustering if allowed
if ((!force && allowCluster) || force) {
// we loop over all edges INITIALLY connected to this hub
for (j = 0; j < amountOfInitialEdges; j++) {
edge = this.edges[edgesIdarray[j]];
// the edge can be clustered by this function in a previous loop
if (edge !== undefined) {
var childNode = this.nodes[(edge.fromId == hubNode.id) ? edge.toId : edge.fromId];
// we do not want hubs to merge with other hubs nor do we want to cluster itself.
if ((childNode.dynamicEdges.length <= (this.hubThreshold + absorptionSizeOffset)) &&
(childNode.id != hubNode.id)) {
this._addToCluster(hubNode,childNode,force);
}
}
}
}
}
},
/**
* This function adds the child node to the parent node, creating a cluster if it is not already.
*
* @param {Node} parentNode | this is the node that will house the child node
* @param {Node} childNode | this node will be deleted from the global this.nodes and stored in the parent node
* @param {Boolean} force | true will only update the remainingEdges at the very end of the clustering, ensuring single level collapse
* @private
*/
_addToCluster : function(parentNode, childNode, force) {
// join child node in the parent node
parentNode.containedNodes[childNode.id] = childNode;
// manage all the edges connected to the child and parent nodes
for (var i = 0; i < childNode.dynamicEdges.length; i++) {
var edge = childNode.dynamicEdges[i];
if (edge.toId == parentNode.id || edge.fromId == parentNode.id) { // edge connected to parentNode
this._addToContainedEdges(parentNode,childNode,edge);
}
else {
this._connectEdgeToCluster(parentNode,childNode,edge);
}
}
// a contained node has no dynamic edges.
childNode.dynamicEdges = [];
// remove circular edges from clusters
this._containCircularEdgesFromNode(parentNode,childNode);
// remove the childNode from the global nodes object
delete this.nodes[childNode.id];
// update the properties of the child and parent
var massBefore = parentNode.mass;
childNode.clusterSession = this.clusterSession;
parentNode.mass += childNode.mass;
parentNode.clusterSize += childNode.clusterSize;
parentNode.fontSize = Math.min(this.constants.clustering.maxFontSize, this.constants.nodes.fontSize + this.constants.clustering.fontSizeMultiplier*parentNode.clusterSize);
// keep track of the clustersessions so we can open the cluster up as it has been formed.
if (parentNode.clusterSessions[parentNode.clusterSessions.length - 1] != this.clusterSession) {
parentNode.clusterSessions.push(this.clusterSession);
}
// forced clusters only open from screen size and double tap
if (force == true) {
// parentNode.formationScale = Math.pow(1 - (1.0/11.0),this.clusterSession+3);
parentNode.formationScale = 0;
}
else {
parentNode.formationScale = this.scale; // The latest child has been added on this scale
}
// recalculate the size of the node on the next time the node is rendered
parentNode.clearSizeCache();
// set the pop-out scale for the childnode
parentNode.containedNodes[childNode.id].formationScale = parentNode.formationScale;
// nullify the movement velocity of the child, this is to avoid hectic behaviour
childNode.clearVelocity();
// the mass has altered, preservation of energy dictates the velocity to be updated
parentNode.updateVelocity(massBefore);
// restart the simulation to reorganise all nodes
this.moving = true;
},
/**
* This function will apply the changes made to the remainingEdges during the formation of the clusters.
* This is a seperate function to allow for level-wise collapsing of the node barnesHutTree.
* It has to be called if a level is collapsed. It is called by _formClusters().
* @private
*/
_updateDynamicEdges : function() {
for (var i = 0; i < this.nodeIndices.length; i++) {
var node = this.nodes[this.nodeIndices[i]];
node.dynamicEdgesLength = node.dynamicEdges.length;
// this corrects for multiple edges pointing at the same other node
var correction = 0;
if (node.dynamicEdgesLength > 1) {
for (var j = 0; j < node.dynamicEdgesLength - 1; j++) {
var edgeToId = node.dynamicEdges[j].toId;
var edgeFromId = node.dynamicEdges[j].fromId;
for (var k = j+1; k < node.dynamicEdgesLength; k++) {
if ((node.dynamicEdges[k].toId == edgeToId && node.dynamicEdges[k].fromId == edgeFromId) ||
(node.dynamicEdges[k].fromId == edgeToId && node.dynamicEdges[k].toId == edgeFromId)) {
correction += 1;
}
}
}
}
node.dynamicEdgesLength -= correction;
}
},
/**
* This adds an edge from the childNode to the contained edges of the parent node
*
* @param parentNode | Node object
* @param childNode | Node object
* @param edge | Edge object
* @private
*/
_addToContainedEdges : function(parentNode, childNode, edge) {
// create an array object if it does not yet exist for this childNode
if (!(parentNode.containedEdges.hasOwnProperty(childNode.id))) {
parentNode.containedEdges[childNode.id] = []
}
// add this edge to the list
parentNode.containedEdges[childNode.id].push(edge);
// remove the edge from the global edges object
delete this.edges[edge.id];
// remove the edge from the parent object
for (var i = 0; i < parentNode.dynamicEdges.length; i++) {
if (parentNode.dynamicEdges[i].id == edge.id) {
parentNode.dynamicEdges.splice(i,1);
break;
}
}
},
/**
* This function connects an edge that was connected to a child node to the parent node.
* It keeps track of which nodes it has been connected to with the originalId array.
*
* @param {Node} parentNode | Node object
* @param {Node} childNode | Node object
* @param {Edge} edge | Edge object
* @private
*/
_connectEdgeToCluster : function(parentNode, childNode, edge) {
// handle circular edges
if (edge.toId == edge.fromId) {
this._addToContainedEdges(parentNode, childNode, edge);
}
else {
if (edge.toId == childNode.id) { // edge connected to other node on the "to" side
edge.originalToId.push(childNode.id);
edge.to = parentNode;
edge.toId = parentNode.id;
}
else { // edge connected to other node with the "from" side
edge.originalFromId.push(childNode.id);
edge.from = parentNode;
edge.fromId = parentNode.id;
}
this._addToReroutedEdges(parentNode,childNode,edge);
}
},
/**
* If a node is connected to itself, a circular edge is drawn. When clustering we want to contain
* these edges inside of the cluster.
*
* @param parentNode
* @param childNode
* @private
*/
_containCircularEdgesFromNode : function(parentNode, childNode) {
// manage all the edges connected to the child and parent nodes
for (var i = 0; i < parentNode.dynamicEdges.length; i++) {
var edge = parentNode.dynamicEdges[i];
// handle circular edges
if (edge.toId == edge.fromId) {
this._addToContainedEdges(parentNode, childNode, edge);
}
}
},
/**
* This adds an edge from the childNode to the rerouted edges of the parent node
*
* @param parentNode | Node object
* @param childNode | Node object
* @param edge | Edge object
* @private
*/
_addToReroutedEdges : function(parentNode, childNode, edge) {
// create an array object if it does not yet exist for this childNode
// we store the edge in the rerouted edges so we can restore it when the cluster pops open
if (!(parentNode.reroutedEdges.hasOwnProperty(childNode.id))) {
parentNode.reroutedEdges[childNode.id] = [];
}
parentNode.reroutedEdges[childNode.id].push(edge);
// this edge becomes part of the dynamicEdges of the cluster node
parentNode.dynamicEdges.push(edge);
},
/**
* This function connects an edge that was connected to a cluster node back to the child node.
*
* @param parentNode | Node object
* @param childNode | Node object
* @private
*/
_connectEdgeBackToChild : function(parentNode, childNode) {
if (parentNode.reroutedEdges.hasOwnProperty(childNode.id)) {
for (var i = 0; i < parentNode.reroutedEdges[childNode.id].length; i++) {
var edge = parentNode.reroutedEdges[childNode.id][i];
if (edge.originalFromId[edge.originalFromId.length-1] == childNode.id) {
edge.originalFromId.pop();
edge.fromId = childNode.id;
edge.from = childNode;
}
else {
edge.originalToId.pop();
edge.toId = childNode.id;
edge.to = childNode;
}
// append this edge to the list of edges connecting to the childnode
childNode.dynamicEdges.push(edge);
// remove the edge from the parent object
for (var j = 0; j < parentNode.dynamicEdges.length; j++) {
if (parentNode.dynamicEdges[j].id == edge.id) {
parentNode.dynamicEdges.splice(j,1);
break;
}
}
}
// remove the entry from the rerouted edges
delete parentNode.reroutedEdges[childNode.id];
}
},
/**
* When loops are clustered, an edge can be both in the rerouted array and the contained array.
* This function is called last to verify that all edges in dynamicEdges are in fact connected to the
* parentNode
*
* @param parentNode | Node object
* @private
*/
_validateEdges : function(parentNode) {
for (var i = 0; i < parentNode.dynamicEdges.length; i++) {
var edge = parentNode.dynamicEdges[i];
if (parentNode.id != edge.toId && parentNode.id != edge.fromId) {
parentNode.dynamicEdges.splice(i,1);
}
}
},
/**
* This function released the contained edges back into the global domain and puts them back into the
* dynamic edges of both parent and child.
*
* @param {Node} parentNode |
* @param {Node} childNode |
* @private
*/
_releaseContainedEdges : function(parentNode, childNode) {
for (var i = 0; i < parentNode.containedEdges[childNode.id].length; i++) {
var edge = parentNode.containedEdges[childNode.id][i];
// put the edge back in the global edges object
this.edges[edge.id] = edge;
// put the edge back in the dynamic edges of the child and parent
childNode.dynamicEdges.push(edge);
parentNode.dynamicEdges.push(edge);
}
// remove the entry from the contained edges
delete parentNode.containedEdges[childNode.id];
},
// ------------------- UTILITY FUNCTIONS ---------------------------- //
/**
* This updates the node labels for all nodes (for debugging purposes)
*/
updateLabels : function() {
var nodeId;
// update node labels
for (nodeId in this.nodes) {
if (this.nodes.hasOwnProperty(nodeId)) {
var node = this.nodes[nodeId];
if (node.clusterSize > 1) {
node.label = "[".concat(String(node.clusterSize),"]");
}
}
}
// update node labels
for (nodeId in this.nodes) {
if (this.nodes.hasOwnProperty(nodeId)) {
node = this.nodes[nodeId];
if (node.clusterSize == 1) {
if (node.originalLabel !== undefined) {
node.label = node.originalLabel;
}
else {
node.label = String(node.id);
}
}
}
}
// /* Debug Override */
// for (nodeId in this.nodes) {
// if (this.nodes.hasOwnProperty(nodeId)) {
// node = this.nodes[nodeId];
// node.label = String(node.level);
// }
// }
},
/**
* We want to keep the cluster level distribution rather small. This means we do not want unclustered nodes
* if the rest of the nodes are already a few cluster levels in.
* To fix this we use this function. It determines the min and max cluster level and sends nodes that have not
* clustered enough to the clusterToSmallestNeighbours function.
*/
normalizeClusterLevels : function() {
var maxLevel = 0;
var minLevel = 1e9;
var clusterLevel = 0;
// we loop over all nodes in the list
for (var nodeId in this.nodes) {
if (this.nodes.hasOwnProperty(nodeId)) {
clusterLevel = this.nodes[nodeId].clusterSessions.length;
if (maxLevel < clusterLevel) {maxLevel = clusterLevel;}
if (minLevel > clusterLevel) {minLevel = clusterLevel;}
}
}
if (maxLevel - minLevel > this.constants.clustering.clusterLevelDifference) {
var amountOfNodes = this.nodeIndices.length;
var targetLevel = maxLevel - this.constants.clustering.clusterLevelDifference;
// we loop over all nodes in the list
for (var nodeId in this.nodes) {
if (this.nodes.hasOwnProperty(nodeId)) {
if (this.nodes[nodeId].clusterSessions.length < targetLevel) {
this._clusterToSmallestNeighbour(this.nodes[nodeId]);
}
}
}
this._updateNodeIndexList();
this._updateDynamicEdges();
// if a cluster was formed, we increase the clusterSession
if (this.nodeIndices.length != amountOfNodes) {
this.clusterSession += 1;
}
}
},
/**
* This function determines if the cluster we want to decluster is in the active area
* this means around the zoom center
*
* @param {Node} node
* @returns {boolean}
* @private
*/
_nodeInActiveArea : function(node) {
return (
Math.abs(node.x - this.areaCenter.x) <= this.constants.clustering.activeAreaBoxSize/this.scale
&&
Math.abs(node.y - this.areaCenter.y) <= this.constants.clustering.activeAreaBoxSize/this.scale
)
},
/**
* This is an adaptation of the original repositioning function. This is called if the system is clustered initially
* It puts large clusters away from the center and randomizes the order.
*
*/
repositionNodes : function() {
for (var i = 0; i < this.nodeIndices.length; i++) {
var node = this.nodes[this.nodeIndices[i]];
if ((node.xFixed == false || node.yFixed == false)) {
var radius = 10 * 0.1*this.nodeIndices.length * Math.min(100,node.mass);
var angle = 2 * Math.PI * Math.random();
if (node.xFixed == false) {node.x = radius * Math.cos(angle);}
if (node.yFixed == false) {node.y = radius * Math.sin(angle);}
this._repositionBezierNodes(node);
}
}
},
/**
* We determine how many connections denote an important hub.
* We take the mean + 2*std as the important hub size. (Assuming a normal distribution of data, ~2.2%)
*
* @private
*/
_getHubSize : function() {
var average = 0;
var averageSquared = 0;
var hubCounter = 0;
var largestHub = 0;
for (var i = 0; i < this.nodeIndices.length; i++) {
var node = this.nodes[this.nodeIndices[i]];
if (node.dynamicEdgesLength > largestHub) {
largestHub = node.dynamicEdgesLength;
}
average += node.dynamicEdgesLength;
averageSquared += Math.pow(node.dynamicEdgesLength,2);
hubCounter += 1;
}
average = average / hubCounter;
averageSquared = averageSquared / hubCounter;
var variance = averageSquared - Math.pow(average,2);
var standardDeviation = Math.sqrt(variance);
this.hubThreshold = Math.floor(average + 2*standardDeviation);
// always have at least one to cluster
if (this.hubThreshold > largestHub) {
this.hubThreshold = largestHub;
}
// console.log("average",average,"averageSQ",averageSquared,"var",variance,"std",standardDeviation);
// console.log("hubThreshold:",this.hubThreshold);
},
/**
* We reduce the amount of "extension nodes" or chains. These are not quickly clustered with the outliers and hubs methods
* with this amount we can cluster specifically on these chains.
*
* @param {Number} fraction | between 0 and 1, the percentage of chains to reduce
* @private
*/
_reduceAmountOfChains : function(fraction) {
this.hubThreshold = 2;
var reduceAmount = Math.floor(this.nodeIndices.length * fraction);
for (var nodeId in this.nodes) {
if (this.nodes.hasOwnProperty(nodeId)) {
if (this.nodes[nodeId].dynamicEdgesLength == 2 && this.nodes[nodeId].dynamicEdges.length >= 2) {
if (reduceAmount > 0) {
this._formClusterFromHub(this.nodes[nodeId],true,true,1);
reduceAmount -= 1;
}
}
}
}
},
/**
* We get the amount of "extension nodes" or chains. These are not quickly clustered with the outliers and hubs methods
* with this amount we can cluster specifically on these chains.
*
* @private
*/
_getChainFraction : function() {
var chains = 0;
var total = 0;
for (var nodeId in this.nodes) {
if (this.nodes.hasOwnProperty(nodeId)) {
if (this.nodes[nodeId].dynamicEdgesLength == 2 && this.nodes[nodeId].dynamicEdges.length >= 2) {
chains += 1;
}
total += 1;
}
}
return chains/total;
}
};
var SelectionMixin = {
/**
* This function can be called from the _doInAllSectors function
*
* @param object
* @param overlappingNodes
* @private
*/
_getNodesOverlappingWith : function(object, overlappingNodes) {
var nodes = this.nodes;
for (var nodeId in nodes) {
if (nodes.hasOwnProperty(nodeId)) {
if (nodes[nodeId].isOverlappingWith(object)) {
overlappingNodes.push(nodeId);
}
}
}
},
/**
* retrieve all nodes overlapping with given object
* @param {Object} object An object with parameters left, top, right, bottom
* @return {Number[]} An array with id's of the overlapping nodes
* @private
*/
_getAllNodesOverlappingWith : function (object) {
var overlappingNodes = [];
this._doInAllActiveSectors("_getNodesOverlappingWith",object,overlappingNodes);
return overlappingNodes;
},
/**
* Return a position object in canvasspace from a single point in screenspace
*
* @param pointer
* @returns {{left: number, top: number, right: number, bottom: number}}
* @private
*/
_pointerToPositionObject : function(pointer) {
var x = this._canvasToX(pointer.x);
var y = this._canvasToY(pointer.y);
return {left: x,
top: y,
right: x,
bottom: y};
},
/**
* Get the top node at the a specific point (like a click)
*
* @param {{x: Number, y: Number}} pointer
* @return {Node | null} node
* @private
*/
_getNodeAt : function (pointer) {
// we first check if this is an navigation controls element
var positionObject = this._pointerToPositionObject(pointer);
var overlappingNodes = this._getAllNodesOverlappingWith(positionObject);
// if there are overlapping nodes, select the last one, this is the
// one which is drawn on top of the others
if (overlappingNodes.length > 0) {
return this.nodes[overlappingNodes[overlappingNodes.length - 1]];
}
else {
return null;
}
},
/**
* retrieve all edges overlapping with given object, selector is around center
* @param {Object} object An object with parameters left, top, right, bottom
* @return {Number[]} An array with id's of the overlapping nodes
* @private
*/
_getEdgesOverlappingWith : function (object, overlappingEdges) {
var edges = this.edges;
for (var edgeId in edges) {
if (edges.hasOwnProperty(edgeId)) {
if (edges[edgeId].isOverlappingWith(object)) {
overlappingEdges.push(edgeId);
}
}
}
},
/**
* retrieve all nodes overlapping with given object
* @param {Object} object An object with parameters left, top, right, bottom
* @return {Number[]} An array with id's of the overlapping nodes
* @private
*/
_getAllEdgesOverlappingWith : function (object) {
var overlappingEdges = [];
this._doInAllActiveSectors("_getEdgesOverlappingWith",object,overlappingEdges);
return overlappingEdges;
},
/**
* Place holder. To implement change the _getNodeAt to a _getObjectAt. Have the _getObjectAt call
* _getNodeAt and _getEdgesAt, then priortize the selection to user preferences.
*
* @param pointer
* @returns {null}
* @private
*/
_getEdgeAt : function(pointer) {
var positionObject = this._pointerToPositionObject(pointer);
var overlappingEdges = this._getAllEdgesOverlappingWith(positionObject);
if (overlappingEdges.length > 0) {
return this.edges[overlappingEdges[overlappingEdges.length - 1]];
}
else {
return null;
}
},
/**
* Add object to the selection array.
*
* @param obj
* @private
*/
_addToSelection : function(obj) {
if (obj instanceof Node) {
this.selectionObj.nodes[obj.id] = obj;
}
else {
this.selectionObj.edges[obj.id] = obj;
}
},
/**
* Remove a single option from selection.
*
* @param {Object} obj
* @private
*/
_removeFromSelection : function(obj) {
if (obj instanceof Node) {
delete this.selectionObj.nodes[obj.id];
}
else {
delete this.selectionObj.edges[obj.id];
}
},
/**
* Unselect all. The selectionObj is useful for this.
*
* @param {Boolean} [doNotTrigger] | ignore trigger
* @private
*/
_unselectAll : function(doNotTrigger) {
if (doNotTrigger === undefined) {
doNotTrigger = false;
}
for(var nodeId in this.selectionObj.nodes) {
if(this.selectionObj.nodes.hasOwnProperty(nodeId)) {
this.selectionObj.nodes[nodeId].unselect();
}
}
for(var edgeId in this.selectionObj.edges) {
if(this.selectionObj.edges.hasOwnProperty(edgeId)) {
this.selectionObj.edges[edgeId].unselect();;
}
}
this.selectionObj = {nodes:{},edges:{}};
if (doNotTrigger == false) {
this.emit('select', this.getSelection());
}
},
/**
* Unselect all clusters. The selectionObj is useful for this.
*
* @param {Boolean} [doNotTrigger] | ignore trigger
* @private
*/
_unselectClusters : function(doNotTrigger) {
if (doNotTrigger === undefined) {
doNotTrigger = false;
}
for (var nodeId in this.selectionObj.nodes) {
if (this.selectionObj.nodes.hasOwnProperty(nodeId)) {
if (this.selectionObj.nodes[nodeId].clusterSize > 1) {
this.selectionObj.nodes[nodeId].unselect();
this._removeFromSelection(this.selectionObj.nodes[nodeId]);
}
}
}
if (doNotTrigger == false) {
this.emit('select', this.getSelection());
}
},
/**
* return the number of selected nodes
*
* @returns {number}
* @private
*/
_getSelectedNodeCount : function() {
var count = 0;
for (var nodeId in this.selectionObj.nodes) {
if (this.selectionObj.nodes.hasOwnProperty(nodeId)) {
count += 1;
}
}
return count;
},
/**
* return the number of selected nodes
*
* @returns {number}
* @private
*/
_getSelectedNode : function() {
for (var nodeId in this.selectionObj.nodes) {
if (this.selectionObj.nodes.hasOwnProperty(nodeId)) {
return this.selectionObj.nodes[nodeId];
}
}
return null;
},
/**
* return the number of selected edges
*
* @returns {number}
* @private
*/
_getSelectedEdgeCount : function() {
var count = 0;
for (var edgeId in this.selectionObj.edges) {
if (this.selectionObj.edges.hasOwnProperty(edgeId)) {
count += 1;
}
}
return count;
},
/**
* return the number of selected objects.
*
* @returns {number}
* @private
*/
_getSelectedObjectCount : function() {
var count = 0;
for(var nodeId in this.selectionObj.nodes) {
if(this.selectionObj.nodes.hasOwnProperty(nodeId)) {
count += 1;
}
}
for(var edgeId in this.selectionObj.edges) {
if(this.selectionObj.edges.hasOwnProperty(edgeId)) {
count += 1;
}
}
return count;
},
/**
* Check if anything is selected
*
* @returns {boolean}
* @private
*/
_selectionIsEmpty : function() {
for(var nodeId in this.selectionObj.nodes) {
if(this.selectionObj.nodes.hasOwnProperty(nodeId)) {
return false;
}
}
for(var edgeId in this.selectionObj.edges) {
if(this.selectionObj.edges.hasOwnProperty(edgeId)) {
return false;
}
}
return true;
},
/**
* check if one of the selected nodes is a cluster.
*
* @returns {boolean}
* @private
*/
_clusterInSelection : function() {
for(var nodeId in this.selectionObj.nodes) {
if(this.selectionObj.nodes.hasOwnProperty(nodeId)) {
if (this.selectionObj.nodes[nodeId].clusterSize > 1) {
return true;
}
}
}
return false;
},
/**
* select the edges connected to the node that is being selected
*
* @param {Node} node
* @private
*/
_selectConnectedEdges : function(node) {
for (var i = 0; i < node.dynamicEdges.length; i++) {
var edge = node.dynamicEdges[i];
edge.select();
this._addToSelection(edge);
}
},
/**
* unselect the edges connected to the node that is being selected
*
* @param {Node} node
* @private
*/
_unselectConnectedEdges : function(node) {
for (var i = 0; i < node.dynamicEdges.length; i++) {
var edge = node.dynamicEdges[i];
edge.unselect();
this._removeFromSelection(edge);
}
},
/**
* This is called when someone clicks on a node. either select or deselect it.
* If there is an existing selection and we don't want to append to it, clear the existing selection
*
* @param {Node || Edge} object
* @param {Boolean} append
* @param {Boolean} [doNotTrigger] | ignore trigger
* @private
*/
_selectObject : function(object, append, doNotTrigger) {
if (doNotTrigger === undefined) {
doNotTrigger = false;
}
if (this._selectionIsEmpty() == false && append == false && this.forceAppendSelection == false) {
this._unselectAll(true);
}
if (object.selected == false) {
object.select();
this._addToSelection(object);
if (object instanceof Node && this.blockConnectingEdgeSelection == false) {
this._selectConnectedEdges(object);
}
}
else {
object.unselect();
this._removeFromSelection(object);
}
if (doNotTrigger == false) {
this.emit('select', this.getSelection());
}
},
/**
* handles the selection part of the touch, only for navigation controls elements;
* Touch is triggered before tap, also before hold. Hold triggers after a while.
* This is the most responsive solution
*
* @param {Object} pointer
* @private
*/
_handleTouch : function(pointer) {
},
/**
* handles the selection part of the tap;
*
* @param {Object} pointer
* @private
*/
_handleTap : function(pointer) {
var node = this._getNodeAt(pointer);
if (node != null) {
this._selectObject(node,false);
}
else {
var edge = this._getEdgeAt(pointer);
if (edge != null) {
this._selectObject(edge,false);
}
else {
this._unselectAll();
}
}
this.emit("click", this.getSelection());
this._redraw();
},
/**
* handles the selection part of the double tap and opens a cluster if needed
*
* @param {Object} pointer
* @private
*/
_handleDoubleTap : function(pointer) {
var node = this._getNodeAt(pointer);
if (node != null && node !== undefined) {
// we reset the areaCenter here so the opening of the node will occur
this.areaCenter = {"x" : this._canvasToX(pointer.x),
"y" : this._canvasToY(pointer.y)};
this.openCluster(node);
}
this.emit("doubleClick", this.getSelection());
},
/**
* Handle the onHold selection part
*
* @param pointer
* @private
*/
_handleOnHold : function(pointer) {
var node = this._getNodeAt(pointer);
if (node != null) {
this._selectObject(node,true);
}
else {
var edge = this._getEdgeAt(pointer);
if (edge != null) {
this._selectObject(edge,true);
}
}
this._redraw();
},
/**
* handle the onRelease event. These functions are here for the navigation controls module.
*
* @private
*/
_handleOnRelease : function(pointer) {
},
/**
*
* retrieve the currently selected objects
* @return {Number[] | String[]} selection An array with the ids of the
* selected nodes.
*/
getSelection : function() {
var nodeIds = this.getSelectedNodes();
var edgeIds = this.getSelectedEdges();
return {nodes:nodeIds, edges:edgeIds};
},
/**
*
* retrieve the currently selected nodes
* @return {String} selection An array with the ids of the
* selected nodes.
*/
getSelectedNodes : function() {
var idArray = [];
for(var nodeId in this.selectionObj.nodes) {
if(this.selectionObj.nodes.hasOwnProperty(nodeId)) {
idArray.push(nodeId);
}
}
return idArray
},
/**
*
* retrieve the currently selected edges
* @return {Array} selection An array with the ids of the
* selected nodes.
*/
getSelectedEdges : function() {
var idArray = [];
for(var edgeId in this.selectionObj.edges) {
if(this.selectionObj.edges.hasOwnProperty(edgeId)) {
idArray.push(edgeId);
}
}
return idArray;
},
/**
* select zero or more nodes
* @param {Number[] | String[]} selection An array with the ids of the
* selected nodes.
*/
setSelection : function(selection) {
var i, iMax, id;
if (!selection || (selection.length == undefined))
throw 'Selection must be an array with ids';
// first unselect any selected node
this._unselectAll(true);
for (i = 0, iMax = selection.length; i < iMax; i++) {
id = selection[i];
var node = this.nodes[id];
if (!node) {
throw new RangeError('Node with id "' + id + '" not found');
}
this._selectObject(node,true,true);
}
this.redraw();
},
/**
* Validate the selection: remove ids of nodes which no longer exist
* @private
*/
_updateSelection : function () {
for(var nodeId in this.selectionObj.nodes) {
if(this.selectionObj.nodes.hasOwnProperty(nodeId)) {
if (!this.nodes.hasOwnProperty(nodeId)) {
delete this.selectionObj.nodes[nodeId];
}
}
}
for(var edgeId in this.selectionObj.edges) {
if(this.selectionObj.edges.hasOwnProperty(edgeId)) {
if (!this.edges.hasOwnProperty(edgeId)) {
delete this.selectionObj.edges[edgeId];
}
}
}
}
};
/**
* Created by Alex on 1/22/14.
*/
var NavigationMixin = {
_cleanNavigation : function() {
// clean up previosu navigation items
var wrapper = document.getElementById('graph-navigation_wrapper');
if (wrapper != null) {
this.containerElement.removeChild(wrapper);
}
document.onmouseup = null;
},
/**
* Creation of the navigation controls nodes. They are drawn over the rest of the nodes and are not affected by scale and translation
* they have a triggerFunction which is called on click. If the position of the navigation controls is dependent
* on this.frame.canvas.clientWidth or this.frame.canvas.clientHeight, we flag horizontalAlignLeft and verticalAlignTop false.
* This means that the location will be corrected by the _relocateNavigation function on a size change of the canvas.
*
* @private
*/
_loadNavigationElements : function() {
this._cleanNavigation();
this.navigationDivs = {};
var navigationDivs = ['up','down','left','right','zoomIn','zoomOut','zoomExtends'];
var navigationDivActions = ['_moveUp','_moveDown','_moveLeft','_moveRight','_zoomIn','_zoomOut','zoomExtent'];
this.navigationDivs['wrapper'] = document.createElement('div');
this.navigationDivs['wrapper'].id = "graph-navigation_wrapper";
this.navigationDivs['wrapper'].style.position = "absolute";
this.navigationDivs['wrapper'].style.width = this.frame.canvas.clientWidth + "px";
this.navigationDivs['wrapper'].style.height = this.frame.canvas.clientHeight + "px";
this.containerElement.insertBefore(this.navigationDivs['wrapper'],this.frame);
for (var i = 0; i < navigationDivs.length; i++) {
this.navigationDivs[navigationDivs[i]] = document.createElement('div');
this.navigationDivs[navigationDivs[i]].id = "graph-navigation_" + navigationDivs[i];
this.navigationDivs[navigationDivs[i]].className = "graph-navigation " + navigationDivs[i];
this.navigationDivs['wrapper'].appendChild(this.navigationDivs[navigationDivs[i]]);
this.navigationDivs[navigationDivs[i]].onmousedown = this[navigationDivActions[i]].bind(this);
}
document.onmouseup = this._stopMovement.bind(this);
},
/**
* this stops all movement induced by the navigation buttons
*
* @private
*/
_stopMovement : function() {
this._xStopMoving();
this._yStopMoving();
this._stopZoom();
},
/**
* stops the actions performed by page up and down etc.
*
* @param event
* @private
*/
_preventDefault : function(event) {
if (event !== undefined) {
if (event.preventDefault) {
event.preventDefault();
} else {
event.returnValue = false;
}
}
},
/**
* move the screen up
* By using the increments, instead of adding a fixed number to the translation, we keep fluent and
* instant movement. The onKeypress event triggers immediately, then pauses, then triggers frequently
* To avoid this behaviour, we do the translation in the start loop.
*
* @private
*/
_moveUp : function(event) {
this.yIncrement = this.constants.keyboard.speed.y;
this.start(); // if there is no node movement, the calculation wont be done
this._preventDefault(event);
if (this.navigationDivs) {
this.navigationDivs['up'].className += " active";
}
},
/**
* move the screen down
* @private
*/
_moveDown : function(event) {
this.yIncrement = -this.constants.keyboard.speed.y;
this.start(); // if there is no node movement, the calculation wont be done
this._preventDefault(event);
if (this.navigationDivs) {
this.navigationDivs['down'].className += " active";
}
},
/**
* move the screen left
* @private
*/
_moveLeft : function(event) {
this.xIncrement = this.constants.keyboard.speed.x;
this.start(); // if there is no node movement, the calculation wont be done
this._preventDefault(event);
if (this.navigationDivs) {
this.navigationDivs['left'].className += " active";
}
},
/**
* move the screen right
* @private
*/
_moveRight : function(event) {
this.xIncrement = -this.constants.keyboard.speed.y;
this.start(); // if there is no node movement, the calculation wont be done
this._preventDefault(event);
if (this.navigationDivs) {
this.navigationDivs['right'].className += " active";
}
},
/**
* Zoom in, using the same method as the movement.
* @private
*/
_zoomIn : function(event) {
this.zoomIncrement = this.constants.keyboard.speed.zoom;
this.start(); // if there is no node movement, the calculation wont be done
this._preventDefault(event);
if (this.navigationDivs) {
this.navigationDivs['zoomIn'].className += " active";
}
},
/**
* Zoom out
* @private
*/
_zoomOut : function() {
this.zoomIncrement = -this.constants.keyboard.speed.zoom;
this.start(); // if there is no node movement, the calculation wont be done
this._preventDefault(event);
if (this.navigationDivs) {
this.navigationDivs['zoomOut'].className += " active";
}
},
/**
* Stop zooming and unhighlight the zoom controls
* @private
*/
_stopZoom : function() {
this.zoomIncrement = 0;
if (this.navigationDivs) {
this.navigationDivs['zoomIn'].className = this.navigationDivs['zoomIn'].className.replace(" active","");
this.navigationDivs['zoomOut'].className = this.navigationDivs['zoomOut'].className.replace(" active","");
}
},
/**
* Stop moving in the Y direction and unHighlight the up and down
* @private
*/
_yStopMoving : function() {
this.yIncrement = 0;
if (this.navigationDivs) {
this.navigationDivs['up'].className = this.navigationDivs['up'].className.replace(" active","");
this.navigationDivs['down'].className = this.navigationDivs['down'].className.replace(" active","");
}
},
/**
* Stop moving in the X direction and unHighlight left and right.
* @private
*/
_xStopMoving : function() {
this.xIncrement = 0;
if (this.navigationDivs) {
this.navigationDivs['left'].className = this.navigationDivs['left'].className.replace(" active","");
this.navigationDivs['right'].className = this.navigationDivs['right'].className.replace(" active","");
}
}
};
/**
* Created by Alex on 2/10/14.
*/
var graphMixinLoaders = {
/**
* Load a mixin into the graph object
*
* @param {Object} sourceVariable | this object has to contain functions.
* @private
*/
_loadMixin: function (sourceVariable) {
for (var mixinFunction in sourceVariable) {
if (sourceVariable.hasOwnProperty(mixinFunction)) {
Graph.prototype[mixinFunction] = sourceVariable[mixinFunction];
}
}
},
/**
* removes a mixin from the graph object.
*
* @param {Object} sourceVariable | this object has to contain functions.
* @private
*/
_clearMixin: function (sourceVariable) {
for (var mixinFunction in sourceVariable) {
if (sourceVariable.hasOwnProperty(mixinFunction)) {
Graph.prototype[mixinFunction] = undefined;
}
}
},
/**
* Mixin the physics system and initialize the parameters required.
*
* @private
*/
_loadPhysicsSystem: function () {
this._loadMixin(physicsMixin);
this._loadSelectedForceSolver();
if (this.constants.configurePhysics == true) {
this._loadPhysicsConfiguration();
}
},
/**
* Mixin the cluster system and initialize the parameters required.
*
* @private
*/
_loadClusterSystem: function () {
this.clusterSession = 0;
this.hubThreshold = 5;
this._loadMixin(ClusterMixin);
},
/**
* Mixin the sector system and initialize the parameters required
*
* @private
*/
_loadSectorSystem: function () {
this.sectors = { },
this.activeSector = ["default"];
this.sectors["active"] = { },
this.sectors["active"]["default"] = {"nodes": {},
"edges": {},
"nodeIndices": [],
"formationScale": 1.0,
"drawingNode": undefined };
this.sectors["frozen"] = {},
this.sectors["support"] = {"nodes": {},
"edges": {},
"nodeIndices": [],
"formationScale": 1.0,
"drawingNode": undefined };
this.nodeIndices = this.sectors["active"]["default"]["nodeIndices"]; // the node indices list is used to speed up the computation of the repulsion fields
this._loadMixin(SectorMixin);
},
/**
* Mixin the selection system and initialize the parameters required
*
* @private
*/
_loadSelectionSystem: function () {
this.selectionObj = {nodes: {}, edges: {}};
this._loadMixin(SelectionMixin);
},
/**
* Mixin the navigationUI (User Interface) system and initialize the parameters required
*
* @private
*/
_loadManipulationSystem: function () {
// reset global variables -- these are used by the selection of nodes and edges.
this.blockConnectingEdgeSelection = false;
this.forceAppendSelection = false
if (this.constants.dataManipulation.enabled == true) {
// load the manipulator HTML elements. All styling done in css.
if (this.manipulationDiv === undefined) {
this.manipulationDiv = document.createElement('div');
this.manipulationDiv.className = 'graph-manipulationDiv';
this.manipulationDiv.id = 'graph-manipulationDiv';
if (this.editMode == true) {
this.manipulationDiv.style.display = "block";
}
else {
this.manipulationDiv.style.display = "none";
}
this.containerElement.insertBefore(this.manipulationDiv, this.frame);
}
if (this.editModeDiv === undefined) {
this.editModeDiv = document.createElement('div');
this.editModeDiv.className = 'graph-manipulation-editMode';
this.editModeDiv.id = 'graph-manipulation-editMode';
if (this.editMode == true) {
this.editModeDiv.style.display = "none";
}
else {
this.editModeDiv.style.display = "block";
}
this.containerElement.insertBefore(this.editModeDiv, this.frame);
}
if (this.closeDiv === undefined) {
this.closeDiv = document.createElement('div');
this.closeDiv.className = 'graph-manipulation-closeDiv';
this.closeDiv.id = 'graph-manipulation-closeDiv';
this.closeDiv.style.display = this.manipulationDiv.style.display;
this.containerElement.insertBefore(this.closeDiv, this.frame);
}
// load the manipulation functions
this._loadMixin(manipulationMixin);
// create the manipulator toolbar
this._createManipulatorBar();
}
else {
if (this.manipulationDiv !== undefined) {
// removes all the bindings and overloads
this._createManipulatorBar();
// remove the manipulation divs
this.containerElement.removeChild(this.manipulationDiv);
this.containerElement.removeChild(this.editModeDiv);
this.containerElement.removeChild(this.closeDiv);
this.manipulationDiv = undefined;
this.editModeDiv = undefined;
this.closeDiv = undefined;
// remove the mixin functions
this._clearMixin(manipulationMixin);
}
}
},
/**
* Mixin the navigation (User Interface) system and initialize the parameters required
*
* @private
*/
_loadNavigationControls: function () {
this._loadMixin(NavigationMixin);
// the clean function removes the button divs, this is done to remove the bindings.
this._cleanNavigation();
if (this.constants.navigation.enabled == true) {
this._loadNavigationElements();
}
},
/**
* Mixin the hierarchical layout system.
*
* @private
*/
_loadHierarchySystem: function () {
this._loadMixin(HierarchicalLayoutMixin);
}
};
/**
* @constructor Graph
* Create a graph visualization, displaying nodes and edges.
*
* @param {Element} container The DOM element in which the Graph will
* be created. Normally a div element.
* @param {Object} data An object containing parameters
* {Array} nodes
* {Array} edges
* @param {Object} options Options
*/
function Graph (container, data, options) {
this._initializeMixinLoaders();
// create variables and set default values
this.containerElement = container;
this.width = '100%';
this.height = '100%';
// render and calculation settings
this.renderRefreshRate = 60; // hz (fps)
this.renderTimestep = 1000 / this.renderRefreshRate; // ms -- saves calculation later on
this.renderTime = 0.5 * this.renderTimestep; // measured time it takes to render a frame
this.maxPhysicsTicksPerRender = 3; // max amount of physics ticks per render step.
this.physicsDiscreteStepsize = 0.65; // discrete stepsize of the simulation
this.stabilize = true; // stabilize before displaying the graph
this.selectable = true;
this.initializing = true;
// these functions are triggered when the dataset is edited
this.triggerFunctions = {add:null,edit:null,connect:null,del:null};
// set constant values
this.constants = {
nodes: {
radiusMin: 5,
radiusMax: 20,
radius: 5,
shape: 'ellipse',
image: undefined,
widthMin: 16, // px
widthMax: 64, // px
fixed: false,
fontColor: 'black',
fontSize: 14, // px
fontFace: 'verdana',
level: -1,
color: {
border: '#2B7CE9',
background: '#97C2FC',
highlight: {
border: '#2B7CE9',
background: '#D2E5FF'
}
},
borderColor: '#2B7CE9',
backgroundColor: '#97C2FC',
highlightColor: '#D2E5FF',
group: undefined
},
edges: {
widthMin: 1,
widthMax: 15,
width: 1,
style: 'line',
color: {
color:'#848484',
highlight:'#848484'
},
fontColor: '#343434',
fontSize: 14, // px
fontFace: 'arial',
fontFill: 'white',
dash: {
length: 10,
gap: 5,
altLength: undefined
}
},
configurePhysics:false,
physics: {
barnesHut: {
enabled: true,
theta: 1 / 0.6, // inverted to save time during calculation
gravitationalConstant: -2000,
centralGravity: 0.3,
springLength: 95,
springConstant: 0.04,
damping: 0.09
},
repulsion: {
centralGravity: 0.1,
springLength: 200,
springConstant: 0.05,
nodeDistance: 100,
damping: 0.09
},
hierarchicalRepulsion: {
enabled: false,
centralGravity: 0.0,
springLength: 100,
springConstant: 0.01,
nodeDistance: 60,
damping: 0.09
},
damping: null,
centralGravity: null,
springLength: null,
springConstant: null
},
clustering: { // Per Node in Cluster = PNiC
enabled: false, // (Boolean) | global on/off switch for clustering.
initialMaxNodes: 100, // (# nodes) | if the initial amount of nodes is larger than this, we cluster until the total number is less than this threshold.
clusterThreshold:500, // (# nodes) | during calculate forces, we check if the total number of nodes is larger than this. If it is, cluster until reduced to reduceToNodes
reduceToNodes:300, // (# nodes) | during calculate forces, we check if the total number of nodes is larger than clusterThreshold. If it is, cluster until reduced to this
chainThreshold: 0.4, // (% of all drawn nodes)| maximum percentage of allowed chainnodes (long strings of connected nodes) within all nodes. (lower means less chains).
clusterEdgeThreshold: 20, // (px) | edge length threshold. if smaller, this node is clustered.
sectorThreshold: 100, // (# nodes in cluster) | cluster size threshold. If larger, expanding in own sector.
screenSizeThreshold: 0.2, // (% of canvas) | relative size threshold. If the width or height of a clusternode takes up this much of the screen, decluster node.
fontSizeMultiplier: 4.0, // (px PNiC) | how much the cluster font size grows per node in cluster (in px).
maxFontSize: 1000,
forceAmplification: 0.1, // (multiplier PNiC) | factor of increase fo the repulsion force of a cluster (per node in cluster).
distanceAmplification: 0.1, // (multiplier PNiC) | factor how much the repulsion distance of a cluster increases (per node in cluster).
edgeGrowth: 20, // (px PNiC) | amount of clusterSize connected to the edge is multiplied with this and added to edgeLength.
nodeScaling: {width: 1, // (px PNiC) | growth of the width per node in cluster.
height: 1, // (px PNiC) | growth of the height per node in cluster.
radius: 1}, // (px PNiC) | growth of the radius per node in cluster.
maxNodeSizeIncrements: 600, // (# increments) | max growth of the width per node in cluster.
activeAreaBoxSize: 80, // (px) | box area around the curser where clusters are popped open.
clusterLevelDifference: 2
},
navigation: {
enabled: false
},
keyboard: {
enabled: false,
speed: {x: 10, y: 10, zoom: 0.02}
},
dataManipulation: {
enabled: false,
initiallyVisible: false
},
hierarchicalLayout: {
enabled:false,
levelSeparation: 150,
nodeSpacing: 100,
direction: "UD" // UD, DU, LR, RL
},
freezeForStabilization: false,
smoothCurves: true,
maxVelocity: 10,
minVelocity: 0.1, // px/s
stabilizationIterations: 1000, // maximum number of iteration to stabilize
labels:{
add:"Add Node",
edit:"Edit",
link:"Add Link",
del:"Delete selected",
editNode:"Edit Node",
back:"Back",
addDescription:"Click in an empty space to place a new node.",
linkDescription:"Click on a node and drag the edge to another node to connect them.",
addError:"The function for add does not support two arguments (data,callback).",
linkError:"The function for connect does not support two arguments (data,callback).",
editError:"The function for edit does not support two arguments (data, callback).",
editBoundError:"No edit function has been bound to this button.",
deleteError:"The function for delete does not support two arguments (data, callback).",
deleteClusterError:"Clusters cannot be deleted."
},
tooltip: {
delay: 300,
fontColor: 'black',
fontSize: 14, // px
fontFace: 'verdana',
color: {
border: '#666',
background: '#FFFFC6'
}
}
};
this.editMode = this.constants.dataManipulation.initiallyVisible;
// Node variables
var graph = this;
this.groups = new Groups(); // object with groups
this.images = new Images(); // object with images
this.images.setOnloadCallback(function () {
graph._redraw();
});
// keyboard navigation variables
this.xIncrement = 0;
this.yIncrement = 0;
this.zoomIncrement = 0;
// loading all the mixins:
// load the force calculation functions, grouped under the physics system.
this._loadPhysicsSystem();
// create a frame and canvas
this._create();
// load the sector system. (mandatory, fully integrated with Graph)
this._loadSectorSystem();
// load the cluster system. (mandatory, even when not using the cluster system, there are function calls to it)
this._loadClusterSystem();
// load the selection system. (mandatory, required by Graph)
this._loadSelectionSystem();
// load the selection system. (mandatory, required by Graph)
this._loadHierarchySystem();
// apply options
this.setOptions(options);
// other vars
this.freezeSimulation = false;// freeze the simulation
this.cachedFunctions = {};
// containers for nodes and edges
this.calculationNodes = {};
this.calculationNodeIndices = [];
this.nodeIndices = []; // array with all the indices of the nodes. Used to speed up forces calculation
this.nodes = {}; // object with Node objects
this.edges = {}; // object with Edge objects
// position and scale variables and objects
this.canvasTopLeft = {"x": 0,"y": 0}; // coordinates of the top left of the canvas. they will be set during _redraw.
this.canvasBottomRight = {"x": 0,"y": 0}; // coordinates of the bottom right of the canvas. they will be set during _redraw
this.pointerPosition = {"x": 0,"y": 0}; // coordinates of the bottom right of the canvas. they will be set during _redraw
this.areaCenter = {}; // object with x and y elements used for determining the center of the zoom action
this.scale = 1; // defining the global scale variable in the constructor
this.previousScale = this.scale; // this is used to check if the zoom operation is zooming in or out
// datasets or dataviews
this.nodesData = null; // A DataSet or DataView
this.edgesData = null; // A DataSet or DataView
// create event listeners used to subscribe on the DataSets of the nodes and edges
this.nodesListeners = {
'add': function (event, params) {
graph._addNodes(params.items);
graph.start();
},
'update': function (event, params) {
graph._updateNodes(params.items);
graph.start();
},
'remove': function (event, params) {
graph._removeNodes(params.items);
graph.start();
}
};
this.edgesListeners = {
'add': function (event, params) {
graph._addEdges(params.items);
graph.start();
},
'update': function (event, params) {
graph._updateEdges(params.items);
graph.start();
},
'remove': function (event, params) {
graph._removeEdges(params.items);
graph.start();
}
};
// properties for the animation
this.moving = true;
this.timer = undefined; // Scheduling function. Is definded in this.start();
// load data (the disable start variable will be the same as the enabled clustering)
this.setData(data,this.constants.clustering.enabled || this.constants.hierarchicalLayout.enabled);
// hierarchical layout
this.initializing = false;
if (this.constants.hierarchicalLayout.enabled == true) {
this._setupHierarchicalLayout();
}
else {
// zoom so all data will fit on the screen, if clustering is enabled, we do not want start to be called here.
if (this.stabilize == false) {
this.zoomExtent(true,this.constants.clustering.enabled);
}
}
// if clustering is disabled, the simulation will have started in the setData function
if (this.constants.clustering.enabled) {
this.startWithClustering();
}
}
// Extend Graph with an Emitter mixin
Emitter(Graph.prototype);
/**
* Get the script path where the vis.js library is located
*
* @returns {string | null} path Path or null when not found. Path does not
* end with a slash.
* @private
*/
Graph.prototype._getScriptPath = function() {
var scripts = document.getElementsByTagName( 'script' );
// find script named vis.js or vis.min.js
for (var i = 0; i < scripts.length; i++) {
var src = scripts[i].src;
var match = src && /\/?vis(.min)?\.js$/.exec(src);
if (match) {
// return path without the script name
return src.substring(0, src.length - match[0].length);
}
}
return null;
};
/**
* Find the center position of the graph
* @private
*/
Graph.prototype._getRange = function() {
var minY = 1e9, maxY = -1e9, minX = 1e9, maxX = -1e9, node;
for (var nodeId in this.nodes) {
if (this.nodes.hasOwnProperty(nodeId)) {
node = this.nodes[nodeId];
if (minX > (node.x)) {minX = node.x;}
if (maxX < (node.x)) {maxX = node.x;}
if (minY > (node.y)) {minY = node.y;}
if (maxY < (node.y)) {maxY = node.y;}
}
}
if (minX == 1e9 && maxX == -1e9 && minY == 1e9 && maxY == -1e9) {
minY = 0, maxY = 0, minX = 0, maxX = 0;
}
return {minX: minX, maxX: maxX, minY: minY, maxY: maxY};
};
/**
* @param {object} range = {minX: minX, maxX: maxX, minY: minY, maxY: maxY};
* @returns {{x: number, y: number}}
* @private
*/
Graph.prototype._findCenter = function(range) {
return {x: (0.5 * (range.maxX + range.minX)),
y: (0.5 * (range.maxY + range.minY))};
};
/**
* center the graph
*
* @param {object} range = {minX: minX, maxX: maxX, minY: minY, maxY: maxY};
*/
Graph.prototype._centerGraph = function(range) {
var center = this._findCenter(range);
center.x *= this.scale;
center.y *= this.scale;
center.x -= 0.5 * this.frame.canvas.clientWidth;
center.y -= 0.5 * this.frame.canvas.clientHeight;
this._setTranslation(-center.x,-center.y); // set at 0,0
};
/**
* This function zooms out to fit all data on screen based on amount of nodes
*
* @param {Boolean} [initialZoom] | zoom based on fitted formula or range, true = fitted, default = false;
*/
Graph.prototype.zoomExtent = function(initialZoom, disableStart) {
if (initialZoom === undefined) {
initialZoom = false;
}
if (disableStart === undefined) {
disableStart = false;
}
var range = this._getRange();
var zoomLevel;
if (initialZoom == true) {
var numberOfNodes = this.nodeIndices.length;
if (this.constants.smoothCurves == true) {
if (this.constants.clustering.enabled == true &&
numberOfNodes >= this.constants.clustering.initialMaxNodes) {
zoomLevel = 49.07548 / (numberOfNodes + 142.05338) + 9.1444e-04; // this is obtained from fitting a dataset from 5 points with scale levels that looked good.
}
else {
zoomLevel = 12.662 / (numberOfNodes + 7.4147) + 0.0964822; // this is obtained from fitting a dataset from 5 points with scale levels that looked good.
}
}
else {
if (this.constants.clustering.enabled == true &&
numberOfNodes >= this.constants.clustering.initialMaxNodes) {
zoomLevel = 77.5271985 / (numberOfNodes + 187.266146) + 4.76710517e-05; // this is obtained from fitting a dataset from 5 points with scale levels that looked good.
}
else {
zoomLevel = 30.5062972 / (numberOfNodes + 19.93597763) + 0.08413486; // this is obtained from fitting a dataset from 5 points with scale levels that looked good.
}
}
// correct for larger canvasses.
var factor = Math.min(this.frame.canvas.clientWidth / 600, this.frame.canvas.clientHeight / 600);
zoomLevel *= factor;
}
else {
var xDistance = (Math.abs(range.minX) + Math.abs(range.maxX)) * 1.1;
var yDistance = (Math.abs(range.minY) + Math.abs(range.maxY)) * 1.1;
var xZoomLevel = this.frame.canvas.clientWidth / xDistance;
var yZoomLevel = this.frame.canvas.clientHeight / yDistance;
zoomLevel = (xZoomLevel <= yZoomLevel) ? xZoomLevel : yZoomLevel;
}
if (zoomLevel > 1.0) {
zoomLevel = 1.0;
}
this._setScale(zoomLevel);
this._centerGraph(range);
if (disableStart == false) {
this.moving = true;
this.start();
}
};
/**
* Update the this.nodeIndices with the most recent node index list
* @private
*/
Graph.prototype._updateNodeIndexList = function() {
this._clearNodeIndexList();
for (var idx in this.nodes) {
if (this.nodes.hasOwnProperty(idx)) {
this.nodeIndices.push(idx);
}
}
};
/**
* Set nodes and edges, and optionally options as well.
*
* @param {Object} data Object containing parameters:
* {Array | DataSet | DataView} [nodes] Array with nodes
* {Array | DataSet | DataView} [edges] Array with edges
* {String} [dot] String containing data in DOT format
* {Options} [options] Object with options
* @param {Boolean} [disableStart] | optional: disable the calling of the start function.
*/
Graph.prototype.setData = function(data, disableStart) {
if (disableStart === undefined) {
disableStart = false;
}
if (data && data.dot && (data.nodes || data.edges)) {
throw new SyntaxError('Data must contain either parameter "dot" or ' +
' parameter pair "nodes" and "edges", but not both.');
}
// set options
this.setOptions(data && data.options);
// set all data
if (data && data.dot) {
// parse DOT file
if(data && data.dot) {
var dotData = vis.util.DOTToGraph(data.dot);
this.setData(dotData);
return;
}
}
else {
this._setNodes(data && data.nodes);
this._setEdges(data && data.edges);
}
this._putDataInSector();
if (!disableStart) {
// find a stable position or start animating to a stable position
if (this.stabilize) {
this._stabilize();
}
this.start();
}
};
/**
* Set options
* @param {Object} options
*/
Graph.prototype.setOptions = function (options) {
if (options) {
var prop;
// retrieve parameter values
if (options.width !== undefined) {this.width = options.width;}
if (options.height !== undefined) {this.height = options.height;}
if (options.stabilize !== undefined) {this.stabilize = options.stabilize;}
if (options.selectable !== undefined) {this.selectable = options.selectable;}
if (options.smoothCurves !== undefined) {this.constants.smoothCurves = options.smoothCurves;}
if (options.freezeForStabilization !== undefined) {this.constants.freezeForStabilization = options.freezeForStabilization;}
if (options.configurePhysics !== undefined){this.constants.configurePhysics = options.configurePhysics;}
if (options.stabilizationIterations !== undefined) {this.constants.stabilizationIterations = options.stabilizationIterations;}
if (options.labels !== undefined) {
for (prop in options.labels) {
if (options.labels.hasOwnProperty(prop)) {
this.constants.labels[prop] = options.labels[prop];
}
}
}
if (options.onAdd) {
this.triggerFunctions.add = options.onAdd;
}
if (options.onEdit) {
this.triggerFunctions.edit = options.onEdit;
}
if (options.onConnect) {
this.triggerFunctions.connect = options.onConnect;
}
if (options.onDelete) {
this.triggerFunctions.del = options.onDelete;
}
if (options.physics) {
if (options.physics.barnesHut) {
this.constants.physics.barnesHut.enabled = true;
for (prop in options.physics.barnesHut) {
if (options.physics.barnesHut.hasOwnProperty(prop)) {
this.constants.physics.barnesHut[prop] = options.physics.barnesHut[prop];
}
}
}
if (options.physics.repulsion) {
this.constants.physics.barnesHut.enabled = false;
for (prop in options.physics.repulsion) {
if (options.physics.repulsion.hasOwnProperty(prop)) {
this.constants.physics.repulsion[prop] = options.physics.repulsion[prop];
}
}
}
}
if (options.hierarchicalLayout) {
this.constants.hierarchicalLayout.enabled = true;
for (prop in options.hierarchicalLayout) {
if (options.hierarchicalLayout.hasOwnProperty(prop)) {
this.constants.hierarchicalLayout[prop] = options.hierarchicalLayout[prop];
}
}
}
else if (options.hierarchicalLayout !== undefined) {
this.constants.hierarchicalLayout.enabled = false;
}
if (options.clustering) {
this.constants.clustering.enabled = true;
for (prop in options.clustering) {
if (options.clustering.hasOwnProperty(prop)) {
this.constants.clustering[prop] = options.clustering[prop];
}
}
}
else if (options.clustering !== undefined) {
this.constants.clustering.enabled = false;
}
if (options.navigation) {
this.constants.navigation.enabled = true;
for (prop in options.navigation) {
if (options.navigation.hasOwnProperty(prop)) {
this.constants.navigation[prop] = options.navigation[prop];
}
}
}
else if (options.navigation !== undefined) {
this.constants.navigation.enabled = false;
}
if (options.keyboard) {
this.constants.keyboard.enabled = true;
for (prop in options.keyboard) {
if (options.keyboard.hasOwnProperty(prop)) {
this.constants.keyboard[prop] = options.keyboard[prop];
}
}
}
else if (options.keyboard !== undefined) {
this.constants.keyboard.enabled = false;
}
if (options.dataManipulation) {
this.constants.dataManipulation.enabled = true;
for (prop in options.dataManipulation) {
if (options.dataManipulation.hasOwnProperty(prop)) {
this.constants.dataManipulation[prop] = options.dataManipulation[prop];
}
}
}
else if (options.dataManipulation !== undefined) {
this.constants.dataManipulation.enabled = false;
}
// TODO: work out these options and document them
if (options.edges) {
for (prop in options.edges) {
if (options.edges.hasOwnProperty(prop)) {
if (typeof options.edges[prop] != "object") {
this.constants.edges[prop] = options.edges[prop];
}
}
}
if (options.edges.color !== undefined) {
if (util.isString(options.edges.color)) {
this.constants.edges.color = {};
this.constants.edges.color.color = options.edges.color;
this.constants.edges.color.highlight = options.edges.color;
}
else {
if (options.edges.color.color !== undefined) {this.constants.edges.color.color = options.edges.color.color;}
if (options.edges.color.highlight !== undefined) {this.constants.edges.color.highlight = options.edges.color.highlight;}
}
}
if (!options.edges.fontColor) {
if (options.edges.color !== undefined) {
if (util.isString(options.edges.color)) {this.constants.edges.fontColor = options.edges.color;}
else if (options.edges.color.color !== undefined) {this.constants.edges.fontColor = options.edges.color.color;}
}
}
// Added to support dashed lines
// David Jordan
// 2012-08-08
if (options.edges.dash) {
if (options.edges.dash.length !== undefined) {
this.constants.edges.dash.length = options.edges.dash.length;
}
if (options.edges.dash.gap !== undefined) {
this.constants.edges.dash.gap = options.edges.dash.gap;
}
if (options.edges.dash.altLength !== undefined) {
this.constants.edges.dash.altLength = options.edges.dash.altLength;
}
}
}
if (options.nodes) {
for (prop in options.nodes) {
if (options.nodes.hasOwnProperty(prop)) {
this.constants.nodes[prop] = options.nodes[prop];
}
}
if (options.nodes.color) {
this.constants.nodes.color = util.parseColor(options.nodes.color);
}
/*
if (options.nodes.widthMin) this.constants.nodes.radiusMin = options.nodes.widthMin;
if (options.nodes.widthMax) this.constants.nodes.radiusMax = options.nodes.widthMax;
*/
}
if (options.groups) {
for (var groupname in options.groups) {
if (options.groups.hasOwnProperty(groupname)) {
var group = options.groups[groupname];
this.groups.add(groupname, group);
}
}
}
if (options.tooltip) {
for (prop in options.tooltip) {
if (options.tooltip.hasOwnProperty(prop)) {
this.constants.tooltip[prop] = options.tooltip[prop];
}
}
if (options.tooltip.color) {
this.constants.tooltip.color = util.parseColor(options.tooltip.color);
}
}
}
// (Re)loading the mixins that can be enabled or disabled in the options.
// load the force calculation functions, grouped under the physics system.
this._loadPhysicsSystem();
// load the navigation system.
this._loadNavigationControls();
// load the data manipulation system
this._loadManipulationSystem();
// configure the smooth curves
this._configureSmoothCurves();
// bind keys. If disabled, this will not do anything;
this._createKeyBinds();
this.setSize(this.width, this.height);
this._setTranslation(this.frame.clientWidth / 2, this.frame.clientHeight / 2);
this._setScale(1);
this._redraw();
};
/**
* Create the main frame for the Graph.
* This function is executed once when a Graph object is created. The frame
* contains a canvas, and this canvas contains all objects like the axis and
* nodes.
* @private
*/
Graph.prototype._create = function () {
// remove all elements from the container element.
while (this.containerElement.hasChildNodes()) {
this.containerElement.removeChild(this.containerElement.firstChild);
}
this.frame = document.createElement('div');
this.frame.className = 'graph-frame';
this.frame.style.position = 'relative';
this.frame.style.overflow = 'hidden';
// create the graph canvas (HTML canvas element)
this.frame.canvas = document.createElement( 'canvas' );
this.frame.canvas.style.position = 'relative';
this.frame.appendChild(this.frame.canvas);
if (!this.frame.canvas.getContext) {
var noCanvas = document.createElement( 'DIV' );
noCanvas.style.color = 'red';
noCanvas.style.fontWeight = 'bold' ;
noCanvas.style.padding = '10px';
noCanvas.innerHTML = 'Error: your browser does not support HTML canvas';
this.frame.canvas.appendChild(noCanvas);
}
var me = this;
this.drag = {};
this.pinch = {};
this.hammer = Hammer(this.frame.canvas, {
prevent_default: true
});
this.hammer.on('tap', me._onTap.bind(me) );
this.hammer.on('doubletap', me._onDoubleTap.bind(me) );
this.hammer.on('hold', me._onHold.bind(me) );
this.hammer.on('pinch', me._onPinch.bind(me) );
this.hammer.on('touch', me._onTouch.bind(me) );
this.hammer.on('dragstart', me._onDragStart.bind(me) );
this.hammer.on('drag', me._onDrag.bind(me) );
this.hammer.on('dragend', me._onDragEnd.bind(me) );
this.hammer.on('release', me._onRelease.bind(me) );
this.hammer.on('mousewheel',me._onMouseWheel.bind(me) );
this.hammer.on('DOMMouseScroll',me._onMouseWheel.bind(me) ); // for FF
this.hammer.on('mousemove', me._onMouseMoveTitle.bind(me) );
// add the frame to the container element
this.containerElement.appendChild(this.frame);
};
/**
* Binding the keys for keyboard navigation. These functions are defined in the NavigationMixin
* @private
*/
Graph.prototype._createKeyBinds = function() {
var me = this;
this.mousetrap = mousetrap;
this.mousetrap.reset();
if (this.constants.keyboard.enabled == true) {
this.mousetrap.bind("up", this._moveUp.bind(me) , "keydown");
this.mousetrap.bind("up", this._yStopMoving.bind(me), "keyup");
this.mousetrap.bind("down", this._moveDown.bind(me) , "keydown");
this.mousetrap.bind("down", this._yStopMoving.bind(me), "keyup");
this.mousetrap.bind("left", this._moveLeft.bind(me) , "keydown");
this.mousetrap.bind("left", this._xStopMoving.bind(me), "keyup");
this.mousetrap.bind("right",this._moveRight.bind(me), "keydown");
this.mousetrap.bind("right",this._xStopMoving.bind(me), "keyup");
this.mousetrap.bind("=", this._zoomIn.bind(me), "keydown");
this.mousetrap.bind("=", this._stopZoom.bind(me), "keyup");
this.mousetrap.bind("-", this._zoomOut.bind(me), "keydown");
this.mousetrap.bind("-", this._stopZoom.bind(me), "keyup");
this.mousetrap.bind("[", this._zoomIn.bind(me), "keydown");
this.mousetrap.bind("[", this._stopZoom.bind(me), "keyup");
this.mousetrap.bind("]", this._zoomOut.bind(me), "keydown");
this.mousetrap.bind("]", this._stopZoom.bind(me), "keyup");
this.mousetrap.bind("pageup",this._zoomIn.bind(me), "keydown");
this.mousetrap.bind("pageup",this._stopZoom.bind(me), "keyup");
this.mousetrap.bind("pagedown",this._zoomOut.bind(me),"keydown");
this.mousetrap.bind("pagedown",this._stopZoom.bind(me), "keyup");
}
if (this.constants.dataManipulation.enabled == true) {
this.mousetrap.bind("escape",this._createManipulatorBar.bind(me));
this.mousetrap.bind("del",this._deleteSelected.bind(me));
}
};
/**
* Get the pointer location from a touch location
* @param {{pageX: Number, pageY: Number}} touch
* @return {{x: Number, y: Number}} pointer
* @private
*/
Graph.prototype._getPointer = function (touch) {
return {
x: touch.pageX - vis.util.getAbsoluteLeft(this.frame.canvas),
y: touch.pageY - vis.util.getAbsoluteTop(this.frame.canvas)
};
};
/**
* On start of a touch gesture, store the pointer
* @param event
* @private
*/
Graph.prototype._onTouch = function (event) {
this.drag.pointer = this._getPointer(event.gesture.center);
this.drag.pinched = false;
this.pinch.scale = this._getScale();
this._handleTouch(this.drag.pointer);
};
/**
* handle drag start event
* @private
*/
Graph.prototype._onDragStart = function () {
this._handleDragStart();
};
/**
* This function is called by _onDragStart.
* It is separated out because we can then overload it for the datamanipulation system.
*
* @private
*/
Graph.prototype._handleDragStart = function() {
var drag = this.drag;
var node = this._getNodeAt(drag.pointer);
// note: drag.pointer is set in _onTouch to get the initial touch location
drag.dragging = true;
drag.selection = [];
drag.translation = this._getTranslation();
drag.nodeId = null;
if (node != null) {
drag.nodeId = node.id;
// select the clicked node if not yet selected
if (!node.isSelected()) {
this._selectObject(node,false);
}
// create an array with the selected nodes and their original location and status
for (var objectId in this.selectionObj.nodes) {
if (this.selectionObj.nodes.hasOwnProperty(objectId)) {
var object = this.selectionObj.nodes[objectId];
var s = {
id: object.id,
node: object,
// store original x, y, xFixed and yFixed, make the node temporarily Fixed
x: object.x,
y: object.y,
xFixed: object.xFixed,
yFixed: object.yFixed
};
object.xFixed = true;
object.yFixed = true;
drag.selection.push(s);
}
}
}
};
/**
* handle drag event
* @private
*/
Graph.prototype._onDrag = function (event) {
this._handleOnDrag(event)
};
/**
* This function is called by _onDrag.
* It is separated out because we can then overload it for the datamanipulation system.
*
* @private
*/
Graph.prototype._handleOnDrag = function(event) {
if (this.drag.pinched) {
return;
}
var pointer = this._getPointer(event.gesture.center);
var me = this,
drag = this.drag,
selection = drag.selection;
if (selection && selection.length) {
// calculate delta's and new location
var deltaX = pointer.x - drag.pointer.x,
deltaY = pointer.y - drag.pointer.y;
// update position of all selected nodes
selection.forEach(function (s) {
var node = s.node;
if (!s.xFixed) {
node.x = me._canvasToX(me._xToCanvas(s.x) + deltaX);
}
if (!s.yFixed) {
node.y = me._canvasToY(me._yToCanvas(s.y) + deltaY);
}
});
// start _animationStep if not yet running
if (!this.moving) {
this.moving = true;
this.start();
}
}
else {
// move the graph
var diffX = pointer.x - this.drag.pointer.x;
var diffY = pointer.y - this.drag.pointer.y;
this._setTranslation(
this.drag.translation.x + diffX,
this.drag.translation.y + diffY);
this._redraw();
this.moved = true;
}
};
/**
* handle drag start event
* @private
*/
Graph.prototype._onDragEnd = function () {
this.drag.dragging = false;
var selection = this.drag.selection;
if (selection) {
selection.forEach(function (s) {
// restore original xFixed and yFixed
s.node.xFixed = s.xFixed;
s.node.yFixed = s.yFixed;
});
}
};
/**
* handle tap/click event: select/unselect a node
* @private
*/
Graph.prototype._onTap = function (event) {
var pointer = this._getPointer(event.gesture.center);
this.pointerPosition = pointer;
this._handleTap(pointer);
};
/**
* handle doubletap event
* @private
*/
Graph.prototype._onDoubleTap = function (event) {
var pointer = this._getPointer(event.gesture.center);
this._handleDoubleTap(pointer);
};
/**
* handle long tap event: multi select nodes
* @private
*/
Graph.prototype._onHold = function (event) {
var pointer = this._getPointer(event.gesture.center);
this.pointerPosition = pointer;
this._handleOnHold(pointer);
};
/**
* handle the release of the screen
*
* @private
*/
Graph.prototype._onRelease = function (event) {
var pointer = this._getPointer(event.gesture.center);
this._handleOnRelease(pointer);
};
/**
* Handle pinch event
* @param event
* @private
*/
Graph.prototype._onPinch = function (event) {
var pointer = this._getPointer(event.gesture.center);
this.drag.pinched = true;
if (!('scale' in this.pinch)) {
this.pinch.scale = 1;
}
// TODO: enabled moving while pinching?
var scale = this.pinch.scale * event.gesture.scale;
this._zoom(scale, pointer)
};
/**
* Zoom the graph in or out
* @param {Number} scale a number around 1, and between 0.01 and 10
* @param {{x: Number, y: Number}} pointer Position on screen
* @return {Number} appliedScale scale is limited within the boundaries
* @private
*/
Graph.prototype._zoom = function(scale, pointer) {
var scaleOld = this._getScale();
if (scale < 0.00001) {
scale = 0.00001;
}
if (scale > 10) {
scale = 10;
}
// + this.frame.canvas.clientHeight / 2
var translation = this._getTranslation();
var scaleFrac = scale / scaleOld;
var tx = (1 - scaleFrac) * pointer.x + translation.x * scaleFrac;
var ty = (1 - scaleFrac) * pointer.y + translation.y * scaleFrac;
this.areaCenter = {"x" : this._canvasToX(pointer.x),
"y" : this._canvasToY(pointer.y)};
this._setScale(scale);
this._setTranslation(tx, ty);
this.updateClustersDefault();
this._redraw();
return scale;
};
/**
* Event handler for mouse wheel event, used to zoom the timeline
* See http://adomas.org/javascript-mouse-wheel/
* https://github.com/EightMedia/hammer.js/issues/256
* @param {MouseEvent} event
* @private
*/
Graph.prototype._onMouseWheel = function(event) {
// retrieve delta
var delta = 0;
if (event.wheelDelta) { /* IE/Opera. */
delta = event.wheelDelta/120;
} else if (event.detail) { /* Mozilla case. */
// In Mozilla, sign of delta is different than in IE.
// Also, delta is multiple of 3.
delta = -event.detail/3;
}
// If delta is nonzero, handle it.
// Basically, delta is now positive if wheel was scrolled up,
// and negative, if wheel was scrolled down.
if (delta) {
// calculate the new scale
var scale = this._getScale();
var zoom = delta / 10;
if (delta < 0) {
zoom = zoom / (1 - zoom);
}
scale *= (1 + zoom);
// calculate the pointer location
var gesture = util.fakeGesture(this, event);
var pointer = this._getPointer(gesture.center);
// apply the new scale
this._zoom(scale, pointer);
}
// Prevent default actions caused by mouse wheel.
event.preventDefault();
};
/**
* Mouse move handler for checking whether the title moves over a node with a title.
* @param {Event} event
* @private
*/
Graph.prototype._onMouseMoveTitle = function (event) {
var gesture = util.fakeGesture(this, event);
var pointer = this._getPointer(gesture.center);
// check if the previously selected node is still selected
if (this.popupNode) {
this._checkHidePopup(pointer);
}
// start a timeout that will check if the mouse is positioned above
// an element
var me = this;
var checkShow = function() {
me._checkShowPopup(pointer);
};
if (this.popupTimer) {
clearInterval(this.popupTimer); // stop any running calculationTimer
}
if (!this.drag.dragging) {
this.popupTimer = setTimeout(checkShow, this.constants.tooltip.delay);
}
};
/**
* Check if there is an element on the given position in the graph
* (a node or edge). If so, and if this element has a title,
* show a popup window with its title.
*
* @param {{x:Number, y:Number}} pointer
* @private
*/
Graph.prototype._checkShowPopup = function (pointer) {
var obj = {
left: this._canvasToX(pointer.x),
top: this._canvasToY(pointer.y),
right: this._canvasToX(pointer.x),
bottom: this._canvasToY(pointer.y)
};
var id;
var lastPopupNode = this.popupNode;
if (this.popupNode == undefined) {
// search the nodes for overlap, select the top one in case of multiple nodes
var nodes = this.nodes;
for (id in nodes) {
if (nodes.hasOwnProperty(id)) {
var node = nodes[id];
if (node.getTitle() !== undefined && node.isOverlappingWith(obj)) {
this.popupNode = node;
break;
}
}
}
}
if (this.popupNode === undefined) {
// search the edges for overlap
var edges = this.edges;
for (id in edges) {
if (edges.hasOwnProperty(id)) {
var edge = edges[id];
if (edge.connected && (edge.getTitle() !== undefined) &&
edge.isOverlappingWith(obj)) {
this.popupNode = edge;
break;
}
}
}
}
if (this.popupNode) {
// show popup message window
if (this.popupNode != lastPopupNode) {
var me = this;
if (!me.popup) {
me.popup = new Popup(me.frame, me.constants.tooltip);
}
// adjust a small offset such that the mouse cursor is located in the
// bottom left location of the popup, and you can easily move over the
// popup area
me.popup.setPosition(pointer.x - 3, pointer.y - 3);
me.popup.setText(me.popupNode.getTitle());
me.popup.show();
}
}
else {
if (this.popup) {
this.popup.hide();
}
}
};
/**
* Check if the popup must be hided, which is the case when the mouse is no
* longer hovering on the object
* @param {{x:Number, y:Number}} pointer
* @private
*/
Graph.prototype._checkHidePopup = function (pointer) {
if (!this.popupNode || !this._getNodeAt(pointer) ) {
this.popupNode = undefined;
if (this.popup) {
this.popup.hide();
}
}
};
/**
* Set a new size for the graph
* @param {string} width Width in pixels or percentage (for example '800px'
* or '50%')
* @param {string} height Height in pixels or percentage (for example '400px'
* or '30%')
*/
Graph.prototype.setSize = function(width, height) {
this.frame.style.width = width;
this.frame.style.height = height;
this.frame.canvas.style.width = '100%';
this.frame.canvas.style.height = '100%';
this.frame.canvas.width = this.frame.canvas.clientWidth;
this.frame.canvas.height = this.frame.canvas.clientHeight;
if (this.manipulationDiv !== undefined) {
this.manipulationDiv.style.width = this.frame.canvas.clientWidth + "px";
}
if (this.navigationDivs !== undefined) {
if (this.navigationDivs['wrapper'] !== undefined) {
this.navigationDivs['wrapper'].style.width = this.frame.canvas.clientWidth + "px";
this.navigationDivs['wrapper'].style.height = this.frame.canvas.clientHeight + "px";
}
}
this.emit('resize', {width:this.frame.canvas.width,height:this.frame.canvas.height});
};
/**
* Set a data set with nodes for the graph
* @param {Array | DataSet | DataView} nodes The data containing the nodes.
* @private
*/
Graph.prototype._setNodes = function(nodes) {
var oldNodesData = this.nodesData;
if (nodes instanceof DataSet || nodes instanceof DataView) {
this.nodesData = nodes;
}
else if (nodes instanceof Array) {
this.nodesData = new DataSet();
this.nodesData.add(nodes);
}
else if (!nodes) {
this.nodesData = new DataSet();
}
else {
throw new TypeError('Array or DataSet expected');
}
if (oldNodesData) {
// unsubscribe from old dataset
util.forEach(this.nodesListeners, function (callback, event) {
oldNodesData.off(event, callback);
});
}
// remove drawn nodes
this.nodes = {};
if (this.nodesData) {
// subscribe to new dataset
var me = this;
util.forEach(this.nodesListeners, function (callback, event) {
me.nodesData.on(event, callback);
});
// draw all new nodes
var ids = this.nodesData.getIds();
this._addNodes(ids);
}
this._updateSelection();
};
/**
* Add nodes
* @param {Number[] | String[]} ids
* @private
*/
Graph.prototype._addNodes = function(ids) {
var id;
for (var i = 0, len = ids.length; i < len; i++) {
id = ids[i];
var data = this.nodesData.get(id);
var node = new Node(data, this.images, this.groups, this.constants);
this.nodes[id] = node; // note: this may replace an existing node
if ((node.xFixed == false || node.yFixed == false) && (node.x === null || node.y === null)) {
var radius = 10 * 0.1*ids.length;
var angle = 2 * Math.PI * Math.random();
if (node.xFixed == false) {node.x = radius * Math.cos(angle);}
if (node.yFixed == false) {node.y = radius * Math.sin(angle);}
}
this.moving = true;
}
this._updateNodeIndexList();
if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) {
this._resetLevels();
this._setupHierarchicalLayout();
}
this._updateCalculationNodes();
this._reconnectEdges();
this._updateValueRange(this.nodes);
this.updateLabels();
};
/**
* Update existing nodes, or create them when not yet existing
* @param {Number[] | String[]} ids
* @private
*/
Graph.prototype._updateNodes = function(ids) {
var nodes = this.nodes,
nodesData = this.nodesData;
for (var i = 0, len = ids.length; i < len; i++) {
var id = ids[i];
var node = nodes[id];
var data = nodesData.get(id);
if (node) {
// update node
node.setProperties(data, this.constants);
}
else {
// create node
node = new Node(properties, this.images, this.groups, this.constants);
nodes[id] = node;
if (!node.isFixed()) {
this.moving = true;
}
}
}
this._updateNodeIndexList();
this._reconnectEdges();
this._updateValueRange(nodes);
};
/**
* Remove existing nodes. If nodes do not exist, the method will just ignore it.
* @param {Number[] | String[]} ids
* @private
*/
Graph.prototype._removeNodes = function(ids) {
var nodes = this.nodes;
for (var i = 0, len = ids.length; i < len; i++) {
var id = ids[i];
delete nodes[id];
}
this._updateNodeIndexList();
if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) {
this._resetLevels();
this._setupHierarchicalLayout();
}
this._updateCalculationNodes();
this._reconnectEdges();
this._updateSelection();
this._updateValueRange(nodes);
};
/**
* Load edges by reading the data table
* @param {Array | DataSet | DataView} edges The data containing the edges.
* @private
* @private
*/
Graph.prototype._setEdges = function(edges) {
var oldEdgesData = this.edgesData;
if (edges instanceof DataSet || edges instanceof DataView) {
this.edgesData = edges;
}
else if (edges instanceof Array) {
this.edgesData = new DataSet();
this.edgesData.add(edges);
}
else if (!edges) {
this.edgesData = new DataSet();
}
else {
throw new TypeError('Array or DataSet expected');
}
if (oldEdgesData) {
// unsubscribe from old dataset
util.forEach(this.edgesListeners, function (callback, event) {
oldEdgesData.off(event, callback);
});
}
// remove drawn edges
this.edges = {};
if (this.edgesData) {
// subscribe to new dataset
var me = this;
util.forEach(this.edgesListeners, function (callback, event) {
me.edgesData.on(event, callback);
});
// draw all new nodes
var ids = this.edgesData.getIds();
this._addEdges(ids);
}
this._reconnectEdges();
};
/**
* Add edges
* @param {Number[] | String[]} ids
* @private
*/
Graph.prototype._addEdges = function (ids) {
var edges = this.edges,
edgesData = this.edgesData;
for (var i = 0, len = ids.length; i < len; i++) {
var id = ids[i];
var oldEdge = edges[id];
if (oldEdge) {
oldEdge.disconnect();
}
var data = edgesData.get(id, {"showInternalIds" : true});
edges[id] = new Edge(data, this, this.constants);
}
this.moving = true;
this._updateValueRange(edges);
this._createBezierNodes();
if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) {
this._resetLevels();
this._setupHierarchicalLayout();
}
this._updateCalculationNodes();
};
/**
* Update existing edges, or create them when not yet existing
* @param {Number[] | String[]} ids
* @private
*/
Graph.prototype._updateEdges = function (ids) {
var edges = this.edges,
edgesData = this.edgesData;
for (var i = 0, len = ids.length; i < len; i++) {
var id = ids[i];
var data = edgesData.get(id);
var edge = edges[id];
if (edge) {
// update edge
edge.disconnect();
edge.setProperties(data, this.constants);
edge.connect();
}
else {
// create edge
edge = new Edge(data, this, this.constants);
this.edges[id] = edge;
}
}
this._createBezierNodes();
if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) {
this._resetLevels();
this._setupHierarchicalLayout();
}
this.moving = true;
this._updateValueRange(edges);
};
/**
* Remove existing edges. Non existing ids will be ignored
* @param {Number[] | String[]} ids
* @private
*/
Graph.prototype._removeEdges = function (ids) {
var edges = this.edges;
for (var i = 0, len = ids.length; i < len; i++) {
var id = ids[i];
var edge = edges[id];
if (edge) {
if (edge.via != null) {
delete this.sectors['support']['nodes'][edge.via.id];
}
edge.disconnect();
delete edges[id];
}
}
this.moving = true;
this._updateValueRange(edges);
if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) {
this._resetLevels();
this._setupHierarchicalLayout();
}
this._updateCalculationNodes();
};
/**
* Reconnect all edges
* @private
*/
Graph.prototype._reconnectEdges = function() {
var id,
nodes = this.nodes,
edges = this.edges;
for (id in nodes) {
if (nodes.hasOwnProperty(id)) {
nodes[id].edges = [];
}
}
for (id in edges) {
if (edges.hasOwnProperty(id)) {
var edge = edges[id];
edge.from = null;
edge.to = null;
edge.connect();
}
}
};
/**
* Update the values of all object in the given array according to the current
* value range of the objects in the array.
* @param {Object} obj An object containing a set of Edges or Nodes
* The objects must have a method getValue() and
* setValueRange(min, max).
* @private
*/
Graph.prototype._updateValueRange = function(obj) {
var id;
// determine the range of the objects
var valueMin = undefined;
var valueMax = undefined;
for (id in obj) {
if (obj.hasOwnProperty(id)) {
var value = obj[id].getValue();
if (value !== undefined) {
valueMin = (valueMin === undefined) ? value : Math.min(value, valueMin);
valueMax = (valueMax === undefined) ? value : Math.max(value, valueMax);
}
}
}
// adjust the range of all objects
if (valueMin !== undefined && valueMax !== undefined) {
for (id in obj) {
if (obj.hasOwnProperty(id)) {
obj[id].setValueRange(valueMin, valueMax);
}
}
}
};
/**
* Redraw the graph with the current data
* chart will be resized too.
*/
Graph.prototype.redraw = function() {
this.setSize(this.width, this.height);
this._redraw();
};
/**
* Redraw the graph with the current data
* @private
*/
Graph.prototype._redraw = function() {
var ctx = this.frame.canvas.getContext('2d');
// clear the canvas
var w = this.frame.canvas.width;
var h = this.frame.canvas.height;
ctx.clearRect(0, 0, w, h);
// set scaling and translation
ctx.save();
ctx.translate(this.translation.x, this.translation.y);
ctx.scale(this.scale, this.scale);
this.canvasTopLeft = {
"x": this._canvasToX(0),
"y": this._canvasToY(0)
};
this.canvasBottomRight = {
"x": this._canvasToX(this.frame.canvas.clientWidth),
"y": this._canvasToY(this.frame.canvas.clientHeight)
};
this._doInAllSectors("_drawAllSectorNodes",ctx);
this._doInAllSectors("_drawEdges",ctx);
this._doInAllSectors("_drawNodes",ctx,false);
// this._doInSupportSector("_drawNodes",ctx,true);
// this._drawTree(ctx,"#F00F0F");
// restore original scaling and translation
ctx.restore();
};
/**
* Set the translation of the graph
* @param {Number} offsetX Horizontal offset
* @param {Number} offsetY Vertical offset
* @private
*/
Graph.prototype._setTranslation = function(offsetX, offsetY) {
if (this.translation === undefined) {
this.translation = {
x: 0,
y: 0
};
}
if (offsetX !== undefined) {
this.translation.x = offsetX;
}
if (offsetY !== undefined) {
this.translation.y = offsetY;
}
};
/**
* Get the translation of the graph
* @return {Object} translation An object with parameters x and y, both a number
* @private
*/
Graph.prototype._getTranslation = function() {
return {
x: this.translation.x,
y: this.translation.y
};
};
/**
* Scale the graph
* @param {Number} scale Scaling factor 1.0 is unscaled
* @private
*/
Graph.prototype._setScale = function(scale) {
this.scale = scale;
};
/**
* Get the current scale of the graph
* @return {Number} scale Scaling factor 1.0 is unscaled
* @private
*/
Graph.prototype._getScale = function() {
return this.scale;
};
/**
* Convert a horizontal point on the HTML canvas to the x-value of the model
* @param {number} x
* @returns {number}
* @private
*/
Graph.prototype._canvasToX = function(x) {
return (x - this.translation.x) / this.scale;
};
/**
* Convert an x-value in the model to a horizontal point on the HTML canvas
* @param {number} x
* @returns {number}
* @private
*/
Graph.prototype._xToCanvas = function(x) {
return x * this.scale + this.translation.x;
};
/**
* Convert a vertical point on the HTML canvas to the y-value of the model
* @param {number} y
* @returns {number}
* @private
*/
Graph.prototype._canvasToY = function(y) {
return (y - this.translation.y) / this.scale;
};
/**
* Convert an y-value in the model to a vertical point on the HTML canvas
* @param {number} y
* @returns {number}
* @private
*/
Graph.prototype._yToCanvas = function(y) {
return y * this.scale + this.translation.y ;
};
/**
* Redraw all nodes
* The 2d context of a HTML canvas can be retrieved by canvas.getContext('2d');
* @param {CanvasRenderingContext2D} ctx
* @param {Boolean} [alwaysShow]
* @private
*/
Graph.prototype._drawNodes = function(ctx,alwaysShow) {
if (alwaysShow === undefined) {
alwaysShow = false;
}
// first draw the unselected nodes
var nodes = this.nodes;
var selected = [];
for (var id in nodes) {
if (nodes.hasOwnProperty(id)) {
nodes[id].setScaleAndPos(this.scale,this.canvasTopLeft,this.canvasBottomRight);
if (nodes[id].isSelected()) {
selected.push(id);
}
else {
if (nodes[id].inArea() || alwaysShow) {
nodes[id].draw(ctx);
}
}
}
}
// draw the selected nodes on top
for (var s = 0, sMax = selected.length; s < sMax; s++) {
if (nodes[selected[s]].inArea() || alwaysShow) {
nodes[selected[s]].draw(ctx);
}
}
};
/**
* Redraw all edges
* The 2d context of a HTML canvas can be retrieved by canvas.getContext('2d');
* @param {CanvasRenderingContext2D} ctx
* @private
*/
Graph.prototype._drawEdges = function(ctx) {
var edges = this.edges;
for (var id in edges) {
if (edges.hasOwnProperty(id)) {
var edge = edges[id];
edge.setScale(this.scale);
if (edge.connected) {
edges[id].draw(ctx);
}
}
}
};
/**
* Find a stable position for all nodes
* @private
*/
Graph.prototype._stabilize = function() {
if (this.constants.freezeForStabilization == true) {
this._freezeDefinedNodes();
}
// find stable position
var count = 0;
while (this.moving && count < this.constants.stabilizationIterations) {
this._physicsTick();
count++;
}
this.zoomExtent(false,true);
if (this.constants.freezeForStabilization == true) {
this._restoreFrozenNodes();
}
this.emit("stabilized",{iterations:count});
};
Graph.prototype._freezeDefinedNodes = function() {
var nodes = this.nodes;
for (var id in nodes) {
if (nodes.hasOwnProperty(id)) {
if (nodes[id].x != null && nodes[id].y != null) {
nodes[id].fixedData.x = nodes[id].xFixed;
nodes[id].fixedData.y = nodes[id].yFixed;
nodes[id].xFixed = true;
nodes[id].yFixed = true;
}
}
}
};
Graph.prototype._restoreFrozenNodes = function() {
var nodes = this.nodes;
for (var id in nodes) {
if (nodes.hasOwnProperty(id)) {
if (nodes[id].fixedData.x != null) {
nodes[id].xFixed = nodes[id].fixedData.x;
nodes[id].yFixed = nodes[id].fixedData.y;
}
}
}
};
/**
* Check if any of the nodes is still moving
* @param {number} vmin the minimum velocity considered as 'moving'
* @return {boolean} true if moving, false if non of the nodes is moving
* @private
*/
Graph.prototype._isMoving = function(vmin) {
var nodes = this.nodes;
for (var id in nodes) {
if (nodes.hasOwnProperty(id) && nodes[id].isMoving(vmin)) {
return true;
}
}
return false;
};
/**
* /**
* Perform one discrete step for all nodes
*
* @private
*/
Graph.prototype._discreteStepNodes = function() {
var interval = this.physicsDiscreteStepsize;
var nodes = this.nodes;
var nodeId;
var nodesPresent = false;
if (this.constants.maxVelocity > 0) {
for (nodeId in nodes) {
if (nodes.hasOwnProperty(nodeId)) {
nodes[nodeId].discreteStepLimited(interval, this.constants.maxVelocity);
nodesPresent = true;
}
}
}
else {
for (nodeId in nodes) {
if (nodes.hasOwnProperty(nodeId)) {
nodes[nodeId].discreteStep(interval);
nodesPresent = true;
}
}
}
if (nodesPresent == true) {
var vminCorrected = this.constants.minVelocity / Math.max(this.scale,0.05);
if (vminCorrected > 0.5*this.constants.maxVelocity) {
this.moving = true;
}
else {
this.moving = this._isMoving(vminCorrected);
}
}
};
Graph.prototype._physicsTick = function() {
if (!this.freezeSimulation) {
if (this.moving) {
this._doInAllActiveSectors("_initializeForceCalculation");
this._doInAllActiveSectors("_discreteStepNodes");
if (this.constants.smoothCurves) {
this._doInSupportSector("_discreteStepNodes");
}
this._findCenter(this._getRange())
}
}
};
/**
* This function runs one step of the animation. It calls an x amount of physics ticks and one render tick.
* It reschedules itself at the beginning of the function
*
* @private
*/
Graph.prototype._animationStep = function() {
// reset the timer so a new scheduled animation step can be set
this.timer = undefined;
// handle the keyboad movement
this._handleNavigation();
// this schedules a new animation step
this.start();
// start the physics simulation
var calculationTime = Date.now();
var maxSteps = 1;
this._physicsTick();
var timeRequired = Date.now() - calculationTime;
while (timeRequired < (this.renderTimestep - this.renderTime) && maxSteps < this.maxPhysicsTicksPerRender) {
this._physicsTick();
timeRequired = Date.now() - calculationTime;
maxSteps++;
}
// start the rendering process
var renderTime = Date.now();
this._redraw();
this.renderTime = Date.now() - renderTime;
};
if (typeof window !== 'undefined') {
window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
}
/**
* Schedule a animation step with the refreshrate interval.
*/
Graph.prototype.start = function() {
if (this.moving || this.xIncrement != 0 || this.yIncrement != 0 || this.zoomIncrement != 0) {
if (!this.timer) {
var ua = navigator.userAgent.toLowerCase();
var requiresTimeout = false;
if (ua.indexOf('msie 9.0') != -1) { // IE 9
requiresTimeout = true;
}
else if (ua.indexOf('safari') != -1) { // safari
if (ua.indexOf('chrome') <= -1) {
requiresTimeout = true;
}
}
if (requiresTimeout == true) {
this.timer = window.setTimeout(this._animationStep.bind(this), this.renderTimestep); // wait this.renderTimeStep milliseconds and perform the animation step function
}
else{
this.timer = window.requestAnimationFrame(this._animationStep.bind(this), this.renderTimestep); // wait this.renderTimeStep milliseconds and perform the animation step function
}
}
}
else {
this._redraw();
}
};
/**
* Move the graph according to the keyboard presses.
*
* @private
*/
Graph.prototype._handleNavigation = function() {
if (this.xIncrement != 0 || this.yIncrement != 0) {
var translation = this._getTranslation();
this._setTranslation(translation.x+this.xIncrement, translation.y+this.yIncrement);
}
if (this.zoomIncrement != 0) {
var center = {
x: this.frame.canvas.clientWidth / 2,
y: this.frame.canvas.clientHeight / 2
};
this._zoom(this.scale*(1 + this.zoomIncrement), center);
}
};
/**
* Freeze the _animationStep
*/
Graph.prototype.toggleFreeze = function() {
if (this.freezeSimulation == false) {
this.freezeSimulation = true;
}
else {
this.freezeSimulation = false;
this.start();
}
};
Graph.prototype._configureSmoothCurves = function(disableStart) {
if (disableStart === undefined) {
disableStart = true;
}
if (this.constants.smoothCurves == true) {
this._createBezierNodes();
}
else {
// delete the support nodes
this.sectors['support']['nodes'] = {};
for (var edgeId in this.edges) {
if (this.edges.hasOwnProperty(edgeId)) {
this.edges[edgeId].smooth = false;
this.edges[edgeId].via = null;
}
}
}
this._updateCalculationNodes();
if (!disableStart) {
this.moving = true;
this.start();
}
};
Graph.prototype._createBezierNodes = function() {
if (this.constants.smoothCurves == true) {
for (var edgeId in this.edges) {
if (this.edges.hasOwnProperty(edgeId)) {
var edge = this.edges[edgeId];
if (edge.via == null) {
edge.smooth = true;
var nodeId = "edgeId:".concat(edge.id);
this.sectors['support']['nodes'][nodeId] = new Node(
{id:nodeId,
mass:1,
shape:'circle',
image:"",
internalMultiplier:1
},{},{},this.constants);
edge.via = this.sectors['support']['nodes'][nodeId];
edge.via.parentEdgeId = edge.id;
edge.positionBezierNode();
}
}
}
}
};
Graph.prototype._initializeMixinLoaders = function () {
for (var mixinFunction in graphMixinLoaders) {
if (graphMixinLoaders.hasOwnProperty(mixinFunction)) {
Graph.prototype[mixinFunction] = graphMixinLoaders[mixinFunction];
}
}
};
/**
* Load the XY positions of the nodes into the dataset.
*/
Graph.prototype.storePosition = function() {
var dataArray = [];
for (var nodeId in this.nodes) {
if (this.nodes.hasOwnProperty(nodeId)) {
var node = this.nodes[nodeId];
var allowedToMoveX = !this.nodes.xFixed;
var allowedToMoveY = !this.nodes.yFixed;
if (this.nodesData.data[nodeId].x != Math.round(node.x) || this.nodesData.data[nodeId].y != Math.round(node.y)) {
dataArray.push({id:nodeId,x:Math.round(node.x),y:Math.round(node.y),allowedToMoveX:allowedToMoveX,allowedToMoveY:allowedToMoveY});
}
}
}
this.nodesData.update(dataArray);
};
/**
* vis.js module exports
*/
var vis = {
util: util,
Controller: Controller,
DataSet: DataSet,
DataView: DataView,
Range: Range,
Stack: Stack,
TimeStep: TimeStep,
components: {
items: {
Item: Item,
ItemBox: ItemBox,
ItemPoint: ItemPoint,
ItemRange: ItemRange
},
Component: Component,
Panel: Panel,
RootPanel: RootPanel,
ItemSet: ItemSet,
TimeAxis: TimeAxis
},
graph: {
Node: Node,
Edge: Edge,
Popup: Popup,
Groups: Groups,
Images: Images
},
Timeline: Timeline,
Graph: Graph
};
/**
* CommonJS module exports
*/
if (typeof exports !== 'undefined') {
exports = vis;
}
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
module.exports = vis;
}
/**
* AMD module exports
*/
if (typeof(define) === 'function') {
define(function () {
return vis;
});
}
/**
* Window exports
*/
if (typeof window !== 'undefined') {
// attach the module to the window, load as a regular javascript file
window['vis'] = vis;
}
},{"emitter-component":2,"hammerjs":3,"moment":4,"mousetrap":5}],2:[function(require,module,exports){
/**
* Expose `Emitter`.
*/
module.exports = Emitter;
/**
* Initialize a new `Emitter`.
*
* @api public
*/
function Emitter(obj) {
if (obj) return mixin(obj);
};
/**
* Mixin the emitter properties.
*
* @param {Object} obj
* @return {Object}
* @api private
*/
function mixin(obj) {
for (var key in Emitter.prototype) {
obj[key] = Emitter.prototype[key];
}
return obj;
}
/**
* Listen on the given `event` with `fn`.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.on =
Emitter.prototype.addEventListener = function(event, fn){
this._callbacks = this._callbacks || {};
(this._callbacks[event] = this._callbacks[event] || [])
.push(fn);
return this;
};
/**
* Adds an `event` listener that will be invoked a single
* time then automatically removed.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.once = function(event, fn){
var self = this;
this._callbacks = this._callbacks || {};
function on() {
self.off(event, on);
fn.apply(this, arguments);
}
on.fn = fn;
this.on(event, on);
return this;
};
/**
* Remove the given callback for `event` or all
* registered callbacks.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.off =
Emitter.prototype.removeListener =
Emitter.prototype.removeAllListeners =
Emitter.prototype.removeEventListener = function(event, fn){
this._callbacks = this._callbacks || {};
// all
if (0 == arguments.length) {
this._callbacks = {};
return this;
}
// specific event
var callbacks = this._callbacks[event];
if (!callbacks) return this;
// remove all handlers
if (1 == arguments.length) {
delete this._callbacks[event];
return this;
}
// remove specific handler
var cb;
for (var i = 0; i < callbacks.length; i++) {
cb = callbacks[i];
if (cb === fn || cb.fn === fn) {
callbacks.splice(i, 1);
break;
}
}
return this;
};
/**
* Emit `event` with the given args.
*
* @param {String} event
* @param {Mixed} ...
* @return {Emitter}
*/
Emitter.prototype.emit = function(event){
this._callbacks = this._callbacks || {};
var args = [].slice.call(arguments, 1)
, callbacks = this._callbacks[event];
if (callbacks) {
callbacks = callbacks.slice(0);
for (var i = 0, len = callbacks.length; i < len; ++i) {
callbacks[i].apply(this, args);
}
}
return this;
};
/**
* Return array of callbacks for `event`.
*
* @param {String} event
* @return {Array}
* @api public
*/
Emitter.prototype.listeners = function(event){
this._callbacks = this._callbacks || {};
return this._callbacks[event] || [];
};
/**
* Check if this emitter has `event` handlers.
*
* @param {String} event
* @return {Boolean}
* @api public
*/
Emitter.prototype.hasListeners = function(event){
return !! this.listeners(event).length;
};
},{}],3:[function(require,module,exports){
/*! Hammer.JS - v1.0.5 - 2013-04-07
* http://eightmedia.github.com/hammer.js
*
* Copyright (c) 2013 Jorik Tangelder <j.tangelder@gmail.com>;
* Licensed under the MIT license */
(function(window, undefined) {
'use strict';
/**
* Hammer
* use this to create instances
* @param {HTMLElement} element
* @param {Object} options
* @returns {Hammer.Instance}
* @constructor
*/
var Hammer = function(element, options) {
return new Hammer.Instance(element, options || {});
};
// default settings
Hammer.defaults = {
// add styles and attributes to the element to prevent the browser from doing
// its native behavior. this doesnt prevent the scrolling, but cancels
// the contextmenu, tap highlighting etc
// set to false to disable this
stop_browser_behavior: {
// this also triggers onselectstart=false for IE
userSelect: 'none',
// this makes the element blocking in IE10 >, you could experiment with the value
// see for more options this issue; https://github.com/EightMedia/hammer.js/issues/241
touchAction: 'none',
touchCallout: 'none',
contentZooming: 'none',
userDrag: 'none',
tapHighlightColor: 'rgba(0,0,0,0)'
}
// more settings are defined per gesture at gestures.js
};
// detect touchevents
Hammer.HAS_POINTEREVENTS = navigator.pointerEnabled || navigator.msPointerEnabled;
Hammer.HAS_TOUCHEVENTS = ('ontouchstart' in window);
// dont use mouseevents on mobile devices
Hammer.MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;
Hammer.NO_MOUSEEVENTS = Hammer.HAS_TOUCHEVENTS && navigator.userAgent.match(Hammer.MOBILE_REGEX);
// eventtypes per touchevent (start, move, end)
// are filled by Hammer.event.determineEventTypes on setup
Hammer.EVENT_TYPES = {};
// direction defines
Hammer.DIRECTION_DOWN = 'down';
Hammer.DIRECTION_LEFT = 'left';
Hammer.DIRECTION_UP = 'up';
Hammer.DIRECTION_RIGHT = 'right';
// pointer type
Hammer.POINTER_MOUSE = 'mouse';
Hammer.POINTER_TOUCH = 'touch';
Hammer.POINTER_PEN = 'pen';
// touch event defines
Hammer.EVENT_START = 'start';
Hammer.EVENT_MOVE = 'move';
Hammer.EVENT_END = 'end';
// hammer document where the base events are added at
Hammer.DOCUMENT = document;
// plugins namespace
Hammer.plugins = {};
// if the window events are set...
Hammer.READY = false;
/**
* setup events to detect gestures on the document
*/
function setup() {
if(Hammer.READY) {
return;
}
// find what eventtypes we add listeners to
Hammer.event.determineEventTypes();
// Register all gestures inside Hammer.gestures
for(var name in Hammer.gestures) {
if(Hammer.gestures.hasOwnProperty(name)) {
Hammer.detection.register(Hammer.gestures[name]);
}
}
// Add touch events on the document
Hammer.event.onTouch(Hammer.DOCUMENT, Hammer.EVENT_MOVE, Hammer.detection.detect);
Hammer.event.onTouch(Hammer.DOCUMENT, Hammer.EVENT_END, Hammer.detection.detect);
// Hammer is ready...!
Hammer.READY = true;
}
/**
* create new hammer instance
* all methods should return the instance itself, so it is chainable.
* @param {HTMLElement} element
* @param {Object} [options={}]
* @returns {Hammer.Instance}
* @constructor
*/
Hammer.Instance = function(element, options) {
var self = this;
// setup HammerJS window events and register all gestures
// this also sets up the default options
setup();
this.element = element;
// start/stop detection option
this.enabled = true;
// merge options
this.options = Hammer.utils.extend(
Hammer.utils.extend({}, Hammer.defaults),
options || {});
// add some css to the element to prevent the browser from doing its native behavoir
if(this.options.stop_browser_behavior) {
Hammer.utils.stopDefaultBrowserBehavior(this.element, this.options.stop_browser_behavior);
}
// start detection on touchstart
Hammer.event.onTouch(element, Hammer.EVENT_START, function(ev) {
if(self.enabled) {
Hammer.detection.startDetect(self, ev);
}
});
// return instance
return this;
};
Hammer.Instance.prototype = {
/**
* bind events to the instance
* @param {String} gesture
* @param {Function} handler
* @returns {Hammer.Instance}
*/
on: function onEvent(gesture, handler){
var gestures = gesture.split(' ');
for(var t=0; t<gestures.length; t++) {
this.element.addEventListener(gestures[t], handler, false);
}
return this;
},
/**
* unbind events to the instance
* @param {String} gesture
* @param {Function} handler
* @returns {Hammer.Instance}
*/
off: function offEvent(gesture, handler){
var gestures = gesture.split(' ');
for(var t=0; t<gestures.length; t++) {
this.element.removeEventListener(gestures[t], handler, false);
}
return this;
},
/**
* trigger gesture event
* @param {String} gesture
* @param {Object} eventData
* @returns {Hammer.Instance}
*/
trigger: function triggerEvent(gesture, eventData){
// create DOM event
var event = Hammer.DOCUMENT.createEvent('Event');
event.initEvent(gesture, true, true);
event.gesture = eventData;
// trigger on the target if it is in the instance element,
// this is for event delegation tricks
var element = this.element;
if(Hammer.utils.hasParent(eventData.target, element)) {
element = eventData.target;
}
element.dispatchEvent(event);
return this;
},
/**
* enable of disable hammer.js detection
* @param {Boolean} state
* @returns {Hammer.Instance}
*/
enable: function enable(state) {
this.enabled = state;
return this;
}
};
/**
* this holds the last move event,
* used to fix empty touchend issue
* see the onTouch event for an explanation
* @type {Object}
*/
var last_move_event = null;
/**
* when the mouse is hold down, this is true
* @type {Boolean}
*/
var enable_detect = false;
/**
* when touch events have been fired, this is true
* @type {Boolean}
*/
var touch_triggered = false;
Hammer.event = {
/**
* simple addEventListener
* @param {HTMLElement} element
* @param {String} type
* @param {Function} handler
*/
bindDom: function(element, type, handler) {
var types = type.split(' ');
for(var t=0; t<types.length; t++) {
element.addEventListener(types[t], handler, false);
}
},
/**
* touch events with mouse fallback
* @param {HTMLElement} element
* @param {String} eventType like Hammer.EVENT_MOVE
* @param {Function} handler
*/
onTouch: function onTouch(element, eventType, handler) {
var self = this;
this.bindDom(element, Hammer.EVENT_TYPES[eventType], function bindDomOnTouch(ev) {
var sourceEventType = ev.type.toLowerCase();
// onmouseup, but when touchend has been fired we do nothing.
// this is for touchdevices which also fire a mouseup on touchend
if(sourceEventType.match(/mouse/) && touch_triggered) {
return;
}
// mousebutton must be down or a touch event
else if( sourceEventType.match(/touch/) || // touch events are always on screen
sourceEventType.match(/pointerdown/) || // pointerevents touch
(sourceEventType.match(/mouse/) && ev.which === 1) // mouse is pressed
){
enable_detect = true;
}
// we are in a touch event, set the touch triggered bool to true,
// this for the conflicts that may occur on ios and android
if(sourceEventType.match(/touch|pointer/)) {
touch_triggered = true;
}
// count the total touches on the screen
var count_touches = 0;
// when touch has been triggered in this detection session
// and we are now handling a mouse event, we stop that to prevent conflicts
if(enable_detect) {
// update pointerevent
if(Hammer.HAS_POINTEREVENTS && eventType != Hammer.EVENT_END) {
count_touches = Hammer.PointerEvent.updatePointer(eventType, ev);
}
// touch
else if(sourceEventType.match(/touch/)) {
count_touches = ev.touches.length;
}
// mouse
else if(!touch_triggered) {
count_touches = sourceEventType.match(/up/) ? 0 : 1;
}
// if we are in a end event, but when we remove one touch and
// we still have enough, set eventType to move
if(count_touches > 0 && eventType == Hammer.EVENT_END) {
eventType = Hammer.EVENT_MOVE;
}
// no touches, force the end event
else if(!count_touches) {
eventType = Hammer.EVENT_END;
}
// because touchend has no touches, and we often want to use these in our gestures,
// we send the last move event as our eventData in touchend
if(!count_touches && last_move_event !== null) {
ev = last_move_event;
}
// store the last move event
else {
last_move_event = ev;
}
// trigger the handler
handler.call(Hammer.detection, self.collectEventData(element, eventType, ev));
// remove pointerevent from list
if(Hammer.HAS_POINTEREVENTS && eventType == Hammer.EVENT_END) {
count_touches = Hammer.PointerEvent.updatePointer(eventType, ev);
}
}
//debug(sourceEventType +" "+ eventType);
// on the end we reset everything
if(!count_touches) {
last_move_event = null;
enable_detect = false;
touch_triggered = false;
Hammer.PointerEvent.reset();
}
});
},
/**
* we have different events for each device/browser
* determine what we need and set them in the Hammer.EVENT_TYPES constant
*/
determineEventTypes: function determineEventTypes() {
// determine the eventtype we want to set
var types;
// pointerEvents magic
if(Hammer.HAS_POINTEREVENTS) {
types = Hammer.PointerEvent.getEvents();
}
// on Android, iOS, blackberry, windows mobile we dont want any mouseevents
else if(Hammer.NO_MOUSEEVENTS) {
types = [
'touchstart',
'touchmove',
'touchend touchcancel'];
}
// for non pointer events browsers and mixed browsers,
// like chrome on windows8 touch laptop
else {
types = [
'touchstart mousedown',
'touchmove mousemove',
'touchend touchcancel mouseup'];
}
Hammer.EVENT_TYPES[Hammer.EVENT_START] = types[0];
Hammer.EVENT_TYPES[Hammer.EVENT_MOVE] = types[1];
Hammer.EVENT_TYPES[Hammer.EVENT_END] = types[2];
},
/**
* create touchlist depending on the event
* @param {Object} ev
* @param {String} eventType used by the fakemultitouch plugin
*/
getTouchList: function getTouchList(ev/*, eventType*/) {
// get the fake pointerEvent touchlist
if(Hammer.HAS_POINTEREVENTS) {
return Hammer.PointerEvent.getTouchList();
}
// get the touchlist
else if(ev.touches) {
return ev.touches;
}
// make fake touchlist from mouse position
else {
return [{
identifier: 1,
pageX: ev.pageX,
pageY: ev.pageY,
target: ev.target
}];
}
},
/**
* collect event data for Hammer js
* @param {HTMLElement} element
* @param {String} eventType like Hammer.EVENT_MOVE
* @param {Object} eventData
*/
collectEventData: function collectEventData(element, eventType, ev) {
var touches = this.getTouchList(ev, eventType);
// find out pointerType
var pointerType = Hammer.POINTER_TOUCH;
if(ev.type.match(/mouse/) || Hammer.PointerEvent.matchType(Hammer.POINTER_MOUSE, ev)) {
pointerType = Hammer.POINTER_MOUSE;
}
return {
center : Hammer.utils.getCenter(touches),
timeStamp : new Date().getTime(),
target : ev.target,
touches : touches,
eventType : eventType,
pointerType : pointerType,
srcEvent : ev,
/**
* prevent the browser default actions
* mostly used to disable scrolling of the browser
*/
preventDefault: function() {
if(this.srcEvent.preventManipulation) {
this.srcEvent.preventManipulation();
}
if(this.srcEvent.preventDefault) {
this.srcEvent.preventDefault();
}
},
/**
* stop bubbling the event up to its parents
*/
stopPropagation: function() {
this.srcEvent.stopPropagation();
},
/**
* immediately stop gesture detection
* might be useful after a swipe was detected
* @return {*}
*/
stopDetect: function() {
return Hammer.detection.stopDetect();
}
};
}
};
Hammer.PointerEvent = {
/**
* holds all pointers
* @type {Object}
*/
pointers: {},
/**
* get a list of pointers
* @returns {Array} touchlist
*/
getTouchList: function() {
var self = this;
var touchlist = [];
// we can use forEach since pointerEvents only is in IE10
Object.keys(self.pointers).sort().forEach(function(id) {
touchlist.push(self.pointers[id]);
});
return touchlist;
},
/**
* update the position of a pointer
* @param {String} type Hammer.EVENT_END
* @param {Object} pointerEvent
*/
updatePointer: function(type, pointerEvent) {
if(type == Hammer.EVENT_END) {
this.pointers = {};
}
else {
pointerEvent.identifier = pointerEvent.pointerId;
this.pointers[pointerEvent.pointerId] = pointerEvent;
}
return Object.keys(this.pointers).length;
},
/**
* check if ev matches pointertype
* @param {String} pointerType Hammer.POINTER_MOUSE
* @param {PointerEvent} ev
*/
matchType: function(pointerType, ev) {
if(!ev.pointerType) {
return false;
}
var types = {};
types[Hammer.POINTER_MOUSE] = (ev.pointerType == ev.MSPOINTER_TYPE_MOUSE || ev.pointerType == Hammer.POINTER_MOUSE);
types[Hammer.POINTER_TOUCH] = (ev.pointerType == ev.MSPOINTER_TYPE_TOUCH || ev.pointerType == Hammer.POINTER_TOUCH);
types[Hammer.POINTER_PEN] = (ev.pointerType == ev.MSPOINTER_TYPE_PEN || ev.pointerType == Hammer.POINTER_PEN);
return types[pointerType];
},
/**
* get events
*/
getEvents: function() {
return [
'pointerdown MSPointerDown',
'pointermove MSPointerMove',
'pointerup pointercancel MSPointerUp MSPointerCancel'
];
},
/**
* reset the list
*/
reset: function() {
this.pointers = {};
}
};
Hammer.utils = {
/**
* extend method,
* also used for cloning when dest is an empty object
* @param {Object} dest
* @param {Object} src
* @parm {Boolean} merge do a merge
* @returns {Object} dest
*/
extend: function extend(dest, src, merge) {
for (var key in src) {
if(dest[key] !== undefined && merge) {
continue;
}
dest[key] = src[key];
}
return dest;
},
/**
* find if a node is in the given parent
* used for event delegation tricks
* @param {HTMLElement} node
* @param {HTMLElement} parent
* @returns {boolean} has_parent
*/
hasParent: function(node, parent) {
while(node){
if(node == parent) {
return true;
}
node = node.parentNode;
}
return false;
},
/**
* get the center of all the touches
* @param {Array} touches
* @returns {Object} center
*/
getCenter: function getCenter(touches) {
var valuesX = [], valuesY = [];
for(var t= 0,len=touches.length; t<len; t++) {
valuesX.push(touches[t].pageX);
valuesY.push(touches[t].pageY);
}
return {
pageX: ((Math.min.apply(Math, valuesX) + Math.max.apply(Math, valuesX)) / 2),
pageY: ((Math.min.apply(Math, valuesY) + Math.max.apply(Math, valuesY)) / 2)
};
},
/**
* calculate the velocity between two points
* @param {Number} delta_time
* @param {Number} delta_x
* @param {Number} delta_y
* @returns {Object} velocity
*/
getVelocity: function getVelocity(delta_time, delta_x, delta_y) {
return {
x: Math.abs(delta_x / delta_time) || 0,
y: Math.abs(delta_y / delta_time) || 0
};
},
/**
* calculate the angle between two coordinates
* @param {Touch} touch1
* @param {Touch} touch2
* @returns {Number} angle
*/
getAngle: function getAngle(touch1, touch2) {
var y = touch2.pageY - touch1.pageY,
x = touch2.pageX - touch1.pageX;
return Math.atan2(y, x) * 180 / Math.PI;
},
/**
* angle to direction define
* @param {Touch} touch1
* @param {Touch} touch2
* @returns {String} direction constant, like Hammer.DIRECTION_LEFT
*/
getDirection: function getDirection(touch1, touch2) {
var x = Math.abs(touch1.pageX - touch2.pageX),
y = Math.abs(touch1.pageY - touch2.pageY);
if(x >= y) {
return touch1.pageX - touch2.pageX > 0 ? Hammer.DIRECTION_LEFT : Hammer.DIRECTION_RIGHT;
}
else {
return touch1.pageY - touch2.pageY > 0 ? Hammer.DIRECTION_UP : Hammer.DIRECTION_DOWN;
}
},
/**
* calculate the distance between two touches
* @param {Touch} touch1
* @param {Touch} touch2
* @returns {Number} distance
*/
getDistance: function getDistance(touch1, touch2) {
var x = touch2.pageX - touch1.pageX,
y = touch2.pageY - touch1.pageY;
return Math.sqrt((x*x) + (y*y));
},
/**
* calculate the scale factor between two touchLists (fingers)
* no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out
* @param {Array} start
* @param {Array} end
* @returns {Number} scale
*/
getScale: function getScale(start, end) {
// need two fingers...
if(start.length >= 2 && end.length >= 2) {
return this.getDistance(end[0], end[1]) /
this.getDistance(start[0], start[1]);
}
return 1;
},
/**
* calculate the rotation degrees between two touchLists (fingers)
* @param {Array} start
* @param {Array} end
* @returns {Number} rotation
*/
getRotation: function getRotation(start, end) {
// need two fingers
if(start.length >= 2 && end.length >= 2) {
return this.getAngle(end[1], end[0]) -
this.getAngle(start[1], start[0]);
}
return 0;
},
/**
* boolean if the direction is vertical
* @param {String} direction
* @returns {Boolean} is_vertical
*/
isVertical: function isVertical(direction) {
return (direction == Hammer.DIRECTION_UP || direction == Hammer.DIRECTION_DOWN);
},
/**
* stop browser default behavior with css props
* @param {HtmlElement} element
* @param {Object} css_props
*/
stopDefaultBrowserBehavior: function stopDefaultBrowserBehavior(element, css_props) {
var prop,
vendors = ['webkit','khtml','moz','ms','o',''];
if(!css_props || !element.style) {
return;
}
// with css properties for modern browsers
for(var i = 0; i < vendors.length; i++) {
for(var p in css_props) {
if(css_props.hasOwnProperty(p)) {
prop = p;
// vender prefix at the property
if(vendors[i]) {
prop = vendors[i] + prop.substring(0, 1).toUpperCase() + prop.substring(1);
}
// set the style
element.style[prop] = css_props[p];
}
}
}
// also the disable onselectstart
if(css_props.userSelect == 'none') {
element.onselectstart = function() {
return false;
};
}
}
};
Hammer.detection = {
// contains all registred Hammer.gestures in the correct order
gestures: [],
// data of the current Hammer.gesture detection session
current: null,
// the previous Hammer.gesture session data
// is a full clone of the previous gesture.current object
previous: null,
// when this becomes true, no gestures are fired
stopped: false,
/**
* start Hammer.gesture detection
* @param {Hammer.Instance} inst
* @param {Object} eventData
*/
startDetect: function startDetect(inst, eventData) {
// already busy with a Hammer.gesture detection on an element
if(this.current) {
return;
}
this.stopped = false;
this.current = {
inst : inst, // reference to HammerInstance we're working for
startEvent : Hammer.utils.extend({}, eventData), // start eventData for distances, timing etc
lastEvent : false, // last eventData
name : '' // current gesture we're in/detected, can be 'tap', 'hold' etc
};
this.detect(eventData);
},
/**
* Hammer.gesture detection
* @param {Object} eventData
* @param {Object} eventData
*/
detect: function detect(eventData) {
if(!this.current || this.stopped) {
return;
}
// extend event data with calculations about scale, distance etc
eventData = this.extendEventData(eventData);
// instance options
var inst_options = this.current.inst.options;
// call Hammer.gesture handlers
for(var g=0,len=this.gestures.length; g<len; g++) {
var gesture = this.gestures[g];
// only when the instance options have enabled this gesture
if(!this.stopped && inst_options[gesture.name] !== false) {
// if a handler returns false, we stop with the detection
if(gesture.handler.call(gesture, eventData, this.current.inst) === false) {
this.stopDetect();
break;
}
}
}
// store as previous event event
if(this.current) {
this.current.lastEvent = eventData;
}
// endevent, but not the last touch, so dont stop
if(eventData.eventType == Hammer.EVENT_END && !eventData.touches.length-1) {
this.stopDetect();
}
return eventData;
},
/**
* clear the Hammer.gesture vars
* this is called on endDetect, but can also be used when a final Hammer.gesture has been detected
* to stop other Hammer.gestures from being fired
*/
stopDetect: function stopDetect() {
// clone current data to the store as the previous gesture
// used for the double tap gesture, since this is an other gesture detect session
this.previous = Hammer.utils.extend({}, this.current);
// reset the current
this.current = null;
// stopped!
this.stopped = true;
},
/**
* extend eventData for Hammer.gestures
* @param {Object} ev
* @returns {Object} ev
*/
extendEventData: function extendEventData(ev) {
var startEv = this.current.startEvent;
// if the touches change, set the new touches over the startEvent touches
// this because touchevents don't have all the touches on touchstart, or the
// user must place his fingers at the EXACT same time on the screen, which is not realistic
// but, sometimes it happens that both fingers are touching at the EXACT same time
if(startEv && (ev.touches.length != startEv.touches.length || ev.touches === startEv.touches)) {
// extend 1 level deep to get the touchlist with the touch objects
startEv.touches = [];
for(var i=0,len=ev.touches.length; i<len; i++) {
startEv.touches.push(Hammer.utils.extend({}, ev.touches[i]));
}
}
var delta_time = ev.timeStamp - startEv.timeStamp,
delta_x = ev.center.pageX - startEv.center.pageX,
delta_y = ev.center.pageY - startEv.center.pageY,
velocity = Hammer.utils.getVelocity(delta_time, delta_x, delta_y);
Hammer.utils.extend(ev, {
deltaTime : delta_time,
deltaX : delta_x,
deltaY : delta_y,
velocityX : velocity.x,
velocityY : velocity.y,
distance : Hammer.utils.getDistance(startEv.center, ev.center),
angle : Hammer.utils.getAngle(startEv.center, ev.center),
direction : Hammer.utils.getDirection(startEv.center, ev.center),
scale : Hammer.utils.getScale(startEv.touches, ev.touches),
rotation : Hammer.utils.getRotation(startEv.touches, ev.touches),
startEvent : startEv
});
return ev;
},
/**
* register new gesture
* @param {Object} gesture object, see gestures.js for documentation
* @returns {Array} gestures
*/
register: function register(gesture) {
// add an enable gesture options if there is no given
var options = gesture.defaults || {};
if(options[gesture.name] === undefined) {
options[gesture.name] = true;
}
// extend Hammer default options with the Hammer.gesture options
Hammer.utils.extend(Hammer.defaults, options, true);
// set its index
gesture.index = gesture.index || 1000;
// add Hammer.gesture to the list
this.gestures.push(gesture);
// sort the list by index
this.gestures.sort(function(a, b) {
if (a.index < b.index) {
return -1;
}
if (a.index > b.index) {
return 1;
}
return 0;
});
return this.gestures;
}
};
Hammer.gestures = Hammer.gestures || {};
/**
* Custom gestures
* ==============================
*
* Gesture object
* --------------------
* The object structure of a gesture:
*
* { name: 'mygesture',
* index: 1337,
* defaults: {
* mygesture_option: true
* }
* handler: function(type, ev, inst) {
* // trigger gesture event
* inst.trigger(this.name, ev);
* }
* }
* @param {String} name
* this should be the name of the gesture, lowercase
* it is also being used to disable/enable the gesture per instance config.
*
* @param {Number} [index=1000]
* the index of the gesture, where it is going to be in the stack of gestures detection
* like when you build an gesture that depends on the drag gesture, it is a good
* idea to place it after the index of the drag gesture.
*
* @param {Object} [defaults={}]
* the default settings of the gesture. these are added to the instance settings,
* and can be overruled per instance. you can also add the name of the gesture,
* but this is also added by default (and set to true).
*
* @param {Function} handler
* this handles the gesture detection of your custom gesture and receives the
* following arguments:
*
* @param {Object} eventData
* event data containing the following properties:
* timeStamp {Number} time the event occurred
* target {HTMLElement} target element
* touches {Array} touches (fingers, pointers, mouse) on the screen
* pointerType {String} kind of pointer that was used. matches Hammer.POINTER_MOUSE|TOUCH
* center {Object} center position of the touches. contains pageX and pageY
* deltaTime {Number} the total time of the touches in the screen
* deltaX {Number} the delta on x axis we haved moved
* deltaY {Number} the delta on y axis we haved moved
* velocityX {Number} the velocity on the x
* velocityY {Number} the velocity on y
* angle {Number} the angle we are moving
* direction {String} the direction we are moving. matches Hammer.DIRECTION_UP|DOWN|LEFT|RIGHT
* distance {Number} the distance we haved moved
* scale {Number} scaling of the touches, needs 2 touches
* rotation {Number} rotation of the touches, needs 2 touches *
* eventType {String} matches Hammer.EVENT_START|MOVE|END
* srcEvent {Object} the source event, like TouchStart or MouseDown *
* startEvent {Object} contains the same properties as above,
* but from the first touch. this is used to calculate
* distances, deltaTime, scaling etc
*
* @param {Hammer.Instance} inst
* the instance we are doing the detection for. you can get the options from
* the inst.options object and trigger the gesture event by calling inst.trigger
*
*
* Handle gestures
* --------------------
* inside the handler you can get/set Hammer.detection.current. This is the current
* detection session. It has the following properties
* @param {String} name
* contains the name of the gesture we have detected. it has not a real function,
* only to check in other gestures if something is detected.
* like in the drag gesture we set it to 'drag' and in the swipe gesture we can
* check if the current gesture is 'drag' by accessing Hammer.detection.current.name
*
* @readonly
* @param {Hammer.Instance} inst
* the instance we do the detection for
*
* @readonly
* @param {Object} startEvent
* contains the properties of the first gesture detection in this session.
* Used for calculations about timing, distance, etc.
*
* @readonly
* @param {Object} lastEvent
* contains all the properties of the last gesture detect in this session.
*
* after the gesture detection session has been completed (user has released the screen)
* the Hammer.detection.current object is copied into Hammer.detection.previous,
* this is usefull for gestures like doubletap, where you need to know if the
* previous gesture was a tap
*
* options that have been set by the instance can be received by calling inst.options
*
* You can trigger a gesture event by calling inst.trigger("mygesture", event).
* The first param is the name of your gesture, the second the event argument
*
*
* Register gestures
* --------------------
* When an gesture is added to the Hammer.gestures object, it is auto registered
* at the setup of the first Hammer instance. You can also call Hammer.detection.register
* manually and pass your gesture object as a param
*
*/
/**
* Hold
* Touch stays at the same place for x time
* @events hold
*/
Hammer.gestures.Hold = {
name: 'hold',
index: 10,
defaults: {
hold_timeout : 500,
hold_threshold : 1
},
timer: null,
handler: function holdGesture(ev, inst) {
switch(ev.eventType) {
case Hammer.EVENT_START:
// clear any running timers
clearTimeout(this.timer);
// set the gesture so we can check in the timeout if it still is
Hammer.detection.current.name = this.name;
// set timer and if after the timeout it still is hold,
// we trigger the hold event
this.timer = setTimeout(function() {
if(Hammer.detection.current.name == 'hold') {
inst.trigger('hold', ev);
}
}, inst.options.hold_timeout);
break;
// when you move or end we clear the timer
case Hammer.EVENT_MOVE:
if(ev.distance > inst.options.hold_threshold) {
clearTimeout(this.timer);
}
break;
case Hammer.EVENT_END:
clearTimeout(this.timer);
break;
}
}
};
/**
* Tap/DoubleTap
* Quick touch at a place or double at the same place
* @events tap, doubletap
*/
Hammer.gestures.Tap = {
name: 'tap',
index: 100,
defaults: {
tap_max_touchtime : 250,
tap_max_distance : 10,
tap_always : true,
doubletap_distance : 20,
doubletap_interval : 300
},
handler: function tapGesture(ev, inst) {
if(ev.eventType == Hammer.EVENT_END) {
// previous gesture, for the double tap since these are two different gesture detections
var prev = Hammer.detection.previous,
did_doubletap = false;
// when the touchtime is higher then the max touch time
// or when the moving distance is too much
if(ev.deltaTime > inst.options.tap_max_touchtime ||
ev.distance > inst.options.tap_max_distance) {
return;
}
// check if double tap
if(prev && prev.name == 'tap' &&
(ev.timeStamp - prev.lastEvent.timeStamp) < inst.options.doubletap_interval &&
ev.distance < inst.options.doubletap_distance) {
inst.trigger('doubletap', ev);
did_doubletap = true;
}
// do a single tap
if(!did_doubletap || inst.options.tap_always) {
Hammer.detection.current.name = 'tap';
inst.trigger(Hammer.detection.current.name, ev);
}
}
}
};
/**
* Swipe
* triggers swipe events when the end velocity is above the threshold
* @events swipe, swipeleft, swiperight, swipeup, swipedown
*/
Hammer.gestures.Swipe = {
name: 'swipe',
index: 40,
defaults: {
// set 0 for unlimited, but this can conflict with transform
swipe_max_touches : 1,
swipe_velocity : 0.7
},
handler: function swipeGesture(ev, inst) {
if(ev.eventType == Hammer.EVENT_END) {
// max touches
if(inst.options.swipe_max_touches > 0 &&
ev.touches.length > inst.options.swipe_max_touches) {
return;
}
// when the distance we moved is too small we skip this gesture
// or we can be already in dragging
if(ev.velocityX > inst.options.swipe_velocity ||
ev.velocityY > inst.options.swipe_velocity) {
// trigger swipe events
inst.trigger(this.name, ev);
inst.trigger(this.name + ev.direction, ev);
}
}
}
};
/**
* Drag
* Move with x fingers (default 1) around on the page. Blocking the scrolling when
* moving left and right is a good practice. When all the drag events are blocking
* you disable scrolling on that area.
* @events drag, drapleft, dragright, dragup, dragdown
*/
Hammer.gestures.Drag = {
name: 'drag',
index: 50,
defaults: {
drag_min_distance : 10,
// set 0 for unlimited, but this can conflict with transform
drag_max_touches : 1,
// prevent default browser behavior when dragging occurs
// be careful with it, it makes the element a blocking element
// when you are using the drag gesture, it is a good practice to set this true
drag_block_horizontal : false,
drag_block_vertical : false,
// drag_lock_to_axis keeps the drag gesture on the axis that it started on,
// It disallows vertical directions if the initial direction was horizontal, and vice versa.
drag_lock_to_axis : false,
// drag lock only kicks in when distance > drag_lock_min_distance
// This way, locking occurs only when the distance has become large enough to reliably determine the direction
drag_lock_min_distance : 25
},
triggered: false,
handler: function dragGesture(ev, inst) {
// current gesture isnt drag, but dragged is true
// this means an other gesture is busy. now call dragend
if(Hammer.detection.current.name != this.name && this.triggered) {
inst.trigger(this.name +'end', ev);
this.triggered = false;
return;
}
// max touches
if(inst.options.drag_max_touches > 0 &&
ev.touches.length > inst.options.drag_max_touches) {
return;
}
switch(ev.eventType) {
case Hammer.EVENT_START:
this.triggered = false;
break;
case Hammer.EVENT_MOVE:
// when the distance we moved is too small we skip this gesture
// or we can be already in dragging
if(ev.distance < inst.options.drag_min_distance &&
Hammer.detection.current.name != this.name) {
return;
}
// we are dragging!
Hammer.detection.current.name = this.name;
// lock drag to axis?
if(Hammer.detection.current.lastEvent.drag_locked_to_axis || (inst.options.drag_lock_to_axis && inst.options.drag_lock_min_distance<=ev.distance)) {
ev.drag_locked_to_axis = true;
}
var last_direction = Hammer.detection.current.lastEvent.direction;
if(ev.drag_locked_to_axis && last_direction !== ev.direction) {
// keep direction on the axis that the drag gesture started on
if(Hammer.utils.isVertical(last_direction)) {
ev.direction = (ev.deltaY < 0) ? Hammer.DIRECTION_UP : Hammer.DIRECTION_DOWN;
}
else {
ev.direction = (ev.deltaX < 0) ? Hammer.DIRECTION_LEFT : Hammer.DIRECTION_RIGHT;
}
}
// first time, trigger dragstart event
if(!this.triggered) {
inst.trigger(this.name +'start', ev);
this.triggered = true;
}
// trigger normal event
inst.trigger(this.name, ev);
// direction event, like dragdown
inst.trigger(this.name + ev.direction, ev);
// block the browser events
if( (inst.options.drag_block_vertical && Hammer.utils.isVertical(ev.direction)) ||
(inst.options.drag_block_horizontal && !Hammer.utils.isVertical(ev.direction))) {
ev.preventDefault();
}
break;
case Hammer.EVENT_END:
// trigger dragend
if(this.triggered) {
inst.trigger(this.name +'end', ev);
}
this.triggered = false;
break;
}
}
};
/**
* Transform
* User want to scale or rotate with 2 fingers
* @events transform, pinch, pinchin, pinchout, rotate
*/
Hammer.gestures.Transform = {
name: 'transform',
index: 45,
defaults: {
// factor, no scale is 1, zoomin is to 0 and zoomout until higher then 1
transform_min_scale : 0.01,
// rotation in degrees
transform_min_rotation : 1,
// prevent default browser behavior when two touches are on the screen
// but it makes the element a blocking element
// when you are using the transform gesture, it is a good practice to set this true
transform_always_block : false
},
triggered: false,
handler: function transformGesture(ev, inst) {
// current gesture isnt drag, but dragged is true
// this means an other gesture is busy. now call dragend
if(Hammer.detection.current.name != this.name && this.triggered) {
inst.trigger(this.name +'end', ev);
this.triggered = false;
return;
}
// atleast multitouch
if(ev.touches.length < 2) {
return;
}
// prevent default when two fingers are on the screen
if(inst.options.transform_always_block) {
ev.preventDefault();
}
switch(ev.eventType) {
case Hammer.EVENT_START:
this.triggered = false;
break;
case Hammer.EVENT_MOVE:
var scale_threshold = Math.abs(1-ev.scale);
var rotation_threshold = Math.abs(ev.rotation);
// when the distance we moved is too small we skip this gesture
// or we can be already in dragging
if(scale_threshold < inst.options.transform_min_scale &&
rotation_threshold < inst.options.transform_min_rotation) {
return;
}
// we are transforming!
Hammer.detection.current.name = this.name;
// first time, trigger dragstart event
if(!this.triggered) {
inst.trigger(this.name +'start', ev);
this.triggered = true;
}
inst.trigger(this.name, ev); // basic transform event
// trigger rotate event
if(rotation_threshold > inst.options.transform_min_rotation) {
inst.trigger('rotate', ev);
}
// trigger pinch event
if(scale_threshold > inst.options.transform_min_scale) {
inst.trigger('pinch', ev);
inst.trigger('pinch'+ ((ev.scale < 1) ? 'in' : 'out'), ev);
}
break;
case Hammer.EVENT_END:
// trigger dragend
if(this.triggered) {
inst.trigger(this.name +'end', ev);
}
this.triggered = false;
break;
}
}
};
/**
* Touch
* Called as first, tells the user has touched the screen
* @events touch
*/
Hammer.gestures.Touch = {
name: 'touch',
index: -Infinity,
defaults: {
// call preventDefault at touchstart, and makes the element blocking by
// disabling the scrolling of the page, but it improves gestures like
// transforming and dragging.
// be careful with using this, it can be very annoying for users to be stuck
// on the page
prevent_default: false,
// disable mouse events, so only touch (or pen!) input triggers events
prevent_mouseevents: false
},
handler: function touchGesture(ev, inst) {
if(inst.options.prevent_mouseevents && ev.pointerType == Hammer.POINTER_MOUSE) {
ev.stopDetect();
return;
}
if(inst.options.prevent_default) {
ev.preventDefault();
}
if(ev.eventType == Hammer.EVENT_START) {
inst.trigger(this.name, ev);
}
}
};
/**
* Release
* Called as last, tells the user has released the screen
* @events release
*/
Hammer.gestures.Release = {
name: 'release',
index: Infinity,
handler: function releaseGesture(ev, inst) {
if(ev.eventType == Hammer.EVENT_END) {
inst.trigger(this.name, ev);
}
}
};
// node export
if(typeof module === 'object' && typeof module.exports === 'object'){
module.exports = Hammer;
}
// just window export
else {
window.Hammer = Hammer;
// requireJS module definition
if(typeof window.define === 'function' && window.define.amd) {
window.define('hammer', [], function() {
return Hammer;
});
}
}
})(this);
},{}],4:[function(require,module,exports){
var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};//! moment.js
//! version : 2.6.0
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
(function (undefined) {
/************************************
Constants
************************************/
var moment,
VERSION = "2.6.0",
// the global-scope this is NOT the global object in Node.js
globalScope = typeof global !== 'undefined' ? global : this,
oldGlobalMoment,
round = Math.round,
i,
YEAR = 0,
MONTH = 1,
DATE = 2,
HOUR = 3,
MINUTE = 4,
SECOND = 5,
MILLISECOND = 6,
// internal storage for language config files
languages = {},
// moment internal properties
momentProperties = {
_isAMomentObject: null,
_i : null,
_f : null,
_l : null,
_strict : null,
_isUTC : null,
_offset : null, // optional. Combine with _isUTC
_pf : null,
_lang : null // optional
},
// check for nodeJS
hasModule = (typeof module !== 'undefined' && module.exports),
// ASP.NET json date format regex
aspNetJsonRegex = /^\/?Date\((\-?\d+)/i,
aspNetTimeSpanJsonRegex = /(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,
// from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
// somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
isoDurationRegex = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,
// format tokens
formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g,
localFormattingTokens = /(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,
// parsing token regexes
parseTokenOneOrTwoDigits = /\d\d?/, // 0 - 99
parseTokenOneToThreeDigits = /\d{1,3}/, // 0 - 999
parseTokenOneToFourDigits = /\d{1,4}/, // 0 - 9999
parseTokenOneToSixDigits = /[+\-]?\d{1,6}/, // -999,999 - 999,999
parseTokenDigits = /\d+/, // nonzero number of digits
parseTokenWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i, // any word (or two) characters or numbers including two/three word month in arabic.
parseTokenTimezone = /Z|[\+\-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z
parseTokenT = /T/i, // T (ISO separator)
parseTokenTimestampMs = /[\+\-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
parseTokenOrdinal = /\d{1,2}/,
//strict parsing regexes
parseTokenOneDigit = /\d/, // 0 - 9
parseTokenTwoDigits = /\d\d/, // 00 - 99
parseTokenThreeDigits = /\d{3}/, // 000 - 999
parseTokenFourDigits = /\d{4}/, // 0000 - 9999
parseTokenSixDigits = /[+-]?\d{6}/, // -999,999 - 999,999
parseTokenSignedNumber = /[+-]?\d+/, // -inf - inf
// iso 8601 regex
// 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
isoRegex = /^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
isoFormat = 'YYYY-MM-DDTHH:mm:ssZ',
isoDates = [
['YYYYYY-MM-DD', /[+-]\d{6}-\d{2}-\d{2}/],
['YYYY-MM-DD', /\d{4}-\d{2}-\d{2}/],
['GGGG-[W]WW-E', /\d{4}-W\d{2}-\d/],
['GGGG-[W]WW', /\d{4}-W\d{2}/],
['YYYY-DDD', /\d{4}-\d{3}/]
],
// iso time formats and regexes
isoTimes = [
['HH:mm:ss.SSSS', /(T| )\d\d:\d\d:\d\d\.\d+/],
['HH:mm:ss', /(T| )\d\d:\d\d:\d\d/],
['HH:mm', /(T| )\d\d:\d\d/],
['HH', /(T| )\d\d/]
],
// timezone chunker "+10:00" > ["10", "00"] or "-1530" > ["-15", "30"]
parseTimezoneChunker = /([\+\-]|\d\d)/gi,
// getter and setter names
proxyGettersAndSetters = 'Date|Hours|Minutes|Seconds|Milliseconds'.split('|'),
unitMillisecondFactors = {
'Milliseconds' : 1,
'Seconds' : 1e3,
'Minutes' : 6e4,
'Hours' : 36e5,
'Days' : 864e5,
'Months' : 2592e6,
'Years' : 31536e6
},
unitAliases = {
ms : 'millisecond',
s : 'second',
m : 'minute',
h : 'hour',
d : 'day',
D : 'date',
w : 'week',
W : 'isoWeek',
M : 'month',
Q : 'quarter',
y : 'year',
DDD : 'dayOfYear',
e : 'weekday',
E : 'isoWeekday',
gg: 'weekYear',
GG: 'isoWeekYear'
},
camelFunctions = {
dayofyear : 'dayOfYear',
isoweekday : 'isoWeekday',
isoweek : 'isoWeek',
weekyear : 'weekYear',
isoweekyear : 'isoWeekYear'
},
// format function strings
formatFunctions = {},
// tokens to ordinalize and pad
ordinalizeTokens = 'DDD w W M D d'.split(' '),
paddedTokens = 'M D H h m s w W'.split(' '),
formatTokenFunctions = {
M : function () {
return this.month() + 1;
},
MMM : function (format) {
return this.lang().monthsShort(this, format);
},
MMMM : function (format) {
return this.lang().months(this, format);
},
D : function () {
return this.date();
},
DDD : function () {
return this.dayOfYear();
},
d : function () {
return this.day();
},
dd : function (format) {
return this.lang().weekdaysMin(this, format);
},
ddd : function (format) {
return this.lang().weekdaysShort(this, format);
},
dddd : function (format) {
return this.lang().weekdays(this, format);
},
w : function () {
return this.week();
},
W : function () {
return this.isoWeek();
},
YY : function () {
return leftZeroFill(this.year() % 100, 2);
},
YYYY : function () {
return leftZeroFill(this.year(), 4);
},
YYYYY : function () {
return leftZeroFill(this.year(), 5);
},
YYYYYY : function () {
var y = this.year(), sign = y >= 0 ? '+' : '-';
return sign + leftZeroFill(Math.abs(y), 6);
},
gg : function () {
return leftZeroFill(this.weekYear() % 100, 2);
},
gggg : function () {
return leftZeroFill(this.weekYear(), 4);
},
ggggg : function () {
return leftZeroFill(this.weekYear(), 5);
},
GG : function () {
return leftZeroFill(this.isoWeekYear() % 100, 2);
},
GGGG : function () {
return leftZeroFill(this.isoWeekYear(), 4);
},
GGGGG : function () {
return leftZeroFill(this.isoWeekYear(), 5);
},
e : function () {
return this.weekday();
},
E : function () {
return this.isoWeekday();
},
a : function () {
return this.lang().meridiem(this.hours(), this.minutes(), true);
},
A : function () {
return this.lang().meridiem(this.hours(), this.minutes(), false);
},
H : function () {
return this.hours();
},
h : function () {
return this.hours() % 12 || 12;
},
m : function () {
return this.minutes();
},
s : function () {
return this.seconds();
},
S : function () {
return toInt(this.milliseconds() / 100);
},
SS : function () {
return leftZeroFill(toInt(this.milliseconds() / 10), 2);
},
SSS : function () {
return leftZeroFill(this.milliseconds(), 3);
},
SSSS : function () {
return leftZeroFill(this.milliseconds(), 3);
},
Z : function () {
var a = -this.zone(),
b = "+";
if (a < 0) {
a = -a;
b = "-";
}
return b + leftZeroFill(toInt(a / 60), 2) + ":" + leftZeroFill(toInt(a) % 60, 2);
},
ZZ : function () {
var a = -this.zone(),
b = "+";
if (a < 0) {
a = -a;
b = "-";
}
return b + leftZeroFill(toInt(a / 60), 2) + leftZeroFill(toInt(a) % 60, 2);
},
z : function () {
return this.zoneAbbr();
},
zz : function () {
return this.zoneName();
},
X : function () {
return this.unix();
},
Q : function () {
return this.quarter();
}
},
lists = ['months', 'monthsShort', 'weekdays', 'weekdaysShort', 'weekdaysMin'];
function defaultParsingFlags() {
// We need to deep clone this object, and es5 standard is not very
// helpful.
return {
empty : false,
unusedTokens : [],
unusedInput : [],
overflow : -2,
charsLeftOver : 0,
nullInput : false,
invalidMonth : null,
invalidFormat : false,
userInvalidated : false,
iso: false
};
}
function deprecate(msg, fn) {
var firstTime = true;
function printMsg() {
if (moment.suppressDeprecationWarnings === false &&
typeof console !== 'undefined' && console.warn) {
console.warn("Deprecation warning: " + msg);
}
}
return extend(function () {
if (firstTime) {
printMsg();
firstTime = false;
}
return fn.apply(this, arguments);
}, fn);
}
function padToken(func, count) {
return function (a) {
return leftZeroFill(func.call(this, a), count);
};
}
function ordinalizeToken(func, period) {
return function (a) {
return this.lang().ordinal(func.call(this, a), period);
};
}
while (ordinalizeTokens.length) {
i = ordinalizeTokens.pop();
formatTokenFunctions[i + 'o'] = ordinalizeToken(formatTokenFunctions[i], i);
}
while (paddedTokens.length) {
i = paddedTokens.pop();
formatTokenFunctions[i + i] = padToken(formatTokenFunctions[i], 2);
}
formatTokenFunctions.DDDD = padToken(formatTokenFunctions.DDD, 3);
/************************************
Constructors
************************************/
function Language() {
}
// Moment prototype object
function Moment(config) {
checkOverflow(config);
extend(this, config);
}
// Duration Constructor
function Duration(duration) {
var normalizedInput = normalizeObjectUnits(duration),
years = normalizedInput.year || 0,
quarters = normalizedInput.quarter || 0,
months = normalizedInput.month || 0,
weeks = normalizedInput.week || 0,
days = normalizedInput.day || 0,
hours = normalizedInput.hour || 0,
minutes = normalizedInput.minute || 0,
seconds = normalizedInput.second || 0,
milliseconds = normalizedInput.millisecond || 0;
// representation for dateAddRemove
this._milliseconds = +milliseconds +
seconds * 1e3 + // 1000
minutes * 6e4 + // 1000 * 60
hours * 36e5; // 1000 * 60 * 60
// Because of dateAddRemove treats 24 hours as different from a
// day when working around DST, we need to store them separately
this._days = +days +
weeks * 7;
// It is impossible translate months into days without knowing
// which months you are are talking about, so we have to store
// it separately.
this._months = +months +
quarters * 3 +
years * 12;
this._data = {};
this._bubble();
}
/************************************
Helpers
************************************/
function extend(a, b) {
for (var i in b) {
if (b.hasOwnProperty(i)) {
a[i] = b[i];
}
}
if (b.hasOwnProperty("toString")) {
a.toString = b.toString;
}
if (b.hasOwnProperty("valueOf")) {
a.valueOf = b.valueOf;
}
return a;
}
function cloneMoment(m) {
var result = {}, i;
for (i in m) {
if (m.hasOwnProperty(i) && momentProperties.hasOwnProperty(i)) {
result[i] = m[i];
}
}
return result;
}
function absRound(number) {
if (number < 0) {
return Math.ceil(number);
} else {
return Math.floor(number);
}
}
// left zero fill a number
// see http://jsperf.com/left-zero-filling for performance comparison
function leftZeroFill(number, targetLength, forceSign) {
var output = '' + Math.abs(number),
sign = number >= 0;
while (output.length < targetLength) {
output = '0' + output;
}
return (sign ? (forceSign ? '+' : '') : '-') + output;
}
// helper function for _.addTime and _.subtractTime
function addOrSubtractDurationFromMoment(mom, duration, isAdding, updateOffset) {
var milliseconds = duration._milliseconds,
days = duration._days,
months = duration._months;
updateOffset = updateOffset == null ? true : updateOffset;
if (milliseconds) {
mom._d.setTime(+mom._d + milliseconds * isAdding);
}
if (days) {
rawSetter(mom, 'Date', rawGetter(mom, 'Date') + days * isAdding);
}
if (months) {
rawMonthSetter(mom, rawGetter(mom, 'Month') + months * isAdding);
}
if (updateOffset) {
moment.updateOffset(mom, days || months);
}
}
// check if is an array
function isArray(input) {
return Object.prototype.toString.call(input) === '[object Array]';
}
function isDate(input) {
return Object.prototype.toString.call(input) === '[object Date]' ||
input instanceof Date;
}
// compare two arrays, return the number of differences
function compareArrays(array1, array2, dontConvert) {
var len = Math.min(array1.length, array2.length),
lengthDiff = Math.abs(array1.length - array2.length),
diffs = 0,
i;
for (i = 0; i < len; i++) {
if ((dontConvert && array1[i] !== array2[i]) ||
(!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
diffs++;
}
}
return diffs + lengthDiff;
}
function normalizeUnits(units) {
if (units) {
var lowered = units.toLowerCase().replace(/(.)s$/, '$1');
units = unitAliases[units] || camelFunctions[lowered] || lowered;
}
return units;
}
function normalizeObjectUnits(inputObject) {
var normalizedInput = {},
normalizedProp,
prop;
for (prop in inputObject) {
if (inputObject.hasOwnProperty(prop)) {
normalizedProp = normalizeUnits(prop);
if (normalizedProp) {
normalizedInput[normalizedProp] = inputObject[prop];
}
}
}
return normalizedInput;
}
function makeList(field) {
var count, setter;
if (field.indexOf('week') === 0) {
count = 7;
setter = 'day';
}
else if (field.indexOf('month') === 0) {
count = 12;
setter = 'month';
}
else {
return;
}
moment[field] = function (format, index) {
var i, getter,
method = moment.fn._lang[field],
results = [];
if (typeof format === 'number') {
index = format;
format = undefined;
}
getter = function (i) {
var m = moment().utc().set(setter, i);
return method.call(moment.fn._lang, m, format || '');
};
if (index != null) {
return getter(index);
}
else {
for (i = 0; i < count; i++) {
results.push(getter(i));
}
return results;
}
};
}
function toInt(argumentForCoercion) {
var coercedNumber = +argumentForCoercion,
value = 0;
if (coercedNumber !== 0 && isFinite(coercedNumber)) {
if (coercedNumber >= 0) {
value = Math.floor(coercedNumber);
} else {
value = Math.ceil(coercedNumber);
}
}
return value;
}
function daysInMonth(year, month) {
return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
}
function weeksInYear(year, dow, doy) {
return weekOfYear(moment([year, 11, 31 + dow - doy]), dow, doy).week;
}
function daysInYear(year) {
return isLeapYear(year) ? 366 : 365;
}
function isLeapYear(year) {
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
}
function checkOverflow(m) {
var overflow;
if (m._a && m._pf.overflow === -2) {
overflow =
m._a[MONTH] < 0 || m._a[MONTH] > 11 ? MONTH :
m._a[DATE] < 1 || m._a[DATE] > daysInMonth(m._a[YEAR], m._a[MONTH]) ? DATE :
m._a[HOUR] < 0 || m._a[HOUR] > 23 ? HOUR :
m._a[MINUTE] < 0 || m._a[MINUTE] > 59 ? MINUTE :
m._a[SECOND] < 0 || m._a[SECOND] > 59 ? SECOND :
m._a[MILLISECOND] < 0 || m._a[MILLISECOND] > 999 ? MILLISECOND :
-1;
if (m._pf._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
overflow = DATE;
}
m._pf.overflow = overflow;
}
}
function isValid(m) {
if (m._isValid == null) {
m._isValid = !isNaN(m._d.getTime()) &&
m._pf.overflow < 0 &&
!m._pf.empty &&
!m._pf.invalidMonth &&
!m._pf.nullInput &&
!m._pf.invalidFormat &&
!m._pf.userInvalidated;
if (m._strict) {
m._isValid = m._isValid &&
m._pf.charsLeftOver === 0 &&
m._pf.unusedTokens.length === 0;
}
}
return m._isValid;
}
function normalizeLanguage(key) {
return key ? key.toLowerCase().replace('_', '-') : key;
}
// Return a moment from input, that is local/utc/zone equivalent to model.
function makeAs(input, model) {
return model._isUTC ? moment(input).zone(model._offset || 0) :
moment(input).local();
}
/************************************
Languages
************************************/
extend(Language.prototype, {
set : function (config) {
var prop, i;
for (i in config) {
prop = config[i];
if (typeof prop === 'function') {
this[i] = prop;
} else {
this['_' + i] = prop;
}
}
},
_months : "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
months : function (m) {
return this._months[m.month()];
},
_monthsShort : "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),
monthsShort : function (m) {
return this._monthsShort[m.month()];
},
monthsParse : function (monthName) {
var i, mom, regex;
if (!this._monthsParse) {
this._monthsParse = [];
}
for (i = 0; i < 12; i++) {
// make the regex if we don't have it already
if (!this._monthsParse[i]) {
mom = moment.utc([2000, i]);
regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
}
// test the regex
if (this._monthsParse[i].test(monthName)) {
return i;
}
}
},
_weekdays : "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
weekdays : function (m) {
return this._weekdays[m.day()];
},
_weekdaysShort : "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),
weekdaysShort : function (m) {
return this._weekdaysShort[m.day()];
},
_weekdaysMin : "Su_Mo_Tu_We_Th_Fr_Sa".split("_"),
weekdaysMin : function (m) {
return this._weekdaysMin[m.day()];
},
weekdaysParse : function (weekdayName) {
var i, mom, regex;
if (!this._weekdaysParse) {
this._weekdaysParse = [];
}
for (i = 0; i < 7; i++) {
// make the regex if we don't have it already
if (!this._weekdaysParse[i]) {
mom = moment([2000, 1]).day(i);
regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
}
// test the regex
if (this._weekdaysParse[i].test(weekdayName)) {
return i;
}
}
},
_longDateFormat : {
LT : "h:mm A",
L : "MM/DD/YYYY",
LL : "MMMM D YYYY",
LLL : "MMMM D YYYY LT",
LLLL : "dddd, MMMM D YYYY LT"
},
longDateFormat : function (key) {
var output = this._longDateFormat[key];
if (!output && this._longDateFormat[key.toUpperCase()]) {
output = this._longDateFormat[key.toUpperCase()].replace(/MMMM|MM|DD|dddd/g, function (val) {
return val.slice(1);
});
this._longDateFormat[key] = output;
}
return output;
},
isPM : function (input) {
// IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
// Using charAt should be more compatible.
return ((input + '').toLowerCase().charAt(0) === 'p');
},
_meridiemParse : /[ap]\.?m?\.?/i,
meridiem : function (hours, minutes, isLower) {
if (hours > 11) {
return isLower ? 'pm' : 'PM';
} else {
return isLower ? 'am' : 'AM';
}
},
_calendar : {
sameDay : '[Today at] LT',
nextDay : '[Tomorrow at] LT',
nextWeek : 'dddd [at] LT',
lastDay : '[Yesterday at] LT',
lastWeek : '[Last] dddd [at] LT',
sameElse : 'L'
},
calendar : function (key, mom) {
var output = this._calendar[key];
return typeof output === 'function' ? output.apply(mom) : output;
},
_relativeTime : {
future : "in %s",
past : "%s ago",
s : "a few seconds",
m : "a minute",
mm : "%d minutes",
h : "an hour",
hh : "%d hours",
d : "a day",
dd : "%d days",
M : "a month",
MM : "%d months",
y : "a year",
yy : "%d years"
},
relativeTime : function (number, withoutSuffix, string, isFuture) {
var output = this._relativeTime[string];
return (typeof output === 'function') ?
output(number, withoutSuffix, string, isFuture) :
output.replace(/%d/i, number);
},
pastFuture : function (diff, output) {
var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
return typeof format === 'function' ? format(output) : format.replace(/%s/i, output);
},
ordinal : function (number) {
return this._ordinal.replace("%d", number);
},
_ordinal : "%d",
preparse : function (string) {
return string;
},
postformat : function (string) {
return string;
},
week : function (mom) {
return weekOfYear(mom, this._week.dow, this._week.doy).week;
},
_week : {
dow : 0, // Sunday is the first day of the week.
doy : 6 // The week that contains Jan 1st is the first week of the year.
},
_invalidDate: 'Invalid date',
invalidDate: function () {
return this._invalidDate;
}
});
// Loads a language definition into the `languages` cache. The function
// takes a key and optionally values. If not in the browser and no values
// are provided, it will load the language file module. As a convenience,
// this function also returns the language values.
function loadLang(key, values) {
values.abbr = key;
if (!languages[key]) {
languages[key] = new Language();
}
languages[key].set(values);
return languages[key];
}
// Remove a language from the `languages` cache. Mostly useful in tests.
function unloadLang(key) {
delete languages[key];
}
// Determines which language definition to use and returns it.
//
// With no parameters, it will return the global language. If you
// pass in a language key, such as 'en', it will return the
// definition for 'en', so long as 'en' has already been loaded using
// moment.lang.
function getLangDefinition(key) {
var i = 0, j, lang, next, split,
get = function (k) {
if (!languages[k] && hasModule) {
try {
require('./lang/' + k);
} catch (e) { }
}
return languages[k];
};
if (!key) {
return moment.fn._lang;
}
if (!isArray(key)) {
//short-circuit everything else
lang = get(key);
if (lang) {
return lang;
}
key = [key];
}
//pick the language from the array
//try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
//substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
while (i < key.length) {
split = normalizeLanguage(key[i]).split('-');
j = split.length;
next = normalizeLanguage(key[i + 1]);
next = next ? next.split('-') : null;
while (j > 0) {
lang = get(split.slice(0, j).join('-'));
if (lang) {
return lang;
}
if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
//the next array item is better than a shallower substring of this one
break;
}
j--;
}
i++;
}
return moment.fn._lang;
}
/************************************
Formatting
************************************/
function removeFormattingTokens(input) {
if (input.match(/\[[\s\S]/)) {
return input.replace(/^\[|\]$/g, "");
}
return input.replace(/\\/g, "");
}
function makeFormatFunction(format) {
var array = format.match(formattingTokens), i, length;
for (i = 0, length = array.length; i < length; i++) {
if (formatTokenFunctions[array[i]]) {
array[i] = formatTokenFunctions[array[i]];
} else {
array[i] = removeFormattingTokens(array[i]);
}
}
return function (mom) {
var output = "";
for (i = 0; i < length; i++) {
output += array[i] instanceof Function ? array[i].call(mom, format) : array[i];
}
return output;
};
}
// format date using native date object
function formatMoment(m, format) {
if (!m.isValid()) {
return m.lang().invalidDate();
}
format = expandFormat(format, m.lang());
if (!formatFunctions[format]) {
formatFunctions[format] = makeFormatFunction(format);
}
return formatFunctions[format](m);
}
function expandFormat(format, lang) {
var i = 5;
function replaceLongDateFormatTokens(input) {
return lang.longDateFormat(input) || input;
}
localFormattingTokens.lastIndex = 0;
while (i >= 0 && localFormattingTokens.test(format)) {
format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
localFormattingTokens.lastIndex = 0;
i -= 1;
}
return format;
}
/************************************
Parsing
************************************/
// get the regex to find the next token
function getParseRegexForToken(token, config) {
var a, strict = config._strict;
switch (token) {
case 'Q':
return parseTokenOneDigit;
case 'DDDD':
return parseTokenThreeDigits;
case 'YYYY':
case 'GGGG':
case 'gggg':
return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;
case 'Y':
case 'G':
case 'g':
return parseTokenSignedNumber;
case 'YYYYYY':
case 'YYYYY':
case 'GGGGG':
case 'ggggg':
return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;
case 'S':
if (strict) { return parseTokenOneDigit; }
/* falls through */
case 'SS':
if (strict) { return parseTokenTwoDigits; }
/* falls through */
case 'SSS':
if (strict) { return parseTokenThreeDigits; }
/* falls through */
case 'DDD':
return parseTokenOneToThreeDigits;
case 'MMM':
case 'MMMM':
case 'dd':
case 'ddd':
case 'dddd':
return parseTokenWord;
case 'a':
case 'A':
return getLangDefinition(config._l)._meridiemParse;
case 'X':
return parseTokenTimestampMs;
case 'Z':
case 'ZZ':
return parseTokenTimezone;
case 'T':
return parseTokenT;
case 'SSSS':
return parseTokenDigits;
case 'MM':
case 'DD':
case 'YY':
case 'GG':
case 'gg':
case 'HH':
case 'hh':
case 'mm':
case 'ss':
case 'ww':
case 'WW':
return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;
case 'M':
case 'D':
case 'd':
case 'H':
case 'h':
case 'm':
case 's':
case 'w':
case 'W':
case 'e':
case 'E':
return parseTokenOneOrTwoDigits;
case 'Do':
return parseTokenOrdinal;
default :
a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\', '')), "i"));
return a;
}
}
function timezoneMinutesFromString(string) {
string = string || "";
var possibleTzMatches = (string.match(parseTokenTimezone) || []),
tzChunk = possibleTzMatches[possibleTzMatches.length - 1] || [],
parts = (tzChunk + '').match(parseTimezoneChunker) || ['-', 0, 0],
minutes = +(parts[1] * 60) + toInt(parts[2]);
return parts[0] === '+' ? -minutes : minutes;
}
// function to convert string input to date
function addTimeToArrayFromToken(token, input, config) {
var a, datePartArray = config._a;
switch (token) {
// QUARTER
case 'Q':
if (input != null) {
datePartArray[MONTH] = (toInt(input) - 1) * 3;
}
break;
// MONTH
case 'M' : // fall through to MM
case 'MM' :
if (input != null) {
datePartArray[MONTH] = toInt(input) - 1;
}
break;
case 'MMM' : // fall through to MMMM
case 'MMMM' :
a = getLangDefinition(config._l).monthsParse(input);
// if we didn't find a month name, mark the date as invalid.
if (a != null) {
datePartArray[MONTH] = a;
} else {
config._pf.invalidMonth = input;
}
break;
// DAY OF MONTH
case 'D' : // fall through to DD
case 'DD' :
if (input != null) {
datePartArray[DATE] = toInt(input);
}
break;
case 'Do' :
if (input != null) {
datePartArray[DATE] = toInt(parseInt(input, 10));
}
break;
// DAY OF YEAR
case 'DDD' : // fall through to DDDD
case 'DDDD' :
if (input != null) {
config._dayOfYear = toInt(input);
}
break;
// YEAR
case 'YY' :
datePartArray[YEAR] = moment.parseTwoDigitYear(input);
break;
case 'YYYY' :
case 'YYYYY' :
case 'YYYYYY' :
datePartArray[YEAR] = toInt(input);
break;
// AM / PM
case 'a' : // fall through to A
case 'A' :
config._isPm = getLangDefinition(config._l).isPM(input);
break;
// 24 HOUR
case 'H' : // fall through to hh
case 'HH' : // fall through to hh
case 'h' : // fall through to hh
case 'hh' :
datePartArray[HOUR] = toInt(input);
break;
// MINUTE
case 'm' : // fall through to mm
case 'mm' :
datePartArray[MINUTE] = toInt(input);
break;
// SECOND
case 's' : // fall through to ss
case 'ss' :
datePartArray[SECOND] = toInt(input);
break;
// MILLISECOND
case 'S' :
case 'SS' :
case 'SSS' :
case 'SSSS' :
datePartArray[MILLISECOND] = toInt(('0.' + input) * 1000);
break;
// UNIX TIMESTAMP WITH MS
case 'X':
config._d = new Date(parseFloat(input) * 1000);
break;
// TIMEZONE
case 'Z' : // fall through to ZZ
case 'ZZ' :
config._useUTC = true;
config._tzm = timezoneMinutesFromString(input);
break;
case 'w':
case 'ww':
case 'W':
case 'WW':
case 'd':
case 'dd':
case 'ddd':
case 'dddd':
case 'e':
case 'E':
token = token.substr(0, 1);
/* falls through */
case 'gg':
case 'gggg':
case 'GG':
case 'GGGG':
case 'GGGGG':
token = token.substr(0, 2);
if (input) {
config._w = config._w || {};
config._w[token] = input;
}
break;
}
}
// convert an array to a date.
// the array should mirror the parameters below
// note: all values past the year are optional and will default to the lowest possible value.
// [year, month, day , hour, minute, second, millisecond]
function dateFromConfig(config) {
var i, date, input = [], currentDate,
yearToUse, fixYear, w, temp, lang, weekday, week;
if (config._d) {
return;
}
currentDate = currentDateArray(config);
//compute day of the year from weeks and weekdays
if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
fixYear = function (val) {
var intVal = parseInt(val, 10);
return val ?
(val.length < 3 ? (intVal > 68 ? 1900 + intVal : 2000 + intVal) : intVal) :
(config._a[YEAR] == null ? moment().weekYear() : config._a[YEAR]);
};
w = config._w;
if (w.GG != null || w.W != null || w.E != null) {
temp = dayOfYearFromWeeks(fixYear(w.GG), w.W || 1, w.E, 4, 1);
}
else {
lang = getLangDefinition(config._l);
weekday = w.d != null ? parseWeekday(w.d, lang) :
(w.e != null ? parseInt(w.e, 10) + lang._week.dow : 0);
week = parseInt(w.w, 10) || 1;
//if we're parsing 'd', then the low day numbers may be next week
if (w.d != null && weekday < lang._week.dow) {
week++;
}
temp = dayOfYearFromWeeks(fixYear(w.gg), week, weekday, lang._week.doy, lang._week.dow);
}
config._a[YEAR] = temp.year;
config._dayOfYear = temp.dayOfYear;
}
//if the day of the year is set, figure out what it is
if (config._dayOfYear) {
yearToUse = config._a[YEAR] == null ? currentDate[YEAR] : config._a[YEAR];
if (config._dayOfYear > daysInYear(yearToUse)) {
config._pf._overflowDayOfYear = true;
}
date = makeUTCDate(yearToUse, 0, config._dayOfYear);
config._a[MONTH] = date.getUTCMonth();
config._a[DATE] = date.getUTCDate();
}
// Default to current date.
// * if no year, month, day of month are given, default to today
// * if day of month is given, default month and year
// * if month is given, default only year
// * if year is given, don't default anything
for (i = 0; i < 3 && config._a[i] == null; ++i) {
config._a[i] = input[i] = currentDate[i];
}
// Zero out whatever was not defaulted, including time
for (; i < 7; i++) {
config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
}
// add the offsets to the time to be parsed so that we can have a clean array for checking isValid
input[HOUR] += toInt((config._tzm || 0) / 60);
input[MINUTE] += toInt((config._tzm || 0) % 60);
config._d = (config._useUTC ? makeUTCDate : makeDate).apply(null, input);
}
function dateFromObject(config) {
var normalizedInput;
if (config._d) {
return;
}
normalizedInput = normalizeObjectUnits(config._i);
config._a = [
normalizedInput.year,
normalizedInput.month,
normalizedInput.day,
normalizedInput.hour,
normalizedInput.minute,
normalizedInput.second,
normalizedInput.millisecond
];
dateFromConfig(config);
}
function currentDateArray(config) {
var now = new Date();
if (config._useUTC) {
return [
now.getUTCFullYear(),
now.getUTCMonth(),
now.getUTCDate()
];
} else {
return [now.getFullYear(), now.getMonth(), now.getDate()];
}
}
// date from string and format string
function makeDateFromStringAndFormat(config) {
config._a = [];
config._pf.empty = true;
// This array is used to make a Date, either with `new Date` or `Date.UTC`
var lang = getLangDefinition(config._l),
string = '' + config._i,
i, parsedInput, tokens, token, skipped,
stringLength = string.length,
totalParsedInputLength = 0;
tokens = expandFormat(config._f, lang).match(formattingTokens) || [];
for (i = 0; i < tokens.length; i++) {
token = tokens[i];
parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
if (parsedInput) {
skipped = string.substr(0, string.indexOf(parsedInput));
if (skipped.length > 0) {
config._pf.unusedInput.push(skipped);
}
string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
totalParsedInputLength += parsedInput.length;
}
// don't parse if it's not a known token
if (formatTokenFunctions[token]) {
if (parsedInput) {
config._pf.empty = false;
}
else {
config._pf.unusedTokens.push(token);
}
addTimeToArrayFromToken(token, parsedInput, config);
}
else if (config._strict && !parsedInput) {
config._pf.unusedTokens.push(token);
}
}
// add remaining unparsed input length to the string
config._pf.charsLeftOver = stringLength - totalParsedInputLength;
if (string.length > 0) {
config._pf.unusedInput.push(string);
}
// handle am pm
if (config._isPm && config._a[HOUR] < 12) {
config._a[HOUR] += 12;
}
// if is 12 am, change hours to 0
if (config._isPm === false && config._a[HOUR] === 12) {
config._a[HOUR] = 0;
}
dateFromConfig(config);
checkOverflow(config);
}
function unescapeFormat(s) {
return s.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
return p1 || p2 || p3 || p4;
});
}
// Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
function regexpEscape(s) {
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
}
// date from string and array of format strings
function makeDateFromStringAndArray(config) {
var tempConfig,
bestMoment,
scoreToBeat,
i,
currentScore;
if (config._f.length === 0) {
config._pf.invalidFormat = true;
config._d = new Date(NaN);
return;
}
for (i = 0; i < config._f.length; i++) {
currentScore = 0;
tempConfig = extend({}, config);
tempConfig._pf = defaultParsingFlags();
tempConfig._f = config._f[i];
makeDateFromStringAndFormat(tempConfig);
if (!isValid(tempConfig)) {
continue;
}
// if there is any input that was not parsed add a penalty for that format
currentScore += tempConfig._pf.charsLeftOver;
//or tokens
currentScore += tempConfig._pf.unusedTokens.length * 10;
tempConfig._pf.score = currentScore;
if (scoreToBeat == null || currentScore < scoreToBeat) {
scoreToBeat = currentScore;
bestMoment = tempConfig;
}
}
extend(config, bestMoment || tempConfig);
}
// date from iso format
function makeDateFromString(config) {
var i, l,
string = config._i,
match = isoRegex.exec(string);
if (match) {
config._pf.iso = true;
for (i = 0, l = isoDates.length; i < l; i++) {
if (isoDates[i][1].exec(string)) {
// match[5] should be "T" or undefined
config._f = isoDates[i][0] + (match[6] || " ");
break;
}
}
for (i = 0, l = isoTimes.length; i < l; i++) {
if (isoTimes[i][1].exec(string)) {
config._f += isoTimes[i][0];
break;
}
}
if (string.match(parseTokenTimezone)) {
config._f += "Z";
}
makeDateFromStringAndFormat(config);
}
else {
moment.createFromInputFallback(config);
}
}
function makeDateFromInput(config) {
var input = config._i,
matched = aspNetJsonRegex.exec(input);
if (input === undefined) {
config._d = new Date();
} else if (matched) {
config._d = new Date(+matched[1]);
} else if (typeof input === 'string') {
makeDateFromString(config);
} else if (isArray(input)) {
config._a = input.slice(0);
dateFromConfig(config);
} else if (isDate(input)) {
config._d = new Date(+input);
} else if (typeof(input) === 'object') {
dateFromObject(config);
} else if (typeof(input) === 'number') {
// from milliseconds
config._d = new Date(input);
} else {
moment.createFromInputFallback(config);
}
}
function makeDate(y, m, d, h, M, s, ms) {
//can't just apply() to create a date:
//http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
var date = new Date(y, m, d, h, M, s, ms);
//the date constructor doesn't accept years < 1970
if (y < 1970) {
date.setFullYear(y);
}
return date;
}
function makeUTCDate(y) {
var date = new Date(Date.UTC.apply(null, arguments));
if (y < 1970) {
date.setUTCFullYear(y);
}
return date;
}
function parseWeekday(input, language) {
if (typeof input === 'string') {
if (!isNaN(input)) {
input = parseInt(input, 10);
}
else {
input = language.weekdaysParse(input);
if (typeof input !== 'number') {
return null;
}
}
}
return input;
}
/************************************
Relative Time
************************************/
// helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
function substituteTimeAgo(string, number, withoutSuffix, isFuture, lang) {
return lang.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
}
function relativeTime(milliseconds, withoutSuffix, lang) {
var seconds = round(Math.abs(milliseconds) / 1000),
minutes = round(seconds / 60),
hours = round(minutes / 60),
days = round(hours / 24),
years = round(days / 365),
args = seconds < 45 && ['s', seconds] ||
minutes === 1 && ['m'] ||
minutes < 45 && ['mm', minutes] ||
hours === 1 && ['h'] ||
hours < 22 && ['hh', hours] ||
days === 1 && ['d'] ||
days <= 25 && ['dd', days] ||
days <= 45 && ['M'] ||
days < 345 && ['MM', round(days / 30)] ||
years === 1 && ['y'] || ['yy', years];
args[2] = withoutSuffix;
args[3] = milliseconds > 0;
args[4] = lang;
return substituteTimeAgo.apply({}, args);
}
/************************************
Week of Year
************************************/
// firstDayOfWeek 0 = sun, 6 = sat
// the day of the week that starts the week
// (usually sunday or monday)
// firstDayOfWeekOfYear 0 = sun, 6 = sat
// the first week is the week that contains the first
// of this day of the week
// (eg. ISO weeks use thursday (4))
function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {
var end = firstDayOfWeekOfYear - firstDayOfWeek,
daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),
adjustedMoment;
if (daysToDayOfWeek > end) {
daysToDayOfWeek -= 7;
}
if (daysToDayOfWeek < end - 7) {
daysToDayOfWeek += 7;
}
adjustedMoment = moment(mom).add('d', daysToDayOfWeek);
return {
week: Math.ceil(adjustedMoment.dayOfYear() / 7),
year: adjustedMoment.year()
};
}
//http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
function dayOfYearFromWeeks(year, week, weekday, firstDayOfWeekOfYear, firstDayOfWeek) {
var d = makeUTCDate(year, 0, 1).getUTCDay(), daysToAdd, dayOfYear;
weekday = weekday != null ? weekday : firstDayOfWeek;
daysToAdd = firstDayOfWeek - d + (d > firstDayOfWeekOfYear ? 7 : 0) - (d < firstDayOfWeek ? 7 : 0);
dayOfYear = 7 * (week - 1) + (weekday - firstDayOfWeek) + daysToAdd + 1;
return {
year: dayOfYear > 0 ? year : year - 1,
dayOfYear: dayOfYear > 0 ? dayOfYear : daysInYear(year - 1) + dayOfYear
};
}
/************************************
Top Level Functions
************************************/
function makeMoment(config) {
var input = config._i,
format = config._f;
if (input === null || (format === undefined && input === '')) {
return moment.invalid({nullInput: true});
}
if (typeof input === 'string') {
config._i = input = getLangDefinition().preparse(input);
}
if (moment.isMoment(input)) {
config = cloneMoment(input);
config._d = new Date(+input._d);
} else if (format) {
if (isArray(format)) {
makeDateFromStringAndArray(config);
} else {
makeDateFromStringAndFormat(config);
}
} else {
makeDateFromInput(config);
}
return new Moment(config);
}
moment = function (input, format, lang, strict) {
var c;
if (typeof(lang) === "boolean") {
strict = lang;
lang = undefined;
}
// object construction must be done this way.
// https://github.com/moment/moment/issues/1423
c = {};
c._isAMomentObject = true;
c._i = input;
c._f = format;
c._l = lang;
c._strict = strict;
c._isUTC = false;
c._pf = defaultParsingFlags();
return makeMoment(c);
};
moment.suppressDeprecationWarnings = false;
moment.createFromInputFallback = deprecate(
"moment construction falls back to js Date. This is " +
"discouraged and will be removed in upcoming major " +
"release. Please refer to " +
"https://github.com/moment/moment/issues/1407 for more info.",
function (config) {
config._d = new Date(config._i);
});
// creating with utc
moment.utc = function (input, format, lang, strict) {
var c;
if (typeof(lang) === "boolean") {
strict = lang;
lang = undefined;
}
// object construction must be done this way.
// https://github.com/moment/moment/issues/1423
c = {};
c._isAMomentObject = true;
c._useUTC = true;
c._isUTC = true;
c._l = lang;
c._i = input;
c._f = format;
c._strict = strict;
c._pf = defaultParsingFlags();
return makeMoment(c).utc();
};
// creating with unix timestamp (in seconds)
moment.unix = function (input) {
return moment(input * 1000);
};
// duration
moment.duration = function (input, key) {
var duration = input,
// matching against regexp is expensive, do it on demand
match = null,
sign,
ret,
parseIso;
if (moment.isDuration(input)) {
duration = {
ms: input._milliseconds,
d: input._days,
M: input._months
};
} else if (typeof input === 'number') {
duration = {};
if (key) {
duration[key] = input;
} else {
duration.milliseconds = input;
}
} else if (!!(match = aspNetTimeSpanJsonRegex.exec(input))) {
sign = (match[1] === "-") ? -1 : 1;
duration = {
y: 0,
d: toInt(match[DATE]) * sign,
h: toInt(match[HOUR]) * sign,
m: toInt(match[MINUTE]) * sign,
s: toInt(match[SECOND]) * sign,
ms: toInt(match[MILLISECOND]) * sign
};
} else if (!!(match = isoDurationRegex.exec(input))) {
sign = (match[1] === "-") ? -1 : 1;
parseIso = function (inp) {
// We'd normally use ~~inp for this, but unfortunately it also
// converts floats to ints.
// inp may be undefined, so careful calling replace on it.
var res = inp && parseFloat(inp.replace(',', '.'));
// apply sign while we're at it
return (isNaN(res) ? 0 : res) * sign;
};
duration = {
y: parseIso(match[2]),
M: parseIso(match[3]),
d: parseIso(match[4]),
h: parseIso(match[5]),
m: parseIso(match[6]),
s: parseIso(match[7]),
w: parseIso(match[8])
};
}
ret = new Duration(duration);
if (moment.isDuration(input) && input.hasOwnProperty('_lang')) {
ret._lang = input._lang;
}
return ret;
};
// version number
moment.version = VERSION;
// default format
moment.defaultFormat = isoFormat;
// Plugins that add properties should also add the key here (null value),
// so we can properly clone ourselves.
moment.momentProperties = momentProperties;
// This function will be called whenever a moment is mutated.
// It is intended to keep the offset in sync with the timezone.
moment.updateOffset = function () {};
// This function will load languages and then set the global language. If
// no arguments are passed in, it will simply return the current global
// language key.
moment.lang = function (key, values) {
var r;
if (!key) {
return moment.fn._lang._abbr;
}
if (values) {
loadLang(normalizeLanguage(key), values);
} else if (values === null) {
unloadLang(key);
key = 'en';
} else if (!languages[key]) {
getLangDefinition(key);
}
r = moment.duration.fn._lang = moment.fn._lang = getLangDefinition(key);
return r._abbr;
};
// returns language data
moment.langData = function (key) {
if (key && key._lang && key._lang._abbr) {
key = key._lang._abbr;
}
return getLangDefinition(key);
};
// compare moment object
moment.isMoment = function (obj) {
return obj instanceof Moment ||
(obj != null && obj.hasOwnProperty('_isAMomentObject'));
};
// for typechecking Duration objects
moment.isDuration = function (obj) {
return obj instanceof Duration;
};
for (i = lists.length - 1; i >= 0; --i) {
makeList(lists[i]);
}
moment.normalizeUnits = function (units) {
return normalizeUnits(units);
};
moment.invalid = function (flags) {
var m = moment.utc(NaN);
if (flags != null) {
extend(m._pf, flags);
}
else {
m._pf.userInvalidated = true;
}
return m;
};
moment.parseZone = function () {
return moment.apply(null, arguments).parseZone();
};
moment.parseTwoDigitYear = function (input) {
return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
};
/************************************
Moment Prototype
************************************/
extend(moment.fn = Moment.prototype, {
clone : function () {
return moment(this);
},
valueOf : function () {
return +this._d + ((this._offset || 0) * 60000);
},
unix : function () {
return Math.floor(+this / 1000);
},
toString : function () {
return this.clone().lang('en').format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ");
},
toDate : function () {
return this._offset ? new Date(+this) : this._d;
},
toISOString : function () {
var m = moment(this).utc();
if (0 < m.year() && m.year() <= 9999) {
return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
} else {
return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
}
},
toArray : function () {
var m = this;
return [
m.year(),
m.month(),
m.date(),
m.hours(),
m.minutes(),
m.seconds(),
m.milliseconds()
];
},
isValid : function () {
return isValid(this);
},
isDSTShifted : function () {
if (this._a) {
return this.isValid() && compareArrays(this._a, (this._isUTC ? moment.utc(this._a) : moment(this._a)).toArray()) > 0;
}
return false;
},
parsingFlags : function () {
return extend({}, this._pf);
},
invalidAt: function () {
return this._pf.overflow;
},
utc : function () {
return this.zone(0);
},
local : function () {
this.zone(0);
this._isUTC = false;
return this;
},
format : function (inputString) {
var output = formatMoment(this, inputString || moment.defaultFormat);
return this.lang().postformat(output);
},
add : function (input, val) {
var dur;
// switch args to support add('s', 1) and add(1, 's')
if (typeof input === 'string') {
dur = moment.duration(+val, input);
} else {
dur = moment.duration(input, val);
}
addOrSubtractDurationFromMoment(this, dur, 1);
return this;
},
subtract : function (input, val) {
var dur;
// switch args to support subtract('s', 1) and subtract(1, 's')
if (typeof input === 'string') {
dur = moment.duration(+val, input);
} else {
dur = moment.duration(input, val);
}
addOrSubtractDurationFromMoment(this, dur, -1);
return this;
},
diff : function (input, units, asFloat) {
var that = makeAs(input, this),
zoneDiff = (this.zone() - that.zone()) * 6e4,
diff, output;
units = normalizeUnits(units);
if (units === 'year' || units === 'month') {
// average number of days in the months in the given dates
diff = (this.daysInMonth() + that.daysInMonth()) * 432e5; // 24 * 60 * 60 * 1000 / 2
// difference in months
output = ((this.year() - that.year()) * 12) + (this.month() - that.month());
// adjust by taking difference in days, average number of days
// and dst in the given months.
output += ((this - moment(this).startOf('month')) -
(that - moment(that).startOf('month'))) / diff;
// same as above but with zones, to negate all dst
output -= ((this.zone() - moment(this).startOf('month').zone()) -
(that.zone() - moment(that).startOf('month').zone())) * 6e4 / diff;
if (units === 'year') {
output = output / 12;
}
} else {
diff = (this - that);
output = units === 'second' ? diff / 1e3 : // 1000
units === 'minute' ? diff / 6e4 : // 1000 * 60
units === 'hour' ? diff / 36e5 : // 1000 * 60 * 60
units === 'day' ? (diff - zoneDiff) / 864e5 : // 1000 * 60 * 60 * 24, negate dst
units === 'week' ? (diff - zoneDiff) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst
diff;
}
return asFloat ? output : absRound(output);
},
from : function (time, withoutSuffix) {
return moment.duration(this.diff(time)).lang(this.lang()._abbr).humanize(!withoutSuffix);
},
fromNow : function (withoutSuffix) {
return this.from(moment(), withoutSuffix);
},
calendar : function () {
// We want to compare the start of today, vs this.
// Getting start-of-today depends on whether we're zone'd or not.
var sod = makeAs(moment(), this).startOf('day'),
diff = this.diff(sod, 'days', true),
format = diff < -6 ? 'sameElse' :
diff < -1 ? 'lastWeek' :
diff < 0 ? 'lastDay' :
diff < 1 ? 'sameDay' :
diff < 2 ? 'nextDay' :
diff < 7 ? 'nextWeek' : 'sameElse';
return this.format(this.lang().calendar(format, this));
},
isLeapYear : function () {
return isLeapYear(this.year());
},
isDST : function () {
return (this.zone() < this.clone().month(0).zone() ||
this.zone() < this.clone().month(5).zone());
},
day : function (input) {
var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
if (input != null) {
input = parseWeekday(input, this.lang());
return this.add({ d : input - day });
} else {
return day;
}
},
month : makeAccessor('Month', true),
startOf: function (units) {
units = normalizeUnits(units);
// the following switch intentionally omits break keywords
// to utilize falling through the cases.
switch (units) {
case 'year':
this.month(0);
/* falls through */
case 'quarter':
case 'month':
this.date(1);
/* falls through */
case 'week':
case 'isoWeek':
case 'day':
this.hours(0);
/* falls through */
case 'hour':
this.minutes(0);
/* falls through */
case 'minute':
this.seconds(0);
/* falls through */
case 'second':
this.milliseconds(0);
/* falls through */
}
// weeks are a special case
if (units === 'week') {
this.weekday(0);
} else if (units === 'isoWeek') {
this.isoWeekday(1);
}
// quarters are also special
if (units === 'quarter') {
this.month(Math.floor(this.month() / 3) * 3);
}
return this;
},
endOf: function (units) {
units = normalizeUnits(units);
return this.startOf(units).add((units === 'isoWeek' ? 'week' : units), 1).subtract('ms', 1);
},
isAfter: function (input, units) {
units = typeof units !== 'undefined' ? units : 'millisecond';
return +this.clone().startOf(units) > +moment(input).startOf(units);
},
isBefore: function (input, units) {
units = typeof units !== 'undefined' ? units : 'millisecond';
return +this.clone().startOf(units) < +moment(input).startOf(units);
},
isSame: function (input, units) {
units = units || 'ms';
return +this.clone().startOf(units) === +makeAs(input, this).startOf(units);
},
min: function (other) {
other = moment.apply(null, arguments);
return other < this ? this : other;
},
max: function (other) {
other = moment.apply(null, arguments);
return other > this ? this : other;
},
// keepTime = true means only change the timezone, without affecting
// the local hour. So 5:31:26 +0300 --[zone(2, true)]--> 5:31:26 +0200
// It is possible that 5:31:26 doesn't exist int zone +0200, so we
// adjust the time as needed, to be valid.
//
// Keeping the time actually adds/subtracts (one hour)
// from the actual represented time. That is why we call updateOffset
// a second time. In case it wants us to change the offset again
// _changeInProgress == true case, then we have to adjust, because
// there is no such time in the given timezone.
zone : function (input, keepTime) {
var offset = this._offset || 0;
if (input != null) {
if (typeof input === "string") {
input = timezoneMinutesFromString(input);
}
if (Math.abs(input) < 16) {
input = input * 60;
}
this._offset = input;
this._isUTC = true;
if (offset !== input) {
if (!keepTime || this._changeInProgress) {
addOrSubtractDurationFromMoment(this,
moment.duration(offset - input, 'm'), 1, false);
} else if (!this._changeInProgress) {
this._changeInProgress = true;
moment.updateOffset(this, true);
this._changeInProgress = null;
}
}
} else {
return this._isUTC ? offset : this._d.getTimezoneOffset();
}
return this;
},
zoneAbbr : function () {
return this._isUTC ? "UTC" : "";
},
zoneName : function () {
return this._isUTC ? "Coordinated Universal Time" : "";
},
parseZone : function () {
if (this._tzm) {
this.zone(this._tzm);
} else if (typeof this._i === 'string') {
this.zone(this._i);
}
return this;
},
hasAlignedHourOffset : function (input) {
if (!input) {
input = 0;
}
else {
input = moment(input).zone();
}
return (this.zone() - input) % 60 === 0;
},
daysInMonth : function () {
return daysInMonth(this.year(), this.month());
},
dayOfYear : function (input) {
var dayOfYear = round((moment(this).startOf('day') - moment(this).startOf('year')) / 864e5) + 1;
return input == null ? dayOfYear : this.add("d", (input - dayOfYear));
},
quarter : function (input) {
return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
},
weekYear : function (input) {
var year = weekOfYear(this, this.lang()._week.dow, this.lang()._week.doy).year;
return input == null ? year : this.add("y", (input - year));
},
isoWeekYear : function (input) {
var year = weekOfYear(this, 1, 4).year;
return input == null ? year : this.add("y", (input - year));
},
week : function (input) {
var week = this.lang().week(this);
return input == null ? week : this.add("d", (input - week) * 7);
},
isoWeek : function (input) {
var week = weekOfYear(this, 1, 4).week;
return input == null ? week : this.add("d", (input - week) * 7);
},
weekday : function (input) {
var weekday = (this.day() + 7 - this.lang()._week.dow) % 7;
return input == null ? weekday : this.add("d", input - weekday);
},
isoWeekday : function (input) {
// behaves the same as moment#day except
// as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
// as a setter, sunday should belong to the previous week.
return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7);
},
isoWeeksInYear : function () {
return weeksInYear(this.year(), 1, 4);
},
weeksInYear : function () {
var weekInfo = this._lang._week;
return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
},
get : function (units) {
units = normalizeUnits(units);
return this[units]();
},
set : function (units, value) {
units = normalizeUnits(units);
if (typeof this[units] === 'function') {
this[units](value);
}
return this;
},
// If passed a language key, it will set the language for this
// instance. Otherwise, it will return the language configuration
// variables for this instance.
lang : function (key) {
if (key === undefined) {
return this._lang;
} else {
this._lang = getLangDefinition(key);
return this;
}
}
});
function rawMonthSetter(mom, value) {
var dayOfMonth;
// TODO: Move this out of here!
if (typeof value === 'string') {
value = mom.lang().monthsParse(value);
// TODO: Another silent failure?
if (typeof value !== 'number') {
return mom;
}
}
dayOfMonth = Math.min(mom.date(),
daysInMonth(mom.year(), value));
mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
return mom;
}
function rawGetter(mom, unit) {
return mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]();
}
function rawSetter(mom, unit, value) {
if (unit === 'Month') {
return rawMonthSetter(mom, value);
} else {
return mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
}
}
function makeAccessor(unit, keepTime) {
return function (value) {
if (value != null) {
rawSetter(this, unit, value);
moment.updateOffset(this, keepTime);
return this;
} else {
return rawGetter(this, unit);
}
};
}
moment.fn.millisecond = moment.fn.milliseconds = makeAccessor('Milliseconds', false);
moment.fn.second = moment.fn.seconds = makeAccessor('Seconds', false);
moment.fn.minute = moment.fn.minutes = makeAccessor('Minutes', false);
// Setting the hour should keep the time, because the user explicitly
// specified which hour he wants. So trying to maintain the same hour (in
// a new timezone) makes sense. Adding/subtracting hours does not follow
// this rule.
moment.fn.hour = moment.fn.hours = makeAccessor('Hours', true);
// moment.fn.month is defined separately
moment.fn.date = makeAccessor('Date', true);
moment.fn.dates = deprecate("dates accessor is deprecated. Use date instead.", makeAccessor('Date', true));
moment.fn.year = makeAccessor('FullYear', true);
moment.fn.years = deprecate("years accessor is deprecated. Use year instead.", makeAccessor('FullYear', true));
// add plural methods
moment.fn.days = moment.fn.day;
moment.fn.months = moment.fn.month;
moment.fn.weeks = moment.fn.week;
moment.fn.isoWeeks = moment.fn.isoWeek;
moment.fn.quarters = moment.fn.quarter;
// add aliased format methods
moment.fn.toJSON = moment.fn.toISOString;
/************************************
Duration Prototype
************************************/
extend(moment.duration.fn = Duration.prototype, {
_bubble : function () {
var milliseconds = this._milliseconds,
days = this._days,
months = this._months,
data = this._data,
seconds, minutes, hours, years;
// The following code bubbles up values, see the tests for
// examples of what that means.
data.milliseconds = milliseconds % 1000;
seconds = absRound(milliseconds / 1000);
data.seconds = seconds % 60;
minutes = absRound(seconds / 60);
data.minutes = minutes % 60;
hours = absRound(minutes / 60);
data.hours = hours % 24;
days += absRound(hours / 24);
data.days = days % 30;
months += absRound(days / 30);
data.months = months % 12;
years = absRound(months / 12);
data.years = years;
},
weeks : function () {
return absRound(this.days() / 7);
},
valueOf : function () {
return this._milliseconds +
this._days * 864e5 +
(this._months % 12) * 2592e6 +
toInt(this._months / 12) * 31536e6;
},
humanize : function (withSuffix) {
var difference = +this,
output = relativeTime(difference, !withSuffix, this.lang());
if (withSuffix) {
output = this.lang().pastFuture(difference, output);
}
return this.lang().postformat(output);
},
add : function (input, val) {
// supports only 2.0-style add(1, 's') or add(moment)
var dur = moment.duration(input, val);
this._milliseconds += dur._milliseconds;
this._days += dur._days;
this._months += dur._months;
this._bubble();
return this;
},
subtract : function (input, val) {
var dur = moment.duration(input, val);
this._milliseconds -= dur._milliseconds;
this._days -= dur._days;
this._months -= dur._months;
this._bubble();
return this;
},
get : function (units) {
units = normalizeUnits(units);
return this[units.toLowerCase() + 's']();
},
as : function (units) {
units = normalizeUnits(units);
return this['as' + units.charAt(0).toUpperCase() + units.slice(1) + 's']();
},
lang : moment.fn.lang,
toIsoString : function () {
// inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
var years = Math.abs(this.years()),
months = Math.abs(this.months()),
days = Math.abs(this.days()),
hours = Math.abs(this.hours()),
minutes = Math.abs(this.minutes()),
seconds = Math.abs(this.seconds() + this.milliseconds() / 1000);
if (!this.asSeconds()) {
// this is the same as C#'s (Noda) and python (isodate)...
// but not other JS (goog.date)
return 'P0D';
}
return (this.asSeconds() < 0 ? '-' : '') +
'P' +
(years ? years + 'Y' : '') +
(months ? months + 'M' : '') +
(days ? days + 'D' : '') +
((hours || minutes || seconds) ? 'T' : '') +
(hours ? hours + 'H' : '') +
(minutes ? minutes + 'M' : '') +
(seconds ? seconds + 'S' : '');
}
});
function makeDurationGetter(name) {
moment.duration.fn[name] = function () {
return this._data[name];
};
}
function makeDurationAsGetter(name, factor) {
moment.duration.fn['as' + name] = function () {
return +this / factor;
};
}
for (i in unitMillisecondFactors) {
if (unitMillisecondFactors.hasOwnProperty(i)) {
makeDurationAsGetter(i, unitMillisecondFactors[i]);
makeDurationGetter(i.toLowerCase());
}
}
makeDurationAsGetter('Weeks', 6048e5);
moment.duration.fn.asMonths = function () {
return (+this - this.years() * 31536e6) / 2592e6 + this.years() * 12;
};
/************************************
Default Lang
************************************/
// Set default language, other languages will inherit from English.
moment.lang('en', {
ordinal : function (number) {
var b = number % 10,
output = (toInt(number % 100 / 10) === 1) ? 'th' :
(b === 1) ? 'st' :
(b === 2) ? 'nd' :
(b === 3) ? 'rd' : 'th';
return number + output;
}
});
/* EMBED_LANGUAGES */
/************************************
Exposing Moment
************************************/
function makeGlobal(shouldDeprecate) {
/*global ender:false */
if (typeof ender !== 'undefined') {
return;
}
oldGlobalMoment = globalScope.moment;
if (shouldDeprecate) {
globalScope.moment = deprecate(
"Accessing Moment through the global scope is " +
"deprecated, and will be removed in an upcoming " +
"release.",
moment);
} else {
globalScope.moment = moment;
}
}
// CommonJS module is defined
if (hasModule) {
module.exports = moment;
} else if (typeof define === "function" && define.amd) {
define("moment", function (require, exports, module) {
if (module.config && module.config() && module.config().noGlobal === true) {
// release the global variable
globalScope.moment = oldGlobalMoment;
}
return moment;
});
makeGlobal(true);
} else {
makeGlobal();
}
}).call(this);
},{}],5:[function(require,module,exports){
/**
* Copyright 2012 Craig Campbell
*
* 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.
*
* Mousetrap is a simple keyboard shortcut library for Javascript with
* no external dependencies
*
* @version 1.1.2
* @url craig.is/killing/mice
*/
/**
* mapping of special keycodes to their corresponding keys
*
* everything in this dictionary cannot use keypress events
* so it has to be here to map to the correct keycodes for
* keyup/keydown events
*
* @type {Object}
*/
var _MAP = {
8: 'backspace',
9: 'tab',
13: 'enter',
16: 'shift',
17: 'ctrl',
18: 'alt',
20: 'capslock',
27: 'esc',
32: 'space',
33: 'pageup',
34: 'pagedown',
35: 'end',
36: 'home',
37: 'left',
38: 'up',
39: 'right',
40: 'down',
45: 'ins',
46: 'del',
91: 'meta',
93: 'meta',
224: 'meta'
},
/**
* mapping for special characters so they can support
*
* this dictionary is only used incase you want to bind a
* keyup or keydown event to one of these keys
*
* @type {Object}
*/
_KEYCODE_MAP = {
106: '*',
107: '+',
109: '-',
110: '.',
111 : '/',
186: ';',
187: '=',
188: ',',
189: '-',
190: '.',
191: '/',
192: '`',
219: '[',
220: '\\',
221: ']',
222: '\''
},
/**
* this is a mapping of keys that require shift on a US keypad
* back to the non shift equivelents
*
* this is so you can use keyup events with these keys
*
* note that this will only work reliably on US keyboards
*
* @type {Object}
*/
_SHIFT_MAP = {
'~': '`',
'!': '1',
'@': '2',
'#': '3',
'$': '4',
'%': '5',
'^': '6',
'&': '7',
'*': '8',
'(': '9',
')': '0',
'_': '-',
'+': '=',
':': ';',
'\"': '\'',
'<': ',',
'>': '.',
'?': '/',
'|': '\\'
},
/**
* this is a list of special strings you can use to map
* to modifier keys when you specify your keyboard shortcuts
*
* @type {Object}
*/
_SPECIAL_ALIASES = {
'option': 'alt',
'command': 'meta',
'return': 'enter',
'escape': 'esc'
},
/**
* variable to store the flipped version of _MAP from above
* needed to check if we should use keypress or not when no action
* is specified
*
* @type {Object|undefined}
*/
_REVERSE_MAP,
/**
* a list of all the callbacks setup via Mousetrap.bind()
*
* @type {Object}
*/
_callbacks = {},
/**
* direct map of string combinations to callbacks used for trigger()
*
* @type {Object}
*/
_direct_map = {},
/**
* keeps track of what level each sequence is at since multiple
* sequences can start out with the same sequence
*
* @type {Object}
*/
_sequence_levels = {},
/**
* variable to store the setTimeout call
*
* @type {null|number}
*/
_reset_timer,
/**
* temporary state where we will ignore the next keyup
*
* @type {boolean|string}
*/
_ignore_next_keyup = false,
/**
* are we currently inside of a sequence?
* type of action ("keyup" or "keydown" or "keypress") or false
*
* @type {boolean|string}
*/
_inside_sequence = false;
/**
* loop through the f keys, f1 to f19 and add them to the map
* programatically
*/
for (var i = 1; i < 20; ++i) {
_MAP[111 + i] = 'f' + i;
}
/**
* loop through to map numbers on the numeric keypad
*/
for (i = 0; i <= 9; ++i) {
_MAP[i + 96] = i;
}
/**
* cross browser add event method
*
* @param {Element|HTMLDocument} object
* @param {string} type
* @param {Function} callback
* @returns void
*/
function _addEvent(object, type, callback) {
if (object.addEventListener) {
return object.addEventListener(type, callback, false);
}
object.attachEvent('on' + type, callback);
}
/**
* takes the event and returns the key character
*
* @param {Event} e
* @return {string}
*/
function _characterFromEvent(e) {
// for keypress events we should return the character as is
if (e.type == 'keypress') {
return String.fromCharCode(e.which);
}
// for non keypress events the special maps are needed
if (_MAP[e.which]) {
return _MAP[e.which];
}
if (_KEYCODE_MAP[e.which]) {
return _KEYCODE_MAP[e.which];
}
// if it is not in the special map
return String.fromCharCode(e.which).toLowerCase();
}
/**
* should we stop this event before firing off callbacks
*
* @param {Event} e
* @return {boolean}
*/
function _stop(e) {
var element = e.target || e.srcElement,
tag_name = element.tagName;
// if the element has the class "mousetrap" then no need to stop
if ((' ' + element.className + ' ').indexOf(' mousetrap ') > -1) {
return false;
}
// stop for input, select, and textarea
return tag_name == 'INPUT' || tag_name == 'SELECT' || tag_name == 'TEXTAREA' || (element.contentEditable && element.contentEditable == 'true');
}
/**
* checks if two arrays are equal
*
* @param {Array} modifiers1
* @param {Array} modifiers2
* @returns {boolean}
*/
function _modifiersMatch(modifiers1, modifiers2) {
return modifiers1.sort().join(',') === modifiers2.sort().join(',');
}
/**
* resets all sequence counters except for the ones passed in
*
* @param {Object} do_not_reset
* @returns void
*/
function _resetSequences(do_not_reset) {
do_not_reset = do_not_reset || {};
var active_sequences = false,
key;
for (key in _sequence_levels) {
if (do_not_reset[key]) {
active_sequences = true;
continue;
}
_sequence_levels[key] = 0;
}
if (!active_sequences) {
_inside_sequence = false;
}
}
/**
* finds all callbacks that match based on the keycode, modifiers,
* and action
*
* @param {string} character
* @param {Array} modifiers
* @param {string} action
* @param {boolean=} remove - should we remove any matches
* @param {string=} combination
* @returns {Array}
*/
function _getMatches(character, modifiers, action, remove, combination) {
var i,
callback,
matches = [];
// if there are no events related to this keycode
if (!_callbacks[character]) {
return [];
}
// if a modifier key is coming up on its own we should allow it
if (action == 'keyup' && _isModifier(character)) {
modifiers = [character];
}
// loop through all callbacks for the key that was pressed
// and see if any of them match
for (i = 0; i < _callbacks[character].length; ++i) {
callback = _callbacks[character][i];
// if this is a sequence but it is not at the right level
// then move onto the next match
if (callback.seq && _sequence_levels[callback.seq] != callback.level) {
continue;
}
// if the action we are looking for doesn't match the action we got
// then we should keep going
if (action != callback.action) {
continue;
}
// if this is a keypress event that means that we need to only
// look at the character, otherwise check the modifiers as
// well
if (action == 'keypress' || _modifiersMatch(modifiers, callback.modifiers)) {
// remove is used so if you change your mind and call bind a
// second time with a new function the first one is overwritten
if (remove && callback.combo == combination) {
_callbacks[character].splice(i, 1);
}
matches.push(callback);
}
}
return matches;
}
/**
* takes a key event and figures out what the modifiers are
*
* @param {Event} e
* @returns {Array}
*/
function _eventModifiers(e) {
var modifiers = [];
if (e.shiftKey) {
modifiers.push('shift');
}
if (e.altKey) {
modifiers.push('alt');
}
if (e.ctrlKey) {
modifiers.push('ctrl');
}
if (e.metaKey) {
modifiers.push('meta');
}
return modifiers;
}
/**
* actually calls the callback function
*
* if your callback function returns false this will use the jquery
* convention - prevent default and stop propogation on the event
*
* @param {Function} callback
* @param {Event} e
* @returns void
*/
function _fireCallback(callback, e) {
if (callback(e) === false) {
if (e.preventDefault) {
e.preventDefault();
}
if (e.stopPropagation) {
e.stopPropagation();
}
e.returnValue = false;
e.cancelBubble = true;
}
}
/**
* handles a character key event
*
* @param {string} character
* @param {Event} e
* @returns void
*/
function _handleCharacter(character, e) {
// if this event should not happen stop here
if (_stop(e)) {
return;
}
var callbacks = _getMatches(character, _eventModifiers(e), e.type),
i,
do_not_reset = {},
processed_sequence_callback = false;
// loop through matching callbacks for this key event
for (i = 0; i < callbacks.length; ++i) {
// fire for all sequence callbacks
// this is because if for example you have multiple sequences
// bound such as "g i" and "g t" they both need to fire the
// callback for matching g cause otherwise you can only ever
// match the first one
if (callbacks[i].seq) {
processed_sequence_callback = true;
// keep a list of which sequences were matches for later
do_not_reset[callbacks[i].seq] = 1;
_fireCallback(callbacks[i].callback, e);
continue;
}
// if there were no sequence matches but we are still here
// that means this is a regular match so we should fire that
if (!processed_sequence_callback && !_inside_sequence) {
_fireCallback(callbacks[i].callback, e);
}
}
// if you are inside of a sequence and the key you are pressing
// is not a modifier key then we should reset all sequences
// that were not matched by this key event
if (e.type == _inside_sequence && !_isModifier(character)) {
_resetSequences(do_not_reset);
}
}
/**
* handles a keydown event
*
* @param {Event} e
* @returns void
*/
function _handleKey(e) {
// normalize e.which for key events
// @see http://stackoverflow.com/questions/4285627/javascript-keycode-vs-charcode-utter-confusion
e.which = typeof e.which == "number" ? e.which : e.keyCode;
var character = _characterFromEvent(e);
// no character found then stop
if (!character) {
return;
}
if (e.type == 'keyup' && _ignore_next_keyup == character) {
_ignore_next_keyup = false;
return;
}
_handleCharacter(character, e);
}
/**
* determines if the keycode specified is a modifier key or not
*
* @param {string} key
* @returns {boolean}
*/
function _isModifier(key) {
return key == 'shift' || key == 'ctrl' || key == 'alt' || key == 'meta';
}
/**
* called to set a 1 second timeout on the specified sequence
*
* this is so after each key press in the sequence you have 1 second
* to press the next key before you have to start over
*
* @returns void
*/
function _resetSequenceTimer() {
clearTimeout(_reset_timer);
_reset_timer = setTimeout(_resetSequences, 1000);
}
/**
* reverses the map lookup so that we can look for specific keys
* to see what can and can't use keypress
*
* @return {Object}
*/
function _getReverseMap() {
if (!_REVERSE_MAP) {
_REVERSE_MAP = {};
for (var key in _MAP) {
// pull out the numeric keypad from here cause keypress should
// be able to detect the keys from the character
if (key > 95 && key < 112) {
continue;
}
if (_MAP.hasOwnProperty(key)) {
_REVERSE_MAP[_MAP[key]] = key;
}
}
}
return _REVERSE_MAP;
}
/**
* picks the best action based on the key combination
*
* @param {string} key - character for key
* @param {Array} modifiers
* @param {string=} action passed in
*/
function _pickBestAction(key, modifiers, action) {
// if no action was picked in we should try to pick the one
// that we think would work best for this key
if (!action) {
action = _getReverseMap()[key] ? 'keydown' : 'keypress';
}
// modifier keys don't work as expected with keypress,
// switch to keydown
if (action == 'keypress' && modifiers.length) {
action = 'keydown';
}
return action;
}
/**
* binds a key sequence to an event
*
* @param {string} combo - combo specified in bind call
* @param {Array} keys
* @param {Function} callback
* @param {string=} action
* @returns void
*/
function _bindSequence(combo, keys, callback, action) {
// start off by adding a sequence level record for this combination
// and setting the level to 0
_sequence_levels[combo] = 0;
// if there is no action pick the best one for the first key
// in the sequence
if (!action) {
action = _pickBestAction(keys[0], []);
}
/**
* callback to increase the sequence level for this sequence and reset
* all other sequences that were active
*
* @param {Event} e
* @returns void
*/
var _increaseSequence = function(e) {
_inside_sequence = action;
++_sequence_levels[combo];
_resetSequenceTimer();
},
/**
* wraps the specified callback inside of another function in order
* to reset all sequence counters as soon as this sequence is done
*
* @param {Event} e
* @returns void
*/
_callbackAndReset = function(e) {
_fireCallback(callback, e);
// we should ignore the next key up if the action is key down
// or keypress. this is so if you finish a sequence and
// release the key the final key will not trigger a keyup
if (action !== 'keyup') {
_ignore_next_keyup = _characterFromEvent(e);
}
// weird race condition if a sequence ends with the key
// another sequence begins with
setTimeout(_resetSequences, 10);
},
i;
// loop through keys one at a time and bind the appropriate callback
// function. for any key leading up to the final one it should
// increase the sequence. after the final, it should reset all sequences
for (i = 0; i < keys.length; ++i) {
_bindSingle(keys[i], i < keys.length - 1 ? _increaseSequence : _callbackAndReset, action, combo, i);
}
}
/**
* binds a single keyboard combination
*
* @param {string} combination
* @param {Function} callback
* @param {string=} action
* @param {string=} sequence_name - name of sequence if part of sequence
* @param {number=} level - what part of the sequence the command is
* @returns void
*/
function _bindSingle(combination, callback, action, sequence_name, level) {
// make sure multiple spaces in a row become a single space
combination = combination.replace(/\s+/g, ' ');
var sequence = combination.split(' '),
i,
key,
keys,
modifiers = [];
// if this pattern is a sequence of keys then run through this method
// to reprocess each pattern one key at a time
if (sequence.length > 1) {
return _bindSequence(combination, sequence, callback, action);
}
// take the keys from this pattern and figure out what the actual
// pattern is all about
keys = combination === '+' ? ['+'] : combination.split('+');
for (i = 0; i < keys.length; ++i) {
key = keys[i];
// normalize key names
if (_SPECIAL_ALIASES[key]) {
key = _SPECIAL_ALIASES[key];
}
// if this is not a keypress event then we should
// be smart about using shift keys
// this will only work for US keyboards however
if (action && action != 'keypress' && _SHIFT_MAP[key]) {
key = _SHIFT_MAP[key];
modifiers.push('shift');
}
// if this key is a modifier then add it to the list of modifiers
if (_isModifier(key)) {
modifiers.push(key);
}
}
// depending on what the key combination is
// we will try to pick the best event for it
action = _pickBestAction(key, modifiers, action);
// make sure to initialize array if this is the first time
// a callback is added for this key
if (!_callbacks[key]) {
_callbacks[key] = [];
}
// remove an existing match if there is one
_getMatches(key, modifiers, action, !sequence_name, combination);
// add this call back to the array
// if it is a sequence put it at the beginning
// if not put it at the end
//
// this is important because the way these are processed expects
// the sequence ones to come first
_callbacks[key][sequence_name ? 'unshift' : 'push']({
callback: callback,
modifiers: modifiers,
action: action,
seq: sequence_name,
level: level,
combo: combination
});
}
/**
* binds multiple combinations to the same callback
*
* @param {Array} combinations
* @param {Function} callback
* @param {string|undefined} action
* @returns void
*/
function _bindMultiple(combinations, callback, action) {
for (var i = 0; i < combinations.length; ++i) {
_bindSingle(combinations[i], callback, action);
}
}
// start!
_addEvent(document, 'keypress', _handleKey);
_addEvent(document, 'keydown', _handleKey);
_addEvent(document, 'keyup', _handleKey);
var mousetrap = {
/**
* binds an event to mousetrap
*
* can be a single key, a combination of keys separated with +,
* a comma separated list of keys, an array of keys, or
* a sequence of keys separated by spaces
*
* be sure to list the modifier keys first to make sure that the
* correct key ends up getting bound (the last key in the pattern)
*
* @param {string|Array} keys
* @param {Function} callback
* @param {string=} action - 'keypress', 'keydown', or 'keyup'
* @returns void
*/
bind: function(keys, callback, action) {
_bindMultiple(keys instanceof Array ? keys : [keys], callback, action);
_direct_map[keys + ':' + action] = callback;
return this;
},
/**
* unbinds an event to mousetrap
*
* the unbinding sets the callback function of the specified key combo
* to an empty function and deletes the corresponding key in the
* _direct_map dict.
*
* the keycombo+action has to be exactly the same as
* it was defined in the bind method
*
* TODO: actually remove this from the _callbacks dictionary instead
* of binding an empty function
*
* @param {string|Array} keys
* @param {string} action
* @returns void
*/
unbind: function(keys, action) {
if (_direct_map[keys + ':' + action]) {
delete _direct_map[keys + ':' + action];
this.bind(keys, function() {}, action);
}
return this;
},
/**
* triggers an event that has already been bound
*
* @param {string} keys
* @param {string=} action
* @returns void
*/
trigger: function(keys, action) {
_direct_map[keys + ':' + action]();
return this;
},
/**
* resets the library back to its initial state. this is useful
* if you want to clear out the current keyboard shortcuts and bind
* new ones - for example if you switch to another page
*
* @returns void
*/
reset: function() {
_callbacks = {};
_direct_map = {};
return this;
}
};
module.exports = mousetrap;
},{}]},{},[1])
(1)
});
|
src/user-accounts/UserAccountsPage.js
|
nazaninreihani/binary-next-gen
|
import React from 'react';
import WebPage from '../containers/WebPage';
import UserAccountsContainer from './UserAccountsContainer';
export default (props) => (
<WebPage>
<UserAccountsContainer {...props} />
</WebPage>
);
|
demo/tooltip/tooltip.js
|
koorchik/react-mdl
|
import React from 'react';
import Icon from '../../src/Icon';
import Tooltip from '../../src/Tooltip';
class Demo extends React.Component {
render() {
return (
<div>
<p>Simple tooltip</p>
<Tooltip label="Follow">
<Icon name="add" />
</Tooltip>
<p>Large Tooltip</p>
<Tooltip label="Print" large={true}>
<Icon name="print" />
</Tooltip>
<p>Rich Tooltip</p>
<Tooltip label={<span>Upload <strong>file.zip</strong></span>}>
<Icon name="cloud_upload" />
</Tooltip>
<p>Multiline Tooltip</p>
<Tooltip label={<span>Share your content<br />via social media</span>}>
<Icon name="share" />
</Tooltip>
</div>
);
}
}
React.render(<Demo />, document.getElementById('app'));
|
app/javascript/mastodon/components/avatar.js
|
tateisu/mastodon
|
import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { autoPlayGif } from '../initial_state';
export default class Avatar extends React.PureComponent {
static propTypes = {
account: ImmutablePropTypes.map.isRequired,
size: PropTypes.number.isRequired,
style: PropTypes.object,
inline: PropTypes.bool,
animate: PropTypes.bool,
};
static defaultProps = {
animate: autoPlayGif,
size: 20,
inline: false,
};
state = {
hovering: false,
};
handleMouseEnter = () => {
if (this.props.animate) return;
this.setState({ hovering: true });
}
handleMouseLeave = () => {
if (this.props.animate) return;
this.setState({ hovering: false });
}
render () {
const { account, size, animate, inline } = this.props;
const { hovering } = this.state;
const src = account.get('avatar');
const staticSrc = account.get('avatar_static');
let className = 'account__avatar';
if (inline) {
className = className + ' account__avatar-inline';
}
const style = {
...this.props.style,
width: `${size}px`,
height: `${size}px`,
backgroundSize: `${size}px ${size}px`,
};
if (hovering || animate) {
style.backgroundImage = `url(${src})`;
} else {
style.backgroundImage = `url(${staticSrc})`;
}
return (
<div
className={className}
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}
style={style}
/>
);
}
}
|
imports/plugins/core/shipping/server/no-meteor/startup.js
|
anthonybrown/reaction
|
import Logger from "@reactioncommerce/logger";
import Random from "@reactioncommerce/random";
import ReactionError from "@reactioncommerce/reaction-error";
/**
* @summary Figures out which fulfillment group a cart item should initially be in
* @param {Object[]} currentGroups The current cart fulfillment groups array
* @param {String[]} supportedFulfillmentTypes Array of fulfillment types supported by the item
* @param {String} shopId The ID of the shop that owns the item (product)
* @returns {Object|null} The group or null if no viable group
*/
function determineInitialGroupForItem(currentGroups, supportedFulfillmentTypes, shopId) {
const compatibleGroup = currentGroups.find((group) => supportedFulfillmentTypes.indexOf(group.type) !== -1 &&
shopId === group.shopId);
return compatibleGroup || null;
}
/**
* @summary Called on startup
* @param {Object} context Startup context
* @param {Object} context.appEvents App event emitter
* @param {Object} context.collections Map of MongoDB collections
* @returns {undefined}
*/
export default function startup({ appEvents, collections }) {
const { Cart } = collections;
const handler = async ({ cart: updatedCart }) => {
if (!updatedCart) {
throw new Error("afterCartUpdate hook run with no cart argument");
}
Logger.debug("Handling afterCartUpdate: shipping");
// Every time the cart is updated, create any missing fulfillment groups as necessary.
// We need one group per type per shop, containing only the items from that shop.
// Also make sure that every item is assigned to a fulfillment group.
const currentGroups = updatedCart.shipping || [];
let didModifyGroups = false;
(updatedCart.items || []).forEach((item) => {
let { supportedFulfillmentTypes } = item;
if (!supportedFulfillmentTypes || supportedFulfillmentTypes.length === 0) {
supportedFulfillmentTypes = ["shipping"];
}
// Out of the current groups, returns the one that this item should be in by default, if it isn't
// already in a group
const group = determineInitialGroupForItem(currentGroups, supportedFulfillmentTypes, item.shopId);
if (!group) {
// If no compatible group, add one with initially just this item in it
didModifyGroups = true;
currentGroups.push({
_id: Random.id(),
itemIds: [item._id],
shopId: item.shopId,
type: supportedFulfillmentTypes[0]
});
} else if (!group.itemIds) {
// If there is a compatible group but it has no items array, add one with just this item in it
didModifyGroups = true;
group.itemIds = [item._id];
} else if (group.itemIds.indexOf(item._id) === -1) {
// If there is a compatible group with an items array but it is missing this item, add this item ID to the array
didModifyGroups = true;
group.itemIds.push(item._id);
}
});
// Items may also have been removed. Need to remove their IDs from each group.itemIds
currentGroups.forEach((group) => {
group.itemIds = (group.itemIds || []).filter((itemId) => !!updatedCart.items.find((item) => item._id === itemId));
});
if (!didModifyGroups) return;
const modifier = {
$set: {
shipping: currentGroups,
updatedAt: new Date()
}
};
const { modifiedCount } = await Cart.updateOne({ _id: updatedCart._id }, modifier);
if (modifiedCount === 0) throw new ReactionError("server-error", "Failed to update cart");
};
appEvents.on("afterCartUpdate", handler);
appEvents.on("afterCartCreate", handler);
}
|
ajax/libs/reactive-coffee/1.2.0/reactive-coffee.js
|
hristozov/cdnjs
|
(function() {
var rxFactory,
__slice = [].slice,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
rxFactory = function(_, $) {
var DepArray, DepCell, DepMap, DepMgr, Ev, FakeObsCell, FakeSrcCell, IndexedArray, IndexedDepArray, IndexedMappedDepArray, MappedDepArray, ObsArray, ObsCell, ObsMap, ObsMapEntryCell, RawHtml, Recorder, SrcArray, SrcCell, SrcMap, SrcMapEntryCell, asyncBind, bind, depMgr, ev, events, firstWhere, flatten, lagBind, mkAtts, mkMap, mktag, mkuid, nextUid, nthWhere, permToSplices, popKey, postLagBind, prop, propSet, props, recorder, rx, rxt, setDynProp, setProp, specialAttrs, sum, tag, tags, _fn, _i, _len;
rx = {};
nextUid = 0;
mkuid = function() {
return nextUid += 1;
};
popKey = function(x, k) {
var v;
if (!(k in x)) {
throw new Error('object has no key ' + k);
}
v = x[k];
delete x[k];
return v;
};
nthWhere = function(xs, n, f) {
var i, x, _i, _len;
for (i = _i = 0, _len = xs.length; _i < _len; i = ++_i) {
x = xs[i];
if (f(x) && (n -= 1) < 0) {
return [x, i];
}
}
return [null, -1];
};
firstWhere = function(xs, f) {
return nthWhere(xs, 0, f);
};
mkMap = function(xs) {
var k, map, v, _i, _len, _ref;
if (xs == null) {
xs = [];
}
map = Object.create != null ? Object.create(null) : {};
if (_.isArray(xs)) {
for (_i = 0, _len = xs.length; _i < _len; _i++) {
_ref = xs[_i], k = _ref[0], v = _ref[1];
map[k] = v;
}
} else {
for (k in xs) {
v = xs[k];
map[k] = v;
}
}
return map;
};
sum = function(xs) {
var n, x, _i, _len;
n = 0;
for (_i = 0, _len = xs.length; _i < _len; _i++) {
x = xs[_i];
n += x;
}
return n;
};
DepMgr = rx.DepMgr = (function() {
function DepMgr() {
this.uid2src = {};
this.buffering = 0;
this.buffer = [];
}
DepMgr.prototype.sub = function(uid, src) {
return this.uid2src[uid] = src;
};
DepMgr.prototype.unsub = function(uid) {
return popKey(this.uid2src, uid);
};
DepMgr.prototype.transaction = function(f) {
var b, res, _i, _len, _ref;
this.buffering += 1;
try {
res = f();
} finally {
this.buffering -= 1;
if (this.buffering === 0) {
_ref = this.buffer;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
b = _ref[_i];
b();
}
this.buffer = [];
}
}
return res;
};
return DepMgr;
})();
rx._depMgr = depMgr = new DepMgr();
Ev = rx.Ev = (function() {
function Ev(inits) {
this.inits = inits;
this.subs = mkMap();
}
Ev.prototype.sub = function(listener) {
var init, uid, _i, _len, _ref;
uid = mkuid();
if (this.inits != null) {
_ref = this.inits();
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
init = _ref[_i];
listener(init);
}
}
this.subs[uid] = listener;
depMgr.sub(uid, this);
return uid;
};
Ev.prototype.pub = function(data) {
var listener, uid, _ref, _results;
if (depMgr.buffering) {
return depMgr.buffer.push((function(_this) {
return function() {
return _this.pub(data);
};
})(this));
} else {
_ref = this.subs;
_results = [];
for (uid in _ref) {
listener = _ref[uid];
_results.push(listener(data));
}
return _results;
}
};
Ev.prototype.unsub = function(uid) {
popKey(this.subs, uid);
return depMgr.unsub(uid, this);
};
Ev.prototype.scoped = function(listener, context) {
var uid;
uid = this.sub(listener);
try {
return context();
} finally {
this.unsub(uid);
}
};
return Ev;
})();
rx.skipFirst = function(f) {
var first;
first = true;
return function() {
var args;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
if (first) {
return first = false;
} else {
return f.apply(null, args);
}
};
};
Recorder = rx.Recorder = (function() {
function Recorder() {
this.stack = [];
this.isMutating = false;
this.isIgnoring = false;
this.onMutationWarning = new Ev();
}
Recorder.prototype.record = function(dep, f) {
var wasIgnoring, wasMutating;
if (this.stack.length > 0 && !this.isMutating) {
_(this.stack).last().addNestedBind(dep);
}
this.stack.push(dep);
wasMutating = this.isMutating;
this.isMutating = false;
wasIgnoring = this.isIgnoring;
this.isIgnoring = false;
try {
return f();
} finally {
this.isIgnoring = wasIgnoring;
this.isMutating = wasMutating;
this.stack.pop();
}
};
Recorder.prototype.sub = function(sub) {
var handle, topCell;
if (this.stack.length > 0 && !this.isIgnoring) {
topCell = _(this.stack).last();
return handle = sub(topCell);
}
};
Recorder.prototype.addCleanup = function(cleanup) {
if (this.stack.length > 0) {
return _(this.stack).last().addCleanup(cleanup);
}
};
Recorder.prototype.mutating = function(f) {
var wasMutating;
if (this.stack.length > 0) {
console.warn('Mutation to observable detected during a bind context');
this.onMutationWarning.pub(null);
}
wasMutating = this.isMutating;
this.isMutating = true;
try {
return f();
} finally {
this.isMutating = wasMutating;
}
};
Recorder.prototype.ignoring = function(f) {
var wasIgnoring;
wasIgnoring = this.isIgnoring;
this.isIgnoring = true;
try {
return f();
} finally {
this.isIgnoring = wasIgnoring;
}
};
return Recorder;
})();
rx._recorder = recorder = new Recorder();
rx.asyncBind = asyncBind = function(init, f) {
var dep;
dep = new DepCell(f, init);
dep.refresh();
return dep;
};
rx.bind = bind = function(f) {
return asyncBind(null, function() {
return this.done(this.record(f));
});
};
rx.lagBind = lagBind = function(lag, init, f) {
var timeout;
timeout = null;
return asyncBind(init, function() {
if (timeout != null) {
clearTimeout(timeout);
}
return timeout = setTimeout((function(_this) {
return function() {
return _this.done(_this.record(f));
};
})(this), lag);
});
};
rx.postLagBind = postLagBind = function(init, f) {
var timeout;
timeout = null;
return asyncBind(init, function() {
var ms, val, _ref;
_ref = this.record(f), val = _ref.val, ms = _ref.ms;
if (timeout != null) {
clearTimeout(timeout);
}
return timeout = setTimeout(((function(_this) {
return function() {
return _this.done(val);
};
})(this)), ms);
});
};
rx.snap = function(f) {
return recorder.ignoring(f);
};
rx.onDispose = function(cleanup) {
return recorder.addCleanup(cleanup);
};
rx.autoSub = function(ev, listener) {
var subid;
subid = ev.sub(listener);
rx.onDispose(function() {
return ev.unsub(subid);
});
return subid;
};
ObsCell = rx.ObsCell = (function() {
function ObsCell(x) {
var _ref;
this.x = x;
this.x = (_ref = this.x) != null ? _ref : null;
this.onSet = new Ev((function(_this) {
return function() {
return [[null, _this.x]];
};
})(this));
}
ObsCell.prototype.get = function() {
recorder.sub((function(_this) {
return function(target) {
return rx.autoSub(_this.onSet, function() {
return target.refresh();
});
};
})(this));
return this.x;
};
return ObsCell;
})();
SrcCell = rx.SrcCell = (function(_super) {
__extends(SrcCell, _super);
function SrcCell() {
return SrcCell.__super__.constructor.apply(this, arguments);
}
SrcCell.prototype.set = function(x) {
return recorder.mutating((function(_this) {
return function() {
var old;
if (_this.x !== x) {
old = _this.x;
_this.x = x;
_this.onSet.pub([old, x]);
return old;
}
};
})(this));
};
return SrcCell;
})(ObsCell);
DepCell = rx.DepCell = (function(_super) {
__extends(DepCell, _super);
function DepCell(body, init) {
this.body = body;
DepCell.__super__.constructor.call(this, init != null ? init : null);
this.refreshing = false;
this.nestedBinds = [];
this.cleanups = [];
}
DepCell.prototype.refresh = function() {
var env, isSynchronous, old, realDone, syncResult;
if (!this.refreshing) {
old = this.x;
realDone = (function(_this) {
return function(x) {
_this.x = x;
return _this.onSet.pub([old, _this.x]);
};
})(this);
({
recorded: false
});
syncResult = null;
isSynchronous = false;
env = {
record: (function(_this) {
return function(f) {
var recorded, res;
if (!_this.refreshing) {
_this.disconnect();
if (recorded) {
throw new Error('this refresh has already recorded its dependencies');
}
_this.refreshing = true;
recorded = true;
try {
res = recorder.record(_this, function() {
return f.call(env);
});
} finally {
_this.refreshing = false;
}
if (isSynchronous) {
realDone(syncResult);
}
return res;
}
};
})(this),
done: (function(_this) {
return function(x) {
if (old !== x) {
if (_this.refreshing) {
isSynchronous = true;
return syncResult = x;
} else {
return realDone(x);
}
}
};
})(this)
};
return this.body.call(env);
}
};
DepCell.prototype.disconnect = function() {
var cleanup, nestedBind, _i, _j, _len, _len1, _ref, _ref1;
_ref = this.cleanups;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
cleanup = _ref[_i];
cleanup();
}
_ref1 = this.nestedBinds;
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
nestedBind = _ref1[_j];
nestedBind.disconnect();
}
this.nestedBinds = [];
return this.cleanups = [];
};
DepCell.prototype.addNestedBind = function(nestedBind) {
return this.nestedBinds.push(nestedBind);
};
DepCell.prototype.addCleanup = function(cleanup) {
return this.cleanups.push(cleanup);
};
return DepCell;
})(ObsCell);
ObsArray = rx.ObsArray = (function() {
function ObsArray(xs, diff) {
this.xs = xs != null ? xs : [];
this.diff = diff != null ? diff : rx.basicDiff();
this.onChange = new Ev((function(_this) {
return function() {
return [[0, [], _this.xs]];
};
})(this));
this.indexed_ = null;
}
ObsArray.prototype.all = function() {
recorder.sub((function(_this) {
return function(target) {
return rx.autoSub(_this.onChange, function() {
return target.refresh();
});
};
})(this));
return _.clone(this.xs);
};
ObsArray.prototype.raw = function() {
recorder.sub((function(_this) {
return function(target) {
return rx.autoSub(_this.onChange, function() {
return target.refresh();
});
};
})(this));
return this.xs;
};
ObsArray.prototype.at = function(i) {
recorder.sub((function(_this) {
return function(target) {
return rx.autoSub(_this.onChange, function(_arg) {
var added, index, removed;
index = _arg[0], removed = _arg[1], added = _arg[2];
if (index === i) {
return target.refresh();
}
});
};
})(this));
return this.xs[i];
};
ObsArray.prototype.length = function() {
recorder.sub((function(_this) {
return function(target) {
return rx.autoSub(_this.onChange, function(_arg) {
var added, index, removed;
index = _arg[0], removed = _arg[1], added = _arg[2];
if (removed.length !== added.length) {
return target.refresh();
}
});
};
})(this));
return this.xs.length;
};
ObsArray.prototype.map = function(f) {
var ys;
ys = new MappedDepArray();
rx.autoSub(this.onChange, function(_arg) {
var added, index, removed;
index = _arg[0], removed = _arg[1], added = _arg[2];
return ys.realSplice(index, removed.length, added.map(f));
});
return ys;
};
ObsArray.prototype.indexed = function() {
if (this.indexed_ == null) {
this.indexed_ = new IndexedDepArray();
rx.autoSub(this.onChange, (function(_this) {
return function(_arg) {
var added, index, removed;
index = _arg[0], removed = _arg[1], added = _arg[2];
return _this.indexed_.realSplice(index, removed.length, added);
};
})(this));
}
return this.indexed_;
};
ObsArray.prototype.concat = function(that) {
return rx.concat(this, that);
};
ObsArray.prototype.realSplice = function(index, count, additions) {
var removed;
removed = this.xs.splice.apply(this.xs, [index, count].concat(additions));
return this.onChange.pub([index, removed, additions]);
};
ObsArray.prototype._update = function(val, diff) {
var additions, count, fullSplice, index, old, splice, splices, x, _i, _len, _ref, _results;
if (diff == null) {
diff = this.diff;
}
old = this.xs;
fullSplice = [0, old.length, val];
x = null;
splices = diff != null ? (_ref = permToSplices(old.length, val, diff(old, val))) != null ? _ref : [fullSplice] : [fullSplice];
_results = [];
for (_i = 0, _len = splices.length; _i < _len; _i++) {
splice = splices[_i];
index = splice[0], count = splice[1], additions = splice[2];
_results.push(this.realSplice(index, count, additions));
}
return _results;
};
return ObsArray;
})();
SrcArray = rx.SrcArray = (function(_super) {
__extends(SrcArray, _super);
function SrcArray() {
return SrcArray.__super__.constructor.apply(this, arguments);
}
SrcArray.prototype.spliceArray = function(index, count, additions) {
return recorder.mutating((function(_this) {
return function() {
return _this.realSplice(index, count, additions);
};
})(this));
};
SrcArray.prototype.splice = function() {
var additions, count, index;
index = arguments[0], count = arguments[1], additions = 3 <= arguments.length ? __slice.call(arguments, 2) : [];
return this.spliceArray(index, count, additions);
};
SrcArray.prototype.insert = function(x, index) {
return this.splice(index, 0, x);
};
SrcArray.prototype.remove = function(x) {
var i;
i = _(this.raw()).indexOf(x);
if (i >= 0) {
return this.removeAt(i);
}
};
SrcArray.prototype.removeAt = function(index) {
return this.splice(index, 1);
};
SrcArray.prototype.push = function(x) {
return this.splice(this.length(), 0, x);
};
SrcArray.prototype.put = function(i, x) {
return this.splice(i, 1, x);
};
SrcArray.prototype.replace = function(xs) {
return this.spliceArray(0, this.length(), xs);
};
SrcArray.prototype.update = function(xs) {
return recorder.mutating((function(_this) {
return function() {
return _this._update(xs);
};
})(this));
};
return SrcArray;
})(ObsArray);
MappedDepArray = rx.MappedDepArray = (function(_super) {
__extends(MappedDepArray, _super);
function MappedDepArray() {
return MappedDepArray.__super__.constructor.apply(this, arguments);
}
return MappedDepArray;
})(ObsArray);
IndexedDepArray = rx.IndexedDepArray = (function(_super) {
__extends(IndexedDepArray, _super);
function IndexedDepArray(xs, diff) {
var i, x;
if (xs == null) {
xs = [];
}
IndexedDepArray.__super__.constructor.call(this, xs, diff);
this.is = (function() {
var _i, _len, _ref, _results;
_ref = this.xs;
_results = [];
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
x = _ref[i];
_results.push(rx.cell(i));
}
return _results;
}).call(this);
this.onChange = new Ev((function(_this) {
return function() {
return [[0, [], _.zip(_this.xs, _this.is)]];
};
})(this));
}
IndexedDepArray.prototype.map = function(f) {
var ys;
ys = new IndexedMappedDepArray();
rx.autoSub(this.onChange, function(_arg) {
var a, added, i, index, removed;
index = _arg[0], removed = _arg[1], added = _arg[2];
return ys.realSplice(index, removed.length, (function() {
var _i, _len, _ref, _results;
_results = [];
for (_i = 0, _len = added.length; _i < _len; _i++) {
_ref = added[_i], a = _ref[0], i = _ref[1];
_results.push(f(a, i));
}
return _results;
})());
});
return ys;
};
IndexedDepArray.prototype.realSplice = function(index, count, additions) {
var i, newIs, offset, removed, _i, _len, _ref, _ref1, _ref2;
removed = (_ref = this.xs).splice.apply(_ref, [index, count].concat(__slice.call(additions)));
_ref1 = this.is.slice(index + count);
for (offset = _i = 0, _len = _ref1.length; _i < _len; offset = ++_i) {
i = _ref1[offset];
i.set(index + additions.length + offset);
}
newIs = (function() {
var _j, _ref2, _results;
_results = [];
for (i = _j = 0, _ref2 = additions.length; 0 <= _ref2 ? _j < _ref2 : _j > _ref2; i = 0 <= _ref2 ? ++_j : --_j) {
_results.push(rx.cell(index + i));
}
return _results;
})();
(_ref2 = this.is).splice.apply(_ref2, [index, count].concat(__slice.call(newIs)));
return this.onChange.pub([index, removed, _.zip(additions, newIs)]);
};
return IndexedDepArray;
})(ObsArray);
IndexedMappedDepArray = rx.IndexedMappedDepArray = (function(_super) {
__extends(IndexedMappedDepArray, _super);
function IndexedMappedDepArray() {
return IndexedMappedDepArray.__super__.constructor.apply(this, arguments);
}
return IndexedMappedDepArray;
})(IndexedDepArray);
DepArray = rx.DepArray = (function(_super) {
__extends(DepArray, _super);
function DepArray(f, diff) {
this.f = f;
DepArray.__super__.constructor.call(this, [], diff);
rx.autoSub((bind((function(_this) {
return function() {
return _this.f();
};
})(this))).onSet, (function(_this) {
return function(_arg) {
var old, val;
old = _arg[0], val = _arg[1];
return _this._update(val);
};
})(this));
}
return DepArray;
})(ObsArray);
IndexedArray = rx.IndexedArray = (function(_super) {
__extends(IndexedArray, _super);
function IndexedArray(xs) {
this.xs = xs;
}
IndexedArray.prototype.map = function(f) {
var ys;
ys = new MappedDepArray();
rx.autoSub(this.xs.onChange, function(_arg) {
var added, index, removed;
index = _arg[0], removed = _arg[1], added = _arg[2];
return ys.realSplice(index, removed.length, added.map(f));
});
return ys;
};
return IndexedArray;
})(DepArray);
rx.concat = function() {
var repLens, xs, xss, ys;
xss = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
ys = new MappedDepArray();
repLens = (function() {
var _i, _len, _results;
_results = [];
for (_i = 0, _len = xss.length; _i < _len; _i++) {
xs = xss[_i];
_results.push(0);
}
return _results;
})();
xss.map(function(xs, i) {
return rx.autoSub(xs.onChange, function(_arg) {
var added, index, removed, xsOffset;
index = _arg[0], removed = _arg[1], added = _arg[2];
xsOffset = sum(repLens.slice(0, i));
repLens[i] += added.length - removed.length;
return ys.realSplice(xsOffset + index, removed.length, added);
});
});
return ys;
};
FakeSrcCell = rx.FakeSrcCell = (function(_super) {
__extends(FakeSrcCell, _super);
function FakeSrcCell(_getter, _setter) {
this._getter = _getter;
this._setter = _setter;
}
FakeSrcCell.prototype.get = function() {
return this._getter();
};
FakeSrcCell.prototype.set = function(x) {
return this._setter(x);
};
return FakeSrcCell;
})(SrcCell);
FakeObsCell = rx.FakeObsCell = (function(_super) {
__extends(FakeObsCell, _super);
function FakeObsCell(_getter) {
this._getter = _getter;
}
FakeObsCell.prototype.get = function() {
return this._getter();
};
return FakeObsCell;
})(ObsCell);
SrcMapEntryCell = rx.MapEntryCell = (function(_super) {
__extends(MapEntryCell, _super);
function MapEntryCell(_map, _key) {
this._map = _map;
this._key = _key;
}
MapEntryCell.prototype.get = function() {
return this._map.get(this._key);
};
MapEntryCell.prototype.set = function(x) {
return this._map.put(this._key, x);
};
return MapEntryCell;
})(FakeSrcCell);
ObsMapEntryCell = rx.ObsMapEntryCell = (function(_super) {
__extends(ObsMapEntryCell, _super);
function ObsMapEntryCell(_map, _key) {
this._map = _map;
this._key = _key;
}
ObsMapEntryCell.prototype.get = function() {
return this._map.get(this._key);
};
return ObsMapEntryCell;
})(FakeObsCell);
ObsMap = rx.ObsMap = (function() {
function ObsMap(x) {
this.x = x != null ? x : {};
this.onAdd = new Ev(function() {
var k, v, _results;
_results = [];
for (k in x) {
v = x[k];
_results.push([k, v]);
}
return _results;
});
this.onRemove = new Ev();
this.onChange = new Ev();
}
ObsMap.prototype.get = function(key) {
recorder.sub((function(_this) {
return function(target) {
return rx.autoSub(_this.onAdd, function(_arg) {
var subkey, val;
subkey = _arg[0], val = _arg[1];
if (key === subkey) {
return target.refresh();
}
});
};
})(this));
recorder.sub((function(_this) {
return function(target) {
return rx.autoSub(_this.onChange, function(_arg) {
var old, subkey, val;
subkey = _arg[0], old = _arg[1], val = _arg[2];
if (key === subkey) {
return target.refresh();
}
});
};
})(this));
recorder.sub((function(_this) {
return function(target) {
return rx.autoSub(_this.onRemove, function(_arg) {
var old, subkey;
subkey = _arg[0], old = _arg[1];
if (key === subkey) {
return target.refresh();
}
});
};
})(this));
return this.x[key];
};
ObsMap.prototype.all = function() {
recorder.sub((function(_this) {
return function(target) {
return rx.autoSub(_this.onAdd, function() {
return target.refresh();
});
};
})(this));
recorder.sub((function(_this) {
return function(target) {
return rx.autoSub(_this.onChange, function() {
return target.refresh();
});
};
})(this));
recorder.sub((function(_this) {
return function(target) {
return rx.autoSub(_this.onRemove, function() {
return target.refresh();
});
};
})(this));
return _.clone(this.x);
};
ObsMap.prototype.realPut = function(key, val) {
var old;
if (key in this.x) {
old = this.x[key];
this.x[key] = val;
this.onChange.pub([key, old, val]);
return old;
} else {
this.x[key] = val;
this.onAdd.pub([key, val]);
return void 0;
}
};
ObsMap.prototype.realRemove = function(key) {
var val;
val = popKey(this.x, key);
this.onRemove.pub([key, val]);
return val;
};
ObsMap.prototype.cell = function(key) {
return new ObsMapEntryCell(this, key);
};
return ObsMap;
})();
SrcMap = rx.SrcMap = (function(_super) {
__extends(SrcMap, _super);
function SrcMap() {
return SrcMap.__super__.constructor.apply(this, arguments);
}
SrcMap.prototype.put = function(key, val) {
return recorder.mutating((function(_this) {
return function() {
return _this.realPut(key, val);
};
})(this));
};
SrcMap.prototype.remove = function(key) {
return recorder.mutating((function(_this) {
return function() {
return _this.realRemove(key);
};
})(this));
};
SrcMap.prototype.cell = function(key) {
return new SrcMapEntryCell(this, key);
};
return SrcMap;
})(ObsMap);
DepMap = rx.DepMap = (function(_super) {
__extends(DepMap, _super);
function DepMap(f) {
this.f = f;
DepMap.__super__.constructor.call(this);
rx.autoSub(new DepCell(this.f).onSet, function(_arg) {
var k, old, v, val, _results;
old = _arg[0], val = _arg[1];
for (k in old) {
v = old[k];
if (!(k in val)) {
this.realRemove(k);
}
}
_results = [];
for (k in val) {
v = val[k];
if (this.x[k] !== v) {
_results.push(this.realPut(k, v));
} else {
_results.push(void 0);
}
}
return _results;
});
}
return DepMap;
})(ObsMap);
rx.liftSpec = function(obj) {
var name, type, val;
return _.object((function() {
var _i, _len, _ref, _results;
_ref = Object.getOwnPropertyNames(obj);
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
name = _ref[_i];
val = obj[name];
if ((val != null) && (val instanceof rx.ObsMap || val instanceof rx.ObsCell || val instanceof rx.ObsArray)) {
continue;
}
type = _.isFunction(val) ? null : _.isArray(val) ? 'array' : 'cell';
_results.push([
name, {
type: type,
val: val
}
]);
}
return _results;
})());
};
rx.lift = function(x, fieldspec) {
var c, name, spec;
if (fieldspec == null) {
fieldspec = rx.liftSpec(x);
}
for (name in fieldspec) {
spec = fieldspec[name];
if (!_.some((function() {
var _i, _len, _ref, _results;
_ref = [ObsCell, ObsArray, ObsMap];
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
c = _ref[_i];
_results.push(x[name] instanceof c);
}
return _results;
})())) {
x[name] = (function() {
switch (spec.type) {
case 'cell':
return rx.cell(x[name]);
case 'array':
return rx.array(x[name]);
case 'map':
return rx.map(x[name]);
default:
return x[name];
}
})();
}
}
return x;
};
rx.unlift = function(x) {
var k, v;
return _.object((function() {
var _results;
_results = [];
for (k in x) {
v = x[k];
_results.push([k, v instanceof rx.ObsCell ? v.get() : v instanceof rx.ObsArray ? v.all() : v]);
}
return _results;
})());
};
rx.reactify = function(obj, fieldspec) {
var arr, methName, name, spec;
if (_.isArray(obj)) {
arr = rx.array(_.clone(obj));
Object.defineProperties(obj, _.object((function() {
var _i, _len, _ref, _results;
_ref = _.functions(arr);
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
methName = _ref[_i];
if (methName !== 'length') {
_results.push((function(methName) {
var meth, newMeth, spec;
meth = obj[methName];
newMeth = function() {
var args, res, _ref1;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
if (meth != null) {
res = meth.call.apply(meth, [obj].concat(__slice.call(args)));
}
(_ref1 = arr[methName]).call.apply(_ref1, [arr].concat(__slice.call(args)));
return res;
};
spec = {
configurable: true,
enumerable: false,
value: newMeth,
writable: true
};
return [methName, spec];
})(methName));
}
}
return _results;
})()));
return obj;
} else {
return Object.defineProperties(obj, _.object((function() {
var _results;
_results = [];
for (name in fieldspec) {
spec = fieldspec[name];
_results.push((function(name, spec) {
var desc, obs, view, _ref, _ref1;
desc = null;
switch (spec.type) {
case 'cell':
obs = rx.cell((_ref = spec.val) != null ? _ref : null);
desc = {
configurable: true,
enumerable: true,
get: function() {
return obs.get();
},
set: function(x) {
return obs.set(x);
}
};
break;
case 'array':
view = rx.reactify((_ref1 = spec.val) != null ? _ref1 : []);
desc = {
configurable: true,
enumerable: true,
get: function() {
view.raw();
return view;
},
set: function(x) {
view.splice.apply(view, [0, view.length].concat(__slice.call(x)));
return view;
}
};
break;
default:
throw new Error("Unknown observable type: " + type);
}
return [name, desc];
})(name, spec));
}
return _results;
})()));
}
};
rx.autoReactify = function(obj) {
var name, type, val;
return rx.reactify(obj, _.object((function() {
var _i, _len, _ref, _results;
_ref = Object.getOwnPropertyNames(obj);
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
name = _ref[_i];
val = obj[name];
if (val instanceof ObsMap || val instanceof ObsCell || val instanceof ObsArray) {
continue;
}
type = _.isFunction(val) ? null : _.isArray(val) ? 'array' : 'cell';
_results.push([
name, {
type: type,
val: val
}
]);
}
return _results;
})()));
};
_.extend(rx, {
cell: function(x) {
return new SrcCell(x);
},
array: function(xs, diff) {
return new SrcArray(xs, diff);
},
map: function(x) {
return new SrcMap(x);
}
});
rx.flatten = function(xs) {
return new DepArray(function() {
var x;
return _((function() {
var _i, _len, _results;
_results = [];
for (_i = 0, _len = xs.length; _i < _len; _i++) {
x = xs[_i];
if (x instanceof ObsArray) {
_results.push(x.raw());
} else if (x instanceof ObsCell) {
_results.push(x.get());
} else {
_results.push(x);
}
}
return _results;
})()).chain().flatten(true).filter(function(x) {
return x != null;
}).value();
});
};
flatten = function(xss) {
var xs;
xs = _.flatten(xss);
return rx.cellToArray(bind(function() {
return _.flatten(xss);
}));
};
rx.cellToArray = function(cell, diff) {
return new DepArray((function() {
return cell.get();
}), diff);
};
rx.basicDiff = function(key) {
if (key == null) {
key = rx.smartUidify;
}
return function(oldXs, newXs) {
var i, oldKeys, x, _i, _len, _ref, _results;
oldKeys = mkMap((function() {
var _i, _len, _results;
_results = [];
for (i = _i = 0, _len = oldXs.length; _i < _len; i = ++_i) {
x = oldXs[i];
_results.push([key(x), i]);
}
return _results;
})());
_results = [];
for (_i = 0, _len = newXs.length; _i < _len; _i++) {
x = newXs[_i];
_results.push((_ref = oldKeys[key(x)]) != null ? _ref : -1);
}
return _results;
};
};
rx.uidify = function(x) {
var _ref;
return (_ref = x.__rxUid) != null ? _ref : (Object.defineProperty(x, '__rxUid', {
enumerable: false,
value: mkuid()
})).__rxUid;
};
rx.smartUidify = function(x) {
if (_.isObject(x)) {
return rx.uidify(x);
} else {
return JSON.stringify(x);
}
};
permToSplices = function(oldLength, newXs, perm) {
var cur, i, last, refs, splice, splices;
refs = (function() {
var _i, _len, _results;
_results = [];
for (_i = 0, _len = perm.length; _i < _len; _i++) {
i = perm[_i];
if (i >= 0) {
_results.push(i);
}
}
return _results;
})();
if (_.some((function() {
var _i, _ref, _results;
_results = [];
for (i = _i = 0, _ref = refs.length - 1; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
_results.push(refs[i + 1] - refs[i] <= 0);
}
return _results;
})())) {
return null;
}
splices = [];
last = -1;
i = 0;
while (i < perm.length) {
while (i < perm.length && perm[i] === last + 1) {
last += 1;
i += 1;
}
splice = {
index: i,
count: 0,
additions: []
};
while (i < perm.length && perm[i] === -1) {
splice.additions.push(newXs[i]);
i += 1;
}
cur = i === perm.length ? oldLength : perm[i];
splice.count = cur - (last + 1);
if (splice.count > 0 || splice.additions.length > 0) {
splices.push([splice.index, splice.count, splice.additions]);
}
last = cur;
i += 1;
}
return splices;
};
rx.transaction = function(f) {
return depMgr.transaction(f);
};
if ($ != null) {
$.fn.rx = function(prop) {
var checked, focused, map, val;
map = this.data('rx-map');
if (map == null) {
this.data('rx-map', map = mkMap());
}
if (prop in map) {
return map[prop];
}
return map[prop] = (function() {
switch (prop) {
case 'focused':
focused = rx.cell(this.is(':focus'));
this.focus(function() {
return focused.set(true);
});
this.blur(function() {
return focused.set(false);
});
return focused;
case 'val':
val = rx.cell(this.val());
this.change((function(_this) {
return function() {
return val.set(_this.val());
};
})(this));
this.on('input', (function(_this) {
return function() {
return val.set(_this.val());
};
})(this));
return val;
case 'checked':
checked = rx.cell(this.is(':checked'));
this.change((function(_this) {
return function() {
return checked.set(_this.is(':checked'));
};
})(this));
return checked;
default:
throw new Error('Unknown reactive property type');
}
}).call(this);
};
rxt = {};
RawHtml = rxt.RawHtml = (function() {
function RawHtml(html) {
this.html = html;
}
return RawHtml;
})();
events = ["blur", "change", "click", "dblclick", "error", "focus", "focusin", "focusout", "hover", "keydown", "keypress", "keyup", "load", "mousedown", "mouseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "ready", "resize", "scroll", "select", "submit", "toggle", "unload"];
specialAttrs = rxt.specialAttrs = {
init: function(elt, fn) {
return fn.call(elt);
}
};
_fn = function(ev) {
return specialAttrs[ev] = function(elt, fn) {
return elt[ev](function(e) {
return fn.call(elt, e);
});
};
};
for (_i = 0, _len = events.length; _i < _len; _i++) {
ev = events[_i];
_fn(ev);
}
props = ['async', 'autofocus', 'checked', 'location', 'multiple', 'readOnly', 'selected', 'selectedIndex', 'tagName', 'nodeName', 'nodeType', 'ownerDocument', 'defaultChecked', 'defaultSelected'];
propSet = _.object((function() {
var _j, _len1, _results;
_results = [];
for (_j = 0, _len1 = props.length; _j < _len1; _j++) {
prop = props[_j];
_results.push([prop, null]);
}
return _results;
})());
setProp = function(elt, prop, val) {
if (prop === 'value') {
return elt.val(val);
} else if (prop in propSet) {
return elt.prop(prop, val);
} else {
return elt.attr(prop, val);
}
};
setDynProp = function(elt, prop, val, xform) {
if (xform == null) {
xform = _.identity;
}
if (val instanceof ObsCell) {
return rx.autoSub(val.onSet, function(_arg) {
var n, o;
o = _arg[0], n = _arg[1];
return setProp(elt, prop, xform(n));
});
} else {
return setProp(elt, prop, xform(val));
}
};
rxt.mkAtts = mkAtts = function(attstr) {
return (function(atts) {
var classes, cls, id;
id = attstr.match(/[#](\w+)/);
if (id) {
atts.id = id[1];
}
classes = attstr.match(/\.\w+/g);
if (classes) {
atts["class"] = ((function() {
var _j, _len1, _results;
_results = [];
for (_j = 0, _len1 = classes.length; _j < _len1; _j++) {
cls = classes[_j];
_results.push(cls.replace(/^\./, ''));
}
return _results;
})()).join(' ');
}
return atts;
})({});
};
rxt.mktag = mktag = function(tag) {
return function(arg1, arg2) {
var attrs, contents, elt, key, name, toNodes, updateContents, value, _ref, _ref1;
_ref = (arg1 == null) && (arg2 == null) ? [{}, null] : arg1 instanceof Object && (arg2 != null) ? [arg1, arg2] : _.isString(arg1) && (arg2 != null) ? [mkAtts(arg1), arg2] : (arg2 == null) && _.isString(arg1) || _.isNumber(arg1) || arg1 instanceof Element || arg1 instanceof RawHtml || arg1 instanceof $ || _.isArray(arg1) || arg1 instanceof ObsCell || arg1 instanceof ObsArray ? [{}, arg1] : [arg1, null], attrs = _ref[0], contents = _ref[1];
elt = $("<" + tag + "/>");
_ref1 = _.omit(attrs, _.keys(specialAttrs));
for (name in _ref1) {
value = _ref1[name];
setDynProp(elt, name, value);
}
if (contents != null) {
toNodes = function(contents) {
var child, parsed, _j, _len1, _results;
_results = [];
for (_j = 0, _len1 = contents.length; _j < _len1; _j++) {
child = contents[_j];
if (child != null) {
if (_.isString(child) || _.isNumber(child)) {
_results.push(document.createTextNode(child));
} else if (child instanceof Element) {
_results.push(child);
} else if (child instanceof RawHtml) {
parsed = $(child.html);
if (parsed.length !== 1) {
throw new Error('RawHtml must wrap a single element');
}
_results.push(parsed[0]);
} else if (child instanceof $) {
if (child.length !== 1) {
throw new Error('jQuery object must wrap a single element');
}
_results.push(child[0]);
} else {
throw new Error("Unknown element type in array: " + child.constructor.name + " (must be string, number, Element, RawHtml, or jQuery objects)");
}
} else {
_results.push(void 0);
}
}
return _results;
};
updateContents = function(contents) {
var covers, hasWidth, left, node, nodes, top;
elt.html('');
if (_.isArray(contents)) {
nodes = toNodes(contents);
elt.append(nodes);
if (false) {
hasWidth = function(node) {
var e;
try {
return ($(node).width() != null) !== 0;
} catch (_error) {
e = _error;
return false;
}
};
covers = (function() {
var _j, _len1, _ref2, _ref3, _results;
_ref2 = nodes != null ? nodes : [];
_results = [];
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
node = _ref2[_j];
if (!(hasWidth(node))) {
continue;
}
_ref3 = $(node).offset(), left = _ref3.left, top = _ref3.top;
_results.push($('<div/>').appendTo($('body').first()).addClass('updated-element').offset({
top: top,
left: left
}).width($(node).width()).height($(node).height()));
}
return _results;
})();
return setTimeout((function() {
var cover, _j, _len1, _results;
_results = [];
for (_j = 0, _len1 = covers.length; _j < _len1; _j++) {
cover = covers[_j];
_results.push($(cover).remove());
}
return _results;
}), 2000);
}
} else if (_.isString(contents) || _.isNumber(contents) || contents instanceof Element || contents instanceof RawHtml || contents instanceof $) {
return updateContents([contents]);
} else {
throw new Error("Unknown type for element contents: " + contents.constructor.name + " (accepted types: string, number, Element, RawHtml, jQuery object of single element, or array of the aforementioned)");
}
};
if (contents instanceof ObsArray) {
rx.autoSub(contents.onChange, function(_arg) {
var added, index, removed, toAdd;
index = _arg[0], removed = _arg[1], added = _arg[2];
elt.contents().slice(index, index + removed.length).remove();
toAdd = toNodes(added);
if (index === elt.contents().length) {
return elt.append(toAdd);
} else {
return elt.contents().eq(index).before(toAdd);
}
});
} else if (contents instanceof ObsCell) {
rx.autoSub(contents.onSet, function(_arg) {
var old, val;
old = _arg[0], val = _arg[1];
return updateContents(val);
});
} else {
updateContents(contents);
}
}
for (key in attrs) {
if (key in specialAttrs) {
specialAttrs[key](elt, attrs[key], attrs, contents);
}
}
return elt;
};
};
tags = ['html', 'head', 'title', 'base', 'link', 'meta', 'style', 'script', 'noscript', 'body', 'body', 'section', 'nav', 'article', 'aside', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'h1', 'h6', 'header', 'footer', 'address', 'main', 'main', 'p', 'hr', 'pre', 'blockquote', 'ol', 'ul', 'li', 'dl', 'dt', 'dd', 'dd', 'figure', 'figcaption', 'div', 'a', 'em', 'strong', 'small', 's', 'cite', 'q', 'dfn', 'abbr', 'data', 'time', 'code', 'var', 'samp', 'kbd', 'sub', 'sup', 'i', 'b', 'u', 'mark', 'ruby', 'rt', 'rp', 'bdi', 'bdo', 'span', 'br', 'wbr', 'ins', 'del', 'img', 'iframe', 'embed', 'object', 'param', 'object', 'video', 'audio', 'source', 'video', 'audio', 'track', 'video', 'audio', 'canvas', 'map', 'area', 'area', 'map', 'svg', 'math', 'table', 'caption', 'colgroup', 'col', 'tbody', 'thead', 'tfoot', 'tr', 'td', 'th', 'form', 'fieldset', 'legend', 'fieldset', 'label', 'input', 'button', 'select', 'datalist', 'optgroup', 'option', 'select', 'datalist', 'textarea', 'keygen', 'output', 'progress', 'meter', 'details', 'summary', 'details', 'menuitem', 'menu'];
rxt.tags = _.object((function() {
var _j, _len1, _results;
_results = [];
for (_j = 0, _len1 = tags.length; _j < _len1; _j++) {
tag = tags[_j];
_results.push([tag, rxt.mktag(tag)]);
}
return _results;
})());
rxt.rawHtml = function(html) {
return new RawHtml(html);
};
rxt.importTags = (function(_this) {
return function(x) {
return _(x != null ? x : _this).extend(rxt.tags);
};
})(this);
rxt.cast = function(value, type) {
var key, opts, types;
if (type == null) {
type = "cell";
}
if (_.isString(type)) {
switch (type) {
case 'array':
if (value instanceof rx.ObsArray) {
return value;
} else if (_.isArray(value)) {
return new rx.DepArray(function() {
return value;
});
} else if (value instanceof rx.ObsCell) {
return new rx.DepArray(function() {
return value.get();
});
} else {
throw new Error('Cannot cast to array: ' + value.constructor.name);
}
break;
case 'cell':
if (value instanceof rx.ObsCell) {
return value;
} else {
return bind(function() {
return value;
});
}
break;
default:
return value;
}
} else {
opts = value;
types = type;
return _.object((function() {
var _results;
_results = [];
for (key in opts) {
value = opts[key];
_results.push([key, types[key] ? rxt.cast(value, types[key]) : value]);
}
return _results;
})());
}
};
rxt.trim = $.trim;
rxt.dasherize = function(str) {
return rxt.trim(str).replace(/([A-Z])/g, '-$1').replace(/[-_\s]+/g, '-').toLowerCase();
};
rxt.cssify = function(map) {
var k, v;
return ((function() {
var _results;
_results = [];
for (k in map) {
v = map[k];
if (v != null) {
_results.push("" + (rxt.dasherize(k)) + ": " + (_.isNumber(v) ? v + 'px' : v) + ";");
}
}
return _results;
})()).join(' ');
};
specialAttrs.style = function(elt, value) {
return setDynProp(elt, 'style', value, function(val) {
if (_.isString(val)) {
return val;
} else {
return rxt.cssify(val);
}
});
};
rxt.smushClasses = function(xs) {
return _(xs).chain().flatten().compact().value().join(' ').replace(/\s+/, ' ').trim();
};
specialAttrs["class"] = function(elt, value) {
return setDynProp(elt, 'class', value, function(val) {
if (_.isString(val)) {
return val;
} else {
return rxt.smushClasses(val);
}
});
};
}
rx.rxt = rxt;
return rx;
};
(function(root, factory, deps) {
var rx, _;
if ((typeof define !== "undefined" && define !== null ? define.amd : void 0) != null) {
return define(deps, factory);
} else if ((typeof module !== "undefined" && module !== null ? module.exports : void 0) != null) {
_ = require('underscore');
rx = factory(_);
return module.exports = rx;
} else if ((root._ != null) && (root.$ != null)) {
return root.rx = factory(root._, root.$);
} else {
throw "Dependencies are not met for reactive: _ and $ not found";
}
})(this, rxFactory, ['underscore', 'jquery']);
}).call(this);
//# sourceMappingURL=reactive.js.map
|
src/components/swatches/SwatchesGroup.js
|
Scratch-it/react-color
|
'use strict' /* @flow */
import React from 'react'
import ReactCSS from 'reactcss'
import shallowCompare from 'react-addons-shallow-compare'
import SwatchesColor from './SwatchesColor'
export class SwatchesGroup extends ReactCSS.Component {
shouldComponentUpdate = shallowCompare.bind(this, this, arguments[0], arguments[1])
classes(): any {
return {
'default': {
group: {
paddingBottom: '10px',
width: '40px',
float: 'left',
marginRight: '10px',
},
},
}
}
handleClick = (data: any) => {
this.props.onClick(data)
}
render(): any {
var colors = []
for (var i = 0; i < this.props.group.length; i++) {
var color = this.props.group[i]
colors.push(<SwatchesColor key={ color } color={ color } active={ color.toLowerCase() === this.props.active } first={ i === 0 } last={ i === this.props.group.length - 1 } onClick={ this.handleClick } />)
}
return (
<div is="group" ref="group">
{ colors }
</div>
)
}
}
export default SwatchesGroup
|
src/components/app.js
|
MichaelWiss/React_E
|
import React, { Component } from 'react';
export default class App extends Component {
render() {
return (
<div>
{this.props.children}
</div>
);
}
}
|
techCurriculum/ui/solutions/5.2/src/components/Title.js
|
tadas412/EngineeringEssentials
|
/**
* Copyright 2017 Goldman Sachs.
* 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.
**/
import React from 'react';
function Title() {
return (
<div>
<h1>Cards</h1>
<h2>Share your ideas</h2>
</div>
);
}
export default Title;
|
src/shared/components/donate/donate.js
|
sethbergman/operationcode_frontend
|
import React from 'react';
import Section from 'shared/components/section/section';
import LinkButton from 'shared/components/linkButton/linkButton';
import commonUrl from 'shared/constants/commonLinks';
import styles from './donate.css';
const Donate = () => (
<Section
title="Donate"
headingLines={false}
className={styles.donateSection}
headingTheme="white"
>
<div className={styles.donate}>
<p>
As a 501(c)(3) veteran-led nonprofit organization, our programs and
services are maintained through the efforts of our volunteer staff. Your
financial support allows us to continue helping the military community
learn software development, enter the tech industry, and code the
future.
</p>
<p>Thank you for supporting our mission!</p>
<LinkButton text="Donate Now" link={commonUrl.donateLink} isExternal />
</div>
</Section>
);
export default Donate;
|
demo/src/index.js
|
Psykar/react-filtered-multiselect
|
import 'bootstrap/dist/css/bootstrap.min.css'
import 'bootstrap/dist/css/bootstrap-theme.min.css'
import React from 'react'
import {render} from 'react-dom'
import FilteredMultiSelect from '../../src/index'
import CULTURE_SHIPS from './ships.json'
const BOOTSTRAP_CLASSES = {
filter: 'form-control',
select: 'form-control',
button: 'btn btn btn-block btn-default',
buttonActive: 'btn btn btn-block btn-primary'
}
var BasicSelection = React.createClass({
getInitialState() {
return {
selectedOptions: []
}
},
handleClearSelection() {
this.setState({selectedOptions: []})
},
handleDeselect(index) {
var selectedOptions = this.state.selectedOptions.slice()
selectedOptions.splice(index, 1)
this.setState({selectedOptions})
},
handleSelectionChange(selectedOptions) {
selectedOptions.sort((a, b) => a.id - b.id)
this.setState({selectedOptions})
},
render() {
var {selectedOptions} = this.state
return <div className="row">
<div className="col-md-5">
<FilteredMultiSelect
classNames={BOOTSTRAP_CLASSES}
onChange={this.handleSelectionChange}
options={CULTURE_SHIPS}
selectedOptions={selectedOptions}
textProp="name"
valueProp="id"
/>
<p className="help-block">Press Enter when there's only one matching item to select it.</p>
</div>
<div className="col-md-5">
{selectedOptions.length === 0 && <p>(nothing selected yet)</p>}
{selectedOptions.length > 0 && <ol>
{selectedOptions.map((ship, i) => <li key={ship.id}>
{`${ship.name} `}
<span style={{cursor: 'pointer'}} onClick={this.handleDeselect.bind(null, i)}>
×
</span>
</li>)}
</ol>}
{selectedOptions.length > 0 && <button style={{marginLeft: 20}} className="btn btn-default" onClick={this.handleClearSelection}>
Clear Selection
</button>}
</div>
</div>
}
})
var AddRemoveSelection = React.createClass({
getInitialState() {
return {
selectedOptions: []
}
},
handleDeselect(deselectedOptions) {
var selectedOptions = this.state.selectedOptions.slice()
deselectedOptions.forEach(option => {
selectedOptions.splice(selectedOptions.indexOf(option), 1)
})
this.setState({selectedOptions})
},
handleSelect(selectedOptions) {
selectedOptions.sort((a, b) => a.id - b.id)
this.setState({selectedOptions})
},
render() {
var {selectedOptions} = this.state
return <div className="row">
<div className="col-md-5">
<FilteredMultiSelect
buttonText="Add"
classNames={BOOTSTRAP_CLASSES}
onChange={this.handleSelect}
options={CULTURE_SHIPS}
selectedOptions={selectedOptions}
textProp="name"
valueProp="id"
/>
</div>
<div className="col-md-5">
<FilteredMultiSelect
buttonText="Remove"
classNames={{
filter: 'form-control',
select: 'form-control',
button: 'btn btn btn-block btn-default',
buttonActive: 'btn btn btn-block btn-danger'
}}
onChange={this.handleDeselect}
options={selectedOptions}
textProp="name"
valueProp="id"
/>
</div>
</div>
}
})
var App = React.createClass({
render() {
return <div className="container">
<div className="row header">
<div className="col-md-12">
<h1><a href="https://github.com/insin/react-filtered-multiselect">React <FilteredMultiSelect/></a></h1>
<p className="lead">A reusable React component for making and adding to selections using a filtered multi-select.</p>
</div>
</div>
<h2>Basic Selection</h2>
<p>Select some ships from <a href="http://en.wikipedia.org/wiki/The_Culture">The Culture</a>.</p>
<BasicSelection/>
<h2>Add & Remove</h2>
<p>Move items from one <code><FilteredMultiSelect/></code> to another and back again.</p>
<AddRemoveSelection/>
</div>
}
})
var app = document.querySelector('#app')
if (!app) {
app = document.createElement('div')
app.id = 'app'
document.body.appendChild(app)
}
render(<App/>, app)
|
go-betz/src/views/add-credits/index.js
|
FabioFischer/go-betz
|
import React from 'react';
import { TextField } from 'material-ui';
import { AuthenticatedButton } from './../../components';
import { wallet, ls } from './../../services';
class AddCredits extends React.Component {
state = {
value: ''
};
handleOnChange = (e, newValue) => this.setState({ value: newValue });
handleCCChange = (e, newValue) => this.setState({ creditCard: newValue });
handleCancel = () => this.props.history.push('my-bets');
getPaymentRequest() {
const supportedInstruments = [{
supportedMethods: ['basic-card'],
data: {
supportedNetworks: [
'visa', 'mastercard', 'amex', 'discover',
'diners', 'jcb', 'unionpay'
]
}
}];
const details = {
displayItems: [{
label: 'Credits',
amount: { currency: 'BRL', value: parseFloat(this.state.value) || 0 }
}],
total: {
label: 'Total due',
amount: { currency: 'BRL', value: this.state.value }
}
};
return new window.PaymentRequest(supportedInstruments, details);
}
handleAdd() {
const request = this.getPaymentRequest();
request.show()
.then(result => {
const currentUser = ls.get('current_user');
const requestBody = {
userId: currentUser ? currentUser.id : 0,
value: parseFloat(this.state.value),
payment: result.toJSON()
};
console.log('request', requestBody);
return wallet.addCredits(requestBody)
.then(response => result.complete('success'))
.catch(e => result.complete('fail'))
});
}
render() {
return (
<div className='add-credits page upner--page'>
<div className='add-credits--content'>
<h2>ADD CREDITS</h2>
<div className='add-credits--form'>
<form>
<TextField name='value' value={this.state.value} onChange={this.handleOnChange} floatingLabelText='Value' />
</form>
</div>
<div className='add-credits--actions'>
<AuthenticatedButton label='add' primary onTouchTap={this.handleAdd.bind(this)} />
<AuthenticatedButton label='cancel' primary onTouchTap={this.handleCancel} />
</div>
</div>
</div>
);
}
}
export default AddCredits;
// <Stepper activeStep={stepIndex}>
// <Step>
// <StepLabel>Select campaign settings</StepLabel>
// </Step>
// <Step>
// <StepLabel>Create an ad group</StepLabel>
// </Step>
// <Step>
// <StepLabel>Create an ad</StepLabel>
// </Step>
// </Stepper>
|
client/src/components/RecordingStatus.js
|
jakkra/SmartMirror
|
import React from 'react';
const styles = {
redCircle: {
borderRadius: '50%',
width: '20px',
height: '20px',
backgroundColor: 'red',
},
};
const RecordingStatus = ({ isRecording }) => <canvas hidden={!isRecording} style={styles.redCircle} />;
export default RecordingStatus;
|
src/shared/element-react/dist/npm/es6/src/collapse/Collapse.js
|
thundernet8/Elune-WWW
|
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
import React from 'react';
import { Component, PropTypes } from '../../libs';
var Collapse = function (_Component) {
_inherits(Collapse, _Component);
function Collapse(props) {
_classCallCheck(this, Collapse);
var _this = _possibleConstructorReturn(this, _Component.call(this, props));
_this.state = {
activeNames: [].concat(_this.props.value)
};
return _this;
}
Collapse.prototype.setActiveNames = function setActiveNames(activeNames) {
var _this2 = this;
activeNames = [].concat(activeNames);
this.setState({ activeNames: activeNames }, function () {
return _this2.props.onChange(activeNames);
});
};
Collapse.prototype.handleItemClick = function handleItemClick(name) {
var activeNames = this.state.activeNames;
if (this.props.accordion) {
this.setActiveNames(activeNames[0] && activeNames[0] === name ? '' : name);
} else {
if (activeNames.includes(name)) {
this.setActiveNames(activeNames.filter(function (item) {
return item !== name;
}));
} else {
this.setActiveNames(activeNames.concat(name));
}
}
};
Collapse.prototype.render = function render() {
var _this3 = this;
var content = React.Children.map(this.props.children, function (child, idx) {
var name = child.props.name || idx.toString();
return React.cloneElement(child, {
isActive: _this3.state.activeNames.includes(name),
key: idx,
name: name,
onClick: function onClick(item) {
return _this3.handleItemClick(item);
}
});
});
return React.createElement(
'div',
{ className: 'el-collapse' },
content
);
};
return Collapse;
}(Component);
Collapse.defaultProps = {
value: [],
onChange: function onChange() {}
};
export default Collapse;
Collapse.propTypes = {
accordion: PropTypes.bool,
value: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
onChange: PropTypes.func
};
|
mobile_app/src/components/views/userProfile/MyProfile.js
|
youennPennarun/agorask
|
/* @flow*/
import React from 'react';
import { View, Text, Image, Dimensions, StyleSheet } from 'react-native';
import { connect } from 'react-redux';
import {MKTextField, MKColor} from 'react-native-material-kit';
import TopBar from '../../commons/TopBar';
import ProfilePic from '../../commons/ProfilePic';
const { width } = Dimensions.get('window');
type MyProfilePropsType = {
username: string,
};
function MyProfile(props: MyProfilePropsType) {
const profilePictureUrl = ProfilePic.getImageURL(props.username);
return (
<View style={styles.container} >
<TopBar left={TopBar.BACK} right={TopBar.SUBMIT} title={'Profile'} />
<View style={styles.header} >
<Image style={styles.profilePic} source={{ uri: profilePictureUrl }} />
</View>
<View style={styles.form}>
<Text style={styles.title} >Change password</Text>
<PasswordInput placeholder='Old password' />
<PasswordInput placeholder='New password' />
<PasswordInput placeholder='Password confirmation' />
</View>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#e9e9e9',
},
header: {
alignItems: 'center',
backgroundColor: 'white',
elevation: 5,
},
profilePic: {
width,
height: width * (9 / 16),
},
username: {
fontSize: 30,
},
title: {
marginLeft: 15,
marginTop: 15,
fontSize: 20,
},
form: {
backgroundColor: 'white',
paddingHorizontal: 15,
paddingBottom: 15,
elevation: 3,
},
input: {
height: 45,
},
});
const PasswordInput = MKTextField.textfieldWithFloatingLabel()
.withPassword(true)
.withDefaultValue('')
.withHighlightColor(MKColor.DeepPurple)
.withStyle(styles.input)
.withTextInputStyle(styles.textInput)
.build();
function mapStateToProps(state): Object {
return {
...state.user,
};
}
export default connect(mapStateToProps)(MyProfile);
|
examples/huge-apps/routes/Profile/components/Profile.js
|
rubengrill/react-router
|
import React from 'react'
class Profile extends React.Component {
render() {
return (
<div>
<h2>Profile</h2>
</div>
)
}
}
export default Profile
|
src/components/Footer.js
|
cape-io/acf-client
|
import React from 'react'
function Footer() {
return (
<footer id="footer" className="sticky">
<div className="copyright">
<div className="container">
<ul className="pull-right nomargin list-inline mobile-block">
<li><a href="https://composersforum.org/terms-service">Terms & Conditions</a></li>
<li>•</li>
<li><a href="https://composersforum.org/privacy-policy">Privacy</a></li>
</ul>
© 2015 American Composers Forum. All rights reserved
</div>
</div>
</footer>
)
}
Footer.propTypes = {}
// Logout.defaultProps = {};
export default Footer
|
packages/material-ui-icons/src/HdrOnRounded.js
|
kybarg/material-ui
|
import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<path d="M7.25 9c-.41 0-.75.34-.75.75V11h-2V9.75c0-.41-.34-.75-.75-.75S3 9.34 3 9.75v4.5c0 .41.34.75.75.75s.75-.34.75-.75V12.5h2v1.75c0 .41.34.75.75.75s.75-.34.75-.75v-4.5C8 9.34 7.66 9 7.25 9zM21 11.5v-1c0-.83-.67-1.5-1.5-1.5H17c-.55 0-1 .45-1 1v4.25c0 .41.34.75.75.75s.75-.34.75-.75V13h1.1l.72 1.59c.11.25.36.41.63.41.5 0 .83-.51.64-.96l-.49-1.14c.5-.3.9-.8.9-1.4zm-3.5 0v-1h2v1h-2zM13 9h-3c-.28 0-.5.22-.5.5v5c0 .28.22.5.5.5h3c.82 0 1.5-.68 1.5-1.5v-3c0-.82-.68-1.5-1.5-1.5zm0 4.5h-2v-3h2v3z" />
, 'HdrOnRounded');
|
bear-ts-apollo/build/client/.next/dist/components/Layout.js
|
thoughtbit/node-web-starter
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var head_1 = require("next/dist/lib/head.js");
var Header_1 = require("./Header");
var Layout = function Layout(_ref) {
var children = _ref.children,
_ref$title = _ref.title,
title = _ref$title === undefined ? 'This is the default title' : _ref$title;
return React.createElement("div", null, React.createElement(head_1.default, null, React.createElement("title", null, title), React.createElement("meta", { charSet: 'utf-8' }), React.createElement("meta", { name: 'viewport', content: 'initial-scale=1.0, width=device-width' }), React.createElement("link", { rel: 'stylesheet', type: 'text/css', href: '/static/nprogress.css' })), React.createElement(Header_1.default, null), children, React.createElement("footer", null, "I`m here to stay"));
};
exports.default = Layout;
//# sourceMappingURL=Layout.js.map
|
app/m_components/Footer.js
|
kongchun/BigData-Web
|
import React from 'react';
import {
IndexLink
} from 'react-router';
class Footer extends React.Component {
componentDidMount() {
/*$(".footer-nav .navbar").headroom({
tolerance: 0,
offset: 0,
classes: {
initial: "animated",
pinned: "slideInUp",
unpinned: "slideOutDown"
}
});*/
}
render() {
return (<div className="footer-nav">
<nav className="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div className="container-fluid">
<div className="nav-tab">
<IndexLink to={'/'} className="tab-item" activeClassName="tab-item-active">
<div className="glyphicon glyphicon-inbox"></div>
<div>快阅</div>
</IndexLink>
<IndexLink to={'/page/1'} className="tab-item" activeClassName="tab-item-active">
<div className="glyphicon glyphicon-th-list"></div>
<div>资讯</div>
</IndexLink>
<IndexLink to={'/hotdot'} className="tab-item hide" activeClassName="tab-item-active">
<div className="glyphicon glyphicon-signal"></div>
<div>趋势</div>
</IndexLink>
<IndexLink to={'/sports'} className="tab-item hide" activeClassName="tab-item-active">
<div className="glyphicon glyphicon-globe"></div>
<div>专家</div>
</IndexLink>
<IndexLink to={'/myInfo'} className="tab-item" activeClassName="tab-item-active">
<div className="glyphicon glyphicon-user"></div>
<div>我的</div>
</IndexLink>
</div>
</div>
</nav>
</div> );
}
}
export default Footer;
|
src/components/pages/demoPage/Register.js
|
guangqiang-liu/OneM
|
import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
import Button from 'react-native-button';
import { Actions } from 'react-native-router-flux';
export default class Register extends React.Component {
render() {
return (
<View style={styles.container}>
<Text>Register page</Text>
<Button onPress={()=>Actions.register2()}>Register</Button>
<Button onPress={Actions.home}>Replace screen</Button>
<Button onPress={Actions.pop}>Back</Button>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
})
|
app/javascript/mastodon/features/status/index.js
|
hugogameiro/mastodon
|
import Immutable from 'immutable';
import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { fetchStatus } from '../../actions/statuses';
import MissingIndicator from '../../components/missing_indicator';
import DetailedStatus from './components/detailed_status';
import ActionBar from './components/action_bar';
import Column from '../ui/components/column';
import {
favourite,
unfavourite,
reblog,
unreblog,
pin,
unpin,
} from '../../actions/interactions';
import {
replyCompose,
mentionCompose,
directCompose,
} from '../../actions/compose';
import { blockAccount } from '../../actions/accounts';
import {
muteStatus,
unmuteStatus,
deleteStatus,
hideStatus,
revealStatus,
} from '../../actions/statuses';
import { initMuteModal } from '../../actions/mutes';
import { initReport } from '../../actions/reports';
import { makeGetStatus } from '../../selectors';
import { ScrollContainer } from 'react-router-scroll-4';
import ColumnBackButton from '../../components/column_back_button';
import ColumnHeader from '../../components/column_header';
import StatusContainer from '../../containers/status_container';
import { openModal } from '../../actions/modal';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { HotKeys } from 'react-hotkeys';
import { boostModal, deleteModal } from '../../initial_state';
import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from '../ui/util/fullscreen';
import { textForScreenReader } from '../../components/status';
const messages = defineMessages({
deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
deleteMessage: { id: 'confirmations.delete.message', defaultMessage: 'Are you sure you want to delete this status?' },
redraftConfirm: { id: 'confirmations.redraft.confirm', defaultMessage: 'Delete & redraft' },
redraftMessage: { id: 'confirmations.redraft.message', defaultMessage: 'Are you sure you want to delete this status and re-draft it? Favourites and boosts will be lost, and replies to the original post will be orphaned.' },
blockConfirm: { id: 'confirmations.block.confirm', defaultMessage: 'Block' },
revealAll: { id: 'status.show_more_all', defaultMessage: 'Show more for all' },
hideAll: { id: 'status.show_less_all', defaultMessage: 'Show less for all' },
detailedStatus: { id: 'status.detailed_status', defaultMessage: 'Detailed conversation view' },
replyConfirm: { id: 'confirmations.reply.confirm', defaultMessage: 'Reply' },
replyMessage: { id: 'confirmations.reply.message', defaultMessage: 'Replying now will overwrite the message you are currently composing. Are you sure you want to proceed?' },
});
const makeMapStateToProps = () => {
const getStatus = makeGetStatus();
const mapStateToProps = (state, props) => {
const status = getStatus(state, { id: props.params.statusId });
let ancestorsIds = Immutable.List();
let descendantsIds = Immutable.List();
if (status) {
ancestorsIds = ancestorsIds.withMutations(mutable => {
let id = status.get('in_reply_to_id');
while (id) {
mutable.unshift(id);
id = state.getIn(['contexts', 'inReplyTos', id]);
}
});
descendantsIds = descendantsIds.withMutations(mutable => {
const ids = [status.get('id')];
while (ids.length > 0) {
let id = ids.shift();
const replies = state.getIn(['contexts', 'replies', id]);
if (status.get('id') !== id) {
mutable.push(id);
}
if (replies) {
replies.reverse().forEach(reply => {
ids.unshift(reply);
});
}
}
});
}
return {
status,
ancestorsIds,
descendantsIds,
askReplyConfirmation: state.getIn(['compose', 'text']).trim().length !== 0,
};
};
return mapStateToProps;
};
export default @injectIntl
@connect(makeMapStateToProps)
class Status extends ImmutablePureComponent {
static contextTypes = {
router: PropTypes.object,
};
static propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
status: ImmutablePropTypes.map,
ancestorsIds: ImmutablePropTypes.list,
descendantsIds: ImmutablePropTypes.list,
intl: PropTypes.object.isRequired,
askReplyConfirmation: PropTypes.bool,
};
state = {
fullscreen: false,
};
componentWillMount () {
this.props.dispatch(fetchStatus(this.props.params.statusId));
}
componentDidMount () {
attachFullscreenListener(this.onFullScreenChange);
}
componentWillReceiveProps (nextProps) {
if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) {
this._scrolledIntoView = false;
this.props.dispatch(fetchStatus(nextProps.params.statusId));
}
}
handleFavouriteClick = (status) => {
if (status.get('favourited')) {
this.props.dispatch(unfavourite(status));
} else {
this.props.dispatch(favourite(status));
}
}
handlePin = (status) => {
if (status.get('pinned')) {
this.props.dispatch(unpin(status));
} else {
this.props.dispatch(pin(status));
}
}
handleReplyClick = (status) => {
let { askReplyConfirmation, dispatch, intl } = this.props;
if (askReplyConfirmation) {
dispatch(openModal('CONFIRM', {
message: intl.formatMessage(messages.replyMessage),
confirm: intl.formatMessage(messages.replyConfirm),
onConfirm: () => dispatch(replyCompose(status, this.context.router.history)),
}));
} else {
dispatch(replyCompose(status, this.context.router.history));
}
}
handleModalReblog = (status) => {
this.props.dispatch(reblog(status));
}
handleReblogClick = (status, e) => {
if (status.get('reblogged')) {
this.props.dispatch(unreblog(status));
} else {
if ((e && e.shiftKey) || !boostModal) {
this.handleModalReblog(status);
} else {
this.props.dispatch(openModal('BOOST', { status, onReblog: this.handleModalReblog }));
}
}
}
handleDeleteClick = (status, history, withRedraft = false) => {
const { dispatch, intl } = this.props;
if (!deleteModal) {
dispatch(deleteStatus(status.get('id'), history, withRedraft));
} else {
dispatch(openModal('CONFIRM', {
message: intl.formatMessage(withRedraft ? messages.redraftMessage : messages.deleteMessage),
confirm: intl.formatMessage(withRedraft ? messages.redraftConfirm : messages.deleteConfirm),
onConfirm: () => dispatch(deleteStatus(status.get('id'), history, withRedraft)),
}));
}
}
handleDirectClick = (account, router) => {
this.props.dispatch(directCompose(account, router));
}
handleMentionClick = (account, router) => {
this.props.dispatch(mentionCompose(account, router));
}
handleOpenMedia = (media, index) => {
this.props.dispatch(openModal('MEDIA', { media, index }));
}
handleOpenVideo = (media, time) => {
this.props.dispatch(openModal('VIDEO', { media, time }));
}
handleMuteClick = (account) => {
this.props.dispatch(initMuteModal(account));
}
handleConversationMuteClick = (status) => {
if (status.get('muted')) {
this.props.dispatch(unmuteStatus(status.get('id')));
} else {
this.props.dispatch(muteStatus(status.get('id')));
}
}
handleToggleHidden = (status) => {
if (status.get('hidden')) {
this.props.dispatch(revealStatus(status.get('id')));
} else {
this.props.dispatch(hideStatus(status.get('id')));
}
}
handleToggleAll = () => {
const { status, ancestorsIds, descendantsIds } = this.props;
const statusIds = [status.get('id')].concat(ancestorsIds.toJS(), descendantsIds.toJS());
if (status.get('hidden')) {
this.props.dispatch(revealStatus(statusIds));
} else {
this.props.dispatch(hideStatus(statusIds));
}
}
handleBlockClick = (account) => {
const { dispatch, intl } = this.props;
dispatch(openModal('CONFIRM', {
message: <FormattedMessage id='confirmations.block.message' defaultMessage='Are you sure you want to block {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
confirm: intl.formatMessage(messages.blockConfirm),
onConfirm: () => dispatch(blockAccount(account.get('id'))),
}));
}
handleReport = (status) => {
this.props.dispatch(initReport(status.get('account'), status));
}
handleEmbed = (status) => {
this.props.dispatch(openModal('EMBED', { url: status.get('url') }));
}
handleHotkeyMoveUp = () => {
this.handleMoveUp(this.props.status.get('id'));
}
handleHotkeyMoveDown = () => {
this.handleMoveDown(this.props.status.get('id'));
}
handleHotkeyReply = e => {
e.preventDefault();
this.handleReplyClick(this.props.status);
}
handleHotkeyFavourite = () => {
this.handleFavouriteClick(this.props.status);
}
handleHotkeyBoost = () => {
this.handleReblogClick(this.props.status);
}
handleHotkeyMention = e => {
e.preventDefault();
this.handleMentionClick(this.props.status.get('account'));
}
handleHotkeyOpenProfile = () => {
this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`);
}
handleHotkeyToggleHidden = () => {
this.handleToggleHidden(this.props.status);
}
handleMoveUp = id => {
const { status, ancestorsIds, descendantsIds } = this.props;
if (id === status.get('id')) {
this._selectChild(ancestorsIds.size - 1);
} else {
let index = ancestorsIds.indexOf(id);
if (index === -1) {
index = descendantsIds.indexOf(id);
this._selectChild(ancestorsIds.size + index);
} else {
this._selectChild(index - 1);
}
}
}
handleMoveDown = id => {
const { status, ancestorsIds, descendantsIds } = this.props;
if (id === status.get('id')) {
this._selectChild(ancestorsIds.size + 1);
} else {
let index = ancestorsIds.indexOf(id);
if (index === -1) {
index = descendantsIds.indexOf(id);
this._selectChild(ancestorsIds.size + index + 2);
} else {
this._selectChild(index + 1);
}
}
}
_selectChild (index) {
const element = this.node.querySelectorAll('.focusable')[index];
if (element) {
element.focus();
}
}
renderChildren (list) {
return list.map(id => (
<StatusContainer
key={id}
id={id}
onMoveUp={this.handleMoveUp}
onMoveDown={this.handleMoveDown}
contextType='thread'
/>
));
}
setRef = c => {
this.node = c;
}
componentDidUpdate () {
if (this._scrolledIntoView) {
return;
}
const { status, ancestorsIds } = this.props;
if (status && ancestorsIds && ancestorsIds.size > 0) {
const element = this.node.querySelectorAll('.focusable')[ancestorsIds.size - 1];
window.requestAnimationFrame(() => {
element.scrollIntoView(true);
});
this._scrolledIntoView = true;
}
}
componentWillUnmount () {
detachFullscreenListener(this.onFullScreenChange);
}
onFullScreenChange = () => {
this.setState({ fullscreen: isFullscreen() });
}
render () {
let ancestors, descendants;
const { shouldUpdateScroll, status, ancestorsIds, descendantsIds, intl } = this.props;
const { fullscreen } = this.state;
if (status === null) {
return (
<Column>
<ColumnBackButton />
<MissingIndicator />
</Column>
);
}
if (ancestorsIds && ancestorsIds.size > 0) {
ancestors = <div>{this.renderChildren(ancestorsIds)}</div>;
}
if (descendantsIds && descendantsIds.size > 0) {
descendants = <div>{this.renderChildren(descendantsIds)}</div>;
}
const handlers = {
moveUp: this.handleHotkeyMoveUp,
moveDown: this.handleHotkeyMoveDown,
reply: this.handleHotkeyReply,
favourite: this.handleHotkeyFavourite,
boost: this.handleHotkeyBoost,
mention: this.handleHotkeyMention,
openProfile: this.handleHotkeyOpenProfile,
toggleHidden: this.handleHotkeyToggleHidden,
};
return (
<Column label={intl.formatMessage(messages.detailedStatus)}>
<ColumnHeader
showBackButton
extraButton={(
<button className='column-header__button' title={intl.formatMessage(status.get('hidden') ? messages.revealAll : messages.hideAll)} aria-label={intl.formatMessage(status.get('hidden') ? messages.revealAll : messages.hideAll)} onClick={this.handleToggleAll} aria-pressed={status.get('hidden') ? 'false' : 'true'}><i className={`fa fa-${status.get('hidden') ? 'eye-slash' : 'eye'}`} /></button>
)}
/>
<ScrollContainer scrollKey='thread' shouldUpdateScroll={shouldUpdateScroll}>
<div className={classNames('scrollable', { fullscreen })} ref={this.setRef}>
{ancestors}
<HotKeys handlers={handlers}>
<div className={classNames('focusable', 'detailed-status__wrapper')} tabIndex='0' aria-label={textForScreenReader(intl, status, false, !status.get('hidden'))}>
<DetailedStatus
status={status}
onOpenVideo={this.handleOpenVideo}
onOpenMedia={this.handleOpenMedia}
onToggleHidden={this.handleToggleHidden}
/>
<ActionBar
status={status}
onReply={this.handleReplyClick}
onFavourite={this.handleFavouriteClick}
onReblog={this.handleReblogClick}
onDelete={this.handleDeleteClick}
onDirect={this.handleDirectClick}
onMention={this.handleMentionClick}
onMute={this.handleMuteClick}
onMuteConversation={this.handleConversationMuteClick}
onBlock={this.handleBlockClick}
onReport={this.handleReport}
onPin={this.handlePin}
onEmbed={this.handleEmbed}
/>
</div>
</HotKeys>
{descendants}
</div>
</ScrollContainer>
</Column>
);
}
}
|
src/client/routes.js
|
jaegerpicker/GLDice
|
import App from './app/app.react';
import Examples from './pages/examples.react';
import Home from './pages/home.react';
import Login from './pages/login.react';
import Me from './pages/me.react';
import NotFound from './pages/notfound.react';
import React from 'react';
import Todos from './pages/todos.react';
import {DefaultRoute, NotFoundRoute, Route} from 'react-router';
export default (
<Route handler={App} path="/">
<DefaultRoute handler={Home} name="home" />
<NotFoundRoute handler={NotFound} name="not-found" />
<Route handler={Examples} name="examples" />
<Route handler={Login} name="login" />
<Route handler={Me} name="me" />
<Route handler={Todos} name="todos" />
</Route>
);
|
app/components/UserBadge/index.js
|
ScoutingIJsselgroep/Jotihunt
|
import React from 'react';
export default class UserBadge extends React.Component { // eslint-disable-line react/prefer-stateless-function
static propTypes = {
picture: React.PropTypes.string.isRequired,
};
render() {
return <img alt="avatar" src={this.props.picture} />;
}
}
|
src/components/dropdown/FormDropdown.js
|
mariusespejo/semantic-redux-form-fields
|
import React, { Component } from 'react';
import { connectedDropdown } from '../../hoc';
import { Form, Dropdown, Label } from 'semantic-ui-react';
export const ReduxDropdown = connectedDropdown(Dropdown);
class FormDropdown extends Component {
handleChange = (e, { value, options }) => {
const {
input: { onChange }
} = this.props;
onChange(value);
};
render() {
const {
input: { name, onBlur, value },
meta: { error, touched },
meta,
simpleValue,
label,
readOnly,
width,
errorMessageStyle,
required,
inline,
...rest
} = this.props;
let hasError = touched && Boolean(error);
if (readOnly) {
return (
<span className="read-only">
{this.props.multiple && Array.isArray(value)
? value.join(', ')
: value}
</span>
);
}
return (
<Form.Field
error={hasError}
width={width}
required={required}
inline={inline}
>
{label && <label>{label}</label>}
<ReduxDropdown
name={name}
value={value}
label={label}
search
selection
onChange={this.handleChange}
selectOnBlur={touched}
onBlur={e => {
e.preventDefault();
onBlur();
}}
{...rest}
/>
{hasError && (
<Label
className="error-message"
pointing={inline ? 'left' : true}
style={errorMessageStyle}
>
{error}
</Label>
)}
</Form.Field>
);
}
}
export default FormDropdown;
|
code/workspaces/web-app/src/pages/SparkPage.js
|
NERC-CEH/datalab
|
import React from 'react';
import Typography from '@material-ui/core/Typography';
import { makeStyles } from '@material-ui/core/styles';
import copy from 'copy-to-clipboard';
import Page from './Page';
import ClustersContainer from '../containers/clusters/ClustersContainer';
import ExternalLink from '../components/common/ExternalLink';
import { SPARK_CLUSTER_TYPE } from '../containers/clusters/clusterTypeName';
import notify from '../components/common/notify';
const useStyles = makeStyles(theme => ({
clusterList: {
marginTop: theme.spacing(5),
},
}));
export const getPythonMessage = (condaPath, schedulerAddress, maxWorkerMemoryGb) => {
const pythonVersionString = `${condaPath}/bin/python`;
// 1GB is reserved, and Spark expects integer values for the executor memory.
const mem = Math.floor(maxWorkerMemoryGb) - 1;
return `import os
import pyspark
conf = pyspark.SparkConf()
# The below option can be altered depending on your memory requirement.
# The maximum value is the amount of memory assigned to each worker, minus 1GB.
conf.set('spark.executor.memory', '${mem}g')
os.environ["PYSPARK_PYTHON"] = "${pythonVersionString}"
os.environ["PYSPARK_DRIVER_PYTHON"] = "${pythonVersionString}"
sc = pyspark.SparkContext(master="${schedulerAddress}", conf=conf)
sc
`;
};
const copyPythonSnippet = ({ condaPath, schedulerAddress, maxWorkerMemoryGb }) => {
const message = getPythonMessage(condaPath, schedulerAddress, maxWorkerMemoryGb);
try {
copy(message);
notify.success('Clipboard contains snippet for notebook cell');
} catch (error) {
notify.error('Unable to access clipboard.');
}
};
export const getRMessage = (schedulerAddress, maxWorkerMemoryGb) => {
// 1GB is reserved, and Spark expects integer values for the executor memory.
const mem = Math.floor(maxWorkerMemoryGb) - 1;
return `library(SparkR)
# The below option can be altered depending on your memory requirement.
# The maximum value is the amount of memory assigned to each worker, minus 1GB.
sparkR.session(master="${schedulerAddress}", sparkConfig=list(spark.executor.memory="${mem}g"))`;
};
const copyRSnippet = ({ schedulerAddress, maxWorkerMemoryGb }) => {
const message = getRMessage(schedulerAddress, maxWorkerMemoryGb);
try {
copy(message);
notify.success('Clipboard contains snippet for notebook cell');
} catch (error) {
notify.error('Unable to access clipboard.');
}
};
const SparkPage = () => {
const classes = useStyles();
const copySnippets = {
Python: copyPythonSnippet,
R: copyRSnippet,
};
return (
<Page className={''} title="Spark">
<Typography variant="body1">
<ExternalLink href="https://spark.apache.org/">Apache Spark</ExternalLink> is an open-source cluster-computing framework.<br/>
DataLabs supports usage of Spark via Kubernetes which allows Spark executors
to be deployed across the cluster.
</Typography>
<div className={classes.clusterList}>
<ClustersContainer clusterType={SPARK_CLUSTER_TYPE} copySnippets={copySnippets} />
</div>
</Page>
);
};
export default SparkPage;
|
node_modules/material-ui/lib/svg-icons/action/assignment-late.js
|
aykutyaman/meteor1.3-react-flowrouter-demo
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactAddonsPureRenderMixin = require('react-addons-pure-render-mixin');
var _reactAddonsPureRenderMixin2 = _interopRequireDefault(_reactAddonsPureRenderMixin);
var _svgIcon = require('../../svg-icon');
var _svgIcon2 = _interopRequireDefault(_svgIcon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var ActionAssignmentLate = _react2.default.createClass({
displayName: 'ActionAssignmentLate',
mixins: [_reactAddonsPureRenderMixin2.default],
render: function render() {
return _react2.default.createElement(
_svgIcon2.default,
this.props,
_react2.default.createElement('path', { d: 'M19 3h-4.18C14.4 1.84 13.3 1 12 1c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-6 15h-2v-2h2v2zm0-4h-2V8h2v6zm-1-9c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1z' })
);
}
});
exports.default = ActionAssignmentLate;
module.exports = exports['default'];
|
react-flux-mui/js/material-ui/src/svg-icons/social/notifications-active.js
|
pbogdan/react-flux-mui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let SocialNotificationsActive = (props) => (
<SvgIcon {...props}>
<path d="M7.58 4.08L6.15 2.65C3.75 4.48 2.17 7.3 2.03 10.5h2c.15-2.65 1.51-4.97 3.55-6.42zm12.39 6.42h2c-.15-3.2-1.73-6.02-4.12-7.85l-1.42 1.43c2.02 1.45 3.39 3.77 3.54 6.42zM18 11c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2v-5zm-6 11c.14 0 .27-.01.4-.04.65-.14 1.18-.58 1.44-1.18.1-.24.15-.5.15-.78h-4c.01 1.1.9 2 2.01 2z"/>
</SvgIcon>
);
SocialNotificationsActive = pure(SocialNotificationsActive);
SocialNotificationsActive.displayName = 'SocialNotificationsActive';
SocialNotificationsActive.muiName = 'SvgIcon';
export default SocialNotificationsActive;
|
projects/van-eventviz/viz/index.js
|
ebemunk/blog
|
import React from 'react'
import ReactDOM from 'react-dom'
import { AppContainer } from 'react-hot-loader'
import { Provider } from 'react-redux'
import configureStore from './src/store'
import App from './src/App'
const store = configureStore({})
// if (process.env.NODE_ENV !== 'production') {
// const { whyDidYouUpdate } = require('why-did-you-update')
// whyDidYouUpdate(React)
// }
const render = (component, selector) =>
ReactDOM.render(
<AppContainer>
<Provider store={store}>{component}</Provider>
</AppContainer>,
document.querySelector(selector),
)
// render(<App />, '#root')
|
node_modules/react-icons/md/assessment.js
|
bengimbel/Solstice-React-Contacts-Project
|
import React from 'react'
import Icon from 'react-icon-base'
const MdAssessment = props => (
<Icon viewBox="0 0 40 40" {...props}>
<g><path d="m28.4 28.4v-6.8h-3.4v6.8h3.4z m-6.8 0v-16.8h-3.2v16.8h3.2z m-6.6 0v-11.8h-3.4v11.8h3.4z m16.6-23.4q1.4 0 2.4 1t1 2.4v23.2q0 1.4-1 2.4t-2.4 1h-23.2q-1.4 0-2.4-1t-1-2.4v-23.2q0-1.4 1-2.4t2.4-1h23.2z"/></g>
</Icon>
)
export default MdAssessment
|
bundle.js
|
sophieehsu/todolist
|
(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})({"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\checkbrowser.js":[function(require,module,exports){
/*
convert to pure js
save -g reactify
*/
var React=(window&&window.React)||require("react");
var E=React.createElement;
var hasksanagap=(typeof ksanagap!="undefined");
if (hasksanagap && (typeof console=="undefined" || typeof console.log=="undefined")) {
window.console={log:ksanagap.log,error:ksanagap.error,debug:ksanagap.debug,warn:ksanagap.warn};
console.log("install console output funciton");
}
var checkfs=function() {
return (navigator && navigator.webkitPersistentStorage) || hasksanagap;
}
var featurechecks={
"fs":checkfs
}
var checkbrowser = React.createClass({
getInitialState:function() {
var missingFeatures=this.getMissingFeatures();
return {ready:false, missing:missingFeatures};
},
getMissingFeatures:function() {
var feature=this.props.feature.split(",");
var status=[];
feature.map(function(f){
var checker=featurechecks[f];
if (checker) checker=checker();
status.push([f,checker]);
});
return status.filter(function(f){return !f[1]});
},
downloadbrowser:function() {
window.location="https://www.google.com/chrome/"
},
renderMissing:function() {
var showMissing=function(m) {
return E("div", null, m);
}
return (
E("div", {ref: "dialog1", className: "modal fade", "data-backdrop": "static"},
E("div", {className: "modal-dialog"},
E("div", {className: "modal-content"},
E("div", {className: "modal-header"},
E("button", {type: "button", className: "close", "data-dismiss": "modal", "aria-hidden": "true"}, "×"),
E("h4", {className: "modal-title"}, "Browser Check")
),
E("div", {className: "modal-body"},
E("p", null, "Sorry but the following feature is missing"),
this.state.missing.map(showMissing)
),
E("div", {className: "modal-footer"},
E("button", {onClick: this.downloadbrowser, type: "button", className: "btn btn-primary"}, "Download Google Chrome")
)
)
)
)
);
},
renderReady:function() {
return E("span", null, "browser ok")
},
render:function(){
return (this.state.missing.length)?this.renderMissing():this.renderReady();
},
componentDidMount:function() {
if (!this.state.missing.length) {
this.props.onReady();
} else {
$(this.refs.dialog1.getDOMNode()).modal('show');
}
}
});
module.exports=checkbrowser;
},{"react":"react"}],"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\downloader.js":[function(require,module,exports){
var userCancel=false;
var files=[];
var totalDownloadByte=0;
var targetPath="";
var tempPath="";
var nfile=0;
var baseurl="";
var result="";
var downloading=false;
var startDownload=function(dbid,_baseurl,_files) { //return download id
var fs = require("fs");
var path = require("path");
files=_files.split("\uffff");
if (downloading) return false; //only one session
userCancel=false;
totalDownloadByte=0;
nextFile();
downloading=true;
baseurl=_baseurl;
if (baseurl[baseurl.length-1]!='/')baseurl+='/';
targetPath=ksanagap.rootPath+dbid+'/';
tempPath=ksanagap.rootPath+".tmp/";
result="";
return true;
}
var nextFile=function() {
setTimeout(function(){
if (nfile==files.length) {
nfile++;
endDownload();
} else {
downloadFile(nfile++);
}
},100);
}
var downloadFile=function(nfile) {
var url=baseurl+files[nfile];
var tmpfilename=tempPath+files[nfile];
var mkdirp = require("./mkdirp");
var fs = require("fs");
var http = require("http");
mkdirp.sync(path.dirname(tmpfilename));
var writeStream = fs.createWriteStream(tmpfilename);
var datalength=0;
var request = http.get(url, function(response) {
response.on('data',function(chunk){
writeStream.write(chunk);
totalDownloadByte+=chunk.length;
if (userCancel) {
writeStream.end();
setTimeout(function(){nextFile();},100);
}
});
response.on("end",function() {
writeStream.end();
setTimeout(function(){nextFile();},100);
});
});
}
var cancelDownload=function() {
userCancel=true;
endDownload();
}
var verify=function() {
return true;
}
var endDownload=function() {
nfile=files.length+1;//stop
result="cancelled";
downloading=false;
if (userCancel) return;
var fs = require("fs");
var mkdirp = require("./mkdirp");
for (var i=0;i<files.length;i++) {
var targetfilename=targetPath+files[i];
var tmpfilename =tempPath+files[i];
mkdirp.sync(path.dirname(targetfilename));
fs.renameSync(tmpfilename,targetfilename);
}
if (verify()) {
result="success";
} else {
result="error";
}
}
var downloadedByte=function() {
return totalDownloadByte;
}
var doneDownload=function() {
if (nfile>files.length) return result;
else return "";
}
var downloadingFile=function() {
return nfile-1;
}
var downloader={startDownload:startDownload, downloadedByte:downloadedByte,
downloadingFile:downloadingFile, cancelDownload:cancelDownload,doneDownload:doneDownload};
module.exports=downloader;
},{"./mkdirp":"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\mkdirp.js","fs":false,"http":false,"path":false}],"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\fileinstaller.js":[function(require,module,exports){
/* todo , optional kdb */
var React=(window&&window.React)||require("react");
var HtmlFS=require("./htmlfs");
var html5fs=require("./html5fs");
var CheckBrowser=require("./checkbrowser");
var E=React.createElement;
var FileList = React.createClass({
getInitialState:function() {
return {downloading:false,progress:0};
},
updatable:function(f) {
var classes="btn btn-warning";
if (this.state.downloading) classes+=" disabled";
if (f.hasUpdate) return E("button", {className: classes,
"data-filename": f.filename, "data-url": f.url,
onClick: this.download
}, "Update")
else return null;
},
showLocal:function(f) {
var classes="btn btn-danger";
if (this.state.downloading) classes+=" disabled";
return E("tr", null, E("td", null, f.filename),
E("td", null),
E("td", {className: "pull-right"},
this.updatable(f), E("button", {className: classes,
onClick: this.deleteFile, "data-filename": f.filename}, "Delete")
)
)
},
showRemote:function(f) {
var classes="btn btn-warning";
if (this.state.downloading) classes+=" disabled";
return (E("tr", {"data-id": f.filename}, E("td", null,
f.filename),
E("td", null, f.desc),
E("td", null,
E("span", {"data-filename": f.filename, "data-url": f.url,
className: classes,
onClick: this.download}, "Download")
)
));
},
showFile:function(f) {
// return <span data-id={f.filename}>{f.url}</span>
return (f.ready)?this.showLocal(f):this.showRemote(f);
},
reloadDir:function() {
this.props.action("reload");
},
download:function(e) {
var url=e.target.dataset["url"];
var filename=e.target.dataset["filename"];
this.setState({downloading:true,progress:0,url:url});
this.userbreak=false;
html5fs.download(url,filename,function(){
this.reloadDir();
this.setState({downloading:false,progress:1});
},function(progress,total){
if (progress==0) {
this.setState({message:"total "+total})
}
this.setState({progress:progress});
//if user press abort return true
return this.userbreak;
}
,this);
},
deleteFile:function( e) {
var filename=e.target.attributes["data-filename"].value;
this.props.action("delete",filename);
},
allFilesReady:function(e) {
return this.props.files.every(function(f){ return f.ready});
},
dismiss:function() {
$(this.refs.dialog1.getDOMNode()).modal('hide');
this.props.action("dismiss");
},
abortdownload:function() {
this.userbreak=true;
},
showProgress:function() {
if (this.state.downloading) {
var progress=Math.round(this.state.progress*100);
return (
E("div", null,
"Downloading from ", this.state.url,
E("div", {key: "progress", className: "progress col-md-8"},
E("div", {className: "progress-bar", role: "progressbar",
"aria-valuenow": progress, "aria-valuemin": "0",
"aria-valuemax": "100", style: {width: progress+"%"}},
progress, "%"
)
),
E("button", {onClick: this.abortdownload,
className: "btn btn-danger col-md-4"}, "Abort")
)
);
} else {
if ( this.allFilesReady() ) {
return E("button", {onClick: this.dismiss, className: "btn btn-success"}, "Ok")
} else return null;
}
},
showUsage:function() {
var percent=this.props.remainPercent;
return (E("div", null, E("span", {className: "pull-left"}, "Usage:"), E("div", {className: "progress"},
E("div", {className: "progress-bar progress-bar-success progress-bar-striped", role: "progressbar", style: {width: percent+"%"}},
percent+"%"
)
)));
},
render:function() {
return (
E("div", {ref: "dialog1", className: "modal fade", "data-backdrop": "static"},
E("div", {className: "modal-dialog"},
E("div", {className: "modal-content"},
E("div", {className: "modal-header"},
E("h4", {className: "modal-title"}, "File Installer")
),
E("div", {className: "modal-body"},
E("table", {className: "table"},
E("tbody", null,
this.props.files.map(this.showFile)
)
)
),
E("div", {className: "modal-footer"},
this.showUsage(),
this.showProgress()
)
)
)
)
);
},
componentDidMount:function() {
$(this.refs.dialog1.getDOMNode()).modal('show');
}
});
/*TODO kdb check version*/
var Filemanager = React.createClass({
getInitialState:function() {
var quota=this.getQuota();
return {browserReady:false,noupdate:true, requestQuota:quota,remain:0};
},
getQuota:function() {
var q=this.props.quota||"128M";
var unit=q[q.length-1];
var times=1;
if (unit=="M") times=1024*1024;
else if (unit="K") times=1024;
return parseInt(q) * times;
},
missingKdb:function() {
if (ksanagap.platform!="chrome") return [];
var missing=this.props.needed.filter(function(kdb){
for (var i in html5fs.files) {
if (html5fs.files[i][0]==kdb.filename) return false;
}
return true;
},this);
return missing;
},
getRemoteUrl:function(fn) {
var f=this.props.needed.filter(function(f){return f.filename==fn});
if (f.length ) return f[0].url;
},
genFileList:function(existing,missing){
var out=[];
for (var i in existing) {
var url=this.getRemoteUrl(existing[i][0]);
out.push({filename:existing[i][0], url :url, ready:true });
}
for (var i in missing) {
out.push(missing[i]);
}
return out;
},
reload:function() {
html5fs.readdir(function(files){
this.setState({files:this.genFileList(files,this.missingKdb())});
},this);
},
deleteFile:function(fn) {
html5fs.rm(fn,function(){
this.reload();
},this);
},
onQuoteOk:function(quota,usage) {
if (ksanagap.platform!="chrome") {
//console.log("onquoteok");
this.setState({noupdate:true,missing:[],files:[],autoclose:true
,quota:quota,remain:quota-usage,usage:usage});
return;
}
//console.log("quote ok");
var files=this.genFileList(html5fs.files,this.missingKdb());
var that=this;
that.checkIfUpdate(files,function(hasupdate) {
var missing=this.missingKdb();
var autoclose=this.props.autoclose;
if (missing.length) autoclose=false;
that.setState({autoclose:autoclose,
quota:quota,usage:usage,files:files,
missing:missing,
noupdate:!hasupdate,
remain:quota-usage});
});
},
onBrowserOk:function() {
this.totalDownloadSize();
},
dismiss:function() {
this.props.onReady(this.state.usage,this.state.quota);
setTimeout(function(){
var modalin=$(".modal.in");
if (modalin.modal) modalin.modal('hide');
},500);
},
totalDownloadSize:function() {
var files=this.missingKdb();
var taskqueue=[],totalsize=0;
for (var i=0;i<files.length;i++) {
taskqueue.push(
(function(idx){
return (function(data){
if (!(typeof data=='object' && data.__empty)) totalsize+=data;
html5fs.getDownloadSize(files[idx].url,taskqueue.shift());
});
})(i)
);
}
var that=this;
taskqueue.push(function(data){
totalsize+=data;
setTimeout(function(){that.setState({requireSpace:totalsize,browserReady:true})},0);
});
taskqueue.shift()({__empty:true});
},
checkIfUpdate:function(files,cb) {
var taskqueue=[];
for (var i=0;i<files.length;i++) {
taskqueue.push(
(function(idx){
return (function(data){
if (!(typeof data=='object' && data.__empty)) files[idx-1].hasUpdate=data;
html5fs.checkUpdate(files[idx].url,files[idx].filename,taskqueue.shift());
});
})(i)
);
}
var that=this;
taskqueue.push(function(data){
if (files.length) files[files.length-1].hasUpdate=data;
var hasupdate=files.some(function(f){return f.hasUpdate});
if (cb) cb.apply(that,[hasupdate]);
});
taskqueue.shift()({__empty:true});
},
render:function(){
if (!this.state.browserReady) {
return E(CheckBrowser, {feature: "fs", onReady: this.onBrowserOk})
} if (!this.state.quota || this.state.remain<this.state.requireSpace) {
var quota=this.state.requestQuota;
if (this.state.usage+this.state.requireSpace>quota) {
quota=(this.state.usage+this.state.requireSpace)*1.5;
}
return E(HtmlFS, {quota: quota, autoclose: "true", onReady: this.onQuoteOk})
} else {
if (!this.state.noupdate || this.missingKdb().length || !this.state.autoclose) {
var remain=Math.round((this.state.usage/this.state.quota)*100);
return E(FileList, {action: this.action, files: this.state.files, remainPercent: remain})
} else {
setTimeout( this.dismiss ,0);
return E("span", null, "Success");
}
}
},
action:function() {
var args = Array.prototype.slice.call(arguments);
var type=args.shift();
var res=null, that=this;
if (type=="delete") {
this.deleteFile(args[0]);
} else if (type=="reload") {
this.reload();
} else if (type=="dismiss") {
this.dismiss();
}
}
});
module.exports=Filemanager;
},{"./checkbrowser":"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\checkbrowser.js","./html5fs":"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\html5fs.js","./htmlfs":"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\htmlfs.js","react":"react"}],"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\html5fs.js":[function(require,module,exports){
/* emulate filesystem on html5 browser */
var get_head=function(url,field,cb){
var xhr = new XMLHttpRequest();
xhr.open("HEAD", url, true);
xhr.onreadystatechange = function() {
if (this.readyState == this.DONE) {
cb(xhr.getResponseHeader(field));
} else {
if (this.status!==200&&this.status!==206) {
cb("");
}
}
};
xhr.send();
}
var get_date=function(url,cb) {
get_head(url,"Last-Modified",function(value){
cb(value);
});
}
var get_size=function(url, cb) {
get_head(url,"Content-Length",function(value){
cb(parseInt(value));
});
};
var checkUpdate=function(url,fn,cb) {
if (!url) {
cb(false);
return;
}
get_date(url,function(d){
API.fs.root.getFile(fn, {create: false, exclusive: false}, function(fileEntry) {
fileEntry.getMetadata(function(metadata){
var localDate=Date.parse(metadata.modificationTime);
var urlDate=Date.parse(d);
cb(urlDate>localDate);
});
},function(){
cb(false);
});
});
}
var download=function(url,fn,cb,statuscb,context) {
var totalsize=0,batches=null,written=0;
var fileEntry=0, fileWriter=0;
var createBatches=function(size) {
var bytes=1024*1024, out=[];
var b=Math.floor(size / bytes);
var last=size %bytes;
for (var i=0;i<=b;i++) {
out.push(i*bytes);
}
out.push(b*bytes+last);
return out;
}
var finish=function() {
rm(fn,function(){
fileEntry.moveTo(fileEntry.filesystem.root, fn,function(){
setTimeout( cb.bind(context,false) , 0) ;
},function(e){
console.log("failed",e)
});
},this);
};
var tempfn="temp.kdb";
var batch=function(b) {
var abort=false;
var xhr = new XMLHttpRequest();
var requesturl=url+"?"+Math.random();
xhr.open('get', requesturl, true);
xhr.setRequestHeader('Range', 'bytes='+batches[b]+'-'+(batches[b+1]-1));
xhr.responseType = 'blob';
xhr.addEventListener('load', function() {
var blob=this.response;
fileEntry.createWriter(function(fileWriter) {
fileWriter.seek(fileWriter.length);
fileWriter.write(blob);
written+=blob.size;
fileWriter.onwriteend = function(e) {
if (statuscb) {
abort=statuscb.apply(context,[ fileWriter.length / totalsize,totalsize ]);
if (abort) setTimeout( cb.bind(context,false) , 0) ;
}
b++;
if (!abort) {
if (b<batches.length-1) setTimeout(batch.bind(context,b),0);
else finish();
}
};
}, console.error);
},false);
xhr.send();
}
get_size(url,function(size){
totalsize=size;
if (!size) {
if (cb) cb.apply(context,[false]);
} else {//ready to download
rm(tempfn,function(){
batches=createBatches(size);
if (statuscb) statuscb.apply(context,[ 0, totalsize ]);
API.fs.root.getFile(tempfn, {create: 1, exclusive: false}, function(_fileEntry) {
fileEntry=_fileEntry;
batch(0);
});
},this);
}
});
}
var readFile=function(filename,cb,context) {
API.fs.root.getFile(filename, function(fileEntry) {
var reader = new FileReader();
reader.onloadend = function(e) {
if (cb) cb.apply(cb,[this.result]);
};
}, console.error);
}
var writeFile=function(filename,buf,cb,context){
API.fs.root.getFile(filename, {create: true, exclusive: true}, function(fileEntry) {
fileEntry.createWriter(function(fileWriter) {
fileWriter.write(buf);
fileWriter.onwriteend = function(e) {
if (cb) cb.apply(cb,[buf.byteLength]);
};
}, console.error);
}, console.error);
}
var readdir=function(cb,context) {
var dirReader = API.fs.root.createReader();
var out=[],that=this;
dirReader.readEntries(function(entries) {
if (entries.length) {
for (var i = 0, entry; entry = entries[i]; ++i) {
if (entry.isFile) {
out.push([entry.name,entry.toURL ? entry.toURL() : entry.toURI()]);
}
}
}
API.files=out;
if (cb) cb.apply(context,[out]);
}, function(){
if (cb) cb.apply(context,[null]);
});
}
var getFileURL=function(filename) {
if (!API.files ) return null;
var file= API.files.filter(function(f){return f[0]==filename});
if (file.length) return file[0][1];
}
var rm=function(filename,cb,context) {
var url=getFileURL(filename);
if (url) rmURL(url,cb,context);
else if (cb) cb.apply(context,[false]);
}
var rmURL=function(filename,cb,context) {
webkitResolveLocalFileSystemURL(filename, function(fileEntry) {
fileEntry.remove(function() {
if (cb) cb.apply(context,[true]);
}, console.error);
}, function(e){
if (cb) cb.apply(context,[false]);//no such file
});
}
function errorHandler(e) {
console.error('Error: ' +e.name+ " "+e.message);
}
var initfs=function(grantedBytes,cb,context) {
webkitRequestFileSystem(PERSISTENT, grantedBytes, function(fs) {
API.fs=fs;
API.quota=grantedBytes;
readdir(function(){
API.initialized=true;
cb.apply(context,[grantedBytes,fs]);
},context);
}, errorHandler);
}
var init=function(quota,cb,context) {
navigator.webkitPersistentStorage.requestQuota(quota,
function(grantedBytes) {
initfs(grantedBytes,cb,context);
}, errorHandler
);
}
var queryQuota=function(cb,context) {
var that=this;
navigator.webkitPersistentStorage.queryUsageAndQuota(
function(usage,quota){
initfs(quota,function(){
cb.apply(context,[usage,quota]);
},context);
});
}
var API={
init:init
,readdir:readdir
,checkUpdate:checkUpdate
,rm:rm
,rmURL:rmURL
,getFileURL:getFileURL
,writeFile:writeFile
,readFile:readFile
,download:download
,get_head:get_head
,get_date:get_date
,get_size:get_size
,getDownloadSize:get_size
,queryQuota:queryQuota
}
module.exports=API;
},{}],"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\htmlfs.js":[function(require,module,exports){
var html5fs=require("./html5fs");
var React=(window&&window.React)||require("react");
var E=React.createElement;
var htmlfs = React.createClass({
getInitialState:function() {
return {ready:false, quota:0,usage:0,Initialized:false,autoclose:this.props.autoclose};
},
initFilesystem:function() {
var quota=this.props.quota||1024*1024*128; // default 128MB
quota=parseInt(quota);
html5fs.init(quota,function(q){
this.dialog=false;
$(this.refs.dialog1.getDOMNode()).modal('hide');
this.setState({quota:q,autoclose:true});
},this);
},
welcome:function() {
return (
E("div", {ref: "dialog1", className: "modal fade", id: "myModal", "data-backdrop": "static"},
E("div", {className: "modal-dialog"},
E("div", {className: "modal-content"},
E("div", {className: "modal-header"},
E("h4", {className: "modal-title"}, "Welcome")
),
E("div", {className: "modal-body"},
"Browser will ask for your confirmation."
),
E("div", {className: "modal-footer"},
E("button", {onClick: this.initFilesystem, type: "button",
className: "btn btn-primary"}, "Initialize File System")
)
)
)
)
);
},
renderDefault:function(){
var used=Math.floor(this.state.usage/this.state.quota *100);
var more=function() {
if (used>50) return E("button", {type: "button", className: "btn btn-primary"}, "Allocate More");
else null;
}
return (
E("div", {ref: "dialog1", className: "modal fade", id: "myModal", "data-backdrop": "static"},
E("div", {className: "modal-dialog"},
E("div", {className: "modal-content"},
E("div", {className: "modal-header"},
E("h4", {className: "modal-title"}, "Sandbox File System")
),
E("div", {className: "modal-body"},
E("div", {className: "progress"},
E("div", {className: "progress-bar", role: "progressbar", style: {width: used+"%"}},
used, "%"
)
),
E("span", null, this.state.quota, " total , ", this.state.usage, " in used")
),
E("div", {className: "modal-footer"},
E("button", {onClick: this.dismiss, type: "button", className: "btn btn-default", "data-dismiss": "modal"}, "Close"),
more()
)
)
)
)
);
},
dismiss:function() {
var that=this;
setTimeout(function(){
that.props.onReady(that.state.quota,that.state.usage);
},0);
},
queryQuota:function() {
if (ksanagap.platform=="chrome") {
html5fs.queryQuota(function(usage,quota){
this.setState({usage:usage,quota:quota,initialized:true});
},this);
} else {
this.setState({usage:333,quota:1000*1000*1024,initialized:true,autoclose:true});
}
},
render:function() {
var that=this;
if (!this.state.quota || this.state.quota<this.props.quota) {
if (this.state.initialized) {
this.dialog=true;
return this.welcome();
} else {
return E("span", null, "checking quota");
}
} else {
if (!this.state.autoclose) {
this.dialog=true;
return this.renderDefault();
}
this.dismiss();
this.dialog=false;
return null;
}
},
componentDidMount:function() {
if (!this.state.quota) {
this.queryQuota();
};
},
componentDidUpdate:function() {
if (this.dialog) $(this.refs.dialog1.getDOMNode()).modal('show');
}
});
module.exports=htmlfs;
},{"./html5fs":"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\html5fs.js","react":"react"}],"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\index.js":[function(require,module,exports){
var ksana={"platform":"remote"};
if (typeof window!="undefined") {
window.ksana=ksana;
if (typeof ksanagap=="undefined") {
window.ksanagap=require("./ksanagap"); //compatible layer with mobile
}
}
if (typeof process !="undefined") {
if (process.versions && process.versions["node-webkit"]) {
if (typeof nodeRequire!="undefined") ksana.require=nodeRequire;
ksana.platform="node-webkit";
window.ksanagap.platform="node-webkit";
var ksanajs=require("fs").readFileSync("ksana.js","utf8").trim();
ksana.js=JSON.parse(ksanajs.substring(14,ksanajs.length-1));
window.kfs=require("./kfs");
}
} else if (typeof chrome!="undefined"){//} && chrome.fileSystem){
// window.ksanagap=require("./ksanagap"); //compatible layer with mobile
window.ksanagap.platform="chrome";
window.kfs=require("./kfs_html5");
if(window.location.origin.indexOf("//127.0.0.1")>-1) {
require("./livereload")();
}
ksana.platform="chrome";
} else {
if (typeof ksanagap!="undefined" && typeof fs!="undefined") {//mobile
var ksanajs=fs.readFileSync("ksana.js","utf8").trim(); //android extra \n at the end
ksana.js=JSON.parse(ksanajs.substring(14,ksanajs.length-1));
ksana.platform=ksanagap.platform;
if (typeof ksanagap.android !="undefined") {
ksana.platform="android";
}
}
}
var timer=null;
var React=window.React||require("react");
var boot=function(appId,cb) {
if (typeof React!="undefined") {
React.initializeTouchEvents(true);
}
ksana.appId=appId;
if (ksanagap.platform=="chrome") { //need to wait for jsonp ksana.js
timer=setInterval(function(){
if (ksana.ready){
clearInterval(timer);
if (ksana.js && ksana.js.files && ksana.js.files.length) {
require("./installkdb")(ksana.js,cb);
} else {
cb();
}
}
},300);
} else {
cb();
}
}
module.exports={boot:boot
,htmlfs:require("./htmlfs")
,html5fs:require("./html5fs")
,liveupdate:require("./liveupdate")
,fileinstaller:require("./fileinstaller")
,downloader:require("./downloader")
,installkdb:require("./installkdb")
};
},{"./downloader":"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\downloader.js","./fileinstaller":"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\fileinstaller.js","./html5fs":"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\html5fs.js","./htmlfs":"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\htmlfs.js","./installkdb":"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\installkdb.js","./kfs":"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\kfs.js","./kfs_html5":"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\kfs_html5.js","./ksanagap":"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\ksanagap.js","./livereload":"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\livereload.js","./liveupdate":"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\liveupdate.js","fs":false,"react":"react"}],"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\installkdb.js":[function(require,module,exports){
var React=(window&&window.React)||require("react");
var Fileinstaller=require("./fileinstaller");
var getRequire_kdb=function() {
var required=[];
ksana.js.files.map(function(f){
if (f.indexOf(".kdb")==f.length-4) {
var slash=f.lastIndexOf("/");
if (slash>-1) {
var dbid=f.substring(slash+1,f.length-4);
required.push({url:f,dbid:dbid,filename:dbid+".kdb"});
} else {
var dbid=f.substring(0,f.length-4);
required.push({url:ksana.js.baseurl+f,dbid:dbid,filename:f});
}
}
});
return required;
}
var callback=null;
var onReady=function() {
callback();
}
var openFileinstaller=function(keep) {
var require_kdb=getRequire_kdb().map(function(db){
return {
url:window.location.origin+window.location.pathname+db.dbid+".kdb",
dbdb:db.dbid,
filename:db.filename
}
})
return React.createElement(Fileinstaller, {quota: "512M", autoclose: !keep, needed: require_kdb,
onReady: onReady});
}
var installkdb=function(ksanajs,cb,context) {
React.render(openFileinstaller(),document.getElementById("main"));
callback=cb;
}
module.exports=installkdb;
},{"./fileinstaller":"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\fileinstaller.js","react":"react"}],"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\kfs.js":[function(require,module,exports){
//Simulate feature in ksanagap
/*
runs on node-webkit only
*/
var readDir=function(path) { //simulate Ksanagap function
var fs=nodeRequire("fs");
path=path||"..";
var dirs=[];
if (path[0]==".") {
if (path==".") dirs=fs.readdirSync(".");
else {
dirs=fs.readdirSync("..");
}
} else {
dirs=fs.readdirSync(path);
}
return dirs.join("\uffff");
}
var listApps=function() {
var fs=nodeRequire("fs");
var ksanajsfile=function(d) {return "../"+d+"/ksana.js"};
var dirs=fs.readdirSync("..").filter(function(d){
return fs.statSync("../"+d).isDirectory() && d[0]!="."
&& fs.existsSync(ksanajsfile(d));
});
var out=dirs.map(function(d){
var fn=ksanajsfile(d);
if (!fs.existsSync(fn)) return;
var content=fs.readFileSync(fn,"utf8");
content=content.replace("})","}");
content=content.replace("jsonp_handler(","");
try{
var obj= JSON.parse(content);
obj.dbid=d;
obj.path=d;
return obj;
} catch(e) {
console.log(e);
return null;
}
});
out=out.filter(function(o){return !!o});
return JSON.stringify(out);
}
var kfs={readDir:readDir,listApps:listApps};
module.exports=kfs;
},{}],"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\kfs_html5.js":[function(require,module,exports){
var readDir=function(){
return "[]";
}
var listApps=function(){
return "[]";
}
module.exports={readDir:readDir,listApps:listApps};
},{}],"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\ksanagap.js":[function(require,module,exports){
var appname="installer";
var switchApp=function(path) {
var fs=require("fs");
path="../"+path;
appname=path;
document.location.href= path+"/index.html";
process.chdir(path);
}
var downloader={};
var rootPath="";
var deleteApp=function(app) {
console.error("not allow on PC, do it in File Explorer/ Finder");
}
var username=function() {
return "";
}
var useremail=function() {
return ""
}
var runtime_version=function() {
return "1.4";
}
//copy from liveupdate
var jsonp=function(url,dbid,callback,context) {
var script=document.getElementById("jsonp2");
if (script) {
script.parentNode.removeChild(script);
}
window.jsonp_handler=function(data) {
if (typeof data=="object") {
data.dbid=dbid;
callback.apply(context,[data]);
}
}
window.jsonp_error_handler=function() {
console.error("url unreachable",url);
callback.apply(context,[null]);
}
script=document.createElement('script');
script.setAttribute('id', "jsonp2");
script.setAttribute('onerror', "jsonp_error_handler()");
url=url+'?'+(new Date().getTime());
script.setAttribute('src', url);
document.getElementsByTagName('head')[0].appendChild(script);
}
var ksanagap={
platform:"node-webkit",
startDownload:downloader.startDownload,
downloadedByte:downloader.downloadedByte,
downloadingFile:downloader.downloadingFile,
cancelDownload:downloader.cancelDownload,
doneDownload:downloader.doneDownload,
switchApp:switchApp,
rootPath:rootPath,
deleteApp: deleteApp,
username:username, //not support on PC
useremail:username,
runtime_version:runtime_version,
}
if (typeof process!="undefined" && !process.browser) {
var ksanajs=require("fs").readFileSync("./ksana.js","utf8").trim();
downloader=require("./downloader");
//ksana.js=JSON.parse(ksanajs.substring(14,ksanajs.length-1));
rootPath=process.cwd();
rootPath=require("path").resolve(rootPath,"..").replace(/\\/g,"/")+'/';
ksana.ready=true;
} else{
var url=window.location.origin+window.location.pathname.replace("index.html","")+"ksana.js";
jsonp(url,appname,function(data){
ksana.js=data;
ksana.ready=true;
});
}
module.exports=ksanagap;
},{"./downloader":"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\downloader.js","fs":false,"path":false}],"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\livereload.js":[function(require,module,exports){
var started=false;
var timer=null;
var bundledate=null;
var get_date=require("./html5fs").get_date;
var checkIfBundleUpdated=function() {
get_date("bundle.js",function(date){
if (bundledate &&bundledate!=date){
location.reload();
}
bundledate=date;
});
}
var livereload=function() {
if (started) return;
timer1=setInterval(function(){
checkIfBundleUpdated();
},2000);
started=true;
}
module.exports=livereload;
},{"./html5fs":"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\html5fs.js"}],"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\liveupdate.js":[function(require,module,exports){
var jsonp=function(url,dbid,callback,context) {
var script=document.getElementById("jsonp");
if (script) {
script.parentNode.removeChild(script);
}
if (typeof dbid=="function") {
context=callback;
callback=dbid;
dbid="";
}
window.jsonp_handler=function(data) {
//console.log("receive from ksana.js",data);
if (typeof data=="object" && dbid) {
if (typeof data.dbid=="undefined") {
data.dbid=dbid;
}
}
callback.apply(context,[data]);
}
window.jsonp_error_handler=function() {
console.error("url unreachable",url);
callback.apply(context,[null]);
}
script=document.createElement('script');
script.setAttribute('id', "jsonp");
script.setAttribute('onerror', "jsonp_error_handler()");
url=url+'?'+(new Date().getTime());
script.setAttribute('src', url);
document.getElementsByTagName('head')[0].appendChild(script);
}
var runtime_version_ok=function(minruntime) {
if (!minruntime) return true;//not mentioned.
var min=parseFloat(minruntime);
var runtime=parseFloat( ksanagap.runtime_version()||"1.0");
if (min>runtime) return false;
return true;
}
var needToUpdate=function(fromjson,tojson) {
var needUpdates=[];
for (var i=0;i<fromjson.length;i++) {
var to=tojson[i];
var from=fromjson[i];
var newfiles=[],newfilesizes=[],removed=[];
if (!to || !to.files) continue; //cannot reach host
if (!runtime_version_ok(to.minruntime)) {
console.warn("runtime too old, need "+to.minruntime);
continue;
}
if (!from.filedates) {
console.warn("missing filedates in ksana.js of "+from.dbid);
continue;
}
from.filedates.map(function(f,idx){
var newidx=to.files.indexOf( from.files[idx]);
if (newidx==-1) {
//file removed in new version
removed.push(from.files[idx]);
} else {
var fromdate=Date.parse(f);
var todate=Date.parse(to.filedates[newidx]);
if (fromdate<todate) {
newfiles.push( to.files[newidx] );
newfilesizes.push(to.filesizes[newidx]);
}
}
});
if (newfiles.length) {
from.newfiles=newfiles;
from.newfilesizes=newfilesizes;
from.removed=removed;
needUpdates.push(from);
}
}
return needUpdates;
}
var getUpdatables=function(apps,cb,context) {
getRemoteJson(apps,function(jsons){
var hasUpdates=needToUpdate(apps,jsons);
cb.apply(context,[hasUpdates]);
},context);
}
var getRemoteJson=function(apps,cb,context) {
var taskqueue=[],output=[];
var makecb=function(app){
return function(data){
if (!(data && typeof data =='object' && data.__empty)) output.push(data);
if (!app.baseurl) {
taskqueue.shift({__empty:true});
} else {
var url=app.baseurl+"/ksana.js";
try {
jsonp( url ,app.dbid,taskqueue.shift(), context);
} catch(e) {
console.log(e);
taskqueue.shift({__empty:true});
}
}
};
};
apps.forEach(function(app){taskqueue.push(makecb(app))});
taskqueue.push(function(data){
output.push(data);
cb.apply(context,[output]);
});
taskqueue.shift()({__empty:true}); //run the task
}
var humanFileSize=function(bytes, si) {
var thresh = si ? 1000 : 1024;
if(bytes < thresh) return bytes + ' B';
var units = si ? ['kB','MB','GB','TB','PB','EB','ZB','YB'] : ['KiB','MiB','GiB','TiB','PiB','EiB','ZiB','YiB'];
var u = -1;
do {
bytes /= thresh;
++u;
} while(bytes >= thresh);
return bytes.toFixed(1)+' '+units[u];
};
var humanDate=function(datestring) {
var d=Date.parse(datestring);
if (isNaN(d)) {
return "invalid date";
} else {
return new Date(d).toLocaleString();
}
}
var start=function(ksanajs,cb,context){
var files=ksanajs.newfiles||ksanajs.files;
var baseurl=ksanajs.baseurl|| "http://127.0.0.1:8080/"+ksanajs.dbid+"/";
var started=ksanagap.startDownload(ksanajs.dbid,baseurl,files.join("\uffff"));
cb.apply(context,[started]);
}
var status=function(){
var nfile=ksanagap.downloadingFile();
var downloadedByte=ksanagap.downloadedByte();
var done=ksanagap.doneDownload();
return {nfile:nfile,downloadedByte:downloadedByte, done:done};
}
var cancel=function(){
return ksanagap.cancelDownload();
}
var liveupdate={ humanFileSize: humanFileSize, humanDate:humanDate,
needToUpdate: needToUpdate , jsonp:jsonp,
getUpdatables:getUpdatables,
start:start,
cancel:cancel,
status:status
};
module.exports=liveupdate;
},{}],"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\mkdirp.js":[function(require,module,exports){
function mkdirP (p, mode, f, made) {
var path = nodeRequire('path');
var fs = nodeRequire('fs');
if (typeof mode === 'function' || mode === undefined) {
f = mode;
mode = 0x1FF & (~process.umask());
}
if (!made) made = null;
var cb = f || function () {};
if (typeof mode === 'string') mode = parseInt(mode, 8);
p = path.resolve(p);
fs.mkdir(p, mode, function (er) {
if (!er) {
made = made || p;
return cb(null, made);
}
switch (er.code) {
case 'ENOENT':
mkdirP(path.dirname(p), mode, function (er, made) {
if (er) cb(er, made);
else mkdirP(p, mode, cb, made);
});
break;
// In the case of any other error, just see if there's a dir
// there already. If so, then hooray! If not, then something
// is borked.
default:
fs.stat(p, function (er2, stat) {
// if the stat fails, then that's super weird.
// let the original error be the failure reason.
if (er2 || !stat.isDirectory()) cb(er, made)
else cb(null, made);
});
break;
}
});
}
mkdirP.sync = function sync (p, mode, made) {
var path = nodeRequire('path');
var fs = nodeRequire('fs');
if (mode === undefined) {
mode = 0x1FF & (~process.umask());
}
if (!made) made = null;
if (typeof mode === 'string') mode = parseInt(mode, 8);
p = path.resolve(p);
try {
fs.mkdirSync(p, mode);
made = made || p;
}
catch (err0) {
switch (err0.code) {
case 'ENOENT' :
made = sync(path.dirname(p), mode, made);
sync(p, mode, made);
break;
// In the case of any other error, just see if there's a dir
// there already. If so, then hooray! If not, then something
// is borked.
default:
var stat;
try {
stat = fs.statSync(p);
}
catch (err1) {
throw err0;
}
if (!stat.isDirectory()) throw err0;
break;
}
}
return made;
};
module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
},{}],"D:\\GitHub\\ksana2015\\node_modules\\reflux\\index.js":[function(require,module,exports){
module.exports = require('./src');
},{"./src":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\index.js"}],"D:\\GitHub\\ksana2015\\node_modules\\reflux\\node_modules\\eventemitter3\\index.js":[function(require,module,exports){
'use strict';
/**
* Representation of a single EventEmitter function.
*
* @param {Function} fn Event handler to be called.
* @param {Mixed} context Context for function execution.
* @param {Boolean} once Only emit once
* @api private
*/
function EE(fn, context, once) {
this.fn = fn;
this.context = context;
this.once = once || false;
}
/**
* Minimal EventEmitter interface that is molded against the Node.js
* EventEmitter interface.
*
* @constructor
* @api public
*/
function EventEmitter() { /* Nothing to set */ }
/**
* Holds the assigned EventEmitters by name.
*
* @type {Object}
* @private
*/
EventEmitter.prototype._events = undefined;
/**
* Return a list of assigned event listeners.
*
* @param {String} event The events that should be listed.
* @returns {Array}
* @api public
*/
EventEmitter.prototype.listeners = function listeners(event) {
if (!this._events || !this._events[event]) return [];
if (this._events[event].fn) return [this._events[event].fn];
for (var i = 0, l = this._events[event].length, ee = new Array(l); i < l; i++) {
ee[i] = this._events[event][i].fn;
}
return ee;
};
/**
* Emit an event to all registered event listeners.
*
* @param {String} event The name of the event.
* @returns {Boolean} Indication if we've emitted an event.
* @api public
*/
EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
if (!this._events || !this._events[event]) return false;
var listeners = this._events[event]
, len = arguments.length
, args
, i;
if ('function' === typeof listeners.fn) {
if (listeners.once) this.removeListener(event, listeners.fn, true);
switch (len) {
case 1: return listeners.fn.call(listeners.context), true;
case 2: return listeners.fn.call(listeners.context, a1), true;
case 3: return listeners.fn.call(listeners.context, a1, a2), true;
case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
}
for (i = 1, args = new Array(len -1); i < len; i++) {
args[i - 1] = arguments[i];
}
listeners.fn.apply(listeners.context, args);
} else {
var length = listeners.length
, j;
for (i = 0; i < length; i++) {
if (listeners[i].once) this.removeListener(event, listeners[i].fn, true);
switch (len) {
case 1: listeners[i].fn.call(listeners[i].context); break;
case 2: listeners[i].fn.call(listeners[i].context, a1); break;
case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
default:
if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
args[j - 1] = arguments[j];
}
listeners[i].fn.apply(listeners[i].context, args);
}
}
}
return true;
};
/**
* Register a new EventListener for the given event.
*
* @param {String} event Name of the event.
* @param {Functon} fn Callback function.
* @param {Mixed} context The context of the function.
* @api public
*/
EventEmitter.prototype.on = function on(event, fn, context) {
var listener = new EE(fn, context || this);
if (!this._events) this._events = {};
if (!this._events[event]) this._events[event] = listener;
else {
if (!this._events[event].fn) this._events[event].push(listener);
else this._events[event] = [
this._events[event], listener
];
}
return this;
};
/**
* Add an EventListener that's only called once.
*
* @param {String} event Name of the event.
* @param {Function} fn Callback function.
* @param {Mixed} context The context of the function.
* @api public
*/
EventEmitter.prototype.once = function once(event, fn, context) {
var listener = new EE(fn, context || this, true);
if (!this._events) this._events = {};
if (!this._events[event]) this._events[event] = listener;
else {
if (!this._events[event].fn) this._events[event].push(listener);
else this._events[event] = [
this._events[event], listener
];
}
return this;
};
/**
* Remove event listeners.
*
* @param {String} event The event we want to remove.
* @param {Function} fn The listener that we need to find.
* @param {Boolean} once Only remove once listeners.
* @api public
*/
EventEmitter.prototype.removeListener = function removeListener(event, fn, once) {
if (!this._events || !this._events[event]) return this;
var listeners = this._events[event]
, events = [];
if (fn) {
if (listeners.fn && (listeners.fn !== fn || (once && !listeners.once))) {
events.push(listeners);
}
if (!listeners.fn) for (var i = 0, length = listeners.length; i < length; i++) {
if (listeners[i].fn !== fn || (once && !listeners[i].once)) {
events.push(listeners[i]);
}
}
}
//
// Reset the array, or remove it completely if we have no more listeners.
//
if (events.length) {
this._events[event] = events.length === 1 ? events[0] : events;
} else {
delete this._events[event];
}
return this;
};
/**
* Remove all listeners or only the listeners for the specified event.
*
* @param {String} event The event want to remove all listeners for.
* @api public
*/
EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
if (!this._events) return this;
if (event) delete this._events[event];
else this._events = {};
return this;
};
//
// Alias methods names because people roll like that.
//
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
//
// This function doesn't apply anymore.
//
EventEmitter.prototype.setMaxListeners = function setMaxListeners() {
return this;
};
//
// Expose the module.
//
EventEmitter.EventEmitter = EventEmitter;
EventEmitter.EventEmitter2 = EventEmitter;
EventEmitter.EventEmitter3 = EventEmitter;
//
// Expose the module.
//
module.exports = EventEmitter;
},{}],"D:\\GitHub\\ksana2015\\node_modules\\reflux\\node_modules\\native-promise-only\\npo.js":[function(require,module,exports){
/*! Native Promise Only
v0.7.6-a (c) Kyle Simpson
MIT License: http://getify.mit-license.org
*/
!function(t,n,e){n[t]=n[t]||e(),"undefined"!=typeof module&&module.exports?module.exports=n[t]:"function"==typeof define&&define.amd&&define(function(){return n[t]})}("Promise","undefined"!=typeof global?global:this,function(){"use strict";function t(t,n){l.add(t,n),h||(h=y(l.drain))}function n(t){var n,e=typeof t;return null==t||"object"!=e&&"function"!=e||(n=t.then),"function"==typeof n?n:!1}function e(){for(var t=0;t<this.chain.length;t++)o(this,1===this.state?this.chain[t].success:this.chain[t].failure,this.chain[t]);this.chain.length=0}function o(t,e,o){var r,i;try{e===!1?o.reject(t.msg):(r=e===!0?t.msg:e.call(void 0,t.msg),r===o.promise?o.reject(TypeError("Promise-chain cycle")):(i=n(r))?i.call(r,o.resolve,o.reject):o.resolve(r))}catch(c){o.reject(c)}}function r(o){var c,u,a=this;if(!a.triggered){a.triggered=!0,a.def&&(a=a.def);try{(c=n(o))?(u=new f(a),c.call(o,function(){r.apply(u,arguments)},function(){i.apply(u,arguments)})):(a.msg=o,a.state=1,a.chain.length>0&&t(e,a))}catch(s){i.call(u||new f(a),s)}}}function i(n){var o=this;o.triggered||(o.triggered=!0,o.def&&(o=o.def),o.msg=n,o.state=2,o.chain.length>0&&t(e,o))}function c(t,n,e,o){for(var r=0;r<n.length;r++)!function(r){t.resolve(n[r]).then(function(t){e(r,t)},o)}(r)}function f(t){this.def=t,this.triggered=!1}function u(t){this.promise=t,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function a(n){if("function"!=typeof n)throw TypeError("Not a function");if(0!==this.__NPO__)throw TypeError("Not a promise");this.__NPO__=1;var o=new u(this);this.then=function(n,r){var i={success:"function"==typeof n?n:!0,failure:"function"==typeof r?r:!1};return i.promise=new this.constructor(function(t,n){if("function"!=typeof t||"function"!=typeof n)throw TypeError("Not a function");i.resolve=t,i.reject=n}),o.chain.push(i),0!==o.state&&t(e,o),i.promise},this["catch"]=function(t){return this.then(void 0,t)};try{n.call(void 0,function(t){r.call(o,t)},function(t){i.call(o,t)})}catch(c){i.call(o,c)}}var s,h,l,p=Object.prototype.toString,y="undefined"!=typeof setImmediate?function(t){return setImmediate(t)}:setTimeout;try{Object.defineProperty({},"x",{}),s=function(t,n,e,o){return Object.defineProperty(t,n,{value:e,writable:!0,configurable:o!==!1})}}catch(d){s=function(t,n,e){return t[n]=e,t}}l=function(){function t(t,n){this.fn=t,this.self=n,this.next=void 0}var n,e,o;return{add:function(r,i){o=new t(r,i),e?e.next=o:n=o,e=o,o=void 0},drain:function(){var t=n;for(n=e=h=void 0;t;)t.fn.call(t.self),t=t.next}}}();var g=s({},"constructor",a,!1);return s(a,"prototype",g,!1),s(g,"__NPO__",0,!1),s(a,"resolve",function(t){var n=this;return t&&"object"==typeof t&&1===t.__NPO__?t:new n(function(n,e){if("function"!=typeof n||"function"!=typeof e)throw TypeError("Not a function");n(t)})}),s(a,"reject",function(t){return new this(function(n,e){if("function"!=typeof n||"function"!=typeof e)throw TypeError("Not a function");e(t)})}),s(a,"all",function(t){var n=this;return"[object Array]"!=p.call(t)?n.reject(TypeError("Not an array")):0===t.length?n.resolve([]):new n(function(e,o){if("function"!=typeof e||"function"!=typeof o)throw TypeError("Not a function");var r=t.length,i=Array(r),f=0;c(n,t,function(t,n){i[t]=n,++f===r&&e(i)},o)})}),s(a,"race",function(t){var n=this;return"[object Array]"!=p.call(t)?n.reject(TypeError("Not an array")):new n(function(e,o){if("function"!=typeof e||"function"!=typeof o)throw TypeError("Not a function");c(n,t,function(t,n){e(n)},o)})}),a});
},{}],"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\ActionMethods.js":[function(require,module,exports){
/**
* A module of methods that you want to include in all actions.
* This module is consumed by `createAction`.
*/
module.exports = {
};
},{}],"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\Keep.js":[function(require,module,exports){
exports.createdStores = [];
exports.createdActions = [];
exports.reset = function() {
while(exports.createdStores.length) {
exports.createdStores.pop();
}
while(exports.createdActions.length) {
exports.createdActions.pop();
}
};
},{}],"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\ListenerMethods.js":[function(require,module,exports){
var _ = require('./utils'),
maker = require('./joins').instanceJoinCreator;
/**
* Extract child listenables from a parent from their
* children property and return them in a keyed Object
*
* @param {Object} listenable The parent listenable
*/
var mapChildListenables = function(listenable) {
var i = 0, children = {}, childName;
for (;i < (listenable.children||[]).length; ++i) {
childName = listenable.children[i];
if(listenable[childName]){
children[childName] = listenable[childName];
}
}
return children;
};
/**
* Make a flat dictionary of all listenables including their
* possible children (recursively), concatenating names in camelCase.
*
* @param {Object} listenables The top-level listenables
*/
var flattenListenables = function(listenables) {
var flattened = {};
for(var key in listenables){
var listenable = listenables[key];
var childMap = mapChildListenables(listenable);
// recursively flatten children
var children = flattenListenables(childMap);
// add the primary listenable and chilren
flattened[key] = listenable;
for(var childKey in children){
var childListenable = children[childKey];
flattened[key + _.capitalize(childKey)] = childListenable;
}
}
return flattened;
};
/**
* A module of methods related to listening.
*/
module.exports = {
/**
* An internal utility function used by `validateListening`
*
* @param {Action|Store} listenable The listenable we want to search for
* @returns {Boolean} The result of a recursive search among `this.subscriptions`
*/
hasListener: function(listenable) {
var i = 0, j, listener, listenables;
for (;i < (this.subscriptions||[]).length; ++i) {
listenables = [].concat(this.subscriptions[i].listenable);
for (j = 0; j < listenables.length; j++){
listener = listenables[j];
if (listener === listenable || listener.hasListener && listener.hasListener(listenable)) {
return true;
}
}
}
return false;
},
/**
* A convenience method that listens to all listenables in the given object.
*
* @param {Object} listenables An object of listenables. Keys will be used as callback method names.
*/
listenToMany: function(listenables){
var allListenables = flattenListenables(listenables);
for(var key in allListenables){
var cbname = _.callbackName(key),
localname = this[cbname] ? cbname : this[key] ? key : undefined;
if (localname){
this.listenTo(allListenables[key],localname,this[cbname+"Default"]||this[localname+"Default"]||localname);
}
}
},
/**
* Checks if the current context can listen to the supplied listenable
*
* @param {Action|Store} listenable An Action or Store that should be
* listened to.
* @returns {String|Undefined} An error message, or undefined if there was no problem.
*/
validateListening: function(listenable){
if (listenable === this) {
return "Listener is not able to listen to itself";
}
if (!_.isFunction(listenable.listen)) {
return listenable + " is missing a listen method";
}
if (listenable.hasListener && listenable.hasListener(this)) {
return "Listener cannot listen to this listenable because of circular loop";
}
},
/**
* Sets up a subscription to the given listenable for the context object
*
* @param {Action|Store} listenable An Action or Store that should be
* listened to.
* @param {Function|String} callback The callback to register as event handler
* @param {Function|String} defaultCallback The callback to register as default handler
* @returns {Object} A subscription obj where `stop` is an unsub function and `listenable` is the object being listened to
*/
listenTo: function(listenable, callback, defaultCallback) {
var desub, unsubscriber, subscriptionobj, subs = this.subscriptions = this.subscriptions || [];
_.throwIf(this.validateListening(listenable));
this.fetchInitialState(listenable, defaultCallback);
desub = listenable.listen(this[callback]||callback, this);
unsubscriber = function() {
var index = subs.indexOf(subscriptionobj);
_.throwIf(index === -1,'Tried to remove listen already gone from subscriptions list!');
subs.splice(index, 1);
desub();
};
subscriptionobj = {
stop: unsubscriber,
listenable: listenable
};
subs.push(subscriptionobj);
return subscriptionobj;
},
/**
* Stops listening to a single listenable
*
* @param {Action|Store} listenable The action or store we no longer want to listen to
* @returns {Boolean} True if a subscription was found and removed, otherwise false.
*/
stopListeningTo: function(listenable){
var sub, i = 0, subs = this.subscriptions || [];
for(;i < subs.length; i++){
sub = subs[i];
if (sub.listenable === listenable){
sub.stop();
_.throwIf(subs.indexOf(sub)!==-1,'Failed to remove listen from subscriptions list!');
return true;
}
}
return false;
},
/**
* Stops all subscriptions and empties subscriptions array
*/
stopListeningToAll: function(){
var remaining, subs = this.subscriptions || [];
while((remaining=subs.length)){
subs[0].stop();
_.throwIf(subs.length!==remaining-1,'Failed to remove listen from subscriptions list!');
}
},
/**
* Used in `listenTo`. Fetches initial data from a publisher if it has a `getInitialState` method.
* @param {Action|Store} listenable The publisher we want to get initial state from
* @param {Function|String} defaultCallback The method to receive the data
*/
fetchInitialState: function (listenable, defaultCallback) {
defaultCallback = (defaultCallback && this[defaultCallback]) || defaultCallback;
var me = this;
if (_.isFunction(defaultCallback) && _.isFunction(listenable.getInitialState)) {
var data = listenable.getInitialState();
if (data && _.isFunction(data.then)) {
data.then(function() {
defaultCallback.apply(me, arguments);
});
} else {
defaultCallback.call(this, data);
}
}
},
/**
* The callback will be called once all listenables have triggered at least once.
* It will be invoked with the last emission from each listenable.
* @param {...Publishers} publishers Publishers that should be tracked.
* @param {Function|String} callback The method to call when all publishers have emitted
* @returns {Object} A subscription obj where `stop` is an unsub function and `listenable` is an array of listenables
*/
joinTrailing: maker("last"),
/**
* The callback will be called once all listenables have triggered at least once.
* It will be invoked with the first emission from each listenable.
* @param {...Publishers} publishers Publishers that should be tracked.
* @param {Function|String} callback The method to call when all publishers have emitted
* @returns {Object} A subscription obj where `stop` is an unsub function and `listenable` is an array of listenables
*/
joinLeading: maker("first"),
/**
* The callback will be called once all listenables have triggered at least once.
* It will be invoked with all emission from each listenable.
* @param {...Publishers} publishers Publishers that should be tracked.
* @param {Function|String} callback The method to call when all publishers have emitted
* @returns {Object} A subscription obj where `stop` is an unsub function and `listenable` is an array of listenables
*/
joinConcat: maker("all"),
/**
* The callback will be called once all listenables have triggered.
* If a callback triggers twice before that happens, an error is thrown.
* @param {...Publishers} publishers Publishers that should be tracked.
* @param {Function|String} callback The method to call when all publishers have emitted
* @returns {Object} A subscription obj where `stop` is an unsub function and `listenable` is an array of listenables
*/
joinStrict: maker("strict")
};
},{"./joins":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\joins.js","./utils":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\utils.js"}],"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\ListenerMixin.js":[function(require,module,exports){
var _ = require('./utils'),
ListenerMethods = require('./ListenerMethods');
/**
* A module meant to be consumed as a mixin by a React component. Supplies the methods from
* `ListenerMethods` mixin and takes care of teardown of subscriptions.
* Note that if you're using the `connect` mixin you don't need this mixin, as connect will
* import everything this mixin contains!
*/
module.exports = _.extend({
/**
* Cleans up all listener previously registered.
*/
componentWillUnmount: ListenerMethods.stopListeningToAll
}, ListenerMethods);
},{"./ListenerMethods":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\ListenerMethods.js","./utils":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\utils.js"}],"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\PublisherMethods.js":[function(require,module,exports){
var _ = require('./utils');
/**
* A module of methods for object that you want to be able to listen to.
* This module is consumed by `createStore` and `createAction`
*/
module.exports = {
/**
* Hook used by the publisher that is invoked before emitting
* and before `shouldEmit`. The arguments are the ones that the action
* is invoked with. If this function returns something other than
* undefined, that will be passed on as arguments for shouldEmit and
* emission.
*/
preEmit: function() {},
/**
* Hook used by the publisher after `preEmit` to determine if the
* event should be emitted with given arguments. This may be overridden
* in your application, default implementation always returns true.
*
* @returns {Boolean} true if event should be emitted
*/
shouldEmit: function() { return true; },
/**
* Subscribes the given callback for action triggered
*
* @param {Function} callback The callback to register as event handler
* @param {Mixed} [optional] bindContext The context to bind the callback with
* @returns {Function} Callback that unsubscribes the registered event handler
*/
listen: function(callback, bindContext) {
bindContext = bindContext || this;
var eventHandler = function(args) {
if (aborted){
return;
}
callback.apply(bindContext, args);
}, me = this, aborted = false;
this.emitter.addListener(this.eventLabel, eventHandler);
return function() {
aborted = true;
me.emitter.removeListener(me.eventLabel, eventHandler);
};
},
/**
* Attach handlers to promise that trigger the completed and failed
* child publishers, if available.
*
* @param {Object} The promise to attach to
*/
promise: function(promise) {
var me = this;
var canHandlePromise =
this.children.indexOf('completed') >= 0 &&
this.children.indexOf('failed') >= 0;
if (!canHandlePromise){
throw new Error('Publisher must have "completed" and "failed" child publishers');
}
promise.then(function(response) {
return me.completed(response);
}, function(error) {
return me.failed(error);
});
},
/**
* Subscribes the given callback for action triggered, which should
* return a promise that in turn is passed to `this.promise`
*
* @param {Function} callback The callback to register as event handler
*/
listenAndPromise: function(callback, bindContext) {
var me = this;
bindContext = bindContext || this;
this.willCallPromise = (this.willCallPromise || 0) + 1;
var removeListen = this.listen(function() {
if (!callback) {
throw new Error('Expected a function returning a promise but got ' + callback);
}
var args = arguments,
promise = callback.apply(bindContext, args);
return me.promise.call(me, promise);
}, bindContext);
return function () {
me.willCallPromise--;
removeListen.call(me);
};
},
/**
* Publishes an event using `this.emitter` (if `shouldEmit` agrees)
*/
trigger: function() {
var args = arguments,
pre = this.preEmit.apply(this, args);
args = pre === undefined ? args : _.isArguments(pre) ? pre : [].concat(pre);
if (this.shouldEmit.apply(this, args)) {
this.emitter.emit(this.eventLabel, args);
}
},
/**
* Tries to publish the event on the next tick
*/
triggerAsync: function(){
var args = arguments,me = this;
_.nextTick(function() {
me.trigger.apply(me, args);
});
},
/**
* Returns a Promise for the triggered action
*
* @return {Promise}
* Resolved by completed child action.
* Rejected by failed child action.
* If listenAndPromise'd, then promise associated to this trigger.
* Otherwise, the promise is for next child action completion.
*/
triggerPromise: function(){
var me = this;
var args = arguments;
var canHandlePromise =
this.children.indexOf('completed') >= 0 &&
this.children.indexOf('failed') >= 0;
var promise = _.createPromise(function(resolve, reject) {
// If `listenAndPromise` is listening
// patch `promise` w/ context-loaded resolve/reject
if (me.willCallPromise) {
_.nextTick(function() {
var old_promise_method = me.promise;
me.promise = function (promise) {
promise.then(resolve, reject);
// Back to your regularly schedule programming.
me.promise = old_promise_method;
return me.promise.apply(me, arguments);
};
me.trigger.apply(me, args);
});
return;
}
if (canHandlePromise) {
var removeSuccess = me.completed.listen(function(args) {
removeSuccess();
removeFailed();
resolve(args);
});
var removeFailed = me.failed.listen(function(args) {
removeSuccess();
removeFailed();
reject(args);
});
}
me.triggerAsync.apply(me, args);
if (!canHandlePromise) {
resolve();
}
});
return promise;
}
};
},{"./utils":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\utils.js"}],"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\StoreMethods.js":[function(require,module,exports){
/**
* A module of methods that you want to include in all stores.
* This module is consumed by `createStore`.
*/
module.exports = {
};
},{}],"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\bindMethods.js":[function(require,module,exports){
module.exports = function(store, definition) {
for (var name in definition) {
if (Object.getOwnPropertyDescriptor && Object.defineProperty) {
var propertyDescriptor = Object.getOwnPropertyDescriptor(definition, name);
if (!propertyDescriptor.value || typeof propertyDescriptor.value !== 'function' || !definition.hasOwnProperty(name)) {
continue;
}
store[name] = definition[name].bind(store);
} else {
var property = definition[name];
if (typeof property !== 'function' || !definition.hasOwnProperty(name)) {
continue;
}
store[name] = property.bind(store);
}
}
return store;
};
},{}],"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\connect.js":[function(require,module,exports){
var Reflux = require('./index'),
_ = require('./utils');
module.exports = function(listenable,key){
return {
getInitialState: function(){
if (!_.isFunction(listenable.getInitialState)) {
return {};
} else if (key === undefined) {
return listenable.getInitialState();
} else {
return _.object([key],[listenable.getInitialState()]);
}
},
componentDidMount: function(){
_.extend(this,Reflux.ListenerMethods);
var me = this, cb = (key === undefined ? this.setState : function(v){me.setState(_.object([key],[v]));});
this.listenTo(listenable,cb);
},
componentWillUnmount: Reflux.ListenerMixin.componentWillUnmount
};
};
},{"./index":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\index.js","./utils":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\utils.js"}],"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\connectFilter.js":[function(require,module,exports){
var Reflux = require('./index'),
_ = require('./utils');
module.exports = function(listenable, key, filterFunc) {
filterFunc = _.isFunction(key) ? key : filterFunc;
return {
getInitialState: function() {
if (!_.isFunction(listenable.getInitialState)) {
return {};
} else if (_.isFunction(key)) {
return filterFunc.call(this, listenable.getInitialState());
} else {
// Filter initial payload from store.
var result = filterFunc.call(this, listenable.getInitialState());
if (result) {
return _.object([key], [result]);
} else {
return {};
}
}
},
componentDidMount: function() {
_.extend(this, Reflux.ListenerMethods);
var me = this;
var cb = function(value) {
if (_.isFunction(key)) {
me.setState(filterFunc.call(me, value));
} else {
var result = filterFunc.call(me, value);
me.setState(_.object([key], [result]));
}
};
this.listenTo(listenable, cb);
},
componentWillUnmount: Reflux.ListenerMixin.componentWillUnmount
};
};
},{"./index":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\index.js","./utils":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\utils.js"}],"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\createAction.js":[function(require,module,exports){
var _ = require('./utils'),
Reflux = require('./index'),
Keep = require('./Keep'),
allowed = {preEmit:1,shouldEmit:1};
/**
* Creates an action functor object. It is mixed in with functions
* from the `PublisherMethods` mixin. `preEmit` and `shouldEmit` may
* be overridden in the definition object.
*
* @param {Object} definition The action object definition
*/
var createAction = function(definition) {
definition = definition || {};
if (!_.isObject(definition)){
definition = {actionName: definition};
}
for(var a in Reflux.ActionMethods){
if (!allowed[a] && Reflux.PublisherMethods[a]) {
throw new Error("Cannot override API method " + a +
" in Reflux.ActionMethods. Use another method name or override it on Reflux.PublisherMethods instead."
);
}
}
for(var d in definition){
if (!allowed[d] && Reflux.PublisherMethods[d]) {
throw new Error("Cannot override API method " + d +
" in action creation. Use another method name or override it on Reflux.PublisherMethods instead."
);
}
}
definition.children = definition.children || [];
if (definition.asyncResult){
definition.children = definition.children.concat(["completed","failed"]);
}
var i = 0, childActions = {};
for (; i < definition.children.length; i++) {
var name = definition.children[i];
childActions[name] = createAction(name);
}
var context = _.extend({
eventLabel: "action",
emitter: new _.EventEmitter(),
_isAction: true
}, Reflux.PublisherMethods, Reflux.ActionMethods, definition);
var functor = function() {
return functor[functor.sync?"trigger":"triggerPromise"].apply(functor, arguments);
};
_.extend(functor,childActions,context);
Keep.createdActions.push(functor);
return functor;
};
module.exports = createAction;
},{"./Keep":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\Keep.js","./index":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\index.js","./utils":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\utils.js"}],"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\createStore.js":[function(require,module,exports){
var _ = require('./utils'),
Reflux = require('./index'),
Keep = require('./Keep'),
mixer = require('./mixer'),
allowed = {preEmit:1,shouldEmit:1},
bindMethods = require('./bindMethods');
/**
* Creates an event emitting Data Store. It is mixed in with functions
* from the `ListenerMethods` and `PublisherMethods` mixins. `preEmit`
* and `shouldEmit` may be overridden in the definition object.
*
* @param {Object} definition The data store object definition
* @returns {Store} A data store instance
*/
module.exports = function(definition) {
definition = definition || {};
for(var a in Reflux.StoreMethods){
if (!allowed[a] && (Reflux.PublisherMethods[a] || Reflux.ListenerMethods[a])){
throw new Error("Cannot override API method " + a +
" in Reflux.StoreMethods. Use another method name or override it on Reflux.PublisherMethods / Reflux.ListenerMethods instead."
);
}
}
for(var d in definition){
if (!allowed[d] && (Reflux.PublisherMethods[d] || Reflux.ListenerMethods[d])){
throw new Error("Cannot override API method " + d +
" in store creation. Use another method name or override it on Reflux.PublisherMethods / Reflux.ListenerMethods instead."
);
}
}
definition = mixer(definition);
function Store() {
var i=0, arr;
this.subscriptions = [];
this.emitter = new _.EventEmitter();
this.eventLabel = "change";
bindMethods(this, definition);
if (this.init && _.isFunction(this.init)) {
this.init();
}
if (this.listenables){
arr = [].concat(this.listenables);
for(;i < arr.length;i++){
this.listenToMany(arr[i]);
}
}
}
_.extend(Store.prototype, Reflux.ListenerMethods, Reflux.PublisherMethods, Reflux.StoreMethods, definition);
var store = new Store();
Keep.createdStores.push(store);
return store;
};
},{"./Keep":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\Keep.js","./bindMethods":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\bindMethods.js","./index":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\index.js","./mixer":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\mixer.js","./utils":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\utils.js"}],"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\index.js":[function(require,module,exports){
exports.ActionMethods = require('./ActionMethods');
exports.ListenerMethods = require('./ListenerMethods');
exports.PublisherMethods = require('./PublisherMethods');
exports.StoreMethods = require('./StoreMethods');
exports.createAction = require('./createAction');
exports.createStore = require('./createStore');
exports.connect = require('./connect');
exports.connectFilter = require('./connectFilter');
exports.ListenerMixin = require('./ListenerMixin');
exports.listenTo = require('./listenTo');
exports.listenToMany = require('./listenToMany');
var maker = require('./joins').staticJoinCreator;
exports.joinTrailing = exports.all = maker("last"); // Reflux.all alias for backward compatibility
exports.joinLeading = maker("first");
exports.joinStrict = maker("strict");
exports.joinConcat = maker("all");
var _ = require('./utils');
exports.EventEmitter = _.EventEmitter;
exports.Promise = _.Promise;
/**
* Convenience function for creating a set of actions
*
* @param definitions the definitions for the actions to be created
* @returns an object with actions of corresponding action names
*/
exports.createActions = function(definitions) {
var actions = {};
for (var k in definitions){
if (definitions.hasOwnProperty(k)) {
var val = definitions[k],
actionName = _.isObject(val) ? k : val;
actions[actionName] = exports.createAction(val);
}
}
return actions;
};
/**
* Sets the eventmitter that Reflux uses
*/
exports.setEventEmitter = function(ctx) {
var _ = require('./utils');
exports.EventEmitter = _.EventEmitter = ctx;
};
/**
* Sets the Promise library that Reflux uses
*/
exports.setPromise = function(ctx) {
var _ = require('./utils');
exports.Promise = _.Promise = ctx;
};
/**
* Sets the Promise factory that creates new promises
* @param {Function} factory has the signature `function(resolver) { return [new Promise]; }`
*/
exports.setPromiseFactory = function(factory) {
var _ = require('./utils');
_.createPromise = factory;
};
/**
* Sets the method used for deferring actions and stores
*/
exports.nextTick = function(nextTick) {
var _ = require('./utils');
_.nextTick = nextTick;
};
/**
* Provides the set of created actions and stores for introspection
*/
exports.__keep = require('./Keep');
/**
* Warn if Function.prototype.bind not available
*/
if (!Function.prototype.bind) {
console.error(
'Function.prototype.bind not available. ' +
'ES5 shim required. ' +
'https://github.com/spoike/refluxjs#es5'
);
}
},{"./ActionMethods":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\ActionMethods.js","./Keep":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\Keep.js","./ListenerMethods":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\ListenerMethods.js","./ListenerMixin":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\ListenerMixin.js","./PublisherMethods":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\PublisherMethods.js","./StoreMethods":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\StoreMethods.js","./connect":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\connect.js","./connectFilter":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\connectFilter.js","./createAction":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\createAction.js","./createStore":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\createStore.js","./joins":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\joins.js","./listenTo":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\listenTo.js","./listenToMany":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\listenToMany.js","./utils":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\utils.js"}],"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\joins.js":[function(require,module,exports){
/**
* Internal module used to create static and instance join methods
*/
var slice = Array.prototype.slice,
_ = require("./utils"),
createStore = require("./createStore"),
strategyMethodNames = {
strict: "joinStrict",
first: "joinLeading",
last: "joinTrailing",
all: "joinConcat"
};
/**
* Used in `index.js` to create the static join methods
* @param {String} strategy Which strategy to use when tracking listenable trigger arguments
* @returns {Function} A static function which returns a store with a join listen on the given listenables using the given strategy
*/
exports.staticJoinCreator = function(strategy){
return function(/* listenables... */) {
var listenables = slice.call(arguments);
return createStore({
init: function(){
this[strategyMethodNames[strategy]].apply(this,listenables.concat("triggerAsync"));
}
});
};
};
/**
* Used in `ListenerMethods.js` to create the instance join methods
* @param {String} strategy Which strategy to use when tracking listenable trigger arguments
* @returns {Function} An instance method which sets up a join listen on the given listenables using the given strategy
*/
exports.instanceJoinCreator = function(strategy){
return function(/* listenables..., callback*/){
_.throwIf(arguments.length < 3,'Cannot create a join with less than 2 listenables!');
var listenables = slice.call(arguments),
callback = listenables.pop(),
numberOfListenables = listenables.length,
join = {
numberOfListenables: numberOfListenables,
callback: this[callback]||callback,
listener: this,
strategy: strategy
}, i, cancels = [], subobj;
for (i = 0; i < numberOfListenables; i++) {
_.throwIf(this.validateListening(listenables[i]));
}
for (i = 0; i < numberOfListenables; i++) {
cancels.push(listenables[i].listen(newListener(i,join),this));
}
reset(join);
subobj = {listenable: listenables};
subobj.stop = makeStopper(subobj,cancels,this);
this.subscriptions = (this.subscriptions || []).concat(subobj);
return subobj;
};
};
// ---- internal join functions ----
function makeStopper(subobj,cancels,context){
return function() {
var i, subs = context.subscriptions,
index = (subs ? subs.indexOf(subobj) : -1);
_.throwIf(index === -1,'Tried to remove join already gone from subscriptions list!');
for(i=0;i < cancels.length; i++){
cancels[i]();
}
subs.splice(index, 1);
};
}
function reset(join) {
join.listenablesEmitted = new Array(join.numberOfListenables);
join.args = new Array(join.numberOfListenables);
}
function newListener(i,join) {
return function() {
var callargs = slice.call(arguments);
if (join.listenablesEmitted[i]){
switch(join.strategy){
case "strict": throw new Error("Strict join failed because listener triggered twice.");
case "last": join.args[i] = callargs; break;
case "all": join.args[i].push(callargs);
}
} else {
join.listenablesEmitted[i] = true;
join.args[i] = (join.strategy==="all"?[callargs]:callargs);
}
emitIfAllListenablesEmitted(join);
};
}
function emitIfAllListenablesEmitted(join) {
for (var i = 0; i < join.numberOfListenables; i++) {
if (!join.listenablesEmitted[i]) {
return;
}
}
join.callback.apply(join.listener,join.args);
reset(join);
}
},{"./createStore":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\createStore.js","./utils":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\utils.js"}],"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\listenTo.js":[function(require,module,exports){
var Reflux = require('./index');
/**
* A mixin factory for a React component. Meant as a more convenient way of using the `ListenerMixin`,
* without having to manually set listeners in the `componentDidMount` method.
*
* @param {Action|Store} listenable An Action or Store that should be
* listened to.
* @param {Function|String} callback The callback to register as event handler
* @param {Function|String} defaultCallback The callback to register as default handler
* @returns {Object} An object to be used as a mixin, which sets up the listener for the given listenable.
*/
module.exports = function(listenable,callback,initial){
return {
/**
* Set up the mixin before the initial rendering occurs. Import methods from `ListenerMethods`
* and then make the call to `listenTo` with the arguments provided to the factory function
*/
componentDidMount: function() {
for(var m in Reflux.ListenerMethods){
if (this[m] !== Reflux.ListenerMethods[m]){
if (this[m]){
throw "Can't have other property '"+m+"' when using Reflux.listenTo!";
}
this[m] = Reflux.ListenerMethods[m];
}
}
this.listenTo(listenable,callback,initial);
},
/**
* Cleans up all listener previously registered.
*/
componentWillUnmount: Reflux.ListenerMethods.stopListeningToAll
};
};
},{"./index":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\index.js"}],"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\listenToMany.js":[function(require,module,exports){
var Reflux = require('./index');
/**
* A mixin factory for a React component. Meant as a more convenient way of using the `listenerMixin`,
* without having to manually set listeners in the `componentDidMount` method. This version is used
* to automatically set up a `listenToMany` call.
*
* @param {Object} listenables An object of listenables
* @returns {Object} An object to be used as a mixin, which sets up the listeners for the given listenables.
*/
module.exports = function(listenables){
return {
/**
* Set up the mixin before the initial rendering occurs. Import methods from `ListenerMethods`
* and then make the call to `listenTo` with the arguments provided to the factory function
*/
componentDidMount: function() {
for(var m in Reflux.ListenerMethods){
if (this[m] !== Reflux.ListenerMethods[m]){
if (this[m]){
throw "Can't have other property '"+m+"' when using Reflux.listenToMany!";
}
this[m] = Reflux.ListenerMethods[m];
}
}
this.listenToMany(listenables);
},
/**
* Cleans up all listener previously registered.
*/
componentWillUnmount: Reflux.ListenerMethods.stopListeningToAll
};
};
},{"./index":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\index.js"}],"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\mixer.js":[function(require,module,exports){
var _ = require('./utils');
module.exports = function mix(def) {
var composed = {
init: [],
preEmit: [],
shouldEmit: []
};
var updated = (function mixDef(mixin) {
var mixed = {};
if (mixin.mixins) {
mixin.mixins.forEach(function (subMixin) {
_.extend(mixed, mixDef(subMixin));
});
}
_.extend(mixed, mixin);
Object.keys(composed).forEach(function (composable) {
if (mixin.hasOwnProperty(composable)) {
composed[composable].push(mixin[composable]);
}
});
return mixed;
}(def));
if (composed.init.length > 1) {
updated.init = function () {
var args = arguments;
composed.init.forEach(function (init) {
init.apply(this, args);
}, this);
};
}
if (composed.preEmit.length > 1) {
updated.preEmit = function () {
return composed.preEmit.reduce(function (args, preEmit) {
var newValue = preEmit.apply(this, args);
return newValue === undefined ? args : [newValue];
}.bind(this), arguments);
};
}
if (composed.shouldEmit.length > 1) {
updated.shouldEmit = function () {
var args = arguments;
return !composed.shouldEmit.some(function (shouldEmit) {
return !shouldEmit.apply(this, args);
}, this);
};
}
Object.keys(composed).forEach(function (composable) {
if (composed[composable].length === 1) {
updated[composable] = composed[composable][0];
}
});
return updated;
};
},{"./utils":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\utils.js"}],"D:\\GitHub\\ksana2015\\node_modules\\reflux\\src\\utils.js":[function(require,module,exports){
/*
* isObject, extend, isFunction, isArguments are taken from undescore/lodash in
* order to remove the dependency
*/
var isObject = exports.isObject = function(obj) {
var type = typeof obj;
return type === 'function' || type === 'object' && !!obj;
};
exports.extend = function(obj) {
if (!isObject(obj)) {
return obj;
}
var source, prop;
for (var i = 1, length = arguments.length; i < length; i++) {
source = arguments[i];
for (prop in source) {
if (Object.getOwnPropertyDescriptor && Object.defineProperty) {
var propertyDescriptor = Object.getOwnPropertyDescriptor(source, prop);
Object.defineProperty(obj, prop, propertyDescriptor);
} else {
obj[prop] = source[prop];
}
}
}
return obj;
};
exports.isFunction = function(value) {
return typeof value === 'function';
};
exports.EventEmitter = require('eventemitter3');
exports.nextTick = function(callback) {
setTimeout(callback, 0);
};
exports.capitalize = function(string){
return string.charAt(0).toUpperCase()+string.slice(1);
};
exports.callbackName = function(string){
return "on"+exports.capitalize(string);
};
exports.object = function(keys,vals){
var o={}, i=0;
for(;i<keys.length;i++){
o[keys[i]] = vals[i];
}
return o;
};
exports.Promise = require("native-promise-only");
exports.createPromise = function(resolver) {
return new exports.Promise(resolver);
};
exports.isArguments = function(value) {
return typeof value === 'object' && ('callee' in value) && typeof value.length === 'number';
};
exports.throwIf = function(val,msg){
if (val){
throw Error(msg||val);
}
};
},{"eventemitter3":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\node_modules\\eventemitter3\\index.js","native-promise-only":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\node_modules\\native-promise-only\\npo.js"}],"D:\\GitHub\\ksana2015\\todolist\\index.js":[function(require,module,exports){
var React=require("react");
var runtime=require("ksana2015-webruntime");
runtime.boot("todolist",function(){
ksana.runtime=runtime;
var Main=React.createElement(require("./src/main.jsx"));
ksana.mainComponent=React.render(Main,document.getElementById("main"));
});
},{"./src/main.jsx":"D:\\GitHub\\ksana2015\\todolist\\src\\main.jsx","ksana2015-webruntime":"D:\\GitHub\\ksana2015\\node_modules\\ksana2015-webruntime\\index.js","react":"react"}],"D:\\GitHub\\ksana2015\\todolist\\src\\actions.js":[function(require,module,exports){
var Reflux=require("reflux");
var actions=Reflux.createActions([
"add"
,"clear"
,"toggle"
]);
module.exports=actions;
},{"reflux":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\index.js"}],"D:\\GitHub\\ksana2015\\todolist\\src\\controls.jsx":[function(require,module,exports){
var React=require("react");
var actions=require("./actions");
var Controls=React.createClass({displayName: "Controls",
add:function() {
var todo=this.refs.todo.getDOMNode().value;
this.refs.todo.getDOMNode().value="";
todo&&actions.add(todo);
}
,clear:function() {
actions.clear();
}
,keypress:function(e){
if(e.key=="Enter") this.add();
}
,render:function() {
return React.createElement("div", null,
React.createElement("input", {ref: "todo", onKeyPress: this.keypress}),
React.createElement("button", {onClick: this.add}, "Add"),
React.createElement("button", {onClick: this.clear}, "Clear")
)
}
});
module.exports=Controls;
},{"./actions":"D:\\GitHub\\ksana2015\\todolist\\src\\actions.js","react":"react"}],"D:\\GitHub\\ksana2015\\todolist\\src\\listview.jsx":[function(require,module,exports){
var React=require("react");
var Reflux=require("reflux");
var store=require("./store");
var acts=require("./actions");
var Listview = React.createClass({displayName: "Listview",
mixins:[Reflux.listenTo(store,"onStore")]
,getInitialState:function(){
return {data:[]};
}
,onStore:function(data) {
this.setState({data:data});
}
,toggleDone:function(e){
var index = e.target.dataset.idx;
acts.toggle(index);
}
,renderItem:function(item,idx) {
return React.createElement("div", null,
React.createElement("li", {"data-idx": idx, onClick: this.toggleDone,
className: item.done?"done":""}, item.context)
)
}
,render: function() {
return React.createElement("div", null,
React.createElement("ol", null,
this.state.data.map(this.renderItem)
)
);
}
});
module.exports=Listview
},{"./actions":"D:\\GitHub\\ksana2015\\todolist\\src\\actions.js","./store":"D:\\GitHub\\ksana2015\\todolist\\src\\store.js","react":"react","reflux":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\index.js"}],"D:\\GitHub\\ksana2015\\todolist\\src\\main.jsx":[function(require,module,exports){
var React=require("react");
var Controls=require("./controls.jsx");
var Listview=require("./listview.jsx");
var Status = require("./status.jsx")
var Maincomponent = React.createClass({displayName: "Maincomponent",
render: function() {
return React.createElement("div", null,
React.createElement(Controls, null),
React.createElement(Listview, null),
React.createElement(Status, null)
);
}
});
module.exports=Maincomponent;
},{"./controls.jsx":"D:\\GitHub\\ksana2015\\todolist\\src\\controls.jsx","./listview.jsx":"D:\\GitHub\\ksana2015\\todolist\\src\\listview.jsx","./status.jsx":"D:\\GitHub\\ksana2015\\todolist\\src\\status.jsx","react":"react"}],"D:\\GitHub\\ksana2015\\todolist\\src\\status.jsx":[function(require,module,exports){
var React=require("react");
var Reflux=require("reflux");
var Store=require("./store.js");
var Status=React.createClass({displayName: "Status",
mixins:[Reflux.listenTo(Store,"onStore")]
,getInitialState:function(){
return {listcount:0}
}
,onStore:function(data) {
var count=data.filter(function(item){
return !item.done;
}).length;
this.setState({listcount:count});
}
,render:function(){
return React.createElement("div", null, "待辦事項:", this.state.listcount, " 項")
}
});
module.exports=Status;
},{"./store.js":"D:\\GitHub\\ksana2015\\todolist\\src\\store.js","react":"react","reflux":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\index.js"}],"D:\\GitHub\\ksana2015\\todolist\\src\\store.js":[function(require,module,exports){
var Reflux=require("reflux");
var actions=require("./actions");
var store=Reflux.createStore({
listenables:actions
,data:[]
,onAdd:function(item) {
this.data.push({context:item,done:false});
this.trigger(this.data);
}
,onClear:function() {
this.data=this.data.filter(function(item){
return !item.done;
});
this.trigger(this.data);
}
,onToggle:function(itemidx){
this.data[itemidx].done=!this.data[itemidx].done;
this.trigger(this.data);
}
});
module.exports=store;
},{"./actions":"D:\\GitHub\\ksana2015\\todolist\\src\\actions.js","reflux":"D:\\GitHub\\ksana2015\\node_modules\\reflux\\index.js"}]},{},["D:\\GitHub\\ksana2015\\todolist\\index.js"])
//# sourceMappingURL=bundle.js.map
|
src/pages/About.js
|
lottebijlsma/lottebijlsma.github.io
|
// @flow
import React from 'react';
import './about.css';
type TProps = {
data: {
contentfulPage: {
images: Array<{
file: {
url: string,
}
}>
}
}
}
const AboutPage = ({ data: { contentfulPage: page } }: TProps) => (
<div className='about'>
<section>
<div className='about-txt'>
<article dangerouslySetInnerHTML={{ __html: page.body.childMarkdownRemark.html }} />
<div className='socialbox'>
<div className='socials'>
<div className='socialbox1'>
<h2>Socials</h2>
<div>
<a href='https://twitter.com/bijlsmalotte' rel='noopener noreferrer' target='_blank'>Twitter</a>
<a href='https://instagram.com/lotte.bijlsma' rel='noopener noreferrer' target='_blank'>Instagram</a>
<a href='https://dribbble.com/lottebijlsma' rel='noopener noreferrer' target='_blank'>Dribbble</a>
<a href='https://github.com/lottebijlsma' rel='noopener noreferrer' target='_blank'>Github</a>
</div>
</div>
</div>
<div className='socials'>
<div>
<h2>Downloads</h2>
<div>
<a href='https://drive.google.com/open?id=1XiYoPoB4a35CpBViQy2H7bomplce5wuq' rel='noopener noreferrer' target='_blank'>Resume</a>
</div>
</div>
</div>
</div>
</div>
<img className='aboutImage' src={page.images[0].file.url} />
</section>
</div>
);
export const query = graphql`
query AboutPageQuery {
contentfulPage(title: {eq: "About"}) {
images {
file {
url
}
}
body {
childMarkdownRemark {
html
}
}
}
}
`;
AboutPage.defaultProps = {};
export default AboutPage;
|
ajax/libs/optimal-select/3.4.3/optimal-select.min.js
|
dc-js/cdnjs
|
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.OptimalSelect=t():e.OptimalSelect=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var u=n[r]={exports:{},id:r,loaded:!1};return e[r].call(u.exports,u,u.exports,t),u.loaded=!0,u.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function u(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.common=t.optimize=t.getMultiSelector=t.getSingleSelector=t.select=void 0;var o=n(6);Object.defineProperty(t,"getSingleSelector",{enumerable:!0,get:function(){return o.getSingleSelector}}),Object.defineProperty(t,"getMultiSelector",{enumerable:!0,get:function(){return o.getMultiSelector}});var i=u(o),a=n(3),c=u(a),f=n(2),l=r(f);t.select=i.default,t.optimize=c.default,t.common=l,t.default=i.default},function(e,t){(function(n){"use strict";function r(e,t){if(n.document)return!1;var r=t.context;n.document=r||function(){for(var t=e;t.parent;)t=t.parent;return t}();var i=Object.getPrototypeOf(n.document);return Object.getOwnPropertyDescriptor(i,"childTags")||Object.defineProperty(i,"childTags",{enumerable:!0,get:function(){return this.children.filter(function(e){return"tag"===e.type||"script"===e.type||"style"===e.type})}}),Object.getOwnPropertyDescriptor(i,"attributes")||Object.defineProperty(i,"attributes",{enumerable:!0,get:function(){var e=this.attribs,t=Object.keys(e),n=t.reduce(function(t,n,r){return t[r]={name:n,value:e[n]},t},{});return Object.defineProperty(n,"length",{enumerable:!1,configurable:!1,value:t.length}),n}}),i.getAttribute||(i.getAttribute=function(e){return this.attribs[e]||null}),i.getElementsByTagName||(i.getElementsByTagName=function(e){var t=[];return o(this.childTags,function(n){n.name!==e&&"*"!==e||t.push(n)}),t}),i.getElementsByClassName||(i.getElementsByClassName=function(e){var t=e.trim().replace(/\s+/g," ").split(" "),n=[];return o([this],function(e){var r=e.attribs.class;r&&t.every(function(e){return r.indexOf(e)>-1})&&n.push(e)}),n}),i.querySelectorAll||(i.querySelectorAll=function(e){var t=this;e=e.replace(/(>)(\S)/g,"$1 $2").trim();var n=u(e),r=n.shift(),o=n.length;return r(this).filter(function(e){for(var r=0;r<o;){if(e=n[r](e,t),!e)return!1;r+=1}return!0})}),i.contains||(i.contains=function(e){var t=!1;return o([this],function(n,r){n===e&&(t=!0,r())}),t}),!0}function u(e){return e.split(" ").reverse().map(function(e,t){var n=0===t,r=e.split(":"),u=c(r,2),f=u[0],l=u[1],s=null,d=null;if(function(){switch(!0){case/>/.test(f):d=function(e){return function(t){return t(e.parent)&&e.parent}};break;case/^\./.test(f):var e=f.substr(1).split(".");s=function(t){var n=t.attribs.class;return n&&e.every(function(e){return n.indexOf(e)>-1})},d=function(t,r){return n?t.getElementsByClassName(e.join(" ")):"function"==typeof t?t(s):i(t,r,s)};break;case/^\[/.test(f):var t=f.replace(/\[|\]|"/g,"").split("="),r=c(t,2),u=r[0],l=r[1];s=function(e){var t=Object.keys(e.attribs).indexOf(u)>-1;return!(!t||l&&e.attribs[u]!==l)},d=function(e,t){if(n){var r=function(){var t=[];return o([e],function(e){s(e)&&t.push(e)}),{v:t}}();if("object"===("undefined"==typeof r?"undefined":a(r)))return r.v}return"function"==typeof e?e(s):i(e,t,s)};break;case/^#/.test(f):var v=f.substr(1);s=function(e){return e.attribs.id===v},d=function(e,t){if(n){var r=function(){var t=[];return o([e],function(e,n){s(e)&&(t.push(e),n())}),{v:t}}();if("object"===("undefined"==typeof r?"undefined":a(r)))return r.v}return"function"==typeof e?e(s):i(e,t,s)};break;case/\*/.test(f):s=function(e){return!0},d=function(e,t){if(n){var r=function(){var t=[];return o([e],function(e){return t.push(e)}),{v:t}}();if("object"===("undefined"==typeof r?"undefined":a(r)))return r.v}return"function"==typeof e?e(s):i(e,t,s)};break;default:s=function(e){return e.name===f},d=function(e,t){if(n){var r=function(){var t=[];return o([e],function(e){s(e)&&t.push(e)}),{v:t}}();if("object"===("undefined"==typeof r?"undefined":a(r)))return r.v}return"function"==typeof e?e(s):i(e,t,s)}}}(),!l)return d;var v=l.match(/-(child|type)\((\d+)\)$/),p=v[1],g=parseInt(v[2],10)-1,y=function(e){if(e){var t=e.parent.childTags;"type"===p&&(t=t.filter(s));var n=t.findIndex(function(t){return t===e});if(n===g)return!0}return!1};return function(e){var t=d(e);return n?t.reduce(function(e,t){return y(t)&&e.push(t),e},[]):y(t)&&t}})}function o(e,t){e.forEach(function(e){var n=!0;t(e,function(){return n=!1}),e.childTags&&n&&o(e.childTags,t)})}function i(e,t,n){for(;e.parent;){if(e=e.parent,n(e))return e;if(e===t)break}return null}Object.defineProperty(t,"__esModule",{value:!0});var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},c=function(){function e(e,t){var n=[],r=!0,u=!1,o=void 0;try{for(var i,a=e[Symbol.iterator]();!(r=(i=a.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(c){u=!0,o=c}finally{try{!r&&a.return&&a.return()}finally{if(u)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.default=r,e.exports=t.default}).call(t,function(){return this}())},function(e,t){"use strict";function n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.root,r=void 0===n?document:n,u=(t.skip,t.ignore,[]);e.forEach(function(e,t){for(var n=[];e!==r;)e=e.parentNode,n.unshift(e);u[t]=n}),u.sort(function(e,t){return e.length-t.length});for(var o=u.shift(),i=null,a=function(){var e=o[c],t=u.some(function(t){return!t.some(function(t){return t===e})});return t?"break":void(i=e)},c=0,f=o.length;c<f;c++){var l=a();if("break"===l)break}return i}function r(e){var t={classes:[],attributes:{},tag:null};return e.forEach(function(e){var n=t.classes,r=t.attributes,u=t.tag;if(void 0!==n){var o=e.getAttribute("class");o?(o=o.trim().split(" "),n.length?(n=n.filter(function(e){return o.some(function(t){return t===e})}),n.length?t.classes=n:delete t.classes):t.classes=o):delete t.classes}if(void 0!==r&&!function(){var n=e.attributes,u=Object.keys(n).reduce(function(e,t){var r=n[t],u=r.name;return r&&"class"!==u&&(e[u]=r.value),e},{}),o=Object.keys(u),i=Object.keys(r);o.length?i.length?(r=i.reduce(function(e,t){var n=r[t];return n===u[t]&&(e[t]=n),e},{}),Object.keys(r).length?t.attributes=r:delete t.attributes):t.attributes=u:delete t.attributes}(),void 0!==u){var i=e.tagName.toLowerCase();u?i!==u&&delete t.tag:t.tag=i}}),t}Object.defineProperty(t,"__esModule",{value:!0}),t.getCommonAncestor=n,t.getCommonProperties=r},function(e,t,n){(function(r){"use strict";function u(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Array.isArray(t)||(t=t.length?(0,l.convertNodeList)(t):[t]),!t.length||t.some(function(e){return 1!==e.nodeType}))throw new Error('Invalid input - to compare HTMLElements its necessary to provide a reference of the selected node(s)! (missing "elements")');var u=(0,f.default)(t[0],n),o=e.replace(/> /g,">").split(/\s+(?=(?:(?:[^"]*"){2})*[^"]*$)/);if(o.length<3)return i("",e,"",t);for(var a=[o.pop()];o.length>1;){var c=o.pop(),s=o.join(" "),d=a.join(" "),v=s+" "+d,p=document.querySelectorAll(v);p.length!==t.length&&a.unshift(i(s,c,d,t))}return a.unshift(o[0]),o=a,o[0]=i("",o[0],o.slice(1).join(" "),t),o[o.length-1]=i(o.slice(0,-1).join(" "),o[o.length-1],"",t),u&&delete r.document,o.join(" ").replace(/>/g,"> ").trim()}function i(e,t,n,r){if(e.length&&(e+=" "),n.length&&(n=" "+n),/\[*\]/.test(t)){var u=t.replace(/=.*$/,"]"),o=""+e+u+n,i=document.querySelectorAll(o);if(a(i,r))t=u;else for(var c=document.querySelectorAll(""+e+u),f=function(){var u=c[l];if(r.some(function(e){return u.contains(e)})){var f=u.tagName.toLowerCase();return o=""+e+f+n,i=document.querySelectorAll(o),a(i,r)&&(t=f),"break"}},l=0,s=c.length;l<s;l++){var o,i,d=f();if("break"===d)break}}if(/>/.test(t)){var v=t.replace(/>/,""),o=""+e+v+n,i=document.querySelectorAll(o);a(i,r)&&(t=v)}if(/:nth-child/.test(t)){var p=t.replace(/nth-child/g,"nth-of-type"),o=""+e+p+n,i=document.querySelectorAll(o);a(i,r)&&(t=p)}if(/\.\S+\.\S+/.test(t)){for(var g=t.trim().split(".").slice(1).map(function(e){return"."+e}).sort(function(e,t){return e.length-t.length});g.length;){var y=t.replace(g.shift(),"").trim(),o=""+e+y+n;if(!o||">"===y)break;var i=document.querySelectorAll(o);a(i,r)&&(t=y)}if(t&&t.match(/\./g).length>2)for(var h=document.querySelectorAll(""+e+t),m=function(){var u=h[l];if(r.some(function(e){return u.contains(e)})){var c=u.tagName.toLowerCase();return o=""+e+c+n,i=document.querySelectorAll(o),a(i,r)&&(t=c),"break"}},l=0,s=h.length;l<s;l++){var o,i,b=m();if("break"===b)break}}return t}function a(e,t){var n=e.length;return n===t.length&&t.every(function(t){for(var r=0;r<n;r++)if(e[r]===t)return!0;return!1})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var c=n(1),f=u(c),l=n(4);e.exports=t.default}).call(t,function(){return this}())},function(e,t){"use strict";function n(e){for(var t=e.length,n=new Array(t),r=0;r<t;r++)n[r]=e[r];return n}Object.defineProperty(t,"__esModule",{value:!0}),t.convertNodeList=n},function(e,t){"use strict";function n(e,t){var n=t.root,v=void 0===n?document:n,p=t.skip,g=void 0===p?null:p,y=t.ignore,h=void 0===y?{}:y,m=[],b=e,j=m.length,S=g&&(Array.isArray(g)?g:[g]).map(function(e){return"function"!=typeof e?function(t){return t===e}:e}),O=function(e){return g&&S.some(function(t){return t(e)})},k=!1;for(Object.keys(h).forEach(function(e){"class"===e&&(k=!0);var t=h[e];"function"!=typeof t&&("number"==typeof t&&(t=t.toString()),"string"==typeof t&&(t=new RegExp(t)),h[e]=t.test.bind(t))}),k&&!function(){var e=h.attribute;h.attribute=function(t,n,r){return h.class(n)||e&&e(t,n,r)}}();b!==v;){if(O(b)!==!0){if(d(b,m,h))break;if(r(b,m,h,v))break;if(i(b,m,h,v))break;if(f(b,m,h,v))break;u(b,m,h),m.length===j&&a(b,m,h),m.length===j&&l(b,m,h),m.length===j&&o(b,m,h),m.length===j&&c(b,m,h),m.length===j&&s(b,m,h)}b=b.parentNode,j=m.length}return b===v&&m.unshift("*"),m.join(" ")}function r(e,t,n,r){return v(e,t,n,r)}function u(e,t,n){return v(e,t,n,e.parentNode)}function o(e,t,n){var r=e.getAttribute("class");return!h(n.class,r)&&y(e,t,"."+r.trim().replace(/\s+/g,"."))}function i(e,t,n,r){return p(e,t,n,r)}function a(e,t,n){return p(e,t,n,e.parentNode)}function c(e,t,n){var r=e.attributes;return Object.keys(r).some(function(u){var o=r[u],i=o.name,a=o.value;if(h(n.attribute,i,a,m.attribute))return!1;var c="["+i+'="'+a+'"]';return y(e,t,c)})}function f(e,t,n,r){return g(e,t,n,r)}function l(e,t,n){return g(e,t,n,e.parentNode)}function s(e,t,n){var r=e.tagName.toLowerCase();return!h(n.tag,r)&&y(e,t,r)}function d(e,t,n){var r=e.getAttribute("id");return!h(n.id,r)&&(t.unshift("#"+r),!0)}function v(e,t,n,r){var u=e.getAttribute("class");if(h(n.class,u))return!1;var o=r.getElementsByClassName(u);return 1===o.length&&(t.unshift("."+u.trim().replace(/\s+/g,".")),!0)}function p(e,t,n,r){var u=e.attributes;return Object.keys(u).some(function(e){var o=u[e],i=o.name,a=o.value;if(h(n.attribute,i,a,m.attribute))return!1;var c="["+i+'="'+a+'"]',f=r.querySelectorAll(c);return 1===f.length?(t.unshift(c),!0):void 0})}function g(e,t,n,r){var u=e.tagName.toLowerCase();if(h(n.tag,u))return!1;var o=r.getElementsByTagName(u);return 1===o.length&&(t.unshift(u),!0)}function y(e,t,n){for(var r=e.parentNode,u=r.childTags||r.children,o=0,i=u.length;o<i;o++)if(u[o]===e)return t.unshift("> "+n+":nth-child("+(o+1)+")"),!0;return!1}function h(e,t,n,r){if(!t)return!0;var u=e||r;return!!u&&u(t,n||t,r)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var m={attribute:function(e){return["style","data-reactid","data-react-checksum"].indexOf(e)>-1}};e.exports=t.default},function(e,t,n){(function(e){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function u(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.length?i(e,t):o(e,t)}function o(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(3===t.nodeType&&(t=t.parentNode),1!==t.nodeType)throw new Error('Invalid input - only HTMLElements or representations of them are supported! (not "'+("undefined"==typeof t?"undefined":c(t))+'")');var r=(0,l.default)(t,n),u=(0,d.default)(t,n),o=(0,p.default)(u,t,n);return r&&delete e.document,o}function i(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Array.isArray(t)||(t=(0,g.convertNodeList)(t)),t.some(function(e){return 1!==e.nodeType}))throw new Error("Invalid input - only an Array of HTMLElements or representations of them is supported!");var r=(0,l.default)(t[0],n),u=(0,y.getCommonAncestor)(t,n),i=o(u,n),c=a(t),f=c[0],s=(0,p.default)(i+" "+f,t,n),d=(0,g.convertNodeList)(document.querySelectorAll(s));return t.every(function(e){return d.some(function(t){return t===e})})?(r&&delete e.document,s):console.warn("\n The selected elements can't be efficiently mapped.\n Its probably best to use multiple single selectors instead!\n ",t)}function a(e){var t=(0,y.getCommonProperties)(e),n=t.classes,r=t.attributes,u=t.tag,o=[];if(u&&o.push(u),n){var i=n.map(function(e){return"."+e}).join("");o.push(i)}if(r){var a=Object.keys(r).reduce(function(e,t){return e.push("["+t+'="'+r[t]+'"]'),e},[]).join("");o.push(a)}return o.length,[o.join("")]}Object.defineProperty(t,"__esModule",{value:!0});var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};t.default=u,t.getSingleSelector=o,t.getMultiSelector=i;var f=n(1),l=r(f),s=n(5),d=r(s),v=n(3),p=r(v),g=n(4),y=n(2)}).call(t,function(){return this}())}])});
//# sourceMappingURL=optimal-select.min.js.map
|
src/routes/login/index.js
|
onelink-translations/react-localization
|
/**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-present Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import React from 'react';
import Layout from '../../components/Layout';
import Login from './Login';
const title = 'Log In';
export default {
path: '/login',
action() {
return {
title,
component: <Layout><Login title={title} /></Layout>,
};
},
};
|
ajax/libs/rxjs/2.1.1/rx.modern.js
|
pombredanne/cdnjs
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
(function (window, undefined) {
var freeExports = typeof exports == 'object' && exports &&
(typeof global == 'object' && global && global == global.global && (window = global), exports);
/**
* @name Rx
* @type Object
*/
var Rx = { Internals: {} };
// Defaults
function noop() { }
function identity(x) { return x; }
function defaultNow() { return new Date().getTime(); }
function defaultComparer(x, y) { return x === y; }
function defaultSubComparer(x, y) { return x - y; }
function defaultKeySerializer(x) { return x.toString(); }
function defaultError(err) { throw err; }
// Errors
var sequenceContainsNoElements = 'Sequence contains no elements.';
var argumentOutOfRange = 'Argument out of range';
var objectDisposed = 'Object has been disposed';
function checkDisposed() {
if (this.isDisposed) {
throw new Error(objectDisposed);
}
}
var slice = Array.prototype.slice;
function argsOrArray(args, idx) {
return args.length === 1 && Array.isArray(args[idx]) ?
args[idx] :
slice.call(args);
}
var hasProp = {}.hasOwnProperty;
/** @private */
var inherits = this.inherits = Rx.Internals.inherits = function (child, parent) {
function __() { this.constructor = child; }
__.prototype = parent.prototype;
child.prototype = new __();
};
/** @private */
var addProperties = Rx.Internals.addProperties = function (obj) {
var sources = slice.call(arguments, 1);
for (var i = 0, len = sources.length; i < len; i++) {
var source = sources[i];
for (var prop in source) {
obj[prop] = source[prop];
}
}
};
// Rx Utils
var addRef = Rx.Internals.addRef = function (xs, r) {
return new AnonymousObservable(function (observer) {
return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer));
});
};
// Collection polyfills
function arrayInitialize(count, factory) {
var a = new Array(count);
for (var i = 0; i < count; i++) {
a[i] = factory();
}
return a;
}
// Collections
var IndexedItem = function (id, value) {
this.id = id;
this.value = value;
};
IndexedItem.prototype.compareTo = function (other) {
var c = this.value.compareTo(other.value);
if (c === 0) {
c = this.id - other.id;
}
return c;
};
// Priority Queue for Scheduling
var PriorityQueue = function (capacity) {
this.items = new Array(capacity);
this.length = 0;
};
var priorityProto = PriorityQueue.prototype;
priorityProto.isHigherPriority = function (left, right) {
return this.items[left].compareTo(this.items[right]) < 0;
};
priorityProto.percolate = function (index) {
if (index >= this.length || index < 0) {
return;
}
var parent = index - 1 >> 1;
if (parent < 0 || parent === index) {
return;
}
if (this.isHigherPriority(index, parent)) {
var temp = this.items[index];
this.items[index] = this.items[parent];
this.items[parent] = temp;
this.percolate(parent);
}
};
priorityProto.heapify = function (index) {
if (index === undefined) {
index = 0;
}
if (index >= this.length || index < 0) {
return;
}
var left = 2 * index + 1,
right = 2 * index + 2,
first = index;
if (left < this.length && this.isHigherPriority(left, first)) {
first = left;
}
if (right < this.length && this.isHigherPriority(right, first)) {
first = right;
}
if (first !== index) {
var temp = this.items[index];
this.items[index] = this.items[first];
this.items[first] = temp;
this.heapify(first);
}
};
priorityProto.peek = function () {
return this.items[0].value;
};
priorityProto.removeAt = function (index) {
this.items[index] = this.items[--this.length];
delete this.items[this.length];
this.heapify();
};
priorityProto.dequeue = function () {
var result = this.peek();
this.removeAt(0);
return result;
};
priorityProto.enqueue = function (item) {
var index = this.length++;
this.items[index] = new IndexedItem(PriorityQueue.count++, item);
this.percolate(index);
};
priorityProto.remove = function (item) {
for (var i = 0; i < this.length; i++) {
if (this.items[i].value === item) {
this.removeAt(i);
return true;
}
}
return false;
};
PriorityQueue.count = 0;
/**
* Represents a group of disposable resources that are disposed together.
*
* @constructor
*/
var CompositeDisposable = Rx.CompositeDisposable = function () {
this.disposables = argsOrArray(arguments, 0);
this.isDisposed = false;
this.length = this.disposables.length;
};
var CompositeDisposablePrototype = CompositeDisposable.prototype;
/**
* Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.
*
* @param {Mixed} item Disposable to add.
*/
CompositeDisposablePrototype.add = function (item) {
if (this.isDisposed) {
item.dispose();
} else {
this.disposables.push(item);
this.length++;
}
};
/**
* Removes and disposes the first occurrence of a disposable from the CompositeDisposable.
*
* @memberOf 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.
*
* @memberOf CompositeDisposable#
*/
CompositeDisposablePrototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var currentDisposables = this.disposables.slice(0);
this.disposables = [];
this.length = 0;
for (var i = 0, len = currentDisposables.length; i < len; i++) {
currentDisposables[i].dispose();
}
}
};
/**
* Removes and disposes all disposables from the CompositeDisposable, but does not dispose the CompositeDisposable.
*
* @memberOf CompositeDisposable#
*/
CompositeDisposablePrototype.clear = function () {
var currentDisposables = this.disposables.slice(0);
this.disposables = [];
this.length = 0;
for (var i = 0, len = currentDisposables.length; i < len; i++) {
currentDisposables[i].dispose();
}
};
/**
* Determines whether the CompositeDisposable contains a specific disposable.
*
* @memberOf CompositeDisposable#
* @param {Mixed} item Disposable to search for.
* @returns {Boolean} true if the disposable was found; otherwise, false.
*/
CompositeDisposablePrototype.contains = function (item) {
return this.disposables.indexOf(item) !== -1;
};
/**
* Converts the existing CompositeDisposable to an array of disposables
*
* @memberOf CompositeDisposable#
* @returns {Array} An array of disposable objects.
*/
CompositeDisposablePrototype.toArray = function () {
return this.disposables.slice(0);
};
/**
* Provides a set of static methods for creating Disposables.
*
* @constructor
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
*/
var Disposable = Rx.Disposable = function (action) {
this.isDisposed = false;
this.action = action;
};
/**
* Performs the task of cleaning up resources.
*
* @memberOf Disposable#
*/
Disposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.action();
this.isDisposed = true;
}
};
/**
* Creates a disposable object that invokes the specified action when disposed.
*
* @static
* @memberOf Disposable
* @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.
*
* @static
* @memberOf Disposable
*/
var disposableEmpty = Disposable.empty = { dispose: noop };
/**
* Represents a disposable resource which only allows a single assignment of its underlying disposable resource.
* If an underlying disposable resource has already been set, future attempts to set the underlying disposable resource will throw an Error.
*
* @constructor
*/
var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = function () {
this.isDisposed = false;
this.current = null;
};
var SingleAssignmentDisposablePrototype = SingleAssignmentDisposable.prototype;
/**
* Gets or sets the underlying disposable. After disposal, the result of getting this method is undefined.
*
* @memberOf SingleAssignmentDisposable#
* @param {Disposable} [value] The new underlying disposable.
* @returns {Disposable} The underlying disposable.
*/
SingleAssignmentDisposablePrototype.disposable = function (value) {
return !value ? this.getDisposable() : this.setDisposable(value);
};
/**
* Gets the underlying disposable. After disposal, the result of getting this method is undefined.
*
* @memberOf SingleAssignmentDisposable#
* @returns {Disposable} The underlying disposable.
*/
SingleAssignmentDisposablePrototype.getDisposable = function () {
return this.current;
};
/**
* Sets the underlying disposable.
*
* @memberOf SingleAssignmentDisposable#
* @param {Disposable} value The new underlying disposable.
*/
SingleAssignmentDisposablePrototype.setDisposable = function (value) {
if (this.current) {
throw new Error('Disposable has already been assigned');
}
var shouldDispose = this.isDisposed;
if (!shouldDispose) {
this.current = value;
}
if (shouldDispose && value) {
value.dispose();
}
};
/**
* Disposes the underlying disposable.
*
* @memberOf SingleAssignmentDisposable#
*/
SingleAssignmentDisposablePrototype.dispose = function () {
var old;
if (!this.isDisposed) {
this.isDisposed = true;
old = this.current;
this.current = null;
}
if (old) {
old.dispose();
}
};
/**
* Represents a disposable resource whose underlying disposable resource can be replaced by another disposable resource, causing automatic disposal of the previous underlying disposable resource.
*
* @constructor
*/
var SerialDisposable = Rx.SerialDisposable = function () {
this.isDisposed = false;
this.current = null;
};
/**
* Gets the underlying disposable.
* @return The underlying disposable</returns>
*/
SerialDisposable.prototype.getDisposable = function () {
return this.current;
};
/**
* Sets the underlying disposable.
*
* @memberOf SerialDisposable#
* @param {Disposable} value The new underlying disposable.
*/
SerialDisposable.prototype.setDisposable = function (value) {
var shouldDispose = this.isDisposed, old;
if (!shouldDispose) {
old = this.current;
this.current = value;
}
if (old) {
old.dispose();
}
if (shouldDispose && value) {
value.dispose();
}
};
/**
* Gets or sets the underlying disposable.
* If the SerialDisposable has already been disposed, assignment to this property causes immediate disposal of the given disposable object. Assigning this property disposes the previous disposable object.
*
* @memberOf SerialDisposable#
* @param {Disposable} [value] The new underlying disposable.
* @returns {Disposable} The underlying disposable.
*/
SerialDisposable.prototype.disposable = function (value) {
if (!value) {
return this.getDisposable();
} else {
this.setDisposable(value);
}
};
/**
* Disposes the underlying disposable as well as all future replacements.
*
* @memberOf SerialDisposable#
*/
SerialDisposable.prototype.dispose = function () {
var old;
if (!this.isDisposed) {
this.isDisposed = true;
old = this.current;
this.current = null;
}
if (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 () {
/**
* @constructor
* @private
*/
function InnerDisposable(disposable) {
this.disposable = disposable;
this.disposable.count++;
this.isInnerDisposed = false;
}
/** @private */
InnerDisposable.prototype.dispose = function () {
if (!this.disposable.isDisposed) {
if (!this.isInnerDisposed) {
this.isInnerDisposed = true;
this.disposable.count--;
if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) {
this.disposable.isDisposed = true;
this.disposable.underlyingDisposable.dispose();
}
}
}
};
/**
* Initializes a new instance of the RefCountDisposable with the specified disposable.
*
* @constructor
* @param {Disposable} disposable Underlying disposable.
*/
function RefCountDisposable(disposable) {
this.underlyingDisposable = disposable;
this.isDisposed = false;
this.isPrimaryDisposed = false;
this.count = 0;
}
/**
* Disposes the underlying disposable only when all dependent disposables have been disposed
*
* @memberOf RefCountDisposable#
*/
RefCountDisposable.prototype.dispose = function () {
if (!this.isDisposed) {
if (!this.isPrimaryDisposed) {
this.isPrimaryDisposed = true;
if (this.count === 0) {
this.isDisposed = true;
this.underlyingDisposable.dispose();
}
}
}
};
/**
* Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable.
*
* @memberOf RefCountDisposable#
* @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime.H
*/
RefCountDisposable.prototype.getDisposable = function () {
return this.isDisposed ? disposableEmpty : new InnerDisposable(this);
};
return RefCountDisposable;
})();
/**
* @constructor
* @private
*/
function ScheduledDisposable(scheduler, disposable) {
this.scheduler = scheduler, this.disposable = disposable, this.isDisposed = false;
}
/**
* @private
* @memberOf ScheduledDisposable#
*/
ScheduledDisposable.prototype.dispose = function () {
var parent = this;
this.scheduler.schedule(function () {
if (!parent.isDisposed) {
parent.isDisposed = true;
parent.disposable.dispose();
}
});
};
/**
* @private
* @constructor
*/
function ScheduledItem(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();
}
/**
* @private
* @memberOf ScheduledItem#
*/
ScheduledItem.prototype.invoke = function () {
this.disposable.disposable(this.invokeCore());
};
/**
* @private
* @memberOf ScheduledItem#
*/
ScheduledItem.prototype.compareTo = function (other) {
return this.comparer(this.dueTime, other.dueTime);
};
/**
* @private
* @memberOf ScheduledItem#
*/
ScheduledItem.prototype.isCancelled = function () {
return this.disposable.isDisposed;
};
/**
* @private
* @memberOf ScheduledItem#
*/
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 () {
/**
* @constructor
* @private
*/
function Scheduler(now, schedule, scheduleRelative, scheduleAbsolute) {
this.now = now;
this._schedule = schedule;
this._scheduleRelative = scheduleRelative;
this._scheduleAbsolute = scheduleAbsolute;
}
function invokeRecImmediate(scheduler, pair) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2) {
var isAdded = false, isDone = false,
d = scheduler.scheduleWithState(state2, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function invokeRecDate(scheduler, pair, method) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2, dueTime1) {
var isAdded = false, isDone = false,
d = scheduler[method].call(scheduler, state2, dueTime1, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function invokeAction(scheduler, action) {
action();
return disposableEmpty;
}
var schedulerProto = Scheduler.prototype;
/**
* Returns a scheduler that wraps the original scheduler, adding exception handling for scheduled actions.
*
* @memberOf Scheduler#
* @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.catchException = function (handler) {
return new CatchScheduler(this, handler);
};
/**
* 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.
*
* @memberOf Scheduler#
* @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).
*/
schedulerProto.schedulePeriodic = function (period, action) {
return this.schedulePeriodicWithState(null, period, function () {
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.
*
* @memberOf Scheduler#
* @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).
*/
schedulerProto.schedulePeriodicWithState = function (state, period, action) {
var s = state, id = window.setInterval(function () {
s = action(s);
}, period);
return disposableCreate(function () {
window.clearInterval(id);
});
};
/**
* Schedules an action to be executed.
*
* @memberOf Scheduler#
* @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.
*
* @memberOf Scheduler#
* @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.
*
* @memberOf Scheduler#
* @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.
*
* @memberOf Scheduler#
* @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.
*
* @memberOf Scheduler#
* @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.
*
* @memberOf Scheduler#
* @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);
};
/**
* Schedules an action to be executed recursively.
*
* @memberOf Scheduler#
* @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.
*
* @memberOf Scheduler#
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithState = function (state, action) {
return this.scheduleWithState({ first: state, second: action }, function (s, p) {
return invokeRecImmediate(s, p);
});
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
*
* @memberOf Scheduler
* @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, function (_action, self) {
_action(function (dt) {
self(_action, dt);
});
});
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
*
* @memberOf Scheduler
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative({ first: state, second: action }, dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithRelativeAndState');
});
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
*
* @memberOf Scheduler
* @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, function (_action, self) {
_action(function (dt) {
self(_action, dt);
});
});
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
*
* @memberOf Scheduler
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute({ first: state, second: action }, dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState');
});
};
/** Gets the current time according to the local machine's system clock. */
Scheduler.now = defaultNow;
/**
* Normalizes the specified TimeSpan value to a positive value.
*
* @static
* @memberOf Scheduler
* @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) {
if (timeSpan < 0) {
timeSpan = 0;
}
return timeSpan;
};
return Scheduler;
}());
var schedulerNoBlockError = 'Scheduler is not allowed to block the thread';
/**
* Gets a scheduler that schedules work immediately on the current thread.
*
* @memberOf Scheduler
*/
var immediateScheduler = Scheduler.immediate = (function () {
function scheduleNow(state, action) {
return action(this, state);
}
function scheduleRelative(state, dueTime, action) {
if (dueTime > 0) throw new Error(schedulerNoBlockError);
return action(this, state);
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}());
/**
* Gets a scheduler that schedules work as soon as possible on the current thread.
*/
var currentThreadScheduler = Scheduler.currentThread = (function () {
var queue;
/**
* @private
* @constructor
*/
function Trampoline() {
queue = new PriorityQueue(4);
}
/**
* @private
* @memberOf Trampoline
*/
Trampoline.prototype.dispose = function () {
queue = null;
};
/**
* @private
* @memberOf Trampoline
*/
Trampoline.prototype.run = function () {
var item;
while (queue.length > 0) {
item = queue.dequeue();
if (!item.isCancelled()) {
while (item.dueTime - Scheduler.now() > 0) {
}
if (!item.isCancelled()) {
item.invoke();
}
}
}
};
function scheduleNow(state, action) {
return this.scheduleWithRelativeAndState(state, 0, action);
}
function scheduleRelative(state, dueTime, action) {
var dt = this.now() + Scheduler.normalize(dueTime),
si = new ScheduledItem(this, state, action, dt),
t;
if (!queue) {
t = new Trampoline();
try {
queue.enqueue(si);
t.run();
} catch (e) {
throw e;
} finally {
t.dispose();
}
} else {
queue.enqueue(si);
}
return si.disposable;
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
var currentScheduler = new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
currentScheduler.scheduleRequired = function () { return queue === null; };
currentScheduler.ensureTrampoline = function (action) {
if (queue === null) {
return this.schedule(action);
} else {
return action();
}
};
return currentScheduler;
}());
/**
* @private
*/
var SchedulePeriodicRecursive = (function () {
function tick(command, recurse) {
recurse(0, this._period);
try {
this._state = this._action(this._state);
} catch (e) {
this._cancel.dispose();
throw e;
}
}
/**
* @constructor
* @private
*/
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;
}());
/** 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;
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be emulated using recursive scheduling.
*
* @memberOf VirtualTimeScheduler#
* @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.
*
* @memberOf VirtualTimeScheduler#
* @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.
*
* @memberOf VirtualTimeScheduler#
* @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.
*
* @memberOf VirtualTimeScheduler#
*/
VirtualTimeSchedulerPrototype.start = function () {
var next;
if (!this.isEnabled) {
this.isEnabled = true;
do {
next = this.getNext();
if (next !== null) {
if (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.
*
* @memberOf VirtualTimeScheduler#
*/
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 next;
var dueToClock = this.comparer(this.clock, time);
if (this.comparer(this.clock, time) > 0) {
throw new Error(argumentOutOfRange);
}
if (dueToClock === 0) {
return;
}
if (!this.isEnabled) {
this.isEnabled = true;
do {
next = this.getNext();
if (next !== null && this.comparer(next.dueTime, time) <= 0) {
if (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.
*
* @memberOf VirtualTimeScheduler#
* @param {Number} time Relative time to advance the scheduler's clock by.
*/
VirtualTimeSchedulerPrototype.advanceBy = function (time) {
var dt = this.add(this.clock, time);
var dueToClock = this.comparer(this.clock, dt);
if (dueToClock > 0) {
throw new Error(argumentOutOfRange);
}
if (dueToClock === 0) {
return;
}
return this.advanceTo(dt);
};
/**
* Advances the scheduler's clock by the specified relative time.
*
* @memberOf VirtualTimeScheduler#
* @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 Error(argumentOutOfRange);
}
this.clock = dt;
};
/**
* Gets the next scheduled item to be executed.
*
* @memberOf VirtualTimeScheduler#
* @returns {ScheduledItem} The next scheduled item.
*/
VirtualTimeSchedulerPrototype.getNext = function () {
var next;
while (this.queue.length > 0) {
next = this.queue.peek();
if (next.isCancelled()) {
this.queue.dequeue();
} else {
return next;
}
}
return null;
};
/**
* Schedules an action to be executed at dueTime.
*
* @memberOf VirtualTimeScheduler#
* @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.
*
* @memberOf VirtualTimeScheduler#
* @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,
run = function (scheduler, state1) {
self.queue.remove(si);
return action(scheduler, state1);
},
si = new ScheduledItem(self, state, run, dueTime, self.comparer);
self.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.
*
* @memberOf HistoricalScheduler
* @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;
};
/**
* @private
* @memberOf HistoricalScheduler
*/
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));
/**
* Gets a scheduler that schedules work via a timed callback based upon platform.
*
* @memberOf Scheduler
*/
var timeoutScheduler = Scheduler.timeout = (function () {
function postMessageSupported () {
// Ensure not in a worker
if (!window.postMessage || window.importScripts) { return false; }
var isAsync = false,
oldHandler = window.onmessage;
// Test for async
window.onmessage = function () { isAsync = true; };
window.postMessage('','*');
window.onmessage = oldHandler;
return isAsync;
}
var scheduleMethod, clearMethod = noop;
if (typeof window.process !== 'undefined' && typeof window.process === '[object process]') {
scheduleMethod = window.process.nextTick;
} else if (typeof window.setImmediate === 'function') {
scheduleMethod = window.setImmediate;
clearMethod = window.clearImmediate;
} else if (postMessageSupported()) {
var MSG_PREFIX = 'ms.rx.schedule' + Math.random(),
tasks = {},
taskId = 0;
function onGlobalPostMessage(event) {
// Only if we're a match to avoid any other global events
if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) {
var handleId = event.data.substring(MSG_PREFIX.length),
action = tasks[handleId];
action();
delete tasks[handleId];
}
}
if (window.addEventListener) {
window.addEventListener('message', onGlobalPostMessage, false);
} else {
window.attachEvent('onmessage', onGlobalPostMessage, false);
}
scheduleMethod = function (action) {
var currentId = taskId++;
tasks[currentId] = action;
window.postMessage(MSG_PREFIX + currentId, '*');
};
} else if (!!window.MessageChannel) {
scheduleMethod = function (action) {
var channel = new window.MessageChannel();
channel.port1.onmessage = function (event) {
action();
};
channel.port2.postMessage();
};
} else if ('document' in window && 'onreadystatechange' in window.document.createElement('script')) {
var scriptElement = window.document.createElement('script');
scriptElement.onreadystatechange = function () {
action();
scriptElement.onreadystatechange = null;
scriptElement.parentNode.removeChild(scriptElement);
scriptElement = null;
};
window.document.documentElement.appendChild(scriptElement);
} else {
scheduleMethod = function (action) { return window.setTimeout(action, 0); };
clearMethod = window.clearTimeout;
}
function scheduleNow(state, action) {
var scheduler = this,
disposable = new SingleAssignmentDisposable();
var id = scheduleMethod(function () {
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
});
return new CompositeDisposable(disposable, disposableCreate(function () {
clearMethod(id);
}));
}
function scheduleRelative(state, dueTime, action) {
var scheduler = this,
dt = Scheduler.normalize(dueTime);
if (dt === 0) {
return scheduler.scheduleWithState(state, action);
}
var disposable = new SingleAssignmentDisposable();
var id = window.setTimeout(function () {
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
}, dt);
return new CompositeDisposable(disposable, disposableCreate(function () {
window.clearTimeout(id);
}));
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
})();
/** @private */
var CatchScheduler = (function (_super) {
function localNow() {
return this._scheduler.now();
}
function scheduleNow(state, action) {
return this._scheduler.scheduleWithState(state, this._wrap(action));
}
function scheduleRelative(state, dueTime, action) {
return this._scheduler.scheduleWithRelativeAndState(state, dueTime, this._wrap(action));
}
function scheduleAbsolute(state, dueTime, action) {
return this._scheduler.scheduleWithAbsoluteAndState(state, dueTime, this._wrap(action));
}
inherits(CatchScheduler, _super);
/** @private */
function CatchScheduler(scheduler, handler) {
this._scheduler = scheduler;
this._handler = handler;
this._recursiveOriginal = null;
this._recursiveWrapper = null;
_super.call(this, localNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}
/** @private */
CatchScheduler.prototype._clone = function (scheduler) {
return new CatchScheduler(scheduler, this._handler);
};
/** @private */
CatchScheduler.prototype._wrap = function (action) {
var parent = this;
return function (self, state) {
try {
return action(parent._getRecursiveWrapper(self), state);
} catch (e) {
if (!parent._handler(e)) { throw e; }
return disposableEmpty;
}
};
};
/** @private */
CatchScheduler.prototype._getRecursiveWrapper = function (scheduler) {
if (!this._recursiveOriginal !== scheduler) {
this._recursiveOriginal = scheduler;
var wrapper = this._clone(scheduler);
wrapper._recursiveOriginal = scheduler;
wrapper._recursiveWrapper = wrapper;
this._recursiveWrapper = wrapper;
}
return this._recursiveWrapper;
};
/** @private */
CatchScheduler.prototype.schedulePeriodicWithState = function (state, period, action) {
var self = this, failed = false, d = new SingleAssignmentDisposable();
d.setDisposable(this._scheduler.schedulePeriodicWithState(state, period, function (state1) {
if (failed) { return null; }
try {
return action(state1);
} catch (e) {
failed = true;
if (!self._handler(e)) { throw e; }
d.dispose();
return null;
}
}));
return d;
};
return CatchScheduler;
}(Scheduler));
/**
* Represents a notification to an observer.
*/
var Notification = Rx.Notification = (function () {
function Notification(kind, hasValue) {
this.hasValue = hasValue == null ? false : hasValue;
this.kind = kind;
}
var NotificationPrototype = Notification.prototype;
/**
* 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.
*/
NotificationPrototype.accept = function (observerOrOnNext, onError, onCompleted) {
if (arguments.length === 1 && typeof observerOrOnNext === 'object') {
return this._acceptObservable(observerOrOnNext);
}
return this._accept(observerOrOnNext, onError, onCompleted);
};
/**
* Returns an observable sequence with a single notification.
*
* @memberOf Notification
* @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.
*/
NotificationPrototype.toObservable = function (scheduler) {
var notification = this;
scheduler = scheduler || immediateScheduler;
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
notification._acceptObservable(observer);
if (notification.kind === 'N') {
observer.onCompleted();
}
});
});
};
NotificationPrototype.equals = function (other) {
var otherString = other == null ? '' : other.toString();
return this.toString() === otherString;
};
return Notification;
})();
/**
* Creates an object that represents an OnNext notification to an observer.
*
* @static
* @memberOf Notification
* @param {Any} value The value contained in the notification.
* @returns {Notification} The OnNext notification containing the value.
*/
var notificationCreateOnNext = Notification.createOnNext = (function () {
function _accept (onNext) {
return onNext(this.value);
}
function _acceptObservable(observer) {
return observer.onNext(this.value);
}
function toString () {
return 'OnNext(' + this.value + ')';
}
return function (value) {
var notification = new Notification('N', true);
notification.value = value;
notification._accept = _accept.bind(notification);
notification._acceptObservable = _acceptObservable.bind(notification);
notification.toString = toString.bind(notification);
return notification;
};
}());
/**
* Creates an object that represents an OnError notification to an observer.
*
* @static s
* @memberOf Notification
* @param {Any} error The exception contained in the notification.
* @returns {Notification} The OnError notification containing the exception.
*/
var notificationCreateOnError = Notification.createOnError = (function () {
function _accept (onNext, onError) {
return onError(this.exception);
}
function _acceptObservable(observer) {
return observer.onError(this.exception);
}
function toString () {
return 'OnError(' + this.exception + ')';
}
return function (exception) {
var notification = new Notification('E');
notification.exception = exception;
notification._accept = _accept.bind(notification);
notification._acceptObservable = _acceptObservable.bind(notification);
notification.toString = toString.bind(notification);
return notification;
};
}());
/**
* Creates an object that represents an OnCompleted notification to an observer.
*
* @static
* @memberOf Notification
* @returns {Notification} The OnCompleted notification.
*/
var notificationCreateOnCompleted = Notification.createOnCompleted = (function () {
function _accept (onNext, onError, onCompleted) {
return onCompleted();
}
function _acceptObservable(observer) {
return observer.onCompleted();
}
function toString () {
return 'OnCompleted()';
}
return function () {
var notification = new Notification('C');
notification._accept = _accept.bind(notification);
notification._acceptObservable = _acceptObservable.bind(notification);
notification.toString = toString.bind(notification);
return notification;
};
}());
/**
* @constructor
* @private
*/
var Enumerator = Rx.Internals.Enumerator = function (moveNext, getCurrent, dispose) {
this.moveNext = moveNext;
this.getCurrent = getCurrent;
this.dispose = dispose;
};
/**
* @static
* @memberOf Enumerator
* @private
*/
var enumeratorCreate = Enumerator.create = function (moveNext, getCurrent, dispose) {
var done = false;
dispose || (dispose = noop);
return new Enumerator(function () {
if (done) {
return false;
}
var result = moveNext();
if (!result) {
done = true;
dispose();
}
return result;
}, function () { return getCurrent(); }, function () {
if (!done) {
dispose();
done = true;
}
});
};
/** @private */
var Enumerable = Rx.Internals.Enumerable = (function () {
/**
* @constructor
* @private
*/
function Enumerable(getEnumerator) {
this.getEnumerator = getEnumerator;
}
/**
* @private
* @memberOf Enumerable#
*/
Enumerable.prototype.concat = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var e = sources.getEnumerator(), isDisposed = false, subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
var current, ex, hasNext = false;
if (!isDisposed) {
try {
hasNext = e.moveNext();
if (hasNext) {
current = e.getCurrent();
} else {
e.dispose();
}
} catch (exception) {
ex = exception;
e.dispose();
}
} else {
return;
}
if (ex) {
observer.onError(ex);
return;
}
if (!hasNext) {
observer.onCompleted();
return;
}
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(current.subscribe(
observer.onNext.bind(observer),
observer.onError.bind(observer),
function () { self(); })
);
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
e.dispose();
}));
});
};
/**
* @private
* @memberOf Enumerable#
*/
Enumerable.prototype.catchException = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var e = sources.getEnumerator(), isDisposed = false, lastException;
var subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
var current, ex, hasNext;
hasNext = false;
if (!isDisposed) {
try {
hasNext = e.moveNext();
if (hasNext) {
current = e.getCurrent();
}
} catch (exception) {
ex = exception;
}
} else {
return;
}
if (ex) {
observer.onError(ex);
return;
}
if (!hasNext) {
if (lastException) {
observer.onError(lastException);
} else {
observer.onCompleted();
}
return;
}
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(current.subscribe(
observer.onNext.bind(observer),
function (exn) {
lastException = exn;
self();
},
observer.onCompleted.bind(observer)));
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
return Enumerable;
}());
/**
* @static
* @private
* @memberOf Enumerable
*/
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
if (repeatCount === undefined) {
repeatCount = -1;
}
return new Enumerable(function () {
var current, left = repeatCount;
return enumeratorCreate(function () {
if (left === 0) {
return false;
}
if (left > 0) {
left--;
}
current = value;
return true;
}, function () { return current; });
});
};
/**
* @static
* @private
* @memberOf Enumerable
*/
var enumerableFor = Enumerable.forEach = function (source, selector) {
selector || (selector = identity);
return new Enumerable(function () {
var current, index = -1;
return enumeratorCreate(
function () {
if (++index < source.length) {
current = selector(source[index], index);
return true;
}
return false;
},
function () { return current; }
);
});
};
/**
* Supports push-style iteration over an observable sequence.
*/
var Observer = Rx.Observer = function () { };
/**
* Creates a notification callback from an observer.
*
* @param observer Observer object.
* @returns The action that forwards its input notification to the underlying observer.
*/
Observer.prototype.toNotifier = function () {
var observer = this;
return function (n) {
return n.accept(observer);
};
};
/**
* Hides the identity of an observer.
* @returns An observer that hides the identity of the specified observer.
*/
Observer.prototype.asObserver = function () {
return new AnonymousObserver(this.onNext.bind(this), this.onError.bind(this), this.onCompleted.bind(this));
};
/**
* Checks access to the observer for grammar violations. This includes checking for multiple OnError or OnCompleted calls, as well as reentrancy in any of the observer methods.
* If a violation is detected, an Error is thrown from the offending observer method call.
*
* @returns An observer that checks callbacks invocations against the observer grammar and, if the checks pass, forwards those to the specified observer.
*/
Observer.prototype.checked = function () { return new CheckedObserver(this); };
/**
* Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions.
*
* @static
* @memberOf Observer
* @param {Function} [onNext] Observer's OnNext action implementation.
* @param {Function} [onError] Observer's OnError action implementation.
* @param {Function} [onCompleted] Observer's OnCompleted action implementation.
* @returns {Observer} The observer object implemented using the given actions.
*/
var observerCreate = Observer.create = function (onNext, onError, onCompleted) {
onNext || (onNext = noop);
onError || (onError = defaultError);
onCompleted || (onCompleted = noop);
return new AnonymousObserver(onNext, onError, onCompleted);
};
/**
* Creates an observer from a notification callback.
*
* @static
* @memberOf Observer
* @param {Function} handler Action that handles a notification.
* @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives.
*/
Observer.fromNotifier = function (handler) {
return new AnonymousObserver(function (x) {
return handler(notificationCreateOnNext(x));
}, function (exception) {
return handler(notificationCreateOnError(exception));
}, function () {
return handler(notificationCreateOnCompleted());
});
};
/**
* Abstract base class for implementations of the Observer class.
* This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages.
*/
var AbstractObserver = Rx.Internals.AbstractObserver = (function (_super) {
inherits(AbstractObserver, _super);
/**
* Creates a new observer in a non-stopped state.
*
* @constructor
*/
function AbstractObserver() {
this.isStopped = false;
_super.call(this);
}
/**
* Notifies the observer of a new element in the sequence.
*
* @memberOf AbstractObserver
* @param {Any} value Next element in the sequence.
*/
AbstractObserver.prototype.onNext = function (value) {
if (!this.isStopped) {
this.next(value);
}
};
/**
* Notifies the observer that an exception has occurred.
*
* @memberOf AbstractObserver
* @param {Any} error The error that has occurred.
*/
AbstractObserver.prototype.onError = function (error) {
if (!this.isStopped) {
this.isStopped = true;
this.error(error);
}
};
/**
* Notifies the observer of the end of the sequence.
*/
AbstractObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.completed();
}
};
/**
* Disposes the observer, causing it to transition to the stopped state.
*/
AbstractObserver.prototype.dispose = function () {
this.isStopped = true;
};
AbstractObserver.prototype.fail = function () {
if (!this.isStopped) {
this.isStopped = true;
this.error(true);
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.
*
* @constructor
* @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.
*
* @memberOf AnonymousObserver
* @param {Any} value Next element in the sequence.
*/
AnonymousObserver.prototype.next = function (value) {
this._onNext(value);
};
/**
* Calls the onError action.
*
* @memberOf AnonymousObserver
* @param {Any{ error The error that has occurred.
*/
AnonymousObserver.prototype.error = function (exception) {
this._onError(exception);
};
/**
* Calls the onCompleted action.
*
* @memberOf AnonymousObserver
*/
AnonymousObserver.prototype.completed = function () {
this._onCompleted();
};
return AnonymousObserver;
}(AbstractObserver));
var CheckedObserver = (function (_super) {
inherits(CheckedObserver, _super);
function CheckedObserver(observer) {
_super.call(this);
this._observer = observer;
this._state = 0; // 0 - idle, 1 - busy, 2 - done
}
var CheckedObserverPrototype = CheckedObserver.prototype;
CheckedObserverPrototype.onNext = function (value) {
this.checkAccess();
try {
this._observer.onNext(value);
} catch (e) {
throw e;
} finally {
this._state = 0;
}
};
CheckedObserverPrototype.onError = function (err) {
this.checkAccess();
try {
this._observer.onError(err);
} catch (e) {
throw e;
} finally {
this._state = 2;
}
};
CheckedObserverPrototype.onCompleted = function () {
this.checkAccess();
try {
this._observer.onCompleted();
} catch (e) {
throw e;
} finally {
this._state = 2;
}
};
CheckedObserverPrototype.checkAccess = function () {
if (this._state === 1) { throw new Error('Re-entrancy detected'); }
if (this._state === 2) { throw new Error('Observer completed'); }
if (this._state === 0) { this._state = 1; }
};
return CheckedObserver;
}(Observer));
/** @private */
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();
}
/** @private */
ScheduledObserver.prototype.next = function (value) {
var self = this;
this.queue.push(function () {
self.observer.onNext(value);
});
};
/** @private */
ScheduledObserver.prototype.error = function (exception) {
var self = this;
this.queue.push(function () {
self.observer.onError(exception);
});
};
/** @private */
ScheduledObserver.prototype.completed = function () {
var self = this;
this.queue.push(function () {
self.observer.onCompleted();
});
};
/** @private */
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();
}));
}
};
/** @private */
ScheduledObserver.prototype.dispose = function () {
_super.prototype.dispose.call(this);
this.disposable.dispose();
};
return ScheduledObserver;
}(AbstractObserver));
/** @private */
var ObserveOnObserver = (function (_super) {
inherits(ObserveOnObserver, _super);
/** @private */
function ObserveOnObserver() {
_super.apply(this, arguments);
}
/** @private */
ObserveOnObserver.prototype.next = function (value) {
_super.prototype.next.call(this, value);
this.ensureActive();
};
/** @private */
ObserveOnObserver.prototype.error = function (e) {
_super.prototype.error.call(this, e);
this.ensureActive();
};
/** @private */
ObserveOnObserver.prototype.completed = function () {
_super.prototype.completed.call(this);
this.ensureActive();
};
return ObserveOnObserver;
})(ScheduledObserver);
var observableProto;
/**
* Represents a push-style collection.
*/
var Observable = Rx.Observable = (function () {
/**
* @constructor
* @private
*/
function Observable(subscribe) {
this._subscribe = subscribe;
}
observableProto = Observable.prototype;
observableProto.finalValue = function () {
var source = this;
return new AnonymousObservable(function (observer) {
var hasValue = false, value;
return source.subscribe(function (x) {
hasValue = true;
value = x;
}, observer.onError.bind(observer), function () {
if (!hasValue) {
observer.onError(new Error(sequenceContainsNoElements));
} else {
observer.onNext(value);
observer.onCompleted();
}
});
});
};
/**
* Subscribes an observer to the observable sequence.
*
* @example
* 1 - source.subscribe();
* 2 - source.subscribe(observer);
* 3 - source.subscribe(function (x) { console.log(x); });
* 4 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); });
* 5 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); }, function () { console.log('done'); });
* @param {Mixed} [observerOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
*/
observableProto.subscribe = observableProto.forEach = function (observerOrOnNext, onError, onCompleted) {
var subscriber;
if (typeof observerOrOnNext === 'object') {
subscriber = observerOrOnNext;
} else {
subscriber = observerCreate(observerOrOnNext, onError, onCompleted);
}
return this._subscribe(subscriber);
};
/**
* Creates a list from an observable sequence.
*
* @memberOf Observable
* @returns An observable sequence containing a single element with a list containing all the elements of the source sequence.
*/
observableProto.toArray = function () {
function accumulator(list, i) {
var newList = list.slice(0);
newList.push(i);
return newList;
}
return this.scan([], accumulator).startWith([]).finalValue();
}
return Observable;
})();
/**
* Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence.
*
* @example
* 1 - res = Rx.Observable.start(function () { console.log('hello'); });
* 2 - res = Rx.Observable.start(function () { console.log('hello'); }, Rx.Scheduler.timeout);
* 2 - 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, scheduler, context) {
return observableToAsync(func, 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.
*
* @example
* 1 - res = Rx.Observable.toAsync(function (x, y) { return x + y; })(4, 3);
* 2 - res = Rx.Observable.toAsync(function (x, y) { return x + y; }, Rx.Scheduler.timeout)(4, 3);
* 2 - res = Rx.Observable.toAsync(function (x) { this.log(x); }, Rx.Scheduler.timeout, console)('hello');
*
* @param 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, scheduler, context) {
scheduler || (scheduler = timeoutScheduler);
return function () {
var args = slice.call(arguments, 0), 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();
};
};
/**
* Wraps the source sequence in order to run its observer callbacks on the specified scheduler.
*
* This only invokes observer callbacks on a scheduler. In case the subscription and/or unsubscription actions have side-effects
* that require to be run on a scheduler, use subscribeOn.
*
* @param {Scheduler} scheduler Scheduler to notify observers on.
* @returns {Observable} The source sequence whose observations happen on the specified scheduler.
*/
observableProto.observeOn = function (scheduler) {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(new ObserveOnObserver(scheduler, observer));
});
};
/**
* Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used;
* see the remarks section for more information on the distinction between subscribeOn and observeOn.
* This only performs the side-effects of subscription and unsubscription on the specified scheduler. In order to invoke observer
* callbacks on a scheduler, use observeOn.
* @param {Scheduler} scheduler Scheduler to perform subscription and unsubscription actions on.
* @returns {Observable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
*/
observableProto.subscribeOn = function (scheduler) {
var source = this;
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(), d = new SerialDisposable();
d.setDisposable(m);
m.setDisposable(scheduler.schedule(function () {
d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(observer)));
}));
return d;
});
};
/**
* Creates an observable sequence from a specified subscribe method implementation.
*
* @example
* 1 - res = Rx.Observable.create(function (observer) { return function () { } );
*
* @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 = function (subscribe) {
return new AnonymousObservable(function (o) {
return disposableCreate(subscribe(o));
});
};
/**
* Creates an observable sequence from a specified subscribe method implementation.
*
* @example
* 1 - res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } );
* @static
* @memberOf Observable
* @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method.
* @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.
*/
Observable.createWithDisposable = function (subscribe) {
return new AnonymousObservable(subscribe);
};
/**
* Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.
*
* @example
* 1 - res = Rx.Observable.defer(function () { return Rx.Observable.fromArray([1,2,3]); });
* @static
* @memberOf Observable
* @param {Function} observableFactory Observable factory function to invoke for each observer that subscribes to the resulting sequence.
* @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);
}
return result.subscribe(observer);
});
};
/**
* Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
*
* @example
* 1 - res = Rx.Observable.empty();
* 2 - res = Rx.Observable.empty(Rx.Scheduler.timeout);
* @static
* @memberOf Observable
* @param {Scheduler} [scheduler] Scheduler to send the termination call on.
* @returns {Observable} An observable sequence with no elements.
*/
var observableEmpty = Observable.empty = function (scheduler) {
scheduler || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onCompleted();
});
});
};
/**
* Converts an array to an observable sequence, using an optional scheduler to enumerate the array.
*
* @example
* 1 - res = Rx.Observable.fromArray([1,2,3]);
* 2 - res = Rx.Observable.fromArray([1,2,3], Rx.Scheduler.timeout);
* @static
* @memberOf Observable
* @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) {
scheduler || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var count = 0;
return scheduler.scheduleRecursive(function (self) {
if (count < array.length) {
observer.onNext(array[count++]);
self();
} else {
observer.onCompleted();
}
});
});
};
/**
* Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages.
*
* @example
* 1 - res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; });
* 2 - res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }, Rx.Scheduler.timeout);
* @static
* @memberOf Observable
* @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) {
scheduler || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var first = true, state = initialState;
return scheduler.scheduleRecursive(function (self) {
var hasResult, result;
try {
if (first) {
first = false;
} else {
state = iterate(state);
}
hasResult = condition(state);
if (hasResult) {
result = resultSelector(state);
}
} catch (exception) {
observer.onError(exception);
return;
}
if (hasResult) {
observer.onNext(result);
self();
} else {
observer.onCompleted();
}
});
});
};
/**
* Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
*
* @static
* @memberOf Observable
* @returns {Observable} An observable sequence whose observers will never get called.
*/
var observableNever = Observable.never = function () {
return new AnonymousObservable(function () {
return disposableEmpty;
});
};
/**
* Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages.
*
* @example
* 1 - res = Rx.Observable.range(0, 10);
* 2 - res = Rx.Observable.range(0, 10, Rx.Scheduler.timeout);
* @static
* @memberOf Observable
* @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) {
scheduler || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.scheduleRecursiveWithState(0, function (i, self) {
if (i < count) {
observer.onNext(start + i);
self(i + 1);
} else {
observer.onCompleted();
}
});
});
};
/**
* Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages.
*
* @example
* 1 - res = Rx.Observable.repeat(42);
* 2 - res = Rx.Observable.repeat(42, 4);
* 3 - res = Rx.Observable.repeat(42, 4, Rx.Scheduler.timeout);
* 4 - res = Rx.Observable.repeat(42, null, Rx.Scheduler.timeout);
* @static
* @memberOf Observable
* @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) {
scheduler || (scheduler = currentThreadScheduler);
if (repeatCount == undefined) {
repeatCount = -1;
}
return observableReturn(value, scheduler).repeat(repeatCount);
};
/**
* Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages.
*
* @example
* 1 - res = Rx.Observable.returnValue(42);
* 2 - res = Rx.Observable.returnValue(42, Rx.Scheduler.timeout);
* @static
* @memberOf Observable
* @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.returnValue = function (value, scheduler) {
scheduler || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onNext(value);
observer.onCompleted();
});
});
};
/**
* Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single OnError message.
*
* @example
* 1 - res = Rx.Observable.throwException(new Error('Error'));
* 2 - res = Rx.Observable.throwException(new Error('Error'), Rx.Scheduler.timeout);
* @static
* @memberOf Observable
* @param {Mixed} exception An object used for the sequence's termination.
* @param {Scheduler} scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} The observable sequence that terminates exceptionally with the specified exception object.
*/
var observableThrow = Observable.throwException = function (exception, scheduler) {
scheduler || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onError(exception);
});
});
};
/**
* Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime.
*
* @example
* 1 - res = Rx.Observable.using(function () { return new AsyncSubject(); }, function (s) { return s; });
* @static
* @memberOf Observable
* @param {Function} resourceFactory Factory function to obtain a resource object.
* @param {Function} observableFactory Factory function to obtain an observable sequence that depends on the obtained resource.
* @returns {Observable} An observable sequence whose lifetime controls the lifetime of the dependent resource object.
*/
Observable.using = function (resourceFactory, observableFactory) {
return new AnonymousObservable(function (observer) {
var disposable = disposableEmpty, resource, source;
try {
resource = resourceFactory();
if (resource) {
disposable = resource;
}
source = observableFactory(resource);
} catch (exception) {
return new CompositeDisposable(observableThrow(exception).subscribe(observer), disposable);
}
return new CompositeDisposable(source.subscribe(observer), disposable);
});
};
/**
* Propagates the observable sequence that reacts first.
*
* @memberOf Observable#
* @param {Observable} rightSource Second observable sequence.
* @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();
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 that reacts first.
*
* @example
* E.g. winner = Rx.Observable.amb(xs, ys, zs);
* @static
* @memberOf Observable
* @returns {Observable} An observable sequence that surfaces any of the given sequences, whichever reacted first.
*/
Observable.amb = function () {
var acc = observableNever(),
items = argsOrArray(arguments, 0);
function func(previous, current) {
return previous.amb(current);
}
for (var i = 0, len = items.length; i < len; i++) {
acc = func(acc, items[i]);
}
return acc;
};
function observableCatchHandler(source, handler) {
return new AnonymousObservable(function (observer) {
var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable();
subscription.setDisposable(d1);
d1.setDisposable(source.subscribe(observer.onNext.bind(observer), function (exception) {
var d, result;
try {
result = handler(exception);
} catch (ex) {
observer.onError(ex);
return;
}
d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(result.subscribe(observer));
}, observer.onCompleted.bind(observer)));
return subscription;
});
}
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
* @example
* 1 - xs.catchException(ys)
* 2 - xs.catchException(function (ex) { return ys(ex); })
* @memberOf Observable#
* @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.catchException = function (handlerOrSecond) {
if (typeof handlerOrSecond === 'function') {
return observableCatchHandler(this, handlerOrSecond);
}
return observableCatch([this, handlerOrSecond]);
};
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
*
* @example
* 1 - res = Rx.Observable.catchException(xs, ys, zs);
* 2 - res = Rx.Observable.catchException([xs, ys, zs]);
* @static
* @memberOf Observable
* @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.
*/
var observableCatch = Observable.catchException = function () {
var items = argsOrArray(arguments, 0);
return enumerableFor(items).catchException();
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences 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; });
* @memberOf Observable#
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.combineLatest = function () {
var args = slice.call(arguments);
if (Array.isArray(args[0])) {
args[0].unshift(this);
} else {
args.unshift(this);
}
return combineLatest.apply(this, args);
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences 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; });
* @static
* @memberOf Observable
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
var combineLatest = Observable.combineLatest = function () {
var args = slice.call(arguments), resultSelector = args.pop();
if (Array.isArray(args[0])) {
args = args[0];
}
return new AnonymousObservable(function (observer) {
var falseFactory = function () { return false; },
n = args.length,
hasValue = arrayInitialize(n, falseFactory),
hasValueAll = false,
isDone = arrayInitialize(n, falseFactory),
values = new Array(n);
function next(i) {
var res;
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(function (x) { return x; }))) {
try {
res = resultSelector.apply(null, values);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(function (x) { return x; })) {
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) {
subscriptions[i] = new SingleAssignmentDisposable();
subscriptions[i].setDisposable(args[i].subscribe(function (x) {
values[i] = x;
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
})(idx);
}
return new CompositeDisposable(subscriptions);
});
};
/**
* Concatenates all the observable sequences. This takes in either an array or variable arguments to concatenate.
*
* @example
* 1 - concatenated = xs.concat(ys, zs);
* 2 - concatenated = xs.concat([ys, zs]);
* @memberOf Observable#
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
observableProto.concat = function () {
var items = slice.call(arguments, 0);
items.unshift(this);
return observableConcat.apply(this, items);
};
/**
* Concatenates all the observable sequences.
*
* @example
* 1 - res = Rx.Observable.concat(xs, ys, zs);
* 2 - res = Rx.Observable.concat([xs, ys, zs]);
* @static
* @memberOf Observable
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
var observableConcat = Observable.concat = function () {
var sources = argsOrArray(arguments, 0);
return enumerableFor(sources).concat();
};
/**
* Concatenates an observable sequence of observable sequences.
*
* @memberOf Observable#
* @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order.
*/
observableProto.concatObservable = observableProto.concatAll =function () {
return this.merge(1);
};
/**
* Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences.
* Or merges two observable sequences into a single observable sequence.
*
* @example
* 1 - merged = sources.merge(1);
* 2 - merged = source.merge(otherSource);
* @memberOf Observable#
* @param {Mixed} [maxConcurrentOrOther] Maximum number of inner observable sequences being subscribed to concurrently or the second observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.merge = function (maxConcurrentOrOther) {
if (typeof maxConcurrentOrOther !== 'number') {
return observableMerge(this, maxConcurrentOrOther);
}
var sources = this;
return new AnonymousObservable(function (observer) {
var activeCount = 0,
group = new CompositeDisposable(),
isStopped = false,
q = [],
subscribe = function (xs) {
var subscription = new SingleAssignmentDisposable();
group.add(subscription);
subscription.setDisposable(xs.subscribe(observer.onNext.bind(observer), observer.onError.bind(observer), function () {
var s;
group.remove(subscription);
if (q.length > 0) {
s = q.shift();
subscribe(s);
} else {
activeCount--;
if (isStopped && activeCount === 0) {
observer.onCompleted();
}
}
}));
};
group.add(sources.subscribe(function (innerSource) {
if (activeCount < maxConcurrentOrOther) {
activeCount++;
subscribe(innerSource);
} else {
q.push(innerSource);
}
}, observer.onError.bind(observer), function () {
isStopped = true;
if (activeCount === 0) {
observer.onCompleted();
}
}));
return group;
});
};
/**
* Merges all the observable sequences into a single observable sequence.
* The scheduler is optional and if not specified, the immediate scheduler is used.
*
* @example
* 1 - merged = Rx.Observable.merge(xs, ys, zs);
* 2 - merged = Rx.Observable.merge([xs, ys, zs]);
* 3 - merged = Rx.Observable.merge(scheduler, xs, ys, zs);
* 4 - merged = Rx.Observable.merge(scheduler, [xs, ys, zs]);
*
* @static
* @memberOf Observable
* @returns {Observable} The observable sequence that merges the elements of the observable sequences.
*/
var observableMerge = Observable.merge = function () {
var scheduler, sources;
if (!arguments[0]) {
scheduler = immediateScheduler;
sources = slice.call(arguments, 1);
} else if (arguments[0].now) {
scheduler = arguments[0];
sources = slice.call(arguments, 1);
} else {
scheduler = immediateScheduler;
sources = slice.call(arguments, 0);
}
if (Array.isArray(sources[0])) {
sources = sources[0];
}
return observableFromArray(sources, scheduler).mergeObservable();
};
/**
* Merges an observable sequence of observable sequences into an observable sequence.
*
* @memberOf Observable#
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.mergeObservable = observableProto.mergeAll =function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var group = new CompositeDisposable(),
isStopped = false,
m = new SingleAssignmentDisposable();
group.add(m);
m.setDisposable(sources.subscribe(function (innerSource) {
var innerSubscription = new SingleAssignmentDisposable();
group.add(innerSubscription);
innerSubscription.setDisposable(innerSource.subscribe(function (x) {
observer.onNext(x);
}, observer.onError.bind(observer), function () {
group.remove(innerSubscription);
if (isStopped && group.length === 1) {
observer.onCompleted();
}
}));
}, observer.onError.bind(observer), function () {
isStopped = true;
if (group.length === 1) {
observer.onCompleted();
}
}));
return group;
});
};
/**
* Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.
*
* @memberOf Observable
* @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]);
* @static
* @memberOf Observable
* @returns {Observable} An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally.
*/
var onErrorResumeNext = Observable.onErrorResumeNext = function () {
var sources = argsOrArray(arguments, 0);
return new AnonymousObservable(function (observer) {
var pos = 0, subscription = new SerialDisposable(),
cancelable = immediateScheduler.scheduleRecursive(function (self) {
var current, d;
if (pos < sources.length) {
current = sources[pos++];
d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(current.subscribe(observer.onNext.bind(observer), function () {
self();
}, function () {
self();
}));
} else {
observer.onCompleted();
}
});
return new CompositeDisposable(subscription, cancelable);
});
};
/**
* Returns the values from the source observable sequence only after the other observable sequence produces a value.
*
* @memberOf Observable#
* @param {Observable} other The observable sequence that triggers propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.
*/
observableProto.skipUntil = function (other) {
var source = this;
return new AnonymousObservable(function (observer) {
var isOpen = false;
var disposables = new CompositeDisposable(source.subscribe(function (left) {
if (isOpen) {
observer.onNext(left);
}
}, observer.onError.bind(observer), function () {
if (isOpen) {
observer.onCompleted();
}
}));
var rightSubscription = new SingleAssignmentDisposable();
disposables.add(rightSubscription);
rightSubscription.setDisposable(other.subscribe(function () {
isOpen = true;
rightSubscription.dispose();
}, observer.onError.bind(observer), function () {
rightSubscription.dispose();
}));
return disposables;
});
};
/**
* Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
*
* @memberOf Observable#
* @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.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);
d.setDisposable(innerSource.subscribe(function (x) {
if (latest === id) {
observer.onNext(x);
}
}, function (e) {
if (latest === id) {
observer.onError(e);
}
}, function () {
if (latest === id) {
hasLatest = false;
if (isStopped) {
observer.onCompleted();
}
}
}));
}, observer.onError.bind(observer), function () {
isStopped = true;
if (!hasLatest) {
observer.onCompleted();
}
});
return new CompositeDisposable(subscription, innerSubscription);
});
};
/**
* Returns the values from the source observable sequence until the other observable sequence produces a value.
*
* @memberOf Observable#
* @param {Observable} other Observable sequence that terminates propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.
*/
observableProto.takeUntil = function (other) {
var source = this;
return new AnonymousObservable(function (observer) {
return new CompositeDisposable(
source.subscribe(observer),
other.subscribe(observer.onCompleted.bind(observer), observer.onError.bind(observer), noop)
);
});
};
function zipArray(second, resultSelector) {
var first = this;
return new AnonymousObservable(function (observer) {
var index = 0, len = second.length;
return first.subscribe(function (left) {
if (index < len) {
var right = second[index++], result;
try {
result = resultSelector(left, right);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
} else {
observer.onCompleted();
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
}
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.
* The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the sources.
*
* @example
* 1 - res = obs1.zip(obs2, fn);
* 1 - res = x1.zip([1,2,3], fn);
* @memberOf Observable#
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.zip = function () {
if (Array.isArray(arguments[0])) {
return zipArray.apply(this, arguments);
}
var parent = this, sources = slice.call(arguments), resultSelector = sources.pop();
sources.unshift(parent);
return new AnonymousObservable(function (observer) {
var n = sources.length,
queues = arrayInitialize(n, function () { return []; }),
isDone = arrayInitialize(n, function () { return false; });
var next = function (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(function (x) { return x; })) {
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) {
subscriptions[i] = new SingleAssignmentDisposable();
subscriptions[i].setDisposable(sources[i].subscribe(function (x) {
queues[i].push(x);
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
})(idx);
}
return new CompositeDisposable(subscriptions);
});
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
*
* @static
* @memberOf Observable
* @param {Array} sources 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 (sources, resultSelector) {
var first = sources[0],
rest = sources.slice(1);
rest.push(resultSelector);
return first.zip.apply(first, rest);
};
/**
* Hides the identity of an observable sequence.
*
* @returns {Observable} An observable sequence that hides the identity of the source sequence.
*/
observableProto.asObservable = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(observer);
});
};
/**
* Projects each element of an observable sequence into zero or more buffers which are produced based on element count information.
*
* @example
* 1 - xs.bufferWithCount(10);
* 2 - xs.bufferWithCount(10, 1);
*
* @memberOf Observable#
* @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 (skip === undefined) {
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.
*
* @memberOf Observable#
* @returns {Observable} An observable sequence exhibiting the behavior corresponding to the source sequence's notification values.
*/
observableProto.dematerialize = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
return x.accept(observer);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.
*
* 1 - var obs = observable.distinctUntilChanged();
* 2 - var obs = observable.distinctUntilChanged(function (x) { return x.id; });
* 3 - var obs = observable.distinctUntilChanged(function (x) { return x.id; }, function (x, y) { return x === y; });
*
* @memberOf Observable#
* @param {Function} [keySelector] A function to compute the comparison key for each element. If not provided, it projects the value.
* @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.
* @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
*/
observableProto.distinctUntilChanged = function (keySelector, comparer) {
var source = this;
keySelector || (keySelector = identity);
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (observer) {
var hasCurrentKey = false, currentKey;
return source.subscribe(function (value) {
var comparerEquals = false, key;
try {
key = keySelector(value);
} catch (exception) {
observer.onError(exception);
return;
}
if (hasCurrentKey) {
try {
comparerEquals = comparer(currentKey, key);
} catch (exception) {
observer.onError(exception);
return;
}
}
if (!hasCurrentKey || !comparerEquals) {
hasCurrentKey = true;
currentKey = key;
observer.onNext(value);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
*
* @example
* 1 - observable.doAction(observer);
* 2 - observable.doAction(onNext);
* 3 - observable.doAction(onNext, onError);
* 4 - observable.doAction(onNext, onError, onCompleted);
*
* @memberOf Observable#
* @param {Mixed} 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.doAction = function (observerOrOnNext, onError, onCompleted) {
var source = this, onNextFunc;
if (typeof observerOrOnNext === 'function') {
onNextFunc = observerOrOnNext;
} else {
onNextFunc = observerOrOnNext.onNext.bind(observerOrOnNext);
onError = observerOrOnNext.onError.bind(observerOrOnNext);
onCompleted = observerOrOnNext.onCompleted.bind(observerOrOnNext);
}
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
try {
onNextFunc(x);
} catch (e) {
observer.onError(e);
}
observer.onNext(x);
}, function (exception) {
if (!onError) {
observer.onError(exception);
} else {
try {
onError(exception);
} catch (e) {
observer.onError(e);
}
observer.onError(exception);
}
}, function () {
if (!onCompleted) {
observer.onCompleted();
} else {
try {
onCompleted();
} catch (e) {
observer.onError(e);
}
observer.onCompleted();
}
});
});
};
/**
* Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.
*
* @example
* 1 - obs = observable.finallyAction(function () { console.log('sequence ended'; });
*
* @memberOf Observable#
* @param {Function} finallyAction Action to invoke after the source observable sequence terminates.
* @returns {Observable} Source sequence with the action-invoking termination behavior applied.
*/
observableProto.finallyAction = function (action) {
var source = this;
return new AnonymousObservable(function (observer) {
var subscription = source.subscribe(observer);
return disposableCreate(function () {
try {
subscription.dispose();
} catch (e) {
throw e;
} finally {
action();
}
});
});
};
/**
* Ignores all elements in an observable sequence leaving only the termination messages.
*
* @memberOf Observable#
* @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence.
*/
observableProto.ignoreElements = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(noop, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Materializes the implicit notifications of an observable sequence as explicit notification values.
*
* @memberOf Observable#
* @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 (exception) {
observer.onNext(notificationCreateOnError(exception));
observer.onCompleted();
}, function () {
observer.onNext(notificationCreateOnCompleted());
observer.onCompleted();
});
});
};
/**
* Repeats the observable sequence a specified number of times. If the repeat count is not specified, the sequence repeats indefinitely.
*
* @example
* 1 - repeated = source.repeat();
* 2 - repeated = source.repeat(42);
*
* @memberOf Observable#
* @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.
*
* @example
* 1 - retried = retry.repeat();
* 2 - retried = retry.repeat(42);
*
* @memberOf Observable#
* @param {Number} [retryCount] Number of times to retry the sequence. If not provided, retry the sequence indefinitely.
* @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
*/
observableProto.retry = function (retryCount) {
return enumerableRepeat(this, retryCount).catchException();
};
/**
* Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value.
* For aggregation behavior with no intermediate results, see Observable.aggregate.
*
* 1 - scanned = source.scan(function (acc, x) { return acc + x; });
* 2 - scanned = source.scan(0, function (acc, x) { return acc + x; });
*
* @memberOf Observable#
* @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 seed, hasSeed = false, accumulator;
if (arguments.length === 2) {
seed = arguments[0];
accumulator = arguments[1];
hasSeed = true;
} else {
accumulator = arguments[0];
}
var source = this;
return observableDefer(function () {
var hasAccumulation = false, accumulation;
return source.select(function (x) {
if (hasAccumulation) {
accumulation = accumulator(accumulation, x);
} else {
accumulation = hasSeed ? accumulator(seed, x) : x;
hasAccumulation = true;
}
return accumulation;
});
});
};
/**
* Bypasses a specified number of elements at the end of an observable sequence.
*
* @memberOf Observable#
* @description
* This operator accumulates a queue with a length enough to store the first <paramref name="count"/> elements. As more elements are
* received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed.
* @param count Number of elements to bypass at the end of the source sequence.
* @returns {Observable} An observable sequence containing the source sequence elements except for the bypassed ones at the end.
*/
observableProto.skipLast = function (count) {
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
if (q.length > count) {
observer.onNext(q.shift());
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Prepends a sequence of values to an observable sequence with an optional scheduler and an argument list of values to prepend.
*
* 1 - source.startWith(1, 2, 3);
* 2 - source.startWith(Rx.Scheduler.timeout, 1, 2, 3);
*
* @memberOf Observable#
* @returns {Observable} The source sequence prepended with the specified values.
*/
observableProto.startWith = function () {
var values, scheduler, start = 0;
if (arguments.length > 0 && arguments[0] != null && arguments[0].now !== undefined) {
scheduler = arguments[0];
start = 1;
} else {
scheduler = immediateScheduler;
}
values = slice.call(arguments, start);
return enumerableFor([observableFromArray(values, scheduler), this]).concat();
};
/**
* Returns a specified number of contiguous elements from the end of an observable sequence, using an optional scheduler to drain the queue.
*
* @example
* 1 - obs = source.takeLast(5);
* 2 - obs = source.takeLast(5, Rx.Scheduler.timeout);
*
* @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.
*
* @memberOf Observable#
* @param {Number} count Number of elements to take from the end of the source sequence.
* @param {Scheduler} [scheduler] Scheduler used to drain the queue upon completion 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, scheduler) {
return this.takeLastBuffer(count).selectMany(function (xs) { return observableFromArray(xs, scheduler); });
};
/**
* 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.
*
* @memberOf Observable#
* @param {Number} count Number of elements to take from the end of the source sequence.
* @returns {Observable} An observable sequence containing a single array with the specified number of elements from the end of the source sequence.
*/
observableProto.takeLastBuffer = function (count) {
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
if (q.length > count) {
q.shift();
}
}, observer.onError.bind(observer), function () {
observer.onNext(q);
observer.onCompleted();
});
});
};
/**
* Projects each element of an observable sequence into zero or more windows which are produced based on element count information.
*
* 1 - xs.windowWithCount(10);
* 2 - xs.windowWithCount(10, 1);
*
* @memberOf Observable#
* @param {Number} count Length of each window.
* @param {Number} [skip] Number of elements to skip between creation of consecutive windows. If not specified, defaults to the count.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.windowWithCount = function (count, skip) {
var source = this;
if (count <= 0) {
throw new Error(argumentOutOfRange);
}
if (skip == null) {
skip = count;
}
if (skip <= 0) {
throw new Error(argumentOutOfRange);
}
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(),
refCountDisposable = new RefCountDisposable(m),
n = 0,
q = [],
createWindow = function () {
var s = new Subject();
q.push(s);
observer.onNext(addRef(s, refCountDisposable));
};
createWindow();
m.setDisposable(source.subscribe(function (x) {
var s;
for (var i = 0, len = q.length; i < len; i++) {
q[i].onNext(x);
}
var c = n - count + 1;
if (c >= 0 && c % skip === 0) {
s = q.shift();
s.onCompleted();
}
n++;
if (n % skip === 0) {
createWindow();
}
}, function (exception) {
while (q.length > 0) {
q.shift().onError(exception);
}
observer.onError(exception);
}, function () {
while (q.length > 0) {
q.shift().onCompleted();
}
observer.onCompleted();
}));
return refCountDisposable;
});
};
/**
* Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty.
*
* 1 - obs = xs.defaultIfEmpty();
* 2 - obs = xs.defaultIfEmpty(false);
*
* @memberOf Observable#
* @param defaultValue The value to return if the sequence is empty. If not provided, this defaults to null.
* @returns {Observable} An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself.
*/
observableProto.defaultIfEmpty = function (defaultValue) {
var source = this;
if (defaultValue === undefined) {
defaultValue = null;
}
return new AnonymousObservable(function (observer) {
var found = false;
return source.subscribe(function (x) {
found = true;
observer.onNext(x);
}, observer.onError.bind(observer), function () {
if (!found) {
observer.onNext(defaultValue);
}
observer.onCompleted();
});
});
};
/**
* 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
* 1 - obs = xs.distinct();
* 2 - obs = xs.distinct(function (x) { return x.id; });
* 2 - obs = xs.distinct(function (x) { return x.id; }, function (x) { return x.toString(); });
*
* @memberOf Observable#
* @param {Function} [keySelector] A function to compute the comparison key for each element.
* @param {Function} [keySerializer] Used to serialize the given object into a string for object comparison.
* @returns {Observable} An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.
*/
observableProto.distinct = function (keySelector, keySerializer) {
var source = this;
keySelector || (keySelector = identity);
keySerializer || (keySerializer = defaultKeySerializer);
return new AnonymousObservable(function (observer) {
var hashSet = {};
return source.subscribe(function (x) {
var key, serializedKey, otherKey, hasMatch = false;
try {
key = keySelector(x);
serializedKey = keySerializer(key);
} catch (exception) {
observer.onError(exception);
return;
}
for (otherKey in hashSet) {
if (serializedKey === otherKey) {
hasMatch = true;
break;
}
}
if (!hasMatch) {
hashSet[serializedKey] = null;
observer.onNext(x);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* 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
* 1 - 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(); });
*
* @memberOf Observable#
* @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} [keySerializer] Used to serialize the given object into a string for object comparison.
* @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, keySerializer) {
return this.groupByUntil(keySelector, elementSelector, function () {
return observableNever();
}, keySerializer);
};
/**
* 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
* 1 - 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(); });
*
* @memberOf Observable#
* @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} [keySerializer] Used to serialize the given object into a string for object comparison.
* @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, keySerializer) {
var source = this;
elementSelector || (elementSelector = identity);
keySerializer || (keySerializer = defaultKeySerializer);
return new AnonymousObservable(function (observer) {
var map = {},
groupDisposable = new CompositeDisposable(),
refCountDisposable = new RefCountDisposable(groupDisposable);
groupDisposable.add(source.subscribe(function (x) {
var duration, durationGroup, element, expire, fireNewMapEntry, group, key, serializedKey, md, writer, w;
try {
key = keySelector(x);
serializedKey = keySerializer(key);
} catch (e) {
for (w in map) {
map[w].onError(e);
}
observer.onError(e);
return;
}
fireNewMapEntry = false;
try {
writer = map[serializedKey];
if (!writer) {
writer = new Subject();
map[serializedKey] = writer;
fireNewMapEntry = true;
}
} catch (e) {
for (w in map) {
map[w].onError(e);
}
observer.onError(e);
return;
}
if (fireNewMapEntry) {
group = new GroupedObservable(key, writer, refCountDisposable);
durationGroup = new GroupedObservable(key, writer);
try {
duration = durationSelector(durationGroup);
} catch (e) {
for (w in map) {
map[w].onError(e);
}
observer.onError(e);
return;
}
observer.onNext(group);
md = new SingleAssignmentDisposable();
groupDisposable.add(md);
expire = function () {
if (serializedKey in map) {
delete map[serializedKey];
writer.onCompleted();
}
groupDisposable.remove(md);
};
md.setDisposable(duration.take(1).subscribe(noop, function (exn) {
for (w in map) {
map[w].onError(exn);
}
observer.onError(exn);
}, function () {
expire();
}));
}
try {
element = elementSelector(x);
} catch (e) {
for (w in map) {
map[w].onError(e);
}
observer.onError(e);
return;
}
writer.onNext(element);
}, function (ex) {
for (var w in map) {
map[w].onError(ex);
}
observer.onError(ex);
}, function () {
for (var w in map) {
map[w].onCompleted();
}
observer.onCompleted();
}));
return refCountDisposable;
});
};
/**
* Projects each element of an observable sequence into a new form by incorporating the element's index.
*
* @example
* source.select(function (value, index) { return value * value + index; });
*
* @memberOf Observable#
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source.
*/
observableProto.select = function (selector, thisArg) {
var parent = this;
return new AnonymousObservable(function (observer) {
var count = 0;
return parent.subscribe(function (value) {
var result;
try {
result = selector.call(thisArg, value, count++, parent);
} catch (exception) {
observer.onError(exception);
return;
}
observer.onNext(result);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
observableProto.map = observableProto.select;
function selectMany(selector) {
return this.select(selector).mergeObservable();
}
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* 1 - 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.
*
* 1 - 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.
*
* 1 - source.selectMany(Rx.Observable.fromArray([1,2,3]));
*
* @memberOf Observable#
* @param selector A transform function to apply to each element or an observable sequence to project each element from the source sequence onto.
* @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.selectMany = observableProto.flatMap = function (selector, resultSelector) {
if (resultSelector) {
return this.selectMany(function (x) {
return selector(x).select(function (y) {
return resultSelector(x, y);
});
});
}
if (typeof selector === 'function') {
return selectMany.call(this, selector);
}
return selectMany.call(this, function () {
return selector;
});
};
/**
* Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.
*
* @memberOf Observable#
* @param {Number} count The number of elements to skip before returning the remaining elements.
* @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence.
*/
observableProto.skip = function (count) {
if (count < 0) {
throw new Error(argumentOutOfRange);
}
var observable = this;
return new AnonymousObservable(function (observer) {
var remaining = count;
return observable.subscribe(function (x) {
if (remaining <= 0) {
observer.onNext(x);
} else {
remaining--;
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
* The element's index is used in the logic of the predicate function.
*
* 1 - source.skipWhile(function (value) { return value < 10; });
* 1 - source.skipWhile(function (value, index) { return value < 10 || index < 10; });
*
* @memberOf Observable#
* @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.
* @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) {
var source = this;
return new AnonymousObservable(function (observer) {
var i = 0, running = false;
return source.subscribe(function (x) {
if (!running) {
try {
running = !predicate(x, i++);
} catch (e) {
observer.onError(e);
return;
}
}
if (running) {
observer.onNext(x);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of take(0).
*
* 1 - source.take(5);
* 2 - source.take(0, Rx.Scheduler.timeout);
*
* @memberOf Observable#
* @param {Number} count The number of elements to return.
* @param {Scheduler} [scheduler] Scheduler used to produce an OnCompleted message in case <paramref name="count count</paramref> is set to 0.
* @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence.
*/
observableProto.take = function (count, scheduler) {
if (count < 0) {
throw new Error(argumentOutOfRange);
}
if (count === 0) {
return observableEmpty(scheduler);
}
var observable = this;
return new AnonymousObservable(function (observer) {
var remaining = count;
return observable.subscribe(function (x) {
if (remaining > 0) {
remaining--;
observer.onNext(x);
if (remaining === 0) {
observer.onCompleted();
}
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns elements from an observable sequence as long as a specified condition is true.
* The element's index is used in the logic of the predicate function.
*
* @example
* 1 - source.takeWhile(function (value) { return value < 10; });
* 1 - source.takeWhile(function (value, index) { return value < 10 || index < 10; });
*
* @memberOf Observable#
* @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.
* @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) {
var observable = this;
return new AnonymousObservable(function (observer) {
var i = 0, running = true;
return observable.subscribe(function (x) {
if (running) {
try {
running = predicate(x, i++);
} catch (e) {
observer.onError(e);
return;
}
if (running) {
observer.onNext(x);
} else {
observer.onCompleted();
}
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Filters the elements of an observable sequence based on a predicate by incorporating the element's index.
*
* @example
* 1 - source.where(function (value) { return value < 10; });
* 1 - source.where(function (value, index) { return value < 10 || index < 10; });
*
* @memberOf Observable#
* @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains elements from the input sequence that satisfy the condition.
*/
observableProto.where = function (predicate, thisArg) {
var parent = this;
return new AnonymousObservable(function (observer) {
var count = 0;
return parent.subscribe(function (value) {
var shouldRun;
try {
shouldRun = predicate.call(thisArg, value, count++, parent);
} catch (exception) {
observer.onError(exception);
return;
}
if (shouldRun) {
observer.onNext(value);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
observableProto.filter = observableProto.where;
/** @private */
var AnonymousObservable = Rx.Internals.AnonymousObservable = (function (_super) {
inherits(AnonymousObservable, _super);
/**
* @private
* @constructor
*/
function AnonymousObservable(subscribe) {
function s(observer) {
var autoDetachObserver = new AutoDetachObserver(observer);
if (currentThreadScheduler.scheduleRequired()) {
currentThreadScheduler.schedule(function () {
try {
autoDetachObserver.disposable(subscribe(autoDetachObserver));
} catch (e) {
if (!autoDetachObserver.fail(e)) {
throw e;
}
}
});
} else {
try {
autoDetachObserver.disposable(subscribe(autoDetachObserver));
} catch (e) {
if (!autoDetachObserver.fail(e)) {
throw e;
}
}
}
return autoDetachObserver;
}
_super.call(this, s);
}
return AnonymousObservable;
}(Observable));
/** @private */
var AutoDetachObserver = (function (_super) {
inherits(AutoDetachObserver, _super);
/**
* @private
* @constructor
*/
function AutoDetachObserver(observer) {
_super.call(this);
this.observer = observer;
this.m = new SingleAssignmentDisposable();
}
var AutoDetachObserverPrototype = AutoDetachObserver.prototype
/**
* @private
* @memberOf AutoDetachObserver#
*/
AutoDetachObserverPrototype.next = function (value) {
var noError = false;
try {
this.observer.onNext(value);
noError = true;
} catch (e) {
throw e;
} finally {
if (!noError) {
this.dispose();
}
}
};
/**
* @private
* @memberOf AutoDetachObserver#
*/
AutoDetachObserverPrototype.error = function (exn) {
try {
this.observer.onError(exn);
} catch (e) {
throw e;
} finally {
this.dispose();
}
};
/**
* @private
* @memberOf AutoDetachObserver#
*/
AutoDetachObserverPrototype.completed = function () {
try {
this.observer.onCompleted();
} catch (e) {
throw e;
} finally {
this.dispose();
}
};
/**
* @private
* @memberOf AutoDetachObserver#
*/
AutoDetachObserverPrototype.disposable = function (value) {
return this.m.disposable(value);
};
/**
* @private
* @memberOf AutoDetachObserver#
*/
AutoDetachObserverPrototype.dispose = function () {
_super.prototype.dispose.call(this);
this.m.dispose();
};
return AutoDetachObserver;
}(AbstractObserver));
/** @private */
var GroupedObservable = (function (_super) {
inherits(GroupedObservable, _super);
function subscribe(observer) {
return this.underlyingObservable.subscribe(observer);
}
/**
* @constructor
* @private
*/
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));
/** @private */
var InnerSubscription = function (subject, observer) {
this.subject = subject;
this.observer = observer;
};
/**
* @private
* @memberOf InnerSubscription
*/
InnerSubscription.prototype.dispose = function () {
if (!this.subject.isDisposed && this.observer !== null) {
var idx = this.subject.observers.indexOf(this.observer);
this.subject.observers.splice(idx, 1);
this.observer = null;
}
};
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed observers.
*/
var Subject = Rx.Subject = (function (_super) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
if (this.exception) {
observer.onError(this.exception);
return disposableEmpty;
}
observer.onCompleted();
return disposableEmpty;
}
inherits(Subject, _super);
/**
* Creates a subject.
*
* @constructor
*/
function Subject() {
_super.call(this, subscribe);
this.isDisposed = false,
this.isStopped = false,
this.observers = [];
}
addProperties(Subject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
*
* @memberOf ReplaySubject#
* @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.
*
* @memberOf ReplaySubject#
*/
onCompleted: function () {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the exception.
*
* @memberOf ReplaySubject#
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (exception) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
this.exception = exception;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onError(exception);
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
*
* @memberOf ReplaySubject#
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
for (var i = 0, len = os.length; i < len; i++) {
os[i].onNext(value);
}
}
},
/**
* Unsubscribe all observers and release resources.
*
* @memberOf ReplaySubject#
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
/**
* Creates a subject from the specified observer and observable.
*
* @static
* @memberOf Subject
* @param {Observer} observer The observer used to send messages to the subject.
* @param {Observable} observable The observable used to subscribe to messages sent from the subject.
* @returns {Subject} Subject implemented using the given observer and observable.
*/
Subject.create = function (observer, observable) {
return new AnonymousSubject(observer, observable);
};
return Subject;
}(Observable));
/**
* Represents the result of an asynchronous operation.
* The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers.
*/
var AsyncSubject = Rx.AsyncSubject = (function (_super) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
var ex = this.exception;
var hv = this.hasValue;
var v = this.value;
if (ex) {
observer.onError(ex);
} else if (hv) {
observer.onNext(v);
observer.onCompleted();
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(AsyncSubject, _super);
/**
* Creates a subject that can only receive one value and that value is cached for all future observations.
*
* @constructor
*/
function AsyncSubject() {
_super.call(this, subscribe);
this.isDisposed = false,
this.isStopped = false,
this.value = null,
this.hasValue = false,
this.observers = [],
this.exception = null;
}
addProperties(AsyncSubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
*
* @memberOf AsyncSubject#
* @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, also causing the last received value to be sent out (if any).
*
* @memberOf AsyncSubject#
*/
onCompleted: function () {
var o, i, len;
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
var v = this.value;
var hv = this.hasValue;
if (hv) {
for (i = 0, len = os.length; i < len; i++) {
o = os[i];
o.onNext(v);
o.onCompleted();
}
} else {
for (i = 0, len = os.length; i < len; i++) {
os[i].onCompleted();
}
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the exception.
*
* @memberOf AsyncSubject#
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (exception) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
this.exception = exception;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onError(exception);
}
this.observers = [];
}
},
/**
* Sends a value to the subject. The last value received before successful termination will be sent to all subscribed and future observers.
*
* @memberOf AsyncSubject#
* @param {Mixed} value The value to store in the subject.
*/
onNext: function (value) {
checkDisposed.call(this);
if (!this.isStopped) {
this.value = value;
this.hasValue = true;
}
},
/**
* Unsubscribe all observers and release resources.
*
* @memberOf AsyncSubject#
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
this.exception = null;
this.value = null;
}
});
return AsyncSubject;
}(Observable));
/** @private */
var AnonymousSubject = (function (_super) {
inherits(AnonymousSubject, _super);
function subscribe(observer) {
return this.observable.subscribe(observer);
}
/**
* @private
* @constructor
*/
function AnonymousSubject(observer, observable) {
_super.call(this, subscribe);
this.observer = observer;
this.observable = observable;
}
addProperties(AnonymousSubject.prototype, Observer, {
/**
* @private
* @memberOf AnonymousSubject#
*/
onCompleted: function () {
this.observer.onCompleted();
},
/**
* @private
* @memberOf AnonymousSubject#
*/
onError: function (exception) {
this.observer.onError(exception);
},
/**
* @private
* @memberOf AnonymousSubject#
*/
onNext: function (value) {
this.observer.onNext(value);
}
});
return AnonymousSubject;
}(Observable));
// Check for AMD
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
window.Rx = Rx;
return define(function () {
return Rx;
});
} else if (freeExports) {
if (typeof module == 'object' && module && module.exports == freeExports) {
module.exports = Rx;
} else {
freeExports = Rx;
}
} else {
window.Rx = Rx;
}
}(this));
|
src/__tests__/smart-app-banner-spec.js
|
react-smart-app-banner/react-smart-app-banner
|
jest.disableAutomock()
import React from 'react'
import ReactDOM from 'react-dom'
import { renderToString } from 'react-dom/server'
import { configure, mount } from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
configure({ adapter: new Adapter() })
import CloseButton from '../close-button'
import ReactSmartAppBanner from '../smart-app-banner'
describe('ReactSmartAppBanner', () => {
var component
const __origNav = window.navigator
const __origLocalStorage = window.localStorage
function setUserAgent(userAgent) {
Object.defineProperty(window.navigator, 'userAgent', {
writable: true,
value: userAgent
})
}
function resetUserAgent() {
window.navigator = __origNav
}
function renderComponent(props) {
return mount(
<ReactSmartAppBanner {...props} />
)
}
function serverRenderComponent(props) {
return renderToString(
<ReactSmartAppBanner {...props} />
)
}
it('renders', () => {
component = renderComponent()
expect(component).not.toBeFalsy()
})
describe('when using a Nexus 5 on Chrome', () => {
beforeEach(() => {
setUserAgent('Mozilla/5.0 (Linux; Android 4.4.4; Nexus 5 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.114 Mobile Safari/537.36')
component = renderComponent()
})
afterEach(() => {
resetUserAgent()
})
it('renders', () => { expect(component).not.toBeFalsy() })
it('is android', () => { expect(component.state().os).toBe('android')})
it('is not hidden', () => { expect(component.state().hide).toBe(false) })
})
describe('when using a Nokia Lumia 520 on IEMobile', () => {
beforeEach(() => {
setUserAgent('Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)')
component = renderComponent()
})
afterEach(() => {
resetUserAgent()
})
it('renders', () => { expect(component).not.toBeFalsy() })
it('is windows', () => { expect(component.state().os).toBe('windows') })
it('is not hidden', () => { expect(component.state().hide).toBe(false) })
})
describe('when using an iPhone 4 on Safari for iOS 4.2.1', () => {
beforeEach(() => {
setUserAgent('Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5')
component = renderComponent()
})
afterEach(() => {
resetUserAgent()
})
it('renders', () => { expect(component).not.toBeFalsy() })
it('is ios', () => { expect(component.state().os).toBe('ios') })
it('is not hidden', () => { expect(component.state().hide).toBe(false) })
})
describe('when using an iPhone 5 on Chrome for iOS 7.0', () => {
beforeEach(() => {
setUserAgent('Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X; en-us) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3')
component = renderComponent()
})
afterEach(() => {
resetUserAgent()
})
it('renders', () => { expect(component).not.toBeFalsy() })
it('is ios', () => { expect(component.state().os).toBe('ios') })
it('is not hidden', () => { expect(component.state().hide).toBe(false) })
})
describe('when using an iPhone 5 on Safari for iOS 7.0', () => {
beforeEach(() => {
setUserAgent('Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X; en-us) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53')
component = renderComponent()
})
afterEach(() => {
resetUserAgent()
})
it('renders', () => { expect(component).not.toBeFalsy() })
it('is ios', () => { expect(component.state().os).toBe('ios') })
it('is hidden', () => { expect(component.state().hide).toBe(true) })
describe('but overwritting OS with android', () => {
beforeEach(() => {
component = renderComponent({ os: 'android' })
})
it('renders', () => { expect(component).not.toBeFalsy() })
it('is android', () => { expect(component.state().os).toBe('android') })
it('is not hidden', () => { expect(component.state().hide).toBe(false) })
})
})
describe('when close clicked', () => {
var node
beforeEach(() => {
setUserAgent('Mozilla/5.0 (Linux; Android 4.4.4; Nexus 5 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.114 Mobile Safari/537.36')
})
afterEach(() => {
resetUserAgent()
})
it('uses close function on CloseButton click', () => {
component = renderComponent()
const closeButton = component.find(CloseButton)
expect(component.instance().close).toEqual(closeButton.prop('onClick'))
})
it('sets the hide state', () => {
component = renderComponent()
component.instance().close()
expect(component.state().hide).toBe(true)
})
it('calls onClose callback', () => {
const onClose = jest.fn()
component = renderComponent({ onClose })
component.instance().close()
expect(onClose).toBeCalled()
})
describe('6 days ago', () => {
beforeEach(() => {
window['date'] = Date.now() - 86400000 * 6
window['localStorage'] = {
setItem: () => {},
getItem: () => { return window['date'] },
removeItem: () => { window['date'] = undefined },
}
component = renderComponent()
})
afterEach(() => {
window['localStorage'] = __origLocalStorage
})
it('sets the hide state', () => { expect(component.state().hide).toBe(true) })
})
describe('8 days ago', () => {
beforeEach(() => {
window['date'] = Date.now() - 86400000 * 8
window['localStorage'] = {
setItem: () => {},
getItem: () => { return window['date'] },
removeItem: () => { window['date'] = undefined },
}
component = renderComponent()
})
afterEach(() => {
window['localStorage'] = __origLocalStorage
})
it('sets the hide state', () => {
expect(component.state().hide).toBe(false)
})
})
})
describe('when attributes are overwitten', () => {
it('renders', () => {
component = renderComponent({
icon: {
style: {
android: { backgroundImage: 'url(data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)' },
windows: { backgroundImage: 'url(data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)' },
ios: { backgroundImage: 'url(data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)' },
},
},
header: {
title: 'Facebook',
subtitle: {
android: 'Free - In Google Play',
windows: 'Free - In Windows Store',
ios: 'Free - On the App Store',
},
},
viewButton: {
attributes: {
android: { href: 'https://play.google.com/store/apps/details?id=com.facebook.katana' },
ios: { href: 'https://itunes.apple.com/US/app/id284882215' },
windows: { href: 'http://www.windowsphone.com/s?appid=82a23635-5bd9-df11-a844-00237de2db9e' }
},
text: 'Open',
onClick: () => {}
},
})
expect(component).not.toBeFalsy()
})
})
describe('when allowedOs is only ["android", "ios"]', () => {
describe('and a Nokia Lumia 520 on IEMobile is used', () => {
beforeEach(() => {
setUserAgent('Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)')
component = renderComponent({allowedOs: ['android', 'ios']})
})
afterEach(() => {
resetUserAgent()
})
it('renders', () => { expect(component).not.toBeFalsy() })
it('is windows', () => { expect(component.state().os).toBe('windows') })
it('is hidden', () => { expect(component.state().hide).toBe(true) })
})
})
describe('#componentDidMount', () => {
let onUpdateSpy
beforeEach(() => {
onUpdateSpy = jasmine.createSpy('onUpdate')
component = renderComponent()
component.setProps({ onUpdate: onUpdateSpy })
})
it('calls onUpdate callback', () => {
expect(onUpdateSpy).toHaveBeenCalledWith(component.state())
})
})
})
|
client-portal/src/components/Body/Table/ReactBootstrapTable/index.js
|
choiboi/web-scraper-architecture
|
import React, { Component } from 'react';
import classnames from 'classnames';
import './react_boottable.css';
import { Table, Button } from 'react-bootstrap';
const tableData = [
{
name: 'John Smith',
status: 'Employed',
},
{
name: 'Randal White',
status: 'Unemployed',
},
{
name: 'Stephanie Sanders',
status: 'Employed',
},
{
name: 'Steve Brown',
status: 'Employed',
},
{
name: 'Joyce Whitten',
status: 'Employed',
},
{
name: 'Samuel Roberts',
status: 'Employed',
},
{
name: 'Adam Moore',
status: 'Employed',
},
];
class ReactBootstrapTable extends Component {
render() {
const { className, ...props } = this.props;
return (
<div className={classnames('boot-table', className)} {...props}>
<div className="table-title">
<p>{this.props.title}</p>
<Button bsStyle="info" className="boot-button">REFRESH</Button>
</div>
<Table striped bordered condensed hover>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Employement Status</th>
</tr>
</thead>
<tbody>
{
tableData.map((row, index) => (
<tr key={index + 1}>
<td>{index + 1}</td>
<td>{row.name}</td>
<td>{row.status}</td>
</tr>
))
}
</tbody>
</Table>
</div>
);
}
}
export default ReactBootstrapTable;
|
src/svg-icons/device/battery-20.js
|
skarnecki/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let DeviceBattery20 = (props) => (
<SvgIcon {...props}>
<path d="M7 17v3.67C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V17H7z"/><path fillOpacity=".3" d="M17 5.33C17 4.6 16.4 4 15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33V17h10V5.33z"/>
</SvgIcon>
);
DeviceBattery20 = pure(DeviceBattery20);
DeviceBattery20.displayName = 'DeviceBattery20';
export default DeviceBattery20;
|
src/components/Layout/index.js
|
marcneander/marcneander.se
|
import React from 'react';
import styled from 'styled-components';
import { Helmet } from 'react-helmet';
import Header from '../Header';
import GlobalStyle from '../GlobalStyle';
import '../../font.css';
const Banner = styled.div`
width: 100%;
height: 8px;
background: #424250;
`;
const Layout = (props) => {
const { children } = props;
return (
<React.Fragment>
<GlobalStyle />
<Helmet defaultTitle="Marc Neander - Javascript/Front-end engineer" titleTemplate="%s - marcneander.com">
<html lang="en" />
<meta
name="description"
content="Freelancing Javascript/Front-end engineer based in Stockholm. I make sure applications are accessible, performant, SEO optimized and user friendly."
/>
{/* Favicon stuff */}
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="manifest" href="/site.webmanifest" />
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#33343d" />
<meta name="msapplication-TileColor" content="#ffffff" />
<meta name="theme-color" content="#ffffff" />
{/* Open graph */}
<meta
property="og:description"
content="Freelancing Javascript/Front-end engineer based in Stockholm. I have been improving the web since 2006.
I make sure applications are accessible, performant, SEO optimized and user friendly."
/>
<meta property="og:title" content="Marc Neander - Front-end/Javascript engineer" />
<meta property="og:url" content="https://marcneander.io" />
</Helmet>
<Banner />
<Header />
{children}
</React.Fragment>
);
};
export default Layout;
|
ajax/libs/core-js/1.2.5/shim.js
|
kennynaoh/cdnjs
|
/**
* core-js 1.2.5
* https://github.com/zloirock/core-js
* License: http://rock.mit-license.org
* © 2015 Denis Pushkarev
*/
!function(__e, __g, undefined){
'use strict';
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(1);
__webpack_require__(34);
__webpack_require__(40);
__webpack_require__(42);
__webpack_require__(44);
__webpack_require__(46);
__webpack_require__(48);
__webpack_require__(50);
__webpack_require__(51);
__webpack_require__(52);
__webpack_require__(53);
__webpack_require__(54);
__webpack_require__(55);
__webpack_require__(56);
__webpack_require__(57);
__webpack_require__(58);
__webpack_require__(59);
__webpack_require__(60);
__webpack_require__(61);
__webpack_require__(64);
__webpack_require__(65);
__webpack_require__(66);
__webpack_require__(68);
__webpack_require__(69);
__webpack_require__(70);
__webpack_require__(71);
__webpack_require__(72);
__webpack_require__(73);
__webpack_require__(74);
__webpack_require__(76);
__webpack_require__(77);
__webpack_require__(78);
__webpack_require__(80);
__webpack_require__(81);
__webpack_require__(82);
__webpack_require__(84);
__webpack_require__(85);
__webpack_require__(86);
__webpack_require__(87);
__webpack_require__(88);
__webpack_require__(89);
__webpack_require__(90);
__webpack_require__(91);
__webpack_require__(92);
__webpack_require__(93);
__webpack_require__(94);
__webpack_require__(95);
__webpack_require__(96);
__webpack_require__(97);
__webpack_require__(99);
__webpack_require__(103);
__webpack_require__(104);
__webpack_require__(106);
__webpack_require__(107);
__webpack_require__(111);
__webpack_require__(116);
__webpack_require__(117);
__webpack_require__(120);
__webpack_require__(122);
__webpack_require__(124);
__webpack_require__(126);
__webpack_require__(127);
__webpack_require__(128);
__webpack_require__(130);
__webpack_require__(131);
__webpack_require__(133);
__webpack_require__(134);
__webpack_require__(135);
__webpack_require__(136);
__webpack_require__(143);
__webpack_require__(146);
__webpack_require__(147);
__webpack_require__(149);
__webpack_require__(150);
__webpack_require__(151);
__webpack_require__(152);
__webpack_require__(153);
__webpack_require__(154);
__webpack_require__(155);
__webpack_require__(156);
__webpack_require__(157);
__webpack_require__(158);
__webpack_require__(159);
__webpack_require__(160);
__webpack_require__(162);
__webpack_require__(163);
__webpack_require__(164);
__webpack_require__(165);
__webpack_require__(166);
__webpack_require__(167);
__webpack_require__(169);
__webpack_require__(170);
__webpack_require__(171);
__webpack_require__(172);
__webpack_require__(174);
__webpack_require__(175);
__webpack_require__(177);
__webpack_require__(178);
__webpack_require__(180);
__webpack_require__(181);
__webpack_require__(182);
__webpack_require__(183);
module.exports = __webpack_require__(186);
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(2)
, DESCRIPTORS = __webpack_require__(3)
, createDesc = __webpack_require__(5)
, html = __webpack_require__(6)
, cel = __webpack_require__(8)
, has = __webpack_require__(10)
, cof = __webpack_require__(11)
, $def = __webpack_require__(12)
, invoke = __webpack_require__(17)
, arrayMethod = __webpack_require__(18)
, IE_PROTO = __webpack_require__(16)('__proto__')
, isObject = __webpack_require__(9)
, anObject = __webpack_require__(30)
, aFunction = __webpack_require__(20)
, toObject = __webpack_require__(22)
, toIObject = __webpack_require__(31)
, toInteger = __webpack_require__(25)
, toIndex = __webpack_require__(32)
, toLength = __webpack_require__(24)
, IObject = __webpack_require__(21)
, fails = __webpack_require__(4)
, ObjectProto = Object.prototype
, A = []
, _slice = A.slice
, _join = A.join
, defineProperty = $.setDesc
, getOwnDescriptor = $.getDesc
, defineProperties = $.setDescs
, $indexOf = __webpack_require__(33)(false)
, factories = {}
, IE8_DOM_DEFINE;
if(!DESCRIPTORS){
IE8_DOM_DEFINE = !fails(function(){
return defineProperty(cel('div'), 'a', {get: function(){ return 7; }}).a != 7;
});
$.setDesc = function(O, P, Attributes){
if(IE8_DOM_DEFINE)try {
return defineProperty(O, P, Attributes);
} catch(e){ /* empty */ }
if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
if('value' in Attributes)anObject(O)[P] = Attributes.value;
return O;
};
$.getDesc = function(O, P){
if(IE8_DOM_DEFINE)try {
return getOwnDescriptor(O, P);
} catch(e){ /* empty */ }
if(has(O, P))return createDesc(!ObjectProto.propertyIsEnumerable.call(O, P), O[P]);
};
$.setDescs = defineProperties = function(O, Properties){
anObject(O);
var keys = $.getKeys(Properties)
, length = keys.length
, i = 0
, P;
while(length > i)$.setDesc(O, P = keys[i++], Properties[P]);
return O;
};
}
$def($def.S + $def.F * !DESCRIPTORS, 'Object', {
// 19.1.2.6 / 15.2.3.3 Object.getOwnPropertyDescriptor(O, P)
getOwnPropertyDescriptor: $.getDesc,
// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
defineProperty: $.setDesc,
// 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties)
defineProperties: defineProperties
});
// IE 8- don't enum bug keys
var keys1 = ('constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,' +
'toLocaleString,toString,valueOf').split(',')
// Additional keys for getOwnPropertyNames
, keys2 = keys1.concat('length', 'prototype')
, keysLen1 = keys1.length;
// Create object with `null` prototype: use iframe Object with cleared prototype
var createDict = function(){
// Thrash, waste and sodomy: IE GC bug
var iframe = cel('iframe')
, i = keysLen1
, gt = '>'
, iframeDocument;
iframe.style.display = 'none';
html.appendChild(iframe);
iframe.src = 'javascript:'; // eslint-disable-line no-script-url
// createDict = iframe.contentWindow.Object;
// html.removeChild(iframe);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write('<script>document.F=Object</script' + gt);
iframeDocument.close();
createDict = iframeDocument.F;
while(i--)delete createDict.prototype[keys1[i]];
return createDict();
};
var createGetKeys = function(names, length){
return function(object){
var O = toIObject(object)
, i = 0
, result = []
, key;
for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);
// Don't enum bug & hidden keys
while(length > i)if(has(O, key = names[i++])){
~$indexOf(result, key) || result.push(key);
}
return result;
};
};
var Empty = function(){};
$def($def.S, 'Object', {
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
getPrototypeOf: $.getProto = $.getProto || function(O){
O = toObject(O);
if(has(O, IE_PROTO))return O[IE_PROTO];
if(typeof O.constructor == 'function' && O instanceof O.constructor){
return O.constructor.prototype;
} return O instanceof Object ? ObjectProto : null;
},
// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
getOwnPropertyNames: $.getNames = $.getNames || createGetKeys(keys2, keys2.length, true),
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
create: $.create = $.create || function(O, /*?*/Properties){
var result;
if(O !== null){
Empty.prototype = anObject(O);
result = new Empty();
Empty.prototype = null;
// add "__proto__" for Object.getPrototypeOf shim
result[IE_PROTO] = O;
} else result = createDict();
return Properties === undefined ? result : defineProperties(result, Properties);
},
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
keys: $.getKeys = $.getKeys || createGetKeys(keys1, keysLen1, false)
});
var construct = function(F, len, args){
if(!(len in factories)){
for(var n = [], i = 0; i < len; i++)n[i] = 'a[' + i + ']';
factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')');
}
return factories[len](F, args);
};
// 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...)
$def($def.P, 'Function', {
bind: function bind(that /*, args... */){
var fn = aFunction(this)
, partArgs = _slice.call(arguments, 1);
var bound = function(/* args... */){
var args = partArgs.concat(_slice.call(arguments));
return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that);
};
if(isObject(fn.prototype))bound.prototype = fn.prototype;
return bound;
}
});
// fallback for not array-like ES3 strings and DOM objects
var buggySlice = fails(function(){
if(html)_slice.call(html);
});
$def($def.P + $def.F * buggySlice, 'Array', {
slice: function(begin, end){
var len = toLength(this.length)
, klass = cof(this);
end = end === undefined ? len : end;
if(klass == 'Array')return _slice.call(this, begin, end);
var start = toIndex(begin, len)
, upTo = toIndex(end, len)
, size = toLength(upTo - start)
, cloned = Array(size)
, i = 0;
for(; i < size; i++)cloned[i] = klass == 'String'
? this.charAt(start + i)
: this[start + i];
return cloned;
}
});
$def($def.P + $def.F * (IObject != Object), 'Array', {
join: function(){
return _join.apply(IObject(this), arguments);
}
});
// 22.1.2.2 / 15.4.3.2 Array.isArray(arg)
$def($def.S, 'Array', {isArray: __webpack_require__(27)});
var createArrayReduce = function(isRight){
return function(callbackfn, memo){
aFunction(callbackfn);
var O = IObject(this)
, length = toLength(O.length)
, index = isRight ? length - 1 : 0
, i = isRight ? -1 : 1;
if(arguments.length < 2)for(;;){
if(index in O){
memo = O[index];
index += i;
break;
}
index += i;
if(isRight ? index < 0 : length <= index){
throw TypeError('Reduce of empty array with no initial value');
}
}
for(;isRight ? index >= 0 : length > index; index += i)if(index in O){
memo = callbackfn(memo, O[index], index, this);
}
return memo;
};
};
var methodize = function($fn){
return function(arg1/*, arg2 = undefined */){
return $fn(this, arg1, arguments[1]);
};
};
$def($def.P, 'Array', {
// 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg])
forEach: $.each = $.each || methodize(arrayMethod(0)),
// 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg])
map: methodize(arrayMethod(1)),
// 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg])
filter: methodize(arrayMethod(2)),
// 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg])
some: methodize(arrayMethod(3)),
// 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg])
every: methodize(arrayMethod(4)),
// 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue])
reduce: createArrayReduce(false),
// 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue])
reduceRight: createArrayReduce(true),
// 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex])
indexOf: methodize($indexOf),
// 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex])
lastIndexOf: function(el, fromIndex /* = @[*-1] */){
var O = toIObject(this)
, length = toLength(O.length)
, index = length - 1;
if(arguments.length > 1)index = Math.min(index, toInteger(fromIndex));
if(index < 0)index = toLength(length + index);
for(;index >= 0; index--)if(index in O)if(O[index] === el)return index;
return -1;
}
});
// 20.3.3.1 / 15.9.4.4 Date.now()
$def($def.S, 'Date', {now: function(){ return +new Date; }});
var lz = function(num){
return num > 9 ? num : '0' + num;
};
// 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString()
// PhantomJS and old webkit had a broken Date implementation.
var date = new Date(-5e13 - 1)
, brokenDate = !(date.toISOString && date.toISOString() == '0385-07-25T07:06:39.999Z'
&& fails(function(){ new Date(NaN).toISOString(); }));
$def($def.P + $def.F * brokenDate, 'Date', {
toISOString: function toISOString(){
if(!isFinite(this))throw RangeError('Invalid time value');
var d = this
, y = d.getUTCFullYear()
, m = d.getUTCMilliseconds()
, s = y < 0 ? '-' : y > 9999 ? '+' : '';
return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) +
'-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) +
'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) +
':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z';
}
});
/***/ },
/* 2 */
/***/ function(module, exports) {
var $Object = Object;
module.exports = {
create: $Object.create,
getProto: $Object.getPrototypeOf,
isEnum: {}.propertyIsEnumerable,
getDesc: $Object.getOwnPropertyDescriptor,
setDesc: $Object.defineProperty,
setDescs: $Object.defineProperties,
getKeys: $Object.keys,
getNames: $Object.getOwnPropertyNames,
getSymbols: $Object.getOwnPropertySymbols,
each: [].forEach
};
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
// Thank's IE8 for his funny defineProperty
module.exports = !__webpack_require__(4)(function(){
return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
});
/***/ },
/* 4 */
/***/ function(module, exports) {
module.exports = function(exec){
try {
return !!exec();
} catch(e){
return true;
}
};
/***/ },
/* 5 */
/***/ function(module, exports) {
module.exports = function(bitmap, value){
return {
enumerable : !(bitmap & 1),
configurable: !(bitmap & 2),
writable : !(bitmap & 4),
value : value
};
};
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(7).document && document.documentElement;
/***/ },
/* 7 */
/***/ function(module, exports) {
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math
? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(9)
, document = __webpack_require__(7).document
// in old IE typeof document.createElement is 'object'
, is = isObject(document) && isObject(document.createElement);
module.exports = function(it){
return is ? document.createElement(it) : {};
};
/***/ },
/* 9 */
/***/ function(module, exports) {
module.exports = function(it){
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
/***/ },
/* 10 */
/***/ function(module, exports) {
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function(it, key){
return hasOwnProperty.call(it, key);
};
/***/ },
/* 11 */
/***/ function(module, exports) {
var toString = {}.toString;
module.exports = function(it){
return toString.call(it).slice(8, -1);
};
/***/ },
/* 12 */
/***/ function(module, exports, __webpack_require__) {
var global = __webpack_require__(7)
, core = __webpack_require__(13)
, hide = __webpack_require__(14)
, $redef = __webpack_require__(15)
, PROTOTYPE = 'prototype';
var ctx = function(fn, that){
return function(){
return fn.apply(that, arguments);
};
};
var $def = function(type, name, source){
var key, own, out, exp
, isGlobal = type & $def.G
, isProto = type & $def.P
, target = isGlobal ? global : type & $def.S
? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]
, exports = isGlobal ? core : core[name] || (core[name] = {});
if(isGlobal)source = name;
for(key in source){
// contains in native
own = !(type & $def.F) && target && key in target;
// export native or passed
out = (own ? target : source)[key];
// bind timers to global for call from export context
if(type & $def.B && own)exp = ctx(out, global);
else exp = isProto && typeof out == 'function' ? ctx(Function.call, out) : out;
// extend global
if(target && !own)$redef(target, key, out);
// export
if(exports[key] != out)hide(exports, key, exp);
if(isProto)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out;
}
};
global.core = core;
// type bitmap
$def.F = 1; // forced
$def.G = 2; // global
$def.S = 4; // static
$def.P = 8; // proto
$def.B = 16; // bind
$def.W = 32; // wrap
module.exports = $def;
/***/ },
/* 13 */
/***/ function(module, exports) {
var core = module.exports = {version: '1.2.5'};
if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(2)
, createDesc = __webpack_require__(5);
module.exports = __webpack_require__(3) ? function(object, key, value){
return $.setDesc(object, key, createDesc(1, value));
} : function(object, key, value){
object[key] = value;
return object;
};
/***/ },
/* 15 */
/***/ function(module, exports, __webpack_require__) {
// add fake Function#toString
// for correct work wrapped methods / constructors with methods like LoDash isNative
var global = __webpack_require__(7)
, hide = __webpack_require__(14)
, SRC = __webpack_require__(16)('src')
, TO_STRING = 'toString'
, $toString = Function[TO_STRING]
, TPL = ('' + $toString).split(TO_STRING);
__webpack_require__(13).inspectSource = function(it){
return $toString.call(it);
};
(module.exports = function(O, key, val, safe){
if(typeof val == 'function'){
val.hasOwnProperty(SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
val.hasOwnProperty('name') || hide(val, 'name', key);
}
if(O === global){
O[key] = val;
} else {
if(!safe)delete O[key];
hide(O, key, val);
}
})(Function.prototype, TO_STRING, function toString(){
return typeof this == 'function' && this[SRC] || $toString.call(this);
});
/***/ },
/* 16 */
/***/ function(module, exports) {
var id = 0
, px = Math.random();
module.exports = function(key){
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
};
/***/ },
/* 17 */
/***/ function(module, exports) {
// fast apply, http://jsperf.lnkit.com/fast-apply/5
module.exports = function(fn, args, that){
var un = that === undefined;
switch(args.length){
case 0: return un ? fn()
: fn.call(that);
case 1: return un ? fn(args[0])
: fn.call(that, args[0]);
case 2: return un ? fn(args[0], args[1])
: fn.call(that, args[0], args[1]);
case 3: return un ? fn(args[0], args[1], args[2])
: fn.call(that, args[0], args[1], args[2]);
case 4: return un ? fn(args[0], args[1], args[2], args[3])
: fn.call(that, args[0], args[1], args[2], args[3]);
} return fn.apply(that, args);
};
/***/ },
/* 18 */
/***/ function(module, exports, __webpack_require__) {
// 0 -> Array#forEach
// 1 -> Array#map
// 2 -> Array#filter
// 3 -> Array#some
// 4 -> Array#every
// 5 -> Array#find
// 6 -> Array#findIndex
var ctx = __webpack_require__(19)
, IObject = __webpack_require__(21)
, toObject = __webpack_require__(22)
, toLength = __webpack_require__(24)
, asc = __webpack_require__(26);
module.exports = function(TYPE){
var IS_MAP = TYPE == 1
, IS_FILTER = TYPE == 2
, IS_SOME = TYPE == 3
, IS_EVERY = TYPE == 4
, IS_FIND_INDEX = TYPE == 6
, NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
return function($this, callbackfn, that){
var O = toObject($this)
, self = IObject(O)
, f = ctx(callbackfn, that, 3)
, length = toLength(self.length)
, index = 0
, result = IS_MAP ? asc($this, length) : IS_FILTER ? asc($this, 0) : undefined
, val, res;
for(;length > index; index++)if(NO_HOLES || index in self){
val = self[index];
res = f(val, index, O);
if(TYPE){
if(IS_MAP)result[index] = res; // map
else if(res)switch(TYPE){
case 3: return true; // some
case 5: return val; // find
case 6: return index; // findIndex
case 2: result.push(val); // filter
} else if(IS_EVERY)return false; // every
}
}
return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
};
};
/***/ },
/* 19 */
/***/ function(module, exports, __webpack_require__) {
// optional / simple context binding
var aFunction = __webpack_require__(20);
module.exports = function(fn, that, length){
aFunction(fn);
if(that === undefined)return fn;
switch(length){
case 1: return function(a){
return fn.call(that, a);
};
case 2: return function(a, b){
return fn.call(that, a, b);
};
case 3: return function(a, b, c){
return fn.call(that, a, b, c);
};
}
return function(/* ...args */){
return fn.apply(that, arguments);
};
};
/***/ },
/* 20 */
/***/ function(module, exports) {
module.exports = function(it){
if(typeof it != 'function')throw TypeError(it + ' is not a function!');
return it;
};
/***/ },
/* 21 */
/***/ function(module, exports, __webpack_require__) {
// fallback for non-array-like ES3 and non-enumerable old V8 strings
var cof = __webpack_require__(11);
module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){
return cof(it) == 'String' ? it.split('') : Object(it);
};
/***/ },
/* 22 */
/***/ function(module, exports, __webpack_require__) {
// 7.1.13 ToObject(argument)
var defined = __webpack_require__(23);
module.exports = function(it){
return Object(defined(it));
};
/***/ },
/* 23 */
/***/ function(module, exports) {
// 7.2.1 RequireObjectCoercible(argument)
module.exports = function(it){
if(it == undefined)throw TypeError("Can't call method on " + it);
return it;
};
/***/ },
/* 24 */
/***/ function(module, exports, __webpack_require__) {
// 7.1.15 ToLength
var toInteger = __webpack_require__(25)
, min = Math.min;
module.exports = function(it){
return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
};
/***/ },
/* 25 */
/***/ function(module, exports) {
// 7.1.4 ToInteger
var ceil = Math.ceil
, floor = Math.floor;
module.exports = function(it){
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
};
/***/ },
/* 26 */
/***/ function(module, exports, __webpack_require__) {
// 9.4.2.3 ArraySpeciesCreate(originalArray, length)
var isObject = __webpack_require__(9)
, isArray = __webpack_require__(27)
, SPECIES = __webpack_require__(28)('species');
module.exports = function(original, length){
var C;
if(isArray(original)){
C = original.constructor;
// cross-realm fallback
if(typeof C == 'function' && (C === Array || isArray(C.prototype)))C = undefined;
if(isObject(C)){
C = C[SPECIES];
if(C === null)C = undefined;
}
} return new (C === undefined ? Array : C)(length);
};
/***/ },
/* 27 */
/***/ function(module, exports, __webpack_require__) {
// 7.2.2 IsArray(argument)
var cof = __webpack_require__(11);
module.exports = Array.isArray || function(arg){
return cof(arg) == 'Array';
};
/***/ },
/* 28 */
/***/ function(module, exports, __webpack_require__) {
var store = __webpack_require__(29)('wks')
, uid = __webpack_require__(16)
, Symbol = __webpack_require__(7).Symbol;
module.exports = function(name){
return store[name] || (store[name] =
Symbol && Symbol[name] || (Symbol || uid)('Symbol.' + name));
};
/***/ },
/* 29 */
/***/ function(module, exports, __webpack_require__) {
var global = __webpack_require__(7)
, SHARED = '__core-js_shared__'
, store = global[SHARED] || (global[SHARED] = {});
module.exports = function(key){
return store[key] || (store[key] = {});
};
/***/ },
/* 30 */
/***/ function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(9);
module.exports = function(it){
if(!isObject(it))throw TypeError(it + ' is not an object!');
return it;
};
/***/ },
/* 31 */
/***/ function(module, exports, __webpack_require__) {
// to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject = __webpack_require__(21)
, defined = __webpack_require__(23);
module.exports = function(it){
return IObject(defined(it));
};
/***/ },
/* 32 */
/***/ function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(25)
, max = Math.max
, min = Math.min;
module.exports = function(index, length){
index = toInteger(index);
return index < 0 ? max(index + length, 0) : min(index, length);
};
/***/ },
/* 33 */
/***/ function(module, exports, __webpack_require__) {
// false -> Array#indexOf
// true -> Array#includes
var toIObject = __webpack_require__(31)
, toLength = __webpack_require__(24)
, toIndex = __webpack_require__(32);
module.exports = function(IS_INCLUDES){
return function($this, el, fromIndex){
var O = toIObject($this)
, length = toLength(O.length)
, index = toIndex(fromIndex, length)
, value;
// Array#includes uses SameValueZero equality algorithm
if(IS_INCLUDES && el != el)while(length > index){
value = O[index++];
if(value != value)return true;
// Array#toIndex ignores holes, Array#includes - not
} else for(;length > index; index++)if(IS_INCLUDES || index in O){
if(O[index] === el)return IS_INCLUDES || index;
} return !IS_INCLUDES && -1;
};
};
/***/ },
/* 34 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// ECMAScript 6 symbols shim
var $ = __webpack_require__(2)
, global = __webpack_require__(7)
, has = __webpack_require__(10)
, DESCRIPTORS = __webpack_require__(3)
, $def = __webpack_require__(12)
, $redef = __webpack_require__(15)
, $fails = __webpack_require__(4)
, shared = __webpack_require__(29)
, setToStringTag = __webpack_require__(35)
, uid = __webpack_require__(16)
, wks = __webpack_require__(28)
, keyOf = __webpack_require__(36)
, $names = __webpack_require__(37)
, enumKeys = __webpack_require__(38)
, isArray = __webpack_require__(27)
, anObject = __webpack_require__(30)
, toIObject = __webpack_require__(31)
, createDesc = __webpack_require__(5)
, getDesc = $.getDesc
, setDesc = $.setDesc
, _create = $.create
, getNames = $names.get
, $Symbol = global.Symbol
, $JSON = global.JSON
, _stringify = $JSON && $JSON.stringify
, setter = false
, HIDDEN = wks('_hidden')
, isEnum = $.isEnum
, SymbolRegistry = shared('symbol-registry')
, AllSymbols = shared('symbols')
, useNative = typeof $Symbol == 'function'
, ObjectProto = Object.prototype;
// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
var setSymbolDesc = DESCRIPTORS && $fails(function(){
return _create(setDesc({}, 'a', {
get: function(){ return setDesc(this, 'a', {value: 7}).a; }
})).a != 7;
}) ? function(it, key, D){
var protoDesc = getDesc(ObjectProto, key);
if(protoDesc)delete ObjectProto[key];
setDesc(it, key, D);
if(protoDesc && it !== ObjectProto)setDesc(ObjectProto, key, protoDesc);
} : setDesc;
var wrap = function(tag){
var sym = AllSymbols[tag] = _create($Symbol.prototype);
sym._k = tag;
DESCRIPTORS && setter && setSymbolDesc(ObjectProto, tag, {
configurable: true,
set: function(value){
if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false;
setSymbolDesc(this, tag, createDesc(1, value));
}
});
return sym;
};
var isSymbol = function(it){
return typeof it == 'symbol';
};
var $defineProperty = function defineProperty(it, key, D){
if(D && has(AllSymbols, key)){
if(!D.enumerable){
if(!has(it, HIDDEN))setDesc(it, HIDDEN, createDesc(1, {}));
it[HIDDEN][key] = true;
} else {
if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false;
D = _create(D, {enumerable: createDesc(0, false)});
} return setSymbolDesc(it, key, D);
} return setDesc(it, key, D);
};
var $defineProperties = function defineProperties(it, P){
anObject(it);
var keys = enumKeys(P = toIObject(P))
, i = 0
, l = keys.length
, key;
while(l > i)$defineProperty(it, key = keys[i++], P[key]);
return it;
};
var $create = function create(it, P){
return P === undefined ? _create(it) : $defineProperties(_create(it), P);
};
var $propertyIsEnumerable = function propertyIsEnumerable(key){
var E = isEnum.call(this, key);
return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key]
? E : true;
};
var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){
var D = getDesc(it = toIObject(it), key);
if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true;
return D;
};
var $getOwnPropertyNames = function getOwnPropertyNames(it){
var names = getNames(toIObject(it))
, result = []
, i = 0
, key;
while(names.length > i)if(!has(AllSymbols, key = names[i++]) && key != HIDDEN)result.push(key);
return result;
};
var $getOwnPropertySymbols = function getOwnPropertySymbols(it){
var names = getNames(toIObject(it))
, result = []
, i = 0
, key;
while(names.length > i)if(has(AllSymbols, key = names[i++]))result.push(AllSymbols[key]);
return result;
};
var $stringify = function stringify(it){
if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined
var args = [it]
, i = 1
, $$ = arguments
, replacer, $replacer;
while($$.length > i)args.push($$[i++]);
replacer = args[1];
if(typeof replacer == 'function')$replacer = replacer;
if($replacer || !isArray(replacer))replacer = function(key, value){
if($replacer)value = $replacer.call(this, key, value);
if(!isSymbol(value))return value;
};
args[1] = replacer;
return _stringify.apply($JSON, args);
};
var buggyJSON = $fails(function(){
var S = $Symbol();
// MS Edge converts symbol values to JSON as {}
// WebKit converts symbol values to JSON as null
// V8 throws on boxed symbols
return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}';
});
// 19.4.1.1 Symbol([description])
if(!useNative){
$Symbol = function Symbol(){
if(isSymbol(this))throw TypeError('Symbol is not a constructor');
return wrap(uid(arguments.length > 0 ? arguments[0] : undefined));
};
$redef($Symbol.prototype, 'toString', function toString(){
return this._k;
});
isSymbol = function(it){
return it instanceof $Symbol;
};
$.create = $create;
$.isEnum = $propertyIsEnumerable;
$.getDesc = $getOwnPropertyDescriptor;
$.setDesc = $defineProperty;
$.setDescs = $defineProperties;
$.getNames = $names.get = $getOwnPropertyNames;
$.getSymbols = $getOwnPropertySymbols;
if(DESCRIPTORS && !__webpack_require__(39)){
$redef(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
}
}
var symbolStatics = {
// 19.4.2.1 Symbol.for(key)
'for': function(key){
return has(SymbolRegistry, key += '')
? SymbolRegistry[key]
: SymbolRegistry[key] = $Symbol(key);
},
// 19.4.2.5 Symbol.keyFor(sym)
keyFor: function keyFor(key){
return keyOf(SymbolRegistry, key);
},
useSetter: function(){ setter = true; },
useSimple: function(){ setter = false; }
};
// 19.4.2.2 Symbol.hasInstance
// 19.4.2.3 Symbol.isConcatSpreadable
// 19.4.2.4 Symbol.iterator
// 19.4.2.6 Symbol.match
// 19.4.2.8 Symbol.replace
// 19.4.2.9 Symbol.search
// 19.4.2.10 Symbol.species
// 19.4.2.11 Symbol.split
// 19.4.2.12 Symbol.toPrimitive
// 19.4.2.13 Symbol.toStringTag
// 19.4.2.14 Symbol.unscopables
$.each.call((
'hasInstance,isConcatSpreadable,iterator,match,replace,search,' +
'species,split,toPrimitive,toStringTag,unscopables'
).split(','), function(it){
var sym = wks(it);
symbolStatics[it] = useNative ? sym : wrap(sym);
});
setter = true;
$def($def.G + $def.W, {Symbol: $Symbol});
$def($def.S, 'Symbol', symbolStatics);
$def($def.S + $def.F * !useNative, 'Object', {
// 19.1.2.2 Object.create(O [, Properties])
create: $create,
// 19.1.2.4 Object.defineProperty(O, P, Attributes)
defineProperty: $defineProperty,
// 19.1.2.3 Object.defineProperties(O, Properties)
defineProperties: $defineProperties,
// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
// 19.1.2.7 Object.getOwnPropertyNames(O)
getOwnPropertyNames: $getOwnPropertyNames,
// 19.1.2.8 Object.getOwnPropertySymbols(O)
getOwnPropertySymbols: $getOwnPropertySymbols
});
// 24.3.2 JSON.stringify(value [, replacer [, space]])
$JSON && $def($def.S + $def.F * (!useNative || buggyJSON), 'JSON', {stringify: $stringify});
// 19.4.3.5 Symbol.prototype[@@toStringTag]
setToStringTag($Symbol, 'Symbol');
// 20.2.1.9 Math[@@toStringTag]
setToStringTag(Math, 'Math', true);
// 24.3.3 JSON[@@toStringTag]
setToStringTag(global.JSON, 'JSON', true);
/***/ },
/* 35 */
/***/ function(module, exports, __webpack_require__) {
var def = __webpack_require__(2).setDesc
, has = __webpack_require__(10)
, TAG = __webpack_require__(28)('toStringTag');
module.exports = function(it, tag, stat){
if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});
};
/***/ },
/* 36 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(2)
, toIObject = __webpack_require__(31);
module.exports = function(object, el){
var O = toIObject(object)
, keys = $.getKeys(O)
, length = keys.length
, index = 0
, key;
while(length > index)if(O[key = keys[index++]] === el)return key;
};
/***/ },
/* 37 */
/***/ function(module, exports, __webpack_require__) {
// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
var toString = {}.toString
, toIObject = __webpack_require__(31)
, getNames = __webpack_require__(2).getNames;
var windowNames = typeof window == 'object' && Object.getOwnPropertyNames
? Object.getOwnPropertyNames(window) : [];
var getWindowNames = function(it){
try {
return getNames(it);
} catch(e){
return windowNames.slice();
}
};
module.exports.get = function getOwnPropertyNames(it){
if(windowNames && toString.call(it) == '[object Window]')return getWindowNames(it);
return getNames(toIObject(it));
};
/***/ },
/* 38 */
/***/ function(module, exports, __webpack_require__) {
// all enumerable object keys, includes symbols
var $ = __webpack_require__(2);
module.exports = function(it){
var keys = $.getKeys(it)
, getSymbols = $.getSymbols;
if(getSymbols){
var symbols = getSymbols(it)
, isEnum = $.isEnum
, i = 0
, key;
while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))keys.push(key);
}
return keys;
};
/***/ },
/* 39 */
/***/ function(module, exports) {
module.exports = false;
/***/ },
/* 40 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.3.1 Object.assign(target, source)
var $def = __webpack_require__(12);
$def($def.S + $def.F, 'Object', {assign: __webpack_require__(41)});
/***/ },
/* 41 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.1 Object.assign(target, source, ...)
var $ = __webpack_require__(2)
, toObject = __webpack_require__(22)
, IObject = __webpack_require__(21);
// should work with symbols and should have deterministic property order (V8 bug)
module.exports = __webpack_require__(4)(function(){
var a = Object.assign
, A = {}
, B = {}
, S = Symbol()
, K = 'abcdefghijklmnopqrst';
A[S] = 7;
K.split('').forEach(function(k){ B[k] = k; });
return a({}, A)[S] != 7 || Object.keys(a({}, B)).join('') != K;
}) ? function assign(target, source){ // eslint-disable-line no-unused-vars
var T = toObject(target)
, $$ = arguments
, $$len = $$.length
, index = 1
, getKeys = $.getKeys
, getSymbols = $.getSymbols
, isEnum = $.isEnum;
while($$len > index){
var S = IObject($$[index++])
, keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S)
, length = keys.length
, j = 0
, key;
while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key];
}
return T;
} : Object.assign;
/***/ },
/* 42 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.3.10 Object.is(value1, value2)
var $def = __webpack_require__(12);
$def($def.S, 'Object', {is: __webpack_require__(43)});
/***/ },
/* 43 */
/***/ function(module, exports) {
// 7.2.9 SameValue(x, y)
module.exports = Object.is || function is(x, y){
return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
};
/***/ },
/* 44 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.3.19 Object.setPrototypeOf(O, proto)
var $def = __webpack_require__(12);
$def($def.S, 'Object', {setPrototypeOf: __webpack_require__(45).set});
/***/ },
/* 45 */
/***/ function(module, exports, __webpack_require__) {
// Works with __proto__ only. Old v8 can't work with null proto objects.
/* eslint-disable no-proto */
var getDesc = __webpack_require__(2).getDesc
, isObject = __webpack_require__(9)
, anObject = __webpack_require__(30);
var check = function(O, proto){
anObject(O);
if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!");
};
module.exports = {
set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
function(test, buggy, set){
try {
set = __webpack_require__(19)(Function.call, getDesc(Object.prototype, '__proto__').set, 2);
set(test, []);
buggy = !(test instanceof Array);
} catch(e){ buggy = true; }
return function setPrototypeOf(O, proto){
check(O, proto);
if(buggy)O.__proto__ = proto;
else set(O, proto);
return O;
};
}({}, false) : undefined),
check: check
};
/***/ },
/* 46 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// 19.1.3.6 Object.prototype.toString()
var classof = __webpack_require__(47)
, test = {};
test[__webpack_require__(28)('toStringTag')] = 'z';
if(test + '' != '[object z]'){
__webpack_require__(15)(Object.prototype, 'toString', function toString(){
return '[object ' + classof(this) + ']';
}, true);
}
/***/ },
/* 47 */
/***/ function(module, exports, __webpack_require__) {
// getting tag from 19.1.3.6 Object.prototype.toString()
var cof = __webpack_require__(11)
, TAG = __webpack_require__(28)('toStringTag')
// ES3 wrong here
, ARG = cof(function(){ return arguments; }()) == 'Arguments';
module.exports = function(it){
var O, T, B;
return it === undefined ? 'Undefined' : it === null ? 'Null'
// @@toStringTag case
: typeof (T = (O = Object(it))[TAG]) == 'string' ? T
// builtinTag case
: ARG ? cof(O)
// ES3 arguments fallback
: (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
};
/***/ },
/* 48 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.5 Object.freeze(O)
var isObject = __webpack_require__(9);
__webpack_require__(49)('freeze', function($freeze){
return function freeze(it){
return $freeze && isObject(it) ? $freeze(it) : it;
};
});
/***/ },
/* 49 */
/***/ function(module, exports, __webpack_require__) {
// most Object methods by ES6 should accept primitives
var $def = __webpack_require__(12)
, core = __webpack_require__(13)
, fails = __webpack_require__(4);
module.exports = function(KEY, exec){
var $def = __webpack_require__(12)
, fn = (core.Object || {})[KEY] || Object[KEY]
, exp = {};
exp[KEY] = exec(fn);
$def($def.S + $def.F * fails(function(){ fn(1); }), 'Object', exp);
};
/***/ },
/* 50 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.17 Object.seal(O)
var isObject = __webpack_require__(9);
__webpack_require__(49)('seal', function($seal){
return function seal(it){
return $seal && isObject(it) ? $seal(it) : it;
};
});
/***/ },
/* 51 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.15 Object.preventExtensions(O)
var isObject = __webpack_require__(9);
__webpack_require__(49)('preventExtensions', function($preventExtensions){
return function preventExtensions(it){
return $preventExtensions && isObject(it) ? $preventExtensions(it) : it;
};
});
/***/ },
/* 52 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.12 Object.isFrozen(O)
var isObject = __webpack_require__(9);
__webpack_require__(49)('isFrozen', function($isFrozen){
return function isFrozen(it){
return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true;
};
});
/***/ },
/* 53 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.13 Object.isSealed(O)
var isObject = __webpack_require__(9);
__webpack_require__(49)('isSealed', function($isSealed){
return function isSealed(it){
return isObject(it) ? $isSealed ? $isSealed(it) : false : true;
};
});
/***/ },
/* 54 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.11 Object.isExtensible(O)
var isObject = __webpack_require__(9);
__webpack_require__(49)('isExtensible', function($isExtensible){
return function isExtensible(it){
return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false;
};
});
/***/ },
/* 55 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
var toIObject = __webpack_require__(31);
__webpack_require__(49)('getOwnPropertyDescriptor', function($getOwnPropertyDescriptor){
return function getOwnPropertyDescriptor(it, key){
return $getOwnPropertyDescriptor(toIObject(it), key);
};
});
/***/ },
/* 56 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.9 Object.getPrototypeOf(O)
var toObject = __webpack_require__(22);
__webpack_require__(49)('getPrototypeOf', function($getPrototypeOf){
return function getPrototypeOf(it){
return $getPrototypeOf(toObject(it));
};
});
/***/ },
/* 57 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.14 Object.keys(O)
var toObject = __webpack_require__(22);
__webpack_require__(49)('keys', function($keys){
return function keys(it){
return $keys(toObject(it));
};
});
/***/ },
/* 58 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.7 Object.getOwnPropertyNames(O)
__webpack_require__(49)('getOwnPropertyNames', function(){
return __webpack_require__(37).get;
});
/***/ },
/* 59 */
/***/ function(module, exports, __webpack_require__) {
var setDesc = __webpack_require__(2).setDesc
, createDesc = __webpack_require__(5)
, has = __webpack_require__(10)
, FProto = Function.prototype
, nameRE = /^\s*function ([^ (]*)/
, NAME = 'name';
// 19.2.4.2 name
NAME in FProto || __webpack_require__(3) && setDesc(FProto, NAME, {
configurable: true,
get: function(){
var match = ('' + this).match(nameRE)
, name = match ? match[1] : '';
has(this, NAME) || setDesc(this, NAME, createDesc(5, name));
return name;
}
});
/***/ },
/* 60 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(2)
, isObject = __webpack_require__(9)
, HAS_INSTANCE = __webpack_require__(28)('hasInstance')
, FunctionProto = Function.prototype;
// 19.2.3.6 Function.prototype[@@hasInstance](V)
if(!(HAS_INSTANCE in FunctionProto))$.setDesc(FunctionProto, HAS_INSTANCE, {value: function(O){
if(typeof this != 'function' || !isObject(O))return false;
if(!isObject(this.prototype))return O instanceof this;
// for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this:
while(O = $.getProto(O))if(this.prototype === O)return true;
return false;
}});
/***/ },
/* 61 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(2)
, global = __webpack_require__(7)
, has = __webpack_require__(10)
, cof = __webpack_require__(11)
, toPrimitive = __webpack_require__(62)
, fails = __webpack_require__(4)
, $trim = __webpack_require__(63).trim
, NUMBER = 'Number'
, $Number = global[NUMBER]
, Base = $Number
, proto = $Number.prototype
// Opera ~12 has broken Object#toString
, BROKEN_COF = cof($.create(proto)) == NUMBER
, TRIM = 'trim' in String.prototype;
// 7.1.3 ToNumber(argument)
var toNumber = function(argument){
var it = toPrimitive(argument, false);
if(typeof it == 'string' && it.length > 2){
it = TRIM ? it.trim() : $trim(it, 3);
var first = it.charCodeAt(0)
, third, radix, maxCode;
if(first === 43 || first === 45){
third = it.charCodeAt(2);
if(third === 88 || third === 120)return NaN; // Number('+0x1') should be NaN, old V8 fix
} else if(first === 48){
switch(it.charCodeAt(1)){
case 66 : case 98 : radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i
case 79 : case 111 : radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i
default : return +it;
}
for(var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++){
code = digits.charCodeAt(i);
// parseInt parses a string to a first unavailable symbol
// but ToNumber should return NaN if a string contains unavailable symbols
if(code < 48 || code > maxCode)return NaN;
} return parseInt(digits, radix);
}
} return +it;
};
if(!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')){
$Number = function Number(value){
var it = arguments.length < 1 ? 0 : value
, that = this;
return that instanceof $Number
// check on 1..constructor(foo) case
&& (BROKEN_COF ? fails(function(){ proto.valueOf.call(that); }) : cof(that) != NUMBER)
? new Base(toNumber(it)) : toNumber(it);
};
$.each.call(__webpack_require__(3) ? $.getNames(Base) : (
// ES3:
'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
// ES6 (in case, if modules with ES6 Number statics required before):
'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'
).split(','), function(key){
if(has(Base, key) && !has($Number, key)){
$.setDesc($Number, key, $.getDesc(Base, key));
}
});
$Number.prototype = proto;
proto.constructor = $Number;
__webpack_require__(15)(global, NUMBER, $Number);
}
/***/ },
/* 62 */
/***/ function(module, exports, __webpack_require__) {
// 7.1.1 ToPrimitive(input [, PreferredType])
var isObject = __webpack_require__(9);
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
module.exports = function(it, S){
if(!isObject(it))return it;
var fn, val;
if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;
if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
throw TypeError("Can't convert object to primitive value");
};
/***/ },
/* 63 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(12)
, defined = __webpack_require__(23)
, fails = __webpack_require__(4)
, spaces = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' +
'\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'
, space = '[' + spaces + ']'
, non = '\u200b\u0085'
, ltrim = RegExp('^' + space + space + '*')
, rtrim = RegExp(space + space + '*$');
var $export = function(KEY, exec){
var exp = {};
exp[KEY] = exec(trim);
$def($def.P + $def.F * fails(function(){
return !!spaces[KEY]() || non[KEY]() != non;
}), 'String', exp);
};
// 1 -> String#trimLeft
// 2 -> String#trimRight
// 3 -> String#trim
var trim = $export.trim = function(string, TYPE){
string = String(defined(string));
if(TYPE & 1)string = string.replace(ltrim, '');
if(TYPE & 2)string = string.replace(rtrim, '');
return string;
};
module.exports = $export;
/***/ },
/* 64 */
/***/ function(module, exports, __webpack_require__) {
// 20.1.2.1 Number.EPSILON
var $def = __webpack_require__(12);
$def($def.S, 'Number', {EPSILON: Math.pow(2, -52)});
/***/ },
/* 65 */
/***/ function(module, exports, __webpack_require__) {
// 20.1.2.2 Number.isFinite(number)
var $def = __webpack_require__(12)
, _isFinite = __webpack_require__(7).isFinite;
$def($def.S, 'Number', {
isFinite: function isFinite(it){
return typeof it == 'number' && _isFinite(it);
}
});
/***/ },
/* 66 */
/***/ function(module, exports, __webpack_require__) {
// 20.1.2.3 Number.isInteger(number)
var $def = __webpack_require__(12);
$def($def.S, 'Number', {isInteger: __webpack_require__(67)});
/***/ },
/* 67 */
/***/ function(module, exports, __webpack_require__) {
// 20.1.2.3 Number.isInteger(number)
var isObject = __webpack_require__(9)
, floor = Math.floor;
module.exports = function isInteger(it){
return !isObject(it) && isFinite(it) && floor(it) === it;
};
/***/ },
/* 68 */
/***/ function(module, exports, __webpack_require__) {
// 20.1.2.4 Number.isNaN(number)
var $def = __webpack_require__(12);
$def($def.S, 'Number', {
isNaN: function isNaN(number){
return number != number;
}
});
/***/ },
/* 69 */
/***/ function(module, exports, __webpack_require__) {
// 20.1.2.5 Number.isSafeInteger(number)
var $def = __webpack_require__(12)
, isInteger = __webpack_require__(67)
, abs = Math.abs;
$def($def.S, 'Number', {
isSafeInteger: function isSafeInteger(number){
return isInteger(number) && abs(number) <= 0x1fffffffffffff;
}
});
/***/ },
/* 70 */
/***/ function(module, exports, __webpack_require__) {
// 20.1.2.6 Number.MAX_SAFE_INTEGER
var $def = __webpack_require__(12);
$def($def.S, 'Number', {MAX_SAFE_INTEGER: 0x1fffffffffffff});
/***/ },
/* 71 */
/***/ function(module, exports, __webpack_require__) {
// 20.1.2.10 Number.MIN_SAFE_INTEGER
var $def = __webpack_require__(12);
$def($def.S, 'Number', {MIN_SAFE_INTEGER: -0x1fffffffffffff});
/***/ },
/* 72 */
/***/ function(module, exports, __webpack_require__) {
// 20.1.2.12 Number.parseFloat(string)
var $def = __webpack_require__(12);
$def($def.S, 'Number', {parseFloat: parseFloat});
/***/ },
/* 73 */
/***/ function(module, exports, __webpack_require__) {
// 20.1.2.13 Number.parseInt(string, radix)
var $def = __webpack_require__(12);
$def($def.S, 'Number', {parseInt: parseInt});
/***/ },
/* 74 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.3 Math.acosh(x)
var $def = __webpack_require__(12)
, log1p = __webpack_require__(75)
, sqrt = Math.sqrt
, $acosh = Math.acosh;
// V8 bug https://code.google.com/p/v8/issues/detail?id=3509
$def($def.S + $def.F * !($acosh && Math.floor($acosh(Number.MAX_VALUE)) == 710), 'Math', {
acosh: function acosh(x){
return (x = +x) < 1 ? NaN : x > 94906265.62425156
? Math.log(x) + Math.LN2
: log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1));
}
});
/***/ },
/* 75 */
/***/ function(module, exports) {
// 20.2.2.20 Math.log1p(x)
module.exports = Math.log1p || function log1p(x){
return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x);
};
/***/ },
/* 76 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.5 Math.asinh(x)
var $def = __webpack_require__(12);
function asinh(x){
return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : Math.log(x + Math.sqrt(x * x + 1));
}
$def($def.S, 'Math', {asinh: asinh});
/***/ },
/* 77 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.7 Math.atanh(x)
var $def = __webpack_require__(12);
$def($def.S, 'Math', {
atanh: function atanh(x){
return (x = +x) == 0 ? x : Math.log((1 + x) / (1 - x)) / 2;
}
});
/***/ },
/* 78 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.9 Math.cbrt(x)
var $def = __webpack_require__(12)
, sign = __webpack_require__(79);
$def($def.S, 'Math', {
cbrt: function cbrt(x){
return sign(x = +x) * Math.pow(Math.abs(x), 1 / 3);
}
});
/***/ },
/* 79 */
/***/ function(module, exports) {
// 20.2.2.28 Math.sign(x)
module.exports = Math.sign || function sign(x){
return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
};
/***/ },
/* 80 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.11 Math.clz32(x)
var $def = __webpack_require__(12);
$def($def.S, 'Math', {
clz32: function clz32(x){
return (x >>>= 0) ? 31 - Math.floor(Math.log(x + 0.5) * Math.LOG2E) : 32;
}
});
/***/ },
/* 81 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.12 Math.cosh(x)
var $def = __webpack_require__(12)
, exp = Math.exp;
$def($def.S, 'Math', {
cosh: function cosh(x){
return (exp(x = +x) + exp(-x)) / 2;
}
});
/***/ },
/* 82 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.14 Math.expm1(x)
var $def = __webpack_require__(12);
$def($def.S, 'Math', {expm1: __webpack_require__(83)});
/***/ },
/* 83 */
/***/ function(module, exports) {
// 20.2.2.14 Math.expm1(x)
module.exports = Math.expm1 || function expm1(x){
return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1;
};
/***/ },
/* 84 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.16 Math.fround(x)
var $def = __webpack_require__(12)
, sign = __webpack_require__(79)
, pow = Math.pow
, EPSILON = pow(2, -52)
, EPSILON32 = pow(2, -23)
, MAX32 = pow(2, 127) * (2 - EPSILON32)
, MIN32 = pow(2, -126);
var roundTiesToEven = function(n){
return n + 1 / EPSILON - 1 / EPSILON;
};
$def($def.S, 'Math', {
fround: function fround(x){
var $abs = Math.abs(x)
, $sign = sign(x)
, a, result;
if($abs < MIN32)return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32;
a = (1 + EPSILON32 / EPSILON) * $abs;
result = a - (a - $abs);
if(result > MAX32 || result != result)return $sign * Infinity;
return $sign * result;
}
});
/***/ },
/* 85 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.17 Math.hypot([value1[, value2[, … ]]])
var $def = __webpack_require__(12)
, abs = Math.abs;
$def($def.S, 'Math', {
hypot: function hypot(value1, value2){ // eslint-disable-line no-unused-vars
var sum = 0
, i = 0
, $$ = arguments
, $$len = $$.length
, larg = 0
, arg, div;
while(i < $$len){
arg = abs($$[i++]);
if(larg < arg){
div = larg / arg;
sum = sum * div * div + 1;
larg = arg;
} else if(arg > 0){
div = arg / larg;
sum += div * div;
} else sum += arg;
}
return larg === Infinity ? Infinity : larg * Math.sqrt(sum);
}
});
/***/ },
/* 86 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.18 Math.imul(x, y)
var $def = __webpack_require__(12)
, $imul = Math.imul;
// some WebKit versions fails with big numbers, some has wrong arity
$def($def.S + $def.F * __webpack_require__(4)(function(){
return $imul(0xffffffff, 5) != -5 || $imul.length != 2;
}), 'Math', {
imul: function imul(x, y){
var UINT16 = 0xffff
, xn = +x
, yn = +y
, xl = UINT16 & xn
, yl = UINT16 & yn;
return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0);
}
});
/***/ },
/* 87 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.21 Math.log10(x)
var $def = __webpack_require__(12);
$def($def.S, 'Math', {
log10: function log10(x){
return Math.log(x) / Math.LN10;
}
});
/***/ },
/* 88 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.20 Math.log1p(x)
var $def = __webpack_require__(12);
$def($def.S, 'Math', {log1p: __webpack_require__(75)});
/***/ },
/* 89 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.22 Math.log2(x)
var $def = __webpack_require__(12);
$def($def.S, 'Math', {
log2: function log2(x){
return Math.log(x) / Math.LN2;
}
});
/***/ },
/* 90 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.28 Math.sign(x)
var $def = __webpack_require__(12);
$def($def.S, 'Math', {sign: __webpack_require__(79)});
/***/ },
/* 91 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.30 Math.sinh(x)
var $def = __webpack_require__(12)
, expm1 = __webpack_require__(83)
, exp = Math.exp;
// V8 near Chromium 38 has a problem with very small numbers
$def($def.S + $def.F * __webpack_require__(4)(function(){
return !Math.sinh(-2e-17) != -2e-17;
}), 'Math', {
sinh: function sinh(x){
return Math.abs(x = +x) < 1
? (expm1(x) - expm1(-x)) / 2
: (exp(x - 1) - exp(-x - 1)) * (Math.E / 2);
}
});
/***/ },
/* 92 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.33 Math.tanh(x)
var $def = __webpack_require__(12)
, expm1 = __webpack_require__(83)
, exp = Math.exp;
$def($def.S, 'Math', {
tanh: function tanh(x){
var a = expm1(x = +x)
, b = expm1(-x);
return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x));
}
});
/***/ },
/* 93 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.34 Math.trunc(x)
var $def = __webpack_require__(12);
$def($def.S, 'Math', {
trunc: function trunc(it){
return (it > 0 ? Math.floor : Math.ceil)(it);
}
});
/***/ },
/* 94 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(12)
, toIndex = __webpack_require__(32)
, fromCharCode = String.fromCharCode
, $fromCodePoint = String.fromCodePoint;
// length should be 1, old FF problem
$def($def.S + $def.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
// 21.1.2.2 String.fromCodePoint(...codePoints)
fromCodePoint: function fromCodePoint(x){ // eslint-disable-line no-unused-vars
var res = []
, $$ = arguments
, $$len = $$.length
, i = 0
, code;
while($$len > i){
code = +$$[i++];
if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point');
res.push(code < 0x10000
? fromCharCode(code)
: fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
);
} return res.join('');
}
});
/***/ },
/* 95 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(12)
, toIObject = __webpack_require__(31)
, toLength = __webpack_require__(24);
$def($def.S, 'String', {
// 21.1.2.4 String.raw(callSite, ...substitutions)
raw: function raw(callSite){
var tpl = toIObject(callSite.raw)
, len = toLength(tpl.length)
, $$ = arguments
, $$len = $$.length
, res = []
, i = 0;
while(len > i){
res.push(String(tpl[i++]));
if(i < $$len)res.push(String($$[i]));
} return res.join('');
}
});
/***/ },
/* 96 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// 21.1.3.25 String.prototype.trim()
__webpack_require__(63)('trim', function($trim){
return function trim(){
return $trim(this, 3);
};
});
/***/ },
/* 97 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $def = __webpack_require__(12)
, $at = __webpack_require__(98)(false);
$def($def.P, 'String', {
// 21.1.3.3 String.prototype.codePointAt(pos)
codePointAt: function codePointAt(pos){
return $at(this, pos);
}
});
/***/ },
/* 98 */
/***/ function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(25)
, defined = __webpack_require__(23);
// true -> String#at
// false -> String#codePointAt
module.exports = function(TO_STRING){
return function(that, pos){
var s = String(defined(that))
, i = toInteger(pos)
, l = s.length
, a, b;
if(i < 0 || i >= l)return TO_STRING ? '' : undefined;
a = s.charCodeAt(i);
return a < 0xd800 || a > 0xdbff || i + 1 === l
|| (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
? TO_STRING ? s.charAt(i) : a
: TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
};
};
/***/ },
/* 99 */
/***/ function(module, exports, __webpack_require__) {
// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition])
'use strict';
var $def = __webpack_require__(12)
, toLength = __webpack_require__(24)
, context = __webpack_require__(100)
, ENDS_WITH = 'endsWith'
, $endsWith = ''[ENDS_WITH];
$def($def.P + $def.F * __webpack_require__(102)(ENDS_WITH), 'String', {
endsWith: function endsWith(searchString /*, endPosition = @length */){
var that = context(this, searchString, ENDS_WITH)
, $$ = arguments
, endPosition = $$.length > 1 ? $$[1] : undefined
, len = toLength(that.length)
, end = endPosition === undefined ? len : Math.min(toLength(endPosition), len)
, search = String(searchString);
return $endsWith
? $endsWith.call(that, search, end)
: that.slice(end - search.length, end) === search;
}
});
/***/ },
/* 100 */
/***/ function(module, exports, __webpack_require__) {
// helper for String#{startsWith, endsWith, includes}
var isRegExp = __webpack_require__(101)
, defined = __webpack_require__(23);
module.exports = function(that, searchString, NAME){
if(isRegExp(searchString))throw TypeError('String#' + NAME + " doesn't accept regex!");
return String(defined(that));
};
/***/ },
/* 101 */
/***/ function(module, exports, __webpack_require__) {
// 7.2.8 IsRegExp(argument)
var isObject = __webpack_require__(9)
, cof = __webpack_require__(11)
, MATCH = __webpack_require__(28)('match');
module.exports = function(it){
var isRegExp;
return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');
};
/***/ },
/* 102 */
/***/ function(module, exports, __webpack_require__) {
var MATCH = __webpack_require__(28)('match');
module.exports = function(KEY){
var re = /./;
try {
'/./'[KEY](re);
} catch(e){
try {
re[MATCH] = false;
return !'/./'[KEY](re);
} catch(f){ /* empty */ }
} return true;
};
/***/ },
/* 103 */
/***/ function(module, exports, __webpack_require__) {
// 21.1.3.7 String.prototype.includes(searchString, position = 0)
'use strict';
var $def = __webpack_require__(12)
, context = __webpack_require__(100)
, INCLUDES = 'includes';
$def($def.P + $def.F * __webpack_require__(102)(INCLUDES), 'String', {
includes: function includes(searchString /*, position = 0 */){
return !!~context(this, searchString, INCLUDES).indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined);
}
});
/***/ },
/* 104 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(12);
$def($def.P, 'String', {
// 21.1.3.13 String.prototype.repeat(count)
repeat: __webpack_require__(105)
});
/***/ },
/* 105 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var toInteger = __webpack_require__(25)
, defined = __webpack_require__(23);
module.exports = function repeat(count){
var str = String(defined(this))
, res = ''
, n = toInteger(count);
if(n < 0 || n == Infinity)throw RangeError("Count can't be negative");
for(;n > 0; (n >>>= 1) && (str += str))if(n & 1)res += str;
return res;
};
/***/ },
/* 106 */
/***/ function(module, exports, __webpack_require__) {
// 21.1.3.18 String.prototype.startsWith(searchString [, position ])
'use strict';
var $def = __webpack_require__(12)
, toLength = __webpack_require__(24)
, context = __webpack_require__(100)
, STARTS_WITH = 'startsWith'
, $startsWith = ''[STARTS_WITH];
$def($def.P + $def.F * __webpack_require__(102)(STARTS_WITH), 'String', {
startsWith: function startsWith(searchString /*, position = 0 */){
var that = context(this, searchString, STARTS_WITH)
, $$ = arguments
, index = toLength(Math.min($$.length > 1 ? $$[1] : undefined, that.length))
, search = String(searchString);
return $startsWith
? $startsWith.call(that, search, index)
: that.slice(index, index + search.length) === search;
}
});
/***/ },
/* 107 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $at = __webpack_require__(98)(true);
// 21.1.3.27 String.prototype[@@iterator]()
__webpack_require__(108)(String, 'String', function(iterated){
this._t = String(iterated); // target
this._i = 0; // next index
// 21.1.5.2.1 %StringIteratorPrototype%.next()
}, function(){
var O = this._t
, index = this._i
, point;
if(index >= O.length)return {value: undefined, done: true};
point = $at(O, index);
this._i += point.length;
return {value: point, done: false};
});
/***/ },
/* 108 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var LIBRARY = __webpack_require__(39)
, $def = __webpack_require__(12)
, $redef = __webpack_require__(15)
, hide = __webpack_require__(14)
, has = __webpack_require__(10)
, SYMBOL_ITERATOR = __webpack_require__(28)('iterator')
, Iterators = __webpack_require__(109)
, $iterCreate = __webpack_require__(110)
, setToStringTag = __webpack_require__(35)
, getProto = __webpack_require__(2).getProto
, BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next`
, FF_ITERATOR = '@@iterator'
, KEYS = 'keys'
, VALUES = 'values';
var returnThis = function(){ return this; };
module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCE){
$iterCreate(Constructor, NAME, next);
var getMethod = function(kind){
if(!BUGGY && kind in proto)return proto[kind];
switch(kind){
case KEYS: return function keys(){ return new Constructor(this, kind); };
case VALUES: return function values(){ return new Constructor(this, kind); };
} return function entries(){ return new Constructor(this, kind); };
};
var TAG = NAME + ' Iterator'
, proto = Base.prototype
, _native = proto[SYMBOL_ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]
, _default = _native || getMethod(DEFAULT)
, methods, key;
// Fix native
if(_native){
var IteratorPrototype = getProto(_default.call(new Base));
// Set @@toStringTag to native iterators
setToStringTag(IteratorPrototype, TAG, true);
// FF fix
if(!LIBRARY && has(proto, FF_ITERATOR))hide(IteratorPrototype, SYMBOL_ITERATOR, returnThis);
}
// Define iterator
if((!LIBRARY || FORCE) && (BUGGY || !(SYMBOL_ITERATOR in proto))){
hide(proto, SYMBOL_ITERATOR, _default);
}
// Plug for library
Iterators[NAME] = _default;
Iterators[TAG] = returnThis;
if(DEFAULT){
methods = {
values: DEFAULT == VALUES ? _default : getMethod(VALUES),
keys: IS_SET ? _default : getMethod(KEYS),
entries: DEFAULT != VALUES ? _default : getMethod('entries')
};
if(FORCE)for(key in methods){
if(!(key in proto))$redef(proto, key, methods[key]);
} else $def($def.P + $def.F * BUGGY, NAME, methods);
}
return methods;
};
/***/ },
/* 109 */
/***/ function(module, exports) {
module.exports = {};
/***/ },
/* 110 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(2)
, descriptor = __webpack_require__(5)
, setToStringTag = __webpack_require__(35)
, IteratorPrototype = {};
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
__webpack_require__(14)(IteratorPrototype, __webpack_require__(28)('iterator'), function(){ return this; });
module.exports = function(Constructor, NAME, next){
Constructor.prototype = $.create(IteratorPrototype, {next: descriptor(1, next)});
setToStringTag(Constructor, NAME + ' Iterator');
};
/***/ },
/* 111 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var ctx = __webpack_require__(19)
, $def = __webpack_require__(12)
, toObject = __webpack_require__(22)
, call = __webpack_require__(112)
, isArrayIter = __webpack_require__(113)
, toLength = __webpack_require__(24)
, getIterFn = __webpack_require__(114);
$def($def.S + $def.F * !__webpack_require__(115)(function(iter){ Array.from(iter); }), 'Array', {
// 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){
var O = toObject(arrayLike)
, C = typeof this == 'function' ? this : Array
, $$ = arguments
, $$len = $$.length
, mapfn = $$len > 1 ? $$[1] : undefined
, mapping = mapfn !== undefined
, index = 0
, iterFn = getIterFn(O)
, length, result, step, iterator;
if(mapping)mapfn = ctx(mapfn, $$len > 2 ? $$[2] : undefined, 2);
// if object isn't iterable or it's array with default iterator - use simple case
if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){
for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){
result[index] = mapping ? call(iterator, mapfn, [step.value, index], true) : step.value;
}
} else {
length = toLength(O.length);
for(result = new C(length); length > index; index++){
result[index] = mapping ? mapfn(O[index], index) : O[index];
}
}
result.length = index;
return result;
}
});
/***/ },
/* 112 */
/***/ function(module, exports, __webpack_require__) {
// call something on iterator step with safe closing on error
var anObject = __webpack_require__(30);
module.exports = function(iterator, fn, value, entries){
try {
return entries ? fn(anObject(value)[0], value[1]) : fn(value);
// 7.4.6 IteratorClose(iterator, completion)
} catch(e){
var ret = iterator['return'];
if(ret !== undefined)anObject(ret.call(iterator));
throw e;
}
};
/***/ },
/* 113 */
/***/ function(module, exports, __webpack_require__) {
// check on default Array iterator
var Iterators = __webpack_require__(109)
, ITERATOR = __webpack_require__(28)('iterator')
, ArrayProto = Array.prototype;
module.exports = function(it){
return (Iterators.Array || ArrayProto[ITERATOR]) === it;
};
/***/ },
/* 114 */
/***/ function(module, exports, __webpack_require__) {
var classof = __webpack_require__(47)
, ITERATOR = __webpack_require__(28)('iterator')
, Iterators = __webpack_require__(109);
module.exports = __webpack_require__(13).getIteratorMethod = function(it){
if(it != undefined)return it[ITERATOR]
|| it['@@iterator']
|| Iterators[classof(it)];
};
/***/ },
/* 115 */
/***/ function(module, exports, __webpack_require__) {
var ITERATOR = __webpack_require__(28)('iterator')
, SAFE_CLOSING = false;
try {
var riter = [7][ITERATOR]();
riter['return'] = function(){ SAFE_CLOSING = true; };
Array.from(riter, function(){ throw 2; });
} catch(e){ /* empty */ }
module.exports = function(exec, skipClosing){
if(!skipClosing && !SAFE_CLOSING)return false;
var safe = false;
try {
var arr = [7]
, iter = arr[ITERATOR]();
iter.next = function(){ safe = true; };
arr[ITERATOR] = function(){ return iter; };
exec(arr);
} catch(e){ /* empty */ }
return safe;
};
/***/ },
/* 116 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $def = __webpack_require__(12);
// WebKit Array.of isn't generic
$def($def.S + $def.F * __webpack_require__(4)(function(){
function F(){}
return !(Array.of.call(F) instanceof F);
}), 'Array', {
// 22.1.2.3 Array.of( ...items)
of: function of(/* ...args */){
var index = 0
, $$ = arguments
, $$len = $$.length
, result = new (typeof this == 'function' ? this : Array)($$len);
while($$len > index)result[index] = $$[index++];
result.length = $$len;
return result;
}
});
/***/ },
/* 117 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var addToUnscopables = __webpack_require__(118)
, step = __webpack_require__(119)
, Iterators = __webpack_require__(109)
, toIObject = __webpack_require__(31);
// 22.1.3.4 Array.prototype.entries()
// 22.1.3.13 Array.prototype.keys()
// 22.1.3.29 Array.prototype.values()
// 22.1.3.30 Array.prototype[@@iterator]()
module.exports = __webpack_require__(108)(Array, 'Array', function(iterated, kind){
this._t = toIObject(iterated); // target
this._i = 0; // next index
this._k = kind; // kind
// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
}, function(){
var O = this._t
, kind = this._k
, index = this._i++;
if(!O || index >= O.length){
this._t = undefined;
return step(1);
}
if(kind == 'keys' )return step(0, index);
if(kind == 'values')return step(0, O[index]);
return step(0, [index, O[index]]);
}, 'values');
// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
Iterators.Arguments = Iterators.Array;
addToUnscopables('keys');
addToUnscopables('values');
addToUnscopables('entries');
/***/ },
/* 118 */
/***/ function(module, exports, __webpack_require__) {
// 22.1.3.31 Array.prototype[@@unscopables]
var UNSCOPABLES = __webpack_require__(28)('unscopables')
, ArrayProto = Array.prototype;
if(ArrayProto[UNSCOPABLES] == undefined)__webpack_require__(14)(ArrayProto, UNSCOPABLES, {});
module.exports = function(key){
ArrayProto[UNSCOPABLES][key] = true;
};
/***/ },
/* 119 */
/***/ function(module, exports) {
module.exports = function(done, value){
return {value: value, done: !!done};
};
/***/ },
/* 120 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(121)('Array');
/***/ },
/* 121 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var global = __webpack_require__(7)
, $ = __webpack_require__(2)
, DESCRIPTORS = __webpack_require__(3)
, SPECIES = __webpack_require__(28)('species');
module.exports = function(KEY){
var C = global[KEY];
if(DESCRIPTORS && C && !C[SPECIES])$.setDesc(C, SPECIES, {
configurable: true,
get: function(){ return this; }
});
};
/***/ },
/* 122 */
/***/ function(module, exports, __webpack_require__) {
// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
'use strict';
var $def = __webpack_require__(12);
$def($def.P, 'Array', {copyWithin: __webpack_require__(123)});
__webpack_require__(118)('copyWithin');
/***/ },
/* 123 */
/***/ function(module, exports, __webpack_require__) {
// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
'use strict';
var toObject = __webpack_require__(22)
, toIndex = __webpack_require__(32)
, toLength = __webpack_require__(24);
module.exports = [].copyWithin || function copyWithin(target/*= 0*/, start/*= 0, end = @length*/){
var O = toObject(this)
, len = toLength(O.length)
, to = toIndex(target, len)
, from = toIndex(start, len)
, $$ = arguments
, end = $$.length > 2 ? $$[2] : undefined
, count = Math.min((end === undefined ? len : toIndex(end, len)) - from, len - to)
, inc = 1;
if(from < to && to < from + count){
inc = -1;
from += count - 1;
to += count - 1;
}
while(count-- > 0){
if(from in O)O[to] = O[from];
else delete O[to];
to += inc;
from += inc;
} return O;
};
/***/ },
/* 124 */
/***/ function(module, exports, __webpack_require__) {
// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
var $def = __webpack_require__(12);
$def($def.P, 'Array', {fill: __webpack_require__(125)});
__webpack_require__(118)('fill');
/***/ },
/* 125 */
/***/ function(module, exports, __webpack_require__) {
// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
'use strict';
var toObject = __webpack_require__(22)
, toIndex = __webpack_require__(32)
, toLength = __webpack_require__(24);
module.exports = [].fill || function fill(value /*, start = 0, end = @length */){
var O = toObject(this, true)
, length = toLength(O.length)
, $$ = arguments
, $$len = $$.length
, index = toIndex($$len > 1 ? $$[1] : undefined, length)
, end = $$len > 2 ? $$[2] : undefined
, endPos = end === undefined ? length : toIndex(end, length);
while(endPos > index)O[index++] = value;
return O;
};
/***/ },
/* 126 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined)
var KEY = 'find'
, $def = __webpack_require__(12)
, forced = true
, $find = __webpack_require__(18)(5);
// Shouldn't skip holes
if(KEY in [])Array(1)[KEY](function(){ forced = false; });
$def($def.P + $def.F * forced, 'Array', {
find: function find(callbackfn/*, that = undefined */){
return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
}
});
__webpack_require__(118)(KEY);
/***/ },
/* 127 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined)
var KEY = 'findIndex'
, $def = __webpack_require__(12)
, forced = true
, $find = __webpack_require__(18)(6);
// Shouldn't skip holes
if(KEY in [])Array(1)[KEY](function(){ forced = false; });
$def($def.P + $def.F * forced, 'Array', {
findIndex: function findIndex(callbackfn/*, that = undefined */){
return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
}
});
__webpack_require__(118)(KEY);
/***/ },
/* 128 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(2)
, global = __webpack_require__(7)
, isRegExp = __webpack_require__(101)
, $flags = __webpack_require__(129)
, $RegExp = global.RegExp
, Base = $RegExp
, proto = $RegExp.prototype
, re1 = /a/g
, re2 = /a/g
// "new" creates a new object, old webkit buggy here
, CORRECT_NEW = new $RegExp(re1) !== re1;
if(__webpack_require__(3) && (!CORRECT_NEW || __webpack_require__(4)(function(){
re2[__webpack_require__(28)('match')] = false;
// RegExp constructor can alter flags and IsRegExp works correct with @@match
return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i';
}))){
$RegExp = function RegExp(p, f){
var piRE = isRegExp(p)
, fiU = f === undefined;
return !(this instanceof $RegExp) && piRE && p.constructor === $RegExp && fiU ? p
: CORRECT_NEW
? new Base(piRE && !fiU ? p.source : p, f)
: Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f);
};
$.each.call($.getNames(Base), function(key){
key in $RegExp || $.setDesc($RegExp, key, {
configurable: true,
get: function(){ return Base[key]; },
set: function(it){ Base[key] = it; }
});
});
proto.constructor = $RegExp;
$RegExp.prototype = proto;
__webpack_require__(15)(global, 'RegExp', $RegExp);
}
__webpack_require__(121)('RegExp');
/***/ },
/* 129 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// 21.2.5.3 get RegExp.prototype.flags
var anObject = __webpack_require__(30);
module.exports = function(){
var that = anObject(this)
, result = '';
if(that.global) result += 'g';
if(that.ignoreCase) result += 'i';
if(that.multiline) result += 'm';
if(that.unicode) result += 'u';
if(that.sticky) result += 'y';
return result;
};
/***/ },
/* 130 */
/***/ function(module, exports, __webpack_require__) {
// 21.2.5.3 get RegExp.prototype.flags()
var $ = __webpack_require__(2);
if(__webpack_require__(3) && /./g.flags != 'g')$.setDesc(RegExp.prototype, 'flags', {
configurable: true,
get: __webpack_require__(129)
});
/***/ },
/* 131 */
/***/ function(module, exports, __webpack_require__) {
// @@match logic
__webpack_require__(132)('match', 1, function(defined, MATCH){
// 21.1.3.11 String.prototype.match(regexp)
return function match(regexp){
'use strict';
var O = defined(this)
, fn = regexp == undefined ? undefined : regexp[MATCH];
return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
};
});
/***/ },
/* 132 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var hide = __webpack_require__(14)
, redef = __webpack_require__(15)
, fails = __webpack_require__(4)
, defined = __webpack_require__(23)
, wks = __webpack_require__(28);
module.exports = function(KEY, length, exec){
var SYMBOL = wks(KEY)
, original = ''[KEY];
if(fails(function(){
var O = {};
O[SYMBOL] = function(){ return 7; };
return ''[KEY](O) != 7;
})){
redef(String.prototype, KEY, exec(defined, SYMBOL, original));
hide(RegExp.prototype, SYMBOL, length == 2
// 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
// 21.2.5.11 RegExp.prototype[@@split](string, limit)
? function(string, arg){ return original.call(string, this, arg); }
// 21.2.5.6 RegExp.prototype[@@match](string)
// 21.2.5.9 RegExp.prototype[@@search](string)
: function(string){ return original.call(string, this); }
);
}
};
/***/ },
/* 133 */
/***/ function(module, exports, __webpack_require__) {
// @@replace logic
__webpack_require__(132)('replace', 2, function(defined, REPLACE, $replace){
// 21.1.3.14 String.prototype.replace(searchValue, replaceValue)
return function replace(searchValue, replaceValue){
'use strict';
var O = defined(this)
, fn = searchValue == undefined ? undefined : searchValue[REPLACE];
return fn !== undefined
? fn.call(searchValue, O, replaceValue)
: $replace.call(String(O), searchValue, replaceValue);
};
});
/***/ },
/* 134 */
/***/ function(module, exports, __webpack_require__) {
// @@search logic
__webpack_require__(132)('search', 1, function(defined, SEARCH){
// 21.1.3.15 String.prototype.search(regexp)
return function search(regexp){
'use strict';
var O = defined(this)
, fn = regexp == undefined ? undefined : regexp[SEARCH];
return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
};
});
/***/ },
/* 135 */
/***/ function(module, exports, __webpack_require__) {
// @@split logic
__webpack_require__(132)('split', 2, function(defined, SPLIT, $split){
// 21.1.3.17 String.prototype.split(separator, limit)
return function split(separator, limit){
'use strict';
var O = defined(this)
, fn = separator == undefined ? undefined : separator[SPLIT];
return fn !== undefined
? fn.call(separator, O, limit)
: $split.call(String(O), separator, limit);
};
});
/***/ },
/* 136 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(2)
, LIBRARY = __webpack_require__(39)
, global = __webpack_require__(7)
, ctx = __webpack_require__(19)
, classof = __webpack_require__(47)
, $def = __webpack_require__(12)
, isObject = __webpack_require__(9)
, anObject = __webpack_require__(30)
, aFunction = __webpack_require__(20)
, strictNew = __webpack_require__(137)
, forOf = __webpack_require__(138)
, setProto = __webpack_require__(45).set
, same = __webpack_require__(43)
, SPECIES = __webpack_require__(28)('species')
, speciesConstructor = __webpack_require__(139)
, RECORD = __webpack_require__(16)('record')
, asap = __webpack_require__(140)
, PROMISE = 'Promise'
, process = global.process
, isNode = classof(process) == 'process'
, P = global[PROMISE]
, Wrapper;
var testResolve = function(sub){
var test = new P(function(){});
if(sub)test.constructor = Object;
return P.resolve(test) === test;
};
var useNative = function(){
var works = false;
function P2(x){
var self = new P(x);
setProto(self, P2.prototype);
return self;
}
try {
works = P && P.resolve && testResolve();
setProto(P2, P);
P2.prototype = $.create(P.prototype, {constructor: {value: P2}});
// actual Firefox has broken subclass support, test that
if(!(P2.resolve(5).then(function(){}) instanceof P2)){
works = false;
}
// actual V8 bug, https://code.google.com/p/v8/issues/detail?id=4162
if(works && __webpack_require__(3)){
var thenableThenGotten = false;
P.resolve($.setDesc({}, 'then', {
get: function(){ thenableThenGotten = true; }
}));
works = thenableThenGotten;
}
} catch(e){ works = false; }
return works;
}();
// helpers
var isPromise = function(it){
return isObject(it) && (useNative ? classof(it) == 'Promise' : RECORD in it);
};
var sameConstructor = function(a, b){
// library wrapper special case
if(LIBRARY && a === P && b === Wrapper)return true;
return same(a, b);
};
var getConstructor = function(C){
var S = anObject(C)[SPECIES];
return S != undefined ? S : C;
};
var isThenable = function(it){
var then;
return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
};
var notify = function(record, isReject){
if(record.n)return;
record.n = true;
var chain = record.c;
asap(function(){
var value = record.v
, ok = record.s == 1
, i = 0;
var run = function(react){
var cb = ok ? react.ok : react.fail
, ret, then;
try {
if(cb){
if(!ok)record.h = true;
ret = cb === true ? value : cb(value);
if(ret === react.P){
react.rej(TypeError('Promise-chain cycle'));
} else if(then = isThenable(ret)){
then.call(ret, react.res, react.rej);
} else react.res(ret);
} else react.rej(value);
} catch(err){
react.rej(err);
}
};
while(chain.length > i)run(chain[i++]); // variable length - can't use forEach
chain.length = 0;
record.n = false;
if(isReject)setTimeout(function(){
var promise = record.p
, handler, console;
if(isUnhandled(promise)){
if(isNode){
process.emit('unhandledRejection', value, promise);
} else if(handler = global.onunhandledrejection){
handler({promise: promise, reason: value});
} else if((console = global.console) && console.error){
console.error('Unhandled promise rejection', value);
}
} record.a = undefined;
}, 1);
});
};
var isUnhandled = function(promise){
var record = promise[RECORD]
, chain = record.a || record.c
, i = 0
, react;
if(record.h)return false;
while(chain.length > i){
react = chain[i++];
if(react.fail || !isUnhandled(react.P))return false;
} return true;
};
var $reject = function(value){
var record = this;
if(record.d)return;
record.d = true;
record = record.r || record; // unwrap
record.v = value;
record.s = 2;
record.a = record.c.slice();
notify(record, true);
};
var $resolve = function(value){
var record = this
, then;
if(record.d)return;
record.d = true;
record = record.r || record; // unwrap
try {
if(then = isThenable(value)){
asap(function(){
var wrapper = {r: record, d: false}; // wrap
try {
then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
} catch(e){
$reject.call(wrapper, e);
}
});
} else {
record.v = value;
record.s = 1;
notify(record, false);
}
} catch(e){
$reject.call({r: record, d: false}, e); // wrap
}
};
// constructor polyfill
if(!useNative){
// 25.4.3.1 Promise(executor)
P = function Promise(executor){
aFunction(executor);
var record = {
p: strictNew(this, P, PROMISE), // <- promise
c: [], // <- awaiting reactions
a: undefined, // <- checked in isUnhandled reactions
s: 0, // <- state
d: false, // <- done
v: undefined, // <- value
h: false, // <- handled rejection
n: false // <- notify
};
this[RECORD] = record;
try {
executor(ctx($resolve, record, 1), ctx($reject, record, 1));
} catch(err){
$reject.call(record, err);
}
};
__webpack_require__(142)(P.prototype, {
// 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
then: function then(onFulfilled, onRejected){
var react = {
ok: typeof onFulfilled == 'function' ? onFulfilled : true,
fail: typeof onRejected == 'function' ? onRejected : false
};
var promise = react.P = new (speciesConstructor(this, P))(function(res, rej){
react.res = res;
react.rej = rej;
});
aFunction(react.res);
aFunction(react.rej);
var record = this[RECORD];
record.c.push(react);
if(record.a)record.a.push(react);
if(record.s)notify(record, false);
return promise;
},
// 25.4.5.1 Promise.prototype.catch(onRejected)
'catch': function(onRejected){
return this.then(undefined, onRejected);
}
});
}
// export
$def($def.G + $def.W + $def.F * !useNative, {Promise: P});
__webpack_require__(35)(P, PROMISE);
__webpack_require__(121)(PROMISE);
Wrapper = __webpack_require__(13)[PROMISE];
// statics
$def($def.S + $def.F * !useNative, PROMISE, {
// 25.4.4.5 Promise.reject(r)
reject: function reject(r){
return new this(function(res, rej){ rej(r); });
}
});
$def($def.S + $def.F * (!useNative || testResolve(true)), PROMISE, {
// 25.4.4.6 Promise.resolve(x)
resolve: function resolve(x){
return isPromise(x) && sameConstructor(x.constructor, this)
? x : new this(function(res){ res(x); });
}
});
$def($def.S + $def.F * !(useNative && __webpack_require__(115)(function(iter){
P.all(iter)['catch'](function(){});
})), PROMISE, {
// 25.4.4.1 Promise.all(iterable)
all: function all(iterable){
var C = getConstructor(this)
, values = [];
return new C(function(res, rej){
forOf(iterable, false, values.push, values);
var remaining = values.length
, results = Array(remaining);
if(remaining)$.each.call(values, function(promise, index){
C.resolve(promise).then(function(value){
results[index] = value;
--remaining || res(results);
}, rej);
});
else res(results);
});
},
// 25.4.4.4 Promise.race(iterable)
race: function race(iterable){
var C = getConstructor(this);
return new C(function(res, rej){
forOf(iterable, false, function(promise){
C.resolve(promise).then(res, rej);
});
});
}
});
/***/ },
/* 137 */
/***/ function(module, exports) {
module.exports = function(it, Constructor, name){
if(!(it instanceof Constructor))throw TypeError(name + ": use the 'new' operator!");
return it;
};
/***/ },
/* 138 */
/***/ function(module, exports, __webpack_require__) {
var ctx = __webpack_require__(19)
, call = __webpack_require__(112)
, isArrayIter = __webpack_require__(113)
, anObject = __webpack_require__(30)
, toLength = __webpack_require__(24)
, getIterFn = __webpack_require__(114);
module.exports = function(iterable, entries, fn, that){
var iterFn = getIterFn(iterable)
, f = ctx(fn, that, entries ? 2 : 1)
, index = 0
, length, step, iterator;
if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!');
// fast case for arrays with default iterator
if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){
entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
} else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){
call(iterator, f, step.value, entries);
}
};
/***/ },
/* 139 */
/***/ function(module, exports, __webpack_require__) {
// 7.3.20 SpeciesConstructor(O, defaultConstructor)
var anObject = __webpack_require__(30)
, aFunction = __webpack_require__(20)
, SPECIES = __webpack_require__(28)('species');
module.exports = function(O, D){
var C = anObject(O).constructor, S;
return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
};
/***/ },
/* 140 */
/***/ function(module, exports, __webpack_require__) {
var global = __webpack_require__(7)
, macrotask = __webpack_require__(141).set
, Observer = global.MutationObserver || global.WebKitMutationObserver
, process = global.process
, isNode = __webpack_require__(11)(process) == 'process'
, head, last, notify;
var flush = function(){
var parent, domain;
if(isNode && (parent = process.domain)){
process.domain = null;
parent.exit();
}
while(head){
domain = head.domain;
if(domain)domain.enter();
head.fn.call(); // <- currently we use it only for Promise - try / catch not required
if(domain)domain.exit();
head = head.next;
} last = undefined;
if(parent)parent.enter();
};
// Node.js
if(isNode){
notify = function(){
process.nextTick(flush);
};
// browsers with MutationObserver
} else if(Observer){
var toggle = 1
, node = document.createTextNode('');
new Observer(flush).observe(node, {characterData: true}); // eslint-disable-line no-new
notify = function(){
node.data = toggle = -toggle;
};
// for other environments - macrotask based on:
// - setImmediate
// - MessageChannel
// - window.postMessag
// - onreadystatechange
// - setTimeout
} else {
notify = function(){
// strange IE + webpack dev server bug - use .call(global)
macrotask.call(global, flush);
};
}
module.exports = function asap(fn){
var task = {fn: fn, next: undefined, domain: isNode && process.domain};
if(last)last.next = task;
if(!head){
head = task;
notify();
} last = task;
};
/***/ },
/* 141 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var ctx = __webpack_require__(19)
, invoke = __webpack_require__(17)
, html = __webpack_require__(6)
, cel = __webpack_require__(8)
, global = __webpack_require__(7)
, process = global.process
, setTask = global.setImmediate
, clearTask = global.clearImmediate
, MessageChannel = global.MessageChannel
, counter = 0
, queue = {}
, ONREADYSTATECHANGE = 'onreadystatechange'
, defer, channel, port;
var run = function(){
var id = +this;
if(queue.hasOwnProperty(id)){
var fn = queue[id];
delete queue[id];
fn();
}
};
var listner = function(event){
run.call(event.data);
};
// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
if(!setTask || !clearTask){
setTask = function setImmediate(fn){
var args = [], i = 1;
while(arguments.length > i)args.push(arguments[i++]);
queue[++counter] = function(){
invoke(typeof fn == 'function' ? fn : Function(fn), args);
};
defer(counter);
return counter;
};
clearTask = function clearImmediate(id){
delete queue[id];
};
// Node.js 0.8-
if(__webpack_require__(11)(process) == 'process'){
defer = function(id){
process.nextTick(ctx(run, id, 1));
};
// Browsers with MessageChannel, includes WebWorkers
} else if(MessageChannel){
channel = new MessageChannel;
port = channel.port2;
channel.port1.onmessage = listner;
defer = ctx(port.postMessage, port, 1);
// Browsers with postMessage, skip WebWorkers
// IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
} else if(global.addEventListener && typeof postMessage == 'function' && !global.importScripts){
defer = function(id){
global.postMessage(id + '', '*');
};
global.addEventListener('message', listner, false);
// IE8-
} else if(ONREADYSTATECHANGE in cel('script')){
defer = function(id){
html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function(){
html.removeChild(this);
run.call(id);
};
};
// Rest old browsers
} else {
defer = function(id){
setTimeout(ctx(run, id, 1), 0);
};
}
}
module.exports = {
set: setTask,
clear: clearTask
};
/***/ },
/* 142 */
/***/ function(module, exports, __webpack_require__) {
var $redef = __webpack_require__(15);
module.exports = function(target, src){
for(var key in src)$redef(target, key, src[key]);
return target;
};
/***/ },
/* 143 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var strong = __webpack_require__(144);
// 23.1 Map Objects
__webpack_require__(145)('Map', function(get){
return function Map(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
}, {
// 23.1.3.6 Map.prototype.get(key)
get: function get(key){
var entry = strong.getEntry(this, key);
return entry && entry.v;
},
// 23.1.3.9 Map.prototype.set(key, value)
set: function set(key, value){
return strong.def(this, key === 0 ? 0 : key, value);
}
}, strong, true);
/***/ },
/* 144 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(2)
, hide = __webpack_require__(14)
, mix = __webpack_require__(142)
, ctx = __webpack_require__(19)
, strictNew = __webpack_require__(137)
, defined = __webpack_require__(23)
, forOf = __webpack_require__(138)
, $iterDefine = __webpack_require__(108)
, step = __webpack_require__(119)
, ID = __webpack_require__(16)('id')
, $has = __webpack_require__(10)
, isObject = __webpack_require__(9)
, setSpecies = __webpack_require__(121)
, DESCRIPTORS = __webpack_require__(3)
, isExtensible = Object.isExtensible || isObject
, SIZE = DESCRIPTORS ? '_s' : 'size'
, id = 0;
var fastKey = function(it, create){
// return primitive with prefix
if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
if(!$has(it, ID)){
// can't set id to frozen object
if(!isExtensible(it))return 'F';
// not necessary to add id
if(!create)return 'E';
// add missing object id
hide(it, ID, ++id);
// return object id with prefix
} return 'O' + it[ID];
};
var getEntry = function(that, key){
// fast case
var index = fastKey(key), entry;
if(index !== 'F')return that._i[index];
// frozen object case
for(entry = that._f; entry; entry = entry.n){
if(entry.k == key)return entry;
}
};
module.exports = {
getConstructor: function(wrapper, NAME, IS_MAP, ADDER){
var C = wrapper(function(that, iterable){
strictNew(that, C, NAME);
that._i = $.create(null); // index
that._f = undefined; // first entry
that._l = undefined; // last entry
that[SIZE] = 0; // size
if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
});
mix(C.prototype, {
// 23.1.3.1 Map.prototype.clear()
// 23.2.3.2 Set.prototype.clear()
clear: function clear(){
for(var that = this, data = that._i, entry = that._f; entry; entry = entry.n){
entry.r = true;
if(entry.p)entry.p = entry.p.n = undefined;
delete data[entry.i];
}
that._f = that._l = undefined;
that[SIZE] = 0;
},
// 23.1.3.3 Map.prototype.delete(key)
// 23.2.3.4 Set.prototype.delete(value)
'delete': function(key){
var that = this
, entry = getEntry(that, key);
if(entry){
var next = entry.n
, prev = entry.p;
delete that._i[entry.i];
entry.r = true;
if(prev)prev.n = next;
if(next)next.p = prev;
if(that._f == entry)that._f = next;
if(that._l == entry)that._l = prev;
that[SIZE]--;
} return !!entry;
},
// 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
// 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
forEach: function forEach(callbackfn /*, that = undefined */){
var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3)
, entry;
while(entry = entry ? entry.n : this._f){
f(entry.v, entry.k, this);
// revert to the last existing entry
while(entry && entry.r)entry = entry.p;
}
},
// 23.1.3.7 Map.prototype.has(key)
// 23.2.3.7 Set.prototype.has(value)
has: function has(key){
return !!getEntry(this, key);
}
});
if(DESCRIPTORS)$.setDesc(C.prototype, 'size', {
get: function(){
return defined(this[SIZE]);
}
});
return C;
},
def: function(that, key, value){
var entry = getEntry(that, key)
, prev, index;
// change existing entry
if(entry){
entry.v = value;
// create new entry
} else {
that._l = entry = {
i: index = fastKey(key, true), // <- index
k: key, // <- key
v: value, // <- value
p: prev = that._l, // <- previous entry
n: undefined, // <- next entry
r: false // <- removed
};
if(!that._f)that._f = entry;
if(prev)prev.n = entry;
that[SIZE]++;
// add to index
if(index !== 'F')that._i[index] = entry;
} return that;
},
getEntry: getEntry,
setStrong: function(C, NAME, IS_MAP){
// add .keys, .values, .entries, [@@iterator]
// 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
$iterDefine(C, NAME, function(iterated, kind){
this._t = iterated; // target
this._k = kind; // kind
this._l = undefined; // previous
}, function(){
var that = this
, kind = that._k
, entry = that._l;
// revert to the last existing entry
while(entry && entry.r)entry = entry.p;
// get next entry
if(!that._t || !(that._l = entry = entry ? entry.n : that._t._f)){
// or finish the iteration
that._t = undefined;
return step(1);
}
// return step by kind
if(kind == 'keys' )return step(0, entry.k);
if(kind == 'values')return step(0, entry.v);
return step(0, [entry.k, entry.v]);
}, IS_MAP ? 'entries' : 'values' , !IS_MAP, true);
// add [@@species], 23.1.2.2, 23.2.2.2
setSpecies(NAME);
}
};
/***/ },
/* 145 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var global = __webpack_require__(7)
, $def = __webpack_require__(12)
, $redef = __webpack_require__(15)
, mix = __webpack_require__(142)
, forOf = __webpack_require__(138)
, strictNew = __webpack_require__(137)
, isObject = __webpack_require__(9)
, fails = __webpack_require__(4)
, $iterDetect = __webpack_require__(115)
, setToStringTag = __webpack_require__(35);
module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){
var Base = global[NAME]
, C = Base
, ADDER = IS_MAP ? 'set' : 'add'
, proto = C && C.prototype
, O = {};
var fixMethod = function(KEY){
var fn = proto[KEY];
$redef(proto, KEY,
KEY == 'delete' ? function(a){
return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
} : KEY == 'has' ? function has(a){
return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
} : KEY == 'get' ? function get(a){
return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a);
} : KEY == 'add' ? function add(a){ fn.call(this, a === 0 ? 0 : a); return this; }
: function set(a, b){ fn.call(this, a === 0 ? 0 : a, b); return this; }
);
};
if(typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function(){
new C().entries().next();
}))){
// create collection constructor
C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
mix(C.prototype, methods);
} else {
var instance = new C
// early implementations not supports chaining
, HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance
// V8 ~ Chromium 40- weak-collections throws on primitives, but should return false
, THROWS_ON_PRIMITIVES = fails(function(){ instance.has(1); })
// most early implementations doesn't supports iterables, most modern - not close it correctly
, ACCEPT_ITERABLES = $iterDetect(function(iter){ new C(iter); }) // eslint-disable-line no-new
// for early implementations -0 and +0 not the same
, BUGGY_ZERO;
if(!ACCEPT_ITERABLES){
C = wrapper(function(target, iterable){
strictNew(target, C, NAME);
var that = new Base;
if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
return that;
});
C.prototype = proto;
proto.constructor = C;
}
IS_WEAK || instance.forEach(function(val, key){
BUGGY_ZERO = 1 / key === -Infinity;
});
if(THROWS_ON_PRIMITIVES || BUGGY_ZERO){
fixMethod('delete');
fixMethod('has');
IS_MAP && fixMethod('get');
}
if(BUGGY_ZERO || HASNT_CHAINING)fixMethod(ADDER);
// weak collections should not contains .clear method
if(IS_WEAK && proto.clear)delete proto.clear;
}
setToStringTag(C, NAME);
O[NAME] = C;
$def($def.G + $def.W + $def.F * (C != Base), O);
if(!IS_WEAK)common.setStrong(C, NAME, IS_MAP);
return C;
};
/***/ },
/* 146 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var strong = __webpack_require__(144);
// 23.2 Set Objects
__webpack_require__(145)('Set', function(get){
return function Set(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
}, {
// 23.2.3.1 Set.prototype.add(value)
add: function add(value){
return strong.def(this, value = value === 0 ? 0 : value, value);
}
}, strong);
/***/ },
/* 147 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(2)
, redef = __webpack_require__(15)
, weak = __webpack_require__(148)
, isObject = __webpack_require__(9)
, has = __webpack_require__(10)
, frozenStore = weak.frozenStore
, WEAK = weak.WEAK
, isExtensible = Object.isExtensible || isObject
, tmp = {};
// 23.3 WeakMap Objects
var $WeakMap = __webpack_require__(145)('WeakMap', function(get){
return function WeakMap(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
}, {
// 23.3.3.3 WeakMap.prototype.get(key)
get: function get(key){
if(isObject(key)){
if(!isExtensible(key))return frozenStore(this).get(key);
if(has(key, WEAK))return key[WEAK][this._i];
}
},
// 23.3.3.5 WeakMap.prototype.set(key, value)
set: function set(key, value){
return weak.def(this, key, value);
}
}, weak, true, true);
// IE11 WeakMap frozen keys fix
if(new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7){
$.each.call(['delete', 'has', 'get', 'set'], function(key){
var proto = $WeakMap.prototype
, method = proto[key];
redef(proto, key, function(a, b){
// store frozen objects on leaky map
if(isObject(a) && !isExtensible(a)){
var result = frozenStore(this)[key](a, b);
return key == 'set' ? this : result;
// store all the rest on native weakmap
} return method.call(this, a, b);
});
});
}
/***/ },
/* 148 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var hide = __webpack_require__(14)
, mix = __webpack_require__(142)
, anObject = __webpack_require__(30)
, strictNew = __webpack_require__(137)
, forOf = __webpack_require__(138)
, method = __webpack_require__(18)
, WEAK = __webpack_require__(16)('weak')
, isObject = __webpack_require__(9)
, $has = __webpack_require__(10)
, isExtensible = Object.isExtensible || isObject
, find = method(5)
, findIndex = method(6)
, id = 0;
// fallback for frozen keys
var frozenStore = function(that){
return that._l || (that._l = new FrozenStore);
};
var FrozenStore = function(){
this.a = [];
};
var findFrozen = function(store, key){
return find(store.a, function(it){
return it[0] === key;
});
};
FrozenStore.prototype = {
get: function(key){
var entry = findFrozen(this, key);
if(entry)return entry[1];
},
has: function(key){
return !!findFrozen(this, key);
},
set: function(key, value){
var entry = findFrozen(this, key);
if(entry)entry[1] = value;
else this.a.push([key, value]);
},
'delete': function(key){
var index = findIndex(this.a, function(it){
return it[0] === key;
});
if(~index)this.a.splice(index, 1);
return !!~index;
}
};
module.exports = {
getConstructor: function(wrapper, NAME, IS_MAP, ADDER){
var C = wrapper(function(that, iterable){
strictNew(that, C, NAME);
that._i = id++; // collection id
that._l = undefined; // leak store for frozen objects
if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
});
mix(C.prototype, {
// 23.3.3.2 WeakMap.prototype.delete(key)
// 23.4.3.3 WeakSet.prototype.delete(value)
'delete': function(key){
if(!isObject(key))return false;
if(!isExtensible(key))return frozenStore(this)['delete'](key);
return $has(key, WEAK) && $has(key[WEAK], this._i) && delete key[WEAK][this._i];
},
// 23.3.3.4 WeakMap.prototype.has(key)
// 23.4.3.4 WeakSet.prototype.has(value)
has: function has(key){
if(!isObject(key))return false;
if(!isExtensible(key))return frozenStore(this).has(key);
return $has(key, WEAK) && $has(key[WEAK], this._i);
}
});
return C;
},
def: function(that, key, value){
if(!isExtensible(anObject(key))){
frozenStore(that).set(key, value);
} else {
$has(key, WEAK) || hide(key, WEAK, {});
key[WEAK][that._i] = value;
} return that;
},
frozenStore: frozenStore,
WEAK: WEAK
};
/***/ },
/* 149 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var weak = __webpack_require__(148);
// 23.4 WeakSet Objects
__webpack_require__(145)('WeakSet', function(get){
return function WeakSet(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
}, {
// 23.4.3.1 WeakSet.prototype.add(value)
add: function add(value){
return weak.def(this, value, true);
}
}, weak, false, true);
/***/ },
/* 150 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.1 Reflect.apply(target, thisArgument, argumentsList)
var $def = __webpack_require__(12)
, _apply = Function.apply;
$def($def.S, 'Reflect', {
apply: function apply(target, thisArgument, argumentsList){
return _apply.call(target, thisArgument, argumentsList);
}
});
/***/ },
/* 151 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.2 Reflect.construct(target, argumentsList [, newTarget])
var $ = __webpack_require__(2)
, $def = __webpack_require__(12)
, aFunction = __webpack_require__(20)
, anObject = __webpack_require__(30)
, isObject = __webpack_require__(9)
, bind = Function.bind || __webpack_require__(13).Function.prototype.bind;
// MS Edge supports only 2 arguments
// FF Nightly sets third argument as `new.target`, but does not create `this` from it
$def($def.S + $def.F * __webpack_require__(4)(function(){
function F(){}
return !(Reflect.construct(function(){}, [], F) instanceof F);
}), 'Reflect', {
construct: function construct(Target, args /*, newTarget*/){
aFunction(Target);
var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]);
if(Target == newTarget){
// w/o altered newTarget, optimization for 0-4 arguments
if(args != undefined)switch(anObject(args).length){
case 0: return new Target;
case 1: return new Target(args[0]);
case 2: return new Target(args[0], args[1]);
case 3: return new Target(args[0], args[1], args[2]);
case 4: return new Target(args[0], args[1], args[2], args[3]);
}
// w/o altered newTarget, lot of arguments case
var $args = [null];
$args.push.apply($args, args);
return new (bind.apply(Target, $args));
}
// with altered newTarget, not support built-in constructors
var proto = newTarget.prototype
, instance = $.create(isObject(proto) ? proto : Object.prototype)
, result = Function.apply.call(Target, instance, args);
return isObject(result) ? result : instance;
}
});
/***/ },
/* 152 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.3 Reflect.defineProperty(target, propertyKey, attributes)
var $ = __webpack_require__(2)
, $def = __webpack_require__(12)
, anObject = __webpack_require__(30);
// MS Edge has broken Reflect.defineProperty - throwing instead of returning false
$def($def.S + $def.F * __webpack_require__(4)(function(){
Reflect.defineProperty($.setDesc({}, 1, {value: 1}), 1, {value: 2});
}), 'Reflect', {
defineProperty: function defineProperty(target, propertyKey, attributes){
anObject(target);
try {
$.setDesc(target, propertyKey, attributes);
return true;
} catch(e){
return false;
}
}
});
/***/ },
/* 153 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.4 Reflect.deleteProperty(target, propertyKey)
var $def = __webpack_require__(12)
, getDesc = __webpack_require__(2).getDesc
, anObject = __webpack_require__(30);
$def($def.S, 'Reflect', {
deleteProperty: function deleteProperty(target, propertyKey){
var desc = getDesc(anObject(target), propertyKey);
return desc && !desc.configurable ? false : delete target[propertyKey];
}
});
/***/ },
/* 154 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// 26.1.5 Reflect.enumerate(target)
var $def = __webpack_require__(12)
, anObject = __webpack_require__(30);
var Enumerate = function(iterated){
this._t = anObject(iterated); // target
this._i = 0; // next index
var keys = this._k = [] // keys
, key;
for(key in iterated)keys.push(key);
};
__webpack_require__(110)(Enumerate, 'Object', function(){
var that = this
, keys = that._k
, key;
do {
if(that._i >= keys.length)return {value: undefined, done: true};
} while(!((key = keys[that._i++]) in that._t));
return {value: key, done: false};
});
$def($def.S, 'Reflect', {
enumerate: function enumerate(target){
return new Enumerate(target);
}
});
/***/ },
/* 155 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.6 Reflect.get(target, propertyKey [, receiver])
var $ = __webpack_require__(2)
, has = __webpack_require__(10)
, $def = __webpack_require__(12)
, isObject = __webpack_require__(9)
, anObject = __webpack_require__(30);
function get(target, propertyKey/*, receiver*/){
var receiver = arguments.length < 3 ? target : arguments[2]
, desc, proto;
if(anObject(target) === receiver)return target[propertyKey];
if(desc = $.getDesc(target, propertyKey))return has(desc, 'value')
? desc.value
: desc.get !== undefined
? desc.get.call(receiver)
: undefined;
if(isObject(proto = $.getProto(target)))return get(proto, propertyKey, receiver);
}
$def($def.S, 'Reflect', {get: get});
/***/ },
/* 156 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey)
var $ = __webpack_require__(2)
, $def = __webpack_require__(12)
, anObject = __webpack_require__(30);
$def($def.S, 'Reflect', {
getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey){
return $.getDesc(anObject(target), propertyKey);
}
});
/***/ },
/* 157 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.8 Reflect.getPrototypeOf(target)
var $def = __webpack_require__(12)
, getProto = __webpack_require__(2).getProto
, anObject = __webpack_require__(30);
$def($def.S, 'Reflect', {
getPrototypeOf: function getPrototypeOf(target){
return getProto(anObject(target));
}
});
/***/ },
/* 158 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.9 Reflect.has(target, propertyKey)
var $def = __webpack_require__(12);
$def($def.S, 'Reflect', {
has: function has(target, propertyKey){
return propertyKey in target;
}
});
/***/ },
/* 159 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.10 Reflect.isExtensible(target)
var $def = __webpack_require__(12)
, anObject = __webpack_require__(30)
, $isExtensible = Object.isExtensible;
$def($def.S, 'Reflect', {
isExtensible: function isExtensible(target){
anObject(target);
return $isExtensible ? $isExtensible(target) : true;
}
});
/***/ },
/* 160 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.11 Reflect.ownKeys(target)
var $def = __webpack_require__(12);
$def($def.S, 'Reflect', {ownKeys: __webpack_require__(161)});
/***/ },
/* 161 */
/***/ function(module, exports, __webpack_require__) {
// all object keys, includes non-enumerable and symbols
var $ = __webpack_require__(2)
, anObject = __webpack_require__(30)
, Reflect = __webpack_require__(7).Reflect;
module.exports = Reflect && Reflect.ownKeys || function ownKeys(it){
var keys = $.getNames(anObject(it))
, getSymbols = $.getSymbols;
return getSymbols ? keys.concat(getSymbols(it)) : keys;
};
/***/ },
/* 162 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.12 Reflect.preventExtensions(target)
var $def = __webpack_require__(12)
, anObject = __webpack_require__(30)
, $preventExtensions = Object.preventExtensions;
$def($def.S, 'Reflect', {
preventExtensions: function preventExtensions(target){
anObject(target);
try {
if($preventExtensions)$preventExtensions(target);
return true;
} catch(e){
return false;
}
}
});
/***/ },
/* 163 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.13 Reflect.set(target, propertyKey, V [, receiver])
var $ = __webpack_require__(2)
, has = __webpack_require__(10)
, $def = __webpack_require__(12)
, createDesc = __webpack_require__(5)
, anObject = __webpack_require__(30)
, isObject = __webpack_require__(9);
function set(target, propertyKey, V/*, receiver*/){
var receiver = arguments.length < 4 ? target : arguments[3]
, ownDesc = $.getDesc(anObject(target), propertyKey)
, existingDescriptor, proto;
if(!ownDesc){
if(isObject(proto = $.getProto(target))){
return set(proto, propertyKey, V, receiver);
}
ownDesc = createDesc(0);
}
if(has(ownDesc, 'value')){
if(ownDesc.writable === false || !isObject(receiver))return false;
existingDescriptor = $.getDesc(receiver, propertyKey) || createDesc(0);
existingDescriptor.value = V;
$.setDesc(receiver, propertyKey, existingDescriptor);
return true;
}
return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true);
}
$def($def.S, 'Reflect', {set: set});
/***/ },
/* 164 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.14 Reflect.setPrototypeOf(target, proto)
var $def = __webpack_require__(12)
, setProto = __webpack_require__(45);
if(setProto)$def($def.S, 'Reflect', {
setPrototypeOf: function setPrototypeOf(target, proto){
setProto.check(target, proto);
try {
setProto.set(target, proto);
return true;
} catch(e){
return false;
}
}
});
/***/ },
/* 165 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $def = __webpack_require__(12)
, $includes = __webpack_require__(33)(true);
$def($def.P, 'Array', {
// https://github.com/domenic/Array.prototype.includes
includes: function includes(el /*, fromIndex = 0 */){
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
}
});
__webpack_require__(118)('includes');
/***/ },
/* 166 */
/***/ function(module, exports, __webpack_require__) {
// https://github.com/mathiasbynens/String.prototype.at
'use strict';
var $def = __webpack_require__(12)
, $at = __webpack_require__(98)(true);
$def($def.P, 'String', {
at: function at(pos){
return $at(this, pos);
}
});
/***/ },
/* 167 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $def = __webpack_require__(12)
, $pad = __webpack_require__(168);
$def($def.P, 'String', {
padLeft: function padLeft(maxLength /*, fillString = ' ' */){
return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true);
}
});
/***/ },
/* 168 */
/***/ function(module, exports, __webpack_require__) {
// https://github.com/ljharb/proposal-string-pad-left-right
var toLength = __webpack_require__(24)
, repeat = __webpack_require__(105)
, defined = __webpack_require__(23);
module.exports = function(that, maxLength, fillString, left){
var S = String(defined(that))
, stringLength = S.length
, fillStr = fillString === undefined ? ' ' : String(fillString)
, intMaxLength = toLength(maxLength);
if(intMaxLength <= stringLength)return S;
if(fillStr == '')fillStr = ' ';
var fillLen = intMaxLength - stringLength
, stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length));
if(stringFiller.length > fillLen)stringFiller = stringFiller.slice(0, fillLen);
return left ? stringFiller + S : S + stringFiller;
};
/***/ },
/* 169 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $def = __webpack_require__(12)
, $pad = __webpack_require__(168);
$def($def.P, 'String', {
padRight: function padRight(maxLength /*, fillString = ' ' */){
return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false);
}
});
/***/ },
/* 170 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// https://github.com/sebmarkbage/ecmascript-string-left-right-trim
__webpack_require__(63)('trimLeft', function($trim){
return function trimLeft(){
return $trim(this, 1);
};
});
/***/ },
/* 171 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// https://github.com/sebmarkbage/ecmascript-string-left-right-trim
__webpack_require__(63)('trimRight', function($trim){
return function trimRight(){
return $trim(this, 2);
};
});
/***/ },
/* 172 */
/***/ function(module, exports, __webpack_require__) {
// https://github.com/benjamingr/RexExp.escape
var $def = __webpack_require__(12)
, $re = __webpack_require__(173)(/[\\^$*+?.()|[\]{}]/g, '\\$&');
$def($def.S, 'RegExp', {escape: function escape(it){ return $re(it); }});
/***/ },
/* 173 */
/***/ function(module, exports) {
module.exports = function(regExp, replace){
var replacer = replace === Object(replace) ? function(part){
return replace[part];
} : replace;
return function(it){
return String(it).replace(regExp, replacer);
};
};
/***/ },
/* 174 */
/***/ function(module, exports, __webpack_require__) {
// https://gist.github.com/WebReflection/9353781
var $ = __webpack_require__(2)
, $def = __webpack_require__(12)
, ownKeys = __webpack_require__(161)
, toIObject = __webpack_require__(31)
, createDesc = __webpack_require__(5);
$def($def.S, 'Object', {
getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object){
var O = toIObject(object)
, setDesc = $.setDesc
, getDesc = $.getDesc
, keys = ownKeys(O)
, result = {}
, i = 0
, key, D;
while(keys.length > i){
D = getDesc(O, key = keys[i++]);
if(key in result)setDesc(result, key, createDesc(0, D));
else result[key] = D;
} return result;
}
});
/***/ },
/* 175 */
/***/ function(module, exports, __webpack_require__) {
// http://goo.gl/XkBrjD
var $def = __webpack_require__(12)
, $values = __webpack_require__(176)(false);
$def($def.S, 'Object', {
values: function values(it){
return $values(it);
}
});
/***/ },
/* 176 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(2)
, toIObject = __webpack_require__(31)
, isEnum = $.isEnum;
module.exports = function(isEntries){
return function(it){
var O = toIObject(it)
, keys = $.getKeys(O)
, length = keys.length
, i = 0
, result = []
, key;
while(length > i)if(isEnum.call(O, key = keys[i++])){
result.push(isEntries ? [key, O[key]] : O[key]);
} return result;
};
};
/***/ },
/* 177 */
/***/ function(module, exports, __webpack_require__) {
// http://goo.gl/XkBrjD
var $def = __webpack_require__(12)
, $entries = __webpack_require__(176)(true);
$def($def.S, 'Object', {
entries: function entries(it){
return $entries(it);
}
});
/***/ },
/* 178 */
/***/ function(module, exports, __webpack_require__) {
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
var $def = __webpack_require__(12);
$def($def.P, 'Map', {toJSON: __webpack_require__(179)('Map')});
/***/ },
/* 179 */
/***/ function(module, exports, __webpack_require__) {
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
var forOf = __webpack_require__(138)
, classof = __webpack_require__(47);
module.exports = function(NAME){
return function toJSON(){
if(classof(this) != NAME)throw TypeError(NAME + "#toJSON isn't generic");
var arr = [];
forOf(this, false, arr.push, arr);
return arr;
};
};
/***/ },
/* 180 */
/***/ function(module, exports, __webpack_require__) {
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
var $def = __webpack_require__(12);
$def($def.P, 'Set', {toJSON: __webpack_require__(179)('Set')});
/***/ },
/* 181 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(12)
, $task = __webpack_require__(141);
$def($def.G + $def.B, {
setImmediate: $task.set,
clearImmediate: $task.clear
});
/***/ },
/* 182 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(117);
var global = __webpack_require__(7)
, hide = __webpack_require__(14)
, Iterators = __webpack_require__(109)
, ITERATOR = __webpack_require__(28)('iterator')
, NL = global.NodeList
, HTC = global.HTMLCollection
, NLProto = NL && NL.prototype
, HTCProto = HTC && HTC.prototype
, ArrayValues = Iterators.NodeList = Iterators.HTMLCollection = Iterators.Array;
if(NL && !(ITERATOR in NLProto))hide(NLProto, ITERATOR, ArrayValues);
if(HTC && !(ITERATOR in HTCProto))hide(HTCProto, ITERATOR, ArrayValues);
/***/ },
/* 183 */
/***/ function(module, exports, __webpack_require__) {
// ie9- setTimeout & setInterval additional parameters fix
var global = __webpack_require__(7)
, $def = __webpack_require__(12)
, invoke = __webpack_require__(17)
, partial = __webpack_require__(184)
, navigator = global.navigator
, MSIE = !!navigator && /MSIE .\./.test(navigator.userAgent); // <- dirty ie9- check
var wrap = function(set){
return MSIE ? function(fn, time /*, ...args */){
return set(invoke(
partial,
[].slice.call(arguments, 2),
typeof fn == 'function' ? fn : Function(fn)
), time);
} : set;
};
$def($def.G + $def.B + $def.F * MSIE, {
setTimeout: wrap(global.setTimeout),
setInterval: wrap(global.setInterval)
});
/***/ },
/* 184 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var path = __webpack_require__(185)
, invoke = __webpack_require__(17)
, aFunction = __webpack_require__(20);
module.exports = function(/* ...pargs */){
var fn = aFunction(this)
, length = arguments.length
, pargs = Array(length)
, i = 0
, _ = path._
, holder = false;
while(length > i)if((pargs[i] = arguments[i++]) === _)holder = true;
return function(/* ...args */){
var that = this
, $$ = arguments
, $$len = $$.length
, j = 0, k = 0, args;
if(!holder && !$$len)return invoke(fn, pargs, that);
args = pargs.slice();
if(holder)for(;length > j; j++)if(args[j] === _)args[j] = $$[k++];
while($$len > k)args.push($$[k++]);
return invoke(fn, args, that);
};
};
/***/ },
/* 185 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(7);
/***/ },
/* 186 */
/***/ function(module, exports, __webpack_require__) {
// JavaScript 1.6 / Strawman array statics shim
var $ = __webpack_require__(2)
, $def = __webpack_require__(12)
, $ctx = __webpack_require__(19)
, $Array = __webpack_require__(13).Array || Array
, statics = {};
var setStatics = function(keys, length){
$.each.call(keys.split(','), function(key){
if(length == undefined && key in $Array)statics[key] = $Array[key];
else if(key in [])statics[key] = $ctx(Function.call, [][key], length);
});
};
setStatics('pop,reverse,shift,keys,values,entries', 1);
setStatics('indexOf,every,some,forEach,map,filter,find,findIndex,includes', 3);
setStatics('join,slice,concat,push,splice,unshift,sort,lastIndexOf,' +
'reduce,reduceRight,copyWithin,fill');
$def($def.S, 'Array', statics);
/***/ }
/******/ ]);
// CommonJS export
if(typeof module != 'undefined' && module.exports)module.exports = __e;
// RequireJS export
else if(typeof define == 'function' && define.amd)define(function(){return __e});
// Export to global object
else __g.core = __e;
}(1, 1);
|
src/components/about/index.js
|
mich8060/portfolio
|
import React from 'react'
import './about.scss'
import Container from '../container/'
import Display from '../display/'
import Heading from '../heading/'
import List from '../list/'
import Role from '../role/'
import Subtitle from '../subtitle/'
function About(){
return(
<Container>
<Subtitle>About</Subtitle>
<Display>I am currently a Sr. Product Designer at <a href="http://www.pluralsight.com/" target="_blank" rel="noopener noreferrer">Pluralsight</a>, a Freelancer from <span>time-to-time</span> and an Adjunct Professor.</Display>
<Heading theme="dark">
Check the list below to see some of the skills I've obtained throughout
the years. You can always <a href="mailto:mich8060@hotmail.com" target="_blank" rel="noopener noreferrer">email me</a> to learn more.
</Heading>
<List>
<div className="list--column">
<div className="list--title">Education</div>
<Role title="Adjunct Professor" timeline="Weber State University – Aug 2020 to Present" />
<Role title="Sr. Product Designer" timeline="Pluralsight.com – July 2016 to Present" />
<Role title="Principal Designer" timeline="Backcountry.com – January 2015 to July 2016" />
<Role title="Sr. User Experience Design Manager" timeline="Backcountry.com – November 2014 to January 2015" />
<Role title="Sr. User Experience Designer" timeline="Backcountry.com – June 2012 - November 2014" />
<Role title="Product Manager" timeline="Backcountry.com – June 2012 - January 2013" />
<Role title="Sr. User Experience Designer" timeline="Skullcandy – July 2011 - June 2012" />
<Role title="User Experience Designer" timeline="Backcountry.com – April 2008 - July 2011" />
<Role title="Rapid Prototype Developer" timeline="Backcountry.com – August 2007 - April 2008" />
<Role title="Graphic Designer" timeline="Backcountry.com – July 2006 - August 2007" />
<Role title="Front End Developer" timeline="Backcountry.com – March 2004 - July 2006" />
</div>
<div className="list--column">
<div className="list--title">Education</div>
<Role title="Weber State University" timeline="BFA, Visual Communications" />
<Role title="Ogden Applied Technology College" timeline="Technical Associates Degree, Multimedia & Web Development" />
<div className="list--title">Skills</div>
<Role title="Design" timeline="Layout Hierarchy, Typography, Color Theory, Branding, Adobe Creative Suite, Creative Thinking and Design System Creation." />
<Role title="Technology" timeline="HTML5, CSS, SASS, jQuery, PHP, SQL, JavaScript, Node, React.js, Vue.js" />
<Role title="Research" timeline="Usability Testing, Survey Composition, Analytics Technologies, User Interviews, Persona Development." />
<Role title="Product Management" timeline="Analytics, OKR creation & management, Executive & Stakeholder communications & presentation, Public Speaking and Strategy Development." />
<Role title="Servant Leadership & Management" timeline="1:1 Communication, Career Growth, active listening, problem solving, conflict management, interpersonal relationship development and mentorship." />
</div>
</List>
</Container>
)
}
export default About
|
node_modules/react-router/es6/IndexLink.js
|
geng890518/editor-ui
|
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; };
import React from 'react';
import Link from './Link';
/**
* An <IndexLink> is used to link to an <IndexRoute>.
*/
var IndexLink = React.createClass({
displayName: 'IndexLink',
render: function render() {
return React.createElement(Link, _extends({}, this.props, { onlyActiveOnIndex: true }));
}
});
export default IndexLink;
|
app/components/Settings/components/sounds-panel.js
|
builtwithluv/ZenFocus
|
import React from 'react';
import PropTypes from 'prop-types';
import { Checkbox } from '@blueprintjs/core';
const SoundsPanel = ({
audioPhaseDisabled,
audioTickDisabled,
onSettingsChange,
toggleAudioPhase,
toggleAudioTick,
className
}) => (
<div className={className}>
<Checkbox
label="Play ticking sound"
checked={!audioTickDisabled}
onChange={e =>
onSettingsChange(
'sounds.audioTickDisabled',
!e.target.checked,
toggleAudioTick
)
}
/>
<Checkbox
label="Play sound when phase ends"
checked={!audioPhaseDisabled}
onChange={e =>
onSettingsChange(
'sounds.audioPhaseDisabled',
!e.target.checked,
toggleAudioPhase
)
}
/>
</div>
);
SoundsPanel.displayName = 'Settings.SoundsPanel';
SoundsPanel.propTypes = {
audioPhaseDisabled: PropTypes.bool.isRequired,
audioTickDisabled: PropTypes.bool.isRequired,
onSettingsChange: PropTypes.func.isRequired,
toggleAudioPhase: PropTypes.func.isRequired,
toggleAudioTick: PropTypes.func.isRequired,
className: PropTypes.string
};
export default SoundsPanel;
|
node_modules/react-bootstrap/es/InputGroup.js
|
saltypaul/SnipTodo
|
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 InputGroupAddon from './InputGroupAddon';
import InputGroupButton from './InputGroupButton';
import { bsClass, bsSizes, getClassSet, splitBsProps } from './utils/bootstrapUtils';
import { Size } from './utils/StyleConfig';
var InputGroup = function (_React$Component) {
_inherits(InputGroup, _React$Component);
function InputGroup() {
_classCallCheck(this, InputGroup);
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
}
InputGroup.prototype.render = function render() {
var _props = this.props,
className = _props.className,
props = _objectWithoutProperties(_props, ['className']);
var _splitBsProps = splitBsProps(props),
bsProps = _splitBsProps[0],
elementProps = _splitBsProps[1];
var classes = getClassSet(bsProps);
return React.createElement('span', _extends({}, elementProps, {
className: classNames(className, classes)
}));
};
return InputGroup;
}(React.Component);
InputGroup.Addon = InputGroupAddon;
InputGroup.Button = InputGroupButton;
export default bsClass('input-group', bsSizes([Size.LARGE, Size.SMALL], InputGroup));
|
src/CardPanel.js
|
15lyfromsaturn/react-materialize
|
import React from 'react';
import cx from 'classnames';
const CardPanel = ({
className,
children,
...props
}) => {
const classes = {
'card-panel': true
};
return (
<div className={cx(classes, className)} {...props}>
{children}
</div>
);
};
export default CardPanel;
|
ajax/libs/swagger-ui/3.44.1/swagger-ui-standalone-preset.js
|
cdnjs/cdnjs
|
/*! For license information please see swagger-ui-standalone-preset.js.LICENSE.txt */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(function(){try{return require("esprima")}catch(t){}}()):"function"==typeof define&&define.amd?define(["esprima"],e):"object"==typeof exports?exports.SwaggerUIStandalonePreset=e(function(){try{return require("esprima")}catch(t){}}()):t.SwaggerUIStandalonePreset=e(t.esprima)}(this,(function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist",n(n.s=243)}([function(t,e,n){t.exports=function(){"use strict";var t=Array.prototype.slice;function e(t,e){e&&(t.prototype=Object.create(e.prototype)),t.prototype.constructor=t}function n(t){return u(t)?t:J(t)}function r(t){return s(t)?t:Z(t)}function i(t){return a(t)?t:V(t)}function o(t){return u(t)&&!c(t)?t:X(t)}function u(t){return!(!t||!t[l])}function s(t){return!(!t||!t[p])}function a(t){return!(!t||!t[h])}function c(t){return s(t)||a(t)}function f(t){return!(!t||!t[d])}e(r,n),e(i,n),e(o,n),n.isIterable=u,n.isKeyed=s,n.isIndexed=a,n.isAssociative=c,n.isOrdered=f,n.Keyed=r,n.Indexed=i,n.Set=o;var l="@@__IMMUTABLE_ITERABLE__@@",p="@@__IMMUTABLE_KEYED__@@",h="@@__IMMUTABLE_INDEXED__@@",d="@@__IMMUTABLE_ORDERED__@@",y="delete",v=5,g=1<<v,w=g-1,M={},_={value:!1},m={value:!1};function L(t){return t.value=!1,t}function x(t){t&&(t.value=!0)}function b(){}function j(t,e){e=e||0;for(var n=Math.max(0,t.length-e),r=new Array(n),i=0;i<n;i++)r[i]=t[i+e];return r}function N(t){return void 0===t.size&&(t.size=t.__iterate(D)),t.size}function S(t,e){if("number"!=typeof e){var n=e>>>0;if(""+n!==e||4294967295===n)return NaN;e=n}return e<0?N(t)+e:e}function D(){return!0}function I(t,e,n){return(0===t||void 0!==n&&t<=-n)&&(void 0===e||void 0!==n&&e>=n)}function A(t,e){return E(t,e,0)}function O(t,e){return E(t,e,e)}function E(t,e,n){return void 0===t?n:t<0?Math.max(0,e+t):void 0===e?t:Math.min(e,t)}var C=0,T=1,z=2,k="function"==typeof Symbol&&Symbol.iterator,U="@@iterator",Y=k||U;function P(t){this.next=t}function R(t,e,n,r){var i=0===t?e:1===t?n:[e,n];return r?r.value=i:r={value:i,done:!1},r}function Q(){return{value:void 0,done:!0}}function F(t){return!!W(t)}function B(t){return t&&"function"==typeof t.next}function G(t){var e=W(t);return e&&e.call(t)}function W(t){var e=t&&(k&&t[k]||t[U]);if("function"==typeof e)return e}function q(t){return t&&"number"==typeof t.length}function J(t){return null==t?ut():u(t)?t.toSeq():ct(t)}function Z(t){return null==t?ut().toKeyedSeq():u(t)?s(t)?t.toSeq():t.fromEntrySeq():st(t)}function V(t){return null==t?ut():u(t)?s(t)?t.entrySeq():t.toIndexedSeq():at(t)}function X(t){return(null==t?ut():u(t)?s(t)?t.entrySeq():t:at(t)).toSetSeq()}P.prototype.toString=function(){return"[Iterator]"},P.KEYS=C,P.VALUES=T,P.ENTRIES=z,P.prototype.inspect=P.prototype.toSource=function(){return this.toString()},P.prototype[Y]=function(){return this},e(J,n),J.of=function(){return J(arguments)},J.prototype.toSeq=function(){return this},J.prototype.toString=function(){return this.__toString("Seq {","}")},J.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},J.prototype.__iterate=function(t,e){return lt(this,t,e,!0)},J.prototype.__iterator=function(t,e){return pt(this,t,e,!0)},e(Z,J),Z.prototype.toKeyedSeq=function(){return this},e(V,J),V.of=function(){return V(arguments)},V.prototype.toIndexedSeq=function(){return this},V.prototype.toString=function(){return this.__toString("Seq [","]")},V.prototype.__iterate=function(t,e){return lt(this,t,e,!1)},V.prototype.__iterator=function(t,e){return pt(this,t,e,!1)},e(X,J),X.of=function(){return X(arguments)},X.prototype.toSetSeq=function(){return this},J.isSeq=ot,J.Keyed=Z,J.Set=X,J.Indexed=V;var H,K,$,tt="@@__IMMUTABLE_SEQ__@@";function et(t){this._array=t,this.size=t.length}function nt(t){var e=Object.keys(t);this._object=t,this._keys=e,this.size=e.length}function rt(t){this._iterable=t,this.size=t.length||t.size}function it(t){this._iterator=t,this._iteratorCache=[]}function ot(t){return!(!t||!t[tt])}function ut(){return H||(H=new et([]))}function st(t){var e=Array.isArray(t)?new et(t).fromEntrySeq():B(t)?new it(t).fromEntrySeq():F(t)?new rt(t).fromEntrySeq():"object"==typeof t?new nt(t):void 0;if(!e)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+t);return e}function at(t){var e=ft(t);if(!e)throw new TypeError("Expected Array or iterable object of values: "+t);return e}function ct(t){var e=ft(t)||"object"==typeof t&&new nt(t);if(!e)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+t);return e}function ft(t){return q(t)?new et(t):B(t)?new it(t):F(t)?new rt(t):void 0}function lt(t,e,n,r){var i=t._cache;if(i){for(var o=i.length-1,u=0;u<=o;u++){var s=i[n?o-u:u];if(!1===e(s[1],r?s[0]:u,t))return u+1}return u}return t.__iterateUncached(e,n)}function pt(t,e,n,r){var i=t._cache;if(i){var o=i.length-1,u=0;return new P((function(){var t=i[n?o-u:u];return u++>o?Q():R(e,r?t[0]:u-1,t[1])}))}return t.__iteratorUncached(e,n)}function ht(t,e){return e?dt(e,t,"",{"":t}):yt(t)}function dt(t,e,n,r){return Array.isArray(e)?t.call(r,n,V(e).map((function(n,r){return dt(t,n,r,e)}))):vt(e)?t.call(r,n,Z(e).map((function(n,r){return dt(t,n,r,e)}))):e}function yt(t){return Array.isArray(t)?V(t).map(yt).toList():vt(t)?Z(t).map(yt).toMap():t}function vt(t){return t&&(t.constructor===Object||void 0===t.constructor)}function gt(t,e){if(t===e||t!=t&&e!=e)return!0;if(!t||!e)return!1;if("function"==typeof t.valueOf&&"function"==typeof e.valueOf){if((t=t.valueOf())===(e=e.valueOf())||t!=t&&e!=e)return!0;if(!t||!e)return!1}return!("function"!=typeof t.equals||"function"!=typeof e.equals||!t.equals(e))}function wt(t,e){if(t===e)return!0;if(!u(e)||void 0!==t.size&&void 0!==e.size&&t.size!==e.size||void 0!==t.__hash&&void 0!==e.__hash&&t.__hash!==e.__hash||s(t)!==s(e)||a(t)!==a(e)||f(t)!==f(e))return!1;if(0===t.size&&0===e.size)return!0;var n=!c(t);if(f(t)){var r=t.entries();return e.every((function(t,e){var i=r.next().value;return i&>(i[1],t)&&(n||gt(i[0],e))}))&&r.next().done}var i=!1;if(void 0===t.size)if(void 0===e.size)"function"==typeof t.cacheResult&&t.cacheResult();else{i=!0;var o=t;t=e,e=o}var l=!0,p=e.__iterate((function(e,r){if(n?!t.has(e):i?!gt(e,t.get(r,M)):!gt(t.get(r,M),e))return l=!1,!1}));return l&&t.size===p}function Mt(t,e){if(!(this instanceof Mt))return new Mt(t,e);if(this._value=t,this.size=void 0===e?1/0:Math.max(0,e),0===this.size){if(K)return K;K=this}}function _t(t,e){if(!t)throw new Error(e)}function mt(t,e,n){if(!(this instanceof mt))return new mt(t,e,n);if(_t(0!==n,"Cannot step a Range by 0"),t=t||0,void 0===e&&(e=1/0),n=void 0===n?1:Math.abs(n),e<t&&(n=-n),this._start=t,this._end=e,this._step=n,this.size=Math.max(0,Math.ceil((e-t)/n-1)+1),0===this.size){if($)return $;$=this}}function Lt(){throw TypeError("Abstract")}function xt(){}function bt(){}function jt(){}J.prototype[tt]=!0,e(et,V),et.prototype.get=function(t,e){return this.has(t)?this._array[S(this,t)]:e},et.prototype.__iterate=function(t,e){for(var n=this._array,r=n.length-1,i=0;i<=r;i++)if(!1===t(n[e?r-i:i],i,this))return i+1;return i},et.prototype.__iterator=function(t,e){var n=this._array,r=n.length-1,i=0;return new P((function(){return i>r?Q():R(t,i,n[e?r-i++:i++])}))},e(nt,Z),nt.prototype.get=function(t,e){return void 0===e||this.has(t)?this._object[t]:e},nt.prototype.has=function(t){return this._object.hasOwnProperty(t)},nt.prototype.__iterate=function(t,e){for(var n=this._object,r=this._keys,i=r.length-1,o=0;o<=i;o++){var u=r[e?i-o:o];if(!1===t(n[u],u,this))return o+1}return o},nt.prototype.__iterator=function(t,e){var n=this._object,r=this._keys,i=r.length-1,o=0;return new P((function(){var u=r[e?i-o:o];return o++>i?Q():R(t,u,n[u])}))},nt.prototype[d]=!0,e(rt,V),rt.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);var n=G(this._iterable),r=0;if(B(n))for(var i;!(i=n.next()).done&&!1!==t(i.value,r++,this););return r},rt.prototype.__iteratorUncached=function(t,e){if(e)return this.cacheResult().__iterator(t,e);var n=G(this._iterable);if(!B(n))return new P(Q);var r=0;return new P((function(){var e=n.next();return e.done?e:R(t,r++,e.value)}))},e(it,V),it.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);for(var n,r=this._iterator,i=this._iteratorCache,o=0;o<i.length;)if(!1===t(i[o],o++,this))return o;for(;!(n=r.next()).done;){var u=n.value;if(i[o]=u,!1===t(u,o++,this))break}return o},it.prototype.__iteratorUncached=function(t,e){if(e)return this.cacheResult().__iterator(t,e);var n=this._iterator,r=this._iteratorCache,i=0;return new P((function(){if(i>=r.length){var e=n.next();if(e.done)return e;r[i]=e.value}return R(t,i,r[i++])}))},e(Mt,V),Mt.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},Mt.prototype.get=function(t,e){return this.has(t)?this._value:e},Mt.prototype.includes=function(t){return gt(this._value,t)},Mt.prototype.slice=function(t,e){var n=this.size;return I(t,e,n)?this:new Mt(this._value,O(e,n)-A(t,n))},Mt.prototype.reverse=function(){return this},Mt.prototype.indexOf=function(t){return gt(this._value,t)?0:-1},Mt.prototype.lastIndexOf=function(t){return gt(this._value,t)?this.size:-1},Mt.prototype.__iterate=function(t,e){for(var n=0;n<this.size;n++)if(!1===t(this._value,n,this))return n+1;return n},Mt.prototype.__iterator=function(t,e){var n=this,r=0;return new P((function(){return r<n.size?R(t,r++,n._value):Q()}))},Mt.prototype.equals=function(t){return t instanceof Mt?gt(this._value,t._value):wt(t)},e(mt,V),mt.prototype.toString=function(){return 0===this.size?"Range []":"Range [ "+this._start+"..."+this._end+(1!==this._step?" by "+this._step:"")+" ]"},mt.prototype.get=function(t,e){return this.has(t)?this._start+S(this,t)*this._step:e},mt.prototype.includes=function(t){var e=(t-this._start)/this._step;return e>=0&&e<this.size&&e===Math.floor(e)},mt.prototype.slice=function(t,e){return I(t,e,this.size)?this:(t=A(t,this.size),(e=O(e,this.size))<=t?new mt(0,0):new mt(this.get(t,this._end),this.get(e,this._end),this._step))},mt.prototype.indexOf=function(t){var e=t-this._start;if(e%this._step==0){var n=e/this._step;if(n>=0&&n<this.size)return n}return-1},mt.prototype.lastIndexOf=function(t){return this.indexOf(t)},mt.prototype.__iterate=function(t,e){for(var n=this.size-1,r=this._step,i=e?this._start+n*r:this._start,o=0;o<=n;o++){if(!1===t(i,o,this))return o+1;i+=e?-r:r}return o},mt.prototype.__iterator=function(t,e){var n=this.size-1,r=this._step,i=e?this._start+n*r:this._start,o=0;return new P((function(){var u=i;return i+=e?-r:r,o>n?Q():R(t,o++,u)}))},mt.prototype.equals=function(t){return t instanceof mt?this._start===t._start&&this._end===t._end&&this._step===t._step:wt(this,t)},e(Lt,n),e(xt,Lt),e(bt,Lt),e(jt,Lt),Lt.Keyed=xt,Lt.Indexed=bt,Lt.Set=jt;var Nt="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(t,e){var n=65535&(t|=0),r=65535&(e|=0);return n*r+((t>>>16)*r+n*(e>>>16)<<16>>>0)|0};function St(t){return t>>>1&1073741824|3221225471&t}function Dt(t){if(!1===t||null==t)return 0;if("function"==typeof t.valueOf&&(!1===(t=t.valueOf())||null==t))return 0;if(!0===t)return 1;var e=typeof t;if("number"===e){if(t!=t||t===1/0)return 0;var n=0|t;for(n!==t&&(n^=4294967295*t);t>4294967295;)n^=t/=4294967295;return St(n)}if("string"===e)return t.length>Pt?It(t):At(t);if("function"==typeof t.hashCode)return t.hashCode();if("object"===e)return Ot(t);if("function"==typeof t.toString)return At(t.toString());throw new Error("Value type "+e+" cannot be hashed.")}function It(t){var e=Ft[t];return void 0===e&&(e=At(t),Qt===Rt&&(Qt=0,Ft={}),Qt++,Ft[t]=e),e}function At(t){for(var e=0,n=0;n<t.length;n++)e=31*e+t.charCodeAt(n)|0;return St(e)}function Ot(t){var e;if(kt&&void 0!==(e=zt.get(t)))return e;if(void 0!==(e=t[Yt]))return e;if(!Ct){if(void 0!==(e=t.propertyIsEnumerable&&t.propertyIsEnumerable[Yt]))return e;if(void 0!==(e=Tt(t)))return e}if(e=++Ut,1073741824&Ut&&(Ut=0),kt)zt.set(t,e);else{if(void 0!==Et&&!1===Et(t))throw new Error("Non-extensible objects are not allowed as keys.");if(Ct)Object.defineProperty(t,Yt,{enumerable:!1,configurable:!1,writable:!1,value:e});else if(void 0!==t.propertyIsEnumerable&&t.propertyIsEnumerable===t.constructor.prototype.propertyIsEnumerable)t.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},t.propertyIsEnumerable[Yt]=e;else{if(void 0===t.nodeType)throw new Error("Unable to set a non-enumerable property on object.");t[Yt]=e}}return e}var Et=Object.isExtensible,Ct=function(){try{return Object.defineProperty({},"@",{}),!0}catch(t){return!1}}();function Tt(t){if(t&&t.nodeType>0)switch(t.nodeType){case 1:return t.uniqueID;case 9:return t.documentElement&&t.documentElement.uniqueID}}var zt,kt="function"==typeof WeakMap;kt&&(zt=new WeakMap);var Ut=0,Yt="__immutablehash__";"function"==typeof Symbol&&(Yt=Symbol(Yt));var Pt=16,Rt=255,Qt=0,Ft={};function Bt(t){_t(t!==1/0,"Cannot perform this action with an infinite size.")}function Gt(t){return null==t?ie():Wt(t)&&!f(t)?t:ie().withMutations((function(e){var n=r(t);Bt(n.size),n.forEach((function(t,n){return e.set(n,t)}))}))}function Wt(t){return!(!t||!t[Jt])}e(Gt,xt),Gt.of=function(){var e=t.call(arguments,0);return ie().withMutations((function(t){for(var n=0;n<e.length;n+=2){if(n+1>=e.length)throw new Error("Missing value for key: "+e[n]);t.set(e[n],e[n+1])}}))},Gt.prototype.toString=function(){return this.__toString("Map {","}")},Gt.prototype.get=function(t,e){return this._root?this._root.get(0,void 0,t,e):e},Gt.prototype.set=function(t,e){return oe(this,t,e)},Gt.prototype.setIn=function(t,e){return this.updateIn(t,M,(function(){return e}))},Gt.prototype.remove=function(t){return oe(this,t,M)},Gt.prototype.deleteIn=function(t){return this.updateIn(t,(function(){return M}))},Gt.prototype.update=function(t,e,n){return 1===arguments.length?t(this):this.updateIn([t],e,n)},Gt.prototype.updateIn=function(t,e,n){n||(n=e,e=void 0);var r=ve(this,Ln(t),e,n);return r===M?void 0:r},Gt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):ie()},Gt.prototype.merge=function(){return pe(this,void 0,arguments)},Gt.prototype.mergeWith=function(e){return pe(this,e,t.call(arguments,1))},Gt.prototype.mergeIn=function(e){var n=t.call(arguments,1);return this.updateIn(e,ie(),(function(t){return"function"==typeof t.merge?t.merge.apply(t,n):n[n.length-1]}))},Gt.prototype.mergeDeep=function(){return pe(this,he,arguments)},Gt.prototype.mergeDeepWith=function(e){var n=t.call(arguments,1);return pe(this,de(e),n)},Gt.prototype.mergeDeepIn=function(e){var n=t.call(arguments,1);return this.updateIn(e,ie(),(function(t){return"function"==typeof t.mergeDeep?t.mergeDeep.apply(t,n):n[n.length-1]}))},Gt.prototype.sort=function(t){return Fe(ln(this,t))},Gt.prototype.sortBy=function(t,e){return Fe(ln(this,e,t))},Gt.prototype.withMutations=function(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this},Gt.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new b)},Gt.prototype.asImmutable=function(){return this.__ensureOwner()},Gt.prototype.wasAltered=function(){return this.__altered},Gt.prototype.__iterator=function(t,e){return new te(this,t,e)},Gt.prototype.__iterate=function(t,e){var n=this,r=0;return this._root&&this._root.iterate((function(e){return r++,t(e[1],e[0],n)}),e),r},Gt.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?re(this.size,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},Gt.isMap=Wt;var qt,Jt="@@__IMMUTABLE_MAP__@@",Zt=Gt.prototype;function Vt(t,e){this.ownerID=t,this.entries=e}function Xt(t,e,n){this.ownerID=t,this.bitmap=e,this.nodes=n}function Ht(t,e,n){this.ownerID=t,this.count=e,this.nodes=n}function Kt(t,e,n){this.ownerID=t,this.keyHash=e,this.entries=n}function $t(t,e,n){this.ownerID=t,this.keyHash=e,this.entry=n}function te(t,e,n){this._type=e,this._reverse=n,this._stack=t._root&&ne(t._root)}function ee(t,e){return R(t,e[0],e[1])}function ne(t,e){return{node:t,index:0,__prev:e}}function re(t,e,n,r){var i=Object.create(Zt);return i.size=t,i._root=e,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function ie(){return qt||(qt=re(0))}function oe(t,e,n){var r,i;if(t._root){var o=L(_),u=L(m);if(r=ue(t._root,t.__ownerID,0,void 0,e,n,o,u),!u.value)return t;i=t.size+(o.value?n===M?-1:1:0)}else{if(n===M)return t;i=1,r=new Vt(t.__ownerID,[[e,n]])}return t.__ownerID?(t.size=i,t._root=r,t.__hash=void 0,t.__altered=!0,t):r?re(i,r):ie()}function ue(t,e,n,r,i,o,u,s){return t?t.update(e,n,r,i,o,u,s):o===M?t:(x(s),x(u),new $t(e,r,[i,o]))}function se(t){return t.constructor===$t||t.constructor===Kt}function ae(t,e,n,r,i){if(t.keyHash===r)return new Kt(e,r,[t.entry,i]);var o,u=(0===n?t.keyHash:t.keyHash>>>n)&w,s=(0===n?r:r>>>n)&w;return new Xt(e,1<<u|1<<s,u===s?[ae(t,e,n+v,r,i)]:(o=new $t(e,r,i),u<s?[t,o]:[o,t]))}function ce(t,e,n,r){t||(t=new b);for(var i=new $t(t,Dt(n),[n,r]),o=0;o<e.length;o++){var u=e[o];i=i.update(t,0,void 0,u[0],u[1])}return i}function fe(t,e,n,r){for(var i=0,o=0,u=new Array(n),s=0,a=1,c=e.length;s<c;s++,a<<=1){var f=e[s];void 0!==f&&s!==r&&(i|=a,u[o++]=f)}return new Xt(t,i,u)}function le(t,e,n,r,i){for(var o=0,u=new Array(g),s=0;0!==n;s++,n>>>=1)u[s]=1&n?e[o++]:void 0;return u[r]=i,new Ht(t,o+1,u)}function pe(t,e,n){for(var i=[],o=0;o<n.length;o++){var s=n[o],a=r(s);u(s)||(a=a.map((function(t){return ht(t)}))),i.push(a)}return ye(t,e,i)}function he(t,e,n){return t&&t.mergeDeep&&u(e)?t.mergeDeep(e):gt(t,e)?t:e}function de(t){return function(e,n,r){if(e&&e.mergeDeepWith&&u(n))return e.mergeDeepWith(t,n);var i=t(e,n,r);return gt(e,i)?e:i}}function ye(t,e,n){return 0===(n=n.filter((function(t){return 0!==t.size}))).length?t:0!==t.size||t.__ownerID||1!==n.length?t.withMutations((function(t){for(var r=e?function(n,r){t.update(r,M,(function(t){return t===M?n:e(t,n,r)}))}:function(e,n){t.set(n,e)},i=0;i<n.length;i++)n[i].forEach(r)})):t.constructor(n[0])}function ve(t,e,n,r){var i=t===M,o=e.next();if(o.done){var u=i?n:t,s=r(u);return s===u?t:s}_t(i||t&&t.set,"invalid keyPath");var a=o.value,c=i?M:t.get(a,M),f=ve(c,e,n,r);return f===c?t:f===M?t.remove(a):(i?ie():t).set(a,f)}function ge(t){return t=(t=(858993459&(t-=t>>1&1431655765))+(t>>2&858993459))+(t>>4)&252645135,t+=t>>8,127&(t+=t>>16)}function we(t,e,n,r){var i=r?t:j(t);return i[e]=n,i}function Me(t,e,n,r){var i=t.length+1;if(r&&e+1===i)return t[e]=n,t;for(var o=new Array(i),u=0,s=0;s<i;s++)s===e?(o[s]=n,u=-1):o[s]=t[s+u];return o}function _e(t,e,n){var r=t.length-1;if(n&&e===r)return t.pop(),t;for(var i=new Array(r),o=0,u=0;u<r;u++)u===e&&(o=1),i[u]=t[u+o];return i}Zt[Jt]=!0,Zt[y]=Zt.remove,Zt.removeIn=Zt.deleteIn,Vt.prototype.get=function(t,e,n,r){for(var i=this.entries,o=0,u=i.length;o<u;o++)if(gt(n,i[o][0]))return i[o][1];return r},Vt.prototype.update=function(t,e,n,r,i,o,u){for(var s=i===M,a=this.entries,c=0,f=a.length;c<f&&!gt(r,a[c][0]);c++);var l=c<f;if(l?a[c][1]===i:s)return this;if(x(u),(s||!l)&&x(o),!s||1!==a.length){if(!l&&!s&&a.length>=me)return ce(t,a,r,i);var p=t&&t===this.ownerID,h=p?a:j(a);return l?s?c===f-1?h.pop():h[c]=h.pop():h[c]=[r,i]:h.push([r,i]),p?(this.entries=h,this):new Vt(t,h)}},Xt.prototype.get=function(t,e,n,r){void 0===e&&(e=Dt(n));var i=1<<((0===t?e:e>>>t)&w),o=this.bitmap;return 0==(o&i)?r:this.nodes[ge(o&i-1)].get(t+v,e,n,r)},Xt.prototype.update=function(t,e,n,r,i,o,u){void 0===n&&(n=Dt(r));var s=(0===e?n:n>>>e)&w,a=1<<s,c=this.bitmap,f=0!=(c&a);if(!f&&i===M)return this;var l=ge(c&a-1),p=this.nodes,h=f?p[l]:void 0,d=ue(h,t,e+v,n,r,i,o,u);if(d===h)return this;if(!f&&d&&p.length>=Le)return le(t,p,c,s,d);if(f&&!d&&2===p.length&&se(p[1^l]))return p[1^l];if(f&&d&&1===p.length&&se(d))return d;var y=t&&t===this.ownerID,g=f?d?c:c^a:c|a,_=f?d?we(p,l,d,y):_e(p,l,y):Me(p,l,d,y);return y?(this.bitmap=g,this.nodes=_,this):new Xt(t,g,_)},Ht.prototype.get=function(t,e,n,r){void 0===e&&(e=Dt(n));var i=(0===t?e:e>>>t)&w,o=this.nodes[i];return o?o.get(t+v,e,n,r):r},Ht.prototype.update=function(t,e,n,r,i,o,u){void 0===n&&(n=Dt(r));var s=(0===e?n:n>>>e)&w,a=i===M,c=this.nodes,f=c[s];if(a&&!f)return this;var l=ue(f,t,e+v,n,r,i,o,u);if(l===f)return this;var p=this.count;if(f){if(!l&&--p<xe)return fe(t,c,p,s)}else p++;var h=t&&t===this.ownerID,d=we(c,s,l,h);return h?(this.count=p,this.nodes=d,this):new Ht(t,p,d)},Kt.prototype.get=function(t,e,n,r){for(var i=this.entries,o=0,u=i.length;o<u;o++)if(gt(n,i[o][0]))return i[o][1];return r},Kt.prototype.update=function(t,e,n,r,i,o,u){void 0===n&&(n=Dt(r));var s=i===M;if(n!==this.keyHash)return s?this:(x(u),x(o),ae(this,t,e,n,[r,i]));for(var a=this.entries,c=0,f=a.length;c<f&&!gt(r,a[c][0]);c++);var l=c<f;if(l?a[c][1]===i:s)return this;if(x(u),(s||!l)&&x(o),s&&2===f)return new $t(t,this.keyHash,a[1^c]);var p=t&&t===this.ownerID,h=p?a:j(a);return l?s?c===f-1?h.pop():h[c]=h.pop():h[c]=[r,i]:h.push([r,i]),p?(this.entries=h,this):new Kt(t,this.keyHash,h)},$t.prototype.get=function(t,e,n,r){return gt(n,this.entry[0])?this.entry[1]:r},$t.prototype.update=function(t,e,n,r,i,o,u){var s=i===M,a=gt(r,this.entry[0]);return(a?i===this.entry[1]:s)?this:(x(u),s?void x(o):a?t&&t===this.ownerID?(this.entry[1]=i,this):new $t(t,this.keyHash,[r,i]):(x(o),ae(this,t,e,Dt(r),[r,i])))},Vt.prototype.iterate=Kt.prototype.iterate=function(t,e){for(var n=this.entries,r=0,i=n.length-1;r<=i;r++)if(!1===t(n[e?i-r:r]))return!1},Xt.prototype.iterate=Ht.prototype.iterate=function(t,e){for(var n=this.nodes,r=0,i=n.length-1;r<=i;r++){var o=n[e?i-r:r];if(o&&!1===o.iterate(t,e))return!1}},$t.prototype.iterate=function(t,e){return t(this.entry)},e(te,P),te.prototype.next=function(){for(var t=this._type,e=this._stack;e;){var n,r=e.node,i=e.index++;if(r.entry){if(0===i)return ee(t,r.entry)}else if(r.entries){if(i<=(n=r.entries.length-1))return ee(t,r.entries[this._reverse?n-i:i])}else if(i<=(n=r.nodes.length-1)){var o=r.nodes[this._reverse?n-i:i];if(o){if(o.entry)return ee(t,o.entry);e=this._stack=ne(o,e)}continue}e=this._stack=this._stack.__prev}return Q()};var me=g/4,Le=g/2,xe=g/4;function be(t){var e=Te();if(null==t)return e;if(je(t))return t;var n=i(t),r=n.size;return 0===r?e:(Bt(r),r>0&&r<g?Ce(0,r,v,null,new De(n.toArray())):e.withMutations((function(t){t.setSize(r),n.forEach((function(e,n){return t.set(n,e)}))})))}function je(t){return!(!t||!t[Ne])}e(be,bt),be.of=function(){return this(arguments)},be.prototype.toString=function(){return this.__toString("List [","]")},be.prototype.get=function(t,e){if((t=S(this,t))>=0&&t<this.size){var n=Ye(this,t+=this._origin);return n&&n.array[t&w]}return e},be.prototype.set=function(t,e){return ze(this,t,e)},be.prototype.remove=function(t){return this.has(t)?0===t?this.shift():t===this.size-1?this.pop():this.splice(t,1):this},be.prototype.insert=function(t,e){return this.splice(t,0,e)},be.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=v,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):Te()},be.prototype.push=function(){var t=arguments,e=this.size;return this.withMutations((function(n){Pe(n,0,e+t.length);for(var r=0;r<t.length;r++)n.set(e+r,t[r])}))},be.prototype.pop=function(){return Pe(this,0,-1)},be.prototype.unshift=function(){var t=arguments;return this.withMutations((function(e){Pe(e,-t.length);for(var n=0;n<t.length;n++)e.set(n,t[n])}))},be.prototype.shift=function(){return Pe(this,1)},be.prototype.merge=function(){return Re(this,void 0,arguments)},be.prototype.mergeWith=function(e){return Re(this,e,t.call(arguments,1))},be.prototype.mergeDeep=function(){return Re(this,he,arguments)},be.prototype.mergeDeepWith=function(e){var n=t.call(arguments,1);return Re(this,de(e),n)},be.prototype.setSize=function(t){return Pe(this,0,t)},be.prototype.slice=function(t,e){var n=this.size;return I(t,e,n)?this:Pe(this,A(t,n),O(e,n))},be.prototype.__iterator=function(t,e){var n=0,r=Ee(this,e);return new P((function(){var e=r();return e===Oe?Q():R(t,n++,e)}))},be.prototype.__iterate=function(t,e){for(var n,r=0,i=Ee(this,e);(n=i())!==Oe&&!1!==t(n,r++,this););return r},be.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?Ce(this._origin,this._capacity,this._level,this._root,this._tail,t,this.__hash):(this.__ownerID=t,this)},be.isList=je;var Ne="@@__IMMUTABLE_LIST__@@",Se=be.prototype;function De(t,e){this.array=t,this.ownerID=e}Se[Ne]=!0,Se[y]=Se.remove,Se.setIn=Zt.setIn,Se.deleteIn=Se.removeIn=Zt.removeIn,Se.update=Zt.update,Se.updateIn=Zt.updateIn,Se.mergeIn=Zt.mergeIn,Se.mergeDeepIn=Zt.mergeDeepIn,Se.withMutations=Zt.withMutations,Se.asMutable=Zt.asMutable,Se.asImmutable=Zt.asImmutable,Se.wasAltered=Zt.wasAltered,De.prototype.removeBefore=function(t,e,n){if(n===e?1<<e:0===this.array.length)return this;var r=n>>>e&w;if(r>=this.array.length)return new De([],t);var i,o=0===r;if(e>0){var u=this.array[r];if((i=u&&u.removeBefore(t,e-v,n))===u&&o)return this}if(o&&!i)return this;var s=Ue(this,t);if(!o)for(var a=0;a<r;a++)s.array[a]=void 0;return i&&(s.array[r]=i),s},De.prototype.removeAfter=function(t,e,n){if(n===(e?1<<e:0)||0===this.array.length)return this;var r,i=n-1>>>e&w;if(i>=this.array.length)return this;if(e>0){var o=this.array[i];if((r=o&&o.removeAfter(t,e-v,n))===o&&i===this.array.length-1)return this}var u=Ue(this,t);return u.array.splice(i+1),r&&(u.array[i]=r),u};var Ie,Ae,Oe={};function Ee(t,e){var n=t._origin,r=t._capacity,i=Qe(r),o=t._tail;return u(t._root,t._level,0);function u(t,e,n){return 0===e?s(t,n):a(t,e,n)}function s(t,u){var s=u===i?o&&o.array:t&&t.array,a=u>n?0:n-u,c=r-u;return c>g&&(c=g),function(){if(a===c)return Oe;var t=e?--c:a++;return s&&s[t]}}function a(t,i,o){var s,a=t&&t.array,c=o>n?0:n-o>>i,f=1+(r-o>>i);return f>g&&(f=g),function(){for(;;){if(s){var t=s();if(t!==Oe)return t;s=null}if(c===f)return Oe;var n=e?--f:c++;s=u(a&&a[n],i-v,o+(n<<i))}}}}function Ce(t,e,n,r,i,o,u){var s=Object.create(Se);return s.size=e-t,s._origin=t,s._capacity=e,s._level=n,s._root=r,s._tail=i,s.__ownerID=o,s.__hash=u,s.__altered=!1,s}function Te(){return Ie||(Ie=Ce(0,0,v))}function ze(t,e,n){if((e=S(t,e))!=e)return t;if(e>=t.size||e<0)return t.withMutations((function(t){e<0?Pe(t,e).set(0,n):Pe(t,0,e+1).set(e,n)}));e+=t._origin;var r=t._tail,i=t._root,o=L(m);return e>=Qe(t._capacity)?r=ke(r,t.__ownerID,0,e,n,o):i=ke(i,t.__ownerID,t._level,e,n,o),o.value?t.__ownerID?(t._root=i,t._tail=r,t.__hash=void 0,t.__altered=!0,t):Ce(t._origin,t._capacity,t._level,i,r):t}function ke(t,e,n,r,i,o){var u,s=r>>>n&w,a=t&&s<t.array.length;if(!a&&void 0===i)return t;if(n>0){var c=t&&t.array[s],f=ke(c,e,n-v,r,i,o);return f===c?t:((u=Ue(t,e)).array[s]=f,u)}return a&&t.array[s]===i?t:(x(o),u=Ue(t,e),void 0===i&&s===u.array.length-1?u.array.pop():u.array[s]=i,u)}function Ue(t,e){return e&&t&&e===t.ownerID?t:new De(t?t.array.slice():[],e)}function Ye(t,e){if(e>=Qe(t._capacity))return t._tail;if(e<1<<t._level+v){for(var n=t._root,r=t._level;n&&r>0;)n=n.array[e>>>r&w],r-=v;return n}}function Pe(t,e,n){void 0!==e&&(e|=0),void 0!==n&&(n|=0);var r=t.__ownerID||new b,i=t._origin,o=t._capacity,u=i+e,s=void 0===n?o:n<0?o+n:i+n;if(u===i&&s===o)return t;if(u>=s)return t.clear();for(var a=t._level,c=t._root,f=0;u+f<0;)c=new De(c&&c.array.length?[void 0,c]:[],r),f+=1<<(a+=v);f&&(u+=f,i+=f,s+=f,o+=f);for(var l=Qe(o),p=Qe(s);p>=1<<a+v;)c=new De(c&&c.array.length?[c]:[],r),a+=v;var h=t._tail,d=p<l?Ye(t,s-1):p>l?new De([],r):h;if(h&&p>l&&u<o&&h.array.length){for(var y=c=Ue(c,r),g=a;g>v;g-=v){var M=l>>>g&w;y=y.array[M]=Ue(y.array[M],r)}y.array[l>>>v&w]=h}if(s<o&&(d=d&&d.removeAfter(r,0,s)),u>=p)u-=p,s-=p,a=v,c=null,d=d&&d.removeBefore(r,0,u);else if(u>i||p<l){for(f=0;c;){var _=u>>>a&w;if(_!==p>>>a&w)break;_&&(f+=(1<<a)*_),a-=v,c=c.array[_]}c&&u>i&&(c=c.removeBefore(r,a,u-f)),c&&p<l&&(c=c.removeAfter(r,a,p-f)),f&&(u-=f,s-=f)}return t.__ownerID?(t.size=s-u,t._origin=u,t._capacity=s,t._level=a,t._root=c,t._tail=d,t.__hash=void 0,t.__altered=!0,t):Ce(u,s,a,c,d)}function Re(t,e,n){for(var r=[],o=0,s=0;s<n.length;s++){var a=n[s],c=i(a);c.size>o&&(o=c.size),u(a)||(c=c.map((function(t){return ht(t)}))),r.push(c)}return o>t.size&&(t=t.setSize(o)),ye(t,e,r)}function Qe(t){return t<g?0:t-1>>>v<<v}function Fe(t){return null==t?We():Be(t)?t:We().withMutations((function(e){var n=r(t);Bt(n.size),n.forEach((function(t,n){return e.set(n,t)}))}))}function Be(t){return Wt(t)&&f(t)}function Ge(t,e,n,r){var i=Object.create(Fe.prototype);return i.size=t?t.size:0,i._map=t,i._list=e,i.__ownerID=n,i.__hash=r,i}function We(){return Ae||(Ae=Ge(ie(),Te()))}function qe(t,e,n){var r,i,o=t._map,u=t._list,s=o.get(e),a=void 0!==s;if(n===M){if(!a)return t;u.size>=g&&u.size>=2*o.size?(r=(i=u.filter((function(t,e){return void 0!==t&&s!==e}))).toKeyedSeq().map((function(t){return t[0]})).flip().toMap(),t.__ownerID&&(r.__ownerID=i.__ownerID=t.__ownerID)):(r=o.remove(e),i=s===u.size-1?u.pop():u.set(s,void 0))}else if(a){if(n===u.get(s)[1])return t;r=o,i=u.set(s,[e,n])}else r=o.set(e,u.size),i=u.set(u.size,[e,n]);return t.__ownerID?(t.size=r.size,t._map=r,t._list=i,t.__hash=void 0,t):Ge(r,i)}function Je(t,e){this._iter=t,this._useKeys=e,this.size=t.size}function Ze(t){this._iter=t,this.size=t.size}function Ve(t){this._iter=t,this.size=t.size}function Xe(t){this._iter=t,this.size=t.size}function He(t){var e=Mn(t);return e._iter=t,e.size=t.size,e.flip=function(){return t},e.reverse=function(){var e=t.reverse.apply(this);return e.flip=function(){return t.reverse()},e},e.has=function(e){return t.includes(e)},e.includes=function(e){return t.has(e)},e.cacheResult=_n,e.__iterateUncached=function(e,n){var r=this;return t.__iterate((function(t,n){return!1!==e(n,t,r)}),n)},e.__iteratorUncached=function(e,n){if(e===z){var r=t.__iterator(e,n);return new P((function(){var t=r.next();if(!t.done){var e=t.value[0];t.value[0]=t.value[1],t.value[1]=e}return t}))}return t.__iterator(e===T?C:T,n)},e}function Ke(t,e,n){var r=Mn(t);return r.size=t.size,r.has=function(e){return t.has(e)},r.get=function(r,i){var o=t.get(r,M);return o===M?i:e.call(n,o,r,t)},r.__iterateUncached=function(r,i){var o=this;return t.__iterate((function(t,i,u){return!1!==r(e.call(n,t,i,u),i,o)}),i)},r.__iteratorUncached=function(r,i){var o=t.__iterator(z,i);return new P((function(){var i=o.next();if(i.done)return i;var u=i.value,s=u[0];return R(r,s,e.call(n,u[1],s,t),i)}))},r}function $e(t,e){var n=Mn(t);return n._iter=t,n.size=t.size,n.reverse=function(){return t},t.flip&&(n.flip=function(){var e=He(t);return e.reverse=function(){return t.flip()},e}),n.get=function(n,r){return t.get(e?n:-1-n,r)},n.has=function(n){return t.has(e?n:-1-n)},n.includes=function(e){return t.includes(e)},n.cacheResult=_n,n.__iterate=function(e,n){var r=this;return t.__iterate((function(t,n){return e(t,n,r)}),!n)},n.__iterator=function(e,n){return t.__iterator(e,!n)},n}function tn(t,e,n,r){var i=Mn(t);return r&&(i.has=function(r){var i=t.get(r,M);return i!==M&&!!e.call(n,i,r,t)},i.get=function(r,i){var o=t.get(r,M);return o!==M&&e.call(n,o,r,t)?o:i}),i.__iterateUncached=function(i,o){var u=this,s=0;return t.__iterate((function(t,o,a){if(e.call(n,t,o,a))return s++,i(t,r?o:s-1,u)}),o),s},i.__iteratorUncached=function(i,o){var u=t.__iterator(z,o),s=0;return new P((function(){for(;;){var o=u.next();if(o.done)return o;var a=o.value,c=a[0],f=a[1];if(e.call(n,f,c,t))return R(i,r?c:s++,f,o)}}))},i}function en(t,e,n){var r=Gt().asMutable();return t.__iterate((function(i,o){r.update(e.call(n,i,o,t),0,(function(t){return t+1}))})),r.asImmutable()}function nn(t,e,n){var r=s(t),i=(f(t)?Fe():Gt()).asMutable();t.__iterate((function(o,u){i.update(e.call(n,o,u,t),(function(t){return(t=t||[]).push(r?[u,o]:o),t}))}));var o=wn(t);return i.map((function(e){return yn(t,o(e))}))}function rn(t,e,n,r){var i=t.size;if(void 0!==e&&(e|=0),void 0!==n&&(n===1/0?n=i:n|=0),I(e,n,i))return t;var o=A(e,i),u=O(n,i);if(o!=o||u!=u)return rn(t.toSeq().cacheResult(),e,n,r);var s,a=u-o;a==a&&(s=a<0?0:a);var c=Mn(t);return c.size=0===s?s:t.size&&s||void 0,!r&&ot(t)&&s>=0&&(c.get=function(e,n){return(e=S(this,e))>=0&&e<s?t.get(e+o,n):n}),c.__iterateUncached=function(e,n){var i=this;if(0===s)return 0;if(n)return this.cacheResult().__iterate(e,n);var u=0,a=!0,c=0;return t.__iterate((function(t,n){if(!a||!(a=u++<o))return c++,!1!==e(t,r?n:c-1,i)&&c!==s})),c},c.__iteratorUncached=function(e,n){if(0!==s&&n)return this.cacheResult().__iterator(e,n);var i=0!==s&&t.__iterator(e,n),u=0,a=0;return new P((function(){for(;u++<o;)i.next();if(++a>s)return Q();var t=i.next();return r||e===T?t:R(e,a-1,e===C?void 0:t.value[1],t)}))},c}function on(t,e,n){var r=Mn(t);return r.__iterateUncached=function(r,i){var o=this;if(i)return this.cacheResult().__iterate(r,i);var u=0;return t.__iterate((function(t,i,s){return e.call(n,t,i,s)&&++u&&r(t,i,o)})),u},r.__iteratorUncached=function(r,i){var o=this;if(i)return this.cacheResult().__iterator(r,i);var u=t.__iterator(z,i),s=!0;return new P((function(){if(!s)return Q();var t=u.next();if(t.done)return t;var i=t.value,a=i[0],c=i[1];return e.call(n,c,a,o)?r===z?t:R(r,a,c,t):(s=!1,Q())}))},r}function un(t,e,n,r){var i=Mn(t);return i.__iterateUncached=function(i,o){var u=this;if(o)return this.cacheResult().__iterate(i,o);var s=!0,a=0;return t.__iterate((function(t,o,c){if(!s||!(s=e.call(n,t,o,c)))return a++,i(t,r?o:a-1,u)})),a},i.__iteratorUncached=function(i,o){var u=this;if(o)return this.cacheResult().__iterator(i,o);var s=t.__iterator(z,o),a=!0,c=0;return new P((function(){var t,o,f;do{if((t=s.next()).done)return r||i===T?t:R(i,c++,i===C?void 0:t.value[1],t);var l=t.value;o=l[0],f=l[1],a&&(a=e.call(n,f,o,u))}while(a);return i===z?t:R(i,o,f,t)}))},i}function sn(t,e){var n=s(t),i=[t].concat(e).map((function(t){return u(t)?n&&(t=r(t)):t=n?st(t):at(Array.isArray(t)?t:[t]),t})).filter((function(t){return 0!==t.size}));if(0===i.length)return t;if(1===i.length){var o=i[0];if(o===t||n&&s(o)||a(t)&&a(o))return o}var c=new et(i);return n?c=c.toKeyedSeq():a(t)||(c=c.toSetSeq()),(c=c.flatten(!0)).size=i.reduce((function(t,e){if(void 0!==t){var n=e.size;if(void 0!==n)return t+n}}),0),c}function an(t,e,n){var r=Mn(t);return r.__iterateUncached=function(r,i){var o=0,s=!1;function a(t,c){var f=this;t.__iterate((function(t,i){return(!e||c<e)&&u(t)?a(t,c+1):!1===r(t,n?i:o++,f)&&(s=!0),!s}),i)}return a(t,0),o},r.__iteratorUncached=function(r,i){var o=t.__iterator(r,i),s=[],a=0;return new P((function(){for(;o;){var t=o.next();if(!1===t.done){var c=t.value;if(r===z&&(c=c[1]),e&&!(s.length<e)||!u(c))return n?t:R(r,a++,c,t);s.push(o),o=c.__iterator(r,i)}else o=s.pop()}return Q()}))},r}function cn(t,e,n){var r=wn(t);return t.toSeq().map((function(i,o){return r(e.call(n,i,o,t))})).flatten(!0)}function fn(t,e){var n=Mn(t);return n.size=t.size&&2*t.size-1,n.__iterateUncached=function(n,r){var i=this,o=0;return t.__iterate((function(t,r){return(!o||!1!==n(e,o++,i))&&!1!==n(t,o++,i)}),r),o},n.__iteratorUncached=function(n,r){var i,o=t.__iterator(T,r),u=0;return new P((function(){return(!i||u%2)&&(i=o.next()).done?i:u%2?R(n,u++,e):R(n,u++,i.value,i)}))},n}function ln(t,e,n){e||(e=mn);var r=s(t),i=0,o=t.toSeq().map((function(e,r){return[r,e,i++,n?n(e,r,t):e]})).toArray();return o.sort((function(t,n){return e(t[3],n[3])||t[2]-n[2]})).forEach(r?function(t,e){o[e].length=2}:function(t,e){o[e]=t[1]}),r?Z(o):a(t)?V(o):X(o)}function pn(t,e,n){if(e||(e=mn),n){var r=t.toSeq().map((function(e,r){return[e,n(e,r,t)]})).reduce((function(t,n){return hn(e,t[1],n[1])?n:t}));return r&&r[0]}return t.reduce((function(t,n){return hn(e,t,n)?n:t}))}function hn(t,e,n){var r=t(n,e);return 0===r&&n!==e&&(null==n||n!=n)||r>0}function dn(t,e,r){var i=Mn(t);return i.size=new et(r).map((function(t){return t.size})).min(),i.__iterate=function(t,e){for(var n,r=this.__iterator(T,e),i=0;!(n=r.next()).done&&!1!==t(n.value,i++,this););return i},i.__iteratorUncached=function(t,i){var o=r.map((function(t){return t=n(t),G(i?t.reverse():t)})),u=0,s=!1;return new P((function(){var n;return s||(n=o.map((function(t){return t.next()})),s=n.some((function(t){return t.done}))),s?Q():R(t,u++,e.apply(null,n.map((function(t){return t.value}))))}))},i}function yn(t,e){return ot(t)?e:t.constructor(e)}function vn(t){if(t!==Object(t))throw new TypeError("Expected [K, V] tuple: "+t)}function gn(t){return Bt(t.size),N(t)}function wn(t){return s(t)?r:a(t)?i:o}function Mn(t){return Object.create((s(t)?Z:a(t)?V:X).prototype)}function _n(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):J.prototype.cacheResult.call(this)}function mn(t,e){return t>e?1:t<e?-1:0}function Ln(t){var e=G(t);if(!e){if(!q(t))throw new TypeError("Expected iterable or array-like: "+t);e=G(n(t))}return e}function xn(t,e){var n,r=function(o){if(o instanceof r)return o;if(!(this instanceof r))return new r(o);if(!n){n=!0;var u=Object.keys(t);Sn(i,u),i.size=u.length,i._name=e,i._keys=u,i._defaultValues=t}this._map=Gt(o)},i=r.prototype=Object.create(bn);return i.constructor=r,r}e(Fe,Gt),Fe.of=function(){return this(arguments)},Fe.prototype.toString=function(){return this.__toString("OrderedMap {","}")},Fe.prototype.get=function(t,e){var n=this._map.get(t);return void 0!==n?this._list.get(n)[1]:e},Fe.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):We()},Fe.prototype.set=function(t,e){return qe(this,t,e)},Fe.prototype.remove=function(t){return qe(this,t,M)},Fe.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},Fe.prototype.__iterate=function(t,e){var n=this;return this._list.__iterate((function(e){return e&&t(e[1],e[0],n)}),e)},Fe.prototype.__iterator=function(t,e){return this._list.fromEntrySeq().__iterator(t,e)},Fe.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),n=this._list.__ensureOwner(t);return t?Ge(e,n,t,this.__hash):(this.__ownerID=t,this._map=e,this._list=n,this)},Fe.isOrderedMap=Be,Fe.prototype[d]=!0,Fe.prototype[y]=Fe.prototype.remove,e(Je,Z),Je.prototype.get=function(t,e){return this._iter.get(t,e)},Je.prototype.has=function(t){return this._iter.has(t)},Je.prototype.valueSeq=function(){return this._iter.valueSeq()},Je.prototype.reverse=function(){var t=this,e=$e(this,!0);return this._useKeys||(e.valueSeq=function(){return t._iter.toSeq().reverse()}),e},Je.prototype.map=function(t,e){var n=this,r=Ke(this,t,e);return this._useKeys||(r.valueSeq=function(){return n._iter.toSeq().map(t,e)}),r},Je.prototype.__iterate=function(t,e){var n,r=this;return this._iter.__iterate(this._useKeys?function(e,n){return t(e,n,r)}:(n=e?gn(this):0,function(i){return t(i,e?--n:n++,r)}),e)},Je.prototype.__iterator=function(t,e){if(this._useKeys)return this._iter.__iterator(t,e);var n=this._iter.__iterator(T,e),r=e?gn(this):0;return new P((function(){var i=n.next();return i.done?i:R(t,e?--r:r++,i.value,i)}))},Je.prototype[d]=!0,e(Ze,V),Ze.prototype.includes=function(t){return this._iter.includes(t)},Ze.prototype.__iterate=function(t,e){var n=this,r=0;return this._iter.__iterate((function(e){return t(e,r++,n)}),e)},Ze.prototype.__iterator=function(t,e){var n=this._iter.__iterator(T,e),r=0;return new P((function(){var e=n.next();return e.done?e:R(t,r++,e.value,e)}))},e(Ve,X),Ve.prototype.has=function(t){return this._iter.includes(t)},Ve.prototype.__iterate=function(t,e){var n=this;return this._iter.__iterate((function(e){return t(e,e,n)}),e)},Ve.prototype.__iterator=function(t,e){var n=this._iter.__iterator(T,e);return new P((function(){var e=n.next();return e.done?e:R(t,e.value,e.value,e)}))},e(Xe,Z),Xe.prototype.entrySeq=function(){return this._iter.toSeq()},Xe.prototype.__iterate=function(t,e){var n=this;return this._iter.__iterate((function(e){if(e){vn(e);var r=u(e);return t(r?e.get(1):e[1],r?e.get(0):e[0],n)}}),e)},Xe.prototype.__iterator=function(t,e){var n=this._iter.__iterator(T,e);return new P((function(){for(;;){var e=n.next();if(e.done)return e;var r=e.value;if(r){vn(r);var i=u(r);return R(t,i?r.get(0):r[0],i?r.get(1):r[1],e)}}}))},Ze.prototype.cacheResult=Je.prototype.cacheResult=Ve.prototype.cacheResult=Xe.prototype.cacheResult=_n,e(xn,xt),xn.prototype.toString=function(){return this.__toString(Nn(this)+" {","}")},xn.prototype.has=function(t){return this._defaultValues.hasOwnProperty(t)},xn.prototype.get=function(t,e){if(!this.has(t))return e;var n=this._defaultValues[t];return this._map?this._map.get(t,n):n},xn.prototype.clear=function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var t=this.constructor;return t._empty||(t._empty=jn(this,ie()))},xn.prototype.set=function(t,e){if(!this.has(t))throw new Error('Cannot set unknown key "'+t+'" on '+Nn(this));if(this._map&&!this._map.has(t)&&e===this._defaultValues[t])return this;var n=this._map&&this._map.set(t,e);return this.__ownerID||n===this._map?this:jn(this,n)},xn.prototype.remove=function(t){if(!this.has(t))return this;var e=this._map&&this._map.remove(t);return this.__ownerID||e===this._map?this:jn(this,e)},xn.prototype.wasAltered=function(){return this._map.wasAltered()},xn.prototype.__iterator=function(t,e){var n=this;return r(this._defaultValues).map((function(t,e){return n.get(e)})).__iterator(t,e)},xn.prototype.__iterate=function(t,e){var n=this;return r(this._defaultValues).map((function(t,e){return n.get(e)})).__iterate(t,e)},xn.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?jn(this,e,t):(this.__ownerID=t,this._map=e,this)};var bn=xn.prototype;function jn(t,e,n){var r=Object.create(Object.getPrototypeOf(t));return r._map=e,r.__ownerID=n,r}function Nn(t){return t._name||t.constructor.name||"Record"}function Sn(t,e){try{e.forEach(Dn.bind(void 0,t))}catch(t){}}function Dn(t,e){Object.defineProperty(t,e,{get:function(){return this.get(e)},set:function(t){_t(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})}function In(t){return null==t?kn():An(t)&&!f(t)?t:kn().withMutations((function(e){var n=o(t);Bt(n.size),n.forEach((function(t){return e.add(t)}))}))}function An(t){return!(!t||!t[En])}bn[y]=bn.remove,bn.deleteIn=bn.removeIn=Zt.removeIn,bn.merge=Zt.merge,bn.mergeWith=Zt.mergeWith,bn.mergeIn=Zt.mergeIn,bn.mergeDeep=Zt.mergeDeep,bn.mergeDeepWith=Zt.mergeDeepWith,bn.mergeDeepIn=Zt.mergeDeepIn,bn.setIn=Zt.setIn,bn.update=Zt.update,bn.updateIn=Zt.updateIn,bn.withMutations=Zt.withMutations,bn.asMutable=Zt.asMutable,bn.asImmutable=Zt.asImmutable,e(In,jt),In.of=function(){return this(arguments)},In.fromKeys=function(t){return this(r(t).keySeq())},In.prototype.toString=function(){return this.__toString("Set {","}")},In.prototype.has=function(t){return this._map.has(t)},In.prototype.add=function(t){return Tn(this,this._map.set(t,!0))},In.prototype.remove=function(t){return Tn(this,this._map.remove(t))},In.prototype.clear=function(){return Tn(this,this._map.clear())},In.prototype.union=function(){var e=t.call(arguments,0);return 0===(e=e.filter((function(t){return 0!==t.size}))).length?this:0!==this.size||this.__ownerID||1!==e.length?this.withMutations((function(t){for(var n=0;n<e.length;n++)o(e[n]).forEach((function(e){return t.add(e)}))})):this.constructor(e[0])},In.prototype.intersect=function(){var e=t.call(arguments,0);if(0===e.length)return this;e=e.map((function(t){return o(t)}));var n=this;return this.withMutations((function(t){n.forEach((function(n){e.every((function(t){return t.includes(n)}))||t.remove(n)}))}))},In.prototype.subtract=function(){var e=t.call(arguments,0);if(0===e.length)return this;e=e.map((function(t){return o(t)}));var n=this;return this.withMutations((function(t){n.forEach((function(n){e.some((function(t){return t.includes(n)}))&&t.remove(n)}))}))},In.prototype.merge=function(){return this.union.apply(this,arguments)},In.prototype.mergeWith=function(e){var n=t.call(arguments,1);return this.union.apply(this,n)},In.prototype.sort=function(t){return Un(ln(this,t))},In.prototype.sortBy=function(t,e){return Un(ln(this,e,t))},In.prototype.wasAltered=function(){return this._map.wasAltered()},In.prototype.__iterate=function(t,e){var n=this;return this._map.__iterate((function(e,r){return t(r,r,n)}),e)},In.prototype.__iterator=function(t,e){return this._map.map((function(t,e){return e})).__iterator(t,e)},In.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t);return t?this.__make(e,t):(this.__ownerID=t,this._map=e,this)},In.isSet=An;var On,En="@@__IMMUTABLE_SET__@@",Cn=In.prototype;function Tn(t,e){return t.__ownerID?(t.size=e.size,t._map=e,t):e===t._map?t:0===e.size?t.__empty():t.__make(e)}function zn(t,e){var n=Object.create(Cn);return n.size=t?t.size:0,n._map=t,n.__ownerID=e,n}function kn(){return On||(On=zn(ie()))}function Un(t){return null==t?Fn():Yn(t)?t:Fn().withMutations((function(e){var n=o(t);Bt(n.size),n.forEach((function(t){return e.add(t)}))}))}function Yn(t){return An(t)&&f(t)}Cn[En]=!0,Cn[y]=Cn.remove,Cn.mergeDeep=Cn.merge,Cn.mergeDeepWith=Cn.mergeWith,Cn.withMutations=Zt.withMutations,Cn.asMutable=Zt.asMutable,Cn.asImmutable=Zt.asImmutable,Cn.__empty=kn,Cn.__make=zn,e(Un,In),Un.of=function(){return this(arguments)},Un.fromKeys=function(t){return this(r(t).keySeq())},Un.prototype.toString=function(){return this.__toString("OrderedSet {","}")},Un.isOrderedSet=Yn;var Pn,Rn=Un.prototype;function Qn(t,e){var n=Object.create(Rn);return n.size=t?t.size:0,n._map=t,n.__ownerID=e,n}function Fn(){return Pn||(Pn=Qn(We()))}function Bn(t){return null==t?Vn():Gn(t)?t:Vn().unshiftAll(t)}function Gn(t){return!(!t||!t[qn])}Rn[d]=!0,Rn.__empty=Fn,Rn.__make=Qn,e(Bn,bt),Bn.of=function(){return this(arguments)},Bn.prototype.toString=function(){return this.__toString("Stack [","]")},Bn.prototype.get=function(t,e){var n=this._head;for(t=S(this,t);n&&t--;)n=n.next;return n?n.value:e},Bn.prototype.peek=function(){return this._head&&this._head.value},Bn.prototype.push=function(){if(0===arguments.length)return this;for(var t=this.size+arguments.length,e=this._head,n=arguments.length-1;n>=0;n--)e={value:arguments[n],next:e};return this.__ownerID?(this.size=t,this._head=e,this.__hash=void 0,this.__altered=!0,this):Zn(t,e)},Bn.prototype.pushAll=function(t){if(0===(t=i(t)).size)return this;Bt(t.size);var e=this.size,n=this._head;return t.reverse().forEach((function(t){e++,n={value:t,next:n}})),this.__ownerID?(this.size=e,this._head=n,this.__hash=void 0,this.__altered=!0,this):Zn(e,n)},Bn.prototype.pop=function(){return this.slice(1)},Bn.prototype.unshift=function(){return this.push.apply(this,arguments)},Bn.prototype.unshiftAll=function(t){return this.pushAll(t)},Bn.prototype.shift=function(){return this.pop.apply(this,arguments)},Bn.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Vn()},Bn.prototype.slice=function(t,e){if(I(t,e,this.size))return this;var n=A(t,this.size);if(O(e,this.size)!==this.size)return bt.prototype.slice.call(this,t,e);for(var r=this.size-n,i=this._head;n--;)i=i.next;return this.__ownerID?(this.size=r,this._head=i,this.__hash=void 0,this.__altered=!0,this):Zn(r,i)},Bn.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?Zn(this.size,this._head,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},Bn.prototype.__iterate=function(t,e){if(e)return this.reverse().__iterate(t);for(var n=0,r=this._head;r&&!1!==t(r.value,n++,this);)r=r.next;return n},Bn.prototype.__iterator=function(t,e){if(e)return this.reverse().__iterator(t);var n=0,r=this._head;return new P((function(){if(r){var e=r.value;return r=r.next,R(t,n++,e)}return Q()}))},Bn.isStack=Gn;var Wn,qn="@@__IMMUTABLE_STACK__@@",Jn=Bn.prototype;function Zn(t,e,n,r){var i=Object.create(Jn);return i.size=t,i._head=e,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function Vn(){return Wn||(Wn=Zn(0))}function Xn(t,e){var n=function(n){t.prototype[n]=e[n]};return Object.keys(e).forEach(n),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(e).forEach(n),t}Jn[qn]=!0,Jn.withMutations=Zt.withMutations,Jn.asMutable=Zt.asMutable,Jn.asImmutable=Zt.asImmutable,Jn.wasAltered=Zt.wasAltered,n.Iterator=P,Xn(n,{toArray:function(){Bt(this.size);var t=new Array(this.size||0);return this.valueSeq().__iterate((function(e,n){t[n]=e})),t},toIndexedSeq:function(){return new Ze(this)},toJS:function(){return this.toSeq().map((function(t){return t&&"function"==typeof t.toJS?t.toJS():t})).__toJS()},toJSON:function(){return this.toSeq().map((function(t){return t&&"function"==typeof t.toJSON?t.toJSON():t})).__toJS()},toKeyedSeq:function(){return new Je(this,!0)},toMap:function(){return Gt(this.toKeyedSeq())},toObject:function(){Bt(this.size);var t={};return this.__iterate((function(e,n){t[n]=e})),t},toOrderedMap:function(){return Fe(this.toKeyedSeq())},toOrderedSet:function(){return Un(s(this)?this.valueSeq():this)},toSet:function(){return In(s(this)?this.valueSeq():this)},toSetSeq:function(){return new Ve(this)},toSeq:function(){return a(this)?this.toIndexedSeq():s(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Bn(s(this)?this.valueSeq():this)},toList:function(){return be(s(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(t,e){return 0===this.size?t+e:t+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+e},concat:function(){return yn(this,sn(this,t.call(arguments,0)))},includes:function(t){return this.some((function(e){return gt(e,t)}))},entries:function(){return this.__iterator(z)},every:function(t,e){Bt(this.size);var n=!0;return this.__iterate((function(r,i,o){if(!t.call(e,r,i,o))return n=!1,!1})),n},filter:function(t,e){return yn(this,tn(this,t,e,!0))},find:function(t,e,n){var r=this.findEntry(t,e);return r?r[1]:n},forEach:function(t,e){return Bt(this.size),this.__iterate(e?t.bind(e):t)},join:function(t){Bt(this.size),t=void 0!==t?""+t:",";var e="",n=!0;return this.__iterate((function(r){n?n=!1:e+=t,e+=null!=r?r.toString():""})),e},keys:function(){return this.__iterator(C)},map:function(t,e){return yn(this,Ke(this,t,e))},reduce:function(t,e,n){var r,i;return Bt(this.size),arguments.length<2?i=!0:r=e,this.__iterate((function(e,o,u){i?(i=!1,r=e):r=t.call(n,r,e,o,u)})),r},reduceRight:function(t,e,n){var r=this.toKeyedSeq().reverse();return r.reduce.apply(r,arguments)},reverse:function(){return yn(this,$e(this,!0))},slice:function(t,e){return yn(this,rn(this,t,e,!0))},some:function(t,e){return!this.every(er(t),e)},sort:function(t){return yn(this,ln(this,t))},values:function(){return this.__iterator(T)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some((function(){return!0}))},count:function(t,e){return N(t?this.toSeq().filter(t,e):this)},countBy:function(t,e){return en(this,t,e)},equals:function(t){return wt(this,t)},entrySeq:function(){var t=this;if(t._cache)return new et(t._cache);var e=t.toSeq().map(tr).toIndexedSeq();return e.fromEntrySeq=function(){return t.toSeq()},e},filterNot:function(t,e){return this.filter(er(t),e)},findEntry:function(t,e,n){var r=n;return this.__iterate((function(n,i,o){if(t.call(e,n,i,o))return r=[i,n],!1})),r},findKey:function(t,e){var n=this.findEntry(t,e);return n&&n[0]},findLast:function(t,e,n){return this.toKeyedSeq().reverse().find(t,e,n)},findLastEntry:function(t,e,n){return this.toKeyedSeq().reverse().findEntry(t,e,n)},findLastKey:function(t,e){return this.toKeyedSeq().reverse().findKey(t,e)},first:function(){return this.find(D)},flatMap:function(t,e){return yn(this,cn(this,t,e))},flatten:function(t){return yn(this,an(this,t,!0))},fromEntrySeq:function(){return new Xe(this)},get:function(t,e){return this.find((function(e,n){return gt(n,t)}),void 0,e)},getIn:function(t,e){for(var n,r=this,i=Ln(t);!(n=i.next()).done;){var o=n.value;if((r=r&&r.get?r.get(o,M):M)===M)return e}return r},groupBy:function(t,e){return nn(this,t,e)},has:function(t){return this.get(t,M)!==M},hasIn:function(t){return this.getIn(t,M)!==M},isSubset:function(t){return t="function"==typeof t.includes?t:n(t),this.every((function(e){return t.includes(e)}))},isSuperset:function(t){return(t="function"==typeof t.isSubset?t:n(t)).isSubset(this)},keyOf:function(t){return this.findKey((function(e){return gt(e,t)}))},keySeq:function(){return this.toSeq().map($n).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(t){return this.toKeyedSeq().reverse().keyOf(t)},max:function(t){return pn(this,t)},maxBy:function(t,e){return pn(this,e,t)},min:function(t){return pn(this,t?nr(t):or)},minBy:function(t,e){return pn(this,e?nr(e):or,t)},rest:function(){return this.slice(1)},skip:function(t){return this.slice(Math.max(0,t))},skipLast:function(t){return yn(this,this.toSeq().reverse().skip(t).reverse())},skipWhile:function(t,e){return yn(this,un(this,t,e,!0))},skipUntil:function(t,e){return this.skipWhile(er(t),e)},sortBy:function(t,e){return yn(this,ln(this,e,t))},take:function(t){return this.slice(0,Math.max(0,t))},takeLast:function(t){return yn(this,this.toSeq().reverse().take(t).reverse())},takeWhile:function(t,e){return yn(this,on(this,t,e))},takeUntil:function(t,e){return this.takeWhile(er(t),e)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=ur(this))}});var Hn=n.prototype;Hn[l]=!0,Hn[Y]=Hn.values,Hn.__toJS=Hn.toArray,Hn.__toStringMapper=rr,Hn.inspect=Hn.toSource=function(){return this.toString()},Hn.chain=Hn.flatMap,Hn.contains=Hn.includes,Xn(r,{flip:function(){return yn(this,He(this))},mapEntries:function(t,e){var n=this,r=0;return yn(this,this.toSeq().map((function(i,o){return t.call(e,[o,i],r++,n)})).fromEntrySeq())},mapKeys:function(t,e){var n=this;return yn(this,this.toSeq().flip().map((function(r,i){return t.call(e,r,i,n)})).flip())}});var Kn=r.prototype;function $n(t,e){return e}function tr(t,e){return[e,t]}function er(t){return function(){return!t.apply(this,arguments)}}function nr(t){return function(){return-t.apply(this,arguments)}}function rr(t){return"string"==typeof t?JSON.stringify(t):String(t)}function ir(){return j(arguments)}function or(t,e){return t<e?1:t>e?-1:0}function ur(t){if(t.size===1/0)return 0;var e=f(t),n=s(t),r=e?1:0;return sr(t.__iterate(n?e?function(t,e){r=31*r+ar(Dt(t),Dt(e))|0}:function(t,e){r=r+ar(Dt(t),Dt(e))|0}:e?function(t){r=31*r+Dt(t)|0}:function(t){r=r+Dt(t)|0}),r)}function sr(t,e){return e=Nt(e,3432918353),e=Nt(e<<15|e>>>-15,461845907),e=Nt(e<<13|e>>>-13,5),e=Nt((e=(e+3864292196|0)^t)^e>>>16,2246822507),e=St((e=Nt(e^e>>>13,3266489909))^e>>>16)}function ar(t,e){return t^e+2654435769+(t<<6)+(t>>2)|0}return Kn[p]=!0,Kn[Y]=Hn.entries,Kn.__toJS=Hn.toObject,Kn.__toStringMapper=function(t,e){return JSON.stringify(e)+": "+rr(t)},Xn(i,{toKeyedSeq:function(){return new Je(this,!1)},filter:function(t,e){return yn(this,tn(this,t,e,!1))},findIndex:function(t,e){var n=this.findEntry(t,e);return n?n[0]:-1},indexOf:function(t){var e=this.keyOf(t);return void 0===e?-1:e},lastIndexOf:function(t){var e=this.lastKeyOf(t);return void 0===e?-1:e},reverse:function(){return yn(this,$e(this,!1))},slice:function(t,e){return yn(this,rn(this,t,e,!1))},splice:function(t,e){var n=arguments.length;if(e=Math.max(0|e,0),0===n||2===n&&!e)return this;t=A(t,t<0?this.count():this.size);var r=this.slice(0,t);return yn(this,1===n?r:r.concat(j(arguments,2),this.slice(t+e)))},findLastIndex:function(t,e){var n=this.findLastEntry(t,e);return n?n[0]:-1},first:function(){return this.get(0)},flatten:function(t){return yn(this,an(this,t,!1))},get:function(t,e){return(t=S(this,t))<0||this.size===1/0||void 0!==this.size&&t>this.size?e:this.find((function(e,n){return n===t}),void 0,e)},has:function(t){return(t=S(this,t))>=0&&(void 0!==this.size?this.size===1/0||t<this.size:-1!==this.indexOf(t))},interpose:function(t){return yn(this,fn(this,t))},interleave:function(){var t=[this].concat(j(arguments)),e=dn(this.toSeq(),V.of,t),n=e.flatten(!0);return e.size&&(n.size=e.size*t.length),yn(this,n)},keySeq:function(){return mt(0,this.size)},last:function(){return this.get(-1)},skipWhile:function(t,e){return yn(this,un(this,t,e,!1))},zip:function(){return yn(this,dn(this,ir,[this].concat(j(arguments))))},zipWith:function(t){var e=j(arguments);return e[0]=this,yn(this,dn(this,t,e))}}),i.prototype[h]=!0,i.prototype[d]=!0,Xn(o,{get:function(t,e){return this.has(t)?t:e},includes:function(t){return this.has(t)},keySeq:function(){return this.valueSeq()}}),o.prototype.has=Hn.includes,o.prototype.contains=o.prototype.includes,Xn(Z,r.prototype),Xn(V,i.prototype),Xn(X,o.prototype),Xn(xt,r.prototype),Xn(bt,i.prototype),Xn(jt,o.prototype),{Iterable:n,Seq:J,Collection:Lt,Map:Gt,OrderedMap:Fe,List:be,Stack:Bn,Set:In,OrderedSet:Un,Record:xn,Range:mt,Repeat:Mt,is:gt,fromJS:ht}}()},function(t,e,n){"use strict";var r=n(12),i=n(109).f,o=n(247),u=n(10),s=n(111),a=n(25),c=n(21),f=function(t){var e=function(e,n,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,r)}return t.apply(this,arguments)};return e.prototype=t.prototype,e};t.exports=function(t,e){var n,l,p,h,d,y,v,g,w=t.target,M=t.global,_=t.stat,m=t.proto,L=M?r:_?r[w]:(r[w]||{}).prototype,x=M?u:u[w]||(u[w]={}),b=x.prototype;for(p in e)n=!o(M?p:w+(_?".":"#")+p,t.forced)&&L&&c(L,p),d=x[p],n&&(y=t.noTargetGet?(g=i(L,p))&&g.value:L[p]),h=n&&y?y:e[p],n&&typeof d==typeof h||(v=t.bind&&n?s(h,r):t.wrap&&n?f(h):m&&"function"==typeof h?s(Function.call,h):h,(t.sham||h&&h.sham||d&&d.sham)&&a(v,"sham",!0),x[p]=v,m&&(c(u,l=w+"Prototype")||a(u,l,{}),u[l][p]=h,t.real&&b&&!b[p]&&a(b,p,h)))}},function(t,e,n){"use strict";t.exports=n(306)},function(t,e,n){t.exports=n(326)},function(t,e,n){var r=n(10),i=n(21),o=n(121),u=n(33).f;t.exports=function(t){var e=r.Symbol||(r.Symbol={});i(e,t)||u(e,t,{value:o.f(t)})}},function(t,e,n){t.exports=n(366)},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){var r=n(12),i=n(115),o=n(21),u=n(117),s=n(120),a=n(167),c=i("wks"),f=r.Symbol,l=a?f:f&&f.withoutSetter||u;t.exports=function(t){return o(c,t)&&(s||"string"==typeof c[t])||(s&&o(f,t)?c[t]=f[t]:c[t]=l("Symbol."+t)),c[t]}},function(t,e,n){"use strict";var r=n(71),i=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],o=["scalar","sequence","mapping"];t.exports=function(t,e){var n,u;if(e=e||{},Object.keys(e).forEach((function(e){if(-1===i.indexOf(e))throw new r('Unknown option "'+e+'" is met in definition of "'+t+'" YAML type.')})),this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.defaultStyle=e.defaultStyle||null,this.styleAliases=(n=e.styleAliases||null,u={},null!==n&&Object.keys(n).forEach((function(t){n[t].forEach((function(e){u[String(e)]=t}))})),u),-1===o.indexOf(this.kind))throw new r('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}},function(t,e,n){var r=n(10);t.exports=function(t){return r[t+"Prototype"]}},function(t,e){t.exports={}},function(t,e,n){t.exports=n(334)},function(t,e,n){(function(e){var n=function(t){return t&&t.Math==Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof e&&e)||function(){return this}()||Function("return this")()}).call(this,n(20))},function(t,e,n){var r=n(83),i=n(300);function o(e){return"function"==typeof r&&"symbol"==typeof i?(t.exports=o=function(t){return typeof t},t.exports.default=t.exports,t.exports.__esModule=!0):(t.exports=o=function(t){return t&&"function"==typeof r&&t.constructor===r&&t!==r.prototype?"symbol":typeof t},t.exports.default=t.exports,t.exports.__esModule=!0),o(e)}t.exports=o,t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){var r=n(154);t.exports=function(t,e,n){return e in t?r(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){"use strict";(function(t){n.d(e,"d",(function(){return m})),n.d(e,"c",(function(){return L})),n.d(e,"b",(function(){return b})),n.d(e,"e",(function(){return j})),n.d(e,"f",(function(){return N})),n.d(e,"a",(function(){return S}));n(54),n(229),n(147);var r=n(13),i=n.n(r),o=n(5),u=n.n(o),s=n(11),a=n.n(s),c=(n(75),n(3),n(19)),f=n.n(c),l=(n(29),n(30)),p=n.n(l),h=(n(230),n(107),n(148)),d=n.n(h),y=(n(231),n(149),n(108),n(106),n(150),n(53),n(232),n(233),n(234),n(0)),v=n.n(y),g=(n(235),n(236),n(145),n(146)),w=n.n(g),M=(n(237),n(151),n(52),n(73),n(152),n(76)),_=(n(239),n(240),n(241),n(242),n(74),function(t){return v.a.Iterable.isIterable(t)});function m(t){return x(t)?_(t)?t.toJS():t:{}}function L(t){return u()(t)?t:[t]}function x(t){return!!t&&"object"===i()(t)}function b(t){return"function"==typeof t}w.a;var j=function(){var t={},e=M.a.location.search;if(!e)return{};if(""!=e){var n=e.substr(1).split("&");for(var r in n)n.hasOwnProperty(r)&&(r=n[r].split("="),t[decodeURIComponent(r[0])]=r[1]&&decodeURIComponent(r[1])||"")}return t},N=function(t){var e;return a()(e=p()(t)).call(e,(function(e){return encodeURIComponent(e)+"="+encodeURIComponent(t[e])})).join("&")};function S(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){return!0};if("object"!==i()(t)||u()(t)||null===t||!e)return t;var o=d()({},t);return f()(n=p()(o)).call(n,(function(t){t===e&&r(o[t],t)?delete o[t]:o[t]=S(o[t],e,r)})),o}}).call(this,n(89).Buffer)},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e,n){var r=n(89),i=r.Buffer;function o(t,e){for(var n in t)e[n]=t[n]}function u(t,e,n){return i(t,e,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(o(r,e),e.Buffer=u),o(i,u),u.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,n)},u.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=i(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},u.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},u.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},function(t,e,n){t.exports=n(329)},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var r=n(42);t.exports=function(t){return Object(r(t))}},function(t,e){var n=Array.isArray;t.exports=n},function(t,e,n){var r=n(6);t.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(t,e,n){var r=n(24),i=n(33),o=n(56);t.exports=r?function(t,e,n){return i.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(16);t.exports=function(t){if(!r(t))throw TypeError(String(t)+" is not an object");return t}},function(t,e,n){var r=n(193),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();t.exports=o},function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){t.exports=n(370)},function(t,e,n){t.exports=n(374)},function(t,e,n){"use strict";t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},function(t,e,n){var r=n(77),i=n(42);t.exports=function(t){return r(i(t))}},function(t,e,n){var r=n(24),i=n(155),o=n(26),u=n(78),s=Object.defineProperty;e.f=r?s:function(t,e,n){if(o(t),e=u(e,!0),o(n),i)try{return s(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){var r=n(113),i=Math.min;t.exports=function(t){return t>0?i(r(t),9007199254740991):0}},function(t,e){t.exports={}},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function s(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(t){r=u}}();var a,c=[],f=!1,l=-1;function p(){f&&a&&(f=!1,a.length?c=a.concat(c):l=-1,c.length&&h())}function h(){if(!f){var t=s(p);f=!0;for(var e=c.length;e;){for(a=c,c=[];++l<e;)a&&a[l].run();l=-1,e=c.length}a=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function y(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new d(t,e)),1!==c.length||f||s(h)},d.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=y,i.addListener=y,i.once=y,i.off=y,i.removeListener=y,i.removeAllListeners=y,i.emit=y,i.prependListener=y,i.prependOnceListener=y,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){"use strict";var r=n(98),i=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=l;var o=n(70);o.inherits=n(17);var u=n(208),s=n(140);o.inherits(l,u);for(var a=i(s.prototype),c=0;c<a.length;c++){var f=a[c];l.prototype[f]||(l.prototype[f]=s.prototype[f])}function l(t){if(!(this instanceof l))return new l(t);u.call(this,t),s.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",p)}function p(){this.allowHalfOpen||this._writableState.ended||r.nextTick(h,this)}function h(t){t.end()}Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(l.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),l.prototype._destroy=function(t,e){this.push(null),this.end(),r.nextTick(e,t)}},function(t,e,n){"use strict";var r=n(543)();t.exports=function(t){return t!==r&&null!==t}},function(t,e,n){"use strict";var r=n(544),i=Math.max;t.exports=function(t){return i(0,r(t))}},function(t,e,n){},function(t,e,n){"use strict";var r=n(219),i=n(558),o=n(216),u=n(214),s=n(562);(t.exports=function(t,e){var n,i,a,c,f;return arguments.length<2||"string"!=typeof t?(c=e,e=t,t=null):c=arguments[2],r(t)?(n=s.call(t,"c"),i=s.call(t,"e"),a=s.call(t,"w")):(n=a=!0,i=!1),f={value:e,configurable:n,enumerable:i,writable:a},c?o(u(c),f):f}).gs=function(t,e,n){var a,c,f,l;return"string"!=typeof t?(f=n,n=e,e=t,t=null):f=arguments[3],r(e)?i(e)?r(n)?i(n)||(f=n,n=void 0):n=void 0:(f=e,e=n=void 0):e=void 0,r(t)?(a=s.call(t,"c"),c=s.call(t,"e")):(a=!0,c=!1),l={get:e,set:n,configurable:a,enumerable:c},f?o(u(f),l):l}},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){var r=n(122),i=n(57),o=n(7)("toStringTag"),u="Arguments"==i(function(){return arguments}());t.exports=r?i:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),o))?n:u?i(e):"Object"==(r=i(e))&&"function"==typeof e.callee?"Arguments":r}},function(t,e,n){var r=n(111),i=n(77),o=n(22),u=n(34),s=n(165),a=[].push,c=function(t){var e=1==t,n=2==t,c=3==t,f=4==t,l=6==t,p=7==t,h=5==t||l;return function(d,y,v,g){for(var w,M,_=o(d),m=i(_),L=r(y,v,3),x=u(m.length),b=0,j=g||s,N=e?j(d,x):n||p?j(d,0):void 0;x>b;b++)if((h||b in m)&&(M=L(w=m[b],b,_),t))if(e)N[b]=M;else if(M)switch(t){case 3:return!0;case 5:return w;case 6:return b;case 2:a.call(N,w)}else switch(t){case 4:return!1;case 7:a.call(N,w)}return l?-1:c||f?f:N}};t.exports={forEach:c(0),map:c(1),filter:c(2),some:c(3),every:c(4),find:c(5),findIndex:c(6),filterOut:c(7)}},function(t,e,n){n(174);var r=n(305),i=n(12),o=n(43),u=n(25),s=n(35),a=n(7)("toStringTag");for(var c in r){var f=i[c],l=f&&f.prototype;l&&o(l)!==a&&u(l,a,c),s[c]=s.Array}},function(t,e,n){"use strict";var r=n(63),i=n(179),o=(n(125),n(178),Object.prototype.hasOwnProperty),u=n(180),s={key:!0,ref:!0,__self:!0,__source:!0};function a(t){return void 0!==t.ref}function c(t){return void 0!==t.key}var f=function(t,e,n,r,i,o,s){return{$$typeof:u,type:t,key:e,ref:n,props:s,_owner:o}};f.createElement=function(t,e,n){var r,u={},l=null,p=null;if(null!=e)for(r in a(e)&&(p=e.ref),c(e)&&(l=""+e.key),void 0===e.__self?null:e.__self,void 0===e.__source?null:e.__source,e)o.call(e,r)&&!s.hasOwnProperty(r)&&(u[r]=e[r]);var h=arguments.length-2;if(1===h)u.children=n;else if(h>1){for(var d=Array(h),y=0;y<h;y++)d[y]=arguments[y+2];0,u.children=d}if(t&&t.defaultProps){var v=t.defaultProps;for(r in v)void 0===u[r]&&(u[r]=v[r])}return f(t,l,p,0,0,i.current,u)},f.createFactory=function(t){var e=f.createElement.bind(null,t);return e.type=t,e},f.cloneAndReplaceKey=function(t,e){return f(t.type,e,t.ref,t._self,t._source,t._owner,t.props)},f.cloneElement=function(t,e,n){var u,l,p=r({},t.props),h=t.key,d=t.ref,y=(t._self,t._source,t._owner);if(null!=e)for(u in a(e)&&(d=e.ref,y=i.current),c(e)&&(h=""+e.key),t.type&&t.type.defaultProps&&(l=t.type.defaultProps),e)o.call(e,u)&&!s.hasOwnProperty(u)&&(void 0===e[u]&&void 0!==l?p[u]=l[u]:p[u]=e[u]);var v=arguments.length-2;if(1===v)p.children=n;else if(v>1){for(var g=Array(v),w=0;w<v;w++)g[w]=arguments[w+2];p.children=g}return f(t.type,h,d,0,0,y,p)},f.isValidElement=function(t){return"object"==typeof t&&null!==t&&t.$$typeof===u},t.exports=f},function(t,e,n){var r=n(450),i=n(453);t.exports=function(t,e){var n=i(t,e);return r(n)?n:void 0}},function(t,e,n){"use strict";var r=n(38);t.exports=function(t){if(!r(t))throw new TypeError("Cannot use null or undefined");return t}},function(t,e,n){var r=n(18).Buffer;function i(t,e){this._block=r.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}i.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=r.from(t,e));for(var n=this._block,i=this._blockSize,o=t.length,u=this._len,s=0;s<o;){for(var a=u%i,c=Math.min(o-s,i-a),f=0;f<c;f++)n[a+f]=t[s+f];s+=c,(u+=c)%i==0&&this._update(n)}return this._len+=o,this},i.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=i},function(t,e,n){"use strict";function r(t){return null==t}t.exports.isNothing=r,t.exports.isObject=function(t){return"object"==typeof t&&null!==t},t.exports.toArray=function(t){return Array.isArray(t)?t:r(t)?[]:[t]},t.exports.repeat=function(t,e){var n,r="";for(n=0;n<e;n+=1)r+=t;return r},t.exports.isNegativeZero=function(t){return 0===t&&Number.NEGATIVE_INFINITY===1/t},t.exports.extend=function(t,e){var n,r,i,o;if(e)for(n=0,r=(o=Object.keys(e)).length;n<r;n+=1)t[i=o[n]]=e[i];return t}},function(t,e,n){"use strict";var r=n(50),i=n(71),o=n(8);function u(t,e,n){var r=[];return t.include.forEach((function(t){n=u(t,e,n)})),t[e].forEach((function(t){n.forEach((function(e,n){e.tag===t.tag&&e.kind===t.kind&&r.push(n)})),n.push(t)})),n.filter((function(t,e){return-1===r.indexOf(e)}))}function s(t){this.include=t.include||[],this.implicit=t.implicit||[],this.explicit=t.explicit||[],this.implicit.forEach((function(t){if(t.loadKind&&"scalar"!==t.loadKind)throw new i("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")})),this.compiledImplicit=u(this,"implicit",[]),this.compiledExplicit=u(this,"explicit",[]),this.compiledTypeMap=function(){var t,e,n={scalar:{},sequence:{},mapping:{},fallback:{}};function r(t){n[t.kind][t.tag]=n.fallback[t.tag]=t}for(t=0,e=arguments.length;t<e;t+=1)arguments[t].forEach(r);return n}(this.compiledImplicit,this.compiledExplicit)}s.DEFAULT=null,s.create=function(){var t,e;switch(arguments.length){case 1:t=s.DEFAULT,e=arguments[0];break;case 2:t=arguments[0],e=arguments[1];break;default:throw new i("Wrong number of arguments for Schema.create function")}if(t=r.toArray(t),e=r.toArray(e),!t.every((function(t){return t instanceof s})))throw new i("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!e.every((function(t){return t instanceof o})))throw new i("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new s({include:t,explicit:e})},t.exports=s},function(t,e){t.exports=function(t,e){return t===e||t!=t&&e!=e}},function(t,e,n){t.exports=n(409)},function(t,e,n){var r=n(340),i=n(343),o=n(128),u=n(358);t.exports=function(t){return r(t)||i(t)||o(t)||u()},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){var r=n(201),i=n(203),o=n(132),u=n(23),s=n(69),a=n(133),c=n(202),f=n(135),l=Object.prototype.hasOwnProperty;t.exports=function(t){if(null==t)return!0;if(s(t)&&(u(t)||"string"==typeof t||"function"==typeof t.splice||a(t)||f(t)||o(t)))return!t.length;var e=i(t);if("[object Map]"==e||"[object Set]"==e)return!t.size;if(c(t))return!r(t).length;for(var n in t)if(l.call(t,n))return!1;return!0}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}},function(t,e,n){var r=n(10),i=n(12),o=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,e){return arguments.length<2?o(r[t])||o(i[t]):r[t]&&r[t][e]||i[t]&&i[t][e]}},function(t,e){t.exports=!0},function(t,e,n){var r=n(57);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,e,n){"use strict";var r=n(303).charAt,i=n(123),o=n(172),u="String Iterator",s=i.set,a=i.getterFor(u);o(String,"String",(function(t){s(this,{type:u,string:String(t),index:0})}),(function(){var t,e=a(this),n=e.string,i=e.index;return i>=n.length?{value:void 0,done:!0}:(t=r(n,i),e.index+=t.length,{value:t,done:!1})}))},function(t,e,n){"use strict";var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function u(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(t){r[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,s,a=u(t),c=1;c<arguments.length;c++){for(var f in n=Object(arguments[c]))i.call(n,f)&&(a[f]=n[f]);if(r){s=r(n);for(var l=0;l<s.length;l++)o.call(n,s[l])&&(a[s[l]]=n[s[l]])}}return a}},function(t,e,n){"use strict";var r=n(6);t.exports=function(t,e){var n=[][t];return!!n&&r((function(){n.call(null,e||function(){throw 1},1)}))}},function(t,e,n){var r=n(428);t.exports=function(t){return null==t?"":r(t)}},function(t,e,n){var r=n(90),i=n(430),o=n(431),u=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":u&&u in Object(t)?i(t):o(t)}},function(t,e){t.exports=function(t){return null!=t&&"object"==typeof t}},function(t,e){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},function(t,e,n){var r=n(73),i=n(136);t.exports=function(t){return null!=t&&i(t.length)&&!r(t)}},function(t,e,n){(function(t){function n(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===n(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===n(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===n(t)},e.isError=function(t){return"[object Error]"===n(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=t.isBuffer}).call(this,n(89).Buffer)},function(t,e,n){"use strict";function r(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r.prototype.toString=function(t){var e=this.name+": ";return e+=this.reason||"(unknown reason)",!t&&this.mark&&(e+=" "+this.mark.toString()),e},t.exports=r},function(t,e,n){"use strict";var r=n(51);t.exports=new r({include:[n(226)],implicit:[n(619),n(620)],explicit:[n(621),n(622),n(623),n(624)]})},function(t,e,n){var r=n(66),i=n(68);t.exports=function(t){if(!i(t))return!1;var e=r(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},function(t,e,n){"use strict";var r=n(609);t.exports=r},function(t,e,n){t.exports=n(367)},function(t,e,n){"use strict";e.a=function(){var t={location:{},history:{},open:function(){},close:function(){},File:function(){}};if("undefined"==typeof window)return t;try{t=window;for(var e=0,n=["File","Blob","FormData"];e<n.length;e++){var r=n[e];r in window&&(t[r]=window[r])}}catch(t){console.error(t)}return t}()},function(t,e,n){var r=n(6),i=n(57),o="".split;t.exports=r((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==i(t)?o.call(t,""):Object(t)}:Object},function(t,e,n){var r=n(16);t.exports=function(t,e){if(!r(t))return t;var n,i;if(e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;if("function"==typeof(n=t.valueOf)&&!r(i=n.call(t)))return i;if(!e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},function(t,e,n){var r,i=n(26),o=n(252),u=n(114),s=n(81),a=n(253),c=n(156),f=n(82),l=f("IE_PROTO"),p=function(){},h=function(t){return"<script>"+t+"</"+"script>"},d=function(){try{r=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t,e;d=r?function(t){t.write(h("")),t.close();var e=t.parentWindow.Object;return t=null,e}(r):((e=c("iframe")).style.display="none",a.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(h("document.F=Object")),t.close(),t.F);for(var n=u.length;n--;)delete d.prototype[u[n]];return d()};s[l]=!0,t.exports=Object.create||function(t,e){var n;return null!==t?(p.prototype=i(t),n=new p,p.prototype=null,n[l]=t):n=d(),void 0===e?n:o(n,e)}},function(t,e,n){var r=n(157),i=n(114);t.exports=Object.keys||function(t){return r(t,i)}},function(t,e){t.exports={}},function(t,e,n){var r=n(115),i=n(117),o=r("keys");t.exports=function(t){return o[t]||(o[t]=i(t))}},function(t,e,n){t.exports=n(270)},function(t,e,n){var r,i,o=n(12),u=n(272),s=o.process,a=s&&s.versions,c=a&&a.v8;c?i=(r=c.split("."))[0]+r[1]:u&&(!(r=u.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=u.match(/Chrome\/(\d+)/))&&(i=r[1]),t.exports=i&&+i},function(t,e,n){var r=n(6),i=n(7),o=n(84),u=i("species");t.exports=function(t){return o>=51||!r((function(){var e=[];return(e.constructor={})[u]=function(){return{foo:1}},1!==e[t](Boolean).foo}))}},function(t,e,n){var r=n(122),i=n(33).f,o=n(25),u=n(21),s=n(276),a=n(7)("toStringTag");t.exports=function(t,e,n,c){if(t){var f=n?t:t.prototype;u(f,a)||i(f,a,{configurable:!0,value:e}),c&&!r&&o(f,"toString",s)}}},function(t,e,n){"use strict";t.exports=function(t){for(var e=arguments.length-1,n="Minified React error #"+t+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant="+t,r=0;r<e;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);n+=" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";var i=new Error(n);throw i.name="Invariant Violation",i.framesToPop=1,i}},function(t,e,n){"use strict";t.exports=function(t,e,n,r,i,o,u,s){if(!t){var a;if(void 0===e)a=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,i,o,u,s],f=0;(a=new Error(e.replace(/%s/g,(function(){return c[f++]})))).name="Invariant Violation"}throw a.framesToPop=1,a}}},function(t,e,n){"use strict";(function(t){var r=n(338),i=n(339),o=n(183);function u(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(u()<e)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=a.prototype:(null===t&&(t=new a(e)),t.length=e),t}function a(t,e,n){if(!(a.TYPED_ARRAY_SUPPORT||this instanceof a))return new a(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(this,t)}return c(this,t,e,n)}function c(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r);a.TYPED_ARRAY_SUPPORT?(t=e).__proto__=a.prototype:t=p(t,e);return t}(t,e,n,r):"string"==typeof e?function(t,e,n){"string"==typeof n&&""!==n||(n="utf8");if(!a.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|d(e,n),i=(t=s(t,r)).write(e,n);i!==r&&(t=t.slice(0,i));return t}(t,e,n):function(t,e){if(a.isBuffer(e)){var n=0|h(e.length);return 0===(t=s(t,n)).length||e.copy(t,0,0,n),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?s(t,0):p(t,e);if("Buffer"===e.type&&o(e.data))return p(t,e.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function f(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function l(t,e){if(f(e),t=s(t,e<0?0:0|h(e)),!a.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function p(t,e){var n=e.length<0?0:0|h(e.length);t=s(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function h(t){if(t>=u())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u().toString(16)+" bytes");return 0|t}function d(t,e){if(a.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(t).length;default:if(r)return Q(t).length;e=(""+e).toLowerCase(),r=!0}}function y(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return A(this,e,n);case"utf8":case"utf-8":return N(this,e,n);case"ascii":return D(this,e,n);case"latin1":case"binary":return I(this,e,n);case"base64":return j(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function v(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function g(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=a.from(e,r)),a.isBuffer(e))return 0===e.length?-1:w(t,e,n,r,i);if("number"==typeof e)return e&=255,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):w(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function w(t,e,n,r,i){var o,u=1,s=t.length,a=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;u=2,s/=2,a/=2,n/=2}function c(t,e){return 1===u?t[e]:t.readUInt16BE(e*u)}if(i){var f=-1;for(o=n;o<s;o++)if(c(t,o)===c(e,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===a)return f*u}else-1!==f&&(o-=o-f),f=-1}else for(n+a>s&&(n=s-a),o=n;o>=0;o--){for(var l=!0,p=0;p<a;p++)if(c(t,o+p)!==c(e,p)){l=!1;break}if(l)return o}return-1}function M(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var u=0;u<r;++u){var s=parseInt(e.substr(2*u,2),16);if(isNaN(s))return u;t[n+u]=s}return u}function _(t,e,n,r){return B(Q(e,t.length-n),t,n,r)}function m(t,e,n,r){return B(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function L(t,e,n,r){return m(t,e,n,r)}function x(t,e,n,r){return B(F(e),t,n,r)}function b(t,e,n,r){return B(function(t,e){for(var n,r,i,o=[],u=0;u<t.length&&!((e-=2)<0);++u)r=(n=t.charCodeAt(u))>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function j(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function N(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,u,s,a,c=t[i],f=null,l=c>239?4:c>223?3:c>191?2:1;if(i+l<=n)switch(l){case 1:c<128&&(f=c);break;case 2:128==(192&(o=t[i+1]))&&(a=(31&c)<<6|63&o)>127&&(f=a);break;case 3:o=t[i+1],u=t[i+2],128==(192&o)&&128==(192&u)&&(a=(15&c)<<12|(63&o)<<6|63&u)>2047&&(a<55296||a>57343)&&(f=a);break;case 4:o=t[i+1],u=t[i+2],s=t[i+3],128==(192&o)&&128==(192&u)&&128==(192&s)&&(a=(15&c)<<18|(63&o)<<12|(63&u)<<6|63&s)>65535&&a<1114112&&(f=a)}null===f?(f=65533,l=1):f>65535&&(f-=65536,r.push(f>>>10&1023|55296),f=56320|1023&f),r.push(f),i+=l}return function(t){var e=t.length;if(e<=S)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=S));return n}(r)}e.Buffer=a,e.SlowBuffer=function(t){+t!=t&&(t=0);return a.alloc(+t)},e.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=u(),a.poolSize=8192,a._augment=function(t){return t.__proto__=a.prototype,t},a.from=function(t,e,n){return c(null,t,e,n)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(t,e,n){return function(t,e,n,r){return f(e),e<=0?s(t,e):void 0!==n?"string"==typeof r?s(t,e).fill(n,r):s(t,e).fill(n):s(t,e)}(null,t,e,n)},a.allocUnsafe=function(t){return l(null,t)},a.allocUnsafeSlow=function(t){return l(null,t)},a.isBuffer=function(t){return!(null==t||!t._isBuffer)},a.compare=function(t,e){if(!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=a.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var u=t[n];if(!a.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(r,i),i+=u.length}return r},a.byteLength=d,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)v(this,e,e+1);return this},a.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)v(this,e,e+3),v(this,e+1,e+2);return this},a.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)v(this,e,e+7),v(this,e+1,e+6),v(this,e+2,e+5),v(this,e+3,e+4);return this},a.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?N(this,0,t):y.apply(this,arguments)},a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},a.prototype.compare=function(t,e,n,r,i){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),u=(n>>>=0)-(e>>>=0),s=Math.min(o,u),c=this.slice(r,i),f=t.slice(e,n),l=0;l<s;++l)if(c[l]!==f[l]){o=c[l],u=f[l];break}return o<u?-1:u<o?1:0},a.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},a.prototype.indexOf=function(t,e,n){return g(this,t,e,n,!0)},a.prototype.lastIndexOf=function(t,e,n){return g(this,t,e,n,!1)},a.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return M(this,t,e,n);case"utf8":case"utf-8":return _(this,t,e,n);case"ascii":return m(this,t,e,n);case"latin1":case"binary":return L(this,t,e,n);case"base64":return x(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var S=4096;function D(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function I(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function A(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;++o)i+=R(t[o]);return i}function O(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function E(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function C(t,e,n,r,i,o){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function T(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i<o;++i)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function z(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i<o;++i)t[n+i]=e>>>8*(r?i:3-i)&255}function k(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function U(t,e,n,r,o){return o||k(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function Y(t,e,n,r,o){return o||k(t,0,n,8),i.write(t,e,n,r,52,8),n+8}a.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),a.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=a.prototype;else{var i=e-t;n=new a(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+t]}return n},a.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||E(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},a.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||E(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},a.prototype.readUInt8=function(t,e){return e||E(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,e){return e||E(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,e){return e||E(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,e){return e||E(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,e){return e||E(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||E(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*e)),r},a.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||E(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},a.prototype.readInt8=function(t,e){return e||E(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){e||E(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt16BE=function(t,e){e||E(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt32LE=function(t,e){return e||E(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return e||E(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return e||E(t,4,this.length),i.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return e||E(t,4,this.length),i.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return e||E(t,8,this.length),i.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return e||E(t,8,this.length),i.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||C(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},a.prototype.writeUIntBE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||C(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},a.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},a.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):T(this,t,e,!0),e+2},a.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):T(this,t,e,!1),e+2},a.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):z(this,t,e,!0),e+4},a.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):z(this,t,e,!1),e+4},a.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);C(this,t,e,n,i-1,-i)}var o=0,u=1,s=0;for(this[e]=255&t;++o<n&&(u*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/u>>0)-s&255;return e+n},a.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);C(this,t,e,n,i-1,-i)}var o=n-1,u=1,s=0;for(this[e+o]=255&t;--o>=0&&(u*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/u>>0)-s&255;return e+n},a.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):T(this,t,e,!0),e+2},a.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):T(this,t,e,!1),e+2},a.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):z(this,t,e,!0),e+4},a.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):z(this,t,e,!1),e+4},a.prototype.writeFloatLE=function(t,e,n){return U(this,t,e,!0,n)},a.prototype.writeFloatBE=function(t,e,n){return U(this,t,e,!1,n)},a.prototype.writeDoubleLE=function(t,e,n){return Y(this,t,e,!0,n)},a.prototype.writeDoubleBE=function(t,e,n){return Y(this,t,e,!1,n)},a.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,o=r-n;if(this===t&&n<e&&e<r)for(i=o-1;i>=0;--i)t[i+e]=this[i+n];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o},a.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!a.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var o;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o<n;++o)this[o]=t;else{var u=a.isBuffer(t)?t:Q(new a(t,r).toString()),s=u.length;for(o=0;o<n-e;++o)this[o+e]=u[o%s]}return this};var P=/[^+\/0-9A-Za-z-_]/g;function R(t){return t<16?"0"+t.toString(16):t.toString(16)}function Q(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],u=0;u<r;++u){if((n=t.charCodeAt(u))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(u+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function F(t){return r.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(P,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function B(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}}).call(this,n(20))},function(t,e,n){var r=n(27).Symbol;t.exports=r},function(t,e,n){var r=n(66),i=n(67);t.exports=function(t){return"symbol"==typeof t||i(t)&&"[object Symbol]"==r(t)}},function(t,e,n){var r=n(47)(Object,"create");t.exports=r},function(t,e,n){var r=n(458),i=n(459),o=n(460),u=n(461),s=n(462);function a(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}a.prototype.clear=r,a.prototype.delete=i,a.prototype.get=o,a.prototype.has=u,a.prototype.set=s,t.exports=a},function(t,e,n){var r=n(52);t.exports=function(t,e){for(var n=t.length;n--;)if(r(t[n][0],e))return n;return-1}},function(t,e,n){var r=n(464);t.exports=function(t,e){var n=t.__data__;return r(e)?n["string"==typeof e?"string":"hash"]:n.map}},function(t,e,n){var r=n(492),i=n(201),o=n(69);t.exports=function(t){return o(t)?r(t):i(t)}},function(t,e,n){var r=n(91);t.exports=function(t){if("string"==typeof t||r(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e}},function(t,e,n){"use strict";(function(e){!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:function(t,n,r,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var o,u,s=arguments.length;switch(s){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick((function(){t.call(null,n)}));case 3:return e.nextTick((function(){t.call(null,n,r)}));case 4:return e.nextTick((function(){t.call(null,n,r,i)}));default:for(o=new Array(s-1),u=0;u<o.length;)o[u++]=arguments[u];return e.nextTick((function(){t.apply(null,o)}))}}}:t.exports=e}).call(this,n(36))},function(t,e,n){"use strict";t.exports=n(549)("forEach")},function(t,e,n){"use strict";t.exports=n(572)()?globalThis:n(573)},function(t,e,n){"use strict";var r=n(51);t.exports=r.DEFAULT=new r({include:[n(72)],explicit:[n(625),n(626),n(627)]})},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){var r=n(154);function i(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),r(t,i.key,i)}}t.exports=function(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){var r=n(248),i=n(255);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=r(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){var r=n(161),i=n(263),o=n(268),u=n(269);t.exports=function(t){var e=o();return function(){var n,o=i(t);if(e){var s=i(this).constructor;n=r(o,arguments,s)}else n=o.apply(this,arguments);return u(this,n)}},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){t.exports=n(399)},function(t,e,n){t.exports=n(381)},function(t,e,n){t.exports=n(395)},function(t,e,n){var r=n(24),i=n(110),o=n(56),u=n(32),s=n(78),a=n(21),c=n(155),f=Object.getOwnPropertyDescriptor;e.f=r?f:function(t,e){if(t=u(t),e=s(e,!0),c)try{return f(t,e)}catch(t){}if(a(t,e))return o(!i.f.call(t,e),t[e])}},function(t,e,n){"use strict";var r={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,o=i&&!r.call({1:2},1);e.f=o?function(t){var e=i(this,t);return!!e&&e.enumerable}:r},function(t,e,n){var r=n(58);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 0:return function(){return t.call(e)};case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}}},function(t,e,n){var r=n(32),i=n(34),o=n(158),u=function(t){return function(e,n,u){var s,a=r(e),c=i(a.length),f=o(u,c);if(t&&n!=n){for(;c>f;)if((s=a[f++])!=s)return!0}else for(;c>f;f++)if((t||f in a)&&a[f]===n)return t||f||0;return!t&&-1}};t.exports={includes:u(!0),indexOf:u(!1)}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(t,e,n){var r=n(60),i=n(116);(t.exports=function(t,e){return i[t]||(i[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.9.1",mode:r?"pure":"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})},function(t,e,n){var r=n(12),i=n(254),o="__core-js_shared__",u=r[o]||i(o,{});t.exports=u},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++n+r).toString(36)}},function(t,e,n){var r=n(21),i=n(22),o=n(82),u=n(163),s=o("IE_PROTO"),a=Object.prototype;t.exports=u?Object.getPrototypeOf:function(t){return t=i(t),r(t,s)?t[s]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?a:null}},function(t,e,n){"use strict";var r=n(78),i=n(33),o=n(56);t.exports=function(t,e,n){var u=r(e);u in t?i.f(t,u,o(0,n)):t[u]=n}},function(t,e,n){var r=n(166),i=n(84),o=n(6);t.exports=!!Object.getOwnPropertySymbols&&!o((function(){return!Symbol.sham&&(r?38===i:i>37&&i<41)}))},function(t,e,n){var r=n(7);e.f=r},function(t,e,n){var r={};r[n(7)("toStringTag")]="z",t.exports="[object z]"===String(r)},function(t,e,n){var r,i,o,u=n(277),s=n(12),a=n(16),c=n(25),f=n(21),l=n(116),p=n(82),h=n(81),d=s.WeakMap;if(u){var y=l.state||(l.state=new d),v=y.get,g=y.has,w=y.set;r=function(t,e){return e.facade=t,w.call(y,t,e),e},i=function(t){return v.call(y,t)||{}},o=function(t){return g.call(y,t)}}else{var M=p("state");h[M]=!0,r=function(t,e){return e.facade=t,c(t,M,e),e},i=function(t){return f(t,M)?t[M]:{}},o=function(t){return f(t,M)}}t.exports={set:r,get:i,has:o,enforce:function(t){return o(t)?i(t):r(t,{})},getterFor:function(t){return function(e){var n;if(!a(e)||(n=i(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}}}},function(t,e){t.exports=function(){}},function(t,e,n){"use strict";var r=n(177);t.exports=r},function(t,e,n){t.exports=n(341)},function(t,e,n){var r=n(43),i=n(35),o=n(7)("iterator");t.exports=function(t){if(null!=t)return t[o]||t["@@iterator"]||i[r(t)]}},function(t,e,n){var r=n(354),i=n(187),o=n(185);t.exports=function(t,e){var n;if(t){if("string"==typeof t)return o(t,e);var u=r(n=Object.prototype.toString.call(t)).call(n,8,-1);return"Object"===u&&t.constructor&&(u=t.constructor.name),"Map"===u||"Set"===u?i(t):"Arguments"===u||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u)?o(t,e):void 0}},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){var r=n(447),i=n(463),o=n(465),u=n(466),s=n(467);function a(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}a.prototype.clear=r,a.prototype.delete=i,a.prototype.get=o,a.prototype.has=u,a.prototype.set=s,t.exports=a},function(t,e,n){var r=n(47)(n(27),"Map");t.exports=r},function(t,e,n){var r=n(469),i=n(506),o=n(513),u=n(23),s=n(514);t.exports=function(t){return"function"==typeof t?t:null==t?o:"object"==typeof t?u(t)?i(t[0],t[1]):r(t):s(t)}},function(t,e,n){var r=n(494),i=n(67),o=Object.prototype,u=o.hasOwnProperty,s=o.propertyIsEnumerable,a=r(function(){return arguments}())?r:function(t){return i(t)&&u.call(t,"callee")&&!s.call(t,"callee")};t.exports=a},function(t,e,n){(function(t){var r=n(27),i=n(495),o=e&&!e.nodeType&&e,u=o&&"object"==typeof t&&t&&!t.nodeType&&t,s=u&&u.exports===o?r.Buffer:void 0,a=(s?s.isBuffer:void 0)||i;t.exports=a}).call(this,n(200)(t))},function(t,e){var n=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&n.test(t))&&t>-1&&t%1==0&&t<e}},function(t,e,n){var r=n(496),i=n(497),o=n(498),u=o&&o.isTypedArray,s=u?i(u):r;t.exports=s},function(t,e){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},function(t,e,n){var r=n(23),i=n(91),o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,u=/^\w*$/;t.exports=function(t,e){if(r(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!i(t))||(u.test(t)||!o.test(t)||null!=e&&t in Object(e))}},function(t,e,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var u=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(t,e){return new Promise((function(n,r){function i(){void 0!==o&&t.removeListener("error",o),n([].slice.call(arguments))}var o;"error"!==e&&(o=function(n){t.removeListener(e,i),r(n)},t.once("error",o)),t.once(e,i)}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var a=10;function c(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function f(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function l(t,e,n,r){var i,o,u,s;if(c(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),u=o[e]),void 0===u)u=o[e]=n,++t._eventsCount;else if("function"==typeof u?u=o[e]=r?[n,u]:[u,n]:r?u.unshift(n):u.push(n),(i=f(t))>0&&u.length>i&&!u.warned){u.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+u.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=u.length,s=a,console&&console.warn&&console.warn(s)}return t}function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=p.bind(r);return i.listener=n,r.wrapFn=i,i}function d(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(i):v(i,i.length)}function y(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function v(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(t){if("number"!=typeof t||t<0||u(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");a=t}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||u(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},s.prototype.getMaxListeners=function(){return f(this)},s.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r="error"===t,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var u;if(e.length>0&&(u=e[0]),u instanceof Error)throw u;var s=new Error("Unhandled error."+(u?" ("+u.message+")":""));throw s.context=u,s}var a=i[t];if(void 0===a)return!1;if("function"==typeof a)o(a,this,e);else{var c=a.length,f=v(a,c);for(n=0;n<c;++n)o(f[n],this,e)}return!0},s.prototype.addListener=function(t,e){return l(this,t,e,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(t,e){return l(this,t,e,!0)},s.prototype.once=function(t,e){return c(e),this.on(t,h(this,t,e)),this},s.prototype.prependOnceListener=function(t,e){return c(e),this.prependListener(t,h(this,t,e)),this},s.prototype.removeListener=function(t,e){var n,r,i,o,u;if(c(e),void 0===(r=this._events))return this;if(void 0===(n=r[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===e||n[o].listener===e){u=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,i),1===n.length&&(r[t]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",t,u||e)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(t){var e,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},s.prototype.listeners=function(t){return d(this,t,!0)},s.prototype.rawListeners=function(t){return d(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):y.call(t,e)},s.prototype.listenerCount=y,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(t,e,n){(e=t.exports=n(208)).Stream=e,e.Readable=e,e.Writable=n(140),e.Duplex=n(37),e.Transform=n(213),e.PassThrough=n(538)},function(t,e,n){"use strict";(function(e,r,i){var o=n(98);function u(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;t.entry=null;for(;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=w;var s,a=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?r:o.nextTick;w.WritableState=g;var c=n(70);c.inherits=n(17);var f={deprecate:n(537)},l=n(209),p=n(18).Buffer,h=i.Uint8Array||function(){};var d,y=n(210);function v(){}function g(t,e){s=s||n(37),t=t||{};var r=e instanceof s;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,c=t.writableHighWaterMark,f=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(c||0===c)?c:f,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===t.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,r=n.sync,i=n.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,r,i){--e.pendingcb,n?(o.nextTick(i,r),o.nextTick(b,t,e),t._writableState.errorEmitted=!0,t.emit("error",r)):(i(r),t._writableState.errorEmitted=!0,t.emit("error",r),b(t,e))}(t,n,r,e,i);else{var u=L(n);u||n.corked||n.bufferProcessing||!n.bufferedRequest||m(t,n),r?a(_,t,n,u,i):_(t,n,u,i)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new u(this)}function w(t){if(s=s||n(37),!(d.call(w,this)||this instanceof s))return new w(t);this._writableState=new g(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),l.call(this)}function M(t,e,n,r,i,o,u){e.writelen=r,e.writecb=u,e.writing=!0,e.sync=!0,n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function _(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),b(t,e)}function m(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,i=new Array(r),o=e.corkedRequestsFree;o.entry=n;for(var s=0,a=!0;n;)i[s]=n,n.isBuf||(a=!1),n=n.next,s+=1;i.allBuffers=a,M(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new u(e),e.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,f=n.encoding,l=n.callback;if(M(t,e,!1,e.objectMode?1:c.length,c,f,l),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function L(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function x(t,e){t._final((function(n){e.pendingcb--,n&&t.emit("error",n),e.prefinished=!0,t.emit("prefinish"),b(t,e)}))}function b(t,e){var n=L(e);return n&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,o.nextTick(x,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),n}c.inherits(w,l),g.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(g.prototype,"buffer",{get:f.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(w,Symbol.hasInstance,{value:function(t){return!!d.call(this,t)||this===w&&(t&&t._writableState instanceof g)}})):d=function(t){return t instanceof this},w.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},w.prototype.write=function(t,e,n){var r,i=this._writableState,u=!1,s=!i.objectMode&&(r=t,p.isBuffer(r)||r instanceof h);return s&&!p.isBuffer(t)&&(t=function(t){return p.from(t)}(t)),"function"==typeof e&&(n=e,e=null),s?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof n&&(n=v),i.ended?function(t,e){var n=new Error("write after end");t.emit("error",n),o.nextTick(e,n)}(this,n):(s||function(t,e,n,r){var i=!0,u=!1;return null===n?u=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||e.objectMode||(u=new TypeError("Invalid non-string/buffer chunk")),u&&(t.emit("error",u),o.nextTick(r,u),i=!1),i}(this,i,t,n))&&(i.pendingcb++,u=function(t,e,n,r,i,o){if(!n){var u=function(t,e,n){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=p.from(e,n));return e}(e,r,i);r!==u&&(n=!0,i="buffer",r=u)}var s=e.objectMode?1:r.length;e.length+=s;var a=e.length<e.highWaterMark;a||(e.needDrain=!0);if(e.writing||e.corked){var c=e.lastBufferedRequest;e.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:o,next:null},c?c.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else M(t,e,!1,s,r,i,o);return a}(this,i,s,t,e,n)),u},w.prototype.cork=function(){this._writableState.corked++},w.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||m(this,t))},w.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),w.prototype._write=function(t,e,n){n(new Error("_write() is not implemented"))},w.prototype._writev=null,w.prototype.end=function(t,e,n){var r=this._writableState;"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(t,e,n){e.ending=!0,b(t,e),n&&(e.finished?o.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,r,n)},Object.defineProperty(w.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),w.prototype.destroy=y.destroy,w.prototype._undestroy=y.undestroy,w.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,n(36),n(211).setImmediate,n(20))},function(t,e,n){"use strict";t.exports=n(568)()?Array.from:n(569)},function(t,e,n){"use strict";var r=n(586),i=n(39),o=n(48),u=Array.prototype.indexOf,s=Object.prototype.hasOwnProperty,a=Math.abs,c=Math.floor;t.exports=function(t){var e,n,f,l;if(!r(t))return u.apply(this,arguments);for(n=i(o(this).length),f=arguments[1],e=f=isNaN(f)?0:f>=0?c(f):i(this.length)-c(a(f));e<n;++e)if(s.call(this,e)&&(l=this[e],r(l)))return e;return-1}},function(t,e,n){"use strict";(function(e,n){var r=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t},i=function(t){var e,n,i=document.createTextNode(""),o=0;return new t((function(){var t;if(e)n&&(e=n.concat(e));else{if(!n)return;e=n}if(n=e,e=null,"function"==typeof n)return t=n,n=null,void t();for(i.data=o=++o%2;n;)t=n.shift(),n.length||(n=null),t()})).observe(i,{characterData:!0}),function(t){r(t),e?"function"==typeof e?e=[e,t]:e.push(t):(e=t,i.data=o=++o%2)}};t.exports=function(){if("object"==typeof e&&e&&"function"==typeof e.nextTick)return e.nextTick;if("function"==typeof queueMicrotask)return function(t){queueMicrotask(r(t))};if("object"==typeof document&&document){if("function"==typeof MutationObserver)return i(MutationObserver);if("function"==typeof WebKitMutationObserver)return i(WebKitMutationObserver)}return"function"==typeof n?function(t){n(r(t))}:"function"==typeof setTimeout||"object"==typeof setTimeout?function(t){setTimeout(r(t),0)}:null}()}).call(this,n(36),n(211).setImmediate)},function(t,e,n){"use strict";var r=n(51);t.exports=new r({explicit:[n(612),n(613),n(614)]})},function(t,e,n){var r=n(432)("toUpperCase");t.exports=r},function(t,e,n){var r=n(129);function i(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var u=t.apply(this,r);return n.cache=o.set(i,u)||o,u};return n.cache=new(i.Cache||r),n}i.Cache=r,t.exports=i},function(t,e,n){var r=n(83),i=n(364),o=n(126),u=n(189),s=n(128);t.exports=function(t,e){var n;if(void 0===r||null==i(t)){if(o(t)||(n=s(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var a=0,c=function(){};return{s:c,n:function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(t){throw t},f:c}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,l=!0,p=!1;return{s:function(){n=u(t)},n:function(){var t=n.next();return l=t.done,t},e:function(t){p=!0,f=t},f:function(){try{l||null==n.return||n.return()}finally{if(p)throw f}}}},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){t.exports=n(386)},function(t,e,n){t.exports=n(394)},function(t,e,n){t.exports=n(406)},function(t,e,n){var r=n(199),i=n(131),o=n(524),u=n(23),s=n(530);t.exports=function(t,e,n){var a=u(t)?r:o;return n&&s(t,e,n)&&(e=void 0),a(t,i(e,3))}},function(t,e,n){"use strict";n.d(e,"a",(function(){return j})),n.d(e,"b",(function(){return N}));var r=n(13),i=n.n(r),o=n(3),u=n.n(o),s=n(53),a=n.n(s),c=n(5),f=n.n(c),l=n(11),p=n.n(l),h=n(15),d=n(238),y=n.n(d),v=n(153),g=n.n(v),w=n(55),M=n.n(w),_={string:function(){return"string"},string_email:function(){return"user@example.com"},"string_date-time":function(){return(new Date).toISOString()},string_date:function(){return(new Date).toISOString().substring(0,10)},string_uuid:function(){return"3fa85f64-5717-4562-b3fc-2c963f66afa6"},string_hostname:function(){return"example.com"},string_ipv4:function(){return"198.51.100.42"},string_ipv6:function(){return"2001:0db8:5b96:0000:0000:426f:8e17:642a"},number:function(){return 0},number_float:function(){return 0},integer:function(){return 0},boolean:function(t){return"boolean"!=typeof t.default||t.default}},m=function(t){var e,n=t=Object(h.d)(t),r=n.type,i=n.format,o=_[u()(e="".concat(r,"_")).call(e,i)]||_[r];return Object(h.b)(o)?o(t):"Unknown Type: "+t.type},L=function(t){return Object(h.a)(t,"$$ref",(function(t){return"string"==typeof t&&a()(t).call(t,"#")>-1}))},x=function(t,e){return void 0===e.example&&void 0!==t.example&&(e.example=t.example),void 0===e.default&&void 0!==t.default&&(e.default=t.default),void 0===e.enum&&void 0!==t.enum&&(e.enum=t.enum),void 0===e.xml&&void 0!==t.xml&&(e.xml=t.xml),void 0===e.type&&void 0!==t.type&&(e.type=t.type),e},b=function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];e=Object(h.d)(e);var s=void 0!==r||void 0!==e.example||e&&void 0!==e.default,c=!s&&e&&e.oneOf&&e.oneOf.length>0,l=!s&&e&&e.anyOf&&e.anyOf.length>0;if(!s&&(c||l)){var d=Object(h.d)(c?e.oneOf[0]:e.anyOf[0]);if(x(d,e),!e.xml&&d.xml&&(e.xml=d.xml),void 0!==e.example&&void 0!==d.example)s=!0;else if(d.properties){e.properties||(e.properties={});var y=Object(h.d)(d.properties);for(var v in y){var g;if(y.hasOwnProperty(v))if(!y[v]||!y[v].deprecated)if(!y[v]||!y[v].readOnly||n.includeReadOnly)if(!y[v]||!y[v].writeOnly||n.includeWriteOnly)if(!e.properties[v])e.properties[v]=y[v],!d.required&&f()(d.required)&&-1!==a()(g=d.required).call(g,v)&&(e.required?e.required.push(v):e.required=[v])}}}var w,_={},b=e,j=b.xml,N=b.type,S=b.example,D=b.properties,I=b.additionalProperties,A=b.items,O=n.includeReadOnly,E=n.includeWriteOnly,C=j=j||{},T=C.name,z=C.prefix,k=C.namespace,U={};if(o&&(w=(z?z+":":"")+(T=T||"notagname"),k)){var Y=z?"xmlns:"+z:"xmlns";_[Y]=k}if(o&&(U[w]=[]),e&&!N)if(D||I)N="object";else if(A)N="array";else if(!s&&!e.enum)return;var P,R,Q=Object(h.d)(D);if(P=o?function(r){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;if(e&&Q[r]){if(Q[r].xml=Q[r].xml||{},Q[r].xml.attribute){var s=f()(Q[r].enum)?Q[r].enum[0]:void 0,a=Q[r].example,c=Q[r].default;return void(_[Q[r].xml.name||r]=void 0!==a?a:void 0!==c?c:void 0!==s?s:m(Q[r]))}Q[r].xml.name=Q[r].xml.name||r}else Q[r]||!1===I||(Q[r]={xml:{name:r}});var l,p=t(e&&Q[r]||void 0,n,i,o);f()(p)?U[w]=u()(l=U[w]).call(l,p):U[w].push(p)}:function(e,r){U[e]=t(Q[e],n,r,o)},s){var F;if(F=L(void 0!==r?r:void 0!==S?S:e.default),!o){if("number"==typeof F&&"string"===N)return"".concat(F);if("string"!=typeof F||"string"===N)return F;try{return JSON.parse(F)}catch(t){return F}}if(e||(N=f()(F)?"array":i()(F)),"array"===N){if(!f()(F)){if("string"==typeof F)return F;F=[F]}var B=e?e.items:void 0;B&&(B.xml=B.xml||j||{},B.xml.name=B.xml.name||j.name);var G=p()(F).call(F,(function(e){return t(B,n,e,o)}));return j.wrapped?(U[w]=G,M()(_)||U[w].push({_attr:_})):U=G,U}if("object"===N){if("string"==typeof F)return F;for(var W in F)F.hasOwnProperty(W)&&(e&&Q[W]&&Q[W].readOnly&&!O||e&&Q[W]&&Q[W].writeOnly&&!E||(!(e&&Q[W]&&Q[W].xml&&Q[W].xml.attribute)||S&&S[W]?e&&Q[W]&&Q[W].xml&&Q[W].xml.attribute?_[Q[W].xml.name||W]=S[W]:P(W,F[W]):_[Q[W].xml.name||W]=F[W]));return M()(_)||U[w].push({_attr:_}),U}return U[w]=M()(_)?F:[{_attr:_},F],U}if("object"===N){for(var q in Q)Q.hasOwnProperty(q)&&(Q[q]&&Q[q].deprecated||Q[q]&&Q[q].readOnly&&!O||Q[q]&&Q[q].writeOnly&&!E||P(q));if(!0===I)o?U[w].push({additionalProp:"Anything can be here"}):U.additionalProp1={};else if(I){var J=Object(h.d)(I),Z=t(J,n,void 0,o);if(o&&J.xml&&J.xml.name&&"notagname"!==J.xml.name)U[w].push(Z);else for(var V=1;V<4;V++)if(o){var X={};X["additionalProp"+V]=Z.notagname,U[w].push(X)}else U["additionalProp"+V]=Z}return o&&_&&U[w].push({_attr:_}),U}if("array"===N){var H,K;if(o&&(A.xml=A.xml||e.xml||{},A.xml.name=A.xml.name||j.name),f()(A.anyOf))H=p()(K=A.anyOf).call(K,(function(e){return t(x(A,e),n,void 0,o)}));else if(f()(A.oneOf)){var $;H=p()($=A.oneOf).call($,(function(e){return t(x(A,e),n,void 0,o)}))}else{if(!(!o||o&&j.wrapped))return t(A,n,void 0,o);H=[t(A,n,void 0,o)]}return o&&j.wrapped?(U[w]=H,M()(_)||U[w].push({_attr:_}),U):H}if(e&&f()(e.enum))R=Object(h.c)(e.enum)[0];else{if(!e)return;R=m(e)}if("file"!==N)return o?(U[w]=M()(_)?R:[{_attr:_},R],U):R},j=g()((function(t,e,n){var r=b(t,e,n,!0);if(r)return"string"==typeof r?r:y()(r,{declaration:!0,indent:"\t"})})),N=g()((function(t,e,n){return b(t,e,n,!1)}))},function(t,e,n){"use strict";var r=n(214),i=n(215),o=n(548);t.exports=function(t){var e,u=r(arguments[1]);return u.normalizer||0!==(e=u.length=i(u.length,t.length,u.async))&&(u.primitive?!1===e?u.normalizer=n(583):e>1&&(u.normalizer=n(584)(e)):u.normalizer=!1===e?n(585)():1===e?n(589)():n(590)(e)),u.async&&n(591),u.promise&&n(592),u.dispose&&n(598),u.maxAge&&n(599),u.max&&n(602),u.refCounter&&n(604),o(t,u)}},function(t,e,n){t.exports=n(244)},function(t,e,n){var r=n(24),i=n(6),o=n(156);t.exports=!r&&!i((function(){return 7!=Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},function(t,e,n){var r=n(12),i=n(16),o=r.document,u=i(o)&&i(o.createElement);t.exports=function(t){return u?o.createElement(t):{}}},function(t,e,n){var r=n(21),i=n(32),o=n(112).indexOf,u=n(81);t.exports=function(t,e){var n,s=i(t),a=0,c=[];for(n in s)!r(u,n)&&r(s,n)&&c.push(n);for(;e.length>a;)r(s,n=e[a++])&&(~o(c,n)||c.push(n));return c}},function(t,e,n){var r=n(113),i=Math.max,o=Math.min;t.exports=function(t,e){var n=r(t);return n<0?i(n+e,0):o(n,e)}},function(t,e,n){t.exports=n(256)},function(t,e,n){var r=n(26),i=n(259);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),e=n instanceof Array}catch(t){}return function(n,o){return r(n),i(o),e?t.call(n,o):n.__proto__=o,n}}():void 0)},function(t,e,n){t.exports=n(260)},function(t,e,n){"use strict";var r=n(58),i=n(16),o=[].slice,u={},s=function(t,e,n){if(!(e in u)){for(var r=[],i=0;i<e;i++)r[i]="a["+i+"]";u[e]=Function("C,a","return new C("+r.join(",")+")")}return u[e](t,n)};t.exports=Function.bind||function(t){var e=r(this),n=o.call(arguments,1),u=function(){var r=n.concat(o.call(arguments));return this instanceof u?s(e,r.length,r):e.apply(t,r)};return i(e.prototype)&&(u.prototype=e.prototype),u}},function(t,e,n){var r=n(6);t.exports=!r((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}))},function(t,e,n){"use strict";var r=n(1),i=n(6),o=n(61),u=n(16),s=n(22),a=n(34),c=n(119),f=n(165),l=n(85),p=n(7),h=n(84),d=p("isConcatSpreadable"),y=9007199254740991,v="Maximum allowed index exceeded",g=h>=51||!i((function(){var t=[];return t[d]=!1,t.concat()[0]!==t})),w=l("concat"),M=function(t){if(!u(t))return!1;var e=t[d];return void 0!==e?!!e:o(t)};r({target:"Array",proto:!0,forced:!g||!w},{concat:function(t){var e,n,r,i,o,u=s(this),l=f(u,0),p=0;for(e=-1,r=arguments.length;e<r;e++)if(M(o=-1===e?u:arguments[e])){if(p+(i=a(o.length))>y)throw TypeError(v);for(n=0;n<i;n++,p++)n in o&&c(l,p,o[n])}else{if(p>=y)throw TypeError(v);c(l,p++,o)}return l.length=p,l}})},function(t,e,n){var r=n(16),i=n(61),o=n(7)("species");t.exports=function(t,e){var n;return i(t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!i(n.prototype)?r(n)&&null===(n=n[o])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===e?0:e)}},function(t,e,n){var r=n(57),i=n(12);t.exports="process"==r(i.process)},function(t,e,n){var r=n(120);t.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(t,e,n){var r=n(157),i=n(114).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,i)}},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e,n){var r=n(25);t.exports=function(t,e,n,i){i&&i.enumerable?t[e]=n:r(t,e,n)}},function(t,e,n){n(4)("iterator")},function(t,e,n){"use strict";var r=n(1),i=n(304),o=n(118),u=n(160),s=n(86),a=n(25),c=n(170),f=n(7),l=n(60),p=n(35),h=n(173),d=h.IteratorPrototype,y=h.BUGGY_SAFARI_ITERATORS,v=f("iterator"),g="keys",w="values",M="entries",_=function(){return this};t.exports=function(t,e,n,f,h,m,L){i(n,e,f);var x,b,j,N=function(t){if(t===h&&O)return O;if(!y&&t in I)return I[t];switch(t){case g:case w:case M:return function(){return new n(this,t)}}return function(){return new n(this)}},S=e+" Iterator",D=!1,I=t.prototype,A=I[v]||I["@@iterator"]||h&&I[h],O=!y&&A||N(h),E="Array"==e&&I.entries||A;if(E&&(x=o(E.call(new t)),d!==Object.prototype&&x.next&&(l||o(x)===d||(u?u(x,d):"function"!=typeof x[v]&&a(x,v,_)),s(x,S,!0,!0),l&&(p[S]=_))),h==w&&A&&A.name!==w&&(D=!0,O=function(){return A.call(this)}),l&&!L||I[v]===O||a(I,v,O),p[e]=O,h)if(b={values:N(w),keys:m?O:N(g),entries:N(M)},L)for(j in b)(y||D||!(j in I))&&c(I,j,b[j]);else r({target:e,proto:!0,forced:y||D},b);return b}},function(t,e,n){"use strict";var r,i,o,u=n(6),s=n(118),a=n(25),c=n(21),f=n(7),l=n(60),p=f("iterator"),h=!1;[].keys&&("next"in(o=[].keys())?(i=s(s(o)))!==Object.prototype&&(r=i):h=!0);var d=null==r||u((function(){var t={};return r[p].call(t)!==t}));d&&(r={}),l&&!d||c(r,p)||a(r,p,(function(){return this})),t.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:h}},function(t,e,n){"use strict";var r=n(32),i=n(124),o=n(35),u=n(123),s=n(172),a="Array Iterator",c=u.set,f=u.getterFor(a);t.exports=s(Array,"Array",(function(t,e){c(this,{type:a,target:r(t),index:0,kind:e})}),(function(){var t=f(this),e=t.target,n=t.kind,r=t.index++;return!e||r>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:e[r],done:!1}:{value:[r,e[r]],done:!1}}),"values"),o.Arguments=o.Array,i("keys"),i("values"),i("entries")},function(t,e,n){"use strict";var r=n(87),i=n(63),o=n(176),u=(n(178),n(307));n(88),n(308);function s(t,e,n){this.props=t,this.context=e,this.refs=u,this.updater=n||o}function a(t,e,n){this.props=t,this.context=e,this.refs=u,this.updater=n||o}function c(){}s.prototype.isReactComponent={},s.prototype.setState=function(t,e){"object"!=typeof t&&"function"!=typeof t&&null!=t&&r("85"),this.updater.enqueueSetState(this,t),e&&this.updater.enqueueCallback(this,e,"setState")},s.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this),t&&this.updater.enqueueCallback(this,t,"forceUpdate")},c.prototype=s.prototype,a.prototype=new c,a.prototype.constructor=a,i(a.prototype,s.prototype),a.prototype.isPureReactComponent=!0,t.exports={Component:s,PureComponent:a}},function(t,e,n){"use strict";n(125);var r={isMounted:function(t){return!1},enqueueCallback:function(t,e){},enqueueForceUpdate:function(t){},enqueueReplaceState:function(t,e){},enqueueSetState:function(t,e){}};t.exports=r},function(t,e,n){"use strict";function r(t){return function(){return t}}var i=function(){};i.thatReturns=r,i.thatReturnsFalse=r(!1),i.thatReturnsTrue=r(!0),i.thatReturnsNull=r(null),i.thatReturnsThis=function(){return this},i.thatReturnsArgument=function(t){return t},t.exports=i},function(t,e,n){"use strict";t.exports=!1},function(t,e,n){"use strict";t.exports={current:null}},function(t,e,n){"use strict";var r="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;t.exports=r},function(t,e,n){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,e,n){t.exports=n(325)()},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){n(342);var r=n(10);t.exports=r.Array.isArray},function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){t.exports=n(344)},function(t,e,n){t.exports=n(346)},function(t,e,n){var r=n(356),i=Array.prototype;t.exports=function(t){var e=t.slice;return t===i||t instanceof Array&&e===i.slice?r:e}},function(t,e,n){t.exports=n(361)},function(t,e,n){var r=n(405);t.exports=function(t){if(r(t))throw TypeError("The method doesn't accept regular expressions");return t}},function(t,e,n){var r=n(7)("match");t.exports=function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[r]=!1,"/./"[t](e)}catch(t){}}return!1}},function(t,e){t.exports="\t\n\v\f\r \u2028\u2029\ufeff"},function(t,e,n){(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.exports=n}).call(this,n(20))},function(t,e){var n=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");t.exports=function(t){return n.test(t)}},function(t,e){var n=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return n.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},function(t,e,n){var r=n(93),i=n(471),o=n(472),u=n(473),s=n(474),a=n(475);function c(t){var e=this.__data__=new r(t);this.size=e.size}c.prototype.clear=i,c.prototype.delete=o,c.prototype.get=u,c.prototype.has=s,c.prototype.set=a,t.exports=c},function(t,e,n){var r=n(476),i=n(67);t.exports=function t(e,n,o,u,s){return e===n||(null==e||null==n||!i(e)&&!i(n)?e!=e&&n!=n:r(e,n,o,u,t,s))}},function(t,e,n){var r=n(477),i=n(199),o=n(480);t.exports=function(t,e,n,u,s,a){var c=1&n,f=t.length,l=e.length;if(f!=l&&!(c&&l>f))return!1;var p=a.get(t),h=a.get(e);if(p&&h)return p==e&&h==t;var d=-1,y=!0,v=2&n?new r:void 0;for(a.set(t,e),a.set(e,t);++d<f;){var g=t[d],w=e[d];if(u)var M=c?u(w,g,d,e,t,a):u(g,w,d,t,e,a);if(void 0!==M){if(M)continue;y=!1;break}if(v){if(!i(e,(function(t,e){if(!o(v,e)&&(g===t||s(g,t,n,u,a)))return v.push(e)}))){y=!1;break}}else if(g!==w&&!s(g,w,n,u,a)){y=!1;break}}return a.delete(t),a.delete(e),y}},function(t,e){t.exports=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){var r=n(202),i=n(499),o=Object.prototype.hasOwnProperty;t.exports=function(t){if(!r(t))return i(t);var e=[];for(var n in Object(t))o.call(t,n)&&"constructor"!=n&&e.push(n);return e}},function(t,e){var n=Object.prototype;t.exports=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||n)}},function(t,e,n){var r=n(501),i=n(130),o=n(502),u=n(503),s=n(504),a=n(66),c=n(195),f="[object Map]",l="[object Promise]",p="[object Set]",h="[object WeakMap]",d="[object DataView]",y=c(r),v=c(i),g=c(o),w=c(u),M=c(s),_=a;(r&&_(new r(new ArrayBuffer(1)))!=d||i&&_(new i)!=f||o&&_(o.resolve())!=l||u&&_(new u)!=p||s&&_(new s)!=h)&&(_=function(t){var e=a(t),n="[object Object]"==e?t.constructor:void 0,r=n?c(n):"";if(r)switch(r){case y:return d;case v:return f;case g:return l;case w:return p;case M:return h}return e}),t.exports=_},function(t,e,n){var r=n(68);t.exports=function(t){return t==t&&!r(t)}},function(t,e){t.exports=function(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}}},function(t,e,n){var r=n(207),i=n(97);t.exports=function(t,e){for(var n=0,o=(e=r(e,t)).length;null!=t&&n<o;)t=t[i(e[n++])];return n&&n==o?t:void 0}},function(t,e,n){var r=n(23),i=n(137),o=n(508),u=n(65);t.exports=function(t,e){return r(t)?t:i(t,e)?[t]:o(u(t))}},function(t,e,n){"use strict";(function(e,r){var i=n(98);t.exports=M;var o,u=n(183);M.ReadableState=w;n(138).EventEmitter;var s=function(t,e){return t.listeners(e).length},a=n(209),c=n(18).Buffer,f=e.Uint8Array||function(){};var l=n(70);l.inherits=n(17);var p=n(533),h=void 0;h=p&&p.debuglog?p.debuglog("stream"):function(){};var d,y=n(534),v=n(210);l.inherits(M,a);var g=["error","close","destroy","pause","resume"];function w(t,e){t=t||{};var r=e instanceof(o=o||n(37));this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var i=t.highWaterMark,u=t.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(u||0===u)?u:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(d||(d=n(212).StringDecoder),this.decoder=new d(t.encoding),this.encoding=t.encoding)}function M(t){if(o=o||n(37),!(this instanceof M))return new M(t);this._readableState=new w(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function _(t,e,n,r,i){var o,u=t._readableState;null===e?(u.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,b(t)}(t,u)):(i||(o=function(t,e){var n;r=e,c.isBuffer(r)||r instanceof f||"string"==typeof e||void 0===e||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));var r;return n}(u,e)),o?t.emit("error",o):u.objectMode||e&&e.length>0?("string"==typeof e||u.objectMode||Object.getPrototypeOf(e)===c.prototype||(e=function(t){return c.from(t)}(e)),r?u.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):m(t,u,e,!0):u.ended?t.emit("error",new Error("stream.push() after EOF")):(u.reading=!1,u.decoder&&!n?(e=u.decoder.write(e),u.objectMode||0!==e.length?m(t,u,e,!1):N(t,u)):m(t,u,e,!1))):r||(u.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(u)}function m(t,e,n,r){e.flowing&&0===e.length&&!e.sync?(t.emit("data",n),t.read(0)):(e.length+=e.objectMode?1:n.length,r?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&b(t)),N(t,e)}Object.defineProperty(M.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),M.prototype.destroy=v.destroy,M.prototype._undestroy=v.undestroy,M.prototype._destroy=function(t,e){this.push(null),e(t)},M.prototype.push=function(t,e){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof t&&((e=e||r.defaultEncoding)!==r.encoding&&(t=c.from(t,e),e=""),n=!0),_(this,t,e,!1,n)},M.prototype.unshift=function(t){return _(this,t,null,!0,!1)},M.prototype.isPaused=function(){return!1===this._readableState.flowing},M.prototype.setEncoding=function(t){return d||(d=n(212).StringDecoder),this._readableState.decoder=new d(t),this._readableState.encoding=t,this};var L=8388608;function x(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=L?t=L:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function b(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(h("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i.nextTick(j,t):j(t))}function j(t){h("emit readable"),t.emit("readable"),A(t)}function N(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(S,t,e))}function S(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(h("maybeReadMore read 0"),t.read(0),n!==e.length);)n=e.length;e.readingMore=!1}function D(t){h("readable nexttick read 0"),t.read(0)}function I(t,e){e.reading||(h("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),A(t),e.flowing&&!e.reading&&t.read(0)}function A(t){var e=t._readableState;for(h("flow",e.flowing);e.flowing&&null!==t.read(););}function O(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):n=function(t,e,n){var r;t<e.head.data.length?(r=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):r=t===e.head.data.length?e.shift():n?function(t,e){var n=e.head,r=1,i=n.data;t-=i.length;for(;n=n.next;){var o=n.data,u=t>o.length?o.length:t;if(u===o.length?i+=o:i+=o.slice(0,t),0===(t-=u)){u===o.length?(++r,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(u));break}++r}return e.length-=r,i}(t,e):function(t,e){var n=c.allocUnsafe(t),r=e.head,i=1;r.data.copy(n),t-=r.data.length;for(;r=r.next;){var o=r.data,u=t>o.length?o.length:t;if(o.copy(n,n.length-t,0,u),0===(t-=u)){u===o.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(u));break}++i}return e.length-=i,n}(t,e);return r}(t,e.buffer,e.decoder),n);var n}function E(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i.nextTick(C,e,t))}function C(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function T(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1}M.prototype.read=function(t){h("read",t),t=parseInt(t,10);var e=this._readableState,n=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return h("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?E(this):b(this),null;if(0===(t=x(t,e))&&e.ended)return 0===e.length&&E(this),null;var r,i=e.needReadable;return h("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&h("length less than watermark",i=!0),e.ended||e.reading?h("reading or ended",i=!1):i&&(h("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=x(n,e))),null===(r=t>0?O(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&E(this)),null!==r&&this.emit("data",r),r},M.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},M.prototype.pipe=function(t,e){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,h("pipe count=%d opts=%j",o.pipesCount,e);var a=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?f:M;function c(e,r){h("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,h("cleanup"),t.removeListener("close",g),t.removeListener("finish",w),t.removeListener("drain",l),t.removeListener("error",v),t.removeListener("unpipe",c),n.removeListener("end",f),n.removeListener("end",M),n.removeListener("data",y),p=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||l())}function f(){h("onend"),t.end()}o.endEmitted?i.nextTick(a):n.once("end",a),t.on("unpipe",c);var l=function(t){return function(){var e=t._readableState;h("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,A(t))}}(n);t.on("drain",l);var p=!1;var d=!1;function y(e){h("ondata"),d=!1,!1!==t.write(e)||d||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==T(o.pipes,t))&&!p&&(h("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function v(e){h("onerror",e),M(),t.removeListener("error",v),0===s(t,"error")&&t.emit("error",e)}function g(){t.removeListener("finish",w),M()}function w(){h("onfinish"),t.removeListener("close",g),M()}function M(){h("unpipe"),n.unpipe(t)}return n.on("data",y),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?u(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",v),t.once("close",g),t.once("finish",w),t.emit("pipe",n),o.flowing||(h("pipe resume"),n.resume()),t},M.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n)),this;if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,n);return this}var u=T(e.pipes,t);return-1===u||(e.pipes.splice(u,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,n)),this},M.prototype.on=function(t,e){var n=a.prototype.on.call(this,t,e);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&b(this):i.nextTick(D,this))}return n},M.prototype.addListener=M.prototype.on,M.prototype.resume=function(){var t=this._readableState;return t.flowing||(h("resume"),t.flowing=!0,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(I,t,e))}(this,t)),this},M.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this},M.prototype.wrap=function(t){var e=this,n=this._readableState,r=!1;for(var i in t.on("end",(function(){if(h("wrapped end"),n.decoder&&!n.ended){var t=n.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){(h("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i)||(n.objectMode||i&&i.length)&&(e.push(i)||(r=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<g.length;o++)t.on(g[o],this.emit.bind(this,g[o]));return this._read=function(e){h("wrapped _read",e),r&&(r=!1,t.resume())},this},Object.defineProperty(M.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),M._fromList=O}).call(this,n(20),n(36))},function(t,e,n){t.exports=n(138).EventEmitter},function(t,e,n){"use strict";var r=n(98);function i(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var n=this,o=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return o||u?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||r.nextTick(i,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?(r.nextTick(i,n,t),n._writableState&&(n._writableState.errorEmitted=!0)):e&&e(t)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(t,e,n){(function(t){var r=void 0!==t&&t||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(i.call(setTimeout,r,arguments),clearTimeout)},e.setInterval=function(){return new o(i.call(setInterval,r,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},n(536),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(20))},function(t,e,n){"use strict";var r=n(18).Buffer,i=r.isEncoding||function(t){switch((t=""+t)&&t.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!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(r.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=a,this.end=c,e=4;break;case"utf8":this.fillLast=s,e=4;break;case"base64":this.text=f,this.end=l,e=3;break;default:return this.write=p,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(e)}function u(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function a(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function c(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function f(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function p(t){return t.toString(this.encoding)}function h(t){return t&&t.length?this.write(t):""}e.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<t.length?e?e+this.text(t,n):this.text(t,n):e||""},o.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},o.prototype.text=function(t,e){var n=function(t,e,n){var r=e.length-1;if(r<n)return 0;var i=u(e[r]);if(i>=0)return i>0&&(t.lastNeed=i-1),i;if(--r<n||-2===i)return 0;if((i=u(e[r]))>=0)return i>0&&(t.lastNeed=i-2),i;if(--r<n||-2===i)return 0;if((i=u(e[r]))>=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,n){"use strict";t.exports=u;var r=n(37),i=n(70);function o(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function u(t){if(!(this instanceof u))return new u(t);r.call(this,t),this._transformState={afterTransform:o.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",s)}function s(){var t=this;"function"==typeof this._flush?this._flush((function(e,n){a(t,e,n)})):a(this,null,null)}function a(t,e,n){if(e)return t.emit("error",e);if(null!=n&&t.push(n),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}i.inherits=n(17),i.inherits(u,r),u.prototype.push=function(t,e){return this._transformState.needTransform=!1,r.prototype.push.call(this,t,e)},u.prototype._transform=function(t,e,n){throw new Error("_transform() is not implemented")},u.prototype._write=function(t,e,n){var r=this._transformState;if(r.writecb=n,r.writechunk=t,r.writeencoding=e,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},u.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},u.prototype._destroy=function(t,e){var n=this;r.prototype._destroy.call(this,t,(function(t){e(t),n.emit("close")}))}},function(t,e,n){"use strict";var r=n(38),i=Array.prototype.forEach,o=Object.create,u=function(t,e){var n;for(n in t)e[n]=t[n]};t.exports=function(t){var e=o(null);return i.call(arguments,(function(t){r(t)&&u(Object(t),e)})),e}},function(t,e,n){"use strict";var r=n(39);t.exports=function(t,e,n){var i;return isNaN(t)?(i=e)>=0?n&&i?i-1:i:1:!1!==t&&r(t)}},function(t,e,n){"use strict";t.exports=n(552)()?Object.assign:n(553)},function(t,e,n){"use strict";var r,i,o,u,s,a=n(39),c=function(t,e){return e};try{Object.defineProperty(c,"length",{configurable:!0,writable:!1,enumerable:!1,value:1})}catch(t){}1===c.length?(r={configurable:!0,writable:!1,enumerable:!1},i=Object.defineProperty,t.exports=function(t,e){return e=a(e),t.length===e?t:(r.value=e,i(t,"length",r))}):(u=n(218),s=[],o=function(t){var e,n=0;if(s[t])return s[t];for(e=[];t--;)e.push("a"+(++n).toString(36));return new Function("fn","return function ("+e.join(", ")+") { return fn.apply(this, arguments); };")},t.exports=function(t,e){var n;if(e=a(e),t.length===e)return t;n=o(e)(t);try{u(n,t)}catch(t){}return n})},function(t,e,n){"use strict";var r=n(48),i=Object.defineProperty,o=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,s=Object.getOwnPropertySymbols;t.exports=function(t,e){var n,a=Object(r(e));if(t=Object(r(t)),u(a).forEach((function(r){try{i(t,r,o(e,r))}catch(t){n=t}})),"function"==typeof s&&s(a).forEach((function(r){try{i(t,r,o(e,r))}catch(t){n=t}})),void 0!==n)throw n;return t}},function(t,e,n){"use strict";t.exports=function(t){return null!=t}},function(t,e,n){"use strict";var r=n(575);t.exports=function(t){if(!r(t))throw new TypeError(t+" is not a symbol");return t}},function(t,e,n){"use strict";var r=n(31),i=n(99),o=Function.prototype.call;t.exports=function(t,e){var n={},u=arguments[2];return r(e),i(t,(function(t,r,i,s){n[r]=o.call(e,u,t,r,i,s)})),n}},function(t,e,n){"use strict";t.exports=function(t){return"function"==typeof t}},function(t,e){function n(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then}t.exports=n,t.exports.default=n},function(t,e,n){var r=n(17),i=n(49),o=n(18).Buffer,u=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=new Array(64);function a(){this.init(),this._w=s,i.call(this,64,56)}function c(t,e,n){return n^t&(e^n)}function f(t,e,n){return t&e|n&(t|e)}function l(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function p(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function h(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}r(a,i),a.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},a.prototype._update=function(t){for(var e,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,d=0|this._f,y=0|this._g,v=0|this._h,g=0;g<16;++g)n[g]=t.readInt32BE(4*g);for(;g<64;++g)n[g]=0|(((e=n[g-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+n[g-7]+h(n[g-15])+n[g-16];for(var w=0;w<64;++w){var M=v+p(a)+c(a,d,y)+u[w]+n[w]|0,_=l(r)+f(r,i,o)|0;v=y,y=d,d=a,a=s+M|0,s=o,o=i,i=r,r=M+_|0}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0,this._f=d+this._f|0,this._g=y+this._g|0,this._h=v+this._h|0},a.prototype._hash=function(){var t=o.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=a},function(t,e,n){var r=n(17),i=n(49),o=n(18).Buffer,u=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],s=new Array(160);function a(){this.init(),this._w=s,i.call(this,128,112)}function c(t,e,n){return n^t&(e^n)}function f(t,e,n){return t&e|n&(t|e)}function l(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function p(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function h(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function d(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function y(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function v(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function g(t,e){return t>>>0<e>>>0?1:0}r(a,i),a.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},a.prototype._update=function(t){for(var e=this._w,n=0|this._ah,r=0|this._bh,i=0|this._ch,o=0|this._dh,s=0|this._eh,a=0|this._fh,w=0|this._gh,M=0|this._hh,_=0|this._al,m=0|this._bl,L=0|this._cl,x=0|this._dl,b=0|this._el,j=0|this._fl,N=0|this._gl,S=0|this._hl,D=0;D<32;D+=2)e[D]=t.readInt32BE(4*D),e[D+1]=t.readInt32BE(4*D+4);for(;D<160;D+=2){var I=e[D-30],A=e[D-30+1],O=h(I,A),E=d(A,I),C=y(I=e[D-4],A=e[D-4+1]),T=v(A,I),z=e[D-14],k=e[D-14+1],U=e[D-32],Y=e[D-32+1],P=E+k|0,R=O+z+g(P,E)|0;R=(R=R+C+g(P=P+T|0,T)|0)+U+g(P=P+Y|0,Y)|0,e[D]=R,e[D+1]=P}for(var Q=0;Q<160;Q+=2){R=e[Q],P=e[Q+1];var F=f(n,r,i),B=f(_,m,L),G=l(n,_),W=l(_,n),q=p(s,b),J=p(b,s),Z=u[Q],V=u[Q+1],X=c(s,a,w),H=c(b,j,N),K=S+J|0,$=M+q+g(K,S)|0;$=($=($=$+X+g(K=K+H|0,H)|0)+Z+g(K=K+V|0,V)|0)+R+g(K=K+P|0,P)|0;var tt=W+B|0,et=G+F+g(tt,W)|0;M=w,S=N,w=a,N=j,a=s,j=b,s=o+$+g(b=x+K|0,x)|0,o=i,x=L,i=r,L=m,r=n,m=_,n=$+et+g(_=K+tt|0,K)|0}this._al=this._al+_|0,this._bl=this._bl+m|0,this._cl=this._cl+L|0,this._dl=this._dl+x|0,this._el=this._el+b|0,this._fl=this._fl+j|0,this._gl=this._gl+N|0,this._hl=this._hl+S|0,this._ah=this._ah+n+g(this._al,_)|0,this._bh=this._bh+r+g(this._bl,m)|0,this._ch=this._ch+i+g(this._cl,L)|0,this._dh=this._dh+o+g(this._dl,x)|0,this._eh=this._eh+s+g(this._el,b)|0,this._fh=this._fh+a+g(this._fl,j)|0,this._gh=this._gh+w+g(this._gl,N)|0,this._hh=this._hh+M+g(this._hl,S)|0},a.prototype._hash=function(){var t=o.allocUnsafe(64);function e(e,n,r){t.writeInt32BE(e,r),t.writeInt32BE(n,r+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},t.exports=a},function(t,e,n){"use strict";var r=n(51);t.exports=new r({include:[n(227)]})},function(t,e,n){"use strict";var r=n(51);t.exports=new r({include:[n(144)],implicit:[n(615),n(616),n(617),n(618)]})},function(t,e){t.exports="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgNDA3IDExNiI+DQogIDxkZWZzPg0KICAgIDxzdHlsZT4NCiAgICAgIC5jbHMtMSB7DQogICAgICAgIGNsaXAtcGF0aDogdXJsKCNjbGlwLVNXX1RNLWxvZ28tb24tZGFyayk7DQogICAgICB9DQoNCiAgICAgIC5jbHMtMiB7DQogICAgICAgIGZpbGw6ICNmZmY7DQogICAgICB9DQoNCiAgICAgIC5jbHMtMyB7DQogICAgICAgIGZpbGw6ICM4NWVhMmQ7DQogICAgICB9DQoNCiAgICAgIC5jbHMtNCB7DQogICAgICAgIGZpbGw6ICMxNzM2NDc7DQogICAgICB9DQogICAgPC9zdHlsZT4NCiAgICA8Y2xpcFBhdGggaWQ9ImNsaXAtU1dfVE0tbG9nby1vbi1kYXJrIj4NCiAgICAgIDxyZWN0IHdpZHRoPSI0MDciIGhlaWdodD0iMTE2Ii8+DQogICAgPC9jbGlwUGF0aD4NCiAgPC9kZWZzPg0KICA8ZyBpZD0iU1dfVE0tbG9nby1vbi1kYXJrIiBjbGFzcz0iY2xzLTEiPg0KICAgIDxnIGlkPSJTV19Jbi1Qcm9kdWN0IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMC4zMDEpIj4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzI5MzYiIGRhdGEtbmFtZT0iUGF0aCAyOTM2IiBjbGFzcz0iY2xzLTIiIGQ9Ik0zNTkuMTUsNzAuNjc0aC0uN1Y2Ni45OTJoLTEuMjZ2LS42aDMuMjE5di42SDM1OS4xNVoiLz4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzI5MzciIGRhdGEtbmFtZT0iUGF0aCAyOTM3IiBjbGFzcz0iY2xzLTIiIGQ9Ik0zNjMuMjE3LDcwLjY3NCwzNjEuOTc1LDY3LjFoLS4wMjNxLjA1LjguMDUsMS40OTR2Mi4wODNoLS42MzZWNjYuMzkxaC45ODdsMS4xOSwzLjQwN2guMDE3bDEuMjI1LTMuNDA3aC45OXY0LjI4M0gzNjUuMVY2OC41NTZjMC0uMjEzLjAwNi0uNDkuMDE2LS44MzJzLjAyLS41NDkuMDI4LS42MjFoLS4wMjNsLTEuMjg2LDMuNTcxWiIvPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfMjkzOCIgZGF0YS1uYW1lPSJQYXRoIDI5MzgiIGNsYXNzPSJjbHMtMyIgZD0iTTUwLjMyOCw5Ny42NjlBNDcuNjQyLDQ3LjY0MiwwLDEsMSw5Ny45NzEsNTAuMDI3LDQ3LjY0Miw0Ny42NDIsMCwwLDEsNTAuMzI4LDk3LjY2OVoiLz4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzI5MzkiIGRhdGEtbmFtZT0iUGF0aCAyOTM5IiBjbGFzcz0iY2xzLTMiIGQ9Ik01MC4zMjgsNC43NjlBNDUuMjU4LDQ1LjI1OCwwLDEsMSw1LjA3LDUwLjAyNyw0NS4yNTgsNDUuMjU4LDAsMCwxLDUwLjMyOCw0Ljc2OW0wLTQuNzY5YTUwLjAyNyw1MC4wMjcsMCwxLDAsNTAuMDI3LDUwLjAyN0E1MC4wMjcsNTAuMDI3LDAsMCwwLDUwLjMyOCwwWiIvPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfMjk0MCIgZGF0YS1uYW1lPSJQYXRoIDI5NDAiIGNsYXNzPSJjbHMtNCIgZD0iTTMxLjgsMzMuODU0Yy0uMTU0LDEuNzEyLjA1OCwzLjQ4Mi0uMDU3LDUuMjEzYTQyLjY2NSw0Mi42NjUsMCwwLDEtLjY5Myw1LjE1Niw5LjUzLDkuNTMsMCwwLDEtNC4xLDUuODI5YzQuMDc5LDIuNjU0LDQuNTQsNi43NzEsNC44MSwxMC45NDYuMTM1LDIuMjUuMDc3LDQuNTIuMzA4LDYuNzUyLjE3MywxLjczMS44NDYsMi4xNzQsMi42MzYsMi4yMzEuNzMuMDIsMS40OCwwLDIuMzI3LDBWNzUuMzNjLTUuMjkuOS05LjY1Ny0uNi0xMC43MzQtNS4wNzlhMzAuNzYsMzAuNzYsMCwwLDEtLjY1NC01Yy0uMTE3LTEuNzg5LjA3Ni0zLjU3OC0uMDU4LTUuMzY3LS4zODYtNC45MDYtMS4wMi02LjU2LTUuNzEzLTYuNzkxdi02LjFBOS4xOTEsOS4xOTEsMCwwLDEsMjAuOSw0Ni44MmMyLjU3Ny0uMTM1LDMuNjc0LS45MjQsNC4yMzEtMy40NjNhMjkuMywyOS4zLDAsMCwwLC40ODEtNC4zMjksODIuMSw4Mi4xLDAsMCwxLC42LTguNDA2Yy42NzMtMy45ODIsMy4xMzYtNS45MDYsNy4yMzQtNi4xMzcsMS4xNTQtLjA1NywyLjMyNywwLDMuNjU1LDB2NS40NjRjLS41NTguMDM4LTEuMDM5LjExNS0xLjUzOS4xMTVDMzIuMjI2LDI5Ljk0OSwzMi4wNTIsMzEuMDg0LDMxLjgsMzMuODU0Wm02LjQwNiwxMi42NThoLS4wNzdhMy41MTUsMy41MTUsMCwxLDAtLjM0Niw3LjAyMWguMjMxYTMuNDYxLDMuNDYxLDAsMCwwLDMuNjU1LTMuMjUxVjUwLjA5YTMuNTIzLDMuNTIzLDAsMCwwLTMuNDYxLTMuNTc4Wm0xMi4wNjIsMGEzLjM3MywzLjM3MywwLDAsMC0zLjQ4MiwzLjI1MSwxLjc5LDEuNzksMCwwLDAsLjAyLjMyNywzLjMsMy4zLDAsMCwwLDMuNTc4LDMuNDQzLDMuMjYzLDMuMjYzLDAsMCwwLDMuNDQzLTMuNTU4LDMuMzA4LDMuMzA4LDAsMCwwLTMuNTU3LTMuNDYzWm0xMi4zNTEsMGEzLjU5MiwzLjU5MiwwLDAsMC0zLjY1NSwzLjQ4MkEzLjUyOSwzLjUyOSwwLDAsMCw2Mi41LDUzLjUzM2guMDM5YzEuNzY5LjMwOSwzLjU1OS0xLjQsMy42NzQtMy40NjJhMy41NzEsMy41NzEsMCwwLDAtMy42LTMuNTU5Wm0xNi45NDguMjg4Yy0yLjIzMi0uMS0zLjM0OC0uODQ2LTMuOS0yLjk2MmEyMS40NDcsMjEuNDQ3LDAsMCwxLS42MzUtNC4xMzZjLS4xNTQtMi41NzgtLjEzNS01LjE3NS0uMzA4LTcuNzUzLS40LTYuMTE3LTQuODI4LTguMjUyLTExLjI1NC03LjE5NXY1LjMxYzEuMDE5LDAsMS44MDgsMCwyLjYuMDE5LDEuMzY2LjAxOSwyLjQuNTM5LDIuNTM5LDIuMDU5LjEzNSwxLjM4NS4xMzUsMi43ODkuMjcsNC4xOTMuMjY5LDIuNzkuNDIyLDUuNjE4LjksOC4zNjlBOC43MTUsOC43MTUsMCwwLDAsNzMuNyw1MC4wNTJjLTMuNCwyLjI4OS00LjQwNiw1LjU1OS00LjU3OCw5LjIzNC0uMSwyLjUyLS4xNTQsNS4wNTktLjI4OSw3LjYtLjExNSwyLjMwOC0uOTIzLDMuMDU4LTMuMjUxLDMuMTE2LS42NTQuMDE5LTEuMjg5LjA3Ny0yLjAxOS4xMTV2NS40NDVjMS4zNjUsMCwyLjYxNi4wNzcsMy44NjYsMCwzLjg4Ni0uMjMxLDYuMjMzLTIuMTE3LDctNS44ODdBNDkuMDc5LDQ5LjA3OSwwLDAsMCw3NSw2My40Yy4xMzUtMS45MjMuMTE2LTMuODY2LjMwOC01Ljc3MS4yODktMi45ODIsMS42NTUtNC4yMTMsNC42MzYtNC40YTQuMDM3LDQuMDM3LDAsMCwwLC44MjgtLjE5MnYtNi4xYy0uNS0uMDU4LS44NDMtLjExNS0xLjIwOC0uMTM1WiIvPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfMjk0MSIgZGF0YS1uYW1lPSJQYXRoIDI5NDEiIGNsYXNzPSJjbHMtMiIgZD0iTTE1Mi4yNzMsNTguMTIyYTExLjIyOCwxMS4yMjgsMCwwLDEtNC4zODQsOS40MjRxLTQuMzgzLDMuMzgyLTExLjksMy4zODItOC4xNCwwLTEyLjUyNC0yLjFWNjMuN2EzMi45LDMyLjksMCwwLDAsNi4xMzcsMS44NzksMzIuMywzMi4zLDAsMCwwLDYuNTc1LjY4OXE1LjMyMiwwLDguMDE1LTIuMDJhNi42MjYsNi42MjYsMCwwLDAsMi42OTItNS42Miw3LjIyMiw3LjIyMiwwLDAsMC0uOTU0LTMuOSw4Ljg4NSw4Ljg4NSwwLDAsMC0zLjE5NC0yLjgsNDQuNjM0LDQ0LjYzNCwwLDAsMC02LjgxLTIuOTExcS02LjM4Ny0yLjI4Ni05LjEyNi01LjQxN2ExMS45NTUsMTEuOTU1LDAsMCwxLTIuNzQtOC4xNzJBMTAuMTY0LDEwLjE2NCwwLDAsMSwxMjguMDM5LDI3cTMuOTc3LTMuMTMxLDEwLjUyLTMuMTMxYTMxLDMxLDAsMCwxLDEyLjU1NSwyLjVMMTQ5LjQ1NSwzMWEyOC4zODIsMjguMzgyLDAsMCwwLTExLjAyMS0yLjM4LDEwLjY2OCwxMC42NjgsMCwwLDAtNi42MDYsMS44MTYsNS45ODQsNS45ODQsMCwwLDAtMi4zOCw1LjA0MSw3LjcyMiw3LjcyMiwwLDAsMCwuODc3LDMuOSw4LjI0Miw4LjI0MiwwLDAsMCwyLjk1OSwyLjc4NiwzNi43LDM2LjcsMCwwLDAsNi4zNzEsMi44cTcuMiwyLjU2Niw5LjkxLDUuNTFBMTAuODQsMTAuODQsMCwwLDEsMTUyLjI3Myw1OC4xMjJaIi8+DQogICAgICA8cGF0aCBpZD0iUGF0aF8yOTQyIiBkYXRhLW5hbWU9IlBhdGggMjk0MiIgY2xhc3M9ImNscy0yIiBkPSJNMTg1LjI4OCw3MC4zLDE3OSw1MC4xN3EtLjU5NC0xLjg0OC0yLjIyMi04LjM5MWgtLjI1MXEtMS4yNTIsNS40NzktMi4xOTIsOC40NTNMMTY3Ljg0OSw3MC4zaC02LjAxMWwtOS4zNjEtMzQuMzE1aDUuNDQ3cTMuMzE4LDEyLjkzMSw1LjA1NywxOS42OTNhODAuMTEyLDgwLjExMiwwLDAsMSwxLjk4OCw5LjExMWguMjVxLjM0NS0xLjc4NSwxLjExMi00LjYxOHQxLjMzLTQuNDkzbDYuMjk0LTE5LjY5M2g1LjYzNWw2LjEzNywxOS42OTNhNjYuMzY5LDY2LjM2OSwwLDAsMSwyLjM3OSw5LjA0OGguMjUxYTMzLjE2MywzMy4xNjMsMCwwLDEsLjY3My0zLjQ3NXEuNTQ4LTIuMzQ3LDYuNTI4LTI1LjI2Nmg1LjM4NUwxOTEuNDU2LDcwLjNaIi8+DQogICAgICA8cGF0aCBpZD0iUGF0aF8yOTQzIiBkYXRhLW5hbWU9IlBhdGggMjk0MyIgY2xhc3M9ImNscy0yIiBkPSJNMjI1LjExNSw3MC4zbC0xLjAzMy00Ljg4NWgtLjI1YTE0LjQ0NiwxNC40NDYsMCwwLDEtNS4xMTksNC4zNjgsMTUuNjA4LDE1LjYwOCwwLDAsMS02LjM3MiwxLjE0M3EtNS4xLDAtOC0yLjYzdC0yLjktNy40ODNxMC0xMC40LDE2LjYyNi0xMC45bDUuODIzLS4xODhWNDcuNnEwLTQuMDM4LTEuNzM4LTUuOTY0VDIxNi42LDM5LjcxM2EyMi42MzMsMjIuNjMzLDAsMCwwLTkuNzA2LDIuNjNsLTEuNi0zLjk3N2EyNC40MzcsMjQuNDM3LDAsMCwxLDUuNTU3LTIuMTYsMjQuMDU2LDI0LjA1NiwwLDAsMSw2LjA1OC0uNzgzcTYuMTM2LDAsOS4xLDIuNzI0dDIuOTU5LDguNzM1VjcwLjNabS0xMS43NDEtMy42NjNBMTAuNTQ5LDEwLjU0OSwwLDAsMCwyMjEsNjMuOTc3YTkuODQ1LDkuODQ1LDAsMCwwLDIuNzcxLTcuNDUxdi0zLjFsLTUuMi4yMTlxLTYuMi4yMTktOC45MzksMS45MjZhNS44LDUuOCwwLDAsMC0yLjc0LDUuMzA2LDUuMzU0LDUuMzU0LDAsMCwwLDEuNzA3LDQuMjksNy4wODEsNy4wODEsMCwwLDAsNC43NzUsMS40NzJaIi8+DQogICAgICA8cGF0aCBpZD0iUGF0aF8yOTQ0IiBkYXRhLW5hbWU9IlBhdGggMjk0NCIgY2xhc3M9ImNscy0yIiBkPSJNMjY0LjYsMzUuOTg3djMuMjg3bC02LjM1Ni43NTJhMTEuMTYsMTEuMTYsMCwwLDEsMi4yNTUsNi44NTYsMTAuMTQ4LDEwLjE0OCwwLDAsMS0zLjQ0NCw4LjA0N3EtMy40NDQsMy05LjQ1NiwzYTE1LjczNCwxNS43MzQsMCwwLDEtMi44OC0uMjVRMjQxLjQsNTkuNDM4LDI0MS40LDYyLjFhMi4yNDIsMi4yNDIsMCwwLDAsMS4xNTksMi4wODIsOC40NTYsOC40NTYsMCwwLDAsMy45NzYuNjczaDYuMDc0cTUuNTczLDAsOC41NjMsMi4zNDhhOC4xNTgsOC4xNTgsMCwwLDEsMi45OSw2LjgyNSw5Ljc0Myw5Ljc0MywwLDAsMS00LjU3MSw4LjY4OHEtNC41NzIsMi45ODktMTMuMzM4LDIuOTktNi43MzIsMC0xMC4zNzktMi41YTguMDg3LDguMDg3LDAsMCwxLTMuNjQ3LTcuMDc2LDcuOTQ2LDcuOTQ2LDAsMCwxLDItNS40MTcsMTAuMjExLDEwLjIxMSwwLDAsMSw1LjYzNi0zLjEsNS40MjksNS40MjksMCwwLDEtMi4yMDctMS44NDcsNC44OSw0Ljg5LDAsMCwxLS44OTMtMi45MTIsNS41Myw1LjUzLDAsMCwxLDEtMy4yODgsMTAuNTI5LDEwLjUyOSwwLDAsMSwzLjE2Mi0yLjcyMyw5LjI3NSw5LjI3NSwwLDAsMS00LjMzNi0zLjcyNiwxMC45NDUsMTAuOTQ1LDAsMCwxLTEuNjc1LTYuMDEycTAtNS42MzQsMy4zODItOC42ODh0OS41OC0zLjA1MmExNy40MzksMTcuNDM5LDAsMCwxLDQuODUzLjYyNlpNMjM3LjIzMyw3Ni4wNjJhNC42Niw0LjY2LDAsMCwwLDIuMzQ4LDQuMjI3LDEyLjk3MywxMi45NzMsMCwwLDAsNi43MzIsMS40NHE2LjU0MywwLDkuNjktMS45NTZhNS45OTIsNS45OTIsMCwwLDAsMy4xNDctNS4zMDdxMC0yLjc4Ny0xLjcyMy0zLjg2N3QtNi40ODEtMS4wOGgtNi4yM2E4LjIwNSw4LjIwNSwwLDAsMC01LjUxLDEuNjksNi4wNDMsNi4wNDMsMCwwLDAtMS45NzMsNC44NTNabTIuODE4LTI5LjA4NmE2Ljk4NCw2Ljk4NCwwLDAsMCwyLjAzNSw1LjQ0OCw4LjEyMyw4LjEyMywwLDAsMCw1LjY2NywxLjg0N3E3LjYwOCwwLDcuNjA4LTcuMzg5LDAtNy43MzMtNy43LTcuNzMzYTcuNjI4LDcuNjI4LDAsMCwwLTUuNjM1LDEuOTcycS0xLjk3NiwxLjk3My0xLjk3NSw1Ljg1NVoiLz4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzI5NDUiIGRhdGEtbmFtZT0iUGF0aCAyOTQ1IiBjbGFzcz0iY2xzLTIiIGQ9Ik0yOTkuMTM2LDM1Ljk4N3YzLjI4N2wtNi4zNTYuNzUyYTExLjE2OCwxMS4xNjgsMCwwLDEsMi4yNTQsNi44NTYsMTAuMTQ1LDEwLjE0NSwwLDAsMS0zLjQ0NCw4LjA0N3EtMy40NDQsMy05LjQ1NSwzYTE1LjczNCwxNS43MzQsMCwwLDEtMi44OC0uMjVxLTMuMzIsMS43NTQtMy4zMTksNC40MTVhMi4yNDMsMi4yNDMsMCwwLDAsMS4xNTgsMi4wODIsOC40NTksOC40NTksMCwwLDAsMy45NzYuNjczaDYuMDc0cTUuNTc0LDAsOC41NjMsMi4zNDhhOC4xNTgsOC4xNTgsMCwwLDEsMi45OSw2LjgyNSw5Ljc0Myw5Ljc0MywwLDAsMS00LjU3MSw4LjY4OHEtNC41NywyLjk4OS0xMy4zMzcsMi45OS02LjczMiwwLTEwLjM3OS0yLjVhOC4wODgsOC4wODgsMCwwLDEtMy42NDgtNy4wNzYsNy45NDcsNy45NDcsMCwwLDEsMi01LjQxNywxMC4yMDcsMTAuMjA3LDAsMCwxLDUuNjM2LTMuMSw1LjQzMiw1LjQzMiwwLDAsMS0yLjIwOC0xLjg0Nyw0Ljg4OSw0Ljg4OSwwLDAsMS0uODkyLTIuOTEyLDUuNTMsNS41MywwLDAsMSwxLTMuMjg4LDEwLjUyOSwxMC41MjksMCwwLDEsMy4xNjItMi43MjMsOS4yNzEsOS4yNzEsMCwwLDEtNC4zMzYtMy43MjYsMTAuOTQ1LDEwLjk0NSwwLDAsMS0xLjY3NS02LjAxMnEwLTUuNjM0LDMuMzgxLTguNjg4dDkuNTgxLTMuMDUyYTE3LjQ0NCwxNy40NDQsMCwwLDEsNC44NTMuNjI2Wk0yNzEuNzcyLDc2LjA2MmE0LjY1OCw0LjY1OCwwLDAsMCwyLjM0OCw0LjIyNywxMi45NjksMTIuOTY5LDAsMCwwLDYuNzMxLDEuNDRxNi41NDQsMCw5LjY5MS0xLjk1NmE1Ljk5Myw1Ljk5MywwLDAsMCwzLjE0Ni01LjMwN3EwLTIuNzg3LTEuNzIyLTMuODY3dC02LjQ4MS0xLjA4aC02LjIzYTguMjA4LDguMjA4LDAsMCwwLTUuNTExLDEuNjlBNi4wNDIsNi4wNDIsMCwwLDAsMjcxLjc3Miw3Ni4wNjJabTIuODE4LTI5LjA4NmE2Ljk4NCw2Ljk4NCwwLDAsMCwyLjAzNSw1LjQ0OCw4LjEyMSw4LjEyMSwwLDAsMCw1LjY2NywxLjg0N3E3LjYwNywwLDcuNjA4LTcuMzg5LDAtNy43MzMtNy43LTcuNzMzYTcuNjI5LDcuNjI5LDAsMCwwLTUuNjM1LDEuOTcycS0xLjk3NSwxLjk3My0xLjk3NSw1Ljg1NVoiLz4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzI5NDYiIGRhdGEtbmFtZT0iUGF0aCAyOTQ2IiBjbGFzcz0iY2xzLTIiIGQ9Ik0zMTYuNzc4LDcwLjkyOHEtNy42MDgsMC0xMi4wMDctNC42MzR0LTQuNC0xMi44NjhxMC04LjMsNC4wODYtMTMuMTgxYTEzLjU3MywxMy41NzMsMCwwLDEsMTAuOTc0LTQuODg0QTEyLjkzOCwxMi45MzgsMCwwLDEsMzI1LjYzOCwzOS42cTMuNzYyLDQuMjQ3LDMuNzYyLDExLjJ2My4yODdIMzA1Ljc1N3EuMTU2LDYuMDQ0LDMuMDUzLDkuMTc0dDguMTU2LDMuMTMxYTI3LjYzMywyNy42MzMsMCwwLDAsMTAuOTU4LTIuMzE3djQuNjM0YTI3LjUsMjcuNSwwLDAsMS01LjIxMywxLjcwNiwyOS4yNTEsMjkuMjUxLDAsMCwxLTUuOTMzLjUxM1ptLTEuNDA5LTMxLjIxNWE4LjQ4OSw4LjQ4OSwwLDAsMC02LjU5MSwyLjY5MiwxMi40MTYsMTIuNDE2LDAsMCwwLTIuOSw3LjQ1MmgxNy45NHEwLTQuOTE2LTIuMTkxLTcuNTNhNy43MTQsNy43MTQsMCwwLDAtNi4yNTgtMi42MTRaIi8+DQogICAgICA8cGF0aCBpZD0iUGF0aF8yOTQ3IiBkYXRhLW5hbWU9IlBhdGggMjk0NyIgY2xhc3M9ImNscy0yIiBkPSJNMzUwLjksMzUuMzYxYTIwLjM4LDIwLjM4LDAsMCwxLDQuMS4zNzVsLS43MjEsNC44MjJhMTcuNzEyLDE3LjcxMiwwLDAsMC0zLjc1Ny0uNDdBOS4xNDIsOS4xNDIsMCwwLDAsMzQzLjQsNDMuNDdhMTIuMzI3LDEyLjMyNywwLDAsMC0yLjk1OSw4LjQyMlY3MC4zaC01LjJWMzUuOTg3aDQuMjlsLjYsNi4zNTZoLjI1YTE1LjA3MiwxNS4wNzIsMCwwLDEsNC42LTUuMTY2LDEwLjM1NiwxMC4zNTYsMCwwLDEsNS45MTktMS44MTZaIi8+DQogICAgICA8cGF0aCBpZD0iUGF0aF8yOTQ4IiBkYXRhLW5hbWU9IlBhdGggMjk0OCIgY2xhc3M9ImNscy0yIiBkPSJNMjU1Ljg1Nyw5Ni42MzhzLTMuNDMtLjM5MS00Ljg1LS4zOTFjLTIuMDU4LDAtMy4xMTEuNzM1LTMuMTExLDIuMTgsMCwxLjU2OC44ODIsMS45MzUsMy43NDgsMi43MTksMy41MjcuOTgsNC44LDEuOTExLDQuOCw0Ljc3NywwLDMuNjc1LTIuMyw1LjI2Ny01LjYxLDUuMjY3YTM1LjY4NywzNS42ODcsMCwwLDEtNS40ODctLjY2MmwuMjctMi4xOHMzLjMwNi40NDEsNS4wNDYuNDQxYzIuMDgyLDAsMy4wMzctLjkzMSwzLjAzNy0yLjcsMC0xLjQyMS0uNzU5LTEuOTEtMy4zMzEtMi41MjMtMy42MjYtLjkzLTUuMTkzLTIuMDMzLTUuMTkzLTQuOTQ4LDAtMy4zODEsMi4yMjktNC43NzYsNS41ODUtNC43NzZhMzcuMiwzNy4yLDAsMCwxLDUuMzE1LjU4N1oiLz4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzI5NDkiIGRhdGEtbmFtZT0iUGF0aCAyOTQ5IiBjbGFzcz0iY2xzLTIiIGQ9Ik0yNjIuOTY3LDk0LjE0SDI2Ny43bDMuNzQ4LDEzLjEwNkwyNzUuMiw5NC4xNGg0Ljc1MnYxNi43OEgyNzcuMlY5Ni40MmgtLjE0NWwtNC4xOTEsMTMuODE2aC0yLjg0MkwyNjUuODMxLDk2LjQyaC0uMTQ1djE0LjVoLTIuNzE5WiIvPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfMjk1MCIgZGF0YS1uYW1lPSJQYXRoIDI5NTAiIGNsYXNzPSJjbHMtMiIgZD0iTTMyMi4wNTcsOTQuMTRIMzM0LjN2Mi40MjVoLTQuNzI4VjExMC45MmgtMi43NDNWOTYuNTY1aC00Ljc3N1oiLz4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzI5NTEiIGRhdGEtbmFtZT0iUGF0aCAyOTUxIiBjbGFzcz0iY2xzLTIiIGQ9Ik0zNDYuMTM3LDk0LjE0YzMuMzMyLDAsNS4xMiwxLjI0OSw1LjEyLDQuMzYxLDAsMi4wMzMtLjYzNywzLjAzNy0xLjk4NCwzLjc3MiwxLjQ0NS41NjMsMi40LDEuNTkyLDIuNCwzLjksMCwzLjQzLTIuMDgxLDQuNzUyLTUuMzM5LDQuNzUyaC02LjU2NlY5NC4xNFptLTMuNjUsMi4zNTJ2NC44aDMuNmMxLjY2NiwwLDIuNC0uODMyLDIuNC0yLjQ3NCwwLTEuNjE3LS44MzMtMi4zMjctMi41LTIuMzI3Wm0wLDcuMXY0Ljk3M2gzLjdjMS42ODksMCwyLjY5NC0uNTM5LDIuNjk0LTIuNTQ4LDAtMS45MTEtMS40MjEtMi40MjUtMi43NDQtMi40MjVaIi8+DQogICAgICA8cGF0aCBpZD0iUGF0aF8yOTUyIiBkYXRhLW5hbWU9IlBhdGggMjk1MiIgY2xhc3M9ImNscy0yIiBkPSJNMzU4LjQxNCw5NC4xNEgzNjl2Mi4zNzdoLTcuODY0djQuNzUxaDYuMzk0VjEwMy42aC02LjM5NHY0LjkyNEgzNjl2Mi40SDM1OC40MTRaIi8+DQogICAgICA8cGF0aCBpZD0iUGF0aF8yOTUzIiBkYXRhLW5hbWU9IlBhdGggMjk1MyIgY2xhc3M9ImNscy0yIiBkPSJNMzc4Ljc0Nyw5NC4xNGg1LjQxNGw0LjE2NCwxNi43OGgtMi43NDRMMzg0LjM0MiwxMDZoLTUuNzc3bC0xLjIzOSw0LjkyM2gtMi43MTlabS4zNjEsOS40NTZoNC43MDhsLTEuNzM3LTcuMTc4aC0xLjIyNVoiLz4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzI5NTQiIGRhdGEtbmFtZT0iUGF0aCAyOTU0IiBjbGFzcz0iY2xzLTIiIGQ9Ik0zOTcuMSwxMDUuOTQ3djQuOTczaC0yLjcxOVY5NC4xNGg2LjM3YzMuNywwLDUuNjgzLDIuMTIsNS42ODMsNS44NDMsMCwyLjM3Ni0uOTU2LDQuNTE5LTIuNzQ0LDUuMzUybDIuNzY5LDUuNTg1SDQwMy40N2wtMi40MjYtNC45NzNabTMuNjUxLTkuNDU1SDM5Ny4xdjcuMWgzLjdjMi4wNTcsMCwyLjg0MS0xLjg1LDIuODQxLTMuNTg5LDAtMS45LS45MzQtMy41MTEtMi44OTQtMy41MTFaIi8+DQogICAgICA8cGF0aCBpZD0iUGF0aF8yOTU1IiBkYXRhLW5hbWU9IlBhdGggMjk1NSIgY2xhc3M9ImNscy0yIiBkPSJNMjkwLjAxMyw5NC4xNGg1LjQxM2w0LjE2NCwxNi43OGgtMi43NDNMMjk1LjYwOCwxMDZoLTUuNzc3bC0xLjIzOSw0LjkyM2gtMi43MTlabS4zNjEsOS40NTZoNC43MDdsLTEuNzM3LTcuMTc4aC0xLjIyNVoiLz4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzI5NTYiIGRhdGEtbmFtZT0iUGF0aCAyOTU2IiBjbGFzcz0iY2xzLTIiIGQ9Ik0zMDguMzYyLDEwNS45NDd2NC45NzNoLTIuNzE5Vjk0LjE0aDYuMzY5YzMuNywwLDUuNjgzLDIuMTIsNS42ODMsNS44NDMsMCwyLjM3Ni0uOTU1LDQuNTE5LTIuNzQzLDUuMzUybDIuNzY4LDUuNTg1aC0yLjk4OWwtMi40MjUtNC45NzNabTMuNjUtOS40NTVoLTMuNjV2Ny4xaDMuN2MyLjA1OCwwLDIuODQxLTEuODUsMi44NDEtMy41ODlDMzE0LjksOTguMSwzMTMuOTcyLDk2LjQ5MiwzMTIuMDEyLDk2LjQ5MloiLz4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzI5NTciIGRhdGEtbmFtZT0iUGF0aCAyOTU3IiBjbGFzcz0iY2xzLTIiIGQ9Ik0xMzAuNjA2LDEwNy42NDNhMy4wMiwzLjAyLDAsMCwxLTEuMTgsMi41MzcsNS4xMTMsNS4xMTMsMCwwLDEtMy4yLjkxLDguMDMsOC4wMywwLDAsMS0zLjM3MS0uNTY0di0xLjM4M2E4Ljc5Myw4Ljc5MywwLDAsMCwxLjY1Mi41MDYsOC42NzIsOC42NzIsMCwwLDAsMS43Ny4xODYsMy41NjUsMy41NjUsMCwwLDAsMi4xNTctLjU0NCwxLjc4MywxLjc4MywwLDAsMCwuNzI1LTEuNTEyLDEuOTQ3LDEuOTQ3LDAsMCwwLS4yNTctMS4wNSwyLjM5MywyLjM5MywwLDAsMC0uODYtLjc1NCwxMi4xNzEsMTIuMTcxLDAsMCwwLTEuODMzLS43ODQsNS44NDIsNS44NDIsMCwwLDEtMi40NTYtMS40NTgsMy4yMTMsMy4yMTMsMCwwLDEtLjczOC0yLjIsMi43MzYsMi43MzYsMCwwLDEsMS4wNzEtMi4yNjcsNC40NDQsNC40NDQsMCwwLDEsMi44MzEtLjg0Myw4LjM0MSw4LjM0MSwwLDAsMSwzLjM4LjY3NWwtLjQ0NywxLjI0N2E3LjYzOSw3LjYzOSwwLDAsMC0yLjk2Ni0uNjQxLDIuODc4LDIuODc4LDAsMCwwLTEuNzc5LjQ4OSwxLjYxMiwxLjYxMiwwLDAsMC0uNjQsMS4zNTcsMi4wODEsMi4wODEsMCwwLDAsLjIzNiwxLjA0OSwyLjIzMSwyLjIzMSwwLDAsMCwuOC43NSw5Ljg3OCw5Ljg3OCwwLDAsMCwxLjcxNS43NTQsNi44LDYuOCwwLDAsMSwyLjY2NywxLjQ4MywyLjkxOSwyLjkxOSwwLDAsMSwuNzIzLDIuMDU3WiIvPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfMjk1OCIgZGF0YS1uYW1lPSJQYXRoIDI5NTgiIGNsYXNzPSJjbHMtMiIgZD0iTTEzNC40NDcsMTAxLjY4NnY1Ljk5MWEyLjQxMSwyLjQxMSwwLDAsMCwuNTE1LDEuNjg2LDIuMDksMi4wOSwwLDAsMCwxLjYwOS41NTYsMi42MjksMi42MjksMCwwLDAsMi4xMi0uNzkyLDQsNCwwLDAsMCwuNjctMi41ODd2LTQuODU0aDEuNHY5LjIzNkgxMzkuNmwtLjItMS4yMzloLS4wNzVhMi43OTMsMi43OTMsMCwwLDEtMS4xOTMsMS4wNDUsNCw0LDAsMCwxLTEuNzQuMzYyLDMuNTI5LDMuNTI5LDAsMCwxLTIuNTI0LS44LDMuNDA5LDMuNDA5LDAsMCwxLS44MzktMi41NjJ2LTYuMDQyWiIvPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfMjk1OSIgZGF0YS1uYW1lPSJQYXRoIDI5NTkiIGNsYXNzPSJjbHMtMiIgZD0iTTE0OC4yMDYsMTExLjA5YTMuOTkzLDMuOTkzLDAsMCwxLTEuNjQ3LS4zMzMsMy4xLDMuMSwwLDAsMS0xLjI1Mi0xLjAyM2gtLjFhMTIuMjY1LDEyLjI2NSwwLDAsMSwuMSwxLjUzM3YzLjhoLTEuNFYxMDEuNjg2aDEuMTM3bC4xOTQsMS4yNjRoLjA2N2EzLjI1NywzLjI1NywwLDAsMSwxLjI1Ni0xLjEsMy44MzEsMy44MzEsMCwwLDEsMS42NDMtLjMzNywzLjQxMywzLjQxMywwLDAsMSwyLjgzNiwxLjI1Niw2LjY4Myw2LjY4MywwLDAsMS0uMDE3LDcuMDU3LDMuNDIsMy40MiwwLDAsMS0yLjgxNywxLjI2NFptLS4yLTguMzg1YTIuNDgyLDIuNDgyLDAsMCwwLTIuMDQ4Ljc4NCw0LjA0MSw0LjA0MSwwLDAsMC0uNjQ5LDIuNDk0di4zMTJhNC42MjUsNC42MjUsMCwwLDAsLjY0OSwyLjc4NSwyLjQ2NywyLjQ2NywwLDAsMCwyLjA4Mi44MzksMi4xNjQsMi4xNjQsMCwwLDAsMS44NzUtLjk2OSw0LjYsNC42LDAsMCwwLC42NzgtMi42NzEsNC40MjgsNC40MjgsMCwwLDAtLjY3OC0yLjY1MSwyLjIzMiwyLjIzMiwwLDAsMC0xLjkxNS0uOTIzWiIvPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfMjk2MCIgZGF0YS1uYW1lPSJQYXRoIDI5NjAiIGNsYXNzPSJjbHMtMiIgZD0iTTE1OS4wMzksMTExLjA5YTMuOTkzLDMuOTkzLDAsMCwxLTEuNjQ3LS4zMzMsMy4xLDMuMSwwLDAsMS0xLjI1Mi0xLjAyM2gtLjFhMTIuMjY1LDEyLjI2NSwwLDAsMSwuMSwxLjUzM3YzLjhoLTEuNFYxMDEuNjg2aDEuMTM3bC4xOTQsMS4yNjRoLjA2N2EzLjI1NywzLjI1NywwLDAsMSwxLjI1Ni0xLjEsMy44MzEsMy44MzEsMCwwLDEsMS42NDMtLjMzNywzLjQxMywzLjQxMywwLDAsMSwyLjgzNiwxLjI1Niw2LjY4Myw2LjY4MywwLDAsMS0uMDE3LDcuMDU3LDMuNDIsMy40MiwwLDAsMS0yLjgxNywxLjI2NFptLS4yLTguMzg1YTIuNDgyLDIuNDgyLDAsMCwwLTIuMDQ4Ljc4NCw0LjA0MSw0LjA0MSwwLDAsMC0uNjQ5LDIuNDk0di4zMTJhNC42MjUsNC42MjUsMCwwLDAsLjY0OSwyLjc4NSwyLjQ2NywyLjQ2NywwLDAsMCwyLjA4Mi44MzksMi4xNjQsMi4xNjQsMCwwLDAsMS44NzUtLjk2OSw0LjYsNC42LDAsMCwwLC42NzgtMi42NzEsNC40MjgsNC40MjgsMCwwLDAtLjY3OC0yLjY1MSwyLjIzMiwyLjIzMiwwLDAsMC0xLjkxMS0uOTIzWiIvPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfMjk2MSIgZGF0YS1uYW1lPSJQYXRoIDI5NjEiIGNsYXNzPSJjbHMtMiIgZD0iTTE3My42MTIsMTA2LjNhNS4wOTMsNS4wOTMsMCwwLDEtMS4xMzcsMy41MjcsNC4wMDUsNC4wMDUsMCwwLDEtMy4xNDMsMS4yNjgsNC4xNzIsNC4xNzIsMCwwLDEtMi4yLS41ODEsMy44NCwzLjg0LDAsMCwxLTEuNDgzLTEuNjY5LDUuOCw1LjgsMCwwLDEtLjUyMi0yLjU0NSw1LjA4Nyw1LjA4NywwLDAsMSwxLjEyOS0zLjUxOCwzLjk5MSwzLjk5MSwwLDAsMSwzLjEzNS0xLjI2LDMuOTA3LDMuOTA3LDAsMCwxLDMuMDgsMS4yOSw1LjA3MSw1LjA3MSwwLDAsMSwxLjE0MSwzLjQ4OFptLTcuMDM2LDBhNC4zODQsNC4zODQsMCwwLDAsLjcwOCwyLjcsMi44MDksMi44MDksMCwwLDAsNC4xNjcsMCw0LjM2NSw0LjM2NSwwLDAsMCwuNzEyLTIuNyw0LjI5Myw0LjI5MywwLDAsMC0uNzEyLTIuNjc1LDIuNSwyLjUsMCwwLDAtMi4xLS45MTUsMi40NjEsMi40NjEsMCwwLDAtMi4wNzIuOSw0LjMzNCw0LjMzNCwwLDAsMC0uNywyLjY5WiIvPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfMjk2MiIgZGF0YS1uYW1lPSJQYXRoIDI5NjIiIGNsYXNzPSJjbHMtMiIgZD0iTTE4MC41MjUsMTAxLjUxN2E1LjUwNiw1LjUwNiwwLDAsMSwxLjEuMWwtLjE5NCwxLjNhNC43ODYsNC43ODYsMCwwLDAtMS4wMTEtLjEyNywyLjQ2LDIuNDYsMCwwLDAtMS45MTcuOTExLDMuMzE4LDMuMzE4LDAsMCwwLS44LDIuMjY3djQuOTU1aC0xLjR2LTkuMjM2aDEuMTU0bC4xNiwxLjcxaC4wNjhhNC4wNTQsNC4wNTQsMCwwLDEsMS4yMzgtMS4zOSwyLjc4NywyLjc4NywwLDAsMSwxLjYtLjQ5WiIvPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfMjk2MyIgZGF0YS1uYW1lPSJQYXRoIDI5NjMiIGNsYXNzPSJjbHMtMiIgZD0iTTE4Ny4zNjMsMTA5LjkzNmE0LjUwNiw0LjUwNiwwLDAsMCwuNzE2LS4wNTUsNC4zODcsNC4zODcsMCwwLDAsLjU0OC0uMTE0djEuMDdhMi41LDIuNSwwLDAsMS0uNjcuMTgxLDUsNSwwLDAsMS0uOC4wNzJxLTIuNjgsMC0yLjY4LTIuODIzdi01LjQ5NGgtMS4zMjNWMTAyLjFsMS4zMjMtLjU4Mi41OS0xLjk3MmguODA5djIuMTQxaDIuNjh2MS4wODdoLTIuNjh2NS40MzVhMS44NjksMS44NjksMCwwLDAsLjQsMS4yODFBMS4zNzcsMS4zNzcsMCwwLDAsMTg3LjM2MywxMDkuOTM2WiIvPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfMjk2NCIgZGF0YS1uYW1lPSJQYXRoIDI5NjQiIGNsYXNzPSJjbHMtMiIgZD0iTTE5NC41MzgsMTExLjA5YTQuMjM5LDQuMjM5LDAsMCwxLTMuMjMxLTEuMjQ3LDQuODI0LDQuODI0LDAsMCwxLTEuMTg0LTMuNDYzLDUuMzU1LDUuMzU1LDAsMCwxLDEuMS0zLjU0OCwzLjY1MiwzLjY1MiwwLDAsMSwyLjk1NC0xLjMxNSwzLjQ4NCwzLjQ4NCwwLDAsMSwyLjc0NywxLjE0Miw0LjM3OCw0LjM3OCwwLDAsMSwxLjAxMSwzLjAxM3YuODg1aC02LjM2MmEzLjY2LDMuNjYsMCwwLDAsLjgyMiwyLjQ2OSwyLjg0MywyLjg0MywwLDAsMCwyLjIuODQzLDcuNDMxLDcuNDMxLDAsMCwwLDIuOTQ5LS42MjR2MS4yNDdhNy4zNzcsNy4zNzcsMCwwLDEtMS40LjQ1OSw3Ljg2Myw3Ljg2MywwLDAsMS0xLjYuMTM5Wm0tLjM3OS04LjRhMi4yODYsMi4yODYsMCwwLDAtMS43NzQuNzI1LDMuMzM3LDMuMzM3LDAsMCwwLS43NzksMi4wMDZoNC44MjhhMy4wNzIsMy4wNzIsMCwwLDAtLjU5LTIuMDI3LDIuMDc2LDIuMDc2LDAsMCwwLTEuNjg1LS43MDZaIi8+DQogICAgICA8cGF0aCBpZD0iUGF0aF8yOTY1IiBkYXRhLW5hbWU9IlBhdGggMjk2NSIgY2xhc3M9ImNscy0yIiBkPSJNMjA2Ljk1MSwxMDkuNjgzaC0uMDc2YTMuMjg3LDMuMjg3LDAsMCwxLTIuOSwxLjQwNywzLjQyNywzLjQyNywwLDAsMS0yLjgxOS0xLjIzOSw1LjQ1Miw1LjQ1MiwwLDAsMS0xLjAwNi0zLjUyMiw1LjU0Miw1LjU0MiwwLDAsMSwxLjAxMS0zLjU0OCwzLjQsMy40LDAsMCwxLDIuODE0LTEuMjY0LDMuMzYxLDMuMzYxLDAsMCwxLDIuODgzLDEuMzY1aC4xMDlsLS4wNTktLjY2NS0uMDM0LS42NDlWOTcuODA5aDEuNHYxMy4xMTNoLTEuMTM4Wm0tMi44LjIzNmEyLjU1MSwyLjU1MSwwLDAsMCwyLjA3OC0uNzc5LDMuOTQ3LDMuOTQ3LDAsMCwwLC42NDQtMi41MTZ2LS4zYTQuNjM4LDQuNjM4LDAsMCwwLS42NTMtMi44LDIuNDgxLDIuNDgxLDAsMCwwLTIuMDg2LS44MzksMi4xNCwyLjE0LDAsMCwwLTEuODgzLjk1Nyw0Ljc2LDQuNzYsMCwwLDAtLjY1MywyLjcsNC41NTQsNC41NTQsMCwwLDAsLjY0OSwyLjY3MSwyLjE5NCwyLjE5NCwwLDAsMCwxLjkwNi45MDZaIi8+DQogICAgICA8cGF0aCBpZD0iUGF0aF8yOTY2IiBkYXRhLW5hbWU9IlBhdGggMjk2NiIgY2xhc3M9ImNscy0yIiBkPSJNMjIwLjcxMiwxMDEuNTM0YTMuNDM1LDMuNDM1LDAsMCwxLDIuODI3LDEuMjQzLDYuNjUzLDYuNjUzLDAsMCwxLS4wMDksNy4wNTMsMy40MTcsMy40MTcsMCwwLDEtMi44MTgsMS4yNiw0LDQsMCwwLDEtMS42NDgtLjMzMywzLjA5NCwzLjA5NCwwLDAsMS0xLjI1MS0xLjAyM2gtLjFsLS4yOTUsMS4xODhoLTFWOTcuODA5aDEuNFYxMDFxMCwxLjA2OS0uMDY4LDEuOTIxaC4wNjhhMy4zMjIsMy4zMjIsMCwwLDEsMi44OTQtMS4zODdabS0uMiwxLjE3MWEyLjQ0LDIuNDQsMCwwLDAtMi4wNjQuODIyLDYuMzM4LDYuMzM4LDAsMCwwLC4wMTcsNS41NTMsMi40NjQsMi40NjQsMCwwLDAsMi4wODEuODM5LDIuMTU4LDIuMTU4LDAsMCwwLDEuOTIyLS45NCw0LjgyOCw0LjgyOCwwLDAsMCwuNjMyLTIuNyw0LjY0NSw0LjY0NSwwLDAsMC0uNjMyLTIuNjg5LDIuMjQyLDIuMjQyLDAsMCwwLTEuOTU5LS44ODVaIi8+DQogICAgICA8cGF0aCBpZD0iUGF0aF8yOTY3IiBkYXRhLW5hbWU9IlBhdGggMjk2NyIgY2xhc3M9ImNscy0yIiBkPSJNMjI1Ljc1OCwxMDEuNjg2aDEuNWwyLjAyMyw1LjI2N2EyMC4xODgsMjAuMTg4LDAsMCwxLC44MjYsMi42aC4wNjdxLjEwOS0uNDMxLjQ1OS0xLjQ3MXQyLjI4OC02LjRoMS41TDIzMC40NTIsMTEyLjJhNS4yNTMsNS4yNTMsMCwwLDEtMS4zNzgsMi4yMTIsMi45MzIsMi45MzIsMCwwLDEtMS45MzQuNjUzLDUuNjU5LDUuNjU5LDAsMCwxLTEuMjY0LS4xNDNWMTEzLjhhNC45LDQuOSwwLDAsMCwxLjAzNy4xLDIuMTM2LDIuMTM2LDAsMCwwLDIuMDU2LTEuNjE4bC41MTQtMS4zMTRaIi8+DQogICAgPC9nPg0KICA8L2c+DQo8L3N2Zz4NCg=="},function(t,e,n){var r=n(359),i=n(360),o=n(128),u=n(363);t.exports=function(t,e){return r(t)||i(t,e)||o(t,e)||u()},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){t.exports=n(377)},function(t,e,n){t.exports=n(390)},function(t,e,n){t.exports=n(413)},function(t,e,n){t.exports=n(417)},function(t,e,n){t.exports=n(421)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sanitizeUrl=void 0;var r=/^(%20|\s)*(javascript|data|vbscript)/im,i=/[^\x20-\x7EÀ-ž]/gim,o=/^([^:]+):/gm,u=[".","/"];e.sanitizeUrl=function(t){if(!t)return"about:blank";var e=t.replace(i,"").trim();if(function(t){return u.indexOf(t[0])>-1}(e))return e;var n=e.match(o);if(!n)return e;var s=n[0];return r.test(s)?"about:blank":e}},function(t,e,n){var r=n(427),i=n(438)((function(t,e,n){return e=e.toLowerCase(),t+(n?r(e):e)}));t.exports=i},function(t,e,n){var r=n(468)(n(517));t.exports=r},function(t,e,n){(function(e){var r=n(531),i=n(532).Stream;function o(t,e,n){n=n||0;var i,u,s=(i=e,new Array(n||0).join(i||"")),a=t;if("object"==typeof t&&((a=t[u=Object.keys(t)[0]])&&a._elem))return a._elem.name=u,a._elem.icount=n,a._elem.indent=e,a._elem.indents=s,a._elem.interrupt=a,a._elem;var c,f=[],l=[];function p(t){Object.keys(t).forEach((function(e){f.push(function(t,e){return t+'="'+r(e)+'"'}(e,t[e]))}))}switch(typeof a){case"object":if(null===a)break;a._attr&&p(a._attr),a._cdata&&l.push(("<![CDATA["+a._cdata).replace(/\]\]>/g,"]]]]><![CDATA[>")+"]]>"),a.forEach&&(c=!1,l.push(""),a.forEach((function(t){"object"==typeof t?"_attr"==Object.keys(t)[0]?p(t._attr):l.push(o(t,e,n+1)):(l.pop(),c=!0,l.push(r(t)))})),c||l.push(""));break;default:l.push(r(a))}return{name:u,interrupt:!1,attributes:f,content:l,icount:n,indents:s,indent:e}}function u(t,e,n){if("object"!=typeof e)return t(!1,e);var r=e.interrupt?1:e.content.length;function i(){for(;e.content.length;){var i=e.content.shift();if(void 0!==i){if(o(i))return;u(t,i)}}t(!1,(r>1?e.indents:"")+(e.name?"</"+e.name+">":"")+(e.indent&&!n?"\n":"")),n&&n()}function o(e){return!!e.interrupt&&(e.interrupt.append=t,e.interrupt.end=i,e.interrupt=!1,t(!0),!0)}if(t(!1,e.indents+(e.name?"<"+e.name:"")+(e.attributes.length?" "+e.attributes.join(" "):"")+(r?e.name?">":"":e.name?"/>":"")+(e.indent&&r>1?"\n":"")),!r)return t(!1,e.indent?"\n":"");o(e)||i()}t.exports=function(t,n){"object"!=typeof n&&(n={indent:n});var r,s,a=n.stream?new i:null,c="",f=!1,l=n.indent?!0===n.indent?" ":n.indent:"",p=!0;function h(t){p?e.nextTick(t):t()}function d(t,e){if(void 0!==e&&(c+=e),t&&!f&&(a=a||new i,f=!0),t&&f){var n=c;h((function(){a.emit("data",n)})),c=""}}function y(t,e){u(d,o(t,l,l?1:0),e)}function v(){if(a){var t=c;h((function(){a.emit("data",t),a.emit("end"),a.readable=!1,a.emit("close")}))}}return h((function(){p=!1})),n.declaration&&(r=n.declaration,s={version:"1.0",encoding:r.encoding||"UTF-8"},r.standalone&&(s.standalone=r.standalone),y({"?xml":{_attr:s}}),c=c.replace("/>","?>")),t&&t.forEach?t.forEach((function(e,n){var r;n+1===t.length&&(r=v),y(e,r)})):y(t,v),a?(a.readable=!0,a):c},t.exports.element=t.exports.Element=function(){var t=Array.prototype.slice.call(arguments),e={_elem:o(t),push:function(t){if(!this.append)throw new Error("not assigned to a parent!");var e=this,n=this._elem.indent;u(this.append,o(t,n,this._elem.icount+(n?1:0)),(function(){e.append(!0)}))},close:function(t){void 0!==t&&this.push(t),this.end&&this.end()}};return e}}).call(this,n(36))},function(t,e,n){(function(e){var n;n=void 0!==e?e:this,t.exports=function(t){if(t.CSS&&t.CSS.escape)return t.CSS.escape;var e=function(t){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var e,n=String(t),r=n.length,i=-1,o="",u=n.charCodeAt(0);++i<r;)0!=(e=n.charCodeAt(i))?o+=e>=1&&e<=31||127==e||0==i&&e>=48&&e<=57||1==i&&e>=48&&e<=57&&45==u?"\\"+e.toString(16)+" ":0==i&&1==r&&45==e||!(e>=128||45==e||95==e||e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122)?"\\"+n.charAt(i):n.charAt(i):o+="�";return o};return t.CSS||(t.CSS={}),t.CSS.escape=e,e}(n)}).call(this,n(20))},function(t,e,n){"use strict";n.d(e,"a",(function(){return f}));var r=n(29),i=n.n(r),o=n(106),u=n.n(o),s=n(0),a=n.n(s),c=a.a.Set.of("type","format","items","default","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","maxItems","minItems","uniqueItems","enum","multipleOf");function f(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.isOAS3;if(!a.a.Map.isMap(t))return{schema:a.a.Map(),parameterContentMediaType:null};if(!n)return"body"===t.get("in")?{schema:t.get("schema",a.a.Map()),parameterContentMediaType:null}:{schema:i()(t).call(t,(function(t,e){return u()(c).call(c,e)})),parameterContentMediaType:null};if(t.get("content")){var r=t.get("content",a.a.Map({})).keySeq(),o=r.first();return{schema:t.getIn(["content",o,"schema"],a.a.Map()),parameterContentMediaType:o}}return{schema:t.get("schema",a.a.Map()),parameterContentMediaType:null}}},function(t,e,n){"use strict";(function(e,r){var i=65536,o=4294967295;var u=n(18).Buffer,s=e.crypto||e.msCrypto;s&&s.getRandomValues?t.exports=function(t,e){if(t>o)throw new RangeError("requested too many random bytes");var n=u.allocUnsafe(t);if(t>0)if(t>i)for(var a=0;a<t;a+=i)s.getRandomValues(n.slice(a,a+i));else s.getRandomValues(n);if("function"==typeof e)return r.nextTick((function(){e(null,n)}));return n}:t.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,n(20),n(36))},function(t,e,n){(e=t.exports=function(t){t=t.toLowerCase();var n=e[t];if(!n)throw new Error(t+" is not supported (we accept pull requests)");return new n}).sha=n(605),e.sha1=n(606),e.sha224=n(607),e.sha256=n(224),e.sha384=n(608),e.sha512=n(225)},function(t,e,n){t.exports=n(630)},function(t,e,n){var r=n(245);t.exports=r},function(t,e,n){n(246);var r=n(10).Object,i=t.exports=function(t,e,n){return r.defineProperty(t,e,n)};r.defineProperty.sham&&(i.sham=!0)},function(t,e,n){var r=n(1),i=n(24);r({target:"Object",stat:!0,forced:!i,sham:!i},{defineProperty:n(33).f})},function(t,e,n){var r=n(6),i=/#|\.prototype\./,o=function(t,e){var n=s[u(t)];return n==c||n!=a&&("function"==typeof e?r(e):!!e)},u=o.normalize=function(t){return String(t).replace(i,".").toLowerCase()},s=o.data={},a=o.NATIVE="N",c=o.POLYFILL="P";t.exports=o},function(t,e,n){t.exports=n(249)},function(t,e,n){var r=n(250);t.exports=r},function(t,e,n){n(251);var r=n(10).Object;t.exports=function(t,e){return r.create(t,e)}},function(t,e,n){n(1)({target:"Object",stat:!0,sham:!n(24)},{create:n(79)})},function(t,e,n){var r=n(24),i=n(33),o=n(26),u=n(80);t.exports=r?Object.defineProperties:function(t,e){o(t);for(var n,r=u(e),s=r.length,a=0;s>a;)i.f(t,n=r[a++],e[n]);return t}},function(t,e,n){var r=n(59);t.exports=r("document","documentElement")},function(t,e,n){var r=n(12),i=n(25);t.exports=function(t,e){try{i(r,t,e)}catch(n){r[t]=e}return e}},function(t,e,n){var r=n(159);function i(e,n){return t.exports=i=r||function(t,e){return t.__proto__=e,t},t.exports.default=t.exports,t.exports.__esModule=!0,i(e,n)}t.exports=i,t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){var r=n(257);t.exports=r},function(t,e,n){n(258);var r=n(10);t.exports=r.Object.setPrototypeOf},function(t,e,n){n(1)({target:"Object",stat:!0},{setPrototypeOf:n(160)})},function(t,e,n){var r=n(16);t.exports=function(t){if(!r(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype");return t}},function(t,e,n){var r=n(261);t.exports=r},function(t,e,n){n(262);var r=n(10);t.exports=r.Reflect.construct},function(t,e,n){var r=n(1),i=n(59),o=n(58),u=n(26),s=n(16),a=n(79),c=n(162),f=n(6),l=i("Reflect","construct"),p=f((function(){function t(){}return!(l((function(){}),[],t)instanceof t)})),h=!f((function(){l((function(){}))})),d=p||h;r({target:"Reflect",stat:!0,forced:d,sham:d},{construct:function(t,e){o(t),u(e);var n=arguments.length<3?t:o(arguments[2]);if(h&&!p)return l(t,e,n);if(t==n){switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3])}var r=[null];return r.push.apply(r,e),new(c.apply(t,r))}var i=n.prototype,f=a(s(i)?i:Object.prototype),d=Function.apply.call(t,f,e);return s(d)?d:f}})},function(t,e,n){var r=n(159),i=n(264);function o(e){return t.exports=o=r?i:function(t){return t.__proto__||i(t)},t.exports.default=t.exports,t.exports.__esModule=!0,o(e)}t.exports=o,t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){t.exports=n(265)},function(t,e,n){var r=n(266);t.exports=r},function(t,e,n){n(267);var r=n(10);t.exports=r.Object.getPrototypeOf},function(t,e,n){var r=n(1),i=n(6),o=n(22),u=n(118),s=n(163);r({target:"Object",stat:!0,forced:i((function(){u(1)})),sham:!s},{getPrototypeOf:function(t){return u(o(t))}})},function(t,e,n){var r=n(161);t.exports=function(){if("undefined"==typeof Reflect||!r)return!1;if(r.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(r(Boolean,[],(function(){}))),!0}catch(t){return!1}},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){var r=n(13).default,i=n(28);t.exports=function(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?i(t):e},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){var r=n(271);n(295),n(296),n(297),n(298),n(299),t.exports=r},function(t,e,n){n(164),n(273),n(274),n(279),n(280),n(281),n(282),n(171),n(283),n(284),n(285),n(286),n(287),n(288),n(289),n(290),n(291),n(292),n(293),n(294);var r=n(10);t.exports=r.Symbol},function(t,e,n){var r=n(59);t.exports=r("navigator","userAgent")||""},function(t,e){},function(t,e,n){"use strict";var r=n(1),i=n(12),o=n(59),u=n(60),s=n(24),a=n(120),c=n(167),f=n(6),l=n(21),p=n(61),h=n(16),d=n(26),y=n(22),v=n(32),g=n(78),w=n(56),M=n(79),_=n(80),m=n(168),L=n(275),x=n(169),b=n(109),j=n(33),N=n(110),S=n(25),D=n(170),I=n(115),A=n(82),O=n(81),E=n(117),C=n(7),T=n(121),z=n(4),k=n(86),U=n(123),Y=n(44).forEach,P=A("hidden"),R="Symbol",Q=C("toPrimitive"),F=U.set,B=U.getterFor(R),G=Object.prototype,W=i.Symbol,q=o("JSON","stringify"),J=b.f,Z=j.f,V=L.f,X=N.f,H=I("symbols"),K=I("op-symbols"),$=I("string-to-symbol-registry"),tt=I("symbol-to-string-registry"),et=I("wks"),nt=i.QObject,rt=!nt||!nt.prototype||!nt.prototype.findChild,it=s&&f((function(){return 7!=M(Z({},"a",{get:function(){return Z(this,"a",{value:7}).a}})).a}))?function(t,e,n){var r=J(G,e);r&&delete G[e],Z(t,e,n),r&&t!==G&&Z(G,e,r)}:Z,ot=function(t,e){var n=H[t]=M(W.prototype);return F(n,{type:R,tag:t,description:e}),s||(n.description=e),n},ut=c?function(t){return"symbol"==typeof t}:function(t){return Object(t)instanceof W},st=function(t,e,n){t===G&&st(K,e,n),d(t);var r=g(e,!0);return d(n),l(H,r)?(n.enumerable?(l(t,P)&&t[P][r]&&(t[P][r]=!1),n=M(n,{enumerable:w(0,!1)})):(l(t,P)||Z(t,P,w(1,{})),t[P][r]=!0),it(t,r,n)):Z(t,r,n)},at=function(t,e){d(t);var n=v(e),r=_(n).concat(pt(n));return Y(r,(function(e){s&&!ct.call(n,e)||st(t,e,n[e])})),t},ct=function(t){var e=g(t,!0),n=X.call(this,e);return!(this===G&&l(H,e)&&!l(K,e))&&(!(n||!l(this,e)||!l(H,e)||l(this,P)&&this[P][e])||n)},ft=function(t,e){var n=v(t),r=g(e,!0);if(n!==G||!l(H,r)||l(K,r)){var i=J(n,r);return!i||!l(H,r)||l(n,P)&&n[P][r]||(i.enumerable=!0),i}},lt=function(t){var e=V(v(t)),n=[];return Y(e,(function(t){l(H,t)||l(O,t)||n.push(t)})),n},pt=function(t){var e=t===G,n=V(e?K:v(t)),r=[];return Y(n,(function(t){!l(H,t)||e&&!l(G,t)||r.push(H[t])})),r};(a||(D((W=function(){if(this instanceof W)throw TypeError("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,e=E(t),n=function(t){this===G&&n.call(K,t),l(this,P)&&l(this[P],e)&&(this[P][e]=!1),it(this,e,w(1,t))};return s&&rt&&it(G,e,{configurable:!0,set:n}),ot(e,t)}).prototype,"toString",(function(){return B(this).tag})),D(W,"withoutSetter",(function(t){return ot(E(t),t)})),N.f=ct,j.f=st,b.f=ft,m.f=L.f=lt,x.f=pt,T.f=function(t){return ot(C(t),t)},s&&(Z(W.prototype,"description",{configurable:!0,get:function(){return B(this).description}}),u||D(G,"propertyIsEnumerable",ct,{unsafe:!0}))),r({global:!0,wrap:!0,forced:!a,sham:!a},{Symbol:W}),Y(_(et),(function(t){z(t)})),r({target:R,stat:!0,forced:!a},{for:function(t){var e=String(t);if(l($,e))return $[e];var n=W(e);return $[e]=n,tt[n]=e,n},keyFor:function(t){if(!ut(t))throw TypeError(t+" is not a symbol");if(l(tt,t))return tt[t]},useSetter:function(){rt=!0},useSimple:function(){rt=!1}}),r({target:"Object",stat:!0,forced:!a,sham:!s},{create:function(t,e){return void 0===e?M(t):at(M(t),e)},defineProperty:st,defineProperties:at,getOwnPropertyDescriptor:ft}),r({target:"Object",stat:!0,forced:!a},{getOwnPropertyNames:lt,getOwnPropertySymbols:pt}),r({target:"Object",stat:!0,forced:f((function(){x.f(1)}))},{getOwnPropertySymbols:function(t){return x.f(y(t))}}),q)&&r({target:"JSON",stat:!0,forced:!a||f((function(){var t=W();return"[null]"!=q([t])||"{}"!=q({a:t})||"{}"!=q(Object(t))}))},{stringify:function(t,e,n){for(var r,i=[t],o=1;arguments.length>o;)i.push(arguments[o++]);if(r=e,(h(e)||void 0!==t)&&!ut(t))return p(e)||(e=function(t,e){if("function"==typeof r&&(e=r.call(this,t,e)),!ut(e))return e}),i[1]=e,q.apply(null,i)}});W.prototype[Q]||S(W.prototype,Q,W.prototype.valueOf),k(W,R),O[P]=!0},function(t,e,n){var r=n(32),i=n(168).f,o={}.toString,u="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return u&&"[object Window]"==o.call(t)?function(t){try{return i(t)}catch(t){return u.slice()}}(t):i(r(t))}},function(t,e,n){"use strict";var r=n(122),i=n(43);t.exports=r?{}.toString:function(){return"[object "+i(this)+"]"}},function(t,e,n){var r=n(12),i=n(278),o=r.WeakMap;t.exports="function"==typeof o&&/native code/.test(i(o))},function(t,e,n){var r=n(116),i=Function.toString;"function"!=typeof r.inspectSource&&(r.inspectSource=function(t){return i.call(t)}),t.exports=r.inspectSource},function(t,e,n){n(4)("asyncIterator")},function(t,e){},function(t,e,n){n(4)("hasInstance")},function(t,e,n){n(4)("isConcatSpreadable")},function(t,e,n){n(4)("match")},function(t,e,n){n(4)("matchAll")},function(t,e,n){n(4)("replace")},function(t,e,n){n(4)("search")},function(t,e,n){n(4)("species")},function(t,e,n){n(4)("split")},function(t,e,n){n(4)("toPrimitive")},function(t,e,n){n(4)("toStringTag")},function(t,e,n){n(4)("unscopables")},function(t,e,n){var r=n(12);n(86)(r.JSON,"JSON",!0)},function(t,e){},function(t,e){},function(t,e,n){n(4)("asyncDispose")},function(t,e,n){n(4)("dispose")},function(t,e,n){n(4)("observable")},function(t,e,n){n(4)("patternMatch")},function(t,e,n){n(4)("replaceAll")},function(t,e,n){t.exports=n(301)},function(t,e,n){var r=n(302);t.exports=r},function(t,e,n){n(171),n(62),n(45);var r=n(121);t.exports=r.f("iterator")},function(t,e,n){var r=n(113),i=n(42),o=function(t){return function(e,n){var o,u,s=String(i(e)),a=r(n),c=s.length;return a<0||a>=c?t?"":void 0:(o=s.charCodeAt(a))<55296||o>56319||a+1===c||(u=s.charCodeAt(a+1))<56320||u>57343?t?s.charAt(a):o:t?s.slice(a,a+2):u-56320+(o-55296<<10)+65536}};t.exports={codeAt:o(!1),charAt:o(!0)}},function(t,e,n){"use strict";var r=n(173).IteratorPrototype,i=n(79),o=n(56),u=n(86),s=n(35),a=function(){return this};t.exports=function(t,e,n){var c=e+" Iterator";return t.prototype=i(r,{next:o(1,n)}),u(t,c,!1,!0),s[c]=a,t}},function(t,e){t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(t,e,n){"use strict";var r=n(63),i=n(175),o=n(309),u=n(314),s=n(46),a=n(315),c=n(321),f=n(322),l=n(324),p=s.createElement,h=s.createFactory,d=s.cloneElement,y=r,v={Children:{map:o.map,forEach:o.forEach,count:o.count,toArray:o.toArray,only:l},Component:i.Component,PureComponent:i.PureComponent,createElement:p,cloneElement:d,isValidElement:s.isValidElement,PropTypes:a,createClass:f,createFactory:h,createMixin:function(t){return t},DOM:u,version:c,__spread:y};t.exports=v},function(t,e,n){"use strict";t.exports={}},function(t,e,n){"use strict";t.exports=function(){}},function(t,e,n){"use strict";var r=n(310),i=n(46),o=n(177),u=n(311),s=r.twoArgumentPooler,a=r.fourArgumentPooler,c=/\/+/g;function f(t){return(""+t).replace(c,"$&/")}function l(t,e){this.func=t,this.context=e,this.count=0}function p(t,e,n){var r=t.func,i=t.context;r.call(i,e,t.count++)}function h(t,e,n,r){this.result=t,this.keyPrefix=e,this.func=n,this.context=r,this.count=0}function d(t,e,n){var r=t.result,u=t.keyPrefix,s=t.func,a=t.context,c=s.call(a,e,t.count++);Array.isArray(c)?y(c,r,n,o.thatReturnsArgument):null!=c&&(i.isValidElement(c)&&(c=i.cloneAndReplaceKey(c,u+(!c.key||e&&e.key===c.key?"":f(c.key)+"/")+n)),r.push(c))}function y(t,e,n,r,i){var o="";null!=n&&(o=f(n)+"/");var s=h.getPooled(e,o,r,i);u(t,d,s),h.release(s)}function v(t,e,n){return null}l.prototype.destructor=function(){this.func=null,this.context=null,this.count=0},r.addPoolingTo(l,s),h.prototype.destructor=function(){this.result=null,this.keyPrefix=null,this.func=null,this.context=null,this.count=0},r.addPoolingTo(h,a);var g={forEach:function(t,e,n){if(null==t)return t;var r=l.getPooled(e,n);u(t,p,r),l.release(r)},map:function(t,e,n){if(null==t)return t;var r=[];return y(t,r,null,e,n),r},mapIntoWithKeyPrefixInternal:y,count:function(t,e){return u(t,v,null)},toArray:function(t){var e=[];return y(t,e,null,o.thatReturnsArgument),e}};t.exports=g},function(t,e,n){"use strict";var r=n(87),i=(n(88),function(t){var e=this;if(e.instancePool.length){var n=e.instancePool.pop();return e.call(n,t),n}return new e(t)}),o=function(t){var e=this;t instanceof e||r("25"),t.destructor(),e.instancePool.length<e.poolSize&&e.instancePool.push(t)},u=i,s={addPoolingTo:function(t,e){var n=t;return n.instancePool=[],n.getPooled=e||u,n.poolSize||(n.poolSize=10),n.release=o,n},oneArgumentPooler:i,twoArgumentPooler:function(t,e){var n=this;if(n.instancePool.length){var r=n.instancePool.pop();return n.call(r,t,e),r}return new n(t,e)},threeArgumentPooler:function(t,e,n){var r=this;if(r.instancePool.length){var i=r.instancePool.pop();return r.call(i,t,e,n),i}return new r(t,e,n)},fourArgumentPooler:function(t,e,n,r){var i=this;if(i.instancePool.length){var o=i.instancePool.pop();return i.call(o,t,e,n,r),o}return new i(t,e,n,r)}};t.exports=s},function(t,e,n){"use strict";var r=n(87),i=(n(179),n(180)),o=n(312),u=(n(88),n(313));n(125);function s(t,e){return t&&"object"==typeof t&&null!=t.key?u.escape(t.key):e.toString(36)}function a(t,e,n,c){var f,l=typeof t;if("undefined"!==l&&"boolean"!==l||(t=null),null===t||"string"===l||"number"===l||"object"===l&&t.$$typeof===i)return n(c,t,""===e?"."+s(t,0):e),1;var p=0,h=""===e?".":e+":";if(Array.isArray(t))for(var d=0;d<t.length;d++)p+=a(f=t[d],h+s(f,d),n,c);else{var y=o(t);if(y){var v,g=y.call(t);if(y!==t.entries)for(var w=0;!(v=g.next()).done;)p+=a(f=v.value,h+s(f,w++),n,c);else for(;!(v=g.next()).done;){var M=v.value;M&&(p+=a(f=M[1],h+u.escape(M[0])+":"+s(f,0),n,c))}}else if("object"===l){var _=String(t);r("31","[object Object]"===_?"object with keys {"+Object.keys(t).join(", ")+"}":_,"")}}return p}t.exports=function(t,e,n){return null==t?0:a(t,"",e,n)}},function(t,e,n){"use strict";var r="function"==typeof Symbol&&Symbol.iterator;t.exports=function(t){var e=t&&(r&&t[r]||t["@@iterator"]);if("function"==typeof e)return e}},function(t,e,n){"use strict";var r={escape:function(t){var e={"=":"=0",":":"=2"};return"$"+(""+t).replace(/[=:]/g,(function(t){return e[t]}))},unescape:function(t){var e={"=0":"=","=2":":"};return(""+("."===t[0]&&"$"===t[1]?t.substring(2):t.substring(1))).replace(/(=0|=2)/g,(function(t){return e[t]}))}};t.exports=r},function(t,e,n){"use strict";var r=n(46).createFactory,i={a:r("a"),abbr:r("abbr"),address:r("address"),area:r("area"),article:r("article"),aside:r("aside"),audio:r("audio"),b:r("b"),base:r("base"),bdi:r("bdi"),bdo:r("bdo"),big:r("big"),blockquote:r("blockquote"),body:r("body"),br:r("br"),button:r("button"),canvas:r("canvas"),caption:r("caption"),cite:r("cite"),code:r("code"),col:r("col"),colgroup:r("colgroup"),data:r("data"),datalist:r("datalist"),dd:r("dd"),del:r("del"),details:r("details"),dfn:r("dfn"),dialog:r("dialog"),div:r("div"),dl:r("dl"),dt:r("dt"),em:r("em"),embed:r("embed"),fieldset:r("fieldset"),figcaption:r("figcaption"),figure:r("figure"),footer:r("footer"),form:r("form"),h1:r("h1"),h2:r("h2"),h3:r("h3"),h4:r("h4"),h5:r("h5"),h6:r("h6"),head:r("head"),header:r("header"),hgroup:r("hgroup"),hr:r("hr"),html:r("html"),i:r("i"),iframe:r("iframe"),img:r("img"),input:r("input"),ins:r("ins"),kbd:r("kbd"),keygen:r("keygen"),label:r("label"),legend:r("legend"),li:r("li"),link:r("link"),main:r("main"),map:r("map"),mark:r("mark"),menu:r("menu"),menuitem:r("menuitem"),meta:r("meta"),meter:r("meter"),nav:r("nav"),noscript:r("noscript"),object:r("object"),ol:r("ol"),optgroup:r("optgroup"),option:r("option"),output:r("output"),p:r("p"),param:r("param"),picture:r("picture"),pre:r("pre"),progress:r("progress"),q:r("q"),rp:r("rp"),rt:r("rt"),ruby:r("ruby"),s:r("s"),samp:r("samp"),script:r("script"),section:r("section"),select:r("select"),small:r("small"),source:r("source"),span:r("span"),strong:r("strong"),style:r("style"),sub:r("sub"),summary:r("summary"),sup:r("sup"),table:r("table"),tbody:r("tbody"),td:r("td"),textarea:r("textarea"),tfoot:r("tfoot"),th:r("th"),thead:r("thead"),time:r("time"),title:r("title"),tr:r("tr"),track:r("track"),u:r("u"),ul:r("ul"),var:r("var"),video:r("video"),wbr:r("wbr"),circle:r("circle"),clipPath:r("clipPath"),defs:r("defs"),ellipse:r("ellipse"),g:r("g"),image:r("image"),line:r("line"),linearGradient:r("linearGradient"),mask:r("mask"),path:r("path"),pattern:r("pattern"),polygon:r("polygon"),polyline:r("polyline"),radialGradient:r("radialGradient"),rect:r("rect"),stop:r("stop"),svg:r("svg"),text:r("text"),tspan:r("tspan")};t.exports=i},function(t,e,n){"use strict";var r=n(46).isValidElement,i=n(316);t.exports=i(r)},function(t,e,n){"use strict";var r=n(317);t.exports=function(t){return r(t,!1)}},function(t,e,n){"use strict";var r=n(318),i=n(63),o=n(181),u=n(320),s=Function.call.bind(Object.prototype.hasOwnProperty);function a(){return null}t.exports=function(t,e){var n="function"==typeof Symbol&&Symbol.iterator;var c="<<anonymous>>",f={array:d("array"),bool:d("boolean"),func:d("function"),number:d("number"),object:d("object"),string:d("string"),symbol:d("symbol"),any:h(a),arrayOf:function(t){return h((function(e,n,r,i,u){if("function"!=typeof t)return new p("Property `"+u+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=e[n];if(!Array.isArray(s))return new p("Invalid "+i+" `"+u+"` of type `"+v(s)+"` supplied to `"+r+"`, expected an array.");for(var a=0;a<s.length;a++){var c=t(s,a,r,i,u+"["+a+"]",o);if(c instanceof Error)return c}return null}))},element:h((function(e,n,r,i,o){var u=e[n];return t(u)?null:new p("Invalid "+i+" `"+o+"` of type `"+v(u)+"` supplied to `"+r+"`, expected a single ReactElement.")})),elementType:h((function(t,e,n,i,o){var u=t[e];return r.isValidElementType(u)?null:new p("Invalid "+i+" `"+o+"` of type `"+v(u)+"` supplied to `"+n+"`, expected a single ReactElement type.")})),instanceOf:function(t){return h((function(e,n,r,i,o){if(!(e[n]instanceof t)){var u=t.name||c;return new p("Invalid "+i+" `"+o+"` of type `"+(((s=e[n]).constructor&&s.constructor.name?s.constructor.name:c)+"` supplied to `")+r+"`, expected instance of `"+u+"`.")}var s;return null}))},node:h((function(t,e,n,r,i){return y(t[e])?null:new p("Invalid "+r+" `"+i+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(t){return h((function(e,n,r,i,u){if("function"!=typeof t)return new p("Property `"+u+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var a=e[n],c=v(a);if("object"!==c)return new p("Invalid "+i+" `"+u+"` of type `"+c+"` supplied to `"+r+"`, expected an object.");for(var f in a)if(s(a,f)){var l=t(a,f,r,i,u+"."+f,o);if(l instanceof Error)return l}return null}))},oneOf:function(t){if(!Array.isArray(t))return a;return h((function(e,n,r,i,o){for(var u=e[n],s=0;s<t.length;s++)if(l(u,t[s]))return null;var a=JSON.stringify(t,(function(t,e){return"symbol"===g(e)?String(e):e}));return new p("Invalid "+i+" `"+o+"` of value `"+String(u)+"` supplied to `"+r+"`, expected one of "+a+".")}))},oneOfType:function(t){if(!Array.isArray(t))return a;for(var e=0;e<t.length;e++){var n=t[e];if("function"!=typeof n)return w(n),a}return h((function(e,n,r,i,u){for(var s=0;s<t.length;s++)if(null==(0,t[s])(e,n,r,i,u,o))return null;return new p("Invalid "+i+" `"+u+"` supplied to `"+r+"`.")}))},shape:function(t){return h((function(e,n,r,i,u){var s=e[n],a=v(s);if("object"!==a)return new p("Invalid "+i+" `"+u+"` of type `"+a+"` supplied to `"+r+"`, expected `object`.");for(var c in t){var f=t[c];if(f){var l=f(s,c,r,i,u+"."+c,o);if(l)return l}}return null}))},exact:function(t){return h((function(e,n,r,u,s){var a=e[n],c=v(a);if("object"!==c)return new p("Invalid "+u+" `"+s+"` of type `"+c+"` supplied to `"+r+"`, expected `object`.");var f=i({},e[n],t);for(var l in f){var h=t[l];if(!h)return new p("Invalid "+u+" `"+s+"` key `"+l+"` supplied to `"+r+"`.\nBad object: "+JSON.stringify(e[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(t),null," "));var d=h(a,l,r,u,s+"."+l,o);if(d)return d}return null}))}};function l(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}function p(t){this.message=t,this.stack=""}function h(t){function n(n,r,i,u,s,a,f){if((u=u||c,a=a||i,f!==o)&&e){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}return null==r[i]?n?null===r[i]?new p("The "+s+" `"+a+"` is marked as required in `"+u+"`, but its value is `null`."):new p("The "+s+" `"+a+"` is marked as required in `"+u+"`, but its value is `undefined`."):null:t(r,i,u,s,a)}var r=n.bind(null,!1);return r.isRequired=n.bind(null,!0),r}function d(t){return h((function(e,n,r,i,o,u){var s=e[n];return v(s)!==t?new p("Invalid "+i+" `"+o+"` of type `"+g(s)+"` supplied to `"+r+"`, expected `"+t+"`."):null}))}function y(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(y);if(null===e||t(e))return!0;var r=function(t){var e=t&&(n&&t[n]||t["@@iterator"]);if("function"==typeof e)return e}(e);if(!r)return!1;var i,o=r.call(e);if(r!==e.entries){for(;!(i=o.next()).done;)if(!y(i.value))return!1}else for(;!(i=o.next()).done;){var u=i.value;if(u&&!y(u[1]))return!1}return!0;default:return!1}}function v(t){var e=typeof t;return Array.isArray(t)?"array":t instanceof RegExp?"object":function(t,e){return"symbol"===t||!!e&&("Symbol"===e["@@toStringTag"]||"function"==typeof Symbol&&e instanceof Symbol)}(e,t)?"symbol":e}function g(t){if(null==t)return""+t;var e=v(t);if("object"===e){if(t instanceof Date)return"date";if(t instanceof RegExp)return"regexp"}return e}function w(t){var e=g(t);switch(e){case"array":case"object":return"an "+e;case"boolean":case"date":case"regexp":return"a "+e;default:return e}}return p.prototype=Error.prototype,f.checkPropTypes=u,f.resetWarningCache=u.resetWarningCache,f.PropTypes=f,f}},function(t,e,n){"use strict";t.exports=n(319)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r="function"==typeof Symbol&&Symbol.for,i=r?Symbol.for("react.element"):60103,o=r?Symbol.for("react.portal"):60106,u=r?Symbol.for("react.fragment"):60107,s=r?Symbol.for("react.strict_mode"):60108,a=r?Symbol.for("react.profiler"):60114,c=r?Symbol.for("react.provider"):60109,f=r?Symbol.for("react.context"):60110,l=r?Symbol.for("react.async_mode"):60111,p=r?Symbol.for("react.concurrent_mode"):60111,h=r?Symbol.for("react.forward_ref"):60112,d=r?Symbol.for("react.suspense"):60113,y=r?Symbol.for("react.memo"):60115,v=r?Symbol.for("react.lazy"):60116;function g(t){if("object"==typeof t&&null!==t){var e=t.$$typeof;switch(e){case i:switch(t=t.type){case l:case p:case u:case a:case s:case d:return t;default:switch(t=t&&t.$$typeof){case f:case h:case c:return t;default:return e}}case v:case y:case o:return e}}}function w(t){return g(t)===p}e.typeOf=g,e.AsyncMode=l,e.ConcurrentMode=p,e.ContextConsumer=f,e.ContextProvider=c,e.Element=i,e.ForwardRef=h,e.Fragment=u,e.Lazy=v,e.Memo=y,e.Portal=o,e.Profiler=a,e.StrictMode=s,e.Suspense=d,e.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===u||t===p||t===a||t===s||t===d||"object"==typeof t&&null!==t&&(t.$$typeof===v||t.$$typeof===y||t.$$typeof===c||t.$$typeof===f||t.$$typeof===h)},e.isAsyncMode=function(t){return w(t)||g(t)===l},e.isConcurrentMode=w,e.isContextConsumer=function(t){return g(t)===f},e.isContextProvider=function(t){return g(t)===c},e.isElement=function(t){return"object"==typeof t&&null!==t&&t.$$typeof===i},e.isForwardRef=function(t){return g(t)===h},e.isFragment=function(t){return g(t)===u},e.isLazy=function(t){return g(t)===v},e.isMemo=function(t){return g(t)===y},e.isPortal=function(t){return g(t)===o},e.isProfiler=function(t){return g(t)===a},e.isStrictMode=function(t){return g(t)===s},e.isSuspense=function(t){return g(t)===d}},function(t,e,n){"use strict";function r(t,e,n,r,i){}r.resetWarningCache=function(){0},t.exports=r},function(t,e,n){"use strict";t.exports="15.7.0"},function(t,e,n){"use strict";var r=n(175).Component,i=n(46).isValidElement,o=n(176),u=n(323);t.exports=u(r,i,o)},function(t,e,n){"use strict";var r=n(63),i={};function o(t,e,n,r,i,o,u,s){if(!t){var a;if(void 0===e)a=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,i,o,u,s],f=0;(a=new Error(e.replace(/%s/g,(function(){return c[f++]})))).name="Invariant Violation"}throw a.framesToPop=1,a}}var u="mixins";t.exports=function(t,e,n){var s=[],a={mixins:"DEFINE_MANY",statics:"DEFINE_MANY",propTypes:"DEFINE_MANY",contextTypes:"DEFINE_MANY",childContextTypes:"DEFINE_MANY",getDefaultProps:"DEFINE_MANY_MERGED",getInitialState:"DEFINE_MANY_MERGED",getChildContext:"DEFINE_MANY_MERGED",render:"DEFINE_ONCE",componentWillMount:"DEFINE_MANY",componentDidMount:"DEFINE_MANY",componentWillReceiveProps:"DEFINE_MANY",shouldComponentUpdate:"DEFINE_ONCE",componentWillUpdate:"DEFINE_MANY",componentDidUpdate:"DEFINE_MANY",componentWillUnmount:"DEFINE_MANY",UNSAFE_componentWillMount:"DEFINE_MANY",UNSAFE_componentWillReceiveProps:"DEFINE_MANY",UNSAFE_componentWillUpdate:"DEFINE_MANY",updateComponent:"OVERRIDE_BASE"},c={getDerivedStateFromProps:"DEFINE_MANY_MERGED"},f={displayName:function(t,e){t.displayName=e},mixins:function(t,e){if(e)for(var n=0;n<e.length;n++)p(t,e[n])},childContextTypes:function(t,e){t.childContextTypes=r({},t.childContextTypes,e)},contextTypes:function(t,e){t.contextTypes=r({},t.contextTypes,e)},getDefaultProps:function(t,e){t.getDefaultProps?t.getDefaultProps=d(t.getDefaultProps,e):t.getDefaultProps=e},propTypes:function(t,e){t.propTypes=r({},t.propTypes,e)},statics:function(t,e){!function(t,e){if(!e)return;for(var n in e){var r=e[n];if(e.hasOwnProperty(n)){if(o(!(n in f),'ReactClass: You are attempting to define a reserved property, `%s`, that shouldn\'t be on the "statics" key. Define it as an instance property instead; it will still be accessible on the constructor.',n),n in t)return o("DEFINE_MANY_MERGED"===(c.hasOwnProperty(n)?c[n]:null),"ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",n),void(t[n]=d(t[n],r));t[n]=r}}}(t,e)},autobind:function(){}};function l(t,e){var n=a.hasOwnProperty(e)?a[e]:null;M.hasOwnProperty(e)&&o("OVERRIDE_BASE"===n,"ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method names do not overlap with React methods.",e),t&&o("DEFINE_MANY"===n||"DEFINE_MANY_MERGED"===n,"ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",e)}function p(t,n){if(n){o("function"!=typeof n,"ReactClass: You're attempting to use a component class or function as a mixin. Instead, just use a regular object."),o(!e(n),"ReactClass: You're attempting to use a component as a mixin. Instead, just use a regular object.");var r=t.prototype,i=r.__reactAutoBindPairs;for(var s in n.hasOwnProperty(u)&&f.mixins(t,n.mixins),n)if(n.hasOwnProperty(s)&&s!==u){var c=n[s],p=r.hasOwnProperty(s);if(l(p,s),f.hasOwnProperty(s))f[s](t,c);else{var h=a.hasOwnProperty(s);if("function"==typeof c&&!h&&!p&&!1!==n.autobind)i.push(s,c),r[s]=c;else if(p){var v=a[s];o(h&&("DEFINE_MANY_MERGED"===v||"DEFINE_MANY"===v),"ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.",v,s),"DEFINE_MANY_MERGED"===v?r[s]=d(r[s],c):"DEFINE_MANY"===v&&(r[s]=y(r[s],c))}else r[s]=c}}}else;}function h(t,e){for(var n in o(t&&e&&"object"==typeof t&&"object"==typeof e,"mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects."),e)e.hasOwnProperty(n)&&(o(void 0===t[n],"mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the same key: `%s`. This conflict may be due to a mixin; in particular, this may be caused by two getInitialState() or getDefaultProps() methods returning objects with clashing keys.",n),t[n]=e[n]);return t}function d(t,e){return function(){var n=t.apply(this,arguments),r=e.apply(this,arguments);if(null==n)return r;if(null==r)return n;var i={};return h(i,n),h(i,r),i}}function y(t,e){return function(){t.apply(this,arguments),e.apply(this,arguments)}}function v(t,e){return e.bind(t)}var g={componentDidMount:function(){this.__isMounted=!0}},w={componentWillUnmount:function(){this.__isMounted=!1}},M={replaceState:function(t,e){this.updater.enqueueReplaceState(this,t,e)},isMounted:function(){return!!this.__isMounted}},_=function(){};return r(_.prototype,t.prototype,M),function(t){var e=function(t,r,u){this.__reactAutoBindPairs.length&&function(t){for(var e=t.__reactAutoBindPairs,n=0;n<e.length;n+=2){var r=e[n],i=e[n+1];t[r]=v(t,i)}}(this),this.props=t,this.context=r,this.refs=i,this.updater=u||n,this.state=null;var s=this.getInitialState?this.getInitialState():null;o("object"==typeof s&&!Array.isArray(s),"%s.getInitialState(): must return an object or null",e.displayName||"ReactCompositeComponent"),this.state=s};for(var r in e.prototype=new _,e.prototype.constructor=e,e.prototype.__reactAutoBindPairs=[],s.forEach(p.bind(null,e)),p(e,g),p(e,t),p(e,w),e.getDefaultProps&&(e.defaultProps=e.getDefaultProps()),o(e.prototype.render,"createClass(...): Class specification must implement a `render` method."),a)e.prototype[r]||(e.prototype[r]=null);return e}}},function(t,e,n){"use strict";var r=n(87),i=n(46);n(88);t.exports=function(t){return i.isValidElement(t)||r("143"),t}},function(t,e,n){"use strict";var r=n(181);function i(){}function o(){}o.resetWarningCache=i,t.exports=function(){function t(t,e,n,i,o,u){if(u!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function e(){return t}t.isRequired=t;var n={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:o,resetWarningCache:i};return n.PropTypes=n,n}},function(t,e,n){var r=n(327);t.exports=r},function(t,e,n){var r=n(328),i=Array.prototype;t.exports=function(t){var e=t.concat;return t===i||t instanceof Array&&e===i.concat?r:e}},function(t,e,n){n(164);var r=n(9);t.exports=r("Array").concat},function(t,e,n){n(45);var r=n(330),i=n(43),o=Array.prototype,u={DOMTokenList:!0,NodeList:!0};t.exports=function(t){var e=t.forEach;return t===o||t instanceof Array&&e===o.forEach||u.hasOwnProperty(i(t))?r:e}},function(t,e,n){var r=n(331);t.exports=r},function(t,e,n){n(332);var r=n(9);t.exports=r("Array").forEach},function(t,e,n){"use strict";var r=n(1),i=n(333);r({target:"Array",proto:!0,forced:[].forEach!=i},{forEach:i})},function(t,e,n){"use strict";var r=n(44).forEach,i=n(64)("forEach");t.exports=i?[].forEach:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}},function(t,e,n){var r=n(335);t.exports=r},function(t,e,n){var r=n(336),i=Array.prototype;t.exports=function(t){var e=t.map;return t===i||t instanceof Array&&e===i.map?r:e}},function(t,e,n){n(337);var r=n(9);t.exports=r("Array").map},function(t,e,n){"use strict";var r=n(1),i=n(44).map;r({target:"Array",proto:!0,forced:!n(85)("map")},{map:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){"use strict";e.byteLength=function(t){var e=c(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,r=c(t),u=r[0],s=r[1],a=new o(function(t,e,n){return 3*(e+n)/4-n}(0,u,s)),f=0,l=s>0?u-4:u;for(n=0;n<l;n+=4)e=i[t.charCodeAt(n)]<<18|i[t.charCodeAt(n+1)]<<12|i[t.charCodeAt(n+2)]<<6|i[t.charCodeAt(n+3)],a[f++]=e>>16&255,a[f++]=e>>8&255,a[f++]=255&e;2===s&&(e=i[t.charCodeAt(n)]<<2|i[t.charCodeAt(n+1)]>>4,a[f++]=255&e);1===s&&(e=i[t.charCodeAt(n)]<<10|i[t.charCodeAt(n+1)]<<4|i[t.charCodeAt(n+2)]>>2,a[f++]=e>>8&255,a[f++]=255&e);return a},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],u=16383,s=0,a=n-i;s<a;s+=u)o.push(f(t,s,s+u>a?a:s+u));1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=u.length;s<a;++s)r[s]=u[s],i[u.charCodeAt(s)]=s;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function f(t,e,n){for(var i,o,u=[],s=e;s<n;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),u.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return u.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,n,r,i){var o,u,s=8*i-r-1,a=(1<<s)-1,c=a>>1,f=-7,l=n?i-1:0,p=n?-1:1,h=t[e+l];for(l+=p,o=h&(1<<-f)-1,h>>=-f,f+=s;f>0;o=256*o+t[e+l],l+=p,f-=8);for(u=o&(1<<-f)-1,o>>=-f,f+=r;f>0;u=256*u+t[e+l],l+=p,f-=8);if(0===o)o=1-c;else{if(o===a)return u?NaN:1/0*(h?-1:1);u+=Math.pow(2,r),o-=c}return(h?-1:1)*u*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var u,s,a,c=8*o-i-1,f=(1<<c)-1,l=f>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,d=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,u=f):(u=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-u))<1&&(u--,a*=2),(e+=u+l>=1?p/a:p*Math.pow(2,1-l))*a>=2&&(u++,a/=2),u+l>=f?(s=0,u=f):u+l>=1?(s=(e*a-1)*Math.pow(2,i),u+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,i),u=0));i>=8;t[n+h]=255&s,h+=d,s/=256,i-=8);for(u=u<<i|s,c+=i;c>0;t[n+h]=255&u,h+=d,u/=256,c-=8);t[n+h-d]|=128*y}},function(t,e,n){var r=n(126),i=n(185);t.exports=function(t){if(r(t))return i(t)},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){var r=n(184);t.exports=r},function(t,e,n){n(1)({target:"Array",stat:!0},{isArray:n(61)})},function(t,e,n){var r=n(83),i=n(186),o=n(187);t.exports=function(t){if(void 0!==r&&i(Object(t)))return o(t)},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){n(45),n(62);var r=n(345);t.exports=r},function(t,e,n){var r=n(43),i=n(7),o=n(35),u=i("iterator");t.exports=function(t){var e=Object(t);return void 0!==e[u]||"@@iterator"in e||o.hasOwnProperty(r(e))}},function(t,e,n){var r=n(347);t.exports=r},function(t,e,n){n(62),n(348);var r=n(10);t.exports=r.Array.from},function(t,e,n){var r=n(1),i=n(349);r({target:"Array",stat:!0,forced:!n(353)((function(t){Array.from(t)}))},{from:i})},function(t,e,n){"use strict";var r=n(111),i=n(22),o=n(350),u=n(352),s=n(34),a=n(119),c=n(127);t.exports=function(t){var e,n,f,l,p,h,d=i(t),y="function"==typeof this?this:Array,v=arguments.length,g=v>1?arguments[1]:void 0,w=void 0!==g,M=c(d),_=0;if(w&&(g=r(g,v>2?arguments[2]:void 0,2)),null==M||y==Array&&u(M))for(n=new y(e=s(d.length));e>_;_++)h=w?g(d[_],_):d[_],a(n,_,h);else for(p=(l=M.call(d)).next,n=new y;!(f=p.call(l)).done;_++)h=w?o(l,g,[f.value,_],!0):f.value,a(n,_,h);return n.length=_,n}},function(t,e,n){var r=n(26),i=n(351);t.exports=function(t,e,n,o){try{return o?e(r(n)[0],n[1]):e(n)}catch(e){throw i(t),e}}},function(t,e,n){var r=n(26);t.exports=function(t){var e=t.return;if(void 0!==e)return r(e.call(t)).value}},function(t,e,n){var r=n(7),i=n(35),o=r("iterator"),u=Array.prototype;t.exports=function(t){return void 0!==t&&(i.Array===t||u[o]===t)}},function(t,e,n){var r=n(7)("iterator"),i=!1;try{var o=0,u={next:function(){return{done:!!o++}},return:function(){i=!0}};u[r]=function(){return this},Array.from(u,(function(){throw 2}))}catch(t){}t.exports=function(t,e){if(!e&&!i)return!1;var n=!1;try{var o={};o[r]=function(){return{next:function(){return{done:n=!0}}}},t(o)}catch(t){}return n}},function(t,e,n){t.exports=n(355)},function(t,e,n){var r=n(188);t.exports=r},function(t,e,n){n(357);var r=n(9);t.exports=r("Array").slice},function(t,e,n){"use strict";var r=n(1),i=n(16),o=n(61),u=n(158),s=n(34),a=n(32),c=n(119),f=n(7),l=n(85)("slice"),p=f("species"),h=[].slice,d=Math.max;r({target:"Array",proto:!0,forced:!l},{slice:function(t,e){var n,r,f,l=a(this),y=s(l.length),v=u(t,y),g=u(void 0===e?y:e,y);if(o(l)&&("function"!=typeof(n=l.constructor)||n!==Array&&!o(n.prototype)?i(n)&&null===(n=n[p])&&(n=void 0):n=void 0,n===Array||void 0===n))return h.call(l,v,g);for(r=new(void 0===n?Array:n)(d(g-v,0)),f=0;v<g;v++,f++)v in l&&c(r,f,l[v]);return r.length=f,r}})},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){var r=n(126);t.exports=function(t){if(r(t))return t},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){var r=n(83),i=n(186),o=n(189);t.exports=function(t,e){if(void 0!==r&&i(Object(t))){var n=[],u=!0,s=!1,a=void 0;try{for(var c,f=o(t);!(u=(c=f.next()).done)&&(n.push(c.value),!e||n.length!==e);u=!0);}catch(t){s=!0,a=t}finally{try{u||null==f.return||f.return()}finally{if(s)throw a}}return n}},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){n(45),n(62);var r=n(362);t.exports=r},function(t,e,n){var r=n(26),i=n(127);t.exports=function(t){var e=i(t);if("function"!=typeof e)throw TypeError(String(t)+" is not iterable");return r(e.call(t))}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){t.exports=n(365)},function(t,e,n){n(45),n(62);var r=n(127);t.exports=r},function(t,e,n){var r=n(184);t.exports=r},function(t,e,n){n(45);var r=n(368),i=n(43),o=Array.prototype,u={DOMTokenList:!0,NodeList:!0};t.exports=function(t){var e=t.entries;return t===o||t instanceof Array&&e===o.entries||u.hasOwnProperty(i(t))?r:e}},function(t,e,n){var r=n(369);t.exports=r},function(t,e,n){n(174);var r=n(9);t.exports=r("Array").entries},function(t,e,n){var r=n(371);t.exports=r},function(t,e,n){var r=n(372),i=Array.prototype;t.exports=function(t){var e=t.filter;return t===i||t instanceof Array&&e===i.filter?r:e}},function(t,e,n){n(373);var r=n(9);t.exports=r("Array").filter},function(t,e,n){"use strict";var r=n(1),i=n(44).filter;r({target:"Array",proto:!0,forced:!n(85)("filter")},{filter:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){var r=n(375);t.exports=r},function(t,e,n){n(376);var r=n(10);t.exports=r.Object.keys},function(t,e,n){var r=n(1),i=n(22),o=n(80);r({target:"Object",stat:!0,forced:n(6)((function(){o(1)}))},{keys:function(t){return o(i(t))}})},function(t,e,n){var r=n(378);t.exports=r},function(t,e,n){var r=n(379),i=Function.prototype;t.exports=function(t){var e=t.bind;return t===i||t instanceof Function&&e===i.bind?r:e}},function(t,e,n){n(380);var r=n(9);t.exports=r("Function").bind},function(t,e,n){n(1)({target:"Function",proto:!0},{bind:n(162)})},function(t,e,n){var r=n(382);t.exports=r},function(t,e,n){var r=n(383),i=Array.prototype;t.exports=function(t){var e=t.reduce;return t===i||t instanceof Array&&e===i.reduce?r:e}},function(t,e,n){n(384);var r=n(9);t.exports=r("Array").reduce},function(t,e,n){"use strict";var r=n(1),i=n(385).left,o=n(64),u=n(84),s=n(166);r({target:"Array",proto:!0,forced:!o("reduce")||!s&&u>79&&u<83},{reduce:function(t){return i(this,t,arguments.length,arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){var r=n(58),i=n(22),o=n(77),u=n(34),s=function(t){return function(e,n,s,a){r(n);var c=i(e),f=o(c),l=u(c.length),p=t?l-1:0,h=t?-1:1;if(s<2)for(;;){if(p in f){a=f[p],p+=h;break}if(p+=h,t?p<0:l<=p)throw TypeError("Reduce of empty array with no initial value")}for(;t?p>=0:l>p;p+=h)p in f&&(a=n(a,f[p],p,c));return a}};t.exports={left:s(!1),right:s(!0)}},function(t,e,n){var r=n(387);t.exports=r},function(t,e,n){n(388);var r=n(10);t.exports=r.Object.assign},function(t,e,n){var r=n(1),i=n(389);r({target:"Object",stat:!0,forced:Object.assign!==i},{assign:i})},function(t,e,n){"use strict";var r=n(24),i=n(6),o=n(80),u=n(169),s=n(110),a=n(22),c=n(77),f=Object.assign,l=Object.defineProperty;t.exports=!f||i((function(){if(r&&1!==f({b:1},f(l({},"a",{enumerable:!0,get:function(){l(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},n=Symbol(),i="abcdefghijklmnopqrst";return t[n]=7,i.split("").forEach((function(t){e[t]=t})),7!=f({},t)[n]||o(f({},e)).join("")!=i}))?function(t,e){for(var n=a(t),i=arguments.length,f=1,l=u.f,p=s.f;i>f;)for(var h,d=c(arguments[f++]),y=l?o(d).concat(l(d)):o(d),v=y.length,g=0;v>g;)h=y[g++],r&&!p.call(d,h)||(n[h]=d[h]);return n}:f},function(t,e,n){var r=n(391);t.exports=r},function(t,e,n){var r=n(392),i=Array.prototype;t.exports=function(t){var e=t.sort;return t===i||t instanceof Array&&e===i.sort?r:e}},function(t,e,n){n(393);var r=n(9);t.exports=r("Array").sort},function(t,e,n){"use strict";var r=n(1),i=n(58),o=n(22),u=n(6),s=n(64),a=[],c=a.sort,f=u((function(){a.sort(void 0)})),l=u((function(){a.sort(null)})),p=s("sort");r({target:"Array",proto:!0,forced:f||!l||!p},{sort:function(t){return void 0===t?c.call(o(this)):c.call(o(this),i(t))}})},function(t,e,n){var r=n(188);t.exports=r},function(t,e,n){var r=n(396);t.exports=r},function(t,e,n){var r=n(397),i=Array.prototype;t.exports=function(t){var e=t.some;return t===i||t instanceof Array&&e===i.some?r:e}},function(t,e,n){n(398);var r=n(9);t.exports=r("Array").some},function(t,e,n){"use strict";var r=n(1),i=n(44).some;r({target:"Array",proto:!0,forced:!n(64)("some")},{some:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){var r=n(400);t.exports=r},function(t,e,n){var r=n(401),i=n(403),o=Array.prototype,u=String.prototype;t.exports=function(t){var e=t.includes;return t===o||t instanceof Array&&e===o.includes?r:"string"==typeof t||t===u||t instanceof String&&e===u.includes?i:e}},function(t,e,n){n(402);var r=n(9);t.exports=r("Array").includes},function(t,e,n){"use strict";var r=n(1),i=n(112).includes,o=n(124);r({target:"Array",proto:!0},{includes:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),o("includes")},function(t,e,n){n(404);var r=n(9);t.exports=r("String").includes},function(t,e,n){"use strict";var r=n(1),i=n(190),o=n(42);r({target:"String",proto:!0,forced:!n(191)("includes")},{includes:function(t){return!!~String(o(this)).indexOf(i(t),arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){var r=n(16),i=n(57),o=n(7)("match");t.exports=function(t){var e;return r(t)&&(void 0!==(e=t[o])?!!e:"RegExp"==i(t))}},function(t,e,n){var r=n(407);t.exports=r},function(t,e,n){n(408);var r=n(10);r.JSON||(r.JSON={stringify:JSON.stringify}),t.exports=function(t,e,n){return r.JSON.stringify.apply(null,arguments)}},function(t,e,n){var r=n(1),i=n(59),o=n(6),u=i("JSON","stringify"),s=/[\uD800-\uDFFF]/g,a=/^[\uD800-\uDBFF]$/,c=/^[\uDC00-\uDFFF]$/,f=function(t,e,n){var r=n.charAt(e-1),i=n.charAt(e+1);return a.test(t)&&!c.test(i)||c.test(t)&&!a.test(r)?"\\u"+t.charCodeAt(0).toString(16):t},l=o((function(){return'"\\udf06\\ud834"'!==u("\udf06\ud834")||'"\\udead"'!==u("\udead")}));u&&r({target:"JSON",stat:!0,forced:l},{stringify:function(t,e,n){var r=u.apply(null,arguments);return"string"==typeof r?r.replace(s,f):r}})},function(t,e,n){var r=n(410);t.exports=r},function(t,e,n){var r=n(411),i=Array.prototype;t.exports=function(t){var e=t.indexOf;return t===i||t instanceof Array&&e===i.indexOf?r:e}},function(t,e,n){n(412);var r=n(9);t.exports=r("Array").indexOf},function(t,e,n){"use strict";var r=n(1),i=n(112).indexOf,o=n(64),u=[].indexOf,s=!!u&&1/[1].indexOf(1,-0)<0,a=o("indexOf");r({target:"Array",proto:!0,forced:s||!a},{indexOf:function(t){return s?u.apply(this,arguments)||0:i(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){var r=n(414);t.exports=r},function(t,e,n){var r=n(415),i=Array.prototype;t.exports=function(t){var e=t.find;return t===i||t instanceof Array&&e===i.find?r:e}},function(t,e,n){n(416);var r=n(9);t.exports=r("Array").find},function(t,e,n){"use strict";var r=n(1),i=n(44).find,o=n(124),u="find",s=!0;u in[]&&Array(1).find((function(){s=!1})),r({target:"Array",proto:!0,forced:s},{find:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),o(u)},function(t,e,n){var r=n(418);t.exports=r},function(t,e,n){var r=n(419),i=String.prototype;t.exports=function(t){var e=t.startsWith;return"string"==typeof t||t===i||t instanceof String&&e===i.startsWith?r:e}},function(t,e,n){n(420);var r=n(9);t.exports=r("String").startsWith},function(t,e,n){"use strict";var r,i=n(1),o=n(109).f,u=n(34),s=n(190),a=n(42),c=n(191),f=n(60),l="".startsWith,p=Math.min,h=c("startsWith");i({target:"String",proto:!0,forced:!!(f||h||(r=o(String.prototype,"startsWith"),!r||r.writable))&&!h},{startsWith:function(t){var e=String(a(this));s(t);var n=u(p(arguments.length>1?arguments[1]:void 0,e.length)),r=String(t);return l?l.call(e,r,n):e.slice(n,n+r.length)===r}})},function(t,e,n){var r=n(422);t.exports=r},function(t,e,n){var r=n(423),i=String.prototype;t.exports=function(t){var e=t.trim;return"string"==typeof t||t===i||t instanceof String&&e===i.trim?r:e}},function(t,e,n){n(424);var r=n(9);t.exports=r("String").trim},function(t,e,n){"use strict";var r=n(1),i=n(425).trim;r({target:"String",proto:!0,forced:n(426)("trim")},{trim:function(){return i(this)}})},function(t,e,n){var r=n(42),i="["+n(192)+"]",o=RegExp("^"+i+i+"*"),u=RegExp(i+i+"*$"),s=function(t){return function(e){var n=String(r(e));return 1&t&&(n=n.replace(o,"")),2&t&&(n=n.replace(u,"")),n}};t.exports={start:s(1),end:s(2),trim:s(3)}},function(t,e,n){var r=n(6),i=n(192);t.exports=function(t){return r((function(){return!!i[t]()||"
"!="
"[t]()||i[t].name!==t}))}},function(t,e,n){var r=n(65),i=n(145);t.exports=function(t){return i(r(t).toLowerCase())}},function(t,e,n){var r=n(90),i=n(429),o=n(23),u=n(91),s=r?r.prototype:void 0,a=s?s.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(o(e))return i(e,t)+"";if(u(e))return a?a.call(e):"";var n=e+"";return"0"==n&&1/e==-Infinity?"-0":n}},function(t,e){t.exports=function(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}},function(t,e,n){var r=n(90),i=Object.prototype,o=i.hasOwnProperty,u=i.toString,s=r?r.toStringTag:void 0;t.exports=function(t){var e=o.call(t,s),n=t[s];try{t[s]=void 0;var r=!0}catch(t){}var i=u.call(t);return r&&(e?t[s]=n:delete t[s]),i}},function(t,e){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},function(t,e,n){var r=n(433),i=n(194),o=n(435),u=n(65);t.exports=function(t){return function(e){e=u(e);var n=i(e)?o(e):void 0,s=n?n[0]:e.charAt(0),a=n?r(n,1).join(""):e.slice(1);return s[t]()+a}}},function(t,e,n){var r=n(434);t.exports=function(t,e,n){var i=t.length;return n=void 0===n?i:n,!e&&n>=i?t:r(t,e,n)}},function(t,e){t.exports=function(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r<i;)o[r]=t[r+e];return o}},function(t,e,n){var r=n(436),i=n(194),o=n(437);t.exports=function(t){return i(t)?o(t):r(t)}},function(t,e){t.exports=function(t){return t.split("")}},function(t,e){var n="[\\ud800-\\udfff]",r="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",i="\\ud83c[\\udffb-\\udfff]",o="[^\\ud800-\\udfff]",u="(?:\\ud83c[\\udde6-\\uddff]){2}",s="[\\ud800-\\udbff][\\udc00-\\udfff]",a="(?:"+r+"|"+i+")"+"?",c="[\\ufe0e\\ufe0f]?",f=c+a+("(?:\\u200d(?:"+[o,u,s].join("|")+")"+c+a+")*"),l="(?:"+[o+r+"?",r,u,s,n].join("|")+")",p=RegExp(i+"(?="+i+")|"+l+f,"g");t.exports=function(t){return t.match(p)||[]}},function(t,e,n){var r=n(439),i=n(440),o=n(443),u=RegExp("['’]","g");t.exports=function(t){return function(e){return r(o(i(e).replace(u,"")),t,"")}}},function(t,e){t.exports=function(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}},function(t,e,n){var r=n(441),i=n(65),o=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,u=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");t.exports=function(t){return(t=i(t))&&t.replace(o,r).replace(u,"")}},function(t,e,n){var r=n(442)({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"});t.exports=r},function(t,e){t.exports=function(t){return function(e){return null==t?void 0:t[e]}}},function(t,e,n){var r=n(444),i=n(445),o=n(65),u=n(446);t.exports=function(t,e,n){return t=o(t),void 0===(e=n?void 0:e)?i(t)?u(t):r(t):t.match(e)||[]}},function(t,e){var n=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;t.exports=function(t){return t.match(n)||[]}},function(t,e){var n=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;t.exports=function(t){return n.test(t)}},function(t,e){var n="\\u2700-\\u27bf",r="a-z\\xdf-\\xf6\\xf8-\\xff",i="A-Z\\xc0-\\xd6\\xd8-\\xde",o="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",u="["+o+"]",s="\\d+",a="[\\u2700-\\u27bf]",c="["+r+"]",f="[^\\ud800-\\udfff"+o+s+n+r+i+"]",l="(?:\\ud83c[\\udde6-\\uddff]){2}",p="[\\ud800-\\udbff][\\udc00-\\udfff]",h="["+i+"]",d="(?:"+c+"|"+f+")",y="(?:"+h+"|"+f+")",v="(?:['’](?:d|ll|m|re|s|t|ve))?",g="(?:['’](?:D|LL|M|RE|S|T|VE))?",w="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",M="[\\ufe0e\\ufe0f]?",_=M+w+("(?:\\u200d(?:"+["[^\\ud800-\\udfff]",l,p].join("|")+")"+M+w+")*"),m="(?:"+[a,l,p].join("|")+")"+_,L=RegExp([h+"?"+c+"+"+v+"(?="+[u,h,"$"].join("|")+")",y+"+"+g+"(?="+[u,h+d,"$"].join("|")+")",h+"?"+d+"+"+v,h+"+"+g,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",s,m].join("|"),"g");t.exports=function(t){return t.match(L)||[]}},function(t,e,n){var r=n(448),i=n(93),o=n(130);t.exports=function(){this.size=0,this.__data__={hash:new r,map:new(o||i),string:new r}}},function(t,e,n){var r=n(449),i=n(454),o=n(455),u=n(456),s=n(457);function a(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}a.prototype.clear=r,a.prototype.delete=i,a.prototype.get=o,a.prototype.has=u,a.prototype.set=s,t.exports=a},function(t,e,n){var r=n(92);t.exports=function(){this.__data__=r?r(null):{},this.size=0}},function(t,e,n){var r=n(73),i=n(451),o=n(68),u=n(195),s=/^\[object .+?Constructor\]$/,a=Function.prototype,c=Object.prototype,f=a.toString,l=c.hasOwnProperty,p=RegExp("^"+f.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!o(t)||i(t))&&(r(t)?p:s).test(u(t))}},function(t,e,n){var r,i=n(452),o=(r=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";t.exports=function(t){return!!o&&o in t}},function(t,e,n){var r=n(27)["__core-js_shared__"];t.exports=r},function(t,e){t.exports=function(t,e){return null==t?void 0:t[e]}},function(t,e){t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},function(t,e,n){var r=n(92),i=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(r){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return i.call(e,t)?e[t]:void 0}},function(t,e,n){var r=n(92),i=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return r?void 0!==e[t]:i.call(e,t)}},function(t,e,n){var r=n(92);t.exports=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=r&&void 0===e?"__lodash_hash_undefined__":e,this}},function(t,e){t.exports=function(){this.__data__=[],this.size=0}},function(t,e,n){var r=n(94),i=Array.prototype.splice;t.exports=function(t){var e=this.__data__,n=r(e,t);return!(n<0)&&(n==e.length-1?e.pop():i.call(e,n,1),--this.size,!0)}},function(t,e,n){var r=n(94);t.exports=function(t){var e=this.__data__,n=r(e,t);return n<0?void 0:e[n][1]}},function(t,e,n){var r=n(94);t.exports=function(t){return r(this.__data__,t)>-1}},function(t,e,n){var r=n(94);t.exports=function(t,e){var n=this.__data__,i=r(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this}},function(t,e,n){var r=n(95);t.exports=function(t){var e=r(this,t).delete(t);return this.size-=e?1:0,e}},function(t,e){t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},function(t,e,n){var r=n(95);t.exports=function(t){return r(this,t).get(t)}},function(t,e,n){var r=n(95);t.exports=function(t){return r(this,t).has(t)}},function(t,e,n){var r=n(95);t.exports=function(t,e){var n=r(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this}},function(t,e,n){var r=n(131),i=n(69),o=n(96);t.exports=function(t){return function(e,n,u){var s=Object(e);if(!i(e)){var a=r(n,3);e=o(e),n=function(t){return a(s[t],t,s)}}var c=t(e,n,u);return c>-1?s[a?e[c]:c]:void 0}}},function(t,e,n){var r=n(470),i=n(505),o=n(205);t.exports=function(t){var e=i(t);return 1==e.length&&e[0][2]?o(e[0][0],e[0][1]):function(n){return n===t||r(n,t,e)}}},function(t,e,n){var r=n(196),i=n(197);t.exports=function(t,e,n,o){var u=n.length,s=u,a=!o;if(null==t)return!s;for(t=Object(t);u--;){var c=n[u];if(a&&c[2]?c[1]!==t[c[0]]:!(c[0]in t))return!1}for(;++u<s;){var f=(c=n[u])[0],l=t[f],p=c[1];if(a&&c[2]){if(void 0===l&&!(f in t))return!1}else{var h=new r;if(o)var d=o(l,p,f,t,e,h);if(!(void 0===d?i(p,l,3,o,h):d))return!1}}return!0}},function(t,e,n){var r=n(93);t.exports=function(){this.__data__=new r,this.size=0}},function(t,e){t.exports=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}},function(t,e){t.exports=function(t){return this.__data__.get(t)}},function(t,e){t.exports=function(t){return this.__data__.has(t)}},function(t,e,n){var r=n(93),i=n(130),o=n(129);t.exports=function(t,e){var n=this.__data__;if(n instanceof r){var u=n.__data__;if(!i||u.length<199)return u.push([t,e]),this.size=++n.size,this;n=this.__data__=new o(u)}return n.set(t,e),this.size=n.size,this}},function(t,e,n){var r=n(196),i=n(198),o=n(481),u=n(485),s=n(203),a=n(23),c=n(133),f=n(135),l="[object Arguments]",p="[object Array]",h="[object Object]",d=Object.prototype.hasOwnProperty;t.exports=function(t,e,n,y,v,g){var w=a(t),M=a(e),_=w?p:s(t),m=M?p:s(e),L=(_=_==l?h:_)==h,x=(m=m==l?h:m)==h,b=_==m;if(b&&c(t)){if(!c(e))return!1;w=!0,L=!1}if(b&&!L)return g||(g=new r),w||f(t)?i(t,e,n,y,v,g):o(t,e,_,n,y,v,g);if(!(1&n)){var j=L&&d.call(t,"__wrapped__"),N=x&&d.call(e,"__wrapped__");if(j||N){var S=j?t.value():t,D=N?e.value():e;return g||(g=new r),v(S,D,n,y,g)}}return!!b&&(g||(g=new r),u(t,e,n,y,v,g))}},function(t,e,n){var r=n(129),i=n(478),o=n(479);function u(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new r;++e<n;)this.add(t[e])}u.prototype.add=u.prototype.push=i,u.prototype.has=o,t.exports=u},function(t,e){t.exports=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}},function(t,e){t.exports=function(t){return this.__data__.has(t)}},function(t,e){t.exports=function(t,e){return t.has(e)}},function(t,e,n){var r=n(90),i=n(482),o=n(52),u=n(198),s=n(483),a=n(484),c=r?r.prototype:void 0,f=c?c.valueOf:void 0;t.exports=function(t,e,n,r,c,l,p){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!l(new i(t),new i(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return o(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var h=s;case"[object Set]":var d=1&r;if(h||(h=a),t.size!=e.size&&!d)return!1;var y=p.get(t);if(y)return y==e;r|=2,p.set(t,e);var v=u(h(t),h(e),r,c,l,p);return p.delete(t),v;case"[object Symbol]":if(f)return f.call(t)==f.call(e)}return!1}},function(t,e,n){var r=n(27).Uint8Array;t.exports=r},function(t,e){t.exports=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}},function(t,e){t.exports=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}},function(t,e,n){var r=n(486),i=Object.prototype.hasOwnProperty;t.exports=function(t,e,n,o,u,s){var a=1&n,c=r(t),f=c.length;if(f!=r(e).length&&!a)return!1;for(var l=f;l--;){var p=c[l];if(!(a?p in e:i.call(e,p)))return!1}var h=s.get(t),d=s.get(e);if(h&&d)return h==e&&d==t;var y=!0;s.set(t,e),s.set(e,t);for(var v=a;++l<f;){var g=t[p=c[l]],w=e[p];if(o)var M=a?o(w,g,p,e,t,s):o(g,w,p,t,e,s);if(!(void 0===M?g===w||u(g,w,n,o,s):M)){y=!1;break}v||(v="constructor"==p)}if(y&&!v){var _=t.constructor,m=e.constructor;_==m||!("constructor"in t)||!("constructor"in e)||"function"==typeof _&&_ instanceof _&&"function"==typeof m&&m instanceof m||(y=!1)}return s.delete(t),s.delete(e),y}},function(t,e,n){var r=n(487),i=n(489),o=n(96);t.exports=function(t){return r(t,o,i)}},function(t,e,n){var r=n(488),i=n(23);t.exports=function(t,e,n){var o=e(t);return i(t)?o:r(o,n(t))}},function(t,e){t.exports=function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}},function(t,e,n){var r=n(490),i=n(491),o=Object.prototype.propertyIsEnumerable,u=Object.getOwnPropertySymbols,s=u?function(t){return null==t?[]:(t=Object(t),r(u(t),(function(e){return o.call(t,e)})))}:i;t.exports=s},function(t,e){t.exports=function(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var u=t[n];e(u,n,t)&&(o[i++]=u)}return o}},function(t,e){t.exports=function(){return[]}},function(t,e,n){var r=n(493),i=n(132),o=n(23),u=n(133),s=n(134),a=n(135),c=Object.prototype.hasOwnProperty;t.exports=function(t,e){var n=o(t),f=!n&&i(t),l=!n&&!f&&u(t),p=!n&&!f&&!l&&a(t),h=n||f||l||p,d=h?r(t.length,String):[],y=d.length;for(var v in t)!e&&!c.call(t,v)||h&&("length"==v||l&&("offset"==v||"parent"==v)||p&&("buffer"==v||"byteLength"==v||"byteOffset"==v)||s(v,y))||d.push(v);return d}},function(t,e){t.exports=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}},function(t,e,n){var r=n(66),i=n(67);t.exports=function(t){return i(t)&&"[object Arguments]"==r(t)}},function(t,e){t.exports=function(){return!1}},function(t,e,n){var r=n(66),i=n(136),o=n(67),u={};u["[object Float32Array]"]=u["[object Float64Array]"]=u["[object Int8Array]"]=u["[object Int16Array]"]=u["[object Int32Array]"]=u["[object Uint8Array]"]=u["[object Uint8ClampedArray]"]=u["[object Uint16Array]"]=u["[object Uint32Array]"]=!0,u["[object Arguments]"]=u["[object Array]"]=u["[object ArrayBuffer]"]=u["[object Boolean]"]=u["[object DataView]"]=u["[object Date]"]=u["[object Error]"]=u["[object Function]"]=u["[object Map]"]=u["[object Number]"]=u["[object Object]"]=u["[object RegExp]"]=u["[object Set]"]=u["[object String]"]=u["[object WeakMap]"]=!1,t.exports=function(t){return o(t)&&i(t.length)&&!!u[r(t)]}},function(t,e){t.exports=function(t){return function(e){return t(e)}}},function(t,e,n){(function(t){var r=n(193),i=e&&!e.nodeType&&e,o=i&&"object"==typeof t&&t&&!t.nodeType&&t,u=o&&o.exports===i&&r.process,s=function(){try{var t=o&&o.require&&o.require("util").types;return t||u&&u.binding&&u.binding("util")}catch(t){}}();t.exports=s}).call(this,n(200)(t))},function(t,e,n){var r=n(500)(Object.keys,Object);t.exports=r},function(t,e){t.exports=function(t,e){return function(n){return t(e(n))}}},function(t,e,n){var r=n(47)(n(27),"DataView");t.exports=r},function(t,e,n){var r=n(47)(n(27),"Promise");t.exports=r},function(t,e,n){var r=n(47)(n(27),"Set");t.exports=r},function(t,e,n){var r=n(47)(n(27),"WeakMap");t.exports=r},function(t,e,n){var r=n(204),i=n(96);t.exports=function(t){for(var e=i(t),n=e.length;n--;){var o=e[n],u=t[o];e[n]=[o,u,r(u)]}return e}},function(t,e,n){var r=n(197),i=n(507),o=n(510),u=n(137),s=n(204),a=n(205),c=n(97);t.exports=function(t,e){return u(t)&&s(e)?a(c(t),e):function(n){var u=i(n,t);return void 0===u&&u===e?o(n,t):r(e,u,3)}}},function(t,e,n){var r=n(206);t.exports=function(t,e,n){var i=null==t?void 0:r(t,e);return void 0===i?n:i}},function(t,e,n){var r=n(509),i=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,o=/\\(\\)?/g,u=r((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(i,(function(t,n,r,i){e.push(r?i.replace(o,"$1"):n||t)})),e}));t.exports=u},function(t,e,n){var r=n(146);t.exports=function(t){var e=r(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}},function(t,e,n){var r=n(511),i=n(512);t.exports=function(t,e){return null!=t&&i(t,e,r)}},function(t,e){t.exports=function(t,e){return null!=t&&e in Object(t)}},function(t,e,n){var r=n(207),i=n(132),o=n(23),u=n(134),s=n(136),a=n(97);t.exports=function(t,e,n){for(var c=-1,f=(e=r(e,t)).length,l=!1;++c<f;){var p=a(e[c]);if(!(l=null!=t&&n(t,p)))break;t=t[p]}return l||++c!=f?l:!!(f=null==t?0:t.length)&&s(f)&&u(p,f)&&(o(t)||i(t))}},function(t,e){t.exports=function(t){return t}},function(t,e,n){var r=n(515),i=n(516),o=n(137),u=n(97);t.exports=function(t){return o(t)?r(u(t)):i(t)}},function(t,e){t.exports=function(t){return function(e){return null==e?void 0:e[t]}}},function(t,e,n){var r=n(206);t.exports=function(t){return function(e){return r(e,t)}}},function(t,e,n){var r=n(518),i=n(131),o=n(519),u=Math.max;t.exports=function(t,e,n){var s=null==t?0:t.length;if(!s)return-1;var a=null==n?0:o(n);return a<0&&(a=u(s+a,0)),r(t,i(e,3),a)}},function(t,e){t.exports=function(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}},function(t,e,n){var r=n(520);t.exports=function(t){var e=r(t),n=e%1;return e==e?n?e-n:e:0}},function(t,e,n){var r=n(521),i=1/0;t.exports=function(t){return t?(t=r(t))===i||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}},function(t,e,n){var r=n(522),i=n(68),o=n(91),u=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,a=/^0o[0-7]+$/i,c=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(o(t))return NaN;if(i(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=i(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=r(t);var n=s.test(t);return n||a.test(t)?c(t.slice(2),n?2:8):u.test(t)?NaN:+t}},function(t,e,n){var r=n(523),i=/^\s+/;t.exports=function(t){return t?t.slice(0,r(t)+1).replace(i,""):t}},function(t,e){var n=/\s/;t.exports=function(t){for(var e=t.length;e--&&n.test(t.charAt(e)););return e}},function(t,e,n){var r=n(525);t.exports=function(t,e){var n;return r(t,(function(t,r,i){return!(n=e(t,r,i))})),!!n}},function(t,e,n){var r=n(526),i=n(529)(r);t.exports=i},function(t,e,n){var r=n(527),i=n(96);t.exports=function(t,e){return t&&r(t,e,i)}},function(t,e,n){var r=n(528)();t.exports=r},function(t,e){t.exports=function(t){return function(e,n,r){for(var i=-1,o=Object(e),u=r(e),s=u.length;s--;){var a=u[t?s:++i];if(!1===n(o[a],a,o))break}return e}}},function(t,e,n){var r=n(69);t.exports=function(t,e){return function(n,i){if(null==n)return n;if(!r(n))return t(n,i);for(var o=n.length,u=e?o:-1,s=Object(n);(e?u--:++u<o)&&!1!==i(s[u],u,s););return n}}},function(t,e,n){var r=n(52),i=n(69),o=n(134),u=n(68);t.exports=function(t,e,n){if(!u(n))return!1;var s=typeof e;return!!("number"==s?i(n)&&o(e,n.length):"string"==s&&e in n)&&r(n[e],t)}},function(t,e){var n={"&":"&",'"':""","'":"'","<":"<",">":">"};t.exports=function(t){return t&&t.replace?t.replace(/([&"<>'])/g,(function(t,e){return n[e]})):t}},function(t,e,n){t.exports=i;var r=n(138).EventEmitter;function i(){r.call(this)}n(17)(i,r),i.Readable=n(139),i.Writable=n(539),i.Duplex=n(540),i.Transform=n(541),i.PassThrough=n(542),i.Stream=i,i.prototype.pipe=function(t,e){var n=this;function i(e){t.writable&&!1===t.write(e)&&n.pause&&n.pause()}function o(){n.readable&&n.resume&&n.resume()}n.on("data",i),t.on("drain",o),t._isStdio||e&&!1===e.end||(n.on("end",s),n.on("close",a));var u=!1;function s(){u||(u=!0,t.end())}function a(){u||(u=!0,"function"==typeof t.destroy&&t.destroy())}function c(t){if(f(),0===r.listenerCount(this,"error"))throw t}function f(){n.removeListener("data",i),t.removeListener("drain",o),n.removeListener("end",s),n.removeListener("close",a),n.removeListener("error",c),t.removeListener("error",c),n.removeListener("end",f),n.removeListener("close",f),t.removeListener("close",f)}return n.on("error",c),t.on("error",c),n.on("end",f),n.on("close",f),t.on("close",f),t.emit("pipe",n),t}},function(t,e){},function(t,e,n){"use strict";var r=n(18).Buffer,i=n(535);t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n},t.prototype.concat=function(t){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var e,n,i,o=r.allocUnsafe(t>>>0),u=this.head,s=0;u;)e=u.data,n=o,i=s,e.copy(n,i),s+=u.data.length,u=u.next;return o},t}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var t=i.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e){},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var r,i,o,u,s,a=1,c={},f=!1,l=t.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(t);p=p&&p.setTimeout?p:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick((function(){d(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){d(t.data)},r=function(t){o.port2.postMessage(t)}):l&&"onreadystatechange"in l.createElement("script")?(i=l.documentElement,r=function(t){var e=l.createElement("script");e.onreadystatechange=function(){d(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):r=function(t){setTimeout(d,0,t)}:(u="setImmediate$"+Math.random()+"$",s=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(u)&&d(+e.data.slice(u.length))},t.addEventListener?t.addEventListener("message",s,!1):t.attachEvent("onmessage",s),r=function(e){t.postMessage(u+e,"*")}),p.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var i={callback:t,args:e};return c[a]=i,r(a),a++},p.clearImmediate=h}function h(t){delete c[t]}function d(t){if(f)setTimeout(d,0,t);else{var e=c[t];if(e){f=!0;try{!function(t){var e=t.callback,n=t.args;switch(n.length){case 0:e();break;case 1:e(n[0]);break;case 2:e(n[0],n[1]);break;case 3:e(n[0],n[1],n[2]);break;default:e.apply(void 0,n)}}(e)}finally{h(t),f=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,n(20),n(36))},function(t,e,n){(function(e){function n(t){try{if(!e.localStorage)return!1}catch(t){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=function(t,e){if(n("noDeprecation"))return t;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}}}).call(this,n(20))},function(t,e,n){"use strict";t.exports=o;var r=n(213),i=n(70);function o(t){if(!(this instanceof o))return new o(t);r.call(this,t)}i.inherits=n(17),i.inherits(o,r),o.prototype._transform=function(t,e,n){n(null,t)}},function(t,e,n){t.exports=n(140)},function(t,e,n){t.exports=n(37)},function(t,e,n){t.exports=n(139).Transform},function(t,e,n){t.exports=n(139).PassThrough},function(t,e,n){"use strict";t.exports=function(){}},function(t,e,n){"use strict";var r=n(545),i=Math.abs,o=Math.floor;t.exports=function(t){return isNaN(t)?0:0!==(t=Number(t))&&isFinite(t)?r(t)*o(i(t)):t}},function(t,e,n){"use strict";t.exports=n(546)()?Math.sign:n(547)},function(t,e,n){"use strict";t.exports=function(){var t=Math.sign;return"function"==typeof t&&(1===t(10)&&-1===t(-20))}},function(t,e,n){"use strict";t.exports=function(t){return t=Number(t),isNaN(t)||0===t?t:t>0?1:-1}},function(t,e,n){"use strict";var r=n(31),i=n(99),o=n(40),u=n(550),s=n(215);t.exports=function t(e){var n,a,c;if(r(e),(n=Object(arguments[1])).async&&n.promise)throw new Error("Options 'async' and 'promise' cannot be used together");return hasOwnProperty.call(e,"__memoized__")&&!n.force?e:(a=s(n.length,e.length,n.async&&o.async),c=u(e,a,n),i(o,(function(t,e){n[e]&&t(n[e],c,n)})),t.__profiler__&&t.__profiler__(c),c.updateEnv(),c.memoized)}},function(t,e,n){"use strict";var r=n(31),i=n(48),o=Function.prototype.bind,u=Function.prototype.call,s=Object.keys,a=Object.prototype.propertyIsEnumerable;t.exports=function(t,e){return function(n,c){var f,l=arguments[2],p=arguments[3];return n=Object(i(n)),r(c),f=s(n),p&&f.sort("function"==typeof p?o.call(p,n):void 0),"function"!=typeof t&&(t=f[t]),u.call(t,f,(function(t,r){return a.call(n,t)?u.call(c,l,n[t],t,n,r):e}))}}},function(t,e,n){"use strict";var r=n(551),i=n(217),o=n(41),u=n(565).methods,s=n(566),a=n(582),c=Function.prototype.apply,f=Function.prototype.call,l=Object.create,p=Object.defineProperties,h=u.on,d=u.emit;t.exports=function(t,e,n){var u,y,v,g,w,M,_,m,L,x,b,j,N,S,D,I=l(null);return y=!1!==e?e:isNaN(t.length)?1:t.length,n.normalizer&&(x=a(n.normalizer),v=x.get,g=x.set,w=x.delete,M=x.clear),null!=n.resolvers&&(D=s(n.resolvers)),S=v?i((function(e){var n,i,o=arguments;if(D&&(o=D(o)),null!==(n=v(o))&&hasOwnProperty.call(I,n))return b&&u.emit("get",n,o,this),I[n];if(i=1===o.length?f.call(t,this,o[0]):c.call(t,this,o),null===n){if(null!==(n=v(o)))throw r("Circular invocation","CIRCULAR_INVOCATION");n=g(o)}else if(hasOwnProperty.call(I,n))throw r("Circular invocation","CIRCULAR_INVOCATION");return I[n]=i,j&&u.emit("set",n,null,i),i}),y):0===e?function(){var e;if(hasOwnProperty.call(I,"data"))return b&&u.emit("get","data",arguments,this),I.data;if(e=arguments.length?c.call(t,this,arguments):f.call(t,this),hasOwnProperty.call(I,"data"))throw r("Circular invocation","CIRCULAR_INVOCATION");return I.data=e,j&&u.emit("set","data",null,e),e}:function(e){var n,i,o=arguments;if(D&&(o=D(arguments)),i=String(o[0]),hasOwnProperty.call(I,i))return b&&u.emit("get",i,o,this),I[i];if(n=1===o.length?f.call(t,this,o[0]):c.call(t,this,o),hasOwnProperty.call(I,i))throw r("Circular invocation","CIRCULAR_INVOCATION");return I[i]=n,j&&u.emit("set",i,null,n),n},u={original:t,memoized:S,profileName:n.profileName,get:function(t){return D&&(t=D(t)),v?v(t):String(t[0])},has:function(t){return hasOwnProperty.call(I,t)},delete:function(t){var e;hasOwnProperty.call(I,t)&&(w&&w(t),e=I[t],delete I[t],N&&u.emit("delete",t,e))},clear:function(){var t=I;M&&M(),I=l(null),u.emit("clear",t)},on:function(t,e){return"get"===t?b=!0:"set"===t?j=!0:"delete"===t&&(N=!0),h.call(this,t,e)},emit:d,updateEnv:function(){t=u.original}},_=v?i((function(t){var e,n=arguments;D&&(n=D(n)),null!==(e=v(n))&&u.delete(e)}),y):0===e?function(){return u.delete("data")}:function(t){return D&&(t=D(arguments)[0]),u.delete(t)},m=i((function(){var t,n=arguments;return 0===e?I.data:(D&&(n=D(n)),t=v?v(n):String(n[0]),I[t])})),L=i((function(){var t,n=arguments;return 0===e?u.has("data"):(D&&(n=D(n)),null!==(t=v?v(n):String(n[0]))&&u.has(t))})),p(S,{__memoized__:o(!0),delete:o(_),clear:o(u.clear),_get:o(m),_has:o(L)}),u}},function(t,e,n){"use strict";var r=n(216),i=n(557),o=n(38),u=Error.captureStackTrace;t.exports=function(e){var n=new Error(e),s=arguments[1],a=arguments[2];return o(a)||i(s)&&(a=s,s=null),o(a)&&r(n,a),o(s)&&(n.code=s),u&&u(n,t.exports),n}},function(t,e,n){"use strict";t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},function(t,e,n){"use strict";var r=n(554),i=n(48),o=Math.max;t.exports=function(t,e){var n,u,s,a=o(arguments.length,2);for(t=Object(i(t)),s=function(r){try{t[r]=e[r]}catch(t){n||(n=t)}},u=1;u<a;++u)r(e=arguments[u]).forEach(s);if(void 0!==n)throw n;return t}},function(t,e,n){"use strict";t.exports=n(555)()?Object.keys:n(556)},function(t,e,n){"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},function(t,e,n){"use strict";var r=n(38),i=Object.keys;t.exports=function(t){return i(r(t)?Object(t):t)}},function(t,e,n){"use strict";var r=n(38),i={function:!0,object:!0};t.exports=function(t){return r(t)&&i[typeof t]||!1}},function(t,e,n){"use strict";var r=n(559),i=/^\s*class[\s{/}]/,o=Function.prototype.toString;t.exports=function(t){return!!r(t)&&!i.test(o.call(t))}},function(t,e,n){"use strict";var r=n(560);t.exports=function(t){if("function"!=typeof t)return!1;if(!hasOwnProperty.call(t,"length"))return!1;try{if("number"!=typeof t.length)return!1;if("function"!=typeof t.call)return!1;if("function"!=typeof t.apply)return!1}catch(t){return!1}return!r(t)}},function(t,e,n){"use strict";var r=n(561);t.exports=function(t){if(!r(t))return!1;try{return!!t.constructor&&t.constructor.prototype===t}catch(t){return!1}}},function(t,e,n){"use strict";var r=n(219),i={object:!0,function:!0,undefined:!0};t.exports=function(t){return!!r(t)&&hasOwnProperty.call(i,typeof t)}},function(t,e,n){"use strict";t.exports=n(563)()?String.prototype.contains:n(564)},function(t,e,n){"use strict";var r="razdwatrzy";t.exports=function(){return"function"==typeof r.contains&&(!0===r.contains("dwa")&&!1===r.contains("foo"))}},function(t,e,n){"use strict";var r=String.prototype.indexOf;t.exports=function(t){return r.call(this,t,arguments[1])>-1}},function(t,e,n){"use strict";var r,i,o,u,s,a,c,f=n(41),l=n(31),p=Function.prototype.apply,h=Function.prototype.call,d=Object.create,y=Object.defineProperty,v=Object.defineProperties,g=Object.prototype.hasOwnProperty,w={configurable:!0,enumerable:!1,writable:!0};i=function(t,e){var n,i;return l(e),i=this,r.call(this,t,n=function(){o.call(i,t,n),p.call(e,this,arguments)}),n.__eeOnceListener__=e,this},s={on:r=function(t,e){var n;return l(e),g.call(this,"__ee__")?n=this.__ee__:(n=w.value=d(null),y(this,"__ee__",w),w.value=null),n[t]?"object"==typeof n[t]?n[t].push(e):n[t]=[n[t],e]:n[t]=e,this},once:i,off:o=function(t,e){var n,r,i,o;if(l(e),!g.call(this,"__ee__"))return this;if(!(n=this.__ee__)[t])return this;if("object"==typeof(r=n[t]))for(o=0;i=r[o];++o)i!==e&&i.__eeOnceListener__!==e||(2===r.length?n[t]=r[o?0:1]:r.splice(o,1));else r!==e&&r.__eeOnceListener__!==e||delete n[t];return this},emit:u=function(t){var e,n,r,i,o;if(g.call(this,"__ee__")&&(i=this.__ee__[t]))if("object"==typeof i){for(n=arguments.length,o=new Array(n-1),e=1;e<n;++e)o[e-1]=arguments[e];for(i=i.slice(),e=0;r=i[e];++e)p.call(r,this,o)}else switch(arguments.length){case 1:h.call(i,this);break;case 2:h.call(i,this,arguments[1]);break;case 3:h.call(i,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,o=new Array(n-1),e=1;e<n;++e)o[e-1]=arguments[e];p.call(i,this,o)}}},a={on:f(r),once:f(i),off:f(o),emit:f(u)},c=v({},a),t.exports=e=function(t){return null==t?d(c):v(Object(t),a)},e.methods=s},function(t,e,n){"use strict";var r,i=n(567),o=n(38),u=n(31),s=Array.prototype.slice;r=function(t){return this.map((function(e,n){return e?e(t[n]):t[n]})).concat(s.call(t,this.length))},t.exports=function(t){return(t=i(t)).forEach((function(t){o(t)&&u(t)})),r.bind(t)}},function(t,e,n){"use strict";var r=n(141),i=Array.isArray;t.exports=function(t){return i(t)?t:r(t)}},function(t,e,n){"use strict";t.exports=function(){var t,e,n=Array.from;return"function"==typeof n&&(e=n(t=["raz","dwa"]),Boolean(e&&e!==t&&"dwa"===e[1]))}},function(t,e,n){"use strict";var r=n(570).iterator,i=n(579),o=n(580),u=n(39),s=n(31),a=n(48),c=n(38),f=n(581),l=Array.isArray,p=Function.prototype.call,h={configurable:!0,enumerable:!0,writable:!0,value:null},d=Object.defineProperty;t.exports=function(t){var e,n,y,v,g,w,M,_,m,L,x=arguments[1],b=arguments[2];if(t=Object(a(t)),c(x)&&s(x),this&&this!==Array&&o(this))e=this;else{if(!x){if(i(t))return 1!==(g=t.length)?Array.apply(null,t):((v=new Array(1))[0]=t[0],v);if(l(t)){for(v=new Array(g=t.length),n=0;n<g;++n)v[n]=t[n];return v}}v=[]}if(!l(t))if(void 0!==(m=t[r])){for(M=s(m).call(t),e&&(v=new e),_=M.next(),n=0;!_.done;)L=x?p.call(x,b,_.value,n):_.value,e?(h.value=L,d(v,n,h)):v[n]=L,_=M.next(),++n;g=n}else if(f(t)){for(g=t.length,e&&(v=new e),n=0,y=0;n<g;++n)L=t[n],n+1<g&&(w=L.charCodeAt(0))>=55296&&w<=56319&&(L+=t[++n]),L=x?p.call(x,b,L,y):L,e?(h.value=L,d(v,y,h)):v[y]=L,++y;g=y}if(void 0===g)for(g=u(t.length),e&&(v=new e(g)),n=0;n<g;++n)L=x?p.call(x,b,t[n],n):t[n],e?(h.value=L,d(v,n,h)):v[n]=L;return e&&(h.value=null,v.length=g),v}},function(t,e,n){"use strict";t.exports=n(571)()?n(100).Symbol:n(574)},function(t,e,n){"use strict";var r=n(100),i={object:!0,symbol:!0};t.exports=function(){var t,e=r.Symbol;if("function"!=typeof e)return!1;t=e("test symbol");try{String(t)}catch(t){return!1}return!!i[typeof e.iterator]&&(!!i[typeof e.toPrimitive]&&!!i[typeof e.toStringTag])}},function(t,e,n){"use strict";t.exports=function(){return"object"==typeof globalThis&&(!!globalThis&&globalThis.Array===Array)}},function(t,e){var n=function(){if("object"==typeof self&&self)return self;if("object"==typeof window&&window)return window;throw new Error("Unable to resolve global `this`")};t.exports=function(){if(this)return this;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch(t){return n()}try{return __global__||n()}finally{delete Object.prototype.__global__}}()},function(t,e,n){"use strict";var r,i,o,u=n(41),s=n(220),a=n(100).Symbol,c=n(576),f=n(577),l=n(578),p=Object.create,h=Object.defineProperties,d=Object.defineProperty;if("function"==typeof a)try{String(a()),o=!0}catch(t){}else a=null;i=function(t){if(this instanceof i)throw new TypeError("Symbol is not a constructor");return r(t)},t.exports=r=function t(e){var n;if(this instanceof t)throw new TypeError("Symbol is not a constructor");return o?a(e):(n=p(i.prototype),e=void 0===e?"":String(e),h(n,{__description__:u("",e),__name__:u("",c(e))}))},f(r),l(r),h(i.prototype,{constructor:u(r),toString:u("",(function(){return this.__name__}))}),h(r.prototype,{toString:u((function(){return"Symbol ("+s(this).__description__+")"})),valueOf:u((function(){return s(this)}))}),d(r.prototype,r.toPrimitive,u("",(function(){var t=s(this);return"symbol"==typeof t?t:t.toString()}))),d(r.prototype,r.toStringTag,u("c","Symbol")),d(i.prototype,r.toStringTag,u("c",r.prototype[r.toStringTag])),d(i.prototype,r.toPrimitive,u("c",r.prototype[r.toPrimitive]))},function(t,e,n){"use strict";t.exports=function(t){return!!t&&("symbol"==typeof t||!!t.constructor&&("Symbol"===t.constructor.name&&"Symbol"===t[t.constructor.toStringTag]))}},function(t,e,n){"use strict";var r=n(41),i=Object.create,o=Object.defineProperty,u=Object.prototype,s=i(null);t.exports=function(t){for(var e,n,i=0;s[t+(i||"")];)++i;return s[t+=i||""]=!0,o(u,e="@@"+t,r.gs(null,(function(t){n||(n=!0,o(this,e,r(t)),n=!1)}))),e}},function(t,e,n){"use strict";var r=n(41),i=n(100).Symbol;t.exports=function(t){return Object.defineProperties(t,{hasInstance:r("",i&&i.hasInstance||t("hasInstance")),isConcatSpreadable:r("",i&&i.isConcatSpreadable||t("isConcatSpreadable")),iterator:r("",i&&i.iterator||t("iterator")),match:r("",i&&i.match||t("match")),replace:r("",i&&i.replace||t("replace")),search:r("",i&&i.search||t("search")),species:r("",i&&i.species||t("species")),split:r("",i&&i.split||t("split")),toPrimitive:r("",i&&i.toPrimitive||t("toPrimitive")),toStringTag:r("",i&&i.toStringTag||t("toStringTag")),unscopables:r("",i&&i.unscopables||t("unscopables"))})}},function(t,e,n){"use strict";var r=n(41),i=n(220),o=Object.create(null);t.exports=function(t){return Object.defineProperties(t,{for:r((function(e){return o[e]?o[e]:o[e]=t(String(e))})),keyFor:r((function(t){var e;for(e in i(t),o)if(o[e]===t)return e}))})}},function(t,e,n){"use strict";var r=Object.prototype.toString,i=r.call(function(){return arguments}());t.exports=function(t){return r.call(t)===i}},function(t,e,n){"use strict";var r=Object.prototype.toString,i=RegExp.prototype.test.bind(/^[object [A-Za-z0-9]*Function]$/);t.exports=function(t){return"function"==typeof t&&i(r.call(t))}},function(t,e,n){"use strict";var r=Object.prototype.toString,i=r.call("");t.exports=function(t){return"string"==typeof t||t&&"object"==typeof t&&(t instanceof String||r.call(t)===i)||!1}},function(t,e,n){"use strict";var r=n(31);t.exports=function(t){var e;return"function"==typeof t?{set:t,get:t}:(e={get:r(t.get)},void 0!==t.set?(e.set=r(t.set),t.delete&&(e.delete=r(t.delete)),t.clear&&(e.clear=r(t.clear)),e):(e.set=e.get,e))}},function(t,e,n){"use strict";t.exports=function(t){var e,n,r=t.length;if(!r)return"";for(e=String(t[n=0]);--r;)e+=""+t[++n];return e}},function(t,e,n){"use strict";t.exports=function(t){return t?function(e){for(var n=String(e[0]),r=0,i=t;--i;)n+=""+e[++r];return n}:function(){return""}}},function(t,e,n){"use strict";var r=n(142),i=Object.create;t.exports=function(){var t=0,e=[],n=i(null);return{get:function(t){var n,i=0,o=e,u=t.length;if(0===u)return o[u]||null;if(o=o[u]){for(;i<u-1;){if(-1===(n=r.call(o[0],t[i])))return null;o=o[1][n],++i}return-1===(n=r.call(o[0],t[i]))?null:o[1][n]||null}return null},set:function(i){var o,u=0,s=e,a=i.length;if(0===a)s[a]=++t;else{for(s[a]||(s[a]=[[],[]]),s=s[a];u<a-1;)-1===(o=r.call(s[0],i[u]))&&(o=s[0].push(i[u])-1,s[1].push([[],[]])),s=s[1][o],++u;-1===(o=r.call(s[0],i[u]))&&(o=s[0].push(i[u])-1),s[1][o]=++t}return n[t]=i,t},delete:function(t){var i,o=0,u=e,s=n[t],a=s.length,c=[];if(0===a)delete u[a];else if(u=u[a]){for(;o<a-1;){if(-1===(i=r.call(u[0],s[o])))return;c.push(u,i),u=u[1][i],++o}if(-1===(i=r.call(u[0],s[o])))return;for(t=u[1][i],u[0].splice(i,1),u[1].splice(i,1);!u[0].length&&c.length;)i=c.pop(),(u=c.pop())[0].splice(i,1),u[1].splice(i,1)}delete n[t]},clear:function(){e=[],n=i(null)}}}},function(t,e,n){"use strict";t.exports=n(587)()?Number.isNaN:n(588)},function(t,e,n){"use strict";t.exports=function(){var t=Number.isNaN;return"function"==typeof t&&(!t({})&&t(NaN)&&!t(34))}},function(t,e,n){"use strict";t.exports=function(t){return t!=t}},function(t,e,n){"use strict";var r=n(142);t.exports=function(){var t=0,e=[],n=[];return{get:function(t){var i=r.call(e,t[0]);return-1===i?null:n[i]},set:function(r){return e.push(r[0]),n.push(++t),t},delete:function(t){var i=r.call(n,t);-1!==i&&(e.splice(i,1),n.splice(i,1))},clear:function(){e=[],n=[]}}}},function(t,e,n){"use strict";var r=n(142),i=Object.create;t.exports=function(t){var e=0,n=[[],[]],o=i(null);return{get:function(e){for(var i,o=0,u=n;o<t-1;){if(-1===(i=r.call(u[0],e[o])))return null;u=u[1][i],++o}return-1===(i=r.call(u[0],e[o]))?null:u[1][i]||null},set:function(i){for(var u,s=0,a=n;s<t-1;)-1===(u=r.call(a[0],i[s]))&&(u=a[0].push(i[s])-1,a[1].push([[],[]])),a=a[1][u],++s;return-1===(u=r.call(a[0],i[s]))&&(u=a[0].push(i[s])-1),a[1][u]=++e,o[e]=i,e},delete:function(e){for(var i,u=0,s=n,a=[],c=o[e];u<t-1;){if(-1===(i=r.call(s[0],c[u])))return;a.push(s,i),s=s[1][i],++u}if(-1!==(i=r.call(s[0],c[u]))){for(e=s[1][i],s[0].splice(i,1),s[1].splice(i,1);!s[0].length&&a.length;)i=a.pop(),(s=a.pop())[0].splice(i,1),s[1].splice(i,1);delete o[e]}},clear:function(){n=[[],[]],o=i(null)}}}},function(t,e,n){"use strict";var r=n(141),i=n(221),o=n(218),u=n(217),s=n(143),a=Array.prototype.slice,c=Function.prototype.apply,f=Object.create;n(40).async=function(t,e){var n,l,p,h=f(null),d=f(null),y=e.memoized,v=e.original;e.memoized=u((function(t){var e=arguments,r=e[e.length-1];return"function"==typeof r&&(n=r,e=a.call(e,0,-1)),y.apply(l=this,p=e)}),y);try{o(e.memoized,y)}catch(t){}e.on("get",(function(t){var r,i,o;if(n){if(h[t])return"function"==typeof h[t]?h[t]=[h[t],n]:h[t].push(n),void(n=null);r=n,i=l,o=p,n=l=p=null,s((function(){var u;hasOwnProperty.call(d,t)?(u=d[t],e.emit("getasync",t,o,i),c.call(r,u.context,u.args)):(n=r,l=i,p=o,y.apply(i,o))}))}})),e.original=function(){var t,i,o,u;return n?(t=r(arguments),i=function t(n){var i,o,a=t.id;if(null!=a){if(delete t.id,i=h[a],delete h[a],i)return o=r(arguments),e.has(a)&&(n?e.delete(a):(d[a]={context:this,args:o},e.emit("setasync",a,"function"==typeof i?1:i.length))),"function"==typeof i?u=c.call(i,this,o):i.forEach((function(t){u=c.call(t,this,o)}),this),u}else s(c.bind(t,this,arguments))},o=n,n=l=p=null,t.push(i),u=c.call(v,this,t),i.cb=o,n=i,u):c.call(v,this,arguments)},e.on("set",(function(t){n?(h[t]?"function"==typeof h[t]?h[t]=[h[t],n.cb]:h[t].push(n.cb):h[t]=n.cb,delete n.cb,n.id=t,n=null):e.delete(t)})),e.on("delete",(function(t){var n;hasOwnProperty.call(h,t)||d[t]&&(n=d[t],delete d[t],e.emit("deleteasync",t,a.call(n.args,1)))})),e.on("clear",(function(){var t=d;d=f(null),e.emit("clearasync",i(t,(function(t){return a.call(t.args,1)})))}))}},function(t,e,n){"use strict";var r=n(221),i=n(593),o=n(594),u=n(596),s=n(223),a=n(143),c=Object.create,f=i("then","then:finally","done","done:finally");n(40).promise=function(t,e){var n=c(null),i=c(null),l=c(null);if(!0===t)t=null;else if(t=o(t),!f[t])throw new TypeError("'"+u(t)+"' is not valid promise mode");e.on("set",(function(r,o,u){var c=!1;if(!s(u))return i[r]=u,void e.emit("setasync",r,1);n[r]=1,l[r]=u;var f=function(t){var o=n[r];if(c)throw new Error("Memoizee error: Detected unordered then|done & finally resolution, which in turn makes proper detection of success/failure impossible (when in 'done:finally' mode)\nConsider to rely on 'then' or 'done' mode instead.");o&&(delete n[r],i[r]=t,e.emit("setasync",r,o))},p=function(){c=!0,n[r]&&(delete n[r],delete l[r],e.delete(r))},h=t;if(h||(h="then"),"then"===h){var d=function(){a(p)};"function"==typeof(u=u.then((function(t){a(f.bind(this,t))}),d)).finally&&u.finally(d)}else if("done"===h){if("function"!=typeof u.done)throw new Error("Memoizee error: Retrieved promise does not implement 'done' in 'done' mode");u.done(f,p)}else if("done:finally"===h){if("function"!=typeof u.done)throw new Error("Memoizee error: Retrieved promise does not implement 'done' in 'done:finally' mode");if("function"!=typeof u.finally)throw new Error("Memoizee error: Retrieved promise does not implement 'finally' in 'done:finally' mode");u.done(f),u.finally(p)}})),e.on("get",(function(t,r,i){var o;if(n[t])++n[t];else{o=l[t];var u=function(){e.emit("getasync",t,r,i)};s(o)?"function"==typeof o.done?o.done(u):o.then((function(){a(u)})):u()}})),e.on("delete",(function(t){if(delete l[t],n[t])delete n[t];else if(hasOwnProperty.call(i,t)){var r=i[t];delete i[t],e.emit("deleteasync",t,[r])}})),e.on("clear",(function(){var t=i;i=c(null),n=c(null),l=c(null),e.emit("clearasync",r(t,(function(t){return[t]})))}))}},function(t,e,n){"use strict";var r=Array.prototype.forEach,i=Object.create;t.exports=function(t){var e=i(null);return r.call(arguments,(function(t){e[t]=!0})),e}},function(t,e,n){"use strict";var r=n(48),i=n(595);t.exports=function(t){return i(r(t))}},function(t,e,n){"use strict";var r=n(222);t.exports=function(t){try{return t&&r(t.toString)?t.toString():String(t)}catch(t){throw new TypeError("Passed argument cannot be stringifed")}}},function(t,e,n){"use strict";var r=n(597),i=/[\n\r\u2028\u2029]/g;t.exports=function(t){var e=r(t);return e.length>100&&(e=e.slice(0,99)+"…"),e=e.replace(i,(function(t){return JSON.stringify(t).slice(1,-1)}))}},function(t,e,n){"use strict";var r=n(222);t.exports=function(t){try{return t&&r(t.toString)?t.toString():String(t)}catch(t){return"<Non-coercible to string value>"}}},function(t,e,n){"use strict";var r=n(31),i=n(99),o=n(40),u=Function.prototype.apply;o.dispose=function(t,e,n){var s;if(r(t),n.async&&o.async||n.promise&&o.promise)return e.on("deleteasync",s=function(e,n){u.call(t,null,n)}),void e.on("clearasync",(function(t){i(t,(function(t,e){s(e,t)}))}));e.on("delete",s=function(e,n){t(n)}),e.on("clear",(function(t){i(t,(function(t,e){s(e,t)}))}))}},function(t,e,n){"use strict";var r=n(141),i=n(99),o=n(143),u=n(223),s=n(600),a=n(40),c=Function.prototype,f=Math.max,l=Math.min,p=Object.create;a.maxAge=function(t,e,n){var h,d,y,v;(t=s(t))&&(h=p(null),d=n.async&&a.async||n.promise&&a.promise?"async":"",e.on("set"+d,(function(n){h[n]=setTimeout((function(){e.delete(n)}),t),"function"==typeof h[n].unref&&h[n].unref(),v&&(v[n]&&"nextTick"!==v[n]&&clearTimeout(v[n]),v[n]=setTimeout((function(){delete v[n]}),y),"function"==typeof v[n].unref&&v[n].unref())})),e.on("delete"+d,(function(t){clearTimeout(h[t]),delete h[t],v&&("nextTick"!==v[t]&&clearTimeout(v[t]),delete v[t])})),n.preFetch&&(y=!0===n.preFetch||isNaN(n.preFetch)?.333:f(l(Number(n.preFetch),1),0))&&(v={},y=(1-y)*t,e.on("get"+d,(function(t,i,s){v[t]||(v[t]="nextTick",o((function(){var o;"nextTick"===v[t]&&(delete v[t],e.delete(t),n.async&&(i=r(i)).push(c),o=e.memoized.apply(s,i),n.promise&&u(o)&&("function"==typeof o.done?o.done(c,c):o.then(c,c)))})))}))),e.on("clear"+d,(function(){i(h,(function(t){clearTimeout(t)})),h={},v&&(i(v,(function(t){"nextTick"!==t&&clearTimeout(t)})),v={})})))}},function(t,e,n){"use strict";var r=n(39),i=n(601);t.exports=function(t){if((t=r(t))>i)throw new TypeError(t+" exceeds maximum possible timeout");return t}},function(t,e,n){"use strict";t.exports=2147483647},function(t,e,n){"use strict";var r=n(39),i=n(603),o=n(40);o.max=function(t,e,n){var u,s,a;(t=r(t))&&(s=i(t),u=n.async&&o.async||n.promise&&o.promise?"async":"",e.on("set"+u,a=function(t){void 0!==(t=s.hit(t))&&e.delete(t)}),e.on("get"+u,a),e.on("delete"+u,s.delete),e.on("clear"+u,s.clear))}},function(t,e,n){"use strict";var r=n(39),i=Object.create,o=Object.prototype.hasOwnProperty;t.exports=function(t){var e,n=0,u=1,s=i(null),a=i(null),c=0;return t=r(t),{hit:function(r){var i=a[r],f=++c;if(s[f]=r,a[r]=f,!i){if(++n<=t)return;return r=s[u],e(r),r}if(delete s[i],u===i)for(;!o.call(s,++u);)continue},delete:e=function(t){var e=a[t];if(e&&(delete s[e],delete a[t],--n,u===e)){if(!n)return c=0,void(u=1);for(;!o.call(s,++u);)continue}},clear:function(){n=0,u=1,s=i(null),a=i(null),c=0}}}},function(t,e,n){"use strict";var r=n(41),i=n(40),o=Object.create,u=Object.defineProperties;i.refCounter=function(t,e,n){var s,a;s=o(null),a=n.async&&i.async||n.promise&&i.promise?"async":"",e.on("set"+a,(function(t,e){s[t]=e||1})),e.on("get"+a,(function(t){++s[t]})),e.on("delete"+a,(function(t){delete s[t]})),e.on("clear"+a,(function(){s={}})),u(e.memoized,{deleteRef:r((function(){var t=e.get(arguments);return null===t?null:s[t]?!--s[t]&&(e.delete(t),!0):null})),getRefCount:r((function(){var t=e.get(arguments);return null===t?0:s[t]?s[t]:0}))})}},function(t,e,n){var r=n(17),i=n(49),o=n(18).Buffer,u=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function a(){this.init(),this._w=s,i.call(this,64,56)}function c(t){return t<<30|t>>>2}function f(t,e,n,r){return 0===t?e&n|~e&r:2===t?e&n|e&r|n&r:e^n^r}r(a,i),a.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},a.prototype._update=function(t){for(var e,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,l=0;l<16;++l)n[l]=t.readInt32BE(4*l);for(;l<80;++l)n[l]=n[l-3]^n[l-8]^n[l-14]^n[l-16];for(var p=0;p<80;++p){var h=~~(p/20),d=0|((e=r)<<5|e>>>27)+f(h,i,o,s)+a+n[p]+u[h];a=s,s=o,o=c(i),i=r,r=d}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0},a.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=a},function(t,e,n){var r=n(17),i=n(49),o=n(18).Buffer,u=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function a(){this.init(),this._w=s,i.call(this,64,56)}function c(t){return t<<5|t>>>27}function f(t){return t<<30|t>>>2}function l(t,e,n,r){return 0===t?e&n|~e&r:2===t?e&n|e&r|n&r:e^n^r}r(a,i),a.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},a.prototype._update=function(t){for(var e,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,p=0;p<16;++p)n[p]=t.readInt32BE(4*p);for(;p<80;++p)n[p]=(e=n[p-3]^n[p-8]^n[p-14]^n[p-16])<<1|e>>>31;for(var h=0;h<80;++h){var d=~~(h/20),y=c(r)+l(d,i,o,s)+a+n[h]+u[d]|0;a=s,s=o,o=f(i),i=r,r=y}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0},a.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=a},function(t,e,n){var r=n(17),i=n(224),o=n(49),u=n(18).Buffer,s=new Array(64);function a(){this.init(),this._w=s,o.call(this,64,56)}r(a,i),a.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},a.prototype._hash=function(){var t=u.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},t.exports=a},function(t,e,n){var r=n(17),i=n(225),o=n(49),u=n(18).Buffer,s=new Array(160);function a(){this.init(),this._w=s,o.call(this,128,112)}r(a,i),a.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},a.prototype._hash=function(){var t=u.allocUnsafe(48);function e(e,n,r){t.writeInt32BE(e,r),t.writeInt32BE(n,r+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},t.exports=a},function(t,e,n){"use strict";var r=n(610),i=n(629);function o(t){return function(){throw new Error("Function "+t+" is deprecated and cannot be used.")}}t.exports.Type=n(8),t.exports.Schema=n(51),t.exports.FAILSAFE_SCHEMA=n(144),t.exports.JSON_SCHEMA=n(227),t.exports.CORE_SCHEMA=n(226),t.exports.DEFAULT_SAFE_SCHEMA=n(72),t.exports.DEFAULT_FULL_SCHEMA=n(101),t.exports.load=r.load,t.exports.loadAll=r.loadAll,t.exports.safeLoad=r.safeLoad,t.exports.safeLoadAll=r.safeLoadAll,t.exports.dump=i.dump,t.exports.safeDump=i.safeDump,t.exports.YAMLException=n(71),t.exports.MINIMAL_SCHEMA=n(144),t.exports.SAFE_SCHEMA=n(72),t.exports.DEFAULT_SCHEMA=n(101),t.exports.scan=o("scan"),t.exports.parse=o("parse"),t.exports.compose=o("compose"),t.exports.addConstructor=o("addConstructor")},function(t,e,n){"use strict";var r=n(50),i=n(71),o=n(611),u=n(72),s=n(101),a=Object.prototype.hasOwnProperty,c=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,f=/[\x85\u2028\u2029]/,l=/[,\[\]\{\}]/,p=/^(?:!|!!|![a-z\-]+!)$/i,h=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function d(t){return Object.prototype.toString.call(t)}function y(t){return 10===t||13===t}function v(t){return 9===t||32===t}function g(t){return 9===t||32===t||10===t||13===t}function w(t){return 44===t||91===t||93===t||123===t||125===t}function M(t){var e;return 48<=t&&t<=57?t-48:97<=(e=32|t)&&e<=102?e-97+10:-1}function _(t){return 48===t?"\0":97===t?"":98===t?"\b":116===t||9===t?"\t":110===t?"\n":118===t?"\v":102===t?"\f":114===t?"\r":101===t?"":32===t?" ":34===t?'"':47===t?"/":92===t?"\\":78===t?"
":95===t?" ":76===t?"\u2028":80===t?"\u2029":""}function m(t){return t<=65535?String.fromCharCode(t):String.fromCharCode(55296+(t-65536>>10),56320+(t-65536&1023))}for(var L=new Array(256),x=new Array(256),b=0;b<256;b++)L[b]=_(b)?1:0,x[b]=_(b);function j(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||s,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function N(t,e){return new i(e,new o(t.filename,t.input,t.position,t.line,t.position-t.lineStart))}function S(t,e){throw N(t,e)}function D(t,e){t.onWarning&&t.onWarning.call(null,N(t,e))}var I={YAML:function(t,e,n){var r,i,o;null!==t.version&&S(t,"duplication of %YAML directive"),1!==n.length&&S(t,"YAML directive accepts exactly one argument"),null===(r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&S(t,"ill-formed argument of the YAML directive"),i=parseInt(r[1],10),o=parseInt(r[2],10),1!==i&&S(t,"unacceptable YAML version of the document"),t.version=n[0],t.checkLineBreaks=o<2,1!==o&&2!==o&&D(t,"unsupported YAML version of the document")},TAG:function(t,e,n){var r,i;2!==n.length&&S(t,"TAG directive accepts exactly two arguments"),r=n[0],i=n[1],p.test(r)||S(t,"ill-formed tag handle (first argument) of the TAG directive"),a.call(t.tagMap,r)&&S(t,'there is a previously declared suffix for "'+r+'" tag handle'),h.test(i)||S(t,"ill-formed tag prefix (second argument) of the TAG directive"),t.tagMap[r]=i}};function A(t,e,n,r){var i,o,u,s;if(e<n){if(s=t.input.slice(e,n),r)for(i=0,o=s.length;i<o;i+=1)9===(u=s.charCodeAt(i))||32<=u&&u<=1114111||S(t,"expected valid JSON character");else c.test(s)&&S(t,"the stream contains non-printable characters");t.result+=s}}function O(t,e,n,i){var o,u,s,c;for(r.isObject(n)||S(t,"cannot merge mappings; the provided source object is unacceptable"),s=0,c=(o=Object.keys(n)).length;s<c;s+=1)u=o[s],a.call(e,u)||(e[u]=n[u],i[u]=!0)}function E(t,e,n,r,i,o,u,s){var c,f;if(Array.isArray(i))for(c=0,f=(i=Array.prototype.slice.call(i)).length;c<f;c+=1)Array.isArray(i[c])&&S(t,"nested arrays are not supported inside keys"),"object"==typeof i&&"[object Object]"===d(i[c])&&(i[c]="[object Object]");if("object"==typeof i&&"[object Object]"===d(i)&&(i="[object Object]"),i=String(i),null===e&&(e={}),"tag:yaml.org,2002:merge"===r)if(Array.isArray(o))for(c=0,f=o.length;c<f;c+=1)O(t,e,o[c],n);else O(t,e,o,n);else t.json||a.call(n,i)||!a.call(e,i)||(t.line=u||t.line,t.position=s||t.position,S(t,"duplicated mapping key")),e[i]=o,delete n[i];return e}function C(t){var e;10===(e=t.input.charCodeAt(t.position))?t.position++:13===e?(t.position++,10===t.input.charCodeAt(t.position)&&t.position++):S(t,"a line break is expected"),t.line+=1,t.lineStart=t.position}function T(t,e,n){for(var r=0,i=t.input.charCodeAt(t.position);0!==i;){for(;v(i);)i=t.input.charCodeAt(++t.position);if(e&&35===i)do{i=t.input.charCodeAt(++t.position)}while(10!==i&&13!==i&&0!==i);if(!y(i))break;for(C(t),i=t.input.charCodeAt(t.position),r++,t.lineIndent=0;32===i;)t.lineIndent++,i=t.input.charCodeAt(++t.position)}return-1!==n&&0!==r&&t.lineIndent<n&&D(t,"deficient indentation"),r}function z(t){var e,n=t.position;return!(45!==(e=t.input.charCodeAt(n))&&46!==e||e!==t.input.charCodeAt(n+1)||e!==t.input.charCodeAt(n+2)||(n+=3,0!==(e=t.input.charCodeAt(n))&&!g(e)))}function k(t,e){1===e?t.result+=" ":e>1&&(t.result+=r.repeat("\n",e-1))}function U(t,e){var n,r,i=t.tag,o=t.anchor,u=[],s=!1;for(null!==t.anchor&&(t.anchorMap[t.anchor]=u),r=t.input.charCodeAt(t.position);0!==r&&45===r&&g(t.input.charCodeAt(t.position+1));)if(s=!0,t.position++,T(t,!0,-1)&&t.lineIndent<=e)u.push(null),r=t.input.charCodeAt(t.position);else if(n=t.line,R(t,e,3,!1,!0),u.push(t.result),T(t,!0,-1),r=t.input.charCodeAt(t.position),(t.line===n||t.lineIndent>e)&&0!==r)S(t,"bad indentation of a sequence entry");else if(t.lineIndent<e)break;return!!s&&(t.tag=i,t.anchor=o,t.kind="sequence",t.result=u,!0)}function Y(t){var e,n,r,i,o=!1,u=!1;if(33!==(i=t.input.charCodeAt(t.position)))return!1;if(null!==t.tag&&S(t,"duplication of a tag property"),60===(i=t.input.charCodeAt(++t.position))?(o=!0,i=t.input.charCodeAt(++t.position)):33===i?(u=!0,n="!!",i=t.input.charCodeAt(++t.position)):n="!",e=t.position,o){do{i=t.input.charCodeAt(++t.position)}while(0!==i&&62!==i);t.position<t.length?(r=t.input.slice(e,t.position),i=t.input.charCodeAt(++t.position)):S(t,"unexpected end of the stream within a verbatim tag")}else{for(;0!==i&&!g(i);)33===i&&(u?S(t,"tag suffix cannot contain exclamation marks"):(n=t.input.slice(e-1,t.position+1),p.test(n)||S(t,"named tag handle cannot contain such characters"),u=!0,e=t.position+1)),i=t.input.charCodeAt(++t.position);r=t.input.slice(e,t.position),l.test(r)&&S(t,"tag suffix cannot contain flow indicator characters")}return r&&!h.test(r)&&S(t,"tag name cannot contain such characters: "+r),o?t.tag=r:a.call(t.tagMap,n)?t.tag=t.tagMap[n]+r:"!"===n?t.tag="!"+r:"!!"===n?t.tag="tag:yaml.org,2002:"+r:S(t,'undeclared tag handle "'+n+'"'),!0}function P(t){var e,n;if(38!==(n=t.input.charCodeAt(t.position)))return!1;for(null!==t.anchor&&S(t,"duplication of an anchor property"),n=t.input.charCodeAt(++t.position),e=t.position;0!==n&&!g(n)&&!w(n);)n=t.input.charCodeAt(++t.position);return t.position===e&&S(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(e,t.position),!0}function R(t,e,n,i,o){var u,s,c,f,l,p,h,d,_=1,b=!1,j=!1;if(null!==t.listener&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null,u=s=c=4===n||3===n,i&&T(t,!0,-1)&&(b=!0,t.lineIndent>e?_=1:t.lineIndent===e?_=0:t.lineIndent<e&&(_=-1)),1===_)for(;Y(t)||P(t);)T(t,!0,-1)?(b=!0,c=u,t.lineIndent>e?_=1:t.lineIndent===e?_=0:t.lineIndent<e&&(_=-1)):c=!1;if(c&&(c=b||o),1!==_&&4!==n||(h=1===n||2===n?e:e+1,d=t.position-t.lineStart,1===_?c&&(U(t,d)||function(t,e,n){var r,i,o,u,s,a=t.tag,c=t.anchor,f={},l={},p=null,h=null,d=null,y=!1,w=!1;for(null!==t.anchor&&(t.anchorMap[t.anchor]=f),s=t.input.charCodeAt(t.position);0!==s;){if(r=t.input.charCodeAt(t.position+1),o=t.line,u=t.position,63!==s&&58!==s||!g(r)){if(!R(t,n,2,!1,!0))break;if(t.line===o){for(s=t.input.charCodeAt(t.position);v(s);)s=t.input.charCodeAt(++t.position);if(58===s)g(s=t.input.charCodeAt(++t.position))||S(t,"a whitespace character is expected after the key-value separator within a block mapping"),y&&(E(t,f,l,p,h,null),p=h=d=null),w=!0,y=!1,i=!1,p=t.tag,h=t.result;else{if(!w)return t.tag=a,t.anchor=c,!0;S(t,"can not read an implicit mapping pair; a colon is missed")}}else{if(!w)return t.tag=a,t.anchor=c,!0;S(t,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===s?(y&&(E(t,f,l,p,h,null),p=h=d=null),w=!0,y=!0,i=!0):y?(y=!1,i=!0):S(t,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),t.position+=1,s=r;if((t.line===o||t.lineIndent>e)&&(R(t,e,4,!0,i)&&(y?h=t.result:d=t.result),y||(E(t,f,l,p,h,d,o,u),p=h=d=null),T(t,!0,-1),s=t.input.charCodeAt(t.position)),t.lineIndent>e&&0!==s)S(t,"bad indentation of a mapping entry");else if(t.lineIndent<e)break}return y&&E(t,f,l,p,h,null),w&&(t.tag=a,t.anchor=c,t.kind="mapping",t.result=f),w}(t,d,h))||function(t,e){var n,r,i,o,u,s,a,c,f,l,p=!0,h=t.tag,d=t.anchor,y={};if(91===(l=t.input.charCodeAt(t.position)))i=93,s=!1,r=[];else{if(123!==l)return!1;i=125,s=!0,r={}}for(null!==t.anchor&&(t.anchorMap[t.anchor]=r),l=t.input.charCodeAt(++t.position);0!==l;){if(T(t,!0,e),(l=t.input.charCodeAt(t.position))===i)return t.position++,t.tag=h,t.anchor=d,t.kind=s?"mapping":"sequence",t.result=r,!0;p||S(t,"missed comma between flow collection entries"),f=null,o=u=!1,63===l&&g(t.input.charCodeAt(t.position+1))&&(o=u=!0,t.position++,T(t,!0,e)),n=t.line,R(t,e,1,!1,!0),c=t.tag,a=t.result,T(t,!0,e),l=t.input.charCodeAt(t.position),!u&&t.line!==n||58!==l||(o=!0,l=t.input.charCodeAt(++t.position),T(t,!0,e),R(t,e,1,!1,!0),f=t.result),s?E(t,r,y,c,a,f):o?r.push(E(t,null,y,c,a,f)):r.push(a),T(t,!0,e),44===(l=t.input.charCodeAt(t.position))?(p=!0,l=t.input.charCodeAt(++t.position)):p=!1}S(t,"unexpected end of the stream within a flow collection")}(t,h)?j=!0:(s&&function(t,e){var n,i,o,u,s,a=1,c=!1,f=!1,l=e,p=0,h=!1;if(124===(u=t.input.charCodeAt(t.position)))i=!1;else{if(62!==u)return!1;i=!0}for(t.kind="scalar",t.result="";0!==u;)if(43===(u=t.input.charCodeAt(++t.position))||45===u)1===a?a=43===u?3:2:S(t,"repeat of a chomping mode identifier");else{if(!((o=48<=(s=u)&&s<=57?s-48:-1)>=0))break;0===o?S(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):f?S(t,"repeat of an indentation width identifier"):(l=e+o-1,f=!0)}if(v(u)){do{u=t.input.charCodeAt(++t.position)}while(v(u));if(35===u)do{u=t.input.charCodeAt(++t.position)}while(!y(u)&&0!==u)}for(;0!==u;){for(C(t),t.lineIndent=0,u=t.input.charCodeAt(t.position);(!f||t.lineIndent<l)&&32===u;)t.lineIndent++,u=t.input.charCodeAt(++t.position);if(!f&&t.lineIndent>l&&(l=t.lineIndent),y(u))p++;else{if(t.lineIndent<l){3===a?t.result+=r.repeat("\n",c?1+p:p):1===a&&c&&(t.result+="\n");break}for(i?v(u)?(h=!0,t.result+=r.repeat("\n",c?1+p:p)):h?(h=!1,t.result+=r.repeat("\n",p+1)):0===p?c&&(t.result+=" "):t.result+=r.repeat("\n",p):t.result+=r.repeat("\n",c?1+p:p),c=!0,f=!0,p=0,n=t.position;!y(u)&&0!==u;)u=t.input.charCodeAt(++t.position);A(t,n,t.position,!1)}}return!0}(t,h)||function(t,e){var n,r,i;if(39!==(n=t.input.charCodeAt(t.position)))return!1;for(t.kind="scalar",t.result="",t.position++,r=i=t.position;0!==(n=t.input.charCodeAt(t.position));)if(39===n){if(A(t,r,t.position,!0),39!==(n=t.input.charCodeAt(++t.position)))return!0;r=t.position,t.position++,i=t.position}else y(n)?(A(t,r,i,!0),k(t,T(t,!1,e)),r=i=t.position):t.position===t.lineStart&&z(t)?S(t,"unexpected end of the document within a single quoted scalar"):(t.position++,i=t.position);S(t,"unexpected end of the stream within a single quoted scalar")}(t,h)||function(t,e){var n,r,i,o,u,s,a;if(34!==(s=t.input.charCodeAt(t.position)))return!1;for(t.kind="scalar",t.result="",t.position++,n=r=t.position;0!==(s=t.input.charCodeAt(t.position));){if(34===s)return A(t,n,t.position,!0),t.position++,!0;if(92===s){if(A(t,n,t.position,!0),y(s=t.input.charCodeAt(++t.position)))T(t,!1,e);else if(s<256&&L[s])t.result+=x[s],t.position++;else if((u=120===(a=s)?2:117===a?4:85===a?8:0)>0){for(i=u,o=0;i>0;i--)(u=M(s=t.input.charCodeAt(++t.position)))>=0?o=(o<<4)+u:S(t,"expected hexadecimal character");t.result+=m(o),t.position++}else S(t,"unknown escape sequence");n=r=t.position}else y(s)?(A(t,n,r,!0),k(t,T(t,!1,e)),n=r=t.position):t.position===t.lineStart&&z(t)?S(t,"unexpected end of the document within a double quoted scalar"):(t.position++,r=t.position)}S(t,"unexpected end of the stream within a double quoted scalar")}(t,h)?j=!0:!function(t){var e,n,r;if(42!==(r=t.input.charCodeAt(t.position)))return!1;for(r=t.input.charCodeAt(++t.position),e=t.position;0!==r&&!g(r)&&!w(r);)r=t.input.charCodeAt(++t.position);return t.position===e&&S(t,"name of an alias node must contain at least one character"),n=t.input.slice(e,t.position),t.anchorMap.hasOwnProperty(n)||S(t,'unidentified alias "'+n+'"'),t.result=t.anchorMap[n],T(t,!0,-1),!0}(t)?function(t,e,n){var r,i,o,u,s,a,c,f,l=t.kind,p=t.result;if(g(f=t.input.charCodeAt(t.position))||w(f)||35===f||38===f||42===f||33===f||124===f||62===f||39===f||34===f||37===f||64===f||96===f)return!1;if((63===f||45===f)&&(g(r=t.input.charCodeAt(t.position+1))||n&&w(r)))return!1;for(t.kind="scalar",t.result="",i=o=t.position,u=!1;0!==f;){if(58===f){if(g(r=t.input.charCodeAt(t.position+1))||n&&w(r))break}else if(35===f){if(g(t.input.charCodeAt(t.position-1)))break}else{if(t.position===t.lineStart&&z(t)||n&&w(f))break;if(y(f)){if(s=t.line,a=t.lineStart,c=t.lineIndent,T(t,!1,-1),t.lineIndent>=e){u=!0,f=t.input.charCodeAt(t.position);continue}t.position=o,t.line=s,t.lineStart=a,t.lineIndent=c;break}}u&&(A(t,i,o,!1),k(t,t.line-s),i=o=t.position,u=!1),v(f)||(o=t.position+1),f=t.input.charCodeAt(++t.position)}return A(t,i,o,!1),!!t.result||(t.kind=l,t.result=p,!1)}(t,h,1===n)&&(j=!0,null===t.tag&&(t.tag="?")):(j=!0,null===t.tag&&null===t.anchor||S(t,"alias node should not have any properties")),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):0===_&&(j=c&&U(t,d))),null!==t.tag&&"!"!==t.tag)if("?"===t.tag){for(f=0,l=t.implicitTypes.length;f<l;f+=1)if((p=t.implicitTypes[f]).resolve(t.result)){t.result=p.construct(t.result),t.tag=p.tag,null!==t.anchor&&(t.anchorMap[t.anchor]=t.result);break}}else a.call(t.typeMap[t.kind||"fallback"],t.tag)?(p=t.typeMap[t.kind||"fallback"][t.tag],null!==t.result&&p.kind!==t.kind&&S(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+p.kind+'", not "'+t.kind+'"'),p.resolve(t.result)?(t.result=p.construct(t.result),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):S(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")):S(t,"unknown tag !<"+t.tag+">");return null!==t.listener&&t.listener("close",t),null!==t.tag||null!==t.anchor||j}function Q(t){var e,n,r,i,o=t.position,u=!1;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap={},t.anchorMap={};0!==(i=t.input.charCodeAt(t.position))&&(T(t,!0,-1),i=t.input.charCodeAt(t.position),!(t.lineIndent>0||37!==i));){for(u=!0,i=t.input.charCodeAt(++t.position),e=t.position;0!==i&&!g(i);)i=t.input.charCodeAt(++t.position);for(r=[],(n=t.input.slice(e,t.position)).length<1&&S(t,"directive name must not be less than one character in length");0!==i;){for(;v(i);)i=t.input.charCodeAt(++t.position);if(35===i){do{i=t.input.charCodeAt(++t.position)}while(0!==i&&!y(i));break}if(y(i))break;for(e=t.position;0!==i&&!g(i);)i=t.input.charCodeAt(++t.position);r.push(t.input.slice(e,t.position))}0!==i&&C(t),a.call(I,n)?I[n](t,n,r):D(t,'unknown document directive "'+n+'"')}T(t,!0,-1),0===t.lineIndent&&45===t.input.charCodeAt(t.position)&&45===t.input.charCodeAt(t.position+1)&&45===t.input.charCodeAt(t.position+2)?(t.position+=3,T(t,!0,-1)):u&&S(t,"directives end mark is expected"),R(t,t.lineIndent-1,4,!1,!0),T(t,!0,-1),t.checkLineBreaks&&f.test(t.input.slice(o,t.position))&&D(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&z(t)?46===t.input.charCodeAt(t.position)&&(t.position+=3,T(t,!0,-1)):t.position<t.length-1&&S(t,"end of the stream or a document separator is expected")}function F(t,e){e=e||{},0!==(t=String(t)).length&&(10!==t.charCodeAt(t.length-1)&&13!==t.charCodeAt(t.length-1)&&(t+="\n"),65279===t.charCodeAt(0)&&(t=t.slice(1)));var n=new j(t,e);for(n.input+="\0";32===n.input.charCodeAt(n.position);)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)Q(n);return n.documents}function B(t,e,n){var r,i,o=F(t,n);if("function"!=typeof e)return o;for(r=0,i=o.length;r<i;r+=1)e(o[r])}function G(t,e){var n=F(t,e);if(0!==n.length){if(1===n.length)return n[0];throw new i("expected a single document in the stream, but found more")}}t.exports.loadAll=B,t.exports.load=G,t.exports.safeLoadAll=function(t,e,n){if("function"!=typeof e)return B(t,r.extend({schema:u},n));B(t,e,r.extend({schema:u},n))},t.exports.safeLoad=function(t,e){return G(t,r.extend({schema:u},e))}},function(t,e,n){"use strict";var r=n(50);function i(t,e,n,r,i){this.name=t,this.buffer=e,this.position=n,this.line=r,this.column=i}i.prototype.getSnippet=function(t,e){var n,i,o,u,s;if(!this.buffer)return null;for(t=t||4,e=e||75,n="",i=this.position;i>0&&-1==="\0\r\n
\u2028\u2029".indexOf(this.buffer.charAt(i-1));)if(i-=1,this.position-i>e/2-1){n=" ... ",i+=5;break}for(o="",u=this.position;u<this.buffer.length&&-1==="\0\r\n
\u2028\u2029".indexOf(this.buffer.charAt(u));)if((u+=1)-this.position>e/2-1){o=" ... ",u-=5;break}return s=this.buffer.slice(i,u),r.repeat(" ",t)+n+s+o+"\n"+r.repeat(" ",t+this.position-i+n.length)+"^"},i.prototype.toString=function(t){var e,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),t||(e=this.getSnippet())&&(n+=":\n"+e),n},t.exports=i},function(t,e,n){"use strict";var r=n(8);t.exports=new r("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return null!==t?t:""}})},function(t,e,n){"use strict";var r=n(8);t.exports=new r("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return null!==t?t:[]}})},function(t,e,n){"use strict";var r=n(8);t.exports=new r("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return null!==t?t:{}}})},function(t,e,n){"use strict";var r=n(8);t.exports=new r("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(t){if(null===t)return!0;var e=t.length;return 1===e&&"~"===t||4===e&&("null"===t||"Null"===t||"NULL"===t)},construct:function(){return null},predicate:function(t){return null===t},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})},function(t,e,n){"use strict";var r=n(8);t.exports=new r("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e=t.length;return 4===e&&("true"===t||"True"===t||"TRUE"===t)||5===e&&("false"===t||"False"===t||"FALSE"===t)},construct:function(t){return"true"===t||"True"===t||"TRUE"===t},predicate:function(t){return"[object Boolean]"===Object.prototype.toString.call(t)},represent:{lowercase:function(t){return t?"true":"false"},uppercase:function(t){return t?"TRUE":"FALSE"},camelcase:function(t){return t?"True":"False"}},defaultStyle:"lowercase"})},function(t,e,n){"use strict";var r=n(50),i=n(8);function o(t){return 48<=t&&t<=55}function u(t){return 48<=t&&t<=57}t.exports=new i("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e,n,r=t.length,i=0,s=!1;if(!r)return!1;if("-"!==(e=t[i])&&"+"!==e||(e=t[++i]),"0"===e){if(i+1===r)return!0;if("b"===(e=t[++i])){for(i++;i<r;i++)if("_"!==(e=t[i])){if("0"!==e&&"1"!==e)return!1;s=!0}return s&&"_"!==e}if("x"===e){for(i++;i<r;i++)if("_"!==(e=t[i])){if(!(48<=(n=t.charCodeAt(i))&&n<=57||65<=n&&n<=70||97<=n&&n<=102))return!1;s=!0}return s&&"_"!==e}for(;i<r;i++)if("_"!==(e=t[i])){if(!o(t.charCodeAt(i)))return!1;s=!0}return s&&"_"!==e}if("_"===e)return!1;for(;i<r;i++)if("_"!==(e=t[i])){if(":"===e)break;if(!u(t.charCodeAt(i)))return!1;s=!0}return!(!s||"_"===e)&&(":"!==e||/^(:[0-5]?[0-9])+$/.test(t.slice(i)))},construct:function(t){var e,n,r=t,i=1,o=[];return-1!==r.indexOf("_")&&(r=r.replace(/_/g,"")),"-"!==(e=r[0])&&"+"!==e||("-"===e&&(i=-1),e=(r=r.slice(1))[0]),"0"===r?0:"0"===e?"b"===r[1]?i*parseInt(r.slice(2),2):"x"===r[1]?i*parseInt(r,16):i*parseInt(r,8):-1!==r.indexOf(":")?(r.split(":").forEach((function(t){o.unshift(parseInt(t,10))})),r=0,n=1,o.forEach((function(t){r+=t*n,n*=60})),i*r):i*parseInt(r,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&t%1==0&&!r.isNegativeZero(t)},represent:{binary:function(t){return t>=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0"+t.toString(8):"-0"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})},function(t,e,n){"use strict";var r=n(50),i=n(8),o=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var u=/^[-+]?[0-9]+e/;t.exports=new i("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(t){return null!==t&&!(!o.test(t)||"_"===t[t.length-1])},construct:function(t){var e,n,r,i;return n="-"===(e=t.replace(/_/g,"").toLowerCase())[0]?-1:1,i=[],"+-".indexOf(e[0])>=0&&(e=e.slice(1)),".inf"===e?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===e?NaN:e.indexOf(":")>=0?(e.split(":").forEach((function(t){i.unshift(parseFloat(t,10))})),e=0,r=1,i.forEach((function(t){e+=t*r,r*=60})),n*e):n*parseFloat(e,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&(t%1!=0||r.isNegativeZero(t))},represent:function(t,e){var n;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(r.isNegativeZero(t))return"-0.0";return n=t.toString(10),u.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"})},function(t,e,n){"use strict";var r=n(8),i=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),o=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");t.exports=new r("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(t){return null!==t&&(null!==i.exec(t)||null!==o.exec(t))},construct:function(t){var e,n,r,u,s,a,c,f,l=0,p=null;if(null===(e=i.exec(t))&&(e=o.exec(t)),null===e)throw new Error("Date resolve error");if(n=+e[1],r=+e[2]-1,u=+e[3],!e[4])return new Date(Date.UTC(n,r,u));if(s=+e[4],a=+e[5],c=+e[6],e[7]){for(l=e[7].slice(0,3);l.length<3;)l+="0";l=+l}return e[9]&&(p=6e4*(60*+e[10]+ +(e[11]||0)),"-"===e[9]&&(p=-p)),f=new Date(Date.UTC(n,r,u,s,a,c,l)),p&&f.setTime(f.getTime()-p),f},instanceOf:Date,represent:function(t){return t.toISOString()}})},function(t,e,n){"use strict";var r=n(8);t.exports=new r("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(t){return"<<"===t||null===t}})},function(t,e,n){"use strict";var r;try{r=n(89).Buffer}catch(t){}var i=n(8),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";t.exports=new i("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e,n,r=0,i=t.length,u=o;for(n=0;n<i;n++)if(!((e=u.indexOf(t.charAt(n)))>64)){if(e<0)return!1;r+=6}return r%8==0},construct:function(t){var e,n,i=t.replace(/[\r\n=]/g,""),u=i.length,s=o,a=0,c=[];for(e=0;e<u;e++)e%4==0&&e&&(c.push(a>>16&255),c.push(a>>8&255),c.push(255&a)),a=a<<6|s.indexOf(i.charAt(e));return 0===(n=u%4*6)?(c.push(a>>16&255),c.push(a>>8&255),c.push(255&a)):18===n?(c.push(a>>10&255),c.push(a>>2&255)):12===n&&c.push(a>>4&255),r?r.from?r.from(c):new r(c):c},predicate:function(t){return r&&r.isBuffer(t)},represent:function(t){var e,n,r="",i=0,u=t.length,s=o;for(e=0;e<u;e++)e%3==0&&e&&(r+=s[i>>18&63],r+=s[i>>12&63],r+=s[i>>6&63],r+=s[63&i]),i=(i<<8)+t[e];return 0===(n=u%3)?(r+=s[i>>18&63],r+=s[i>>12&63],r+=s[i>>6&63],r+=s[63&i]):2===n?(r+=s[i>>10&63],r+=s[i>>4&63],r+=s[i<<2&63],r+=s[64]):1===n&&(r+=s[i>>2&63],r+=s[i<<4&63],r+=s[64],r+=s[64]),r}})},function(t,e,n){"use strict";var r=n(8),i=Object.prototype.hasOwnProperty,o=Object.prototype.toString;t.exports=new r("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(t){if(null===t)return!0;var e,n,r,u,s,a=[],c=t;for(e=0,n=c.length;e<n;e+=1){if(r=c[e],s=!1,"[object Object]"!==o.call(r))return!1;for(u in r)if(i.call(r,u)){if(s)return!1;s=!0}if(!s)return!1;if(-1!==a.indexOf(u))return!1;a.push(u)}return!0},construct:function(t){return null!==t?t:[]}})},function(t,e,n){"use strict";var r=n(8),i=Object.prototype.toString;t.exports=new r("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(t){if(null===t)return!0;var e,n,r,o,u,s=t;for(u=new Array(s.length),e=0,n=s.length;e<n;e+=1){if(r=s[e],"[object Object]"!==i.call(r))return!1;if(1!==(o=Object.keys(r)).length)return!1;u[e]=[o[0],r[o[0]]]}return!0},construct:function(t){if(null===t)return[];var e,n,r,i,o,u=t;for(o=new Array(u.length),e=0,n=u.length;e<n;e+=1)r=u[e],i=Object.keys(r),o[e]=[i[0],r[i[0]]];return o}})},function(t,e,n){"use strict";var r=n(8),i=Object.prototype.hasOwnProperty;t.exports=new r("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(t){if(null===t)return!0;var e,n=t;for(e in n)if(i.call(n,e)&&null!==n[e])return!1;return!0},construct:function(t){return null!==t?t:{}}})},function(t,e,n){"use strict";var r=n(8);t.exports=new r("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:function(){return!0},construct:function(){},predicate:function(t){return void 0===t},represent:function(){return""}})},function(t,e,n){"use strict";var r=n(8);t.exports=new r("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:function(t){if(null===t)return!1;if(0===t.length)return!1;var e=t,n=/\/([gim]*)$/.exec(t),r="";if("/"===e[0]){if(n&&(r=n[1]),r.length>3)return!1;if("/"!==e[e.length-r.length-1])return!1}return!0},construct:function(t){var e=t,n=/\/([gim]*)$/.exec(t),r="";return"/"===e[0]&&(n&&(r=n[1]),e=e.slice(1,e.length-r.length-1)),new RegExp(e,r)},predicate:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},represent:function(t){var e="/"+t.source+"/";return t.global&&(e+="g"),t.multiline&&(e+="m"),t.ignoreCase&&(e+="i"),e}})},function(t,e,n){"use strict";var r;try{r=n(628)}catch(t){"undefined"!=typeof window&&(r=window.esprima)}var i=n(8);t.exports=new i("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(t){if(null===t)return!1;try{var e="("+t+")",n=r.parse(e,{range:!0});return"Program"===n.type&&1===n.body.length&&"ExpressionStatement"===n.body[0].type&&("ArrowFunctionExpression"===n.body[0].expression.type||"FunctionExpression"===n.body[0].expression.type)}catch(t){return!1}},construct:function(t){var e,n="("+t+")",i=r.parse(n,{range:!0}),o=[];if("Program"!==i.type||1!==i.body.length||"ExpressionStatement"!==i.body[0].type||"ArrowFunctionExpression"!==i.body[0].expression.type&&"FunctionExpression"!==i.body[0].expression.type)throw new Error("Failed to resolve function");return i.body[0].expression.params.forEach((function(t){o.push(t.name)})),e=i.body[0].expression.body.range,"BlockStatement"===i.body[0].expression.body.type?new Function(o,n.slice(e[0]+1,e[1]-1)):new Function(o,"return "+n.slice(e[0],e[1]))},predicate:function(t){return"[object Function]"===Object.prototype.toString.call(t)},represent:function(t){return t.toString()}})},function(e,n){if(void 0===t){var r=new Error("Cannot find module 'esprima'");throw r.code="MODULE_NOT_FOUND",r}e.exports=t},function(t,e,n){"use strict";var r=n(50),i=n(71),o=n(101),u=n(72),s=Object.prototype.toString,a=Object.prototype.hasOwnProperty,c={0:"\\0",7:"\\a",8:"\\b",9:"\\t",10:"\\n",11:"\\v",12:"\\f",13:"\\r",27:"\\e",34:'\\"',92:"\\\\",133:"\\N",160:"\\_",8232:"\\L",8233:"\\P"},f=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function l(t){var e,n,o;if(e=t.toString(16).toUpperCase(),t<=255)n="x",o=2;else if(t<=65535)n="u",o=4;else{if(!(t<=4294967295))throw new i("code point within a string may not be greater than 0xFFFFFFFF");n="U",o=8}return"\\"+n+r.repeat("0",o-e.length)+e}function p(t){this.schema=t.schema||o,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=r.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=function(t,e){var n,r,i,o,u,s,c;if(null===e)return{};for(n={},i=0,o=(r=Object.keys(e)).length;i<o;i+=1)u=r[i],s=String(e[u]),"!!"===u.slice(0,2)&&(u="tag:yaml.org,2002:"+u.slice(2)),(c=t.compiledTypeMap.fallback[u])&&a.call(c.styleAliases,s)&&(s=c.styleAliases[s]),n[u]=s;return n}(this.schema,t.styles||null),this.sortKeys=t.sortKeys||!1,this.lineWidth=t.lineWidth||80,this.noRefs=t.noRefs||!1,this.noCompatMode=t.noCompatMode||!1,this.condenseFlow=t.condenseFlow||!1,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function h(t,e){for(var n,i=r.repeat(" ",e),o=0,u=-1,s="",a=t.length;o<a;)-1===(u=t.indexOf("\n",o))?(n=t.slice(o),o=a):(n=t.slice(o,u+1),o=u+1),n.length&&"\n"!==n&&(s+=i),s+=n;return s}function d(t,e){return"\n"+r.repeat(" ",t.indent*e)}function y(t){return 32===t||9===t}function v(t){return 32<=t&&t<=126||161<=t&&t<=55295&&8232!==t&&8233!==t||57344<=t&&t<=65533&&65279!==t||65536<=t&&t<=1114111}function g(t){return v(t)&&65279!==t&&44!==t&&91!==t&&93!==t&&123!==t&&125!==t&&58!==t&&35!==t}function w(t){return/^\n* /.test(t)}function M(t,e,n,r,i){var o,u,s,a=!1,c=!1,f=-1!==r,l=-1,p=v(s=t.charCodeAt(0))&&65279!==s&&!y(s)&&45!==s&&63!==s&&58!==s&&44!==s&&91!==s&&93!==s&&123!==s&&125!==s&&35!==s&&38!==s&&42!==s&&33!==s&&124!==s&&62!==s&&39!==s&&34!==s&&37!==s&&64!==s&&96!==s&&!y(t.charCodeAt(t.length-1));if(e)for(o=0;o<t.length;o++){if(!v(u=t.charCodeAt(o)))return 5;p=p&&g(u)}else{for(o=0;o<t.length;o++){if(10===(u=t.charCodeAt(o)))a=!0,f&&(c=c||o-l-1>r&&" "!==t[l+1],l=o);else if(!v(u))return 5;p=p&&g(u)}c=c||f&&o-l-1>r&&" "!==t[l+1]}return a||c?n>9&&w(t)?5:c?4:3:p&&!i(t)?1:2}function _(t,e,n,r){t.dump=function(){if(0===e.length)return"''";if(!t.noCompatMode&&-1!==f.indexOf(e))return"'"+e+"'";var o=t.indent*Math.max(1,n),u=-1===t.lineWidth?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-o),s=r||t.flowLevel>-1&&n>=t.flowLevel;switch(M(e,s,t.indent,u,(function(e){return function(t,e){var n,r;for(n=0,r=t.implicitTypes.length;n<r;n+=1)if(t.implicitTypes[n].resolve(e))return!0;return!1}(t,e)}))){case 1:return e;case 2:return"'"+e.replace(/'/g,"''")+"'";case 3:return"|"+m(e,t.indent)+L(h(e,o));case 4:return">"+m(e,t.indent)+L(h(function(t,e){var n,r,i=/(\n+)([^\n]*)/g,o=(s=t.indexOf("\n"),s=-1!==s?s:t.length,i.lastIndex=s,x(t.slice(0,s),e)),u="\n"===t[0]||" "===t[0];var s;for(;r=i.exec(t);){var a=r[1],c=r[2];n=" "===c[0],o+=a+(u||n||""===c?"":"\n")+x(c,e),u=n}return o}(e,u),o));case 5:return'"'+function(t){for(var e,n,r,i="",o=0;o<t.length;o++)(e=t.charCodeAt(o))>=55296&&e<=56319&&(n=t.charCodeAt(o+1))>=56320&&n<=57343?(i+=l(1024*(e-55296)+n-56320+65536),o++):i+=!(r=c[e])&&v(e)?t[o]:r||l(e);return i}(e)+'"';default:throw new i("impossible error: invalid scalar style")}}()}function m(t,e){var n=w(t)?String(e):"",r="\n"===t[t.length-1];return n+(r&&("\n"===t[t.length-2]||"\n"===t)?"+":r?"":"-")+"\n"}function L(t){return"\n"===t[t.length-1]?t.slice(0,-1):t}function x(t,e){if(""===t||" "===t[0])return t;for(var n,r,i=/ [^ ]/g,o=0,u=0,s=0,a="";n=i.exec(t);)(s=n.index)-o>e&&(r=u>o?u:s,a+="\n"+t.slice(o,r),o=r+1),u=s;return a+="\n",t.length-o>e&&u>o?a+=t.slice(o,u)+"\n"+t.slice(u+1):a+=t.slice(o),a.slice(1)}function b(t,e,n){var r,o,u,c,f,l;for(u=0,c=(o=n?t.explicitTypes:t.implicitTypes).length;u<c;u+=1)if(((f=o[u]).instanceOf||f.predicate)&&(!f.instanceOf||"object"==typeof e&&e instanceof f.instanceOf)&&(!f.predicate||f.predicate(e))){if(t.tag=n?f.tag:"?",f.represent){if(l=t.styleMap[f.tag]||f.defaultStyle,"[object Function]"===s.call(f.represent))r=f.represent(e,l);else{if(!a.call(f.represent,l))throw new i("!<"+f.tag+'> tag resolver accepts not "'+l+'" style');r=f.represent[l](e,l)}t.dump=r}return!0}return!1}function j(t,e,n,r,o,u){t.tag=null,t.dump=n,b(t,n,!1)||b(t,n,!0);var a=s.call(t.dump);r&&(r=t.flowLevel<0||t.flowLevel>e);var c,f,l="[object Object]"===a||"[object Array]"===a;if(l&&(f=-1!==(c=t.duplicates.indexOf(n))),(null!==t.tag&&"?"!==t.tag||f||2!==t.indent&&e>0)&&(o=!1),f&&t.usedDuplicates[c])t.dump="*ref_"+c;else{if(l&&f&&!t.usedDuplicates[c]&&(t.usedDuplicates[c]=!0),"[object Object]"===a)r&&0!==Object.keys(t.dump).length?(!function(t,e,n,r){var o,u,s,a,c,f,l="",p=t.tag,h=Object.keys(n);if(!0===t.sortKeys)h.sort();else if("function"==typeof t.sortKeys)h.sort(t.sortKeys);else if(t.sortKeys)throw new i("sortKeys must be a boolean or a function");for(o=0,u=h.length;o<u;o+=1)f="",r&&0===o||(f+=d(t,e)),a=n[s=h[o]],j(t,e+1,s,!0,!0,!0)&&((c=null!==t.tag&&"?"!==t.tag||t.dump&&t.dump.length>1024)&&(t.dump&&10===t.dump.charCodeAt(0)?f+="?":f+="? "),f+=t.dump,c&&(f+=d(t,e)),j(t,e+1,a,!0,c)&&(t.dump&&10===t.dump.charCodeAt(0)?f+=":":f+=": ",l+=f+=t.dump));t.tag=p,t.dump=l||"{}"}(t,e,t.dump,o),f&&(t.dump="&ref_"+c+t.dump)):(!function(t,e,n){var r,i,o,u,s,a="",c=t.tag,f=Object.keys(n);for(r=0,i=f.length;r<i;r+=1)s=t.condenseFlow?'"':"",0!==r&&(s+=", "),u=n[o=f[r]],j(t,e,o,!1,!1)&&(t.dump.length>1024&&(s+="? "),s+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),j(t,e,u,!1,!1)&&(a+=s+=t.dump));t.tag=c,t.dump="{"+a+"}"}(t,e,t.dump),f&&(t.dump="&ref_"+c+" "+t.dump));else if("[object Array]"===a){var p=t.noArrayIndent&&e>0?e-1:e;r&&0!==t.dump.length?(!function(t,e,n,r){var i,o,u="",s=t.tag;for(i=0,o=n.length;i<o;i+=1)j(t,e+1,n[i],!0,!0)&&(r&&0===i||(u+=d(t,e)),t.dump&&10===t.dump.charCodeAt(0)?u+="-":u+="- ",u+=t.dump);t.tag=s,t.dump=u||"[]"}(t,p,t.dump,o),f&&(t.dump="&ref_"+c+t.dump)):(!function(t,e,n){var r,i,o="",u=t.tag;for(r=0,i=n.length;r<i;r+=1)j(t,e,n[r],!1,!1)&&(0!==r&&(o+=","+(t.condenseFlow?"":" ")),o+=t.dump);t.tag=u,t.dump="["+o+"]"}(t,p,t.dump),f&&(t.dump="&ref_"+c+" "+t.dump))}else{if("[object String]"!==a){if(t.skipInvalid)return!1;throw new i("unacceptable kind of an object to dump "+a)}"?"!==t.tag&&_(t,t.dump,e,u)}null!==t.tag&&"?"!==t.tag&&(t.dump="!<"+t.tag+"> "+t.dump)}return!0}function N(t,e){var n,r,i=[],o=[];for(S(t,i,o),n=0,r=o.length;n<r;n+=1)e.duplicates.push(i[o[n]]);e.usedDuplicates=new Array(r)}function S(t,e,n){var r,i,o;if(null!==t&&"object"==typeof t)if(-1!==(i=e.indexOf(t)))-1===n.indexOf(i)&&n.push(i);else if(e.push(t),Array.isArray(t))for(i=0,o=t.length;i<o;i+=1)S(t[i],e,n);else for(i=0,o=(r=Object.keys(t)).length;i<o;i+=1)S(t[r[i]],e,n)}function D(t,e){var n=new p(e=e||{});return n.noRefs||N(t,n),j(n,0,t,!0,!0)?n.dump+"\n":""}t.exports.dump=D,t.exports.safeDump=function(t,e){return D(t,r.extend({schema:u},e))}},function(t,e,n){"use strict";n.r(e);var r={};n.r(r),n.d(r,"UPDATE_CONFIGS",(function(){return T})),n.d(r,"TOGGLE_CONFIGS",(function(){return z})),n.d(r,"update",(function(){return k})),n.d(r,"toggle",(function(){return U})),n.d(r,"loaded",(function(){return P}));var i={};n.r(i),n.d(i,"downloadConfig",(function(){return R})),n.d(i,"getConfigByUrl",(function(){return Q}));var o={};n.r(o),n.d(o,"get",(function(){return G}));var u=n(102),s=n.n(u),a=n(103),c=n.n(a),f=n(104),l=n.n(f),p=n(105),h=n.n(p),d=n(2),y=n.n(d),v=(n(182),function(t){l()(n,t);var e=h()(n);function n(){return s()(this,n),e.apply(this,arguments)}return c()(n,[{key:"render",value:function(){var t=this.props.getComponent,e=t("Container"),n=t("Row"),r=t("Col"),i=t("Topbar",!0),o=t("BaseLayout",!0),u=t("onlineValidatorBadge",!0);return y.a.createElement(e,{className:"swagger-ui"},i?y.a.createElement(i,null):null,y.a.createElement(o,null),y.a.createElement(n,null,y.a.createElement(r,null,y.a.createElement(u,null))))}}]),n}(y.a.Component)),g=n(28),w=n.n(g),M=n(14),_=n.n(M),m=n(3),L=n.n(m),x=n(19),b=n.n(x),j=n(11),N=n.n(j),S=n(228),D=n.n(S),I=n(15),A=function(t){l()(n,t);var e=h()(n);function n(t,r){var i;return s()(this,n),i=e.call(this,t,r),_()(w()(i),"onUrlChange",(function(t){var e=t.target.value;i.setState({url:e})})),_()(w()(i),"loadSpec",(function(t){i.props.specActions.updateUrl(t),i.props.specActions.download(t)})),_()(w()(i),"onUrlSelect",(function(t){var e=t.target.value||t.target.href;i.loadSpec(e),i.setSelectedUrl(e),t.preventDefault()})),_()(w()(i),"downloadUrl",(function(t){i.loadSpec(i.state.url),t.preventDefault()})),_()(w()(i),"setSearch",(function(t){var e,n,r=Object(I.e)();r["urls.primaryName"]=t.name;var i,o=L()(e=L()(n="".concat(window.location.protocol,"//")).call(n,window.location.host)).call(e,window.location.pathname);window&&window.history&&window.history.pushState&&window.history.replaceState(null,"",L()(i="".concat(o,"?")).call(i,Object(I.f)(r)))})),_()(w()(i),"setSelectedUrl",(function(t){var e=i.props.getConfigs().urls||[];e&&e.length&&t&&b()(e).call(e,(function(e,n){e.url===t&&(i.setState({selectedIndex:n}),i.setSearch(e))}))})),_()(w()(i),"onFilterChange",(function(t){var e=t.target.value;i.props.layoutActions.updateFilter(e)})),i.state={url:t.specSelectors.url(),selectedIndex:0},i}return c()(n,[{key:"componentWillReceiveProps",value:function(t){this.setState({url:t.specSelectors.url()})}},{key:"componentDidMount",value:function(){var t=this,e=this.props.getConfigs(),n=e.urls||[];if(n&&n.length){var r=this.state.selectedIndex,i=e["urls.primaryName"];i&&b()(n).call(n,(function(e,n){e.name===i&&(t.setState({selectedIndex:n}),r=n)})),this.loadSpec(n[r].url)}}},{key:"render",value:function(){var t=this.props,e=t.getComponent,n=t.specSelectors,r=t.getConfigs,i=e("Button"),o=e("Link"),u="loading"===n.loadingStatus(),s=["download-url-input"];"failed"===n.loadingStatus()&&s.push("failed"),u&&s.push("loading");var a=r().urls,c=[],f=null;if(a){var l=[];b()(a).call(a,(function(t,e){l.push(y.a.createElement("option",{key:e,value:t.url},t.name))})),c.push(y.a.createElement("label",{className:"select-label",htmlFor:"select"},y.a.createElement("span",null,"Select a definition"),y.a.createElement("select",{id:"select",disabled:u,onChange:this.onUrlSelect,value:a[this.state.selectedIndex].url},l)))}else f=this.downloadUrl,c.push(y.a.createElement("input",{className:s.join(" "),type:"text",onChange:this.onUrlChange,value:this.state.url,disabled:u})),c.push(y.a.createElement(i,{className:"download-url-button",onClick:this.downloadUrl},"Explore"));return y.a.createElement("div",{className:"topbar"},y.a.createElement("div",{className:"wrapper"},y.a.createElement("div",{className:"topbar-wrapper"},y.a.createElement(o,null,y.a.createElement("img",{height:"40",src:D.a,alt:"Swagger UI"})),y.a.createElement("form",{className:"download-url-wrapper",onSubmit:f},N()(c).call(c,(function(t,e){return Object(d.cloneElement)(t,{key:e})}))))))}}]),n}(y.a.Component),O=n(74),E=n.n(O),C=function(t,e){try{return E.a.safeLoad(t)}catch(t){return e&&e.errActions.newThrownErr(new Error(t)),{}}},T="configs_update",z="configs_toggle";function k(t,e){return{type:T,payload:_()({},t,e)}}function U(t){return{type:z,payload:t}}var Y,P=function(){return function(t){var e=t.getConfigs,n=t.authActions;if(e().persistAuthorization){var r=localStorage.getItem("authorized");r&&n.restoreAuthorization({authorized:JSON.parse(r)})}}},R=function(t){return function(e){return(0,e.fn.fetch)(t)}},Q=function(t,e){return function(n){var r=n.specActions;if(t)return r.downloadConfig(t).then(i,i);function i(n){n instanceof Error||n.status>=400?(r.updateLoadingStatus("failedConfig"),r.updateLoadingStatus("failedConfig"),r.updateUrl(""),console.error(n.statusText+" "+t.url),e(null)):e(C(n.text))}}},F=n(5),B=n.n(F),G=function(t,e){return t.getIn(B()(e)?e:[e])},W=n(0),q=(Y={},_()(Y,T,(function(t,e){return t.merge(Object(W.fromJS)(e.payload))})),_()(Y,z,(function(t,e){var n=e.payload,r=t.get(n);return t.set(n,!r)})),Y),J={getLocalConfig:function(){return C('---\nurl: "https://petstore.swagger.io/v2/swagger.json"\ndom_id: "#swagger-ui"\nvalidatorUrl: "https://validator.swagger.io/validator"\n')}};e.default=[function(){return{components:{Topbar:A}}},function(){return{statePlugins:{spec:{actions:i,selectors:J},configs:{reducers:q,actions:r,selectors:o}}}},function(){return{components:{StandaloneLayout:v}}}]}]).default}));
//# sourceMappingURL=swagger-ui-standalone-preset.js.map
|
tutorials/react/start/workspace/static/js/main.ed651977.chunk.js
|
StBozov/Core
|
/*! For license information please see main.ed651977.chunk.js.LICENSE.txt */
(this["webpackJsonpdev-workspaces-frame"]=this["webpackJsonpdev-workspaces-frame"]||[]).push([[0],{16:function(e,t,n){},20:function(e,t,n){"use strict";(function(e){var r=n(5),i=n(14),o=n(0),a=n.n(o),s=n(2),c=n(3),u=n(4),d=n(1),l=n.n(d),p=n(7),h=n(10),f=n.n(h),m=function(e,t){return(m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function v(e,t){function n(){this.constructor=e}m(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var g=function(){return(g=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function y(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function w(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))}function b(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function k(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}var x=function(e){var t=e.appName,n=e.onClick;return l.a.createElement("a",{onClick:function(e){if(e.preventDefault(),"function"==typeof n)return n(e)},className:"list-group-item list-group-item-action px-3"},t)},_=function(e){var t=e.glue,n=e.inLane,r=e.parent,i=e.hidePopup,o=e.searchTerm,a=e.updatePopupHeight,s=e.filterApps||function(e){return!e.isActivity&&!e.isShell&&function(e){return!e.type||"activity"!==e.type&&"canvas"!==e.type&&"workspaces"!==e.type&&"node"!==e.type}(e)&&function(e){var t,n,r;return null!==(n=null===(t=null==e?void 0:e.userProperties)||void 0===t?void 0:t.includeInWorkspaces)&&void 0!==n?n:null===(r=null==e?void 0:e.userProperties)||void 0===r?void 0:r.includeInCanvas}(e)},c=t.appManager.applications().filter(s);return Object(d.useEffect)((function(){a()}),[]),l.a.createElement("nav",{id:"applicationsList",className:"nav list-group"},c.filter((function(e){return-1!==(e.title||e.name).toLowerCase().indexOf(o.toLowerCase())})).map((function(e,t){return l.a.createElement(x,{key:t,onClick:function(){var t;(t=e.name,function(){return w(void 0,void 0,void 0,(function(){var e,o,a,s,c;return b(this,(function(u){switch(u.label){case 0:return a=function(t){e?e.id===t.id&&(t.focus(),o()):o()},r.type?[3,2]:[4,r.onWindowLoaded(a)];case 1:return o=u.sent(),[3,4];case 2:return[4,r.workspace.onWindowLoaded(a)];case 3:o=u.sent(),u.label=4;case 4:return u.trys.push([4,11,,12]),"group"===r.type&&n?[4,r.parent.addGroup({type:"group",children:[{type:"window",appName:t}]})]:[3,6];case 5:return s=u.sent(),e=s.children[0],[3,10];case 6:return"group"===r.type||n?[3,8]:[4,r.addGroup({type:"group",children:[{type:"window",appName:t}]})];case 7:return s=u.sent(),e=s.children[0],[3,10];case 8:return[4,r.addWindow({type:"window",appName:t})];case 9:e=u.sent(),u.label=10;case 10:return[3,12];case 11:return c=u.sent(),console.warn(c),[3,12];case 12:return i(),[2]}}))}))})()},appName:e.title||e.name})})))},I=function(e){var t=e.inLane,n=e.setInLane,r=e.parent,i="";if(r.type?"group"!==r.type||r.children.length?"group"===r.type&&(i=""+(r.parent.type||"")):i="":i="workspace",Object(d.useEffect)((function(){i&&"workspace"!==i||n(!1)}),[i]),!i||"workspace"===i)return null;var o="This "+(i[0].toUpperCase()+i.substring(1));return l.a.createElement("div",{className:"form-group"},l.a.createElement("label",{htmlFor:"Application placement"},"Application Placement"),l.a.createElement("div",{className:"btn-group d-flex mb-2",role:"group","aria-label":"Application placement"},l.a.createElement("button",{onClick:function(){return n(!0)},type:"button",id:"laneButton",className:"btn btn-outline-primary w-100 "+(t?"active":"")},o),l.a.createElement("button",{onClick:function(){return n(!1)},type:"button",id:"tabGroupButton",className:"btn btn-outline-primary w-100 "+(t?"":"active")},"This Tab Group")))},C=function(e){return function(t){var n=t.glue||window.glue||Object(d.useContext)(p.a);if(!n)throw new Error("An instance of Glue is not provided");return l.a.createElement(e,g({},Object.assign({},t,{glue:n})))}},S=C((function(e){var t=e.workspaceId,n=e.boxId,r=e.hidePopup,i=e.resizePopup,o=e.glue,a=(e.frameId,e.filterApps),s=y(e,["workspaceId","boxId","hidePopup","resizePopup","glue","frameId","filterApps"]),c=Object(d.useState)(!1),u=c[0],p=c[1],h=Object(d.useState)(void 0),f=h[0],m=h[1],v=Object(d.useState)(""),w=v[0],b=v[1],k=l.a.createRef();Object(d.useEffect)((function(){var e=!0;return o.workspaces.getAllWorkspaces().then((function(r){var i=r.find((function(e){return e.id===t})),o=i.getBox((function(e){return e.id===n}))||i;e&&m(o)})),function(){e=!1}}),[n,t]);var x=function(){var e,t=null===(e=k.current)||void 0===e?void 0:e.getBoundingClientRect().height;i({width:300,height:t})};return Object(d.useEffect)((function(){x()}),[w,f]),l.a.createElement("div",g({},s,{ref:k,className:"container-fluid add-application"}),l.a.createElement("div",{className:"row"},l.a.createElement("div",{className:"col"},l.a.createElement("h5",{className:"border-bottom border-secondary pb-1 my-3"},"Add Application"))),l.a.createElement("div",{id:"applicationPlacementSection",className:"row"},l.a.createElement("div",{className:"col"},f&&l.a.createElement(I,{inLane:u,setInLane:p,parent:f}))),l.a.createElement("div",{className:"row"},l.a.createElement("div",{className:"col"},l.a.createElement("div",{className:"input-group position-relative mb-2"},l.a.createElement("input",{type:"text",id:"appSearch",className:"form-control pr-4",placeholder:"Search \u0430pplication",value:w,onChange:function(e){return b(e.target.value)},"aria-label":"Search \u0430pplication","aria-describedby":""}),l.a.createElement("div",{className:"icon-search"})))),l.a.createElement("div",{className:"row"},l.a.createElement("div",{className:"col"},l.a.createElement("div",{className:"applications mb-2"},l.a.createElement(_,{glue:o,hidePopup:r,inLane:u,parent:f,searchTerm:w,filterApps:a,updatePopupHeight:function(){x()}})))))})),E=function(e){var t=function(e){var t=/Inner message:\s+(.+)/gm.exec(e);return t&&t[1]||e}(e.errMessage);return l.a.createElement("div",{className:"row"},l.a.createElement("div",{className:"col"},l.a.createElement("div",{id:"feedbackContainer",className:"d-flex flex-row pb-2"},l.a.createElement("div",{className:"invalid-feedback mt-0 d-block"},t||"Something went wrong."))))},W=function(e){var t=e.name,n=e.onClick,r=e.onCloseClick;return l.a.createElement("a",{onClick:function(e){if(e.preventDefault(),"function"==typeof n)return n(e)},className:"list-group-item list-group-item-action ry-2"},l.a.createElement("div",{className:"align-items-center workspace d-flex flex-row"},l.a.createElement("div",{className:"workspace__icon mr-2"}),l.a.createElement("div",{className:"workspace__description"},l.a.createElement("h5",{className:"mb-0 text-truncate"},t)),l.a.createElement("div",{onClick:r,className:"close-icon ml-auto"})))},T=function(e){var t=e.glue,n=e.frameId,r=e.showFeedback,i=e.hidePopup,o=e.resizePopup,a=Object(d.useState)([]),s=a[0],c=a[1],u=function(){return t.workspaces.layouts.getSummaries()};return Object(d.useEffect)((function(){var e=!0;return u().then((function(t){e&&c(t)})),function(){e=!1}}),[]),Object(d.useEffect)((function(){o()}),[s]),l.a.createElement("nav",{id:"workspacesList",className:"nav flex-column"},s.map((function(e,o){return l.a.createElement(W,{key:o,name:e.name,onClick:function(){return(o=e.name,function(){t.workspaces.restoreWorkspace(o,{frameId:n,title:o}).catch((function(e){r(e.message)})).finally((function(){i()}))})();var o},onCloseClick:function(n){var i;n.stopPropagation(),(i=e.name,function(){t.workspaces.layouts.delete(i).catch((function(e){r(e.message)})).then((function(){u().then((function(e){c(e)}))}))})()}})})))},A=C((function(e){var t=e.frameId,n=e.hidePopup,r=e.resizePopup,i=e.glue,o=y(e,["frameId","hidePopup","resizePopup","glue"]),a=Object(d.useState)(void 0),s=a[0],c=a[1],u=l.a.createRef(),p=function(){var e,t=null===(e=u.current)||void 0===e?void 0:e.getBoundingClientRect().height;r({width:300,height:t})};return Object(d.useEffect)((function(){p()}),[s]),l.a.createElement("div",g({},o,{ref:u,className:"container-fluid add-workspace"}),l.a.createElement("div",{className:"row"},l.a.createElement("div",{className:"col"},l.a.createElement("h5",{className:"border-bottom border-secondary pb-1 my-3"},"Add Workspace"))),l.a.createElement("div",{className:"row"},l.a.createElement("div",{className:"col"},l.a.createElement("h5",{onClick:function(){i.workspaces.createWorkspace({children:[],frame:{reuseFrameId:t}}),n()},itemType:"h5",id:"createNewButton",className:"btn btn-primary mb-3 w-100"},"Create New"))),l.a.createElement("div",{className:"row"},l.a.createElement("div",{className:"col"},l.a.createElement("h3",null,"Load Workspace"),l.a.createElement("div",{className:"workspaces mb-2"},l.a.createElement(T,{frameId:t,glue:i,showFeedback:c,hidePopup:n,resizePopup:p})))),s&&l.a.createElement(E,{errMessage:s}))})),P=function(e){var t=e.changeChecked,n=e.refreshHeight,r=l.a.createRef();return Object(d.useEffect)((function(){n()}),[]),l.a.createElement("div",{className:"form-check"},l.a.createElement("input",{onChange:function(){(null==r?void 0:r.current)&&t(r.current.checked)},ref:r,className:"form-check-input",type:"checkbox",value:"",id:"saveContextCheckbox"}),l.a.createElement("label",{className:"form-check-label",htmlFor:"saveContextCheckbox"},"Save context"))},M=function(e){var t=e.workspaceId,n=e.inputValue,r=e.clearInput,i=e.showFeedback,o=e.shouldSaveContext,a=e.hideFeedback,s=e.glue,c=e.hidePopup,u=e.buildMode,p=Object(d.useState)(!1),h=p[0],f=p[1];return Object(d.useEffect)((function(){if(h){var e,a=!0,u=n;return s.workspaces.getAllWorkspaces().then((function(n){return e=n.find((function(e){return e.id===t})),s.workspaces.layouts.save({name:u,workspaceId:e.id,saveContext:o})})).then((function(){return e.setTitle(u)})).catch((function(e){a&&i(e.message)})).finally((function(){a&&(r(),f(!1),c())})),function(){a=!1}}}),[h]),l.a.createElement("button",{onClick:function(){var e=n;if(t&&!u){if(a(),!e)return void i("Please provide a valid name");if(h)return;f(!0)}else t&&function(e,t){return w(void 0,void 0,void 0,(function(){var n,r;return b(this,(function(i){switch(i.label){case 0:return n=s.agm.instance,r={operation:"generateLayout",operationArguments:{name:e,workspaceId:t}},[4,s.agm.invoke("T42.Workspaces.Control",r,n||"best")];case 1:return[2,i.sent().returned]}}))}))}(e,t).then((function(t){!function(e,t){var n=document.createElement("a"),r="text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(e));document.body.append(n),n.setAttribute("href","data:"+r),n.setAttribute("download",t+".txt"),n.click(),n.remove()}(t,e)})).catch((function(e){i(e.message)}))},id:"saveButton",type:"button",className:"btn btn-primary"},u?"Download":"Save")},O=C((function(e){var t=e.workspaceId,n=e.resizePopup,r=e.hidePopup,i=e.buildMode,o=e.glue,a=y(e,["workspaceId","resizePopup","hidePopup","buildMode","glue"]),s=l.a.createRef(),c=l.a.createRef(),u=Object(d.useState)(!1),p=u[0],h=u[1],f=Object(d.useState)(""),m=f[0],v=f[1],w=Object(d.useState)(""),b=w[0],k=w[1],x=function(){if(null==c?void 0:c.current){var e=c.current.getBoundingClientRect();n({height:e.height,width:300})}};return Object(d.useEffect)((function(){x()}),[m,t]),Object(d.useEffect)((function(){var e=!0;return o.workspaces.getAllWorkspaces().then((function(n){var r=n.find((function(e){return e.id===t}));e&&k(r.layoutName||"")})),function(){e=!1}}),[t]),l.a.createElement("div",g({},a,{onClick:function(e){return e.stopPropagation()},ref:c,className:"container-fluid save-workspace"}),l.a.createElement("div",{className:"row"},l.a.createElement("div",{className:"col"},l.a.createElement("h5",{className:"border-bottom border-secondary pb-1 my-3"},"Save Workspace"))),l.a.createElement("div",{className:"row mb-2"},l.a.createElement("div",{className:"col"},l.a.createElement("input",{ref:s,value:b,onChange:function(e){return k(e.target.value)},onClick:function(e){return v("")},className:"form-control mr-1",type:"text",placeholder:"Workspace name",id:"js-workspace-name"}))),l.a.createElement("div",{className:"row align-items-center pb-2"},l.a.createElement("div",{className:"col"},!i&&l.a.createElement(P,{changeChecked:function(e){return h(e)},refreshHeight:x})),l.a.createElement("div",{className:"col text-right"},l.a.createElement(M,{clearInput:function(){k("")},inputValue:b,workspaceId:t,shouldSaveContext:p,showFeedback:v,hideFeedback:function(){return v("")},hidePopup:r,buildMode:i,glue:o}))),m&&l.a.createElement(E,{errMessage:m}))}));function j(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))}var D="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof e?e:"undefined"!=typeof self?self:{};function L(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var N=L((function(e,t){!function(t){var n={config:{},container:{},controls:{},errors:{},items:{},utils:{}};n.utils.F=function(){},n.utils.extend=function(e,t){e.prototype=n.utils.createObject(t.prototype),e.prototype.contructor=e},n.utils.createObject=function(e){return"function"==typeof Object.create?Object.create(e):(n.utils.F.prototype=e,new n.utils.F)},n.utils.objectKeys=function(e){var t,n;if("function"==typeof Object.keys)return Object.keys(e);for(n in t=[],e)t.push(n);return t},n.utils.getHashValue=function(e){var t=location.hash.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},n.utils.getQueryStringParam=function(e){if(window.location.hash)return n.utils.getHashValue(e);if(!window.location.search)return null;var t,r,i=window.location.search.substr(1).split("&"),o={};for(r=0;r<i.length;r++)o[(t=i[r].split("="))[0]]=t[1];return o[e]||null},n.utils.copy=function(e,t){for(var n in t)e[n]=t[n];return e},n.utils.animFrame=function(e){return(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)})((function(){e()}))},n.utils.indexOf=function(e,t){if(!(t instanceof Array))throw new Error("Haystack is not an Array");if(t.indexOf)return t.indexOf(e);for(var n=0;n<t.length;n++)if(t[n]===e)return n;return-1},"object"!=typeof Int8Array?n.utils.isFunction=function(e){return"function"==typeof e||!1}:n.utils.isFunction=function(e){return"[object Function]"===toString.call(e)},n.utils.fnBind=function(e,t,n){if(void 0!==Function.prototype.bind)return Function.prototype.bind.apply(e,[t].concat(n||[]));var r=function r(){var i=(n||[]).concat(Array.prototype.slice.call(arguments,0));if(!(this instanceof r))return e.apply(t,i);e.apply(this,i)};return r.prototype=e.prototype,r},n.utils.removeFromArray=function(e,t){var r=n.utils.indexOf(e,t);if(-1===r)throw new Error("Can't remove item from array. Item is not in the array");t.splice(r,1)},n.utils.now=function(){return"function"==typeof Date.now?Date.now():(new Date).getTime()},n.utils.getUniqueId=function(){return(1e15*Math.random()).toString(36).replace(".","")},n.utils.filterXss=function(e,t){var n=e.replace(/javascript/gi,"javascript").replace(/expression/gi,"expression").replace(/onload/gi,"onload").replace(/script/gi,"script").replace(/onerror/gi,"onerror");return!0===t?n:n.replace(/>/g,">").replace(/</g,"<")},n.utils.stripTags=function(e){return t.trim(e.replace(/(<([^>]+)>)/gi,""))},n.utils.EventEmitter=function(){this._mSubscriptions={},this._mSubscriptions[n.utils.EventEmitter.ALL_EVENT]=[],this.on=function(e,t,r){if(!n.utils.isFunction(t))throw new Error("Tried to listen to event "+e+" with non-function callback "+t);this._mSubscriptions[e]||(this._mSubscriptions[e]=[]),this._mSubscriptions[e].push({fn:t,ctx:r})},this.emit=function(e){var t,r,i;i=Array.prototype.slice.call(arguments,1);var o=this._mSubscriptions[e];if(o)for(o=o.slice(),t=0;t<o.length;t++)r=o[t].ctx||{},o[t].fn.apply(r,i);i.unshift(e);var a=this._mSubscriptions[n.utils.EventEmitter.ALL_EVENT].slice();for(t=0;t<a.length;t++)r=a[t].ctx||{},a[t].fn.apply(r,i)},this.unbind=function(e,t,n){if(this._mSubscriptions[e]){var r,i=!1;for(r=0;r<this._mSubscriptions[e].length;r++)t&&this._mSubscriptions[e][r].fn!==t||n&&n!==this._mSubscriptions[e][r].ctx||(this._mSubscriptions[e].splice(r,1),i=!0);if(!1===i)throw new Error("Nothing to unbind for "+e)}},this.off=this.unbind,this.trigger=this.emit},n.utils.EventEmitter.ALL_EVENT="__all",n.utils.DragListener=function(e,r){n.utils.EventEmitter.call(this),this._eElement=t(e),this._oDocument=t(document),this._eBody=t(document.body),this._nButtonCode=r||0,this._nDelay=200,this._nDistance=10,this._nX=0,this._nY=0,this._nOriginalX=0,this._nOriginalY=0,this._bDragging=!1,this._fMove=n.utils.fnBind(this.onMouseMove,this),this._fUp=n.utils.fnBind(this.onMouseUp,this),this._fDown=n.utils.fnBind(this.onMouseDown,this),this._eElement.on("mousedown touchstart",this._fDown)},n.utils.DragListener.timeout=null,n.utils.copy(n.utils.DragListener.prototype,{destroy:function(){this._eElement.unbind("mousedown touchstart",this._fDown),this._oDocument.unbind("mouseup touchend",this._fUp),this._eElement=null,this._oDocument=null,this._eBody=null},onMouseDown:function(e){if(e.preventDefault(),0==e.button||"touchstart"===e.type){var t=this._getCoordinates(e);this._nOriginalX=t.x,this._nOriginalY=t.y,this._oDocument.on("mousemove touchmove",this._fMove),this._oDocument.one("mouseup touchend",this._fUp),this._timeout=setTimeout(n.utils.fnBind((function(){this._startDrag(e)}),this),this._nDelay)}},onMouseMove:function(e){if(null!=this._timeout){e.preventDefault();var t=this._getCoordinates(e);this._nX=t.x-this._nOriginalX,this._nY=t.y-this._nOriginalY,!1===this._bDragging&&(Math.abs(this._nX)>this._nDistance||Math.abs(this._nY)>this._nDistance)&&(clearTimeout(this._timeout),this._startDrag(e)),this._bDragging&&this.emit("drag",this._nX,this._nY,e)}},onMouseUp:function(e){null!=this._timeout&&(clearTimeout(this._timeout),this._eBody.removeClass("lm_dragging"),this._eElement.removeClass("lm_dragging"),this._oDocument.find("iframe").css("pointer-events",""),this._oDocument.unbind("mousemove touchmove",this._fMove),this._oDocument.unbind("mouseup touchend",this._fUp),!0===this._bDragging&&(this._bDragging=!1,this.emit("dragStop",e,this._nOriginalX+this._nX)))},_startDrag:function(e){this._bDragging=!0,this._eBody.addClass("lm_dragging"),this._eElement.addClass("lm_dragging"),this._oDocument.find("iframe").css("pointer-events","none"),this.emit("dragStart",this._nOriginalX,this._nOriginalY,e)},_getCoordinates:function(e){return{x:(e=e.originalEvent&&e.originalEvent.touches?e.originalEvent.touches[0]:e).pageX,y:e.pageY}}}),n.LayoutManager=function(e,r,i){if(!t&&window.$&&(t=window.$),!t||"function"!=typeof t.noConflict)throw new Error('jQuery is missing as dependency for GoldenLayout. Please either expose $ on GoldenLayout\'s scope (e.g. window) or add "jquery" to your paths when using RequireJS/AMD');n.utils.EventEmitter.call(this),this.isInitialised=!1,this._isFullPage=!1,this._resizeTimeoutId=null,this._components={"lm-react-component":n.utils.ReactComponentHandler},this._itemAreas=[],this._resizeFunction=n.utils.fnBind(this._onResize,this),this._unloadFunction=n.utils.fnBind(this._onUnload,this),this._maximizedItem=null,this._maximizePlaceholder=t('<div class="lm_maximise_place"></div>'),this._creationTimeoutPassed=!1,this._subWindowsCreated=!1,this._dragSources=[],this._dragProxies=[],this._updatingColumnsResponsive=!1,this._firstLoad=!0,this._componentFactory=i,this.width=null,this.height=null,this.root=null,this.openPopouts=[],this.selectedItem=null,this.isSubWindow=!1,this.eventHub=new n.utils.EventHub(this),this.config=this._createConfig(e),this.container=r,this.dropTargetIndicator=null,this.transitionIndicator=null,this.tabDropPlaceholder=t('<div class="lm_drop_tab_placeholder"></div>'),!0===this.isSubWindow&&t("body").css("visibility","hidden"),this._typeToItem={column:n.utils.fnBind(n.items.RowOrColumn,this,[!0]),row:n.utils.fnBind(n.items.RowOrColumn,this,[!1]),stack:n.items.Stack,component:n.items.Component}},n.LayoutManager.__lm=n,n.LayoutManager.minifyConfig=function(e){return(new n.utils.ConfigMinifier).minifyConfig(e)},n.LayoutManager.unminifyConfig=function(e){return(new n.utils.ConfigMinifier).unminifyConfig(e)},n.utils.copy(n.LayoutManager.prototype,{registerComponent:function(e,t){if("function"!=typeof t)throw new Error("Please register a constructor function");if(void 0!==this._components[e])throw new Error("Component "+e+" is already registered");this._components[e]=t},toConfig:function(e){var t,r,i;if(!1===this.isInitialised)throw new Error("Can't create config, layout not yet initialised");if(e&&!(e instanceof n.items.AbstractContentItem))throw new Error("Root must be a ContentItem");for((t={settings:n.utils.copy({},this.config.settings),dimensions:n.utils.copy({},this.config.dimensions),labels:n.utils.copy({},this.config.labels),context:n.utils.copy({},this.config.context),workspacesOptions:n.utils.copy({},this.config.workspacesOptions)}).content=[],(r=function(e,t){var n,i;for(n in t.config)"content"!==n&&(e[n]=t.config[n]);if(t.contentItems.length)for(e.content=[],i=0;i<t.contentItems.length;i++)e.content[i]={},r(e.content[i],t.contentItems[i])})(t,e?{contentItems:[e]}:this.root),this._$reconcilePopoutWindows(),t.openPopouts=[],i=0;i<this.openPopouts.length;i++)t.openPopouts.push(this.openPopouts[i].toConfig());return t.maximizedItemId=this._maximizedItem?"__glMaximised":null,t},getComponent:function(e){if(void 0===this._components[e])throw new n.errors.ConfigurationError('Unknown component "'+e+'"');return this._components[e]},init:function(){if(!1===this._subWindowsCreated&&(this._createSubWindows(),this._subWindowsCreated=!0),"loading"!==document.readyState&&null!==document.body){if(!0===this.isSubWindow&&!1===this._creationTimeoutPassed)return setTimeout(n.utils.fnBind(this.init,this),7),void(this._creationTimeoutPassed=!0);!0===this.isSubWindow&&this._adjustToWindowMode(),this._setContainer(),this.dropTargetIndicator=new n.controls.DropTargetIndicator(this.container),this.transitionIndicator=new n.controls.TransitionIndicator,this.updateSize(),this._create(this.config),this._bindEvents(),this.isInitialised=!0,this._adjustColumnsResponsive(),this.emit("initialised")}else t(document).ready(n.utils.fnBind(this.init,this))},updateSize:function(e,t){2===arguments.length?(this.width=e,this.height=t):(this.width=this.container.width(),this.height=this.container.height()),!0===this.isInitialised&&(this.root.callDownwards("setSize",[this.width,this.height]),this._maximizedItem&&(this._maximizedItem.element.width(e),this._maximizedItem.element.height(t),this._maximizedItem.callDownwards("setSize")),this._adjustColumnsResponsive())},destroy:function(){!1!==this.isInitialised&&(this._onUnload(),t(window).off("resize",this._resizeFunction),t(window).off("unload beforeunload",this._unloadFunction),this.root.callDownwards("_$destroy",[],!0),this.root.contentItems=[],this.tabDropPlaceholder.remove(),this.dropTargetIndicator.destroy(),this.transitionIndicator.destroy(),this.eventHub.destroy(),this._dragSources.forEach((function(e){"function"==typeof e._dragListener.destroy&&e._dragListener.destroy(),e._element=null,e._itemConfig=null,e._dragListener=null})),this._dragSources=[])},createContentItem:function(e,t){var r;if("string"!=typeof e.type)throw new n.errors.ConfigurationError("Missing parameter 'type'",e);if("react-component"===e.type&&(e.type="component",e.componentName="lm-react-component"),!this._typeToItem[e.type])throw r="Unknown type '"+e.type+"'. Valid types are "+n.utils.objectKeys(this._typeToItem).join(","),new n.errors.ConfigurationError(r);return"component"!==e.type||t instanceof n.items.Stack||!t||!0===this.isSubWindow&&t instanceof n.items.Root||(e={type:"stack",width:e.width,height:e.height,content:[e]}),new this._typeToItem[e.type](this,e,t)},createPopout:function(e,t,r,i){var o,a,s,c,u,d,l=e,p=e instanceof n.items.AbstractContentItem,h=this;if(r=r||null,p){for(l=this.toConfig(e).content,r=n.utils.getUniqueId(),c=e.parent,u=e;1===c.contentItems.length&&!c.isRoot;)c=c.parent,u=u.parent;c.addId(r),isNaN(i)&&(i=n.utils.indexOf(u,c.contentItems))}else l instanceof Array||(l=[l]);return!t&&p&&(o=window.screenX||window.screenLeft,a=window.screenY||window.screenTop,t={left:o+(s=e.element.offset()).left,top:a+s.top,width:e.element.width(),height:e.element.height()}),t||p||(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),p&&e.remove(),(d=new n.controls.BrowserPopout(l,t,r,i,this)).on("initialised",(function(){h.emit("windowOpened",d)})),d.on("closed",(function(){h._$reconcilePopoutWindows()})),this.openPopouts.push(d),d},createDragSource:function(e,r,i){this.config.settings.constrainDragToContainer=!1;var o=new n.controls.DragSource(t(e),r,this,i);return this._dragSources.push(o),o},selectItem:function(e,t){if(!0!==this.config.settings.selectionEnabled)throw new Error("Please set selectionEnabled to true to use this feature");e!==this.selectedItem&&(null!==this.selectedItem&&this.selectedItem.deselect(),e&&!0!==t&&e.select(),this.selectedItem=e,this.emit("selectionChanged",e))},_$maximiseItem:function(e){null!==this._maximizedItem&&this._$minimizeItem(this._maximizedItem),this._maximizedItem=e,this._maximizedItem.addId("__glMaximised"),e.element.addClass("lm_maximised"),e.element.after(this._maximizePlaceholder),this.root.element.prepend(e.element),e.element.width(this.container.width()),e.element.height(this.container.height()),e.callDownwards("setSize"),this._maximizedItem.emit("maximized"),this.emit("stateChanged")},_$minimiseItem:function(e){e.element.removeClass("lm_maximised"),e.removeId("__glMaximised"),this._maximizePlaceholder.after(e.element),this._maximizePlaceholder.remove(),e.parent.callDownwards("setSize"),this._maximizedItem=null,e.emit("minimized"),this.emit("stateChanged")},_$closeWindow:function(){window.setTimeout((function(){window.close()}),1)},_$getArea:function(e,t){var n,r,i=1/0,o=null;for(n=0;n<this._itemAreas.length;n++)e>(r=this._itemAreas[n]).x1&&e<r.x2&&t>r.y1&&t<r.y2&&i>r.surface&&(i=r.surface,o=r);return o},_$createRootItemAreas:function(){var e={y2:0,x2:0,y1:"y2",x1:"x2"};for(var t in e){var n=this.root._$getArea();n.side=t,n[t]=e[t]?n[e[t]]-50:"y2"===t?50+this.root.element.offset().top:50,n.surface=(n.x2-n.x1)*(n.y2-n.y1),this._itemAreas.push(n)}},_$calculateItemAreas:function(){var e,t,r=this._getAllContentItems();if(this._itemAreas=[],1!==r.length){for(this._$createRootItemAreas(),e=0;e<r.length;e++)if(r[e].isStack&&null!==(t=r[e]._$getArea()))if(t instanceof Array)this._itemAreas=this._itemAreas.concat(t);else{this._itemAreas.push(t);var i={};n.utils.copy(i,t),n.utils.copy(i,t.contentItem._contentAreaDimensions.header.highlightArea),i.surface=(i.x2-i.x1)*(i.y2-i.y1),this._itemAreas.push(i)}"workspace"===this.config.settings.mode&&(this._itemAreas=[this._itemAreas[this._itemAreas.length-1]])}else this._itemAreas.push(this.root._$getArea())},_$normalizeContentItem:function(e,r){if(!e)throw new Error("No content item defined");if(n.utils.isFunction(e)&&(e=e()),e instanceof n.items.AbstractContentItem)return e;if(t.isPlainObject(e)&&e.type){var i=this.createContentItem(e,r);return i.callDownwards("_$init"),i}throw new Error("Invalid contentItem")},_$reconcilePopoutWindows:function(){var e,t=[];for(e=0;e<this.openPopouts.length;e++)!1===this.openPopouts[e].getWindow().closed?t.push(this.openPopouts[e]):this.emit("windowClosed",this.openPopouts[e]);this.openPopouts.length!==t.length&&(this.emit("stateChanged"),this.openPopouts=t)},_getAllContentItems:function(){var e=[];return function t(n){if(e.push(n),n.contentItems instanceof Array)for(var r=0;r<n.contentItems.length;r++)t(n.contentItems[r])}(this.root),e},_bindEvents:function(){this._isFullPage&&t(window).resize(this._resizeFunction),t(window).on("unload beforeunload",this._unloadFunction)},_onResize:function(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=setTimeout(n.utils.fnBind(this.updateSize,this),100)},_createConfig:function(e){var r=n.utils.getQueryStringParam("gl-window");r&&(this.isSubWindow=!0,e=localStorage.getItem(r),e=JSON.parse(e),e=(new n.utils.ConfigMinifier).unminifyConfig(e),localStorage.removeItem(r));return function e(t){for(var n in t)"props"!==n&&"object"==typeof t[n]?e(t[n]):"type"===n&&"react-component"===t[n]&&(t.type="component",t.componentName="lm-react-component")}(e=t.extend(!0,{},n.config.defaultConfig,e)),!1===e.settings.hasHeaders&&(e.dimensions.headerHeight=0),e},_adjustToWindowMode:function(){var e=t('<div class="lm_popin" title="'+this.config.labels.popin+'"><div class="lm_icon"></div><div class="lm_bg"></div></div>');e.click(n.utils.fnBind((function(){this.emit("popIn")}),this)),document.title=n.utils.stripTags(this.config.content[0].title),t("head").append(t("body link, body style, template, .gl_keep")),this.container=t("body").html("").css("visibility","visible").append(e),document.body.offsetHeight,window.__glInstance=this},_createSubWindows:function(){var e,t;for(e=0;e<this.config.openPopouts.length;e++)t=this.config.openPopouts[e],this.createPopout(t.content,t.dimensions,t.parentId,t.indexInParent)},_setContainer:function(){var e=t(this.container||"body");if(0===e.length)throw new Error("GoldenLayout container not found");if(e.length>1)throw new Error("GoldenLayout more than one container element specified");e[0]===document.body&&(this._isFullPage=!0,t("html, body").css({height:"100%",margin:0,padding:0,overflow:"hidden"})),this.container=e},_create:function(e){var t;if(!(e.content instanceof Array))throw t=void 0===e.content?"Missing setting 'content' on top level of configuration":"Configuration parameter 'content' must be an array",new n.errors.ConfigurationError(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new n.errors.ConfigurationError(t,e);this.root=new n.items.Root(this,{content:e.content},this.container),this.root.callDownwards("_$init"),"__glMaximised"===e.maximizedItemId&&this.root.getItemsById(e.maximizedItemId)[0].toggleMaximise()},_onUnload:function(){if(!0===this.config.settings.closePopoutsOnUnload)for(var e=0;e<this.openPopouts.length;e++)this.openPopouts[e].close()},_adjustColumnsResponsive:function(){if(this._useResponsiveLayout()&&!this._updatingColumnsResponsive&&this.config.dimensions&&this.config.dimensions.minItemWidth&&0!==this.root.contentItems.length&&this.root.contentItems[0].isRow){this._firstLoad=!1;var e=this.root.contentItems[0].contentItems.length;if(!(e<=1)){var t=this.config.dimensions.minItemWidth;if(!(e*t<=this.width)&&this.container.is(":visible")){this._updatingColumnsResponsive=!0;for(var n=e-Math.max(Math.floor(this.width/t),1),r=this.root.contentItems[0],i=this._findAllStackContainers()[0],o=0;o<n;o++){var a=r.contentItems[r.contentItems.length-1];this._addChildContentItemsToContainer(i,a)}this._updatingColumnsResponsive=!1}}}else this._firstLoad=!1},_useResponsiveLayout:function(){return this.config.settings&&("always"==this.config.settings.responsiveMode||"onload"==this.config.settings.responsiveMode&&this._firstLoad)},_addChildContentItemsToContainer:function(e,t){"stack"===t.type?t.contentItems.forEach((function(n){e.addChild(n),t.removeChild(n,!0)})):t.contentItems.forEach(n.utils.fnBind((function(t){this._addChildContentItemsToContainer(e,t)}),this))},_findAllStackContainers:function(){var e=[];return this._findAllStackContainersRecursive(e,this.root),e},_findAllStackContainersRecursive:function(e,t){t.contentItems.forEach(n.utils.fnBind((function(t){"stack"==t.type?e.push(t):t.isComponent||this._findAllStackContainersRecursive(e,t)}),this))}}),n.LayoutManager.default=n.LayoutManager,e.exports=n.LayoutManager,window.GoldenLayout=n.LayoutManager,n.config.defaultConfig={openPopouts:[],settings:{hasHeaders:!0,constrainDragToContainer:!0,reorderEnabled:!0,selectionEnabled:!1,popoutWholeStack:!1,blockedPopoutsThrowError:!0,closePopoutsOnUnload:!0,showMinimizeIcon:!1,showPopoutIcon:!0,showMaximizeIcon:!0,showCloseIcon:!0,responsiveMode:"always",tabOverlapAllowance:0,reorderOnTabMenuClick:!0,tabControlOffset:10,mode:"default"},dimensions:{borderWidth:5,borderGrabWidth:15,minItemHeight:10,minItemWidth:10,headerHeight:20,dragProxyWidth:500,dragProxyHeight:500},labels:{close:"close",maximize:"maximize",restore:"restore",minimize:"minimize",popout:"eject",popin:"pop in",tabDropdown:"additional tabs"},workspacesOptions:{}},n.config.itemDefaultConfig={isClosable:!0,reorderEnabled:!0,title:"",workspacesConfig:{}},n.container.ItemContainer=function(e,r,i){n.utils.EventEmitter.call(this),this.width=null,this.height=null,this.title=e.componentName,this.parent=r,this.layoutManager=i,this.isHidden=!1,this._config=e,this._element=t(['<div class="lm_item_container">','<div class="lm_content"></div>',"</div>"].join("")),this._contentElement=this._element.find(".lm_content")},n.utils.copy(n.container.ItemContainer.prototype,{getElement:function(){return this._contentElement},hide:function(){this.emit("hide"),this.isHidden=!0,this._element.hide()},show:function(){this.emit("show"),this.isHidden=!1,this._element.show(),0==this.height&&0==this.width||this.emit("shown")},setSize:function(e,t){for(var n,r,i,o,a=this.parent,s=this;!a.isColumn&&!a.isRow;)if(s=a,(a=a.parent).isRoot)return!1;for(n=("height"==(r=a.isColumn?"height":"width")?t:e)/(this[r]*(1/(s.config[r]/100)))*100,i=(s.config[r]-n)/(a.contentItems.length-1),o=0;o<a.contentItems.length;o++)a.contentItems[o]===s?a.contentItems[o].config[r]=n:a.contentItems[o].config[r]+=i;return a.callDownwards("setSize"),!0},close:function(){this._config.isClosable&&(this.emit("close"),this.parent.close())},getState:function(){return this._config.componentState},extendState:function(e){this.setState(t.extend(!0,this.getState(),e))},setState:function(e){this._config.componentState=e,this.parent.emitBubblingEvent("stateChanged")},setTitle:function(e){this.parent.setTitle(e)},_$setSize:function(e,t){if(e!==this.width||t!==this.height){this.width=e,this.height=t;var n=this._contentElement[0],r=n.offsetWidth-n.clientWidth,i=n.offsetHeight-n.clientHeight;this._contentElement.width(this.width-r).height(this.height-i),this.emit("resize")}}}),n.controls.BrowserPopout=function(e,t,r,i,o){n.utils.EventEmitter.call(this),this.isInitialised=!1,this._config=e,this._dimensions=t,this._parentId=r,this._indexInParent=i,this._layoutManager=o,this._popoutWindow=null,this._id=null,this._createWindow()},n.utils.copy(n.controls.BrowserPopout.prototype,{toConfig:function(){if(!1===this.isInitialised)throw new Error("Can't create config, layout not yet initialised");return{dimensions:{width:this.getGlInstance().width,height:this.getGlInstance().height,left:this._popoutWindow.screenX||this._popoutWindow.screenLeft,top:this._popoutWindow.screenY||this._popoutWindow.screenTop},content:this.getGlInstance().toConfig().content,parentId:this._parentId,indexInParent:this._indexInParent}},getGlInstance:function(){return this._popoutWindow.__glInstance},getWindow:function(){return this._popoutWindow},close:function(){if(this.getGlInstance())this.getGlInstance()._$closeWindow();else try{this.getWindow().close()}catch(e){}},popIn:function(){var e,n;this._indexInParent,this._parentId&&(e=t.extend(!0,{},this.getGlInstance().toConfig()).content[0],(n=this._layoutManager.root.getItemsById(this._parentId)[0])||(n=this._layoutManager.root.contentItems.length>0?this._layoutManager.root.contentItems[0]:this._layoutManager.root)),n.addChild(e,this._indexInParent),this.close()},_createWindow:function(){var e,r=this._createUrl(),i=Math.floor(1e6*Math.random()).toString(36),o=this._serializeWindowOptions({width:this._dimensions.width,height:this._dimensions.height,innerWidth:this._dimensions.width,innerHeight:this._dimensions.height,menubar:"no",toolbar:"no",location:"no",personalbar:"no",resizable:"yes",scrollbars:"no",status:"no"});if(this._popoutWindow=window.open(r,i,o),this._popoutWindow)t(this._popoutWindow).on("load",n.utils.fnBind(this._positionWindow,this)).on("unload beforeunload",n.utils.fnBind(this._onClose,this)),e=setInterval(n.utils.fnBind((function(){this._popoutWindow.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),clearInterval(e))}),this),10);else if(!0===this._layoutManager.config.settings.blockedPopoutsThrowError){var a=new Error("Popout blocked");throw a.type="popoutBlocked",a}},_serializeWindowOptions:function(e){var t,n=[];for(t in e)n.push(t+"="+e[t]);return n.join(",")},_createUrl:function(){var e,t={content:this._config},r="gl-window-config-"+n.utils.getUniqueId();t=(new n.utils.ConfigMinifier).minifyConfig(t);try{localStorage.setItem(r,JSON.stringify(t))}catch(e){throw new Error("Error while writing to localStorage "+e.toString())}return 1===(e=document.location.href.split("?")).length?e[0]+"?gl-window="+r:document.location.href+"&gl-window="+r},_positionWindow:function(){this._popoutWindow.moveTo(this._dimensions.left,this._dimensions.top),this._popoutWindow.focus()},_onInitialised:function(){this.isInitialised=!0,this.getGlInstance().on("popIn",this.popIn,this),this.emit("initialised")},_onClose:function(){setTimeout(n.utils.fnBind(this.emit,this,["closed"]),50)}}),n.controls.DragProxy=function(e,r,i,o,a,s){n.utils.EventEmitter.call(this),this._dragListener=i,this._layoutManager=o,this._contentItem=a,this._originalParent=s,this._area=null,this._lastValidArea=null,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this.element=t(n.controls.DragProxy._template),s&&s._side&&(this._sided=s._sided,this.element.addClass("lm_"+s._side),["right","bottom"].indexOf(s._side)>=0&&this.element.find(".lm_content").after(this.element.find(".lm_header"))),this.element.css({left:e,top:r}),this.element.find(".lm_tab").attr("title",n.utils.stripTags(this._contentItem.config.title)),this.element.find(".lm_title").html(this._contentItem.config.title),this.childElementContainer=this.element.find(".lm_content"),this.childElementContainer.append(a.element),this._originalParent&&this._originalParent.layoutManager.config&&this._originalParent.layoutManager.config.settings&&this._originalParent.layoutManager.config.settings.disableDragProxy&&this.element.find(".lm_content").css("display","none"),this._updateTree(),this._layoutManager._$calculateItemAreas(),this._setDimensions(),t(document.body).append(this.element);var c=this._layoutManager.container.offset();this._minX=c.left,this._minY=c.top,this._maxX=this._layoutManager.container.width()+this._minX,this._maxY=this._layoutManager.container.height()+this._minY,this._width=this._layoutManager.config.dimensions.dragProxyWidth,this._height=this._layoutManager.config.dimensions.dragProxyHeight,this._setDropPosition(e,r)},n.controls.DragProxy._template='<div class="lm_dragProxy"><div class="lm_header"><ul class="lm_tabs"><li class="lm_tab lm_active"><i class="lm_left"></i><span class="lm_title"></span><i class="lm_right"></i></li></ul></div><div class="lm_content"></div></div>',n.utils.copy(n.controls.DragProxy.prototype,{_onDrag:function(e,t,n){var r=(n=n.originalEvent&&n.originalEvent.touches?n.originalEvent.touches[0]:n).pageX,i=n.pageY;(r>this._minX&&r<this._maxX&&i>this._minY&&i<this._maxY||!0!==this._layoutManager.config.settings.constrainDragToContainer)&&this._setDropPosition(r,i)},_setDropPosition:function(e,t){this.element.css({left:e,top:t}),this._area=this._layoutManager._$getArea(e,t),null!==this._area&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(e,t,this._area))},_onDrop:function(e){this._layoutManager.dropTargetIndicator.hide(),this.element.find(".lm_content").css("display",""),null===this._area||e&&e.canceled?null===this._lastValidArea||e&&e.canceled?!this._originalParent||e&&e.canceled?this._contentItem._$destroy():this._originalParent.addChild(this._contentItem):this._lastValidArea.contentItem._$onDrop(this._contentItem,this._lastValidArea):(this._area.contentItem._$onDrop(this._contentItem,this._area),this._originalParent&&this._area.contentItem!==this._originalParent&&this._layoutManager.emit("parentChanged",this._contentItem,this._originalParent)),this.element.remove();var t=this._layoutManager._dragProxies.indexOf(this);t>-1&&this._layoutManager._dragProxies.splice(t,1),this._layoutManager.emit("itemDropped",this._contentItem)},_updateTree:function(){this._contentItem.parent&&this._contentItem.parent.removeChild(this._contentItem,!0),this._contentItem._$setParent(this)},_setDimensions:function(){this._contentItem.callDownwards("_$show")}}),n.controls.DragSource=function(e,t,n,r){this._element=e,this._itemConfig=t,this._layoutManager=n,this._dragListener=null,this._createDragListener(r)},n.utils.copy(n.controls.DragSource.prototype,{_createDragListener:function(e){null!==this._dragListener&&this._dragListener.destroy(),this._dragListener=e||new n.utils.DragListener(this._element),"function"==typeof this._dragListener.on&&(this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this))},_onDragStart:function(e,r){var i=this._itemConfig;n.utils.isFunction(i)&&(i=i());var o=this._layoutManager._$normalizeContentItem(t.extend(!0,{},i)),a=new n.controls.DragProxy(e,r,this._dragListener,this._layoutManager,o,null);this._layoutManager.transitionIndicator.transitionElements(this._element,a.element)}}),n.controls.DropTargetIndicator=function(){this.element=t(n.controls.DropTargetIndicator._template),t(document.body).append(this.element)},n.controls.DropTargetIndicator._template='<div class="lm_dropTargetIndicator"><div class="lm_inner"><span></span><span></span><span></span></div></div>',n.utils.copy(n.controls.DropTargetIndicator.prototype,{destroy:function(){this.element.remove()},highlight:function(e,t,n,r){this.highlightArea({x1:e,y1:t,x2:n,y2:r})},highlightArea:function(e){this.element.css({left:e.x1,top:e.y1,width:e.x2-e.x1,height:e.y2-e.y1}).show()},hide:function(){this.element.hide()}}),n.controls.Header=function(e,r){if(n.utils.EventEmitter.call(this),this.layoutManager=e,this.element=t(n.controls.Header._template),!0===this.layoutManager.config.settings.selectionEnabled&&(this.element.addClass("lm_selectable"),this.element.on("click touchstart",n.utils.fnBind(this._onHeaderClick,this))),"workspace"===this.layoutManager.config.settings.mode&&this.element.addClass("header_double"),"workspace"===this.layoutManager.config.settings.mode&&this.layoutManager._componentFactory){var i=this.element.children(".lm_controls")[0],o=this.element.children(".lm_workspace_controls")[0],a=this.element.children(".lm_logo")[0];this.layoutManager._componentFactory.createLogo&&this.layoutManager._componentFactory.createLogo({domNode:a}),this.layoutManager._componentFactory.createAddWorkspace&&this.layoutManager._componentFactory.createAddWorkspace({domNode:o}),this.layoutManager._componentFactory.createSystemButtons&&this.layoutManager._componentFactory.createSystemButtons({domNode:i})}this.tabsContainer=this.element.find(".lm_tabs"),this.tabDropdownContainer=this.element.find(".lm_tabdropdown_list"),this.tabDropdownContainer.hide(),this.controlsContainer=this.element.find(".lm_controls"),this.workspaceControlsContainer="workspace"===this.layoutManager.config.settings.mode?this.element.find(".lm_workspace_controls"):void 0,this.tabsControlsContainer="workspace"!==this.layoutManager.config.settings.mode?this.element.find(".lm_tabs_controls"):void 0,this.parent=r,this.parent.on("resize",this._updateTabSizesWithoutDropdown,this),this.tabs=[],this.activeContentItem=null,this.closeButton=null,this.tabDropdownButton=null,this.hideAdditionalTabsDropdown=n.utils.fnBind(this._hideAdditionalTabsDropdown,this),t(document).mouseup(this.hideAdditionalTabsDropdown),this._lastVisibleTabIndex=-1,this._tabControlOffset=this.layoutManager.config.settings.tabControlOffset,"workspace"===this.layoutManager.config.settings.mode&&this.layoutManager._componentFactory&&this.layoutManager._componentFactory.createSystemButtons||this._createControls()},n.controls.Header._template=['<div class="lm_header">','<div class="lm_logo"></div>','<ul class="lm_tabs"></ul>','<ul class="lm_workspace_controls"></ul>','<ul class="lm_tabs_controls"></ul>','<div class="move_area"></div>','<ul class="lm_controls"></ul>','<ul class="lm_tabdropdown_list"></ul>',"</div>"].join(""),n.utils.copy(n.controls.Header.prototype,{createTab:function(e,t){var r,i;for(i=0;i<this.tabs.length;i++)if(this.tabs[i].contentItem===e)return;if(r=new n.controls.Tab(this,e),0===this.tabs.length)return this.tabs.push(r),void this.tabsContainer.append(r.element);void 0===t&&(t=this.tabs.length),t>0?this.tabs[t-1].element.after(r.element):this.tabs[0].element.before(r.element),this.tabs.splice(t,0,r),this._updateTabSizesWithoutDropdown()},removeTab:function(e){for(var t=0;t<this.tabs.length;t++)if(this.tabs[t].contentItem===e)return this.tabs[t]._$destroy(),void this.tabs.splice(t,1);throw new Error("contentItem is not controlled by this header")},setActiveContentItem:function(e){var t,n,r,i;for(t=0;t<this.tabs.length;t++)r=this.tabs[t].contentItem===e,this.tabs[t].setActive(r),!0===r&&(this.activeContentItem=e,this.parent.config.activeItemIndex=t);if(this.layoutManager.config.settings.reorderOnTabMenuClick&&-1!==this._lastVisibleTabIndex&&this.parent.config.activeItemIndex>this._lastVisibleTabIndex){for(i=this.tabs[this.parent.config.activeItemIndex],n=this.parent.config.activeItemIndex;n>0;n--)this.tabs[n]=this.tabs[n-1];this.tabs[0]=i,this.parent.config.activeItemIndex=0}this._updateTabSizesWithoutDropdown(),this.parent.emitBubblingEvent("stateChanged")},position:function(e){var t=this.parent._header.show;return t&&!this.parent._side&&(t="top"),void 0!==e&&this.parent._header.show!=e&&(this.parent._header.show=e,this.parent._setupHeaderPosition()),t},_$setClosable:function(e){return!(!this.closeButton||!this._isClosable()||(this.closeButton.element[e?"show":"hide"](),0))},_$destroy:function(){this.emit("destroy",this);for(var e=0;e<this.tabs.length;e++)this.tabs[e]._$destroy();t(document).off("mouseup",this.hideAdditionalTabsDropdown),this.element.remove()},_getHeaderSetting:function(e){if(e in this.parent._header)return this.parent._header[e]},_createControls:function(){var e,t,r,i,o,a,s,c,u;u=n.utils.fnBind(this._showAdditionalTabsDropdown,this),c=this.layoutManager.config.labels.tabDropdown,this.tabDropdownButton=new n.controls.HeaderButton(this,c,"lm_tabdropdown",u),this.tabDropdownButton.element.hide(),this._getHeaderSetting("popout")&&(t=n.utils.fnBind(this._onPopoutClick,this),r=this._getHeaderSetting("popout"),new n.controls.HeaderButton(this,r,"lm_popout",t)),this._getHeaderSetting("minimize")&&(minimizeLabel=this._getHeaderSetting("minimize"),minimizeButton=new n.controls.HeaderButton(this,minimizeLabel,"lm_minimise",void 0)),this._getHeaderSetting("maximize")&&("workspace"!==this.layoutManager.config.settings.mode&&(a=n.utils.fnBind(this.parent.toggleMaximise,this.parent)),i=this._getHeaderSetting("maximize"),s=new n.controls.HeaderButton(this,i,"lm_maximise",a),o=this._getHeaderSetting("restore"),this.parent.on("maximized",(function(){s.element.attr("title",o)})),this.parent.on("minimized",(function(){s.element.attr("title",i)}))),this._isClosable()&&("workspace"!==this.layoutManager.config.settings.mode&&(e=n.utils.fnBind(this.parent.remove,this.parent)),r=this._getHeaderSetting("close"),this.closeButton=new n.controls.HeaderButton(this,r,"lm_close",e))},_showAdditionalTabsDropdown:function(){this.tabDropdownContainer.show()},_hideAdditionalTabsDropdown:function(e){this.tabDropdownContainer.hide()},_isClosable:function(){return this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon},_onPopoutClick:function(){this.parent.emit("popoutRequested")},_onHeaderClick:function(e){e.target===this.element[0]&&this.parent.select()},_updateTabSizes:function(e){if(0!==this.tabs.length){this.tabDropdownButton.element.toggle(!0===e),this.element.css(this.parent._sided?"height":"width","");var t,n,r,i,o=this.element.outerWidth()-this.controlsContainer.outerWidth()-this._tabControlOffset,a=0,s=0,c=0,u=this.layoutManager.config.settings.tabOverlapAllowance,d=!1,l=this.activeContentItem?this.tabs.indexOf(this.activeContentItem.tab):0,p=this.tabs[l];for(this.parent._sided&&(o=this.element.outerHeight()-this.controlsContainer.outerHeight()-this._tabControlOffset),this._lastVisibleTabIndex=-1,n=0;n<this.tabs.length;n++)if(t=this.tabs[n].element,this.tabsContainer.append(t),a+=t.outerWidth()+parseInt(t.css("margin-right"),10),(s=l<=n?a:a+p.element.outerWidth()+parseInt(p.element.css("margin-right"),10))>o){if(d)n===l&&(t.css({"z-index":"auto","margin-left":""}),this.tabsContainer.append(t));else if((c=l>0&&l<=n?(s-o)/(n-1):(s-o)/n)<u){for(r=0;r<=n;r++)i=r!==l&&0!==r?"-"+c+"px":"",this.tabs[r].element.css({"z-index":n-r,"margin-left":i});this._lastVisibleTabIndex=n,this.tabsContainer.append(t)}else d=!0;if(d&&n!==l){if(!e)return void this._updateTabSizes(!0);t.css({"z-index":"auto","margin-left":""}),this.tabDropdownContainer.append(t)}}else this._lastVisibleTabIndex=n,t.css({"z-index":"auto","margin-left":""}),this.tabsContainer.append(t)}},_updateTabSizesWithoutDropdown:function(e){if(0!==this.tabs.length){this.element.css(this.parent._sided?"height":"width",""),this.element.outerWidth(),this.controlsContainer.outerWidth(),this._tabControlOffset;var t,n,r=(this.layoutManager.config.settings.tabOverlapAllowance,this.activeContentItem?this.tabs.indexOf(this.activeContentItem.tab):0),i=this.tabs[r];for(this.parent._sided&&(this.element.outerHeight(),this.controlsContainer.outerHeight(),this._tabControlOffset),n=0;n<this.tabs.length;n++)t=this.tabs[n].element,this.tabsContainer.append(t),t.outerWidth(),parseInt(t.css("margin-right"),10),r<=n||(i.element.outerWidth(),parseInt(i.element.css("margin-right"),10)),t.css({"z-index":"auto","margin-left":""}),this.tabsContainer.append(t)}}}),n.controls.HeaderButton=function(e,n,r,i){this._header=e,this.element=t('<li class="'+r+'" title="'+n+'"></li>'),this._header.on("destroy",this._$destroy,this),this._action=i,this.element.on("click touchstart",this._action),this._header.controlsContainer.append(this.element)},n.utils.copy(n.controls.HeaderButton.prototype,{_$destroy:function(){this.element.off(),this.element.remove()}}),n.controls.Splitter=function(e,t,r){this._isVertical=e,this._size=t,this._grabSize=r<t?t:r,this.element=this._createElement(),this._dragListener=new n.utils.DragListener(this.element)},n.utils.copy(n.controls.Splitter.prototype,{on:function(e,t,n){this._dragListener.on(e,t,n)},_$destroy:function(){this.element.remove()},_createElement:function(){var e=t('<div class="lm_drag_handle"></div>'),n=t('<div class="lm_splitter"></div>');n.append(e);var r=this._grabSize-this._size,i=r/2;return this._isVertical?(e.css("top",-i),e.css("height",this._size+r),n.addClass("lm_vertical"),n.height(this._size)):(e.css("left",-i),e.css("width",this._size+r),n.addClass("lm_horizontal"),n.width(this._size)),n}}),n.controls.Tab=function(e,r){this.header=e,this.contentItem=r,this.element=t(n.controls.Tab._template),this.titleElement=this.element.find(".lm_title"),this.closeElement=this.element.find(".lm_close_tab"),this.closeElement[r.config.isClosable?"show":"hide"](),this.isActive=!1,this.setTitle(r.config.title),this.contentItem.on("titleChanged",this.setTitle,this),this._layoutManager=this.contentItem.layoutManager,!0===this._layoutManager.config.settings.reorderEnabled&&!0===r.config.reorderEnabled&&(this._dragListener=new n.utils.DragListener(this.element),this._dragListener.on("dragStart",this._onDragStart,this),this.contentItem.on("destroy",this._dragListener.destroy,this._dragListener)),this._onTabClickFn=n.utils.fnBind(this._onTabClick,this),this._onCloseClickFn=n.utils.fnBind(this._onCloseClick,this),"workspace"===this._layoutManager.config.settings.mode&&r.config.noTabHeader&&this.element.hide(),this.element.on("mousedown touchstart",this._onTabClickFn),this.contentItem.config.isClosable?(this.closeElement.on("click touchstart",this._onCloseClickFn),this.closeElement.on("mousedown",this._onCloseMousedown)):this.closeElement.remove(),this.contentItem.tab=this,this.contentItem.emit("tab",this),this.contentItem.layoutManager.emit("tabCreated",this),this.contentItem.isComponent&&(this.contentItem.container.tab=this,this.contentItem.container.emit("tab",this))},n.controls.Tab._template='<li class="lm_tab"><i class="lm_left"></i><span class="lm_title"></span><div class="lm_close_tab"></div><i class="lm_right"></i></li>',n.utils.copy(n.controls.Tab.prototype,{setTitle:function(e){this.element.attr("title",n.utils.stripTags(e)),this.titleElement.html(e)},onCloseClick:void 0,setActive:function(e){e!==this.isActive&&(this.isActive=e,e?this.element.addClass("lm_active"):this.element.removeClass("lm_active"))},_$destroy:function(){this.element.off("mousedown touchstart",this._onTabClickFn),this.closeElement.off("click touchstart",this._onCloseClickFn),this._dragListener&&(this.contentItem.off("destroy",this._dragListener.destroy,this._dragListener),this._dragListener.off("dragStart",this._onDragStart),this._dragListener=null),this.element.remove()},_onDragStart:function(e,t){!0===this.contentItem.parent.isMaximized&&this.contentItem.parent.toggleMaximise();var r="workspace"===this.contentItem.layoutManager.config.settings.mode,i=this.contentItem.parent.header.tabs.length<2,o=!this.contentItem.config.windowId&&this.contentItem.config.componentState&&!this.contentItem.config.componentState.windowId;if((!r||!i)&&(r||!o)){var a=new n.controls.DragProxy(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent);this._layoutManager._dragProxies.push(a)}},_onTabClick:function(e){if(0===e.button||"touchstart"===e.type){var t=this.header.parent.getActiveContentItem();this.contentItem!==t&&this.header.parent.setActiveContentItem(this.contentItem)}else 1===e.button&&this.contentItem.config.isClosable&&this._onCloseClick(e)},_onCloseClick:function(e){this.contentItem.layoutManager.emit("tabCloseRequested",this),this.onCloseClick&&this.onCloseClick(e)},_onCloseMousedown:function(e){e.stopPropagation()}}),n.controls.TransitionIndicator=function(){this._element=t('<div class="lm_transition_indicator"></div>'),t(document.body).append(this._element),this._toElement=null,this._fromDimensions=null,this._totalAnimationDuration=200,this._animationStartTime=null},n.utils.copy(n.controls.TransitionIndicator.prototype,{destroy:function(){this._element.remove()},transitionElements:function(e,t){},_nextAnimationFrame:function(){var e,t=this._measure(this._toElement),r=(n.utils.now()-this._animationStartTime)/this._totalAnimationDuration,i={};if(r>=1)this._element.hide();else{for(e in t.opacity=0,this._fromDimensions)i[e]=this._fromDimensions[e]+(t[e]-this._fromDimensions[e])*r;this._element.css(i),n.utils.animFrame(n.utils.fnBind(this._nextAnimationFrame,this))}},_measure:function(e){var t=e.offset();return{left:t.left,top:t.top,width:e.outerWidth(),height:e.outerHeight()}}}),n.errors.ConfigurationError=function(e,t){Error.call(this),this.name="Configuration Error",this.message=e,this.node=t},n.errors.ConfigurationError.prototype=new Error,n.items.AbstractContentItem=function(e,t,r){n.utils.EventEmitter.call(this),this.config=this._extendItemNode(t),this.type=t.type,this.contentItems=[],this.parent=r,this.isInitialised=!1,this.isMaximized=!1,this.isRoot=!1,this.isRow=!1,this.isColumn=!1,this.isStack=!1,this.isComponent=!1,this.isVisible=!0,this.layoutManager=e,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(n.utils.EventEmitter.ALL_EVENT,this._propagateEvent,this),t.content&&this._createContentItems(t)},n.utils.copy(n.items.AbstractContentItem.prototype,{setSize:function(){throw new Error("Abstract Method")},callDownwards:function(e,t,n,r){var i;for(!0!==n&&!0!==r&&this[e].apply(this,t||[]),i=0;i<this.contentItems.length;i++)this.contentItems[i].callDownwards(e,t,n);!0===n&&!0!==r&&this[e].apply(this,t||[])},removeChild:function(e,t){var r=n.utils.indexOf(e,this.contentItems);if(-1===r)throw new Error("Can't remove child item. Unknown content item");!0!==t&&this.contentItems[r]._$destroy(),this.contentItems.splice(r,1),this.config.content.splice(r,1),this.contentItems.length>0?this.callDownwards("setSize"):this instanceof n.items.Root||!0!==this.config.isClosable||this.parent.removeChild(this)},addChild:function(e,t){void 0===t&&(t=this.contentItems.length),this.contentItems.splice(t,0,e),void 0===this.config.content&&(this.config.content=[]),this.config.content.splice(t,0,e.config),e.parent=this,!0===e.parent.isInitialised&&!1===e.isInitialised&&e._$init()},replaceChild:function(e,t,r){t=this.layoutManager._$normalizeContentItem(t);var i=n.utils.indexOf(e,this.contentItems),o=e.element[0].parentNode;if(-1===i)throw new Error("Can't replace child. oldChild is not child of this");o.replaceChild(t.element[0],e.element[0]);var a=e.isVisible;!0===r&&(e.parent=null,e._$destroy()),this.contentItems[i]=t,t.parent=this,this.isStack&&(this.header.tabs[i].contentItem=t),!0===t.parent.isInitialised&&!1===t.isInitialised&&t._$init(),a||t._$hide(),this.callDownwards("setSize")},remove:function(){this.parent.removeChild(this)},popout:function(){var e=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),e},toggleMaximise:function(e){e&&e.preventDefault(),!0===this.isMaximized?this.layoutManager._$minimiseItem(this):this.layoutManager._$maximiseItem(this),this.isMaximized=!this.isMaximized,this.emitBubblingEvent("stateChanged")},select:function(){this.layoutManager.selectedItem!==this&&(this.layoutManager.selectItem(this,!0),this.element.addClass("lm_selected"))},deselect:function(){this.layoutManager.selectedItem===this&&(this.layoutManager.selectedItem=null,this.element.removeClass("lm_selected"))},setTitle:function(e){this.config.title=e,this.emit("titleChanged",e),this.emit("stateChanged")},hasId:function(e){return!!this.config.id&&("string"==typeof this.config.id?this.config.id===e:this.config.id instanceof Array?-1!==n.utils.indexOf(e,this.config.id):void 0)},addId:function(e){this.hasId(e)||(this.config.id?"string"==typeof this.config.id?this.config.id=[this.config.id,e]:this.config.id instanceof Array&&this.config.id.push(e):this.config.id=e)},removeId:function(e){if(!this.hasId(e))throw new Error("Id not found");if("string"==typeof this.config.id)delete this.config.id;else if(this.config.id instanceof Array){var t=n.utils.indexOf(e,this.config.id);this.config.id.splice(t,1)}},getItemsByFilter:function(e){var t=[];return function n(r){for(var i=0;i<r.contentItems.length;i++)!0===e(r.contentItems[i])&&t.push(r.contentItems[i]),n(r.contentItems[i])}(this),t},getItemsById:function(e){return this.getItemsByFilter((function(t){return t.config.id instanceof Array?-1!==n.utils.indexOf(e,t.config.id):t.config.id===e}))},getItemsByType:function(e){return this._$getItemsByProperty("type",e)},getComponentsByName:function(e){var t,n=this._$getItemsByProperty("componentName",e),r=[];for(t=0;t<n.length;t++)r.push(n[t].instance&&0!==Object.keys(n[t].instance).length?n[t].instance:n[t]);return r},_$getItemsByProperty:function(e,t){return this.getItemsByFilter((function(n){return n[e]===t}))},_$setParent:function(e){this.parent=e},_$highlightDropZone:function(e,t,n){this.layoutManager.dropTargetIndicator.highlightArea(n)},_$onDrop:function(e){this.addChild(e)},_$hide:function(){this._callOnActiveComponents("hide"),this.element.hide(),this.isVisible=!1,this.layoutManager.updateSize()},_$show:function(){this._callOnActiveComponents("show"),this.element.show(),this.isVisible=!0,this.layoutManager.updateSize()},_callOnActiveComponents:function(e){var t,n,r=this.getItemsByType("stack");for(n=0;n<r.length;n++)(t=r[n].getActiveContentItem())&&t.isComponent&&t.container[e]()},_$destroy:function(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")},_$getArea:function(e){var t=(e=e||this.element).offset(),n=e.width(),r=e.height();return{x1:t.left,y1:t.top,x2:t.left+n,y2:t.top+r,surface:n*r,contentItem:this}},_$init:function(){var e;for(this.setSize(),e=0;e<this.contentItems.length;e++)this.childElementContainer.append(this.contentItems[e].element);this.isInitialised=!0,this.emitBubblingEvent("itemCreated"),this.emitBubblingEvent(this.type+"Created")},emitBubblingEvent:function(e){var t=new n.utils.BubblingEvent(e,this);this.emit(e,t)},_createContentItems:function(e){var t,r;if(!(e.content instanceof Array))throw new n.errors.ConfigurationError("content must be an Array",e);for(r=0;r<e.content.length;r++)t=this.layoutManager.createContentItem(e.content[r],this),this.contentItems.push(t)},_extendItemNode:function(e){for(var t in n.config.itemDefaultConfig)void 0===e[t]&&(e[t]=n.config.itemDefaultConfig[t]);return e},_propagateEvent:function(e,t){t instanceof n.utils.BubblingEvent&&!1===t.isPropagationStopped&&!0===this.isInitialised&&(!1===this.isRoot&&this.parent?this.parent.emit.apply(this.parent,Array.prototype.slice.call(arguments,0)):this._scheduleEventPropagationToLayoutManager(e,t))},_scheduleEventPropagationToLayoutManager:function(e,t){-1===n.utils.indexOf(e,this._throttledEvents)?this.layoutManager.emit(e,t.origin):!0!==this._pendingEventPropagations[e]&&(this._pendingEventPropagations[e]=!0,n.utils.animFrame(n.utils.fnBind(this._propagateEventToLayoutManager,this,[e,t])))},_propagateEventToLayoutManager:function(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}),n.items.Component=function(e,r,i){n.items.AbstractContentItem.call(this,e,r,i);var o=e.getComponent(this.config.componentName),a=t.extend(!0,{},this.config.componentState||{});a.componentName=this.config.componentName,this.componentName=this.config.componentName,""===this.config.title&&(this.config.title=this.config.componentName),this.isComponent=!0,this.container=new n.container.ItemContainer(this.config,this,e),this.instance=new o(this.container,a),this.element=this.container._element},n.utils.extend(n.items.Component,n.items.AbstractContentItem),n.utils.copy(n.items.Component.prototype,{close:function(){this.parent.removeChild(this)},setSize:function(){this.element.is(":visible")&&(this.emit("size-changed",{width:this.element.width(),height:this.element.height()}),this.container._$setSize(this.element.width(),this.element.height()))},_$init:function(){n.items.AbstractContentItem.prototype._$init.call(this),this.container.emit("open")},_$hide:function(){this.container.hide(),n.items.AbstractContentItem.prototype._$hide.call(this)},_$show:function(){this.container.show(),n.items.AbstractContentItem.prototype._$show.call(this)},_$shown:function(){this.container.shown(),n.items.AbstractContentItem.prototype._$shown.call(this)},_$destroy:function(){this.container.emit("destroy",this),n.items.AbstractContentItem.prototype._$destroy.call(this)},_$getArea:function(){return null}}),n.items.Root=function(e,r,i){n.items.AbstractContentItem.call(this,e,r,null),this.isRoot=!0,this.type="root",this.element=t('<div class="lm_goldenlayout lm_item lm_root"></div>'),this.childElementContainer=this.element,this._containerElement=i,this._containerElement.append(this.element)},n.utils.extend(n.items.Root,n.items.AbstractContentItem),n.utils.copy(n.items.Root.prototype,{addChild:function(e){if(this.contentItems.length>0)throw new Error("Root node can only have a single child");e=this.layoutManager._$normalizeContentItem(e,this),this.childElementContainer.append(e.element),n.items.AbstractContentItem.prototype.addChild.call(this,e),this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")},setSize:function(e,t){e=void 0===e?this._containerElement.width():e,t=void 0===t?this._containerElement.height():t,this.element.width(e),this.element.height(t),this.contentItems[0]&&(this.contentItems[0].element.width(e),this.contentItems[0].element.height(t))},_$highlightDropZone:function(e,t,r){this.layoutManager.tabDropPlaceholder.remove(),n.items.AbstractContentItem.prototype._$highlightDropZone.apply(this,arguments)},_$onDrop:function(e,t){var r;if(e.isComponent&&((r=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this))._$init(),r.addChild(e),e=r),this.contentItems.length){var i="x"==t.side[0]?"row":"column",o="x"==t.side[0]?"width":"height",a="2"==t.side[1],s=this.contentItems[0];if(!s instanceof n.items.RowOrColumn||s.type!=i){var c=this.layoutManager.createContentItem({type:i},this);this.replaceChild(s,c),c.addChild(e,a?0:void 0,!0),c.addChild(s,a?void 0:0,!0),s.config[o]=50,e.config[o]=50,c.callDownwards("setSize")}else{var u=s.contentItems[a?0:s.contentItems.length-1];s.addChild(e,a?0:void 0,!0),u.config[o]*=.5,e.config[o]=u.config[o],s.callDownwards("setSize")}}else this.addChild(e)}}),n.items.RowOrColumn=function(e,r,i,o){n.items.AbstractContentItem.call(this,r,i,o),this.isRow=!e,this.isColumn=e,this.element=t('<div class="lm_item lm_'+(e?"column":"row")+'"></div>'),this.childElementContainer=this.element,this._splitterSize=r.config.dimensions.borderWidth,this._splitterGrabSize=r.config.dimensions.borderGrabWidth,this._isColumn=e,this._dimension=e?"height":"width",this._splitter=[],this._splitterPosition=null,this._splitterMinPosition=null,this._splitterMaxPosition=null,this._layoutManager=r},n.utils.extend(n.items.RowOrColumn,n.items.AbstractContentItem),n.utils.copy(n.items.RowOrColumn.prototype,{addChild:function(e,t,r){var i,o,a,s;if(e=this.layoutManager._$normalizeContentItem(e,this),void 0===t&&(t=this.contentItems.length),this.contentItems.length>0?(s=this._createSplitter(Math.max(0,t-1)).element,t>0?(this.contentItems[t-1].element.after(s),s.after(e.element)):(this.contentItems[0].element.before(s),s.before(e.element))):this.childElementContainer.append(e.element),n.items.AbstractContentItem.prototype.addChild.call(this,e,t),i=1/this.contentItems.length*100,!0!==r){for(a=0;a<this.contentItems.length;a++)this.contentItems[a]===e?e.config[this._dimension]=i:(o=this.contentItems[a].config[this._dimension]*=(100-i)/100,this.contentItems[a].config[this._dimension]=o);this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}else this.emitBubblingEvent("stateChanged")},removeChild:function(e,t){var r,i,o=e.config[this._dimension],a=n.utils.indexOf(e,this.contentItems),s=Math.max(a-1,0);if(-1===a)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[s]&&(this._splitter[s]._$destroy(),this._splitter.splice(s,1)),r=0;r<this.contentItems.length;r++)this.contentItems[r]!==e&&(this.contentItems[r].config[this._dimension]+=o/(this.contentItems.length-1));n.items.AbstractContentItem.prototype.removeChild.call(this,e,t),1===this.contentItems.length&&!0===this.config.isClosable?(i=this.contentItems[0],this.contentItems=[],this.parent.replaceChild(this,i,!0)):(this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged"))},replaceChild:function(e,t){var r=e.config[this._dimension];t.config=t.config||{},t.config[this._dimension]=r,n.items.AbstractContentItem.prototype.replaceChild.call(this,e,t),this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")},setSize:function(){this.contentItems.length>0&&(this._calculateRelativeSizes(),this._setAbsoluteSizes()),this.emitBubblingEvent("stateChanged"),this.emit("resize")},_$init:function(){var e;if(!0!==this.isInitialised)for(n.items.AbstractContentItem.prototype._$init.call(this),e=0;e<this.contentItems.length-1;e++)this.contentItems[e].element.after(this._createSplitter(e).element)},_setAbsoluteSizes:function(){var e,t=this._calculateAbsoluteSizes();for(e=0;e<this.contentItems.length;e++)t.additionalPixel-e>0&&t.itemSizes[e]++,this._isColumn?(this.contentItems[e].element.width(t.totalWidth),this.contentItems[e].element.height(t.itemSizes[e])):(this.contentItems[e].element.width(t.itemSizes[e]),this.contentItems[e].element.height(t.totalHeight))},_calculateAbsoluteSizes:function(){var e,t,n=(this.contentItems.length-1)*this._splitterSize,r=this.element.width(),i=this.element.height(),o=0,a=[];for(this._isColumn?i-=n:r-=n,e=0;e<this.contentItems.length;e++)o+=t=this._isColumn?Math.floor(i*(this.contentItems[e].config.height/100)):Math.floor(r*(this.contentItems[e].config.width/100)),a.push(t);return{itemSizes:a,additionalPixel:Math.floor((this._isColumn?i:r)-o),totalWidth:r,totalHeight:i}},_calculateRelativeSizes:function(){var e,t=0,n=[],r=this._isColumn?"height":"width";for(e=0;e<this.contentItems.length;e++)void 0!==this.contentItems[e].config[r]?t+=this.contentItems[e].config[r]:n.push(this.contentItems[e]);if(100!==Math.round(t))if(Math.round(t)<100&&n.length>0){for(e=0;e<n.length;e++)n[e].config[r]=(100-t)/n.length;this._respectMinItemWidth()}else{if(Math.round(t)>100)for(e=0;e<n.length;e++)n[e].config[r]=50,t+=50;for(e=0;e<this.contentItems.length;e++)this.contentItems[e].config[r]=this.contentItems[e].config[r]/t*100;this._respectMinItemWidth()}else this._respectMinItemWidth()},_respectMinItemWidth:function(){var e,t,n,r,i=this.layoutManager.config.dimensions&&this.layoutManager.config.dimensions.minItemWidth||0,o=[],a=0,s=0,c=0,u=0,d=[];if(!(this._isColumn||!i||this.contentItems.length<=1)){e=this._calculateAbsoluteSizes();for(var l=0;l<this.contentItems.length;l++)this.contentItems[l],(u=e.itemSizes[l])<i?(s+=i-u,r={width:i}):(a+=u-i,r={width:u},o.push(r)),d.push(r);if(!(0===s||s>a)){for(t=s/a,c=s,l=0;l<o.length;l++)r=o[l],c-=n=Math.round((r.width-i)*t),r.width-=n;for(0!==c&&(d[d.length-1].width-=c),l=0;l<this.contentItems.length;l++)this.contentItems[l].config.width=d[l].width/e.totalWidth*100}}},_createSplitter:function(e){var t;return(t=new n.controls.Splitter(this._isColumn,this._splitterSize,this._splitterGrabSize)).on("drag",n.utils.fnBind(this._onSplitterDrag,this,[t]),this),t.on("dragStop",n.utils.fnBind(this._onSplitterDragStop,this,[t]),this),t.on("dragStart",n.utils.fnBind(this._onSplitterDragStart,this,[t]),this),this._splitter.splice(e,0,t),t},_getItemsForSplitter:function(e){var t=n.utils.indexOf(e,this._splitter);return{before:this.contentItems[t],after:this.contentItems[t+1]}},_getMinimumDimensions:function(e){for(var t=0,n=0,r=0;r<e.length;++r)t=Math.max(e[r].minWidth||0,t),n=Math.max(e[r].minHeight||0,n);return{horizontal:t,vertical:n}},_onSplitterDragStart:function(e){var t=this._getItemsForSplitter(e),n=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],r=this._getMinimumDimensions(t.before.config.content),i=this._isColumn?r.vertical:r.horizontal,o=this._getMinimumDimensions(t.after.config.content),a=this._isColumn?o.vertical:o.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(t.before.element[this._dimension]()-(i||n)),this._splitterMaxPosition=t.after.element[this._dimension]()-(a||n)},_onSplitterDrag:function(e,t,n){var r=this._isColumn?n:t;r>this._splitterMinPosition&&r<this._splitterMaxPosition&&(this._splitterPosition=r,e.element.css(this._isColumn?"top":"left",r)),this._layoutManager.emit("splitterDragged",e)},_onSplitterDragStop:function(e){var t=this._getItemsForSplitter(e),r=t.before.element[this._dimension](),i=t.after.element[this._dimension](),o=(this._splitterPosition+r)/(r+i),a=t.before.config[this._dimension]+t.after.config[this._dimension];t.before.config[this._dimension]=o*a,t.after.config[this._dimension]=(1-o)*a,e.element.css({top:0,left:0}),n.utils.animFrame(n.utils.fnBind(this.callDownwards,this,["setSize"])),this._layoutManager.emit("splitterDragStopped",e)}}),n.items.Stack=function(e,r,i){n.items.AbstractContentItem.call(this,e,r,i),this.element=t('<div class="lm_item lm_stack"></div>'),this._activeContentItem=null;var o=e.config;this._header={show:!0===o.settings.hasHeaders&&!1!==r.hasHeaders,popout:o.settings.showPopoutIcon&&o.labels.popout,maximize:o.settings.showMaximizeIcon&&o.labels.maximize,minimize:o.settings.showMinimizeIcon&&o.labels.minimize,close:o.settings.showCloseIcon&&o.labels.close},o.header&&n.utils.copy(this._header,o.header),r.header&&n.utils.copy(this._header,r.header),r.content&&r.content[0]&&r.content[0].header&&n.utils.copy(this._header,r.content[0].header),this._dropZones={},this._dropSegment=null,this._contentAreaDimensions=null,this._dropIndex=null,this.isStack=!0,this.childElementContainer=t('<div class="lm_items"></div>'),this.header=new n.controls.Header(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()},n.utils.extend(n.items.Stack,n.items.AbstractContentItem),n.utils.copy(n.items.Stack.prototype,{setSize:function(){var e,t=this._header.show?this.header.element.height():0,n=this.element.width()-(this._sided?t:0),r=this.element.height()-(this._sided?0:t);for(this.childElementContainer.width(n),this.childElementContainer.height(r),e=0;e<this.contentItems.length;e++)this.contentItems[e].element.width(n).height(r);this.emit("resize"),this.emitBubblingEvent("stateChanged")},_$init:function(){var e,t;if(!0!==this.isInitialised){for(n.items.AbstractContentItem.prototype._$init.call(this),e=0;e<this.contentItems.length;e++)this.header.createTab(this.contentItems[e]),this.contentItems[e]._$hide();if(this.contentItems.length>0){if(!(t=this.contentItems[this.config.activeItemIndex||0]))throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(t)}}},setActiveContentItem:function(e){if(-1===n.utils.indexOf(e,this.contentItems))throw new Error("contentItem is not a child of this stack");var t=this._activeContentItem;null!==this._activeContentItem&&this._activeContentItem._$hide(),this._activeContentItem=e,this.header.setActiveContentItem(e),e._$show(),this.emit("activeContentItemChanged",e),this.layoutManager.emit("activeContentItemChanged",e),t&&t.emit("focusLost"),this.emitBubblingEvent("stateChanged")},getActiveContentItem:function(){return this.header.activeContentItem},addChild:function(e,r){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];e=this.layoutManager._$normalizeContentItem(e,this),n.items.AbstractContentItem.prototype.addChild.call(this,e,r),this.childElementContainer.append(e.element),this.header.createTab(e,r),t(this.layoutManager.container).is(":visible")&&i?this.setActiveContentItem(e):e._$hide(),this.callDownwards("setSize"),this._$validateClosability(),this.emitBubblingEvent("stateChanged")},removeChild:function(e,t){var r=n.utils.indexOf(e,this.contentItems);n.items.AbstractContentItem.prototype.removeChild.call(this,e,t),this.header.removeTab(e),this.header.activeContentItem===e&&(this.contentItems.length>0?this.setActiveContentItem(this.contentItems[Math.max(r-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")},_$validateClosability:function(){var e,t,n;for(e=this.header._isClosable(),n=0,t=this.contentItems.length;n<t&&e;n++)e=this.contentItems[n].config.isClosable;this.header._$setClosable(e)},_$destroy:function(){n.items.AbstractContentItem.prototype._$destroy.call(this),this.header._$destroy()},_$onDrop:function(e){if("header"===this._dropSegment)return this._resetHeaderDropZone(),void this.addChild(e,this._dropIndex);if("body"!==this._dropSegment){var t,r,i,o="top"===this._dropSegment||"bottom"===this._dropSegment,a="left"===this._dropSegment||"right"===this._dropSegment,s="top"===this._dropSegment||"left"===this._dropSegment,c=o&&this.parent.isColumn||a&&this.parent.isRow,u=o?"column":"row",d=o?"height":"width";e.isComponent&&((r=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this))._$init(),r.addChild(e),e=r),c?(t=n.utils.indexOf(this,this.parent.contentItems),this.parent.addChild(e,s?t:t+1,!0),this.config[d]*=.5,e.config[d]=this.config[d],this.parent.callDownwards("setSize")):(u=o?"column":"row",i=this.layoutManager.createContentItem({type:u},this),this.parent.replaceChild(this,i),i.addChild(e,s?0:void 0,!0),i.addChild(this,s?void 0:0,!0),this.config[d]=50,e.config[d]=50,i.callDownwards("setSize"))}else this.addChild(e)},_$highlightDropZone:function(e,t){var n,r;for(n in this._contentAreaDimensions)if((r=this._contentAreaDimensions[n].hoverArea).x1<e&&r.x2>e&&r.y1<t&&r.y2>t)return void("header"===n?(this._dropSegment="header",this._highlightHeaderDropZone(this._sided?t:e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(n)))},_$getArea:function(){if(!1===this.element.is(":visible"))return null;var e=n.items.AbstractContentItem.prototype._$getArea,t=e.call(this,this.header.element),r=e.call(this,this.childElementContainer),i=r.x2-r.x1,o=r.y2-r.y1;return this._contentAreaDimensions={header:{hoverArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}}},this._activeContentItem&&!1===this._activeContentItem.isComponent?t:0===this.contentItems.length?(this._contentAreaDimensions.body={hoverArea:{x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2},highlightArea:{x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2}},e.call(this,this.element)):("workspace"!==this.layoutManager.config.settings.mode&&(this._contentAreaDimensions.left={hoverArea:{x1:r.x1,y1:r.y1,x2:r.x1+.25*i,y2:r.y2},highlightArea:{x1:r.x1,y1:r.y1,x2:r.x1+.5*i,y2:r.y2}},this._contentAreaDimensions.top={hoverArea:{x1:r.x1+.25*i,y1:r.y1,x2:r.x1+.75*i,y2:r.y1+.5*o},highlightArea:{x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y1+.5*o}},this._contentAreaDimensions.right={hoverArea:{x1:r.x1+.75*i,y1:r.y1,x2:r.x2,y2:r.y2},highlightArea:{x1:r.x1+.5*i,y1:r.y1,x2:r.x2,y2:r.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:r.x1+.25*i,y1:r.y1+.5*o,x2:r.x1+.75*i,y2:r.y2},highlightArea:{x1:r.x1,y1:r.y1+.5*o,x2:r.x2,y2:r.y2}}),e.call(this,this.element))},_highlightHeaderDropZone:function(e){var t,n,r,i,o,a,s,c,u=this.header.tabs.length,d=!1;if(0===u)return s=this.header.element.offset(),void this.layoutManager.dropTargetIndicator.highlightArea({x1:s.left,x2:s.left+100,y1:s.top+this.header.element.height()-20,y2:s.top+this.header.element.height()});for(t=0;t<u;t++)if(o=(n=this.header.tabs[t].element).offset(),this._sided?(i=o.top,r=o.left,c=n.height()):(i=o.left,r=o.top,c=n.width()),e>i&&e<i+c){d=!0;break}if(!(!1===d&&e<i)){if(e<i+c/2?(this._dropIndex=t,n.before(this.layoutManager.tabDropPlaceholder)):(this._dropIndex=Math.min(t+1,u),n.after(this.layoutManager.tabDropPlaceholder)),this._sided)return placeHolderTop=this.layoutManager.tabDropPlaceholder.offset().top,void this.layoutManager.dropTargetIndicator.highlightArea({x1:r,x2:r+n.innerHeight(),y1:placeHolderTop,y2:placeHolderTop+this.layoutManager.tabDropPlaceholder.width()});a=this.layoutManager.tabDropPlaceholder.offset().left,this.layoutManager.dropTargetIndicator.highlightArea({x1:a,x2:a+this.layoutManager.tabDropPlaceholder.width(),y1:r,y2:r+n.innerHeight()})}},_resetHeaderDropZone:function(){this.layoutManager.tabDropPlaceholder.remove()},_setupHeaderPosition:function(){var e=["right","left","bottom"].indexOf(this._header.show)>=0&&this._header.show;if(this.header.element.toggle(!!this._header.show),this._side=e,this._sided=["right","left"].indexOf(this._side)>=0,this.element.removeClass("lm_left lm_right lm_bottom"),this._side&&this.element.addClass("lm_"+this._side),this.element.find(".lm_header").length&&this.childElementContainer){var t=["right","bottom"].indexOf(this._side)>=0?"before":"after";this.header.element[t](this.childElementContainer),this.callDownwards("setSize")}},_highlightBodyDropZone:function(e){var t=this._contentAreaDimensions[e].highlightArea;this.layoutManager.dropTargetIndicator.highlightArea(t),this._dropSegment=e}}),n.utils.BubblingEvent=function(e,t){this.name=e,this.origin=t,this.isPropagationStopped=!1},n.utils.BubblingEvent.prototype.stopPropagation=function(){this.isPropagationStopped=!0},n.utils.ConfigMinifier=function(){if(this._keys=["settings","hasHeaders","constrainDragToContainer","selectionEnabled","dimensions","borderWidth","minItemHeight","minItemWidth","headerHeight","dragProxyWidth","dragProxyHeight","labels","close","maximize","minimize","popout","content","componentName","componentState","id","width","type","height","isClosable","title","popoutWholeStack","openPopouts","parentId","activeItemIndex","reorderEnabled","borderGrabWidth"],this._keys.length>36)throw new Error("Too many keys in config minifier map");this._values=[!0,!1,"row","column","stack","component","close","maximize","minimize","open in new window"]},n.utils.copy(n.utils.ConfigMinifier.prototype,{minifyConfig:function(e){var t={};return this._nextLevel(e,t,"_min"),t},unminifyConfig:function(e){var t={};return this._nextLevel(e,t,"_max"),t},_nextLevel:function(e,t,n){var r,i;for(r in e)e instanceof Array&&(r=parseInt(r,10)),e.hasOwnProperty(r)&&(i=this[n](r,this._keys),"object"==typeof e[r]?(t[i]=e[r]instanceof Array?[]:{},this._nextLevel(e[r],t[i],n)):t[i]=this[n](e[r],this._values))},_min:function(e,t){if("string"==typeof e&&1===e.length)return"___"+e;var r=n.utils.indexOf(e,t);return-1===r?e:r.toString(36)},_max:function(e,t){return"string"==typeof e&&1===e.length?t[parseInt(e,36)]:"string"==typeof e&&"___"===e.substr(0,3)?e[3]:e}}),n.utils.EventHub=function(e){n.utils.EventEmitter.call(this),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(n.utils.EventEmitter.ALL_EVENT,n.utils.fnBind(this._onEventFromThis,this)),this._boundOnEventFromChild=n.utils.fnBind(this._onEventFromChild,this),t(window).on("gl_child_event",this._boundOnEventFromChild)},n.utils.EventHub.prototype._onEventFromThis=function(){var e=Array.prototype.slice.call(arguments);this._layoutManager.isSubWindow&&e[0]!==this._dontPropagateToParent&&this._propagateToParent(e),this._propagateToChildren(e),this._dontPropagateToParent=null,this._childEventSource=null},n.utils.EventHub.prototype._$onEventFromParent=function(e){this._dontPropagateToParent=e[0],this.emit.apply(this,e)},n.utils.EventHub.prototype._onEventFromChild=function(e){this._childEventSource=e.originalEvent.__gl,this.emit.apply(this,e.originalEvent.__glArgs)},n.utils.EventHub.prototype._propagateToParent=function(e){var t,n="gl_child_event";document.createEvent?(t=window.opener.document.createEvent("HTMLEvents")).initEvent(n,!0,!0):(t=window.opener.document.createEventObject()).eventType=n,t.eventName=n,t.__glArgs=e,t.__gl=this._layoutManager,document.createEvent?window.opener.dispatchEvent(t):window.opener.fireEvent("on"+t.eventType,t)},n.utils.EventHub.prototype._propagateToChildren=function(e){var t,n;for(n=0;n<this._layoutManager.openPopouts.length;n++)(t=this._layoutManager.openPopouts[n].getGlInstance())&&t!==this._childEventSource&&t.eventHub._$onEventFromParent(e)},n.utils.EventHub.prototype.destroy=function(){t(window).off("gl_child_event",this._boundOnEventFromChild)},n.utils.ReactComponentHandler=function(e,t){this._reactComponent=null,this._originalComponentWillUpdate=null,this._container=e,this._initialState=t,this._reactClass=this._getReactClass(),this._container.on("open",this._render,this),this._container.on("destroy",this._destroy,this)},n.utils.copy(n.utils.ReactComponentHandler.prototype,{_render:function(){this._reactComponent=ReactDOM.render(this._getReactComponent(),this._container.getElement()[0]),this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate||function(){},this._reactComponent.componentWillUpdate=this._onUpdate.bind(this),this._container.getState()&&this._reactComponent.setState(this._container.getState())},_destroy:function(){ReactDOM.unmountComponentAtNode(this._container.getElement()[0]),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)},_onUpdate:function(e,t){this._container.setState(t),this._originalComponentWillUpdate.call(this._reactComponent,e,t)},_getReactClass:function(){var e,t=this._container._config.component;if(!t)throw new Error("No react component name. type: react-component needs a field `component`");if(!(e=this._container.layoutManager.getComponent(t)))throw new Error('React component "'+t+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return e},_getReactComponent:function(){var e={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container},n=t.extend(e,this._container._config.props);return React.createElement(this._reactClass,n)}})}(window.$)}));function R(e){if(e&&e.errorHandling&&"function"!=typeof e.errorHandling&&"log"!==e.errorHandling&&"silent"!==e.errorHandling&&"throw"!==e.errorHandling)throw new Error('Invalid options passed to createRegistry. Prop errorHandling should be ["log" | "silent" | "throw" | (err) => void], but '+typeof e.errorHandling+" was passed");var t=e&&"function"==typeof e.errorHandling&&e.errorHandling,n={};function r(n,r){var i=n instanceof Error?n:new Error(n);if(t)t(i);else{var o='[ERROR] callback-registry: User callback for key "'+r+'" failed: '+i.stack;if(e)switch(e.errorHandling){case"log":return console.error(o);case"silent":return;case"throw":throw new Error(o)}console.error(o)}}return{add:function(e,t,i){var o=n[e];return o||(o=[],n[e]=o),o.push(t),i&&setTimeout((function(){i.forEach((function(i){var o;if(null===(o=n[e])||void 0===o?void 0:o.includes(t))try{Array.isArray(i)?t.apply(void 0,i):t.apply(void 0,[i])}catch(t){r(t,e)}}))}),0),function(){var r=n[e];r&&(0===(r=r.reduce((function(e,n,r){return n===t&&e.length===r||e.push(n),e}),[])).length?delete n[e]:n[e]=r)}},execute:function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];var o=n[e];if(!o||0===o.length)return[];var a=[];return o.forEach((function(n){try{var i=n.apply(void 0,t);a.push(i)}catch(t){a.push(void 0),r(t,e)}})),a},clear:function(){n={}},clearKey:function(e){n[e]&&delete n[e]}}}R.default=R;var F,B,z,H=R,q=function(e){return Array.isArray(e)?e[0]:e},U=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=function e(t){return"component"===t.type?t.id?[t]:[]:t.content.reduce((function(t,n){return[].concat(Object(u.a)(t),Object(u.a)(e(n)))}),[])};return e.reduce((function(e,n){return[].concat(Object(u.a)(e),Object(u.a)(t(n)))}),[])},G=function(e){var t=$(e)[0].getBoundingClientRect();return{x:Math.round(t.x),y:Math.round(t.y),left:Math.round(t.left),top:Math.round(t.top),width:Math.round(t.width),height:Math.round(t.height)}},V=function(e){return"___workspace___"+e},J=new(function(){function e(){Object(s.a)(this,e),this._idToLayout={}}return Object(c.a)(e,[{key:"getWorkspaceLayoutItemById",value:function(e){return this.workspaceLayout.root.getItemsById(e)[0]}},{key:"getById",value:function(e){return e=q(e),this._idToLayout[e]}},{key:"getByContainerId",value:function(e){return this._idToLayout[e]||this.getByContainerIdCore(e)}},{key:"getWorkspaceTitle",value:function(e){var t=this.workspaceLayout.root.getItemsById(e)[0];return(null==t?void 0:t.tab.titleElement[0].innerText)||(null==t?void 0:t.config.title)}},{key:"removeById",value:function(e){delete this._idToLayout[e]}},{key:"removeLayout",value:function(e){var t;null===(t=this._idToLayout[e].layout)||void 0===t||t.destroy(),this._idToLayout[e].layout=void 0}},{key:"addOrUpdate",value:function(e,t,n){var r=this.getById(e);if(r)return r.layout=n,void(r.windows=this.mergeWindows(r.windows,t));this._idToLayout[e]={id:e,windows:t,layout:n,hibernatedWindows:[],lastActive:Date.now()}}},{key:"getWindow",value:function(e){var t=q(e);return this.layouts.reduce((function(e,n){return e||n.windows.find((function(e){return e.id===t||e.windowId===t}))}),void 0)}},{key:"getActiveWorkspace",value:function(){var e=this.workspaceLayout.root.contentItems[0].getActiveContentItem().config.id;return this.getById(e)}},{key:"addWindow",value:function(e,t){var n=this.getById(t);n.windows=n.windows.filter((function(t){return t.id!==e.id})),n.windows.push(e)}},{key:"getByWindowId",value:function(e){return e=q(e),this.layouts.find((function(t){return t.windows.some((function(t){return t.id===e||t.windowId===e}))}))}},{key:"getWindowContentItem",value:function(e){var t=this.layouts.filter((function(e){return e.layout})).reduce((function(t,n){return t||n.layout.root.getItemsById(e)[0]}),void 0);if(t&&t.isComponent)return t;var n=this.layouts.filter((function(e){return e.layout})).reduce((function(t,n){return t||n.layout.root.getItemsByFilter((function(t){return t.isComponent&&t.config.componentState.windowId===e}))[0]}),void 0);return(null==n?void 0:n.isComponent)?n:void 0}},{key:"getContainer",value:function(e){return this.layouts.reduce((function(e,t){return t.layout&&e.push(t.layout),e}),[]).reduce((function(t,n){return t||n.root.getItemsById(e)[0]}),void 0)}},{key:"getWorkspaceContext",value:function(e){var t,n,r,i=this.getById(e);return null===(r=null===(n=null===(t=null==i?void 0:i.layout)||void 0===t?void 0:t.config)||void 0===n?void 0:n.workspacesOptions)||void 0===r?void 0:r.context}},{key:"getWorkspaceContentItem",value:function(e){return this.workspaceLayout.root.getItemsById(e)[0]}},{key:"getByContainerIdCore",value:function(e){return this.layouts.reduce((function(e,t){return t.layout&&e.push(t),e}),[]).find((function(t){return t.layout.root.getItemsById(e)[0]}))}},{key:"mergeWindows",value:function(e,t){return t.map((function(t){var n=t.windowId;if(!n){var r=e.find((function(e){return e.id===t.id}));n=null==r?void 0:r.windowId}return Object.assign(Object.assign({},t),{windowId:n})}))}},{key:"layouts",get:function(){return Object.values(this._idToLayout)}},{key:"workspaceIds",get:function(){return Object.keys(this._idToLayout)}},{key:"workspaceTitles",get:function(){var e=this;return this.workspaceIds.map((function(t){return e.getWorkspaceTitle(t)}))}},{key:"workspaceLayout",set:function(e){this._workspaceLayout=e},get:function(){return this._workspaceLayout}},{key:"workspaceLayoutHeader",get:function(){return this._workspaceLayout.root.contentItems[0].header}}]),e}()),K=function(){function e(){Object(s.a)(this,e)}return Object(c.a)(e,[{key:"init",value:function(e){this.containerElement=$(e)[0],this.setupEvents()}},{key:"setupEvents",value:function(){var e=this,t=new MutationObserver((function(t){Array.from(t).forEach((function(t){if("childList"===t.type&&t.target.classList.contains("lm_tabs")){var n=$(t.target);e.handleTabCountChanged(n,Array.from(t.removedNodes))}else if("attributes"===t.type&&t.target.classList.contains("lm_stack")&&"style"===t.attributeName){var r=$(t.target);e.handleTabHeaderResized(r)}}))}));return t.observe(this.containerElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1}),function(){t.disconnect()}}},{key:"handleTabCountChanged",value:function(e,t){var n=this,r=e.children(),i=this.visibleTabs($(e));e.css("max-width",200*i.length+"px");var o=e.width()/i.length;Array.from(r).forEach((function(e){$(e).children(".lm_title").css("max-width",.75*o+"px"),t.length&&n.refreshTabClasses(e)}))}},{key:"handleTabHeaderResized",value:function(e){var t=this,n=e.children(".lm_header").children(".lm_tabs"),r=this.visibleTabs($(n)),i=n.width()/r.length;Array.from(n.children()).forEach((function(e){$(e).children(".lm_title").css("max-width",.65*i+"px"),t.refreshTabClasses(e)}))}},{key:"refreshTabClasses",value:function(e){var t=$(e).outerWidth(),n=e.classList;t>=25&&t<35?(n.contains("lm_tab_mini")&&n.remove("lm_tab_mini"),n.add("lm_tab_small")):t>=35?(n.remove("lm_tab_small"),n.contains("lm_tab_mini")&&n.remove("lm_tab_mini")):t<25&&(n.remove("lm_tab_small"),n.add("lm_tab_mini"))}},{key:"visibleTabs",value:function(e){return Array.from(e.children()).filter((function(e){return $(e).is(":visible")}))}}]),e}(),X=new(function(){function e(){var t=this;Object(s.a)(this,e),this.visibilityState={logo:void 0,addWorkspace:void 0,systemButtons:void 0,workspaceContents:[]},this.componentsFactory={},this._decoratedFactory={},this.callbackRegistry=H(),this.observer=new MutationObserver((function(e){Array.from(e).forEach((function(e){var n=e.target,r=t.getWorkspaceIdFromContents(n),i="none"===n.style.display?"workspace-contents-hidden":"workspace-contents-shown";t.callbackRegistry.execute(i,r)}))}))}return Object(c.a)(e,[{key:"init",value:function(e,t){var n=this;this.componentsFactory=t,(null==t?void 0:t.createAddWorkspace)&&(this.decoratedFactory.createAddWorkspace=function(){for(var t,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return n.visibilityState.addWorkspace=[].concat(i,[e]),(t=n.componentsFactory).createAddWorkspace.apply(t,Object(u.a)(n.visibilityState.addWorkspace))}),(null==t?void 0:t.createLogo)&&(this.decoratedFactory.createLogo=function(){for(var t,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return n.visibilityState.logo=[].concat(i,[e]),(t=n.componentsFactory).createLogo.apply(t,Object(u.a)(n.visibilityState.logo))}),(null==t?void 0:t.createSystemButtons)&&(this.decoratedFactory.createSystemButtons=function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return n.visibilityState.systemButtons=[].concat(i,[e]),t.createSystemButtons.apply(t,Object(u.a)(n.visibilityState.systemButtons))}),(null==t?void 0:t.createWorkspaceContents)&&(this.decoratedFactory.createWorkspaceContents=function(){for(var e,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return n.visibilityState.workspaceContents.push([].concat(i)),n.subscribeForWorkspaceContentsVisibility(null===(e=i[0])||void 0===e?void 0:e.workspaceId),t.createWorkspaceContents.apply(t,i)})}},{key:"reInitialize",value:function(e){(null==e?void 0:e.createAddWorkspace)&&this.visibilityState.addWorkspace&&e.createAddWorkspace.apply(e,Object(u.a)(this.visibilityState.addWorkspace)),(null==e?void 0:e.createLogo)&&this.visibilityState.logo&&e.createLogo.apply(e,Object(u.a)(this.visibilityState.logo)),(null==e?void 0:e.createSystemButtons)&&this.visibilityState.systemButtons&&e.createSystemButtons.apply(e,Object(u.a)(this.visibilityState.systemButtons)),(null==e?void 0:e.createWorkspaceContents)&&this.visibilityState.workspaceContents.forEach((function(t){e.createWorkspaceContents.apply(e,Object(u.a)(t))})),this.componentsFactory=e}},{key:"onWorkspaceContentsShown",value:function(e){this.callbackRegistry.add("workspace-contents-shown",e)}},{key:"onWorkspaceContentsHidden",value:function(e){this.callbackRegistry.add("workspace-contents-hidden",e)}},{key:"subscribeForWorkspaceContentsVisibility",value:function(e){var t=document.getElementById("nestHere"+e);t&&this.observer.observe(t,{attributes:!0,attributeFilter:["style"]})}},{key:"getWorkspaceIdFromContents",value:function(e){return e.id.split("nestHere")[1]}},{key:"decoratedFactory",get:function(){return this._decoratedFactory}}]),e}()),Y=n(17).default||n(17),Z=function(){function e(t,n,r,i){Object(s.a)(this,e),this._maximizedId="__glMaximised",this._workspaceLayoutElementId="#outter-layout-container",this._registry=H(),this._emptyVisibleWindowName="emptyVisibleWindow",this._stackMaximizeLabel="maximize",this._stackRestoreLabel="restore",this._options=r,this._emitter=t,this._stateResolver=n,this._configFactory=i}return Object(c.a)(e,[{key:"init",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){var n=this;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._frameId=e.frameId,(new K).init(this._workspaceLayoutElementId),t.next=4,this.initWorkspaceConfig(e.workspaceLayout);case 4:return this.refreshLayoutSize(),t.next=7,Promise.all(e.workspaceConfigs.map((function(e){return j(n,void 0,void 0,a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.initWorkspaceContents(e.id,e.config);case 2:this.emitter.raiseEvent("workspace-added",{workspace:J.getById(e.id)});case 3:case"end":return t.stop()}}),t,this)})))})));case 7:this.setupOuterLayout(),J.workspaceIds.forEach((function(e){n.setupContentLayouts(e)}));case 9:case"end":return t.stop()}}),t,this)})))}},{key:"addWindow",value:function(e,t){return j(this,void 0,void 0,a.a.mark((function n(){var r,i,o,s,c,u,d=this;return a.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(t=t||q(J.workspaceLayout.root.contentItems[0].getActiveContentItem().config.id),r=J.getByContainerId(t),!this._stateResolver.isWorkspaceHibernated(r.id)){n.next=4;break}throw new Error("Could not add window to ".concat(r.id," because its hibernated"));case 4:if(r.layout){n.next=9;break}return this.hideAddButton(r.id),n.next=8,this.initWorkspaceContents(r.id,e);case 8:return n.abrupt("return",void n.sent);case 9:return(i=r.layout._maximizedItem)&&i.toggleMaximise(),o=r.layout.root.getItemsByFilter((function(e){return e.isColumn||e.isRow}))[0],t&&t!==r.id&&(o=r.layout.root.getItemsById(t)[0]),o||(o=r.layout.root.getItemsByFilter((function(e){return e.isStack}))[0]),s=this.getWindowInfoFromConfig(e),c=s.placementId,s.windowId,s.url,s.appName,this.registerWindowComponent(r.layout,q(c)),u=o.getComponentsByName(this._emptyVisibleWindowName)[0],n.abrupt("return",new Promise((function(t){var n,i=d.emitter.onContentComponentCreated((function(e){e.config.id===c&&(i(),t())}));if("stack"===r.layout.root.contentItems[0].type&&"component"!==e.type&&(e=U([e])[0]),u&&!(null===(n=u.parent.config.workspacesConfig)||void 0===n?void 0:n.wrapper)){var a=d._configFactory.wrapInGroup([e]);return a.workspacesConfig.wrapper=!1,void u.parent.parent.replaceChild(u.parent,a)}u?u.parent.replaceChild(u,e):o.addChild(e)})));case 17:case"end":return n.stop()}}),n,this)})))}},{key:"addContainer",value:function(e,t){var n;return j(this,void 0,void 0,a.a.mark((function r(){var i,o,s,c,u,d,l=this;return a.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(i=J.getByContainerId(t),!this._stateResolver.isWorkspaceHibernated(i.id)){r.next=3;break}throw new Error("Could not add container to ".concat(i.id," because its hibernated"));case 3:if(i.layout){r.next=10;break}return o=e.id||this._configFactory.getId(),e&&(e.id=o),this.hideAddButton(i.id),r.next=9,this.initWorkspaceContents(i.id,e);case 9:return r.abrupt("return",q(o));case 10:if((s=i.layout._maximizedItem)&&s.toggleMaximise(),c=i.layout.root.getItemsByFilter((function(e){return e.isColumn||e.isRow}))[0],t&&(c=i.layout.root.getItemsById(t)[0]),c||(c=i.layout.root.getItemsByFilter((function(e){return e.isStack}))[0]),i.id===t&&("column"===e.type||"stack"===e.type?this.bundleWorkspace(i.id,"row"):"row"===e.type&&this.bundleWorkspace(i.id,"column"),c=i.layout.root.contentItems[0]),e.content&&U(e.content).forEach((function(e){l.registerWindowComponent(i.layout,q(e.id))})),"component"!==c.type){r.next=15;break}throw new Error("The target item for add container can't be a component");case 15:return u=c.contentItems.find((function(e){return"stack"===e.type&&!0===e.config.workspacesConfig.wrapper})),d=(null===(n=null==u?void 0:u.contentItems[0])||void 0===n?void 0:n.config.componentName)===this._emptyVisibleWindowName,r.abrupt("return",new Promise((function(t,n){var r=function(){},o=setTimeout((function(){r(),n("Component with id ".concat(e.id," could not be created in 10000ms"))}),1e4);if(r=l.emitter.onContentItemCreated((function(n,a){n===i.id&&a.type===e.type&&(t(q(a.config.id)),r(),clearTimeout(o))})),1===(null==u?void 0:u.contentItems.length)&&d){var a=c.getComponentsByName(l._emptyVisibleWindowName)[0];a.parent.replaceChild(a,e)}else c.addChild(e)})));case 17:case"end":return r.stop()}}),r,this)})))}},{key:"closeContainer",value:function(e){var t=J.getByContainerId(e)||J.getByWindowId(e);if(!t)throw new Error("Could not find container ".concat(e," to close in any workspace"));t.layout.root.getItemsById(e)[0].remove()}},{key:"bundleWorkspace",value:function(e,t){var n=this,r=J.getById(e),i=r.layout.root.contentItems.map((function(e){return n._stateResolver.getContainerConfig(e.config.id)})),o=r.layout.root.contentItems[0],a={type:t,content:i,workspacesConfig:{}};r.layout.root.replaceChild(o,a)}},{key:"hideAddButton",value:function(e){$("#nestHere"+e).children(".add-button").hide()}},{key:"showAddButton",value:function(e){$("#nestHere"+e).children(".add-button").show()}},{key:"addWorkspace",value:function(e,t){var n,r;return j(this,void 0,void 0,a.a.mark((function i(){var o,s;return a.a.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return o=J.workspaceLayout.root.getItemsByFilter((function(e){return e.isStack}))[0],s={componentName:this._configFactory.getWorkspaceLayoutComponentName(e),type:"component",workspacesConfig:{},id:e,noTabHeader:null===(n=t.workspacesOptions)||void 0===n?void 0:n.noTabHeader,title:(null===(r=null==t?void 0:t.workspacesOptions)||void 0===r?void 0:r.title)||this._configFactory.getWorkspaceTitle(J.workspaceTitles)},this.registerWorkspaceComponent(e),o.addChild(s,void 0,!s.noTabHeader),i.next=5,this.initWorkspaceContents(e,t);case 5:this.setupContentLayouts(e),this.emitter.raiseEvent("workspace-added",{workspace:J.getById(e)});case 7:case"end":return i.stop()}}),i,this)})))}},{key:"reinitializeWorkspace",value:function(e,t){var n;return J.removeLayout(e),(null===(n=t.workspacesOptions)||void 0===n?void 0:n.reuseWorkspaceId)&&delete t.workspacesOptions.reuseWorkspaceId,this.initWorkspaceContents(e,t)}},{key:"removeWorkspace",value:function(e){var t=J.getWorkspaceLayoutItemById(e);if(!t)throw new Error("Could find workspace to remove with id "+e);J.removeById(e),t.remove()}},{key:"changeTheme",value:function(e){var t=document.getElementsByTagName("html")[0];"light"===e?t.classList.contains(e)||(t.classList.remove("dark"),t.classList.add(e)):t.classList.contains(e)||(t.classList.remove("light"),t.classList.add(e));var n=$("link[href='./dist/glue42-light-theme.css']");(0===n.length?$("link[href='./dist/glue42-dark-theme.css']"):n).attr("href","./dist/glue42-".concat(e,"-theme.css"))}},{key:"getDragElement",value:function(){return $(".lm_dragProxy")[0]}},{key:"setDragElementSize",value:function(e,t){var n=this,r=this.getDragElement();if(r){r.setAttribute("width",e+"px"),r.setAttribute("height",t+"px");var i=$(r).children(".lm_content").children(".lm_item_container")[0];i.setAttribute("width",e+"px"),i.setAttribute("height",t+"px"),i.setAttribute("style","")}else{var o=new MutationObserver((function(r){var i;Array.from(r).forEach((function(e){var t=$(e.addedNodes);i||(i=t.find(".lm_dragProxy"))})),i&&(o.disconnect(),n.setDragElementSize(e,t))}));o.observe($("body")[0],{childList:!0,subtree:!0})}}},{key:"removeLayoutElement",value:function(e){var t;return J.layouts.filter((function(e){return e.layout})).forEach((function(n){var r=n.layout.root.getItemsById(e)[0];r&&n.windows.find((function(t){return t.id===e}))&&(n.windows=n.windows.filter((function(t){return t.id!==e})),r.remove(),t=n)})),t}},{key:"setWindowTitle",value:function(e,t){var n=J.getWindowContentItem(e);if(!n)throw new Error("Could not find window ".concat(e," to change its title to ").concat(t));n.setTitle(t),n.config.componentState.title=t}},{key:"setWorkspaceTitle",value:function(e,t){J.getWorkspaceLayoutItemById(e).setTitle(t)}},{key:"focusWindow",value:function(e){var t=J.getByWindowId(e);if(!t)throw new Error("Could not find workspace for window "+e);if(this._stateResolver.isWorkspaceHibernated(t.id))throw new Error("Could not focus window ".concat(e," because the workspace ").concat(t.id," is hibernated"));var n=t.layout.root.getItemsById(e)[0];n.parent.setActiveContentItem(n)}},{key:"focusWorkspace",value:function(e){var t=J.getWorkspaceLayoutItemById(e);t.parent.setActiveContentItem(t)}},{key:"maximizeWindow",value:function(e){var t=J.getByWindowId(e);if(!t)throw new Error("Could not find workspace for window "+e);if(this._stateResolver.isWorkspaceHibernated(t.id))throw new Error("Could not maximize window ".concat(e," because the workspace ").concat(t.id," is hibernated"));var n=t.layout.root.getItemsById(e)[0];n.parent.hasId(this._maximizedId)||n.parent.toggleMaximise()}},{key:"restoreWindow",value:function(e){var t=J.getByWindowId(e);if(!t)throw new Error("Could not find workspace for window "+e);if(this._stateResolver.isWorkspaceHibernated(t.id))throw new Error("Could not restore window ".concat(e," because the workspace ").concat(t.id," is hibernated"));var n=t.layout.root.getItemsById(e)[0];n.parent.hasId(this._maximizedId)&&n.parent.toggleMaximise()}},{key:"showLoadedWindow",value:function(e,t){return j(this,void 0,void 0,a.a.mark((function n(){var r,i,o;return a.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.waitForWindowContainer(e);case 2:r=J.getWindowContentItem(e),i=J.getByWindowId(e),(o=r.config).componentState.windowId=t,i.windows.find((function(t){return t.id===e})).windowId=t,r.parent.replaceChild(r,o);case 4:case"end":return n.stop()}}),n,this)})))}},{key:"isWindowVisible",value:function(e){return e=q(e),J.getWindowContentItem(e).parent.getActiveContentItem().config.id===e}},{key:"showHibernationIcon",value:function(e){var t,n=null===(t=J.getWorkspaceContentItem(e))||void 0===t?void 0:t.tab;if(n){var r=n.element.children(".lm_saveButton");r.addClass("lm_hibernationIcon"),r.attr("title","hibernated")}}},{key:"showSaveIcon",value:function(e){var t,n=null===(t=J.getWorkspaceContentItem(e))||void 0===t?void 0:t.tab;if(n){var r=n.element.children(".lm_saveButton");r.removeClass("lm_hibernationIcon"),r.attr("title","save")}else console.error("Could not find the tab for",e)}},{key:"initWorkspaceContents",value:function(e,t){var n=this;if(!t||"component"!==t.type&&!t.content.length)return J.addOrUpdate(e,[]),this.showAddButton(e),Promise.resolve();var r=function(e,t){var n,r,i=0,o=setTimeout((function(){r()}),1e4);return{reject:function(e){clearTimeout(o),r(e)},signal:function(){++i>=2&&(clearTimeout(o),n())},promise:new Promise((function(e,t){n=e,r=t}))}}();t.settings||(t.settings=this._configFactory.getDefaultWorkspaceSettings()),t.type&&"workspace"!==t.type&&(t={settings:this._configFactory.getDefaultWorkspaceSettings(),content:[{type:"column",content:[t],workspacesConfig:{}}]}),"component"!==t.type&&"stack"===t.content[0].type&&(t=Object.assign(Object.assign({},t),{content:[{type:"column",content:t.content,workspacesConfig:{}}]}));var i=new N(t,$("#nestHere"+e));J.addOrUpdate(e,[]),this.registerEmptyWindowComponent(i,e),U(t.content).forEach((function(e){n.registerWindowComponent(i,q(e.id))}));var o=$("#nestHere"+e);return i.on("initialised",(function(){var t=U(i.toConfig().content);J.addOrUpdate(e,t.map((function(e){var t=i.root.getItemsById(q(e.id))[0].element;return{id:q(e.id),bounds:G(t),windowId:e.componentState.windowId}})),i),n.emitter.raiseEventWithDynamicName("content-layout-initialised-"+e),n.emitter.raiseEvent("content-layout-init",{layout:i});var a=o.width(),s=o.height();i.updateSize(a,s),r.signal()})),i.on("stateChanged",(function(){n.emitter.raiseEvent("content-layout-state-changed",{layoutId:e})})),i.on("itemCreated",(function(t){var r;if(t.isComponent)t.on("size-changed",(function(){var r=J.getById(e).windows.find((function(e){return e.id===t.config.id}));r&&(r.bounds=G(t.element));var i=t.config.id;n.emitter.raiseEvent("content-item-resized",{target:t.element[0],id:q(i)})})),(t.config.componentName===n._emptyVisibleWindowName||(null===(r=t.parent)||void 0===r?void 0:r.config.workspacesConfig.wrapper))&&t.tab.header.position(!1);else{if(t.isRoot)return void(t.id&&t.id.length||t.addId(e));t.config.id&&t.config.id.length||t.addId(n._configFactory.getId())}n.emitter.raiseEvent("content-item-created",{workspaceId:e,item:t})})),i.on("stackCreated",(function(t){var r=document.createElement("li");r.classList.add("lm_add_button"),r.onclick=function(i){i.stopPropagation(),n.emitter.raiseEvent("add-button-clicked",{args:{laneId:q(t.config.id),workspaceId:e,bounds:G(r)}})};var i=$(t.element).children(".lm_header").children(".lm_controls").children(".lm_maximise");i.addClass("workspace_content"),t.on("maximized",(function(){i.addClass("lm_restore"),i.attr("title",n._stackRestoreLabel),n.emitter.raiseEvent("stack-maximized",{stack:t})})),t.on("minimized",(function(){i.removeClass("lm_restore"),i.attr("title",n._stackMaximizeLabel),n.emitter.raiseEvent("stack-restored",{stack:t})})),n._options.disableCustomButtons||t.header.controlsContainer.prepend($(r)),t.on("activeContentItemChanged",(function(){var e=t.getActiveContentItem();if(e.isComponent){var r=e.config.id,i=[{id:q(e.config.id),bounds:G(e.element),windowId:e.config.componentState.windowId,appName:e.config.componentState.appName,url:e.config.componentState.url}],o=t.header.tabs.reduce((function(e,t){var n=t.contentItem.config;if("component"===n.type){var r={id:q(n.id),bounds:G(t.contentItem.element),windowId:n.componentState.windowId,appName:n.componentState.appName,url:n.componentState.url};e.push(r)}return e}),[]).filter((function(e){return e.id!==r}));n.emitter.raiseEvent("selection-changed",{toBack:o,toFront:i})}})),t.on("popoutRequested",(function(){var e=t.getActiveContentItem();n.emitter.raiseEvent("eject-requested",{item:e})}))})),i.on("tabCreated",(function(e){e._dragListener.on("drag",(function(){n.emitter.raiseEvent("tab-drag",{tab:e})})),e._dragListener.on("dragStart",(function(){n.emitter.raiseEvent("tab-drag-start",{tab:e})})),e._dragListener.on("dragEnd",(function(){n.emitter.raiseEvent("tab-drag-end",{tab:e})})),e.element.mousedown((function(){n.emitter.raiseEvent("tab-element-mouse-down",{tab:e})})),n.refreshTabSizeClass(e)})),i.on("tabCloseRequested",(function(e){n.emitter.raiseEvent("tab-close-requested",{item:e.contentItem})})),i.on("componentCreated",(function(t){var i=n.emitter.raiseEvent("content-component-created",{component:t,workspaceId:e});Array.isArray(i)?Promise.all(i).then((function(){r.signal()})).catch((function(e){return r.reject(e)})):i.then((function(){r.signal()})).catch((function(e){return r.reject(e)}))})),i.init(),r.promise}},{key:"initWorkspaceConfig",value:function(e){var t=this;return new Promise((function(n){e.settings.selectionEnabled=!0,J.workspaceLayout=new N(e,$(t._workspaceLayoutElementId),X.decoratedFactory),new Y((function(e){Array.from(e).forEach((function(e){t.emitter.raiseEvent("outer-layout-container-resized",{target:e.target})}))})).observe($("#outter-layout-container")[0]),e.content[0].content.forEach((function(e){var n=e.id;t.registerWorkspaceComponent(q(n))})),J.workspaceLayout.on("initialised",(function(){t.emitter.raiseEvent("workspace-layout-initialised",{}),n()})),J.workspaceLayout.on("stackCreated",(function(e){var n,r=e.header.controlsContainer.children(".lm_close")[0];r&&(r.onclick=function(){t.emitter.raiseEvent("close-frame",{})});var i=e.header.element[0];if(new MutationObserver((function(){var e=t.getElementByClass(i,"lm_add_button");e&&X.decoratedFactory.createAddWorkspace&&(e.onclick=function(n){n.stopPropagation(),t.emitter.raiseEvent("workspace-add-button-clicked",{bounds:G(e)})})})).observe(e.header.element[0],{attributes:!1,childList:!0,subtree:!0}),!t._options.disableCustomButtons&&!(null===(n=X.decoratedFactory)||void 0===n?void 0:n.createAddWorkspace)){var o=document.createElement("li");o.classList.add("lm_add_button"),o.onclick=function(e){e.stopPropagation(),t._emitter.raiseEvent("workspace-add-button-clicked",{})},e.header.workspaceControlsContainer.prepend($(o))}if(!X.decoratedFactory.createLogo){var s=document.createElement("span");s.classList.add("logo_type");var c=e.header.element[0].getElementsByClassName("lm_logo")[0];c&&c.appendChild(s)}e.on("activeContentItemChanged",(function(){return j(t,void 0,void 0,a.a.mark((function t(){var n,r;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(0!==J.workspaceIds.length){t.next=2;break}return t.abrupt("return");case 2:return n=e.getActiveContentItem().config.id,t.next=5,this.waitForLayout(q(n));case 5:r=J.workspaceIds.reduce((function(e,t){return[].concat(Object(u.a)(e),Object(u.a)(J.getById(t).windows))}),[]),this.emitter.raiseEvent("workspace-selection-changed",{workspace:J.getById(n),toBack:r});case 7:case"end":return t.stop()}}),t,this)})))}))})),J.workspaceLayout.on("itemCreated",(function(e){e.isComponent&&e.on("size-changed",(function(){t.emitter.raiseEvent("workspace-content-container-resized",{target:e,id:q(e.config.id)}),t.emitter.raiseEventWithDynamicName("workspace-content-container-resized-"+e.config.id,e)}))})),J.workspaceLayout.on("tabCreated",(function(e){var n=document.createElement("div");n.classList.add("lm_saveButton"),n.onclick=function(n){t.emitter.raiseEvent("workspace-save-requested",{workspaceId:q(e.contentItem.config.id)})},t._options.disableCustomButtons||(e.element[0].prepend(n),e.element[0].onclick=function(e){-1!==e.composedPath().indexOf(n)&&document.activeElement.blur(),e.stopPropagation()}),t.refreshTabSizeClass(e)})),J.workspaceLayout.on("tabCloseRequested",(function(e){t.emitter.raiseEvent("workspace-tab-close-requested",{workspace:J.getById(e.contentItem.config.id)})})),J.workspaceLayout.init()}))}},{key:"setupOuterLayout",value:function(){this.emitter.onOuterLayoutContainerResized((function(e){J.workspaceLayout.updateSize($(e).width(),$(e).height())}))}},{key:"setupContentLayouts",value:function(e){this.emitter.onContentContainerResized((function(t){var n=J.getById(e).layout;n&&n.updateSize($(t.element).width(),$(t.element).height())}),e)}},{key:"registerWindowComponent",value:function(e,t){this.registerComponent(e,"app"+t,(function(e){var n=document.createElement("div");n.setAttribute("style","height:100%;"),n.id="app"+t,e.getElement().append(n)}))}},{key:"registerEmptyWindowComponent",value:function(e,t){var n=this;this.registerComponent(e,this._emptyVisibleWindowName,(function(e){var r=document.createElement("div");r.classList.add("empty-container-background");var i=document.createElement("button");i.classList.add("add-button"),i.onclick=function(r){r.stopPropagation();var o=e.tab.contentItem,a="stack"===o.parent.type?"group":o.parent.type;o.parent.config.workspacesConfig.wrapper?n.emitter.raiseEvent("add-button-clicked",{args:{laneId:q(o.parent.parent.config.id),workspaceId:t,parentType:o.parent.parent.type,bounds:G(i)}}):n.emitter.raiseEvent("add-button-clicked",{args:{laneId:q(o.parent.config.id),workspaceId:t,parentType:a,bounds:G(i)}})},r.append(i),e.getElement().append(r)}))}},{key:"registerWorkspaceComponent",value:function(e){var t=this;this.registerComponent(J.workspaceLayout,this._configFactory.getWorkspaceLayoutComponentName(e),(function(n){var r,i,o=document.createElement("div");o.setAttribute("style","height:calc(100% - 1px); width:calc(100% - 1px);"),o.id="nestHere"+e;var a=document.createElement("button");a.classList.add("add-button"),a.onclick=function(r){r.stopPropagation();var i=n.tab.contentItem;t.emitter.raiseEvent("add-button-clicked",{args:{laneId:q(i.parent.id),workspaceId:e,bounds:G(a)}})},o.appendChild(a),(null===(r=X.decoratedFactory)||void 0===r?void 0:r.createWorkspaceContents)?(document.body.append(o),o.style.display="none",null===(i=X.decoratedFactory)||void 0===i||i.createWorkspaceContents({workspaceId:e,domNode:n.getElement()[0]})):n.getElement().append(o),$(a).hide()}))}},{key:"registerComponent",value:function(e,t,n){try{e.registerComponent(t,(function(e,t){n&&n(e,t)}))}catch(e){console.log("Tried to register and already existing component - "+t)}}},{key:"waitForLayout",value:function(e){var t=this;return new Promise((function(n){var r=t._registry.add("content-layout-initialised-"+e,(function(){n(),r()}));J.getById(e)&&(n(),r())}))}},{key:"waitForWindowContainer",value:function(e){var t=this;return new Promise((function(n){var r=t.emitter.onContentComponentCreated((function(t){t.config.id===e&&(n(),r())}));J.getWindowContentItem(e)&&(n(),r())}))}},{key:"getWindowInfoFromConfig",value:function(e){return"component"!==e.type?this.getWindowInfoFromConfig(e.content[0]):{placementId:q(e.id),windowId:e.componentState.windowId,appName:e.componentState.appName,url:e.componentState.url}}},{key:"refreshLayoutSize",value:function(){var e=G($(this._workspaceLayoutElementId));J.workspaceLayout.updateSize(e.width,e.height)}},{key:"refreshTabSizeClass",value:function(e){var t=e.header.tabs,n=t.map((function(e){return e.element})).some((function(e){return e.hasClass("lm_tab_small")})),r=t.map((function(e){return e.element})).some((function(e){return e.hasClass("lm_tab_mini")}));n&&e.element.addClass("lm_tab_small"),r&&e.element.addClass("lm_tab_mini")}},{key:"getElementByClass",value:function(e,t){var n=e.getElementsByClassName(t);if(n.length>1)throw new Error("Multiple elements with class ".concat(t," in element with id ").concat(e.id," and class ").concat(e.className," are not supported"));return n[0]}},{key:"emitter",get:function(){return this._emitter}},{key:"bounds",get:function(){return G(document.getElementById("outter-layout-container"))}}]),e}(),Q=function(){function e(t){Object(s.a)(this,e),this._registry=t}return Object(c.a)(e,[{key:"onWorkspaceLayoutInit",value:function(e){return this._registry.add("workspace-layout-initialised",e)}},{key:"onContentLayoutInit",value:function(e){return this._registry.add("content-layout-init",e)}},{key:"onOuterLayoutContainerResized",value:function(e){return this._registry.add("outer-layout-container-resized",e)}},{key:"onContentContainerResized",value:function(e,t){return t?this._registry.add("workspace-content-container-resized-"+t,e):this._registry.add("workspace-content-container-resized",e)}},{key:"onContentItemResized",value:function(e){return this._registry.add("content-item-resized",e)}},{key:"onContentComponentCreated",value:function(e){return this._registry.add("content-component-created",e)}},{key:"onFrameCloseRequested",value:function(e){return this._registry.add("close-frame",e)}},{key:"onRestoreRequested",value:function(e){return this._registry.add("restore-frame",e)}},{key:"onMaximizeRequested",value:function(e){return this._registry.add("maximize-frame",e)}},{key:"onMinimizeRequested",value:function(e){return this._registry.add("minimize-frame",e)}},{key:"onMoveAreaChanged",value:function(e){return this._registry.add("move-area-changed",e)}},{key:"onTabCloseRequested",value:function(e){return this._registry.add("tab-close-requested",e)}},{key:"onTabDragStart",value:function(e){return this._registry.add("tab-drag-start",e)}},{key:"onTabDrag",value:function(e){return this._registry.add("tab-drag",e)}},{key:"onTabDragEnd",value:function(e){return this._registry.add("tab-drag-end",e)}},{key:"onTabElementMouseDown",value:function(e){return this._registry.add("tab-element-mouse-down",e)}},{key:"onSelectionChanged",value:function(e){return this._registry.add("selection-changed",e)}},{key:"onWorkspaceAdded",value:function(e){return this._registry.add("workspace-added",e)}},{key:"onWorkspaceSelectionChanged",value:function(e){return this._registry.add("workspace-selection-changed",e)}},{key:"onWorkspaceTabCloseRequested",value:function(e){return this._registry.add("workspace-tab-close-requested",e)}},{key:"onAddButtonClicked",value:function(e){return this._registry.add("add-button-clicked",e)}},{key:"onContentLayoutStateChanged",value:function(e){return this._registry.add("content-layout-state-changed",e)}},{key:"onContentItemCreated",value:function(e){return this._registry.add("content-item-created",e)}},{key:"onWorkspaceAddButtonClicked",value:function(e){return this._registry.add("workspace-add-button-clicked",e)}},{key:"onWorkspaceSaveRequested",value:function(e){return this._registry.add("workspace-save-requested",e)}},{key:"onStackMaximized",value:function(e){return this._registry.add("stack-maximized",e)}},{key:"onStackRestored",value:function(e){return this._registry.add("stack-restored",e)}},{key:"onEjectRequested",value:function(e){return this._registry.add("eject-requested",e)}},{key:"raiseEvent",value:function(e,t){var n,r=(n=this._registry).execute.apply(n,[e].concat(Object(u.a)(Object.values(t))));return Array.isArray(r)&&r.some((function(e){return e&&e.then}))||r&&!Array.isArray(r)&&r.then?r:Promise.resolve(r)}},{key:"raiseEventWithDynamicName",value:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];(t=this._registry).execute.apply(t,[e].concat(r))}}]),e}(),ee=1,te=function(){return(ee=(9301*ee+49297)%233280)/233280},ne="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";function re(){z=!1}function ie(e){if(e){if(e!==F){if(e.length!==ne.length)throw new Error("Custom alphabet for shortid must be "+ne.length+" unique characters. You submitted "+e.length+" characters: "+e);var t=e.split("").filter((function(e,t,n){return t!==n.lastIndexOf(e)}));if(t.length)throw new Error("Custom alphabet for shortid must be "+ne.length+" unique characters. These characters were not unique: "+t.join(", "));F=e,re()}}else F!==ne&&(F=ne,re())}function oe(){return z||(z=function(){F||ie(ne);for(var e,t=F.split(""),n=[],r=te();t.length>0;)r=te(),e=Math.floor(r*t.length),n.push(t.splice(e,1)[0]);return n.join("")}())}var ae,se,ce,ue={get:function(){return F||ne},characters:function(e){return ie(e),F},seed:function(e){(function(e){ee=e})(e),B!==e&&(re(),B=e)},lookup:function(e){return oe()[e]},shuffled:oe},de="object"==typeof window&&(window.crypto||window.msCrypto),le=de&&de.getRandomValues?function(e){return de.getRandomValues(new Uint8Array(e))}:function(e){for(var t=[],n=0;n<e;n++)t.push(Math.floor(256*Math.random()));return t},pe=function(e,t,n){for(var r=(2<<Math.log(t.length-1)/Math.LN2)-1,i=-~(1.6*r*n/t.length),o="";;)for(var a=e(i),s=i;s--;)if((o+=t[a[s]&r]||"").length===+n)return o},he=function(e){for(var t,n=0,r="";!t;)r+=pe(le,ue.get(),1),t=e<Math.pow(16,n+1),n++;return r},fe=function(e){return!(!e||"string"!=typeof e||e.length<6||new RegExp("[^"+ue.get().replace(/[|\\{}()[\]^$+*?.-]/g,"\\$&")+"]").test(e))},me=L((function(e){var t=0;function n(){return function(e){var t="",n=Math.floor(.001*(Date.now()-1567752802062));return n===se?ae++:(ae=0,se=n),t+=he(7),t+=he(e),ae>0&&(t+=he(ae)),t+he(n)}(t)}e.exports=n,e.exports.generate=n,e.exports.seed=function(t){return ue.seed(t),e.exports},e.exports.worker=function(n){return t=n,e.exports},e.exports.characters=function(e){return void 0!==e&&ue.characters(e),ue.shuffled()},e.exports.isValid=fe})),ve=function(){function e(t){Object(s.a)(this,e),this._registry=H(),this._idToFrame={},this._glue=t}return Object(c.a)(e,[{key:"startFrame",value:function(e,t,n,r){return j(this,void 0,void 0,a.a.mark((function n(){var i;return a.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=r||me.generate(),!this._idToFrame[e]){n.next=2;break}return n.abrupt("return",this._idToFrame[e]);case 2:if(t){n.next=4;break}throw new Error("The url of window with itemId ".concat(e," is undefined"));case 4:return(i=document.createElement("iframe")).name=r+"#wsp",i.src=t,document.body.appendChild(i),this._registry.execute("frameLoaded",e),i.setAttribute("id",e),$(i).css("position","absolute"),this._idToFrame[e]=i,n.next=14,this.waitForWindow(r);case 14:return n.abrupt("return",i);case 15:case"end":return n.stop()}}),n,this)})))}},{key:"moveFrame",value:function(e,t){var n=this._idToFrame[e],r=$(n);r.css("top",t.top+"px"),r.css("left",t.left+"px"),r.css("width",t.width+"px"),r.css("height",t.height+"px")}},{key:"selectionChanged",value:function(e,t){var n=this;t.forEach((function(e){$(n._idToFrame[e]).css("z-index","-1")})),e.forEach((function(e){$(n._idToFrame[e]).hasClass("maximized-active-tab")?$(n._idToFrame[e]).css("z-index","42"):$(n._idToFrame[e]).css("z-index","19")}))}},{key:"maximizeTab",value:function(e){$(this._idToFrame[e]).addClass("maximized-active-tab")}},{key:"restoreTab",value:function(e){$(this._idToFrame[e]).removeClass("maximized-active-tab")}},{key:"selectionChangedDeep",value:function(e,t){var n=this;t.forEach((function(e){$(n._idToFrame[e]).css("z-index","-1")})),e.forEach((function(e){$(n._idToFrame[e]).hasClass("maximized-active-tab")?$(n._idToFrame[e]).css("z-index","42"):$(n._idToFrame[e]).css("z-index","19")}))}},{key:"bringToFront",value:function(e){$(this._idToFrame[e]).css("z-index","999")}},{key:"remove",value:function(e){var t=this._idToFrame[e];if(t){delete this._idToFrame[e];try{t.contentWindow.dispatchEvent(new Event("beforeunload"))}catch(e){}t.remove()}}},{key:"onFrameLoaded",value:function(e){return this._registry.add("frameLoaded",e)}},{key:"onFrameContentClicked",value:function(e){return this._registry.add("frame-content-clicked",e)}},{key:"onWindowTitleChanged",value:function(e){return this._registry.add("window-title-changed",e)}},{key:"waitForWindow",value:function(e){var t=this;return new Promise((function(n,r){var i=function(){},o=setTimeout((function(){r("Window with id ".concat(e," did not appear in 5000ms")),i()}),5e3);i=t._glue.windows.onWindowAdded((function(t){t.id===e&&(i(),n(),clearTimeout(o))})),t._glue.windows.list().find((function(t){return t.id===e}))&&(n(),i(),clearTimeout(o))}))}}]),e}(),ge=new(function(){function e(){Object(s.a)(this,e),this.LAST_SESSION_KEY="lastSession"}return Object(c.a)(e,[{key:"get",value:function(e){return JSON.parse(localStorage.getItem(e))}},{key:"set",value:function(e,t){localStorage.setItem(e,JSON.stringify(t))}}]),e}()),ye=new(function(){function e(){Object(s.a)(this,e)}return Object(c.a)(e,[{key:"loadConfig",value:function(){var e,t=new URLSearchParams(window.location.search),n=t.get("emptyFrame"),r=t.get("disableCustomButtons"),i=t.get("workspaceName"),o=t.get("workspaceNames"),a=t.get("context"),s=t.get("build"),c=[];try{c=JSON.parse(o)||c}catch(t){}try{e=JSON.parse(a)}catch(t){}i&&c.push(i);var u={emptyFrame:null!=n&&void 0!==n,disableCustomButtons:null!=r&&void 0!==r,workspaceNames:c,context:e,build:null!=s};return this._config=u,this.cleanUpUrl(),u}},{key:"cleanUpUrl",value:function(){var e=this.removeQueryParams(window.location.search,["emptyFrame"]);window.history.replaceState(null,document.title,window.location.origin+window.location.pathname+e)}},{key:"removeQueryParams",value:function(e,t){return t.forEach((function(t){var n=new URLSearchParams(e),r=n.get(t);Array.from(n.keys()).indexOf(t)>-1&&(e=e.replace("".concat(t,"=").concat(r),""))})),"&"===e[e.length-1]&&(e=e.substr(0,e.length-1)),e=(e=e.replace("&&","&")).replace("?&","?")}},{key:"config",get:function(){return this._config}}]),e}()),we=function(){function e(t,n,r,i){Object(s.a)(this,e),this.resolver=t,this._glue=n,this._configFactory=r,this._configConverter=i,this._layoutsType="Workspace",this._layoutComponentType="Workspace"}return Object(c.a)(e,[{key:"getInitialConfig",value:function(){var e;return j(this,void 0,void 0,a.a.mark((function t(){var n,r,i,o=this;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this._initialWorkspaceConfig){t.next=2;break}return t.abrupt("return",this._configFactory.generateInitialConfig([this._initialWorkspaceConfig]));case 2:if(!(n=ye.config).workspaceNames||!n.workspaceNames.length){t.next=11;break}return t.next=6,Promise.all(n.workspaceNames.map((function(e){return j(o,void 0,void 0,a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getWorkspaceByName(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))})));case 6:if(!(r=t.sent.map((function(e){return e.config.workspacesOptions=e.config.workspacesOptions||{},e.config.workspacesOptions.context=e.layoutData.context,e.config})).filter((function(e){return e}))).length){t.next=9;break}return t.abrupt("return",(r.forEach((function(e,t){e.id=o._configFactory.getId(),e.workspacesOptions=e.workspacesOptions||{},n.context&&e.workspacesOptions.context?e.workspacesOptions.context=Object.assign(e.workspacesOptions.context,n.context):n.context&&(e.workspacesOptions.context=n.context),e.workspacesOptions.layoutName=n.workspaceNames[t]})),this._configFactory.generateInitialConfig(r)));case 9:t.next=15;break;case 11:if(null===(e=ye.config)||void 0===e?void 0:e.build){t.next=15;break}if(!(i=this.getLastSession())||!i.length){t.next=15;break}return t.abrupt("return",(i.forEach((function(e){e&&(e.id=o._configFactory.getId())})),this._configFactory.generateInitialConfig(i)));case 15:return t.abrupt("return",this._configFactory.getDefaultFrameConfig());case 16:case"end":return t.stop()}}),t,this)})))}},{key:"getLastSession",value:function(){var e=this;return(ge.get(ge.LAST_SESSION_KEY)||[]).map((function(t){return e.addWorkspaceIds(t),e.addWindowIds(t),e._configConverter.convertToRendererConfig(t)}))}},{key:"getSavedWorkspaceNames",value:function(){return j(this,void 0,void 0,a.a.mark((function e(){var t=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._glue.layouts.getAll(this._layoutsType);case 2:return e.abrupt("return",e.sent.filter((function(e){return e.type===t._layoutsType})).map((function(e){return e.name})));case 3:case"end":return e.stop()}}),e,this)})))}},{key:"export",value:function(){return j(this,void 0,void 0,a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._glue.layouts.export(this._layoutsType));case 1:case"end":return e.stop()}}),e,this)})))}},{key:"getWorkspaceByName",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){var n,r,i;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._glue.layouts.get(e,this._layoutsType);case 2:return n=t.sent,r=n.components[0].state,i=this._configConverter.convertToRendererConfig(r),t.abrupt("return",(this.addWorkspaceIds(i),this.addWindowIds(i),{config:i,layoutData:{metadata:n.metadata,name:e,context:r.context}}));case 6:case"end":return t.stop()}}),t,this)})))}},{key:"delete",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._glue.layouts.remove(this._layoutsType,e);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"save",value:function(e){var t;return j(this,void 0,void 0,a.a.mark((function n(){var r,i,o,s,c,u,d;return a.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=e.workspace,i=e.title,o=e.name,s=e.saveContext,r.layout||r.hibernateConfig){n.next=3;break}throw new Error("An empty layout cannot be saved");case 3:return((null===(t=r.layout)||void 0===t?void 0:t.config)||r.hibernateConfig).workspacesOptions.name=o,n.next=6,this.saveWorkspaceCore(r);case 6:if(c=n.sent,i&&(c.config.title=i),u=void 0,!s){n.next=18;break}return n.prev=10,n.next=13,this.getWorkspaceContext(r.id);case 13:u=n.sent,n.next=18;break;case 16:n.prev=16,n.t0=n.catch(10);case 18:return d={name:o,type:this._layoutsType,metadata:{},components:[{type:this._layoutComponentType,state:{children:c.children,config:c.config,context:u}}]},n.next=21,this._glue.layouts.import([d],"merge");case 21:return n.abrupt("return",d);case 22:case"end":return n.stop()}}),n,this,[[10,16]])})))}},{key:"generateLayout",value:function(e,t){return j(this,void 0,void 0,a.a.mark((function n(){var r;return a.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(t.layout){n.next=2;break}throw new Error("An empty layout cannot be generated");case 2:return t.layout.config.workspacesOptions.name=e,n.next=5,this.saveWorkspaceCore(t);case 5:return r=n.sent,n.abrupt("return",{name:e,type:this._layoutsType,metadata:{},components:[{type:this._layoutComponentType,state:{children:r.children,config:r.config,context:{}}}]});case 7:case"end":return n.stop()}}),n,this)})))}},{key:"saveWorkspacesFrame",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){var n,r,i=this;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.map((function(e){return i.saveWorkspaceCoreSync(e)})),t.next=3,Promise.all(n);case 3:r=t.sent,ge.set(ge.LAST_SESSION_KEY,r);case 5:case"end":return t.stop()}}),t)})))}},{key:"setInitialWorkspaceConfig",value:function(e){this._initialWorkspaceConfig=e}},{key:"saveWorkspaceCore",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){var n,r;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.layout||e.hibernateConfig){t.next=2;break}return t.abrupt("return");case 2:return(n=this.resolver.getWorkspaceConfig(e.id)).workspacesOptions.layoutName&&delete n.workspacesOptions,this.removeWorkspaceIds(n),t.next=7,this.applyWindowLayoutState(n);case 7:return r=this._configConverter.convertToAPIConfig(n),t.abrupt("return",(this.removeWorkspaceItemIds(r),this.windowSummariesToWindowLayout(r),this.addWindowUrlsToWindows(r),this.workspaceSummaryToWorkspaceLayout(r),r));case 9:case"end":return t.stop()}}),t,this)})))}},{key:"saveWorkspaceCoreSync",value:function(e){if(e.layout||e.hibernateConfig){var t=this.resolver.getWorkspaceConfig(e.id);this.removeWorkspaceIds(t);var n=this._configConverter.convertToAPIConfig(t);return this.removeWorkspaceItemIds(n),this.windowSummariesToWindowLayout(n),this.addWindowUrlsToWindows(n),this.workspaceSummaryToWorkspaceLayout(n),n}}},{key:"windowSummariesToWindowLayout",value:function(e){!function e(t){if("window"===t.type)return delete t.config.isMaximized,delete t.config.isLoaded,delete t.config.isFocused,delete t.config.windowId,delete t.config.workspaceId,delete t.config.frameId,delete t.config.positionIndex,void(t.config.appName&&delete t.config.url);t.children.forEach((function(t){return e(t)}))}(e)}},{key:"addWindowContexts",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){var n,r=this;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=function e(t){return j(r,void 0,void 0,a.a.mark((function n(){var r,i;return a.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if("window"===t.type){n.next=5;break}return n.next=3,Promise.all(t.children.map((function(t){return e(t)})));case 3:n.next=12;break;case 5:if(!t.config.windowId){n.next=12;break}if(!(r=this._glue.windows.findById(t.config.windowId))){n.next=12;break}return n.next=10,r.getContext();case 10:i=n.sent,t.config.context=Object.assign({},t.config.context||{},i);case 12:case"end":return n.stop()}}),n,this)})))},t.next=3,n(e);case 3:case"end":return t.stop()}}),t)})))}},{key:"workspaceSummaryToWorkspaceLayout",value:function(e){(null==e?void 0:e.config)&&(delete e.config.frameId,delete e.config.positionIndex)}},{key:"addWindowUrlsToWindows",value:function(e){var t=this;!function e(n){var r,i;if("window"!==n.type||n.config.url||n.config.appName)"window"!==n.type&&n.children.forEach((function(t){return e(t)}));else{var o=t._glue.appManager.application(n.config.appName);n.config.url=null===(i=null===(r=null==o?void 0:o.userProperties)||void 0===r?void 0:r.details)||void 0===i?void 0:i.url}}(e)}},{key:"addWorkspaceIds",value:function(e){var t=this;if(e){!function e(n){n.id=t._configFactory.getId(),n.type&&"component"===n.type&&(n.componentName="app"+n.id),"component"!==n.type&&n.content&&n.content.forEach((function(t){return e(t)}))}(e)}}},{key:"addWindowIds",value:function(e){var t=this;if(e){!function e(n){"component"===n.type&&(n.componentState.windowId=t._configFactory.getId()),"component"!==n.type&&n.content&&n.content.forEach((function(t){return e(t)}))}(e)}}},{key:"removeWorkspaceIds",value:function(e){!function e(t){"id"in t&&delete t.id,"component"===(null==t?void 0:t.type)&&(t.componentName="placeHolderId",t.title="placeHolderId"),"component"!==t.type&&t.content&&t.content.forEach((function(t){return e(t)}))}(e)}},{key:"removeWorkspaceItemIds",value:function(e){!function e(t){var n;"id"in t&&delete t.id,"window"!==t.type&&(null===(n=t.children)||void 0===n||n.forEach((function(t){return e(t)})))}(e)}},{key:"applyWindowLayoutState",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){var n,r=this;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=function e(t){return j(r,void 0,void 0,a.a.mark((function n(){var r;return a.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if("component"!==t.type){n.next=7;break}return n.next=3,this.getWindowLayoutState(t.windowId);case 3:r=n.sent,t.componentState.layoutState=r,n.next=8;break;case 7:t.content.forEach((function(t){return e(t)}));case 8:case"end":return n.stop()}}),n,this)})))},t.next=3,Promise.all(e.content.map((function(e){return j(r,void 0,void 0,a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n(e);case 2:case"end":return t.stop()}}),t)})))})));case 3:case"end":return t.stop()}}),t)})))}},{key:"getWorkspaceContext",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._glue.contexts.get(V(e));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"getWindowLayoutState",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",Promise.resolve({windowId:e}));case 1:case"end":return t.stop()}}),t)})))}}]),e}(),be=function(){function e(t,n){Object(s.a)(this,e),this._frameId=t,this._layoutEventEmitter=n}return Object(c.a)(e,[{key:"getWindowSummary",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){var n;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=Array.isArray(e)?e[0]:e,n=J.getWindowContentItem(e),t.t0=n,t.t0){t.next=7;break}return t.next=6,this.waitForWindowContentItem(e);case 6:n=J.getWindowContentItem(e);case 7:return t.abrupt("return",this.getWindowSummaryCore(n,e));case 8:case"end":return t.stop()}}),t,this)})))}},{key:"getWindowSummarySync",value:function(e,t){e=Array.isArray(e)?e[0]:e;var n=t||J.getWindowContentItem(e);return this.getWindowSummaryCore(n,e)}},{key:"getWorkspaceConfig",value:function(e){var t=J.getById(e);if(!t)throw new Error("Could find workspace to remove with id "+e);if(t.hibernateConfig)return t.hibernateConfig.workspacesOptions.isHibernated=!0,t.hibernateConfig;var n=t.layout?t.layout.toConfig():{workspacesOptions:{},content:[],id:e};return n.workspacesOptions.frameId=this._frameId,n.workspacesOptions.positionIndex=this.getWorkspaceTabIndex(e),n.workspacesOptions.isHibernated="object"==typeof t.hibernateConfig,n.workspacesOptions.isSelected=this.isWorkspaceSelected(e),n.workspacesOptions.lastActive=t.lastActive,n.workspacesOptions.title||(n.workspacesOptions.title=J.getWorkspaceTitle(e)),n.workspacesOptions.name=n.workspacesOptions.name||n.workspacesOptions.title,this.transformComponentsToWindowSummary(n),this.transformParentsToContainerSummary(n),n}},{key:"getWorkspaceSummary",value:function(e){var t=J.getById(e),n=this.getWorkspaceConfig(e),r=this.getWorkspaceTabIndex(e),i={frameId:this._frameId,positionIndex:r,title:J.getWorkspaceTitle(e),name:n.workspacesOptions.name||J.getWorkspaceTitle(e),isHibernated:"object"==typeof t.hibernateConfig,isSelected:this.isWorkspaceSelected(e),lastActive:t.lastActive};return n.workspacesOptions.layoutName&&(i.layoutName=n.workspacesOptions.layoutName),{config:i,id:e}}},{key:"isWindowMaximized",value:function(e){var t=q(e),n=J.getWindowContentItem(t);return!!(null==n?void 0:n.parent.isMaximized)}},{key:"isWindowSelected",value:function(e){var t,n,r=q(e),i=J.getWindowContentItem(r);return(null===(n=null===(t=null==i?void 0:i.parent)||void 0===t?void 0:t.getActiveContentItem())||void 0===n?void 0:n.config.id)===r}},{key:"isWorkspaceSelected",value:function(e){var t,n,r=J.getWorkspaceContentItem(e);return(null===(n=null===(t=null==r?void 0:r.parent)||void 0===t?void 0:t.getActiveContentItem())||void 0===n?void 0:n.config.id)===e}},{key:"isWorkspaceHibernated",value:function(e){return"object"==typeof J.getById(e).hibernateConfig}},{key:"getContainerSummary",value:function(e){var t;e=q(e);var n=J.getByContainerId(e),r=J.getContainer(e),i=null===(t=r.parent)||void 0===t?void 0:t.contentItems.indexOf(r);return{itemId:e,config:{workspaceId:n.id,frameId:this._frameId,positionIndex:i||0}}}},{key:"getContainerSummaryByReference",value:function(e,t){var n,r=null===(n=e.parent)||void 0===n?void 0:n.contentItems.indexOf(e);return{itemId:q(e.config.id),config:{workspaceId:t,frameId:this._frameId,positionIndex:r||0}}}},{key:"getContainerConfig",value:function(e){e=q(e);var t=(J.getByContainerId(e)||J.getByWindowId(e)).layout.toConfig();return this.findElementInConfig(e,t)}},{key:"isWindowInWorkspace",value:function(e){return!!J.getWindowContentItem(e)}},{key:"getFrameSnapshot",value:function(){var e=this,t=J.workspaceIds.map((function(t){return e.getWorkspaceSummary(t)}));return{id:this._frameId,config:{},workspaces:t}}},{key:"getSnapshot",value:function(e){try{return this.getWorkspaceConfig(e)}catch(e){return this.getFrameSnapshot()}}},{key:"extractWindowSummariesFromSnapshot",value:function(e){var t=[];return function e(n,r){"component"!==n.type?n.content.forEach((function(t){return e(t,q(n.id))})):t.push({itemId:q(n.id),parentId:r,config:n.workspacesConfig})}(e,void 0),t}},{key:"findElementInConfig",value:function(e,t){return function t(n){return n.id===e?[n]:("component"!==n.type?n.content:[]).reduce((function(e,n){return[].concat(Object(u.a)(e),Object(u.a)(t(n)))}),[])}(t).find((function(e){return e.id}))}},{key:"getWorkspaceTabIndex",value:function(e){var t,n=null===(t=J.workspaceLayout.root.getItemsById(e)[0])||void 0===t?void 0:t.parent;return n?n.header.tabs.findIndex((function(t){return t.contentItem.config.id===e})):0}},{key:"getWindowSummaryCore",value:function(e,t){var n,r=e.parent.getActiveContentItem().config.id===e.config.id,i=void 0!==e.config.componentState.windowId,o=this.getWindowPositionIndex(e),a=null===(n=J.getByWindowId(t))||void 0===n?void 0:n.id,s=e.config.componentState,c=s.appName,u=s.url,d=s.windowId,l=this.getUserFriendlyParent(e);return{itemId:q(e.config.id),parentId:q(l.config.id),config:{frameId:this._frameId,isFocused:r,isLoaded:i,positionIndex:o,workspaceId:a,windowId:d,isMaximized:this.isWindowMaximized(d),appName:c,url:u,title:e.config.title}}}},{key:"getWindowPositionIndex",value:function(e){var t=e.parent.contentItems.indexOf(e);return-1===t?e.parent.contentItems.length:t}},{key:"getUserFriendlyParent",value:function(e){return e.parent?e.parent.config.workspacesConfig.wrapper?this.getUserFriendlyParent(e.parent):e.parent:e}},{key:"transformComponentsToWindowSummary",value:function(e){var t,n=this;if("component"!==e.type||"emptyVisibleWindow"!==e.componentName){if("component"===e.type){var r=this.getWindowSummarySync(e.id);return e.workspacesConfig=e.workspacesConfig||{},void(e.workspacesConfig=Object.assign(Object.assign({},e.workspacesConfig),r.config))}null===(t=e.content)||void 0===t||t.map((function(e){return n.transformComponentsToWindowSummary(e)}))}}},{key:"transformParentsToContainerSummary",value:function(e){var t,n=this;if("component"!==e.type){if("stack"===e.type||"row"===e.type||"column"===e.type){var r=this.getContainerSummary(e.id);e.workspacesConfig=e.workspacesConfig||{},e.workspacesConfig=Object.assign(Object.assign({},e.workspacesConfig),r.config)}null===(t=e.content)||void 0===t||t.map((function(e){return n.transformParentsToContainerSummary(e)}))}}},{key:"waitForWindowContentItem",value:function(e){var t=this;return new Promise((function(n){var r=t._layoutEventEmitter.onContentComponentCreated((function(t){t.config.id===e&&(r(),n())}));J.getWindowContentItem(e)&&(r(),n())}))}}]),e}(),ke=function(){function e(){Object(s.a)(this,e),this._pattern=/^Untitled ([0-9]+)$/}return Object(c.a)(e,[{key:"getTitle",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=e.filter((function(e){return t._pattern.test(e)})).map((function(e){return parseInt(t._pattern.exec(e)[1],10)}));return"Untitled "+((r.length?r.sort((function(e,t){return e-t}))[r.length-1]:0)+1+n)}}]),e}(),xe=function(){function e(t){Object(s.a)(this,e),this._titleGenerator=new ke,this._defaultWorkspaceLayoutSettings={showCloseIcon:!1,showMaximizeIcon:!1,showPopoutIcon:!1,disableDragProxy:!0,mode:"workspace"},this._glue=t}return Object(c.a)(e,[{key:"createEmptyVisibleWindowConfig",value:function(){return Object.assign(Object.assign({},this.createWindowConfigurationCore()),{componentState:{header:!1}})}},{key:"createGDWindowConfig",value:function(e){var t=this.createWindowConfigurationCore(e.id);return Object.assign(Object.assign({},t),{componentName:"app"+t.id,windowId:e.windowId,title:e.title,componentState:{windowId:e.windowId,appName:e.appName,url:e.url,title:e.title,context:e.context}})}},{key:"createApiWindow",value:function(e){return{id:Array.isArray(e.id)?e.id[0]:e.id,type:"window",config:{windowId:e.windowId,isMaximized:e.isMaximized,isLoaded:void 0!==e.windowId,isFocused:e.isFocused,appName:e.appName,url:e.url,title:e.title,workspaceId:e.workspaceId,frameId:e.frameId,positionIndex:e.positionIndex}}}},{key:"getWorkspaceLayoutComponentName",value:function(e){return"workspace"+e}},{key:"getWorkspaceTitle",value:function(e){return this._titleGenerator.getTitle(e)}},{key:"getId",value:function(){return me.generate()}},{key:"getDefaultWorkspaceSettings",value:function(){return{mode:"default",showCloseIcon:!1,showPopoutIcon:!0}}},{key:"getDefaultFrameConfig",value:function(){var e=me.generate();return{frameId:void 0,workspaceConfigs:[{id:e,config:this.getDefaultWorkspaceConfig()}],workspaceLayout:{settings:this._defaultWorkspaceLayoutSettings,content:[{type:"stack",content:[{type:"component",id:e,componentName:this.getWorkspaceLayoutComponentName(e),componentState:{},workspacesConfig:{},title:this.getWorkspaceTitle(J.workspaceTitles)}],workspacesConfig:{}}]}}}},{key:"getDefaultWorkspaceConfig",value:function(){}},{key:"generateInitialConfig",value:function(e){var t=this,n={settings:this._defaultWorkspaceLayoutSettings,content:[{type:"stack",content:e.map((function(e){var n,r,i,o=me.generate();return{workspacesConfig:{},type:"component",id:(null==e?void 0:e.id)||o,componentName:t.getWorkspaceLayoutComponentName(q(null==e?void 0:e.id)||o),componentState:{},noTabHeader:null===(n=null==e?void 0:e.workspacesOptions)||void 0===n?void 0:n.noTabHeader,title:(null===(r=null==e?void 0:e.workspacesOptions)||void 0===r?void 0:r.title)||(null===(i=null==e?void 0:e.workspacesOptions)||void 0===i?void 0:i.name)||t.getWorkspaceTitle(J.workspaceIds)}})),workspacesConfig:{}}]};return{frameId:void 0,workspaceConfigs:e.map((function(e,t){var r=null==e?void 0:e.id;return r||"component"===n.content[0].type||(r=n.content[0].content[t].id),{id:r,config:e}})),workspaceLayout:n}}},{key:"wrapInGroup",value:function(e){return this.wrap(e,"stack")}},{key:"getAppNameFromWindowId",value:function(e){var t=this._glue.appManager.instances().find((function(t){return t.agm.windowId===e}));return null==t?void 0:t.application.name}},{key:"createWindowConfigurationCore",value:function(e){return{workspacesConfig:{},type:"component",id:e||this.getId(),componentName:"emptyVisibleWindow"}}},{key:"wrap",value:function(e,t){return{workspacesConfig:{wrapper:!0},type:t,content:e}}}]),e}(),_e=function(){function e(){Object(s.a)(this,e),this.registry=H()}return Object(c.a)(e,[{key:"onFrameEvent",value:function(e){return this.registry.add("frame",e)}},{key:"onWindowEvent",value:function(e){return this.registry.add("window",e)}},{key:"onContainerEvent",value:function(e){return this.registry.add("container",e)}},{key:"onWorkspaceEvent",value:function(e){return this.registry.add("workspace",e)}},{key:"raiseFrameEvent",value:function(e){this.registry.execute("frame",e.action,e.payload)}},{key:"raiseWindowEvent",value:function(e){this.registry.execute("window",e.action,e.payload)}},{key:"raiseContainerEvent",value:function(e){this.registry.execute("container",e.action,e.payload)}},{key:"raiseWorkspaceEvent",value:function(e){this.registry.execute("workspace",e.action,e.payload)}}]),e}(),Ie=function(){function e(t){Object(s.a)(this,e),this._configFactory=t,this.flat=function(e){return e.reduce((function(e,t){return[].concat(Object(u.a)(e),Object(u.a)(Array.isArray(t)?t:[t]))}),[])}}return Object(c.a)(e,[{key:"convertToRendererConfig",value:function(e){if(e)return this.convertToRendererConfigCore(e,void 0)}},{key:"convertToAPIConfig",value:function(e){if(e)return this.convertToApiConfigCore(e)}},{key:"convertToRendererConfigCore",value:function(e,t){var n,r,i,o,a,s,c,d=this,l={type:e.type,content:[],workspacesOptions:e.config||{}};if("workspace"!==e.type&&e.type||(l=this.applyDefaultRendererConfig({content:[],workspacesOptions:e.config})),"workspace"===e.type||!e.type){var p,h=e,f=h.children;return f.length>1&&f.every((function(e){return"column"===e.type}))?l.content.push(this.wrap(f.map((function(e){return d.convertToRendererConfigCore(e,h)})),"row")):f.length>1&&f.every((function(e){return"row"===e.type}))?l.content.push(this.wrap(f.map((function(e){return d.convertToRendererConfigCore(e,h)})),"column")):(p=l.content).push.apply(p,Object(u.a)(f.map((function(e){return d.convertToRendererConfigCore(e,h)})))),l}if("column"===e.type||"row"===e.type)return(n=l.content).push.apply(n,Object(u.a)(e.children.map((function(t){return d.convertToRendererConfigCore(t,e)})))),0===l.content.length&&l.content.push(this.getGroupWithEmptyVisibleWindow()),l;if("group"===e.type)return l.type="stack",(r=l.content).push.apply(r,Object(u.a)(e.children.map((function(t){return d.convertToRendererConfigCore(t,e)})))),0===l.content.length&&l.content.push(this._configFactory.createEmptyVisibleWindowConfig()),l;if("window"===e.type){var m=(null===(i=e.config)||void 0===i?void 0:i.appName)||e.appName,v=null===(o=e.config)||void 0===o?void 0:o.windowId;!m&&v&&(m=this._configFactory.getAppNameFromWindowId(v));var g=this._configFactory.createGDWindowConfig({windowId:v,id:e.id,appName:m,url:(null===(a=e.config)||void 0===a?void 0:a.url)||e.url,title:(null===(s=e.config)||void 0===s?void 0:s.title)||e.title,context:(null===(c=e.config)||void 0===c?void 0:c.context)||e.context});return"group"!==t.type?(g.componentState.header=!1,this.wrap([g],"stack")):g}}},{key:"convertToApiConfigCore",value:function(e){var t=this;if(!e.type||"workspace"===e.type){e=e;var n=this.flat(e.content.map((function(e){return t.convertToApiConfigCore(e)})));return{id:q(e.id),config:e.workspacesOptions,children:n}}if("component"===e.type&&"emptyVisibleWindow"===e.componentName)return[];if("component"!==e.type&&e.workspacesConfig&&e.workspacesConfig.wrapper)return this.flat(e.content.map((function(e){return t.convertToApiConfigCore(e)})));if("component"===e.type){var r=e.workspacesConfig;return this._configFactory.createApiWindow({id:e.id,isFocused:!1,isMaximized:r.isMaximized,windowId:e.componentState.windowId,appName:e.componentState.appName,url:e.componentState.url,frameId:r.frameId,workspaceId:r.workspaceId,title:r.title,positionIndex:r.positionIndex})}return{id:q(e.id),type:"stack"===e.type?"group":e.type,children:this.flat(e.content.map((function(e){return t.convertToApiConfigCore(e)}))),config:{}}}},{key:"wrap",value:function(e,t){return{workspacesConfig:{wrapper:!0},type:t,content:e}}},{key:"applyDefaultRendererConfig",value:function(e){return Object.assign({settings:Object.assign({},this._configFactory.getDefaultWorkspaceSettings())},e)}},{key:"getGroupWithEmptyVisibleWindow",value:function(){return this.wrap([this._configFactory.createEmptyVisibleWindowConfig()],"stack")}}]),e}(),Ce=function(){function e(t,n,r){Object(s.a)(this,e),this._externalPopupManager=t,this._componentPopupManager=n,this._componentFactory=r}return Object(c.a)(e,[{key:"showAddWindowPopup",value:function(e,t){var n;return j(this,void 0,void 0,a.a.mark((function r(){return a.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",(null===(n=this._componentFactory)||void 0===n?void 0:n.createAddApplicationPopup)?this._componentPopupManager.showAddWindowPopup(e,t):this._externalPopupManager.showAddWindowPopup(e,t));case 1:case"end":return r.stop()}}),r,this)})))}},{key:"showOpenWorkspacePopup",value:function(e,t){var n;return j(this,void 0,void 0,a.a.mark((function r(){return a.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",(null===(n=this._componentFactory)||void 0===n?void 0:n.createAddWorkspacePopup)?this._componentPopupManager.showOpenWorkspacePopup(e):this._externalPopupManager.showOpenWorkspacePopup(e,t));case 1:case"end":return r.stop()}}),r,this)})))}},{key:"showSaveWorkspacePopup",value:function(e,t){var n;return j(this,void 0,void 0,a.a.mark((function r(){return a.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",(null===(n=this._componentFactory)||void 0===n?void 0:n.createSaveWorkspacePopup)?this._componentPopupManager.showSaveWorkspacePopup(e,t):this._externalPopupManager.showSaveWorkspacePopup(e,t));case 1:case"end":return r.stop()}}),r,this)})))}},{key:"hidePopup",value:function(){this._externalPopupManager.hidePopup(),this._componentFactory&&this._componentPopupManager.hidePopup()}}]),e}(),Se=function(){function e(t){Object(s.a)(this,e),this._addApplicationType="addApplication",this._openWorkspaceType="openWorkspace",this._saveWorkspaceType="saveWorkspace",this._showPopupMethod="T42.Workspaces.ShowPopup",this._glue=t,this.initPopup(),this.registerHideMethod(),this.registerResizeMethod()}return Object(c.a)(e,[{key:"showAddWindowPopup",value:function(e,t){return j(this,void 0,void 0,a.a.mark((function n(){var r;return a.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.hidePopup(),n.next=3,this.getPopupSize(this._addApplicationType,t);case 3:r=n.sent,this.showElement(this._popup,e,r);case 5:case"end":return n.stop()}}),n,this)})))}},{key:"showOpenWorkspacePopup",value:function(e,t){return j(this,void 0,void 0,a.a.mark((function n(){var r;return a.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.hidePopup(),n.next=3,this.getPopupSize(this._openWorkspaceType,t);case 3:r=n.sent,this.showElement(this._popup,e,r);case 5:case"end":return n.stop()}}),n,this)})))}},{key:"showSaveWorkspacePopup",value:function(e,t){return j(this,void 0,void 0,a.a.mark((function n(){var r;return a.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.hidePopup(),n.next=3,this.getPopupSize(this._saveWorkspaceType,t);case 3:r=n.sent,this.showElement(this._popup,e,r);case 5:case"end":return n.stop()}}),n,this)})))}},{key:"hidePopup",value:function(){$(this._popup).css("visibility","hidden")}},{key:"initPopup",value:function(){}},{key:"showElement",value:function(e,t,n){$(e).css("visibility","visible").css("top",t.top+"px").css("left",t.left+"px"),n.height&&$(e).css("height",n.height+"px"),n.width&&$(e).css("width",n.width+"px");var r=e.getBoundingClientRect(),i=document.body.getBoundingClientRect(),o=i.width-r.right-10,a=i.height-r.bottom-10;o<0&&$(e).css("left",t.left+o),a<0&&$(e).css("top",t.top+a)}},{key:"resizePopup",value:function(e){var t=$(this._popup);e.height&&t.css("height",e.height+"px"),e.width&&t.css("width",e.width+"px");var n=this._popup.getBoundingClientRect(),r=document.body.getBoundingClientRect(),i=r.width-n.right-10,o=r.height-n.bottom-10;if(i<0){var a=t.css("left"),s=parseInt(a.substring(0,a.length-2));t.css("left",s+i)}if(o<0){var c=t.css("top"),u=parseInt(c.substring(0,c.length-2));t.css("top",u+o)}}},{key:"getPopupSize",value:function(e,t){return j(this,void 0,void 0,a.a.mark((function n(){var r,i;return a.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=this.getPopupInteropId(),i=this._glue.agm.servers().find((function(e){return e.windowId===r})),n.next=3,this._glue.agm.invoke(this._showPopupMethod,{type:e,payload:t},i);case 3:return n.abrupt("return",n.sent.returned);case 4:case"end":return n.stop()}}),n,this)})))}},{key:"registerHideMethod",value:function(){}},{key:"registerResizeMethod",value:function(){}},{key:"getPopupInteropId",value:function(){try{return this._popup.contentWindow.interopId||"best"}catch(e){console.warn("Could not get the popup interop id using best")}return"best"}},{key:"getPopupWindowTemplate",value:function(e){return'<iframe id="popup" src="'.concat(e,'" class="popup"></iframe>')}}]),e}(),Ee=function(){function e(t,n){var r,o=this;Object(s.a)(this,e),this._addApplicationType="addApplication",this._openWorkspaceType="openWorkspace",this._saveWorkspaceType="saveWorkspace",this._popupSizes=(r={},Object(i.a)(r,this._addApplicationType,{height:200,width:200}),Object(i.a)(r,this._openWorkspaceType,{height:200,width:200}),Object(i.a)(r,this._saveWorkspaceType,{height:200,width:200}),r),this.hidePopup=function(){return document.body.onclick=void 0,$(o._popup).css("visibility","hidden"),new Promise((function(e){var t;(null===(t=o._componentFactory)||void 0===t?void 0:t.hideSystemPopups)?o._componentFactory.hideSystemPopups(e):e()}))},this._componentFactory=t,this._frameId=n,this.initPopup()}return Object(c.a)(e,[{key:"showAddWindowPopup",value:function(e,t){var n=t.workspaceId,r=t.parentType,i=t.boxId;return j(this,void 0,void 0,a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.showInternalAddAppPopup(e,i,n,r);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"showOpenWorkspacePopup",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.showInternalOpenWorkspacePopup(e);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"showSaveWorkspacePopup",value:function(e,t){return j(this,void 0,void 0,a.a.mark((function n(){return a.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.showInternalSaveWorkspacePopup(e,t);case 2:case"end":return n.stop()}}),n,this)})))}},{key:"showInternalSaveWorkspacePopup",value:function(e,t){return j(this,void 0,void 0,a.a.mark((function n(){var r,i=this;return a.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.hidePopup();case 2:r=this.getPopupSize(this._saveWorkspaceType),this.showElement(this._popup,e,r),this._componentFactory.createSaveWorkspacePopup({domNode:this._popup,resizePopup:function(e){return i.resizePopup(e,i._saveWorkspaceType,$(i._popup))},hidePopup:this.hidePopup,workspaceId:t.workspaceId,buildMode:t.buildMode});case 4:case"end":return n.stop()}}),n,this)})))}},{key:"showInternalOpenWorkspacePopup",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){var n,r=this;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hidePopup();case 2:n=this.getPopupSize(this._openWorkspaceType),this.showElement(this._popup,e,n),this._componentFactory.createAddWorkspacePopup({domNode:this._popup,frameId:this._frameId,hidePopup:this.hidePopup,resizePopup:function(e){return r.resizePopup(e,r._openWorkspaceType,$(r._popup))}});case 4:case"end":return t.stop()}}),t,this)})))}},{key:"showInternalAddAppPopup",value:function(e,t,n,r){return j(this,void 0,void 0,a.a.mark((function r(){var i,o=this;return a.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.hidePopup();case 2:i=this.getPopupSize(this._addApplicationType),this.showElement(this._popup,e,i),this._componentFactory.createAddApplicationPopup({domNode:this._popup,boxId:t,resizePopup:function(e){return o.resizePopup(e,o._addApplicationType,$(o._popup))},hidePopup:this.hidePopup,workspaceId:n,frameId:this._frameId});case 4:case"end":return r.stop()}}),r,this)})))}},{key:"initPopup",value:function(){this._popup=document.createElement("div"),this._popup.classList.add("workspaces-system-popup"),document.body.appendChild(this._popup)}},{key:"showElement",value:function(e,t,n){var r=this;document.body.onclick=function(e){-1===e.composedPath().indexOf(r._popup)&&r.hidePopup()},document.body.onblur=function(e){"iframe"===document.activeElement.tagName.toLowerCase()&&r.hidePopup()},$(e).css("visibility","visible").css("top",t.top+"px").css("left",t.left+"px"),n.height&&$(e).css("height",n.height+"px"),n.width&&$(e).css("width",n.width+"px");var i=e.getBoundingClientRect(),o=document.body.getBoundingClientRect(),a=o.width-i.right-10,s=o.height-i.bottom-10;a<0&&$(e).css("left",t.left+a),s<0&&$(e).css("top",t.top+s)}},{key:"resizePopup",value:function(e,t,n){e.height&&(n.css("height",e.height+"px"),this._popupSizes[t].height=e.height),e.width&&(n.css("width",e.width+"px"),this._popupSizes[t].width=e.width);var r=n[0].getBoundingClientRect(),i=document.body.getBoundingClientRect(),o=i.width-r.right-10,a=i.height-r.bottom-10;if(o<0){var s=n.css("left"),c=parseInt(s.substring(0,s.length-2),10);n.css("left",c+o)}if(a<0){var u=n.css("top"),d=parseInt(u.substring(0,u.length-2),10);n.css("top",d+a)}}},{key:"getPopupSize",value:function(e){return this._popupSizes[e]}}]),e}(),We=function(){function e(t,n,r,i){Object(s.a)(this,e),this._glue=t,this._stateResolver=n,this._frameController=r,this._manager=i,this.registry=H(),this.WAIT_FOR_WINDOWS_TIMEOUT=3e4}return Object(c.a)(e,[{key:"start",value:function(e,t){var n,r;return j(this,void 0,void 0,a.a.mark((function i(){var o,s,c,u,d,l,p,h,f,m,v,g,y,w,b,k,x,_;return a.a.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if("emptyVisibleWindow"!==e.config.componentName){i.next=2;break}return i.abrupt("return");case 2:if(o=J.getById(t),s=G(e.element),c=e.config.componentState,u=c.title,d=c.appName,l=c.windowId,p=q(e.config.id),h=this.getTitleByAppName(d),f=this.vaidateTitle(u)||this.vaidateTitle(h)||this.vaidateTitle(d)||"Glue",m=null===(n=null==e?void 0:e.config.componentState)||void 0===n?void 0:n.context,v=this.getUrlByAppName(c.appName)||c.url,g=!J.getWindow(p),y=o.hibernatedWindows.some((function(t){return t.id===q(e.config.id)})),J.addWindow({id:p,bounds:s,windowId:l,url:v,appName:d},o.id),v||!l){i.next=13;break}return w=this._glue.windows.list().find((function(e){return e.id===l})),i.next=11,w.getURL();case 11:v=i.sent,J.getWindow(p).url=v;case 13:if(l=l||me.generate(),(null===(r=e.config.componentState)||void 0===r?void 0:r.context)&&delete e.config.componentState.context,e.config.componentState.url=v,f&&e.setTitle(f),!g||y){i.next=25;break}if(b=this._stateResolver.getWindowSummarySync(p,e),this._manager.workspacesEventEmitter.raiseWindowEvent({action:"added",payload:{windowSummary:b}}),!(k=this._glue.windows.findById(l))){i.next=25;break}return i.prev=18,i.next=21,k.close();case 21:i.next=25;break;case 23:i.prev=23,i.t0=i.catch(18);case 25:return i.prev=25,i.next=28,this.notifyFrameWillStart(l,d,m,f);case 28:return i.next=30,this._frameController.startFrame(p,v,void 0,l);case 30:if(x=J.getWindow(p),e.config.componentState.windowId=l,x.windowId=l,this._glue.windows.findById(l).getTitle().then((function(t){e.setTitle(t)})).catch((function(e){console.warn("Failed while setting the window title",e)})),this._frameController.moveFrame(p,G(e.element)),i.t1=g&&!y,!i.t1){i.next=44;break}return i.t2=this._manager.workspacesEventEmitter,i.next=40,this._stateResolver.getWindowSummary(p);case 40:i.t3=i.sent,i.t4={windowSummary:i.t3},i.t5={action:"loaded",payload:i.t4},i.t2.raiseWindowEvent.call(i.t2,i.t5);case 44:if(d){i.next=49;break}if(_=this.getAppNameByWindowId(l),e.config.componentState){i.next=48;break}throw new Error("Invalid state - the created component ".concat(p," with windowId ").concat(l," is missing its state object"));case 48:e.config.componentState.appName=_,x.appName=_;case 49:i.next=55;break;case 51:if(i.prev=51,i.t6=i.catch(25),this.raiseFailed(e,t),e.config.componentState.windowId=void 0,v?this._frameController.moveFrame(p,G(e.element)):this._manager.closeTab(e,!1),J.getById(t)){i.next=55;break}throw new Error("Workspace ".concat(t," failed ot initialize because none of the specified windows were able to load\n Internal error: ").concat(i.t6));case 55:return i.prev=55,o.hibernatedWindows=o.hibernatedWindows.filter((function(t){return t.id!==q(e.config.id)})),i.finish(55);case 58:case"end":return i.stop()}}),i,this,[[18,23],[25,51,55,58]])})))}},{key:"notifyFrameWillClose",value:function(e,t){return this._glue.interop.invoke("T42.Web.Platform.Control",{domain:t?"appManager":"windows",operation:t?"unregisterWorkspaceApp":"unregisterWorkspaceWindow",data:{windowId:e}})}},{key:"onStarted",value:function(e){return this.registry.add("on-started",e)}},{key:"onLoaded",value:function(e){return this.registry.add("on-loaded",e)}},{key:"onFailed",value:function(e){return this.registry.add("on-failed",e)}},{key:"waitForWindows",value:function(e,t){var n=this;return new Promise((function(i,o){var a,s=function(){},c=function(){},u=n.waitFor(t.length,(function(){i(),s(),c(),clearTimeout(a)})),d=Object(r.a)(u,2),l=d[0],p=d[1];a=setTimeout((function(){o("Waiting for windows ".concat(JSON.stringify(t)," in workspace ").concat(e,", but only heard ").concat(JSON.stringify(p())," in ").concat(n.WAIT_FOR_WINDOWS_TIMEOUT," seconds"))}),n.WAIT_FOR_WINDOWS_TIMEOUT),s=n.onLoaded((function(n){var r=n.summary;r.config.workspaceId===e&&t.includes(r.itemId)&&l(r.itemId)})),c=n.onFailed((function(n){n.workspaceId===e&&t.includes(q(n.component.config.id))&&l(n.component.config.id)}))}))}},{key:"getUrlByAppName",value:function(e){var t,n,r,i;if(e)return null===(i=null===(r=null===(n=null===(t=this._glue.appManager)||void 0===t?void 0:t.application(e))||void 0===n?void 0:n.userProperties)||void 0===r?void 0:r.details)||void 0===i?void 0:i.url}},{key:"raiseStarted",value:function(e){this.registry.execute("on-started",{summary:e})}},{key:"raiseLoaded",value:function(e){this.registry.execute("on-loaded",{summary:e})}},{key:"raiseFailed",value:function(e,t){this.registry.execute("on-failed",{component:e,workspaceId:t})}},{key:"getTitleByAppName",value:function(e){var t,n;if(e)return null===(n=null===(t=this._glue.appManager)||void 0===t?void 0:t.application(e))||void 0===n?void 0:n.title}},{key:"getAppNameByWindowId",value:function(e){var t,n,r,i;return null===(i=null===(r=null===(n=null===(t=this._glue.appManager)||void 0===t?void 0:t.instances())||void 0===n?void 0:n.find((function(t){return t.id===e})))||void 0===r?void 0:r.application)||void 0===i?void 0:i.name}},{key:"notifyFrameWillStart",value:function(e,t,n,r){return this._glue.interop.invoke("T42.Web.Platform.Control",{domain:t?"appManager":"windows",operation:t?"registerWorkspaceApp":"registerWorkspaceWindow",data:{name:"".concat(t||"window","_").concat(e),windowId:e,frameId:this._manager.frameId,appName:t,context:n,title:r}})}},{key:"waitFor",value:function(e,t){var n=[];return[function(r){n.push(r),n.length===e&&t()},function(){return n}]}},{key:"vaidateTitle",value:function(e){if(null==e?void 0:e.length)return e}}]),e}(),Te=new(function(){function e(){var t=this;Object(s.a)(this,e),this._isLayoutInitialized=!1,this._initPromise=Promise.resolve(),this._workspacesEventEmitter=new _e,this._titleGenerator=new ke,this.getComponentBounds=function(){return t._controller.bounds},this.subscribeForWindowClicked=function(e){return t._frameController.onFrameContentClicked(e)},this.cleanUp=function(){var e;if(t._isDisposing=!0,!(null===(e=ye.config)||void 0===e?void 0:e.build)){var n=[],r=J.workspaceIds.map((function(e){var r=J.getById(e);n.push.apply(n,Object(u.a)(r.windows.map((function(e){return t.stateResolver.getWindowSummarySync(e.id)}))));var i=t.stateResolver.getWorkspaceConfig(e),o=t.stateResolver.extractWindowSummariesFromSnapshot(i);return n.push.apply(n,Object(u.a)(o)),t.stateResolver.getWorkspaceSummary(e)}));n.forEach((function(e){t._applicationFactory.notifyFrameWillClose(e.config.windowId,e.config.appName).catch((function(e){})),t.workspacesEventEmitter.raiseWindowEvent({action:"removed",payload:{windowSummary:e}})})),r.forEach((function(e){t.workspacesEventEmitter.raiseWorkspaceEvent({action:"closed",payload:{frameSummary:{id:t._frameId},workspaceSummary:e}})}));var i=J.layouts.filter((function(e){var t,n,r;return!(null===(r=null===(n=null===(t=e.layout)||void 0===t?void 0:t.config)||void 0===n?void 0:n.workspacesOptions)||void 0===r?void 0:r.noTabHeader)}));t._layoutsManager.saveWorkspacesFrame(i),t.workspacesEventEmitter.raiseFrameEvent({action:"closed",payload:{frameSummary:{id:t._frameId}}})}}}return Object(c.a)(e,[{key:"init",value:function(e,t,n,r){this._glue=e,this._facade=n;var i=ye.loadConfig();if(!this._initialized){this._initialized=!0,this._frameId=t,this._configFactory=new xe(e);var o=new Ie(this._configFactory);X.init(this._frameId,r);var a=new Q(H());return this._stateResolver=new be(this._frameId,a),this._controller=new Z(a,this._stateResolver,i,this._configFactory),this._frameController=new ve(e),this._applicationFactory=new We(e,this.stateResolver,this._frameController,this),this._layoutsManager=new we(this.stateResolver,e,this._configFactory,o),this._popupManager=new Ce(new Se(e),new Ee(r,t),r),i.emptyFrame||this.initLayout(),{cleanUp:this.cleanUp}}X.reInitialize(r)}},{key:"saveWorkspace",value:function(e,t,n){var r;return j(this,void 0,void 0,a.a.mark((function i(){var o,s,c;return a.a.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return o=J.getById(t)||J.getActiveWorkspace(),i.next=3,this._layoutsManager.save({name:e,workspace:o,title:J.getWorkspaceTitle(o.id),saveContext:n});case 3:return s=i.sent,c=(null===(r=o.layout)||void 0===r?void 0:r.config)||o.hibernateConfig,i.abrupt("return",(c.workspacesOptions.layoutName=e,c.workspacesOptions.noTabHeader&&delete c.workspacesOptions.noTabHeader,s));case 6:case"end":return i.stop()}}),i,this)})))}},{key:"openWorkspace",value:function(e,t){var n;return j(this,void 0,void 0,a.a.mark((function r(){var i,o,s=this;return a.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this._layoutsManager.getWorkspaceByName(e);case 2:if(i=r.sent,(o=i.config).workspacesOptions.context=i.layoutData.context,(null==t?void 0:t.context)&&o.workspacesOptions.context?o.workspacesOptions.context=Object.assign(i.layoutData.context,null==t?void 0:t.context):(null==t?void 0:t.context)&&(o.workspacesOptions.context=null==t?void 0:t.context),(null==t?void 0:t.title)&&(o.workspacesOptions.title=null==t?void 0:t.title),o&&o.workspacesOptions&&!o.workspacesOptions.name&&(o.workspacesOptions.name=e),o&&(o.workspacesOptions=o.workspacesOptions||{},o.workspacesOptions.layoutName=i.layoutData.name),o&&void 0!==(null==t?void 0:t.noTabHeader)&&(o.workspacesOptions=o.workspacesOptions||{},o.workspacesOptions.noTabHeader=null==t?void 0:t.noTabHeader),!this._isLayoutInitialized){r.next=32;break}if(!e){r.next=28;break}if(o.id=(null==t?void 0:t.reuseWorkspaceId)||this._configFactory.getId(),!(null==t?void 0:t.reuseWorkspaceId)){r.next=23;break}return J.getById(o.id).windows.map((function(e){return J.getWindowContentItem(e.id)})).filter((function(e){return e})).map((function(e){return s.closeTab(e,!1)})),r.next=17,this._controller.reinitializeWorkspace(o.id,o);case 17:if(r.t2=null===(n=o.workspacesOptions)||void 0===n?void 0:n.context,!r.t2){r.next=21;break}return r.next=21,this._glue.contexts.set(V(o.id),o.workspacesOptions.context);case 21:r.next=25;break;case 23:return r.next=25,this.addWorkspace(q(o.id),o);case 25:r.t1=q(o.id),r.next=29;break;case 28:r.t1=void 0;case 29:r.t0=r.t1,r.next=37;break;case 32:return this._layoutsManager.setInitialWorkspaceConfig(o),this._initPromise=this.initLayout(),r.next=36,this._initPromise;case 36:r.t0=q(o.id);case 37:return r.abrupt("return",r.t0);case 38:case"end":return r.stop()}}),r,this)})))}},{key:"exportAllLayouts",value:function(){return this._layoutsManager.export()}},{key:"deleteLayout",value:function(e){this._layoutsManager.delete(e)}},{key:"maximizeItem",value:function(e){this._controller.maximizeWindow(e)}},{key:"restoreItem",value:function(e){this._controller.restoreWindow(e)}},{key:"closeItem",value:function(e){var t=this,n=J.getWindow(e),r=J.getContainer(e);if(this._frameId===e)J.workspaceIds.forEach((function(e){return t.closeWorkspace(J.getById(e))}));else if(n){var i=J.getWindowContentItem(e);if(!i)throw new Error("Could not find item ".concat(e," to close"));this.closeTab(i)}else if(r)this._controller.closeContainer(e);else{var o=J.getById(e);this.closeWorkspace(o)}}},{key:"addContainer",value:function(e,t){return this._controller.addContainer(e,t)}},{key:"addWindow",value:function(e,t){var n=J.getContainer(t);return n&&"stack"===n.type||"component"!==e.type||(e=this._configFactory.wrapInGroup([e])),this._controller.addWindow(e,t)}},{key:"setItemTitle",value:function(e,t){J.getById(e)?this._controller.setWorkspaceTitle(e,t):this._controller.setWindowTitle(e,t)}},{key:"eject",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){var n,r,i,o,s,c,u,d,l;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.config.componentState,r=n.appName,i=n.url,o=n.windowId,s=J.getWorkspaceContext(J.getByWindowId(e.config.id).id),!(c=this._glue.windows.findById(o))){t.next=12;break}return t.next=9,c.getContext();case 9:t.t0=t.sent,t.next=13;break;case 12:t.t0=s;case 13:if(u=t.t0,this.closeItem(q(e.config.id)),!r){t.next=20;break}return d=o?{reuseId:o}:void 0,t.next=18,this._glue.appManager.application(r).start(u,d);case 18:return t.t1=t.sent.id,t.abrupt("return",{windowId:t.t1});case 20:return l=this._applicationFactory.getUrlByAppName(r)||i,t.next=23,this._glue.windows.open("".concat(r,"_").concat(o),l,{context:u,windowId:o});case 23:return t.t2=t.sent.id,t.abrupt("return",{windowId:t.t2});case 25:case"end":return t.stop()}}),t,this)})))}},{key:"createWorkspace",value:function(e){var t,n;return j(this,void 0,void 0,a.a.mark((function r(){var i,o=this;return a.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(this._isLayoutInitialized){r.next=7;break}return e.id=this._configFactory.getId(),this._layoutsManager.setInitialWorkspaceConfig(e),this._initPromise=this.initLayout(),r.next=6,this._initPromise;case 6:return r.abrupt("return",q(e.id));case 7:if(i=(null===(t=e.workspacesOptions)||void 0===t?void 0:t.reuseWorkspaceId)||this._configFactory.getId(),!(null===(n=e.workspacesOptions)||void 0===n?void 0:n.reuseWorkspaceId)){r.next=18;break}return J.getById(i).windows.map((function(e){return J.getWindowContentItem(e.id)})).filter((function(e){return e})).map((function(e){return o.closeTab(e,!1)})),r.next=12,this._controller.reinitializeWorkspace(i,e);case 12:if(r.t0=e.workspacesOptions.context,!r.t0){r.next=16;break}return r.next=16,this._glue.contexts.set(V(i),e.workspacesOptions.context);case 16:r.next=20;break;case 18:return r.next=20,this.addWorkspace(i,e);case 20:return r.abrupt("return",i);case 21:case"end":return r.stop()}}),r,this)})))}},{key:"loadWindow",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){var n,r,i=this;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=J.getWindowContentItem(e)){t.next=3;break}throw new Error("Could not find window ".concat(e," to load"));case 3:if(r=n.config.componentState.windowId,t.t0=r,t.t0){t.next=10;break}return t.next=8,this.waitForFrameLoaded(e);case 8:n=J.getWindowContentItem(e),r=n.config.componentState.windowId;case 10:return t.abrupt("return",new Promise((function(t,n){r||n("The window id of ".concat(e," is missing"));var o=function(){},a=setTimeout((function(){n("Could not load window ".concat(r," for 5000ms")),o()}),5e3);o=i._glue.windows.onWindowAdded((function(e){e.id===r&&(t({windowId:r}),o(),clearTimeout(a))})),i._glue.windows.list().find((function(e){return e.id===r}))&&(t({windowId:r}),o(),clearTimeout(a))})));case 11:case"end":return t.stop()}}),t,this)})))}},{key:"focusItem",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){var n;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=J.getById(e),t.t0=this._frameId===e,t.t0){t.next=12;break}if(!n){t.next=11;break}if(t.t1=n.hibernateConfig,!t.t1){t.next=8;break}return t.next=8,this.resumeWorkspace(n.id);case 8:this._controller.focusWorkspace(n.id),t.next=12;break;case 11:this._controller.focusWindow(e);case 12:case"end":return t.stop()}}),t,this)})))}},{key:"bundleWorkspace",value:function(e,t){if(this._stateResolver.isWorkspaceHibernated(e))throw new Error("Could not bundle workspace ".concat(e," because its hibernated"));this._controller.bundleWorkspace(e,t)}},{key:"move",value:function(e){return this._glue.windows.my().moveTo(e.y,e.x)}},{key:"getFrameSummary",value:function(e){var t=J.getByContainerId(e)||J.getByWindowId(e)||J.getById(e),n=this._frameId===e;return{id:t||n?this._frameId:"none"}}},{key:"moveWindowTo",value:function(e,t){return j(this,void 0,void 0,a.a.mark((function n(){var r,i;return a.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=J.getByContainerId(t)||J.getById(t)){n.next=3;break}throw new Error("Could not find container ".concat(t," in frame ").concat(this._frameId));case 3:if(!this._stateResolver.isWorkspaceHibernated(r.id)){n.next=5;break}throw new Error("Could not move window ".concat(e," to workspace ").concat(r.id," because its hibernated"));case 5:if(i=J.getWindowContentItem(e)){n.next=8;break}throw new Error("Could not find window ".concat(e," in frame ").concat(this._frameId));case 8:return n.abrupt("return",(this.closeTab(i),this._controller.addWindow(i.config,t)));case 9:case"end":return n.stop()}}),n,this)})))}},{key:"generateWorkspaceLayout",value:function(e,t){var n=J.getById(t);if(!n)throw new Error("Could not find workspace with id "+t);return this._layoutsManager.generateLayout(e,n)}},{key:"resumeWorkspace",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){var n,r;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=J.getById(e)){t.next=3;break}throw new Error("Could not find workspace ".concat(e," in any of the frames"));case 3:return(r=n.hibernateConfig).workspacesOptions||(r.workspacesOptions={}),r.workspacesOptions.reuseWorkspaceId=e,t.next=8,this.createWorkspace(r);case 8:n.hibernateConfig=void 0,this._controller.showSaveIcon(e);case 10:case"end":return t.stop()}}),t,this)})))}},{key:"hibernateWorkspace",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){var n,r,i=this;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=J.getById(e),J.getActiveWorkspace().id!==n.id){t.next=3;break}throw new Error("Cannot hibernate workspace ".concat(n.id," because its active"));case 3:if(!this.stateResolver.isWorkspaceHibernated(e)){t.next=5;break}throw new Error("Cannot hibernate workspace ".concat(e," because it has already been hibernated"));case 5:if(n.layout){t.next=7;break}throw new Error("Cannot hibernate workspace ".concat(n.id," because its empty"));case 7:return t.next=9,this.stateResolver.getWorkspaceConfig(n.id);case 9:return r=t.sent,t.abrupt("return",(n.hibernatedWindows=n.windows,r.workspacesOptions.isHibernated=!0,n.hibernateConfig=r,n.windows.map((function(e){return J.getWindowContentItem(e.id)})).forEach((function(e){return i.closeTab(e,!1)})),J.removeLayout(n.id),this._controller.showHibernationIcon(e),r));case 11:case"end":return t.stop()}}),t,this)})))}},{key:"closeTab",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=q(e.config.id),r=J.getByWindowId(n),i=this.stateResolver.getWindowSummarySync(n);this._controller.removeLayoutElement(n),this._frameController.remove(n),this._applicationFactory.notifyFrameWillClose(i.config.windowId,i.config.appName).catch((function(e){})),r.hibernatedWindows.some((function(e){return i.itemId===e.id}))||this.workspacesEventEmitter.raiseWindowEvent({action:"removed",payload:{windowSummary:i}}),!r.windows.length&&t&&this.checkForEmptyWorkspace(r)}},{key:"unmount",value:function(){try{this._popupManager.hidePopup()}catch(e){console.warn(e)}}},{key:"initLayout",value:function(){return j(this,void 0,void 0,a.a.mark((function e(){var t,n=this;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._layoutsManager.getInitialConfig();case 2:return t=e.sent,this.subscribeForPopups(),this.subscribeForLayout(),this._isLayoutInitialized=!0,e.next=8,Promise.all(t.workspaceConfigs.map((function(e){var t,r;return n._glue.contexts.set(V(e.id),(null===(r=null===(t=e.config)||void 0===t?void 0:t.workspacesOptions)||void 0===r?void 0:r.context)||{})})));case 8:return e.next=10,this._controller.init({frameId:this._frameId,workspaceLayout:t.workspaceLayout,workspaceConfigs:t.workspaceConfigs});case 10:J.layouts.map((function(e){return e.layout})).filter((function(e){return e})).forEach((function(e){return n.reportLayoutStructure(e)})),ye.config.emptyFrame&&this._workspacesEventEmitter.raiseFrameEvent({action:"opened",payload:{frameSummary:{id:this._frameId}}});case 12:case"end":return e.stop()}}),e,this)})))}},{key:"subscribeForLayout",value:function(){var e=this;this._controller.emitter.onContentComponentCreated((function(t,n){return j(e,void 0,void 0,a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._applicationFactory.start(t,n);case 2:case"end":return e.stop()}}),e,this)})))})),this._controller.emitter.onContentItemResized((function(t,n){e._frameController.moveFrame(n,G(t))})),this._controller.emitter.onTabCloseRequested((function(t){return j(e,void 0,void 0,a.a.mark((function e(){var n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=J.getByWindowId(q(t.config.id)),this.closeTab(t),this._controller.removeLayoutElement(q(t.config.id)),this._frameController.remove(q(t.config.id)),n.windows.length||this.checkForEmptyWorkspace(n);case 2:case"end":return e.stop()}}),e,this)})))})),this._controller.emitter.onWorkspaceTabCloseRequested((function(t){e.closeWorkspace(t)})),this._controller.emitter.onTabElementMouseDown((function(t){var n=G(t.contentItem.element),r=Math.min(n.width,800),i=Math.min(n.height,600);e._controller.setDragElementSize(r,i)})),this._controller.emitter.onTabDragStart((function(t){var n=e._controller.getDragElement();new MutationObserver((function(n){Array.from(n).forEach((function(n){if("attributes"===n.type){var r=$(e._controller.getDragElement()).children(".lm_content").children(".lm_item_container"),i=G(r[0]),o=q(t.contentItem.config.id);e._frameController.moveFrame(o,i),e._frameController.bringToFront(o)}}))})).observe(n,{attributes:!0})})),this._controller.emitter.onTabDragEnd((function(t){var n=t.header.tabs.filter((function(e){return e.contentItem.config.id!==t.contentItem.config.id}));e._frameController.selectionChanged([q(t.contentItem.id)],n.map((function(e){return q(e.contentItem.id)})))})),this._controller.emitter.onSelectionChanged((function(t,n){return j(e,void 0,void 0,a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._popupManager.hidePopup(),this._frameController.selectionChanged(n.map((function(e){return e.id})),t.map((function(e){return e.id})));case 1:case"end":return e.stop()}}),e,this)})))})),this._controller.emitter.onWorkspaceAdded((function(t){var n,r=J.workspaceIds.filter((function(e){return e!==t.id})).reduce((function(e,t){return[].concat(Object(u.a)(e),Object(u.a)(J.getById(t).windows))}),[]);if(e._workspacesEventEmitter.raiseWorkspaceEvent({action:"opened",payload:{frameSummary:{id:e._frameId},workspaceSummary:e.stateResolver.getWorkspaceSummary(t.id)}}),J.getActiveWorkspace().id===t.id){if(e._workspacesEventEmitter.raiseWorkspaceEvent({action:"selected",payload:{frameSummary:{id:e._frameId},workspaceSummary:e.stateResolver.getWorkspaceSummary(t.id)}}),!t.layout)return void e._frameController.selectionChangedDeep([],r.map((function(e){return e.id})));var i=U(t.layout.toConfig().content);e._frameController.selectionChangedDeep(i.map((function(e){return q(e.id)})),r.map((function(e){return e.id})))}if(t.layout){var o=t.layout.config.workspacesOptions,a=o.title||o.name;a&&(null===(n=J.getWorkspaceLayoutItemById(t.id))||void 0===n||n.setTitle(a))}})),this._controller.emitter.onWorkspaceSelectionChanged((function(t,n){if(e._popupManager.hidePopup(),!t.layout)return e._frameController.selectionChangedDeep([],n.map((function(e){return e.id}))),e._workspacesEventEmitter.raiseWorkspaceEvent({action:"selected",payload:{frameSummary:{id:e._frameId},workspaceSummary:e.stateResolver.getWorkspaceSummary(t.id)}}),void(t.hibernateConfig&&e.resumeWorkspace(t.id));var r=U(t.layout.toConfig().content).filter((function(t){return e._controller.isWindowVisible(t.id)}));e._frameController.selectionChangedDeep(r.map((function(e){return q(e.id)})),n.map((function(e){return e.id}))),e._workspacesEventEmitter.raiseWorkspaceEvent({action:"selected",payload:{frameSummary:{id:e._frameId},workspaceSummary:e.stateResolver.getWorkspaceSummary(t.id)}})})),this._controller.emitter.onAddButtonClicked((function(t){var n=t.laneId,r=t.workspaceId,i=t.bounds,o=t.parentType;return j(e,void 0,void 0,a.a.mark((function e(){var t;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={boxId:n,workspaceId:r,parentType:o,frameId:this._frameId,peerId:this._glue.agm.instance.peerId,domNode:void 0,resizePopup:void 0,hidePopup:void 0},e.next=3,this._popupManager.showAddWindowPopup(i,t);case 3:case"end":return e.stop()}}),e,this)})))})),this._controller.emitter.onContentLayoutInit((function(t){e.reportLayoutStructure(t)})),this._controller.emitter.onWorkspaceAddButtonClicked((function(){return j(e,void 0,void 0,a.a.mark((function e(){var t,n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={frameId:this._frameId,peerId:this._glue.agm.instance.windowId},n=J.workspaceLayoutHeader.element.find(".lm_workspace_controls").find(".lm_add_button"),r=G(n),e.next=3,this._popupManager.showOpenWorkspacePopup(r,t);case 3:case"end":return e.stop()}}),e,this)})))})),this._controller.emitter.onWorkspaceSaveRequested((function(t){return j(e,void 0,void 0,a.a.mark((function e(){var n,r,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={frameId:this._frameId,workspaceId:t,peerId:this._glue.agm.instance.peerId,buildMode:ye.config.build,domNode:void 0,resizePopup:void 0,hidePopup:void 0},r=J.getWorkspaceLayoutItemById(t).tab.element.find(".lm_saveButton"),i=G(r),e.next=3,this._popupManager.showSaveWorkspacePopup(i,n);case 3:case"end":return e.stop()}}),e,this)})))})),this._controller.emitter.onStackMaximized((function(t){var n=t.getActiveContentItem(),r=t.contentItems.map((function(e){return q(e.config.id)}));t.contentItems.forEach((function(t){e._frameController.maximizeTab(q(t.config.id))})),e._frameController.selectionChanged([q(n.config.id)],r)})),this._controller.emitter.onStackRestored((function(t){var n=t.getActiveContentItem(),r=t.contentItems.map((function(e){return q(e.config.id)}));t.contentItems.forEach((function(t){e._frameController.restoreTab(q(t.config.id))})),e._frameController.selectionChanged([q(n.config.id)],r)})),this._controller.emitter.onEjectRequested((function(t){if(!t.isComponent)throw new Error("Can't eject item of type "+t.type);return e.eject(t)})),X.onWorkspaceContentsShown((function(t){var n=J.getActiveWorkspace();if((null==n?void 0:n.layout)&&t===n.id){var r=J.getWorkspaceContentItem(t),i=G(r.element);n.layout.updateSize(i.width,i.height);var o=n.layout.root.getItemsByFilter((function(e){return"stack"===e.type}));e._frameController.selectionChangedDeep(o.map((function(e){return q(e.getActiveContentItem().config.id)})),[])}})),X.onWorkspaceContentsHidden((function(t){var n=J.getById(t);(null==n?void 0:n.layout)&&t===n.id&&e._frameController.selectionChangedDeep([],n.windows.map((function(e){return e.id})))})),this.workspacesEventEmitter.onWorkspaceEvent((function(e,t){var n=J.getById(t.workspaceSummary.id);n&&(n.lastActive=Date.now())}))}},{key:"subscribeForPopups",value:function(){var e=this;this._frameController.onFrameContentClicked((function(){e._popupManager.hidePopup()})),this._frameController.onWindowTitleChanged((function(t,n){e.setItemTitle(t,n)}))}},{key:"reportLayoutStructure",value:function(e){var t=this;U(e.toConfig().content).forEach((function(n){var r=e.root.getItemsById(n.id)[0];t._frameController.moveFrame(q(r.config.id),G(r.element))}))}},{key:"closeWorkspace",value:function(e){if(!e)throw new Error("Could not find a workspace to close");e.hibernateConfig?this.closeHibernatedWorkspaceCore(e):this.closeWorkspaceCore(e)}},{key:"closeWorkspaceCore",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){var n,r,i,o=this;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=this.stateResolver.getWorkspaceSummary(e.id),r=e.windows.map((function(e){if(J.getWindowContentItem(e.id))return o.stateResolver.getWindowSummarySync(e.id)})).filter((function(e){return e})),e.windows.forEach((function(e){return o._frameController.remove(e.id)})),i=this.checkForEmptyWorkspace(e),r.forEach((function(e){o._applicationFactory.notifyFrameWillClose(e.config.windowId,e.config.appName).catch((function(e){})),o.workspacesEventEmitter.raiseWindowEvent({action:"removed",payload:{windowSummary:e}})})),i||this.workspacesEventEmitter.raiseWorkspaceEvent({action:"closed",payload:{workspaceSummary:n,frameSummary:{id:this._frameId}}});case 4:case"end":return t.stop()}}),t,this)})))}},{key:"closeHibernatedWorkspaceCore",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){var n,r,i,o,s=this;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=this.stateResolver.getWorkspaceSummary(e.id),r=this.stateResolver.getSnapshot(e.id),i=this.stateResolver.extractWindowSummariesFromSnapshot(r),e.windows.forEach((function(e){return s._frameController.remove(e.id)})),o=this.checkForEmptyWorkspace(e),i.forEach((function(e){s._applicationFactory.notifyFrameWillClose(e.config.windowId,e.config.appName).catch((function(e){})),s.workspacesEventEmitter.raiseWindowEvent({action:"removed",payload:{windowSummary:e}})})),o||this.workspacesEventEmitter.raiseWorkspaceEvent({action:"closed",payload:{workspaceSummary:n,frameSummary:{id:this._frameId}}});case 4:case"end":return t.stop()}}),t,this)})))}},{key:"addWorkspace",value:function(e,t){var n;return j(this,void 0,void 0,a.a.mark((function r(){return a.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this._glue.contexts.set(V(e),(null===(n=null==t?void 0:t.workspacesOptions)||void 0===n?void 0:n.context)||{});case 2:return r.next=4,this._controller.addWorkspace(e,t);case 4:case"end":return r.stop()}}),r,this)})))}},{key:"checkForEmptyWorkspace",value:function(e){var t;if(1===J.layouts.length){try{if(this._isLayoutInitialized)return this._facade.executeAfterControlIsDone((function(){window.close()})),!0}catch(e){console.log("ERROR",e)}e.windows=[],null===(t=e.layout)||void 0===t||t.destroy(),e.layout=void 0,this._controller.showAddButton(e.id);var n=J.getWorkspaceTitle(e.id),r=this._configFactory.getWorkspaceTitle(J.workspaceTitles.filter((function(e){return e!==n})));this._controller.setWorkspaceTitle(e.id,r)}else this._controller.removeWorkspace(e.id);return!1}},{key:"waitForFrameLoaded",value:function(e){var t=this;return new Promise((function(n,r){var i=function(){},o=setTimeout((function(){i(),r("Did not hear frame loaded for ".concat(e," in 5000ms"))}),5e3);i=t.workspacesEventEmitter.onWindowEvent((function(t,r){"loaded"===t&&r.windowSummary.itemId===e&&(n(),clearTimeout(o),i())}))}))}},{key:"raiseWindowRemoved",value:function(e,t){this.workspacesEventEmitter.raiseWindowEvent({action:"removed",payload:{windowSummary:t}})}},{key:"stateResolver",get:function(){return this._stateResolver}},{key:"workspacesEventEmitter",get:function(){return this._workspacesEventEmitter}},{key:"initPromise",get:function(){return this._initPromise}},{key:"initialized",get:function(){return this._initialized}},{key:"frameId",get:function(){return this._frameId}}]),e}()),Ae=new(function(){function e(){var t=this;Object(s.a)(this,e),this._workspacesControlMethod="T42.Workspaces.Control",this._workspacesEventMethod="T42.Workspaces.Events",this._inDisposing=!1,this._controlPromise=Promise.resolve(),this.handleControlCore=function(e,n,r,i){return j(t,void 0,void 0,a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Te.initPromise;case 3:t.t0=e.operation,t.next="isWindowInWorkspace"===t.t0?6:"addWindow"===t.t0?8:"addContainer"===t.t0?14:"getWorkspaceSnapshot"===t.t0?20:"openWorkspace"===t.t0?22:"saveLayout"===t.t0?28:"exportAllLayouts"===t.t0?34:"deleteLayout"===t.t0?40:"getAllWorkspacesSummaries"===t.t0?42:"maximizeItem"===t.t0?44:"restoreItem"===t.t0?46:"closeItem"===t.t0?48:"setItemTitle"===t.t0?50:"addWorkspaceChildren"===t.t0?54:"ejectWindow"===t.t0?58:"createWorkspace"===t.t0?64:"forceLoadWindow"===t.t0?70:"focusItem"===t.t0?76:"bundleWorkspace"===t.t0?80:"getFrameSummary"===t.t0?82:"moveFrame"===t.t0?88:"getFrameSnapshot"===t.t0?92:"getSnapshot"===t.t0?98:"moveWindowTo"===t.t0?104:"generateLayout"===t.t0?108:"ping"===t.t0?114:"hibernateWorkspace"===t.t0?116:"resumeWorkspace"===t.t0?120:124;break;case 6:return r(this.handleIsWindowInWorkspace(e.operationArguments)),t.abrupt("break",125);case 8:return t.t1=r,t.next=11,this.handleAddWindow(e.operationArguments);case 11:return t.t2=t.sent,(0,t.t1)(t.t2),t.abrupt("break",125);case 14:return t.t3=r,t.next=17,this.handleAddContainer(e.operationArguments);case 17:return t.t4=t.sent,(0,t.t3)(t.t4),t.abrupt("break",125);case 20:return r(this.handleGetWorkspaceSnapshot(e.operationArguments)),t.abrupt("break",125);case 22:return t.t5=r,t.next=25,this.handleOpenWorkspace(e.operationArguments);case 25:return t.t6=t.sent,(0,t.t5)(t.t6),t.abrupt("break",125);case 28:return t.t7=r,t.next=31,this.handleSaveLayout(e.operationArguments);case 31:return t.t8=t.sent,(0,t.t7)(t.t8),t.abrupt("break",125);case 34:return t.t9=r,t.next=37,this.handleExportAllLayouts();case 37:return t.t10=t.sent,(0,t.t9)(t.t10),t.abrupt("break",125);case 40:return this.handleDeleteLayout(e.operationArguments),r(void 0),t.abrupt("break",125);case 42:return r(this.handleGetAllWorkspaceSummaries()),t.abrupt("break",125);case 44:return this.handleMaximizeItem(e.operationArguments),r(void 0),t.abrupt("break",125);case 46:return this.handleRestoreItem(e.operationArguments),r(void 0),t.abrupt("break",125);case 48:return this.handleCloseItem(e.operationArguments),r(void 0),t.abrupt("break",125);case 50:return t.next=52,this.handleSetItemTitle(e.operationArguments);case 52:return r(void 0),t.abrupt("break",125);case 54:return t.next=56,this.handleAddWorkspaceChildren(e.operationArguments);case 56:return r(void 0),t.abrupt("break",125);case 58:return t.t11=r,t.next=61,this.handleEject(e.operationArguments);case 61:return t.t12=t.sent,(0,t.t11)(t.t12),t.abrupt("break",125);case 64:return t.t13=r,t.next=67,this.handleCreateWorkspace(e.operationArguments);case 67:return t.t14=t.sent,(0,t.t13)(t.t14),t.abrupt("break",125);case 70:return t.t15=r,t.next=73,this.handleForceLoadWindow(e.operationArguments);case 73:return t.t16=t.sent,(0,t.t15)(t.t16),t.abrupt("break",125);case 76:return t.next=78,this.handleFocusItem(e.operationArguments);case 78:return r(void 0),t.abrupt("break",125);case 80:return this.handleBundleWorkspace(e.operationArguments),r(void 0),t.abrupt("break",125);case 82:return t.t17=r,t.next=85,this.handleGetFrameSummary(e.operationArguments);case 85:return t.t18=t.sent,(0,t.t17)(t.t18),t.abrupt("break",125);case 88:return t.next=90,this.handleMoveFrame(e.operationArguments);case 90:return r(void 0),t.abrupt("break",125);case 92:return t.t19=r,t.next=95,this.handleGetFrameSnapshot();case 95:return t.t20=t.sent,(0,t.t19)(t.t20),t.abrupt("break",125);case 98:return t.t21=r,t.next=101,this.handleGetSnapshot(e.operationArguments);case 101:return t.t22=t.sent,(0,t.t21)(t.t22),t.abrupt("break",125);case 104:return t.next=106,this.handleMoveWindowTo(e.operationArguments);case 106:return r(void 0),t.abrupt("break",125);case 108:return t.t23=r,t.next=111,this.handleGenerateLayout(e.operationArguments);case 111:return t.t24=t.sent,(0,t.t23)(t.t24),t.abrupt("break",125);case 114:return r(this.handlePing()),t.abrupt("break",125);case 116:return t.next=118,this.handleHibernateWorkspace(e.operationArguments);case 118:return r(void 0),t.abrupt("break",125);case 120:return t.next=122,this.handleResumeWorkspace(e.operationArguments);case 122:return r(void 0),t.abrupt("break",125);case 124:i("Invalid operation - "+e.operation);case 125:t.next=130;break;case 127:t.prev=127,t.t25=t.catch(0),i(t.t25.message);case 130:case"end":return t.stop()}}),t,this,[[0,127]])})))},this.handleControl=function(e,n,r,i){return j(t,void 0,void 0,a.a.mark((function t(){var o;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=this.handleControlCore(e,n,r,i),this._controlPromise=o,t.next=4,o;case 4:case"end":return t.stop()}}),t,this)})))}}return Object(c.a)(e,[{key:"init",value:function(e,t){return j(this,void 0,void 0,a.a.mark((function n(){return a.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this._frameId=t,this._glue=e,this._configFactory=new xe(e),this._converter=new Ie(this._configFactory),n.t0=this._glue,!n.t0){n.next=8;break}return n.next=8,this.registerAgmMethods();case 8:case"end":return n.stop()}}),n,this)})))}},{key:"dispose",value:function(){this._inDisposing=!0}},{key:"subscribeForWorkspaceEvents",value:function(){var e=this;Te.workspacesEventEmitter.onFrameEvent((function(t,n){e.publishEventData(t,n,"frame")})),Te.workspacesEventEmitter.onWindowEvent((function(t,n){e.publishEventData(t,n,"window")})),Te.workspacesEventEmitter.onWorkspaceEvent((function(t,n){e.publishEventData(t,n,"workspace")})),Te.workspacesEventEmitter.onContainerEvent((function(t,n){e.publishEventData(t,n,"box")}))}},{key:"executeAfterControlIsDone",value:function(e){this._controlPromise.finally((function(){return e()}))}},{key:"registerAgmMethods",value:function(){return j(this,void 0,void 0,a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._glue.agm.registerAsync({name:this._workspacesControlMethod},this.handleControl);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"handleOpenWorkspace",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){var n,r,i;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Te.openWorkspace(e.name,e.restoreOptions);case 2:return n=t.sent,r=Te.stateResolver.getWorkspaceConfig(n),i=this._converter.convertToAPIConfig(r),t.abrupt("return",{id:i.id,children:i.children,config:i.config,frameSummary:{id:this._frameId}});case 6:case"end":return t.stop()}}),t,this)})))}},{key:"handleExportAllLayouts",value:function(){return j(this,void 0,void 0,a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Te.exportAllLayouts();case 2:return e.t0=e.sent,e.abrupt("return",{layouts:e.t0});case 4:case"end":return e.stop()}}),e)})))}},{key:"handleSaveLayout",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Te.saveWorkspace(e.name,e.workspaceId,e.saveContext);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))}},{key:"handleDeleteLayout",value:function(e){Te.deleteLayout(e.name)}},{key:"handleGetWorkspaceSnapshot",value:function(e){var t=J.getById(e.itemId),n=Te.stateResolver.getWorkspaceConfig(t.id),r=this._converter.convertToAPIConfig(n);return{id:r.id,children:r.children,config:r.config,frameSummary:{id:this._frameId}}}},{key:"handleGetAllWorkspaceSummaries",value:function(){return{summaries:J.layouts.map((function(e){return Te.stateResolver.getWorkspaceSummary(e.id)}))}}},{key:"handleCloseItem",value:function(e){Te.closeItem(e.itemId)}},{key:"handleRestoreItem",value:function(e){Te.restoreItem(e.itemId)}},{key:"handleMaximizeItem",value:function(e){Te.maximizeItem(e.itemId)}},{key:"handleAddContainer",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){var n,r;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("workspace"!==(n=this._converter.convertToRendererConfig(e.definition)).type){t.next=3;break}throw new Error("Unsuccessful conversion");case 3:return r={id:q(n.id),content:n.content,type:n.type,workspacesConfig:n.workspacesConfig},t.next=6,Te.addContainer(r,e.parentId);case 6:return t.t0=t.sent,t.abrupt("return",{itemId:t.t0});case 8:case"end":return t.stop()}}),t,this)})))}},{key:"handleAddWindow",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){var n,r,i;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=this._configFactory.createGDWindowConfig({windowId:e.definition.windowId,id:void 0,appName:e.definition.appName,url:e.definition.url,context:e.definition.context}),!e.definition.windowId){t.next=7;break}return r=this._glue.windows.list().find((function(t){return t.id===e.definition.windowId})),t.next=5,r.getURL();case 5:i=t.sent,n.componentState.url=i,n.componentState.appName=this._configFactory.getAppNameFromWindowId(r.id);case 7:return t.next=9,Te.addWindow(n,e.parentId);case 9:return t.abrupt("return",{itemId:q(n.id)});case 10:case"end":return t.stop()}}),t,this)})))}},{key:"handleSetItemTitle",value:function(e){Te.setItemTitle(e.itemId,e.title)}},{key:"handleAddWorkspaceChildren",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){var n,r,i,o;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.children.some((function(e){return"row"===e.type})),!(r=e.children.some((function(e){return"column"===e.type})))||!n){t.next=3;break}throw new Error("Can't add both row and column workspace children");case 3:return i={type:"column",children:e.children},r&&(i={type:"row",children:e.children}),o=this._converter.convertToRendererConfig(i),t.next=8,Te.addContainer(o,e.workspaceId);case 8:case"end":return t.stop()}}),t,this)})))}},{key:"handleEject",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){var n;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=J.getWindowContentItem(e.itemId)){t.next=3;break}throw new Error("Could not find item "+e.itemId);case 3:return t.next=5,Te.eject(n);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t)})))}},{key:"handleCreateWorkspace",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){var n,r,i;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.config||(e.config={}),e.config.context=e.config.context||e.context,n=this._converter.convertToRendererConfig(e),t.next=4,Te.createWorkspace(n);case 4:return r=t.sent,i=this._converter.convertToAPIConfig(Te.stateResolver.getWorkspaceConfig(r)),t.abrupt("return",{id:i.id,children:i.children,config:i.config,frameSummary:{id:this._frameId}});case 7:case"end":return t.stop()}}),t,this)})))}},{key:"handleForceLoadWindow",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Te.loadWindow(e.itemId);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))}},{key:"handleFocusItem",value:function(e){return Te.focusItem(e.itemId)}},{key:"handleBundleWorkspace",value:function(e){return Te.bundleWorkspace(e.workspaceId,e.type)}},{key:"handleIsWindowInWorkspace",value:function(e){return{inWorkspace:Te.stateResolver.isWindowInWorkspace(e.itemId)}}},{key:"handleGetFrameSummary",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",Te.getFrameSummary(e.itemId));case 1:case"end":return t.stop()}}),t)})))}},{key:"handleMoveFrame",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Te.move(e.location);case 2:case"end":return t.stop()}}),t)})))}},{key:"handleGetFrameSnapshot",value:function(){return Te.stateResolver.getFrameSnapshot()}},{key:"handleGetSnapshot",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",Te.stateResolver.getSnapshot(e.itemId));case 1:case"end":return t.stop()}}),t)})))}},{key:"handleMoveWindowTo",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",Te.moveWindowTo(e.itemId,e.containerId));case 1:case"end":return t.stop()}}),t)})))}},{key:"handleGenerateLayout",value:function(e){return Te.generateWorkspaceLayout(e.name,e.workspaceId)}},{key:"handlePing",value:function(){return{live:!this._inDisposing}}},{key:"handleHibernateWorkspace",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",Te.hibernateWorkspace(e.workspaceId));case 1:case"end":return t.stop()}}),t)})))}},{key:"handleResumeWorkspace",value:function(e){return j(this,void 0,void 0,a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",Te.resumeWorkspace(e.workspaceId));case 1:case"end":return t.stop()}}),t)})))}},{key:"publishEventData",value:function(e,t,n){var r=this;if(this._glue.agm.methods().some((function(e){return e.name===r._workspacesEventMethod}))){var i={action:e,type:n,payload:t};this._glue.agm.invoke(this._workspacesEventMethod,i).catch((function(){}))}}}]),e}()),Pe=L((function(e){var t,n;t="undefined"!=typeof window?window:D,n=function(e,t){var n=[],r=Object.getPrototypeOf,i=n.slice,o=n.flat?function(e){return n.flat.call(e)}:function(e){return n.concat.apply([],e)},a=n.push,s=n.indexOf,c={},u=c.toString,d=c.hasOwnProperty,l=d.toString,p=l.call(Object),h={},f=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},m=function(e){return null!=e&&e===e.window},v=e.document,g={type:!0,src:!0,nonce:!0,noModule:!0};function y(e,t,n){var r,i,o=(n=n||v).createElement("script");if(o.text=e,t)for(r in g)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[u.call(e)]||"object":typeof e}var b="3.5.1",k=function e(t,n){return new e.fn.init(t,n)};function x(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!f(e)&&!m(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}k.fn=k.prototype={jquery:b,constructor:k,length:0,toArray:function(){return i.call(this)},get:function(e){return null==e?i.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=k.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return k.each(this,e)},map:function(e){return this.pushStack(k.map(this,(function(t,n){return e.call(t,n,t)})))},slice:function(){return this.pushStack(i.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(k.grep(this,(function(e,t){return(t+1)%2})))},odd:function(){return this.pushStack(k.grep(this,(function(e,t){return t%2})))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:a,sort:n.sort,splice:n.splice},k.extend=k.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,c=arguments.length,u=!1;for("boolean"==typeof a&&(u=a,a=arguments[s]||{},s++),"object"==typeof a||f(a)||(a={}),s===c&&(a=this,s--);s<c;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(u&&r&&(k.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||k.isPlainObject(n)?n:{},i=!1,a[t]=k.extend(u,o,r)):void 0!==r&&(a[t]=r));return a},k.extend({expando:"jQuery"+(b+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==u.call(e)||(t=r(e))&&("function"!=typeof(n=d.call(t,"constructor")&&t.constructor)||l.call(n)!==p))},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t,n){y(e,{nonce:t&&t.nonce},n)},each:function(e,t){var n,r=0;if(x(e))for(n=e.length;r<n&&!1!==t.call(e[r],r,e[r]);r++);else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},makeArray:function(e,t){var n=t||[];return null!=e&&(x(Object(e))?k.merge(n,"string"==typeof e?[e]:e):a.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:s.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,a=0,s=[];if(x(e))for(r=e.length;a<r;a++)null!=(i=t(e[a],a,n))&&s.push(i);else for(a in e)null!=(i=t(e[a],a,n))&&s.push(i);return o(s)},guid:1,support:h}),"function"==typeof Symbol&&(k.fn[Symbol.iterator]=n[Symbol.iterator]),k.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),(function(e,t){c["[object "+t+"]"]=t.toLowerCase()}));var _=function(e){var t,n,r,i,o,a,s,c,u,d,l,p,h,f,m,v,g,y,w,b="sizzle"+1*new Date,k=e.document,x=0,_=0,I=ce(),C=ce(),S=ce(),E=ce(),W=function(e,t){return e===t&&(l=!0),0},T={}.hasOwnProperty,A=[],P=A.pop,M=A.push,O=A.push,j=A.slice,D=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",N="[\\x20\\t\\r\\n\\f]",R="(?:\\\\[\\da-fA-F]{1,6}[\\x20\\t\\r\\n\\f]?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",F="\\[[\\x20\\t\\r\\n\\f]*("+R+")(?:"+N+"*([*^$|!~]?=)"+N+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+R+"))|)"+N+"*\\]",B=":("+R+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+F+")*)|.*)\\)|)",z=new RegExp(N+"+","g"),H=new RegExp("^[\\x20\\t\\r\\n\\f]+|((?:^|[^\\\\])(?:\\\\.)*)[\\x20\\t\\r\\n\\f]+$","g"),q=new RegExp("^[\\x20\\t\\r\\n\\f]*,[\\x20\\t\\r\\n\\f]*"),$=new RegExp("^[\\x20\\t\\r\\n\\f]*([>+~]|[\\x20\\t\\r\\n\\f])[\\x20\\t\\r\\n\\f]*"),U=new RegExp(N+"|>"),G=new RegExp(B),V=new RegExp("^"+R+"$"),J={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+F),PSEUDO:new RegExp("^"+B),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\([\\x20\\t\\r\\n\\f]*(even|odd|(([+-]|)(\\d*)n|)[\\x20\\t\\r\\n\\f]*(?:([+-]|)[\\x20\\t\\r\\n\\f]*(\\d+)|))[\\x20\\t\\r\\n\\f]*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^[\\x20\\t\\r\\n\\f]*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\([\\x20\\t\\r\\n\\f]*((?:-\\d)?\\d*)[\\x20\\t\\r\\n\\f]*\\)|)(?=[^-]|$)","i")},K=/HTML$/i,X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,Q=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}[\\x20\\t\\r\\n\\f]?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){p()},ae=be((function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{O.apply(A=j.call(k.childNodes),k.childNodes),A[k.childNodes.length].nodeType}catch(e){O={apply:A.length?function(e,t){M.apply(e,j.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}function se(e,t,r,i){var o,s,u,d,l,f,g,y=t&&t.ownerDocument,k=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==k&&9!==k&&11!==k)return r;if(!i&&(p(t),t=t||h,m)){if(11!==k&&(l=Q.exec(e)))if(o=l[1]){if(9===k){if(!(u=t.getElementById(o)))return r;if(u.id===o)return r.push(u),r}else if(y&&(u=y.getElementById(o))&&w(t,u)&&u.id===o)return r.push(u),r}else{if(l[2])return O.apply(r,t.getElementsByTagName(e)),r;if((o=l[3])&&n.getElementsByClassName&&t.getElementsByClassName)return O.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!E[e+" "]&&(!v||!v.test(e))&&(1!==k||"object"!==t.nodeName.toLowerCase())){if(g=e,y=t,1===k&&(U.test(e)||$.test(e))){for((y=ee.test(e)&&ge(t.parentNode)||t)===t&&n.scope||((d=t.getAttribute("id"))?d=d.replace(re,ie):t.setAttribute("id",d=b)),s=(f=a(e)).length;s--;)f[s]=(d?"#"+d:":scope")+" "+we(f[s]);g=f.join(",")}try{return O.apply(r,y.querySelectorAll(g)),r}catch(t){E(e,!0)}finally{d===b&&t.removeAttribute("id")}}}return c(e.replace(H,"$1"),t,r,i)}function ce(){var e=[];return function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}}function ue(e){return e[b]=!0,e}function de(e){var t=h.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){for(var n=e.split("|"),i=n.length;i--;)r.attrHandle[n[i]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function he(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function fe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function me(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ae(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function ve(e){return ue((function(t){return t=+t,ue((function(n,r){for(var i,o=e([],n.length,t),a=o.length;a--;)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))}))}))}function ge(e){return e&&void 0!==e.getElementsByTagName&&e}for(t in n=se.support={},o=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!K.test(t||n&&n.nodeName||"HTML")},p=se.setDocument=function(e){var t,i,a=e?e.ownerDocument||e:k;return a!=h&&9===a.nodeType&&a.documentElement?(f=(h=a).documentElement,m=!o(h),k!=h&&(i=h.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",oe,!1):i.attachEvent&&i.attachEvent("onunload",oe)),n.scope=de((function(e){return f.appendChild(e).appendChild(h.createElement("div")),void 0!==e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length})),n.attributes=de((function(e){return e.className="i",!e.getAttribute("className")})),n.getElementsByTagName=de((function(e){return e.appendChild(h.createComment("")),!e.getElementsByTagName("*").length})),n.getElementsByClassName=Z.test(h.getElementsByClassName),n.getById=de((function(e){return f.appendChild(e).id=b,!h.getElementsByName||!h.getElementsByName(b).length})),n.getById?(r.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if(void 0!==t.getElementById&&m){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(te,ne);return function(e){var n=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if(void 0!==t.getElementById&&m){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];for(i=t.getElementsByName(e),r=0;o=i[r++];)if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&m)return t.getElementsByClassName(e)},g=[],v=[],(n.qsa=Z.test(h.querySelectorAll))&&(de((function(e){var t;f.appendChild(e).innerHTML="<a id='"+b+"'></a><select id='"+b+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]=[\\x20\\t\\r\\n\\f]*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\[[\\x20\\t\\r\\n\\f]*(?:value|"+L+")"),e.querySelectorAll("[id~="+b+"-]").length||v.push("~="),(t=h.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\[[\\x20\\t\\r\\n\\f]*name[\\x20\\t\\r\\n\\f]*=[\\x20\\t\\r\\n\\f]*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")})),de((function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=h.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name[\\x20\\t\\r\\n\\f]*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),f.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")}))),(n.matchesSelector=Z.test(y=f.matches||f.webkitMatchesSelector||f.mozMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&de((function(e){n.disconnectedMatch=y.call(e,"*"),y.call(e,"[s!='']:x"),g.push("!=",B)})),v=v.length&&new RegExp(v.join("|")),g=g.length&&new RegExp(g.join("|")),t=Z.test(f.compareDocumentPosition),w=t||Z.test(f.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},W=t?function(e,t){if(e===t)return l=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e==h||e.ownerDocument==k&&w(k,e)?-1:t==h||t.ownerDocument==k&&w(k,t)?1:d?D(d,e)-D(d,t):0:4&r?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==h?-1:t==h?1:i?-1:o?1:d?D(d,e)-D(d,t):0;if(i===o)return pe(e,t);for(n=e;n=n.parentNode;)a.unshift(n);for(n=t;n=n.parentNode;)s.unshift(n);for(;a[r]===s[r];)r++;return r?pe(a[r],s[r]):a[r]==k?-1:s[r]==k?1:0},h):h},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(p(e),n.matchesSelector&&m&&!E[t+" "]&&(!g||!g.test(t))&&(!v||!v.test(t)))try{var r=y.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){E(t,!0)}return se(t,h,null,[e]).length>0},se.contains=function(e,t){return(e.ownerDocument||e)!=h&&p(e),w(e,t)},se.attr=function(e,t){(e.ownerDocument||e)!=h&&p(e);var i=r.attrHandle[t.toLowerCase()],o=i&&T.call(r.attrHandle,t.toLowerCase())?i(e,t,!m):void 0;return void 0!==o?o:n.attributes||!m?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},se.escape=function(e){return(e+"").replace(re,ie)},se.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},se.uniqueSort=function(e){var t,r=[],i=0,o=0;if(l=!n.detectDuplicates,d=!n.sortStable&&e.slice(0),e.sort(W),l){for(;t=e[o++];)t===e[o]&&(i=r.push(o));for(;i--;)e.splice(r[i],1)}return d=null,e},i=se.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else for(;t=e[r++];)n+=i(t);return n},(r=se.selectors={cacheLength:50,createPseudo:ue,match:J,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(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===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]||se.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]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return J.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&G.test(n)&&(t=a(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=I[e+" "];return t||(t=new RegExp("(^|[\\x20\\t\\r\\n\\f])"+e+"("+N+"|$)"))&&I(e,(function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")}))},ATTR:function(e,t,n){return function(r){var i=se.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace(z," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,c){var u,d,l,p,h,f,m=o!==a?"nextSibling":"previousSibling",v=t.parentNode,g=s&&t.nodeName.toLowerCase(),y=!c&&!s,w=!1;if(v){if(o){for(;m;){for(p=t;p=p[m];)if(s?p.nodeName.toLowerCase()===g:1===p.nodeType)return!1;f=m="only"===e&&!f&&"nextSibling"}return!0}if(f=[a?v.firstChild:v.lastChild],a&&y){for(w=(h=(u=(d=(l=(p=v)[b]||(p[b]={}))[p.uniqueID]||(l[p.uniqueID]={}))[e]||[])[0]===x&&u[1])&&u[2],p=h&&v.childNodes[h];p=++h&&p&&p[m]||(w=h=0)||f.pop();)if(1===p.nodeType&&++w&&p===t){d[e]=[x,h,w];break}}else if(y&&(w=h=(u=(d=(l=(p=t)[b]||(p[b]={}))[p.uniqueID]||(l[p.uniqueID]={}))[e]||[])[0]===x&&u[1]),!1===w)for(;(p=++h&&p&&p[m]||(w=h=0)||f.pop())&&((s?p.nodeName.toLowerCase()!==g:1!==p.nodeType)||!++w||(y&&((d=(l=p[b]||(p[b]={}))[p.uniqueID]||(l[p.uniqueID]={}))[e]=[x,w]),p!==t)););return(w-=i)===r||w%r==0&&w/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||se.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?ue((function(e,n){for(var r,o=i(e,t),a=o.length;a--;)e[r=D(e,o[a])]=!(n[r]=o[a])})):function(e){return i(e,0,n)}):i}},pseudos:{not:ue((function(e){var t=[],n=[],r=s(e.replace(H,"$1"));return r[b]?ue((function(e,t,n,i){for(var o,a=r(e,null,i,[]),s=e.length;s--;)(o=a[s])&&(e[s]=!(t[s]=o))})):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}})),has:ue((function(e){return function(t){return se(e,t).length>0}})),contains:ue((function(e){return e=e.replace(te,ne),function(t){return(t.textContent||i(t)).indexOf(e)>-1}})),lang:ue((function(e){return V.test(e||"")||se.error("unsupported lang: "+e),e=e.replace(te,ne).toLowerCase(),function(t){var n;do{if(n=m?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}})),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===h.activeElement&&(!h.hasFocus||h.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:me(!1),disabled:me(!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,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return X.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:ve((function(){return[0]})),last:ve((function(e,t){return[t-1]})),eq:ve((function(e,t,n){return[n<0?n+t:n]})),even:ve((function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e})),odd:ve((function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e})),lt:ve((function(e,t,n){for(var r=n<0?n+t:n>t?t:n;--r>=0;)e.push(r);return e})),gt:ve((function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e}))}}).pseudos.nth=r.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=he(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=fe(t);function ye(){}function we(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function be(e,t,n){var r=t.dir,i=t.next,o=i||r,a=n&&"parentNode"===o,s=_++;return t.first?function(t,n,i){for(;t=t[r];)if(1===t.nodeType||a)return e(t,n,i);return!1}:function(t,n,c){var u,d,l,p=[x,s];if(c){for(;t=t[r];)if((1===t.nodeType||a)&&e(t,n,c))return!0}else for(;t=t[r];)if(1===t.nodeType||a)if(d=(l=t[b]||(t[b]={}))[t.uniqueID]||(l[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase())t=t[r]||t;else{if((u=d[o])&&u[0]===x&&u[1]===s)return p[2]=u[2];if(d[o]=p,p[2]=e(t,n,c))return!0}return!1}}function ke(e){return e.length>1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xe(e,t,n,r,i){for(var o,a=[],s=0,c=e.length,u=null!=t;s<c;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),u&&t.push(s)));return a}function _e(e,t,n,r,i,o){return r&&!r[b]&&(r=_e(r)),i&&!i[b]&&(i=_e(i,o)),ue((function(o,a,s,c){var u,d,l,p=[],h=[],f=a.length,m=o||function(e,t,n){for(var r=0,i=t.length;r<i;r++)se(e,t[r],n);return n}(t||"*",s.nodeType?[s]:s,[]),v=!e||!o&&t?m:xe(m,p,e,s,c),g=n?i||(o?e:f||r)?[]:a:v;if(n&&n(v,g,s,c),r)for(u=xe(g,h),r(u,[],s,c),d=u.length;d--;)(l=u[d])&&(g[h[d]]=!(v[h[d]]=l));if(o){if(i||e){if(i){for(u=[],d=g.length;d--;)(l=g[d])&&u.push(v[d]=l);i(null,g=[],u,c)}for(d=g.length;d--;)(l=g[d])&&(u=i?D(o,l):p[d])>-1&&(o[u]=!(a[u]=l))}}else g=xe(g===a?g.splice(f,g.length):g),i?i(null,a,g,c):O.apply(a,g)}))}function Ie(e){for(var t,n,i,o=e.length,a=r.relative[e[0].type],s=a||r.relative[" "],c=a?1:0,d=be((function(e){return e===t}),s,!0),l=be((function(e){return D(t,e)>-1}),s,!0),p=[function(e,n,r){var i=!a&&(r||n!==u)||((t=n).nodeType?d(e,n,r):l(e,n,r));return t=null,i}];c<o;c++)if(n=r.relative[e[c].type])p=[be(ke(p),n)];else{if((n=r.filter[e[c].type].apply(null,e[c].matches))[b]){for(i=++c;i<o&&!r.relative[e[i].type];i++);return _e(c>1&&ke(p),c>1&&we(e.slice(0,c-1).concat({value:" "===e[c-2].type?"*":""})).replace(H,"$1"),n,c<i&&Ie(e.slice(c,i)),i<o&&Ie(e=e.slice(i)),i<o&&we(e))}p.push(n)}return ke(p)}return ye.prototype=r.filters=r.pseudos,r.setFilters=new ye,a=se.tokenize=function(e,t){var n,i,o,a,s,c,u,d=C[e+" "];if(d)return t?0:d.slice(0);for(s=e,c=[],u=r.preFilter;s;){for(a in n&&!(i=q.exec(s))||(i&&(s=s.slice(i[0].length)||s),c.push(o=[])),n=!1,(i=$.exec(s))&&(n=i.shift(),o.push({value:n,type:i[0].replace(H," ")}),s=s.slice(n.length)),r.filter)!(i=J[a].exec(s))||u[a]&&!(i=u[a](i))||(n=i.shift(),o.push({value:n,type:a,matches:i}),s=s.slice(n.length));if(!n)break}return t?s.length:s?se.error(e):C(e,c).slice(0)},s=se.compile=function(e,t){var n,i=[],o=[],s=S[e+" "];if(!s){for(t||(t=a(e)),n=t.length;n--;)(s=Ie(t[n]))[b]?i.push(s):o.push(s);(s=S(e,function(e,t){var n=t.length>0,i=e.length>0,o=function(o,a,s,c,d){var l,f,v,g=0,y="0",w=o&&[],b=[],k=u,_=o||i&&r.find.TAG("*",d),I=x+=null==k?1:Math.random()||.1,C=_.length;for(d&&(u=a==h||a||d);y!==C&&null!=(l=_[y]);y++){if(i&&l){for(f=0,a||l.ownerDocument==h||(p(l),s=!m);v=e[f++];)if(v(l,a||h,s)){c.push(l);break}d&&(x=I)}n&&((l=!v&&l)&&g--,o&&w.push(l))}if(g+=y,n&&y!==g){for(f=0;v=t[f++];)v(w,b,a,s);if(o){if(g>0)for(;y--;)w[y]||b[y]||(b[y]=P.call(c));b=xe(b)}O.apply(c,b),d&&!o&&b.length>0&&g+t.length>1&&se.uniqueSort(c)}return d&&(x=I,u=k),w};return n?ue(o):o}(o,i))).selector=e}return s},c=se.select=function(e,t,n,i){var o,c,u,d,l,p="function"==typeof e&&e,h=!i&&a(e=p.selector||e);if(n=n||[],1===h.length){if((c=h[0]=h[0].slice(0)).length>2&&"ID"===(u=c[0]).type&&9===t.nodeType&&m&&r.relative[c[1].type]){if(!(t=(r.find.ID(u.matches[0].replace(te,ne),t)||[])[0]))return n;p&&(t=t.parentNode),e=e.slice(c.shift().value.length)}for(o=J.needsContext.test(e)?0:c.length;o--&&(u=c[o],!r.relative[d=u.type]);)if((l=r.find[d])&&(i=l(u.matches[0].replace(te,ne),ee.test(c[0].type)&&ge(t.parentNode)||t))){if(c.splice(o,1),!(e=i.length&&we(c)))return O.apply(n,i),n;break}}return(p||s(e,h))(i,t,!m,n,!t||ee.test(e)&&ge(t.parentNode)||t),n},n.sortStable=b.split("").sort(W).join("")===b,n.detectDuplicates=!!l,p(),n.sortDetached=de((function(e){return 1&e.compareDocumentPosition(h.createElement("fieldset"))})),de((function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")}))||le("type|href|height|width",(function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)})),n.attributes&&de((function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")}))||le("value",(function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue})),de((function(e){return null==e.getAttribute("disabled")}))||le(L,(function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null})),se}(e);k.find=_,(k.expr=_.selectors)[":"]=k.expr.pseudos,k.uniqueSort=k.unique=_.uniqueSort,k.text=_.getText,k.isXMLDoc=_.isXML,k.contains=_.contains,k.escapeSelector=_.escape;var I=function(e,t,n){for(var r=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&k(e).is(n))break;r.push(e)}return r},C=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},S=k.expr.match.needsContext;function E(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var W=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function T(e,t,n){return f(t)?k.grep(e,(function(e,r){return!!t.call(e,r,e)!==n})):t.nodeType?k.grep(e,(function(e){return e===t!==n})):"string"!=typeof t?k.grep(e,(function(e){return s.call(t,e)>-1!==n})):k.filter(t,e,n)}k.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?k.find.matchesSelector(r,e)?[r]:[]:k.find.matches(e,k.grep(t,(function(e){return 1===e.nodeType})))},k.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(k(e).filter((function(){for(t=0;t<r;t++)if(k.contains(i[t],this))return!0})));for(n=this.pushStack([]),t=0;t<r;t++)k.find(e,i[t],n);return r>1?k.uniqueSort(n):n},filter:function(e){return this.pushStack(T(this,e||[],!1))},not:function(e){return this.pushStack(T(this,e||[],!0))},is:function(e){return!!T(this,"string"==typeof e&&S.test(e)?k(e):e||[],!1).length}});var A,P=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(k.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||A,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:P.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof k?t[0]:t,k.merge(this,k.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:v,!0)),W.test(r[1])&&k.isPlainObject(t))for(r in t)f(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=v.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):f(e)?void 0!==n.ready?n.ready(e):e(k):k.makeArray(e,this)}).prototype=k.fn,A=k(v);var M=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};function j(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}k.fn.extend({has:function(e){var t=k(e,this),n=t.length;return this.filter((function(){for(var e=0;e<n;e++)if(k.contains(this,t[e]))return!0}))},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&k(e);if(!S.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&k.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?k.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?s.call(k(e),this[0]):s.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(k.uniqueSort(k.merge(this.get(),k(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),k.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return I(e,"parentNode")},parentsUntil:function(e,t,n){return I(e,"parentNode",n)},next:function(e){return j(e,"nextSibling")},prev:function(e){return j(e,"previousSibling")},nextAll:function(e){return I(e,"nextSibling")},prevAll:function(e){return I(e,"previousSibling")},nextUntil:function(e,t,n){return I(e,"nextSibling",n)},prevUntil:function(e,t,n){return I(e,"previousSibling",n)},siblings:function(e){return C((e.parentNode||{}).firstChild,e)},children:function(e){return C(e.firstChild)},contents:function(e){return null!=e.contentDocument&&r(e.contentDocument)?e.contentDocument:(E(e,"template")&&(e=e.content||e),k.merge([],e.childNodes))}},(function(e,t){k.fn[e]=function(n,r){var i=k.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=k.filter(r,i)),this.length>1&&(O[e]||k.uniqueSort(i),M.test(e)&&i.reverse()),this.pushStack(i)}}));var D=/[^\x20\t\r\n\f]+/g;function L(e){return e}function N(e){throw e}function R(e,t,n,r){var i;try{e&&f(i=e.promise)?i.call(e).done(t).fail(n):e&&f(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}k.Callbacks=function(e){e="string"==typeof e?function(e){var t={};return k.each(e.match(D)||[],(function(e,n){t[n]=!0})),t}(e):k.extend({},e);var t,n,r,i,o=[],a=[],s=-1,c=function(){for(i=i||e.once,r=t=!0;a.length;s=-1)for(n=a.shift();++s<o.length;)!1===o[s].apply(n[0],n[1])&&e.stopOnFalse&&(s=o.length,n=!1);e.memory||(n=!1),t=!1,i&&(o=n?[]:"")},u={add:function(){return o&&(n&&!t&&(s=o.length-1,a.push(n)),function t(n){k.each(n,(function(n,r){f(r)?e.unique&&u.has(r)||o.push(r):r&&r.length&&"string"!==w(r)&&t(r)}))}(arguments),n&&!t&&c()),this},remove:function(){return k.each(arguments,(function(e,t){for(var n;(n=k.inArray(t,o,n))>-1;)o.splice(n,1),n<=s&&s--})),this},has:function(e){return e?k.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],a.push(n),t||c()),this},fire:function(){return u.fireWith(this,arguments),this},fired:function(){return!!r}};return u},k.extend({Deferred:function(t){var n=[["notify","progress",k.Callbacks("memory"),k.Callbacks("memory"),2],["resolve","done",k.Callbacks("once memory"),k.Callbacks("once memory"),0,"resolved"],["reject","fail",k.Callbacks("once memory"),k.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},catch:function(e){return i.then(null,e)},pipe:function(){var e=arguments;return k.Deferred((function(t){k.each(n,(function(n,r){var i=f(e[r[4]])&&e[r[4]];o[r[1]]((function(){var e=i&&i.apply(this,arguments);e&&f(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,i?[e]:arguments)}))})),e=null})).promise()},then:function(t,r,i){var o=0;function a(t,n,r,i){return function(){var s=this,c=arguments,u=function(){var e,u;if(!(t<o)){if((e=r.apply(s,c))===n.promise())throw new TypeError("Thenable self-resolution");u=e&&("object"==typeof e||"function"==typeof e)&&e.then,f(u)?i?u.call(e,a(o,n,L,i),a(o,n,N,i)):(o++,u.call(e,a(o,n,L,i),a(o,n,N,i),a(o,n,L,n.notifyWith))):(r!==L&&(s=void 0,c=[e]),(i||n.resolveWith)(s,c))}},d=i?u:function(){try{u()}catch(e){k.Deferred.exceptionHook&&k.Deferred.exceptionHook(e,d.stackTrace),t+1>=o&&(r!==N&&(s=void 0,c=[e]),n.rejectWith(s,c))}};t?d():(k.Deferred.getStackHook&&(d.stackTrace=k.Deferred.getStackHook()),e.setTimeout(d))}}return k.Deferred((function(e){n[0][3].add(a(0,e,f(i)?i:L,e.notifyWith)),n[1][3].add(a(0,e,f(t)?t:L)),n[2][3].add(a(0,e,f(r)?r:N))})).promise()},promise:function(e){return null!=e?k.extend(e,i):i}},o={};return k.each(n,(function(e,t){var a=t[2],s=t[5];i[t[1]]=a.add,s&&a.add((function(){r=s}),n[3-e][2].disable,n[3-e][3].disable,n[0][2].lock,n[0][3].lock),a.add(t[3].fire),o[t[0]]=function(){return o[t[0]+"With"](this===o?void 0:this,arguments),this},o[t[0]+"With"]=a.fireWith})),i.promise(o),t&&t.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),o=i.call(arguments),a=k.Deferred(),s=function(e){return function(n){r[e]=this,o[e]=arguments.length>1?i.call(arguments):n,--t||a.resolveWith(r,o)}};if(t<=1&&(R(e,a.done(s(n)).resolve,a.reject,!t),"pending"===a.state()||f(o[n]&&o[n].then)))return a.then();for(;n--;)R(o[n],s(n),a.reject);return a.promise()}});var F=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;k.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&F.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},k.readyException=function(t){e.setTimeout((function(){throw t}))};var B=k.Deferred();function z(){v.removeEventListener("DOMContentLoaded",z),e.removeEventListener("load",z),k.ready()}k.fn.ready=function(e){return B.then(e).catch((function(e){k.readyException(e)})),this},k.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--k.readyWait:k.isReady)||(k.isReady=!0,!0!==e&&--k.readyWait>0||B.resolveWith(v,[k]))}}),k.ready.then=B.then,"complete"===v.readyState||"loading"!==v.readyState&&!v.documentElement.doScroll?e.setTimeout(k.ready):(v.addEventListener("DOMContentLoaded",z),e.addEventListener("load",z));var H=function e(t,n,r,i,o,a,s){var c=0,u=t.length,d=null==r;if("object"===w(r))for(c in o=!0,r)e(t,n,c,r[c],!0,a,s);else if(void 0!==i&&(o=!0,f(i)||(s=!0),d&&(s?(n.call(t,i),n=null):(d=n,n=function(e,t,n){return d.call(k(e),n)})),n))for(;c<u;c++)n(t[c],r,s?i:i.call(t[c],c,n(t[c],r)));return o?t:d?n.call(t):u?n(t[0],r):a},q=/^-ms-/,$=/-([a-z])/g;function U(e,t){return t.toUpperCase()}function G(e){return e.replace(q,"ms-").replace($,U)}var V=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function J(){this.expando=k.expando+J.uid++}J.uid=1,J.prototype={cache:function(e){var t=e[this.expando];return t||(t={},V(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[G(t)]=n;else for(r in t)i[G(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][G(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(G):(t=G(t))in r?[t]:t.match(D)||[]).length;for(;n--;)delete r[t[n]]}(void 0===t||k.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!k.isEmptyObject(t)}};var K=new J,X=new J,Y=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Z=/[A-Z]/g;function Q(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(Z,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n=function(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:Y.test(e)?JSON.parse(e):e)}(n)}catch(e){}X.set(e,t,n)}else n=void 0;return n}k.extend({hasData:function(e){return X.hasData(e)||K.hasData(e)},data:function(e,t,n){return X.access(e,t,n)},removeData:function(e,t){X.remove(e,t)},_data:function(e,t,n){return K.access(e,t,n)},_removeData:function(e,t){K.remove(e,t)}}),k.fn.extend({data:function(e,t){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(i=X.get(o),1===o.nodeType&&!K.get(o,"hasDataAttrs"))){for(n=a.length;n--;)a[n]&&0===(r=a[n].name).indexOf("data-")&&(r=G(r.slice(5)),Q(o,r,i[r]));K.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof e?this.each((function(){X.set(this,e)})):H(this,(function(t){var n;if(o&&void 0===t)return void 0!==(n=X.get(o,e))||void 0!==(n=Q(o,e))?n:void 0;this.each((function(){X.set(this,e,t)}))}),null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each((function(){X.remove(this,e)}))}}),k.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=K.get(e,t),n&&(!r||Array.isArray(n)?r=K.access(e,t,k.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){var n=k.queue(e,t=t||"fx"),r=n.length,i=n.shift(),o=k._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,(function(){k.dequeue(e,t)}),o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return K.get(e,n)||K.access(e,n,{empty:k.Callbacks("once memory").add((function(){K.remove(e,[t+"queue",n])}))})}}),k.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length<n?k.queue(this[0],e):void 0===t?this:this.each((function(){var n=k.queue(this,e,t);k._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&k.dequeue(this,e)}))},dequeue:function(e){return this.each((function(){k.dequeue(this,e)}))},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=k.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};for("string"!=typeof e&&(t=e,e=void 0),e=e||"fx";a--;)(n=K.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var ee=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,te=new RegExp("^(?:([+-])=|)("+ee+")([a-z%]*)$","i"),ne=["Top","Right","Bottom","Left"],re=v.documentElement,ie=function(e){return k.contains(e.ownerDocument,e)},oe={composed:!0};re.getRootNode&&(ie=function(e){return k.contains(e.ownerDocument,e)||e.getRootNode(oe)===e.ownerDocument});var ae=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&ie(e)&&"none"===k.css(e,"display")};function se(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return k.css(e,t,"")},c=s(),u=n&&n[3]||(k.cssNumber[t]?"":"px"),d=e.nodeType&&(k.cssNumber[t]||"px"!==u&&+c)&&te.exec(k.css(e,t));if(d&&d[3]!==u){for(c/=2,u=u||d[3],d=+c||1;a--;)k.style(e,t,d+u),(1-o)*(1-(o=s()/c||.5))<=0&&(a=0),d/=o;k.style(e,t,(d*=2)+u),n=n||[]}return n&&(d=+d||+c||0,i=n[1]?d+(n[1]+1)*n[2]:+n[2],r&&(r.unit=u,r.start=d,r.end=i)),i}var ce={};function ue(e){var t,n=e.ownerDocument,r=e.nodeName,i=ce[r];return i||(t=n.body.appendChild(n.createElement(r)),i=k.css(t,"display"),t.parentNode.removeChild(t),"none"===i&&(i="block"),ce[r]=i,i)}function de(e,t){for(var n,r,i=[],o=0,a=e.length;o<a;o++)(r=e[o]).style&&(n=r.style.display,t?("none"===n&&(i[o]=K.get(r,"display")||null,i[o]||(r.style.display="")),""===r.style.display&&ae(r)&&(i[o]=ue(r))):"none"!==n&&(i[o]="none",K.set(r,"display",n)));for(o=0;o<a;o++)null!=i[o]&&(e[o].style.display=i[o]);return e}k.fn.extend({show:function(){return de(this,!0)},hide:function(){return de(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each((function(){ae(this)?k(this).show():k(this).hide()}))}});var le,pe,he=/^(?:checkbox|radio)$/i,fe=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,me=/^$|^module$|\/(?:java|ecma)script/i;le=v.createDocumentFragment().appendChild(v.createElement("div")),(pe=v.createElement("input")).setAttribute("type","radio"),pe.setAttribute("checked","checked"),pe.setAttribute("name","t"),le.appendChild(pe),h.checkClone=le.cloneNode(!0).cloneNode(!0).lastChild.checked,le.innerHTML="<textarea>x</textarea>",h.noCloneChecked=!!le.cloneNode(!0).lastChild.defaultValue,le.innerHTML="<option></option>",h.option=!!le.lastChild;var ve={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function ge(e,t){var n;return n=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&E(e,t)?k.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n<r;n++)K.set(e[n],"globalEval",!t||K.get(t[n],"globalEval"))}ve.tbody=ve.tfoot=ve.colgroup=ve.caption=ve.thead,ve.th=ve.td,h.option||(ve.optgroup=ve.option=[1,"<select multiple='multiple'>","</select>"]);var we=/<|&#?\w+;/;function be(e,t,n,r,i){for(var o,a,s,c,u,d,l=t.createDocumentFragment(),p=[],h=0,f=e.length;h<f;h++)if((o=e[h])||0===o)if("object"===w(o))k.merge(p,o.nodeType?[o]:o);else if(we.test(o)){for(a=a||l.appendChild(t.createElement("div")),s=(fe.exec(o)||["",""])[1].toLowerCase(),c=ve[s]||ve._default,a.innerHTML=c[1]+k.htmlPrefilter(o)+c[2],d=c[0];d--;)a=a.lastChild;k.merge(p,a.childNodes),(a=l.firstChild).textContent=""}else p.push(t.createTextNode(o));for(l.textContent="",h=0;o=p[h++];)if(r&&k.inArray(o,r)>-1)i&&i.push(o);else if(u=ie(o),a=ge(l.appendChild(o),"script"),u&&ye(a),n)for(d=0;o=a[d++];)me.test(o.type||"")&&n.push(o);return l}var ke=/^key/,xe=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,_e=/^([^.]*)(?:\.(.+)|)/;function Ie(){return!0}function Ce(){return!1}function Se(e,t){return e===function(){try{return v.activeElement}catch(e){}}()==("focus"===t)}function Ee(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)Ee(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Ce;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return k().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=k.guid++)),e.each((function(){k.event.add(this,t,i,r,n)}))}function We(e,t,n){n?(K.set(e,t,!1),k.event.add(e,t,{namespace:!1,handler:function(e){var r,o,a=K.get(this,t);if(1&e.isTrigger&&this[t]){if(a.length)(k.event.special[t]||{}).delegateType&&e.stopPropagation();else if(a=i.call(arguments),K.set(this,t,a),r=n(this,t),this[t](),a!==(o=K.get(this,t))||r?K.set(this,t,!1):o={},a!==o)return e.stopImmediatePropagation(),e.preventDefault(),o.value}else a.length&&(K.set(this,t,{value:k.event.trigger(k.extend(a[0],k.Event.prototype),a.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===K.get(e,t)&&k.event.add(e,t,Ie)}k.event={global:{},add:function(e,t,n,r,i){var o,a,s,c,u,d,l,p,h,f,m,v=K.get(e);if(V(e))for(n.handler&&(n=(o=n).handler,i=o.selector),i&&k.find.matchesSelector(re,i),n.guid||(n.guid=k.guid++),(c=v.events)||(c=v.events=Object.create(null)),(a=v.handle)||(a=v.handle=function(t){return void 0!==k&&k.event.triggered!==t.type?k.event.dispatch.apply(e,arguments):void 0}),u=(t=(t||"").match(D)||[""]).length;u--;)h=m=(s=_e.exec(t[u])||[])[1],f=(s[2]||"").split(".").sort(),h&&(l=k.event.special[h]||{},h=(i?l.delegateType:l.bindType)||h,l=k.event.special[h]||{},d=k.extend({type:h,origType:m,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&k.expr.match.needsContext.test(i),namespace:f.join(".")},o),(p=c[h])||((p=c[h]=[]).delegateCount=0,l.setup&&!1!==l.setup.call(e,r,f,a)||e.addEventListener&&e.addEventListener(h,a)),l.add&&(l.add.call(e,d),d.handler.guid||(d.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,d):p.push(d),k.event.global[h]=!0)},remove:function(e,t,n,r,i){var o,a,s,c,u,d,l,p,h,f,m,v=K.hasData(e)&&K.get(e);if(v&&(c=v.events)){for(u=(t=(t||"").match(D)||[""]).length;u--;)if(h=m=(s=_e.exec(t[u])||[])[1],f=(s[2]||"").split(".").sort(),h){for(l=k.event.special[h]||{},p=c[h=(r?l.delegateType:l.bindType)||h]||[],s=s[2]&&new RegExp("(^|\\.)"+f.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;o--;)d=p[o],!i&&m!==d.origType||n&&n.guid!==d.guid||s&&!s.test(d.namespace)||r&&r!==d.selector&&("**"!==r||!d.selector)||(p.splice(o,1),d.selector&&p.delegateCount--,l.remove&&l.remove.call(e,d));a&&!p.length&&(l.teardown&&!1!==l.teardown.call(e,f,v.handle)||k.removeEvent(e,h,v.handle),delete c[h])}else for(h in c)k.event.remove(e,h+t[u],n,r,!0);k.isEmptyObject(c)&&K.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=new Array(arguments.length),c=k.event.fix(e),u=(K.get(this,"events")||Object.create(null))[c.type]||[],d=k.event.special[c.type]||{};for(s[0]=c,t=1;t<arguments.length;t++)s[t]=arguments[t];if(c.delegateTarget=this,!d.preDispatch||!1!==d.preDispatch.call(this,c)){for(a=k.event.handlers.call(this,c,u),t=0;(i=a[t++])&&!c.isPropagationStopped();)for(c.currentTarget=i.elem,n=0;(o=i.handlers[n++])&&!c.isImmediatePropagationStopped();)c.rnamespace&&!1!==o.namespace&&!c.rnamespace.test(o.namespace)||(c.handleObj=o,c.data=o.data,void 0!==(r=((k.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s))&&!1===(c.result=r)&&(c.preventDefault(),c.stopPropagation()));return d.postDispatch&&d.postDispatch.call(this,c),c.result}},handlers:function(e,t){var n,r,i,o,a,s=[],c=t.delegateCount,u=e.target;if(c&&u.nodeType&&!("click"===e.type&&e.button>=1))for(;u!==this;u=u.parentNode||this)if(1===u.nodeType&&("click"!==e.type||!0!==u.disabled)){for(o=[],a={},n=0;n<c;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?k(i,this).index(u)>-1:k.find(i,this,null,[u]).length),a[i]&&o.push(r);o.length&&s.push({elem:u,handlers:o})}return u=this,c<t.length&&s.push({elem:u,handlers:t.slice(c)}),s},addProp:function(e,t){Object.defineProperty(k.Event.prototype,e,{enumerable:!0,configurable:!0,get:f(t)?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set:function(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})},fix:function(e){return e[k.expando]?e:new k.Event(e)},special:{load:{noBubble:!0},click:{setup:function(e){var t=this||e;return he.test(t.type)&&t.click&&E(t,"input")&&We(t,"click",Ie),!1},trigger:function(e){var t=this||e;return he.test(t.type)&&t.click&&E(t,"input")&&We(t,"click"),!0},_default:function(e){var t=e.target;return he.test(t.type)&&t.click&&E(t,"input")&&K.get(t,"click")||E(t,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},k.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},(k.Event=function(e,t){if(!(this instanceof k.Event))return new k.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ie:Ce,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&k.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[k.expando]=!0}).prototype={constructor:k.Event,isDefaultPrevented:Ce,isPropagationStopped:Ce,isImmediatePropagationStopped:Ce,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ie,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ie,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ie,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},k.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,char:!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&ke.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&xe.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},k.event.addProp),k.each({focus:"focusin",blur:"focusout"},(function(e,t){k.event.special[e]={setup:function(){return We(this,e,Se),!1},trigger:function(){return We(this,e),!0},delegateType:t}})),k.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},(function(e,t){k.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return i&&(i===r||k.contains(r,i))||(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}})),k.fn.extend({on:function(e,t,n,r){return Ee(this,e,t,n,r)},one:function(e,t,n,r){return Ee(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,k(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=Ce),this.each((function(){k.event.remove(this,e,n,t)}))}});var Te=/<script|<style|<link/i,Ae=/checked\s*(?:[^=]|=\s*.checked.)/i,Pe=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Me(e,t){return E(e,"table")&&E(11!==t.nodeType?t:t.firstChild,"tr")&&k(e).children("tbody")[0]||e}function Oe(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function je(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function De(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(K.hasData(e)&&(s=K.get(e).events))for(i in K.remove(t,"handle events"),s)for(n=0,r=s[i].length;n<r;n++)k.event.add(t,i,s[i][n]);X.hasData(e)&&(o=X.access(e),a=k.extend({},o),X.set(t,a))}}function Le(e,t){var n=t.nodeName.toLowerCase();"input"===n&&he.test(e.type)?t.checked=e.checked:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}function Ne(e,t,n,r){t=o(t);var i,a,s,c,u,d,l=0,p=e.length,m=p-1,v=t[0],g=f(v);if(g||p>1&&"string"==typeof v&&!h.checkClone&&Ae.test(v))return e.each((function(i){var o=e.eq(i);g&&(t[0]=v.call(this,i,o.html())),Ne(o,t,n,r)}));if(p&&(a=(i=be(t,e[0].ownerDocument,!1,e,r)).firstChild,1===i.childNodes.length&&(i=a),a||r)){for(c=(s=k.map(ge(i,"script"),Oe)).length;l<p;l++)u=i,l!==m&&(u=k.clone(u,!0,!0),c&&k.merge(s,ge(u,"script"))),n.call(e[l],u,l);if(c)for(d=s[s.length-1].ownerDocument,k.map(s,je),l=0;l<c;l++)u=s[l],me.test(u.type||"")&&!K.access(u,"globalEval")&&k.contains(d,u)&&(u.src&&"module"!==(u.type||"").toLowerCase()?k._evalUrl&&!u.noModule&&k._evalUrl(u.src,{nonce:u.nonce||u.getAttribute("nonce")},d):y(u.textContent.replace(Pe,""),u,d))}return e}function Re(e,t,n){for(var r,i=t?k.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||k.cleanData(ge(r)),r.parentNode&&(n&&ie(r)&&ye(ge(r,"script")),r.parentNode.removeChild(r));return e}k.extend({htmlPrefilter:function(e){return e},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),c=ie(e);if(!(h.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||k.isXMLDoc(e)))for(a=ge(s),r=0,i=(o=ge(e)).length;r<i;r++)Le(o[r],a[r]);if(t)if(n)for(o=o||ge(e),a=a||ge(s),r=0,i=o.length;r<i;r++)De(o[r],a[r]);else De(e,s);return(a=ge(s,"script")).length>0&&ye(a,!c&&ge(e,"script")),s},cleanData:function(e){for(var t,n,r,i=k.event.special,o=0;void 0!==(n=e[o]);o++)if(V(n)){if(t=n[K.expando]){if(t.events)for(r in t.events)i[r]?k.event.remove(n,r):k.removeEvent(n,r,t.handle);n[K.expando]=void 0}n[X.expando]&&(n[X.expando]=void 0)}}}),k.fn.extend({detach:function(e){return Re(this,e,!0)},remove:function(e){return Re(this,e)},text:function(e){return H(this,(function(e){return void 0===e?k.text(this):this.empty().each((function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)}))}),null,e,arguments.length)},append:function(){return Ne(this,arguments,(function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Me(this,e).appendChild(e)}))},prepend:function(){return Ne(this,arguments,(function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Me(this,e);t.insertBefore(e,t.firstChild)}}))},before:function(){return Ne(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this)}))},after:function(){return Ne(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)}))},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(k.cleanData(ge(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map((function(){return k.clone(this,e,t)}))},html:function(e){return H(this,(function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Te.test(e)&&!ve[(fe.exec(e)||["",""])[1].toLowerCase()]){e=k.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(k.cleanData(ge(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)}),null,e,arguments.length)},replaceWith:function(){var e=[];return Ne(this,arguments,(function(t){var n=this.parentNode;k.inArray(this,e)<0&&(k.cleanData(ge(this)),n&&n.replaceChild(t,this))}),e)}}),k.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},(function(e,t){k.fn[e]=function(e){for(var n,r=[],i=k(e),o=i.length-1,s=0;s<=o;s++)n=s===o?this:this.clone(!0),k(i[s])[t](n),a.apply(r,n.get());return this.pushStack(r)}}));var Fe=new RegExp("^("+ee+")(?!px)[a-z%]+$","i"),Be=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)},ze=function(e,t,n){var r,i,o={};for(i in t)o[i]=e.style[i],e.style[i]=t[i];for(i in r=n.call(e),t)e.style[i]=o[i];return r},He=new RegExp(ne.join("|"),"i");function qe(e,t,n){var r,i,o,a,s=e.style;return(n=n||Be(e))&&(""!==(a=n.getPropertyValue(t)||n[t])||ie(e)||(a=k.style(e,t)),!h.pixelBoxStyles()&&Fe.test(a)&&He.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o)),void 0!==a?a+"":a}function $e(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}!function(){function t(){if(d){u.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",d.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",re.appendChild(u).appendChild(d);var t=e.getComputedStyle(d);r="1%"!==t.top,c=12===n(t.marginLeft),d.style.right="60%",a=36===n(t.right),i=36===n(t.width),d.style.position="absolute",o=12===n(d.offsetWidth/3),re.removeChild(u),d=null}}function n(e){return Math.round(parseFloat(e))}var r,i,o,a,s,c,u=v.createElement("div"),d=v.createElement("div");d.style&&(d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",h.clearCloneStyle="content-box"===d.style.backgroundClip,k.extend(h,{boxSizingReliable:function(){return t(),i},pixelBoxStyles:function(){return t(),a},pixelPosition:function(){return t(),r},reliableMarginLeft:function(){return t(),c},scrollboxSize:function(){return t(),o},reliableTrDimensions:function(){var t,n,r,i;return null==s&&(t=v.createElement("table"),n=v.createElement("tr"),r=v.createElement("div"),t.style.cssText="position:absolute;left:-11111px",n.style.height="1px",r.style.height="9px",re.appendChild(t).appendChild(n).appendChild(r),i=e.getComputedStyle(n),s=parseInt(i.height)>3,re.removeChild(t)),s}}))}();var Ue=["Webkit","Moz","ms"],Ge=v.createElement("div").style,Ve={};function Je(e){return k.cssProps[e]||Ve[e]||(e in Ge?e:Ve[e]=function(e){for(var t=e[0].toUpperCase()+e.slice(1),n=Ue.length;n--;)if((e=Ue[n]+t)in Ge)return e}(e)||e)}var Ke=/^(none|table(?!-c[ea]).+)/,Xe=/^--/,Ye={position:"absolute",visibility:"hidden",display:"block"},Ze={letterSpacing:"0",fontWeight:"400"};function Qe(e,t,n){var r=te.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function et(e,t,n,r,i,o){var a="width"===t?1:0,s=0,c=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(c+=k.css(e,n+ne[a],!0,i)),r?("content"===n&&(c-=k.css(e,"padding"+ne[a],!0,i)),"margin"!==n&&(c-=k.css(e,"border"+ne[a]+"Width",!0,i))):(c+=k.css(e,"padding"+ne[a],!0,i),"padding"!==n?c+=k.css(e,"border"+ne[a]+"Width",!0,i):s+=k.css(e,"border"+ne[a]+"Width",!0,i));return!r&&o>=0&&(c+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-c-s-.5))||0),c}function tt(e,t,n){var r=Be(e),i=(!h.boxSizingReliable()||n)&&"border-box"===k.css(e,"boxSizing",!1,r),o=i,a=qe(e,t,r),s="offset"+t[0].toUpperCase()+t.slice(1);if(Fe.test(a)){if(!n)return a;a="auto"}return(!h.boxSizingReliable()&&i||!h.reliableTrDimensions()&&E(e,"tr")||"auto"===a||!parseFloat(a)&&"inline"===k.css(e,"display",!1,r))&&e.getClientRects().length&&(i="border-box"===k.css(e,"boxSizing",!1,r),(o=s in e)&&(a=e[s])),(a=parseFloat(a)||0)+et(e,t,n||(i?"border":"content"),o,r,a)+"px"}function nt(e,t,n,r,i){return new nt.prototype.init(e,t,n,r,i)}k.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=qe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=G(t),c=Xe.test(t),u=e.style;if(c||(t=Je(s)),a=k.cssHooks[t]||k.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:u[t];"string"==(o=typeof n)&&(i=te.exec(n))&&i[1]&&(n=se(e,t,i),o="number"),null!=n&&n==n&&("number"!==o||c||(n+=i&&i[3]||(k.cssNumber[s]?"":"px")),h.clearCloneStyle||""!==n||0!==t.indexOf("background")||(u[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(c?u.setProperty(t,n):u[t]=n))}},css:function(e,t,n,r){var i,o,a,s=G(t);return Xe.test(t)||(t=Je(s)),(a=k.cssHooks[t]||k.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=qe(e,t,r)),"normal"===i&&t in Ze&&(i=Ze[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),k.each(["height","width"],(function(e,t){k.cssHooks[t]={get:function(e,n,r){if(n)return!Ke.test(k.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?tt(e,t,r):ze(e,Ye,(function(){return tt(e,t,r)}))},set:function(e,n,r){var i,o=Be(e),a=!h.scrollboxSize()&&"absolute"===o.position,s=(a||r)&&"border-box"===k.css(e,"boxSizing",!1,o),c=r?et(e,t,r,s,o):0;return s&&a&&(c-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-et(e,t,"border",!1,o)-.5)),c&&(i=te.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=k.css(e,t)),Qe(0,n,c)}}})),k.cssHooks.marginLeft=$e(h.reliableMarginLeft,(function(e,t){if(t)return(parseFloat(qe(e,"marginLeft"))||e.getBoundingClientRect().left-ze(e,{marginLeft:0},(function(){return e.getBoundingClientRect().left})))+"px"})),k.each({margin:"",padding:"",border:"Width"},(function(e,t){k.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+ne[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(k.cssHooks[e+t].set=Qe)})),k.fn.extend({css:function(e,t){return H(this,(function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=Be(e),i=t.length;a<i;a++)o[t[a]]=k.css(e,t[a],!1,r);return o}return void 0!==n?k.style(e,t,n):k.css(e,t)}),e,t,arguments.length>1)}}),k.Tween=nt,nt.prototype={constructor:nt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||k.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(k.cssNumber[n]?"":"px")},cur:function(){var e=nt.propHooks[this.prop];return e&&e.get?e.get(this):nt.propHooks._default.get(this)},run:function(e){var t,n=nt.propHooks[this.prop];return this.options.duration?this.pos=t=k.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):nt.propHooks._default.set(this),this}},nt.prototype.init.prototype=nt.prototype,nt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=k.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){k.fx.step[e.prop]?k.fx.step[e.prop](e):1!==e.elem.nodeType||!k.cssHooks[e.prop]&&null==e.elem.style[Je(e.prop)]?e.elem[e.prop]=e.now:k.style(e.elem,e.prop,e.now+e.unit)}}},nt.propHooks.scrollTop=nt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},k.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},(k.fx=nt.prototype.init).step={};var rt,it,ot=/^(?:toggle|show|hide)$/,at=/queueHooks$/;function st(){it&&(!1===v.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(st):e.setTimeout(st,k.fx.interval),k.fx.tick())}function ct(){return e.setTimeout((function(){rt=void 0})),rt=Date.now()}function ut(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=ne[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function dt(e,t,n){for(var r,i=(lt.tweeners[t]||[]).concat(lt.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function lt(e,t,n){var r,i,o=0,a=lt.prefilters.length,s=k.Deferred().always((function(){delete c.elem})),c=function(){if(i)return!1;for(var t=rt||ct(),n=Math.max(0,u.startTime+u.duration-t),r=1-(n/u.duration||0),o=0,a=u.tweens.length;o<a;o++)u.tweens[o].run(r);return s.notifyWith(e,[u,r,n]),r<1&&a?n:(a||s.notifyWith(e,[u,1,0]),s.resolveWith(e,[u]),!1)},u=s.promise({elem:e,props:k.extend({},t),opts:k.extend(!0,{specialEasing:{},easing:k.easing._default},n),originalProperties:t,originalOptions:n,startTime:rt||ct(),duration:n.duration,tweens:[],createTween:function(t,n){var r=k.Tween(e,u.opts,t,n,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(r),r},stop:function(t){var n=0,r=t?u.tweens.length:0;if(i)return this;for(i=!0;n<r;n++)u.tweens[n].run(1);return t?(s.notifyWith(e,[u,1,0]),s.resolveWith(e,[u,t])):s.rejectWith(e,[u,t]),this}}),d=u.props;for(function(e,t){var n,r,i,o,a;for(n in e)if(i=t[r=G(n)],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=k.cssHooks[r])&&"expand"in a)for(n in o=a.expand(o),delete e[r],o)n in e||(e[n]=o[n],t[n]=i);else t[r]=i}(d,u.opts.specialEasing);o<a;o++)if(r=lt.prefilters[o].call(u,e,d,u.opts))return f(r.stop)&&(k._queueHooks(u.elem,u.opts.queue).stop=r.stop.bind(r)),r;return k.map(d,dt,u),f(u.opts.start)&&u.opts.start.call(e,u),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always),k.fx.timer(k.extend(c,{elem:e,anim:u,queue:u.opts.queue})),u}k.Animation=k.extend(lt,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return se(n.elem,e,te.exec(t),n),n}]},tweener:function(e,t){f(e)?(t=e,e=["*"]):e=e.match(D);for(var n,r=0,i=e.length;r<i;r++)n=e[r],lt.tweeners[n]=lt.tweeners[n]||[],lt.tweeners[n].unshift(t)},prefilters:[function(e,t,n){var r,i,o,a,s,c,u,d,l="width"in t||"height"in t,p=this,h={},f=e.style,m=e.nodeType&&ae(e),v=K.get(e,"fxshow");for(r in n.queue||(null==(a=k._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always((function(){p.always((function(){a.unqueued--,k.queue(e,"fx").length||a.empty.fire()}))}))),t)if(i=t[r],ot.test(i)){if(delete t[r],o=o||"toggle"===i,i===(m?"hide":"show")){if("show"!==i||!v||void 0===v[r])continue;m=!0}h[r]=v&&v[r]||k.style(e,r)}if((c=!k.isEmptyObject(t))||!k.isEmptyObject(h))for(r in l&&1===e.nodeType&&(n.overflow=[f.overflow,f.overflowX,f.overflowY],null==(u=v&&v.display)&&(u=K.get(e,"display")),"none"===(d=k.css(e,"display"))&&(u?d=u:(de([e],!0),u=e.style.display||u,d=k.css(e,"display"),de([e]))),("inline"===d||"inline-block"===d&&null!=u)&&"none"===k.css(e,"float")&&(c||(p.done((function(){f.display=u})),null==u&&(d=f.display,u="none"===d?"":d)),f.display="inline-block")),n.overflow&&(f.overflow="hidden",p.always((function(){f.overflow=n.overflow[0],f.overflowX=n.overflow[1],f.overflowY=n.overflow[2]}))),c=!1,h)c||(v?"hidden"in v&&(m=v.hidden):v=K.access(e,"fxshow",{display:u}),o&&(v.hidden=!m),m&&de([e],!0),p.done((function(){for(r in m||de([e]),K.remove(e,"fxshow"),h)k.style(e,r,h[r])}))),c=dt(m?v[r]:0,r,p),r in v||(v[r]=c.start,m&&(c.end=c.start,c.start=0))}],prefilter:function(e,t){t?lt.prefilters.unshift(e):lt.prefilters.push(e)}}),k.speed=function(e,t,n){var r=e&&"object"==typeof e?k.extend({},e):{complete:n||!n&&t||f(e)&&e,duration:e,easing:n&&t||t&&!f(t)&&t};return k.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in k.fx.speeds?r.duration=k.fx.speeds[r.duration]:r.duration=k.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){f(r.old)&&r.old.call(this),r.queue&&k.dequeue(this,r.queue)},r},k.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ae).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=k.isEmptyObject(e),o=k.speed(t,n,r),a=function(){var t=lt(this,k.extend({},e),o);(i||K.get(this,"finish"))&&t.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&this.queue(e||"fx",[]),this.each((function(){var t=!0,i=null!=e&&e+"queueHooks",o=k.timers,a=K.get(this);if(i)a[i]&&a[i].stop&&r(a[i]);else for(i in a)a[i]&&a[i].stop&&at.test(i)&&r(a[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));!t&&n||k.dequeue(this,e)}))},finish:function(e){return!1!==e&&(e=e||"fx"),this.each((function(){var t,n=K.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=k.timers,a=r?r.length:0;for(n.finish=!0,k.queue(this,e,[]),i&&i.stop&&i.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;t<a;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish}))}}),k.each(["toggle","show","hide"],(function(e,t){var n=k.fn[t];k.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ut(t,!0),e,r,i)}})),k.each({slideDown:ut("show"),slideUp:ut("hide"),slideToggle:ut("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},(function(e,t){k.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}})),k.timers=[],k.fx.tick=function(){var e,t=0,n=k.timers;for(rt=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||k.fx.stop(),rt=void 0},k.fx.timer=function(e){k.timers.push(e),k.fx.start()},k.fx.interval=13,k.fx.start=function(){it||(it=!0,st())},k.fx.stop=function(){it=null},k.fx.speeds={slow:600,fast:200,_default:400},k.fn.delay=function(t,n){return t=k.fx&&k.fx.speeds[t]||t,n=n||"fx",this.queue(n,(function(n,r){var i=e.setTimeout(n,t);r.stop=function(){e.clearTimeout(i)}}))},function(){var e=v.createElement("input"),t=v.createElement("select").appendChild(v.createElement("option"));e.type="checkbox",h.checkOn=""!==e.value,h.optSelected=t.selected,(e=v.createElement("input")).value="t",e.type="radio",h.radioValue="t"===e.value}();var pt,ht=k.expr.attrHandle;k.fn.extend({attr:function(e,t){return H(this,k.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each((function(){k.removeAttr(this,e)}))}}),k.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return void 0===e.getAttribute?k.prop(e,t,n):(1===o&&k.isXMLDoc(e)||(i=k.attrHooks[t.toLowerCase()]||(k.expr.match.bool.test(t)?pt:void 0)),void 0!==n?null===n?void k.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=k.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!h.radioValue&&"radio"===t&&E(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(D);if(i&&1===e.nodeType)for(;n=i[r++];)e.removeAttribute(n)}}),pt={set:function(e,t,n){return!1===t?k.removeAttr(e,n):e.setAttribute(n,n),n}},k.each(k.expr.match.bool.source.match(/\w+/g),(function(e,t){var n=ht[t]||k.find.attr;ht[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=ht[a],ht[a]=i,i=null!=n(e,t,r)?a:null,ht[a]=o),i}}));var ft=/^(?:input|select|textarea|button)$/i,mt=/^(?:a|area)$/i;function vt(e){return(e.match(D)||[]).join(" ")}function gt(e){return e.getAttribute&&e.getAttribute("class")||""}function yt(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(D)||[]}k.fn.extend({prop:function(e,t){return H(this,k.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each((function(){delete this[k.propFix[e]||e]}))}}),k.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&k.isXMLDoc(e)||(t=k.propFix[t]||t,i=k.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=k.find.attr(e,"tabindex");return t?parseInt(t,10):ft.test(e.nodeName)||mt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),h.optSelected||(k.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),k.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){k.propFix[this.toLowerCase()]=this})),k.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,c=0;if(f(e))return this.each((function(t){k(this).addClass(e.call(this,t,gt(this)))}));if((t=yt(e)).length)for(;n=this[c++];)if(i=gt(n),r=1===n.nodeType&&" "+vt(i)+" "){for(a=0;o=t[a++];)r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,c=0;if(f(e))return this.each((function(t){k(this).removeClass(e.call(this,t,gt(this)))}));if(!arguments.length)return this.attr("class","");if((t=yt(e)).length)for(;n=this[c++];)if(i=gt(n),r=1===n.nodeType&&" "+vt(i)+" "){for(a=0;o=t[a++];)for(;r.indexOf(" "+o+" ")>-1;)r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):f(e)?this.each((function(n){k(this).toggleClass(e.call(this,n,gt(this),t),t)})):this.each((function(){var t,i,o,a;if(r)for(i=0,o=k(this),a=yt(e);t=a[i++];)o.hasClass(t)?o.removeClass(t):o.addClass(t);else void 0!==e&&"boolean"!==n||((t=gt(this))&&K.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":K.get(this,"__className__")||""))}))},hasClass:function(e){var t,n,r=0;for(t=" "+e+" ";n=this[r++];)if(1===n.nodeType&&(" "+vt(gt(n))+" ").indexOf(t)>-1)return!0;return!1}});var wt=/\r/g;k.fn.extend({val:function(e){var t,n,r,i=this[0];return arguments.length?(r=f(e),this.each((function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,k(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=k.map(i,(function(e){return null==e?"":e+""}))),(t=k.valHooks[this.type]||k.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))}))):i?(t=k.valHooks[i.type]||k.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(wt,""):null==n?"":n:void 0}}),k.extend({valHooks:{option:{get:function(e){var t=k.find.attr(e,"value");return null!=t?t:vt(k.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],c=a?o+1:i.length;for(r=o<0?c:a?o:0;r<c;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!E(n.parentNode,"optgroup"))){if(t=k(n).val(),a)return t;s.push(t)}return s},set:function(e,t){for(var n,r,i=e.options,o=k.makeArray(t),a=i.length;a--;)((r=i[a]).selected=k.inArray(k.valHooks.option.get(r),o)>-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),k.each(["radio","checkbox"],(function(){k.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=k.inArray(k(e).val(),t)>-1}},h.checkOn||(k.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})})),h.focusin="onfocusin"in e;var bt=/^(?:focusinfocus|focusoutblur)$/,kt=function(e){e.stopPropagation()};k.extend(k.event,{trigger:function(t,n,r,i){var o,a,s,c,u,l,p,h,g=[r||v],y=d.call(t,"type")?t.type:t,w=d.call(t,"namespace")?t.namespace.split("."):[];if(a=h=s=r=r||v,3!==r.nodeType&&8!==r.nodeType&&!bt.test(y+k.event.triggered)&&(y.indexOf(".")>-1&&(w=y.split("."),y=w.shift(),w.sort()),u=y.indexOf(":")<0&&"on"+y,(t=t[k.expando]?t:new k.Event(y,"object"==typeof t&&t)).isTrigger=i?2:3,t.namespace=w.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+w.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=r),n=null==n?[t]:k.makeArray(n,[t]),p=k.event.special[y]||{},i||!p.trigger||!1!==p.trigger.apply(r,n))){if(!i&&!p.noBubble&&!m(r)){for(c=p.delegateType||y,bt.test(c+y)||(a=a.parentNode);a;a=a.parentNode)g.push(a),s=a;s===(r.ownerDocument||v)&&g.push(s.defaultView||s.parentWindow||e)}for(o=0;(a=g[o++])&&!t.isPropagationStopped();)h=a,t.type=o>1?c:p.bindType||y,(l=(K.get(a,"events")||Object.create(null))[t.type]&&K.get(a,"handle"))&&l.apply(a,n),(l=u&&a[u])&&l.apply&&V(a)&&(t.result=l.apply(a,n),!1===t.result&&t.preventDefault());return t.type=y,i||t.isDefaultPrevented()||p._default&&!1!==p._default.apply(g.pop(),n)||!V(r)||u&&f(r[y])&&!m(r)&&((s=r[u])&&(r[u]=null),k.event.triggered=y,t.isPropagationStopped()&&h.addEventListener(y,kt),r[y](),t.isPropagationStopped()&&h.removeEventListener(y,kt),k.event.triggered=void 0,s&&(r[u]=s)),t.result}},simulate:function(e,t,n){var r=k.extend(new k.Event,n,{type:e,isSimulated:!0});k.event.trigger(r,null,t)}}),k.fn.extend({trigger:function(e,t){return this.each((function(){k.event.trigger(e,t,this)}))},triggerHandler:function(e,t){var n=this[0];if(n)return k.event.trigger(e,t,n,!0)}}),h.focusin||k.each({focus:"focusin",blur:"focusout"},(function(e,t){var n=function(e){k.event.simulate(t,e.target,k.event.fix(e))};k.event.special[t]={setup:function(){var r=this.ownerDocument||this.document||this,i=K.access(r,t);i||r.addEventListener(e,n,!0),K.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this.document||this,i=K.access(r,t)-1;i?K.access(r,t,i):(r.removeEventListener(e,n,!0),K.remove(r,t))}}}));var xt=e.location,_t={guid:Date.now()},It=/\?/;k.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||k.error("Invalid XML: "+t),n};var Ct=/\[\]$/,St=/\r?\n/g,Et=/^(?:submit|button|image|reset|file)$/i,Wt=/^(?:input|select|textarea|keygen)/i;function Tt(e,t,n,r){var i;if(Array.isArray(t))k.each(t,(function(t,i){n||Ct.test(e)?r(e,i):Tt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)}));else if(n||"object"!==w(t))r(e,t);else for(i in t)Tt(e+"["+i+"]",t[i],n,r)}k.param=function(e,t){var n,r=[],i=function(e,t){var n=f(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!k.isPlainObject(e))k.each(e,(function(){i(this.name,this.value)}));else for(n in e)Tt(n,e[n],t,i);return r.join("&")},k.fn.extend({serialize:function(){return k.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var e=k.prop(this,"elements");return e?k.makeArray(e):this})).filter((function(){var e=this.type;return this.name&&!k(this).is(":disabled")&&Wt.test(this.nodeName)&&!Et.test(e)&&(this.checked||!he.test(e))})).map((function(e,t){var n=k(this).val();return null==n?null:Array.isArray(n)?k.map(n,(function(e){return{name:t.name,value:e.replace(St,"\r\n")}})):{name:t.name,value:n.replace(St,"\r\n")}})).get()}});var At=/%20/g,Pt=/#.*$/,Mt=/([?&])_=[^&]*/,Ot=/^(.*?):[ \t]*([^\r\n]*)$/gm,jt=/^(?:GET|HEAD)$/,Dt=/^\/\//,Lt={},Nt={},Rt="*/".concat("*"),Ft=v.createElement("a");function Bt(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(D)||[];if(f(n))for(;r=o[i++];)"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function zt(e,t,n,r){var i={},o=e===Nt;function a(s){var c;return i[s]=!0,k.each(e[s]||[],(function(e,s){var u=s(t,n,r);return"string"!=typeof u||o||i[u]?o?!(c=u):void 0:(t.dataTypes.unshift(u),a(u),!1)})),c}return a(t.dataTypes[0])||!i["*"]&&a("*")}function Ht(e,t){var n,r,i=k.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&k.extend(!0,e,r),e}Ft.href=xt.href,k.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:xt.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(xt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Rt,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"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":k.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Ht(Ht(e,k.ajaxSettings),t):Ht(k.ajaxSettings,e)},ajaxPrefilter:Bt(Lt),ajaxTransport:Bt(Nt),ajax:function(t,n){"object"==typeof t&&(n=t,t=void 0);var r,i,o,a,s,c,u,d,l,p,h=k.ajaxSetup({},n=n||{}),f=h.context||h,m=h.context&&(f.nodeType||f.jquery)?k(f):k.event,g=k.Deferred(),y=k.Callbacks("once memory"),w=h.statusCode||{},b={},x={},_="canceled",I={readyState:0,getResponseHeader:function(e){var t;if(u){if(!a)for(a={};t=Ot.exec(o);)a[t[1].toLowerCase()+" "]=(a[t[1].toLowerCase()+" "]||[]).concat(t[2]);t=a[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return u?o:null},setRequestHeader:function(e,t){return null==u&&(e=x[e.toLowerCase()]=x[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==u&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(u)I.always(e[I.status]);else for(t in e)w[t]=[w[t],e[t]];return this},abort:function(e){var t=e||_;return r&&r.abort(t),C(0,t),this}};if(g.promise(I),h.url=((t||h.url||xt.href)+"").replace(Dt,xt.protocol+"//"),h.type=n.method||n.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(D)||[""],null==h.crossDomain){c=v.createElement("a");try{c.href=h.url,c.href=c.href,h.crossDomain=Ft.protocol+"//"+Ft.host!=c.protocol+"//"+c.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=k.param(h.data,h.traditional)),zt(Lt,h,n,I),u)return I;for(l in(d=k.event&&h.global)&&0==k.active++&&k.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!jt.test(h.type),i=h.url.replace(Pt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(At,"+")):(p=h.url.slice(i.length),h.data&&(h.processData||"string"==typeof h.data)&&(i+=(It.test(i)?"&":"?")+h.data,delete h.data),!1===h.cache&&(i=i.replace(Mt,"$1"),p=(It.test(i)?"&":"?")+"_="+_t.guid+++p),h.url=i+p),h.ifModified&&(k.lastModified[i]&&I.setRequestHeader("If-Modified-Since",k.lastModified[i]),k.etag[i]&&I.setRequestHeader("If-None-Match",k.etag[i])),(h.data&&h.hasContent&&!1!==h.contentType||n.contentType)&&I.setRequestHeader("Content-Type",h.contentType),I.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+Rt+"; q=0.01":""):h.accepts["*"]),h.headers)I.setRequestHeader(l,h.headers[l]);if(h.beforeSend&&(!1===h.beforeSend.call(f,I,h)||u))return I.abort();if(_="abort",y.add(h.complete),I.done(h.success),I.fail(h.error),r=zt(Nt,h,n,I)){if(I.readyState=1,d&&m.trigger("ajaxSend",[I,h]),u)return I;h.async&&h.timeout>0&&(s=e.setTimeout((function(){I.abort("timeout")}),h.timeout));try{u=!1,r.send(b,C)}catch(e){if(u)throw e;C(-1,e)}}else C(-1,"No Transport");function C(t,n,a,c){var l,p,v,b,x,_=n;u||(u=!0,s&&e.clearTimeout(s),r=void 0,o=c||"",I.readyState=t>0?4:0,l=t>=200&&t<300||304===t,a&&(b=function(e,t,n){for(var r,i,o,a,s=e.contents,c=e.dataTypes;"*"===c[0];)c.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){c.unshift(i);break}if(c[0]in n)o=c[0];else{for(i in n){if(!c[0]||e.converters[i+" "+c[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==c[0]&&c.unshift(o),n[o]}(h,I,a)),!l&&k.inArray("script",h.dataTypes)>-1&&(h.converters["text script"]=function(){}),b=function(e,t,n,r){var i,o,a,s,c,u={},d=e.dataTypes.slice();if(d[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];for(o=d.shift();o;)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!c&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),c=o,o=d.shift())if("*"===o)o=c;else if("*"!==c&&c!==o){if(!(a=u[c+" "+o]||u["* "+o]))for(i in u)if((s=i.split(" "))[1]===o&&(a=u[c+" "+s[0]]||u["* "+s[0]])){!0===a?a=u[i]:!0!==u[i]&&(o=s[0],d.unshift(s[1]));break}if(!0!==a)if(a&&e.throws)t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+c+" to "+o}}}return{state:"success",data:t}}(h,b,I,l),l?(h.ifModified&&((x=I.getResponseHeader("Last-Modified"))&&(k.lastModified[i]=x),(x=I.getResponseHeader("etag"))&&(k.etag[i]=x)),204===t||"HEAD"===h.type?_="nocontent":304===t?_="notmodified":(_=b.state,p=b.data,l=!(v=b.error))):(v=_,!t&&_||(_="error",t<0&&(t=0))),I.status=t,I.statusText=(n||_)+"",l?g.resolveWith(f,[p,_,I]):g.rejectWith(f,[I,_,v]),I.statusCode(w),w=void 0,d&&m.trigger(l?"ajaxSuccess":"ajaxError",[I,h,l?p:v]),y.fireWith(f,[I,_]),d&&(m.trigger("ajaxComplete",[I,h]),--k.active||k.event.trigger("ajaxStop")))}return I},getJSON:function(e,t,n){return k.get(e,t,n,"json")},getScript:function(e,t){return k.get(e,void 0,t,"script")}}),k.each(["get","post"],(function(e,t){k[t]=function(e,n,r,i){return f(n)&&(i=i||r,r=n,n=void 0),k.ajax(k.extend({url:e,type:t,dataType:i,data:n,success:r},k.isPlainObject(e)&&e))}})),k.ajaxPrefilter((function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")})),k._evalUrl=function(e,t,n){return k.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){k.globalEval(e,t,n)}})},k.fn.extend({wrapAll:function(e){var t;return this[0]&&(f(e)&&(e=e.call(this[0])),t=k(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map((function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e})).append(this)),this},wrapInner:function(e){return f(e)?this.each((function(t){k(this).wrapInner(e.call(this,t))})):this.each((function(){var t=k(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)}))},wrap:function(e){var t=f(e);return this.each((function(n){k(this).wrapAll(t?e.call(this,n):e)}))},unwrap:function(e){return this.parent(e).not("body").each((function(){k(this).replaceWith(this.childNodes)})),this}}),k.expr.pseudos.hidden=function(e){return!k.expr.pseudos.visible(e)},k.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},k.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var qt={0:200,1223:204},$t=k.ajaxSettings.xhr();h.cors=!!$t&&"withCredentials"in $t,h.ajax=$t=!!$t,k.ajaxTransport((function(t){var n,r;if(h.cors||$t&&!t.crossDomain)return{send:function(i,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];for(a in t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest"),i)s.setRequestHeader(a,i[a]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(qt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout((function(){n&&r()}))},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}})),k.ajaxPrefilter((function(e){e.crossDomain&&(e.contents.script=!1)})),k.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return k.globalEval(e),e}}}),k.ajaxPrefilter("script",(function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")})),k.ajaxTransport("script",(function(e){var t,n;if(e.crossDomain||e.scriptAttrs)return{send:function(r,i){t=k("<script>").attr(e.scriptAttrs||{}).prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&i("error"===e.type?404:200,e.type)}),v.head.appendChild(t[0])},abort:function(){n&&n()}}}));var Ut,Gt=[],Vt=/(=)\?(?=&|$)|\?\?/;k.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Gt.pop()||k.expando+"_"+_t.guid++;return this[e]=!0,e}}),k.ajaxPrefilter("json jsonp",(function(t,n,r){var i,o,a,s=!1!==t.jsonp&&(Vt.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vt.test(t.data)&&"data");if(s||"jsonp"===t.dataTypes[0])return i=t.jsonpCallback=f(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(Vt,"$1"+i):!1!==t.jsonp&&(t.url+=(It.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return a||k.error(i+" was not called"),a[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){a=arguments},r.always((function(){void 0===o?k(e).removeProp(i):e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,Gt.push(i)),a&&f(o)&&o(a[0]),a=o=void 0})),"script"})),h.createHTMLDocument=((Ut=v.implementation.createHTMLDocument("").body).innerHTML="<form></form><form></form>",2===Ut.childNodes.length),k.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(h.createHTMLDocument?((r=(t=v.implementation.createHTMLDocument("")).createElement("base")).href=v.location.href,t.head.appendChild(r)):t=v),o=!n&&[],(i=W.exec(e))?[t.createElement(i[1])]:(i=be([e],t,o),o&&o.length&&k(o).remove(),k.merge([],i.childNodes)));var r,i,o},k.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return s>-1&&(r=vt(e.slice(s)),e=e.slice(0,s)),f(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),a.length>0&&k.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done((function(e){o=arguments,a.html(r?k("<div>").append(k.parseHTML(e)).find(r):e)})).always(n&&function(e,t){a.each((function(){n.apply(this,o||[e.responseText,t,e])}))}),this},k.expr.pseudos.animated=function(e){return k.grep(k.timers,(function(t){return e===t.elem})).length},k.offset={setOffset:function(e,t,n){var r,i,o,a,s,c,u=k.css(e,"position"),d=k(e),l={};"static"===u&&(e.style.position="relative"),s=d.offset(),o=k.css(e,"top"),c=k.css(e,"left"),("absolute"===u||"fixed"===u)&&(o+c).indexOf("auto")>-1?(a=(r=d.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(c)||0),f(t)&&(t=t.call(e,n,k.extend({},s))),null!=t.top&&(l.top=t.top-s.top+a),null!=t.left&&(l.left=t.left-s.left+i),"using"in t?t.using.call(e,l):("number"==typeof l.top&&(l.top+="px"),"number"==typeof l.left&&(l.left+="px"),d.css(l))}},k.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each((function(t){k.offset.setOffset(this,e,t)}));var t,n,r=this[0];return r?r.getClientRects().length?(t=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:t.top+n.pageYOffset,left:t.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===k.css(r,"position"))t=r.getBoundingClientRect();else{for(t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;e&&(e===n.body||e===n.documentElement)&&"static"===k.css(e,"position");)e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=k(e).offset()).top+=k.css(e,"borderTopWidth",!0),i.left+=k.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-k.css(r,"marginTop",!0),left:t.left-i.left-k.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map((function(){for(var e=this.offsetParent;e&&"static"===k.css(e,"position");)e=e.offsetParent;return e||re}))}}),k.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},(function(e,t){var n="pageYOffset"===t;k.fn[e]=function(r){return H(this,(function(e,r,i){var o;if(m(e)?o=e:9===e.nodeType&&(o=e.defaultView),void 0===i)return o?o[t]:e[r];o?o.scrollTo(n?o.pageXOffset:i,n?i:o.pageYOffset):e[r]=i}),e,r,arguments.length)}})),k.each(["top","left"],(function(e,t){k.cssHooks[t]=$e(h.pixelPosition,(function(e,n){if(n)return n=qe(e,t),Fe.test(n)?k(e).position()[t]+"px":n}))})),k.each({Height:"height",Width:"width"},(function(e,t){k.each({padding:"inner"+e,content:t,"":"outer"+e},(function(n,r){k.fn[r]=function(i,o){var a=arguments.length&&(n||"boolean"!=typeof i),s=n||(!0===i||!0===o?"margin":"border");return H(this,(function(t,n,i){var o;return m(t)?0===r.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(o=t.documentElement,Math.max(t.body["scroll"+e],o["scroll"+e],t.body["offset"+e],o["offset"+e],o["client"+e])):void 0===i?k.css(t,n,s):k.style(t,n,i,s)}),t,a?i:void 0,a)}}))})),k.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],(function(e,t){k.fn[t]=function(e){return this.on(t,e)}})),k.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),k.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),(function(e,t){k.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}));var Jt=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;k.proxy=function(e,t){var n,r,o;if("string"==typeof t&&(n=e[t],t=e,e=n),f(e))return r=i.call(arguments,2),(o=function(){return e.apply(t||this,r.concat(i.call(arguments)))}).guid=e.guid=e.guid||k.guid++,o},k.holdReady=function(e){e?k.readyWait++:k.ready(!0)},k.isArray=Array.isArray,k.parseJSON=JSON.parse,k.nodeName=E,k.isFunction=f,k.isWindow=m,k.camelCase=G,k.type=w,k.now=Date.now,k.isNumeric=function(e){var t=k.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},k.trim=function(e){return null==e?"":(e+"").replace(Jt,"")};var Kt=e.jQuery,Xt=e.$;return k.noConflict=function(t){return e.$===k&&(e.$=Xt),t&&e.jQuery===k&&(e.jQuery=Kt),k},void 0===t&&(e.jQuery=e.$=k),k},e.exports=t.document?n(t,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return n(e)}}));window.$=Pe,window.addEventListener("beforeunload",(function(){return Ae.dispose(),ce&&ce(),"Are you sure you want to leave? changes will be lost"}));var Me={init:function(e,t){if(!Te.initialized){Ae.subscribeForWorkspaceEvents();var n=Te.init(e,e.agm.instance.windowId,Ae,t);return ce=n.cleanUp,Ae.init(e,e.agm.instance.windowId).then((function(){ye.config.emptyFrame||Te.workspacesEventEmitter.raiseFrameEvent({action:"opened",payload:{frameSummary:{id:e.agm.instance.windowId}}})})).catch(console.warn),Te}Te.init(e,e.agm.instance.windowId,Ae,t)},getFrameId:function(){return Te.frameId},notifyMoveAreaChanged:function(){},getComponentBounds:function(){return Te.getComponentBounds()},registerPopup:function(e){return""},removePopup:function(e){},removePopupById:function(e){},unmount:function(){Te.unmount()},subscribeForWindowFocused:function(e){return Te.subscribeForWindowClicked(e)},notifyWorkspacePopupChanged:function(e){},requestFocus:function(){}},Oe=new(function(){function e(){}return e.prototype.init=function(e,t){window.workspacesManager?window.workspacesManager.init(t):Me.init(e,t)},e.prototype.getFrameId=function(){return(window.workspacesManager||Me).getFrameId()},e.prototype.notifyMoveAreaChanged=function(){(window.workspacesManager||Me).notifyMoveAreaChanged()},e.prototype.notifyWorkspacePopupChanged=function(e){return(window.workspacesManager||Me).notifyWorkspacePopupChanged(e)},e.prototype.getComponentBounds=function(){return(window.workspacesManager||Me).getComponentBounds()},e.prototype.registerPopup=function(e){return(window.workspacesManager||Me).registerPopup(e)},e.prototype.removePopup=function(e){return(window.workspacesManager||Me).removePopup(e)},e.prototype.removePopupById=function(e){return(window.workspacesManager||Me).removePopupById(e)},e.prototype.subscribeForWindowFocused=function(e){return(window.workspacesManager||Me).subscribeForWindowFocused(e)},e.prototype.unmount=function(){return(window.workspacesManager||Me).unmount()},e.prototype.requestFocus=function(){return(window.workspacesManager||Me).requestFocus()},e}());function je(){return(je=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var De="undefined"!=typeof window?d.useLayoutEffect:d.useEffect,Le={popupContent:{tooltip:{position:"absolute",zIndex:999},modal:{position:"relative",margin:"auto"}},popupArrow:{height:"8px",width:"16px",position:"absolute",background:"transparent",color:"#FFF",zIndex:-1},overlay:{tooltip:{position:"fixed",top:"0",bottom:"0",left:"0",right:"0",zIndex:999},modal:{position:"fixed",top:"0",bottom:"0",left:"0",right:"0",display:"flex",zIndex:999}}},Ne=["top left","top center","top right","right top","right center","right bottom","bottom left","bottom center","bottom right","left top","left center","left bottom"],Re=function(e,t,n,r,i){var o=i.offsetX,a=i.offsetY,s=r?8:0,c=n.split(" "),u=e.top+e.height/2,d=e.left+e.width/2,l=t.height,p=t.width,h=u-l/2,f=d-p/2,m="",v="0%",g="0%";switch(c[0]){case"top":h-=l/2+e.height/2+s,m="rotate(180deg) translateX(50%)",v="100%",g="50%";break;case"bottom":h+=l/2+e.height/2+s,m="rotate(0deg) translateY(-100%) translateX(-50%)",g="50%";break;case"left":f-=p/2+e.width/2+s,m=" rotate(90deg) translateY(50%) translateX(-25%)",g="100%",v="50%";break;case"right":f+=p/2+e.width/2+s,m="rotate(-90deg) translateY(-150%) translateX(25%)",v="50%"}switch(c[1]){case"top":h=e.top,v=e.height/2+"px";break;case"bottom":h=e.top-l+e.height,v=l-e.height/2+"px";break;case"left":f=e.left,g=e.width/2+"px";break;case"right":f=e.left-p+e.width,g=p-e.width/2+"px"}return{top:h="top"===c[0]?h-a:h+a,left:f="left"===c[0]?f-o:f+o,transform:m,arrowLeft:g,arrowTop:v}},Fe=0,Be=(Object(d.forwardRef)((function(e,t){var n=e.trigger,r=void 0===n?null:n,i=e.onOpen,o=void 0===i?function(){}:i,a=e.onClose,s=void 0===a?function(){}:a,c=e.defaultOpen,u=void 0!==c&&c,p=e.open,h=void 0===p?void 0:p,m=e.disabled,v=void 0!==m&&m,g=e.nested,y=void 0!==g&&g,w=e.closeOnDocumentClick,b=void 0===w||w,k=e.repositionOnResize,x=void 0===k||k,_=e.closeOnEscape,I=void 0===_||_,C=e.on,S=void 0===C?["click"]:C,E=e.contentStyle,W=void 0===E?{}:E,T=e.arrowStyle,A=void 0===T?{}:T,P=e.overlayStyle,M=void 0===P?{}:P,O=e.className,j=void 0===O?"":O,D=e.position,L=void 0===D?"bottom center":D,N=e.modal,R=void 0!==N&&N,F=e.lockScroll,B=void 0!==F&&F,z=e.arrow,H=void 0===z||z,q=e.offsetX,$=void 0===q?0:q,U=e.offsetY,G=void 0===U?0:U,V=e.mouseEnterDelay,J=void 0===V?100:V,K=e.mouseLeaveDelay,X=void 0===K?100:K,Y=e.keepTooltipInside,Z=void 0!==Y&&Y,Q=e.children,ee=Object(d.useState)(h||u),te=ee[0],ne=ee[1],re=Object(d.useRef)(null),ie=Object(d.useRef)(null),oe=Object(d.useRef)(null),ae=Object(d.useRef)(null),se=Object(d.useRef)("popup-"+ ++Fe),ce=!!R||!r,ue=Object(d.useRef)(0);De((function(){return te?(ae.current=document.activeElement,ke(),ye(),ve()):ge(),function(){clearTimeout(ue.current)}}),[te]),Object(d.useEffect)((function(){"boolean"==typeof h&&(h?de():le())}),[h,v]);var de=function(){te||v||(ne(!0),setTimeout(o,0))},le=function(){te&&!v&&(ne(!1),ce&&ae.current.focus(),setTimeout(s,0))},pe=function(e){null==e||e.stopPropagation(),te?le():de()},he=function(){clearTimeout(ue.current),ue.current=setTimeout(de,J)},fe=function(e){null==e||e.preventDefault(),pe()},me=function(){clearTimeout(ue.current),ue.current=setTimeout(le,X)},ve=function(){ce&&B&&(document.getElementsByTagName("body")[0].style.overflow="hidden")},ge=function(){ce&&B&&(document.getElementsByTagName("body")[0].style.overflow="auto")},ye=function(){var e,t=null==ie||null===(e=ie.current)||void 0===e?void 0:e.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]'),n=Array.prototype.slice.call(t)[0];null==n||n.focus()};Object(d.useImperativeHandle)(t,(function(){return{open:function(){de()},close:function(){le()},toggle:function(){pe()}}}));var we,be,ke=function(){if(!ce&&te&&(null==re?void 0:re.current)&&(null==re?void 0:re.current)&&(null==ie?void 0:ie.current)){var e,t,n=function(e,t,n,r,i,o){var a=i.offsetX,s=i.offsetY,c={arrowLeft:"0%",arrowTop:"0%",left:0,top:0,transform:"rotate(135deg)"},u=0,d=function(e){var t={top:0,left:0,width:window.innerWidth,height:window.innerHeight};if("string"==typeof e){var n=document.querySelector(e);null!==n&&(t=n.getBoundingClientRect())}return t}(o),l=Array.isArray(n)?n:[n];for((o||Array.isArray(n))&&(l=[].concat(l,Ne));u<l.length;){var p={top:(c=Re(e,t,l[u],r,{offsetX:a,offsetY:s})).top,left:c.left,width:t.width,height:t.height};if(!(p.top<=d.top||p.left<=d.left||p.top+p.height>=d.top+d.height||p.left+p.width>=d.left+d.width))break;u++}return c}(re.current.getBoundingClientRect(),ie.current.getBoundingClientRect(),L,H,{offsetX:$,offsetY:G},Z);ie.current.style.top=n.top+window.scrollY+"px",ie.current.style.left=n.left+window.scrollX+"px",H&&oe.current&&(oe.current.style.transform=n.transform,oe.current.style.setProperty("-ms-transform",n.transform),oe.current.style.setProperty("-webkit-transform",n.transform),oe.current.style.top=(null===(e=A.top)||void 0===e?void 0:e.toString())||n.arrowTop,oe.current.style.left=(null===(t=A.left)||void 0===t?void 0:t.toString())||n.arrowLeft)}};void 0===(be=I)&&(be=!0),Object(d.useEffect)((function(){if(be){var e=function(e){"Escape"===e.key&&we()};return document.addEventListener("keyup",e),function(){be&&document.removeEventListener("keyup",e)}}}),[we=le,be]),function(e,t){void 0===t&&(t=!0),Object(d.useEffect)((function(){if(t){var n=function(t){if(9===t.keyCode){var n,r=null==e||null===(n=e.current)||void 0===n?void 0:n.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]'),i=Array.prototype.slice.call(r);if(1===i.length)return void t.preventDefault();var o=i[0],a=i[i.length-1];t.shiftKey&&document.activeElement===o?(t.preventDefault(),a.focus()):document.activeElement===a&&(t.preventDefault(),o.focus())}};return document.addEventListener("keydown",n),function(){t&&document.removeEventListener("keydown",n)}}}),[e,t])}(ie,te&&ce),function(e,t){void 0===t&&(t=!0),Object(d.useEffect)((function(){if(t){var n=function(){e()};return window.addEventListener("resize",n),function(){t&&window.removeEventListener("resize",n)}}}),[e,t])}(ke,x),function(e,t,n){void 0===n&&(n=!0),Object(d.useEffect)((function(){if(n){var r=function(n){var r=Array.isArray(e)?e:[e],i=!1;r.forEach((function(e){e.current&&!e.current.contains(n.target)||(i=!0)})),n.stopPropagation(),i||t()};return document.addEventListener("mousedown",r),document.addEventListener("touchstart",r),function(){n&&(document.removeEventListener("mousedown",r),document.removeEventListener("touchstart",r))}}}),[e,t,n])}(r?[ie,re]:[ie],le,b&&!y);var xe,_e=function(){return l.a.createElement("div",Object.assign({},(e=ce?Le.popupContent.modal:Le.popupContent.tooltip,t={className:"popup-content "+(""!==j?j.split(" ").map((function(e){return e+"-content"})).join(" "):""),style:je({},e,W,{pointerEvents:"auto"}),ref:ie,onClick:function(e){e.stopPropagation()}},!R&&S.indexOf("hover")>=0&&(t.onMouseEnter=he,t.onMouseLeave=me),t),{key:"C",role:ce?"dialog":"tooltip",id:se.current}),H&&!ce&&l.a.createElement("div",{ref:oe,style:Le.popupArrow},l.a.createElement("svg",{"data-testid":"arrow",className:"popup-arrow "+(""!==j?j.split(" ").map((function(e){return e+"-arrow"})).join(" "):""),viewBox:"0 0 32 16",style:je({position:"absolute"},A)},l.a.createElement("path",{d:"M16 0l16 16H0z",fill:"currentcolor"}))),Q&&"function"==typeof Q?Q(le,te):Q);var e,t},Ie=!(S.indexOf("hover")>=0),Ce=ce?Le.overlay.modal:Le.overlay.tooltip,Se=[Ie&&l.a.createElement("div",{key:"O","data-testid":"overlay","data-popup":ce?"modal":"tooltip",className:"popup-overlay "+(""!==j?j.split(" ").map((function(e){return e+"-overlay"})).join(" "):""),style:je({},Ce,M,{pointerEvents:b&&y||ce?"auto":"none"}),onClick:b&&y?le:void 0,tabIndex:-1},ce&&_e()),!ce&&_e()];return l.a.createElement(l.a.Fragment,null,function(){for(var e={key:"T",ref:re,"aria-describedby":se.current},t=Array.isArray(S)?S:[S],n=0,i=t.length;n<i;n++)switch(t[n]){case"click":e.onClick=pe;break;case"right-click":e.onContextMenu=fe;break;case"hover":e.onMouseEnter=he,e.onMouseLeave=me;break;case"focus":e.onFocus=he,e.onBlur=me}if("function"==typeof r){var o=r(te);return!!r&&l.a.cloneElement(o,e)}return!!r&&l.a.cloneElement(r,e)}(),te&&f.a.createPortal(Se,(null===(xe=document.getElementById("popup-root"))&&((xe=document.createElement("div")).setAttribute("id","popup-root"),document.body.appendChild(xe)),xe)))})),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return v(t,e),t.prototype.render=function(){return f.a.createPortal(this.props.children,this.props.domNode)},t}(l.a.Component)),ze="workspaces-react-wrapper-template",He=C(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return v(t,e),t.prototype.componentDidMount=function(){var e=document.getElementById(ze);if(!e){var t=document.createElement("template");t.id=ze;var n=document.createElement("div");n.id="outter-layout-container",n.style.overflow="hidden",n.style.width="100%",n.style.height="100%",t.content.appendChild(n),document.body.appendChild(t),e=t}if(this.containerRef){this.containerRef.appendChild(e.content);var r={createLogo:this.props.onCreateLogoRequested,createAddWorkspace:this.props.onCreateAddWorkspaceRequested,createSystemButtons:this.props.onCreateSystemButtonsRequested,createWorkspaceContents:this.props.onCreateWorkspaceContentsRequested,createSaveWorkspacePopup:this.props.onCreateSaveWorkspacePopupRequested,createAddApplicationPopup:this.props.onCreateAddApplicationPopupRequested,createAddWorkspacePopup:this.props.onCreateAddWorkspacePopupRequested,hideSystemPopups:this.props.onHideSystemPopupsRequested,externalPopupApplications:this.props.externalPopupApplications};Oe.init(this.props.glue,r)}},t.prototype.componentWillUnmount=function(){var e=document.getElementById(ze);this.containerRef&&(null==e||e.content.appendChild(this.containerRef.children[0]),Oe.unmount())},t.prototype.render=function(){var e=this;return l.a.createElement("div",{ref:function(t){return e.containerRef=t},style:{overflow:"hidden",width:"100%",height:"100%"}})},t}(l.a.Component)),qe=function(e){function t(t){var n=e.call(this,t)||this;return n.onCreateLogoRequested=function(e){e!==n.state.logo&&n.setState((function(t){return g(g({},t),{logo:e})}))},n.onCreateAddWorkspaceRequested=function(e){e!==n.state.addWorkspace&&n.setState((function(t){return g(g({},t),{addWorkspace:e})}))},n.onCreateSystemButtonsRequested=function(e){e!==n.state.systemButtons&&n.setState((function(t){return g(g({},t),{systemButtons:e})}))},n.onCreateWorkspaceContentsRequested=function(e){n.state.workspaceContents.some((function(t){return t.domNode===e.domNode}))||n.setState((function(t){return g(g({},t),{workspaceContents:k(t.workspaceContents,[e])})}))},n.onCreateSaveWorkspaceRequested=function(e){e!==n.state.saveWorkspacePopup&&n.setState((function(t){return g(g({},t),{saveWorkspacePopup:e})}),e.callback)},n.onCreateAddApplicationRequested=function(e){e!==n.state.addApplicationPopup&&n.setState((function(t){return g(g({},t),{addApplicationPopup:e})}),e.callback)},n.onCreateAddWorkspacePopupRequested=function(e){e!==n.state.addWorkspacePopup&&n.setState((function(t){return g(g({},t),{addWorkspacePopup:e})}),e.callback)},n.onHideSystemPopups=function(e){n.setState((function(e){return g(g({},e),{addApplicationPopup:void 0,saveWorkspacePopup:void 0,addWorkspacePopup:void 0})}),e)},n.renderLogoComponent=function(){var e,t,r=null===(t=null===(e=n.props.components)||void 0===e?void 0:e.header)||void 0===t?void 0:t.LogoComponent;if(r&&n.state.logo&&n.state.logo.domNode){var i=n.state.logo,o=i.domNode,a=(i.callback,y(i,["domNode","callback"]));return l.a.createElement(Be,{domNode:o},l.a.createElement(r,g({},a)))}},n.renderAddWorkspaceComponent=function(){var e,t,r=null===(t=null===(e=n.props.components)||void 0===e?void 0:e.header)||void 0===t?void 0:t.AddWorkspaceComponent;if(r&&n.state.addWorkspace&&n.state.addWorkspace.domNode){var i=n.state.addWorkspace,o=i.domNode,a=(i.callback,y(i,["domNode","callback"]));return l.a.createElement(Be,{domNode:o},l.a.createElement(r,g({},a)))}},n.renderSystemButtonsComponent=function(){var e,t,r=null===(t=null===(e=n.props.components)||void 0===e?void 0:e.header)||void 0===t?void 0:t.SystemButtonsComponent;if(r&&n.state.systemButtons&&n.state.systemButtons.domNode){var i=n.state.systemButtons,o=i.domNode,a=(i.callback,y(i,["domNode","callback"]));return l.a.createElement(Be,{domNode:o},l.a.createElement(r,g({},a)))}},n.renderWorskpaceContents=function(){var e,t=null===(e=n.props.components)||void 0===e?void 0:e.WorkspaceContents;return n.state.workspaceContents.map((function(e){if(t&&e.domNode){var n=e.domNode,r=(e.callback,y(e,["domNode","callback"]));return l.a.createElement(Be,{key:r.workspaceId,domNode:n},l.a.createElement(t,g({},r)))}}))},n.renderSaveWorkspacePopupComponent=function(){var e,t,r=(null===(t=null===(e=n.props.components)||void 0===e?void 0:e.popups)||void 0===t?void 0:t.SaveWorkspaceComponent)||O;if(r&&n.state.saveWorkspacePopup&&n.state.saveWorkspacePopup.domNode){var i=n.state.saveWorkspacePopup,o=i.domNode,a=y(i,["domNode"]);return l.a.createElement(Be,{domNode:o},l.a.createElement(r,g({glue:n.props.glue},a)))}},n.renderAddApplicationPopupComponent=function(){var e,t,r=(null===(t=null===(e=n.props.components)||void 0===e?void 0:e.popups)||void 0===t?void 0:t.AddApplicationComponent)||S;if(r&&n.state.addApplicationPopup&&n.state.addApplicationPopup.domNode){var i=n.state.addApplicationPopup,o=i.domNode,a=y(i,["domNode"]);return l.a.createElement(Be,{domNode:o},l.a.createElement(r,g({glue:n.props.glue},a)))}},n.renderAddWorkspacePopupComponent=function(){var e,t,r=(null===(t=null===(e=n.props.components)||void 0===e?void 0:e.popups)||void 0===t?void 0:t.AddWorkspaceComponent)||A;if(r&&n.state.addWorkspacePopup&&n.state.addWorkspacePopup.domNode){var i=n.state.addWorkspacePopup,o=i.domNode,a=(i.callback,y(i,["domNode","callback"]));return l.a.createElement(Be,{domNode:o},l.a.createElement(r,g({glue:n.props.glue},a)))}},n.state={logo:void 0,addWorkspace:void 0,systemButtons:void 0,workspaceContents:[],saveWorkspacePopup:void 0,addApplicationPopup:void 0,addWorkspacePopup:void 0},n}return v(t,e),t.prototype.render=function(){var e,t,n,r,i,o,a=this.props,s=a.components,c=a.glue,u=y(a,["components","glue"]),d=(null===(e=null==s?void 0:s.popups)||void 0===e?void 0:e.AddApplicationComponent)||S,p=(null===(t=null==s?void 0:s.popups)||void 0===t?void 0:t.SaveWorkspaceComponent)||O,h=(null===(n=null==s?void 0:s.popups)||void 0===n?void 0:n.AddWorkspaceComponent)||A,f=d&&"string"!=typeof d?this.onCreateAddApplicationRequested:void 0,m=h&&"string"!=typeof h?this.onCreateAddWorkspacePopupRequested:void 0,v=p&&"string"!=typeof p?this.onCreateSaveWorkspaceRequested:void 0,w={addApplication:"string"==typeof d?d:void 0,saveWorkspace:"string"==typeof p?p:void 0,addWorkspace:"string"==typeof h?h:void 0};return l.a.createElement("div",g({},u,{style:{overflow:"hidden",width:"100%",height:"100%"}}),this.renderLogoComponent(),this.renderAddWorkspaceComponent(),this.renderSystemButtonsComponent(),this.renderWorskpaceContents(),this.renderSaveWorkspacePopupComponent(),this.renderAddApplicationPopupComponent(),this.renderAddWorkspacePopupComponent(),l.a.createElement(He,{onCreateSystemButtonsRequested:(null===(r=null==s?void 0:s.header)||void 0===r?void 0:r.SystemButtonsComponent)?this.onCreateSystemButtonsRequested:void 0,onCreateAddWorkspaceRequested:(null===(i=null==s?void 0:s.header)||void 0===i?void 0:i.AddWorkspaceComponent)?this.onCreateAddWorkspaceRequested:void 0,onCreateLogoRequested:(null===(o=null==s?void 0:s.header)||void 0===o?void 0:o.LogoComponent)?this.onCreateLogoRequested:void 0,onCreateWorkspaceContentsRequested:(null==s?void 0:s.WorkspaceContents)?this.onCreateWorkspaceContentsRequested:void 0,onCreateSaveWorkspacePopupRequested:v,onCreateAddApplicationPopupRequested:f,onCreateAddWorkspacePopupRequested:m,onHideSystemPopupsRequested:this.onHideSystemPopups,externalPopupApplications:w,glue:c}))},t}(l.a.Component);t.a=qe}).call(this,n(9))},22:function(e,t,n){"use strict";(function(e,r,i){var o=n(13),a=n(5),s=n(4),c=n(0),u=n.n(c),d=n(2),l=n(3);function p(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(t){o(t)}}function s(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))}var h={logger:"info",gateway:{webPlatform:{}},libraries:[]},f=function(e){var t,n=Object.assign({},h,e);return n.systemLogger&&(n.logger=null!==(t=n.systemLogger.level)&&void 0!==t?t:"info"),n},m=function(){var e=window.glue42core;if(e){if(e.webStarted)throw new Error("The Glue42 Core Web has already been started for this application.");e.webStarted=!0}else window.glue42core={webStarted:!0}},v=function(e){var t,n,r={windows:!0,layouts:"full",appManager:"full",channels:!0,libraries:e.libraries,logger:null!==(n=null===(t=null===e||void 0===e?void 0:e.systemLogger)||void 0===t?void 0:t.level)&&void 0!==n?n:"warn"};return window.Glue(r)},g=function(e){return{ok:!0,result:e}},y=function(e){return{ok:!1,error:e}},w=function(e){return!0===e.ok?Promise.resolve(e.result):Promise.reject(e.error)},b=function(e,t){return!0===t.ok?t.result:e},k=function(e){if(!0===e.ok)return e.result;throw e.error},x=function(e,t){return!0===t.ok?g(e(t.result)):t},_=function(e,t,n){return!1===t.ok?t:!1===n.ok?n:g(e(t.result,n.result))},I=function(e,t){return!0===t.ok?t:y(e(t.error))},C=function(e,t){return!0===t.ok?e(t.result):t},S=(Object.freeze({ok:g,isOk:function(e){return!0===e.ok},err:y,isErr:function(e){return!1===e.ok},asPromise:w,withDefault:b,withException:k,successes:function(e){return e.reduce((function(e,t){return!0===t.ok?e.concat(t.result):e}),[])},map:x,map2:_,mapError:I,andThen:C}),function(){return(S=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)});function E(e,t){if(e===t)return!0;if(null===e&&null===t)return!0;if(typeof e!==typeof t)return!1;if("object"===typeof e){if(Array.isArray(e)){if(!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!E(e[n],t[n]))return!1;return!0}var r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(n=0;n<r.length;n++){if(!t.hasOwnProperty(r[n]))return!1;if(!E(e[r[n]],t[r[n]]))return!1}return!0}}var W=function(e){return Array.isArray(e)},T=function(e){return"object"===typeof e&&null!==e&&!W(e)},A=function(e,t){return"expected "+e+", got "+function(e){switch(typeof e){case"string":return"a string";case"number":return"a number";case"boolean":return"a boolean";case"undefined":return"undefined";case"object":return e instanceof Array?"an array":null===e?"null":"an object";default:return JSON.stringify(e)}}(t)},P=function(e){return e.map((function(e){return"string"===typeof e?"."+e:"["+e+"]"})).join("")},M=function(e,t){var n=t.at,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(t,["at"]);return S({at:e+(n||"")},r)},O=function(){function e(t){var n=this;this.decode=t,this.run=function(e){return I((function(t){return{kind:"DecoderError",input:e,at:"input"+(t.at||""),message:t.message||""}}),n.decode(e))},this.runPromise=function(e){return w(n.run(e))},this.runWithException=function(e){return k(n.run(e))},this.map=function(t){return new e((function(e){return x(t,n.decode(e))}))},this.andThen=function(t){return new e((function(e){return C((function(n){return t(n).decode(e)}),n.decode(e))}))},this.where=function(t,r){return n.andThen((function(n){return t(n)?e.succeed(n):e.fail(r)}))}}return e.string=function(){return new e((function(e){return"string"===typeof e?g(e):y({message:A("a string",e)})}))},e.number=function(){return new e((function(e){return"number"===typeof e?g(e):y({message:A("a number",e)})}))},e.boolean=function(){return new e((function(e){return"boolean"===typeof e?g(e):y({message:A("a boolean",e)})}))},e.constant=function(t){return new e((function(e){return E(e,t)?g(t):y({message:"expected "+JSON.stringify(t)+", got "+JSON.stringify(e)})}))},e.object=function(t){return new e((function(e){if(T(e)&&t){var n={};for(var r in t)if(t.hasOwnProperty(r)){var i=t[r].decode(e[r]);if(!0!==i.ok)return void 0===e[r]?y({message:"the key '"+r+"' is required but was not present"}):y(M("."+r,i.error));void 0!==i.result&&(n[r]=i.result)}return g(n)}return T(e)?g(e):y({message:A("an object",e)})}))},e.array=function(t){return new e((function(e){if(W(e)&&t){return e.reduce((function(e,n,r){return _((function(e,t){return e.concat([t])}),e,function(e,n){return I((function(e){return M("["+n+"]",e)}),t.decode(e))}(n,r))}),g([]))}return W(e)?g(e):y({message:A("an array",e)})}))},e.tuple=function(t){return new e((function(e){if(W(e)){if(e.length!==t.length)return y({message:"expected a tuple of length "+t.length+", got one of length "+e.length});for(var n=[],r=0;r<t.length;r++){var i=t[r].decode(e[r]);if(!i.ok)return y(M("["+r+"]",i.error));n[r]=i.result}return g(n)}return y({message:A("a tuple of length "+t.length,e)})}))},e.union=function(t,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];return e.oneOf.apply(e,[t,n].concat(r))},e.intersection=function(t,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];return new e((function(e){return[t,n].concat(r).reduce((function(t,n){return _(Object.assign,t,n.decode(e))}),g({}))}))},e.anyJson=function(){return new e((function(e){return g(e)}))},e.unknownJson=function(){return new e((function(e){return g(e)}))},e.dict=function(t){return new e((function(e){if(T(e)){var n={};for(var r in e)if(e.hasOwnProperty(r)){var i=t.decode(e[r]);if(!0!==i.ok)return y(M("."+r,i.error));n[r]=i.result}return g(n)}return y({message:A("an object",e)})}))},e.optional=function(t){return new e((function(e){return void 0===e||null===e?g(void 0):t.decode(e)}))},e.oneOf=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new e((function(e){for(var n=[],r=0;r<t.length;r++){var i=t[r].decode(e);if(!0===i.ok)return i;n[r]=i.error}var o=n.map((function(e){return"at error"+(e.at||"")+": "+e.message})).join('", "');return y({message:'expected a value matching one of the decoders, got the errors ["'+o+'"]'})}))},e.withDefault=function(t,n){return new e((function(e){return g(b(t,n.decode(e)))}))},e.valueAt=function(t,n){return new e((function(e){for(var r=e,i=0;i<t.length;i++){if(void 0===r)return y({at:P(t.slice(0,i+1)),message:"path does not exist"});if("string"===typeof t[i]&&!T(r))return y({at:P(t.slice(0,i+1)),message:A("an object",r)});if("number"===typeof t[i]&&!W(r))return y({at:P(t.slice(0,i+1)),message:A("an array",r)});r=r[t[i]]}return I((function(e){return void 0===r?{at:P(t),message:"path does not exist"}:M(P(t),e)}),n.decode(r))}))},e.succeed=function(t){return new e((function(e){return g(t)}))},e.fail=function(t){return new e((function(e){return y({message:t})}))},e.lazy=function(t){return new e((function(e){return t().decode(e)}))},e}(),j=O.string,D=O.number,L=O.boolean,N=O.anyJson,R=O.constant,F=O.object,B=O.array,z=O.optional,H=O.oneOf,q=O.lazy,$=j().where((function(e){return e.length>0}),"Expected a non-empty string"),U=D().where((function(e){return e>=0}),"Expected a non-negative number"),G=H(R("windows"),R("appManager"),R("layouts"),R("intents")),V=H(R("openWindow"),R("windowHello"),R("windowAdded"),R("windowRemoved"),R("getBounds"),R("getUrl"),R("moveResize"),R("focus"),R("close"),R("getTitle"),R("setTitle")),J=H(R("appHello"),R("applicationAdded"),R("applicationRemoved"),R("applicationChanged"),R("instanceStarted"),R("instanceStopped"),R("applicationStart"),R("instanceStop"),R("clear")),K=H(R("layoutAdded"),R("layoutChanged"),R("layoutRemoved"),R("get"),R("getAll"),R("export"),R("import"),R("remove")),X=H(R("top"),R("left"),R("right"),R("bottom")),Y=z(F({top:z(D()),left:z(D()),width:z(U),height:z(U),context:z(N()),relativeTo:z($),relativeDirection:z(X),windowId:z($)})),Z=F({name:$,url:$,options:Y}),Q=F({windowId:z($)}),ee=F({windowId:$,name:$}),te=F({windowId:$}),ne=F({windows:B(ee),isWorkspaceFrame:L()}),re=F({windowId:$,title:j()}),ie=F({windowId:$,top:z(D()),left:z(D()),width:z(U),height:z(U),relative:z(L())}),oe=F({windowId:$,bounds:F({top:D(),left:D(),width:U,height:U})}),ae=F({windowId:$,url:$}),se=N(),ce=F({top:z(D()),left:z(D()),width:z(U),height:z(U)}),ue=F({id:$,applicationName:$}),de=F({url:$,top:z(D()),left:z(D()),width:z(U),height:z(U)}),le=F({name:$,displayName:z(j()),contexts:z(B(j())),customConfig:z(F())}),pe=F({name:$,title:z($),version:z($),appId:$,manifest:$,manifestType:$,tooltip:z($),description:z($),contactEmail:z($),supportEmail:z($),publisher:z($),images:z(B(F({url:z($)}))),icons:z(B(F({icon:z($)}))),customConfig:N(),intents:z(B(le))}),he=F({name:$,type:$.where((function(e){return"window"===e}),"Expected a value of window"),title:z($),version:z($),customProperties:z(N()),icon:z($),caption:z($),details:de,intents:z(B(le))}),fe=H(he,pe),me=(F({definitions:B(fe),mode:H(R("replace"),R("merge"))}),F({name:$})),ve=F({definitions:B(he)}),ge=F({name:$,type:$.where((function(e){return"window"===e}),"Expected a value of window"),instances:B(ue),userProperties:z(N()),title:z($),version:z($),icon:z($),caption:z($)}),ye=F({name:$,type:$.where((function(e){return"window"===e}),"Expected a value of window"),userProperties:N(),title:z($),version:z($),icon:z($),caption:z($)}),we=F({apps:B(ge)}),be=F({id:$}),ke=F({name:$,waitForAGMReady:L(),id:z($),context:z(N()),top:z(D()),left:z(D()),width:z(U),height:z(U),relativeTo:z($),relativeDirection:z(H(R("top"),R("left"),R("right"),R("bottom")))}),xe=H(R("Global"),R("Activity"),R("ApplicationDefault"),R("Swimlane"),R("Workspace")),_e=H(R("application"),R("activity")),Ie=F({type:$.where((function(e){return"window"===e}),"Expected a value of window"),componentType:z(_e),state:F({name:N(),context:N(),url:$,bounds:N(),id:$,parentId:z($),main:L()})}),Ce=F({type:R("window"),config:F({appName:$,url:z($),title:z(j())})}),Se=F({type:R("group"),config:N(),children:B(H(Ce))}),Ee=F({type:R("column"),config:N(),children:B(H(Se,Ce,q((function(){return Ee})),q((function(){return We}))))}),We=F({type:R("row"),config:N(),children:B(H(Ee,Se,Ce,q((function(){return We}))))}),Te=F({type:R("Workspace"),state:F({config:N(),context:N(),children:B(H(We,Ee,Se,Ce))})}),Ae=F({name:$,type:xe,components:B(H(Ie,Te)),version:z($),context:z(N()),metadata:z(N())}),Pe=F({name:$,context:z(N()),metadata:z(N())}),Me=F({name:$,context:z(N()),closeRunningInstance:z(L())}),Oe=F({name:$,type:xe,context:z(N()),metadata:z(N())}),je=F({name:$,type:xe}),De=F({type:xe}),Le=F({layouts:B(Ae)}),Ne=H(R("replace"),R("merge")),Re=F({layouts:B(Ae),mode:Ne}),Fe=F({summaries:B(Oe)}),Be=(F({layout:Ae}),F({layout:z(Ae)})),ze=H(R("findIntent"),R("getIntents"),R("raiseIntent")),He=F({applicationName:$,applicationTitle:j(),applicationDescription:z(j()),applicationIcon:z(j()),type:H(R("app"),R("instance")),displayName:z(j()),contextTypes:z(B($)),instanceId:z(j()),instanceTitle:z(j())}),qe=F({name:$,handlers:B(He)}),$e=H(R("startNew"),R("reuse"),F({app:z($),instance:z($)})),Ue=F({type:z($),data:z(F())}),Ge=F({intents:B(qe)}),Ve=F({name:z($),contextType:z($)}),Je=H($,Ve),Ke=F({filter:z(Ve)}),Xe=F({intent:$,target:z($e),context:z(Ue),options:z(Y)}),Ye=H($,Xe),Ze=F({request:Xe,handler:He,result:N()}),Qe=F({intent:$,contextTypes:z(B($)),displayName:z(j()),icon:z(j()),description:z(j())}),et=H($,Qe),tt=function(e){return $.where((function(t){return e.includes(t)}),"Expected a valid channel name")},nt={openWindow:{name:"openWindow",dataDecoder:Z,resultDecoder:ee},windowHello:{name:"windowHello",dataDecoder:Q,resultDecoder:ne},windowAdded:{name:"windowAdded",dataDecoder:ee},windowRemoved:{name:"windowRemoved",dataDecoder:te},getBounds:{name:"getBounds",dataDecoder:te,resultDecoder:oe},getUrl:{name:"getUrl",dataDecoder:te,resultDecoder:ae},moveResize:{name:"moveResize",dataDecoder:ie},focus:{name:"focus",dataDecoder:te},close:{name:"close",dataDecoder:te},getTitle:{name:"getTitle",dataDecoder:te,resultDecoder:re},setTitle:{name:"setTitle",dataDecoder:re}};function rt(e){if(e&&e.errorHandling&&"function"!==typeof e.errorHandling&&"log"!==e.errorHandling&&"silent"!==e.errorHandling&&"throw"!==e.errorHandling)throw new Error('Invalid options passed to createRegistry. Prop errorHandling should be ["log" | "silent" | "throw" | (err) => void], but '+typeof e.errorHandling+" was passed");var t=e&&"function"===typeof e.errorHandling&&e.errorHandling,n={};function r(n,r){var i=n instanceof Error?n:new Error(n);if(t)t(i);else{var o='[ERROR] callback-registry: User callback for key "'+r+'" failed: '+i.stack;if(e)switch(e.errorHandling){case"log":return console.error(o);case"silent":return;case"throw":throw new Error(o)}console.error(o)}}return{add:function(e,t,i){var o=n[e];return o||(o=[],n[e]=o),o.push(t),i&&setTimeout((function(){i.forEach((function(i){var o;if(null===(o=n[e])||void 0===o?void 0:o.includes(t))try{Array.isArray(i)?t.apply(void 0,i):t.apply(void 0,[i])}catch(y){r(y,e)}}))}),0),function(){var r=n[e];r&&(r=r.reduce((function(e,n,r){return n===t&&e.length===r||e.push(n),e}),[]),n[e]=r)}},execute:function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];var o=n[e];if(!o||0===o.length)return[];var a=[];return o.forEach((function(n){try{var i=n.apply(void 0,t);a.push(i)}catch(y){a.push(void 0),r(y,e)}})),a},clear:function(){n={}},clearKey:function(e){n[e]&&delete n[e]}}}rt.default=rt;var it=rt,ot=function(){function e(t,n,r){Object(d.a)(this,e),this._id=t,this._name=n,this._bridge=r,this.registry=it(),this.myCtxKey="___window___".concat(this.id)}return Object(l.a)(e,[{key:"clean",value:function(){this.ctxUnsubscribe&&this.ctxUnsubscribe()}},{key:"toApi",value:function(){return p(this,void 0,void 0,u.a.mark((function e(){var t,n=this;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._bridge.contextLib.subscribe(this.myCtxKey,(function(e){return n.registry.execute("context-updated",e)}));case 2:return this.ctxUnsubscribe=e.sent,t={id:this.id,name:this.name,getURL:this.getURL.bind(this),moveResize:this.moveResize.bind(this),resizeTo:this.resizeTo.bind(this),moveTo:this.moveTo.bind(this),focus:this.focus.bind(this),close:this.close.bind(this),getTitle:this.getTitle.bind(this),setTitle:this.setTitle.bind(this),getBounds:this.getBounds.bind(this),getContext:this.getContext.bind(this),updateContext:this.updateContext.bind(this),setContext:this.setContext.bind(this),onContextUpdated:this.onContextUpdated.bind(this)},this.me=Object.freeze(t),e.abrupt("return",this.me);case 6:case"end":return e.stop()}}),e,this)})))}},{key:"getURL",value:function(){return p(this,void 0,void 0,u.a.mark((function e(){var t;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._bridge.send("windows",nt.getUrl,{windowId:this.id});case 2:return t=e.sent,e.abrupt("return",t.url);case 4:case"end":return e.stop()}}),e,this)})))}},{key:"moveResize",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n,r;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=ce.runWithException(e),r=Object.assign({},n,{windowId:this.id,relative:!1}),t.next=4,this._bridge.send("windows",nt.moveResize,r);case 4:return t.abrupt("return",this.me);case 5:case"end":return t.stop()}}),t,this)})))}},{key:"resizeTo",value:function(e,t){return p(this,void 0,void 0,u.a.mark((function n(){var r;return u.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if("undefined"!==typeof e||"undefined"!==typeof t){n.next=2;break}return n.abrupt("return",this.me);case 2:return"undefined"!==typeof e&&U.runWithException(e),"undefined"!==typeof t&&U.runWithException(t),r=Object.assign({},{width:e,height:t},{windowId:this.id,relative:!0}),n.next=7,this._bridge.send("windows",nt.moveResize,r);case 7:return n.abrupt("return",this.me);case 8:case"end":return n.stop()}}),n,this)})))}},{key:"moveTo",value:function(e,t){return p(this,void 0,void 0,u.a.mark((function n(){var r;return u.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if("undefined"!==typeof e||"undefined"!==typeof t){n.next=2;break}return n.abrupt("return",this.me);case 2:return"undefined"!==typeof e&&D().runWithException(e),"undefined"!==typeof t&&D().runWithException(t),r=Object.assign({},{top:e,left:t},{windowId:this.id,relative:!0}),n.next=7,this._bridge.send("windows",nt.moveResize,r);case 7:return n.abrupt("return",this.me);case 8:case"end":return n.stop()}}),n,this)})))}},{key:"focus",value:function(){return p(this,void 0,void 0,u.a.mark((function e(){return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._bridge.send("windows",nt.focus,{windowId:this.id});case 2:return e.abrupt("return",this.me);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"close",value:function(){return p(this,void 0,void 0,u.a.mark((function e(){return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._bridge.send("windows",nt.close,{windowId:this.id});case 2:return e.abrupt("return",this.me);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"getTitle",value:function(){return p(this,void 0,void 0,u.a.mark((function e(){var t;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._bridge.send("windows",nt.getTitle,{windowId:this.id});case 2:return t=e.sent,e.abrupt("return",t.title);case 4:case"end":return e.stop()}}),e,this)})))}},{key:"setTitle",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=$.runWithException(e),t.next=3,this._bridge.send("windows",nt.setTitle,{windowId:this.id,title:n});case 3:return t.abrupt("return",this.me);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"getBounds",value:function(){return p(this,void 0,void 0,u.a.mark((function e(){var t;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._bridge.send("windows",nt.getBounds,{windowId:this.id});case 2:return t=e.sent,e.abrupt("return",t.bounds);case 4:case"end":return e.stop()}}),e,this)})))}},{key:"getContext",value:function(){return p(this,void 0,void 0,u.a.mark((function e(){var t;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._bridge.contextLib.get(this.myCtxKey);case 2:return t=e.sent,e.abrupt("return",t);case 4:case"end":return e.stop()}}),e,this)})))}},{key:"updateContext",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=se.runWithException(e),t.next=3,this._bridge.contextLib.update(this.myCtxKey,n);case 3:return t.abrupt("return",this.me);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"setContext",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=se.runWithException(e),t.next=3,this._bridge.contextLib.set(this.myCtxKey,n);case 3:return t.abrupt("return",this.me);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"onContextUpdated",value:function(e){var t=this;if("function"!==typeof e)throw new Error("Cannot subscribe to context changes, because the provided callback is not a function!");return this.registry.add("context-updated",(function(n){e(n,t.me)}))}},{key:"id",get:function(){return this._id.slice()}},{key:"name",get:function(){return this._name.slice()}}]),e}(),at=function(){function e(){Object(d.a)(this,e),this.registry=it(),this.allWindowProjections=[]}return Object(l.a)(e,[{key:"start",value:function(e,t){return p(this,void 0,void 0,u.a.mark((function n(){var r;return u.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.logger=e.logger.subLogger("windows.controller.web"),this.logger.trace("starting the web windows controller"),this.publicWindowId=e.connection.transport.publicWindowId,this.actualWindowId=e.interop.instance.windowId,this.addWindowOperationExecutors(),this.ioc=t,this.bridge=t.bridge,this.logger.trace("set the public window id: ".concat(this.publicWindowId," and actual window id: ").concat(this.actualWindowId,", set the bridge operations and ioc, registering with the platform now")),this.platformRegistration=this.registerWithPlatform(),n.next=11,this.platformRegistration;case 11:this.logger.trace("registration with the platform successful, attaching the windows property to glue and returning"),r=this.toApi(),e.windows=r;case 14:case"end":return n.stop()}}),n,this)})))}},{key:"handleBridgeMessage",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n,r,i;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.platformRegistration;case 2:if(n=V.runWithException(e.operation),(r=nt[n]).execute){t.next=6;break}return t.abrupt("return");case 6:return i=e.data,r.dataDecoder&&(i=r.dataDecoder.runWithException(e.data)),t.next=10,r.execute(i);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})))}},{key:"open",value:function(e,t,n){return p(this,void 0,void 0,u.a.mark((function r(){var i,o,a;return u.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return $.runWithException(e),$.runWithException(t),i=Y.runWithException(n),r.next=5,this.bridge.send("windows",nt.openWindow,{name:e,url:t,options:i});case 5:return o=r.sent,r.next=8,this.ioc.buildWebWindow(o.windowId,o.name);case 8:return a=r.sent,r.abrupt("return",a.api);case 10:case"end":return r.stop()}}),r,this)})))}},{key:"list",value:function(){return this.allWindowProjections.map((function(e){return e.api}))}},{key:"findById",value:function(e){var t;return $.runWithException(e),null===(t=this.allWindowProjections.find((function(t){return t.id===e})))||void 0===t?void 0:t.api}},{key:"toApi",value:function(){return{open:this.open.bind(this),my:this.my.bind(this),list:this.list.bind(this),findById:this.findById.bind(this),onWindowAdded:this.onWindowAdded.bind(this),onWindowRemoved:this.onWindowRemoved.bind(this)}}},{key:"addWindowOperationExecutors",value:function(){nt.windowAdded.execute=this.handleWindowAdded.bind(this),nt.windowRemoved.execute=this.handleWindowRemoved.bind(this),nt.getBounds.execute=this.handleGetBounds.bind(this),nt.getTitle.execute=this.handleGetTitle.bind(this),nt.getUrl.execute=this.handleGetUrl.bind(this),nt.moveResize.execute=this.handleMoveResize.bind(this),nt.setTitle.execute=this.handleSetTitle.bind(this)}},{key:"my",value:function(){return Object.assign({},this.me)}},{key:"onWindowAdded",value:function(e){if("function"!==typeof e)throw new Error("Cannot subscribe to window added, because the provided callback is not a function!");return this.registry.add("window-added",e)}},{key:"onWindowRemoved",value:function(e){if("function"!==typeof e)throw new Error("Cannot subscribe to window removed, because the provided callback is not a function!");return this.registry.add("window-removed",e)}},{key:"sayHello",value:function(){return p(this,void 0,void 0,u.a.mark((function e(){var t;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.bridge.send("windows",nt.windowHello,{windowId:this.actualWindowId});case 2:return t=e.sent,e.abrupt("return",t);case 4:case"end":return e.stop()}}),e,this)})))}},{key:"registerWithPlatform",value:function(){return p(this,void 0,void 0,u.a.mark((function e(){var t,n,r,i,o,a,c=this;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.sayHello();case 2:if(n=e.sent,r=n.windows,i=n.isWorkspaceFrame,this.logger.trace("the platform responded to the hello message"),i){e.next=14;break}if(this.logger.trace("i am not treated as a workspace frame, setting my window"),o=r.find((function(e){return e.windowId===c.publicWindowId}))){e.next=11;break}throw new Error("Cannot initialize the window library, because I received no information about me from the platform");case 11:return e.next=13,this.ioc.buildWebWindow(this.publicWindowId,o.name);case 13:this.me=e.sent.api;case 14:return e.next=16,Promise.all(r.map((function(e){return c.ioc.buildWebWindow(e.windowId,e.name)})));case 16:a=e.sent,this.logger.trace("all windows projections are completed, building the list collection"),(t=this.allWindowProjections).push.apply(t,Object(s.a)(a));case 19:case"end":return e.stop()}}),e,this)})))}},{key:"handleWindowAdded",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.allWindowProjections.some((function(t){return t.id===e.windowId}))){t.next=2;break}return t.abrupt("return");case 2:return t.next=4,this.ioc.buildWebWindow(e.windowId,e.name);case 4:n=t.sent,this.allWindowProjections.push(n),this.registry.execute("window-added",n.api);case 7:case"end":return t.stop()}}),t,this)})))}},{key:"handleWindowRemoved",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=this.allWindowProjections.find((function(t){return t.id===e.windowId}))){t.next=3;break}return t.abrupt("return");case 3:this.allWindowProjections=this.allWindowProjections.filter((function(t){return t.id!==e.windowId})),n.model.clean(),this.registry.execute("window-removed",n.api);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"handleGetBounds",value:function(){return p(this,void 0,void 0,u.a.mark((function e(){return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",{windowId:this.me.id,bounds:{top:window.screenTop,left:window.screenLeft,width:window.innerWidth,height:window.innerHeight}});case 1:case"end":return e.stop()}}),e,this)})))}},{key:"handleGetTitle",value:function(){return p(this,void 0,void 0,u.a.mark((function e(){return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",{windowId:this.me.id,title:document.title});case 1:case"end":return e.stop()}}),e,this)})))}},{key:"handleGetUrl",value:function(){return p(this,void 0,void 0,u.a.mark((function e(){return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",{windowId:this.me.id,url:window.location.href});case 1:case"end":return e.stop()}}),e,this)})))}},{key:"handleMoveResize",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n,r,i,o,a,s;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n="number"===typeof e.top?e.top:e.relative?0:window.screenTop,r="number"===typeof e.left?e.left:e.relative?0:window.screenLeft,i="number"===typeof e.height?e.height:e.relative?0:window.innerHeight,o="number"===typeof e.width?e.width:e.relative?0:window.innerWidth,a=e.relative?window.moveBy:window.moveTo,s=e.relative?window.resizeBy:window.resizeTo,a(r,n),s(o,i);case 8:case"end":return t.stop()}}),t)})))}},{key:"handleSetTitle",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:document.title=e.title;case 1:case"end":return t.stop()}}),t)})))}}]),e}(),st=function(e,t,n){return new Promise((function(r,i){var o=!0,a=setTimeout((function(){if(o){o=!1;var e=n||"Promise timeout hit: ".concat(t);i(e)}}),t);e().then((function(e){o&&(o=!1,clearTimeout(a),r(e))})).catch((function(e){o&&(o=!1,clearTimeout(a),i(e))}))}))},ct="T42.Web.Platform.Control",ut="T42.Web.Platform.Stream",dt=function(){function e(t){Object(d.a)(this,e),this.coreGlue=t,this.platformMethodTimeoutMs=1e4}return Object(l.a)(e,[{key:"start",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n,r,i,o=this;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.controllers=e,t.next=3,Promise.all([this.checkWaitMethod(ct),this.checkWaitMethod(ut)]);case 3:return t.next=5,Promise.all([this.coreGlue.interop.subscribe(ut),this.coreGlue.interop.registerAsync("T42.Web.Client.Control",(function(e,t,n,r){return o.passMessageController(e,n,r)}))]);case 5:n=t.sent,r=Object(a.a)(n,1),i=r[0],this.sub=i,this.sub.onData((function(e){return o.passMessageController(e.data)}));case 10:case"end":return t.stop()}}),t,this)})))}},{key:"getInteropInstance",value:function(e){var t=this.coreGlue.interop.servers().find((function(t){return t.windowId&&t.windowId===e}));return{application:null===t||void 0===t?void 0:t.application,applicationName:null===t||void 0===t?void 0:t.applicationName,peerId:null===t||void 0===t?void 0:t.peerId,instance:null===t||void 0===t?void 0:t.instance,windowId:null===t||void 0===t?void 0:t.windowId}}},{key:"send",value:function(e,t,n){return p(this,void 0,void 0,u.a.mark((function r(){var i;return u.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!t.dataDecoder){r.next=8;break}r.prev=1,t.dataDecoder.runWithException(n),r.next=8;break;case 5:throw r.prev=5,r.t0=r.catch(1),new Error("Unexpected internal outgoing validation error: ".concat(r.t0.message,", for operation: ").concat(t.name," and input: ").concat(JSON.stringify(r.t0.input)));case 8:return r.prev=8,r.next=11,this.transmitMessage(e,t,n);case 11:i=r.sent,t.resultDecoder&&(i=t.resultDecoder.runWithException(i)),r.next=20;break;case 15:if(r.prev=15,r.t1=r.catch(8),!r.t1.kind){r.next=19;break}throw new Error("Unexpected internal incoming validation error: ".concat(r.t1.message,", for operation: ").concat(t.name," and input: ").concat(JSON.stringify(r.t1.input)));case 19:throw new Error(r.t1.message);case 20:return r.abrupt("return",i);case 21:case"end":return r.stop()}}),r,this,[[1,5],[8,15]])})))}},{key:"checkWaitMethod",value:function(e){var t,n,r,i=this;return t=function(t){if(i.coreGlue.interop.methods().some((function(t){return t.name===e})))return t();var n=i.coreGlue.interop.methodAdded((function(r){r.name===e&&(n(),t())}))},n=this.platformMethodTimeoutMs,r="Cannot initiate Glue Web, because a system method's discovery timed out: ".concat(e),new Promise((function(e,i){var o=setTimeout((function(){var e=r||"Promise timeout hit: ".concat(n);i(e)}),n);new Promise(t).then((function(t){clearTimeout(o),e(t)})).catch((function(e){clearTimeout(o),i(e)}))}))}},{key:"passMessageController",value:function(e,t,n){var r=G.run(e.domain);if(r.ok){var i=r.result;this.controllers[i].handleBridgeMessage(e).then((function(e){t&&t(e)})).catch((function(e){n&&n(e),console.warn(e)}))}else n&&n("Cannot execute this client control, because of domain validation error: ".concat(JSON.stringify(r.error)))}},{key:"transmitMessage",value:function(e,t,n){return p(this,void 0,void 0,u.a.mark((function r(){var i,o,a,s;return u.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i={domain:e,data:n,operation:t.name},a="Internal Platform Communication Error. Attempted operation: ".concat(JSON.stringify(t.name)," with data: ").concat(JSON.stringify(n),". "),r.prev=2,r.next=5,this.coreGlue.interop.invoke(ct,i);case 5:if(o=r.sent){r.next=8;break}throw new Error("Received unsupported result from the platform - empty result");case 8:if(Array.isArray(o.all_return_values)&&0!==o.all_return_values.length){r.next=10;break}throw new Error("Received unsupported result from the platform - empty values collection");case 10:r.next=18;break;case 12:if(r.prev=12,r.t0=r.catch(2),!(r.t0&&r.t0.all_errors&&r.t0.all_errors.length)){r.next=17;break}throw s=r.t0.all_errors[0].message,new Error("".concat(a," -> Inner message: ").concat(s));case 17:throw new Error("".concat(a," -> Inner message: ").concat(r.t0.message));case 18:return r.abrupt("return",o.all_return_values[0].returned);case 19:case"end":return r.stop()}}),r,this,[[2,12]])})))}},{key:"contextLib",get:function(){return this.coreGlue.contexts}},{key:"interopInstance",get:function(){return this.coreGlue.interop.instance.instance}}]),e}(),lt={appHello:{name:"appHello",dataDecoder:Q,resultDecoder:we},applicationAdded:{name:"applicationAdded",dataDecoder:ye},applicationRemoved:{name:"applicationRemoved",dataDecoder:ye},applicationChanged:{name:"applicationChanged",dataDecoder:ye},instanceStarted:{name:"instanceStarted",dataDecoder:ue},instanceStopped:{name:"instanceStopped",dataDecoder:ue},applicationStart:{name:"applicationStart",dataDecoder:ke,resultDecoder:ue},instanceStop:{name:"instanceStop",dataDecoder:be},import:{name:"import"},remove:{name:"remove",dataDecoder:me},export:{name:"export",resultDecoder:ve},clear:{name:"clear"}},pt=function(){function e(){Object(d.a)(this,e),this.registry=it(),this.applications=[],this.instances=[]}return Object(l.a)(e,[{key:"start",value:function(e,t){return p(this,void 0,void 0,u.a.mark((function n(){var r;return u.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.logger=e.logger.subLogger("appManger.controller.web"),this.logger.trace("starting the web appManager controller"),this.publicWindowId=e.connection.transport.publicWindowId,this.actualWindowId=e.interop.instance.windowId,this.addOperationsExecutors(),this.ioc=t,this.bridge=t.bridge,this.platformRegistration=this.registerWithPlatform(),n.next=10,this.platformRegistration;case 10:this.logger.trace("registration with the platform successful, attaching the appManager property to glue and returning"),r=this.toApi(),e.appManager=r;case 13:case"end":return n.stop()}}),n,this)})))}},{key:"handleBridgeMessage",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n,r,i;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.platformRegistration;case 2:if(n=J.runWithException(e.operation),(r=lt[n]).execute){t.next=6;break}return t.abrupt("return");case 6:return i=e.data,r.dataDecoder&&(i=r.dataDecoder.runWithException(e.data)),t.next=10,r.execute(i);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})))}},{key:"onInstanceStarted",value:function(e){return this.registry.add("instance-started",e,this.instances)}},{key:"onInstanceStopped",value:function(e){return this.registry.add("instance-stopped",e)}},{key:"startApplication",value:function(e,t,n){var r,i;return p(this,void 0,void 0,u.a.mark((function o(){var a,s,c;return u.a.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return a={name:e,waitForAGMReady:null===(r=null===n||void 0===n?void 0:n.waitForAGMReady)||void 0===r||r,context:t,top:null===n||void 0===n?void 0:n.top,left:null===n||void 0===n?void 0:n.left,width:null===n||void 0===n?void 0:n.width,height:null===n||void 0===n?void 0:n.height,relativeTo:null===n||void 0===n?void 0:n.relativeTo,relativeDirection:null===n||void 0===n?void 0:n.relativeDirection,id:null===(i=n)||void 0===i?void 0:i.reuseId},o.next=3,this.bridge.send("appManager",lt.applicationStart,a);case 3:return s=o.sent,c=this.applications.find((function(e){return e.name===s.applicationName})),o.abrupt("return",this.ioc.buildInstance(s,c));case 6:case"end":return o.stop()}}),o,this)})))}},{key:"toApi",value:function(){var e={myInstance:this.me,inMemory:{import:this.import.bind(this),remove:this.remove.bind(this),export:this.export.bind(this),clear:this.clear.bind(this)},application:this.getApplication.bind(this),applications:this.getApplications.bind(this),instances:this.getInstances.bind(this),onAppAdded:this.onAppAdded.bind(this),onAppChanged:this.onAppChanged.bind(this),onAppRemoved:this.onAppRemoved.bind(this),onInstanceStarted:this.onInstanceStarted.bind(this),onInstanceStopped:this.onInstanceStopped.bind(this)};return Object.freeze(e)}},{key:"addOperationsExecutors",value:function(){lt.applicationAdded.execute=this.handleApplicationAddedMessage.bind(this),lt.applicationRemoved.execute=this.handleApplicationRemovedMessage.bind(this),lt.applicationChanged.execute=this.handleApplicationChangedMessage.bind(this),lt.instanceStarted.execute=this.handleInstanceStartedMessage.bind(this),lt.instanceStopped.execute=this.handleInstanceStoppedMessage.bind(this)}},{key:"onAppAdded",value:function(e){return this.registry.add("application-added",e,this.applications)}},{key:"onAppRemoved",value:function(e){return this.registry.add("application-removed",e)}},{key:"onAppChanged",value:function(e){return this.registry.add("application-changed",e)}},{key:"handleApplicationAddedMessage",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n,r,i;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.applications.some((function(t){return t.name===e.name}))){t.next=2;break}return t.abrupt("return");case 2:return t.next=4,this.ioc.buildApplication(e,[]);case 4:r=t.sent,i=this.instances.filter((function(e){return e.application.name===r.name})),(n=r.instances).push.apply(n,Object(s.a)(i)),this.applications.push(r),this.registry.execute("application-added",r);case 9:case"end":return t.stop()}}),t,this)})))}},{key:"handleApplicationRemovedMessage",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n,r;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!((n=this.applications.findIndex((function(t){return t.name===e.name})))<0)){t.next=3;break}return t.abrupt("return");case 3:r=this.applications[n],this.applications.splice(n,1),this.registry.execute("application-removed",r);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"handleApplicationChangedMessage",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=this.applications.find((function(t){return t.name===e.name}))){t.next=3;break}return t.abrupt("return",this.handleApplicationAddedMessage(e));case 3:n.title=e.title,n.version=e.version,n.icon=e.icon,n.caption=e.caption,n.userProperties=e.userProperties,this.registry.execute("application-changed",n);case 9:case"end":return t.stop()}}),t,this)})))}},{key:"handleInstanceStartedMessage",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n,r;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.instances.some((function(t){return t.id===e.id}))){t.next=2;break}return t.abrupt("return");case 2:if(n=this.applications.find((function(t){return t.name===e.applicationName}))){t.next=5;break}throw new Error("Cannot add instance: ".concat(e.id,", because there is no application definition associated with it"));case 5:r=this.ioc.buildInstance(e,n),this.instances.push(r),n.instances.push(r),this.registry.execute("instance-started",r);case 9:case"end":return t.stop()}}),t,this)})))}},{key:"handleInstanceStoppedMessage",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n,r,i,o;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((n=this.instances.find((function(t){return t.id===e.id})))&&(r=this.instances.findIndex((function(t){return t.id===e.id})),this.instances.splice(r,1)),(i=this.applications.find((function(t){return t.instances.some((function(t){return t.id===e.id}))})))&&(o=i.instances.findIndex((function(t){return t.id===e.id})),i.instances.splice(o,1)),n){t.next=6;break}return t.abrupt("return");case 6:this.registry.execute("instance-stopped",n);case 7:case"end":return t.stop()}}),t,this)})))}},{key:"import",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"replace";return p(this,void 0,void 0,u.a.mark((function n(){var r;return u.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(Ne.runWithException(t),Array.isArray(e)){n.next=3;break}throw new Error("Import must be called with an array of definitions");case 3:return r=e.reduce((function(e,t){var n=fe.run(t);return n.ok?e.valid.push(t):e.invalid.push({app:null===t||void 0===t?void 0:t.name,error:JSON.stringify(n.error)}),e}),{valid:[],invalid:[]}),n.next=6,this.bridge.send("appManager",lt.import,{definitions:r.valid,mode:t});case 6:return n.abrupt("return",{imported:r.valid.map((function(e){return e.name})),errors:r.invalid});case 7:case"end":return n.stop()}}),n,this)})))}},{key:"remove",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return $.runWithException(e),t.next=3,this.bridge.send("appManager",lt.remove,{name:e});case 3:case"end":return t.stop()}}),t,this)})))}},{key:"clear",value:function(){return p(this,void 0,void 0,u.a.mark((function e(){return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.bridge.send("appManager",lt.clear,void 0);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"export",value:function(){return p(this,void 0,void 0,u.a.mark((function e(){var t;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.bridge.send("appManager",lt.export,void 0);case 2:return t=e.sent,e.abrupt("return",t.definitions);case 4:case"end":return e.stop()}}),e,this)})))}},{key:"getApplication",value:function(e){var t=$.runWithException(e);return this.applications.find((function(e){return e.name===t}))}},{key:"getApplications",value:function(){return this.applications.slice()}},{key:"getInstances",value:function(){return this.instances.slice()}},{key:"registerWithPlatform",value:function(){return p(this,void 0,void 0,u.a.mark((function e(){var t,n=this;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.bridge.send("appManager",lt.appHello,{windowId:this.actualWindowId});case 2:return t=e.sent,this.logger.trace("the platform responded to the hello message with a full list of apps"),e.next=6,Promise.all(t.apps.map((function(e){return n.ioc.buildApplication(e,e.instances)})));case 6:this.applications=e.sent,this.instances=this.applications.reduce((function(e,t){return e.push.apply(e,Object(s.a)(t.instances)),e}),[]),this.me=this.findMyInstance(),this.logger.trace("all applications were parsed and saved. I am ".concat(this.me?"NOT a":"a"," valid instance"));case 10:case"end":return e.stop()}}),e,this)})))}},{key:"findMyInstance",value:function(){var e,t=this,n=Object(o.a)(this.applications);try{for(n.s();!(e=n.n()).done;){var r=e.value.instances.find((function(e){return e.id===t.publicWindowId}));if(r)return r}}catch(y){n.e(y)}finally{n.f()}}}]),e}(),ht=function(){function e(t,n,r){Object(d.a)(this,e),this.data=t,this.bridge=n,this.application=r,this.myCtxKey="___instance___".concat(this.data.id)}return Object(l.a)(e,[{key:"toApi",value:function(){var e=this.bridge.getInteropInstance(this.data.id),t={id:this.data.id,agm:e,application:this.application,stop:this.stop.bind(this),getContext:this.getContext.bind(this)};return this.me=Object.freeze(t),this.me}},{key:"getContext",value:function(){return p(this,void 0,void 0,u.a.mark((function e(){return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.bridge.contextLib.get(this.myCtxKey));case 1:case"end":return e.stop()}}),e,this)})))}},{key:"stop",value:function(){return p(this,void 0,void 0,u.a.mark((function e(){return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.bridge.send("appManager",lt.instanceStop,{id:this.data.id});case 2:case"end":return e.stop()}}),e,this)})))}}]),e}(),ft=function(){function e(t,n,r){Object(d.a)(this,e),this.data=t,this.instances=n,this.controller=r}return Object(l.a)(e,[{key:"toApi",value:function(){var e={name:this.data.name,title:this.data.title,version:this.data.version,icon:this.data.icon,caption:this.data.caption,userProperties:this.data.userProperties,instances:this.instances,start:this.start.bind(this),onInstanceStarted:this.onInstanceStarted.bind(this),onInstanceStopped:this.onInstanceStopped.bind(this)};return this.me=e,this.me}},{key:"onInstanceStarted",value:function(e){var t=this;if("function"!==typeof e)throw new Error("OnInstanceStarted requires a single argument of type function");this.controller.onInstanceStarted((function(n){n.application.name===t.data.name&&e(n)}))}},{key:"onInstanceStopped",value:function(e){var t=this;if("function"!==typeof e)throw new Error("OnInstanceStarted requires a single argument of type function");this.controller.onInstanceStopped((function(n){n.application.name===t.data.name&&e(n)}))}},{key:"start",value:function(e,t){return p(this,void 0,void 0,u.a.mark((function n(){return u.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",this.controller.startApplication(this.data.name,e,t));case 1:case"end":return n.stop()}}),n,this)})))}}]),e}(),mt={layoutAdded:{name:"layoutAdded",dataDecoder:Ae},layoutChanged:{name:"layoutChanged",dataDecoder:Ae},layoutRemoved:{name:"layoutRemoved",dataDecoder:Ae},get:{name:"get",dataDecoder:je,resultDecoder:Be},getAll:{name:"getAll",dataDecoder:De,resultDecoder:Fe},export:{name:"export",dataDecoder:De,resultDecoder:Le},import:{name:"import",dataDecoder:Re},remove:{name:"remove",dataDecoder:je}},vt=function(){function e(){Object(d.a)(this,e),this.registry=it()}return Object(l.a)(e,[{key:"start",value:function(e,t){return p(this,void 0,void 0,u.a.mark((function n(){var r;return u.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:this.logger=e.logger.subLogger("layouts.controller.web"),this.logger.trace("starting the web layouts controller"),this.bridge=t.bridge,this.addOperationsExecutors(),r=this.toApi(),this.logger.trace("no need for platform registration, attaching the layouts property to glue and returning"),e.layouts=r;case 7:case"end":return n.stop()}}),n,this)})))}},{key:"handleBridgeMessage",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n,r,i;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=K.runWithException(e.operation),(r=mt[n]).execute){t.next=4;break}return t.abrupt("return");case 4:return i=e.data,r.dataDecoder&&(i=r.dataDecoder.runWithException(e.data)),t.next=8,r.execute(i);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t)})))}},{key:"toApi",value:function(){var e={get:this.get.bind(this),getAll:this.getAll.bind(this),export:this.export.bind(this),import:this.import.bind(this),save:this.save.bind(this),restore:this.restore.bind(this),remove:this.remove.bind(this),onAdded:this.onAdded.bind(this),onChanged:this.onChanged.bind(this),onRemoved:this.onRemoved.bind(this)};return Object.freeze(e)}},{key:"addOperationsExecutors",value:function(){mt.layoutAdded.execute=this.handleOnAdded.bind(this),mt.layoutChanged.execute=this.handleOnChanged.bind(this),mt.layoutRemoved.execute=this.handleOnRemoved.bind(this)}},{key:"get",value:function(e,t){return p(this,void 0,void 0,u.a.mark((function n(){var r;return u.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return $.runWithException(e),xe.runWithException(t),n.next=4,this.bridge.send("layouts",mt.get,{name:e,type:t});case 4:return r=n.sent,n.abrupt("return",r.layout);case 6:case"end":return n.stop()}}),n,this)})))}},{key:"getAll",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return xe.runWithException(e),t.next=3,this.bridge.send("layouts",mt.getAll,{type:e});case 3:return n=t.sent,t.abrupt("return",n.summaries);case 5:case"end":return t.stop()}}),t,this)})))}},{key:"export",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e&&xe.runWithException(e),t.next=3,this.bridge.send("layouts",mt.export,{type:"Workspace"});case 3:return n=t.sent,t.abrupt("return",n.layouts);case 5:case"end":return t.stop()}}),t,this)})))}},{key:"import",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"replace";return p(this,void 0,void 0,u.a.mark((function n(){var r,i=this;return u.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(Ne.runWithException(t),Array.isArray(e)){n.next=3;break}throw new Error("Import must be called with an array of layouts");case 3:return r=e.reduce((function(e,t){var n=Ae.run(t);return n.ok?e.valid.push(t):i.logger.warn("A layout with name: ".concat(t.name," was not imported, because of error: ").concat(JSON.stringify(n.error))),e}),{valid:[]}),n.next=6,this.bridge.send("layouts",mt.import,{layouts:r.valid,mode:t});case 6:case"end":return n.stop()}}),n,this)})))}},{key:"save",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw Pe.runWithException(e),new Error("Save is not supported in Core at the moment");case 2:case"end":return t.stop()}}),t)})))}},{key:"restore",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw Me.runWithException(e),new Error("Restore is not supported in Core at the moment");case 2:case"end":return t.stop()}}),t)})))}},{key:"remove",value:function(e,t){return p(this,void 0,void 0,u.a.mark((function n(){return u.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return xe.runWithException(e),$.runWithException(t),n.next=4,this.bridge.send("layouts",mt.remove,{type:e,name:t});case 4:case"end":return n.stop()}}),n,this)})))}},{key:"onAdded",value:function(e){return this.export().then((function(t){return t.forEach((function(t){return e(t)}))})).catch((function(){})),this.registry.add(mt.layoutAdded.name,e)}},{key:"onChanged",value:function(e){return this.registry.add(mt.layoutChanged.name,e)}},{key:"onRemoved",value:function(e){return this.registry.add(mt.layoutRemoved.name,e)}},{key:"handleOnAdded",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.registry.execute(mt.layoutAdded.name,e);case 1:case"end":return t.stop()}}),t,this)})))}},{key:"handleOnChanged",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.registry.execute(mt.layoutChanged.name,e);case 1:case"end":return t.stop()}}),t,this)})))}},{key:"handleOnRemoved",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.registry.execute(mt.layoutRemoved.name,e);case 1:case"end":return t.stop()}}),t,this)})))}}]),e}(),gt=function(){function e(){Object(d.a)(this,e)}return Object(l.a)(e,[{key:"start",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.logger=e.logger.subLogger("notifications.controller.web"),this.logger.trace("starting the web notifications controller"),this.interop=e.interop,n=this.toApi(),e.notifications=n,this.logger.trace("notifications are ready");case 6:case"end":return t.stop()}}),t,this)})))}},{key:"handleBridgeMessage",value:function(){return p(this,void 0,void 0,u.a.mark((function e(){return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})))}},{key:"toApi",value:function(){var e={raise:this.raise.bind(this)};return Object.freeze(e)}},{key:"raise",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n,r,i,o=this;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("Notification"in window){t.next=2;break}throw new Error("this browser does not support desktop notification");case 2:return n="granted"===Notification.permission?Promise.resolve("granted"):"denied"===Notification.permission?Promise.reject("no permissions from user"):Notification.requestPermission(),t.next=5,n;case 5:return r=this.raiseUsingWebApi(e),e.clickInterop&&(i=e.clickInterop,r.onclick=function(){var e,t;o.interop.invoke(i.method,null!==(e=null===i||void 0===i?void 0:i.arguments)&&void 0!==e?e:{},null!==(t=null===i||void 0===i?void 0:i.target)&&void 0!==t?t:"best")}),t.abrupt("return",r);case 8:case"end":return t.stop()}}),t,this)})))}},{key:"raiseUsingWebApi",value:function(e){return new Notification(e.title)}}]),e}(),yt={getIntents:{name:"getIntents",resultDecoder:Ge},findIntent:{name:"findIntent",dataDecoder:Ke,resultDecoder:Ge},raiseIntent:{name:"raiseIntent",dataDecoder:Xe,resultDecoder:Ze}},wt=function(){function e(){Object(d.a)(this,e),this.myIntents=new Set,this.GlueWebIntentsPrefix="Tick42.FDC3.Intents."}return Object(l.a)(e,[{key:"start",value:function(e,t){return p(this,void 0,void 0,u.a.mark((function n(){var r;return u.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:this.logger=e.logger.subLogger("intents.controller.web"),this.logger.trace("starting the web intents controller"),this.bridge=t.bridge,this.interop=e.interop,r=this.toApi(),this.logger.trace("no need for platform registration, attaching the intents property to glue and returning"),e.intents=r;case 7:case"end":return n.stop()}}),n,this)})))}},{key:"handleBridgeMessage",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n,r,i;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=ze.runWithException(e.operation),(r=yt[n]).execute){t.next=4;break}return t.abrupt("return");case 4:return i=e.data,r.dataDecoder&&(i=r.dataDecoder.runWithException(e.data)),t.next=8,r.execute(i);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t)})))}},{key:"toApi",value:function(){var e={raise:this.raise.bind(this),all:this.all.bind(this),addIntentListener:this.addIntentListener.bind(this),find:this.find.bind(this)};return Object.freeze(e)}},{key:"raise",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n,r,i;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Ye.runWithException(e),r="string"===typeof n?{intent:n}:n,t.next=4,this.bridge.send("intents",yt.raiseIntent,r);case 4:return i=t.sent,t.abrupt("return",i);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"all",value:function(){return p(this,void 0,void 0,u.a.mark((function e(){var t;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.bridge.send("intents",yt.getIntents,void 0);case 2:return t=e.sent,e.abrupt("return",t.intents);case 4:case"end":return e.stop()}}),e,this)})))}},{key:"addIntentListener",value:function(e,t){var n=this;if(et.runWithException(e),"function"!==typeof t)throw new Error("Cannot add intent listener, because the provided handler is not a function!");var r=!0,i="string"===typeof e?e:e.intent,o="".concat(this.GlueWebIntentsPrefix).concat(i);if(this.myIntents.has(i))throw new Error("Intent listener for intent ".concat(i," already registered!"));this.myIntents.add(i);var a={unsubscribe:function(){r=!1;try{n.interop.unregister(o),n.myIntents.delete(i)}catch(e){n.logger.trace("Unsubscribed intent listener, but ".concat(o," unregistration failed!"))}}},s={};"object"===typeof e&&(s=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["intent"]));return this.interop.register({name:o,flags:{intent:s}},(function(e){if(r)return t(e)})),a}},{key:"find",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n,r,i;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=void 0,"undefined"!==typeof e&&("string"===typeof(r=Je.runWithException(e))?n={filter:{name:r}}:"object"===typeof r&&(n={filter:r})),t.next=4,this.bridge.send("intents",yt.findIntent,n);case 4:return i=t.sent,t.abrupt("return",i.intents);case 6:case"end":return t.stop()}}),t,this)})))}}]),e}(),bt=function(){function e(){Object(d.a)(this,e),this.registry=it(),this.GlueWebChannelsPrefix="___channel___",this.SubsKey="subs",this.ChangedKey="changed"}return Object(l.a)(e,[{key:"start",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.logger=e.logger.subLogger("channels.controller.web"),this.logger.trace("starting the web channels controller"),this.contexts=e.contexts,this.logger.trace("no need for platform registration, attaching the channels property to glue and returning"),n=this.toApi(),e.channels=n;case 6:case"end":return t.stop()}}),t,this)})))}},{key:"handleBridgeMessage",value:function(){return p(this,void 0,void 0,u.a.mark((function e(){return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})))}},{key:"toApi",value:function(){var e={subscribe:this.subscribe.bind(this),subscribeFor:this.subscribeFor.bind(this),publish:this.publish.bind(this),all:this.all.bind(this),list:this.list.bind(this),get:this.get.bind(this),join:this.join.bind(this),leave:this.leave.bind(this),current:this.current.bind(this),my:this.my.bind(this),changed:this.changed.bind(this),onChanged:this.onChanged.bind(this),add:this.add.bind(this)};return Object.freeze(e)}},{key:"createContextName",value:function(e){return"".concat(this.GlueWebChannelsPrefix).concat(e)}},{key:"getAllChannelNames",value:function(){var e=this;return this.contexts.all().filter((function(t){return t.startsWith(e.GlueWebChannelsPrefix)})).map((function(t){return t.replace(e.GlueWebChannelsPrefix,"")}))}},{key:"unsubscribe",value:function(){this.unsubscribeFunc&&(this.unsubscribeFunc(),this.unsubscribeFunc=void 0)}},{key:"switchToChannel",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n,r=this;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.unsubscribe(),this.currentChannelName=e,"undefined"===typeof e){t.next=7;break}return n=this.createContextName(e),t.next=6,this.contexts.subscribe(n,(function(e,t,n,i,o){r.registry.execute(r.SubsKey,e.data,e,null===o||void 0===o?void 0:o.updaterId)}));case 6:this.unsubscribeFunc=t.sent;case 7:this.registry.execute(this.ChangedKey,e);case 8:case"end":return t.stop()}}),t,this)})))}},{key:"updateData",value:function(e,t){return p(this,void 0,void 0,u.a.mark((function n(){var r,i;return u.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=this.createContextName(e),!this.contexts.setPathSupported){n.next=7;break}return i=Object.keys(t).map((function(e){return{path:"data.".concat(e),value:t[e]}})),n.next=5,this.contexts.setPaths(r,i);case 5:n.next=9;break;case 7:return n.next=9,this.contexts.update(r,{data:t});case 9:case"end":return n.stop()}}),n,this)})))}},{key:"subscribe",value:function(e){if("function"!==typeof e)throw new Error("Cannot subscribe to channels, because the provided callback is not a function!");return this.registry.add(this.SubsKey,e)}},{key:"subscribeFor",value:function(e,t){return p(this,void 0,void 0,u.a.mark((function n(){var r,i;return u.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=this.getAllChannelNames(),tt(r).runWithException(e),"function"===typeof t){n.next=4;break}throw new Error("Cannot subscribe to channel ".concat(e,", because the provided callback is not a function!"));case 4:return i=this.createContextName(e),n.abrupt("return",this.contexts.subscribe(i,(function(e,n,r,i,o){t(e.data,e,null===o||void 0===o?void 0:o.updaterId)})));case 6:case"end":return n.stop()}}),n,this)})))}},{key:"publish",value:function(e,t){if("object"!==typeof e)throw new Error("Cannot publish to channel, because the provided data is not an object!");if("undefined"!==typeof t){var n=this.getAllChannelNames();return tt(n).runWithException(t),this.updateData(t,e)}if("undefined"===typeof this.currentChannelName)throw new Error("Cannot publish to channel, because not joined to a channel!");return this.updateData(this.currentChannelName,e)}},{key:"all",value:function(){return p(this,void 0,void 0,u.a.mark((function e(){var t;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.getAllChannelNames(),e.abrupt("return",t);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"list",value:function(){return p(this,void 0,void 0,u.a.mark((function e(){var t,n,r=this;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.getAllChannelNames(),e.next=3,Promise.all(t.map((function(e){return r.get(e)})));case 3:return n=e.sent,e.abrupt("return",n);case 5:case"end":return e.stop()}}),e,this)})))}},{key:"get",value:function(e){var t=this.getAllChannelNames();tt(t).runWithException(e);var n=this.createContextName(e);return this.contexts.get(n)}},{key:"join",value:function(e){return p(this,void 0,void 0,u.a.mark((function t(){var n;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.getAllChannelNames(),tt(n).runWithException(e),t.next=4,this.switchToChannel(e);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"leave",value:function(){return p(this,void 0,void 0,u.a.mark((function e(){return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.switchToChannel();case 2:case"end":return e.stop()}}),e,this)})))}},{key:"current",value:function(){return this.currentChannelName}},{key:"my",value:function(){return this.current()}},{key:"changed",value:function(e){if("function"!==typeof e)throw new Error("Cannot subscribe to channel changed, because the provided callback is not a function!");return this.registry.add(this.ChangedKey,e)}},{key:"onChanged",value:function(e){return this.changed(e)}},{key:"add",value:function(e){throw new Error("Method `add()` isn't implemented.")}}]),e}(),kt=function(){function e(t){Object(d.a)(this,e),this.coreGlue=t,this.controllers={windows:this.windowsController,appManager:this.appManagerController,layouts:this.layoutsController,notifications:this.notificationsController,intents:this.intentsController,channels:this.channelsController}}return Object(l.a)(e,[{key:"buildWebWindow",value:function(e,t){return p(this,void 0,void 0,u.a.mark((function n(){var r,i;return u.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=new ot(e,t,this.bridge),n.next=3,r.toApi();case 3:return i=n.sent,n.abrupt("return",{id:e,model:r,api:i});case 5:case"end":return n.stop()}}),n,this)})))}},{key:"buildApplication",value:function(e,t){return p(this,void 0,void 0,u.a.mark((function n(){var r,i,o,a=this;return u.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return i=new ft(e,[],this.appManagerController).toApi(),o=t.map((function(e){return a.buildInstance(e,i)})),(r=i.instances).push.apply(r,Object(s.a)(o)),n.abrupt("return",i);case 4:case"end":return n.stop()}}),n,this)})))}},{key:"buildInstance",value:function(e,t){return new ht(e,this.bridge,t).toApi()}},{key:"windowsController",get:function(){return this._windowsControllerInstance||(this._windowsControllerInstance=new at),this._windowsControllerInstance}},{key:"appManagerController",get:function(){return this._appManagerControllerInstance||(this._appManagerControllerInstance=new pt),this._appManagerControllerInstance}},{key:"layoutsController",get:function(){return this._layoutsControllerInstance||(this._layoutsControllerInstance=new vt),this._layoutsControllerInstance}},{key:"notificationsController",get:function(){return this._notificationsControllerInstance||(this._notificationsControllerInstance=new gt),this._notificationsControllerInstance}},{key:"intentsController",get:function(){return this._intentsControllerInstance||(this._intentsControllerInstance=new wt),this._intentsControllerInstance}},{key:"channelsController",get:function(){return this._channelsControllerInstance||(this._channelsControllerInstance=new bt),this._channelsControllerInstance}},{key:"bridge",get:function(){return this._bridgeInstance||(this._bridgeInstance=new dt(this.coreGlue)),this._bridgeInstance}}]),e}(),xt="2.0.8",_t=function(e,t){return(_t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function It(e,t){function n(){this.constructor=e}_t(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Ct=function(){return(Ct=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function St(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(t){o(t)}}function s(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){e.done?i(e.value):new n((function(t){t(e.value)})).then(a,s)}c((r=r.apply(e,t||[])).next())}))}function Et(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"===typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(s){o=[6,s],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function Wt(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}var Tt=1,At=2,Pt=3,Mt=4;function Ot(e){return e.type===Pt?"timestamp":e.type===At?"number":e.type===Tt?"string":e.type===Mt?"object":"unknown"}function jt(e){return e.constructor===Date?"timestamp":"number"===typeof e?"number":"string"===typeof e?"string":"object"===typeof e?"object":"string"}function Dt(e){var t={},n=Ot(e);if("object"===n){var r=Object.keys(e.value).reduce((function(t,n){var r=jt(e.value[n]);if("object"===r){var i=Lt(e.value[n]);t[n]={type:"object",description:"",context:{},composite:i}}else t[n]={type:r,description:"",context:{}};return t}),{});t.composite=r}return t.name=Nt(e.path.join("/")+"/"+e.name),t.type=n,t.description=e.description,t.context={},t}function Lt(e){return Object.keys(e).reduce((function(t,n){var r=jt(e[n]);return t[n]="object"===r?{type:"object",description:"",context:{},composite:Lt(e[n])}:{type:r,description:"",context:{}},t}),{})}function Nt(e){return"undefined"!==typeof e&&e.length>0&&"/"!==e[0]?"/"+e:e}function Rt(e){return"timestamp"===Ot(e)?Date.now():Ft(e.value)}function Ft(e){return"object"!==typeof e?e:Object.keys(e).reduce((function(t,n){var r=e[n];return"object"===typeof r&&r.constructor!==Date?t[n]=Ft(r):r.constructor===Date?t[n]=new Date(r).getTime():r.constructor===Boolean?t[n]=r.toString():t[n]=r,t}),{})}function Bt(e){return e.reduce((function(e,t){return e.concat(Array.isArray(t)?Bt(t):t)}),[])}function zt(e){var t=Bt(e.root.getAggregateState()),n=t.sort((function(e,t){return e.state?t.state?t.state-e.state:-1:1}))[0];return{description:function(e){var t="";return e.forEach((function(e,n,r){var i=e.path.join(".");n===r.length-1?t+=i+"."+e.name+": "+e.description:t+=i+"."+e.name+": "+e.description+","})),t.length>100?t.slice(0,100)+"...":t}(t),value:n.state}}var Ht=function(e,t,n){if(null===e||"object"!==typeof e)throw new Error("Missing definition");if(null===t||"object"!==typeof t)throw new Error("Missing parent");if(null===n||"object"!==typeof n)throw new Error("Missing transport")},qt=function(){function e(e,t,n,r,i){this.definition=e,this.system=t,this.transport=n,this.value=r,this.type=i,this.path=[],Ht(e,t,n),this.path=t.path.slice(0),this.path.push(t.name),this.name=e.name,this.description=e.description,n.createMetric(this)}return Object.defineProperty(e.prototype,"repo",{get:function(){var e;return null===(e=this.system)||void 0===e?void 0:e.repo},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"id",{get:function(){return this.system.path+"/"+name},enumerable:!0,configurable:!0}),e.prototype.update=function(e){return this.value=e,this.transport.updateMetric(this)},e}(),$t=function(e){function t(t,n,r,i){return e.call(this,t,n,r,i,At)||this}return It(t,e),t.prototype.incrementBy=function(e){this.update(this.value+e)},t.prototype.increment=function(){this.incrementBy(1)},t.prototype.decrement=function(){this.incrementBy(-1)},t.prototype.decrementBy=function(e){this.incrementBy(-1*e)},t}(qt),Ut=function(e){function t(t,n,r,i){return e.call(this,t,n,r,i,Mt)||this}return It(t,e),t.prototype.update=function(e){return this.mergeValues(e),this.transport.updateMetric(this)},t.prototype.mergeValues=function(e){var t=this;return Object.keys(this.value).forEach((function(n){"undefined"!==typeof e[n]&&(t.value[n]=e[n])}))},t}(qt),Gt=function(e){function t(t,n,r,i){return e.call(this,t,n,r,i,Tt)||this}return It(t,e),t}(qt),Vt=function(e){function t(t,n,r,i){return e.call(this,t,n,r,i,Pt)||this}return It(t,e),t.prototype.now=function(){this.update(new Date)},t}(qt);function Jt(e,t,n,r,i){if(!t)throw new Error("Repository is required");if(!n)throw new Error("Transport is required");var o,a,s=n,c=e,u=i||"",d=t,l=r,p=function e(t){if(!t||!t.parent)return[];var n=e(t.parent);return n.push(t.name),n}(r),h={},f=(a="/",((o=p)&&o.length>0?o.join(a):"")+e),m=t.root,v=[],g=[];function y(e,t,n,r){var i={name:""};i="string"===typeof e?{name:e}:e;var o=g.filter((function(e){return e.name===i.name}));if(o.length>0){var a=o[0];if(a.type!==t)throw new Error("A metric named "+i.name+" is already defined with different type.");return"undefined"!==typeof n&&a.update(n).catch((function(){})),a}var s=r(i);return g.push(s),s}var w={get name(){return c},get description(){return u},get repo(){return d},get parent(){return l},path:p,id:f,root:m,get subSystems(){return v},get metrics(){return g},subSystem:function(e,t){if(!e||0===e.length)throw new Error("name is required");var n=v.filter((function(t){return t.name===e}));if(n.length>0)return n[0];var r=Jt(e,d,s,w,t);return v.push(r),r},getState:function(){return h},setState:function(e,t){h={state:e,description:t},s.updateSystem(w,h)},stringMetric:function(e,t){return y(e,Tt,t,(function(e){return new Gt(e,w,s,t)}))},timestampMetric:function(e,t){return y(e,Pt,t,(function(e){return new Vt(e,w,s,t)}))},objectMetric:function(e,t){return y(e,Mt,t,(function(e){return new Ut(e,w,s,t)}))},numberMetric:function(e,t){return y(e,At,t,(function(e){return new $t(e,w,s,t)}))},getAggregateState:function(){var e=[];return Object.keys(h).length>0&&e.push({name:c,path:p,state:h.state,description:h.description}),v.forEach((function(t){var n=t.getAggregateState();n.length>0&&e.push.apply(e,n)})),e}};return s.createSystem(w),w}var Kt=function(){function e(e,t){t.init(this),this.root=Jt("",this,t),this.addSystemMetrics(this.root,e.clickStream||void 0===e.clickStream)}return e.prototype.addSystemMetrics=function(e,t){if("undefined"!==typeof navigator&&e.stringMetric("UserAgent",navigator.userAgent),t&&"undefined"!==typeof document){var n=e.subSystem("ClickStream"),r=function(e){if(e.target){var t=e.target;n.objectMetric("LastBrowserEvent",{type:"click",timestamp:new Date,target:{className:e.target?t.className:"",id:t.id,type:"<"+t.tagName.toLowerCase()+">",href:t.href||""}})}};n.objectMetric("Page",{title:document.title,page:window.location.href}),document.addEventListener?document.addEventListener("click",r):document.attachEvent("onclick",r)}e.stringMetric("StartTime",(new Date).toString());var i=e.stringMetric("StartURL",""),o=e.stringMetric("AppName","");if("undefined"!==typeof window){if("undefined"!==typeof window.location){var a=window.location.href;i.update(a)}"undefined"!==typeof window.glue42gd&&o.update(window.glue42gd.appName)}},e}(),Xt=function(){function e(){}return e.prototype.init=function(e){},e.prototype.createSystem=function(e){return Promise.resolve()},e.prototype.updateSystem=function(e,t){return Promise.resolve()},e.prototype.createMetric=function(e){return Promise.resolve()},e.prototype.updateMetric=function(e){return Promise.resolve()},e}(),Yt=function(){function e(e,t,n){this.api=e,this.lastCount=0,this.initialPublishTimeout=1e4,this.publishInterval=6e4,this.initialPublishTimeout=null!==t&&void 0!==t?t:this.initialPublishTimeout,this.publishInterval=null!==n&&void 0!==n?n:this.publishInterval,this.scheduleCollection(),this.system=this.api.subSystem("performance","Performance data published by the web application")}return e.prototype.scheduleCollection=function(){var e=this;setTimeout((function(){e.collect(),setInterval((function(){e.collect()}),e.publishInterval)}),this.initialPublishTimeout)},e.prototype.collect=function(){try{this.collectMemory(),this.collectEntries()}catch(e){}},e.prototype.collectMemory=function(){var e=window.performance.memory;this.system.stringMetric("memory",JSON.stringify({totalJSHeapSize:e.totalJSHeapSize,usedJSHeapSize:e.usedJSHeapSize}))},e.prototype.collectEntries=function(){var e=window.performance.getEntries();e.length<=this.lastCount||(this.lastCount=e.length,this.system.stringMetric("entries",JSON.stringify(e)))},e}(),Zt=function(e){var t;t=e.connection&&"object"===typeof e.connection?function(e,t){var n,r,i=this;if(!e||"object"!==typeof e)throw new Error("Connection is required parameter");var o=function(e){a(e.root)},a=function e(t){s(t),t.metrics.forEach((function(e){c(e)})),t.subSystems.forEach((function(t){e(t)}))},s=function(e){return St(i,void 0,void 0,(function(){var t,i;return Et(this,(function(o){switch(o.label){case 0:return void 0===e.parent?[2]:[4,n];case 1:return o.sent(),t={name:Nt(e.path.join("/")+"/"+e.name+"/State"),type:"object",composite:{Description:{type:"string",description:""},Value:{type:"number",description:""}},description:"System state",context:{}},i={type:"define",metrics:[t]},r.send(i),[2]}}))}))},c=function(e){return St(i,void 0,void 0,(function(){var t,i,o;return Et(this,(function(a){switch(a.label){case 0:return t=d(e),[4,n];case 1:return a.sent(),i=Dt(t),o={type:"define",metrics:[i]},r.send(o),"undefined"!==typeof t.value&&u(t),[2]}}))}))},u=function(e){if(l()){var t=Rt(e),n={type:"publish",values:[{name:Nt(e.path.join("/")+"/"+e.name),value:t,timestamp:Date.now()}]};return r.sendFireAndForget(n)}return Promise.resolve()},d=function(e){var t=Ct({},e);return"object"===typeof e.value&&null!==e.value&&(t.value=Ct({},e.value)),t},l=function(){var e;try{return(null!==(e=t.canUpdateMetric)&&void 0!==e?e:function(){return!0})()}catch(n){return!0}};return{init:function(i){var a;n=new Promise((function(e){a=e})),(r=e.domain("metrics")).onJoined((function(e){!e&&a&&(a(),a=void 0);var t={type:"define",metrics:[{name:"/State",type:"object",composite:{Description:{type:"string",description:""},Value:{type:"number",description:""}},description:"System state",context:{}}]};r.send(t),e&&o(i)})),r.join({system:t.system,service:t.service,instance:t.instance})},createSystem:s,updateSystem:function(t,o){return St(i,void 0,void 0,(function(){var i,a,s;return Et(this,(function(c){switch(c.label){case 0:return[4,n];case 1:return c.sent(),i={type:"publish",values:[{name:Nt(t.path.join("/")+"/"+t.name+"/State"),value:{Description:o.description,Value:o.state},timestamp:Date.now()}]},r.send(i),a=zt(t),s={type:"publish",peer_id:e.peerId,values:[{name:"/State",value:{Description:a.description,Value:a.value},timestamp:Date.now()}]},r.send(s),[2]}}))}))},createMetric:c,updateMetric:function(e){return St(i,void 0,void 0,(function(){var t;return Et(this,(function(r){switch(r.label){case 0:return t=d(e),[4,n];case 1:return r.sent(),u(t),[2]}}))}))}}}(e.connection,e):new Xt;var n=new Kt(e,t).root;e.disableAutoAppSystem||(n=n.subSystem("App"));var r=function(e){var t,n=e.subSystem("reporting"),r={name:"features"},i=function(e,i,o){if("undefined"===typeof e||""===e)throw new Error("name is mandatory");if("undefined"===typeof i||""===i)throw new Error("action is mandatory");if("undefined"===typeof o||""===o)throw new Error("payload is mandatory");t?t.update({name:e,action:i,payload:o}):t=n.objectMetric(r,{name:e,action:i,payload:o})};return e.featureMetric=i,e}(n);return function(e,t){var n,r;if("undefined"===typeof window)return;var i=null===(r=null===(n=null===window||void 0===window?void 0:window.glue42gd)||void 0===n?void 0:n.metrics)||void 0===r?void 0:r.pagePerformanceMetrics;i&&(t=i);(null===t||void 0===t?void 0:t.enabled)&&new Yt(e,t.initialPublishTimeout,t.publishInterval)}(r,e.pagePerformanceMetrics),r};function Qt(e){if(e&&e.errorHandling&&"function"!==typeof e.errorHandling&&"log"!==e.errorHandling&&"silent"!==e.errorHandling&&"throw"!==e.errorHandling)throw new Error('Invalid options passed to createRegistry. Prop errorHandling should be ["log" | "silent" | "throw" | (err) => void], but '+typeof e.errorHandling+" was passed");var t=e&&"function"===typeof e.errorHandling&&e.errorHandling,n={};function r(n,r){var i=n instanceof Error?n:new Error(n);if(t)t(i);else{var o='[ERROR] callback-registry: User callback for key "'+r+'" failed: '+i.stack;if(e)switch(e.errorHandling){case"log":return console.error(o);case"silent":return;case"throw":throw new Error(o)}console.error(o)}}return{add:function(e,t,i){var o=n[e];return o||(o=[],n[e]=o),o.push(t),i&&setTimeout((function(){i.forEach((function(i){var o;if(null===(o=n[e])||void 0===o?void 0:o.includes(t))try{Array.isArray(i)?t.apply(void 0,i):t.apply(void 0,[i])}catch(y){r(y,e)}}))}),0),function(){var r=n[e];r&&(0===(r=r.reduce((function(e,n,r){return n===t&&e.length===r||e.push(n),e}),[])).length?delete n[e]:n[e]=r)}},execute:function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];var o=n[e];if(!o||0===o.length)return[];var a=[];return o.forEach((function(n){try{var i=n.apply(void 0,t);a.push(i)}catch(y){a.push(void 0),r(y,e)}})),a},clear:function(){n={}},clearKey:function(e){n[e]&&delete n[e]}}}Qt.default=Qt;var en=Qt,tn=function(){function e(e,t){var n=this;this.registry=en(),this.gw=e.facade,this.gw.connect((function(e,t){n.messageHandler(t)})).then((function(e){n.client=e}))}return Object.defineProperty(e.prototype,"isObjectBasedTransport",{get:function(){return!0},enumerable:!0,configurable:!0}),e.prototype.sendObject=function(e){return this.client?(this.client.send(e),Promise.resolve(void 0)):Promise.reject("not connected")},e.prototype.send=function(e){return Promise.reject("not supported")},e.prototype.onMessage=function(e){return this.registry.add("onMessage",e)},e.prototype.onConnectedChanged=function(e){e(!0)},e.prototype.close=function(){return Promise.resolve()},e.prototype.open=function(){return Promise.resolve()},e.prototype.name=function(){return"in-memory"},e.prototype.reconnect=function(){return Promise.resolve()},e.prototype.messageHandler=function(e){this.registry.execute("onMessage",e)},e}(),nn=function(){function e(e,t){var n=this;this.logger=t,this.registry=en(),this.worker=new SharedWorker(e),this.worker.port.onmessage=function(e){n.messageHandler(e.data)}}return Object.defineProperty(e.prototype,"isObjectBasedTransport",{get:function(){return!0},enumerable:!0,configurable:!0}),e.prototype.sendObject=function(e){return this.worker.port.postMessage(e),Promise.resolve()},e.prototype.send=function(e){return Promise.reject("not supported")},e.prototype.onMessage=function(e){return this.registry.add("onMessage",e)},e.prototype.onConnectedChanged=function(e){e(!0)},e.prototype.close=function(){return Promise.resolve()},e.prototype.open=function(){return Promise.resolve()},e.prototype.name=function(){return"shared-worker"},e.prototype.reconnect=function(){return Promise.resolve()},e.prototype.messageHandler=function(e){this.registry.execute("onMessage",e)},e}(),rn=function(){function t(){}return t.getGDMajorVersion=function(){if("undefined"!==typeof window&&window.glueDesktop&&window.glueDesktop.version){var e=Number(window.glueDesktop.version.substr(0,1));return isNaN(e)?void 0:e}},t.isNode=function(){if("undefined"!==typeof t._isNode)return t._isNode;if("undefined"!==typeof window)return t._isNode=!1,!1;try{t._isNode="[object process]"===Object.prototype.toString.call(e.process)}catch(n){t._isNode=!1}return t._isNode},t}(),on=function(){function e(){var e=this;this.rejected=!1,this.resolved=!1,this.promise=new Promise((function(t,n){e.resolve=function(n){e.resolved=!0,t(n)},e.reject=function(t){e.rejected=!0,n(t)}}))}return e.delay=function(e){return new Promise((function(t){return setTimeout(t,e)}))},Object.defineProperty(e.prototype,"ended",{get:function(){return this.rejected||this.resolved},enumerable:!0,configurable:!0}),e}(),an={};function sn(e){var t=an[e];if(t)return t;var n=[];function r(){return(new Date).getTime()}var i,o,a=r();function s(e,t){var i=null!==t&&void 0!==t?t:r(),o=0;n.length>0&&(o=i-n[n.length-1].time),n.push({name:e,time:i,diff:o})}s("start",a);var c={get startTime(){return a},get endTime(){return i},get period(){return o},stop:function(){return s("end",i=r()),o=i-a},mark:s,marks:n};return an[e]=c,c}var cn=rn.isNode()?n(37):window.WebSocket,un=function(){function e(e,t){if(this.startupTimer=sn("connection"),this._running=!0,this._registry=en(),this.wsRequests=[],this.settings=e,this.logger=t,!this.settings.ws)throw new Error("ws is missing")}return e.prototype.onMessage=function(e){return this._registry.add("onMessage",e)},e.prototype.send=function(e,t){var n=this;return new Promise((function(t,r){n.waitForSocketConnection((function(){var i;try{null===(i=n.ws)||void 0===i||i.send(e),t()}catch(o){r(o)}}),r)}))},e.prototype.open=function(){var e=this;return this.logger.info("opening ws..."),this._running=!0,new Promise((function(t,n){e.waitForSocketConnection(t,n)}))},e.prototype.close=function(){return this._running=!1,this.ws&&this.ws.close(),Promise.resolve()},e.prototype.onConnectedChanged=function(e){return this._registry.add("onConnectedChanged",e)},e.prototype.name=function(){return"ws "+this.settings.ws},e.prototype.reconnect=function(){var e;null===(e=this.ws)||void 0===e||e.close();var t=new on;return this.waitForSocketConnection((function(){t.resolve()})),t.promise},e.prototype.waitForSocketConnection=function(e,t){var n;t=null!==t&&void 0!==t?t:function(){},this._running?1!==(null===(n=this.ws)||void 0===n?void 0:n.readyState)?(this.wsRequests.push({callback:e,failed:t}),this.wsRequests.length>1||this.openSocket()):e():t("wait for socket on "+this.settings.ws+" failed - socket closed by user")},e.prototype.openSocket=function(e,t){return St(this,void 0,void 0,(function(){var n=this;return Et(this,(function(r){switch(r.label){case 0:if(this.startupTimer.mark("opening-socket"),void 0===e&&(e=this.settings.reconnectInterval),void 0!==t){if(0===t)return this.notifyForSocketState("wait for socket on "+this.settings.ws+" failed - no more retries left"),[2];this.logger.debug("will retry "+t+" more times (every "+e+" ms)")}r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.initiateSocket()];case 2:return r.sent(),this.startupTimer.mark("socket-initiated"),this.notifyForSocketState(),[3,4];case 3:return r.sent(),setTimeout((function(){var r=void 0===t?void 0:t-1;n.openSocket(e,r)}),e),[3,4];case 4:return[2]}}))}))},e.prototype.initiateSocket=function(){var e=this,t=new on;return this.logger.debug("initiating ws to "+this.settings.ws+"..."),this.ws=new cn(this.settings.ws||""),this.ws.onerror=function(n){var r="";try{r=JSON.stringify(n)}catch(o){var i=new WeakSet;r=JSON.stringify(n,(function(e,t){if("object"===typeof t&&null!==t){if(i.has(t))return;i.add(t)}return t}))}t.reject("error"),e.notifyStatusChanged(!1,r)},this.ws.onclose=function(n){e.logger.info("ws closed "+n),t.reject("closed"),e.notifyStatusChanged(!1)},this.ws.onopen=function(){var n;e.startupTimer.mark("ws-opened"),e.logger.info("ws opened "+(null===(n=e.settings.identity)||void 0===n?void 0:n.application)),t.resolve(),e.notifyStatusChanged(!0)},this.ws.onmessage=function(t){e._registry.execute("onMessage",t.data)},t.promise},e.prototype.notifyForSocketState=function(e){this.wsRequests.forEach((function(t){e?t.failed&&t.failed(e):t.callback()})),this.wsRequests=[]},e.prototype.notifyStatusChanged=function(e,t){this._registry.execute("onConnectedChanged",e,t)},e}();var dn=1;var ln,pn,hn,fn={nextValue:function(){return(dn=(9301*dn+49297)%233280)/233280},seed:function(e){dn=e}},mn="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";function vn(){hn=!1}function gn(e){if(e){if(e!==ln){if(e.length!==mn.length)throw new Error("Custom alphabet for shortid must be "+mn.length+" unique characters. You submitted "+e.length+" characters: "+e);var t=e.split("").filter((function(e,t,n){return t!==n.lastIndexOf(e)}));if(t.length)throw new Error("Custom alphabet for shortid must be "+mn.length+" unique characters. These characters were not unique: "+t.join(", "));ln=e,vn()}}else ln!==mn&&(ln=mn,vn())}function yn(){return hn||(hn=function(){ln||gn(mn);for(var e,t=ln.split(""),n=[],r=fn.nextValue();t.length>0;)r=fn.nextValue(),e=Math.floor(r*t.length),n.push(t.splice(e,1)[0]);return n.join("")}())}var wn={characters:function(e){return gn(e),ln},seed:function(e){fn.seed(e),pn!==e&&(vn(),pn=e)},lookup:function(e){return yn()[e]},shuffled:yn},bn="object"===typeof window&&(window.crypto||window.msCrypto);var kn=function(){if(!bn||!bn.getRandomValues)return 48&Math.floor(256*Math.random());var e=new Uint8Array(1);return bn.getRandomValues(e),48&e[0]};var xn=function(e,t){for(var n,r=0,i="";!n;)i+=e(t>>4*r&15|kn()),n=t<Math.pow(16,r+1),r++;return i};var _n=function(e){var t=wn.shuffled();return{version:15&t.indexOf(e.substr(0,1)),worker:15&t.indexOf(e.substr(1,1))}};var In=function(e){if(!e||"string"!==typeof e||e.length<6)return!1;for(var t=wn.characters(),n=e.length,r=0;r<n;r++)if(-1===t.indexOf(e[r]))return!1;return!0},Cn=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){var t,n,r=0;function i(){var e="",i=Math.floor(.001*(Date.now()-1459707606518));return i===n?t++:(t=0,n=i),e+=xn(wn.lookup,6),e+=xn(wn.lookup,r),t>0&&(e+=xn(wn.lookup,t)),e+=xn(wn.lookup,i)}e.exports=i,e.exports.generate=i,e.exports.seed=function(t){return wn.seed(t),e.exports},e.exports.worker=function(t){return r=t,e.exports},e.exports.characters=function(e){return void 0!==e&&wn.characters(e),wn.shuffled()},e.exports.decode=_n,e.exports.isValid=In})),Sn=(Cn.generate,Cn.seed,Cn.worker,Cn.characters,Cn.decode,Cn.isValid,Cn);function En(e,t,n,r,i){null==e&&(e="global"),r=r||["success"],i=i||["error"];var o,a=!1,s=!1,c=!1,u=en();t.disconnected((function(){c=!1,n.debug("connection is down"),a=!1,s=!0,u.execute("onLeft",{disconnected:!0})})),t.loggedIn((function(){c=!0,s&&(n.debug("connection is now up - trying to reconnect..."),l(o))})),t.on("success",(function(e){return h(e)})),t.on("error",(function(e){return p(e)})),t.on("result",(function(e){return h(e)})),r&&r.forEach((function(e){t.on(e,(function(e){return h(e)}))})),i&&i.forEach((function(e){t.on(e,(function(e){return p(e)}))}));var d={};function l(t){return o=t,new Promise((function(r,i){if(a)r();else{var o;if("global"===e)o=c?Promise.resolve({}):Promise.reject("not connected to gateway");else n.debug("joining domain "+e),o=m({type:"join",destination:e,domain:"global",options:t});o.then((function(){!function(){n.debug("did join "+e),a=!0;var t=s;s=!1,u.execute("onJoined",t)}(),r()})).catch((function(t){n.debug("error joining "+e+" domain: "+JSON.stringify(t)),i(t)}))}}))}function p(t){if(e===t.domain){var n=t.request_id;if(n){var r=d[n];r&&r.error(t)}}}function h(t){if(t.domain===e){var n=t.request_id;if(n){var r=d[n];r&&r.success(t)}}}function f(){return Sn()}function m(r,i,o){o=o||{},r.request_id=r.request_id||f(),r.domain=r.domain||e,o.skipPeerId||(r.peer_id=t.peerId);var a=r.request_id;return new Promise((function(e,s){d[a]={success:function(t){delete d[a],t._tag=i,e(t)},error:function(e){n.warn("GW error - "+JSON.stringify(e)+" for request "+JSON.stringify(r)),delete d[a],e._tag=i,s(e)}},t.send(r,o).catch((function(e){d[a].error({err:e})}))}))}return{join:l,leave:function(){return"global"===e?Promise.resolve():(n.debug("stopping session "+e+"..."),s=!1,m({type:"leave",destination:e,domain:"global"}).then((function(){a=!1,u.execute("onLeft")})))},onJoined:function(e){return a&&e(!1),u.add("onJoined",e)},onLeft:function(e){return a||e(),u.add("onLeft",e)},send:m,sendFireAndForget:function(n){return n.request_id=n.request_id?n.request_id:f(),n.domain=n.domain||e,n.peer_id=t.peerId,t.send(n)},on:function(r,i){t.on(r,(function(t){if(t.domain===e)try{i(t)}catch(r){n.error("Callback failed: "+r+" \n "+r.stack+" \n msg was: "+JSON.stringify(t),r)}}))},loggedIn:function(e){return t.loggedIn(e)},connected:function(e){return t.connected(e)},disconnected:function(e){return t.disconnected(e)},get peerId(){return t.peerId},get domain(){return e}}}var Wn=function(){function e(e,t,n){var r=this;this.connection=e,this.settings=t,this.logger=n,this.protocolVersion=3,this.datePrefix="#T42_DATE#",this.datePrefixLen=this.datePrefix.length,this.dateMinLen=this.datePrefixLen+1,this.datePrefixFirstChar=this.datePrefix[0],this.registry=en(),this._isLoggedIn=!1,this.shouldTryLogin=!0,this.initialLogin=!0,this.initialLoginAttempts=3,this.sessions=[],e.disconnected((function(){r.handleDisconnected()})),this.ping()}return Object.defineProperty(e.prototype,"isLoggedIn",{get:function(){return this._isLoggedIn},enumerable:!0,configurable:!0}),e.prototype.processStringMessage=function(e){var t=this,n=JSON.parse(e,(function(e,n){if("string"!==typeof n)return n;if(n.length<t.dateMinLen)return n;if(n[0]!==t.datePrefixFirstChar)return n;if(n.substring(0,t.datePrefixLen)!==t.datePrefix)return n;try{var r=parseInt(n.substring(t.datePrefixLen,n.length),10);return isNaN(r)?n:new Date(r)}catch(i){return n}}));return{msg:n,msgType:n.type}},e.prototype.createStringMessage=function(e){var t=Date.prototype.toJSON;try{var n=this.datePrefix;return Date.prototype.toJSON=function(){return n+this.getTime()},JSON.stringify(e)}finally{Date.prototype.toJSON=t}},e.prototype.processObjectMessage=function(e){if(!e.type)throw new Error("Object should have type property");return{msg:e,msgType:e.type}},e.prototype.createObjectMessage=function(e){return e},e.prototype.login=function(e,t){return St(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,d,l,p;return Et(this,(function(h){switch(h.label){case 0:if(this.logger.debug("logging in..."),this.loginConfig=e,this.loginConfig||(this.loginConfig={username:"",password:""}),this.shouldTryLogin=!0,n={},this.connection.gatewayToken=e.gatewayToken,!e.gatewayToken)return[3,5];if(!t)return[3,4];h.label=1;case 1:return h.trys.push([1,3,,4]),[4,this.getNewGWToken()];case 2:return d=h.sent(),e.gatewayToken=d,[3,4];case 3:return i=h.sent(),this.logger.warn("failed to get GW token when reconnecting "+((null===i||void 0===i?void 0:i.message)||i)),[3,4];case 4:return n.method="gateway-token",n.token=e.gatewayToken,this.connection.gatewayToken=e.gatewayToken,[3,10];case 5:return"sspi"!==e.flowName?[3,9]:(n.provider="win",n.method="access-token",e.flowCallback&&e.sessionId?(o=n,[4,e.flowCallback(e.sessionId,null)]):[3,7]);case 6:return o.token=h.sent().data.toString("base64"),[3,8];case 7:throw new Error("Invalid SSPI config");case 8:return[3,10];case 9:if(e.token)n.method="access-token",n.token=e.token;else{if(!e.username)throw new Error("invalid auth message"+JSON.stringify(e));n.method="secret",n.login=e.username,n.secret=e.password}h.label=10;case 10:a={type:"hello",identity:this.settings.identity,authentication:n},e.sessionId&&(a.request_id=e.sessionId),this.globalDomain=En("global",this.connection,this.logger.subLogger("global-domain"),["welcome","token","authentication-request"]),s={skipPeerId:!0},this.initialLogin&&(s.retryInterval=this.settings.reconnectInterval,s.maxRetries=this.settings.reconnectAttempts),h.label=11;case 11:h.trys.push([11,19,20,21]),c=void 0,h.label=12;case 12:return[4,this.globalDomain.send(a,void 0,s)];case 13:return"authentication-request"!==(u=h.sent()).type?[3,16]:(d=r.from(u.authentication.token,"base64"),e.flowCallback&&e.sessionId?(l=a.authentication,[4,e.flowCallback(e.sessionId,d)]):[3,15]);case 14:l.token=h.sent().data.toString("base64"),h.label=15;case 15:return a.request_id=e.sessionId,[3,12];case 16:if("welcome"===u.type)return c=u,[3,18];throw"error"===u.type?new Error("Authentication failed: "+u.reason):new Error("Unexpected message type during authentication: "+u.type);case 17:return[3,12];case 18:return this.initialLogin=!1,this.logger.debug("login successful with peerId "+c.peer_id),this.connection.peerId=c.peer_id,this.connection.resolvedIdentity=c.resolved_identity,this.connection.availableDomains=c.available_domains,c.options&&(this.connection.token=c.options.access_token,this.connection.info=c.options.info),this.setLoggedIn(!0),[2,c.resolved_identity];case 19:throw p=h.sent(),this.logger.error("error sending hello message - "+(p.message||p.msg||p.reason||p),p),p;case 20:return e&&e.flowCallback&&e.sessionId&&e.flowCallback(e.sessionId,null),[7];case 21:return[2]}}))}))},e.prototype.logout=function(){return St(this,void 0,void 0,(function(){var e;return Et(this,(function(t){switch(t.label){case 0:return this.logger.debug("logging out..."),this.shouldTryLogin=!1,this.pingTimer&&clearTimeout(this.pingTimer),e=this.sessions.map((function(e){e.leave()})),[4,Promise.all(e)];case 1:return t.sent(),[2]}}))}))},e.prototype.loggedIn=function(e){return this._isLoggedIn&&e(),this.registry.add("onLoggedIn",e)},e.prototype.domain=function(e,t,n,r){var i=this.sessions.filter((function(t){return t.domain===e}))[0];return i||(i=En(e,this.connection,t,n,r),this.sessions.push(i)),i},e.prototype.handleDisconnected=function(){var e=this;if(this.setLoggedIn(!1),this.shouldTryLogin&&this.initialLogin){if(this.initialLoginAttempts<=0)return;this.initialLoginAttempts--}if(this.logger.debug("disconnected - will try new login?"+this.shouldTryLogin),this.shouldTryLogin){if(!this.loginConfig)throw new Error("no login info");this.connection.login(this.loginConfig,!0).catch((function(){setTimeout(e.handleDisconnected.bind(e),e.settings.reconnectInterval||1e3)}))}},e.prototype.setLoggedIn=function(e){this._isLoggedIn=e,this._isLoggedIn&&this.registry.execute("onLoggedIn")},e.prototype.ping=function(){var e=this;this.shouldTryLogin&&(this._isLoggedIn&&this.connection.send({type:"ping"}),this.pingTimer=setTimeout((function(){e.ping()}),3e4))},e.prototype.authToken=function(){return this.globalDomain?this.globalDomain.send({type:"create-token"}).then((function(e){return e.token})):Promise.reject(new Error("no global domain session"))},e.prototype.getNewGWToken=function(){if(void 0!==typeof window){var e=window.glue42gd;if(e)return e.getGWToken()}return Promise.reject(new Error("not running in GD"))},e}(),Tn=function(){function e(e){this.specsNames=[],this.messages={},this.subs={},this.subsRefCount={},this.specs={};for(var t=0,n=e;t<n.length;t++){var r=n[t];this.specs[r.name]=r,this.specsNames.push(r.name)}}return e.prototype.init=function(e){var t=this;this.connection=e;for(var n=0,r=this.specsNames;n<r.length;n++)for(var i=r[n],o=function(n){var r=a.subsRefCount[n];if(r||(r=0),r+=1,a.subsRefCount[n]=r,r>1)return"continue";var i=e.on(n,(function(e){return t.processMessage(n,e)}));a.subs[n]=i},a=this,s=0,c=this.specs[i].types;s<c.length;s++){o(c[s])}},e.prototype.processMessage=function(e,t){if(!this.isDone&&t)for(var n=0,r=this.specsNames;n<r.length;n++){var i=r[n];if(-1!==this.specs[i].types.indexOf(e)){var o=this.messages[i]||[];this.messages[i]=o,o.push(t)}}},e.prototype.drain=function(e,t){var n;t&&(this.messages[e]||[]).forEach(t),delete this.messages[e];for(var r=0,i=this.specs[e].types;r<i.length;r++){var o=i[r];this.subsRefCount[o]-=1,this.subsRefCount[o]<=0&&(null===(n=this.connection)||void 0===n||n.off(this.subs[o]),delete this.subs[o],delete this.subsRefCount[o])}delete this.specs[e],this.specs.length||(this.isDone=!0)},e}(),An=function(e,t,n){return new Promise((function(r,i){var o=setTimeout((function(){i(n||"Promise timeout hit: "+t)}),t);new Promise(e).then((function(e){clearTimeout(o),r(e)})).catch((function(e){clearTimeout(o),i(e)}))}))},Pn=function(){function e(e,t,n){this.settings=e,this.logger=t,this.identity=n,this.parentReady=!1,this.iAmConnected=!1,this.rejected=!1,this.children=[],this.parentPingTimeout=3e3,this.connectionRequestTimeout=5e3,this.defaultTargetString="*",this.registry=en(),this.messages={connectionAccepted:{name:"connectionAccepted",handle:this.handleConnectionAccepted.bind(this)},connectionRejected:{name:"connectionRejected",handle:this.handleConnectionRejected.bind(this)},connectionRequest:{name:"connectionRequest",handle:this.handleConnectionRequest.bind(this)},parentReady:{name:"parentReady",handle:this.handleParentReady.bind(this)},parentPing:{name:"parentPing",handle:this.handleParentPing.bind(this)},platformPing:{name:"platformPing",handle:this.handlePlatformPing.bind(this)},platformUnload:{name:"platformUnload",handle:this.handlePlatformUnload.bind(this)},platformReady:{name:"platformReady",handle:this.handlePlatformReady.bind(this)},clientUnload:{name:"clientUnload",handle:this.handleClientUnload.bind(this)}},this.setUpMessageListener(),this.setUpUnload(),this.settings.port||(this.parent=window.opener||window.top,this.parentType=window.opener?"opener":-1!==window.name.indexOf("#wsp")?"workspace":"top")}return Object.defineProperty(e.prototype,"transportWindowId",{get:function(){return this.publicWindowId},enumerable:!0,configurable:!0}),e.prototype.sendObject=function(e){return St(this,void 0,void 0,(function(){return Et(this,(function(t){if(!this.port)throw new Error("Cannot send message, because the port was not opened yet");return this.port.postMessage(e),[2]}))}))},Object.defineProperty(e.prototype,"isObjectBasedTransport",{get:function(){return!0},enumerable:!0,configurable:!0}),e.prototype.onMessage=function(e){return this.registry.add("onMessage",e)},e.prototype.send=function(){return Promise.reject("not supported")},e.prototype.onConnectedChanged=function(e){return this.registry.add("onConnectedChanged",e)},e.prototype.open=function(){return St(this,void 0,void 0,(function(){return Et(this,(function(e){switch(e.label){case 0:return this.logger.debug("opening a connection to the web platform gateway."),[4,this.connect()];case 1:return e.sent(),this.notifyStatusChanged(!0),[2]}}))}))},e.prototype.close=function(){return Promise.resolve()},e.prototype.name=function(){return"web-platform"},e.prototype.reconnect=function(){return Promise.resolve()},e.prototype.connect=function(){return St(this,void 0,void 0,(function(){var e=this;return Et(this,(function(t){switch(t.label){case 0:if(this.parentReady)return this.logger.debug("cancelling connection attempt, because this client's parent has already given a ready signal"),[2];if(this.settings.port)return this.logger.debug("opening an internal web platform connection"),this.port=this.settings.port,this.publicWindowId=this.settings.windowId,this.identity&&(this.identity.windowId=this.publicWindowId),this.port.onmessage=function(t){return e.registry.execute("onMessage",t.data)},this.logger.debug("internal web platform connection completed"),[2];if(!this.parentType||!this.parent)throw new Error("Cannot initiate a connection, because there is no opener, no top and no port.");return this.logger.debug("opening a "+("opener"===this.parentType?"child":"grandchild")+" client web platform connection"),[4,this.waitParent(this.parent,this.parentType)];case 1:return t.sent(),[4,this.initiateRemoteConnection(this.parent,this.parentType)];case 2:return t.sent(),this.logger.debug("the "+("opener"===this.parentType?"child":"grandchild")+" client is connected"),[2]}}))}))},e.prototype.initiateRemoteConnection=function(e,t){var n=this;return An((function(r,i){n.connectionResolve=r,n.connectionReject=i,n.myClientId=Sn();var o="workspace"===n.parentType?window.name.substring(0,window.name.indexOf("#wsp")):window.name,a={glue42core:{type:n.messages.connectionRequest.name,clientId:n.myClientId,clientType:"top"===t||"workspace"===t?"grandChild":"child",bridgeInstanceId:o}};n.logger.debug("sending connection request to "+t),e.postMessage(a,n.defaultTargetString)}),this.connectionRequestTimeout,"The connection to the opener/top window timed out")},e.prototype.waitParent=function(e,t){var n=this;return An((function(r){n.parentPingResolve=r;var i={glue42core:{type:"opener"===t?n.messages.platformPing.name:n.messages.parentPing.name}};n.logger.debug("checking for "+t+" window availability"),e.postMessage(i,n.defaultTargetString)}),this.parentPingTimeout,"Cannot initiate glue, because this window was not opened or created by a glue client")},e.prototype.setUpMessageListener=function(){var e=this;this.settings.port?this.logger.debug("skipping generic message listener, because this is an internal client"):window.addEventListener("message",(function(t){var n,r=null===(n=t.data)||void 0===n?void 0:n.glue42core;if(r&&!e.rejected)if(e.checkMessageTypeValid(r.type)){var i=r.type;e.logger.debug("received valid glue42core message of type: "+i),e.messages[i].handle(t)}else e.logger.error("cannot handle the incoming glue42 core message, because the type is invalid: "+r.type)}))},e.prototype.setUpUnload=function(){var e=this;this.settings.port?this.logger.debug("skipping unload event listener, because this is an internal client"):window.addEventListener("beforeunload",(function(){var t,n,r={glue42core:{type:e.messages.clientUnload.name,data:{clientId:e.myClientId,ownWindowId:null===(t=e.identity)||void 0===t?void 0:t.windowId}}};e.parent&&e.parent.postMessage(r,e.defaultTargetString),null===(n=e.port)||void 0===n||n.postMessage(r)}))},e.prototype.handleParentReady=function(){if(this.logger.debug("handling the ready signal from the parent, by resoling the pending promise."),this.parentReady=!0,this.parentPingResolve)return this.parentPingResolve(),void delete this.parentPingResolve;this.logger.debug("silently handling the ready signal from the top parent, because there is no defined promise")},e.prototype.handlePlatformReady=function(){if(this.logger.debug("the web platform gave the ready signal"),this.parentReady=!0,this.parentPingResolve)return this.parentPingResolve(),void delete this.parentPingResolve;this.logger.debug("silently handling the ready signal from the top parent, because there is no defined promise")},e.prototype.handleConnectionAccepted=function(e){var t,n=null===(t=e.data)||void 0===t?void 0:t.glue42core;return this.myClientId===n.clientId?this.handleAcceptanceOfMyRequest(n):this.handleAcceptanceOfGrandChildRequest(n,e)},e.prototype.handleAcceptanceOfMyRequest=function(e){var t=this;if(this.logger.debug("handling a connection accepted signal targeted at me."),e.port){if(this.publicWindowId="opener"===this.parentType?window.name:"top"===this.parentType?e.parentWindowId:window.name.substring(0,window.name.indexOf("#wsp")),this.identity&&"top"!==this.parentType&&(this.identity.windowId=this.publicWindowId),this.identity&&e.appName&&(this.identity.application=e.appName,this.identity.applicationName=e.appName),this.port=e.port,this.port.onmessage=function(e){return t.registry.execute("onMessage",e.data)},this.connectionResolve)return this.logger.debug("my connection is set up, calling the connection resolve."),this.connectionResolve(),void delete this.connectionResolve;this.logger.error("unable to call the connection resolve, because no connection promise was found")}else this.logger.error("cannot set up my connection, because I was not provided with a port")},e.prototype.handleAcceptanceOfGrandChildRequest=function(e,t){this.logger.debug("handling a connection accepted signal targeted at a grandchild: "+e.clientId);var n=this.children.find((function(t){return t.grandChildId===e.clientId}));n?(n.connected=!0,this.logger.debug("the grandchild connection for "+e.clientId+" is set up, forwarding the success message and the gateway port"),e.parentWindowId=this.publicWindowId,n.source.postMessage(t.data,n.origin,[e.port])):this.logger.error("cannot handle connection accepted for grandchild: "+e.clientId+", because there is no grandchild with this id")},e.prototype.handleConnectionRejected=function(){this.logger.debug("handling a connection rejection. Most likely the reason is that this window was not created by a glue API call"),this.connectionReject&&(this.connectionReject("The platform connection was rejected. Most likely because this window was not created by a glue API call"),delete this.connectionReject)},e.prototype.handleConnectionRequest=function(e){var t=e.source,n=e.data.glue42core;return n.clientType&&"grandChild"===n.clientType?n.clientId?"opener"===this.parentType&&this.parent?(this.logger.debug("handling a connection request for a grandchild: "+n.clientId),this.children.push({grandChildId:n.clientId,source:t,connected:!1,origin:e.origin}),this.logger.debug("grandchild: "+n.clientId+" is prepared, forwarding connection request to the platform"),void this.parent.postMessage(e.data,this.defaultTargetString)):this.rejectConnectionRequest(t,e.origin,"Cannot forward the connection request, because no direct connection to the platform was found"):this.rejectConnectionRequest(t,e.origin,"rejecting a connection request, because the source did not provide a valid id"):this.rejectConnectionRequest(t,e.origin,"rejecting a connection request, because the source was not opened by a glue API call")},e.prototype.handleParentPing=function(e){if(this.parentReady)if(this.iAmConnected){var t={glue42core:{type:this.messages.parentReady.name}},n=e.source;this.logger.debug("responding to a parent ping with a ready message"),n.postMessage(t,e.origin)}else this.logger.debug("i am not fully connected yet, I am ignoring the parent ping");else this.logger.debug("my parent is not ready, I am ignoring the parent ping")},e.prototype.handlePlatformUnload=function(e){this.logger.debug("detected a web platform unload"),this.parentReady=!1,this.children.length&&(this.logger.debug("forwarding the platform unload to all known children and starting platform discovery polling"),this.children.forEach((function(t){return t.source.postMessage(e.data,t.origin)}))),this.notifyStatusChanged(!1,"Gateway unloaded")},e.prototype.handleClientUnload=function(e){var t=e.data.glue42core;t.clientId?this.children.find((function(e){return e.grandChildId===t.clientId}))?(this.logger.debug("handling grandchild unload for id: "+t.clientId),this.children=this.children.filter((function(e){return e.grandChildId!==t.clientId}))):this.logger.warn("cannot process grand child unload, because this client is unaware of this grandchild"):this.logger.warn("cannot process grand child unload, because the provided id was not valid")},e.prototype.handlePlatformPing=function(){this.logger.error("cannot handle platform ping, because this is not a platform calls handling component")},e.prototype.notifyStatusChanged=function(e,t){this.iAmConnected=e,this.registry.execute("onConnectedChanged",e,t)},e.prototype.checkMessageTypeValid=function(e){return"string"===typeof e&&!!this.messages[e]},e.prototype.rejectConnectionRequest=function(e,t,n){this.rejected=!0,this.logger.error(n);var r={glue42core:{type:this.messages.connectionRejected.name}};e.postMessage(r,t)},e}(),Mn=function(){function e(e,t){if(this.settings=e,this.logger=t,this.messageHandlers={},this.ids=1,this.registry=en(),this._connected=!1,this.isTrace=!1,(e=e||{}).reconnectAttempts=e.reconnectAttempts||10,e.reconnectInterval=e.reconnectInterval||1e3,e.inproc)this.transport=new tn(e.inproc,t.subLogger("inMemory"));else if(e.sharedWorker)this.transport=new nn(e.sharedWorker,t.subLogger("shared-worker"));else if(e.webPlatform)this.transport=new Pn(e.webPlatform,t.subLogger("web-platform"),e.identity);else{if(void 0===e.ws)throw new Error("No connection information specified");this.transport=new un(e,t.subLogger("ws"))}this.isTrace=t.canPublish("trace"),t.debug("starting with "+this.transport.name()+" transport"),this.protocol=new Wn(this,e,t.subLogger("protocol")),this.transport.onConnectedChanged(this.handleConnectionChanged.bind(this)),this.transport.onMessage(this.handleTransportMessage.bind(this)),e.replaySpecs&&e.replaySpecs.length&&(this.replayer=new Tn(e.replaySpecs),this.replayer.init(this))}return Object.defineProperty(e.prototype,"protocolVersion",{get:function(){var e;return null===(e=this.protocol)||void 0===e?void 0:e.protocolVersion},enumerable:!0,configurable:!0}),e.prototype.send=function(e,t){if(this.transport.sendObject&&this.transport.isObjectBasedTransport){var n=this.protocol.createObjectMessage(e);return this.isTrace&&this.logger.trace(">> "+JSON.stringify(n)),this.transport.sendObject(n,t)}var r=this.protocol.createStringMessage(e);return this.isTrace&&this.logger.trace(">> "+r),this.transport.send(r,t)},e.prototype.on=function(e,t){e=e.toLowerCase(),void 0===this.messageHandlers[e]&&(this.messageHandlers[e]={});var n=this.ids++;return this.messageHandlers[e][n]=t,{type:e,id:n}},e.prototype.off=function(e){delete this.messageHandlers[e.type.toLowerCase()][e.id]},Object.defineProperty(e.prototype,"isConnected",{get:function(){return this.protocol.isLoggedIn},enumerable:!0,configurable:!0}),e.prototype.connected=function(e){var t=this;return this.protocol.loggedIn((function(){e(t.settings.ws||t.settings.sharedWorker||"")}))},e.prototype.disconnected=function(e){return this.registry.add("disconnected",e)},e.prototype.login=function(e,t){return St(this,void 0,void 0,(function(){var n;return Et(this,(function(r){switch(r.label){case 0:return[4,this.transport.open()];case 1:return r.sent(),sn("connection").mark("transport-opened"),n=this.protocol.login(e,t),sn("connection").mark("protocol-logged-in"),[2,n]}}))}))},e.prototype.logout=function(){return St(this,void 0,void 0,(function(){return Et(this,(function(e){switch(e.label){case 0:return[4,this.protocol.logout()];case 1:return e.sent(),[4,this.transport.close()];case 2:return e.sent(),[2]}}))}))},e.prototype.loggedIn=function(e){return this.protocol.loggedIn(e)},e.prototype.domain=function(e,t,n){return this.protocol.domain(e,this.logger.subLogger("domain="+e),t,n)},e.prototype.authToken=function(){return this.protocol.authToken()},e.prototype.reconnect=function(){return this.transport.reconnect()},e.prototype.distributeMessage=function(e,t){var n=this,r=this.messageHandlers[t.toLowerCase()];void 0!==r&&Object.keys(r).forEach((function(t){var i=r[t];if(void 0!==i)try{i(e)}catch(o){try{n.logger.error("Message handler failed with "+o.stack,o)}catch(a){console.log("Message handler failed",o)}}}))},e.prototype.handleConnectionChanged=function(e){this._connected!==e&&(this._connected=e,e?this.registry.execute("connected"):this.registry.execute("disconnected"))},e.prototype.handleTransportMessage=function(e){var t;t="string"===typeof e?this.protocol.processStringMessage(e):this.protocol.processObjectMessage(e),this.isTrace&&this.logger.trace("<< "+JSON.stringify(t)),this.distributeMessage(t.msg,t.msgType)},e}(),On=["trace","debug","info","warn","error","off"],jn=function(){function e(e,t,n){this.name=e,this.parent=t,this.subLoggers=[],this.logFn=console,this.customLogFn=!1,this.name=e,this.path=t?t.path+"."+e:e,this.loggerFullName="["+this.path+"]",this.includeTimeAndLevel=!n,n&&(this.logFn=n,this.customLogFn=!0)}return e.prototype.subLogger=function(t){var n=this.subLoggers.filter((function(e){return e.name===t}))[0];if(void 0!==n)return n;Object.keys(this).forEach((function(e){if(e===t)throw new Error("This sub logger name is not allowed.")}));var r=new e(t,this,this.customLogFn?this.logFn:void 0);return this.subLoggers.push(r),r},e.prototype.publishLevel=function(e){var t;return e&&(this._publishLevel=e),this._publishLevel||(null===(t=this.parent)||void 0===t?void 0:t.publishLevel())},e.prototype.consoleLevel=function(e){var t;return e&&(this._consoleLevel=e),this._consoleLevel||(null===(t=this.parent)||void 0===t?void 0:t.consoleLevel())},e.prototype.log=function(e,t,n){this.publishMessage(t||"info",e,n)},e.prototype.trace=function(e){this.log(e,"trace")},e.prototype.debug=function(e){this.log(e,"debug")},e.prototype.info=function(e){this.log(e,"info")},e.prototype.warn=function(e){this.log(e,"warn")},e.prototype.error=function(e,t){this.log(e,"error")},e.prototype.canPublish=function(e,t){return On.indexOf(e)>=On.indexOf(t||this.consoleLevel()||"trace")},e.prototype.publishMessage=function(t,n,r){var i=this.loggerFullName;if("error"===t&&!r){var o=new Error;o.stack&&(n=n+"\n"+o.stack.split("\n").slice(3).join("\n"))}if(this.canPublish(t,this.publishLevel())){var a=e.Interop;if(a)try{a.methods({name:e.InteropMethodName}).length>0&&a.invoke(e.InteropMethodName,{msg:""+n,logger:i,level:t})}catch(d){}}if(this.canPublish(t)){var s="";if(this.includeTimeAndLevel){var c=new Date;s="["+(c.getHours()+":"+c.getMinutes()+":"+c.getSeconds()+":"+c.getMilliseconds())+"] ["+t+"] "}var u=""+s+i+": "+n;switch(t){case"trace":this.logFn.debug(u);break;case"debug":this.logFn.debug?this.logFn.debug(u):this.logFn.log(u);break;case"info":this.logFn.info(u);break;case"warn":this.logFn.warn(u);break;case"error":this.logFn.error(u,r)}}},e.InteropMethodName="T42.AppLogger.Log",e}(),Dn="create-context",Ln="created",Nn="destroyed",Rn="context-created",Fn="context-added",Bn="subscribe-context",zn="subscribed-context",Hn="unsubscribe-context",qn="destroy-context",$n="context-destroyed",Un="update-context",Gn="context-updated",Vn="joined",Jn={get name(){return"context"},get types(){return[Dn,Ln,Nn,Rn,Fn,Bn,zn,Hn,qn,$n,Un,Gn,Vn]}},Kn="5.4.0";var Xn=function(){function e(e,t,n,r){this.updateCallbacks={},this.contextId=e,this.name=t,this.isAnnounced=n,this.activityId=r,this.context={}}return e.prototype.hasCallbacks=function(){return Object.keys(this.updateCallbacks).length>0},e.prototype.getState=function(){return this.isAnnounced&&this.hasCallbacks()?3:this.isAnnounced?2:this.hasCallbacks()?1:0},e}();function Yn(e,t,n){try{if((null===n||void 0===n?void 0:n.canPublish("trace"))&&(null===n||void 0===n||n.trace("applying context delta "+JSON.stringify(t)+" on context "+JSON.stringify(e))),!t)return e;if(t.reset)return e=Ct({},t.reset);if(e=Zn(e,void 0),t.commands){for(var r=0,i=t.commands;r<i.length;r++){var o=i[r];"remove"===o.type?rr(e,o.path):"set"===o.type&&tr(e,o.value,o.path)}return e}var a=t.added,s=t.updated,c=t.removed;return a&&Object.keys(a).forEach((function(t){e[t]=a[t]})),s&&Object.keys(s).forEach((function(t){Qn(t,e,s)})),c&&c.forEach((function(t){delete e[t]})),e}catch(u){return null===n||void 0===n||n.error("error applying context delta "+JSON.stringify(t)+" on context "+JSON.stringify(e),u),e}}function Zn(e,t){if(t=t||new WeakMap,Object(e)!==e)return e;if(e instanceof Set)return new Set(e);if(t.has(e))return t.get(e);var n=e instanceof Date?new Date(e):e instanceof RegExp?new RegExp(e.source,e.flags):e.constructor?new e.constructor:Object.create(null);return t.set(e,n),Object.assign.apply(Object,Wt([n],Object.keys(e).map((function(n){var r;return(r={})[n]=Zn(e[n],t),r}))))}var Qn=function(e,t,n){var r=n[e];if(void 0===r)return t;var i=t[e];return i&&r?"string"===typeof i||"number"===typeof i||"boolean"===typeof i||"string"===typeof r||"number"===typeof r||"boolean"===typeof r||Array.isArray(i)||Array.isArray(r)?(t[e]=r,t):(t[e]=Object.assign({},i,r),t):(t[e]=r,t)};function er(e,t){if(e===t)return!0;if(!(e instanceof Object)||!(t instanceof Object))return!1;if(e.constructor!==t.constructor)return!1;for(var n in e)if(e.hasOwnProperty(n)){if(!t.hasOwnProperty(n))return!1;if(e[n]!==t[n]){if("object"!==typeof e[n])return!1;if(!er(e[n],t[n]))return!1}}for(var n in t)if(t.hasOwnProperty(n)&&!e.hasOwnProperty(n))return!1;return!0}function tr(e,t,n){var r,i=n.split(".");for(r=0;r<i.length-1;r++)e[i[r]]||(e[i[r]]={}),"object"!==typeof e[i[r]]&&(e[i[r]]={}),e=e[i[r]];e[i[r]]=t}function nr(e,t){return Object.keys(t).every((function(n){return"object"===typeof t[n]?nr((null===e||void 0===e?void 0:e[n])||{},t[n]||{}):t[n]===(null===e||void 0===e?void 0:e[n])}))}function rr(e,t){var n,r=t.split(".");for(n=0;n<r.length-1;n++){if(!e[r[n]])return;e=e[r[n]]}delete e[r[n]]}var ir,or=function(){function e(e){var t,n=this;this._contextNameToData={},this._gw3Subscriptions=[],this._nextCallbackSubscriptionNumber=0,this._contextNameToId={},this._contextIdToName={},this._protocolVersion=void 0,this._connection=e.connection,this._logger=e.logger,this._gw3Session=this._connection.domain("global",[Rn,zn,$n,Gn]),this.subscribeToContextCreatedMessages(),this.subscribeToContextUpdatedMessages(),this.subscribeToContextDestroyedMessages(),null===(t=this._connection.replayer)||void 0===t||t.drain(Jn.name,(function(e){var t=e.type;t&&(t===Rn||t===Fn||t===Ln?n.handleContextCreatedMessage(e):t===zn||t===Gn||t===Vn?n.handleContextUpdatedMessage(e):t!==$n&&t!==Nn||n.handleContextDestroyedMessage(e))}))}return Object.defineProperty(e.prototype,"protocolVersion",{get:function(){var e;if(!this._protocolVersion){var t=this._connection.availableDomains.find((function(e){return"context"===e.uri}));this._protocolVersion=null!==(e=null===t||void 0===t?void 0:t.version)&&void 0!==e?e:1}return this._protocolVersion},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"setPathSupported",{get:function(){return this.protocolVersion>=2},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){for(var e=0,t=this._gw3Subscriptions;e<t.length;e++){var n=t[e];this._connection.off(n)}for(var r in this._gw3Subscriptions.length=0,this._contextNameToData)this._contextNameToId.hasOwnProperty(r)&&delete this._contextNameToData[r]},e.prototype.createContext=function(e,t){var n=this;return this._gw3Session.send({type:Dn,domain:"global",name:e,data:t,lifetime:"retained"}).then((function(r){n._contextNameToId[e]=r.context_id,n._contextIdToName[r.context_id]=e;var i=n._contextNameToData[e]||new Xn(r.context_id,e,!0,void 0);return i.isAnnounced=!0,i.name=e,i.contextId=r.context_id,i.context=t,n._contextNameToData[e]=i,r.context_id}))},e.prototype.all=function(){var e=this;return Object.keys(this._contextNameToData).filter((function(t){return e._contextNameToData[t].isAnnounced}))},e.prototype.update=function(e,t){var n;return St(this,void 0,void 0,(function(){var r,i,o,a=this;return Et(this,(function(s){switch(s.label){case 0:return(r=this._contextNameToData[e])&&r.isAnnounced?(i=r.context,r.hasCallbacks()?[3,2]:[4,this.get(r.name)]):[2,this.createContext(e,t)];case 1:i=s.sent(),s.label=2;case 2:return o=2===this.protocolVersion?this.calculateContextDeltaV2(i,t):this.calculateContextDeltaV1(i,t),Object.keys(o.added).length||Object.keys(o.updated).length||o.removed.length||(null===(n=o.commands)||void 0===n?void 0:n.length)?[2,this._gw3Session.send({type:Un,domain:"global",context_id:r.contextId,delta:o},{},{skipPeerId:!1}).then((function(e){a.handleUpdated(r,o,{updaterId:e.peer_id})}))]:[2,Promise.resolve()]}}))}))},e.prototype.set=function(e,t){var n=this,r=this._contextNameToData[e];return r&&r.isAnnounced?this._gw3Session.send({type:Un,domain:"global",context_id:r.contextId,delta:{reset:t}},{},{skipPeerId:!1}).then((function(e){n.handleUpdated(r,{reset:t,added:{},removed:[],updated:{}},{updaterId:e.peer_id})})):this.createContext(e,t)},e.prototype.setPath=function(e,t,n){return this.setPathSupported?this.setPaths(e,[{path:t,value:n}]):Promise.reject("glue.contexts.setPath operation is not supported, use Glue42 3.10 or later")},e.prototype.setPaths=function(e,t){var n=this;if(!this.setPathSupported)return Promise.reject("glue.contexts.setPaths operation is not supported, use Glue42 3.10 or later");var r=this._contextNameToData[e];if(!r||!r.isAnnounced){for(var i={},o=0,a=t;o<a.length;o++){tr(i,(d=a[o]).value,d.path)}return this.createContext(e,i)}for(var s=[],c=0,u=t;c<u.length;c++){var d;null===(d=u[c]).value?s.push({type:"remove",path:d.path}):s.push({type:"set",path:d.path,value:d.value})}return this._gw3Session.send({type:Un,domain:"global",context_id:r.contextId,delta:{commands:s}},{},{skipPeerId:!1}).then((function(e){n.handleUpdated(r,{added:{},removed:[],updated:{},commands:s},{updaterId:e.peer_id})}))},e.prototype.get=function(e){var t,n=this,r=this._contextNameToData[e];if(!r||!r.isAnnounced)return Promise.resolve({});if(r&&!r.hasCallbacks())return new Promise((function(t,r){return St(n,void 0,void 0,(function(){var n=this;return Et(this,(function(r){return this.subscribe(e,(function(e,r,i,o){n.unsubscribe(o),t(e)})),[2]}))}))}));var i=null!==(t=null===r||void 0===r?void 0:r.context)&&void 0!==t?t:{};return Promise.resolve(i)},e.prototype.subscribe=function(e,t){var n=this._nextCallbackSubscriptionNumber;this._nextCallbackSubscriptionNumber+=1;var r=this._contextNameToData[e];if(!r||!r.isAnnounced)return r=r||new Xn(void 0,e,!1,void 0),this._contextNameToData[e]=r,r.updateCallbacks[n]=t,Promise.resolve(n);var i,o=r.hasCallbacks();return r.updateCallbacks[n]=t,o||r.joinedActivity||r.context&&r.sentExplicitSubscription?(t(i=Zn(r.context),i,[],n),Promise.resolve(n)):this.sendSubscribe(r).then((function(){return n}))},e.prototype.unsubscribe=function(e){for(var t=0,n=Object.keys(this._contextNameToData);t<n.length;t++){var r=n[t],i=(this._contextNameToId[r],this._contextNameToData[r]);if(!i)return;var o=i.hasCallbacks();delete i.updateCallbacks[e],i.isAnnounced&&o&&!i.hasCallbacks()&&i.sentExplicitSubscription&&this.sendUnsubscribe(i),i.isAnnounced||i.hasCallbacks()||delete this._contextNameToData[r]}},e.prototype.destroy=function(e){var t=this._contextNameToData[e];return t?this._gw3Session.send({type:qn,domain:"global",context_id:t.contextId}).then((function(e){})):Promise.reject("context with "+e+" does not exist")},e.prototype.handleUpdated=function(e,t,n){var r=e.context;e.context=Yn(e.context,t,this._logger),this._contextNameToData[e.name]!==e||er(r,e.context)||this.invokeUpdateCallbacks(e,t,n)},e.prototype.subscribeToContextCreatedMessages=function(){for(var e=0,t=[Fn,Rn,Ln];e<t.length;e++){var n=t[e],r=this._connection.on(n,this.handleContextCreatedMessage.bind(this));this._gw3Subscriptions.push(r)}},e.prototype.handleContextCreatedMessage=function(e){var t=e.type;t===Ln?(this._contextNameToId[e.activity_id]=e.context_id,this._contextIdToName[e.context_id]=e.activity_id):t===Fn&&(this._contextNameToId[e.name]=e.context_id,this._contextIdToName[e.context_id]=e.name);var n=this._contextIdToName[e.context_id];if(!n)throw new Error("Received created event for context with unknown name: "+e.context_id);if(!this._contextNameToId[n])throw new Error("Received created event for context with unknown id: "+e.context_id);var r=this._contextNameToData[n];if(r){if(r.isAnnounced)return;if(!r.hasCallbacks())throw new Error("Assertion failure: contextData.hasCallbacks()");r.isAnnounced=!0,r.contextId=e.context_id,r.activityId=e.activity_id,r.sentExplicitSubscription||this.sendSubscribe(r)}else this._contextNameToData[n]=r=new Xn(e.context_id,n,!0,e.activity_id)},e.prototype.subscribeToContextUpdatedMessages=function(){for(var e=0,t=[Gn,zn,Vn];e<t.length;e++){var n=t[e],r=this._connection.on(n,this.handleContextUpdatedMessage.bind(this));this._gw3Subscriptions.push(r)}},e.prototype.handleContextUpdatedMessage=function(e){var t=e.type,n=e.context_id,r=this._contextNameToData[this._contextIdToName[n]],i=!r||!r.isAnnounced;if(t===Vn)r?(r.contextId=n,r.isAnnounced=!0,r.activityId=e.activity_id):(r=new Xn(n,e.activity_id,!0,e.activity_id),this._contextNameToData[e.activity_id]=r,this._contextIdToName[n]=e.activity_id,this._contextNameToId[e.activity_id]=n),r.joinedActivity=!0;else if(!r||!r.isAnnounced)return void(t===zn?((r=r||new Xn(n,e.name,!0,void 0)).sentExplicitSubscription=!0,this._contextNameToData[e.name]=r,this._contextIdToName[n]=e.name,this._contextNameToId[e.name]=n):this._logger.error("Received 'update' for unknown context: "+n));var o=r.context;if(t===zn)r.context=e.data||{};else if(t===Vn)r.context=e.context_snapshot||{};else{if(t!==Gn)throw new Error("Unrecognized context update message "+t);r.context=Yn(r.context,e.delta,this._logger)}!i&&er(r.context,o)&&t!==zn||this.invokeUpdateCallbacks(r,e.delta,{updaterId:e.updater_id})},e.prototype.invokeUpdateCallbacks=function(e,t,n){if((t=t||{added:{},updated:{},reset:{},removed:[]}).commands){t.added=t.updated=t.reset={},t.removed=[];for(var r=0,i=t.commands;r<i.length;r++){var o=i[r];"remove"===o.type?(-1===o.path.indexOf(".")&&t.removed.push(o.path),tr(t.updated,null,o.path)):"set"===o.type&&tr(t.updated,o.value,o.path)}}for(var a in e.updateCallbacks)if(e.updateCallbacks.hasOwnProperty(a))try{(0,e.updateCallbacks[a])(Zn(e.context),Object.assign({},t.added||{},t.updated||{},t.reset||{}),t.removed,parseInt(a,10),n)}catch(y){this._logger.debug("callback error: "+JSON.stringify(y))}},e.prototype.subscribeToContextDestroyedMessages=function(){for(var e=0,t=[$n,Nn];e<t.length;e++){var n=t[e],r=this._connection.on(n,this.handleContextDestroyedMessage.bind(this));this._gw3Subscriptions.push(r)}},e.prototype.handleContextDestroyedMessage=function(e){var t,n;if(e.type===Nn){if(n=e.activity_id,!(t=this._contextNameToId[n]))return void this._logger.error("Received 'destroyed' for unknown activity: "+e.activity_id)}else if(t=e.context_id,!(n=this._contextIdToName[t]))return void this._logger.error("Received 'destroyed' for unknown context: "+e.context_id);delete this._contextIdToName[t],delete this._contextNameToId[n];var r=this._contextNameToData[n];delete this._contextNameToData[n],r&&r.isAnnounced||this._logger.error("Received 'destroyed' for unknown context: "+t)},e.prototype.sendSubscribe=function(e){return e.sentExplicitSubscription=!0,this._gw3Session.send({type:Bn,domain:"global",context_id:e.contextId}).then((function(e){}))},e.prototype.sendUnsubscribe=function(e){return e.sentExplicitSubscription=!1,this._gw3Session.send({type:Hn,domain:"global",context_id:e.contextId}).then((function(e){}))},e.prototype.calculateContextDeltaV1=function(e,t){var n={added:{},updated:{},removed:[],reset:void 0};if(e)for(var r=0,i=Object.keys(e);r<i.length;r++){var o=i[r];-1===Object.keys(t).indexOf(o)||null===t[o]||er(e[o],t[o])||(n.updated[o]=t[o])}for(var a=0,s=Object.keys(t);a<s.length;a++){o=s[a];e&&-1!==Object.keys(e).indexOf(o)?null===t[o]&&n.removed.push(o):null!==t[o]&&(n.added[o]=t[o])}return n},e.prototype.calculateContextDeltaV2=function(e,t){for(var n,r,i={added:{},updated:{},removed:[],reset:void 0,commands:[]},o=0,a=Object.keys(t);o<a.length;o++){var s=a[o];if(null!==t[s])er(e?e[s]:null,t[s])||null===(n=i.commands)||void 0===n||n.push({type:"set",path:s,value:t[s]});else null===(r=i.commands)||void 0===r||r.push({type:"remove",path:s})}return i},e}(),ar=function(){function e(e){this._bridge=new or(e)}return e.prototype.all=function(){return this._bridge.all()},e.prototype.update=function(e,t){return this.checkName(e),this.checkData(t),this._bridge.update(e,t)},e.prototype.set=function(e,t){return this.checkName(e),this.checkData(t),this._bridge.set(e,t)},e.prototype.setPath=function(e,t,n){return this.checkName(e),this.checkPath(t),""===t?(this.checkData(n),this.set(e,n)):this._bridge.setPath(e,t,n)},e.prototype.setPaths=function(e,t){if(this.checkName(e),!Array.isArray(t))throw new Error("Please provide the paths as an array of PathValues!");for(var n=0,r=t;n<r.length;n++){var i=r[n],o=i.path,a=i.value;this.checkPath(o),""===o&&this.checkData(a)}return this._bridge.setPaths(e,t)},e.prototype.subscribe=function(e,t){var n=this;if(this.checkName(e),"function"!==typeof t)throw new Error("Please provide the callback as a function!");return this._bridge.subscribe(e,(function(e,r,i,o,a){return t(e,r,i,(function(){return n._bridge.unsubscribe(o)}),a)})).then((function(e){return function(){n._bridge.unsubscribe(e)}}))},e.prototype.get=function(e){return this.checkName(e),this._bridge.get(e)},e.prototype.ready=function(){return Promise.resolve(this)},e.prototype.destroy=function(e){return this.checkName(e),this._bridge.destroy(e)},Object.defineProperty(e.prototype,"setPathSupported",{get:function(){return this._bridge.setPathSupported},enumerable:!0,configurable:!0}),e.prototype.checkName=function(e){if("string"!==typeof e||""===e)throw new Error("Please provide the name as a non-empty string!")},e.prototype.checkPath=function(e){if("string"!==typeof e)throw new Error("Please provide the path as a dot delimited string!")},e.prototype.checkData=function(e){if("object"!==typeof e)throw new Error("Please provide the data as an object!")},e}();function sr(e,t,n){return"function"!==typeof t&&"function"!==typeof n?e:("function"!==typeof t?t=function(){}:"function"!==typeof n&&(n=function(){}),e.then(t,n))}function cr(e,t,n){var r;return void 0===e&&(e=0),t.finally((function(){r&&clearTimeout(r)})),new Promise((function(t,i){r=setTimeout((function(){return i(n)}),e)}))}!function(e){e[e.Success=0]="Success",e[e.Error=1]="Error"}(ir||(ir={}));var ur=function(){function e(e,t,n,r){this.protocol=e,this.repo=t,this.instance=n,this.configuration=r}return e.prototype.subscribe=function(e,t,n,r,i){var o=this,a=function(e,n,r,a){var s;t.methodResponseTimeout=null!==(s=t.methodResponseTimeout)&&void 0!==s?s:t.waitTimeoutMs,o.protocol.client.subscribe(n,t,e,r,a,i)};return sr(new Promise((function(n,r){var i,s=function(e){n(e)},c=function(e){r(e)};if(e)if((i="string"===typeof e?{name:e}:e).name){void 0===t&&(t={});var u=t.target;if(void 0===u&&(u="best"),"string"!==typeof u||"all"===u||"best"===u){void 0===t.methodResponseTimeout&&(t.methodResponseTimeout=t.method_response_timeout,void 0===t.methodResponseTimeout&&(t.methodResponseTimeout=o.configuration.methodResponseTimeout)),void 0===t.waitTimeoutMs&&(t.waitTimeoutMs=t.wait_for_method_timeout,void 0===t.waitTimeoutMs&&(t.waitTimeoutMs=o.configuration.waitTimeoutMs));var d=0,l=o.getServerMethodsByFilterAndTarget(i,u);if(l.length>0)a(l,l[0].methods[0],s,c);else{setTimeout((function n(){if(u&&t.waitTimeoutMs)if(d+=500,(l=o.getServerMethodsByFilterAndTarget(i,u)).length>0){var r=l[0].methods[0];a(l,r,s,c)}else if(d>=t.waitTimeoutMs){a(l,"string"===typeof e?{name:e}:e,s,c)}else setTimeout(n,500)}),500)}}else r(new Error('"'+u+'" is not a valid target. Valid targets are "all", "best", or an instance.'))}else r("Method definition is required. Please, provide either a unique string for a method name or a \u201cmethodDefinition\u201d object with a required \u201cname\u201d property.");else r("Method definition is required. Please, provide either a unique string for a method name or a \u201cmethodDefinition\u201d object with a required \u201cname\u201d property.")})),n,r)},e.prototype.servers=function(e){var t=void 0===e?void 0:Ct({},e);return this.getServers(t).map((function(e){return e.server.instance}))},e.prototype.methods=function(e){return e="string"===typeof e?{name:e}:Ct({},e),this.getMethods(e)},e.prototype.methodsForInstance=function(e){return this.getMethodsForInstance(e)},e.prototype.methodAdded=function(e){return this.repo.onMethodAdded(e)},e.prototype.methodRemoved=function(e){return this.repo.onMethodRemoved(e)},e.prototype.serverAdded=function(e){return this.repo.onServerAdded(e)},e.prototype.serverRemoved=function(e){return this.repo.onServerRemoved((function(t,n){e(t,n)}))},e.prototype.serverMethodAdded=function(e){return this.repo.onServerMethodAdded((function(t,n){e({server:t,method:n})}))},e.prototype.serverMethodRemoved=function(e){return this.repo.onServerMethodRemoved((function(t,n){e({server:t,method:n})}))},e.prototype.invoke=function(e,t,n,r,i,o){return St(this,void 0,void 0,(function(){var a=this;return Et(this,(function(s){return[2,sr(function(){return St(a,void 0,void 0,(function(){var i,o,a,s,c,u,d,l,p,h,f,m,v=this;return Et(this,(function(g){switch(g.label){case 0:if(!(i="string"===typeof e?{name:e}:Ct({},e)).name)return[2,Promise.reject("Method definition is required. Please, provide either a unique string for a method name or a \u201cmethodDefinition\u201d object with a required \u201cname\u201d property.")];if(t||(t={}),n||(n="best"),"string"===typeof n&&"all"!==n&&"best"!==n&&"skipMine"!==n)return[2,Promise.reject(new Error('"'+n+'" is not a valid target. Valid targets are "all" and "best".'))];if(r||(r={}),void 0===r.methodResponseTimeoutMs&&(r.methodResponseTimeoutMs=r.method_response_timeout,void 0===r.methodResponseTimeoutMs&&(r.methodResponseTimeoutMs=this.configuration.methodResponseTimeout)),void 0===r.waitTimeoutMs&&(r.waitTimeoutMs=r.wait_for_method_timeout,void 0===r.waitTimeoutMs&&(r.waitTimeoutMs=this.configuration.waitTimeoutMs)),void 0!==r.waitTimeoutMs&&"number"!==typeof r.waitTimeoutMs)return[2,Promise.reject(new Error('"'+r.waitTimeoutMs+'" is not a valid number for "waitTimeoutMs" '))];if("object"!==typeof t)return[2,Promise.reject(new Error("The method arguments must be an object. method: "+i.name))];if(0!==(o=this.getServerMethodsByFilterAndTarget(i,n)).length)return[3,4];g.label=1;case 1:return g.trys.push([1,3,,4]),[4,this.tryToAwaitForMethods(i,n,r)];case 2:return o=g.sent(),[3,4];case 3:return g.sent(),a=Ct(Ct({},i),{getServers:function(){return[]},supportsStreaming:!1,objectTypes:null!==(h=i.objectTypes)&&void 0!==h?h:[],flags:null!==(m=null===(f=i.flags)||void 0===f?void 0:f.metadata)&&void 0!==m?m:{}}),s={method:a,called_with:t,message:"Can not find a method matching "+JSON.stringify(e)+" with server filter "+JSON.stringify(n),executed_by:void 0,returned:void 0,status:void 0},[2,Promise.reject(s)];case 4:return c=r.methodResponseTimeoutMs,u=r,d=o.map((function(e){var n=Sn(),r=e.methods[0],i=e.server,o=v.protocol.client.invoke(n,r,t,i,u);return Promise.race([o,cr(c,o,{invocationId:n,message:"Invocation timeout ("+c+" ms) reached for method name: "+(null===r||void 0===r?void 0:r.name)+", target instance: "+JSON.stringify(i.instance)+", options: "+JSON.stringify(u),status:ir.Error})])})),[4,Promise.all(d)];case 5:return l=g.sent(),p=this.getInvocationResultObj(l,i,t),l.every((function(e){return e.status===ir.Error}))?[2,Promise.reject(p)]:[2,p]}}))}))}(),i,o)]}))}))},e.prototype.getInvocationResultObj=function(e,t,n){var r=e.filter((function(e){return e.status===ir.Success})).reduce((function(e,r){return e=Wt(e,[{executed_by:r.instance,returned:r.result,called_with:n,method:t,message:r.message,status:r.status}])}),[]),i=e.filter((function(e){return e.status===ir.Error})).reduce((function(e,r){return e=Wt(e,[{executed_by:r.instance,called_with:n,name:t.name,message:r.message}])}),[]),o=e[0];return{method:t,called_with:n,returned:o.result,executed_by:o.instance,all_return_values:r,all_errors:i,message:o.message,status:o.status}},e.prototype.tryToAwaitForMethods=function(e,t,n){var r=this;return new Promise((function(i,o){if(0!==n.waitTimeoutMs)var a=0,s=setInterval((function(){a+=500;var c=r.getServerMethodsByFilterAndTarget(e,t);if(c.length>0)clearInterval(s),i(c);else if(a>=(n.waitTimeoutMs||1e4))return clearInterval(s),void o()}),500);else o()}))},e.prototype.filterByTarget=function(e,t){var n=this;if("string"!==typeof e){return(Array.isArray(e)?e:[e]).reduce((function(e,r){var i=t.filter((function(e){return n.instanceMatch(r,e.server.instance)}));return e.concat(i)}),[])}if("all"===e)return Wt(t);if("best"===e){var r=t.find((function(e){return e.server.instance.isLocal}));if(r)return[r];if(void 0!==t[0])return[t[0]]}else if("skipMine"===e)return t.filter((function(e){return e.server.instance.peerId!==n.instance.peerId}));return[]},e.prototype.instanceMatch=function(e,t){return this.containsProps(e,t)},e.prototype.methodMatch=function(e,t){return this.containsProps(e,t)},e.prototype.containsProps=function(e,t){return Object.keys(e).filter((function(t){return void 0!==e[t]&&"function"!==typeof e[t]&&"object_types"!==t&&"display_name"!==t&&"id"!==t&&"gatewayId"!==t&&"identifier"!==t&&"_"!==t[0]})).every((function(n){var r,i=e[n],o=t[n];switch(n){case"objectTypes":r=(i||[]).every((function(e){return(o||[]).includes(e)}));break;case"flags":r=nr(o||{},i||{});break;default:r=String(i).toLowerCase()===String(o).toLowerCase()}return r}))},e.prototype.getMethods=function(e){var t=this;return void 0===e?this.repo.getMethods():this.repo.getMethods().filter((function(n){return t.methodMatch(e,n)}))},e.prototype.getMethodsForInstance=function(e){var t=this,n=this.repo.getServers().filter((function(n){return t.instanceMatch(e,n.instance)}));if(0===n.length)return[];var r={};return 1===n.length?r=n[0].methods:n.forEach((function(e){Object.keys(e.methods).forEach((function(t){var n=e.methods[t];r[n.identifier]=n}))})),Object.keys(r).map((function(e){return r[e]}))},e.prototype.getServers=function(e){var t=this,n=this.repo.getServers();return void 0===e?n.map((function(e){return{server:e,methods:[]}})):n.reduce((function(n,r){var i=Object.values(r.methods).filter((function(n){return t.methodMatch(e,n)}));return i.length>0&&n.push({server:r,methods:i}),n}),[])},e.prototype.getServerMethodsByFilterAndTarget=function(e,t){var n=this.getServers(e);return this.filterByTarget(t,n)},e}(),dr=function(){function e(e,t,n){this.protocol=e,this.repoMethod=t,this.subscription=n}return Object.defineProperty(e.prototype,"stream",{get:function(){if(!this.repoMethod.stream)throw new Error("no stream");return this.repoMethod.stream},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"arguments",{get:function(){return this.subscription.arguments||{}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"branchKey",{get:function(){return this.subscription.branchKey},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"instance",{get:function(){if(!this.subscription.instance)throw new Error("no instance");return this.subscription.instance},enumerable:!0,configurable:!0}),e.prototype.close=function(){this.protocol.server.closeSingleSubscription(this.repoMethod,this.subscription)},e.prototype.push=function(e){this.protocol.server.pushDataToSingle(this.repoMethod,this.subscription,e)},e}(),lr=function(){function e(e,t,n){this.protocol=e,this.repoMethod=t,this.requestContext=n,this.arguments=n.arguments,this.instance=n.instance}return e.prototype.accept=function(){this.protocol.server.acceptRequestOnBranch(this.requestContext,this.repoMethod,"")},e.prototype.acceptOnBranch=function(e){this.protocol.server.acceptRequestOnBranch(this.requestContext,this.repoMethod,e)},e.prototype.reject=function(e){this.protocol.server.rejectRequest(this.requestContext,this.repoMethod,e)},e}(),pr=function(){function e(e,t){var n=this;this.protocol=e,this.server=t,e.server.onSubRequest((function(e,t){return n.handleSubRequest(e,t)})),e.server.onSubAdded((function(e,t){return n.handleSubAdded(e,t)})),e.server.onSubRemoved((function(e,t){return n.handleSubRemoved(e,t)}))}return e.prototype.handleSubRequest=function(e,t){if(t&&t.streamCallbacks&&"function"===typeof t.streamCallbacks.subscriptionRequestHandler){var n=new lr(this.protocol,t,e);t.streamCallbacks.subscriptionRequestHandler(n)}},e.prototype.handleSubAdded=function(e,t){if(t&&t.streamCallbacks&&"function"===typeof t.streamCallbacks.subscriptionAddedHandler){var n=new dr(this.protocol,t,e);t.streamCallbacks.subscriptionAddedHandler(n)}},e.prototype.handleSubRemoved=function(e,t){if(t&&t.streamCallbacks&&"function"===typeof t.streamCallbacks.subscriptionRemovedHandler){var n=new dr(this.protocol,t,e);t.streamCallbacks.subscriptionRemovedHandler(n)}},e}(),hr=function(){function e(e,t,n){this.key=e,this.protocol=t,this.repoMethod=n}return e.prototype.subscriptions=function(){var e=this;return this.protocol.server.getSubscriptionList(this.repoMethod,this.key).map((function(t){return new dr(e.protocol,e.repoMethod,t)}))},e.prototype.close=function(){this.protocol.server.closeAllSubscriptions(this.repoMethod,this.key)},e.prototype.push=function(e){this.protocol.server.pushData(this.repoMethod,e,[this.key])},e}(),fr=function(){function e(e,t,n){this._protocol=e,this._repoMethod=t,this._server=n,this.name=this._repoMethod.definition.name}return e.prototype.branches=function(e){var t=this,n=this._protocol.server.getBranchList(this._repoMethod);return e?n.indexOf(e)>-1?new hr(e,this._protocol,this._repoMethod):void 0:n.map((function(e){return new hr(e,t._protocol,t._repoMethod)}))},e.prototype.branch=function(e){return this.branches(e)},e.prototype.subscriptions=function(){var e=this;return this._protocol.server.getSubscriptionList(this._repoMethod).map((function(t){return new dr(e._protocol,e._repoMethod,t)}))},Object.defineProperty(e.prototype,"definition",{get:function(){var e,t=this._repoMethod.definition;return{accepts:t.accepts,description:t.description,displayName:t.displayName,name:t.name,objectTypes:t.objectTypes,returns:t.returns,supportsStreaming:t.supportsStreaming,flags:null===(e=t.flags)||void 0===e?void 0:e.metadata}},enumerable:!0,configurable:!0}),e.prototype.close=function(){this._protocol.server.closeAllSubscriptions(this._repoMethod),this._server.unregister(this._repoMethod.definition,!0)},e.prototype.push=function(e,t){if("string"!==typeof t&&!Array.isArray(t)&&void 0!==t)throw new Error("invalid branches should be string or string array");if("object"!==typeof e)throw new Error("Invalid arguments. Data must be an object.");this._protocol.server.pushData(this._repoMethod,e,t)},e.prototype.updateRepoMethod=function(e){this._repoMethod=e},e}(),mr=function(){function e(e,t){this.protocol=e,this.serverRepository=t,this.invocations=0,this.currentlyUnregistering={},this.streaming=new pr(e,this),this.protocol.server.onInvoked(this.onMethodInvoked.bind(this))}return e.prototype.createStream=function(e,t,n,r,i){var o=this;return sr(new Promise((function(n,r){if(e){var a;if(!(a="string"===typeof e?{name:""+e}:Ct({},e)).name)return r("The \u201cname\u201d property is required for the \u201cstreamDefinition\u201d object and must be unique. Stream definition: "+JSON.stringify(a));if(o.serverRepository.getList().some((function(e){return e.definition.name===a.name})))return r('A stream with the name "'+a.name+'" already exists! Please, provide a unique name for the stream.');a.supportsStreaming=!0,t||(t={}),"function"!==typeof t.subscriptionRequestHandler&&(t.subscriptionRequestHandler=function(e){e.accept()});var s=o.serverRepository.add({definition:a,streamCallbacks:t,protocolState:{}});o.protocol.server.createStream(s).then((function(){var e;i?(e=i,i.updateRepoMethod(s)):e=new fr(o.protocol,s,o),s.stream=e,n(e)})).catch((function(e){s.repoId&&o.serverRepository.remove(s.repoId),r(e)}))}else r("The stream name must be unique! Please, provide either a unique string for a stream name to \u201cglue.interop.createStream()\u201d or a \u201cmethodDefinition\u201d object with a unique \u201cname\u201d property for the stream.")})),n,r)},e.prototype.register=function(e,t){var n=this;if(!e)return Promise.reject("Method definition is required. Please, provide either a unique string for a method name or a \u201cmethodDefinition\u201d object with a required \u201cname\u201d property.");if("function"!==typeof t)return Promise.reject("The second parameter must be a callback function. Method: "+("string"===typeof e?e:e.name));var r=function(e,r){return St(n,void 0,void 0,(function(){var n,i,o;return Et(this,(function(a){switch(a.label){case 0:return a.trys.push([0,4,,5]),(n=t(e.args,e.instance))&&"function"===typeof n.then?[4,n]:[3,2];case 1:return i=a.sent(),r(void 0,i),[3,3];case 2:r(void 0,n),a.label=3;case 3:return[3,5];case 4:return(o=a.sent())||(o=""),r(o,o),[3,5];case 5:return[2]}}))}))};return r.userCallback=t,this.registerCore(e,r)},e.prototype.registerAsync=function(e,t){if(!e)return Promise.reject("Method definition is required. Please, provide either a unique string for a method name or a \u201cmethodDefinition\u201d object with a required \u201cname\u201d property.");if("function"!==typeof t)return Promise.reject("The second parameter must be a callback function. Method: "+("string"===typeof e?e:e.name));var n=function(e,n){try{var r=!1,i=function(e){r||n(void 0,e),r=!0},o=function(e){r||(e||(e=""),n(e,e)),r=!0},a=t(e.args,e.instance,i,o);a&&"function"===typeof a.then&&a.then(i).catch(o)}catch(s){n(s,void 0)}};return n.userCallbackAsync=t,this.registerCore(e,n)},e.prototype.unregister=function(e,t){return void 0===t&&(t=!1),St(this,void 0,void 0,(function(){var n,r;return Et(this,(function(i){switch(i.label){case 0:return void 0===e?[2,Promise.reject("Please, provide either a unique string for a name or an object containing a \u201cname\u201d property.")]:"function"!==typeof e?[3,2]:[4,this.unregisterWithPredicate(e,t)];case 1:return i.sent(),[2];case 2:return void 0===(n="string"===typeof e?{name:e}:e).name?[2,Promise.reject("Method name is required. Cannot find a method if the method name is undefined!")]:(r=this.serverRepository.getList().find((function(e){return e.definition.name===n.name&&(e.definition.supportsStreaming||!1)===t})))?[4,this.removeMethodsOrStreams([r])]:[2,Promise.reject('Method with a name "'+n.name+'" does not exist or is not registered by your application!')];case 3:return i.sent(),[2]}}))}))},e.prototype.unregisterWithPredicate=function(e,t){return St(this,void 0,void 0,(function(){var n;return Et(this,(function(r){switch(r.label){case 0:return(n=this.serverRepository.getList().filter((function(t){return e(t.definition)})).filter((function(e){return(e.definition.supportsStreaming||!1)===t})))&&0!==n.length?[4,this.removeMethodsOrStreams(n)]:[2,Promise.reject("Could not find a "+(t?"stream":"method")+" matching the specified condition!")];case 1:return r.sent(),[2]}}))}))},e.prototype.removeMethodsOrStreams=function(e){var t=this,n=[];return e.forEach((function(e){var r=t.protocol.server.unregister(e).then((function(){e.repoId&&t.serverRepository.remove(e.repoId)}));n.push(r),t.addAsCurrentlyUnregistering(e.definition.name,r)})),Promise.all(n)},e.prototype.addAsCurrentlyUnregistering=function(e,t){return St(this,void 0,void 0,(function(){var n,r=this;return Et(this,(function(i){return n=new Promise((function(e){return setTimeout(e,5e3)})),this.currentlyUnregistering[e]=Promise.race([t,n]).then((function(){delete r.currentlyUnregistering[e]})),[2]}))}))},e.prototype.registerCore=function(e,t){return St(this,void 0,void 0,(function(){var n,r,i,o=this;return Et(this,(function(a){switch(a.label){case 0:return(n="string"===typeof e?{name:""+e}:Ct({},e)).name?(r=this.currentlyUnregistering[n.name])?[4,r]:[3,2]:[2,Promise.reject("Please, provide a (unique) string value for the \u201cname\u201d property in the \u201cmethodDefinition\u201d object: "+JSON.stringify(e))];case 1:a.sent(),a.label=2;case 2:return this.serverRepository.getList().some((function(e){return e.definition.name===n.name}))?[2,Promise.reject('A method with the name "'+n.name+'" already exists! Please, provide a unique name for the method.')]:n.supportsStreaming?[2,Promise.reject("When you create methods with \u201cglue.interop.register()\u201d or \u201cglue.interop.registerAsync()\u201d the property \u201csupportsStreaming\u201d cannot be \u201ctrue\u201d. If you want \u201c"+n.name+"\u201d to be a stream, please use the \u201cglue.interop.createStream()\u201d method.")]:(i=this.serverRepository.add({definition:n,theFunction:t,protocolState:{}}),[2,this.protocol.server.register(i).catch((function(e){throw(null===i||void 0===i?void 0:i.repoId)&&o.serverRepository.remove(i.repoId),e}))])}}))}))},e.prototype.onMethodInvoked=function(e,t,n){var r=this;e&&e.theFunction&&e.theFunction(n,(function(n,i){if(void 0!==n&&null!==n)if(n.message&&"string"===typeof n.message)n=n.message;else if("string"!==typeof n)try{n=JSON.stringify(n)}catch(o){n="un-stringifyable error in onMethodInvoked! Top level prop names: "+Object.keys(n)}i?("object"!==typeof i||Array.isArray(i))&&(i={_value:i}):i={},r.protocol.server.methodInvocationResult(e,t,n,i)}))},e}(),vr=function(){function e(e,t,n){var r=this;this.wrapped={},this.wrapped.getMethods=function(){return e.methodsForInstance(this)},this.wrapped.getStreams=function(){return e.methodsForInstance(this).filter((function(e){return e.supportsStreaming}))},t&&this.refreshWrappedObject(t),n&&(n.loggedIn((function(){r.refresh(n)})),this.refresh(n))}return e.prototype.unwrap=function(){return this.wrapped},e.prototype.refresh=function(e){if(e){var t=null===e||void 0===e?void 0:e.resolvedIdentity,n=Object.assign({},null!==t&&void 0!==t?t:{},{peerId:null===e||void 0===e?void 0:e.peerId});this.refreshWrappedObject(n)}},e.prototype.refreshWrappedObject=function(e){var t,n,r;this.wrapped.user=e.user,this.wrapped.instance=e.instance,this.wrapped.application=null!==(t=e.application)&&void 0!==t?t:Sn(),this.wrapped.applicationName=e.applicationName,this.wrapped.pid=null!==(r=null!==(n=e.pid)&&void 0!==n?n:e.process)&&void 0!==r?r:Math.floor(1e10*Math.random()),this.wrapped.machine=e.machine,this.wrapped.environment=e.environment,this.wrapped.region=e.region,this.wrapped.windowId=e.windowId,this.wrapped.isLocal=!0,this.wrapped.api=e.api,this.wrapped.service=e.service,this.wrapped.peerId=e.peerId},e}(),gr=function(e){return Ct(Ct({},e),{flags:e.flags.metadata||{}})},yr=function(){function e(e,t){this.logger=e,this.API=t,this.servers={},this.methodsCount={},this.callbacks=en();var n=this.API.instance.peerId;this.myServer={id:n,methods:{},instance:this.API.instance,wrapper:this.API.unwrappedInstance},this.servers[n]=this.myServer}return e.prototype.addServer=function(e,t){this.logger.debug("adding server "+t);var n=this.servers[t];if(n)return n.id;var r=new vr(this.API,e),i={id:t,methods:{},instance:r.unwrap(),wrapper:r};return this.servers[t]=i,this.callbacks.execute("onServerAdded",i.instance),t},e.prototype.removeServerById=function(e,t){var n=this,r=this.servers[e];r?(this.logger.debug("removing server "+e),Object.keys(r.methods).forEach((function(t){n.removeServerMethod(e,t)})),delete this.servers[e],this.callbacks.execute("onServerRemoved",r.instance,t)):this.logger.warn("not aware of server "+e+", my state "+JSON.stringify(Object.keys(this.servers)))},e.prototype.addServerMethod=function(e,t){var n,r=this.servers[e];if(!r)throw new Error("server does not exists");if(!r.methods[t.id]){var i=this.createMethodIdentifier(t),o=this,a={identifier:i,gatewayId:t.id,name:t.name,displayName:t.display_name,description:t.description,version:t.version,objectTypes:t.object_types||[],accepts:t.input_signature,returns:t.result_signature,supportsStreaming:"undefined"!==typeof t.flags&&t.flags.streaming,flags:null!==(n=t.flags)&&void 0!==n?n:{},getServers:function(){return o.getServersByMethod(i)}};a.object_types=a.objectTypes,a.display_name=a.displayName,a.version=a.version,r.methods[t.id]=a;var s=gr(a);return this.methodsCount[i]||(this.methodsCount[i]=0,this.callbacks.execute("onMethodAdded",s)),this.methodsCount[i]=this.methodsCount[i]+1,this.callbacks.execute("onServerMethodAdded",r.instance,s),a}},e.prototype.removeServerMethod=function(e,t){var n=this.servers[e];if(!n)throw new Error("server does not exists");var r=n.methods[t];delete n.methods[t];var i=gr(r);this.methodsCount[r.identifier]=this.methodsCount[r.identifier]-1,0===this.methodsCount[r.identifier]&&this.callbacks.execute("onMethodRemoved",i),this.callbacks.execute("onServerMethodRemoved",n.instance,i)},e.prototype.getMethods=function(){return this.extractMethodsFromServers(Object.values(this.servers)).map(gr)},e.prototype.getServers=function(){return Object.values(this.servers).map(this.hideServerMethodSystemFlags)},e.prototype.onServerAdded=function(e){var t=this.callbacks.add("onServerAdded",e),n=this.getServers().map((function(e){return e.instance}));return this.returnUnsubWithDelayedReplay(t,n,e)},e.prototype.onMethodAdded=function(e){var t=this.callbacks.add("onMethodAdded",e),n=this.getMethods();return this.returnUnsubWithDelayedReplay(t,n,e)},e.prototype.onServerMethodAdded=function(e){var t=this.callbacks.add("onServerMethodAdded",e),n=!1,r=this.getServers();return setTimeout((function(){r.forEach((function(t){var r=t.methods;Object.keys(r).forEach((function(i){n||e(t.instance,r[i])}))}))}),0),function(){n=!0,t()}},e.prototype.onMethodRemoved=function(e){return this.callbacks.add("onMethodRemoved",e)},e.prototype.onServerRemoved=function(e){return this.callbacks.add("onServerRemoved",e)},e.prototype.onServerMethodRemoved=function(e){return this.callbacks.add("onServerMethodRemoved",e)},e.prototype.getServerById=function(e){return this.hideServerMethodSystemFlags(this.servers[e])},e.prototype.reset=function(){var e,t=this;Object.keys(this.servers).forEach((function(e){t.removeServerById(e,"reset")})),this.servers=((e={})[this.myServer.id]=this.myServer,e),this.methodsCount={}},e.prototype.createMethodIdentifier=function(e){var t=void 0!==e.input_signature?e.input_signature:"",n=void 0!==e.result_signature?e.result_signature:"";return(e.name+t+n).toLowerCase()},e.prototype.getServersByMethod=function(e){var t=[];return Object.values(this.servers).forEach((function(n){Object.values(n.methods).forEach((function(r){r.identifier===e&&t.push(n.instance)}))})),t},e.prototype.returnUnsubWithDelayedReplay=function(e,t,n){var r=!1;return setTimeout((function(){t.forEach((function(e){r||n(e)}))}),0),function(){r=!0,e()}},e.prototype.hideServerMethodSystemFlags=function(e){var t={};return Object.entries(e.methods).forEach((function(e){var n=e[0],r=e[1];t[n]=gr(r)})),Ct(Ct({},e),{methods:t})},e.prototype.extractMethodsFromServers=function(e){return Object.values(e).reduce((function(e,t){return Wt(e,Object.values(t.methods))}),[])},e}(),wr=function(){function e(){this.nextId=0,this.methods=[]}return e.prototype.add=function(e){return e.repoId=String(this.nextId),this.nextId+=1,this.methods.push(e),e},e.prototype.remove=function(e){if("string"!==typeof e)return new TypeError("Expecting a string");this.methods=this.methods.filter((function(t){return t.repoId!==e}))},e.prototype.getById=function(e){if("string"===typeof e)return this.methods.find((function(t){return t.repoId===e}))},e.prototype.getList=function(){return this.methods.map((function(e){return e}))},e.prototype.length=function(){return this.methods.length},e.prototype.reset=function(){this.methods=[]},e}(),br="onSubscriptionRequest",kr="onSubscriptionAdded",xr="onSubscriptionRemoved",_r=function(){function e(e,t,n){var r=this;this.session=e,this.repository=t,this.serverRepository=n,this.ERR_URI_SUBSCRIPTION_FAILED="com.tick42.agm.errors.subscription.failure",this.callbacks=en(),this.nextStreamId=0,e.on("add-interest",(function(e){r.handleAddInterest(e)})),e.on("remove-interest",(function(e){r.handleRemoveInterest(e)}))}return e.prototype.acceptRequestOnBranch=function(e,t,n){if("string"!==typeof n&&(n=""),"object"!==typeof t.protocolState.subscriptionsMap)throw new TypeError("The streaming method is missing its subscriptions.");if(!Array.isArray(t.protocolState.branchKeyToStreamIdMap))throw new TypeError("The streaming method is missing its branches.");var r=this.getStreamId(t,n),i=e.msg.subscription_id,o={id:i,arguments:e.arguments,instance:e.instance,branchKey:n,streamId:r,subscribeMsg:e.msg};t.protocolState.subscriptionsMap[i]=o,this.session.sendFireAndForget({type:"accepted",subscription_id:i,stream_id:r}),this.callbacks.execute(kr,o,t)},e.prototype.rejectRequest=function(e,t,n){"string"!==typeof n&&(n=""),this.sendSubscriptionFailed("Subscription rejected by user. "+n,e.msg.subscription_id)},e.prototype.pushData=function(e,t,n){var r=this;if("object"===typeof e&&Array.isArray(e.protocolState.branchKeyToStreamIdMap)){if("object"!==typeof t)throw new Error("Invalid arguments. Data must be an object.");"string"===typeof n?n=[n]:(!Array.isArray(n)||n.length<=0)&&(n=[]),e.protocolState.branchKeyToStreamIdMap.filter((function(e){return!n||0===n.length||n.indexOf(e.key)>=0})).map((function(e){return e.streamId})).forEach((function(e){var n={type:"publish",stream_id:e,data:t};r.session.sendFireAndForget(n)}))}},e.prototype.pushDataToSingle=function(e,t,n){if("object"!==typeof n)throw new Error("Invalid arguments. Data must be an object.");var r={type:"post",subscription_id:t.id,data:n};this.session.sendFireAndForget(r)},e.prototype.closeSingleSubscription=function(e,t){e.protocolState.subscriptionsMap&&delete e.protocolState.subscriptionsMap[t.id];var n={type:"drop-subscription",subscription_id:t.id,reason:"Server dropping a single subscription"};this.session.sendFireAndForget(n);t.instance;this.callbacks.execute(xr,t,e)},e.prototype.closeMultipleSubscriptions=function(e,t){var n=this;if("object"===typeof e&&"object"===typeof e.protocolState.subscriptionsMap&&e.protocolState.subscriptionsMap){var r=e.protocolState.subscriptionsMap,i=Object.keys(r).map((function(e){return r[e]}));"string"===typeof t&&(i=i.filter((function(e){return e.branchKey===t}))),i.forEach((function(e){delete r[e.id];var t={type:"drop-subscription",subscription_id:e.id,reason:"Server dropping all subscriptions on stream_id: "+e.streamId};n.session.sendFireAndForget(t)}))}},e.prototype.getSubscriptionList=function(e,t){if("object"!==typeof e)return[];if(!e.protocolState.subscriptionsMap)return[];var n=e.protocolState.subscriptionsMap,r=Object.keys(n).map((function(e){return n[e]}));return"string"!==typeof t?r:r.filter((function(e){return e.branchKey===t}))},e.prototype.getBranchList=function(e){if("object"!==typeof e)return[];if(!e.protocolState.subscriptionsMap)return[];var t=e.protocolState.subscriptionsMap,n=Object.keys(t).map((function(e){return t[e]})),r=[];return n.forEach((function(e){var t="";"object"===typeof e&&"string"===typeof e.branchKey&&(t=e.branchKey),-1===r.indexOf(t)&&r.push(t)})),r},e.prototype.onSubAdded=function(e){this.onSubscriptionLifetimeEvent(kr,e)},e.prototype.onSubRequest=function(e){this.onSubscriptionLifetimeEvent(br,e)},e.prototype.onSubRemoved=function(e){this.onSubscriptionLifetimeEvent(xr,e)},e.prototype.handleRemoveInterest=function(e){var t=this.serverRepository.getById(e.method_id);if("string"===typeof e.subscription_id&&"object"===typeof t&&t.protocolState.subscriptionsMap&&"object"===typeof t.protocolState.subscriptionsMap[e.subscription_id]){var n=t.protocolState.subscriptionsMap[e.subscription_id];delete t.protocolState.subscriptionsMap[e.subscription_id],this.callbacks.execute(xr,n,t)}},e.prototype.onSubscriptionLifetimeEvent=function(e,t){this.callbacks.add(e,t)},e.prototype.getNextStreamId=function(){return this.nextStreamId+++""},e.prototype.handleAddInterest=function(e){var t=this.repository.getServerById(e.caller_id).instance,n={msg:e,arguments:e.arguments_kv||{},instance:t},r=this.serverRepository.getById(e.method_id);if(void 0!==r)r.protocolState.subscriptionsMap&&r.protocolState.subscriptionsMap[e.subscription_id]?this.sendSubscriptionFailed("A subscription with id "+e.subscription_id+" already exists.",e.subscription_id):this.callbacks.execute(br,n,r);else{var i="No method with id "+e.method_id+" on this server.";this.sendSubscriptionFailed(i,e.subscription_id)}},e.prototype.sendSubscriptionFailed=function(e,t){var n={type:"error",reason_uri:this.ERR_URI_SUBSCRIPTION_FAILED,reason:e,request_id:t};this.session.sendFireAndForget(n)},e.prototype.getStreamId=function(e,t){if("string"!==typeof t&&(t=""),!e.protocolState.branchKeyToStreamIdMap)throw new Error("streaming "+e.definition.name+" method without protocol state");var n=e.protocolState.branchKeyToStreamIdMap.filter((function(e){return e.key===t}))[0],r=n?n.streamId:void 0;return"string"===typeof r&&""!==r||(r=this.getNextStreamId(),e.protocolState.branchKeyToStreamIdMap.push({key:t,streamId:r})),r},e}(),Ir=function(){function e(e,t,n,r){var i=this;this.session=e,this.clientRepository=t,this.serverRepository=n,this.logger=r,this.callbacks=en(),this.streaming=new _r(e,t,n),this.session.on("invoke",(function(e){return i.handleInvokeMessage(e)}))}return e.prototype.createStream=function(e){return e.protocolState.subscriptionsMap={},e.protocolState.branchKeyToStreamIdMap=[],this.register(e,!0)},e.prototype.register=function(e,t){var n,r=this,i=e.definition,o=Object.assign({},{metadata:null!==(n=i.flags)&&void 0!==n?n:{}},{streaming:t||!1}),a={type:"register",methods:[{id:e.repoId,name:i.name,display_name:i.displayName,description:i.description,version:i.version,flags:o,object_types:i.objectTypes||i.object_types,input_signature:i.accepts,result_signature:i.returns,restrictions:void 0}]};return this.session.send(a,{methodId:e.repoId}).then((function(){r.logger.debug("registered method "+e.definition.name+" with id "+e.repoId)})).catch((function(t){throw r.logger.warn("failed to register method "+e.definition.name+" with id "+e.repoId+" - "+JSON.stringify(t)),t}))},e.prototype.onInvoked=function(e){this.callbacks.add("onInvoked",e)},e.prototype.methodInvocationResult=function(e,t,n,r){var i;i=n||""===n?{type:"error",request_id:t,reason_uri:"agm.errors.client_error",reason:n,context:r,peer_id:void 0}:{type:"yield",invocation_id:t,peer_id:this.session.peerId,result:r,request_id:void 0},this.session.sendFireAndForget(i)},e.prototype.unregister=function(e){return St(this,void 0,void 0,(function(){var t;return Et(this,(function(n){switch(n.label){case 0:return t={type:"unregister",methods:[e.repoId]},[4,this.session.send(t)];case 1:return n.sent(),[2]}}))}))},e.prototype.getBranchList=function(e){return this.streaming.getBranchList(e)},e.prototype.getSubscriptionList=function(e,t){return this.streaming.getSubscriptionList(e,t)},e.prototype.closeAllSubscriptions=function(e,t){this.streaming.closeMultipleSubscriptions(e,t)},e.prototype.pushData=function(e,t,n){this.streaming.pushData(e,t,n)},e.prototype.pushDataToSingle=function(e,t,n){this.streaming.pushDataToSingle(e,t,n)},e.prototype.closeSingleSubscription=function(e,t){this.streaming.closeSingleSubscription(e,t)},e.prototype.acceptRequestOnBranch=function(e,t,n){this.streaming.acceptRequestOnBranch(e,t,n)},e.prototype.rejectRequest=function(e,t,n){this.streaming.rejectRequest(e,t,n)},e.prototype.onSubRequest=function(e){this.streaming.onSubRequest(e)},e.prototype.onSubAdded=function(e){this.streaming.onSubAdded(e)},e.prototype.onSubRemoved=function(e){this.streaming.onSubRemoved(e)},e.prototype.handleInvokeMessage=function(e){var t=e.invocation_id,n=e.caller_id,r=e.method_id,i=e.arguments_kv,o=this.serverRepository.getList().filter((function(e){return e.repoId===r}))[0];if(void 0!==o){var a={args:i,instance:this.clientRepository.getServerById(n).instance};this.callbacks.execute("onInvoked",o,t,a)}},e}(),Cr=function(){function e(e,t){this.repository=e,this.subscriptionData=t}return Object.defineProperty(e.prototype,"requestArguments",{get:function(){return this.subscriptionData.params.arguments||{}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"servers",{get:function(){var e=this;return this.subscriptionData.trackedServers.filter((function(e){return e.subscriptionId})).map((function(t){return e.repository.getServerById(t.serverId).instance}))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"serverInstance",{get:function(){return this.servers[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stream",{get:function(){return this.subscriptionData.method},enumerable:!0,configurable:!0}),e.prototype.onData=function(e){if("function"!==typeof e)throw new TypeError("The data callback must be a function.");this.subscriptionData.handlers.onData.push(e),1===this.subscriptionData.handlers.onData.length&&this.subscriptionData.queued.data.length>0&&this.subscriptionData.queued.data.forEach((function(t){e(t)}))},e.prototype.onClosed=function(e){if("function"!==typeof e)throw new TypeError("The callback must be a function.");this.subscriptionData.handlers.onClosed.push(e)},e.prototype.onFailed=function(e){},e.prototype.onConnected=function(e){if("function"!==typeof e)throw new TypeError("The callback must be a function.");this.subscriptionData.handlers.onConnected.push(e)},e.prototype.close=function(){this.subscriptionData.close()},e.prototype.setNewSubscription=function(e){this.subscriptionData=e},e}(),Sr="awaitingAccept",Er="subscribed",Wr="Subscription failed.",Tr="ClientInitiated",Ar=function(){function e(e,t,n){var r=this;this.session=e,this.repository=t,this.logger=n,this.subscriptionsList={},this.subscriptionIdToLocalKeyMap={},this.nextSubLocalKey=0,this.handleErrorSubscribing=function(e){var t=e._tag,n=t.subLocalKey,i=r.subscriptionsList[n];if("object"===typeof i&&(i.trackedServers=i.trackedServers.filter((function(e){return e.serverId!==t.serverId})),i.trackedServers.length<=0)){if(clearTimeout(i.timeoutId),i.status===Sr){var o="string"===typeof e.reason&&""!==e.reason?' Publisher said "'+e.reason+'".':" No reason given.",a="object"===typeof i.params.arguments?JSON.stringify(i.params.arguments):"{}";i.error({message:"Subscription rejected."+o+" Called with:"+a,called_with:i.params.arguments,method:i.method})}else i.status===Er&&r.callOnClosedHandlers(i);delete r.subscriptionsList[n]}},this.handleSubscribed=function(e){var t=e._tag.subLocalKey,n=r.subscriptionsList[t];if("object"===typeof n){var i=e._tag.serverId,o=n.trackedServers.filter((function(e){return e.serverId===i}))[0];if("object"===typeof o){o.subscriptionId=e.subscription_id,r.subscriptionIdToLocalKeyMap[e.subscription_id]=t;var a=n.status===Sr;if(n.status=Er,a){var s=!1,c=n.subscription;c?(c.setNewSubscription(n),n.success(c),s=!0):(c=new Cr(r.repository,n),n.subscription=c,n.success(c));for(var u=0,d=n.handlers.onConnected;u<d.length;u++){var l=d[u];try{l(c.serverInstance,s)}catch(p){}}}}}},this.handleEventData=function(e){var t=r.subscriptionIdToLocalKeyMap[e.subscription_id];if("undefined"!==typeof t){var n=r.subscriptionsList[t];if("object"===typeof n){var i=n.trackedServers.filter((function(t){return t.subscriptionId===e.subscription_id}));if(1===i.length){var o=e.oob,a=i[0].serverId,s=function(){return{data:e.data,server:r.repository.getServerById(a).instance,requestArguments:n.params.arguments,message:void 0,private:o}},c=n.handlers.onData,u=n.queued.data;c.length>0?c.forEach((function(e){"function"===typeof e&&e(s())})):u.push(s())}}}},this.handleSubscriptionCancelled=function(e){var t=r.subscriptionIdToLocalKeyMap[e.subscription_id];if("undefined"!==typeof t){var n=r.subscriptionsList[t];if("object"===typeof n){var i=n.trackedServers.length-1;n.trackedServers=n.trackedServers.filter((function(t){return t.subscriptionId!==e.subscription_id||(n.queued.closers.push(t.serverId),!1)})),n.trackedServers.length===i&&(n.trackedServers.length<=0&&(clearTimeout(n.timeoutId),r.callOnClosedHandlers(n),delete r.subscriptionsList[t]),delete r.subscriptionIdToLocalKeyMap[e.subscription_id])}}},e.on("subscribed",this.handleSubscribed),e.on("event",this.handleEventData),e.on("subscription-cancelled",this.handleSubscriptionCancelled)}return e.prototype.subscribe=function(e,t,n,r,i,o){var a=this;if(0!==n.length){var s=this.getNextSubscriptionLocalKey(),c=this.registerSubscription(s,e,t,r,i,t.methodResponseTimeout||1e4,o);"object"===typeof c?n.forEach((function(n){var r=n.server.id,i=n.methods.find((function(t){return t.name===e.name}));if(i){c.trackedServers.push({serverId:r,subscriptionId:void 0});var o={type:"subscribe",server_id:r,method_id:i.gatewayId,arguments_kv:t.arguments};a.session.send(o,{serverId:r,subLocalKey:s}).then((function(e){return a.handleSubscribed(e)})).catch((function(e){return a.handleErrorSubscribing(e)}))}else a.logger.error("can not find method "+e.name+" for target "+n.server.id)})):i({method:e,called_with:t.arguments,message:Wr+" Unable to register the user callbacks."})}else i({method:e,called_with:t.arguments,message:Wr+" No available servers matched the target params."})},e.prototype.drainSubscriptions=function(){var e=Object.values(this.subscriptionsList);return this.subscriptionsList={},this.subscriptionIdToLocalKeyMap={},e},e.prototype.getNextSubscriptionLocalKey=function(){var e=this.nextSubLocalKey;return this.nextSubLocalKey+=1,e},e.prototype.registerSubscription=function(e,t,n,r,i,o,a){var s=this,c={localKey:e,status:Sr,method:t,params:n,success:r,error:i,trackedServers:[],handlers:{onData:(null===a||void 0===a?void 0:a.handlers.onData)||[],onClosed:(null===a||void 0===a?void 0:a.handlers.onClosed)||[],onConnected:(null===a||void 0===a?void 0:a.handlers.onConnected)||[]},queued:{data:[],closers:[]},timeoutId:void 0,close:function(){return s.closeSubscription(e)},subscription:null===a||void 0===a?void 0:a.subscription};return a||(n.onData&&c.handlers.onData.push(n.onData),n.onClosed&&c.handlers.onClosed.push(n.onClosed),n.onConnected&&c.handlers.onConnected.push(n.onConnected)),this.subscriptionsList[e]=c,c.timeoutId=setTimeout((function(){if(void 0!==s.subscriptionsList[e]){var r=s.subscriptionsList[e];r.status===Sr?(i({method:t,called_with:n.arguments,message:Wr+" Subscription attempt timed out after "+o+" ms."}),delete s.subscriptionsList[e]):r.status===Er&&r.trackedServers.length>0&&(r.trackedServers=r.trackedServers.filter((function(e){return"undefined"!==typeof e.subscriptionId})),delete r.timeoutId,r.trackedServers.length<=0&&(s.callOnClosedHandlers(r),delete s.subscriptionsList[e]))}}),o),c},e.prototype.callOnClosedHandlers=function(e,t){var n,r=e.queued.closers.length,i=r>0?e.queued.closers[r-1]:null;void 0!==i&&"string"===typeof i&&(n=this.repository.getServerById(i).instance),e.handlers.onClosed.forEach((function(r){"function"===typeof r&&r({message:t||"ServerInitiated",requestArguments:e.params.arguments||{},server:n,stream:e.method})}))},e.prototype.closeSubscription=function(e){var t=this,n=this.subscriptionsList[e];"object"===typeof n&&(n.trackedServers.forEach((function(e){"undefined"!==typeof e.subscriptionId&&(n.queued.closers.push(e.serverId),t.session.sendFireAndForget({type:"unsubscribe",subscription_id:e.subscriptionId,reason_uri:"",reason:Tr}),delete t.subscriptionIdToLocalKeyMap[e.subscriptionId])})),n.trackedServers=[],this.callOnClosedHandlers(n,Tr),delete this.subscriptionsList[e])},e}(),Pr=function(){function e(e,t,n){var r=this;this.session=e,this.repository=t,this.logger=n,e.on("peer-added",(function(e){return r.handlePeerAdded(e)})),e.on("peer-removed",(function(e){return r.handlePeerRemoved(e)})),e.on("methods-added",(function(e){return r.handleMethodsAddedMessage(e)})),e.on("methods-removed",(function(e){return r.handleMethodsRemovedMessage(e)})),this.streaming=new Ar(e,t,n)}return e.prototype.subscribe=function(e,t,n,r,i,o){this.streaming.subscribe(e,t,n,r,i,o)},e.prototype.invoke=function(e,t,n,r){var i=this,o=r.id,a={type:"call",server_id:o,method_id:t.gatewayId,arguments_kv:n};return this.session.send(a,{invocationId:e,serverId:o}).then((function(e){return i.handleResultMessage(e)})).catch((function(e){return i.handleInvocationError(e)}))},e.prototype.drainSubscriptions=function(){return this.streaming.drainSubscriptions()},e.prototype.handlePeerAdded=function(e){var t=e.new_peer_id,n=e.identity,r=!e.meta||e.meta.local,i=Number(n.process),o={machine:n.machine,pid:isNaN(i)?n.process:i,instance:n.instance,application:n.application,applicationName:n.applicationName,environment:n.environment,region:n.region,user:n.user,windowId:n.windowId,peerId:t,api:n.api,isLocal:r};this.repository.addServer(o,t)},e.prototype.handlePeerRemoved=function(e){var t=e.removed_id,n=e.reason;this.repository.removeServerById(t,n)},e.prototype.handleMethodsAddedMessage=function(e){var t=this,n=e.server_id;e.methods.forEach((function(e){t.repository.addServerMethod(n,e)}))},e.prototype.handleMethodsRemovedMessage=function(e){var t=this,n=e.server_id,r=e.methods,i=this.repository.getServerById(n);Object.keys(i.methods).forEach((function(e){var o=i.methods[e];r.indexOf(o.gatewayId)>-1&&t.repository.removeServerMethod(n,e)}))},e.prototype.handleResultMessage=function(e){var t=e._tag.invocationId,n=e.result,r=e._tag.serverId;return{invocationId:t,result:n,instance:this.repository.getServerById(r).instance,status:ir.Success,message:""}},e.prototype.handleInvocationError=function(e){if(this.logger.debug("handle invocation error "+JSON.stringify(e)),"_tag"in e){var t=e._tag.invocationId,n=e._tag.serverId,r=this.repository.getServerById(n),i=e.reason;return{invocationId:t,result:e.context,instance:r.instance,status:ir.Error,message:i}}return{invocationId:"",message:e.message,status:ir.Error,error:e}},e}();function Mr(e,t,n,r,i,o){var a,s=i.logger.subLogger("gw3-protocol"),c=new Promise((function(e){a=e})),u=t.domain("agm",["subscribed"]),d=new Ir(u,n,r,s.subLogger("server")),l=new Pr(u,n,s.subLogger("client"));return u.onJoined((function(i){n.addServer(e,t.peerId),i?function(){s.info("reconnected - will replay registered methods and subscriptions");for(var e=0,t=l.drainSubscriptions();e<t.length;e++){var n=t[e],i=n.method,a=Object.assign({},n.params);s.info("trying to re-subscribe to method "+i.name),o.client.subscribe(i,a,void 0,void 0,n)}var c=r.getList();r.reset();for(var u=0,d=c;u<d.length;u++){var p=d[u],h=p.definition;s.info("re-publishing method "+h.name),p.stream?o.server.createStream(h,p.streamCallbacks,void 0,void 0,p.stream):p.theFunction&&p.theFunction.userCallback?o.register(h,p.theFunction.userCallback):p.theFunction&&p.theFunction.userCallbackAsync&&o.registerAsync(h,p.theFunction.userCallbackAsync)}}():a&&(a({client:l,server:d}),a=void 0)})),u.onLeft((function(){n.reset()})),u.join(),c}var Or=function(){function e(e){var t=this;if("undefined"===typeof e)throw new Error("configuration is required");if("undefined"===typeof e.connection)throw new Error("configuration.connections is required");var n,r=e.connection;if("number"!==typeof e.methodResponseTimeout&&(e.methodResponseTimeout=3e4),"number"!==typeof e.waitTimeoutMs&&(e.waitTimeoutMs=3e4),this.unwrappedInstance=new vr(this,void 0,r),this.instance=this.unwrappedInstance.unwrap(),this.clientRepository=new yr(e.logger.subLogger("cRep"),this),this.serverRepository=new wr,3!==r.protocolVersion)throw new Error("protocol "+r.protocolVersion+" not supported");n=Mr(this.instance,r,this.clientRepository,this.serverRepository,e,this),this.readyPromise=n.then((function(n){return t.protocol=n,t.client=new ur(t.protocol,t.clientRepository,t.instance,e),t.server=new mr(t.protocol,t.serverRepository),t}))}return e.prototype.ready=function(){return this.readyPromise},e.prototype.serverRemoved=function(e){return this.client.serverRemoved(e)},e.prototype.serverAdded=function(e){return this.client.serverAdded(e)},e.prototype.serverMethodRemoved=function(e){return this.client.serverMethodRemoved(e)},e.prototype.serverMethodAdded=function(e){return this.client.serverMethodAdded(e)},e.prototype.methodRemoved=function(e){return this.client.methodRemoved(e)},e.prototype.methodAdded=function(e){return this.client.methodAdded(e)},e.prototype.methodsForInstance=function(e){return this.client.methodsForInstance(e)},e.prototype.methods=function(e){return this.client.methods(e)},e.prototype.servers=function(e){return this.client.servers(e)},e.prototype.subscribe=function(e,t,n,r){return this.client.subscribe(e,t,n,r)},e.prototype.createStream=function(e,t,n,r){return this.server.createStream(e,t,n,r)},e.prototype.unregister=function(e){return this.server.unregister(e)},e.prototype.registerAsync=function(e,t){return this.server.registerAsync(e,t)},e.prototype.register=function(e,t){return this.server.register(e,t)},e.prototype.invoke=function(e,t,n,r,i,o){return this.client.invoke(e,t,n,r,i,o)},e.prototype.waitForMethod=function(e){var t=new on,n=this.client.methodAdded((function(r){r.name===e&&(n(),t.resolve(r))}));return t.promise},e}(),jr=["subscribed","success"],Dr=function(){function e(e,t){var n=this;this.publish=function(e,t,r){var i=r||{},o=i.routingKey,a=i.target,s=n.removeEmptyValues({type:"publish",topic:e,data:t,peer_id:n.peerId,routing_key:o,target_identity:a});n.session.send(s)},this.subscribe=function(e,t,r){return new Promise((function(i,o){var a=r||{},s=a.routingKey,c=a.target,u=n.removeEmptyValues({type:"subscribe",topic:e,peer_id:n.peerId,routing_key:s,source:c});n.session.send(u).then((function(r){var o=r.subscription_id;n.subscriptions.push({subscription_id:o,topic:e,callback:t,source:c}),i({unsubscribe:function(){return n.session.send({type:"unsubscribe",subscription_id:o,peer_id:n.peerId}),n.subscriptions=n.subscriptions.filter((function(e){return e.subscription_id!==o})),Promise.resolve()}})})).catch((function(e){return o(e)}))}))},this.watchOnEvent=function(){n.session.on("event",(function(e){var t=e.data,r=e.subscription_id,i=e["publisher-identity"],o=n.subscriptions.find((function(e){return e.subscription_id===r}));o&&(o.source?n.keysMatch(o.source,i)&&o.callback(t,o.topic,i):o.callback(t,o.topic,i))}))},this.connection=e,this.logger=t,this.peerId=e.peerId,this.subscriptions=[],this.session=e.domain("bus",jr),this.readyPromise=this.session.join(),this.readyPromise.then((function(){n.watchOnEvent()}))}return e.prototype.ready=function(){return this.readyPromise},e.prototype.removeEmptyValues=function(e){var t={};return Object.keys(e).forEach((function(n){void 0!==e[n]&&null!==e[n]&&(t[n]=e[n])})),t},e.prototype.keysMatch=function(e,t){var n=Object.keys(e),r=!0;return n.forEach((function(n){e[n]!==t[n]&&(r=!1)})),r},e}(),Lr=function e(t,n){var r,o=rn.getGDMajorVersion(),a=Promise.resolve();if(o){if(o<3)throw new Error("GD v2 is not supported. Use v4 of the API to run in that context.");o>=3&&(r=window.glue42gd,a=window.gdPreloadPromise||a)}var s,c,u,d,l,p,h,f=sn("glue"),m=function(e,t,n){var r,o,a,s,c,u;if(rn.isNode()){var d=Object({NODE_ENV:"production",PUBLIC_URL:".",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0})._GD_STARTING_CONTEXT_;if(d)try{u=JSON.parse(d)}catch(v){}}function l(){if(e.application)return e.application;if(n)return n.applicationName;var t=Sn();return rn.isNode()?u?u.applicationConfig.name:"NodeJS"+t:"undefined"!==typeof window&&"undefined"!==typeof document?document.title+" ("+t+")":t}var p=function(){var r,o,a,s,c,d,p,h,f,m,v=e.gateway,g=null!==(r=null===v||void 0===v?void 0:v.protocolVersion)&&void 0!==r?r:3,y=null===v||void 0===v?void 0:v.reconnectInterval,w=null===v||void 0===v?void 0:v.reconnectAttempts,b=null===v||void 0===v?void 0:v.ws,k=null===v||void 0===v?void 0:v.sharedWorker,x=null===v||void 0===v?void 0:v.inproc,_=null!==(o=null===v||void 0===v?void 0:v.webPlatform)&&void 0!==o?o:void 0;n&&(b=n.gwURL),rn.isNode()&&u&&u.gwURL&&(b=u.gwURL),b||k||x||(b="ws://localhost:8385");var I=l(),C=I;"undefined"!==typeof n?(p=n.windowId,h=n.pid,n.env&&(f=n.env.env,m=n.env.region),C=null!==(a=n.application)&&void 0!==a?a:"glue-app",d=n.appInstanceId):rn.isNode()&&(h=i.pid,u&&(f=u.env,m=u.region,d=u.instanceId));var S=null!==(c=null===(s=e.gateway)||void 0===s?void 0:s.replaySpecs)&&void 0!==c?c:[];return S.push(Jn),{identity:{application:C,applicationName:I,windowId:p,instance:d,process:h,region:m,environment:f,api:t.version||Kn},reconnectInterval:y,ws:b,sharedWorker:k,webPlatform:_,inproc:x,protocolVersion:g,reconnectAttempts:w,replaySpecs:S}}(),h=l();if("undefined"!==typeof window){var f=window,m=f.htmlContainer?f.htmlContainer.containerName+"."+f.htmlContainer.application:null===(r=null===f||void 0===f?void 0:f.glue42gd)||void 0===r?void 0:r.application;m&&(h=m)}return{bus:null!==(o=e.bus)&&void 0!==o&&o,application:h,auth:function(){var t,n,r;return"string"===typeof e.auth?{token:e.auth}:e.auth?e.auth:rn.isNode()&&u&&u.gwToken?{gatewayToken:u.gwToken}:(null===(t=e.gateway)||void 0===t?void 0:t.webPlatform)||(null===(n=e.gateway)||void 0===n?void 0:n.inproc)||(null===(r=e.gateway)||void 0===r?void 0:r.sharedWorker)?{username:"glue42",password:"glue42"}:void 0}(),logger:function(){var t,r,i,o=e.logger,a="warn";return o||(o=a),n&&(i=n.consoleLogLevel),"string"===typeof o?{console:null!==i&&void 0!==i?i:o,publish:a}:{console:null!==(t=null!==i&&void 0!==i?i:o.console)&&void 0!==t?t:a,publish:null!==(r=o.publish)&&void 0!==r?r:a}}(),connection:p,metrics:null===(a=e.metrics)||void 0===a||a,contexts:null===(s=e.contexts)||void 0===s||s,version:t.version||Kn,libs:null!==(c=t.libs)&&void 0!==c?c:[],customLogger:e.customLogger}}(t=t||{},n=n||{},r),v={};function g(t,n,r){(h=u.canPublish("trace"))&&u.trace("registering "+t+" module");var i=function(){n.initTime=r.stop(),n.initEndTime=r.endTime,n.marks=r.marks,h&&u.trace(t+" is ready - "+(r.endTime-r.startTime))};n.initStartTime=r.startTime,n.ready?n.ready().then((function(){i()})):i(),Array.isArray(t)||(t=[t]),t.forEach((function(t){v[t]=n,e[t]=n}))}function y(){var e,t,n,i,o=sn("metrics"),a=m.metrics,c=null===r||void 0===r?void 0:r.getMetricsPublishingEnabled,l=m.connection.identity,p=c||function(){return!0},h=null!==(e="boolean"!==typeof a&&a.disableAutoAppSystem)&&void 0!==e&&e;return g("metrics",d=Zt({connection:a?s:void 0,logger:u.subLogger("metrics"),canUpdateMetric:p,system:"Glue42",service:null!==(t=null===l||void 0===l?void 0:l.service)&&void 0!==t?t:"metrics-service",instance:null!==(i=null!==(n=null===l||void 0===l?void 0:l.instance)&&void 0!==n?n:null===l||void 0===l?void 0:l.windowId)&&void 0!==i?i:Sn(),disableAutoAppSystem:h,pagePerformanceMetrics:"boolean"!==typeof a?null===a||void 0===a?void 0:a.pagePerformanceMetrics:void 0}),o),Promise.resolve()}function w(){var e=sn("interop"),t={connection:s,logger:u.subLogger("interop")};return c=new Or(t),jn.Interop=c,g(["interop","agm"],c,e),Promise.resolve()}function b(){var e=m.activities&&3===s.protocolVersion;if(m.contexts||e){var t=sn("contexts");return g("contexts",l=new ar({connection:s,logger:u.subLogger("contexts")}),t),l}var n=s.replayer;n&&n.drain(Jn.name)}function k(){return St(this,void 0,void 0,(function(){var e;return Et(this,(function(t){return m.bus?(e=sn("bus"),g("bus",p=new Dr(s,u.subLogger("bus")),e),[2,Promise.resolve()]):[2,Promise.resolve()]}))}))}function x(e){try{return e.forEach((function(e){!function(e,t){var n=sn(e),r=t(v);r&&g(e,r,n)}(e.name,e.create)})),Promise.resolve()}catch(t){return Promise.reject(t)}}return a.then((function(){var e,t=sn("logger");return(u=new jn(""+(null===(e=m.connection.identity)||void 0===e?void 0:e.application),void 0,m.customLogger)).consoleLevel(m.logger.console),u.publishLevel(m.logger.publish),u.canPublish("debug")&&u.debug("initializing glue..."),g("logger",u,t),Promise.resolve(void 0)})).then((function(){var e=sn("connection");s=new Mn(m.connection,u.subLogger("connection"));var t=Promise.resolve(m.auth);return m.connection&&!m.auth&&(t=r?r.getGWToken().then((function(e){return{gatewayToken:e}})):Promise.reject("You need to provide auth information")),t.then((function(t){var n;if(e.mark("auth-promise-resolved"),"[object Object]"!==Object.prototype.toString.call(t))throw new Error("Invalid auth object - "+JSON.stringify(t));return n=t,s.login(n)})).then((function(){return g("connection",s,e),m})).catch((function(e){throw s&&s.logout(),e}))})).then((function(){return Promise.all([y(),w(),b(),k()])})).then((function(){return c.readyPromise})).then((function(){return x(m.libs||[])})).then((function(){var e=Object.keys(v).map((function(e){var t=v[e];return t.ready?t.ready():Promise.resolve()}));return Promise.all(e)})).then((function(){var e={coreVersion:Kn,version:m.version};f.stop();var i={feedback:function(e){c&&c.invoke("T42.ACS.Feedback",e,"best")},info:e,logger:u,interop:c,agm:c,connection:s,metrics:d,contexts:l,bus:p,version:m.version,userConfig:t,done:function(){return null===u||void 0===u||u.info("done called by user..."),s.logout()}};if(i.performance={get glueVer(){return m.version},get glueConfig(){return JSON.stringify(t)},get browser(){return window.performance.timing.toJSON()},get memory(){return window.performance.memory},get initTimes(){var e=an;return Object.keys(e).map((function(t){var n=e[t];return{name:t,duration:n.endTime-n.startTime,marks:n.marks}}))}},Object.keys(v).forEach((function(e){var t=v[e];i[e]=t})),i.config={},Object.keys(m).forEach((function(e){i.config[e]=m[e]})),n&&n.extOptions&&Object.keys(n.extOptions).forEach((function(e){i.config[e]=null===n||void 0===n?void 0:n.extOptions[e]})),(null===n||void 0===n?void 0:n.enrichGlue)&&n.enrichGlue(i),r&&r.updatePerfData&&r.updatePerfData(i.performance),i.agm){var o=function(e,t,n){return function(){return i.logger.warn("glue.js - 'glue.agm."+t+"' method is deprecated, use 'glue.interop."+n+"' instead."),e.apply(i.agm,arguments)}},a=i.agm;a.method_added=o(i.agm.methodAdded,"method_added","methodAdded"),a.method_removed=o(i.agm.methodRemoved,"method_removed","methodRemoved"),a.server_added=o(i.agm.serverAdded,"server_added","serverAdded"),a.server_method_aded=o(i.agm.serverMethodAdded,"server_method_aded","serverMethodAdded"),a.server_method_removed=o(i.agm.serverMethodRemoved,"server_method_removed","serverMethodRemoved")}return i})).catch((function(e){return Promise.reject({err:e,libs:v})}))};"undefined"!==typeof window&&(window.GlueCore=Lr),Lr.version=Kn,Lr.default=Lr;var Nr,Rr=(Nr=Lr,function(e){return p(void 0,void 0,void 0,u.a.mark((function t(){var n,r,i,o;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=f(e),!window.glue42gd){t.next=3;break}return t.abrupt("return",v(n));case 3:return m(),t.next=6,st((function(){return Nr(n,{version:xt})}),3e4,"Glue Web initialization timed out, because core didn't resolve");case 6:return r=t.sent,i=r.logger.subLogger("web.main.controller"),o=new kt(r),t.next=11,o.bridge.start(o.controllers);case 11:return i.trace("the bridge has been started, initializing all controllers"),t.next=14,Promise.all(Object.values(o.controllers).map((function(e){return e.start(r,o)})));case 14:return i.trace("all controllers reported started, starting all additional libraries"),t.next=17,Promise.all(n.libraries.map((function(e){return e(r,n)})));case 17:return i.trace("all libraries were started, glue is ready, returning it"),t.abrupt("return",r);case 19:case"end":return t.stop()}}),t)})))});if("undefined"!==typeof window){var Fr=window;Fr.GlueWeb=Rr,delete Fr.GlueCore}Rr.version=xt,t.a=Rr}).call(this,n(9),n(18).Buffer,n(19))},31:function(e,t,n){},32:function(e,t,n){},33:function(e,t,n){},38:function(e,t,n){"use strict";n.r(t);var r=n(8),i=n(1),o=n.n(i),a=n(10),s=n.n(a),c=(n(16),n(20)),u=(n(31),n(32),n(33),n(7)),d=function(){return window.glue=Object(i.useContext)(u.a),Object(r.jsx)(c.a,{})},l=function(e){e&&e instanceof Function&&n.e(3).then(n.bind(null,39)).then((function(t){var n=t.getCLS,r=t.getFID,i=t.getFCP,o=t.getLCP,a=t.getTTFB;n(e),r(e),i(e),o(e),a(e)}))},p=n(21),h=n.n(p),f=n(22),m=n(13),v=n(4),g=n(0),y=n.n(g),w=n(2),b=n(3);function k(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(t){o(t)}}function s(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){e.done?i(e.value):new n((function(t){t(e.value)})).then(a,s)}c((r=r.apply(e,t||[])).next())}))}function x(e){if(e&&e.errorHandling&&"function"!==typeof e.errorHandling&&"log"!==e.errorHandling&&"silent"!==e.errorHandling&&"throw"!==e.errorHandling)throw new Error('Invalid options passed to createRegistry. Prop errorHandling should be ["log" | "silent" | "throw" | (err) => void], but '+typeof e.errorHandling+" was passed");var t=e&&"function"===typeof e.errorHandling&&e.errorHandling,n={};function r(n,r){var i=n instanceof Error?n:new Error(n);if(t)t(i);else{var o='[ERROR] callback-registry: User callback for key "'+r+'" failed: '+i.stack;if(e)switch(e.errorHandling){case"log":return console.error(o);case"silent":return;case"throw":throw new Error(o)}console.error(o)}}return{add:function(e,t){var r=n[e];return r||(r=[],n[e]=r),r.push(t),function(){var r=n[e];r&&(r=r.reduce((function(e,n,r){return n===t&&e.length===r||e.push(n),e}),[]),n[e]=r)}},execute:function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];var o=n[e];if(!o||0===o.length)return[];var a=[];return o.forEach((function(n){try{var i=n.apply(void 0,t);a.push(i)}catch(C){a.push(void 0),r(C,e)}})),a},clear:function(){n={}},clearKey:function(e){n[e]&&delete n[e]}}}x.default=x;var _=x,I=function(e){return{ok:!0,result:e}},C=function(e){return{ok:!1,error:e}},S=function(e){return!0===e.ok?Promise.resolve(e.result):Promise.reject(e.error)},E=function(e,t){return!0===t.ok?t.result:e},W=function(e){if(!0===e.ok)return e.result;throw e.error},T=function(e,t){return!0===t.ok?I(e(t.result)):t},A=function(e,t,n){return!1===t.ok?t:!1===n.ok?n:I(e(t.result,n.result))},P=function(e,t){return!0===t.ok?t:C(e(t.error))},M=function(e,t){return!0===t.ok?e(t.result):t},O=(Object.freeze({ok:I,isOk:function(e){return!0===e.ok},err:C,isErr:function(e){return!1===e.ok},asPromise:S,withDefault:E,withException:W,successes:function(e){return e.reduce((function(e,t){return!0===t.ok?e.concat(t.result):e}),[])},map:T,map2:A,mapError:P,andThen:M}),function(){return(O=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)});function j(e,t){if(e===t)return!0;if(null===e&&null===t)return!0;if(typeof e!==typeof t)return!1;if("object"===typeof e){if(Array.isArray(e)){if(!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!j(e[n],t[n]))return!1;return!0}var r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(n=0;n<r.length;n++){if(!t.hasOwnProperty(r[n]))return!1;if(!j(e[r[n]],t[r[n]]))return!1}return!0}}var D=function(e){return Array.isArray(e)},L=function(e){return"object"===typeof e&&null!==e&&!D(e)},N=function(e,t){return"expected "+e+", got "+function(e){switch(typeof e){case"string":return"a string";case"number":return"a number";case"boolean":return"a boolean";case"undefined":return"undefined";case"object":return e instanceof Array?"an array":null===e?"null":"an object";default:return JSON.stringify(e)}}(t)},R=function(e){return e.map((function(e){return"string"===typeof e?"."+e:"["+e+"]"})).join("")},F=function(e,t){var n=t.at,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(t,["at"]);return O({at:e+(n||"")},r)},B=function(){function e(t){var n=this;this.decode=t,this.run=function(e){return P((function(t){return{kind:"DecoderError",input:e,at:"input"+(t.at||""),message:t.message||""}}),n.decode(e))},this.runPromise=function(e){return S(n.run(e))},this.runWithException=function(e){return W(n.run(e))},this.map=function(t){return new e((function(e){return T(t,n.decode(e))}))},this.andThen=function(t){return new e((function(e){return M((function(n){return t(n).decode(e)}),n.decode(e))}))},this.where=function(t,r){return n.andThen((function(n){return t(n)?e.succeed(n):e.fail(r)}))}}return e.string=function(){return new e((function(e){return"string"===typeof e?I(e):C({message:N("a string",e)})}))},e.number=function(){return new e((function(e){return"number"===typeof e?I(e):C({message:N("a number",e)})}))},e.boolean=function(){return new e((function(e){return"boolean"===typeof e?I(e):C({message:N("a boolean",e)})}))},e.constant=function(t){return new e((function(e){return j(e,t)?I(t):C({message:"expected "+JSON.stringify(t)+", got "+JSON.stringify(e)})}))},e.object=function(t){return new e((function(e){if(L(e)&&t){var n={};for(var r in t)if(t.hasOwnProperty(r)){var i=t[r].decode(e[r]);if(!0!==i.ok)return void 0===e[r]?C({message:"the key '"+r+"' is required but was not present"}):C(F("."+r,i.error));void 0!==i.result&&(n[r]=i.result)}return I(n)}return L(e)?I(e):C({message:N("an object",e)})}))},e.array=function(t){return new e((function(e){if(D(e)&&t){return e.reduce((function(e,n,r){return A((function(e,t){return e.concat([t])}),e,function(e,n){return P((function(e){return F("["+n+"]",e)}),t.decode(e))}(n,r))}),I([]))}return D(e)?I(e):C({message:N("an array",e)})}))},e.tuple=function(t){return new e((function(e){if(D(e)){if(e.length!==t.length)return C({message:"expected a tuple of length "+t.length+", got one of length "+e.length});for(var n=[],r=0;r<t.length;r++){var i=t[r].decode(e[r]);if(!i.ok)return C(F("["+r+"]",i.error));n[r]=i.result}return I(n)}return C({message:N("a tuple of length "+t.length,e)})}))},e.union=function(t,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];return e.oneOf.apply(e,[t,n].concat(r))},e.intersection=function(t,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];return new e((function(e){return[t,n].concat(r).reduce((function(t,n){return A(Object.assign,t,n.decode(e))}),I({}))}))},e.anyJson=function(){return new e((function(e){return I(e)}))},e.unknownJson=function(){return new e((function(e){return I(e)}))},e.dict=function(t){return new e((function(e){if(L(e)){var n={};for(var r in e)if(e.hasOwnProperty(r)){var i=t.decode(e[r]);if(!0!==i.ok)return C(F("."+r,i.error));n[r]=i.result}return I(n)}return C({message:N("an object",e)})}))},e.optional=function(t){return new e((function(e){return void 0===e||null===e?I(void 0):t.decode(e)}))},e.oneOf=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new e((function(e){for(var n=[],r=0;r<t.length;r++){var i=t[r].decode(e);if(!0===i.ok)return i;n[r]=i.error}var o=n.map((function(e){return"at error"+(e.at||"")+": "+e.message})).join('", "');return C({message:'expected a value matching one of the decoders, got the errors ["'+o+'"]'})}))},e.withDefault=function(t,n){return new e((function(e){return I(E(t,n.decode(e)))}))},e.valueAt=function(t,n){return new e((function(e){for(var r=e,i=0;i<t.length;i++){if(void 0===r)return C({at:R(t.slice(0,i+1)),message:"path does not exist"});if("string"===typeof t[i]&&!L(r))return C({at:R(t.slice(0,i+1)),message:N("an object",r)});if("number"===typeof t[i]&&!D(r))return C({at:R(t.slice(0,i+1)),message:N("an array",r)});r=r[t[i]]}return P((function(e){return void 0===r?{at:R(t),message:"path does not exist"}:F(R(t),e)}),n.decode(r))}))},e.succeed=function(t){return new e((function(e){return I(t)}))},e.fail=function(t){return new e((function(e){return C({message:t})}))},e.lazy=function(t){return new e((function(e){return t().decode(e)}))},e}(),z=B.string,H=B.number,q=B.boolean,$=B.anyJson,U=B.constant,G=B.object,V=B.array,J=B.optional,K=B.oneOf,X=B.intersection,Y=B.lazy,Z=z().where((function(e){return e.length>0}),"Expected a non-empty string"),Q=H().where((function(e){return e>=0}),"Expected a non-negative number"),ee=G({inWorkspace:q()}),te=K(U("workspace"),U("row"),U("column"),U("group")),ne=K(U("row"),U("column"),U("group")),re=K(U("maximized"),U("minimized"),U("normal")),ie=function(e,t){var n=typeof e;if(t&&"function"!==n&&"undefined"!==n)throw new Error("Provided argument must be either undefined or of type function, provided: ".concat(n));if(!t&&"function"!==n)throw new Error("Provided argument must be of type function, provided: ".concat(n))},oe=J(G({saveLayout:J(q())})),ae=G({name:Z}),se=G({type:J(U("window")),appName:J(Z),windowId:J(Z),context:J($())}),ce=G({type:U("window"),appName:J(Z),windowId:J(Z),context:J($())}),ue=J(G({type:J(ne),children:J(Y((function(){return V(K(se,ue))})))})),de=G({type:ne,children:J(Y((function(){return V(K(ce,de))})))}),le=(K(z().where((function(e){return"maximized"===e.toLowerCase()}),"Expected a case insensitive variation of 'maximized'"),z().where((function(e){return"normal"===e.toLowerCase()}),"Expected a case insensitive variation of 'normal'")),G({bounds:J(G({left:J(H()),top:J(H()),width:J(Q),height:J(Q)}))})),pe=K(U("direct"),U("delayed"),U("lazy")),he=J(G({app:J(Z),context:J($()),restoreType:J(pe),title:J(Z),reuseWorkspaceId:J(Z),frameId:J(Z),lockdown:J(q()),activateFrame:J(q()),newFrame:J(K(le,q())),noTabHeader:J(q()),inMemoryLayout:J(q())})),fe=G({name:Z,restoreOptions:J(he)}),me=G({children:J(V(K(se,ue))),context:J($()),config:J(G({title:J(Z),position:J(Q),isFocused:J(q()),noTabHeader:J(q()),reuseWorkspaceId:J(Z)})),frame:J(G({reuseFrameId:J(Z),newFrame:J(K(q(),le))}))}),ve=G({type:te,definition:J(K(me,ue))}),ge=X(me,G({saveConfig:J(G({saveLayout:J(q())}))})),ye=G({itemId:Z}),we=G({id:Z}),be=(G({id:Z,frameId:Z,positionIndex:H(),title:Z,focused:q(),layoutName:J(Z)}),G({type:ne,id:Z,frameId:Z,workspaceId:Z,positionIndex:H()}),K(U("frame"),U("workspace"),U("container"),U("window"))),ke=G({type:be,branch:Z}),xe=K(U("opened"),U("closing"),U("closed"),U("focus"),U("added"),U("loaded"),U("removed"),U("childrenUpdate"),U("containerChange"),U("maximized"),U("minimized"),U("normal"),U("selected")),_e=G({frameId:Z,title:Z,positionIndex:Q,name:Z,layoutName:J(Z),isHibernated:q(),isSelected:q()}),Ie=G({frameId:Z,workspaceId:Z,positionIndex:H()}),Ce=$(),Se=X(Ie,G({windowId:J(Z),isMaximized:J(q()),isFocused:q(),title:J(z()),appName:J(Z)})),Ee=G({id:Z,config:K(Ce,Se),children:J(Y((function(){return V(Ee)}))),type:K(U("window"),U("row"),U("column"),U("group"))}),We=G({id:Z,config:_e,children:V(Ee),frameSummary:we}),Te=G({id:J(Z),config:K(Ce,Se),children:J(Y((function(){return V(Te)}))),type:K(U("window"),U("row"),U("column"),U("group"))}),Ae=G({type:U("window"),config:G({appName:Z,url:J(Z),title:J(z())})}),Pe=G({type:U("group"),config:$(),children:V(K(Ae))}),Me=G({type:U("column"),config:$(),children:V(K(Pe,Ae,Y((function(){return Me})),Y((function(){return Oe}))))}),Oe=G({type:U("row"),config:$(),children:V(K(Me,Pe,Ae,Y((function(){return Oe}))))}),je=G({name:Z,type:U("Workspace"),metadata:J($()),components:V(G({type:U("Workspace"),state:G({config:$(),context:$(),children:V(K(Oe,Me,Pe,Ae))})}))}),De=G({layout:je,mode:K(U("replace"),U("merge"))}),Le=G({layouts:V(je)}),Ne=G({id:Z}),Re=G({summaries:V(Ne)}),Fe=G({id:Z,config:_e}),Be=G({summaries:V(Fe)}),ze=G({id:Z,config:$(),workspaces:V(We)}),He=G({name:Z}),qe=G({summaries:V(He)}),$e=G({windowId:Z}),Ue=$(),Ge=G({state:re}),Ve=G({width:J(Q),height:J(Q),relative:J(q())}),Je=G({top:J(H()),left:J(H()),relative:J(q())}),Ke=G({itemId:Z}),Xe=G({frameId:Z,requestedState:re}),Ye=G({itemId:Z,title:Z}),Ze=G({itemId:Z,containerId:Z}),Qe=X(Ke,Ve),et=X(Ke,Je),tt=(G({id:Z,type:ne}),G({definition:se,parentId:Z,parentType:te})),nt=G({definition:de,parentId:Z,parentType:te}),rt=G({itemId:Z,windowId:J(Z)}),it=G({live:q()}),ot=G({type:K(U("row"),U("column")),workspaceId:Z}),at=G({itemId:Z,config:Ce}),st=G({frameSummary:we}),ct=G({workspaceSummary:Fe,frameSummary:we}),ut=G({containerSummary:at}),dt=G({windowSummary:G({itemId:Z,parentId:Z,config:Se})}),lt=G({name:Z,workspaceId:Z,saveContext:J(q())}),pt=G({workspaceId:Z}),ht="T42.Web.Platform.Control",ft="T42.Web.Platform.WSP.Stream",mt={control:{name:"T42.Workspaces.Control",isStream:!1},frameStream:{name:"T42.Workspaces.Stream.Frame",isStream:!0},workspaceStream:{name:"T42.Workspaces.Stream.Workspace",isStream:!0},containerStream:{name:"T42.Workspaces.Stream.Container",isStream:!0},windowStream:{name:"T42.Workspaces.Stream.Window",isStream:!0}},vt={frame:{name:"T42.Workspaces.Stream.Frame",payloadDecoder:st},workspace:{name:"T42.Workspaces.Stream.Workspace",payloadDecoder:ct},container:{name:"T42.Workspaces.Stream.Container",payloadDecoder:ut},window:{name:"T42.Workspaces.Stream.Window",payloadDecoder:dt}},gt={ping:{name:"ping",resultDecoder:it},isWindowInWorkspace:{name:"isWindowInWorkspace",argsDecoder:Ke,resultDecoder:ee},createWorkspace:{name:"createWorkspace",resultDecoder:We,argsDecoder:ge},getAllFramesSummaries:{name:"getAllFramesSummaries",resultDecoder:Re},getFrameSummary:{name:"getFrameSummary",resultDecoder:we,argsDecoder:ye},getAllWorkspacesSummaries:{name:"getAllWorkspacesSummaries",resultDecoder:Be},getWorkspaceSnapshot:{name:"getWorkspaceSnapshot",resultDecoder:We,argsDecoder:Ke},getAllLayoutsSummaries:{name:"getAllLayoutsSummaries",resultDecoder:qe},openWorkspace:{name:"openWorkspace",argsDecoder:fe,resultDecoder:We},deleteLayout:{name:"deleteLayout",resultDecoder:Ue,argsDecoder:ae},saveLayout:{name:"saveLayout",resultDecoder:je,argsDecoder:lt},importLayout:{name:"importLayout",resultDecoder:Ue,argsDecoder:De},exportAllLayouts:{name:"exportAllLayouts",resultDecoder:Le},restoreItem:{name:"restoreItem",argsDecoder:Ke,resultDecoder:Ue},maximizeItem:{name:"maximizeItem",argsDecoder:Ke,resultDecoder:Ue},focusItem:{name:"focusItem",argsDecoder:Ke,resultDecoder:Ue},closeItem:{name:"closeItem",argsDecoder:Ke,resultDecoder:Ue},resizeItem:{name:"resizeItem",argsDecoder:Qe,resultDecoder:Ue},changeFrameState:{name:"changeFrameState",argsDecoder:Xe,resultDecoder:Ue},getFrameState:{name:"getFrameState",argsDecoder:Ke,resultDecoder:Ge},moveFrame:{name:"moveFrame",argsDecoder:et,resultDecoder:Ue},getFrameSnapshot:{name:"getFrameSnapshot",argsDecoder:Ke,resultDecoder:ze},forceLoadWindow:{name:"forceLoadWindow",argsDecoder:Ke,resultDecoder:$e},ejectWindow:{name:"ejectWindow",argsDecoder:Ke,resultDecoder:$e},setItemTitle:{name:"setItemTitle",argsDecoder:Ye,resultDecoder:Ue},moveWindowTo:{name:"moveWindowTo",argsDecoder:Ze,resultDecoder:Ue},addWindow:{name:"addWindow",argsDecoder:tt,resultDecoder:rt},addContainer:{name:"addContainer",argsDecoder:nt,resultDecoder:rt},bundleWorkspace:{name:"bundleWorkspace",argsDecoder:ot,resultDecoder:Ue},hibernateWorkspace:{name:"hibernateWorkspace",argsDecoder:pt,resultDecoder:Ue},resumeWorkspace:{name:"resumeWorkspace",argsDecoder:pt,resultDecoder:Ue}},yt=function(){function e(t,n){Object(w.a)(this,e),this.transport=t,this.registry=n,this.activeSubscriptions=[]}return Object(b.a)(e,[{key:"createCoreEventSubscription",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.transport.coreSubscriptionReady(this.handleCoreEvent.bind(this));case 2:case"end":return e.stop()}}),e,this)})))}},{key:"handleCoreSubscription",value:function(e){var t=this,n="".concat(e.eventType,"-").concat(e.action),r=e.scope,i=e.scopeId;return this.registry.add(n,(function(n){var o,a,s,c,u,d={type:r,id:i},l={frame:(null===(o=n.frameSummary)||void 0===o?void 0:o.id)||(null===(a=n.windowSummary)||void 0===a?void 0:a.config.frameId),workspace:(null===(s=n.workspaceSummary)||void 0===s?void 0:s.id)||(null===(c=n.windowSummary)||void 0===c?void 0:c.config.workspaceId),window:null===(u=n.windowSummary)||void 0===u?void 0:u.config.windowId};t.checkScopeMatch(d,l)&&e.callback(n)}))}},{key:"send",value:function(e,t){return k(this,void 0,void 0,y.a.mark((function n(){var r,i,o;return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=Object.values(gt).find((function(t){return t.name===e}))){n.next=3;break}throw new Error("Cannot find definition for operation name: ".concat(e));case 3:if(!r.argsDecoder){n.next=11;break}n.prev=4,r.argsDecoder.runWithException(t),n.next=11;break;case 8:throw n.prev=8,n.t0=n.catch(4),new Error("Unexpected internal outgoing validation error: ".concat(n.t0.message,", for input: ").concat(JSON.stringify(n.t0.input),", for operation ").concat(e));case 11:return n.prev=11,n.next=14,this.transport.transmitControl(r.name,t);case 14:o=n.sent,i=r.resultDecoder.runWithException(o),n.next=23;break;case 18:if(n.prev=18,n.t1=n.catch(11),!n.t1.kind){n.next=22;break}throw new Error("Unexpected internal incoming validation error: ".concat(n.t1.message,", for input: ").concat(JSON.stringify(n.t1.input),", for operation ").concat(e));case 22:throw new Error(n.t1.message);case 23:return n.abrupt("return",i);case 24:case"end":return n.stop()}}),n,this,[[4,8],[11,18]])})))}},{key:"subscribe",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r,i,o,a,s=this;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=this.getActiveSubscription(e),r=this.getRegistryKey(e),n){t.next=10;break}return i=vt[e.eventType],t.next=6,this.transport.subscribe(i.name,this.getBranchKey(e),e.eventType);case 6:(o=t.sent).onData((function(e){var t=e.data,n=ke.run(e.requestArguments),r=xe.run(t.action);if(n.ok&&r.ok){var i=n.result.type,o=n.result.branch,a=vt[i].payloadDecoder.run(t.payload);if(a.ok){var c="".concat(i,"-").concat(o,"-").concat(r.result);s.registry.execute(c,a.result)}}})),n={streamType:e.eventType,level:e.scope,levelId:e.scopeId,callbacksCount:0,gdSub:o},this.activeSubscriptions.push(n);case 10:return a=this.registry.add(r,e.callback),++n.callbacksCount,t.abrupt("return",(function(){a(),--n.callbacksCount,0===n.callbacksCount&&(n.gdSub.close(),s.activeSubscriptions.splice(s.activeSubscriptions.indexOf(n),1))}));case 13:case"end":return t.stop()}}),t,this)})))}},{key:"checkScopeMatch",value:function(e,t){return"global"===e.type||("frame"===e.type&&e.id===t.frame||("workspace"===e.type&&e.id===t.workspace||"window"===e.type&&e.id===t.window))}},{key:"handleCoreEvent",value:function(e){var t=e.data;try{var n=xe.runWithException(t.action),r=be.runWithException(t.type),i=vt[r].payloadDecoder.runWithException(t.payload),o="".concat(r,"-").concat(n);this.registry.execute(o,i)}catch(a){console.warn("Cannot handle event with data ".concat(JSON.stringify(t),", because of validation error: ").concat(a.message))}}},{key:"getBranchKey",value:function(e){return"global"===e.scope?e.scope:"".concat(e.scope,"_").concat(e.scopeId)}},{key:"getRegistryKey",value:function(e){return"".concat(e.eventType,"-").concat(this.getBranchKey(e),"-").concat(e.action)}},{key:"getActiveSubscription",value:function(e){return this.activeSubscriptions.find((function(t){return t.streamType===e.eventType&&t.level===e.scope&&t.levelId===e.scopeId}))}}]),e}(),wt=function(){function e(t){Object(w.a)(this,e),this.agm=t,this.defaultTransportTimeout=3e4,this.coreEventMethodInitiated=!1}return Object(b.a)(e,[{key:"initiate",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n=this;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!window.glue42gd){t.next=4;break}return t.next=3,Promise.all(Object.values(mt).map((function(e){return n.verifyMethodLive(e.name)})));case 3:return t.abrupt("return");case 4:return t.next=6,Promise.all([this.verifyMethodLive(ht),this.verifyMethodLive(ft)]);case 6:return t.next=8,this.transmitControl("frameHello",{windowId:e});case 8:case"end":return t.stop()}}),t,this)})))}},{key:"coreSubscriptionReady",value:function(e){return this.coreEventMethodInitiated||this.subscribePlatform(e),this.corePlatformSubPromise}},{key:"subscribePlatform",value:function(e){this.coreEventMethodInitiated=!0,this.corePlatformSubPromise=this.agm.subscribe(ft),this.corePlatformSubPromise.then((function(t){t.onData((function(t){return e(t.data)}))}))}},{key:"subscribe",value:function(e,t,n){return k(this,void 0,void 0,y.a.mark((function r(){var i,o,a;return y.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i={branch:t,type:n},r.prev=1,r.next=4,this.agm.subscribe(e,{arguments:i});case 4:o=r.sent,r.next=11;break;case 7:throw r.prev=7,r.t0=r.catch(1),a="Internal subscription error! Error details: stream - ".concat(e,", branch: ").concat(t,". Internal message: ").concat(r.t0.message),new Error(a);case 11:return r.abrupt("return",o);case 12:case"end":return r.stop()}}),r,this,[[1,7]])})))}},{key:"transmitControl",value:function(e,t){return k(this,void 0,void 0,y.a.mark((function n(){var r,i,o,a,s;return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=window.glue42gd?{operation:e,operationArguments:t}:{operation:e,domain:"workspaces",data:t},i=window.glue42gd?mt.control.name:ht,a="Internal Workspaces Communication Error. Attempted operation: ".concat(JSON.stringify(r),". "),n.prev=3,n.next=6,this.agm.invoke(i,r,"best",{methodResponseTimeoutMs:this.defaultTransportTimeout});case 6:if(o=n.sent){n.next=9;break}throw new Error("Received unsupported result from GD - empty result");case 9:if(Array.isArray(o.all_return_values)&&0!==o.all_return_values.length){n.next=11;break}throw new Error("Received unsupported result from GD - empty values collection");case 11:n.next=19;break;case 13:if(n.prev=13,n.t0=n.catch(3),!(n.t0&&n.t0.all_errors&&n.t0.all_errors.length)){n.next=18;break}throw s=n.t0.all_errors[0].message,new Error("".concat(a," -> Inner message: ").concat(s));case 18:throw new Error("".concat(a," -> Inner message: ").concat(n.t0.message));case 19:return n.abrupt("return",o.all_return_values[0].returned);case 20:case"end":return n.stop()}}),n,this,[[3,13]])})))}},{key:"verifyMethodLive",value:function(e){var t,n,r,i=this;return t=function(){return new Promise((function(t){if(i.agm.methods().some((function(t){return t.name===e})))t();else var n=i.agm.methodAdded((function(r){r.name===e&&(n?(n(),n=null):setTimeout((function(){n&&n()}),0),t())}))}))},n=15e3,r="Timeout waiting for the Workspaces communication channels",new Promise((function(e,i){var o=!0,a=setTimeout((function(){if(o){o=!1;var e=r||"Promise timeout hit: ".concat(n);i(e)}}),n);t().then((function(t){o&&(o=!1,clearTimeout(a),e(t))})).catch((function(e){o&&(o=!1,clearTimeout(a),i(e))}))}))}}]),e}(),bt=new WeakMap,kt=function(){function e(t,n){Object(w.a)(this,e);var r=n.wrapChildren(t.children);delete t.children,bt.set(this,{base:n,children:r,definition:t})}return Object(b.a)(e,[{key:"addColumn",value:function(e){return bt.get(this).base.add("column",bt.get(this).children,e)}},{key:"addRow",value:function(e){return bt.get(this).base.add("row",bt.get(this).children,e)}},{key:"addGroup",value:function(e){return bt.get(this).base.add("group",bt.get(this).children,e)}},{key:"addWindow",value:function(e){return bt.get(this).base.addWindow(bt.get(this).children,e),this}},{key:"serialize",value:function(){var e=bt.get(this).definition;return e.children=bt.get(this).base.serializeChildren(bt.get(this).children),e}},{key:"type",get:function(){return bt.get(this).definition.type}}]),e}(),xt=function(){function e(t){Object(w.a)(this,e),this.getBuilder=t}return Object(b.a)(e,[{key:"wrapChildren",value:function(e){var t=this;return e.map((function(e){return"window"===e.type?e:t.getBuilder({type:e.type,definition:e})}))}},{key:"add",value:function(e,t,n){var r=ue.runWithException(n),i=this.getBuilder({type:e,definition:r});return t.push(i),i}},{key:"addWindow",value:function(e,t){var n=se.runWithException(t);n.type="window",e.push(n)}},{key:"serializeChildren",value:function(e){return e.map((function(e){return e instanceof kt?e.serialize():e}))}}]),e}(),_t=new WeakMap,It=function(){function e(t,n,r){Object(w.a)(this,e);var i=n.wrapChildren(t.children);delete t.children,_t.set(this,{base:n,children:i,definition:t,controller:r})}return Object(b.a)(e,[{key:"addColumn",value:function(e){var t=_t.get(this).children;if(!t.every((function(e){return e instanceof kt&&"column"===e.type})))throw new Error("Cannot add a column to this workspace, because there are already children of another type");return _t.get(this).base.add("column",t,e)}},{key:"addRow",value:function(e){var t=_t.get(this).children;if(!t.every((function(e){return e instanceof kt&&"row"===e.type})))throw new Error("Cannot add a row to this workspace, because there are already children of another type");return _t.get(this).base.add("row",t,e)}},{key:"addGroup",value:function(e){var t=_t.get(this).children;if(0!==t.length)throw new Error("Cannot add a group to this workspace, because there are already defined children.");return _t.get(this).base.add("group",t,e)}},{key:"addWindow",value:function(e){var t=_t.get(this).children;if(0!==t.length)throw new Error("Cannot add a window to this workspace, because there are already defined children.");return _t.get(this).base.addWindow(t,e),this}},{key:"getChildAt",value:function(e){return Q.runWithException(e),_t.get(this).children[e]}},{key:"create",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r,i;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=oe.runWithException(e),(r=_t.get(this).definition).children=_t.get(this).base.serializeChildren(_t.get(this).children),i=_t.get(this).controller,t.abrupt("return",i.createWorkspace(r,n));case 5:case"end":return t.stop()}}),t,this)})))}}]),e}(),Ct=new WeakMap,St=function(e){return Ct.get(e).base},Et=function(){function e(t){Object(w.a)(this,e),Ct.set(this,{base:t})}return Object(b.a)(e,[{key:"addWindow",value:function(e){return St(this).addWindow(this,e,"row")}},{key:"addGroup",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(null===e||void 0===e?void 0:e.type)||"group"===e.type){t.next=2;break}throw new Error("Expected a group definition, but received ".concat(e.type));case 2:return t.abrupt("return",St(this).addParent(this,"group","row",e));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"addColumn",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(null===e||void 0===e?void 0:e.type)||"column"===e.type){t.next=2;break}throw new Error("Expected a column definition, but received ".concat(e.type));case 2:return t.abrupt("return",St(this).addParent(this,"column","row",e));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"addRow",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("Adding rows as row children is not supported");case 1:case"end":return e.stop()}}),e)})))}},{key:"removeChild",value:function(e){return St(this).removeChild(this,e)}},{key:"maximize",value:function(){return St(this).maximize(this)}},{key:"restore",value:function(){return St(this).restore(this)}},{key:"close",value:function(){return St(this).close(this)}},{key:"type",get:function(){return"row"}},{key:"id",get:function(){return St(this).getId(this)}},{key:"frameId",get:function(){return St(this).getFrameId(this)}},{key:"workspaceId",get:function(){return St(this).getWorkspaceId(this)}},{key:"positionIndex",get:function(){return St(this).getPositionIndex(this)}},{key:"children",get:function(){return St(this).getAllChildren(this)}},{key:"parent",get:function(){return St(this).getMyParent(this)}},{key:"frame",get:function(){return St(this).getMyFrame(this)}},{key:"workspace",get:function(){return St(this).getMyWorkspace(this)}}]),e}(),Wt=new WeakMap,Tt=function(e){return Wt.get(e).base},At=function(){function e(t){Object(w.a)(this,e),Wt.set(this,{base:t})}return Object(b.a)(e,[{key:"addWindow",value:function(e){return Tt(this).addWindow(this,e,"column")}},{key:"addGroup",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(null===e||void 0===e?void 0:e.type)||"group"===e.type){t.next=2;break}throw new Error("Expected a group definition, but received ".concat(e.type));case 2:return t.abrupt("return",Tt(this).addParent(this,"group","column",e));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"addColumn",value:function(e){return k(this,void 0,void 0,y.a.mark((function e(){return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("Adding columns as column children is not supported");case 1:case"end":return e.stop()}}),e)})))}},{key:"addRow",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(null===e||void 0===e?void 0:e.type)||"row"===e.type){t.next=2;break}throw new Error("Expected a row definition, but received ".concat(e.type));case 2:return t.abrupt("return",Tt(this).addParent(this,"row","column",e));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"removeChild",value:function(e){return Tt(this).removeChild(this,e)}},{key:"maximize",value:function(){return Tt(this).maximize(this)}},{key:"restore",value:function(){return Tt(this).restore(this)}},{key:"close",value:function(){return Tt(this).close(this)}},{key:"type",get:function(){return"column"}},{key:"id",get:function(){return Tt(this).getId(this)}},{key:"frameId",get:function(){return Tt(this).getFrameId(this)}},{key:"workspaceId",get:function(){return Tt(this).getWorkspaceId(this)}},{key:"positionIndex",get:function(){return Tt(this).getPositionIndex(this)}},{key:"children",get:function(){return Tt(this).getAllChildren(this)}},{key:"parent",get:function(){return Tt(this).getMyParent(this)}},{key:"frame",get:function(){return Tt(this).getMyFrame(this)}},{key:"workspace",get:function(){return Tt(this).getMyWorkspace(this)}}]),e}(),Pt=new WeakMap,Mt=function(e){return Pt.get(e).base},Ot=function(){function e(t){Object(w.a)(this,e),Pt.set(this,{base:t})}return Object(b.a)(e,[{key:"addWindow",value:function(e){return Mt(this).addWindow(this,e,"group")}},{key:"addGroup",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("Adding groups as group child is not supported");case 1:case"end":return e.stop()}}),e)})))}},{key:"addColumn",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("Adding columns as group child is not supported");case 1:case"end":return e.stop()}}),e)})))}},{key:"addRow",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("Adding rows as group child is not supported");case 1:case"end":return e.stop()}}),e)})))}},{key:"removeChild",value:function(e){return Mt(this).removeChild(this,e)}},{key:"maximize",value:function(){return Mt(this).maximize(this)}},{key:"restore",value:function(){return Mt(this).restore(this)}},{key:"close",value:function(){return Mt(this).close(this)}},{key:"type",get:function(){return"group"}},{key:"id",get:function(){return Mt(this).getId(this)}},{key:"frameId",get:function(){return Mt(this).getFrameId(this)}},{key:"workspaceId",get:function(){return Mt(this).getWorkspaceId(this)}},{key:"positionIndex",get:function(){return Mt(this).getPositionIndex(this)}},{key:"children",get:function(){return Mt(this).getAllChildren(this)}},{key:"parent",get:function(){return Mt(this).getMyParent(this)}},{key:"frame",get:function(){return Mt(this).getMyFrame(this)}},{key:"workspace",get:function(){return Mt(this).getMyWorkspace(this)}}]),e}(),jt=new WeakMap,Dt=function(e){return jt.get(e).manager.getWorkspaceData(e)},Lt=function(e){return jt.get(e).manager},Nt=function(){function e(t){Object(w.a)(this,e),jt.set(this,{manager:t})}return Object(b.a)(e,[{key:"removeChild",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(ie(e),n=this.children.find(e)){t.next=4;break}return t.abrupt("return");case 4:return t.next=6,n.close();case 6:return t.next=8,this.refreshReference();case 8:case"end":return t.stop()}}),t,this)})))}},{key:"remove",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),n=Dt(this).controller,r=n.iterateFindChild(this.children,e),t.next=5,r.close();case 5:return t.next=7,this.refreshReference();case 7:case"end":return t.stop()}}),t,this)})))}},{key:"focus",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Dt(this).controller.focusItem(this.id);case 2:return e.next=4,this.refreshReference();case 4:case"end":return e.stop()}}),e,this)})))}},{key:"close",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){var t,n,r=this;return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=Dt(this).controller,e.next=3,Dt(this).frame.workspaces();case 3:if(n=e.sent,!(1===n.length&&n.every((function(e){return e.id===r.id})))){e.next=7;break}return e.abrupt("return",this.frame.close());case 7:return e.next=9,t.closeItem(this.id);case 9:case"end":return e.stop()}}),e,this)})))}},{key:"snapshot",value:function(){return Dt(this).controller.getSnapshot(this.id,"workspace")}},{key:"saveLayout",value:function(e,t){return k(this,void 0,void 0,y.a.mark((function n(){return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return Z.runWithException(e),n.next=3,Dt(this).controller.saveLayout({name:e,workspaceId:this.id,saveContext:null===t||void 0===t?void 0:t.saveContext});case 3:case"end":return n.stop()}}),n,this)})))}},{key:"setTitle",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return Z.runWithException(e),n=Dt(this).controller,t.next=4,n.setItemTitle(this.id,e);case 4:return t.next=6,this.refreshReference();case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getContext",value:function(){return Dt(this).controller.getWorkspaceContext(this.id)}},{key:"setContext",value:function(e){return Dt(this).controller.setWorkspaceContext(this.id,e)}},{key:"updateContext",value:function(e){return Dt(this).controller.updateWorkspaceContext(this.id,e)}},{key:"onContextUpdated",value:function(e){return Dt(this).controller.subscribeWorkspaceContextUpdated(this.id,e)}},{key:"refreshReference",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){var t,n,r,i,o,a,s,c=this;return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Dt(this).controller.getSnapshot(this.id,"workspace");case 2:t=e.sent,n=t.children.reduce((function(e,t){var n;return(n="window"===t.type?c.getWindow((function(e){return e.id===t.id})):c.getBox((function(e){return e.id===t.id})))&&e.push(n),e}),[]),r=Dt(this).controller.refreshChildren({existingChildren:n,workspace:this,parent:this,children:t.children}),(i=this.frame).id===t.config.frameId?(Lt(this).remapFrame(i,t.frameSummary),o=i):(a={summary:t.frameSummary},s=Dt(this).ioc.getModel("frame",a),o=s),Lt(this).remapWorkspace(this,{config:t.config,children:r,frame:o});case 8:case"end":return e.stop()}}),e,this)})))}},{key:"getBox",value:function(e){ie(e);var t=Dt(this).children;return Dt(this).controller.iterateFindChild(t,(function(t){return"window"!==t.type&&e(t)}))}},{key:"getAllBoxes",value:function(e){ie(e,!0);var t=Dt(this).children,n=Dt(this).controller.iterateFilterChildren(t,(function(e){return"window"!==e.type}));return e?n.filter(e):n}},{key:"getRow",value:function(e){return ie(e),this.getBox((function(t){return"row"===t.type&&e(t)}))}},{key:"getAllRows",value:function(e){return ie(e,!0),e?this.getAllBoxes((function(t){return"row"===t.type&&e(t)})):this.getAllBoxes((function(e){return"row"===e.type}))}},{key:"getColumn",value:function(e){return ie(e),this.getBox((function(t){return"column"===t.type&&e(t)}))}},{key:"getAllColumns",value:function(e){return ie(e,!0),e?this.getAllBoxes((function(t){return"column"===t.type&&e(t)})):this.getAllBoxes((function(e){return"column"===e.type}))}},{key:"getGroup",value:function(e){return ie(e),this.getBox((function(t){return"group"===t.type&&e(t)}))}},{key:"getAllGroups",value:function(e){return ie(e,!0),e?this.getAllBoxes((function(t){return"group"===t.type&&e(t)})):this.getAllBoxes((function(e){return"group"===e.type}))}},{key:"getWindow",value:function(e){ie(e);var t=Dt(this).children;return Dt(this).controller.iterateFindChild(t,(function(t){return"window"===t.type&&e(t)}))}},{key:"getAllWindows",value:function(e){ie(e,!0);var t=Dt(this).children,n=Dt(this).controller.iterateFilterChildren(t,(function(e){return"window"===e.type}));return e?n.filter(e):n}},{key:"addRow",value:function(e){return Dt(this).base.addParent(this,"row","workspace",e)}},{key:"addColumn",value:function(e){return Dt(this).base.addParent(this,"column","workspace",e)}},{key:"addGroup",value:function(e){return Dt(this).base.addParent(this,"group","workspace",e)}},{key:"addWindow",value:function(e){return Dt(this).base.addWindow(this,e,"workspace")}},{key:"bundleToRow",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Dt(this).controller.bundleTo("row",this.id);case 2:return e.next=4,this.refreshReference();case 4:case"end":return e.stop()}}),e,this)})))}},{key:"bundleToColumn",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Dt(this).controller.bundleTo("column",this.id);case 2:return e.next=4,this.refreshReference();case 4:case"end":return e.stop()}}),e,this)})))}},{key:"hibernate",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Dt(this).controller.hibernateWorkspace(this.id);case 2:return e.next=4,this.refreshReference();case 4:case"end":return e.stop()}}),e,this)})))}},{key:"resume",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Dt(this).controller.resumeWorkspace(this.id);case 2:return e.next=4,this.refreshReference();case 4:case"end":return e.stop()}}),e,this)})))}},{key:"onClosed",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r,i,o=this;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),n=Dt(this).id,r={action:"closed",eventType:"workspace",scope:"workspace",scopeId:n,callback:function(){return k(o,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e();case 1:case"end":return t.stop()}}),t)})))}},t.next=6,Dt(this).controller.processLocalSubscription(r,n);case 6:return i=t.sent,t.abrupt("return",i);case 8:case"end":return t.stop()}}),t,this)})))}},{key:"onWindowAdded",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r,i,o=this;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),n=Dt(this).id,r={action:"added",eventType:"window",scope:"workspace",scopeId:n,callback:function(t){return k(o,void 0,void 0,y.a.mark((function n(){var r,i;return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.refreshReference();case 2:r=this.getBox((function(e){return e.id===t.windowSummary.parentId})),i=r.children.find((function(e){return"window"===e.type&&e.positionIndex===t.windowSummary.config.positionIndex})),e(i);case 5:case"end":return n.stop()}}),n,this)})))}},t.next=6,Dt(this).controller.processLocalSubscription(r,n);case 6:return i=t.sent,t.abrupt("return",i);case 8:case"end":return t.stop()}}),t,this)})))}},{key:"onWindowRemoved",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r,i,o=this;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),n=Dt(this).id,r={action:"removed",eventType:"window",scope:"workspace",scopeId:n,callback:function(t){return k(o,void 0,void 0,y.a.mark((function n(){var r,i,o,a;return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.refreshReference();case 2:r=t.windowSummary.config,i=r.windowId,o=r.workspaceId,a=r.frameId,e({windowId:i,workspaceId:o,frameId:a});case 4:case"end":return n.stop()}}),n,this)})))}},t.next=6,Dt(this).controller.processLocalSubscription(r,n);case 6:return i=t.sent,t.abrupt("return",i);case 8:case"end":return t.stop()}}),t,this)})))}},{key:"onWindowLoaded",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r,i,o=this;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),n=Dt(this).id,r={action:"loaded",eventType:"window",scope:"workspace",scopeId:n,callback:function(t){return k(o,void 0,void 0,y.a.mark((function n(){var r;return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.refreshReference();case 2:r=this.getWindow((function(e){return e.id&&e.id===t.windowSummary.config.windowId})),e(r);case 4:case"end":return n.stop()}}),n,this)})))}},t.next=6,Dt(this).controller.processLocalSubscription(r,n);case 6:return i=t.sent,t.abrupt("return",i);case 8:case"end":return t.stop()}}),t,this)})))}},{key:"id",get:function(){return Dt(this).id}},{key:"frameId",get:function(){return Dt(this).config.frameId}},{key:"positionIndex",get:function(){return Dt(this).config.positionIndex}},{key:"title",get:function(){return Dt(this).config.title}},{key:"layoutName",get:function(){return Dt(this).config.layoutName}},{key:"isHibernated",get:function(){return Dt(this).config.isHibernated}},{key:"children",get:function(){return Dt(this).children}},{key:"frame",get:function(){return Dt(this).frame}}]),e}(),Rt=new WeakMap,Ft=function(e){return Rt.get(e).manager.getWindowData(e)},Bt=function(){function e(t){Object(w.a)(this,e),Rt.set(this,{manager:t})}return Object(b.a)(e,[{key:"forceLoad",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){var t,n,r;return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isLoaded){e.next=2;break}return e.abrupt("return");case 2:return t=Ft(this).controller,n=Ft(this).id,e.next=6,t.forceLoadWindow(n);case 6:r=e.sent,Ft(this).config.windowId=r;case 8:case"end":return e.stop()}}),e,this)})))}},{key:"focus",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){var t,n;return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=Ft(this).id,n=Ft(this).controller,e.next=4,n.focusItem(t);case 4:case"end":return e.stop()}}),e,this)})))}},{key:"close",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){var t,n;return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=Ft(this).id,n=Ft(this).controller,e.next=4,n.closeItem(t);case 4:return e.next=6,Ft(this).parent.removeChild((function(e){return e.id===t}));case 6:case"end":return e.stop()}}),e,this)})))}},{key:"setTitle",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return Z.runWithException(e),n=Ft(this).id,r=Ft(this).controller,t.next=5,r.setItemTitle(n,e);case 5:case"end":return t.stop()}}),t,this)})))}},{key:"maximize",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){var t,n;return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=Ft(this).id,n=Ft(this).controller,e.next=4,n.maximizeItem(t);case 4:case"end":return e.stop()}}),e,this)})))}},{key:"restore",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){var t,n;return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=Ft(this).id,n=Ft(this).controller,e.next=4,n.restoreItem(t);case 4:case"end":return e.stop()}}),e,this)})))}},{key:"eject",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){var t,n;return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isLoaded){e.next=2;break}throw new Error("Cannot eject this window, because it is not loaded yet");case 2:return t=Ft(this).id,e.next=5,Ft(this).controller.ejectWindow(t);case 5:return n=e.sent,Ft(this).config.windowId=n,e.abrupt("return",this.getGdWindow());case 8:case"end":return e.stop()}}),e,this)})))}},{key:"getGdWindow",value:function(){if(!this.isLoaded)throw new Error("Cannot fetch this GD window, because the window is not yet loaded");var e=Ft(this).config.windowId;return Ft(this).controller.getGDWindow(e)}},{key:"moveTo",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e instanceof Et||e instanceof At||e instanceof Ot){t.next=2;break}throw new Error("Cannot add to the provided parent, because the provided parent is not an instance of Row, Column or Group");case 2:return n=Ft(this).id,r=Ft(this).controller,t.next=6,r.getParent((function(t){return t.id===e.id}));case 6:if(t.sent){t.next=9;break}throw new Error("Cannot move the window to the selected parent, because this parent does not exist.");case 9:return t.abrupt("return",r.moveWindowTo(n,e.id));case 10:case"end":return t.stop()}}),t,this)})))}},{key:"onRemoved",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r,i,o=this;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),n=Ft(this).id,r={callback:function(){return k(o,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.workspace.refreshReference();case 2:e();case 3:case"end":return t.stop()}}),t,this)})))},action:"removed",eventType:"window",scope:"window"},t.next=6,Ft(this).controller.processLocalSubscription(r,n);case 6:return i=t.sent,t.abrupt("return",i);case 8:case"end":return t.stop()}}),t,this)})))}},{key:"id",get:function(){return Ft(this).config.windowId}},{key:"type",get:function(){return"window"}},{key:"frameId",get:function(){return Ft(this).frame.id}},{key:"workspaceId",get:function(){return Ft(this).workspace.id}},{key:"positionIndex",get:function(){return Ft(this).config.positionIndex}},{key:"isMaximized",get:function(){return Ft(this).config.isMaximized}},{key:"isLoaded",get:function(){return Ft(this).controller.checkIsWindowLoaded(this.id)}},{key:"focused",get:function(){return Ft(this).config.isFocused}},{key:"title",get:function(){return Ft(this).config.title}},{key:"workspace",get:function(){return Ft(this).workspace}},{key:"frame",get:function(){return Ft(this).frame}},{key:"parent",get:function(){return Ft(this).parent}},{key:"appName",get:function(){return Ft(this).config.appName}}]),e}(),zt=new WeakMap,Ht=function(e){return zt.get(e).manager.getFrameData(e)},qt=function(){function e(t){Object(w.a)(this,e),zt.set(this,{manager:t})}return Object(b.a)(e,[{key:"resize",value:function(e){var t=Ve.runWithException(e),n=Ht(this).summary.id;return Ht(this).controller.resizeItem(n,t)}},{key:"move",value:function(e){var t=Je.runWithException(e),n=Ht(this).summary.id;return Ht(this).controller.moveFrame(n,t)}},{key:"focus",value:function(){var e=Ht(this).summary.id;return Ht(this).controller.focusItem(e)}},{key:"state",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){var t;return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.glue42gd){e.next=2;break}throw new Error("State operations are not supported in Glue42 Core");case 2:return t=Ht(this).summary.id,e.abrupt("return",Ht(this).controller.getFrameState(t));case 4:case"end":return e.stop()}}),e,this)})))}},{key:"minimize",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){var t;return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.glue42gd){e.next=2;break}throw new Error("State operations are not supported in Glue42 Core");case 2:return t=Ht(this).summary.id,e.abrupt("return",Ht(this).controller.changeFrameState(t,"minimized"));case 4:case"end":return e.stop()}}),e,this)})))}},{key:"maximize",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){var t;return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.glue42gd){e.next=2;break}throw new Error("State operations are not supported in Glue42 Core");case 2:return t=Ht(this).summary.id,e.abrupt("return",Ht(this).controller.changeFrameState(t,"maximized"));case 4:case"end":return e.stop()}}),e,this)})))}},{key:"restore",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){var t;return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.glue42gd){e.next=2;break}throw new Error("State operations are not supported in Glue42 Core");case 2:return t=Ht(this).summary.id,e.abrupt("return",Ht(this).controller.changeFrameState(t,"normal"));case 4:case"end":return e.stop()}}),e,this)})))}},{key:"close",value:function(){var e=Ht(this).summary.id;return Ht(this).controller.closeItem(e)}},{key:"snapshot",value:function(){var e=Ht(this).summary.id;return Ht(this).controller.getSnapshot(e,"frame")}},{key:"workspaces",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){var t,n=this;return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=Ht(this).controller,e.abrupt("return",t.getWorkspaces((function(e){return e.frameId===n.id})));case 2:case"end":return e.stop()}}),e,this)})))}},{key:"restoreWorkspace",value:function(e,t){return k(this,void 0,void 0,y.a.mark((function n(){var r;return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return Z.runWithException(e),r=he.runWithException(t),n.abrupt("return",Ht(this).controller.restoreWorkspace(e,r));case 3:case"end":return n.stop()}}),n,this)})))}},{key:"createWorkspace",value:function(e,t){var n=me.runWithException(e),r=oe.runWithException(t);return Ht(this).controller.createWorkspace(n,r)}},{key:"onClosed",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r,i;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),n=Ht(this).summary.id,r={callback:function(t){e({frameId:t.frameSummary.id})},action:"closed",eventType:"frame",scope:"frame"},t.next=6,Ht(this).controller.processLocalSubscription(r,n);case 6:return i=t.sent,t.abrupt("return",i);case 8:case"end":return t.stop()}}),t,this)})))}},{key:"onMaximized",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r,i;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),n=Ht(this).summary.id,r={callback:function(){e()},action:"maximized",eventType:"frame",scope:"frame"},t.next=6,Ht(this).controller.processLocalSubscription(r,n);case 6:return i=t.sent,t.abrupt("return",i);case 8:case"end":return t.stop()}}),t,this)})))}},{key:"onMinimized",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r,i;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),n=Ht(this).summary.id,r={callback:function(){e()},action:"minimized",eventType:"frame",scope:"frame"},t.next=6,Ht(this).controller.processLocalSubscription(r,n);case 6:return i=t.sent,t.abrupt("return",i);case 8:case"end":return t.stop()}}),t,this)})))}},{key:"onNormal",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r,i;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),n=Ht(this).summary.id,r={callback:function(){e()},action:"normal",eventType:"frame",scope:"frame"},t.next=6,Ht(this).controller.processLocalSubscription(r,n);case 6:return i=t.sent,t.abrupt("return",i);case 8:case"end":return t.stop()}}),t,this)})))}},{key:"onWorkspaceOpened",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r,i,o=this;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),n=Ht(this).summary.id,r={callback:function(t){return k(o,void 0,void 0,y.a.mark((function n(){var r;return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,Ht(this).controller.getWorkspace((function(e){return e.id===t.workspaceSummary.id}));case 2:r=n.sent,e(r);case 4:case"end":return n.stop()}}),n,this)})))},action:"opened",eventType:"workspace",scope:"frame"},t.next=6,Ht(this).controller.processLocalSubscription(r,n);case 6:return i=t.sent,t.abrupt("return",i);case 8:case"end":return t.stop()}}),t,this)})))}},{key:"onWorkspaceSelected",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r,i,o=this;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),n=Ht(this).summary.id,r={callback:function(t){return k(o,void 0,void 0,y.a.mark((function n(){var r;return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,Ht(this).controller.getWorkspace((function(e){return e.id===t.workspaceSummary.id}));case 2:r=n.sent,e(r);case 4:case"end":return n.stop()}}),n,this)})))},action:"selected",eventType:"workspace",scope:"frame"},t.next=6,Ht(this).controller.processLocalSubscription(r,n);case 6:return i=t.sent,t.abrupt("return",i);case 8:case"end":return t.stop()}}),t,this)})))}},{key:"onWorkspaceClosed",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r,i;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),n=Ht(this).summary.id,r={callback:function(t){e({frameId:t.frameSummary.id,workspaceId:t.workspaceSummary.id})},action:"closed",eventType:"workspace",scope:"frame"},t.next=6,Ht(this).controller.processLocalSubscription(r,n);case 6:return i=t.sent,t.abrupt("return",i);case 8:case"end":return t.stop()}}),t,this)})))}},{key:"onWindowAdded",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r,i,o=this;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),n=Ht(this).summary.id,r={callback:function(t){return k(o,void 0,void 0,y.a.mark((function n(){var r,i;return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,Ht(this).controller.getParent((function(e){return e.id===t.windowSummary.parentId}));case 2:r=n.sent,i=r.children.find((function(e){return"window"===e.type&&e.positionIndex===t.windowSummary.config.positionIndex})),e(i);case 5:case"end":return n.stop()}}),n,this)})))},action:"added",eventType:"window",scope:"frame"},t.next=6,Ht(this).controller.processLocalSubscription(r,n);case 6:return i=t.sent,t.abrupt("return",i);case 8:case"end":return t.stop()}}),t,this)})))}},{key:"onWindowRemoved",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r,i;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),n=Ht(this).summary.id,r={callback:function(t){var n=t.windowSummary.config,r=n.windowId,i=n.workspaceId,o=n.frameId;e({windowId:r,workspaceId:i,frameId:o})},action:"removed",eventType:"window",scope:"frame"},t.next=6,Ht(this).controller.processLocalSubscription(r,n);case 6:return i=t.sent,t.abrupt("return",i);case 8:case"end":return t.stop()}}),t,this)})))}},{key:"onWindowLoaded",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r,i,o=this;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),n=Ht(this).summary.id,r={callback:function(t){return k(o,void 0,void 0,y.a.mark((function n(){var r,i;return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,Ht(this).controller.getParent((function(e){return e.id===t.windowSummary.parentId}));case 2:r=n.sent,i=r.children.find((function(e){return"window"===e.type&&e.positionIndex===t.windowSummary.config.positionIndex})),e(i);case 5:case"end":return n.stop()}}),n,this)})))},action:"loaded",eventType:"window",scope:"frame"},t.next=6,Ht(this).controller.processLocalSubscription(r,n);case 6:return i=t.sent,t.abrupt("return",i);case 8:case"end":return t.stop()}}),t,this)})))}},{key:"id",get:function(){return Ht(this).summary.id}}]),e}(),$t=function(){function e(){Object(w.a)(this,e),this.parentsData=new WeakMap,this.workspacesData=new WeakMap,this.windowsData=new WeakMap,this.framesData=new WeakMap,this.windowPlacementIdData={}}return Object(b.a)(e,[{key:"deleteData",value:function(e){var t=this;if(e instanceof Bt){var n=Object.keys(this.windowPlacementIdData).find((function(n){return t.windowPlacementIdData[n]===e}));n&&delete this.windowPlacementIdData[n],this.windowsData.delete(e)}e instanceof Nt&&this.workspacesData.delete(e),(e instanceof Et||e instanceof At||e instanceof Ot)&&this.parentsData.delete(e),e instanceof qt&&this.framesData.delete(e)}},{key:"setWindowData",value:function(e,t){this.windowPlacementIdData[t.id]=e,this.windowsData.set(e,t)}},{key:"setWorkspaceData",value:function(e,t){this.workspacesData.set(e,t)}},{key:"setParentData",value:function(e,t){this.parentsData.set(e,t)}},{key:"setFrameData",value:function(e,t){this.framesData.set(e,t)}},{key:"getWindowData",value:function(e){return this.windowsData.get(e)}},{key:"getWindowByPlacementId",value:function(e){return this.windowPlacementIdData[e]}},{key:"getWorkspaceData",value:function(e){return this.workspacesData.get(e)}},{key:"getParentData",value:function(e){return this.parentsData.get(e)}},{key:"getFrameData",value:function(e){return this.framesData.get(e)}},{key:"remapChild",value:function(e,t){if(e instanceof Bt){var n=this.windowsData.get(e);n.parent=t.parent||n.parent,n.config=t.config||n.config}if(e instanceof Et||e instanceof At||e instanceof Ot){var r=this.parentsData.get(e);r.parent=t.parent||r.parent,r.config=t.config||r.config,r.children=t.children||r.children}}},{key:"remapFrame",value:function(e,t){this.framesData.get(e).summary=t}},{key:"remapWorkspace",value:function(e,t){var n=this.workspacesData.get(e);n.frame=t.frame||n.frame,n.config=t.config||n.config,n.children=t.children||n.children}}]),e}(),Ut=new WeakMap,Gt=function(e,t){var n=Ut.get(e).manager;return t instanceof Nt?n.getWorkspaceData(t):Ut.get(e).manager.getParentData(t)},Vt=function(e,t){return Ut.get(e).manager.getWindowByPlacementId(t)},Jt=function(){function e(t){Object(w.a)(this,e),Ut.set(this,{manager:t})}return Object(b.a)(e,[{key:"getId",value:function(e){return Gt(this,e).id}},{key:"getPositionIndex",value:function(e){return Gt(this,e).config.positionIndex}},{key:"getWorkspaceId",value:function(e){var t=Gt(this,e);return t.config.workspaceId||t.workspace.id}},{key:"getFrameId",value:function(e){return Gt(this,e).frame.id}},{key:"getAllChildren",value:function(e,t){ie(t,!0);var n=Gt(this,e).children;return"undefined"===typeof t?n:n.filter(t)}},{key:"getMyParent",value:function(e){if(!(e instanceof Nt))return Gt(this,e).parent}},{key:"getMyFrame",value:function(e){return Gt(this,e).frame}},{key:"getMyWorkspace",value:function(e){if(!(e instanceof Nt))return Gt(this,e).workspace}},{key:"addWindow",value:function(e,t,n){return k(this,void 0,void 0,y.a.mark((function r(){var i,o,a;return y.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(t.appName||t.windowId){r.next=2;break}throw new Error("The window definition should contain either an appName or a windowId");case 2:return i=se.runWithException(t),o=Gt(this,e).controller,r.next=6,o.add("window",Gt(this,e).id,n,i);case 6:if(a=r.sent,!(e instanceof Nt)){r.next=11;break}return r.next=10,e.refreshReference();case 10:return r.abrupt("return",Vt(this,a.itemId));case 11:return r.next=13,this.getMyWorkspace(e).refreshReference();case 13:return r.abrupt("return",Vt(this,a.itemId));case 14:case"end":return r.stop()}}),r,this)})))}},{key:"addParent",value:function(e,t,n,r){return k(this,void 0,void 0,y.a.mark((function i(){var o,a,s,c;return y.a.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return o=this.transformDefinition(t,r),a=Gt(this,e).controller,i.next=4,a.add("container",Gt(this,e).id,n,o);case 4:if(s=i.sent.itemId,!(e instanceof Nt)){i.next=9;break}return i.next=8,e.refreshReference();case 8:return i.abrupt("return",e.getBox((function(e){return e.id===s})));case 9:return c=this.getMyWorkspace(e),i.next=12,c.refreshReference();case 12:return i.abrupt("return",c.getBox((function(e){return e.id===s})));case 13:case"end":return i.stop()}}),i,this)})))}},{key:"removeChild",value:function(e,t){return k(this,void 0,void 0,y.a.mark((function n(){var r;return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(ie(t),r=this.getAllChildren(e).find(t)){n.next=4;break}return n.abrupt("return");case 4:return n.next=6,r.close();case 6:if(!(e instanceof Nt)){n.next=10;break}return n.next=9,e.refreshReference();case 9:return n.abrupt("return");case 10:return n.next=12,this.getMyWorkspace(e).refreshReference();case 12:case"end":return n.stop()}}),n,this)})))}},{key:"maximize",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Gt(this,e).controller,t.next=3,n.maximizeItem(Gt(this,e).id);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"restore",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Gt(this,e).controller,t.next=3,n.restoreItem(Gt(this,e).id);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"close",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Gt(this,e),r=Gt(this,e).controller,t.next=4,r.closeItem(n.id);case 4:if(!(n.parent instanceof Nt)){t.next=9;break}return t.next=7,n.parent.refreshReference();case 7:t.next=11;break;case 9:return t.next=11,this.getMyWorkspace(n.parent).refreshReference();case 11:case"end":return t.stop()}}),t,this)})))}},{key:"transformDefinition",value:function(e,t){var n;return"undefined"===typeof t?n={type:e,children:[]}:t instanceof kt?n=t.serialize():("undefined"===typeof t.type&&(t.type=e),(n=de.runWithException(t)).children=n.children||[]),n}}]),e}(),Kt=function(){function e(t,n,r,i){Object(w.a)(this,e),this.ioc=t,this.windows=n,this.contexts=r,this.layouts=i}return Object(b.a)(e,[{key:"checkIsWindowLoaded",value:function(e){return e&&this.windows.list().some((function(t){return t.id===e}))}},{key:"createWorkspace",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r,i,o;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.bridge.send(gt.createWorkspace.name,e);case 2:return n=t.sent,r={summary:n.frameSummary},i=this.ioc.getModel("frame",r),o={frame:i,snapshot:n},t.abrupt("return",this.ioc.getModel("workspace",o));case 7:case"end":return t.stop()}}),t,this)})))}},{key:"restoreWorkspace",value:function(e,t){return k(this,void 0,void 0,y.a.mark((function n(){var r,i,o,a,s;return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.bridge.send(gt.openWorkspace.name,{name:e,restoreOptions:t});case 2:return r=n.sent,n.next=5,this.bridge.send(gt.getFrameSummary.name,{itemId:r.config.frameId});case 5:return i=n.sent,o={summary:i},a=this.ioc.getModel("frame",o),s={frame:a,snapshot:r},n.abrupt("return",this.ioc.getModel("workspace",s));case 10:case"end":return n.stop()}}),n,this)})))}},{key:"add",value:function(e,t,n,r){return k(this,void 0,void 0,y.a.mark((function i(){var o,a;return y.a.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(a={definition:r,parentId:t,parentType:n},"window"!==e){i.next=5;break}o=gt.addWindow.name,i.next=10;break;case 5:if("container"!==e){i.next=9;break}o=gt.addContainer.name,i.next=10;break;case 9:throw new Error("Unrecognized add type: ".concat(e));case 10:return i.next=12,this.bridge.send(o,a);case 12:return i.abrupt("return",i.sent);case 13:case"end":return i.stop()}}),i,this)})))}},{key:"getFrame",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.bridge.send(gt.getFrameSummary.name,{itemId:e});case 2:return n=t.sent,r={summary:n},t.abrupt("return",this.ioc.getModel("frame",r));case 5:case"end":return t.stop()}}),t,this)})))}},{key:"getFrames",value:function(e,t){var n=this;return e.reduce((function(e,r){var i={summary:r},o=n.ioc.getModel("frame",i);return t&&!t(o)||e.push(o),e}),[])}},{key:"getAllWorkspaceSummaries",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.reduce((function(e,t){return e.push.apply(e,Object(v.a)(t.summaries)),e}),[]);return r.map((function(e){return{id:e.id,frameId:e.config.frameId,positionIndex:e.config.positionIndex,title:e.config.title,layoutName:e.config.layoutName}}))}},{key:"handleOnSaved",value:function(e){var t=function(t){"Workspace"===t.type&&e(t)},n=this.layouts.onAdded(t),r=this.layouts.onChanged(t);return function(){n(),r()}}},{key:"handleOnRemoved",value:function(e){return this.layouts.onRemoved((function(t){"Workspace"===t.type&&e(t)}))}},{key:"fetchWorkspace",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r,i,o;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.bridge.send(gt.getWorkspaceSnapshot.name,{itemId:e});case 2:return n=t.sent,r={summary:n.frameSummary},i=this.ioc.getModel("frame",r),o={frame:i,snapshot:n},t.abrupt("return",this.ioc.getModel("workspace",o));case 7:case"end":return t.stop()}}),t,this)})))}},{key:"bundleTo",value:function(e,t){return k(this,void 0,void 0,y.a.mark((function n(){return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.bridge.send(gt.bundleWorkspace.name,{type:e,workspaceId:t});case 2:case"end":return n.stop()}}),n,this)})))}},{key:"getWorkspaceContext",value:function(e){var t="___workspace___".concat(e);return this.contexts.get(t)}},{key:"setWorkspaceContext",value:function(e,t){var n="___workspace___".concat(e);return this.contexts.set(n,t)}},{key:"updateWorkspaceContext",value:function(e,t){var n="___workspace___".concat(e);return this.contexts.update(n,t)}},{key:"subscribeWorkspaceContextUpdated",value:function(e,t){var n="___workspace___".concat(e);return this.contexts.subscribe(n,t)}},{key:"restoreItem",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.bridge.send(gt.restoreItem.name,{itemId:e});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"maximizeItem",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.bridge.send(gt.maximizeItem.name,{itemId:e});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"focusItem",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.bridge.send(gt.focusItem.name,{itemId:e});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"closeItem",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.bridge.send(gt.closeItem.name,{itemId:e});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"resizeItem",value:function(e,t){return k(this,void 0,void 0,y.a.mark((function n(){return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.bridge.send(gt.resizeItem.name,Object.assign({},{itemId:e},t));case 2:case"end":return n.stop()}}),n,this)})))}},{key:"moveFrame",value:function(e,t){return k(this,void 0,void 0,y.a.mark((function n(){return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.bridge.send(gt.moveFrame.name,Object.assign({},{itemId:e},t));case 2:case"end":return n.stop()}}),n,this)})))}},{key:"getGDWindow",value:function(e){return this.windows.list().find((function(t){return t.id===e}))}},{key:"forceLoadWindow",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.bridge.send(gt.forceLoadWindow.name,{itemId:e});case 2:return n=t.sent,t.abrupt("return",n.windowId);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"ejectWindow",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.bridge.send(gt.ejectWindow.name,{itemId:e});case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"moveWindowTo",value:function(e,t){return k(this,void 0,void 0,y.a.mark((function n(){return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.bridge.send(gt.moveWindowTo.name,{itemId:e,containerId:t});case 2:case"end":return n.stop()}}),n,this)})))}},{key:"getSnapshot",value:function(e,t){return k(this,void 0,void 0,y.a.mark((function n(){var r;return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if("workspace"!==t){n.next=6;break}return n.next=3,this.bridge.send(gt.getWorkspaceSnapshot.name,{itemId:e});case 3:r=n.sent,n.next=10;break;case 6:if("frame"!==t){n.next=10;break}return n.next=9,this.bridge.send(gt.getFrameSnapshot.name,{itemId:e});case 9:r=n.sent;case 10:return n.abrupt("return",r);case 11:case"end":return n.stop()}}),n,this)})))}},{key:"setItemTitle",value:function(e,t){return k(this,void 0,void 0,y.a.mark((function n(){return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.bridge.send(gt.setItemTitle.name,{itemId:e,title:t});case 2:case"end":return n.stop()}}),n,this)})))}},{key:"refreshChildren",value:function(e){var t=this,n=e.parent,r=e.children,i=e.existingChildren,o=e.workspace;if(!(n instanceof Bt)){var a=r.map((function(e){var r=i.find((function(t){return t.id===e.id})),a=e.type;if(r)t.privateDataManager.remapChild(r,{parent:n,children:[],config:e.config});else if("window"===a){var s={id:e.id,parent:n,frame:o.frame,workspace:o,config:e.config};r=t.ioc.getModel(a,s)}else{var c={id:e.id,children:[],parent:n,frame:o.frame,workspace:o,config:e.config};r=t.ioc.getModel(a,c)}return"window"!==a&&t.refreshChildren({workspace:o,existingChildren:i,children:e.children,parent:r}),r}));return n instanceof Nt||this.privateDataManager.remapChild(n,{children:a}),a}}},{key:"iterateFindChild",value:function(e,t){var n=this,r=e.find((function(e){return t(e)}));return r||(e.some((function(e){return!(e instanceof Bt)&&(!!(r=n.iterateFindChild(e.children,t))||void 0)})),r)}},{key:"iterateFilterChildren",value:function(e,t){var n=this,r=e.filter((function(e){return t(e)})),i=e.reduce((function(e,r){return r instanceof Bt||e.push.apply(e,Object(v.a)(n.iterateFilterChildren(r.children,t))),e}),[]);return r.push.apply(r,Object(v.a)(i)),r}},{key:"notifyWindowAdded",value:function(e){var t=this;return new Promise((function(n){if(t.windows.list().some((function(t){return t.id===e})))return n();var r=t.windows.onWindowAdded((function(t){t.id===e&&(r&&r(),n())}))}))}},{key:"hibernateWorkspace",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.bridge.send(gt.hibernateWorkspace.name,{workspaceId:e});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"resumeWorkspace",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.bridge.send(gt.resumeWorkspace.name,{workspaceId:e});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"bridge",get:function(){return this.ioc.bridge}},{key:"privateDataManager",get:function(){return this.ioc.privateDataManager}}]),e}(),Xt=function(){function e(t,n){Object(w.a)(this,e),this.bridge=t,this.base=n}return Object(b.a)(e,[{key:"checkIsWindowLoaded",value:function(e){return this.base.checkIsWindowLoaded(e)}},{key:"checkIsInSwimlane",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.bridge.send(gt.isWindowInWorkspace.name,{itemId:e});case 2:return n=t.sent,t.abrupt("return",n.inWorkspace);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"createWorkspace",value:function(e,t){return k(this,void 0,void 0,y.a.mark((function n(){var r;return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=Object.assign({},e,{saveConfig:t}),n.next=3,this.base.createWorkspace(r);case 3:return n.abrupt("return",n.sent);case 4:case"end":return n.stop()}}),n,this)})))}},{key:"restoreWorkspace",value:function(e,t){return k(this,void 0,void 0,y.a.mark((function n(){var r,i;return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.getLayoutSummaries();case 2:if(r=n.sent,r.some((function(t){return t.name===e}))){n.next=6;break}throw new Error("This layout: ".concat(e," cannot be restored, because it doesn't exist."));case 6:if(!(null===t||void 0===t?void 0:t.frameId)){n.next=13;break}return n.next=9,this.bridge.send(gt.getAllFramesSummaries.name);case 9:if(i=n.sent,i.summaries.some((function(e){return e.id===t.frameId}))){n.next=13;break}throw new Error("Cannot reuse the frame with id: ".concat(t.frameId,", because there is no frame with that ID found"));case 13:return n.next=15,this.base.restoreWorkspace(e,t);case 15:return n.abrupt("return",n.sent);case 16:case"end":return n.stop()}}),n,this)})))}},{key:"add",value:function(e,t,n,r){return k(this,void 0,void 0,y.a.mark((function i(){return y.a.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.base.add(e,t,n,r);case 2:return i.abrupt("return",i.sent);case 3:case"end":return i.stop()}}),i,this)})))}},{key:"processLocalSubscription",value:function(e,t){return window.glue42gd?this.handleEnterpriseLocalSubscription(e,t):this.handleCoreLocalSubscription(e,t)}},{key:"processGlobalSubscription",value:function(e,t,n){return window.glue42gd?this.handleEnterpriseGlobalSubscription(e,t,n):this.handleCoreGlobalSubscription(e,t,n)}},{key:"getFrame",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.windowId){t.next=4;break}return t.next=3,this.base.getFrame(e.windowId);case 3:return t.abrupt("return",t.sent);case 4:if(!e.predicate){t.next=8;break}return t.next=7,this.getFrames(e.predicate);case 7:return t.abrupt("return",t.sent[0]);case 8:throw new Error("The provided selector is not valid: ".concat(JSON.stringify(e)));case 9:case"end":return t.stop()}}),t,this)})))}},{key:"getFrames",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.bridge.send(gt.getAllFramesSummaries.name);case 2:return n=t.sent,t.abrupt("return",this.base.getFrames(n.summaries,e));case 4:case"end":return t.stop()}}),t,this)})))}},{key:"getWorkspace",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.iterateWorkspaces((function(t,r){e(t)&&(n=t,r())}));case 2:return t.abrupt("return",n);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"getWorkspaces",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=[],t.next=3,this.iterateWorkspaces((function(t){e&&!e(t)||n.push(t)}));case 3:return t.abrupt("return",n);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"getAllWorkspaceSummaries",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){var t;return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.bridge.send(gt.getAllWorkspacesSummaries.name,{});case 2:return t=e.sent,e.abrupt("return",this.base.getAllWorkspaceSummaries(t));case 4:case"end":return e.stop()}}),e,this)})))}},{key:"getWindow",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.iterateWorkspaces((function(t,r){var i=t.getWindow(e);i&&(n=i,r())}));case 2:return t.abrupt("return",n);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"getParent",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.iterateWorkspaces((function(t,r){var i=t.getBox(e);i&&(n=i,r())}));case 2:return t.abrupt("return",n);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"getLayoutSummaries",value:function(){return k(this,void 0,void 0,y.a.mark((function e(){var t;return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.bridge.send(gt.getAllLayoutsSummaries.name);case 2:return t=e.sent,e.abrupt("return",t.summaries);case 4:case"end":return e.stop()}}),e,this)})))}},{key:"deleteLayout",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.bridge.send(gt.deleteLayout.name,{name:e});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"exportLayout",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.bridge.send(gt.exportAllLayouts.name);case 2:return n=t.sent,t.abrupt("return",n.layouts.reduce((function(t,n){return e&&!e(n)||t.push(n),t}),[]));case 4:case"end":return t.stop()}}),t,this)})))}},{key:"saveLayout",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.bridge.send(gt.saveLayout.name,e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"importLayout",value:function(e,t){return k(this,void 0,void 0,y.a.mark((function n(){var r=this;return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,Promise.all(e.map((function(e){return r.bridge.send(gt.importLayout.name,{layout:e,mode:t})})));case 2:case"end":return n.stop()}}),n)})))}},{key:"handleOnSaved",value:function(e){return this.base.handleOnSaved(e)}},{key:"handleOnRemoved",value:function(e){return this.base.handleOnRemoved(e)}},{key:"bundleTo",value:function(e,t){return k(this,void 0,void 0,y.a.mark((function n(){return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.base.bundleTo(e,t);case 2:return n.abrupt("return",n.sent);case 3:case"end":return n.stop()}}),n,this)})))}},{key:"getWorkspaceContext",value:function(e){return this.base.getWorkspaceContext(e)}},{key:"setWorkspaceContext",value:function(e,t){return this.base.setWorkspaceContext(e,t)}},{key:"updateWorkspaceContext",value:function(e,t){return this.base.updateWorkspaceContext(e,t)}},{key:"subscribeWorkspaceContextUpdated",value:function(e,t){return this.base.subscribeWorkspaceContextUpdated(e,t)}},{key:"restoreItem",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.base.restoreItem(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"maximizeItem",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.base.maximizeItem(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"focusItem",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.base.focusItem(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"changeFrameState",value:function(e,t){return k(this,void 0,void 0,y.a.mark((function n(){return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.bridge.send(gt.changeFrameState.name,{frameId:e,requestedState:t});case 2:case"end":return n.stop()}}),n,this)})))}},{key:"getFrameState",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.bridge.send(gt.getFrameState.name,{itemId:e});case 2:return n=t.sent,t.abrupt("return",n.state);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"closeItem",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.base.closeItem(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"resizeItem",value:function(e,t){return k(this,void 0,void 0,y.a.mark((function n(){return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.base.resizeItem(e,t);case 2:return n.abrupt("return",n.sent);case 3:case"end":return n.stop()}}),n,this)})))}},{key:"moveFrame",value:function(e,t){return k(this,void 0,void 0,y.a.mark((function n(){return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.base.moveFrame(e,t);case 2:return n.abrupt("return",n.sent);case 3:case"end":return n.stop()}}),n,this)})))}},{key:"getGDWindow",value:function(e){return this.base.getGDWindow(e)}},{key:"forceLoadWindow",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.base.forceLoadWindow(e);case 2:return n=t.sent,t.next=5,this.base.notifyWindowAdded(n);case 5:return t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"ejectWindow",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.base.ejectWindow(e);case 2:return n=t.sent.windowId,t.next=5,this.base.notifyWindowAdded(n);case 5:return t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"moveWindowTo",value:function(e,t){return k(this,void 0,void 0,y.a.mark((function n(){return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.base.moveWindowTo(e,t);case 2:return n.abrupt("return",n.sent);case 3:case"end":return n.stop()}}),n,this)})))}},{key:"getSnapshot",value:function(e,t){return k(this,void 0,void 0,y.a.mark((function n(){return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.base.getSnapshot(e,t);case 2:return n.abrupt("return",n.sent);case 3:case"end":return n.stop()}}),n,this)})))}},{key:"setItemTitle",value:function(e,t){return k(this,void 0,void 0,y.a.mark((function n(){return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.base.setItemTitle(e,t);case 2:return n.abrupt("return",n.sent);case 3:case"end":return n.stop()}}),n,this)})))}},{key:"refreshChildren",value:function(e){return this.base.refreshChildren(e)}},{key:"iterateFindChild",value:function(e,t){return this.base.iterateFindChild(e,t)}},{key:"iterateFilterChildren",value:function(e,t){return this.base.iterateFilterChildren(e,t)}},{key:"hibernateWorkspace",value:function(e){return this.base.hibernateWorkspace(e)}},{key:"resumeWorkspace",value:function(e){return this.base.resumeWorkspace(e)}},{key:"handleCoreLocalSubscription",value:function(e,t){return k(this,void 0,void 0,y.a.mark((function n(){var r,i,o=this;return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.bridge.createCoreEventSubscription();case 2:return e.scopeId=e.scopeId||t,"window"===e.eventType&&"loaded"===e.action&&(r=e.callback,i=function(e){return k(o,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.base.notifyWindowAdded(e.windowSummary.config.windowId);case 2:r(e);case 3:case"end":return t.stop()}}),t,this)})))},e.callback=i),n.abrupt("return",this.bridge.handleCoreSubscription(e));case 5:case"end":return n.stop()}}),n,this)})))}},{key:"handleEnterpriseLocalSubscription",value:function(e,t){var n=this;if(e.scopeId=e.scopeId||t,"window"===e.eventType&&"loaded"===e.action){var r=e.callback;e.callback=function(e){return k(n,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.base.notifyWindowAdded(e.windowSummary.config.windowId);case 2:r(e);case 3:case"end":return t.stop()}}),t,this)})))}}return this.bridge.subscribe(e)}},{key:"handleCoreGlobalSubscription",value:function(e,t,n){return k(this,void 0,void 0,y.a.mark((function r(){var i,o,a=this;return y.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.bridge.createCoreEventSubscription();case 2:return i={eventType:t,callback:e,action:n,scope:"global"},"window"===t&&"loaded"===n&&(o=function(t){return k(a,void 0,void 0,y.a.mark((function n(){return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.base.notifyWindowAdded(t.windowSummary.config.windowId);case 2:e(t);case 3:case"end":return n.stop()}}),n,this)})))},i.callback=o),r.abrupt("return",this.bridge.handleCoreSubscription(i));case 5:case"end":return r.stop()}}),r,this)})))}},{key:"handleEnterpriseGlobalSubscription",value:function(e,t,n){var r=this,i={eventType:t,callback:e,action:n,scope:"global"};if("window"===t&&"loaded"===n){i.callback=function(t){return k(r,void 0,void 0,y.a.mark((function n(){return y.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.base.notifyWindowAdded(t.windowSummary.config.windowId);case 2:e(t);case 3:case"end":return n.stop()}}),n,this)})))}}return this.bridge.subscribe(i)}},{key:"iterateWorkspaces",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){var n,r,i,o,a,s,c;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=!1,r=function(){n=!0},t.next=4,this.getAllWorkspaceSummaries();case 4:i=t.sent,o=Object(m.a)(i),t.prev=6,o.s();case 8:if((a=o.n()).done){t.next=18;break}if(s=a.value,!n){t.next=12;break}return t.abrupt("return");case 12:return t.next=14,this.base.fetchWorkspace(s.id);case 14:c=t.sent,e(c,r);case 16:t.next=8;break;case 18:t.next=23;break;case 20:t.prev=20,t.t0=t.catch(6),o.e(t.t0);case 23:return t.prev=23,o.f(),t.finish(23);case 26:case"end":return t.stop()}}),t,this,[[6,20,23,26]])})))}}]),e}(),Yt=function(){function e(t,n,r,i){Object(w.a)(this,e),this.agm=t,this.windows=n,this.layouts=r,this.contexts=i}return Object(b.a)(e,[{key:"initiate",value:function(e){return k(this,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.transport.initiate(e);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"getModel",value:function(e,t){switch(e){case"frame":var n=new qt(this.privateDataManager),r={summary:t.summary,controller:this.controller};return this.privateDataManager.setFrameData(n,r),n;case"window":var i=t.id,o=t.parent,a=t.frame,s=t.workspace,c=t.config,u={type:"window",controller:this.controller,config:c,id:i,parent:o,frame:a,workspace:s},d=new Bt(this.privateDataManager);return this.privateDataManager.setWindowData(d,u),d;case"row":case"column":case"group":var l=t.id,p=t.children,h=t.parent,f=t.frame,m=t.workspace,v=t.config,g="column"===e?new At(this.parentBase):"row"===e?new Et(this.parentBase):new Ot(this.parentBase),y=this.buildChildren(p,f,m,g),w={id:l,parent:h,frame:f,workspace:m,config:v,type:e,controller:this.controller,children:y};return this.privateDataManager.setParentData(g,w),g;case"workspace":var b=t.snapshot,k=t.frame,x=new Nt(this.privateDataManager),_=this.buildChildren(b.children,k,x,x),I={id:b.id,type:"workspace",config:b.config,base:this.parentBase,controller:this.controller,children:_,frame:k,ioc:this};return this.privateDataManager.setWorkspaceData(x,I),x;default:throw new Error("Unrecognized type: ".concat(e))}}},{key:"getBuilder",value:function(e){e.definition=e.definition||{},Array.isArray(e.definition.children)||(e.definition.children=[]);var t=new xt(this.getBuilder.bind(this));switch(e.type){case"workspace":return new It(e.definition,t,this.controller);case"row":case"column":case"group":return e.definition.type=e.type,new kt(e.definition,t);default:throw new Error("Unexpected Builder creation error, provided config: ".concat(JSON.stringify(e)))}}},{key:"buildChildren",value:function(e,t,n,r){var i=this;return e.map((function(e){switch(e.type){case"window":return i.getModel("window",{id:e.id,config:e.config,frame:t,workspace:n,parent:r});case"column":case"row":case"group":return i.getModel(e.type,{id:e.id,config:e.config,children:e.children,frame:t,workspace:n,parent:r});default:throw new Error("Unsupported child type: ".concat(e.type))}}))}},{key:"baseController",get:function(){return this._baseController||(this._baseController=new Kt(this,this.windows,this.contexts,this.layouts)),this._baseController}},{key:"controller",get:function(){return this._controllerInstance||(this._controllerInstance=new Xt(this.bridge,this.baseController)),this._controllerInstance}},{key:"bridge",get:function(){return this._bridgeInstance||(this._bridgeInstance=new yt(this.transport,_())),this._bridgeInstance}},{key:"transport",get:function(){return this._transportInstance||(this._transportInstance=new wt(this.agm)),this._transportInstance}},{key:"privateDataManager",get:function(){return this._privateDataManagerInstance||(this._privateDataManagerInstance=new $t),this._privateDataManagerInstance}},{key:"parentBase",get:function(){return this._parentBaseInstance||(this._parentBaseInstance=new Jt(this.privateDataManager)),this._parentBaseInstance}}]),e}(),Zt=function(e,t){var n=t.controller;return{inWorkspace:function(){var t=e.windows.my().id;if(!t)throw new Error("Cannot get my frame, because my id is undefined.");return n.checkIsInSwimlane(t)},getBuilder:function(e){var n=ve.runWithException(e);return t.getBuilder(n)},getMyFrame:function(){return k(void 0,void 0,void 0,y.a.mark((function t(){var r;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.windows.my().id){t.next=3;break}throw new Error("Cannot get my frame, because my id is undefined.");case 3:return t.next=5,n.checkIsInSwimlane(r);case 5:if(t.sent){t.next=8;break}throw new Error("Cannot fetch your frame, because this window is not in a workspace");case 8:return t.abrupt("return",n.getFrame({windowId:r}));case 9:case"end":return t.stop()}}),t)})))},getFrame:function(e){return k(void 0,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),t.abrupt("return",n.getFrame({predicate:e}));case 2:case"end":return t.stop()}}),t)})))},getAllFrames:function(e){return k(void 0,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e,!0),t.abrupt("return",n.getFrames(e));case 2:case"end":return t.stop()}}),t)})))},getAllWorkspacesSummaries:function(){return n.getAllWorkspaceSummaries()},getMyWorkspace:function(){return k(void 0,void 0,void 0,y.a.mark((function t(){var r;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.windows.my().id){t.next=3;break}throw new Error("Cannot get my workspace, because my id is undefined.");case 3:return t.next=5,n.checkIsInSwimlane(r);case 5:if(t.sent){t.next=8;break}throw new Error("Cannot fetch your workspace, because this window is not in a workspace");case 8:return t.next=10,n.getWorkspaces((function(e){return!!e.getWindow((function(e){return e.id===r}))}));case 10:return t.abrupt("return",t.sent[0]);case 11:case"end":return t.stop()}}),t)})))},getWorkspace:function(e){return k(void 0,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),t.next=3,n.getWorkspaces(e);case 3:return t.abrupt("return",t.sent[0]);case 4:case"end":return t.stop()}}),t)})))},getAllWorkspaces:function(e){return ie(e,!0),n.getWorkspaces(e)},getWindow:function(e){return k(void 0,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),t.abrupt("return",n.getWindow(e));case 2:case"end":return t.stop()}}),t)})))},getBox:function(e){return k(void 0,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),t.abrupt("return",n.getParent(e));case 2:case"end":return t.stop()}}),t)})))},restoreWorkspace:function(e,t){return k(void 0,void 0,void 0,y.a.mark((function r(){var i;return y.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return Z.runWithException(e),i=he.runWithException(t),r.abrupt("return",n.restoreWorkspace(e,i));case 3:case"end":return r.stop()}}),r)})))},createWorkspace:function(e,t){return k(void 0,void 0,void 0,y.a.mark((function r(){var i,o;return y.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=me.runWithException(e),o=oe.runWithException(t),r.abrupt("return",n.createWorkspace(i,o));case 3:case"end":return r.stop()}}),r)})))},layouts:{getSummaries:function(){return n.getLayoutSummaries()},delete:function(e){return k(void 0,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return Z.runWithException(e),t.abrupt("return",n.deleteLayout(e));case 2:case"end":return t.stop()}}),t)})))},export:function(e){return k(void 0,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e,!0),t.abrupt("return",n.exportLayout(e));case 2:case"end":return t.stop()}}),t)})))},import:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"replace";return k(void 0,void 0,void 0,y.a.mark((function r(){return y.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(Array.isArray(e)){r.next=2;break}throw new Error("The provided layouts argument is not an array: ".concat(JSON.stringify(e)));case 2:return e.forEach((function(e){return je.runWithException(e)})),r.abrupt("return",n.importLayout(e,t));case 4:case"end":return r.stop()}}),r)})))},save:function(e){return k(void 0,void 0,void 0,y.a.mark((function t(){var r;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=lt.runWithException(e),t.abrupt("return",n.saveLayout(r));case 2:case"end":return t.stop()}}),t)})))},onSaved:function(e){return k(void 0,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),t.abrupt("return",n.handleOnSaved(e));case 2:case"end":return t.stop()}}),t)})))},onRemoved:function(e){return k(void 0,void 0,void 0,y.a.mark((function t(){return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),t.abrupt("return",n.handleOnRemoved(e));case 2:case"end":return t.stop()}}),t)})))}},onFrameOpened:function(e){return k(void 0,void 0,void 0,y.a.mark((function r(){var i,o;return y.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return ie(e),i=function(n){var r={summary:n.frameSummary},i=t.getModel("frame",r);e(i)},r.next=4,n.processGlobalSubscription(i,"frame","opened");case 4:return o=r.sent,r.abrupt("return",o);case 6:case"end":return r.stop()}}),r)})))},onFrameClosed:function(e){return k(void 0,void 0,void 0,y.a.mark((function t(){var r,i;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),r=function(t){e({frameId:t.frameSummary.id})},t.next=4,n.processGlobalSubscription(r,"frame","closed");case 4:return i=t.sent,t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)})))},onWorkspaceOpened:function(e){return k(void 0,void 0,void 0,y.a.mark((function r(){var i,o;return y.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return ie(e),i=function(r){return k(void 0,void 0,void 0,y.a.mark((function i(){var o,a,s,c,u;return y.a.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return o={summary:r.frameSummary},a=t.getModel("frame",o),i.next=4,n.getSnapshot(r.workspaceSummary.id,"workspace");case 4:s=i.sent,c={frame:a,snapshot:s},u=t.getModel("workspace",c),e(u);case 8:case"end":return i.stop()}}),i)})))},r.next=4,n.processGlobalSubscription(i,"workspace","opened");case 4:return o=r.sent,r.abrupt("return",o);case 6:case"end":return r.stop()}}),r)})))},onWorkspaceClosed:function(e){return k(void 0,void 0,void 0,y.a.mark((function t(){var r,i;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),r=function(t){e({frameId:t.frameSummary.id,workspaceId:t.workspaceSummary.id})},t.next=4,n.processGlobalSubscription(r,"workspace","closed");case 4:return i=t.sent,t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)})))},onWindowAdded:function(e){return k(void 0,void 0,void 0,y.a.mark((function r(){var i,o;return y.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return ie(e),i=function(r){return k(void 0,void 0,void 0,y.a.mark((function i(){var o,a,s,c,u,d,l;return y.a.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,n.getSnapshot(r.windowSummary.config.workspaceId,"workspace");case 2:o=i.sent,a={summary:o.frameSummary},s=t.getModel("frame",a),c={frame:s,snapshot:o},u=t.getModel("workspace",c),d=u.getBox((function(e){return e.id===r.windowSummary.parentId})),l=d.children.find((function(e){return"window"===e.type&&e.positionIndex===r.windowSummary.config.positionIndex})),e(l);case 10:case"end":return i.stop()}}),i)})))},r.next=4,n.processGlobalSubscription(i,"window","added");case 4:return o=r.sent,r.abrupt("return",o);case 6:case"end":return r.stop()}}),r)})))},onWindowLoaded:function(e){return k(void 0,void 0,void 0,y.a.mark((function r(){var i,o;return y.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return ie(e),i=function(r){return k(void 0,void 0,void 0,y.a.mark((function i(){var o,a,s,c,u,d;return y.a.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,n.getSnapshot(r.windowSummary.config.workspaceId,"workspace");case 2:o=i.sent,a={summary:o.frameSummary},s=t.getModel("frame",a),c={frame:s,snapshot:o},u=t.getModel("workspace",c),d=u.getWindow((function(e){return e.id&&e.id===r.windowSummary.config.windowId})),e(d);case 9:case"end":return i.stop()}}),i)})))},r.next=4,n.processGlobalSubscription(i,"window","loaded");case 4:return o=r.sent,r.abrupt("return",o);case 6:case"end":return r.stop()}}),r)})))},onWindowRemoved:function(e){return k(void 0,void 0,void 0,y.a.mark((function t(){var r,i;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ie(e),r=function(t){var n=t.windowSummary.config,r=n.windowId,i=n.workspaceId,o=n.frameId;e({windowId:r,workspaceId:i,frameId:o})},t.next=4,n.processGlobalSubscription(r,"window","removed");case 4:return i=t.sent,t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)})))}}},Qt=function(e){return k(void 0,void 0,void 0,y.a.mark((function t(){var n,r;return y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=new Yt(e.agm,e.windows,e.layouts,e.contexts),r=e.interop.instance.windowId,t.next=4,n.initiate(r);case 4:e.workspaces=Zt(e,n);case 5:case"end":return t.stop()}}),t)})))};"undefined"!==typeof window&&(window.GlueWorkspaces=Qt);var en=Qt;s.a.render(Object(r.jsx)(o.a.StrictMode,{children:Object(r.jsx)(u.b,{glueFactory:function(e){return window.glue42gd?h()(Object.assign(e,{libraries:[en],appManager:"skipIcons"})):Object(f.a)(Object.assign(e,{libraries:[en]}))},children:Object(r.jsx)(d,{})})}),document.getElementById("root")),l()}},[[38,1,2]]]);
//# sourceMappingURL=main.ed651977.chunk.js.map
|
docs/src/app/components/pages/components/IconMenu/ExampleNested.js
|
manchesergit/material-ui
|
import React from 'react';
import IconMenu from 'material-ui/IconMenu';
import MenuItem from 'material-ui/MenuItem';
import IconButton from 'material-ui/IconButton';
import Divider from 'material-ui/Divider';
import Download from 'material-ui/svg-icons/file/file-download';
import ArrowDropRight from 'material-ui/svg-icons/navigation-arrow-drop-right';
import MoreVertIcon from 'material-ui/svg-icons/navigation/more-vert';
/**
* Example of nested menus within an IconMenu.
*/
const IconMenuExampleNested = () => (
<IconMenu
iconButtonElement={<IconButton><MoreVertIcon /></IconButton>}
anchorOrigin={{horizontal: 'left', vertical: 'top'}}
targetOrigin={{horizontal: 'left', vertical: 'top'}}
>
<MenuItem
primaryText="Copy & Paste"
rightIcon={<ArrowDropRight />}
menuItems={[
<MenuItem primaryText="Cut" />,
<MenuItem primaryText="Copy" />,
<Divider />,
<MenuItem primaryText="Paste" />,
]}
/>
<MenuItem
primaryText="Case Tools"
rightIcon={<ArrowDropRight />}
menuItems={[
<MenuItem primaryText="UPPERCASE" />,
<MenuItem primaryText="lowercase" />,
<MenuItem primaryText="CamelCase" />,
<MenuItem primaryText="Propercase" />,
]}
/>
<Divider />
<MenuItem primaryText="Download" leftIcon={<Download />} />
<Divider />
<MenuItem value="Del" primaryText="Delete" />
</IconMenu>
);
export default IconMenuExampleNested;
|
examples/counter/index.js
|
madole/redux-devtools
|
import React from 'react';
import App from './containers/App';
React.render(
<App />,
document.getElementById('root')
);
|
app/javascript/mastodon/features/account/components/action_bar.js
|
summoners-riftodon/mastodon
|
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import DropdownMenuContainer from '../../../containers/dropdown_menu_container';
import { Link } from 'react-router-dom';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { me } from '../../../initial_state';
import { shortNumberFormat } from '../../../utils/numbers';
const messages = defineMessages({
mention: { id: 'account.mention', defaultMessage: 'Mention @{name}' },
direct: { id: 'account.direct', defaultMessage: 'Direct message @{name}' },
edit_profile: { id: 'account.edit_profile', defaultMessage: 'Edit profile' },
unblock: { id: 'account.unblock', defaultMessage: 'Unblock @{name}' },
unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' },
unmute: { id: 'account.unmute', defaultMessage: 'Unmute @{name}' },
block: { id: 'account.block', defaultMessage: 'Block @{name}' },
mute: { id: 'account.mute', defaultMessage: 'Mute @{name}' },
follow: { id: 'account.follow', defaultMessage: 'Follow' },
report: { id: 'account.report', defaultMessage: 'Report @{name}' },
share: { id: 'account.share', defaultMessage: 'Share @{name}\'s profile' },
media: { id: 'account.media', defaultMessage: 'Media' },
blockDomain: { id: 'account.block_domain', defaultMessage: 'Hide everything from {domain}' },
unblockDomain: { id: 'account.unblock_domain', defaultMessage: 'Unhide {domain}' },
hideReblogs: { id: 'account.hide_reblogs', defaultMessage: 'Hide boosts from @{name}' },
showReblogs: { id: 'account.show_reblogs', defaultMessage: 'Show boosts from @{name}' },
pins: { id: 'navigation_bar.pins', defaultMessage: 'Pinned toots' },
preferences: { id: 'navigation_bar.preferences', defaultMessage: 'Preferences' },
follow_requests: { id: 'navigation_bar.follow_requests', defaultMessage: 'Follow requests' },
favourites: { id: 'navigation_bar.favourites', defaultMessage: 'Favourites' },
lists: { id: 'navigation_bar.lists', defaultMessage: 'Lists' },
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' },
endorse: { id: 'account.endorse', defaultMessage: 'Feature on profile' },
unendorse: { id: 'account.unendorse', defaultMessage: 'Don\'t feature on profile' },
});
@injectIntl
export default class ActionBar extends React.PureComponent {
static propTypes = {
account: ImmutablePropTypes.map.isRequired,
onFollow: PropTypes.func,
onBlock: PropTypes.func.isRequired,
onMention: PropTypes.func.isRequired,
onDirect: PropTypes.func.isRequired,
onReblogToggle: PropTypes.func.isRequired,
onReport: PropTypes.func.isRequired,
onMute: PropTypes.func.isRequired,
onBlockDomain: PropTypes.func.isRequired,
onUnblockDomain: PropTypes.func.isRequired,
onEndorseToggle: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
};
handleShare = () => {
navigator.share({
url: this.props.account.get('url'),
});
}
render () {
const { account, intl } = this.props;
let menu = [];
let extraInfo = '';
if (account.get('id') !== me) {
menu.push({ text: intl.formatMessage(messages.mention, { name: account.get('username') }), action: this.props.onMention });
menu.push({ text: intl.formatMessage(messages.direct, { name: account.get('username') }), action: this.props.onDirect });
menu.push(null);
}
if ('share' in navigator) {
menu.push({ text: intl.formatMessage(messages.share, { name: account.get('username') }), action: this.handleShare });
menu.push(null);
}
if (account.get('id') === me) {
menu.push({ text: intl.formatMessage(messages.edit_profile), href: '/settings/profile' });
menu.push({ text: intl.formatMessage(messages.preferences), href: '/settings/preferences' });
menu.push({ text: intl.formatMessage(messages.pins), to: '/pinned' });
menu.push(null);
menu.push({ text: intl.formatMessage(messages.follow_requests), to: '/follow_requests' });
menu.push({ text: intl.formatMessage(messages.favourites), to: '/favourites' });
menu.push({ text: intl.formatMessage(messages.lists), to: '/lists' });
menu.push(null);
menu.push({ text: intl.formatMessage(messages.mutes), to: '/mutes' });
menu.push({ text: intl.formatMessage(messages.blocks), to: '/blocks' });
menu.push({ text: intl.formatMessage(messages.domain_blocks), to: '/domain_blocks' });
} else {
if (account.getIn(['relationship', 'following'])) {
if (account.getIn(['relationship', 'showing_reblogs'])) {
menu.push({ text: intl.formatMessage(messages.hideReblogs, { name: account.get('username') }), action: this.props.onReblogToggle });
} else {
menu.push({ text: intl.formatMessage(messages.showReblogs, { name: account.get('username') }), action: this.props.onReblogToggle });
}
menu.push({ text: intl.formatMessage(account.getIn(['relationship', 'endorsed']) ? messages.unendorse : messages.endorse), action: this.props.onEndorseToggle });
menu.push(null);
}
if (account.getIn(['relationship', 'muting'])) {
menu.push({ text: intl.formatMessage(messages.unmute, { name: account.get('username') }), action: this.props.onMute });
} else {
menu.push({ text: intl.formatMessage(messages.mute, { name: account.get('username') }), action: this.props.onMute });
}
if (account.getIn(['relationship', 'blocking'])) {
menu.push({ text: intl.formatMessage(messages.unblock, { name: account.get('username') }), action: this.props.onBlock });
} else {
menu.push({ text: intl.formatMessage(messages.block, { name: account.get('username') }), action: this.props.onBlock });
}
menu.push({ text: intl.formatMessage(messages.report, { name: account.get('username') }), action: this.props.onReport });
}
if (account.get('acct') !== account.get('username')) {
const domain = account.get('acct').split('@')[1];
extraInfo = (
<div className='account__disclaimer'>
<FormattedMessage
id='account.disclaimer_full'
defaultMessage="Information below may reflect the user's profile incompletely."
/>
{' '}
<a target='_blank' rel='noopener' href={account.get('url')}>
<FormattedMessage id='account.view_full_profile' defaultMessage='View full profile' />
</a>
</div>
);
menu.push(null);
if (account.getIn(['relationship', 'domain_blocking'])) {
menu.push({ text: intl.formatMessage(messages.unblockDomain, { domain }), action: this.props.onUnblockDomain });
} else {
menu.push({ text: intl.formatMessage(messages.blockDomain, { domain }), action: this.props.onBlockDomain });
}
}
return (
<div>
{extraInfo}
<div className='account__action-bar'>
<div className='account__action-bar-links'>
<Link className='account__action-bar__tab' to={`/accounts/${account.get('id')}`} title={intl.formatNumber(account.get('statuses_count'))}>
<FormattedMessage id='account.posts' defaultMessage='Toots' />
<strong>{shortNumberFormat(account.get('statuses_count'))}</strong>
</Link>
<Link className='account__action-bar__tab' to={`/accounts/${account.get('id')}/following`} title={intl.formatNumber(account.get('following_count'))}>
<FormattedMessage id='account.follows' defaultMessage='Follows' />
<strong>{shortNumberFormat(account.get('following_count'))}</strong>
</Link>
<Link className='account__action-bar__tab' to={`/accounts/${account.get('id')}/followers`} title={intl.formatNumber(account.get('followers_count'))}>
<FormattedMessage id='account.followers' defaultMessage='Followers' />
<strong>{shortNumberFormat(account.get('followers_count'))}</strong>
</Link>
</div>
<div className='account__action-bar-dropdown'>
<DropdownMenuContainer items={menu} icon='ellipsis-v' size={24} direction='right' />
</div>
</div>
</div>
);
}
}
|
files/rxjs/2.3.8/rx.lite.compat.js
|
firulais/jsdelivr
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
;(function (undefined) {
var objectTypes = {
'boolean': false,
'function': true,
'object': true,
'number': false,
'string': false,
'undefined': false
};
var root = (objectTypes[typeof window] && window) || this,
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
freeGlobal = objectTypes[typeof global] && global;
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
root = freeGlobal;
}
var Rx = {
internals: {},
config: {
Promise: root.Promise // Detect if promise exists
},
helpers: { }
};
// Defaults
var noop = Rx.helpers.noop = function () { },
notDefined = Rx.helpers.notDefined = function (x) { return typeof x === 'undefined'; },
isScheduler = Rx.helpers.isScheduler = function (x) { return x instanceof Rx.Scheduler; },
identity = Rx.helpers.identity = function (x) { return x; },
pluck = Rx.helpers.pluck = function (property) { return function (x) { return x[property]; }; },
just = Rx.helpers.just = function (value) { return function () { return value; }; },
defaultNow = Rx.helpers.defaultNow = (function () { return !!Date.now ? Date.now : function () { return +new Date; }; }()),
defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); },
defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); },
defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); },
defaultError = Rx.helpers.defaultError = function (err) { throw err; },
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.then === 'function'; },
asArray = Rx.helpers.asArray = function () { return Array.prototype.slice.call(arguments); },
not = Rx.helpers.not = function (a) { return !a; };
// Errors
var sequenceContainsNoElements = 'Sequence contains no elements.';
var argumentOutOfRange = 'Argument out of range';
var objectDisposed = 'Object has been disposed';
function checkDisposed() { if (this.isDisposed) { throw new Error(objectDisposed); } }
// Shim in iterator support
var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) ||
'_es6shim_iterator_';
// Bug for mozilla version
if (root.Set && typeof new root.Set()['@@iterator'] === 'function') {
$iterator$ = '@@iterator';
}
var doneEnumerator = { done: true, value: undefined };
/** `Object#toString` result shortcuts */
var argsClass = '[object Arguments]',
arrayClass = '[object Array]',
boolClass = '[object Boolean]',
dateClass = '[object Date]',
errorClass = '[object Error]',
funcClass = '[object Function]',
numberClass = '[object Number]',
objectClass = '[object Object]',
regexpClass = '[object RegExp]',
stringClass = '[object String]';
var toString = Object.prototype.toString,
hasOwnProperty = Object.prototype.hasOwnProperty,
supportsArgsClass = toString.call(arguments) == argsClass, // For less <IE9 && FF<4
suportNodeClass,
errorProto = Error.prototype,
objectProto = Object.prototype,
propertyIsEnumerable = objectProto.propertyIsEnumerable;
try {
suportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
} catch(e) {
suportNodeClass = true;
}
var shadowedProps = [
'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf'
];
var nonEnumProps = {};
nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true };
nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true };
nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true };
nonEnumProps[objectClass] = { 'constructor': true };
var support = {};
(function () {
var ctor = function() { this.x = 1; },
props = [];
ctor.prototype = { 'valueOf': 1, 'y': 1 };
for (var key in new ctor) { props.push(key); }
for (key in arguments) { }
// Detect if `name` or `message` properties of `Error.prototype` are enumerable by default.
support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name');
// Detect if `prototype` properties are enumerable by default.
support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype');
// Detect if `arguments` object indexes are non-enumerable
support.nonEnumArgs = key != 0;
// Detect if properties shadowing those on `Object.prototype` are non-enumerable.
support.nonEnumShadows = !/valueOf/.test(props);
}(1));
function isObject(value) {
// check if the value is the ECMAScript language type of Object
// http://es5.github.io/#x8
// and avoid a V8 bug
// https://code.google.com/p/v8/issues/detail?id=2291
var type = typeof value;
return value && (type == 'function' || type == 'object') || false;
}
function keysIn(object) {
var result = [];
if (!isObject(object)) {
return result;
}
if (support.nonEnumArgs && object.length && isArguments(object)) {
object = slice.call(object);
}
var skipProto = support.enumPrototypes && typeof object == 'function',
skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error);
for (var key in object) {
if (!(skipProto && key == 'prototype') &&
!(skipErrorProps && (key == 'message' || key == 'name'))) {
result.push(key);
}
}
if (support.nonEnumShadows && object !== objectProto) {
var ctor = object.constructor,
index = -1,
length = shadowedProps.length;
if (object === (ctor && ctor.prototype)) {
var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object),
nonEnum = nonEnumProps[className];
}
while (++index < length) {
key = shadowedProps[index];
if (!(nonEnum && nonEnum[key]) && hasOwnProperty.call(object, key)) {
result.push(key);
}
}
}
return result;
}
function internalFor(object, callback, keysFunc) {
var index = -1,
props = keysFunc(object),
length = props.length;
while (++index < length) {
var key = props[index];
if (callback(object[key], key, object) === false) {
break;
}
}
return object;
}
function internalForIn(object, callback) {
return internalFor(object, callback, keysIn);
}
function isNode(value) {
// IE < 9 presents DOM nodes as `Object` objects except they have `toString`
// methods that are `typeof` "string" and still can coerce nodes to strings
return typeof value.toString != 'function' && typeof (value + '') == 'string';
}
function isArguments(value) {
return (value && typeof value == 'object') ? toString.call(value) == argsClass : false;
}
// fallback for browsers that can't detect `arguments` objects by [[Class]]
if (!supportsArgsClass) {
isArguments = function(value) {
return (value && typeof value == 'object') ? hasOwnProperty.call(value, 'callee') : false;
};
}
function isFunction(value) {
return typeof value == 'function' || false;
}
// fallback for older versions of Chrome and Safari
if (isFunction(/x/)) {
isFunction = function(value) {
return typeof value == 'function' && toString.call(value) == funcClass;
};
}
var isEqual = Rx.internals.isEqual = function (x, y) {
return deepEquals(x, y, [], []);
};
/** @private
* Used for deep comparison
**/
function deepEquals(a, b, stackA, stackB) {
// exit early for identical values
if (a === b) {
// treat `+0` vs. `-0` as not equal
return a !== 0 || (1 / a == 1 / b);
}
var type = typeof a,
otherType = typeof b;
// exit early for unlike primitive values
if (a === a && (a == null || b == null ||
(type != 'function' && type != 'object' && otherType != 'function' && otherType != 'object'))) {
return false;
}
// compare [[Class]] names
var className = toString.call(a),
otherClass = toString.call(b);
if (className == argsClass) {
className = objectClass;
}
if (otherClass == argsClass) {
otherClass = objectClass;
}
if (className != otherClass) {
return false;
}
switch (className) {
case boolClass:
case dateClass:
// coerce dates and booleans to numbers, dates to milliseconds and booleans
// to `1` or `0` treating invalid dates coerced to `NaN` as not equal
return +a == +b;
case numberClass:
// treat `NaN` vs. `NaN` as equal
return (a != +a)
? b != +b
// but treat `-0` vs. `+0` as not equal
: (a == 0 ? (1 / a == 1 / b) : a == +b);
case regexpClass:
case stringClass:
// coerce regexes to strings (http://es5.github.io/#x15.10.6.4)
// treat string primitives and their corresponding object instances as equal
return a == String(b);
}
var isArr = className == arrayClass;
if (!isArr) {
// exit for functions and DOM nodes
if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) {
return false;
}
// in older versions of Opera, `arguments` objects have `Array` constructors
var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor,
ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor;
// non `Object` object instances with different constructors are not equal
if (ctorA != ctorB &&
!(hasOwnProperty.call(a, 'constructor') && hasOwnProperty.call(b, 'constructor')) &&
!(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) &&
('constructor' in a && 'constructor' in b)
) {
return false;
}
}
// assume cyclic structures are equal
// the algorithm for detecting cyclic structures is adapted from ES 5.1
// section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3)
var initedStack = !stackA;
stackA || (stackA = []);
stackB || (stackB = []);
var length = stackA.length;
while (length--) {
if (stackA[length] == a) {
return stackB[length] == b;
}
}
var size = 0;
result = true;
// add `a` and `b` to the stack of traversed objects
stackA.push(a);
stackB.push(b);
// recursively compare objects and arrays (susceptible to call stack limits)
if (isArr) {
// compare lengths to determine if a deep comparison is necessary
length = a.length;
size = b.length;
result = size == length;
if (result) {
// deep compare the contents, ignoring non-numeric properties
while (size--) {
var index = length,
value = b[size];
if (!(result = deepEquals(a[size], value, stackA, stackB))) {
break;
}
}
}
}
else {
// deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys`
// which, in this case, is more costly
internalForIn(b, function(value, key, b) {
if (hasOwnProperty.call(b, key)) {
// count the number of properties.
size++;
// deep compare each property value.
return (result = hasOwnProperty.call(a, key) && deepEquals(a[key], value, stackA, stackB));
}
});
if (result) {
// ensure both objects have the same number of properties
internalForIn(a, function(value, key, a) {
if (hasOwnProperty.call(a, key)) {
// `size` will be `-1` if `a` has more properties than `b`
return (result = --size > -1);
}
});
}
}
stackA.pop();
stackB.pop();
return result;
}
var slice = Array.prototype.slice;
function argsOrArray(args, idx) {
return args.length === 1 && Array.isArray(args[idx]) ?
args[idx] :
slice.call(args);
}
var hasProp = {}.hasOwnProperty;
/** @private */
var inherits = this.inherits = Rx.internals.inherits = function (child, parent) {
function __() { this.constructor = child; }
__.prototype = parent.prototype;
child.prototype = new __();
};
/** @private */
var addProperties = Rx.internals.addProperties = function (obj) {
var sources = slice.call(arguments, 1);
for (var i = 0, len = sources.length; i < len; i++) {
var source = sources[i];
for (var prop in source) {
obj[prop] = source[prop];
}
}
};
// Rx Utils
var addRef = Rx.internals.addRef = function (xs, r) {
return new AnonymousObservable(function (observer) {
return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer));
});
};
// Collection polyfills
function arrayInitialize(count, factory) {
var a = new Array(count);
for (var i = 0; i < count; i++) {
a[i] = factory();
}
return a;
}
// Utilities
if (!Function.prototype.bind) {
Function.prototype.bind = function (that) {
var target = this,
args = slice.call(arguments, 1);
var bound = function () {
if (this instanceof bound) {
function F() { }
F.prototype = target.prototype;
var self = new F();
var result = target.apply(self, args.concat(slice.call(arguments)));
if (Object(result) === result) {
return result;
}
return self;
} else {
return target.apply(that, args.concat(slice.call(arguments)));
}
};
return bound;
};
}
if (!Array.prototype.forEach) {
Array.prototype.forEach = function (callback, thisArg) {
var T, k;
if (this == null) {
throw new TypeError(" this is null or not defined");
}
var O = Object(this);
var len = O.length >>> 0;
if (typeof callback !== "function") {
throw new TypeError(callback + " is not a function");
}
if (arguments.length > 1) {
T = thisArg;
}
k = 0;
while (k < len) {
var kValue;
if (k in O) {
kValue = O[k];
callback.call(T, kValue, k, O);
}
k++;
}
};
}
var boxedString = Object("a"),
splitString = boxedString[0] != "a" || !(0 in boxedString);
if (!Array.prototype.every) {
Array.prototype.every = function every(fun /*, thisp */) {
var object = Object(this),
self = splitString && {}.toString.call(this) == stringClass ?
this.split("") :
object,
length = self.length >>> 0,
thisp = arguments[1];
if ({}.toString.call(fun) != funcClass) {
throw new TypeError(fun + " is not a function");
}
for (var i = 0; i < length; i++) {
if (i in self && !fun.call(thisp, self[i], i, object)) {
return false;
}
}
return true;
};
}
if (!Array.prototype.map) {
Array.prototype.map = function map(fun /*, thisp*/) {
var object = Object(this),
self = splitString && {}.toString.call(this) == stringClass ?
this.split("") :
object,
length = self.length >>> 0,
result = Array(length),
thisp = arguments[1];
if ({}.toString.call(fun) != funcClass) {
throw new TypeError(fun + " is not a function");
}
for (var i = 0; i < length; i++) {
if (i in self) {
result[i] = fun.call(thisp, self[i], i, object);
}
}
return result;
};
}
if (!Array.prototype.filter) {
Array.prototype.filter = function (predicate) {
var results = [], item, t = new Object(this);
for (var i = 0, len = t.length >>> 0; i < len; i++) {
item = t[i];
if (i in t && predicate.call(arguments[1], item, i, t)) {
results.push(item);
}
}
return results;
};
}
if (!Array.isArray) {
Array.isArray = function (arg) {
return {}.toString.call(arg) == arrayClass;
};
}
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function indexOf(searchElement) {
var t = Object(this);
var len = t.length >>> 0;
if (len === 0) {
return -1;
}
var n = 0;
if (arguments.length > 1) {
n = Number(arguments[1]);
if (n !== n) {
n = 0;
} else if (n !== 0 && n != Infinity && n !== -Infinity) {
n = (n > 0 || -1) * Math.floor(Math.abs(n));
}
}
if (n >= len) {
return -1;
}
var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
for (; k < len; k++) {
if (k in t && t[k] === searchElement) {
return k;
}
}
return -1;
};
}
// Collections
var IndexedItem = function (id, value) {
this.id = id;
this.value = value;
};
IndexedItem.prototype.compareTo = function (other) {
var c = this.value.compareTo(other.value);
if (c === 0) {
c = this.id - other.id;
}
return c;
};
// Priority Queue for Scheduling
var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {
this.items = new Array(capacity);
this.length = 0;
};
var priorityProto = PriorityQueue.prototype;
priorityProto.isHigherPriority = function (left, right) {
return this.items[left].compareTo(this.items[right]) < 0;
};
priorityProto.percolate = function (index) {
if (index >= this.length || index < 0) {
return;
}
var parent = index - 1 >> 1;
if (parent < 0 || parent === index) {
return;
}
if (this.isHigherPriority(index, parent)) {
var temp = this.items[index];
this.items[index] = this.items[parent];
this.items[parent] = temp;
this.percolate(parent);
}
};
priorityProto.heapify = function (index) {
if (index === undefined) {
index = 0;
}
if (index >= this.length || index < 0) {
return;
}
var left = 2 * index + 1,
right = 2 * index + 2,
first = index;
if (left < this.length && this.isHigherPriority(left, first)) {
first = left;
}
if (right < this.length && this.isHigherPriority(right, first)) {
first = right;
}
if (first !== index) {
var temp = this.items[index];
this.items[index] = this.items[first];
this.items[first] = temp;
this.heapify(first);
}
};
priorityProto.peek = function () { return this.items[0].value; };
priorityProto.removeAt = function (index) {
this.items[index] = this.items[--this.length];
delete this.items[this.length];
this.heapify();
};
priorityProto.dequeue = function () {
var result = this.peek();
this.removeAt(0);
return result;
};
priorityProto.enqueue = function (item) {
var index = this.length++;
this.items[index] = new IndexedItem(PriorityQueue.count++, item);
this.percolate(index);
};
priorityProto.remove = function (item) {
for (var i = 0; i < this.length; i++) {
if (this.items[i].value === item) {
this.removeAt(i);
return true;
}
}
return false;
};
PriorityQueue.count = 0;
/**
* Represents a group of disposable resources that are disposed together.
* @constructor
*/
var CompositeDisposable = Rx.CompositeDisposable = function () {
this.disposables = argsOrArray(arguments, 0);
this.isDisposed = false;
this.length = this.disposables.length;
};
var CompositeDisposablePrototype = CompositeDisposable.prototype;
/**
* Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.
* @param {Mixed} item Disposable to add.
*/
CompositeDisposablePrototype.add = function (item) {
if (this.isDisposed) {
item.dispose();
} else {
this.disposables.push(item);
this.length++;
}
};
/**
* Removes and disposes the first occurrence of a disposable from the CompositeDisposable.
* @param {Mixed} item Disposable to remove.
* @returns {Boolean} true if found; false otherwise.
*/
CompositeDisposablePrototype.remove = function (item) {
var shouldDispose = false;
if (!this.isDisposed) {
var idx = this.disposables.indexOf(item);
if (idx !== -1) {
shouldDispose = true;
this.disposables.splice(idx, 1);
this.length--;
item.dispose();
}
}
return shouldDispose;
};
/**
* Disposes all disposables in the group and removes them from the group.
*/
CompositeDisposablePrototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var currentDisposables = this.disposables.slice(0);
this.disposables = [];
this.length = 0;
for (var i = 0, len = currentDisposables.length; i < len; i++) {
currentDisposables[i].dispose();
}
}
};
/**
* Removes and disposes all disposables from the CompositeDisposable, but does not dispose the CompositeDisposable.
*/
CompositeDisposablePrototype.clear = function () {
var currentDisposables = this.disposables.slice(0);
this.disposables = [];
this.length = 0;
for (var i = 0, len = currentDisposables.length; i < len; i++) {
currentDisposables[i].dispose();
}
};
/**
* Determines whether the CompositeDisposable contains a specific disposable.
* @param {Mixed} item Disposable to search for.
* @returns {Boolean} true if the disposable was found; otherwise, false.
*/
CompositeDisposablePrototype.contains = function (item) {
return this.disposables.indexOf(item) !== -1;
};
/**
* Converts the existing CompositeDisposable to an array of disposables
* @returns {Array} An array of disposable objects.
*/
CompositeDisposablePrototype.toArray = function () {
return this.disposables.slice(0);
};
/**
* Provides a set of static methods for creating Disposables.
*
* @constructor
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
*/
var Disposable = Rx.Disposable = function (action) {
this.isDisposed = false;
this.action = action || noop;
};
/** Performs the task of cleaning up resources. */
Disposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.action();
this.isDisposed = true;
}
};
/**
* Creates a disposable object that invokes the specified action when disposed.
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
* @return {Disposable} The disposable object that runs the given action upon disposal.
*/
var disposableCreate = Disposable.create = function (action) { return new Disposable(action); };
/**
* Gets the disposable that does nothing when disposed.
*/
var disposableEmpty = Disposable.empty = { dispose: noop };
var BooleanDisposable = (function () {
function BooleanDisposable (isSingle) {
this.isSingle = isSingle;
this.isDisposed = false;
this.current = null;
}
var booleanDisposablePrototype = BooleanDisposable.prototype;
/**
* Gets the underlying disposable.
* @return The underlying disposable.
*/
booleanDisposablePrototype.getDisposable = function () {
return this.current;
};
/**
* Sets the underlying disposable.
* @param {Disposable} value The new underlying disposable.
*/
booleanDisposablePrototype.setDisposable = function (value) {
if (this.current && this.isSingle) {
throw new Error('Disposable has already been assigned');
}
var shouldDispose = this.isDisposed, old;
if (!shouldDispose) {
old = this.current;
this.current = value;
}
old && old.dispose();
shouldDispose && value && value.dispose();
};
/**
* Disposes the underlying disposable as well as all future replacements.
*/
booleanDisposablePrototype.dispose = function () {
var old;
if (!this.isDisposed) {
this.isDisposed = true;
old = this.current;
this.current = null;
}
old && old.dispose();
};
return BooleanDisposable;
}());
/**
* Represents a disposable resource which only allows a single assignment of its underlying disposable resource.
* If an underlying disposable resource has already been set, future attempts to set the underlying disposable resource will throw an Error.
*/
var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = (function (super_) {
inherits(SingleAssignmentDisposable, super_);
function SingleAssignmentDisposable() {
super_.call(this, true);
}
return SingleAssignmentDisposable;
}(BooleanDisposable));
/**
* Represents a disposable resource whose underlying disposable resource can be replaced by another disposable resource, causing automatic disposal of the previous underlying disposable resource.
*/
var SerialDisposable = Rx.SerialDisposable = (function (super_) {
inherits(SerialDisposable, super_);
function SerialDisposable() {
super_.call(this, false);
}
return SerialDisposable;
}(BooleanDisposable));
/**
* Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed.
*/
var RefCountDisposable = Rx.RefCountDisposable = (function () {
function InnerDisposable(disposable) {
this.disposable = disposable;
this.disposable.count++;
this.isInnerDisposed = false;
}
InnerDisposable.prototype.dispose = function () {
if (!this.disposable.isDisposed) {
if (!this.isInnerDisposed) {
this.isInnerDisposed = true;
this.disposable.count--;
if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) {
this.disposable.isDisposed = true;
this.disposable.underlyingDisposable.dispose();
}
}
}
};
/**
* Initializes a new instance of the RefCountDisposable with the specified disposable.
* @constructor
* @param {Disposable} disposable Underlying disposable.
*/
function RefCountDisposable(disposable) {
this.underlyingDisposable = disposable;
this.isDisposed = false;
this.isPrimaryDisposed = false;
this.count = 0;
}
/**
* Disposes the underlying disposable only when all dependent disposables have been disposed
*/
RefCountDisposable.prototype.dispose = function () {
if (!this.isDisposed) {
if (!this.isPrimaryDisposed) {
this.isPrimaryDisposed = true;
if (this.count === 0) {
this.isDisposed = true;
this.underlyingDisposable.dispose();
}
}
}
};
/**
* Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable.
* @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime.
*/
RefCountDisposable.prototype.getDisposable = function () {
return this.isDisposed ? disposableEmpty : new InnerDisposable(this);
};
return RefCountDisposable;
})();
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
this.scheduler = scheduler;
this.state = state;
this.action = action;
this.dueTime = dueTime;
this.comparer = comparer || defaultSubComparer;
this.disposable = new SingleAssignmentDisposable();
}
ScheduledItem.prototype.invoke = function () {
this.disposable.setDisposable(this.invokeCore());
};
ScheduledItem.prototype.compareTo = function (other) {
return this.comparer(this.dueTime, other.dueTime);
};
ScheduledItem.prototype.isCancelled = function () {
return this.disposable.isDisposed;
};
ScheduledItem.prototype.invokeCore = function () {
return this.action(this.scheduler, this.state);
};
/** Provides a set of static properties to access commonly used schedulers. */
var Scheduler = Rx.Scheduler = (function () {
function Scheduler(now, schedule, scheduleRelative, scheduleAbsolute) {
this.now = now;
this._schedule = schedule;
this._scheduleRelative = scheduleRelative;
this._scheduleAbsolute = scheduleAbsolute;
}
function invokeRecImmediate(scheduler, pair) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2) {
var isAdded = false, isDone = false,
d = scheduler.scheduleWithState(state2, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function invokeRecDate(scheduler, pair, method) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2, dueTime1) {
var isAdded = false, isDone = false,
d = scheduler[method].call(scheduler, state2, dueTime1, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function invokeAction(scheduler, action) {
action();
return disposableEmpty;
}
var schedulerProto = Scheduler.prototype;
/**
* Schedules an action to be executed.
* @param {Function} action Action to execute.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.schedule = function (action) {
return this._schedule(action, invokeAction);
};
/**
* Schedules an action to be executed.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithState = function (state, action) {
return this._schedule(state, action);
};
/**
* Schedules an action to be executed after the specified relative due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelative = function (dueTime, action) {
return this._scheduleRelative(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed after dueTime.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative(state, dueTime, action);
};
/**
* Schedules an action to be executed at the specified absolute due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsolute = function (dueTime, action) {
return this._scheduleAbsolute(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number}dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute(state, dueTime, action);
};
/** Gets the current time according to the local machine's system clock. */
Scheduler.now = defaultNow;
/**
* Normalizes the specified TimeSpan value to a positive value.
* @param {Number} timeSpan The time span value to normalize.
* @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0
*/
Scheduler.normalize = function (timeSpan) {
timeSpan < 0 && (timeSpan = 0);
return timeSpan;
};
return Scheduler;
}());
var normalizeTime = Scheduler.normalize;
(function (schedulerProto) {
function invokeRecImmediate(scheduler, pair) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2) {
var isAdded = false, isDone = false,
d = scheduler.scheduleWithState(state2, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function invokeRecDate(scheduler, pair, method) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2, dueTime1) {
var isAdded = false, isDone = false,
d = scheduler[method].call(scheduler, state2, dueTime1, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function scheduleInnerRecursive(action, self) {
action(function(dt) { self(action, dt); });
}
/**
* Schedules an action to be executed recursively.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursive = function (action) {
return this.scheduleRecursiveWithState(action, function (_action, self) {
_action(function () { self(_action); }); });
};
/**
* Schedules an action to be executed recursively.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithState = function (state, action) {
return this.scheduleWithState({ first: state, second: action }, invokeRecImmediate);
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified relative time.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelative = function (dueTime, action) {
return this.scheduleRecursiveWithRelativeAndState(action, dueTime, scheduleInnerRecursive);
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative({ first: state, second: action }, dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithRelativeAndState');
});
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified absolute time.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsolute = function (dueTime, action) {
return this.scheduleRecursiveWithAbsoluteAndState(action, dueTime, scheduleInnerRecursive);
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute({ first: state, second: action }, dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState');
});
};
}(Scheduler.prototype));
(function (schedulerProto) {
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
Scheduler.prototype.schedulePeriodic = function (period, action) {
return this.schedulePeriodicWithState(null, period, action);
};
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Mixed} state Initial state passed to the action upon the first iteration.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed, potentially updating the state.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
Scheduler.prototype.schedulePeriodicWithState = function (state, period, action) {
var s = state;
var id = setInterval(function () {
s = action(s);
}, period);
return disposableCreate(function () {
clearInterval(id);
});
};
}(Scheduler.prototype));
/**
* Gets a scheduler that schedules work immediately on the current thread.
*/
var immediateScheduler = Scheduler.immediate = (function () {
function scheduleNow(state, action) { return action(this, state); }
function scheduleRelative(state, dueTime, action) {
var dt = normalizeTime(dt);
while (dt - this.now() > 0) { }
return action(this, state);
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}());
/**
* Gets a scheduler that schedules work as soon as possible on the current thread.
*/
var currentThreadScheduler = Scheduler.currentThread = (function () {
var queue;
function runTrampoline (q) {
var item;
while (q.length > 0) {
item = q.dequeue();
if (!item.isCancelled()) {
// Note, do not schedule blocking work!
while (item.dueTime - Scheduler.now() > 0) {
}
if (!item.isCancelled()) {
item.invoke();
}
}
}
}
function scheduleNow(state, action) {
return this.scheduleWithRelativeAndState(state, 0, action);
}
function scheduleRelative(state, dueTime, action) {
var dt = this.now() + Scheduler.normalize(dueTime),
si = new ScheduledItem(this, state, action, dt);
if (!queue) {
queue = new PriorityQueue(4);
queue.enqueue(si);
try {
runTrampoline(queue);
} catch (e) {
throw e;
} finally {
queue = null;
}
} else {
queue.enqueue(si);
}
return si.disposable;
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
var currentScheduler = new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
currentScheduler.scheduleRequired = function () { return !queue; };
currentScheduler.ensureTrampoline = function (action) {
if (!queue) { this.schedule(action); } else { action(); }
};
return currentScheduler;
}());
var 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;
}());
var scheduleMethod, clearMethod = noop;
(function () {
var reNative = RegExp('^' +
String(toString)
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
.replace(/toString| for [^\]]+/g, '.*?') + '$'
);
var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' &&
!reNative.test(setImmediate) && setImmediate,
clearImmediate = typeof (clearImmediate = freeGlobal && moduleExports && freeGlobal.clearImmediate) == 'function' &&
!reNative.test(clearImmediate) && clearImmediate;
function postMessageSupported () {
// Ensure not in a worker
if (!root.postMessage || root.importScripts) { return false; }
var isAsync = false,
oldHandler = root.onmessage;
// Test for async
root.onmessage = function () { isAsync = true; };
root.postMessage('','*');
root.onmessage = oldHandler;
return isAsync;
}
// Use in order, nextTick, setImmediate, postMessage, MessageChannel, script readystatechanged, setTimeout
if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
scheduleMethod = process.nextTick;
} else if (typeof setImmediate === 'function') {
scheduleMethod = setImmediate;
clearMethod = clearImmediate;
} else if (postMessageSupported()) {
var MSG_PREFIX = 'ms.rx.schedule' + Math.random(),
tasks = {},
taskId = 0;
function onGlobalPostMessage(event) {
// Only if we're a match to avoid any other global events
if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) {
var handleId = event.data.substring(MSG_PREFIX.length),
action = tasks[handleId];
action();
delete tasks[handleId];
}
}
if (root.addEventListener) {
root.addEventListener('message', onGlobalPostMessage, false);
} else {
root.attachEvent('onmessage', onGlobalPostMessage, false);
}
scheduleMethod = function (action) {
var currentId = taskId++;
tasks[currentId] = action;
root.postMessage(MSG_PREFIX + currentId, '*');
};
} else if (!!root.MessageChannel) {
var channel = new root.MessageChannel(),
channelTasks = {},
channelTaskId = 0;
channel.port1.onmessage = function (event) {
var id = event.data,
action = channelTasks[id];
action();
delete channelTasks[id];
};
scheduleMethod = function (action) {
var id = channelTaskId++;
channelTasks[id] = action;
channel.port2.postMessage(id);
};
} else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) {
scheduleMethod = function (action) {
var scriptElement = root.document.createElement('script');
scriptElement.onreadystatechange = function () {
action();
scriptElement.onreadystatechange = null;
scriptElement.parentNode.removeChild(scriptElement);
scriptElement = null;
};
root.document.documentElement.appendChild(scriptElement);
};
} else {
scheduleMethod = function (action) { return setTimeout(action, 0); };
clearMethod = clearTimeout;
}
}());
/**
* Gets a scheduler that schedules work via a timed callback based upon platform.
*/
var timeoutScheduler = Scheduler.timeout = (function () {
function scheduleNow(state, action) {
var scheduler = this,
disposable = new SingleAssignmentDisposable();
var id = scheduleMethod(function () {
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
});
return new CompositeDisposable(disposable, disposableCreate(function () {
clearMethod(id);
}));
}
function scheduleRelative(state, dueTime, action) {
var scheduler = this,
dt = Scheduler.normalize(dueTime);
if (dt === 0) {
return scheduler.scheduleWithState(state, action);
}
var disposable = new SingleAssignmentDisposable();
var id = setTimeout(function () {
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
}, dt);
return new CompositeDisposable(disposable, disposableCreate(function () {
clearTimeout(id);
}));
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
})();
/**
* Represents a notification to an observer.
*/
var Notification = Rx.Notification = (function () {
function Notification(kind, hasValue) {
this.hasValue = hasValue == null ? false : hasValue;
this.kind = kind;
}
/**
* Invokes the delegate corresponding to the notification or the observer's method corresponding to the notification and returns the produced result.
*
* @memberOf Notification
* @param {Any} observerOrOnNext Delegate to invoke for an OnNext notification or Observer to invoke the notification on..
* @param {Function} onError Delegate to invoke for an OnError notification.
* @param {Function} onCompleted Delegate to invoke for an OnCompleted notification.
* @returns {Any} Result produced by the observation.
*/
Notification.prototype.accept = function (observerOrOnNext, onError, onCompleted) {
return observerOrOnNext && typeof observerOrOnNext === 'object' ?
this._acceptObservable(observerOrOnNext) :
this._accept(observerOrOnNext, onError, onCompleted);
};
/**
* Returns an observable sequence with a single notification.
*
* @memberOf Notifications
* @param {Scheduler} [scheduler] Scheduler to send out the notification calls on.
* @returns {Observable} The observable sequence that surfaces the behavior of the notification upon subscription.
*/
Notification.prototype.toObservable = function (scheduler) {
var notification = this;
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
notification._acceptObservable(observer);
notification.kind === 'N' && observer.onCompleted();
});
});
};
return Notification;
})();
/**
* Creates an object that represents an OnNext notification to an observer.
* @param {Any} value The value contained in the notification.
* @returns {Notification} The OnNext notification containing the value.
*/
var notificationCreateOnNext = Notification.createOnNext = (function () {
function _accept (onNext) { return onNext(this.value); }
function _acceptObservable(observer) { return observer.onNext(this.value); }
function toString () { return 'OnNext(' + this.value + ')'; }
return function (value) {
var notification = new Notification('N', true);
notification.value = value;
notification._accept = _accept;
notification._acceptObservable = _acceptObservable;
notification.toString = toString;
return notification;
};
}());
/**
* Creates an object that represents an OnError notification to an observer.
* @param {Any} error The exception contained in the notification.
* @returns {Notification} The OnError notification containing the exception.
*/
var notificationCreateOnError = Notification.createOnError = (function () {
function _accept (onNext, onError) { return onError(this.exception); }
function _acceptObservable(observer) { return observer.onError(this.exception); }
function toString () { return 'OnError(' + this.exception + ')'; }
return function (exception) {
var notification = new Notification('E');
notification.exception = exception;
notification._accept = _accept;
notification._acceptObservable = _acceptObservable;
notification.toString = toString;
return notification;
};
}());
/**
* Creates an object that represents an OnCompleted notification to an observer.
* @returns {Notification} The OnCompleted notification.
*/
var notificationCreateOnCompleted = Notification.createOnCompleted = (function () {
function _accept (onNext, onError, onCompleted) { return onCompleted(); }
function _acceptObservable(observer) { return observer.onCompleted(); }
function toString () { return 'OnCompleted()'; }
return function () {
var notification = new Notification('C');
notification._accept = _accept;
notification._acceptObservable = _acceptObservable;
notification.toString = toString;
return notification;
};
}());
var Enumerator = Rx.internals.Enumerator = function (next) {
this._next = next;
};
Enumerator.prototype.next = function () {
return this._next();
};
Enumerator.prototype[$iterator$] = function () { return this; }
var Enumerable = Rx.internals.Enumerable = function (iterator) {
this._iterator = iterator;
};
Enumerable.prototype[$iterator$] = function () {
return this._iterator();
};
Enumerable.prototype.concat = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var e;
try {
e = sources[$iterator$]();
} catch(err) {
observer.onError();
return;
}
var isDisposed,
subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
var currentItem;
if (isDisposed) { return; }
try {
currentItem = e.next();
} catch (ex) {
observer.onError(ex);
return;
}
if (currentItem.done) {
observer.onCompleted();
return;
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(
observer.onNext.bind(observer),
observer.onError.bind(observer),
function () { self(); })
);
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
Enumerable.prototype.catchException = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var e;
try {
e = sources[$iterator$]();
} catch(err) {
observer.onError();
return;
}
var isDisposed,
lastException,
subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
if (isDisposed) { return; }
var currentItem;
try {
currentItem = e.next();
} catch (ex) {
observer.onError(ex);
return;
}
if (currentItem.done) {
if (lastException) {
observer.onError(lastException);
} else {
observer.onCompleted();
}
return;
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(
observer.onNext.bind(observer),
function (exn) {
lastException = exn;
self();
},
observer.onCompleted.bind(observer)));
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
if (repeatCount == null) { repeatCount = -1; }
return new Enumerable(function () {
var left = repeatCount;
return new Enumerator(function () {
if (left === 0) { return doneEnumerator; }
if (left > 0) { left--; }
return { done: false, value: value };
});
});
};
var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) {
selector || (selector = identity);
return new Enumerable(function () {
var index = -1;
return new Enumerator(
function () {
return ++index < source.length ?
{ done: false, value: selector.call(thisArg, source[index], index, source) } :
doneEnumerator;
});
});
};
/**
* Supports push-style iteration over an observable sequence.
*/
var Observer = Rx.Observer = function () { };
/**
* Creates a notification callback from an observer.
*
* @param observer Observer object.
* @returns The action that forwards its input notification to the underlying observer.
*/
Observer.prototype.toNotifier = function () {
var observer = this;
return function (n) {
return n.accept(observer);
};
};
/**
* Hides the identity of an observer.
* @returns An observer that hides the identity of the specified observer.
*/
Observer.prototype.asObserver = function () {
return new AnonymousObserver(this.onNext.bind(this), this.onError.bind(this), this.onCompleted.bind(this));
};
/**
* Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions.
*
* @static
* @memberOf Observer
* @param {Function} [onNext] Observer's OnNext action implementation.
* @param {Function} [onError] Observer's OnError action implementation.
* @param {Function} [onCompleted] Observer's OnCompleted action implementation.
* @returns {Observer} The observer object implemented using the given actions.
*/
var observerCreate = Observer.create = function (onNext, onError, onCompleted) {
onNext || (onNext = noop);
onError || (onError = defaultError);
onCompleted || (onCompleted = noop);
return new AnonymousObserver(onNext, onError, onCompleted);
};
/**
* Creates an observer from a notification callback.
*
* @static
* @memberOf Observer
* @param {Function} handler Action that handles a notification.
* @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives.
*/
Observer.fromNotifier = function (handler) {
return new AnonymousObserver(function (x) {
return handler(notificationCreateOnNext(x));
}, function (exception) {
return handler(notificationCreateOnError(exception));
}, function () {
return handler(notificationCreateOnCompleted());
});
};
/**
* Abstract base class for implementations of the Observer class.
* This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages.
*/
var AbstractObserver = Rx.internals.AbstractObserver = (function (_super) {
inherits(AbstractObserver, _super);
/**
* Creates a new observer in a non-stopped state.
*
* @constructor
*/
function AbstractObserver() {
this.isStopped = false;
_super.call(this);
}
/**
* Notifies the observer of a new element in the sequence.
*
* @memberOf AbstractObserver
* @param {Any} value Next element in the sequence.
*/
AbstractObserver.prototype.onNext = function (value) {
if (!this.isStopped) {
this.next(value);
}
};
/**
* Notifies the observer that an exception has occurred.
*
* @memberOf AbstractObserver
* @param {Any} error The error that has occurred.
*/
AbstractObserver.prototype.onError = function (error) {
if (!this.isStopped) {
this.isStopped = true;
this.error(error);
}
};
/**
* Notifies the observer of the end of the sequence.
*/
AbstractObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.completed();
}
};
/**
* Disposes the observer, causing it to transition to the stopped state.
*/
AbstractObserver.prototype.dispose = function () {
this.isStopped = true;
};
AbstractObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.error(e);
return true;
}
return false;
};
return AbstractObserver;
}(Observer));
/**
* Class to create an Observer instance from delegate-based implementations of the on* methods.
*/
var AnonymousObserver = Rx.AnonymousObserver = (function (_super) {
inherits(AnonymousObserver, _super);
/**
* Creates an observer from the specified OnNext, OnError, and OnCompleted actions.
* @param {Any} onNext Observer's OnNext action implementation.
* @param {Any} onError Observer's OnError action implementation.
* @param {Any} onCompleted Observer's OnCompleted action implementation.
*/
function AnonymousObserver(onNext, onError, onCompleted) {
_super.call(this);
this._onNext = onNext;
this._onError = onError;
this._onCompleted = onCompleted;
}
/**
* Calls the onNext action.
* @param {Any} value Next element in the sequence.
*/
AnonymousObserver.prototype.next = function (value) {
this._onNext(value);
};
/**
* Calls the onError action.
* @param {Any} error The error that has occurred.
*/
AnonymousObserver.prototype.error = function (exception) {
this._onError(exception);
};
/**
* Calls the onCompleted action.
*/
AnonymousObserver.prototype.completed = function () {
this._onCompleted();
};
return AnonymousObserver;
}(AbstractObserver));
var observableProto;
/**
* Represents a push-style collection.
*/
var Observable = Rx.Observable = (function () {
function Observable(subscribe) {
this._subscribe = subscribe;
}
observableProto = Observable.prototype;
/**
* Subscribes an observer to the observable sequence.
*
* @example
* 1 - source.subscribe();
* 2 - source.subscribe(observer);
* 3 - source.subscribe(function (x) { console.log(x); });
* 4 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); });
* 5 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); }, function () { console.log('done'); });
* @param {Mixed} [observerOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
*/
observableProto.subscribe = observableProto.forEach = function (observerOrOnNext, onError, onCompleted) {
var subscriber = typeof observerOrOnNext === 'object' ?
observerOrOnNext :
observerCreate(observerOrOnNext, onError, onCompleted);
return this._subscribe(subscriber);
};
return Observable;
})();
var ScheduledObserver = Rx.internals.ScheduledObserver = (function (_super) {
inherits(ScheduledObserver, _super);
function ScheduledObserver(scheduler, observer) {
_super.call(this);
this.scheduler = scheduler;
this.observer = observer;
this.isAcquired = false;
this.hasFaulted = false;
this.queue = [];
this.disposable = new SerialDisposable();
}
ScheduledObserver.prototype.next = function (value) {
var self = this;
this.queue.push(function () {
self.observer.onNext(value);
});
};
ScheduledObserver.prototype.error = function (exception) {
var self = this;
this.queue.push(function () {
self.observer.onError(exception);
});
};
ScheduledObserver.prototype.completed = function () {
var self = this;
this.queue.push(function () {
self.observer.onCompleted();
});
};
ScheduledObserver.prototype.ensureActive = function () {
var isOwner = false, parent = this;
if (!this.hasFaulted && this.queue.length > 0) {
isOwner = !this.isAcquired;
this.isAcquired = true;
}
if (isOwner) {
this.disposable.setDisposable(this.scheduler.scheduleRecursive(function (self) {
var work;
if (parent.queue.length > 0) {
work = parent.queue.shift();
} else {
parent.isAcquired = false;
return;
}
try {
work();
} catch (ex) {
parent.queue = [];
parent.hasFaulted = true;
throw ex;
}
self();
}));
}
};
ScheduledObserver.prototype.dispose = function () {
_super.prototype.dispose.call(this);
this.disposable.dispose();
};
return ScheduledObserver;
}(AbstractObserver));
/**
* Creates a list from an observable sequence.
* @returns An observable sequence containing a single element with a list containing all the elements of the source sequence.
*/
observableProto.toArray = function () {
var self = this;
return new AnonymousObservable(function(observer) {
var arr = [];
return self.subscribe(
arr.push.bind(arr),
observer.onError.bind(observer),
function () {
observer.onNext(arr);
observer.onCompleted();
});
});
};
/**
* Creates an observable sequence from a specified subscribe method implementation.
*
* @example
* var res = Rx.Observable.create(function (observer) { return function () { } );
* var res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } );
* var res = Rx.Observable.create(function (observer) { } );
*
* @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable.
* @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.
*/
Observable.create = Observable.createWithDisposable = function (subscribe) {
return new AnonymousObservable(subscribe);
};
/**
* Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.
*
* @example
* var res = Rx.Observable.defer(function () { return Rx.Observable.fromArray([1,2,3]); });
* @param {Function} observableFactory Observable factory function to invoke for each observer that subscribes to the resulting sequence or Promise.
* @returns {Observable} An observable sequence whose observers trigger an invocation of the given observable factory function.
*/
var observableDefer = Observable.defer = function (observableFactory) {
return new AnonymousObservable(function (observer) {
var result;
try {
result = observableFactory();
} catch (e) {
return observableThrow(e).subscribe(observer);
}
isPromise(result) && (result = observableFromPromise(result));
return result.subscribe(observer);
});
};
/**
* Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
*
* @example
* var res = Rx.Observable.empty();
* var res = Rx.Observable.empty(Rx.Scheduler.timeout);
* @param {Scheduler} [scheduler] Scheduler to send the termination call on.
* @returns {Observable} An observable sequence with no elements.
*/
var observableEmpty = Observable.empty = function (scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onCompleted();
});
});
};
var maxSafeInteger = Math.pow(2, 53) - 1;
function numberIsFinite(value) {
return typeof value === 'number' && root.isFinite(value);
}
function isNan(n) {
return n !== n;
}
function isIterable(o) {
return o[$iterator$] !== undefined;
}
function sign(value) {
var number = +value;
if (number === 0) { return number; }
if (isNaN(number)) { return number; }
return number < 0 ? -1 : 1;
}
function toLength(o) {
var len = +o.length;
if (isNaN(len)) { return 0; }
if (len === 0 || !numberIsFinite(len)) { return len; }
len = sign(len) * Math.floor(Math.abs(len));
if (len <= 0) { return 0; }
if (len > maxSafeInteger) { return maxSafeInteger; }
return len;
}
function isCallable(f) {
return Object.prototype.toString.call(f) === '[object Function]' && typeof f === 'function';
}
/**
* This method creates a new Observable sequence from an array-like or iterable object.
* @param {Any} arrayLike An array-like or iterable object to convert to an Observable sequence.
* @param {Function} [mapFn] Map function to call on every element of the array.
* @param {Any} [thisArg] The context to use calling the mapFn if provided.
* @param {Scheduler} [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread.
*/
Observable.from = function (iterable, mapFn, thisArg, scheduler) {
if (iterable == null) {
throw new Error('iterable cannot be null.')
}
if (mapFn && !isCallable(mapFn)) {
throw new Error('mapFn when provided must be a function');
}
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var list = Object(iterable),
objIsIterable = isIterable(list),
len = objIsIterable ? 0 : toLength(list),
it = objIsIterable ? list[$iterator$]() : null,
i = 0;
return scheduler.scheduleRecursive(function (self) {
if (i < len || objIsIterable) {
var result;
if (objIsIterable) {
var next = it.next();
if (next.done) {
observer.onCompleted();
return;
}
result = next.value;
} else {
result = list[i];
}
if (mapFn && isCallable(mapFn)) {
try {
result = thisArg ? mapFn.call(thisArg, result, i) : mapFn(result, i);
} catch (e) {
observer.onError(e);
return;
}
}
observer.onNext(result);
i++;
self();
} else {
observer.onCompleted();
}
});
});
};
/**
* Converts an array to an observable sequence, using an optional scheduler to enumerate the array.
*
* @example
* var res = Rx.Observable.fromArray([1,2,3]);
* var res = Rx.Observable.fromArray([1,2,3], Rx.Scheduler.timeout);
* @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.
* @returns {Observable} The observable sequence whose elements are pulled from the given enumerable sequence.
*/
var observableFromArray = Observable.fromArray = function (array, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var count = 0, len = array.length;
return scheduler.scheduleRecursive(function (self) {
if (count < len) {
observer.onNext(array[count++]);
self();
} else {
observer.onCompleted();
}
});
});
};
/**
* Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
* @returns {Observable} An observable sequence whose observers will never get called.
*/
var observableNever = Observable.never = function () {
return new AnonymousObservable(function () {
return disposableEmpty;
});
};
/**
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
* @example
* var res = Rx.Observable.of(1,2,3);
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
*/
Observable.of = function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return observableFromArray(args);
};
/**
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
* @example
* var res = Rx.Observable.of(1,2,3);
* @param {Scheduler} scheduler A scheduler to use for scheduling the arguments.
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
*/
var observableOf = Observable.ofWithScheduler = function (scheduler) {
var len = arguments.length - 1, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i + 1]; }
return observableFromArray(args, scheduler);
};
/**
* Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.range(0, 10);
* var res = Rx.Observable.range(0, 10, Rx.Scheduler.timeout);
* @param {Number} start The value of the first integer in the sequence.
* @param {Number} count The number of sequential integers to generate.
* @param {Scheduler} [scheduler] Scheduler to run the generator loop on. If not specified, defaults to Scheduler.currentThread.
* @returns {Observable} An observable sequence that contains a range of sequential integral numbers.
*/
Observable.range = function (start, count, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.scheduleRecursiveWithState(0, function (i, self) {
if (i < count) {
observer.onNext(start + i);
self(i + 1);
} else {
observer.onCompleted();
}
});
});
};
/**
* Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.repeat(42);
* var res = Rx.Observable.repeat(42, 4);
* 3 - res = Rx.Observable.repeat(42, 4, Rx.Scheduler.timeout);
* 4 - res = Rx.Observable.repeat(42, null, Rx.Scheduler.timeout);
* @param {Mixed} value Element to repeat.
* @param {Number} repeatCount [Optiona] Number of times to repeat the element. If not specified, repeats indefinitely.
* @param {Scheduler} scheduler Scheduler to run the producer loop on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence that repeats the given element the specified number of times.
*/
Observable.repeat = function (value, repeatCount, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return observableReturn(value, scheduler).repeat(repeatCount == null ? -1 : repeatCount);
};
/**
* Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages.
* There is an alias called 'just', and 'returnValue' for browsers <IE9.
*
* @example
* var res = Rx.Observable.return(42);
* var res = Rx.Observable.return(42, Rx.Scheduler.timeout);
* @param {Mixed} value Single element in the resulting observable sequence.
* @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence containing the single specified element.
*/
var observableReturn = Observable['return'] = Observable.returnValue = Observable.just = function (value, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onNext(value);
observer.onCompleted();
});
});
};
/**
* Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single onError message.
* There is an alias to this method called 'throwException' for browsers <IE9.
*
* @example
* var res = Rx.Observable.throw(new Error('Error'));
* var res = Rx.Observable.throw(new Error('Error'), Rx.Scheduler.timeout);
* @param {Mixed} exception An object used for the sequence's termination.
* @param {Scheduler} scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} The observable sequence that terminates exceptionally with the specified exception object.
*/
var observableThrow = Observable['throw'] = Observable.throwException = function (exception, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onError(exception);
});
});
};
function observableCatchHandler(source, handler) {
return new AnonymousObservable(function (observer) {
var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable();
subscription.setDisposable(d1);
d1.setDisposable(source.subscribe(observer.onNext.bind(observer), function (exception) {
var d, result;
try {
result = handler(exception);
} catch (ex) {
observer.onError(ex);
return;
}
isPromise(result) && (result = observableFromPromise(result));
d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(result.subscribe(observer));
}, observer.onCompleted.bind(observer)));
return subscription;
});
}
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
* @example
* 1 - xs.catchException(ys)
* 2 - xs.catchException(function (ex) { return ys(ex); })
* @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence.
* @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred.
*/
observableProto['catch'] = observableProto.catchException = function (handlerOrSecond) {
return typeof handlerOrSecond === 'function' ?
observableCatchHandler(this, handlerOrSecond) :
observableCatch([this, handlerOrSecond]);
};
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
*
* @example
* 1 - res = Rx.Observable.catchException(xs, ys, zs);
* 2 - res = Rx.Observable.catchException([xs, ys, zs]);
* @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.
*/
var observableCatch = Observable.catchException = Observable['catch'] = function () {
var items = argsOrArray(arguments, 0);
return enumerableFor(items).catchException();
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
* This can be in the form of an argument list of observables or an array.
*
* @example
* 1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.combineLatest = function () {
var args = slice.call(arguments);
if (Array.isArray(args[0])) {
args[0].unshift(this);
} else {
args.unshift(this);
}
return combineLatest.apply(this, args);
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
*
* @example
* 1 - obs = Rx.Observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
var combineLatest = Observable.combineLatest = function () {
var args = slice.call(arguments), resultSelector = args.pop();
if (Array.isArray(args[0])) {
args = args[0];
}
return new AnonymousObservable(function (observer) {
var falseFactory = function () { return false; },
n = args.length,
hasValue = arrayInitialize(n, falseFactory),
hasValueAll = false,
isDone = arrayInitialize(n, falseFactory),
values = new Array(n);
function next(i) {
var res;
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
try {
res = resultSelector.apply(null, values);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
}
}
function done (i) {
isDone[i] = true;
if (isDone.every(identity)) {
observer.onCompleted();
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = args[i], sad = new SingleAssignmentDisposable();
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(function (x) {
values[i] = x;
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
subscriptions[i] = sad;
}(idx));
}
return new CompositeDisposable(subscriptions);
});
};
/**
* Concatenates all the observable sequences. This takes in either an array or variable arguments to concatenate.
*
* @example
* 1 - concatenated = xs.concat(ys, zs);
* 2 - concatenated = xs.concat([ys, zs]);
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
observableProto.concat = function () {
var items = slice.call(arguments, 0);
items.unshift(this);
return observableConcat.apply(this, items);
};
/**
* Concatenates all the observable sequences.
*
* @example
* 1 - res = Rx.Observable.concat(xs, ys, zs);
* 2 - res = Rx.Observable.concat([xs, ys, zs]);
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
var observableConcat = Observable.concat = function () {
var sources = argsOrArray(arguments, 0);
return enumerableFor(sources).concat();
};
/**
* Concatenates an observable sequence of observable sequences.
* @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order.
*/
observableProto.concatObservable = observableProto.concatAll =function () {
return this.merge(1);
};
/**
* Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences.
* Or merges two observable sequences into a single observable sequence.
*
* @example
* 1 - merged = sources.merge(1);
* 2 - merged = source.merge(otherSource);
* @param {Mixed} [maxConcurrentOrOther] Maximum number of inner observable sequences being subscribed to concurrently or the second observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.merge = function (maxConcurrentOrOther) {
if (typeof maxConcurrentOrOther !== 'number') {
return observableMerge(this, maxConcurrentOrOther);
}
var sources = this;
return new AnonymousObservable(function (observer) {
var activeCount = 0,
group = new CompositeDisposable(),
isStopped = false,
q = [],
subscribe = function (xs) {
var subscription = new SingleAssignmentDisposable();
group.add(subscription);
// Check for promises support
if (isPromise(xs)) { xs = observableFromPromise(xs); }
subscription.setDisposable(xs.subscribe(observer.onNext.bind(observer), observer.onError.bind(observer), function () {
var s;
group.remove(subscription);
if (q.length > 0) {
s = q.shift();
subscribe(s);
} else {
activeCount--;
if (isStopped && activeCount === 0) {
observer.onCompleted();
}
}
}));
};
group.add(sources.subscribe(function (innerSource) {
if (activeCount < maxConcurrentOrOther) {
activeCount++;
subscribe(innerSource);
} else {
q.push(innerSource);
}
}, observer.onError.bind(observer), function () {
isStopped = true;
if (activeCount === 0) {
observer.onCompleted();
}
}));
return group;
});
};
/**
* Merges all the observable sequences into a single observable sequence.
* The scheduler is optional and if not specified, the immediate scheduler is used.
*
* @example
* 1 - merged = Rx.Observable.merge(xs, ys, zs);
* 2 - merged = Rx.Observable.merge([xs, ys, zs]);
* 3 - merged = Rx.Observable.merge(scheduler, xs, ys, zs);
* 4 - merged = Rx.Observable.merge(scheduler, [xs, ys, zs]);
* @returns {Observable} The observable sequence that merges the elements of the observable sequences.
*/
var observableMerge = Observable.merge = function () {
var scheduler, sources;
if (!arguments[0]) {
scheduler = immediateScheduler;
sources = slice.call(arguments, 1);
} else if (arguments[0].now) {
scheduler = arguments[0];
sources = slice.call(arguments, 1);
} else {
scheduler = immediateScheduler;
sources = slice.call(arguments, 0);
}
if (Array.isArray(sources[0])) {
sources = sources[0];
}
return observableFromArray(sources, scheduler).mergeObservable();
};
/**
* Merges an observable sequence of observable sequences into an observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.mergeObservable = observableProto.mergeAll =function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var group = new CompositeDisposable(),
isStopped = false,
m = new SingleAssignmentDisposable();
group.add(m);
m.setDisposable(sources.subscribe(function (innerSource) {
var innerSubscription = new SingleAssignmentDisposable();
group.add(innerSubscription);
// Check if Promise or Observable
if (isPromise(innerSource)) {
innerSource = observableFromPromise(innerSource);
}
innerSubscription.setDisposable(innerSource.subscribe(function (x) {
observer.onNext(x);
}, observer.onError.bind(observer), function () {
group.remove(innerSubscription);
if (isStopped && group.length === 1) { observer.onCompleted(); }
}));
}, observer.onError.bind(observer), function () {
isStopped = true;
if (group.length === 1) { observer.onCompleted(); }
}));
return group;
});
};
/**
* Returns the values from the source observable sequence only after the other observable sequence produces a value.
* @param {Observable | Promise} other The observable sequence or Promise that triggers propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.
*/
observableProto.skipUntil = function (other) {
var source = this;
return new AnonymousObservable(function (observer) {
var isOpen = false;
var disposables = new CompositeDisposable(source.subscribe(function (left) {
isOpen && observer.onNext(left);
}, observer.onError.bind(observer), function () {
isOpen && observer.onCompleted();
}));
isPromise(other) && (other = observableFromPromise(other));
var rightSubscription = new SingleAssignmentDisposable();
disposables.add(rightSubscription);
rightSubscription.setDisposable(other.subscribe(function () {
isOpen = true;
rightSubscription.dispose();
}, observer.onError.bind(observer), function () {
rightSubscription.dispose();
}));
return disposables;
});
};
/**
* Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
* @returns {Observable} The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
observableProto['switch'] = observableProto.switchLatest = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var hasLatest = false,
innerSubscription = new SerialDisposable(),
isStopped = false,
latest = 0,
subscription = sources.subscribe(function (innerSource) {
var d = new SingleAssignmentDisposable(), id = ++latest;
hasLatest = true;
innerSubscription.setDisposable(d);
// Check if Promise or Observable
if (isPromise(innerSource)) {
innerSource = observableFromPromise(innerSource);
}
d.setDisposable(innerSource.subscribe(function (x) {
if (latest === id) {
observer.onNext(x);
}
}, function (e) {
if (latest === id) {
observer.onError(e);
}
}, function () {
if (latest === id) {
hasLatest = false;
if (isStopped) {
observer.onCompleted();
}
}
}));
}, observer.onError.bind(observer), function () {
isStopped = true;
if (!hasLatest) {
observer.onCompleted();
}
});
return new CompositeDisposable(subscription, innerSubscription);
});
};
/**
* Returns the values from the source observable sequence until the other observable sequence produces a value.
* @param {Observable | Promise} other Observable sequence or Promise that terminates propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.
*/
observableProto.takeUntil = function (other) {
var source = this;
return new AnonymousObservable(function (observer) {
isPromise(other) && (other = observableFromPromise(other));
return new CompositeDisposable(
source.subscribe(observer),
other.subscribe(observer.onCompleted.bind(observer), observer.onError.bind(observer), noop)
);
});
};
function zipArray(second, resultSelector) {
var first = this;
return new AnonymousObservable(function (observer) {
var index = 0, len = second.length;
return first.subscribe(function (left) {
if (index < len) {
var right = second[index++], result;
try {
result = resultSelector(left, right);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
} else {
observer.onCompleted();
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
}
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.
* The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the sources.
*
* @example
* 1 - res = obs1.zip(obs2, fn);
* 1 - res = x1.zip([1,2,3], fn);
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.zip = function () {
if (Array.isArray(arguments[0])) {
return zipArray.apply(this, arguments);
}
var parent = this, sources = slice.call(arguments), resultSelector = sources.pop();
sources.unshift(parent);
return new AnonymousObservable(function (observer) {
var n = sources.length,
queues = arrayInitialize(n, function () { return []; }),
isDone = arrayInitialize(n, function () { return false; });
function next(i) {
var res, queuedValues;
if (queues.every(function (x) { return x.length > 0; })) {
try {
queuedValues = queues.map(function (x) { return x.shift(); });
res = resultSelector.apply(parent, queuedValues);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
}
};
function done(i) {
isDone[i] = true;
if (isDone.every(function (x) { return x; })) {
observer.onCompleted();
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = sources[i], sad = new SingleAssignmentDisposable();
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(function (x) {
queues[i].push(x);
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
subscriptions[i] = sad;
})(idx);
}
return new CompositeDisposable(subscriptions);
});
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
* @param arguments Observable sources.
* @param {Function} resultSelector Function to invoke for each series of elements at corresponding indexes in the sources.
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
Observable.zip = function () {
var args = slice.call(arguments, 0),
first = args.shift();
return first.zip.apply(first, args);
};
/**
* Merges the specified observable sequences into one observable sequence by emitting a list with the elements of the observable sequences at corresponding indexes.
* @param arguments Observable sources.
* @returns {Observable} An observable sequence containing lists of elements at corresponding indexes.
*/
Observable.zipArray = function () {
var sources = argsOrArray(arguments, 0);
return new AnonymousObservable(function (observer) {
var n = sources.length,
queues = arrayInitialize(n, function () { return []; }),
isDone = arrayInitialize(n, function () { return false; });
function next(i) {
if (queues.every(function (x) { return x.length > 0; })) {
var res = queues.map(function (x) { return x.shift(); });
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
return;
}
};
function done(i) {
isDone[i] = true;
if (isDone.every(identity)) {
observer.onCompleted();
return;
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
subscriptions[i] = new SingleAssignmentDisposable();
subscriptions[i].setDisposable(sources[i].subscribe(function (x) {
queues[i].push(x);
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
})(idx);
}
var compositeDisposable = new CompositeDisposable(subscriptions);
compositeDisposable.add(disposableCreate(function () {
for (var qIdx = 0, qLen = queues.length; qIdx < qLen; qIdx++) {
queues[qIdx] = [];
}
}));
return compositeDisposable;
});
};
/**
* Hides the identity of an observable sequence.
* @returns {Observable} An observable sequence that hides the identity of the source sequence.
*/
observableProto.asObservable = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(observer);
});
};
/**
* Dematerializes the explicit notification values of an observable sequence as implicit notifications.
* @returns {Observable} An observable sequence exhibiting the behavior corresponding to the source sequence's notification values.
*/
observableProto.dematerialize = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
return x.accept(observer);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.
*
* var obs = observable.distinctUntilChanged();
* var obs = observable.distinctUntilChanged(function (x) { return x.id; });
* var obs = observable.distinctUntilChanged(function (x) { return x.id; }, function (x, y) { return x === y; });
*
* @param {Function} [keySelector] A function to compute the comparison key for each element. If not provided, it projects the value.
* @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.
* @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
*/
observableProto.distinctUntilChanged = function (keySelector, comparer) {
var source = this;
keySelector || (keySelector = identity);
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (observer) {
var hasCurrentKey = false, currentKey;
return source.subscribe(function (value) {
var comparerEquals = false, key;
try {
key = keySelector(value);
} catch (exception) {
observer.onError(exception);
return;
}
if (hasCurrentKey) {
try {
comparerEquals = comparer(currentKey, key);
} catch (exception) {
observer.onError(exception);
return;
}
}
if (!hasCurrentKey || !comparerEquals) {
hasCurrentKey = true;
currentKey = key;
observer.onNext(value);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
*
* @example
* var res = observable.do(observer);
* var res = observable.do(onNext);
* var res = observable.do(onNext, onError);
* var res = observable.do(onNext, onError, onCompleted);
* @param {Function | Observer} observerOrOnNext Action to invoke for each element in the observable sequence or an observer.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto['do'] = observableProto.doAction = observableProto.tap = function (observerOrOnNext, onError, onCompleted) {
var source = this, onNextFunc;
if (typeof observerOrOnNext === 'function') {
onNextFunc = observerOrOnNext;
} else {
onNextFunc = observerOrOnNext.onNext.bind(observerOrOnNext);
onError = observerOrOnNext.onError.bind(observerOrOnNext);
onCompleted = observerOrOnNext.onCompleted.bind(observerOrOnNext);
}
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
try {
onNextFunc(x);
} catch (e) {
observer.onError(e);
}
observer.onNext(x);
}, function (err) {
if (!onError) {
observer.onError(err);
} else {
try {
onError(err);
} catch (e) {
observer.onError(e);
}
observer.onError(err);
}
}, function () {
if (!onCompleted) {
observer.onCompleted();
} else {
try {
onCompleted();
} catch (e) {
observer.onError(e);
}
observer.onCompleted();
}
});
});
};
/**
* Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.
*
* @example
* var res = observable.finallyAction(function () { console.log('sequence ended'; });
* @param {Function} finallyAction Action to invoke after the source observable sequence terminates.
* @returns {Observable} Source sequence with the action-invoking termination behavior applied.
*/
observableProto['finally'] = observableProto.finallyAction = function (action) {
var source = this;
return new AnonymousObservable(function (observer) {
var subscription;
try {
subscription = source.subscribe(observer);
} catch (e) {
action();
throw e;
}
return disposableCreate(function () {
try {
subscription.dispose();
} catch (e) {
throw e;
} finally {
action();
}
});
});
};
/**
* Ignores all elements in an observable sequence leaving only the termination messages.
* @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence.
*/
observableProto.ignoreElements = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(noop, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Materializes the implicit notifications of an observable sequence as explicit notification values.
* @returns {Observable} An observable sequence containing the materialized notification values from the source sequence.
*/
observableProto.materialize = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(function (value) {
observer.onNext(notificationCreateOnNext(value));
}, function (e) {
observer.onNext(notificationCreateOnError(e));
observer.onCompleted();
}, function () {
observer.onNext(notificationCreateOnCompleted());
observer.onCompleted();
});
});
};
/**
* Repeats the observable sequence a specified number of times. If the repeat count is not specified, the sequence repeats indefinitely.
*
* @example
* var res = repeated = source.repeat();
* var res = repeated = source.repeat(42);
* @param {Number} [repeatCount] Number of times to repeat the sequence. If not provided, repeats the sequence indefinitely.
* @returns {Observable} The observable sequence producing the elements of the given sequence repeatedly.
*/
observableProto.repeat = function (repeatCount) {
return enumerableRepeat(this, repeatCount).concat();
};
/**
* Repeats the source observable sequence the specified number of times or until it successfully terminates. If the retry count is not specified, it retries indefinitely.
* Note if you encounter an error and want it to retry once, then you must use .retry(2);
*
* @example
* var res = retried = retry.repeat();
* var res = retried = retry.repeat(2);
* @param {Number} [retryCount] Number of times to retry the sequence. If not provided, retry the sequence indefinitely.
* @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
*/
observableProto.retry = function (retryCount) {
return enumerableRepeat(this, retryCount).catchException();
};
/**
* Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value.
* For aggregation behavior with no intermediate results, see Observable.aggregate.
* @example
* var res = source.scan(function (acc, x) { return acc + x; });
* var res = source.scan(0, function (acc, x) { return acc + x; });
* @param {Mixed} [seed] The initial accumulator value.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @returns {Observable} An observable sequence containing the accumulated values.
*/
observableProto.scan = function () {
var hasSeed = false, seed, accumulator, source = this;
if (arguments.length === 2) {
hasSeed = true;
seed = arguments[0];
accumulator = arguments[1];
} else {
accumulator = arguments[0];
}
return new AnonymousObservable(function (observer) {
var hasAccumulation, accumulation, hasValue;
return source.subscribe (
function (x) {
try {
if (!hasValue) {
hasValue = true;
}
if (hasAccumulation) {
accumulation = accumulator(accumulation, x);
} else {
accumulation = hasSeed ? accumulator(seed, x) : x;
hasAccumulation = true;
}
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(accumulation);
},
observer.onError.bind(observer),
function () {
if (!hasValue && hasSeed) {
observer.onNext(seed);
}
observer.onCompleted();
}
);
});
};
/**
* Bypasses a specified number of elements at the end of an observable sequence.
* @description
* This operator accumulates a queue with a length enough to store the first `count` elements. As more elements are
* received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed.
* @param count Number of elements to bypass at the end of the source sequence.
* @returns {Observable} An observable sequence containing the source sequence elements except for the bypassed ones at the end.
*/
observableProto.skipLast = function (count) {
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
if (q.length > count) {
observer.onNext(q.shift());
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Prepends a sequence of values to an observable sequence with an optional scheduler and an argument list of values to prepend.
*
* var res = source.startWith(1, 2, 3);
* var res = source.startWith(Rx.Scheduler.timeout, 1, 2, 3);
*
* @memberOf Observable#
* @returns {Observable} The source sequence prepended with the specified values.
*/
observableProto.startWith = function () {
var values, scheduler, start = 0;
if (!!arguments.length && 'now' in Object(arguments[0])) {
scheduler = arguments[0];
start = 1;
} else {
scheduler = immediateScheduler;
}
values = slice.call(arguments, start);
return enumerableFor([observableFromArray(values, scheduler), this]).concat();
};
/**
* Returns a specified number of contiguous elements from the end of an observable sequence.
*
* @example
* var res = source.takeLast(5);
*
* @description
* This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of
* the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.
* @param {Number} count Number of elements to take from the end of the source sequence.
* @returns {Observable} An observable sequence containing the specified number of elements from the end of the source sequence.
*/
observableProto.takeLast = function (count) {
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && q.shift();
}, observer.onError.bind(observer), function () {
while(q.length > 0) { observer.onNext(q.shift()); }
observer.onCompleted();
});
});
};
function concatMap(source, selector, thisArg) {
return source.map(function (x, i) {
var result = selector.call(thisArg, x, i);
return isPromise(result) ? observableFromPromise(result) : result;
}).concatAll();
}
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.concatMap(Rx.Observable.fromArray([1,2,3]));
* @param selector A transform function to apply to each element or an observable sequence to project each element from the
* source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
observableProto.selectConcat = observableProto.concatMap = function (selector, resultSelector, thisArg) {
if (resultSelector) {
return this.concatMap(function (x, i) {
var selectorResult = selector(x, i),
result = isPromise(selectorResult) ? observableFromPromise(selectorResult) : selectorResult;
return result.map(function (y) {
return resultSelector(x, y, i);
});
});
}
return typeof selector === 'function' ?
concatMap(this, selector, thisArg) :
concatMap(this, function () { return selector; });
};
/**
* Projects each element of an observable sequence into a new form by incorporating the element's index.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source.
*/
observableProto.select = observableProto.map = function (selector, thisArg) {
var parent = this;
return new AnonymousObservable(function (observer) {
var count = 0;
return parent.subscribe(function (value) {
var result;
try {
result = selector.call(thisArg, value, count++, parent);
} catch (exception) {
observer.onError(exception);
return;
}
observer.onNext(result);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Retrieves the value of a specified property from all elements in the Observable sequence.
* @param {String} property The property to pluck.
* @returns {Observable} Returns a new Observable sequence of property values.
*/
observableProto.pluck = function (property) {
return this.select(function (x) { return x[property]; });
};
function flatMap(source, selector, thisArg) {
return source.map(function (x, i) {
var result = selector.call(thisArg, x, i);
return isPromise(result) ? observableFromPromise(result) : result;
}).mergeObservable();
}
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.selectMany(Rx.Observable.fromArray([1,2,3]));
* @param selector A transform function to apply to each element or an observable sequence to project each element from the
* source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
observableProto.selectMany = observableProto.flatMap = function (selector, resultSelector, thisArg) {
if (resultSelector) {
return this.flatMap(function (x, i) {
var selectorResult = selector(x, i),
result = isPromise(selectorResult) ? observableFromPromise(selectorResult) : selectorResult;
return result.map(function (y) {
return resultSelector(x, y, i);
});
}, thisArg);
}
return typeof selector === 'function' ?
flatMap(this, selector, thisArg) :
flatMap(this, function () { return selector; });
};
/**
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
* transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
* and that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
observableProto.selectSwitch = observableProto.flatMapLatest = observableProto.switchMap = function (selector, thisArg) {
return this.select(selector, thisArg).switchLatest();
};
/**
* Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.
* @param {Number} count The number of elements to skip before returning the remaining elements.
* @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence.
*/
observableProto.skip = function (count) {
if (count < 0) {
throw new Error(argumentOutOfRange);
}
var observable = this;
return new AnonymousObservable(function (observer) {
var remaining = count;
return observable.subscribe(function (x) {
if (remaining <= 0) {
observer.onNext(x);
} else {
remaining--;
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
* The element's index is used in the logic of the predicate function.
*
* var res = source.skipWhile(function (value) { return value < 10; });
* var res = source.skipWhile(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.
*/
observableProto.skipWhile = function (predicate, thisArg) {
var source = this;
return new AnonymousObservable(function (observer) {
var i = 0, running = false;
return source.subscribe(function (x) {
if (!running) {
try {
running = !predicate.call(thisArg, x, i++, source);
} catch (e) {
observer.onError(e);
return;
}
}
if (running) {
observer.onNext(x);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of take(0).
*
* var res = source.take(5);
* var res = source.take(0, Rx.Scheduler.timeout);
* @param {Number} count The number of elements to return.
* @param {Scheduler} [scheduler] Scheduler used to produce an OnCompleted message in case <paramref name="count count</paramref> is set to 0.
* @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence.
*/
observableProto.take = function (count, scheduler) {
if (count < 0) {
throw new Error(argumentOutOfRange);
}
if (count === 0) {
return observableEmpty(scheduler);
}
var observable = this;
return new AnonymousObservable(function (observer) {
var remaining = count;
return observable.subscribe(function (x) {
if (remaining > 0) {
remaining--;
observer.onNext(x);
if (remaining === 0) {
observer.onCompleted();
}
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns elements from an observable sequence as long as a specified condition is true.
* The element's index is used in the logic of the predicate function.
*
* @example
* var res = source.takeWhile(function (value) { return value < 10; });
* var res = source.takeWhile(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
*/
observableProto.takeWhile = function (predicate, thisArg) {
var observable = this;
return new AnonymousObservable(function (observer) {
var i = 0, running = true;
return observable.subscribe(function (x) {
if (running) {
try {
running = predicate.call(thisArg, x, i++, observable);
} catch (e) {
observer.onError(e);
return;
}
if (running) {
observer.onNext(x);
} else {
observer.onCompleted();
}
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Filters the elements of an observable sequence based on a predicate by incorporating the element's index.
*
* @example
* var res = source.where(function (value) { return value < 10; });
* var res = source.where(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains elements from the input sequence that satisfy the condition.
*/
observableProto.where = observableProto.filter = function (predicate, thisArg) {
var parent = this;
return new AnonymousObservable(function (observer) {
var count = 0;
return parent.subscribe(function (value) {
var shouldRun;
try {
shouldRun = predicate.call(thisArg, value, count++, parent);
} catch (exception) {
observer.onError(exception);
return;
}
if (shouldRun) {
observer.onNext(value);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* 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 args = slice.call(arguments, 0);
return new AnonymousObservable(function (observer) {
function handler(e) {
var results = e;
if (selector) {
try {
results = selector(arguments);
} catch (err) {
observer.onError(err);
return;
}
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);
});
};
};
/**
* 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 args = slice.call(arguments, 0);
return new AnonymousObservable(function (observer) {
function handler(err) {
if (err) {
observer.onError(err);
return;
}
var results = slice.call(arguments, 1);
if (selector) {
try {
results = selector(results);
} catch (e) {
observer.onError(e);
return;
}
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);
});
};
};
function fixEvent(event) {
var stopPropagation = function () {
this.cancelBubble = true;
};
var preventDefault = function () {
this.bubbledKeyCode = this.keyCode;
if (this.ctrlKey) {
try {
this.keyCode = 0;
} catch (e) { }
}
this.defaultPrevented = true;
this.returnValue = false;
this.modified = true;
};
event || (event = root.event);
if (!event.target) {
event.target = event.target || event.srcElement;
if (event.type == 'mouseover') {
event.relatedTarget = event.fromElement;
}
if (event.type == 'mouseout') {
event.relatedTarget = event.toElement;
}
// Adding stopPropogation and preventDefault to IE
if (!event.stopPropagation){
event.stopPropagation = stopPropagation;
event.preventDefault = preventDefault;
}
// Normalize key events
switch(event.type){
case 'keypress':
var c = ('charCode' in event ? event.charCode : event.keyCode);
if (c == 10) {
c = 0;
event.keyCode = 13;
} else if (c == 13 || c == 27) {
c = 0;
} else if (c == 3) {
c = 99;
}
event.charCode = c;
event.keyChar = event.charCode ? String.fromCharCode(event.charCode) : '';
break;
}
}
return event;
}
function createListener (element, name, handler) {
// Standards compliant
if (element.addEventListener) {
element.addEventListener(name, handler, false);
return disposableCreate(function () {
element.removeEventListener(name, handler, false);
});
}
if (element.attachEvent) {
// IE Specific
var innerHandler = function (event) {
handler(fixEvent(event));
};
element.attachEvent('on' + name, innerHandler);
return disposableCreate(function () {
element.detachEvent('on' + name, innerHandler);
});
}
// Level 1 DOM Events
element['on' + name] = handler;
return disposableCreate(function () {
element['on' + name] = null;
});
}
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;
// Check for Angular/jQuery/Zepto support
var jq =
!!root.angular && !!angular.element ? angular.element :
(!!root.jQuery ? root.jQuery : (
!!root.Zepto ? root.Zepto : null));
// Check for ember
var ember = !!root.Ember && typeof root.Ember.addListener === 'function';
// Check for Backbone.Marionette. Note if using AMD add Marionette as a dependency of rxjs
// for proper loading order!
var marionette = !!root.Backbone && !!root.Backbone.Marionette;
/**
* 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) {
if (marionette) {
return fromEventPattern(
function (h) { element.on(eventName, h); },
function (h) { element.off(eventName, h); },
selector);
}
if (ember) {
return fromEventPattern(
function (h) { Ember.addListener(element, eventName, h); },
function (h) { Ember.removeListener(element, eventName, h); },
selector);
}
if (jq) {
var $elem = jq(element);
return fromEventPattern(
function (h) { $elem.on(eventName, h); },
function (h) { $elem.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) {
observer.onError(err);
return
}
}
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) {
observer.onError(err);
return;
}
}
observer.onNext(result);
}
var returnValue = addHandler(innerHandler);
return disposableCreate(function () {
if (removeHandler) {
removeHandler(innerHandler, returnValue);
}
});
}).publish().refCount();
};
/**
* Converts a Promise to an Observable sequence
* @param {Promise} An ES6 Compliant promise.
* @returns {Observable} An Observable sequence which wraps the existing promise success and failure.
*/
var observableFromPromise = Observable.fromPromise = function (promise) {
return new AnonymousObservable(function (observer) {
promise.then(
function (value) {
observer.onNext(value);
observer.onCompleted();
},
function (reason) {
observer.onError(reason);
});
return function () {
if (promise && promise.abort) {
promise.abort();
}
}
});
};
/*
* Converts an existing observable sequence to an ES6 Compatible Promise
* @example
* var promise = Rx.Observable.return(42).toPromise(RSVP.Promise);
*
* // With config
* Rx.config.Promise = RSVP.Promise;
* var promise = Rx.Observable.return(42).toPromise();
* @param {Function} [promiseCtor] The constructor of the promise. If not provided, it looks for it in Rx.config.Promise.
* @returns {Promise} An ES6 compatible promise with the last value from the observable sequence.
*/
observableProto.toPromise = function (promiseCtor) {
promiseCtor || (promiseCtor = Rx.config.Promise);
if (!promiseCtor) {
throw new Error('Promise type not provided nor in Rx.config.Promise');
}
var source = this;
return new promiseCtor(function (resolve, reject) {
// No cancellation can be done
var value, hasValue = false;
source.subscribe(function (v) {
value = v;
hasValue = true;
}, function (err) {
reject(err);
}, function () {
if (hasValue) {
resolve(value);
}
});
});
};
/**
* 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);
}
/**
* 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());
}) :
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 ?
this.multicast(new Subject()) :
this.multicast(function () {
return new Subject();
}, selector);
};
/**
* 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.
*
* @example
* var res = source.share();
*
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.share = function () {
return this.publish(null).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 ?
this.multicast(new AsyncSubject()) :
this.multicast(function () {
return new AsyncSubject();
}, selector);
};
/**
* 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.
*
* @example
* var res = source.shareValue(42);
*
* @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 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 within a selector function.
*/
observableProto.replay = function (selector, bufferSize, window, scheduler) {
return !selector ?
this.multicast(new ReplaySubject(bufferSize, window, scheduler)) :
this.multicast(function () {
return new ReplaySubject(bufferSize, window, scheduler);
}, selector);
};
/**
* 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, window, scheduler) {
return this.replay(null, bufferSize, window, scheduler).refCount();
};
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, subject.subscribe.bind(subject));
}
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));
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 count = 0, d = dueTime, p = normalizeTime(period);
return scheduler.scheduleRecursiveWithAbsolute(d, function (self) {
if (p > 0) {
var now = scheduler.now();
d = d + p;
d <= now && (d = now + p);
}
observer.onNext(count++);
self(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.
*
* @example
* 1 - res = Rx.Observable.timer(new Date());
* 2 - res = Rx.Observable.timer(new Date(), 1000);
* 3 - res = Rx.Observable.timer(new Date(), Rx.Scheduler.timeout);
* 4 - res = Rx.Observable.timer(new Date(), 1000, Rx.Scheduler.timeout);
*
* 5 - res = Rx.Observable.timer(5000);
* 6 - res = Rx.Observable.timer(5000, 1000);
* 7 - res = Rx.Observable.timer(5000, Rx.Scheduler.timeout);
* 8 - res = Rx.Observable.timer(5000, 1000, Rx.Scheduler.timeout);
*
* @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 (periodOrScheduler !== undefined && typeof periodOrScheduler === 'object') {
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);
});
}
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.
*
* @example
* 1 - res = source.throttle(5000); // 5 seconds
* 2 - res = source.throttle(5000, scheduler);
*
* @param {Number} dueTime Duration of the throttle period for each value (specified as an integer denoting milliseconds).
* @param {Scheduler} [scheduler] Scheduler to run the throttle timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} The throttled sequence.
*/
observableProto.throttle = function (dueTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return this.throttleWithSelector(function () { return observableTimer(dueTime, scheduler); })
};
/**
* 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.timeout);
*
* @param {Scheduler} [scheduler] Scheduler used to compute timestamps. If not specified, the timeout 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)
);
});
}
/**
* 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 = 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.
*
* @example
* 1 - res = source.timeout(new Date()); // As a date
* 2 - res = source.timeout(5000); // 5 seconds
* 3 - res = source.timeout(new Date(), Rx.Observable.returnValue(42)); // As a date and timeout observable
* 4 - res = source.timeout(5000, Rx.Observable.returnValue(42)); // 5 seconds and timeout observable
* 5 - res = source.timeout(new Date(), Rx.Observable.returnValue(42), Rx.Scheduler.timeout); // As a date and timeout observable
* 6 - res = source.timeout(5000, Rx.Observable.returnValue(42), Rx.Scheduler.timeout); // 5 seconds and timeout observable
*
* @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 || (other = observableThrow(new Error('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);
var createTimer = function () {
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);
});
};
/**
* Time shifts the observable sequence by delaying the subscription.
*
* @example
* 1 - res = source.delaySubscription(5000); // 5s
* 2 - res = source.delaySubscription(5000, Rx.Scheduler.timeout); // 5 seconds
*
* @param {Number} dueTime Absolute or relative time to perform the subscription at.
* @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) {
return this.delayWithSelector(observableTimer(dueTime, isScheduler(scheduler) ? scheduler : timeoutScheduler), observableEmpty);
};
/**
* 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 (typeof subscriptionDelay === 'function') {
selector = subscriptionDelay;
} else {
subDelay = subscriptionDelay;
selector = delayDurationSelector;
}
return new AnonymousObservable(function (observer) {
var delays = new CompositeDisposable(), atEnd = false, done = function () {
if (atEnd && delays.length === 0) {
observer.onCompleted();
}
}, subscription = new SerialDisposable(), start = function () {
subscription.setDisposable(source.subscribe(function (x) {
var delay;
try {
delay = selector(x);
} catch (error) {
observer.onError(error);
return;
}
var d = new SingleAssignmentDisposable();
delays.add(d);
d.setDisposable(delay.subscribe(function () {
observer.onNext(x);
delays.remove(d);
done();
}, observer.onError.bind(observer), function () {
observer.onNext(x);
delays.remove(d);
done();
}));
}, observer.onError.bind(observer), function () {
atEnd = true;
subscription.dispose();
done();
}));
};
if (!subDelay) {
start();
} else {
subscription.setDisposable(subDelay.subscribe(function () {
start();
}, observer.onError.bind(observer), function () { start(); }));
}
return new CompositeDisposable(subscription, delays);
});
};
/**
* Returns the source observable sequence, switching to the other observable sequence if a timeout is signaled.
*
* @example
* 1 - res = source.timeoutWithSelector(Rx.Observable.timer(500));
* 2 - res = source.timeoutWithSelector(Rx.Observable.timer(500), function (x) { return Rx.Observable.timer(200); });
* 3 - res = source.timeoutWithSelector(Rx.Observable.timer(500), function (x) { return Rx.Observable.timer(200); }, Rx.Observable.returnValue(42));
*
* @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;
var 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, setTimer = function (timeout) {
var myId = id, timerWins = function () {
return id === myId;
};
var d = new SingleAssignmentDisposable();
timer.setDisposable(d);
d.setDisposable(timeout.subscribe(function () {
if (timerWins()) {
subscription.setDisposable(other.subscribe(observer));
}
d.dispose();
}, function (e) {
if (timerWins()) {
observer.onError(e);
}
}, function () {
if (timerWins()) {
subscription.setDisposable(other.subscribe(observer));
}
}));
};
setTimer(firstTimeout);
var observerWins = function () {
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(timeout);
}
}, function (e) {
if (observerWins()) {
observer.onError(e);
}
}, function () {
if (observerWins()) {
observer.onCompleted();
}
}));
return new CompositeDisposable(subscription, timer);
});
};
/**
* Ignores values from an observable sequence which are followed by another value within a computed throttle duration.
*
* @example
* 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(x + x); });
*
* @param {Function} throttleDurationSelector Selector function to retrieve a sequence indicating the throttle duration for each given element.
* @returns {Observable} The throttled sequence.
*/
observableProto.throttleWithSelector = function (throttleDurationSelector) {
var source = this;
return new AnonymousObservable(function (observer) {
var value, hasValue = false, cancelable = new SerialDisposable(), id = 0, subscription = source.subscribe(function (x) {
var throttle;
try {
throttle = throttleDurationSelector(x);
} catch (e) {
observer.onError(e);
return;
}
hasValue = true;
value = x;
id++;
var currentid = id, d = new SingleAssignmentDisposable();
cancelable.setDisposable(d);
d.setDisposable(throttle.subscribe(function () {
if (hasValue && id === currentid) {
observer.onNext(value);
}
hasValue = false;
d.dispose();
}, observer.onError.bind(observer), function () {
if (hasValue && id === currentid) {
observer.onNext(value);
}
hasValue = false;
d.dispose();
}));
}, function (e) {
cancelable.dispose();
observer.onError(e);
hasValue = false;
id++;
}, function () {
cancelable.dispose();
if (hasValue) {
observer.onNext(value);
}
observer.onCompleted();
hasValue = false;
id++;
});
return new CompositeDisposable(subscription, cancelable);
});
};
/**
* 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 (observer) {
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) {
observer.onNext(q.shift().value);
}
}, observer.onError.bind(observer), function () {
var now = scheduler.now();
while (q.length > 0 && now - q[0].interval >= duration) {
observer.onNext(q.shift().value);
}
observer.onCompleted();
});
});
};
/**
* 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.
*
* @example
* 1 - res = source.takeLastWithTime(5000, [optional timer scheduler], [optional loop 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 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 (observer) {
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();
}
}, observer.onError.bind(observer), function () {
var now = scheduler.now();
while (q.length > 0) {
var next = q.shift();
if (now - next.interval <= duration) {
observer.onNext(next.value);
}
}
observer.onCompleted();
});
});
};
/**
* 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 (observer) {
return new CompositeDisposable(scheduler.scheduleWithRelative(duration, observer.onCompleted.bind(observer)), source.subscribe(observer));
});
};
/**
* 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)));
});
};
var PausableObservable = (function (_super) {
inherits(PausableObservable, _super);
function subscribe(observer) {
var conn = this.source.publish(),
subscription = conn.subscribe(observer),
connection = disposableEmpty;
var pausable = this.subject.distinctUntilChanged().subscribe(function (b) {
if (b) {
connection = conn.connect();
} else {
connection.dispose();
connection = disposableEmpty;
}
});
return new CompositeDisposable(subscription, connection, pausable);
}
function PausableObservable(source, subject) {
this.source = source;
this.subject = subject || new Subject();
this.isPaused = true;
_super.call(this, subscribe);
}
PausableObservable.prototype.pause = function () {
if (this.isPaused === true){
return;
}
this.isPaused = true;
this.subject.onNext(false);
};
PausableObservable.prototype.resume = function () {
if (this.isPaused === false){
return;
}
this.isPaused = false;
this.subject.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 (observer) {
var n = 2,
hasValue = [false, false],
hasValueAll = false,
isDone = false,
values = new Array(n);
function next(x, i) {
values[i] = x
var res;
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
try {
res = resultSelector.apply(null, values);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone) {
observer.onCompleted();
}
}
return new CompositeDisposable(
source.subscribe(
function (x) {
next(x, 0);
},
observer.onError.bind(observer),
function () {
isDone = true;
observer.onCompleted();
}),
subject.subscribe(
function (x) {
next(x, 1);
},
observer.onError.bind(observer))
);
});
}
var PausableBufferedObservable = (function (_super) {
inherits(PausableBufferedObservable, _super);
function subscribe(observer) {
var q = [], previousShouldFire;
var subscription =
combineLatestSource(
this.source,
this.subject.distinctUntilChanged(),
function (data, shouldFire) {
return { data: data, shouldFire: shouldFire };
})
.subscribe(
function (results) {
if (previousShouldFire !== undefined && results.shouldFire != previousShouldFire) {
// change in shouldFire
if (results.shouldFire) {
while (q.length > 0) {
observer.onNext(q.shift());
}
}
} else {
// new data
if (results.shouldFire) {
observer.onNext(results.data);
} else {
q.push(results.data);
}
}
previousShouldFire = results.shouldFire;
},
function (err) {
// Empty buffer before sending error
while (q.length > 0) {
observer.onNext(q.shift());
}
observer.onError(err);
},
function () {
// Empty buffer before sending completion
while (q.length > 0) {
observer.onNext(q.shift());
}
observer.onCompleted();
}
);
this.subject.onNext(false);
return subscription;
}
function PausableBufferedObservable(source, subject) {
this.source = source;
this.subject = subject || new Subject();
this.isPaused = true;
_super.call(this, subscribe);
}
PausableBufferedObservable.prototype.pause = function () {
if (this.isPaused === true){
return;
}
this.isPaused = true;
this.subject.onNext(false);
};
PausableBufferedObservable.prototype.resume = function () {
if (this.isPaused === false){
return;
}
this.isPaused = false;
this.subject.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);
};
/**
* 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 {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.controlled = function (enableQueue) {
if (enableQueue == null) { enableQueue = true; }
return new ControlledObservable(this, enableQueue);
};
var ControlledObservable = (function (_super) {
inherits(ControlledObservable, _super);
function subscribe (observer) {
return this.source.subscribe(observer);
}
function ControlledObservable (source, enableQueue) {
_super.call(this, subscribe);
this.subject = new ControlledSubject(enableQueue);
this.source = source.multicast(this.subject).refCount();
}
ControlledObservable.prototype.request = function (numberOfItems) {
if (numberOfItems == null) { numberOfItems = -1; }
return this.subject.request(numberOfItems);
};
return ControlledObservable;
}(Observable));
var ControlledSubject = Rx.ControlledSubject = (function (_super) {
function subscribe (observer) {
return this.subject.subscribe(observer);
}
inherits(ControlledSubject, _super);
function ControlledSubject(enableQueue) {
if (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.controlledDisposable = disposableEmpty;
}
addProperties(ControlledSubject.prototype, Observer, {
onCompleted: function () {
checkDisposed.call(this);
this.hasCompleted = true;
if (!this.enableQueue || this.queue.length === 0) {
this.subject.onCompleted();
}
},
onError: function (error) {
checkDisposed.call(this);
this.hasFailed = true;
this.error = error;
if (!this.enableQueue || this.queue.length === 0) {
this.subject.onError(error);
}
},
onNext: function (value) {
checkDisposed.call(this);
var hasRequested = false;
if (this.requestedCount === 0) {
if (this.enableQueue) {
this.queue.push(value);
}
} else {
if (this.requestedCount !== -1) {
if (this.requestedCount-- === 0) {
this.disposeCurrentRequest();
}
}
hasRequested = true;
}
if (hasRequested) {
this.subject.onNext(value);
}
},
_processRequest: function (numberOfItems) {
if (this.enableQueue) {
//console.log('queue length', this.queue.length);
while (this.queue.length >= numberOfItems && numberOfItems > 0) {
//console.log('number of items', numberOfItems);
this.subject.onNext(this.queue.shift());
numberOfItems--;
}
if (this.queue.length !== 0) {
return { numberOfItems: numberOfItems, returnValue: true };
} else {
return { numberOfItems: numberOfItems, returnValue: false };
}
}
if (this.hasFailed) {
this.subject.onError(this.error);
this.controlledDisposable.dispose();
this.controlledDisposable = disposableEmpty;
} else if (this.hasCompleted) {
this.subject.onCompleted();
this.controlledDisposable.dispose();
this.controlledDisposable = disposableEmpty;
}
return { numberOfItems: numberOfItems, returnValue: false };
},
request: function (number) {
checkDisposed.call(this);
this.disposeCurrentRequest();
var self = this,
r = this._processRequest(number);
number = r.numberOfItems;
if (!r.returnValue) {
this.requestedCount = number;
this.requestedDisposable = disposableCreate(function () {
self.requestedCount = 0;
});
return this.requestedDisposable
} else {
return disposableEmpty;
}
},
disposeCurrentRequest: function () {
this.requestedDisposable.dispose();
this.requestedDisposable = disposableEmpty;
},
dispose: function () {
this.isDisposed = true;
this.error = null;
this.subject.dispose();
this.requestedDisposable.dispose();
}
});
return ControlledSubject;
}(Observable));
/*
* Performs a exclusive waiting for the first to finish before subscribing to another observable.
* Observables that come in between subscriptions will be dropped on the floor.
* @returns {Observable} A exclusive observable with only the results that happen when subscribed.
*/
observableProto.exclusive = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var hasCurrent = false,
isStopped = false,
m = new SingleAssignmentDisposable(),
g = new CompositeDisposable();
g.add(m);
m.setDisposable(sources.subscribe(
function (innerSource) {
if (!hasCurrent) {
hasCurrent = true;
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
var innerSubscription = new SingleAssignmentDisposable();
g.add(innerSubscription);
innerSubscription.setDisposable(innerSource.subscribe(
observer.onNext.bind(observer),
observer.onError.bind(observer),
function () {
g.remove(innerSubscription);
hasCurrent = false;
if (isStopped && g.length === 1) {
observer.onCompleted();
}
}));
}
},
observer.onError.bind(observer),
function () {
isStopped = true;
if (!hasCurrent && g.length === 1) {
observer.onCompleted();
}
}));
return g;
});
};
/*
* Performs a exclusive map waiting for the first to finish before subscribing to another observable.
* Observables that come in between subscriptions will be dropped on the floor.
* @param {Function} selector Selector to invoke for every item in the current subscription.
* @param {Any} [thisArg] An optional context to invoke with the selector parameter.
* @returns {Observable} An exclusive observable with only the results that happen when subscribed.
*/
observableProto.exclusiveMap = function (selector, thisArg) {
var sources = this;
return new AnonymousObservable(function (observer) {
var index = 0,
hasCurrent = false,
isStopped = true,
m = new SingleAssignmentDisposable(),
g = new CompositeDisposable();
g.add(m);
m.setDisposable(sources.subscribe(
function (innerSource) {
if (!hasCurrent) {
hasCurrent = true;
innerSubscription = new SingleAssignmentDisposable();
g.add(innerSubscription);
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
innerSubscription.setDisposable(innerSource.subscribe(
function (x) {
var result;
try {
result = selector.call(thisArg, x, index++, innerSource);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
},
observer.onError.bind(observer),
function () {
g.remove(innerSubscription);
hasCurrent = false;
if (isStopped && g.length === 1) {
observer.onCompleted();
}
}));
}
},
observer.onError.bind(observer),
function () {
isStopped = true;
if (g.length === 1 && !hasCurrent) {
observer.onCompleted();
}
}));
return g;
});
};
var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) {
inherits(AnonymousObservable, __super__);
// Fix subscriber to check for undefined or function returned to decorate as Disposable
function fixSubscriber(subscriber) {
if (subscriber && typeof subscriber.dispose === 'function') { return subscriber; }
return typeof subscriber === 'function' ?
disposableCreate(subscriber) :
disposableEmpty;
}
function AnonymousObservable(subscribe) {
if (!(this instanceof AnonymousObservable)) {
return new AnonymousObservable(subscribe);
}
function s(observer) {
var setDisposable = function () {
try {
autoDetachObserver.setDisposable(fixSubscriber(subscribe(autoDetachObserver)));
} catch (e) {
if (!autoDetachObserver.fail(e)) {
throw e;
}
}
};
var autoDetachObserver = new AutoDetachObserver(observer);
if (currentThreadScheduler.scheduleRequired()) {
currentThreadScheduler.schedule(setDisposable);
} else {
setDisposable();
}
return autoDetachObserver;
}
__super__.call(this, s);
}
return AnonymousObservable;
}(Observable));
/** @private */
var AutoDetachObserver = (function (_super) {
inherits(AutoDetachObserver, _super);
function AutoDetachObserver(observer) {
_super.call(this);
this.observer = observer;
this.m = new SingleAssignmentDisposable();
}
var AutoDetachObserverPrototype = AutoDetachObserver.prototype;
AutoDetachObserverPrototype.next = function (value) {
var noError = false;
try {
this.observer.onNext(value);
noError = true;
} catch (e) {
throw e;
} finally {
if (!noError) {
this.dispose();
}
}
};
AutoDetachObserverPrototype.error = function (exn) {
try {
this.observer.onError(exn);
} catch (e) {
throw e;
} finally {
this.dispose();
}
};
AutoDetachObserverPrototype.completed = function () {
try {
this.observer.onCompleted();
} catch (e) {
throw e;
} finally {
this.dispose();
}
};
AutoDetachObserverPrototype.setDisposable = function (value) { this.m.setDisposable(value); };
AutoDetachObserverPrototype.getDisposable = function (value) { return this.m.getDisposable(); };
/* @private */
AutoDetachObserverPrototype.disposable = function (value) {
return arguments.length ? this.getDisposable() : setDisposable(value);
};
AutoDetachObserverPrototype.dispose = function () {
_super.prototype.dispose.call(this);
this.m.dispose();
};
return AutoDetachObserver;
}(AbstractObserver));
/** @private */
var InnerSubscription = function (subject, observer) {
this.subject = subject;
this.observer = observer;
};
/**
* @private
* @memberOf InnerSubscription
*/
InnerSubscription.prototype.dispose = function () {
if (!this.subject.isDisposed && this.observer !== null) {
var idx = this.subject.observers.indexOf(this.observer);
this.subject.observers.splice(idx, 1);
this.observer = null;
}
};
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed observers.
*/
var Subject = Rx.Subject = (function (_super) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
if (this.exception) {
observer.onError(this.exception);
return disposableEmpty;
}
observer.onCompleted();
return disposableEmpty;
}
inherits(Subject, _super);
/**
* Creates a subject.
* @constructor
*/
function Subject() {
_super.call(this, subscribe);
this.isDisposed = false,
this.isStopped = false,
this.observers = [];
}
addProperties(Subject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (exception) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
this.exception = exception;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onError(exception);
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
for (var i = 0, len = os.length; i < len; i++) {
os[i].onNext(value);
}
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
/**
* Creates a subject from the specified observer and observable.
* @param {Observer} observer The observer used to send messages to the subject.
* @param {Observable} observable The observable used to subscribe to messages sent from the subject.
* @returns {Subject} Subject implemented using the given observer and observable.
*/
Subject.create = function (observer, observable) {
return new AnonymousSubject(observer, observable);
};
return Subject;
}(Observable));
/**
* Represents the result of an asynchronous operation.
* The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers.
*/
var AsyncSubject = Rx.AsyncSubject = (function (_super) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
var ex = this.exception,
hv = this.hasValue,
v = this.value;
if (ex) {
observer.onError(ex);
} else if (hv) {
observer.onNext(v);
observer.onCompleted();
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(AsyncSubject, _super);
/**
* Creates a subject that can only receive one value and that value is cached for all future observations.
* @constructor
*/
function AsyncSubject() {
_super.call(this, subscribe);
this.isDisposed = false;
this.isStopped = false;
this.value = null;
this.hasValue = false;
this.observers = [];
this.exception = null;
}
addProperties(AsyncSubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
checkDisposed.call(this);
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence, also causing the last received value to be sent out (if any).
*/
onCompleted: function () {
var o, i, len;
checkDisposed.call(this);
if (!this.isStopped) {
this.isStopped = true;
var os = this.observers.slice(0),
v = this.value,
hv = this.hasValue;
if (hv) {
for (i = 0, len = os.length; i < len; i++) {
o = os[i];
o.onNext(v);
o.onCompleted();
}
} else {
for (i = 0, len = os.length; i < len; i++) {
os[i].onCompleted();
}
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (exception) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
this.exception = exception;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onError(exception);
}
this.observers = [];
}
},
/**
* Sends a value to the subject. The last value received before successful termination will be sent to all subscribed and future observers.
* @param {Mixed} value The value to store in the subject.
*/
onNext: function (value) {
checkDisposed.call(this);
if (!this.isStopped) {
this.value = value;
this.hasValue = true;
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
this.exception = null;
this.value = null;
}
});
return AsyncSubject;
}(Observable));
var AnonymousSubject = Rx.AnonymousSubject = (function (__super__) {
inherits(AnonymousSubject, __super__);
function AnonymousSubject(observer, observable) {
this.observer = observer;
this.observable = observable;
__super__.call(this, this.observable.subscribe.bind(this.observable));
}
addProperties(AnonymousSubject.prototype, Observer, {
onCompleted: function () {
this.observer.onCompleted();
},
onError: function (exception) {
this.observer.onError(exception);
},
onNext: function (value) {
this.observer.onNext(value);
}
});
return AnonymousSubject;
}(Observable));
/**
* 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.call(this);
if (!this.isStopped) {
this.observers.push(observer);
observer.onNext(this.value);
return new InnerSubscription(this, observer);
}
var ex = this.exception;
if (ex) {
observer.onError(ex);
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(BehaviorSubject, _super);
/**
* @constructor
* 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.exception = null;
}
addProperties(BehaviorSubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
this.exception = error;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onError(error);
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed.call(this);
if (!this.isStopped) {
this.value = value;
var os = this.observers.slice(0);
for (var i = 0, len = os.length; i < len; i++) {
os[i].onNext(value);
}
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
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) {
function RemovableDisposable (subject, observer) {
this.subject = subject;
this.observer = observer;
};
RemovableDisposable.prototype.dispose = function () {
this.observer.dispose();
if (!this.subject.isDisposed) {
var idx = this.subject.observers.indexOf(this.observer);
this.subject.observers.splice(idx, 1);
}
};
function subscribe(observer) {
var so = new ScheduledObserver(this.scheduler, observer),
subscription = new RemovableDisposable(this, so);
checkDisposed.call(this);
this._trim(this.scheduler.now());
this.observers.push(so);
var n = this.q.length;
for (var i = 0, len = this.q.length; i < len; i++) {
so.onNext(this.q[i].value);
}
if (this.hasError) {
n++;
so.onError(this.error);
} else if (this.isStopped) {
n++;
so.onCompleted();
}
so.ensureActive(n);
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 ? Number.MAX_VALUE : bufferSize;
this.windowSize = windowSize == null ? Number.MAX_VALUE : 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, {
/**
* 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;
},
/* @private */
_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) {
var observer;
checkDisposed.call(this);
if (!this.isStopped) {
var now = this.scheduler.now();
this.q.push({ interval: now, value: value });
this._trim(now);
var o = this.observers.slice(0);
for (var i = 0, len = o.length; i < len; i++) {
observer = o[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) {
var observer;
checkDisposed.call(this);
if (!this.isStopped) {
this.isStopped = true;
this.error = error;
this.hasError = true;
var now = this.scheduler.now();
this._trim(now);
var o = this.observers.slice(0);
for (var i = 0, len = o.length; i < len; i++) {
observer = o[i];
observer.onError(error);
observer.ensureActive();
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
var observer;
checkDisposed.call(this);
if (!this.isStopped) {
this.isStopped = true;
var now = this.scheduler.now();
this._trim(now);
var o = this.observers.slice(0);
for (var i = 0, len = o.length; i < len; i++) {
observer = o[i];
observer.onCompleted();
observer.ensureActive();
}
this.observers = [];
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
return ReplaySubject;
}(Observable));
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
root.Rx = Rx;
define(function() {
return Rx;
});
} else if (freeExports && freeModule) {
// in Node.js or RingoJS
if (moduleExports) {
(freeModule.exports = Rx).Rx = Rx;
} else {
freeExports.Rx = Rx;
}
} else {
// in a browser or Rhino
root.Rx = Rx;
}
}.call(this));
|
examples/transitions/app.js
|
hgezim/react-router
|
import React from 'react';
import { Router, Route, Link, History, Lifecycle } from 'react-router';
var App = React.createClass({
render() {
return (
<div>
<ul>
<li><Link to="/dashboard">Dashboard</Link></li>
<li><Link to="/form">Form</Link></li>
</ul>
{this.props.children}
</div>
);
}
});
var Home = React.createClass({
render() {
return <h1>Home</h1>;
}
});
var Dashboard = React.createClass({
render() {
return <h1>Dashboard</h1>;
}
});
var Form = React.createClass({
mixins: [ Lifecycle, History ],
getInitialState() {
return {
textValue: 'ohai'
};
},
routerWillLeave(nextLocation) {
if (this.state.textValue)
return 'You have unsaved information, are you sure you want to leave this page?';
},
handleChange(event) {
this.setState({
textValue: event.target.value
});
},
handleSubmit(event) {
event.preventDefault();
this.setState({
textValue: ''
}, () => {
this.history.pushState(null, '/');
});
},
render() {
return (
<div>
<form onSubmit={this.handleSubmit}>
<p>Click the dashboard link with text in the input.</p>
<input type="text" ref="userInput" value={this.state.textValue} onChange={this.handleChange} />
<button type="submit">Go</button>
</form>
</div>
);
}
});
React.render((
<Router>
<Route path="/" component={App}>
<Route path="dashboard" component={Dashboard} />
<Route path="form" component={Form} />
</Route>
</Router>
), document.getElementById('example'));
|
src/components/Header/Header.js
|
mywentu/react-blog
|
import React from 'react'
import './Header.scss'
import '../../static/iconfont/iconfont.css'
class Header extends React.Component {
render () {
return (
<header className='header'>
<a onClick={() => this.props.handleVisible()}
className='menu'><i className='iconfont icon-category' />
</a>
</header>
)
}
}
Header.propTypes = {
handleVisible: React.PropTypes.func.isRequired
}
export default Header
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.