diff --git a/docs/example.css b/docs/example.css index 8ee2181..9d66e8e 100644 --- a/docs/example.css +++ b/docs/example.css @@ -285,3 +285,11 @@ opacity: 0; } 100% { opacity: 0.7; } } + +.rv-treemap__leaf { + position: absolute; + overflow: hidden; } + +.rv-treemap { + position: relative; + font-size: 10px; } diff --git a/docs/example.js b/docs/example.js index fe833f1..9e4622c 100644 --- a/docs/example.js +++ b/docs/example.js @@ -37,6 +37,10 @@ var _LayerList = require('./reactors/LayerList/LayerList'); var _LayerList2 = _interopRequireDefault(_LayerList); +var _TreemapChart = require('./reactors/TreemapChart/TreemapChart'); + +var _TreemapChart2 = _interopRequireDefault(_TreemapChart); + var _ListGroups = require('./reactors/ListGroups/ListGroups'); var _ListGroups2 = _interopRequireDefault(_ListGroups); @@ -99,6 +103,11 @@ var App = function (_Mediator) { imageUrlPrefix: 'https://muxlab.github.io/map-effects-100/data/img/', sort: 'NO_' }; + var treemapChartLayerIndex = 6; + var treemapChartFields = { + name: 'SIKUCHOSON', + quantity: 'H27GOKEI' + }; this.setState({ listGroups: { @@ -108,6 +117,10 @@ var App = function (_Mediator) { showcase: { layer: this.state.webmap.layers[showcaseLayerIndex], layoutFields: showcaseLayoutFields + }, + treemapChart: { + layer: this.state.webmap.layers[treemapChartLayerIndex], + fields: treemapChartFields } }); } @@ -183,18 +196,23 @@ var App = function (_Mediator) { ), _react2.default.createElement( _reactBootstrap.MenuItem, - { eventKey: 2.3, href: '#layerlist' }, + { eventKey: 2.4, href: '#layerlist' }, 'LayerList' ), _react2.default.createElement( _reactBootstrap.MenuItem, - { eventKey: 2.3, href: '#listgroups' }, + { eventKey: 2.5, href: '#listgroups' }, 'ListGroups' ), _react2.default.createElement( _reactBootstrap.MenuItem, - { eventKey: 2.3, href: '#showcase' }, + { eventKey: 2.6, href: '#showcase' }, 'Showcase' + ), + _react2.default.createElement( + _reactBootstrap.MenuItem, + { eventKey: 2.7, href: '#treemapchart' }, + 'TreemapChart' ) ) ) @@ -403,6 +421,29 @@ var App = function (_Mediator) { onMouseoutThumbnail: this.highlightFeature }) ) + ), + _react2.default.createElement( + _reactBootstrap.Row, + null, + _react2.default.createElement( + _reactBootstrap.Col, + { xs: 12, md: 12 }, + _react2.default.createElement( + 'h3', + { id: 'treemapchart' }, + _react2.default.createElement( + 'code', + null, + '' + ) + ), + _react2.default.createElement(_TreemapChart2.default, { + layer: this.state.treemapChart.layer, + fields: this.state.treemapChart.fields, + height: 300, + width: 300 + }) + ) ) ) ); @@ -415,7 +456,7 @@ var App = function (_Mediator) { App.displayName = 'App'; exports.default = App; -},{"./Mediator":2,"./mapview/MapView":4,"./reactors/Bookmarks/Bookmarks":6,"./reactors/Geocoder/Geocoder":7,"./reactors/HomeButton/HomeButton":8,"./reactors/LayerList/LayerList":10,"./reactors/ListGroups/ListGroups":12,"./reactors/Showcase/Showcase":14,"react":585,"react-bootstrap":249}],2:[function(require,module,exports){ +},{"./Mediator":2,"./mapview/MapView":4,"./reactors/Bookmarks/Bookmarks":6,"./reactors/Geocoder/Geocoder":7,"./reactors/HomeButton/HomeButton":8,"./reactors/LayerList/LayerList":10,"./reactors/ListGroups/ListGroups":12,"./reactors/Showcase/Showcase":14,"./reactors/TreemapChart/TreemapChart":15,"react":562,"react-bootstrap":331}],2:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -499,6 +540,13 @@ var Mediator = function (_React$Component) { imageUrlPrefix: '', sort: '' } + }, + treemapChart: { + layer: {}, + fields: { + name: '', + quantity: '' + } } }; _this.highlight = null; @@ -641,7 +689,7 @@ Mediator.defaultProps = { Mediator.displayName = 'Mediator'; exports.default = Mediator; -},{"react":585}],3:[function(require,module,exports){ +},{"react":562}],3:[function(require,module,exports){ 'use strict'; var _react = require('react'); @@ -706,7 +754,7 @@ var el = _document2.default.createElement('div'); var render = (0, _reactUtils.isReactDOMSupported)() ? _reactDom2.default.render : _react2.default.render; _document2.default.body.appendChild(el); render(appContents, el); -},{"../lib/utils/react-utils":15,"./App":1,"global/document":18,"react":585,"react-dom":416}],4:[function(require,module,exports){ +},{"../lib/utils/react-utils":16,"./App":1,"global/document":209,"react":562,"react-dom":343}],4:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -788,7 +836,7 @@ MapView.defaultProps = { MapView.displayName = 'MapView'; exports.default = MapView; -},{"react":585}],5:[function(require,module,exports){ +},{"react":562}],5:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -872,7 +920,7 @@ Bookmark.propTypes = { Bookmark.displayName = 'Bookmark'; exports.default = Bookmark; -},{"react":585,"react-bootstrap":249}],6:[function(require,module,exports){ +},{"react":562,"react-bootstrap":331}],6:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -967,7 +1015,7 @@ Bookmarks.defaultProps = { Bookmarks.displayName = 'Bookmarks'; exports.default = Bookmarks; -},{"./Bookmark":5,"react":585,"react-bootstrap":249}],7:[function(require,module,exports){ +},{"./Bookmark":5,"react":562,"react-bootstrap":331}],7:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -1149,7 +1197,7 @@ Geocoder.defaultProps = { Geocoder.displayName = 'Geocoder'; exports.default = Geocoder; -},{"react":585,"react-bootstrap":249}],8:[function(require,module,exports){ +},{"react":562,"react-bootstrap":331}],8:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -1240,7 +1288,7 @@ HomeButton.defaultProps = { HomeButton.displayName = 'HomeButton'; exports.default = HomeButton; -},{"react":585,"react-bootstrap":249}],9:[function(require,module,exports){ +},{"react":562,"react-bootstrap":331}],9:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -1372,7 +1420,7 @@ LayerItem.propTypes = { LayerItem.displayName = 'LayerItem'; exports.default = LayerItem; -},{"rc-slider":24,"react":585,"react-bootstrap":249}],10:[function(require,module,exports){ +},{"rc-slider":229,"react":562,"react-bootstrap":331}],10:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -1493,7 +1541,7 @@ LayerList.defaultProps = { LayerList.displayName = 'LayerList'; exports.default = LayerList; -},{"./LayerItem":9,"rc-slider":24,"react":585,"react-bootstrap":249}],11:[function(require,module,exports){ +},{"./LayerItem":9,"rc-slider":229,"react":562,"react-bootstrap":331}],11:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -1614,7 +1662,7 @@ ListGroupItems.defaultProps = { ListGroupItems.displayName = 'ListGroupItems'; exports.default = ListGroupItems; -},{"react":585,"react-bootstrap":249}],12:[function(require,module,exports){ +},{"react":562,"react-bootstrap":331}],12:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -1816,7 +1864,7 @@ ListGroups.defaultProps = { ListGroups.displayName = 'ListGroups'; exports.default = ListGroups; -},{"./ListGroupItems":11,"react":585,"react-bootstrap":249,"react-bootstrap-switch":162}],13:[function(require,module,exports){ +},{"./ListGroupItems":11,"react":562,"react-bootstrap":331,"react-bootstrap-switch":244}],13:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -1938,7 +1986,7 @@ ItemThumbnail.propTypes = { ItemThumbnail.displayName = 'ItemThumbnail'; exports.default = ItemThumbnail; -},{"react":585,"react-bootstrap":249}],14:[function(require,module,exports){ +},{"react":562,"react-bootstrap":331}],14:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -2066,7 +2114,123 @@ Showcase.propTypes = { Showcase.displayName = 'Showcase'; exports.default = Showcase; -},{"./ItemThumbnail":13,"react":585,"react-bootstrap":249}],15:[function(require,module,exports){ +},{"./ItemThumbnail":13,"react":562,"react-bootstrap":331}],15:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _react = require('react'); + +var _react2 = _interopRequireDefault(_react); + +var _reactVis = require('react-vis'); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Copyright (c) 2016 Yusuke Nunokawa (https://ynunokawa.github.io) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +var TreemapChart = function (_React$Component) { + _inherits(TreemapChart, _React$Component); + + function TreemapChart(props) { + _classCallCheck(this, TreemapChart); + + return _possibleConstructorReturn(this, (TreemapChart.__proto__ || Object.getPrototypeOf(TreemapChart)).call(this, props)); + } + + _createClass(TreemapChart, [{ + key: 'render', + value: function render() { + var layer = this.props.layer; + var fields = this.props.fields; + var height = this.props.height; + var width = this.props.width; + + var features = []; + var lyr = null; + + if (layer.layer !== undefined) { + Object.keys(layer.layer._layers).map(function (k) { + if (layer.layer._layers[k]._cache !== undefined) { + lyr = layer.layer._layers[k]; + } + }); + if (lyr !== null) { + lyr.eachFeature(function (l) { + features.push(l.feature); + }); + } + features = features.sort(function (a, b) { + return b.properties[fields.quantity] - a.properties[fields.quantity]; + }); + } + console.log(features); + + var children = features.map(function (f, i) { + var ratio = f.properties[fields.quantity] / features[0].properties[fields.quantity]; + return { + title: f.properties[fields.name], + size: f.properties[fields.quantity] / 100, + color: (1 - ratio) * 10 + }; + }); + console.log(children); + + var data = { + title: fields.quantity, + opacity: 1, + children: children + }; + + return _react2.default.createElement(_reactVis.Treemap, { + title: layer.title, + width: width, + height: height, + data: data + }); + } + }]); + + return TreemapChart; +}(_react2.default.Component); + +TreemapChart.propTypes = { + layer: _react2.default.PropTypes.object, + fields: _react2.default.PropTypes.object, + width: _react2.default.PropTypes.number, + height: _react2.default.PropTypes.number +}; + +TreemapChart.displayName = 'TreemapChart'; + +exports.default = TreemapChart; +},{"react":562,"react-vis":418}],16:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -2111,11 +2275,11 @@ var minor = _React$version$split2[1]; var versionHigherThanThirteen = Number(minor) > 13 || Number(major) > 13; -/** - * Support React 0.13 and greater where refs are React components, not DOM - * nodes. - * @param {*} ref React's ref. - * @returns {Element} DOM element. +/** + * Support React 0.13 and greater where refs are React components, not DOM + * nodes. + * @param {*} ref React's ref. + * @returns {Element} DOM element. */ function getDOMNode(ref) { if (!isReactDOMSupported()) { @@ -2127,1420 +2291,1063 @@ function getDOMNode(ref) { function isReactDOMSupported() { return versionHigherThanThirteen; } -},{"react":585}],16:[function(require,module,exports){ - -},{}],17:[function(require,module,exports){ -// shim for using process in browser -var process = module.exports = {}; - -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. +},{"react":562}],17:[function(require,module,exports){ +/** + * @ignore + * base event object for custom and dom event. + * @author yiminghe@gmail.com + */ -var cachedSetTimeout; -var cachedClearTimeout; +"use strict"; -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); +Object.defineProperty(exports, "__esModule", { + value: true +}); +function returnFalse() { + return false; } -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - +function returnTrue() { + return true; } -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - - +function EventBaseObject() { + this.timeStamp = Date.now(); + this.target = undefined; + this.currentTarget = undefined; } -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} +EventBaseObject.prototype = { + isEventObject: 1, -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; + constructor: EventBaseObject, - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); -} + isDefaultPrevented: returnFalse, -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; + isPropagationStopped: returnFalse, -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; + isImmediatePropagationStopped: returnFalse, -function noop() {} + preventDefault: function preventDefault() { + this.isDefaultPrevented = returnTrue; + }, -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; + stopPropagation: function stopPropagation() { + this.isPropagationStopped = returnTrue; + }, -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; + stopImmediatePropagation: function stopImmediatePropagation() { + this.isImmediatePropagationStopped = returnTrue; + // fixed 1.2 + // call stopPropagation implicitly + this.stopPropagation(); + }, -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); + halt: function halt(immediate) { + if (immediate) { + this.stopImmediatePropagation(); + } else { + this.stopPropagation(); + } + this.preventDefault(); + } }; -process.umask = function() { return 0; }; +exports["default"] = EventBaseObject; +module.exports = exports["default"]; },{}],18:[function(require,module,exports){ -(function (global){ -var topLevel = typeof global !== 'undefined' ? global : - typeof window !== 'undefined' ? window : {} -var minDoc = require('min-document'); - -if (typeof document !== 'undefined') { - module.exports = document; -} else { - var doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4']; - - if (!doccy) { - doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc; - } - - module.exports = doccy; -} +/** + * @ignore + * event object for dom + * @author yiminghe@gmail.com + */ -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"min-document":16}],19:[function(require,module,exports){ 'use strict'; -Object.defineProperty(exports, "__esModule", { +Object.defineProperty(exports, '__esModule', { value: true }); -var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); - -var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - -var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn'); - -var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } -var _inherits2 = require('babel-runtime/helpers/inherits'); +var _EventBaseObject = require('./EventBaseObject'); -var _inherits3 = _interopRequireDefault(_inherits2); +var _EventBaseObject2 = _interopRequireDefault(_EventBaseObject); -var _react = require('react'); +var _objectAssign = require('object-assign'); -var _react2 = _interopRequireDefault(_react); +var _objectAssign2 = _interopRequireDefault(_objectAssign); -var _rcTooltip = require('rc-tooltip'); +var TRUE = true; +var FALSE = false; +var commonProps = ['altKey', 'bubbles', 'cancelable', 'ctrlKey', 'currentTarget', 'eventPhase', 'metaKey', 'shiftKey', 'target', 'timeStamp', 'view', 'type']; -var _rcTooltip2 = _interopRequireDefault(_rcTooltip); +function isNullOrUndefined(w) { + return w === null || w === undefined; +} -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +var eventNormalizers = [{ + reg: /^key/, + props: ['char', 'charCode', 'key', 'keyCode', 'which'], + fix: function fix(event, nativeEvent) { + if (isNullOrUndefined(event.which)) { + event.which = !isNullOrUndefined(nativeEvent.charCode) ? nativeEvent.charCode : nativeEvent.keyCode; + } -var Handle = function (_React$Component) { - (0, _inherits3["default"])(Handle, _React$Component); + // add metaKey to non-Mac browsers (use ctrl for PC 's and Meta for Macs) + if (event.metaKey === undefined) { + event.metaKey = event.ctrlKey; + } + } +}, { + reg: /^touch/, + props: ['touches', 'changedTouches', 'targetTouches'] +}, { + reg: /^hashchange$/, + props: ['newURL', 'oldURL'] +}, { + reg: /^gesturechange$/i, + props: ['rotation', 'scale'] +}, { + reg: /^(mousewheel|DOMMouseScroll)$/, + props: [], + fix: function fix(event, nativeEvent) { + var deltaX = undefined; + var deltaY = undefined; + var delta = undefined; + var wheelDelta = nativeEvent.wheelDelta; + var axis = nativeEvent.axis; + var wheelDeltaY = nativeEvent.wheelDeltaY; + var wheelDeltaX = nativeEvent.wheelDeltaX; + var detail = nativeEvent.detail; - function Handle(props) { - (0, _classCallCheck3["default"])(this, Handle); + // ie/webkit + if (wheelDelta) { + delta = wheelDelta / 120; + } - var _this = (0, _possibleConstructorReturn3["default"])(this, _React$Component.call(this, props)); + // gecko + if (detail) { + // press control e.detail == 1 else e.detail == 3 + delta = 0 - (detail % 3 === 0 ? detail / 3 : detail); + } - _this.state = { - isTooltipVisible: false - }; - return _this; - } + // Gecko + if (axis !== undefined) { + if (axis === event.HORIZONTAL_AXIS) { + deltaY = 0; + deltaX = 0 - delta; + } else if (axis === event.VERTICAL_AXIS) { + deltaX = 0; + deltaY = delta; + } + } - Handle.prototype.showTooltip = function showTooltip() { - this.setState({ - isTooltipVisible: true - }); - }; + // Webkit + if (wheelDeltaY !== undefined) { + deltaY = wheelDeltaY / 120; + } + if (wheelDeltaX !== undefined) { + deltaX = -1 * wheelDeltaX / 120; + } - Handle.prototype.hideTooltip = function hideTooltip() { - this.setState({ - isTooltipVisible: false - }); - }; + // 默认 deltaY (ie) + if (!deltaX && !deltaY) { + deltaY = delta; + } - Handle.prototype.render = function render() { - var _props = this.props; - var prefixCls = _props.prefixCls; - var tooltipPrefixCls = _props.tooltipPrefixCls; - var className = _props.className; - var tipTransitionName = _props.tipTransitionName; - var tipFormatter = _props.tipFormatter; - var vertical = _props.vertical; - var offset = _props.offset; - var value = _props.value; - var dragging = _props.dragging; - var noTip = _props.noTip; + if (deltaX !== undefined) { + /** + * deltaX of mousewheel event + * @property deltaX + * @member Event.DomEvent.Object + */ + event.deltaX = deltaX; + } + if (deltaY !== undefined) { + /** + * deltaY of mousewheel event + * @property deltaY + * @member Event.DomEvent.Object + */ + event.deltaY = deltaY; + } - var style = vertical ? { bottom: offset + '%' } : { left: offset + '%' }; - var handle = _react2["default"].createElement('div', { className: className, style: style, - onMouseUp: this.showTooltip.bind(this), - onMouseEnter: this.showTooltip.bind(this), - onMouseLeave: this.hideTooltip.bind(this) - }); + if (delta !== undefined) { + /** + * delta of mousewheel event + * @property delta + * @member Event.DomEvent.Object + */ + event.delta = delta; + } + } +}, { + reg: /^mouse|contextmenu|click|mspointer|(^DOMMouseScroll$)/i, + props: ['buttons', 'clientX', 'clientY', 'button', 'offsetX', 'relatedTarget', 'which', 'fromElement', 'toElement', 'offsetY', 'pageX', 'pageY', 'screenX', 'screenY'], + fix: function fix(event, nativeEvent) { + var eventDoc = undefined; + var doc = undefined; + var body = undefined; + var target = event.target; + var button = nativeEvent.button; - if (noTip) { - return handle; + // Calculate pageX/Y if missing and clientX/Y available + if (target && isNullOrUndefined(event.pageX) && !isNullOrUndefined(nativeEvent.clientX)) { + eventDoc = target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + event.pageX = nativeEvent.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); + event.pageY = nativeEvent.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); } - var isTooltipVisible = dragging || this.state.isTooltipVisible; - return _react2["default"].createElement( - _rcTooltip2["default"], - { - prefixCls: tooltipPrefixCls || prefixCls + '-tooltip', - placement: 'top', - visible: isTooltipVisible, - overlay: _react2["default"].createElement( - 'span', - null, - tipFormatter(value) - ), - delay: 0, - transitionName: tipTransitionName - }, - handle - ); - }; + // which for click: 1 === left; 2 === middle; 3 === right + // do not use button + if (!event.which && button !== undefined) { + if (button & 1) { + event.which = 1; + } else if (button & 2) { + event.which = 3; + } else if (button & 4) { + event.which = 2; + } else { + event.which = 0; + } + } - return Handle; -}(_react2["default"].Component); + // add relatedTarget, if necessary + if (!event.relatedTarget && event.fromElement) { + event.relatedTarget = event.fromElement === target ? event.toElement : event.fromElement; + } -exports["default"] = Handle; + return event; + } +}]; +function retTrue() { + return TRUE; +} -Handle.propTypes = { - prefixCls: _react2["default"].PropTypes.string, - tooltipPrefixCls: _react2["default"].PropTypes.string, - className: _react2["default"].PropTypes.string, - vertical: _react2["default"].PropTypes.bool, - offset: _react2["default"].PropTypes.number, - tipTransitionName: _react2["default"].PropTypes.string, - tipFormatter: _react2["default"].PropTypes.func, - value: _react2["default"].PropTypes.number, - dragging: _react2["default"].PropTypes.bool, - noTip: _react2["default"].PropTypes.bool -}; -module.exports = exports['default']; -},{"babel-runtime/helpers/classCallCheck":32,"babel-runtime/helpers/inherits":35,"babel-runtime/helpers/possibleConstructorReturn":37,"rc-tooltip":125,"react":585}],20:[function(require,module,exports){ -'use strict'; +function retFalse() { + return FALSE; +} -Object.defineProperty(exports, "__esModule", { - value: true -}); +function DomEventObject(nativeEvent) { + var type = nativeEvent.type; -var _extends2 = require('babel-runtime/helpers/extends'); + var isNative = typeof nativeEvent.stopPropagation === 'function' || typeof nativeEvent.cancelBubble === 'boolean'; -var _extends3 = _interopRequireDefault(_extends2); + _EventBaseObject2['default'].call(this); -var _typeof2 = require('babel-runtime/helpers/typeof'); + this.nativeEvent = nativeEvent; -var _typeof3 = _interopRequireDefault(_typeof2); + // in case dom event has been mark as default prevented by lower dom node + var isDefaultPrevented = retFalse; + if ('defaultPrevented' in nativeEvent) { + isDefaultPrevented = nativeEvent.defaultPrevented ? retTrue : retFalse; + } else if ('getPreventDefault' in nativeEvent) { + // https://bugzilla.mozilla.org/show_bug.cgi?id=691151 + isDefaultPrevented = nativeEvent.getPreventDefault() ? retTrue : retFalse; + } else if ('returnValue' in nativeEvent) { + isDefaultPrevented = nativeEvent.returnValue === FALSE ? retTrue : retFalse; + } -var _defineProperty2 = require('babel-runtime/helpers/defineProperty'); + this.isDefaultPrevented = isDefaultPrevented; -var _defineProperty3 = _interopRequireDefault(_defineProperty2); + var fixFns = []; + var fixFn = undefined; + var l = undefined; + var prop = undefined; + var props = commonProps.concat(); -var _react = require('react'); + eventNormalizers.forEach(function (normalizer) { + if (type.match(normalizer.reg)) { + props = props.concat(normalizer.props); + if (normalizer.fix) { + fixFns.push(normalizer.fix); + } + } + }); -var _react2 = _interopRequireDefault(_react); + l = props.length; -var _classnames = require('classnames'); + // clone properties of the original event object + while (l) { + prop = props[--l]; + this[prop] = nativeEvent[prop]; + } -var _classnames2 = _interopRequireDefault(_classnames); + // fix target property, if necessary + if (!this.target && isNative) { + this.target = nativeEvent.srcElement || document; // srcElement might not be defined either + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + // check if target is a text node (safari) + if (this.target && this.target.nodeType === 3) { + this.target = this.target.parentNode; + } -var Marks = function Marks(_ref) { - var className = _ref.className; - var vertical = _ref.vertical; - var marks = _ref.marks; - var included = _ref.included; - var upperBound = _ref.upperBound; - var lowerBound = _ref.lowerBound; - var max = _ref.max; - var min = _ref.min; + l = fixFns.length; - var marksKeys = Object.keys(marks); - var marksCount = marksKeys.length; - var unit = 100 / (marksCount - 1); - var markWidth = unit * 0.9; + while (l) { + fixFn = fixFns[--l]; + fixFn(this, nativeEvent); + } - var range = max - min; - var elements = marksKeys.map(parseFloat).sort(function (a, b) { - return a - b; - }).map(function (point) { - var _classNames; + this.timeStamp = nativeEvent.timeStamp || Date.now(); +} - var isActived = !included && point === upperBound || included && point <= upperBound && point >= lowerBound; - var markClassName = (0, _classnames2["default"])((_classNames = {}, (0, _defineProperty3["default"])(_classNames, className + '-text', true), (0, _defineProperty3["default"])(_classNames, className + '-text-active', isActived), _classNames)); +var EventBaseObjectProto = _EventBaseObject2['default'].prototype; - var bottomStyle = { - // height: markWidth + '%', - marginBottom: '-200%', - bottom: (point - min) / range * 100 + '%' - }; +(0, _objectAssign2['default'])(DomEventObject.prototype, EventBaseObjectProto, { + constructor: DomEventObject, - var leftStyle = { - width: markWidth + '%', - marginLeft: -markWidth / 2 + '%', - left: (point - min) / range * 100 + '%' - }; + preventDefault: function preventDefault() { + var e = this.nativeEvent; - var style = vertical ? bottomStyle : leftStyle; + // if preventDefault exists run it on the original event + if (e.preventDefault) { + e.preventDefault(); + } else { + // otherwise set the returnValue property of the original event to FALSE (IE) + e.returnValue = FALSE; + } - var markPoint = marks[point]; - var markPointIsObject = (typeof markPoint === 'undefined' ? 'undefined' : (0, _typeof3["default"])(markPoint)) === 'object' && !_react2["default"].isValidElement(markPoint); - var markLabel = markPointIsObject ? markPoint.label : markPoint; - var markStyle = markPointIsObject ? (0, _extends3["default"])({}, style, markPoint.style) : style; - return _react2["default"].createElement( - 'span', - { className: markClassName, style: markStyle, key: point }, - markLabel - ); - }); + EventBaseObjectProto.preventDefault.call(this); + }, - return _react2["default"].createElement( - 'div', - { className: className }, - elements - ); -}; + stopPropagation: function stopPropagation() { + var e = this.nativeEvent; -exports["default"] = Marks; + // if stopPropagation exists run it on the original event + if (e.stopPropagation) { + e.stopPropagation(); + } else { + // otherwise set the cancelBubble property of the original event to TRUE (IE) + e.cancelBubble = TRUE; + } + + EventBaseObjectProto.stopPropagation.call(this); + } +}); + +exports['default'] = DomEventObject; module.exports = exports['default']; -},{"babel-runtime/helpers/defineProperty":33,"babel-runtime/helpers/extends":34,"babel-runtime/helpers/typeof":39,"classnames":123,"react":585}],21:[function(require,module,exports){ -(function (process){ +},{"./EventBaseObject":17,"object-assign":213}],19:[function(require,module,exports){ 'use strict'; -Object.defineProperty(exports, "__esModule", { +Object.defineProperty(exports, '__esModule', { value: true }); +exports['default'] = addEventListener; -var _defineProperty2 = require('babel-runtime/helpers/defineProperty'); - -var _defineProperty3 = _interopRequireDefault(_defineProperty2); - -var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray'); - -var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } -var _extends2 = require('babel-runtime/helpers/extends'); +var _EventObject = require('./EventObject'); -var _extends3 = _interopRequireDefault(_extends2); +var _EventObject2 = _interopRequireDefault(_EventObject); -var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); +function addEventListener(target, eventType, callback) { + function wrapCallback(e) { + var ne = new _EventObject2['default'](e); + callback.call(target, ne); + } -var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + if (target.addEventListener) { + target.addEventListener(eventType, wrapCallback, false); + return { + remove: function remove() { + target.removeEventListener(eventType, wrapCallback, false); + } + }; + } else if (target.attachEvent) { + target.attachEvent('on' + eventType, wrapCallback); + return { + remove: function remove() { + target.detachEvent('on' + eventType, wrapCallback); + } + }; + } +} -var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn'); +module.exports = exports['default']; +},{"./EventObject":18}],20:[function(require,module,exports){ +module.exports = { "default": require("core-js/library/fn/array/from"), __esModule: true }; +},{"core-js/library/fn/array/from":42}],21:[function(require,module,exports){ +module.exports = { "default": require("core-js/library/fn/object/assign"), __esModule: true }; +},{"core-js/library/fn/object/assign":43}],22:[function(require,module,exports){ +module.exports = { "default": require("core-js/library/fn/object/create"), __esModule: true }; +},{"core-js/library/fn/object/create":44}],23:[function(require,module,exports){ +module.exports = { "default": require("core-js/library/fn/object/define-property"), __esModule: true }; +},{"core-js/library/fn/object/define-property":45}],24:[function(require,module,exports){ +module.exports = { "default": require("core-js/library/fn/object/entries"), __esModule: true }; +},{"core-js/library/fn/object/entries":46}],25:[function(require,module,exports){ +module.exports = { "default": require("core-js/library/fn/object/set-prototype-of"), __esModule: true }; +},{"core-js/library/fn/object/set-prototype-of":47}],26:[function(require,module,exports){ +module.exports = { "default": require("core-js/library/fn/object/values"), __esModule: true }; +},{"core-js/library/fn/object/values":48}],27:[function(require,module,exports){ +module.exports = { "default": require("core-js/library/fn/symbol"), __esModule: true }; +},{"core-js/library/fn/symbol":49}],28:[function(require,module,exports){ +module.exports = { "default": require("core-js/library/fn/symbol/iterator"), __esModule: true }; +},{"core-js/library/fn/symbol/iterator":50}],29:[function(require,module,exports){ +"use strict"; -var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); +exports.__esModule = true; -var _inherits2 = require('babel-runtime/helpers/inherits'); +exports.default = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +}; +},{}],30:[function(require,module,exports){ +"use strict"; -var _inherits3 = _interopRequireDefault(_inherits2); +exports.__esModule = true; -var _react = require('react'); +var _defineProperty = require("../core-js/object/define-property"); -var _react2 = _interopRequireDefault(_react); +var _defineProperty2 = _interopRequireDefault(_defineProperty); -var _addEventListener = require('rc-util/lib/Dom/addEventListener'); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var _addEventListener2 = _interopRequireDefault(_addEventListener); +exports.default = function (obj, key, value) { + if (key in obj) { + (0, _defineProperty2.default)(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } -var _classnames = require('classnames'); + return obj; +}; +},{"../core-js/object/define-property":23}],31:[function(require,module,exports){ +"use strict"; -var _classnames2 = _interopRequireDefault(_classnames); +exports.__esModule = true; -var _Track = require('./Track'); +var _assign = require("../core-js/object/assign"); -var _Track2 = _interopRequireDefault(_Track); +var _assign2 = _interopRequireDefault(_assign); -var _Handle = require('./Handle'); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var _Handle2 = _interopRequireDefault(_Handle); +exports.default = _assign2.default || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; -var _Steps = require('./Steps'); + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } -var _Steps2 = _interopRequireDefault(_Steps); + return target; +}; +},{"../core-js/object/assign":21}],32:[function(require,module,exports){ +"use strict"; -var _Marks = require('./Marks'); +exports.__esModule = true; -var _Marks2 = _interopRequireDefault(_Marks); +var _setPrototypeOf = require("../core-js/object/set-prototype-of"); -var _warning = require('warning'); +var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf); -var _warning2 = _interopRequireDefault(_warning); +var _create = require("../core-js/object/create"); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +var _create2 = _interopRequireDefault(_create); -function noop() {} +var _typeof2 = require("../helpers/typeof"); -function isNotTouchEvent(e) { - return e.touches.length > 1 || e.type.toLowerCase() === 'touchend' && e.touches.length > 0; -} +var _typeof3 = _interopRequireDefault(_typeof2); -function getTouchPosition(vertical, e) { - return vertical ? e.touches[0].clientY : e.touches[0].pageX; -} +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function getMousePosition(vertical, e) { - return vertical ? e.clientY : e.pageX; -} +exports.default = function (subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : (0, _typeof3.default)(superClass))); + } -function pauseEvent(e) { - e.stopPropagation(); - e.preventDefault(); -} + subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass; +}; +},{"../core-js/object/create":22,"../core-js/object/set-prototype-of":25,"../helpers/typeof":36}],33:[function(require,module,exports){ +"use strict"; -var Slider = function (_React$Component) { - (0, _inherits3["default"])(Slider, _React$Component); +exports.__esModule = true; - function Slider(props) { - (0, _classCallCheck3["default"])(this, Slider); +exports.default = function (obj, keys) { + var target = {}; - var _this = (0, _possibleConstructorReturn3["default"])(this, _React$Component.call(this, props)); + for (var i in obj) { + if (keys.indexOf(i) >= 0) continue; + if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; + target[i] = obj[i]; + } - var range = props.range; - var min = props.min; - var max = props.max; - var step = props.step; + return target; +}; +},{}],34:[function(require,module,exports){ +"use strict"; - var initialValue = range ? Array.apply(null, Array(range + 1)).map(function () { - return min; - }) : min; - var defaultValue = 'defaultValue' in props ? props.defaultValue : initialValue; - var value = props.value !== undefined ? props.value : defaultValue; +exports.__esModule = true; - var bounds = (range ? value : [min, value]).map(function (v) { - return _this.trimAlignValue(v); - }); +var _typeof2 = require("../helpers/typeof"); - var recent = void 0; - if (range && bounds[0] === bounds[bounds.length - 1] && bounds[0] === max) { - recent = 0; - } else { - recent = bounds.length - 1; - } +var _typeof3 = _interopRequireDefault(_typeof2); - if (process.env.NODE_ENV !== 'production' && step && Math.floor(step) === step && (max - min) % step !== 0) { - (0, _warning2["default"])(false, 'Slider[max] - Slider[min] (%s) should be a multiple of Slider[step] (%s)', max - min, step); - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - _this.state = { - handle: null, - recent: recent, - bounds: bounds - }; - return _this; +exports.default = function (self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } - Slider.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { - var _this2 = this; + return call && ((typeof call === "undefined" ? "undefined" : (0, _typeof3.default)(call)) === "object" || typeof call === "function") ? call : self; +}; +},{"../helpers/typeof":36}],35:[function(require,module,exports){ +"use strict"; - if (!('value' in nextProps || 'min' in nextProps || 'max' in nextProps)) return; +exports.__esModule = true; - var bounds = this.state.bounds; +var _from = require("../core-js/array/from"); - if (nextProps.range) { - var value = nextProps.value || bounds; - var nextBounds = value.map(function (v) { - return _this2.trimAlignValue(v, nextProps); - }); - if (nextBounds.every(function (v, i) { - return v === bounds[i]; - })) return; +var _from2 = _interopRequireDefault(_from); - this.setState({ bounds: nextBounds }); - if (bounds.some(function (v) { - return _this2.isValueOutOfBounds(v, nextProps); - })) { - this.props.onChange(nextBounds); - } - } else { - var _value = nextProps.value !== undefined ? nextProps.value : bounds[1]; - var nextValue = this.trimAlignValue(_value, nextProps); - if (nextValue === bounds[1] && bounds[0] === nextProps.min) return; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - this.setState({ bounds: [nextProps.min, nextValue] }); - if (this.isValueOutOfBounds(bounds[1], nextProps)) { - this.props.onChange(nextValue); - } +exports.default = function (arr) { + if (Array.isArray(arr)) { + for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { + arr2[i] = arr[i]; } - }; - Slider.prototype.onChange = function onChange(state) { - var props = this.props; - var isNotControlled = !('value' in props); - if (isNotControlled) { - this.setState(state); - } else if (state.handle) { - this.setState({ handle: state.handle }); - } + return arr2; + } else { + return (0, _from2.default)(arr); + } +}; +},{"../core-js/array/from":20}],36:[function(require,module,exports){ +"use strict"; - var data = (0, _extends3["default"])({}, this.state, state); - var changedValue = props.range ? data.bounds : data.bounds[1]; - props.onChange(changedValue); - }; +exports.__esModule = true; - Slider.prototype.onMouseMove = function onMouseMove(e) { - var position = getMousePosition(this.props.vertical, e); - this.onMove(e, position); - }; +var _iterator = require("../core-js/symbol/iterator"); - Slider.prototype.onTouchMove = function onTouchMove(e) { - if (isNotTouchEvent(e)) { - this.end('touch'); - return; - } +var _iterator2 = _interopRequireDefault(_iterator); - var position = getTouchPosition(this.props.vertical, e); - this.onMove(e, position); - }; +var _symbol = require("../core-js/symbol"); - Slider.prototype.onMove = function onMove(e, position) { - pauseEvent(e); - var props = this.props; - var state = this.state; +var _symbol2 = _interopRequireDefault(_symbol); - var diffPosition = position - this.startPosition; - diffPosition = this.props.vertical ? -diffPosition : diffPosition; - var diffValue = diffPosition / this.getSliderLength() * (props.max - props.min); +var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default ? "symbol" : typeof obj; }; - var value = this.trimAlignValue(this.startValue + diffValue); - var oldValue = state.bounds[state.handle]; - if (value === oldValue) return; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - var nextBounds = [].concat((0, _toConsumableArray3["default"])(state.bounds)); - nextBounds[state.handle] = value; - var nextHandle = state.handle; - if (props.pushable !== false) { - var originalValue = state.bounds[nextHandle]; - this.pushSurroundingHandles(nextBounds, nextHandle, originalValue); - } else if (props.allowCross) { - nextBounds.sort(function (a, b) { - return a - b; - }); - nextHandle = nextBounds.indexOf(value); - } - this.onChange({ - handle: nextHandle, - bounds: nextBounds - }); - }; +exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) { + return typeof obj === "undefined" ? "undefined" : _typeof(obj); +} : function (obj) { + return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj); +}; +},{"../core-js/symbol":27,"../core-js/symbol/iterator":28}],37:[function(require,module,exports){ - Slider.prototype.onTouchStart = function onTouchStart(e) { - if (isNotTouchEvent(e)) return; +},{}],38:[function(require,module,exports){ +// shim for using process in browser +var process = module.exports = {}; - var position = getTouchPosition(this.props.vertical, e); - this.onStart(position); - this.addDocumentEvents('touch'); - pauseEvent(e); - }; - - Slider.prototype.onMouseDown = function onMouseDown(e) { - if (e.button !== 0) { - return; - } - var position = getMousePosition(this.props.vertical, e); - this.onStart(position); - this.addDocumentEvents('mouse'); - pauseEvent(e); - }; - - Slider.prototype.onStart = function onStart(position) { - var props = this.props; - props.onBeforeChange(this.getValue()); - - var value = this.calcValueByPos(position); - this.startValue = value; - this.startPosition = position; - - var state = this.state; - var bounds = state.bounds; +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. +var cachedSetTimeout; +var cachedClearTimeout; - var valueNeedChanging = 1; - if (this.props.range) { - var closestBound = 0; - for (var i = 1; i < bounds.length - 1; ++i) { - if (value > bounds[i]) { - closestBound = i; +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; } - } - if (Math.abs(bounds[closestBound + 1] - value) < Math.abs(bounds[closestBound] - value)) { - closestBound = closestBound + 1; - } - valueNeedChanging = closestBound; - - var isAtTheSamePoint = bounds[closestBound + 1] === bounds[closestBound]; - if (isAtTheSamePoint) { - valueNeedChanging = state.recent; - } - - if (isAtTheSamePoint && value !== bounds[closestBound + 1]) { - valueNeedChanging = value < bounds[closestBound + 1] ? closestBound : closestBound + 1; - } + } catch (e) { + cachedSetTimeout = defaultSetTimout; } - - this.setState({ - handle: valueNeedChanging, - recent: valueNeedChanging - }); - - var oldValue = state.bounds[valueNeedChanging]; - if (value === oldValue) return; - - var nextBounds = [].concat((0, _toConsumableArray3["default"])(state.bounds)); - nextBounds[valueNeedChanging] = value; - this.onChange({ bounds: nextBounds }); - }; - - Slider.prototype.getValue = function getValue() { - var bounds = this.state.bounds; - - return this.props.range ? bounds : bounds[1]; - }; - - Slider.prototype.getSliderLength = function getSliderLength() { - var slider = this.refs.slider; - if (!slider) { - return 0; + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; } - - return this.props.vertical ? slider.clientHeight : slider.clientWidth; - }; - - Slider.prototype.getSliderStart = function getSliderStart() { - var slider = this.refs.slider; - var rect = slider.getBoundingClientRect(); - - return this.props.vertical ? rect.top : rect.left; - }; - - Slider.prototype.getPrecision = function getPrecision(step) { - var stepString = step.toString(); - var precision = 0; - if (stepString.indexOf('.') >= 0) { - precision = stepString.length - stepString.indexOf('.') - 1; +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); } - return precision; - }; - - /** - * Returns an array of possible slider points, taking into account both - * `marks` and `step`. The result is cached. - */ - - - Slider.prototype.getPoints = function getPoints() { - var _props = this.props; - var marks = _props.marks; - var step = _props.step; - var min = _props.min; - var max = _props.max; - - var cache = this._getPointsCache; - if (!cache || cache.marks !== marks || cache.step !== step) { - var pointsObject = (0, _extends3["default"])({}, marks); - if (step !== null) { - for (var point = min; point <= max; point += step) { - pointsObject[point] = point; + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); } - } - var points = Object.keys(pointsObject).map(parseFloat); - points.sort(function (a, b) { - return a - b; - }); - this._getPointsCache = { marks: marks, step: step, points: points }; } - return this._getPointsCache.points; - }; - Slider.prototype.isValueOutOfBounds = function isValueOutOfBounds(value, props) { - return value < props.min || value > props.max; - }; - Slider.prototype.trimAlignValue = function trimAlignValue(v, nextProps) { - var state = this.state || {}; - var handle = state.handle; - var bounds = state.bounds; +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } - var _props2 = (0, _extends3["default"])({}, this.props, nextProps || {}); - var marks = _props2.marks; - var step = _props2.step; - var min = _props2.min; - var max = _props2.max; - var allowCross = _props2.allowCross; +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; - var val = v; - if (val <= min) { - val = min; - } - if (val >= max) { - val = max; +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; } - /* eslint-disable eqeqeq */ - if (!allowCross && handle != null && handle > 0 && val <= bounds[handle - 1]) { - val = bounds[handle - 1]; + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; } - if (!allowCross && handle != null && handle < bounds.length - 1 && val >= bounds[handle + 1]) { - val = bounds[handle + 1]; + if (queue.length) { + drainQueue(); } - /* eslint-enable eqeqeq */ +} - var points = Object.keys(marks).map(parseFloat); - if (step !== null) { - var closestStep = Math.round((val - min) / step) * step + min; - points.push(closestStep); +function drainQueue() { + if (draining) { + return; } + var timeout = runTimeout(cleanUpNextTick); + draining = true; - var diffs = points.map(function (point) { - return Math.abs(val - point); - }); - var closestPoint = points[diffs.indexOf(Math.min.apply(Math, diffs))]; - - return step !== null ? parseFloat(closestPoint.toFixed(this.getPrecision(step))) : closestPoint; - }; - - Slider.prototype.pushHandleOnePoint = function pushHandleOnePoint(bounds, handle, direction) { - var points = this.getPoints(); - var pointIndex = points.indexOf(bounds[handle]); - var nextPointIndex = pointIndex + direction; - if (nextPointIndex >= points.length || nextPointIndex < 0) { - // reached the minimum or maximum available point, can't push anymore - return false; + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; } - var nextHandle = handle + direction; - var nextValue = points[nextPointIndex]; - var threshold = this.props.pushable; + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} - var diffToNext = direction * (bounds[nextHandle] - nextValue); - if (!this.pushHandle(bounds, nextHandle, direction, threshold - diffToNext)) { - // couldn't push next handle, so we won't push this one either - return false; +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } } - // push the handle - bounds[handle] = nextValue; - return true; - }; - - Slider.prototype.pushHandle = function pushHandle(bounds, handle, direction, amount) { - var originalValue = bounds[handle]; - var currentValue = bounds[handle]; - while (direction * (currentValue - originalValue) < amount) { - if (!this.pushHandleOnePoint(bounds, handle, direction)) { - // can't push handle enough to create the needed `amount` gap, so we - // revert its position to the original value - bounds[handle] = originalValue; - return false; - } - currentValue = bounds[handle]; + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); } - // the handle was pushed enough to create the needed `amount` gap - return true; - }; +}; - Slider.prototype.pushSurroundingHandles = function pushSurroundingHandles(bounds, handle, originalValue) { - var threshold = this.props.pushable; +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; - var value = bounds[handle]; +function noop() {} - var direction = 0; - if (bounds[handle + 1] - value < threshold) { - direction = +1; - } else if (value - bounds[handle - 1] < threshold) { - direction = -1; - } +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; - if (direction === 0) { - return; - } +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; - var nextHandle = handle + direction; - var diffToNext = direction * (bounds[nextHandle] - value); - if (!this.pushHandle(bounds, nextHandle, direction, threshold - diffToNext)) { - // revert to original value if pushing is impossible - bounds[handle] = originalValue; - } - }; +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; - Slider.prototype.calcOffset = function calcOffset(value) { - var _props3 = this.props; - var min = _props3.min; - var max = _props3.max; +},{}],39:[function(require,module,exports){ +/*! + Copyright (c) 2016 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames +*/ +/* global define */ - var ratio = (value - min) / (max - min); - return ratio * 100; - }; +(function () { + 'use strict'; - Slider.prototype.calcValue = function calcValue(offset) { - var _props4 = this.props; - var vertical = _props4.vertical; - var min = _props4.min; - var max = _props4.max; + var hasOwn = {}.hasOwnProperty; - var ratio = Math.abs(offset / this.getSliderLength()); - var value = vertical ? (1 - ratio) * (max - min) + min : ratio * (max - min) + min; - return value; - }; + function classNames () { + var classes = []; - Slider.prototype.calcValueByPos = function calcValueByPos(position) { - var pixelOffset = position - this.getSliderStart(); - var nextValue = this.trimAlignValue(this.calcValue(pixelOffset)); - return nextValue; - }; + for (var i = 0; i < arguments.length; i++) { + var arg = arguments[i]; + if (!arg) continue; - Slider.prototype.addDocumentEvents = function addDocumentEvents(type) { - if (type === 'touch') { - // just work for chrome iOS Safari and Android Browser - this.onTouchMoveListener = (0, _addEventListener2["default"])(document, 'touchmove', this.onTouchMove.bind(this)); - this.onTouchUpListener = (0, _addEventListener2["default"])(document, 'touchend', this.end.bind(this, 'touch')); - } else if (type === 'mouse') { - this.onMouseMoveListener = (0, _addEventListener2["default"])(document, 'mousemove', this.onMouseMove.bind(this)); - this.onMouseUpListener = (0, _addEventListener2["default"])(document, 'mouseup', this.end.bind(this, 'mouse')); - } - }; + var argType = typeof arg; - Slider.prototype.removeEvents = function removeEvents(type) { - if (type === 'touch') { - this.onTouchMoveListener.remove(); - this.onTouchUpListener.remove(); - } else if (type === 'mouse') { - this.onMouseMoveListener.remove(); - this.onMouseUpListener.remove(); - } - }; + if (argType === 'string' || argType === 'number') { + classes.push(arg); + } else if (Array.isArray(arg)) { + classes.push(classNames.apply(null, arg)); + } else if (argType === 'object') { + for (var key in arg) { + if (hasOwn.call(arg, key) && arg[key]) { + classes.push(key); + } + } + } + } - Slider.prototype.end = function end(type) { - this.removeEvents(type); - this.props.onAfterChange(this.getValue()); - this.setState({ handle: null }); - }; + return classes.join(' '); + } - Slider.prototype.render = function render() { - var _this3 = this, - _classNames3; + if (typeof module !== 'undefined' && module.exports) { + module.exports = classNames; + } else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) { + // register as 'classnames', consistent with npm package name + define('classnames', [], function () { + return classNames; + }); + } else { + window.classNames = classNames; + } +}()); - var _state = this.state; - var handle = _state.handle; - var bounds = _state.bounds; - var _props5 = this.props; - var className = _props5.className; - var prefixCls = _props5.prefixCls; - var tooltipPrefixCls = _props5.tooltipPrefixCls; - var disabled = _props5.disabled; - var vertical = _props5.vertical; - var dots = _props5.dots; - var included = _props5.included; - var range = _props5.range; - var step = _props5.step; - var marks = _props5.marks; - var max = _props5.max; - var min = _props5.min; - var tipTransitionName = _props5.tipTransitionName; - var tipFormatter = _props5.tipFormatter; - var children = _props5.children; +},{}],40:[function(require,module,exports){ +/** + * Module dependencies. + */ +try { + var index = require('indexof'); +} catch (err) { + var index = require('component-indexof'); +} - var customHandle = this.props.handle; +/** + * Whitespace regexp. + */ - var offsets = bounds.map(function (v) { - return _this3.calcOffset(v); - }); +var re = /\s+/; - var handleClassName = prefixCls + '-handle'; +/** + * toString reference. + */ - var handlesClassNames = bounds.map(function (v, i) { - var _classNames; +var toString = Object.prototype.toString; - return (0, _classnames2["default"])((_classNames = {}, (0, _defineProperty3["default"])(_classNames, handleClassName, true), (0, _defineProperty3["default"])(_classNames, handleClassName + '-' + (i + 1), true), (0, _defineProperty3["default"])(_classNames, handleClassName + '-lower', i === 0), (0, _defineProperty3["default"])(_classNames, handleClassName + '-upper', i === bounds.length - 1), _classNames)); - }); +/** + * Wrap `el` in a `ClassList`. + * + * @param {Element} el + * @return {ClassList} + * @api public + */ - var isNoTip = step === null || tipFormatter === null; +module.exports = function(el){ + return new ClassList(el); +}; - var commonHandleProps = { - prefixCls: prefixCls, - tooltipPrefixCls: tooltipPrefixCls, - noTip: isNoTip, - tipTransitionName: tipTransitionName, - tipFormatter: tipFormatter, - vertical: vertical - }; +/** + * Initialize a new ClassList for `el`. + * + * @param {Element} el + * @api private + */ - var handles = bounds.map(function (v, i) { - return (0, _react.cloneElement)(customHandle, (0, _extends3["default"])({}, commonHandleProps, { - className: handlesClassNames[i], - value: v, - offset: offsets[i], - dragging: handle === i, - key: i - })); - }); - if (!range) { - handles.shift(); - } - - var isIncluded = included || range; - - var tracks = []; - for (var i = 1; i < bounds.length; ++i) { - var _classNames2; - - var trackClassName = (0, _classnames2["default"])((_classNames2 = {}, (0, _defineProperty3["default"])(_classNames2, prefixCls + '-track', true), (0, _defineProperty3["default"])(_classNames2, prefixCls + '-track-' + i, true), _classNames2)); - tracks.push(_react2["default"].createElement(_Track2["default"], { className: trackClassName, vertical: vertical, included: isIncluded, - offset: offsets[i - 1], length: offsets[i] - offsets[i - 1], key: i - })); - } - - var sliderClassName = (0, _classnames2["default"])((_classNames3 = {}, (0, _defineProperty3["default"])(_classNames3, prefixCls, true), (0, _defineProperty3["default"])(_classNames3, prefixCls + '-disabled', disabled), (0, _defineProperty3["default"])(_classNames3, className, !!className), (0, _defineProperty3["default"])(_classNames3, prefixCls + '-vertical', this.props.vertical), _classNames3)); - - return _react2["default"].createElement( - 'div', - { ref: 'slider', className: sliderClassName, - onTouchStart: disabled ? noop : this.onTouchStart.bind(this), - onMouseDown: disabled ? noop : this.onMouseDown.bind(this) - }, - tracks, - _react2["default"].createElement(_Steps2["default"], { prefixCls: prefixCls, vertical: vertical, marks: marks, dots: dots, step: step, - included: isIncluded, lowerBound: bounds[0], - upperBound: bounds[bounds.length - 1], max: max, min: min - }), - handles, - _react2["default"].createElement(_Marks2["default"], { className: prefixCls + '-mark', vertical: vertical, marks: marks, - included: isIncluded, lowerBound: bounds[0], - upperBound: bounds[bounds.length - 1], max: max, min: min - }), - children - ); - }; - - return Slider; -}(_react2["default"].Component); - -Slider.propTypes = { - min: _react2["default"].PropTypes.number, - max: _react2["default"].PropTypes.number, - step: _react2["default"].PropTypes.number, - defaultValue: _react2["default"].PropTypes.oneOfType([_react2["default"].PropTypes.number, _react2["default"].PropTypes.arrayOf(_react2["default"].PropTypes.number)]), - value: _react2["default"].PropTypes.oneOfType([_react2["default"].PropTypes.number, _react2["default"].PropTypes.arrayOf(_react2["default"].PropTypes.number)]), - marks: _react2["default"].PropTypes.object, - included: _react2["default"].PropTypes.bool, - className: _react2["default"].PropTypes.string, - prefixCls: _react2["default"].PropTypes.string, - tooltipPrefixCls: _react2["default"].PropTypes.string, - disabled: _react2["default"].PropTypes.bool, - children: _react2["default"].PropTypes.any, - onBeforeChange: _react2["default"].PropTypes.func, - onChange: _react2["default"].PropTypes.func, - onAfterChange: _react2["default"].PropTypes.func, - handle: _react2["default"].PropTypes.element, - tipTransitionName: _react2["default"].PropTypes.string, - tipFormatter: _react2["default"].PropTypes.func, - dots: _react2["default"].PropTypes.bool, - range: _react2["default"].PropTypes.oneOfType([_react2["default"].PropTypes.bool, _react2["default"].PropTypes.number]), - vertical: _react2["default"].PropTypes.bool, - allowCross: _react2["default"].PropTypes.bool, - pushable: _react2["default"].PropTypes.oneOfType([_react2["default"].PropTypes.bool, _react2["default"].PropTypes.number]) -}; - -Slider.defaultProps = { - prefixCls: 'rc-slider', - className: '', - tipTransitionName: '', - min: 0, - max: 100, - step: 1, - marks: {}, - handle: _react2["default"].createElement(_Handle2["default"], null), - onBeforeChange: noop, - onChange: noop, - onAfterChange: noop, - tipFormatter: function tipFormatter(value) { - return value; - }, - included: true, - disabled: false, - dots: false, - range: false, - vertical: false, - allowCross: true, - pushable: false -}; - -exports["default"] = Slider; -module.exports = exports['default']; -}).call(this,require('_process')) -},{"./Handle":19,"./Marks":20,"./Steps":22,"./Track":23,"_process":17,"babel-runtime/helpers/classCallCheck":32,"babel-runtime/helpers/defineProperty":33,"babel-runtime/helpers/extends":34,"babel-runtime/helpers/inherits":35,"babel-runtime/helpers/possibleConstructorReturn":37,"babel-runtime/helpers/toConsumableArray":38,"classnames":123,"rc-util/lib/Dom/addEventListener":154,"react":585,"warning":161}],22:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _defineProperty2 = require('babel-runtime/helpers/defineProperty'); - -var _defineProperty3 = _interopRequireDefault(_defineProperty2); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _classnames = require('classnames'); - -var _classnames2 = _interopRequireDefault(_classnames); - -var _warning = require('warning'); - -var _warning2 = _interopRequireDefault(_warning); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -function calcPoints(vertical, marks, dots, step, min, max) { - (0, _warning2["default"])(dots ? step > 0 : true, '`Slider[step]` should be a positive number in order to make Slider[dots] work.'); - var points = Object.keys(marks).map(parseFloat); - if (dots) { - for (var i = min; i <= max; i = i + step) { - if (points.indexOf(i) >= 0) continue; - points.push(i); - } +function ClassList(el) { + if (!el || !el.nodeType) { + throw new Error('A DOM element reference is required'); } - return points; + this.el = el; + this.list = el.classList; } -var Steps = function Steps(_ref) { - var prefixCls = _ref.prefixCls; - var vertical = _ref.vertical; - var marks = _ref.marks; - var dots = _ref.dots; - var step = _ref.step; - var included = _ref.included; - var lowerBound = _ref.lowerBound; - var upperBound = _ref.upperBound; - var max = _ref.max; - var min = _ref.min; - - var range = max - min; - var elements = calcPoints(vertical, marks, dots, step, min, max).map(function (point) { - var _classNames; - - var offset = Math.abs(point - min) / range * 100 + '%'; - var style = vertical ? { bottom: offset } : { left: offset }; - - var isActived = !included && point === upperBound || included && point <= upperBound && point >= lowerBound; - var pointClassName = (0, _classnames2["default"])((_classNames = {}, (0, _defineProperty3["default"])(_classNames, prefixCls + '-dot', true), (0, _defineProperty3["default"])(_classNames, prefixCls + '-dot-active', isActived), _classNames)); - - return _react2["default"].createElement('span', { className: pointClassName, style: style, key: point }); - }); - - return _react2["default"].createElement( - 'div', - { className: prefixCls + '-step' }, - elements - ); -}; - -exports["default"] = Steps; -module.exports = exports['default']; -},{"babel-runtime/helpers/defineProperty":33,"classnames":123,"react":585,"warning":161}],23:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var Track = function Track(_ref) { - var className = _ref.className; - var included = _ref.included; - var vertical = _ref.vertical; - var offset = _ref.offset; - var length = _ref.length; +/** + * Add class `name` if not already present. + * + * @param {String} name + * @return {ClassList} + * @api public + */ - var style = { - visibility: included ? 'visible' : 'hidden' - }; - if (vertical) { - style.bottom = offset + '%'; - style.height = length + '%'; - } else { - style.left = offset + '%'; - style.width = length + '%'; +ClassList.prototype.add = function(name){ + // classList + if (this.list) { + this.list.add(name); + return this; } - return _react2["default"].createElement('div', { className: className, style: style }); -}; - -exports["default"] = Track; -module.exports = exports['default']; -},{"react":585}],24:[function(require,module,exports){ -'use strict'; -module.exports = require('./Slider'); -},{"./Slider":21}],25:[function(require,module,exports){ -module.exports = { "default": require("core-js/library/fn/array/from"), __esModule: true }; -},{"core-js/library/fn/array/from":40}],26:[function(require,module,exports){ -module.exports = { "default": require("core-js/library/fn/object/assign"), __esModule: true }; -},{"core-js/library/fn/object/assign":41}],27:[function(require,module,exports){ -module.exports = { "default": require("core-js/library/fn/object/create"), __esModule: true }; -},{"core-js/library/fn/object/create":42}],28:[function(require,module,exports){ -module.exports = { "default": require("core-js/library/fn/object/define-property"), __esModule: true }; -},{"core-js/library/fn/object/define-property":43}],29:[function(require,module,exports){ -module.exports = { "default": require("core-js/library/fn/object/set-prototype-of"), __esModule: true }; -},{"core-js/library/fn/object/set-prototype-of":44}],30:[function(require,module,exports){ -module.exports = { "default": require("core-js/library/fn/symbol"), __esModule: true }; -},{"core-js/library/fn/symbol":45}],31:[function(require,module,exports){ -module.exports = { "default": require("core-js/library/fn/symbol/iterator"), __esModule: true }; -},{"core-js/library/fn/symbol/iterator":46}],32:[function(require,module,exports){ -"use strict"; - -exports.__esModule = true; - -exports.default = function (instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } + // fallback + var arr = this.array(); + var i = index(arr, name); + if (!~i) arr.push(name); + this.el.className = arr.join(' '); + return this; }; -},{}],33:[function(require,module,exports){ -"use strict"; -exports.__esModule = true; - -var _defineProperty = require("../core-js/object/define-property"); - -var _defineProperty2 = _interopRequireDefault(_defineProperty); +/** + * Remove class `name` when present, or + * pass a regular expression to remove + * any which match. + * + * @param {String|RegExp} name + * @return {ClassList} + * @api public + */ -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +ClassList.prototype.remove = function(name){ + if ('[object RegExp]' == toString.call(name)) { + return this.removeMatching(name); + } -exports.default = function (obj, key, value) { - if (key in obj) { - (0, _defineProperty2.default)(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; + // classList + if (this.list) { + this.list.remove(name); + return this; } - return obj; + // fallback + var arr = this.array(); + var i = index(arr, name); + if (~i) arr.splice(i, 1); + this.el.className = arr.join(' '); + return this; }; -},{"../core-js/object/define-property":28}],34:[function(require,module,exports){ -"use strict"; - -exports.__esModule = true; - -var _assign = require("../core-js/object/assign"); - -var _assign2 = _interopRequireDefault(_assign); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -exports.default = _assign2.default || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; +/** + * Remove all classes matching `re`. + * + * @param {RegExp} re + * @return {ClassList} + * @api private + */ - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } +ClassList.prototype.removeMatching = function(re){ + var arr = this.array(); + for (var i = 0; i < arr.length; i++) { + if (re.test(arr[i])) { + this.remove(arr[i]); } } - - return target; + return this; }; -},{"../core-js/object/assign":26}],35:[function(require,module,exports){ -"use strict"; - -exports.__esModule = true; - -var _setPrototypeOf = require("../core-js/object/set-prototype-of"); - -var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf); - -var _create = require("../core-js/object/create"); - -var _create2 = _interopRequireDefault(_create); - -var _typeof2 = require("../helpers/typeof"); - -var _typeof3 = _interopRequireDefault(_typeof2); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/** + * Toggle class `name`, can force state via `force`. + * + * For browsers that support classList, but do not support `force` yet, + * the mistake will be detected and corrected. + * + * @param {String} name + * @param {Boolean} force + * @return {ClassList} + * @api public + */ -exports.default = function (subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : (0, _typeof3.default)(superClass))); +ClassList.prototype.toggle = function(name, force){ + // classList + if (this.list) { + if ("undefined" !== typeof force) { + if (force !== this.list.toggle(name, force)) { + this.list.toggle(name); // toggle again to correct + } + } else { + this.list.toggle(name); + } + return this; } - subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, { - constructor: { - value: subClass, - enumerable: false, - writable: true, - configurable: true + // fallback + if ("undefined" !== typeof force) { + if (!force) { + this.remove(name); + } else { + this.add(name); + } + } else { + if (this.has(name)) { + this.remove(name); + } else { + this.add(name); } - }); - if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass; -}; -},{"../core-js/object/create":27,"../core-js/object/set-prototype-of":29,"../helpers/typeof":39}],36:[function(require,module,exports){ -"use strict"; - -exports.__esModule = true; - -exports.default = function (obj, keys) { - var target = {}; - - for (var i in obj) { - if (keys.indexOf(i) >= 0) continue; - if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; - target[i] = obj[i]; } - return target; + return this; }; -},{}],37:[function(require,module,exports){ -"use strict"; - -exports.__esModule = true; -var _typeof2 = require("../helpers/typeof"); - -var _typeof3 = _interopRequireDefault(_typeof2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.default = function (self, call) { - if (!self) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } +/** + * Return an array of classes. + * + * @return {Array} + * @api public + */ - return call && ((typeof call === "undefined" ? "undefined" : (0, _typeof3.default)(call)) === "object" || typeof call === "function") ? call : self; +ClassList.prototype.array = function(){ + var className = this.el.getAttribute('class') || ''; + var str = className.replace(/^\s+|\s+$/g, ''); + var arr = str.split(re); + if ('' === arr[0]) arr.shift(); + return arr; }; -},{"../helpers/typeof":39}],38:[function(require,module,exports){ -"use strict"; - -exports.__esModule = true; - -var _from = require("../core-js/array/from"); - -var _from2 = _interopRequireDefault(_from); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.default = function (arr) { - if (Array.isArray(arr)) { - for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { - arr2[i] = arr[i]; - } +/** + * Check if class `name` is present. + * + * @param {String} name + * @return {ClassList} + * @api public + */ - return arr2; - } else { - return (0, _from2.default)(arr); - } +ClassList.prototype.has = +ClassList.prototype.contains = function(name){ + return this.list + ? this.list.contains(name) + : !! ~index(this.array(), name); }; -},{"../core-js/array/from":25}],39:[function(require,module,exports){ -"use strict"; - -exports.__esModule = true; - -var _iterator = require("../core-js/symbol/iterator"); - -var _iterator2 = _interopRequireDefault(_iterator); - -var _symbol = require("../core-js/symbol"); -var _symbol2 = _interopRequireDefault(_symbol); - -var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default ? "symbol" : typeof obj; }; - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) { - return typeof obj === "undefined" ? "undefined" : _typeof(obj); -} : function (obj) { - return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj); +},{"component-indexof":41,"indexof":41}],41:[function(require,module,exports){ +module.exports = function(arr, obj){ + if (arr.indexOf) return arr.indexOf(obj); + for (var i = 0; i < arr.length; ++i) { + if (arr[i] === obj) return i; + } + return -1; }; -},{"../core-js/symbol":30,"../core-js/symbol/iterator":31}],40:[function(require,module,exports){ +},{}],42:[function(require,module,exports){ require('../../modules/es6.string.iterator'); require('../../modules/es6.array.from'); module.exports = require('../../modules/_core').Array.from; -},{"../../modules/_core":53,"../../modules/es6.array.from":111,"../../modules/es6.string.iterator":118}],41:[function(require,module,exports){ +},{"../../modules/_core":57,"../../modules/es6.array.from":116,"../../modules/es6.string.iterator":123}],43:[function(require,module,exports){ require('../../modules/es6.object.assign'); module.exports = require('../../modules/_core').Object.assign; -},{"../../modules/_core":53,"../../modules/es6.object.assign":113}],42:[function(require,module,exports){ +},{"../../modules/_core":57,"../../modules/es6.object.assign":118}],44:[function(require,module,exports){ require('../../modules/es6.object.create'); var $Object = require('../../modules/_core').Object; module.exports = function create(P, D){ return $Object.create(P, D); }; -},{"../../modules/_core":53,"../../modules/es6.object.create":114}],43:[function(require,module,exports){ +},{"../../modules/_core":57,"../../modules/es6.object.create":119}],45:[function(require,module,exports){ require('../../modules/es6.object.define-property'); var $Object = require('../../modules/_core').Object; module.exports = function defineProperty(it, key, desc){ return $Object.defineProperty(it, key, desc); }; -},{"../../modules/_core":53,"../../modules/es6.object.define-property":115}],44:[function(require,module,exports){ +},{"../../modules/_core":57,"../../modules/es6.object.define-property":120}],46:[function(require,module,exports){ +require('../../modules/es7.object.entries'); +module.exports = require('../../modules/_core').Object.entries; +},{"../../modules/_core":57,"../../modules/es7.object.entries":125}],47:[function(require,module,exports){ require('../../modules/es6.object.set-prototype-of'); module.exports = require('../../modules/_core').Object.setPrototypeOf; -},{"../../modules/_core":53,"../../modules/es6.object.set-prototype-of":116}],45:[function(require,module,exports){ +},{"../../modules/_core":57,"../../modules/es6.object.set-prototype-of":121}],48:[function(require,module,exports){ +require('../../modules/es7.object.values'); +module.exports = require('../../modules/_core').Object.values; +},{"../../modules/_core":57,"../../modules/es7.object.values":126}],49:[function(require,module,exports){ require('../../modules/es6.symbol'); require('../../modules/es6.object.to-string'); require('../../modules/es7.symbol.async-iterator'); require('../../modules/es7.symbol.observable'); module.exports = require('../../modules/_core').Symbol; -},{"../../modules/_core":53,"../../modules/es6.object.to-string":117,"../../modules/es6.symbol":119,"../../modules/es7.symbol.async-iterator":120,"../../modules/es7.symbol.observable":121}],46:[function(require,module,exports){ +},{"../../modules/_core":57,"../../modules/es6.object.to-string":122,"../../modules/es6.symbol":124,"../../modules/es7.symbol.async-iterator":127,"../../modules/es7.symbol.observable":128}],50:[function(require,module,exports){ require('../../modules/es6.string.iterator'); require('../../modules/web.dom.iterable'); module.exports = require('../../modules/_wks-ext').f('iterator'); -},{"../../modules/_wks-ext":108,"../../modules/es6.string.iterator":118,"../../modules/web.dom.iterable":122}],47:[function(require,module,exports){ +},{"../../modules/_wks-ext":113,"../../modules/es6.string.iterator":123,"../../modules/web.dom.iterable":129}],51:[function(require,module,exports){ module.exports = function(it){ if(typeof it != 'function')throw TypeError(it + ' is not a function!'); return it; }; -},{}],48:[function(require,module,exports){ +},{}],52:[function(require,module,exports){ module.exports = function(){ /* empty */ }; -},{}],49:[function(require,module,exports){ +},{}],53:[function(require,module,exports){ var isObject = require('./_is-object'); module.exports = function(it){ if(!isObject(it))throw TypeError(it + ' is not an object!'); return it; }; -},{"./_is-object":71}],50:[function(require,module,exports){ +},{"./_is-object":75}],54:[function(require,module,exports){ // false -> Array#indexOf // true -> Array#includes var toIObject = require('./_to-iobject') @@ -3562,7 +3369,7 @@ module.exports = function(IS_INCLUDES){ } return !IS_INCLUDES && -1; }; }; -},{"./_to-index":100,"./_to-iobject":102,"./_to-length":103}],51:[function(require,module,exports){ +},{"./_to-index":105,"./_to-iobject":107,"./_to-length":108}],55:[function(require,module,exports){ // getting tag from 19.1.3.6 Object.prototype.toString() var cof = require('./_cof') , TAG = require('./_wks')('toStringTag') @@ -3586,16 +3393,16 @@ module.exports = function(it){ // ES3 arguments fallback : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; }; -},{"./_cof":52,"./_wks":109}],52:[function(require,module,exports){ +},{"./_cof":56,"./_wks":114}],56:[function(require,module,exports){ var toString = {}.toString; module.exports = function(it){ return toString.call(it).slice(8, -1); }; -},{}],53:[function(require,module,exports){ +},{}],57:[function(require,module,exports){ var core = module.exports = {version: '2.4.0'}; if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef -},{}],54:[function(require,module,exports){ +},{}],58:[function(require,module,exports){ 'use strict'; var $defineProperty = require('./_object-dp') , createDesc = require('./_property-desc'); @@ -3604,7 +3411,7 @@ module.exports = function(object, index, value){ if(index in object)$defineProperty.f(object, index, createDesc(0, value)); else object[index] = value; }; -},{"./_object-dp":83,"./_property-desc":93}],55:[function(require,module,exports){ +},{"./_object-dp":87,"./_property-desc":98}],59:[function(require,module,exports){ // optional / simple context binding var aFunction = require('./_a-function'); module.exports = function(fn, that, length){ @@ -3625,18 +3432,18 @@ module.exports = function(fn, that, length){ return fn.apply(that, arguments); }; }; -},{"./_a-function":47}],56:[function(require,module,exports){ +},{"./_a-function":51}],60:[function(require,module,exports){ // 7.2.1 RequireObjectCoercible(argument) module.exports = function(it){ if(it == undefined)throw TypeError("Can't call method on " + it); return it; }; -},{}],57:[function(require,module,exports){ +},{}],61:[function(require,module,exports){ // Thank's IE8 for his funny defineProperty module.exports = !require('./_fails')(function(){ return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; }); -},{"./_fails":62}],58:[function(require,module,exports){ +},{"./_fails":66}],62:[function(require,module,exports){ var isObject = require('./_is-object') , document = require('./_global').document // in old IE typeof document.createElement is 'object' @@ -3644,12 +3451,12 @@ var isObject = require('./_is-object') module.exports = function(it){ return is ? document.createElement(it) : {}; }; -},{"./_global":63,"./_is-object":71}],59:[function(require,module,exports){ +},{"./_global":67,"./_is-object":75}],63:[function(require,module,exports){ // IE 8- don't enum bug keys module.exports = ( 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' ).split(','); -},{}],60:[function(require,module,exports){ +},{}],64:[function(require,module,exports){ // all enumerable object keys, includes symbols var getKeys = require('./_object-keys') , gOPS = require('./_object-gops') @@ -3665,7 +3472,7 @@ module.exports = function(it){ while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))result.push(key); } return result; }; -},{"./_object-gops":88,"./_object-keys":91,"./_object-pie":92}],61:[function(require,module,exports){ +},{"./_object-gops":92,"./_object-keys":95,"./_object-pie":96}],65:[function(require,module,exports){ var global = require('./_global') , core = require('./_core') , ctx = require('./_ctx') @@ -3727,7 +3534,7 @@ $export.W = 32; // wrap $export.U = 64; // safe $export.R = 128; // real proto method for `library` module.exports = $export; -},{"./_core":53,"./_ctx":55,"./_global":63,"./_hide":65}],62:[function(require,module,exports){ +},{"./_core":57,"./_ctx":59,"./_global":67,"./_hide":69}],66:[function(require,module,exports){ module.exports = function(exec){ try { return !!exec(); @@ -3735,17 +3542,17 @@ module.exports = function(exec){ return true; } }; -},{}],63:[function(require,module,exports){ +},{}],67:[function(require,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 -},{}],64:[function(require,module,exports){ +},{}],68:[function(require,module,exports){ var hasOwnProperty = {}.hasOwnProperty; module.exports = function(it, key){ return hasOwnProperty.call(it, key); }; -},{}],65:[function(require,module,exports){ +},{}],69:[function(require,module,exports){ var dP = require('./_object-dp') , createDesc = require('./_property-desc'); module.exports = require('./_descriptors') ? function(object, key, value){ @@ -3754,19 +3561,19 @@ module.exports = require('./_descriptors') ? function(object, key, value){ object[key] = value; return object; }; -},{"./_descriptors":57,"./_object-dp":83,"./_property-desc":93}],66:[function(require,module,exports){ +},{"./_descriptors":61,"./_object-dp":87,"./_property-desc":98}],70:[function(require,module,exports){ module.exports = require('./_global').document && document.documentElement; -},{"./_global":63}],67:[function(require,module,exports){ +},{"./_global":67}],71:[function(require,module,exports){ module.exports = !require('./_descriptors') && !require('./_fails')(function(){ return Object.defineProperty(require('./_dom-create')('div'), 'a', {get: function(){ return 7; }}).a != 7; }); -},{"./_descriptors":57,"./_dom-create":58,"./_fails":62}],68:[function(require,module,exports){ +},{"./_descriptors":61,"./_dom-create":62,"./_fails":66}],72:[function(require,module,exports){ // fallback for non-array-like ES3 and non-enumerable old V8 strings var cof = require('./_cof'); module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){ return cof(it) == 'String' ? it.split('') : Object(it); }; -},{"./_cof":52}],69:[function(require,module,exports){ +},{"./_cof":56}],73:[function(require,module,exports){ // check on default Array iterator var Iterators = require('./_iterators') , ITERATOR = require('./_wks')('iterator') @@ -3775,17 +3582,17 @@ var Iterators = require('./_iterators') module.exports = function(it){ return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); }; -},{"./_iterators":77,"./_wks":109}],70:[function(require,module,exports){ +},{"./_iterators":81,"./_wks":114}],74:[function(require,module,exports){ // 7.2.2 IsArray(argument) var cof = require('./_cof'); module.exports = Array.isArray || function isArray(arg){ return cof(arg) == 'Array'; }; -},{"./_cof":52}],71:[function(require,module,exports){ +},{"./_cof":56}],75:[function(require,module,exports){ module.exports = function(it){ return typeof it === 'object' ? it !== null : typeof it === 'function'; }; -},{}],72:[function(require,module,exports){ +},{}],76:[function(require,module,exports){ // call something on iterator step with safe closing on error var anObject = require('./_an-object'); module.exports = function(iterator, fn, value, entries){ @@ -3798,7 +3605,7 @@ module.exports = function(iterator, fn, value, entries){ throw e; } }; -},{"./_an-object":49}],73:[function(require,module,exports){ +},{"./_an-object":53}],77:[function(require,module,exports){ 'use strict'; var create = require('./_object-create') , descriptor = require('./_property-desc') @@ -3812,7 +3619,7 @@ module.exports = function(Constructor, NAME, next){ Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)}); setToStringTag(Constructor, NAME + ' Iterator'); }; -},{"./_hide":65,"./_object-create":82,"./_property-desc":93,"./_set-to-string-tag":96,"./_wks":109}],74:[function(require,module,exports){ +},{"./_hide":69,"./_object-create":86,"./_property-desc":98,"./_set-to-string-tag":101,"./_wks":114}],78:[function(require,module,exports){ 'use strict'; var LIBRARY = require('./_library') , $export = require('./_export') @@ -3883,7 +3690,7 @@ module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED } return methods; }; -},{"./_export":61,"./_has":64,"./_hide":65,"./_iter-create":73,"./_iterators":77,"./_library":79,"./_object-gpo":89,"./_redefine":94,"./_set-to-string-tag":96,"./_wks":109}],75:[function(require,module,exports){ +},{"./_export":65,"./_has":68,"./_hide":69,"./_iter-create":77,"./_iterators":81,"./_library":83,"./_object-gpo":93,"./_redefine":99,"./_set-to-string-tag":101,"./_wks":114}],79:[function(require,module,exports){ var ITERATOR = require('./_wks')('iterator') , SAFE_CLOSING = false; @@ -3905,13 +3712,13 @@ module.exports = function(exec, skipClosing){ } catch(e){ /* empty */ } return safe; }; -},{"./_wks":109}],76:[function(require,module,exports){ +},{"./_wks":114}],80:[function(require,module,exports){ module.exports = function(done, value){ return {value: value, done: !!done}; }; -},{}],77:[function(require,module,exports){ +},{}],81:[function(require,module,exports){ module.exports = {}; -},{}],78:[function(require,module,exports){ +},{}],82:[function(require,module,exports){ var getKeys = require('./_object-keys') , toIObject = require('./_to-iobject'); module.exports = function(object, el){ @@ -3922,9 +3729,9 @@ module.exports = function(object, el){ , key; while(length > index)if(O[key = keys[index++]] === el)return key; }; -},{"./_object-keys":91,"./_to-iobject":102}],79:[function(require,module,exports){ +},{"./_object-keys":95,"./_to-iobject":107}],83:[function(require,module,exports){ module.exports = true; -},{}],80:[function(require,module,exports){ +},{}],84:[function(require,module,exports){ var META = require('./_uid')('meta') , isObject = require('./_is-object') , has = require('./_has') @@ -3978,7 +3785,7 @@ var meta = module.exports = { getWeak: getWeak, onFreeze: onFreeze }; -},{"./_fails":62,"./_has":64,"./_is-object":71,"./_object-dp":83,"./_uid":106}],81:[function(require,module,exports){ +},{"./_fails":66,"./_has":68,"./_is-object":75,"./_object-dp":87,"./_uid":111}],85:[function(require,module,exports){ 'use strict'; // 19.1.2.1 Object.assign(target, source, ...) var getKeys = require('./_object-keys') @@ -4012,7 +3819,7 @@ module.exports = !$assign || require('./_fails')(function(){ while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key]; } return T; } : $assign; -},{"./_fails":62,"./_iobject":68,"./_object-gops":88,"./_object-keys":91,"./_object-pie":92,"./_to-object":104}],82:[function(require,module,exports){ +},{"./_fails":66,"./_iobject":72,"./_object-gops":92,"./_object-keys":95,"./_object-pie":96,"./_to-object":109}],86:[function(require,module,exports){ // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) var anObject = require('./_an-object') , dPs = require('./_object-dps') @@ -4055,7 +3862,7 @@ module.exports = Object.create || function create(O, Properties){ return Properties === undefined ? result : dPs(result, Properties); }; -},{"./_an-object":49,"./_dom-create":58,"./_enum-bug-keys":59,"./_html":66,"./_object-dps":84,"./_shared-key":97}],83:[function(require,module,exports){ +},{"./_an-object":53,"./_dom-create":62,"./_enum-bug-keys":63,"./_html":70,"./_object-dps":88,"./_shared-key":102}],87:[function(require,module,exports){ var anObject = require('./_an-object') , IE8_DOM_DEFINE = require('./_ie8-dom-define') , toPrimitive = require('./_to-primitive') @@ -4072,7 +3879,7 @@ exports.f = require('./_descriptors') ? Object.defineProperty : function defineP if('value' in Attributes)O[P] = Attributes.value; return O; }; -},{"./_an-object":49,"./_descriptors":57,"./_ie8-dom-define":67,"./_to-primitive":105}],84:[function(require,module,exports){ +},{"./_an-object":53,"./_descriptors":61,"./_ie8-dom-define":71,"./_to-primitive":110}],88:[function(require,module,exports){ var dP = require('./_object-dp') , anObject = require('./_an-object') , getKeys = require('./_object-keys'); @@ -4086,7 +3893,7 @@ module.exports = require('./_descriptors') ? Object.defineProperties : function while(length > i)dP.f(O, P = keys[i++], Properties[P]); return O; }; -},{"./_an-object":49,"./_descriptors":57,"./_object-dp":83,"./_object-keys":91}],85:[function(require,module,exports){ +},{"./_an-object":53,"./_descriptors":61,"./_object-dp":87,"./_object-keys":95}],89:[function(require,module,exports){ var pIE = require('./_object-pie') , createDesc = require('./_property-desc') , toIObject = require('./_to-iobject') @@ -4103,7 +3910,7 @@ exports.f = require('./_descriptors') ? gOPD : function getOwnPropertyDescriptor } catch(e){ /* empty */ } if(has(O, P))return createDesc(!pIE.f.call(O, P), O[P]); }; -},{"./_descriptors":57,"./_has":64,"./_ie8-dom-define":67,"./_object-pie":92,"./_property-desc":93,"./_to-iobject":102,"./_to-primitive":105}],86:[function(require,module,exports){ +},{"./_descriptors":61,"./_has":68,"./_ie8-dom-define":71,"./_object-pie":96,"./_property-desc":98,"./_to-iobject":107,"./_to-primitive":110}],90:[function(require,module,exports){ // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window var toIObject = require('./_to-iobject') , gOPN = require('./_object-gopn').f @@ -4124,7 +3931,7 @@ module.exports.f = function getOwnPropertyNames(it){ return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it)); }; -},{"./_object-gopn":87,"./_to-iobject":102}],87:[function(require,module,exports){ +},{"./_object-gopn":91,"./_to-iobject":107}],91:[function(require,module,exports){ // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) var $keys = require('./_object-keys-internal') , hiddenKeys = require('./_enum-bug-keys').concat('length', 'prototype'); @@ -4132,9 +3939,9 @@ var $keys = require('./_object-keys-internal') exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O){ return $keys(O, hiddenKeys); }; -},{"./_enum-bug-keys":59,"./_object-keys-internal":90}],88:[function(require,module,exports){ +},{"./_enum-bug-keys":63,"./_object-keys-internal":94}],92:[function(require,module,exports){ exports.f = Object.getOwnPropertySymbols; -},{}],89:[function(require,module,exports){ +},{}],93:[function(require,module,exports){ // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) var has = require('./_has') , toObject = require('./_to-object') @@ -4148,7 +3955,7 @@ module.exports = Object.getPrototypeOf || function(O){ return O.constructor.prototype; } return O instanceof Object ? ObjectProto : null; }; -},{"./_has":64,"./_shared-key":97,"./_to-object":104}],90:[function(require,module,exports){ +},{"./_has":68,"./_shared-key":102,"./_to-object":109}],94:[function(require,module,exports){ var has = require('./_has') , toIObject = require('./_to-iobject') , arrayIndexOf = require('./_array-includes')(false) @@ -4166,7 +3973,7 @@ module.exports = function(object, names){ } return result; }; -},{"./_array-includes":50,"./_has":64,"./_shared-key":97,"./_to-iobject":102}],91:[function(require,module,exports){ +},{"./_array-includes":54,"./_has":68,"./_shared-key":102,"./_to-iobject":107}],95:[function(require,module,exports){ // 19.1.2.14 / 15.2.3.14 Object.keys(O) var $keys = require('./_object-keys-internal') , enumBugKeys = require('./_enum-bug-keys'); @@ -4174,9 +3981,26 @@ var $keys = require('./_object-keys-internal') module.exports = Object.keys || function keys(O){ return $keys(O, enumBugKeys); }; -},{"./_enum-bug-keys":59,"./_object-keys-internal":90}],92:[function(require,module,exports){ +},{"./_enum-bug-keys":63,"./_object-keys-internal":94}],96:[function(require,module,exports){ exports.f = {}.propertyIsEnumerable; -},{}],93:[function(require,module,exports){ +},{}],97:[function(require,module,exports){ +var getKeys = require('./_object-keys') + , toIObject = require('./_to-iobject') + , isEnum = require('./_object-pie').f; +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; + }; +}; +},{"./_object-keys":95,"./_object-pie":96,"./_to-iobject":107}],98:[function(require,module,exports){ module.exports = function(bitmap, value){ return { enumerable : !(bitmap & 1), @@ -4185,9 +4009,9 @@ module.exports = function(bitmap, value){ value : value }; }; -},{}],94:[function(require,module,exports){ +},{}],99:[function(require,module,exports){ module.exports = require('./_hide'); -},{"./_hide":65}],95:[function(require,module,exports){ +},{"./_hide":69}],100:[function(require,module,exports){ // Works with __proto__ only. Old v8 can't work with null proto objects. /* eslint-disable no-proto */ var isObject = require('./_is-object') @@ -4213,7 +4037,7 @@ module.exports = { }({}, false) : undefined), check: check }; -},{"./_an-object":49,"./_ctx":55,"./_is-object":71,"./_object-gopd":85}],96:[function(require,module,exports){ +},{"./_an-object":53,"./_ctx":59,"./_is-object":75,"./_object-gopd":89}],101:[function(require,module,exports){ var def = require('./_object-dp').f , has = require('./_has') , TAG = require('./_wks')('toStringTag'); @@ -4221,20 +4045,20 @@ var def = require('./_object-dp').f module.exports = function(it, tag, stat){ if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag}); }; -},{"./_has":64,"./_object-dp":83,"./_wks":109}],97:[function(require,module,exports){ +},{"./_has":68,"./_object-dp":87,"./_wks":114}],102:[function(require,module,exports){ var shared = require('./_shared')('keys') , uid = require('./_uid'); module.exports = function(key){ return shared[key] || (shared[key] = uid(key)); }; -},{"./_shared":98,"./_uid":106}],98:[function(require,module,exports){ +},{"./_shared":103,"./_uid":111}],103:[function(require,module,exports){ var global = require('./_global') , SHARED = '__core-js_shared__' , store = global[SHARED] || (global[SHARED] = {}); module.exports = function(key){ return store[key] || (store[key] = {}); }; -},{"./_global":63}],99:[function(require,module,exports){ +},{"./_global":67}],104:[function(require,module,exports){ var toInteger = require('./_to-integer') , defined = require('./_defined'); // true -> String#at @@ -4252,7 +4076,7 @@ module.exports = function(TO_STRING){ : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; }; }; -},{"./_defined":56,"./_to-integer":101}],100:[function(require,module,exports){ +},{"./_defined":60,"./_to-integer":106}],105:[function(require,module,exports){ var toInteger = require('./_to-integer') , max = Math.max , min = Math.min; @@ -4260,34 +4084,34 @@ module.exports = function(index, length){ index = toInteger(index); return index < 0 ? max(index + length, 0) : min(index, length); }; -},{"./_to-integer":101}],101:[function(require,module,exports){ +},{"./_to-integer":106}],106:[function(require,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); }; -},{}],102:[function(require,module,exports){ +},{}],107:[function(require,module,exports){ // to indexed object, toObject with fallback for non-array-like ES3 strings var IObject = require('./_iobject') , defined = require('./_defined'); module.exports = function(it){ return IObject(defined(it)); }; -},{"./_defined":56,"./_iobject":68}],103:[function(require,module,exports){ +},{"./_defined":60,"./_iobject":72}],108:[function(require,module,exports){ // 7.1.15 ToLength var toInteger = require('./_to-integer') , min = Math.min; module.exports = function(it){ return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 }; -},{"./_to-integer":101}],104:[function(require,module,exports){ +},{"./_to-integer":106}],109:[function(require,module,exports){ // 7.1.13 ToObject(argument) var defined = require('./_defined'); module.exports = function(it){ return Object(defined(it)); }; -},{"./_defined":56}],105:[function(require,module,exports){ +},{"./_defined":60}],110:[function(require,module,exports){ // 7.1.1 ToPrimitive(input [, PreferredType]) var isObject = require('./_is-object'); // instead of the ES6 spec version, we didn't implement @@toPrimitive case @@ -4300,13 +4124,13 @@ module.exports = function(it, S){ if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; throw TypeError("Can't convert object to primitive value"); }; -},{"./_is-object":71}],106:[function(require,module,exports){ +},{"./_is-object":75}],111:[function(require,module,exports){ var id = 0 , px = Math.random(); module.exports = function(key){ return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); }; -},{}],107:[function(require,module,exports){ +},{}],112:[function(require,module,exports){ var global = require('./_global') , core = require('./_core') , LIBRARY = require('./_library') @@ -4316,9 +4140,9 @@ module.exports = function(name){ var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); if(name.charAt(0) != '_' && !(name in $Symbol))defineProperty($Symbol, name, {value: wksExt.f(name)}); }; -},{"./_core":53,"./_global":63,"./_library":79,"./_object-dp":83,"./_wks-ext":108}],108:[function(require,module,exports){ +},{"./_core":57,"./_global":67,"./_library":83,"./_object-dp":87,"./_wks-ext":113}],113:[function(require,module,exports){ exports.f = require('./_wks'); -},{"./_wks":109}],109:[function(require,module,exports){ +},{"./_wks":114}],114:[function(require,module,exports){ var store = require('./_shared')('wks') , uid = require('./_uid') , Symbol = require('./_global').Symbol @@ -4330,7 +4154,7 @@ var $exports = module.exports = function(name){ }; $exports.store = store; -},{"./_global":63,"./_shared":98,"./_uid":106}],110:[function(require,module,exports){ +},{"./_global":67,"./_shared":103,"./_uid":111}],115:[function(require,module,exports){ var classof = require('./_classof') , ITERATOR = require('./_wks')('iterator') , Iterators = require('./_iterators'); @@ -4339,7 +4163,7 @@ module.exports = require('./_core').getIteratorMethod = function(it){ || it['@@iterator'] || Iterators[classof(it)]; }; -},{"./_classof":51,"./_core":53,"./_iterators":77,"./_wks":109}],111:[function(require,module,exports){ +},{"./_classof":55,"./_core":57,"./_iterators":81,"./_wks":114}],116:[function(require,module,exports){ 'use strict'; var ctx = require('./_ctx') , $export = require('./_export') @@ -4378,7 +4202,7 @@ $export($export.S + $export.F * !require('./_iter-detect')(function(iter){ Array } }); -},{"./_create-property":54,"./_ctx":55,"./_export":61,"./_is-array-iter":69,"./_iter-call":72,"./_iter-detect":75,"./_to-length":103,"./_to-object":104,"./core.get-iterator-method":110}],112:[function(require,module,exports){ +},{"./_create-property":58,"./_ctx":59,"./_export":65,"./_is-array-iter":73,"./_iter-call":76,"./_iter-detect":79,"./_to-length":108,"./_to-object":109,"./core.get-iterator-method":115}],117:[function(require,module,exports){ 'use strict'; var addToUnscopables = require('./_add-to-unscopables') , step = require('./_iter-step') @@ -4413,26 +4237,26 @@ Iterators.Arguments = Iterators.Array; addToUnscopables('keys'); addToUnscopables('values'); addToUnscopables('entries'); -},{"./_add-to-unscopables":48,"./_iter-define":74,"./_iter-step":76,"./_iterators":77,"./_to-iobject":102}],113:[function(require,module,exports){ +},{"./_add-to-unscopables":52,"./_iter-define":78,"./_iter-step":80,"./_iterators":81,"./_to-iobject":107}],118:[function(require,module,exports){ // 19.1.3.1 Object.assign(target, source) var $export = require('./_export'); $export($export.S + $export.F, 'Object', {assign: require('./_object-assign')}); -},{"./_export":61,"./_object-assign":81}],114:[function(require,module,exports){ +},{"./_export":65,"./_object-assign":85}],119:[function(require,module,exports){ var $export = require('./_export') // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) $export($export.S, 'Object', {create: require('./_object-create')}); -},{"./_export":61,"./_object-create":82}],115:[function(require,module,exports){ +},{"./_export":65,"./_object-create":86}],120:[function(require,module,exports){ var $export = require('./_export'); // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) $export($export.S + $export.F * !require('./_descriptors'), 'Object', {defineProperty: require('./_object-dp').f}); -},{"./_descriptors":57,"./_export":61,"./_object-dp":83}],116:[function(require,module,exports){ +},{"./_descriptors":61,"./_export":65,"./_object-dp":87}],121:[function(require,module,exports){ // 19.1.3.19 Object.setPrototypeOf(O, proto) var $export = require('./_export'); $export($export.S, 'Object', {setPrototypeOf: require('./_set-proto').set}); -},{"./_export":61,"./_set-proto":95}],117:[function(require,module,exports){ -arguments[4][16][0].apply(exports,arguments) -},{"dup":16}],118:[function(require,module,exports){ +},{"./_export":65,"./_set-proto":100}],122:[function(require,module,exports){ +arguments[4][37][0].apply(exports,arguments) +},{"dup":37}],123:[function(require,module,exports){ 'use strict'; var $at = require('./_string-at')(true); @@ -4450,7 +4274,7 @@ require('./_iter-define')(String, 'String', function(iterated){ this._i += point.length; return {value: point, done: false}; }); -},{"./_iter-define":74,"./_string-at":99}],119:[function(require,module,exports){ +},{"./_iter-define":78,"./_string-at":104}],124:[function(require,module,exports){ 'use strict'; // ECMAScript 6 symbols shim var global = require('./_global') @@ -4686,11 +4510,31 @@ setToStringTag($Symbol, 'Symbol'); setToStringTag(Math, 'Math', true); // 24.3.3 JSON[@@toStringTag] setToStringTag(global.JSON, 'JSON', true); -},{"./_an-object":49,"./_descriptors":57,"./_enum-keys":60,"./_export":61,"./_fails":62,"./_global":63,"./_has":64,"./_hide":65,"./_is-array":70,"./_keyof":78,"./_library":79,"./_meta":80,"./_object-create":82,"./_object-dp":83,"./_object-gopd":85,"./_object-gopn":87,"./_object-gopn-ext":86,"./_object-gops":88,"./_object-keys":91,"./_object-pie":92,"./_property-desc":93,"./_redefine":94,"./_set-to-string-tag":96,"./_shared":98,"./_to-iobject":102,"./_to-primitive":105,"./_uid":106,"./_wks":109,"./_wks-define":107,"./_wks-ext":108}],120:[function(require,module,exports){ +},{"./_an-object":53,"./_descriptors":61,"./_enum-keys":64,"./_export":65,"./_fails":66,"./_global":67,"./_has":68,"./_hide":69,"./_is-array":74,"./_keyof":82,"./_library":83,"./_meta":84,"./_object-create":86,"./_object-dp":87,"./_object-gopd":89,"./_object-gopn":91,"./_object-gopn-ext":90,"./_object-gops":92,"./_object-keys":95,"./_object-pie":96,"./_property-desc":98,"./_redefine":99,"./_set-to-string-tag":101,"./_shared":103,"./_to-iobject":107,"./_to-primitive":110,"./_uid":111,"./_wks":114,"./_wks-define":112,"./_wks-ext":113}],125:[function(require,module,exports){ +// https://github.com/tc39/proposal-object-values-entries +var $export = require('./_export') + , $entries = require('./_object-to-array')(true); + +$export($export.S, 'Object', { + entries: function entries(it){ + return $entries(it); + } +}); +},{"./_export":65,"./_object-to-array":97}],126:[function(require,module,exports){ +// https://github.com/tc39/proposal-object-values-entries +var $export = require('./_export') + , $values = require('./_object-to-array')(false); + +$export($export.S, 'Object', { + values: function values(it){ + return $values(it); + } +}); +},{"./_export":65,"./_object-to-array":97}],127:[function(require,module,exports){ require('./_wks-define')('asyncIterator'); -},{"./_wks-define":107}],121:[function(require,module,exports){ +},{"./_wks-define":112}],128:[function(require,module,exports){ require('./_wks-define')('observable'); -},{"./_wks-define":107}],122:[function(require,module,exports){ +},{"./_wks-define":112}],129:[function(require,module,exports){ require('./es6.array.iterator'); var global = require('./_global') , hide = require('./_hide') @@ -4704,4239 +4548,17402 @@ for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList' if(proto && !proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME); Iterators[NAME] = Iterators.Array; } -},{"./_global":63,"./_hide":65,"./_iterators":77,"./_wks":109,"./es6.array.iterator":112}],123:[function(require,module,exports){ -/*! - Copyright (c) 2016 Jed Watson. - Licensed under the MIT License (MIT), see - http://jedwatson.github.io/classnames -*/ -/* global define */ - -(function () { - 'use strict'; - - var hasOwn = {}.hasOwnProperty; - - function classNames () { - var classes = []; - - for (var i = 0; i < arguments.length; i++) { - var arg = arguments[i]; - if (!arg) continue; - - var argType = typeof arg; - - if (argType === 'string' || argType === 'number') { - classes.push(arg); - } else if (Array.isArray(arg)) { - classes.push(classNames.apply(null, arg)); - } else if (argType === 'object') { - for (var key in arg) { - if (hasOwn.call(arg, key) && arg[key]) { - classes.push(key); - } - } - } - } - - return classes.join(' '); - } - - if (typeof module !== 'undefined' && module.exports) { - module.exports = classNames; - } else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) { - // register as 'classnames', consistent with npm package name - define('classnames', [], function () { - return classNames; - }); - } else { - window.classNames = classNames; - } -}()); - -},{}],124:[function(require,module,exports){ +},{"./_global":67,"./_hide":69,"./_iterators":81,"./_wks":114,"./es6.array.iterator":117}],130:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); +var EVENT_NAME_MAP = { + transitionend: { + transition: 'transitionend', + WebkitTransition: 'webkitTransitionEnd', + MozTransition: 'mozTransitionEnd', + OTransition: 'oTransitionEnd', + msTransition: 'MSTransitionEnd' + }, -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - -var _react = require('react'); + animationend: { + animation: 'animationend', + WebkitAnimation: 'webkitAnimationEnd', + MozAnimation: 'mozAnimationEnd', + OAnimation: 'oAnimationEnd', + msAnimation: 'MSAnimationEnd' + } +}; -var _react2 = _interopRequireDefault(_react); +var endEvents = []; -var _placements = require('./placements'); +function detectEvents() { + var testEl = document.createElement('div'); + var style = testEl.style; -var _rcTrigger = require('rc-trigger'); + if (!('AnimationEvent' in window)) { + delete EVENT_NAME_MAP.animationend.animation; + } -var _rcTrigger2 = _interopRequireDefault(_rcTrigger); + if (!('TransitionEvent' in window)) { + delete EVENT_NAME_MAP.transitionend.transition; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + for (var baseEventName in EVENT_NAME_MAP) { + if (EVENT_NAME_MAP.hasOwnProperty(baseEventName)) { + var baseEvents = EVENT_NAME_MAP[baseEventName]; + for (var styleName in baseEvents) { + if (styleName in style) { + endEvents.push(baseEvents[styleName]); + break; + } + } + } + } +} -function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } +if (typeof window !== 'undefined' && typeof document !== 'undefined') { + detectEvents(); +} -var Tooltip = _react2["default"].createClass({ - displayName: 'Tooltip', +function addEventListener(node, eventName, eventListener) { + node.addEventListener(eventName, eventListener, false); +} - propTypes: { - trigger: _react.PropTypes.any, - children: _react.PropTypes.any, - defaultVisible: _react.PropTypes.bool, - visible: _react.PropTypes.bool, - placement: _react.PropTypes.string, - transitionName: _react.PropTypes.string, - animation: _react.PropTypes.any, - onVisibleChange: _react.PropTypes.func, - afterVisibleChange: _react.PropTypes.func, - overlay: _react.PropTypes.oneOfType([_react2["default"].PropTypes.node, _react2["default"].PropTypes.func]).isRequired, - overlayStyle: _react.PropTypes.object, - overlayClassName: _react.PropTypes.string, - prefixCls: _react.PropTypes.string, - mouseEnterDelay: _react.PropTypes.number, - mouseLeaveDelay: _react.PropTypes.number, - getTooltipContainer: _react.PropTypes.func, - destroyTooltipOnHide: _react.PropTypes.bool, - align: _react.PropTypes.object, - arrowContent: _react.PropTypes.any - }, +function removeEventListener(node, eventName, eventListener) { + node.removeEventListener(eventName, eventListener, false); +} - getDefaultProps: function getDefaultProps() { - return { - prefixCls: 'rc-tooltip', - mouseEnterDelay: 0, - destroyTooltipOnHide: false, - mouseLeaveDelay: 0.1, - align: {}, - placement: 'right', - trigger: ['hover'], - arrowContent: null - }; +var TransitionEvents = { + addEndEventListener: function addEndEventListener(node, eventListener) { + if (endEvents.length === 0) { + window.setTimeout(eventListener, 0); + return; + } + endEvents.forEach(function (endEvent) { + addEventListener(node, endEvent, eventListener); + }); }, - getPopupElement: function getPopupElement() { - var _props = this.props; - var arrowContent = _props.arrowContent; - var overlay = _props.overlay; - var prefixCls = _props.prefixCls; - return [_react2["default"].createElement( - 'div', - { className: prefixCls + '-arrow', key: 'arrow' }, - arrowContent - ), _react2["default"].createElement( - 'div', - { className: prefixCls + '-inner', key: 'content' }, - typeof overlay === 'function' ? overlay() : overlay - )]; - }, - getPopupDomNode: function getPopupDomNode() { - return this.refs.trigger.getPopupDomNode(); - }, - render: function render() { - var _props2 = this.props; - var overlayClassName = _props2.overlayClassName; - var trigger = _props2.trigger; - var mouseEnterDelay = _props2.mouseEnterDelay; - var mouseLeaveDelay = _props2.mouseLeaveDelay; - var overlayStyle = _props2.overlayStyle; - var prefixCls = _props2.prefixCls; - var children = _props2.children; - var onVisibleChange = _props2.onVisibleChange; - var transitionName = _props2.transitionName; - var animation = _props2.animation; - var placement = _props2.placement; - var align = _props2.align; - var destroyTooltipOnHide = _props2.destroyTooltipOnHide; - var defaultVisible = _props2.defaultVisible; - var getTooltipContainer = _props2.getTooltipContainer; - var restProps = _objectWithoutProperties(_props2, ['overlayClassName', 'trigger', 'mouseEnterDelay', 'mouseLeaveDelay', 'overlayStyle', 'prefixCls', 'children', 'onVisibleChange', 'transitionName', 'animation', 'placement', 'align', 'destroyTooltipOnHide', 'defaultVisible', 'getTooltipContainer']); + endEvents: endEvents, - var extraProps = _extends({}, restProps); - if ('visible' in this.props) { - extraProps.popupVisible = this.props.visible; + removeEndEventListener: function removeEndEventListener(node, eventListener) { + if (endEvents.length === 0) { + return; } - return _react2["default"].createElement( - _rcTrigger2["default"], - _extends({ - popupClassName: overlayClassName, - ref: 'trigger', - prefixCls: prefixCls, - popup: this.getPopupElement, - action: trigger, - builtinPlacements: _placements.placements, - popupPlacement: placement, - popupAlign: align, - getPopupContainer: getTooltipContainer, - onPopupVisibleChange: onVisibleChange, - popupTransitionName: transitionName, - popupAnimation: animation, - defaultPopupVisible: defaultVisible, - destroyPopupOnHide: destroyTooltipOnHide, - mouseLeaveDelay: mouseLeaveDelay, - popupStyle: overlayStyle, - mouseEnterDelay: mouseEnterDelay - }, extraProps), - children - ); + endEvents.forEach(function (endEvent) { + removeEventListener(node, endEvent, eventListener); + }); } -}); +}; -exports["default"] = Tooltip; +exports["default"] = TransitionEvents; module.exports = exports['default']; -},{"./placements":126,"rc-trigger":131,"react":585}],125:[function(require,module,exports){ -'use strict'; - -module.exports = require('./Tooltip'); -},{"./Tooltip":124}],126:[function(require,module,exports){ +},{}],131:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); -var autoAdjustOverflow = { - adjustX: 1, - adjustY: 1 -}; - -var targetOffset = [0, 0]; -var placements = exports.placements = { - left: { - points: ['cr', 'cl'], - overflow: autoAdjustOverflow, - offset: [-4, 0], - targetOffset: targetOffset - }, - right: { - points: ['cl', 'cr'], - overflow: autoAdjustOverflow, - offset: [4, 0], - targetOffset: targetOffset - }, - top: { - points: ['bc', 'tc'], - overflow: autoAdjustOverflow, - offset: [0, -4], - targetOffset: targetOffset - }, - bottom: { - points: ['tc', 'bc'], - overflow: autoAdjustOverflow, - offset: [0, 4], - targetOffset: targetOffset - }, - topLeft: { - points: ['bl', 'tl'], - overflow: autoAdjustOverflow, - offset: [0, -4], - targetOffset: targetOffset - }, - leftTop: { - points: ['tr', 'tl'], - overflow: autoAdjustOverflow, - offset: [-4, 0], - targetOffset: targetOffset - }, - topRight: { - points: ['br', 'tr'], - overflow: autoAdjustOverflow, - offset: [0, -4], - targetOffset: targetOffset - }, - rightTop: { - points: ['tl', 'tr'], - overflow: autoAdjustOverflow, - offset: [4, 0], - targetOffset: targetOffset - }, - bottomRight: { - points: ['tr', 'br'], - overflow: autoAdjustOverflow, - offset: [0, 4], - targetOffset: targetOffset - }, - rightBottom: { - points: ['bl', 'br'], - overflow: autoAdjustOverflow, - offset: [4, 0], - targetOffset: targetOffset - }, - bottomLeft: { - points: ['tl', 'bl'], - overflow: autoAdjustOverflow, - offset: [0, 4], - targetOffset: targetOffset - }, - leftBottom: { - points: ['br', 'bl'], - overflow: autoAdjustOverflow, - offset: [-4, 0], - targetOffset: targetOffset - } -}; +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; -exports["default"] = placements; -},{}],127:[function(require,module,exports){ -'use strict'; +var _Event = require('./Event'); -Object.defineProperty(exports, "__esModule", { - value: true -}); +var _Event2 = _interopRequireDefault(_Event); -var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties'); +var _componentClasses = require('component-classes'); -var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2); +var _componentClasses2 = _interopRequireDefault(_componentClasses); -var _react = require('react'); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } -var _react2 = _interopRequireDefault(_react); +var isCssAnimationSupported = _Event2["default"].endEvents.length !== 0; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } -var LazyRenderBox = _react2["default"].createClass({ - displayName: 'LazyRenderBox', +var capitalPrefixes = ['Webkit', 'Moz', 'O', +// ms is special .... ! +'ms']; +var prefixes = ['-webkit-', '-moz-', '-o-', 'ms-', '']; - propTypes: { - children: _react.PropTypes.any, - className: _react.PropTypes.string, - visible: _react.PropTypes.bool, - hiddenClassName: _react.PropTypes.string - }, - shouldComponentUpdate: function shouldComponentUpdate(nextProps) { - return nextProps.hiddenClassName || nextProps.visible; - }, - render: function render() { - var _props = this.props; - var hiddenClassName = _props.hiddenClassName; - var visible = _props.visible; - var props = (0, _objectWithoutProperties3["default"])(_props, ['hiddenClassName', 'visible']); +function getStyleProperty(node, name) { + var style = window.getComputedStyle(node); + var ret = ''; + for (var i = 0; i < prefixes.length; i++) { + ret = style.getPropertyValue(prefixes[i] + name); + if (ret) { + break; + } + } + return ret; +} - if (hiddenClassName || _react2["default"].Children.count(props.children) > 1) { - if (!visible && hiddenClassName) { - props.className += ' ' + hiddenClassName; +function fixBrowserByTimeout(node) { + if (isCssAnimationSupported) { + var transitionDelay = parseFloat(getStyleProperty(node, 'transition-delay')) || 0; + var transitionDuration = parseFloat(getStyleProperty(node, 'transition-duration')) || 0; + var animationDelay = parseFloat(getStyleProperty(node, 'animation-delay')) || 0; + var animationDuration = parseFloat(getStyleProperty(node, 'animation-duration')) || 0; + var time = Math.max(transitionDuration + transitionDelay, animationDuration + animationDelay); + // sometimes, browser bug + node.rcEndAnimTimeout = setTimeout(function () { + node.rcEndAnimTimeout = null; + if (node.rcEndListener) { + node.rcEndListener(); } - return _react2["default"].createElement('div', props); - } + }, time * 1000 + 200); + } +} - return _react2["default"].Children.only(props.children); +function clearBrowserBugTimeout(node) { + if (node.rcEndAnimTimeout) { + clearTimeout(node.rcEndAnimTimeout); + node.rcEndAnimTimeout = null; } -}); +} -exports["default"] = LazyRenderBox; -module.exports = exports['default']; -},{"babel-runtime/helpers/objectWithoutProperties":36,"react":585}],128:[function(require,module,exports){ -'use strict'; +var cssAnimation = function cssAnimation(node, transitionName, endCallback) { + var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object'; + var className = nameIsObj ? transitionName.name : transitionName; + var activeClassName = nameIsObj ? transitionName.active : transitionName + '-active'; + var end = endCallback; + var start = void 0; + var active = void 0; + var nodeClasses = (0, _componentClasses2["default"])(node); -Object.defineProperty(exports, "__esModule", { - value: true -}); + if (endCallback && Object.prototype.toString.call(endCallback) === '[object Object]') { + end = endCallback.end; + start = endCallback.start; + active = endCallback.active; + } -var _extends2 = require('babel-runtime/helpers/extends'); + if (node.rcEndListener) { + node.rcEndListener(); + } -var _extends3 = _interopRequireDefault(_extends2); + node.rcEndListener = function (e) { + if (e && e.target !== node) { + return; + } -var _react = require('react'); + if (node.rcAnimTimeout) { + clearTimeout(node.rcAnimTimeout); + node.rcAnimTimeout = null; + } -var _react2 = _interopRequireDefault(_react); + clearBrowserBugTimeout(node); -var _reactDom = require('react-dom'); + nodeClasses.remove(className); + nodeClasses.remove(activeClassName); -var _reactDom2 = _interopRequireDefault(_reactDom); + _Event2["default"].removeEndEventListener(node, node.rcEndListener); + node.rcEndListener = null; -var _rcAlign = require('rc-align'); + // Usually this optional end is used for informing an owner of + // a leave animation and telling it to remove the child. + if (end) { + end(); + } + }; -var _rcAlign2 = _interopRequireDefault(_rcAlign); + _Event2["default"].addEndEventListener(node, node.rcEndListener); -var _rcAnimate = require('rc-animate'); + if (start) { + start(); + } + nodeClasses.add(className); -var _rcAnimate2 = _interopRequireDefault(_rcAnimate); + node.rcAnimTimeout = setTimeout(function () { + node.rcAnimTimeout = null; + nodeClasses.add(activeClassName); + if (active) { + setTimeout(active, 0); + } + fixBrowserByTimeout(node); + // 30ms for firefox + }, 30); -var _PopupInner = require('./PopupInner'); + return { + stop: function stop() { + if (node.rcEndListener) { + node.rcEndListener(); + } + } + }; +}; -var _PopupInner2 = _interopRequireDefault(_PopupInner); +cssAnimation.style = function (node, style, callback) { + if (node.rcEndListener) { + node.rcEndListener(); + } -var _LazyRenderBox = require('./LazyRenderBox'); + node.rcEndListener = function (e) { + if (e && e.target !== node) { + return; + } -var _LazyRenderBox2 = _interopRequireDefault(_LazyRenderBox); + if (node.rcAnimTimeout) { + clearTimeout(node.rcAnimTimeout); + node.rcAnimTimeout = null; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + clearBrowserBugTimeout(node); -var Popup = _react2["default"].createClass({ - displayName: 'Popup', + _Event2["default"].removeEndEventListener(node, node.rcEndListener); + node.rcEndListener = null; - propTypes: { - visible: _react.PropTypes.bool, - style: _react.PropTypes.object, - getClassNameFromAlign: _react.PropTypes.func, - onAlign: _react.PropTypes.func, - getRootDomNode: _react.PropTypes.func, - onMouseEnter: _react.PropTypes.func, - align: _react.PropTypes.any, - destroyPopupOnHide: _react.PropTypes.bool, - className: _react.PropTypes.string, - prefixCls: _react.PropTypes.string, - onMouseLeave: _react.PropTypes.func - }, + // Usually this optional callback is used for informing an owner of + // a leave animation and telling it to remove the child. + if (callback) { + callback(); + } + }; - componentDidMount: function componentDidMount() { - this.rootNode = this.getPopupDomNode(); - }, - onAlign: function onAlign(popupDomNode, align) { - var props = this.props; - var alignClassName = props.getClassNameFromAlign(props.align); - var currentAlignClassName = props.getClassNameFromAlign(align); - if (alignClassName !== currentAlignClassName) { - this.currentAlignClassName = currentAlignClassName; - popupDomNode.className = this.getClassName(currentAlignClassName); + _Event2["default"].addEndEventListener(node, node.rcEndListener); + + node.rcAnimTimeout = setTimeout(function () { + for (var s in style) { + if (style.hasOwnProperty(s)) { + node.style[s] = style[s]; + } } - props.onAlign(popupDomNode, align); - }, - getPopupDomNode: function getPopupDomNode() { - return _reactDom2["default"].findDOMNode(this.refs.popup); - }, - getTarget: function getTarget() { - return this.props.getRootDomNode(); - }, - getMaskTransitionName: function getMaskTransitionName() { - var props = this.props; - var transitionName = props.maskTransitionName; - var animation = props.maskAnimation; - if (!transitionName && animation) { - transitionName = props.prefixCls + '-' + animation; + node.rcAnimTimeout = null; + fixBrowserByTimeout(node); + }, 0); +}; + +cssAnimation.setTransition = function (node, p, value) { + var property = p; + var v = value; + if (value === undefined) { + v = property; + property = ''; + } + property = property || ''; + capitalPrefixes.forEach(function (prefix) { + node.style[prefix + 'Transition' + property] = v; + }); +}; + +cssAnimation.isCssAnimationSupported = isCssAnimationSupported; + +exports["default"] = cssAnimation; +module.exports = exports['default']; +},{"./Event":130,"component-classes":40}],132:[function(require,module,exports){ +// https://d3js.org/d3-array/ Version 1.0.1. Copyright 2016 Mike Bostock. +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (factory((global.d3 = global.d3 || {}))); +}(this, function (exports) { 'use strict'; + + function ascending(a, b) { + return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; + } + + function bisector(compare) { + if (compare.length === 1) compare = ascendingComparator(compare); + return { + left: function(a, x, lo, hi) { + if (lo == null) lo = 0; + if (hi == null) hi = a.length; + while (lo < hi) { + var mid = lo + hi >>> 1; + if (compare(a[mid], x) < 0) lo = mid + 1; + else hi = mid; + } + return lo; + }, + right: function(a, x, lo, hi) { + if (lo == null) lo = 0; + if (hi == null) hi = a.length; + while (lo < hi) { + var mid = lo + hi >>> 1; + if (compare(a[mid], x) > 0) hi = mid; + else lo = mid + 1; + } + return lo; + } + }; + } + + function ascendingComparator(f) { + return function(d, x) { + return ascending(f(d), x); + }; + } + + var ascendingBisect = bisector(ascending); + var bisectRight = ascendingBisect.right; + var bisectLeft = ascendingBisect.left; + + function descending(a, b) { + return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; + } + + function number(x) { + return x === null ? NaN : +x; + } + + function variance(array, f) { + var n = array.length, + m = 0, + a, + d, + s = 0, + i = -1, + j = 0; + + if (f == null) { + while (++i < n) { + if (!isNaN(a = number(array[i]))) { + d = a - m; + m += d / ++j; + s += d * (a - m); + } + } } - return transitionName; - }, - getTransitionName: function getTransitionName() { - var props = this.props; - var transitionName = props.transitionName; - if (!transitionName && props.animation) { - transitionName = props.prefixCls + '-' + props.animation; + + else { + while (++i < n) { + if (!isNaN(a = number(f(array[i], i, array)))) { + d = a - m; + m += d / ++j; + s += d * (a - m); + } + } } - return transitionName; - }, - getClassName: function getClassName(currentAlignClassName) { - return this.props.prefixCls + ' ' + this.props.className + ' ' + currentAlignClassName; - }, - getPopupElement: function getPopupElement() { - var props = this.props; - var align = props.align; - var style = props.style; - var visible = props.visible; - var prefixCls = props.prefixCls; - var destroyPopupOnHide = props.destroyPopupOnHide; - var className = this.getClassName(this.currentAlignClassName || props.getClassNameFromAlign(align)); - var hiddenClassName = prefixCls + '-hidden'; - if (!visible) { - this.currentAlignClassName = null; + if (j > 1) return s / (j - 1); + } + + function deviation(array, f) { + var v = variance(array, f); + return v ? Math.sqrt(v) : v; + } + + function extent(array, f) { + var i = -1, + n = array.length, + a, + b, + c; + + if (f == null) { + while (++i < n) if ((b = array[i]) != null && b >= b) { a = c = b; break; } + while (++i < n) if ((b = array[i]) != null) { + if (a > b) a = b; + if (c < b) c = b; + } } - var newStyle = (0, _extends3["default"])({}, style, this.getZIndexStyle()); - var popupInnerProps = { - className: className, - prefixCls: prefixCls, - ref: 'popup', - onMouseEnter: props.onMouseEnter, - onMouseLeave: props.onMouseLeave, - style: newStyle + + else { + while (++i < n) if ((b = f(array[i], i, array)) != null && b >= b) { a = c = b; break; } + while (++i < n) if ((b = f(array[i], i, array)) != null) { + if (a > b) a = b; + if (c < b) c = b; + } + } + + return [a, c]; + } + + var array = Array.prototype; + + var slice = array.slice; + var map = array.map; + + function constant(x) { + return function() { + return x; }; - if (destroyPopupOnHide) { - return _react2["default"].createElement( - _rcAnimate2["default"], - { - component: '', - exclusive: true, - transitionAppear: true, - transitionName: this.getTransitionName() - }, - visible ? _react2["default"].createElement( - _rcAlign2["default"], - { - target: this.getTarget, - key: 'popup', - ref: this.saveAlign, - monitorWindowResize: true, - align: align, - onAlign: this.onAlign - }, - _react2["default"].createElement( - _PopupInner2["default"], - (0, _extends3["default"])({ - visible: true - }, popupInnerProps), - props.children - ) - ) : null - ); + } + + function identity(x) { + return x; + } + + function range(start, stop, step) { + start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; + + var i = -1, + n = Math.max(0, Math.ceil((stop - start) / step)) | 0, + range = new Array(n); + + while (++i < n) { + range[i] = start + i * step; } - return _react2["default"].createElement( - _rcAnimate2["default"], - { - component: '', - exclusive: true, - transitionAppear: true, - transitionName: this.getTransitionName(), - showProp: 'xVisible' - }, - _react2["default"].createElement( - _rcAlign2["default"], - { - target: this.getTarget, - key: 'popup', - ref: this.saveAlign, - monitorWindowResize: true, - xVisible: visible, - childrenProps: { visible: 'xVisible' }, - disabled: !visible, - align: align, - onAlign: this.onAlign - }, - _react2["default"].createElement( - _PopupInner2["default"], - (0, _extends3["default"])({ - hiddenClassName: hiddenClassName - }, popupInnerProps), - props.children - ) - ) + + return range; + } + + var e10 = Math.sqrt(50); + var e5 = Math.sqrt(10); + var e2 = Math.sqrt(2); + function ticks(start, stop, count) { + var step = tickStep(start, stop, count); + return range( + Math.ceil(start / step) * step, + Math.floor(stop / step) * step + step / 2, // inclusive + step ); - }, - getZIndexStyle: function getZIndexStyle() { - var style = {}; - var props = this.props; - if (props.zIndex !== undefined) { - style.zIndex = props.zIndex; - } - return style; - }, - getMaskElement: function getMaskElement() { - var props = this.props; - var maskElement = void 0; - if (props.mask) { - var maskTransition = this.getMaskTransitionName(); - maskElement = _react2["default"].createElement(_LazyRenderBox2["default"], { - style: this.getZIndexStyle(), - key: 'mask', - className: props.prefixCls + '-mask', - hiddenClassName: props.prefixCls + '-mask-hidden', - visible: props.visible - }); - if (maskTransition) { - maskElement = _react2["default"].createElement( - _rcAnimate2["default"], - { - key: 'mask', - showProp: 'visible', - transitionAppear: true, - component: '', - transitionName: maskTransition - }, - maskElement - ); + } + + function tickStep(start, stop, count) { + var step0 = Math.abs(stop - start) / Math.max(0, count), + step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), + error = step0 / step1; + if (error >= e10) step1 *= 10; + else if (error >= e5) step1 *= 5; + else if (error >= e2) step1 *= 2; + return stop < start ? -step1 : step1; + } + + function sturges(values) { + return Math.ceil(Math.log(values.length) / Math.LN2) + 1; + } + + function histogram() { + var value = identity, + domain = extent, + threshold = sturges; + + function histogram(data) { + var i, + n = data.length, + x, + values = new Array(n); + + for (i = 0; i < n; ++i) { + values[i] = value(data[i], i, data); + } + + var xz = domain(values), + x0 = xz[0], + x1 = xz[1], + tz = threshold(values, x0, x1); + + // Convert number of thresholds into uniform thresholds. + if (!Array.isArray(tz)) tz = ticks(x0, x1, tz); + + // Remove any thresholds outside the domain. + var m = tz.length; + while (tz[0] <= x0) tz.shift(), --m; + while (tz[m - 1] >= x1) tz.pop(), --m; + + var bins = new Array(m + 1), + bin; + + // Initialize bins. + for (i = 0; i <= m; ++i) { + bin = bins[i] = []; + bin.x0 = i > 0 ? tz[i - 1] : x0; + bin.x1 = i < m ? tz[i] : x1; + } + + // Assign data to bins by value, ignoring any outside the domain. + for (i = 0; i < n; ++i) { + x = values[i]; + if (x0 <= x && x <= x1) { + bins[bisectRight(tz, x, 0, m)].push(data[i]); + } } + + return bins; } - return maskElement; - }, - saveAlign: function saveAlign(align) { - this.alignInstance = align; - }, - render: function render() { - return _react2["default"].createElement( - 'div', - null, - this.getMaskElement(), - this.getPopupElement() - ); + + histogram.value = function(_) { + return arguments.length ? (value = typeof _ === "function" ? _ : constant(_), histogram) : value; + }; + + histogram.domain = function(_) { + return arguments.length ? (domain = typeof _ === "function" ? _ : constant([_[0], _[1]]), histogram) : domain; + }; + + histogram.thresholds = function(_) { + return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), histogram) : threshold; + }; + + return histogram; } -}); -exports["default"] = Popup; -module.exports = exports['default']; -},{"./LazyRenderBox":127,"./PopupInner":129,"babel-runtime/helpers/extends":34,"rc-align":134,"rc-animate":148,"react":585,"react-dom":416}],129:[function(require,module,exports){ -'use strict'; + function quantile(array, p, f) { + if (f == null) f = number; + if (!(n = array.length)) return; + if ((p = +p) <= 0 || n < 2) return +f(array[0], 0, array); + if (p >= 1) return +f(array[n - 1], n - 1, array); + var n, + h = (n - 1) * p, + i = Math.floor(h), + a = +f(array[i], i, array), + b = +f(array[i + 1], i + 1, array); + return a + (b - a) * (h - i); + } -Object.defineProperty(exports, "__esModule", { - value: true -}); + function freedmanDiaconis(values, min, max) { + values = map.call(values, number).sort(ascending); + return Math.ceil((max - min) / (2 * (quantile(values, 0.75) - quantile(values, 0.25)) * Math.pow(values.length, -1 / 3))); + } -var _react = require('react'); + function scott(values, min, max) { + return Math.ceil((max - min) / (3.5 * deviation(values) * Math.pow(values.length, -1 / 3))); + } -var _react2 = _interopRequireDefault(_react); + function max(array, f) { + var i = -1, + n = array.length, + a, + b; -var _LazyRenderBox = require('./LazyRenderBox'); + if (f == null) { + while (++i < n) if ((b = array[i]) != null && b >= b) { a = b; break; } + while (++i < n) if ((b = array[i]) != null && b > a) a = b; + } -var _LazyRenderBox2 = _interopRequireDefault(_LazyRenderBox); + else { + while (++i < n) if ((b = f(array[i], i, array)) != null && b >= b) { a = b; break; } + while (++i < n) if ((b = f(array[i], i, array)) != null && b > a) a = b; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + return a; + } -var PopupInner = _react2["default"].createClass({ - displayName: 'PopupInner', + function mean(array, f) { + var s = 0, + n = array.length, + a, + i = -1, + j = n; - propTypes: { - hiddenClassName: _react.PropTypes.string, - className: _react.PropTypes.string, - prefixCls: _react.PropTypes.string, - onMouseEnter: _react.PropTypes.func, - onMouseLeave: _react.PropTypes.func, - children: _react.PropTypes.any - }, - render: function render() { - var props = this.props; - var className = props.className; - if (!props.visible) { - className += ' ' + props.hiddenClassName; + if (f == null) { + while (++i < n) if (!isNaN(a = number(array[i]))) s += a; else --j; } - return _react2["default"].createElement( - 'div', - { - className: className, - onMouseEnter: props.onMouseEnter, - onMouseLeave: props.onMouseLeave, - style: props.style - }, - _react2["default"].createElement( - _LazyRenderBox2["default"], - { className: props.prefixCls + '-content', visible: props.visible }, - props.children - ) - ); + + else { + while (++i < n) if (!isNaN(a = number(f(array[i], i, array)))) s += a; else --j; + } + + if (j) return s / j; } -}); -exports["default"] = PopupInner; -module.exports = exports['default']; -},{"./LazyRenderBox":127,"react":585}],130:[function(require,module,exports){ -'use strict'; + function median(array, f) { + var numbers = [], + n = array.length, + a, + i = -1; -Object.defineProperty(exports, "__esModule", { - value: true -}); + if (f == null) { + while (++i < n) if (!isNaN(a = number(array[i]))) numbers.push(a); + } -var _extends2 = require('babel-runtime/helpers/extends'); + else { + while (++i < n) if (!isNaN(a = number(f(array[i], i, array)))) numbers.push(a); + } -var _extends3 = _interopRequireDefault(_extends2); + return quantile(numbers.sort(ascending), 0.5); + } -var _react = require('react'); + function merge(arrays) { + var n = arrays.length, + m, + i = -1, + j = 0, + merged, + array; -var _react2 = _interopRequireDefault(_react); + while (++i < n) j += arrays[i].length; + merged = new Array(j); -var _reactDom = require('react-dom'); + while (--n >= 0) { + array = arrays[n]; + m = array.length; + while (--m >= 0) { + merged[--j] = array[m]; + } + } -var _reactDom2 = _interopRequireDefault(_reactDom); + return merged; + } -var _contains = require('rc-util/lib/Dom/contains'); + function min(array, f) { + var i = -1, + n = array.length, + a, + b; -var _contains2 = _interopRequireDefault(_contains); + if (f == null) { + while (++i < n) if ((b = array[i]) != null && b >= b) { a = b; break; } + while (++i < n) if ((b = array[i]) != null && a > b) a = b; + } -var _addEventListener = require('rc-util/lib/Dom/addEventListener'); + else { + while (++i < n) if ((b = f(array[i], i, array)) != null && b >= b) { a = b; break; } + while (++i < n) if ((b = f(array[i], i, array)) != null && a > b) a = b; + } -var _addEventListener2 = _interopRequireDefault(_addEventListener); + return a; + } -var _Popup = require('./Popup'); + function pairs(array) { + var i = 0, n = array.length - 1, p = array[0], pairs = new Array(n < 0 ? 0 : n); + while (i < n) pairs[i] = [p, p = array[++i]]; + return pairs; + } -var _Popup2 = _interopRequireDefault(_Popup); + function permute(array, indexes) { + var i = indexes.length, permutes = new Array(i); + while (i--) permutes[i] = array[indexes[i]]; + return permutes; + } -var _utils = require('./utils'); + function scan(array, compare) { + if (!(n = array.length)) return; + var i = 0, + n, + j = 0, + xi, + xj = array[j]; -var _getContainerRenderMixin = require('rc-util/lib/getContainerRenderMixin'); + if (!compare) compare = ascending; -var _getContainerRenderMixin2 = _interopRequireDefault(_getContainerRenderMixin); + while (++i < n) if (compare(xi = array[i], xj) < 0 || compare(xj, xj) !== 0) xj = xi, j = i; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + if (compare(xj, xj) === 0) return j; + } -function noop() {} + function shuffle(array, i0, i1) { + var m = (i1 == null ? array.length : i1) - (i0 = i0 == null ? 0 : +i0), + t, + i; -function returnEmptyString() { - return ''; -} + while (m) { + i = Math.random() * m-- | 0; + t = array[m + i0]; + array[m + i0] = array[i + i0]; + array[i + i0] = t; + } -var ALL_HANDLERS = ['onClick', 'onMouseDown', 'onTouchStart', 'onMouseEnter', 'onMouseLeave', 'onFocus', 'onBlur']; + return array; + } -var Trigger = _react2["default"].createClass({ - displayName: 'Trigger', + function sum(array, f) { + var s = 0, + n = array.length, + a, + i = -1; - propTypes: { - children: _react.PropTypes.any, - action: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.arrayOf(_react.PropTypes.string)]), - showAction: _react.PropTypes.any, - hideAction: _react.PropTypes.any, - getPopupClassNameFromAlign: _react.PropTypes.any, - onPopupVisibleChange: _react.PropTypes.func, - afterPopupVisibleChange: _react.PropTypes.func, - popup: _react.PropTypes.oneOfType([_react.PropTypes.node, _react.PropTypes.func]).isRequired, - popupStyle: _react.PropTypes.object, - prefixCls: _react.PropTypes.string, - popupClassName: _react.PropTypes.string, - popupPlacement: _react.PropTypes.string, - builtinPlacements: _react.PropTypes.object, - popupTransitionName: _react.PropTypes.string, - popupAnimation: _react.PropTypes.any, - mouseEnterDelay: _react.PropTypes.number, - mouseLeaveDelay: _react.PropTypes.number, - zIndex: _react.PropTypes.number, - focusDelay: _react.PropTypes.number, - blurDelay: _react.PropTypes.number, - getPopupContainer: _react.PropTypes.func, - destroyPopupOnHide: _react.PropTypes.bool, - mask: _react.PropTypes.bool, - maskClosable: _react.PropTypes.bool, - onPopupAlign: _react.PropTypes.func, - popupAlign: _react.PropTypes.object, - popupVisible: _react.PropTypes.bool, - maskTransitionName: _react.PropTypes.string, - maskAnimation: _react.PropTypes.string - }, + if (f == null) { + while (++i < n) if (a = +array[i]) s += a; // Note: zero and null are equivalent. + } - mixins: [(0, _getContainerRenderMixin2["default"])({ - autoMount: false, + else { + while (++i < n) if (a = +f(array[i], i, array)) s += a; + } - isVisible: function isVisible(instance) { - return instance.state.popupVisible; + return s; + } + + function transpose(matrix) { + if (!(n = matrix.length)) return []; + for (var i = -1, m = min(matrix, length), transpose = new Array(m); ++i < m;) { + for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n;) { + row[j] = matrix[j][i]; + } + } + return transpose; + } + + function length(d) { + return d.length; + } + + function zip() { + return transpose(arguments); + } + + exports.bisect = bisectRight; + exports.bisectRight = bisectRight; + exports.bisectLeft = bisectLeft; + exports.ascending = ascending; + exports.bisector = bisector; + exports.descending = descending; + exports.deviation = deviation; + exports.extent = extent; + exports.histogram = histogram; + exports.thresholdFreedmanDiaconis = freedmanDiaconis; + exports.thresholdScott = scott; + exports.thresholdSturges = sturges; + exports.max = max; + exports.mean = mean; + exports.median = median; + exports.merge = merge; + exports.min = min; + exports.pairs = pairs; + exports.permute = permute; + exports.quantile = quantile; + exports.range = range; + exports.scan = scan; + exports.shuffle = shuffle; + exports.sum = sum; + exports.ticks = ticks; + exports.tickStep = tickStep; + exports.transpose = transpose; + exports.variance = variance; + exports.zip = zip; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); +},{}],133:[function(require,module,exports){ +// https://d3js.org/d3-collection/ Version 1.0.1. Copyright 2016 Mike Bostock. +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (factory((global.d3 = global.d3 || {}))); +}(this, function (exports) { 'use strict'; + + var prefix = "$"; + + function Map() {} + + Map.prototype = map.prototype = { + constructor: Map, + has: function(key) { + return (prefix + key) in this; }, - getContainer: function getContainer(instance) { - var popupContainer = document.createElement('div'); - var mountNode = instance.props.getPopupContainer ? instance.props.getPopupContainer((0, _reactDom.findDOMNode)(instance)) : document.body; - mountNode.appendChild(popupContainer); - return popupContainer; + get: function(key) { + return this[prefix + key]; }, - getComponent: function getComponent(instance) { - var props = instance.props; - var state = instance.state; + set: function(key, value) { + this[prefix + key] = value; + return this; + }, + remove: function(key) { + var property = prefix + key; + return property in this && delete this[property]; + }, + clear: function() { + for (var property in this) if (property[0] === prefix) delete this[property]; + }, + keys: function() { + var keys = []; + for (var property in this) if (property[0] === prefix) keys.push(property.slice(1)); + return keys; + }, + values: function() { + var values = []; + for (var property in this) if (property[0] === prefix) values.push(this[property]); + return values; + }, + entries: function() { + var entries = []; + for (var property in this) if (property[0] === prefix) entries.push({key: property.slice(1), value: this[property]}); + return entries; + }, + size: function() { + var size = 0; + for (var property in this) if (property[0] === prefix) ++size; + return size; + }, + empty: function() { + for (var property in this) if (property[0] === prefix) return false; + return true; + }, + each: function(f) { + for (var property in this) if (property[0] === prefix) f(this[property], property.slice(1), this); + } + }; - var mouseProps = {}; - if (instance.isMouseEnterToShow()) { - mouseProps.onMouseEnter = instance.onPopupMouseEnter; - } - if (instance.isMouseLeaveToHide()) { - mouseProps.onMouseLeave = instance.onPopupMouseLeave; + function map(object, f) { + var map = new Map; + + // Copy constructor. + if (object instanceof Map) object.each(function(value, key) { map.set(key, value); }); + + // Index array by numeric index or specified key function. + else if (Array.isArray(object)) { + var i = -1, + n = object.length, + o; + + if (f == null) while (++i < n) map.set(i, object[i]); + else while (++i < n) map.set(f(o = object[i], i, object), o); + } + + // Convert object to map. + else if (object) for (var key in object) map.set(key, object[key]); + + return map; + } + + function nest() { + var keys = [], + sortKeys = [], + sortValues, + rollup, + nest; + + function apply(array, depth, createResult, setResult) { + if (depth >= keys.length) return rollup != null + ? rollup(array) : (sortValues != null + ? array.sort(sortValues) + : array); + + var i = -1, + n = array.length, + key = keys[depth++], + keyValue, + value, + valuesByKey = map(), + values, + result = createResult(); + + while (++i < n) { + if (values = valuesByKey.get(keyValue = key(value = array[i]) + "")) { + values.push(value); + } else { + valuesByKey.set(keyValue, [value]); + } } - return _react2["default"].createElement( - _Popup2["default"], - (0, _extends3["default"])({ - prefixCls: props.prefixCls, - destroyPopupOnHide: props.destroyPopupOnHide, - visible: state.popupVisible, - className: props.popupClassName, - action: props.action, - align: instance.getPopupAlign(), - onAlign: props.onPopupAlign, - animation: props.popupAnimation, - getClassNameFromAlign: instance.getPopupClassNameFromAlign - }, mouseProps, { - getRootDomNode: instance.getRootDomNode, - style: props.popupStyle, - mask: props.mask, - zIndex: props.zIndex, - transitionName: props.popupTransitionName, - maskAnimation: props.maskAnimation, - maskTransitionName: props.maskTransitionName - }), - typeof props.popup === 'function' ? props.popup() : props.popup - ); + + valuesByKey.each(function(values, key) { + setResult(result, key, apply(values, depth, createResult, setResult)); + }); + + return result; } - })], - getDefaultProps: function getDefaultProps() { - return { - prefixCls: 'rc-trigger-popup', - getPopupClassNameFromAlign: returnEmptyString, - onPopupVisibleChange: noop, - afterPopupVisibleChange: noop, - onPopupAlign: noop, - popupClassName: '', - mouseEnterDelay: 0, - mouseLeaveDelay: 0.1, - focusDelay: 0, - blurDelay: 0.15, - popupStyle: {}, - destroyPopupOnHide: false, - popupAlign: {}, - defaultPopupVisible: false, - mask: false, - maskClosable: true, - action: [], - showAction: [], - hideAction: [] - }; - }, - getInitialState: function getInitialState() { - var props = this.props; - var popupVisible = void 0; - if ('popupVisible' in props) { - popupVisible = !!props.popupVisible; - } else { - popupVisible = !!props.defaultPopupVisible; + function entries(map, depth) { + if (++depth > keys.length) return map; + var array, sortKey = sortKeys[depth - 1]; + if (rollup != null && depth >= keys.length) array = map.entries(); + else array = [], map.each(function(v, k) { array.push({key: k, values: entries(v, depth)}); }); + return sortKey != null ? array.sort(function(a, b) { return sortKey(a.key, b.key); }) : array; } - return { - popupVisible: popupVisible + + return nest = { + object: function(array) { return apply(array, 0, createObject, setObject); }, + map: function(array) { return apply(array, 0, createMap, setMap); }, + entries: function(array) { return entries(apply(array, 0, createMap, setMap), 0); }, + key: function(d) { keys.push(d); return nest; }, + sortKeys: function(order) { sortKeys[keys.length - 1] = order; return nest; }, + sortValues: function(order) { sortValues = order; return nest; }, + rollup: function(f) { rollup = f; return nest; } }; - }, - componentWillMount: function componentWillMount() { - var _this = this; + } - ALL_HANDLERS.forEach(function (h) { - _this['fire' + h] = function (e) { - _this.fireEvents(h, e); - }; - }); - }, - componentDidMount: function componentDidMount() { - this.componentDidUpdate({}, { - popupVisible: this.state.popupVisible - }); - }, - componentWillReceiveProps: function componentWillReceiveProps(_ref) { - var popupVisible = _ref.popupVisible; + function createObject() { + return {}; + } - if (popupVisible !== undefined) { - this.setState({ - popupVisible: popupVisible - }); - } - }, - componentDidUpdate: function componentDidUpdate(_, prevState) { - var props = this.props; - var state = this.state; - this.renderComponent(null, function () { - if (prevState.popupVisible !== state.popupVisible) { - props.afterPopupVisibleChange(state.popupVisible); - } - }); - if (this.isClickToHide()) { - if (state.popupVisible) { - if (!this.clickOutsideHandler) { - this.clickOutsideHandler = (0, _addEventListener2["default"])(document, 'mousedown', this.onDocumentClick); - this.touchOutsideHandler = (0, _addEventListener2["default"])(document, 'touchstart', this.onDocumentClick); - } - return; - } - } - if (this.clickOutsideHandler) { - this.clickOutsideHandler.remove(); - this.touchOutsideHandler.remove(); - this.clickOutsideHandler = null; - this.touchOutsideHandler = null; - } - }, - componentWillUnmount: function componentWillUnmount() { - this.clearDelayTimer(); - if (this.clickOutsideHandler) { - this.clickOutsideHandler.remove(); - this.touchOutsideHandler.remove(); - this.clickOutsideHandler = null; - this.touchOutsideHandler = null; - } - }, - onMouseEnter: function onMouseEnter(e) { - this.fireEvents('onMouseEnter', e); - this.delaySetPopupVisible(true, this.props.mouseEnterDelay); - }, - onMouseLeave: function onMouseLeave(e) { - this.fireEvents('onMouseLeave', e); - this.delaySetPopupVisible(false, this.props.mouseLeaveDelay); - }, - onPopupMouseEnter: function onPopupMouseEnter() { - this.clearDelayTimer(); - }, - onPopupMouseLeave: function onPopupMouseLeave(e) { - // https://github.com/react-component/trigger/pull/13 - // react bug? - if (e.relatedTarget && !e.relatedTarget.setTimeout && this._component && (0, _contains2["default"])(this._component.getPopupDomNode(), e.relatedTarget)) { - return; - } - this.delaySetPopupVisible(false, this.props.mouseLeaveDelay); - }, - onFocus: function onFocus(e) { - this.fireEvents('onFocus', e); - // incase focusin and focusout - this.clearDelayTimer(); - if (this.isFocusToShow()) { - this.focusTime = Date.now(); - this.delaySetPopupVisible(true, this.props.focusDelay); - } - }, - onMouseDown: function onMouseDown(e) { - this.fireEvents('onMouseDown', e); - this.preClickTime = Date.now(); - }, - onTouchStart: function onTouchStart(e) { - this.fireEvents('onTouchStart', e); - this.preTouchTime = Date.now(); - }, - onBlur: function onBlur(e) { - this.fireEvents('onBlur', e); - this.clearDelayTimer(); - if (this.isBlurToHide()) { - this.delaySetPopupVisible(false, this.props.blurDelay); - } - }, - onClick: function onClick(event) { - this.fireEvents('onClick', event); - // focus will trigger click - if (this.focusTime) { - var preTime = void 0; - if (this.preClickTime && this.preTouchTime) { - preTime = Math.min(this.preClickTime, this.preTouchTime); - } else if (this.preClickTime) { - preTime = this.preClickTime; - } else if (this.preTouchTime) { - preTime = this.preTouchTime; - } - if (Math.abs(preTime - this.focusTime) < 20) { - return; - } - this.focusTime = 0; - } - this.preClickTime = 0; - this.preTouchTime = 0; - event.preventDefault(); - var nextVisible = !this.state.popupVisible; - if (this.isClickToHide() && !nextVisible || nextVisible && this.isClickToShow()) { - this.setPopupVisible(!this.state.popupVisible); - } - }, - onDocumentClick: function onDocumentClick(event) { - if (this.props.mask && !this.props.maskClosable) { - return; - } - var target = event.target; - var root = (0, _reactDom.findDOMNode)(this); - var popupNode = this.getPopupDomNode(); - if (!(0, _contains2["default"])(root, target) && !(0, _contains2["default"])(popupNode, target)) { - this.close(); - } - }, - getPopupDomNode: function getPopupDomNode() { - // for test - if (this._component) { - return this._component.isMounted() ? this._component.getPopupDomNode() : null; - } - return null; - }, - getRootDomNode: function getRootDomNode() { - return _reactDom2["default"].findDOMNode(this); - }, - getPopupClassNameFromAlign: function getPopupClassNameFromAlign(align) { - var className = []; - var props = this.props; - var popupPlacement = props.popupPlacement; - var builtinPlacements = props.builtinPlacements; - var prefixCls = props.prefixCls; + function setObject(object, key, value) { + object[key] = value; + } - if (popupPlacement && builtinPlacements) { - className.push((0, _utils.getPopupClassNameFromAlign)(builtinPlacements, prefixCls, align)); - } - if (props.getPopupClassNameFromAlign) { - className.push(props.getPopupClassNameFromAlign(align)); - } - return className.join(' '); - }, - getPopupAlign: function getPopupAlign() { - var props = this.props; - var popupPlacement = props.popupPlacement; - var popupAlign = props.popupAlign; - var builtinPlacements = props.builtinPlacements; + function createMap() { + return map(); + } - if (popupPlacement && builtinPlacements) { - return (0, _utils.getAlignFromPlacement)(builtinPlacements, popupPlacement, popupAlign); - } - return popupAlign; - }, - setPopupVisible: function setPopupVisible(popupVisible) { - this.clearDelayTimer(); - if (this.state.popupVisible !== popupVisible) { - if (!('popupVisible' in this.props)) { - this.setState({ - popupVisible: popupVisible - }); - } - this.props.onPopupVisibleChange(popupVisible); - } - }, - delaySetPopupVisible: function delaySetPopupVisible(visible, delayS) { - var _this2 = this; + function setMap(map, key, value) { + map.set(key, value); + } - var delay = delayS * 1000; - this.clearDelayTimer(); - if (delay) { - this.delayTimer = setTimeout(function () { - _this2.setPopupVisible(visible); - _this2.clearDelayTimer(); - }, delay); - } else { - this.setPopupVisible(visible); - } - }, - clearDelayTimer: function clearDelayTimer() { - if (this.delayTimer) { - clearTimeout(this.delayTimer); - this.delayTimer = null; - } - }, - createTwoChains: function createTwoChains(event) { - var childPros = this.props.children.props; - var props = this.props; - if (childPros[event] && props[event]) { - return this['fire' + event]; + function Set() {} + + var proto = map.prototype; + + Set.prototype = set.prototype = { + constructor: Set, + has: proto.has, + add: function(value) { + value += ""; + this[prefix + value] = value; + return this; + }, + remove: proto.remove, + clear: proto.clear, + values: proto.keys, + size: proto.size, + empty: proto.empty, + each: proto.each + }; + + function set(object, f) { + var set = new Set; + + // Copy constructor. + if (object instanceof Set) object.each(function(value) { set.add(value); }); + + // Otherwise, assume it’s an array. + else if (object) { + var i = -1, n = object.length; + if (f == null) while (++i < n) set.add(object[i]); + else while (++i < n) set.add(f(object[i], i, object)); + } + + return set; + } + + function keys(map) { + var keys = []; + for (var key in map) keys.push(key); + return keys; + } + + function values(map) { + var values = []; + for (var key in map) values.push(map[key]); + return values; + } + + function entries(map) { + var entries = []; + for (var key in map) entries.push({key: key, value: map[key]}); + return entries; + } + + exports.nest = nest; + exports.set = set; + exports.map = map; + exports.keys = keys; + exports.values = values; + exports.entries = entries; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); +},{}],134:[function(require,module,exports){ +// https://d3js.org/d3-color/ Version 1.0.1. Copyright 2016 Mike Bostock. +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (factory((global.d3 = global.d3 || {}))); +}(this, function (exports) { 'use strict'; + + function define(constructor, factory, prototype) { + constructor.prototype = factory.prototype = prototype; + prototype.constructor = constructor; + } + + function extend(parent, definition) { + var prototype = Object.create(parent.prototype); + for (var key in definition) prototype[key] = definition[key]; + return prototype; + } + + function Color() {} + + var darker = 0.7; + var brighter = 1 / darker; + + var reHex3 = /^#([0-9a-f]{3})$/; + var reHex6 = /^#([0-9a-f]{6})$/; + var reRgbInteger = /^rgb\(\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*\)$/; + var reRgbPercent = /^rgb\(\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/; + var reRgbaInteger = /^rgba\(\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/; + var reRgbaPercent = /^rgba\(\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/; + var reHslPercent = /^hsl\(\s*([-+]?\d+(?:\.\d+)?)\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/; + var reHslaPercent = /^hsla\(\s*([-+]?\d+(?:\.\d+)?)\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/; + var named = { + aliceblue: 0xf0f8ff, + antiquewhite: 0xfaebd7, + aqua: 0x00ffff, + aquamarine: 0x7fffd4, + azure: 0xf0ffff, + beige: 0xf5f5dc, + bisque: 0xffe4c4, + black: 0x000000, + blanchedalmond: 0xffebcd, + blue: 0x0000ff, + blueviolet: 0x8a2be2, + brown: 0xa52a2a, + burlywood: 0xdeb887, + cadetblue: 0x5f9ea0, + chartreuse: 0x7fff00, + chocolate: 0xd2691e, + coral: 0xff7f50, + cornflowerblue: 0x6495ed, + cornsilk: 0xfff8dc, + crimson: 0xdc143c, + cyan: 0x00ffff, + darkblue: 0x00008b, + darkcyan: 0x008b8b, + darkgoldenrod: 0xb8860b, + darkgray: 0xa9a9a9, + darkgreen: 0x006400, + darkgrey: 0xa9a9a9, + darkkhaki: 0xbdb76b, + darkmagenta: 0x8b008b, + darkolivegreen: 0x556b2f, + darkorange: 0xff8c00, + darkorchid: 0x9932cc, + darkred: 0x8b0000, + darksalmon: 0xe9967a, + darkseagreen: 0x8fbc8f, + darkslateblue: 0x483d8b, + darkslategray: 0x2f4f4f, + darkslategrey: 0x2f4f4f, + darkturquoise: 0x00ced1, + darkviolet: 0x9400d3, + deeppink: 0xff1493, + deepskyblue: 0x00bfff, + dimgray: 0x696969, + dimgrey: 0x696969, + dodgerblue: 0x1e90ff, + firebrick: 0xb22222, + floralwhite: 0xfffaf0, + forestgreen: 0x228b22, + fuchsia: 0xff00ff, + gainsboro: 0xdcdcdc, + ghostwhite: 0xf8f8ff, + gold: 0xffd700, + goldenrod: 0xdaa520, + gray: 0x808080, + green: 0x008000, + greenyellow: 0xadff2f, + grey: 0x808080, + honeydew: 0xf0fff0, + hotpink: 0xff69b4, + indianred: 0xcd5c5c, + indigo: 0x4b0082, + ivory: 0xfffff0, + khaki: 0xf0e68c, + lavender: 0xe6e6fa, + lavenderblush: 0xfff0f5, + lawngreen: 0x7cfc00, + lemonchiffon: 0xfffacd, + lightblue: 0xadd8e6, + lightcoral: 0xf08080, + lightcyan: 0xe0ffff, + lightgoldenrodyellow: 0xfafad2, + lightgray: 0xd3d3d3, + lightgreen: 0x90ee90, + lightgrey: 0xd3d3d3, + lightpink: 0xffb6c1, + lightsalmon: 0xffa07a, + lightseagreen: 0x20b2aa, + lightskyblue: 0x87cefa, + lightslategray: 0x778899, + lightslategrey: 0x778899, + lightsteelblue: 0xb0c4de, + lightyellow: 0xffffe0, + lime: 0x00ff00, + limegreen: 0x32cd32, + linen: 0xfaf0e6, + magenta: 0xff00ff, + maroon: 0x800000, + mediumaquamarine: 0x66cdaa, + mediumblue: 0x0000cd, + mediumorchid: 0xba55d3, + mediumpurple: 0x9370db, + mediumseagreen: 0x3cb371, + mediumslateblue: 0x7b68ee, + mediumspringgreen: 0x00fa9a, + mediumturquoise: 0x48d1cc, + mediumvioletred: 0xc71585, + midnightblue: 0x191970, + mintcream: 0xf5fffa, + mistyrose: 0xffe4e1, + moccasin: 0xffe4b5, + navajowhite: 0xffdead, + navy: 0x000080, + oldlace: 0xfdf5e6, + olive: 0x808000, + olivedrab: 0x6b8e23, + orange: 0xffa500, + orangered: 0xff4500, + orchid: 0xda70d6, + palegoldenrod: 0xeee8aa, + palegreen: 0x98fb98, + paleturquoise: 0xafeeee, + palevioletred: 0xdb7093, + papayawhip: 0xffefd5, + peachpuff: 0xffdab9, + peru: 0xcd853f, + pink: 0xffc0cb, + plum: 0xdda0dd, + powderblue: 0xb0e0e6, + purple: 0x800080, + rebeccapurple: 0x663399, + red: 0xff0000, + rosybrown: 0xbc8f8f, + royalblue: 0x4169e1, + saddlebrown: 0x8b4513, + salmon: 0xfa8072, + sandybrown: 0xf4a460, + seagreen: 0x2e8b57, + seashell: 0xfff5ee, + sienna: 0xa0522d, + silver: 0xc0c0c0, + skyblue: 0x87ceeb, + slateblue: 0x6a5acd, + slategray: 0x708090, + slategrey: 0x708090, + snow: 0xfffafa, + springgreen: 0x00ff7f, + steelblue: 0x4682b4, + tan: 0xd2b48c, + teal: 0x008080, + thistle: 0xd8bfd8, + tomato: 0xff6347, + turquoise: 0x40e0d0, + violet: 0xee82ee, + wheat: 0xf5deb3, + white: 0xffffff, + whitesmoke: 0xf5f5f5, + yellow: 0xffff00, + yellowgreen: 0x9acd32 + }; + + define(Color, color, { + displayable: function() { + return this.rgb().displayable(); + }, + toString: function() { + return this.rgb() + ""; } - return childPros[event] || props[event]; - }, - isClickToShow: function isClickToShow() { - var _props = this.props; - var action = _props.action; - var showAction = _props.showAction; + }); - return action.indexOf('click') !== -1 || showAction.indexOf('click') !== -1; - }, - isClickToHide: function isClickToHide() { - var _props2 = this.props; - var action = _props2.action; - var hideAction = _props2.hideAction; + function color(format) { + var m; + format = (format + "").trim().toLowerCase(); + return (m = reHex3.exec(format)) ? (m = parseInt(m[1], 16), new Rgb((m >> 8 & 0xf) | (m >> 4 & 0x0f0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1)) // #f00 + : (m = reHex6.exec(format)) ? rgbn(parseInt(m[1], 16)) // #ff0000 + : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) + : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) + : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) + : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) + : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) + : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1) + : named.hasOwnProperty(format) ? rgbn(named[format]) + : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) + : null; + } - return action.indexOf('click') !== -1 || hideAction.indexOf('click') !== -1; - }, - isMouseEnterToShow: function isMouseEnterToShow() { - var _props3 = this.props; - var action = _props3.action; - var showAction = _props3.showAction; + function rgbn(n) { + return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1); + } - return action.indexOf('hover') !== -1 || showAction.indexOf('mouseEnter') !== -1; - }, - isMouseLeaveToHide: function isMouseLeaveToHide() { - var _props4 = this.props; - var action = _props4.action; - var hideAction = _props4.hideAction; + function rgba(r, g, b, a) { + if (a <= 0) r = g = b = NaN; + return new Rgb(r, g, b, a); + } - return action.indexOf('hover') !== -1 || hideAction.indexOf('mouseLeave') !== -1; - }, - isFocusToShow: function isFocusToShow() { - var _props5 = this.props; - var action = _props5.action; - var showAction = _props5.showAction; + function rgbConvert(o) { + if (!(o instanceof Color)) o = color(o); + if (!o) return new Rgb; + o = o.rgb(); + return new Rgb(o.r, o.g, o.b, o.opacity); + } - return action.indexOf('focus') !== -1 || showAction.indexOf('focus') !== -1; - }, - isBlurToHide: function isBlurToHide() { - var _props6 = this.props; - var action = _props6.action; - var hideAction = _props6.hideAction; + function rgb(r, g, b, opacity) { + return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); + } - return action.indexOf('focus') !== -1 || hideAction.indexOf('blur') !== -1; - }, - forcePopupAlign: function forcePopupAlign() { - if (this.state.popupVisible && this.popupInstance && this.popupInstance.alignInstance) { - this.popupInstance.alignInstance.forceAlign(); - } - }, - fireEvents: function fireEvents(type, e) { - var childCallback = this.props.children.props[type]; - if (childCallback) { - childCallback(e); - } - var callback = this.props[type]; - if (callback) { - callback(e); - } - }, - close: function close() { - this.setPopupVisible(false); - }, - render: function render() { - var props = this.props; - var children = props.children; - var child = _react2["default"].Children.only(children); - var newChildProps = {}; + function Rgb(r, g, b, opacity) { + this.r = +r; + this.g = +g; + this.b = +b; + this.opacity = +opacity; + } - if (this.isClickToHide() || this.isClickToShow()) { - newChildProps.onClick = this.onClick; - newChildProps.onMouseDown = this.onMouseDown; - newChildProps.onTouchStart = this.onTouchStart; - } else { - newChildProps.onClick = this.createTwoChains('onClick'); - newChildProps.onMouseDown = this.createTwoChains('onMouseDown'); - newChildProps.onTouchStart = this.createTwoChains('onTouchStart'); - } - if (this.isMouseEnterToShow()) { - newChildProps.onMouseEnter = this.onMouseEnter; - } else { - newChildProps.onMouseEnter = this.createTwoChains('onMouseEnter'); - } - if (this.isMouseLeaveToHide()) { - newChildProps.onMouseLeave = this.onMouseLeave; + define(Rgb, rgb, extend(Color, { + brighter: function(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); + }, + darker: function(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); + }, + rgb: function() { + return this; + }, + displayable: function() { + return (0 <= this.r && this.r <= 255) + && (0 <= this.g && this.g <= 255) + && (0 <= this.b && this.b <= 255) + && (0 <= this.opacity && this.opacity <= 1); + }, + toString: function() { + var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a)); + return (a === 1 ? "rgb(" : "rgba(") + + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", " + + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", " + + Math.max(0, Math.min(255, Math.round(this.b) || 0)) + + (a === 1 ? ")" : ", " + a + ")"); + } + })); + + function hsla(h, s, l, a) { + if (a <= 0) h = s = l = NaN; + else if (l <= 0 || l >= 1) h = s = NaN; + else if (s <= 0) h = NaN; + return new Hsl(h, s, l, a); + } + + function hslConvert(o) { + if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); + if (!(o instanceof Color)) o = color(o); + if (!o) return new Hsl; + if (o instanceof Hsl) return o; + o = o.rgb(); + var r = o.r / 255, + g = o.g / 255, + b = o.b / 255, + min = Math.min(r, g, b), + max = Math.max(r, g, b), + h = NaN, + s = max - min, + l = (max + min) / 2; + if (s) { + if (r === max) h = (g - b) / s + (g < b) * 6; + else if (g === max) h = (b - r) / s + 2; + else h = (r - g) / s + 4; + s /= l < 0.5 ? max + min : 2 - max - min; + h *= 60; } else { - newChildProps.onMouseLeave = this.createTwoChains('onMouseLeave'); + s = l > 0 && l < 1 ? 0 : h; } - if (this.isFocusToShow() || this.isBlurToHide()) { - newChildProps.onFocus = this.onFocus; - newChildProps.onBlur = this.onBlur; - } else { - newChildProps.onFocus = this.createTwoChains('onFocus'); - newChildProps.onBlur = this.createTwoChains('onBlur'); + return new Hsl(h, s, l, o.opacity); + } + + function hsl(h, s, l, opacity) { + return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); + } + + function Hsl(h, s, l, opacity) { + this.h = +h; + this.s = +s; + this.l = +l; + this.opacity = +opacity; + } + + define(Hsl, hsl, extend(Color, { + brighter: function(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Hsl(this.h, this.s, this.l * k, this.opacity); + }, + darker: function(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Hsl(this.h, this.s, this.l * k, this.opacity); + }, + rgb: function() { + var h = this.h % 360 + (this.h < 0) * 360, + s = isNaN(h) || isNaN(this.s) ? 0 : this.s, + l = this.l, + m2 = l + (l < 0.5 ? l : 1 - l) * s, + m1 = 2 * l - m2; + return new Rgb( + hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), + hsl2rgb(h, m1, m2), + hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), + this.opacity + ); + }, + displayable: function() { + return (0 <= this.s && this.s <= 1 || isNaN(this.s)) + && (0 <= this.l && this.l <= 1) + && (0 <= this.opacity && this.opacity <= 1); + } + })); + + /* From FvD 13.37, CSS Color Module Level 3 */ + function hsl2rgb(h, m1, m2) { + return (h < 60 ? m1 + (m2 - m1) * h / 60 + : h < 180 ? m2 + : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 + : m1) * 255; + } + + var deg2rad = Math.PI / 180; + var rad2deg = 180 / Math.PI; + + var Kn = 18; + var Xn = 0.950470; + var Yn = 1; + var Zn = 1.088830; + var t0 = 4 / 29; + var t1 = 6 / 29; + var t2 = 3 * t1 * t1; + var t3 = t1 * t1 * t1; + function labConvert(o) { + if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity); + if (o instanceof Hcl) { + var h = o.h * deg2rad; + return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity); + } + if (!(o instanceof Rgb)) o = rgbConvert(o); + var b = rgb2xyz(o.r), + a = rgb2xyz(o.g), + l = rgb2xyz(o.b), + x = xyz2lab((0.4124564 * b + 0.3575761 * a + 0.1804375 * l) / Xn), + y = xyz2lab((0.2126729 * b + 0.7151522 * a + 0.0721750 * l) / Yn), + z = xyz2lab((0.0193339 * b + 0.1191920 * a + 0.9503041 * l) / Zn); + return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity); + } + + function lab(l, a, b, opacity) { + return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity); + } + + function Lab(l, a, b, opacity) { + this.l = +l; + this.a = +a; + this.b = +b; + this.opacity = +opacity; + } + + define(Lab, lab, extend(Color, { + brighter: function(k) { + return new Lab(this.l + Kn * (k == null ? 1 : k), this.a, this.b, this.opacity); + }, + darker: function(k) { + return new Lab(this.l - Kn * (k == null ? 1 : k), this.a, this.b, this.opacity); + }, + rgb: function() { + var y = (this.l + 16) / 116, + x = isNaN(this.a) ? y : y + this.a / 500, + z = isNaN(this.b) ? y : y - this.b / 200; + y = Yn * lab2xyz(y); + x = Xn * lab2xyz(x); + z = Zn * lab2xyz(z); + return new Rgb( + xyz2rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z), // D65 -> sRGB + xyz2rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z), + xyz2rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z), + this.opacity + ); } + })); - return _react2["default"].cloneElement(child, newChildProps); + function xyz2lab(t) { + return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0; } -}); -exports["default"] = Trigger; -module.exports = exports['default']; -},{"./Popup":128,"./utils":132,"babel-runtime/helpers/extends":34,"rc-util/lib/Dom/addEventListener":154,"rc-util/lib/Dom/contains":155,"rc-util/lib/getContainerRenderMixin":156,"react":585,"react-dom":416}],131:[function(require,module,exports){ -'use strict'; + function lab2xyz(t) { + return t > t1 ? t * t * t : t2 * (t - t0); + } -module.exports = require('./Trigger'); -},{"./Trigger":130}],132:[function(require,module,exports){ -'use strict'; + function xyz2rgb(x) { + return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055); + } -Object.defineProperty(exports, "__esModule", { - value: true -}); + function rgb2xyz(x) { + return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4); + } -var _extends2 = require('babel-runtime/helpers/extends'); + function hclConvert(o) { + if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity); + if (!(o instanceof Lab)) o = labConvert(o); + var h = Math.atan2(o.b, o.a) * rad2deg; + return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity); + } -var _extends3 = _interopRequireDefault(_extends2); + function hcl(h, c, l, opacity) { + return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity); + } -exports.getAlignFromPlacement = getAlignFromPlacement; -exports.getPopupClassNameFromAlign = getPopupClassNameFromAlign; + function Hcl(h, c, l, opacity) { + this.h = +h; + this.c = +c; + this.l = +l; + this.opacity = +opacity; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + define(Hcl, hcl, extend(Color, { + brighter: function(k) { + return new Hcl(this.h, this.c, this.l + Kn * (k == null ? 1 : k), this.opacity); + }, + darker: function(k) { + return new Hcl(this.h, this.c, this.l - Kn * (k == null ? 1 : k), this.opacity); + }, + rgb: function() { + return labConvert(this).rgb(); + } + })); + + var A = -0.14861; + var B = +1.78277; + var C = -0.29227; + var D = -0.90649; + var E = +1.97294; + var ED = E * D; + var EB = E * B; + var BC_DA = B * C - D * A; + function cubehelixConvert(o) { + if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity); + if (!(o instanceof Rgb)) o = rgbConvert(o); + var r = o.r / 255, + g = o.g / 255, + b = o.b / 255, + l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), + bl = b - l, + k = (E * (g - l) - C * bl) / D, + s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1 + h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN; + return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity); + } + + function cubehelix(h, s, l, opacity) { + return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity); + } + + function Cubehelix(h, s, l, opacity) { + this.h = +h; + this.s = +s; + this.l = +l; + this.opacity = +opacity; + } + + define(Cubehelix, cubehelix, extend(Color, { + brighter: function(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Cubehelix(this.h, this.s, this.l * k, this.opacity); + }, + darker: function(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Cubehelix(this.h, this.s, this.l * k, this.opacity); + }, + rgb: function() { + var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad, + l = +this.l, + a = isNaN(this.s) ? 0 : this.s * l * (1 - l), + cosh = Math.cos(h), + sinh = Math.sin(h); + return new Rgb( + 255 * (l + a * (A * cosh + B * sinh)), + 255 * (l + a * (C * cosh + D * sinh)), + 255 * (l + a * (E * cosh)), + this.opacity + ); + } + })); + + exports.color = color; + exports.rgb = rgb; + exports.hsl = hsl; + exports.lab = lab; + exports.hcl = hcl; + exports.cubehelix = cubehelix; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); +},{}],135:[function(require,module,exports){ +// https://d3js.org/d3-format/ Version 1.0.2. Copyright 2016 Mike Bostock. +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (factory((global.d3 = global.d3 || {}))); +}(this, function (exports) { 'use strict'; + + // Computes the decimal coefficient and exponent of the specified number x with + // significant digits p, where x is positive and p is in [1, 21] or undefined. + // For example, formatDecimal(1.23) returns ["123", 0]. + function formatDecimal(x, p) { + if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity + var i, coefficient = x.slice(0, i); + + // The string returned by toExponential either has the form \d\.\d+e[-+]\d+ + // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3). + return [ + coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, + +x.slice(i + 1) + ]; + } + + function exponent(x) { + return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN; + } + + function formatGroup(grouping, thousands) { + return function(value, width) { + var i = value.length, + t = [], + j = 0, + g = grouping[0], + length = 0; + + while (i > 0 && g > 0) { + if (length + g + 1 > width) g = Math.max(1, width - length); + t.push(value.substring(i -= g, i + g)); + if ((length += g + 1) > width) break; + g = grouping[j = (j + 1) % grouping.length]; + } + + return t.reverse().join(thousands); + }; + } -function isPointsEq(a1, a2) { - return a1[0] === a2[0] && a1[1] === a2[1]; -} + function formatDefault(x, p) { + x = x.toPrecision(p); + + out: for (var n = x.length, i = 1, i0 = -1, i1; i < n; ++i) { + switch (x[i]) { + case ".": i0 = i1 = i; break; + case "0": if (i0 === 0) i0 = i; i1 = i; break; + case "e": break out; + default: if (i0 > 0) i0 = 0; break; + } + } -function getAlignFromPlacement(builtinPlacements, placementStr, align) { - var baseAlign = builtinPlacements[placementStr] || {}; - return (0, _extends3["default"])({}, baseAlign, align); -} + return i0 > 0 ? x.slice(0, i0) + x.slice(i1 + 1) : x; + } -function getPopupClassNameFromAlign(builtinPlacements, prefixCls, align) { - var points = align.points; - for (var placement in builtinPlacements) { - if (builtinPlacements.hasOwnProperty(placement)) { - if (isPointsEq(builtinPlacements[placement].points, points)) { - return prefixCls + '-placement-' + placement; + var prefixExponent; + + function formatPrefixAuto(x, p) { + var d = formatDecimal(x, p); + if (!d) return x + ""; + var coefficient = d[0], + exponent = d[1], + i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, + n = coefficient.length; + return i === n ? coefficient + : i > n ? coefficient + new Array(i - n + 1).join("0") + : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) + : "0." + new Array(1 - i).join("0") + formatDecimal(x, Math.max(0, p + i - 1))[0]; // less than 1y! + } + + function formatRounded(x, p) { + var d = formatDecimal(x, p); + if (!d) return x + ""; + var coefficient = d[0], + exponent = d[1]; + return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient + : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) + : coefficient + new Array(exponent - coefficient.length + 2).join("0"); + } + + var formatTypes = { + "": formatDefault, + "%": function(x, p) { return (x * 100).toFixed(p); }, + "b": function(x) { return Math.round(x).toString(2); }, + "c": function(x) { return x + ""; }, + "d": function(x) { return Math.round(x).toString(10); }, + "e": function(x, p) { return x.toExponential(p); }, + "f": function(x, p) { return x.toFixed(p); }, + "g": function(x, p) { return x.toPrecision(p); }, + "o": function(x) { return Math.round(x).toString(8); }, + "p": function(x, p) { return formatRounded(x * 100, p); }, + "r": formatRounded, + "s": formatPrefixAuto, + "X": function(x) { return Math.round(x).toString(16).toUpperCase(); }, + "x": function(x) { return Math.round(x).toString(16); } + }; + + // [[fill]align][sign][symbol][0][width][,][.precision][type] + var re = /^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i; + + function formatSpecifier(specifier) { + return new FormatSpecifier(specifier); + } + + function FormatSpecifier(specifier) { + if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); + + var match, + fill = match[1] || " ", + align = match[2] || ">", + sign = match[3] || "-", + symbol = match[4] || "", + zero = !!match[5], + width = match[6] && +match[6], + comma = !!match[7], + precision = match[8] && +match[8].slice(1), + type = match[9] || ""; + + // The "n" type is an alias for ",g". + if (type === "n") comma = true, type = "g"; + + // Map invalid types to the default format. + else if (!formatTypes[type]) type = ""; + + // If zero fill is specified, padding goes after sign and before digits. + if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "="; + + this.fill = fill; + this.align = align; + this.sign = sign; + this.symbol = symbol; + this.zero = zero; + this.width = width; + this.comma = comma; + this.precision = precision; + this.type = type; + } + + FormatSpecifier.prototype.toString = function() { + return this.fill + + this.align + + this.sign + + this.symbol + + (this.zero ? "0" : "") + + (this.width == null ? "" : Math.max(1, this.width | 0)) + + (this.comma ? "," : "") + + (this.precision == null ? "" : "." + Math.max(0, this.precision | 0)) + + this.type; + }; + + var prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"]; + + function identity(x) { + return x; + } + + function formatLocale(locale) { + var group = locale.grouping && locale.thousands ? formatGroup(locale.grouping, locale.thousands) : identity, + currency = locale.currency, + decimal = locale.decimal; + + function newFormat(specifier) { + specifier = formatSpecifier(specifier); + + var fill = specifier.fill, + align = specifier.align, + sign = specifier.sign, + symbol = specifier.symbol, + zero = specifier.zero, + width = specifier.width, + comma = specifier.comma, + precision = specifier.precision, + type = specifier.type; + + // Compute the prefix and suffix. + // For SI-prefix, the suffix is lazily computed. + var prefix = symbol === "$" ? currency[0] : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", + suffix = symbol === "$" ? currency[1] : /[%p]/.test(type) ? "%" : ""; + + // What format function should we use? + // Is this an integer type? + // Can this type generate exponential notation? + var formatType = formatTypes[type], + maybeSuffix = !type || /[defgprs%]/.test(type); + + // Set the default precision if not specified, + // or clamp the specified precision to the supported range. + // For significant precision, it must be in [1, 21]. + // For fixed precision, it must be in [0, 20]. + precision = precision == null ? (type ? 6 : 12) + : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) + : Math.max(0, Math.min(20, precision)); + + function format(value) { + var valuePrefix = prefix, + valueSuffix = suffix, + i, n, c; + + if (type === "c") { + valueSuffix = formatType(value) + valueSuffix; + value = ""; + } else { + value = +value; + + // Convert negative to positive, and compute the prefix. + // Note that -0 is not less than 0, but 1 / -0 is! + var valueNegative = (value < 0 || 1 / value < 0) && (value *= -1, true); + + // Perform the initial formatting. + value = formatType(value, precision); + + // If the original value was negative, it may be rounded to zero during + // formatting; treat this as (positive) zero. + if (valueNegative) { + i = -1, n = value.length; + valueNegative = false; + while (++i < n) { + if (c = value.charCodeAt(i), (48 < c && c < 58) + || (type === "x" && 96 < c && c < 103) + || (type === "X" && 64 < c && c < 71)) { + valueNegative = true; + break; + } + } + } + + // Compute the prefix and suffix. + valuePrefix = (valueNegative ? (sign === "(" ? sign : "-") : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; + valueSuffix = valueSuffix + (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + (valueNegative && sign === "(" ? ")" : ""); + + // Break the formatted value into the integer “value” part that can be + // grouped, and fractional or exponential “suffix” part that is not. + if (maybeSuffix) { + i = -1, n = value.length; + while (++i < n) { + if (c = value.charCodeAt(i), 48 > c || c > 57) { + valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix; + value = value.slice(0, i); + break; + } + } + } + } + + // If the fill character is not "0", grouping is applied before padding. + if (comma && !zero) value = group(value, Infinity); + + // Compute the padding. + var length = valuePrefix.length + value.length + valueSuffix.length, + padding = length < width ? new Array(width - length + 1).join(fill) : ""; + + // If the fill character is "0", grouping is applied after padding. + if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; + + // Reconstruct the final output based on the desired alignment. + switch (align) { + case "<": return valuePrefix + value + valueSuffix + padding; + case "=": return valuePrefix + padding + value + valueSuffix; + case "^": return padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); + } + return padding + valuePrefix + value + valueSuffix; } + + format.toString = function() { + return specifier + ""; + }; + + return format; + } + + function formatPrefix(specifier, value) { + var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), + e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3, + k = Math.pow(10, -e), + prefix = prefixes[8 + e / 3]; + return function(value) { + return f(k * value) + prefix; + }; } + + return { + format: newFormat, + formatPrefix: formatPrefix + }; } - return ''; -} -},{"babel-runtime/helpers/extends":34}],133:[function(require,module,exports){ -'use strict'; -Object.defineProperty(exports, "__esModule", { - value: true -}); + var locale; + defaultLocale({ + decimal: ".", + thousands: ",", + grouping: [3], + currency: ["$", ""] + }); -var _react = require('react'); + function defaultLocale(definition) { + locale = formatLocale(definition); + exports.format = locale.format; + exports.formatPrefix = locale.formatPrefix; + return locale; + } -var _react2 = _interopRequireDefault(_react); + function precisionFixed(step) { + return Math.max(0, -exponent(Math.abs(step))); + } -var _reactDom = require('react-dom'); + function precisionPrefix(step, value) { + return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step))); + } -var _reactDom2 = _interopRequireDefault(_reactDom); + function precisionRound(step, max) { + step = Math.abs(step), max = Math.abs(max) - step; + return Math.max(0, exponent(max) - exponent(step)) + 1; + } -var _domAlign = require('dom-align'); + exports.formatDefaultLocale = defaultLocale; + exports.formatLocale = formatLocale; + exports.formatSpecifier = formatSpecifier; + exports.precisionFixed = precisionFixed; + exports.precisionPrefix = precisionPrefix; + exports.precisionRound = precisionRound; -var _domAlign2 = _interopRequireDefault(_domAlign); + Object.defineProperty(exports, '__esModule', { value: true }); -var _addEventListener = require('rc-util/lib/Dom/addEventListener'); +})); +},{}],136:[function(require,module,exports){ +// https://d3js.org/d3-hierarchy/ Version 1.0.2. Copyright 2016 Mike Bostock. +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (factory((global.d3 = global.d3 || {}))); +}(this, function (exports) { 'use strict'; -var _addEventListener2 = _interopRequireDefault(_addEventListener); + function defaultSeparation(a, b) { + return a.parent === b.parent ? 1 : 2; + } -var _isWindow = require('./isWindow'); + function meanX(children) { + return children.reduce(meanXReduce, 0) / children.length; + } -var _isWindow2 = _interopRequireDefault(_isWindow); + function meanXReduce(x, c) { + return x + c.x; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + function maxY(children) { + return 1 + children.reduce(maxYReduce, 0); + } -function buffer(fn, ms) { - var timer = void 0; + function maxYReduce(y, c) { + return Math.max(y, c.y); + } - function clear() { - if (timer) { - clearTimeout(timer); - timer = null; - } + function leafLeft(node) { + var children; + while (children = node.children) node = children[0]; + return node; } - function bufferFn() { - clear(); - timer = setTimeout(fn, ms); + function leafRight(node) { + var children; + while (children = node.children) node = children[children.length - 1]; + return node; } - bufferFn.clear = clear; + function cluster() { + var separation = defaultSeparation, + dx = 1, + dy = 1, + nodeSize = false; - return bufferFn; -} + function cluster(root) { + var previousNode, + x = 0; -var Align = _react2["default"].createClass({ - displayName: 'Align', + // First walk, computing the initial x & y values. + root.eachAfter(function(node) { + var children = node.children; + if (children) { + node.x = meanX(children); + node.y = maxY(children); + } else { + node.x = previousNode ? x += separation(node, previousNode) : 0; + node.y = 0; + previousNode = node; + } + }); - propTypes: { - childrenProps: _react.PropTypes.object, - align: _react.PropTypes.object.isRequired, - target: _react.PropTypes.func, - onAlign: _react.PropTypes.func, - monitorBufferTime: _react.PropTypes.number, - monitorWindowResize: _react.PropTypes.bool, - disabled: _react.PropTypes.bool, - children: _react.PropTypes.any - }, + var left = leafLeft(root), + right = leafRight(root), + x0 = left.x - separation(left, right) / 2, + x1 = right.x + separation(right, left) / 2; + + // Second walk, normalizing x & y to the desired size. + return root.eachAfter(nodeSize ? function(node) { + node.x = (node.x - root.x) * dx; + node.y = (root.y - node.y) * dy; + } : function(node) { + node.x = (node.x - x0) / (x1 - x0) * dx; + node.y = (1 - (root.y ? node.y / root.y : 1)) * dy; + }); + } - getDefaultProps: function getDefaultProps() { - return { - target: function target() { - return window; - }, - onAlign: function onAlign() {}, + cluster.separation = function(x) { + return arguments.length ? (separation = x, cluster) : separation; + }; - monitorBufferTime: 50, - monitorWindowResize: false, - disabled: false + cluster.size = function(x) { + return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? null : [dx, dy]); }; - }, - componentDidMount: function componentDidMount() { - var props = this.props; - // if parent ref not attached .... use document.getElementById - this.forceAlign(); - if (!props.disabled && props.monitorWindowResize) { - this.startMonitorWindowResize(); - } - }, - componentDidUpdate: function componentDidUpdate(prevProps) { - var reAlign = false; - var props = this.props; - if (!props.disabled) { - if (prevProps.disabled || prevProps.align !== props.align) { - reAlign = true; - } else { - var lastTarget = prevProps.target(); - var currentTarget = props.target(); - if ((0, _isWindow2["default"])(lastTarget) && (0, _isWindow2["default"])(currentTarget)) { - reAlign = false; - } else if (lastTarget !== currentTarget) { - reAlign = true; + cluster.nodeSize = function(x) { + return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? [dx, dy] : null); + }; + + return cluster; + } + + function node_each(callback) { + var node = this, current, next = [node], children, i, n; + do { + current = next.reverse(), next = []; + while (node = current.pop()) { + callback(node), children = node.children; + if (children) for (i = 0, n = children.length; i < n; ++i) { + next.push(children[i]); } } - } + } while (next.length); + return this; + } - if (reAlign) { - this.forceAlign(); + function node_eachBefore(callback) { + var node = this, nodes = [node], children, i; + while (node = nodes.pop()) { + callback(node), children = node.children; + if (children) for (i = children.length - 1; i >= 0; --i) { + nodes.push(children[i]); + } } + return this; + } - if (props.monitorWindowResize && !props.disabled) { - this.startMonitorWindowResize(); - } else { - this.stopMonitorWindowResize(); + function node_eachAfter(callback) { + var node = this, nodes = [node], next = [], children, i, n; + while (node = nodes.pop()) { + next.push(node), children = node.children; + if (children) for (i = 0, n = children.length; i < n; ++i) { + nodes.push(children[i]); + } } - }, - componentWillUnmount: function componentWillUnmount() { - this.stopMonitorWindowResize(); - }, - startMonitorWindowResize: function startMonitorWindowResize() { - if (!this.resizeHandler) { - this.bufferMonitor = buffer(this.forceAlign, this.props.monitorBufferTime); - this.resizeHandler = (0, _addEventListener2["default"])(window, 'resize', this.bufferMonitor); + while (node = next.pop()) { + callback(node); } - }, - stopMonitorWindowResize: function stopMonitorWindowResize() { - if (this.resizeHandler) { - this.bufferMonitor.clear(); - this.resizeHandler.remove(); - this.resizeHandler = null; + return this; + } + + function node_sum(value) { + return this.eachAfter(function(node) { + var sum = +value(node.data) || 0, + children = node.children, + i = children && children.length; + while (--i >= 0) sum += children[i].value; + node.value = sum; + }); + } + + function node_sort(compare) { + return this.eachBefore(function(node) { + if (node.children) { + node.children.sort(compare); + } + }); + } + + function node_path(end) { + var start = this, + ancestor = leastCommonAncestor(start, end), + nodes = [start]; + while (start !== ancestor) { + start = start.parent; + nodes.push(start); } - }, - forceAlign: function forceAlign() { - var props = this.props; - if (!props.disabled) { - var source = _reactDom2["default"].findDOMNode(this); - props.onAlign(source, (0, _domAlign2["default"])(source, props.target(), props.align)); + var k = nodes.length; + while (end !== ancestor) { + nodes.splice(k, 0, end); + end = end.parent; } - }, - render: function render() { - var _props = this.props; - var childrenProps = _props.childrenProps; - var children = _props.children; + return nodes; + } - var child = _react2["default"].Children.only(children); - if (childrenProps) { - var newProps = {}; - for (var prop in childrenProps) { - if (childrenProps.hasOwnProperty(prop)) { - newProps[prop] = this.props[childrenProps[prop]]; - } - } - return _react2["default"].cloneElement(child, newProps); + function leastCommonAncestor(a, b) { + if (a === b) return a; + var aNodes = a.ancestors(), + bNodes = b.ancestors(), + c = null; + a = aNodes.pop(); + b = bNodes.pop(); + while (a === b) { + c = a; + a = aNodes.pop(); + b = bNodes.pop(); } - return child; + return c; } -}); - -exports["default"] = Align; -module.exports = exports['default']; -},{"./isWindow":135,"dom-align":142,"rc-util/lib/Dom/addEventListener":154,"react":585,"react-dom":416}],134:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -var _Align = require('./Align'); + function node_ancestors() { + var node = this, nodes = [node]; + while (node = node.parent) { + nodes.push(node); + } + return nodes; + } -var _Align2 = _interopRequireDefault(_Align); + function node_descendants() { + var nodes = []; + this.each(function(node) { + nodes.push(node); + }); + return nodes; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + function node_leaves() { + var leaves = []; + this.eachBefore(function(node) { + if (!node.children) { + leaves.push(node); + } + }); + return leaves; + } -exports["default"] = _Align2["default"]; // export this package's api + function node_links() { + var root = this, links = []; + root.each(function(node) { + if (node !== root) { // Don’t include the root’s parent, if any. + links.push({source: node.parent, target: node}); + } + }); + return links; + } + + function hierarchy(data, children) { + var root = new Node(data), + valued = +data.value && (root.value = data.value), + node, + nodes = [root], + child, + childs, + i, + n; + + if (children == null) children = defaultChildren; + + while (node = nodes.pop()) { + if (valued) node.value = +node.data.value; + if ((childs = children(node.data)) && (n = childs.length)) { + node.children = new Array(n); + for (i = n - 1; i >= 0; --i) { + nodes.push(child = node.children[i] = new Node(childs[i])); + child.parent = node; + child.depth = node.depth + 1; + } + } + } -module.exports = exports['default']; -},{"./Align":133}],135:[function(require,module,exports){ -"use strict"; + return root.eachBefore(computeHeight); + } -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = isWindow; -function isWindow(obj) { - /* eslint no-eq-null: 0 */ - /* eslint eqeqeq: 0 */ - return obj != null && obj == obj.window; -} -module.exports = exports['default']; -},{}],136:[function(require,module,exports){ -'use strict'; + function node_copy() { + return hierarchy(this).eachBefore(copyData); + } -Object.defineProperty(exports, "__esModule", { - value: true -}); + function defaultChildren(d) { + return d.children; + } -var _utils = require('./utils'); + function copyData(node) { + node.data = node.data.data; + } -var _utils2 = _interopRequireDefault(_utils); + function computeHeight(node) { + var height = 0; + do node.height = height; + while ((node = node.parent) && (node.height < ++height)); + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + function Node(data) { + this.data = data; + this.depth = + this.height = 0; + this.parent = null; + } -function adjustForViewport(elFuturePos, elRegion, visibleRect, overflow) { - var pos = _utils2["default"].clone(elFuturePos); - var size = { - width: elRegion.width, - height: elRegion.height + Node.prototype = hierarchy.prototype = { + constructor: Node, + each: node_each, + eachAfter: node_eachAfter, + eachBefore: node_eachBefore, + sum: node_sum, + sort: node_sort, + path: node_path, + ancestors: node_ancestors, + descendants: node_descendants, + leaves: node_leaves, + links: node_links, + copy: node_copy }; - if (overflow.adjustX && pos.left < visibleRect.left) { - pos.left = visibleRect.left; + function Node$2(value) { + this._ = value; + this.next = null; } - // Left edge inside and right edge outside viewport, try to resize it. - if (overflow.resizeWidth && pos.left >= visibleRect.left && pos.left + size.width > visibleRect.right) { - size.width -= pos.left + size.width - visibleRect.right; - } + function shuffle(array) { + var i, + n = (array = array.slice()).length, + head = null, + node = head; - // Right edge outside viewport, try to move it. - if (overflow.adjustX && pos.left + size.width > visibleRect.right) { - // 保证左边界和可视区域左边界对齐 - pos.left = Math.max(visibleRect.right - size.width, visibleRect.left); + while (n) { + var next = new Node$2(array[n - 1]); + if (node) node = node.next = next; + else node = head = next; + array[i] = array[--n]; + } + + return { + head: head, + tail: node + }; } - // Top edge outside viewport, try to move it. - if (overflow.adjustY && pos.top < visibleRect.top) { - pos.top = visibleRect.top; + function enclose(circles) { + return encloseN(shuffle(circles), []); } - // Top edge inside and bottom edge outside viewport, try to resize it. - if (overflow.resizeHeight && pos.top >= visibleRect.top && pos.top + size.height > visibleRect.bottom) { - size.height -= pos.top + size.height - visibleRect.bottom; + function encloses(a, b) { + var dx = b.x - a.x, + dy = b.y - a.y, + dr = a.r - b.r; + return dr * dr + 1e-6 > dx * dx + dy * dy; } - // Bottom edge outside viewport, try to move it. - if (overflow.adjustY && pos.top + size.height > visibleRect.bottom) { - // 保证上边界和可视区域上边界对齐 - pos.top = Math.max(visibleRect.bottom - size.height, visibleRect.top); + // Returns the smallest circle that contains circles L and intersects circles B. + function encloseN(L, B) { + var circle, + l0 = null, + l1 = L.head, + l2, + p1; + + switch (B.length) { + case 1: circle = enclose1(B[0]); break; + case 2: circle = enclose2(B[0], B[1]); break; + case 3: circle = enclose3(B[0], B[1], B[2]); break; + } + + while (l1) { + p1 = l1._, l2 = l1.next; + if (!circle || !encloses(circle, p1)) { + + // Temporarily truncate L before l1. + if (l0) L.tail = l0, l0.next = null; + else L.head = L.tail = null; + + B.push(p1); + circle = encloseN(L, B); // Note: reorders L! + B.pop(); + + // Move l1 to the front of L and reconnect the truncated list L. + if (L.head) l1.next = L.head, L.head = l1; + else l1.next = null, L.head = L.tail = l1; + l0 = L.tail, l0.next = l2; + + } else { + l0 = l1; + } + l1 = l2; + } + + L.tail = l0; + return circle; } - return _utils2["default"].mix(pos, size); -} + function enclose1(a) { + return { + x: a.x, + y: a.y, + r: a.r + }; + } -exports["default"] = adjustForViewport; -module.exports = exports['default']; -},{"./utils":144}],137:[function(require,module,exports){ -'use strict'; + function enclose2(a, b) { + var x1 = a.x, y1 = a.y, r1 = a.r, + x2 = b.x, y2 = b.y, r2 = b.r, + x21 = x2 - x1, y21 = y2 - y1, r21 = r2 - r1, + l = Math.sqrt(x21 * x21 + y21 * y21); + return { + x: (x1 + x2 + x21 / l * r21) / 2, + y: (y1 + y2 + y21 / l * r21) / 2, + r: (l + r1 + r2) / 2 + }; + } -Object.defineProperty(exports, "__esModule", { - value: true -}); -/** - * 获取 node 上的 align 对齐点 相对于页面的坐标 - */ + function enclose3(a, b, c) { + var x1 = a.x, y1 = a.y, r1 = a.r, + x2 = b.x, y2 = b.y, r2 = b.r, + x3 = c.x, y3 = c.y, r3 = c.r, + a2 = 2 * (x1 - x2), + b2 = 2 * (y1 - y2), + c2 = 2 * (r2 - r1), + d2 = x1 * x1 + y1 * y1 - r1 * r1 - x2 * x2 - y2 * y2 + r2 * r2, + a3 = 2 * (x1 - x3), + b3 = 2 * (y1 - y3), + c3 = 2 * (r3 - r1), + d3 = x1 * x1 + y1 * y1 - r1 * r1 - x3 * x3 - y3 * y3 + r3 * r3, + ab = a3 * b2 - a2 * b3, + xa = (b2 * d3 - b3 * d2) / ab - x1, + xb = (b3 * c2 - b2 * c3) / ab, + ya = (a3 * d2 - a2 * d3) / ab - y1, + yb = (a2 * c3 - a3 * c2) / ab, + A = xb * xb + yb * yb - 1, + B = 2 * (xa * xb + ya * yb + r1), + C = xa * xa + ya * ya - r1 * r1, + r = (-B - Math.sqrt(B * B - 4 * A * C)) / (2 * A); + return { + x: xa + xb * r + x1, + y: ya + yb * r + y1, + r: r + }; + } -function getAlignOffset(region, align) { - var V = align.charAt(0); - var H = align.charAt(1); - var w = region.width; - var h = region.height; - var x = void 0; - var y = void 0; + function place(a, b, c) { + var ax = a.x, + ay = a.y, + da = b.r + c.r, + db = a.r + c.r, + dx = b.x - ax, + dy = b.y - ay, + dc = dx * dx + dy * dy; + if (dc) { + var x = 0.5 + ((db *= db) - (da *= da)) / (2 * dc), + y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc); + c.x = ax + x * dx + y * dy; + c.y = ay + x * dy - y * dx; + } else { + c.x = ax + db; + c.y = ay; + } + } - x = region.left; - y = region.top; + function intersects(a, b) { + var dx = b.x - a.x, + dy = b.y - a.y, + dr = a.r + b.r; + return dr * dr > dx * dx + dy * dy; + } - if (V === 'c') { - y += h / 2; - } else if (V === 'b') { - y += h; + function distance2(circle, x, y) { + var dx = circle.x - x, + dy = circle.y - y; + return dx * dx + dy * dy; } - if (H === 'c') { - x += w / 2; - } else if (H === 'r') { - x += w; + function Node$1(circle) { + this._ = circle; + this.next = null; + this.previous = null; } - return { - left: x, - top: y - }; -} + function packEnclose(circles) { + if (!(n = circles.length)) return 0; -exports["default"] = getAlignOffset; -module.exports = exports['default']; -},{}],138:[function(require,module,exports){ -'use strict'; + var a, b, c, n; -Object.defineProperty(exports, "__esModule", { - value: true -}); + // Place the first circle. + a = circles[0], a.x = 0, a.y = 0; + if (!(n > 1)) return a.r; -var _getAlignOffset = require('./getAlignOffset'); + // Place the second circle. + b = circles[1], a.x = -b.r, b.x = a.r, b.y = 0; + if (!(n > 2)) return a.r + b.r; -var _getAlignOffset2 = _interopRequireDefault(_getAlignOffset); + // Place the third circle. + place(b, a, c = circles[2]); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + // Initialize the weighted centroid. + var aa = a.r * a.r, + ba = b.r * b.r, + ca = c.r * c.r, + oa = aa + ba + ca, + ox = aa * a.x + ba * b.x + ca * c.x, + oy = aa * a.y + ba * b.y + ca * c.y, + cx, cy, i, j, k, sj, sk; -function getElFuturePos(elRegion, refNodeRegion, points, offset, targetOffset) { - var xy = void 0; - var diff = void 0; - var p1 = void 0; - var p2 = void 0; + // Initialize the front-chain using the first three circles a, b and c. + a = new Node$1(a), b = new Node$1(b), c = new Node$1(c); + a.next = c.previous = b; + b.next = a.previous = c; + c.next = b.previous = a; - xy = { - left: elRegion.left, - top: elRegion.top - }; + // Attempt to place each remaining circle… + pack: for (i = 3; i < n; ++i) { + place(a._, b._, c = circles[i]), c = new Node$1(c); - p1 = (0, _getAlignOffset2["default"])(refNodeRegion, points[1]); - p2 = (0, _getAlignOffset2["default"])(elRegion, points[0]); + // If there are only three elements in the front-chain… + if ((k = a.previous) === (j = b.next)) { + // If the new circle intersects the third circle, + // rotate the front chain to try the next position. + if (intersects(j._, c._)) { + a = b, b = j, --i; + continue pack; + } + } - diff = [p2.left - p1.left, p2.top - p1.top]; + // Find the closest intersecting circle on the front-chain, if any. + else { + sj = j._.r, sk = k._.r; + do { + if (sj <= sk) { + if (intersects(j._, c._)) { + b = j, a.next = b, b.previous = a, --i; + continue pack; + } + j = j.next, sj += j._.r; + } else { + if (intersects(k._, c._)) { + a = k, a.next = b, b.previous = a, --i; + continue pack; + } + k = k.previous, sk += k._.r; + } + } while (j !== k.next); + } - return { - left: xy.left - diff[0] + offset[0] - targetOffset[0], - top: xy.top - diff[1] + offset[1] - targetOffset[1] - }; -} + // Success! Insert the new circle c between a and b. + c.previous = a, c.next = b, a.next = b.previous = b = c; -exports["default"] = getElFuturePos; -module.exports = exports['default']; -},{"./getAlignOffset":137}],139:[function(require,module,exports){ -'use strict'; + // Update the weighted centroid. + oa += ca = c._.r * c._.r; + ox += ca * c._.x; + oy += ca * c._.y; -Object.defineProperty(exports, "__esModule", { - value: true -}); + // Compute the new closest circle a to centroid. + aa = distance2(a._, cx = ox / oa, cy = oy / oa); + while ((c = c.next) !== b) { + if ((ca = distance2(c._, cx, cy)) < aa) { + a = c, aa = ca; + } + } + b = a.next; + } -var _utils = require('./utils'); + // Compute the enclosing circle of the front chain. + a = [b._], c = b; while ((c = c.next) !== b) a.push(c._); c = enclose(a); -var _utils2 = _interopRequireDefault(_utils); + // Translate the circles to put the enclosing circle around the origin. + for (i = 0; i < n; ++i) a = circles[i], a.x -= c.x, a.y -= c.y; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + return c.r; + } -/** - * 得到会导致元素显示不全的祖先元素 - */ + function siblings(circles) { + packEnclose(circles); + return circles; + } -function getOffsetParent(element) { - // ie 这个也不是完全可行 - /* -
-
- 元素 6 高 100px 宽 50px
-
-
- */ - // element.offsetParent does the right thing in ie7 and below. Return parent with layout! - // In other browsers it only includes elements with position absolute, relative or - // fixed, not elements with overflow set to auto or scroll. - // if (UA.ie && ieMode < 8) { - // return element.offsetParent; - // } - // 统一的 offsetParent 方法 - var doc = element.ownerDocument; - var body = doc.body; - var parent = void 0; - var positionStyle = _utils2["default"].css(element, 'position'); - var skipStatic = positionStyle === 'fixed' || positionStyle === 'absolute'; + function optional(f) { + return f == null ? null : required(f); + } - if (!skipStatic) { - return element.nodeName.toLowerCase() === 'html' ? null : element.parentNode; + function required(f) { + if (typeof f !== "function") throw new Error; + return f; } - for (parent = element.parentNode; parent && parent !== body; parent = parent.parentNode) { - positionStyle = _utils2["default"].css(parent, 'position'); - if (positionStyle !== 'static') { - return parent; - } + function constantZero() { + return 0; } - return null; -} -exports["default"] = getOffsetParent; -module.exports = exports['default']; -},{"./utils":144}],140:[function(require,module,exports){ -'use strict'; + function constant(x) { + return function() { + return x; + }; + } -Object.defineProperty(exports, "__esModule", { - value: true -}); + function defaultRadius(d) { + return Math.sqrt(d.value); + } -var _utils = require('./utils'); + function index() { + var radius = null, + dx = 1, + dy = 1, + padding = constantZero; -var _utils2 = _interopRequireDefault(_utils); + function pack(root) { + root.x = dx / 2, root.y = dy / 2; + if (radius) { + root.eachBefore(radiusLeaf(radius)) + .eachAfter(packChildren(padding, 0.5)) + .eachBefore(translateChild(1)); + } else { + root.eachBefore(radiusLeaf(defaultRadius)) + .eachAfter(packChildren(constantZero, 1)) + .eachAfter(packChildren(padding, root.r / Math.min(dx, dy))) + .eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r))); + } + return root; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + pack.radius = function(x) { + return arguments.length ? (radius = optional(x), pack) : radius; + }; -function getRegion(node) { - var offset = void 0; - var w = void 0; - var h = void 0; - if (!_utils2["default"].isWindow(node) && node.nodeType !== 9) { - offset = _utils2["default"].offset(node); - w = _utils2["default"].outerWidth(node); - h = _utils2["default"].outerHeight(node); - } else { - var win = _utils2["default"].getWindow(node); - offset = { - left: _utils2["default"].getWindowScrollLeft(win), - top: _utils2["default"].getWindowScrollTop(win) + pack.size = function(x) { + return arguments.length ? (dx = +x[0], dy = +x[1], pack) : [dx, dy]; }; - w = _utils2["default"].viewportWidth(win); - h = _utils2["default"].viewportHeight(win); - } - offset.width = w; - offset.height = h; - return offset; -} -exports["default"] = getRegion; -module.exports = exports['default']; -},{"./utils":144}],141:[function(require,module,exports){ -'use strict'; + pack.padding = function(x) { + return arguments.length ? (padding = typeof x === "function" ? x : constant(+x), pack) : padding; + }; -Object.defineProperty(exports, "__esModule", { - value: true -}); + return pack; + } -var _utils = require('./utils'); + function radiusLeaf(radius) { + return function(node) { + if (!node.children) { + node.r = Math.max(0, +radius(node) || 0); + } + }; + } -var _utils2 = _interopRequireDefault(_utils); + function packChildren(padding, k) { + return function(node) { + if (children = node.children) { + var children, + i, + n = children.length, + r = padding(node) * k || 0, + e; -var _getOffsetParent = require('./getOffsetParent'); + if (r) for (i = 0; i < n; ++i) children[i].r += r; + e = packEnclose(children); + if (r) for (i = 0; i < n; ++i) children[i].r -= r; + node.r = e + r; + } + }; + } -var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent); + function translateChild(k) { + return function(node) { + var parent = node.parent; + node.r *= k; + if (parent) { + node.x = parent.x + k * node.x; + node.y = parent.y + k * node.y; + } + }; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + function roundNode(node) { + node.x0 = Math.round(node.x0); + node.y0 = Math.round(node.y0); + node.x1 = Math.round(node.x1); + node.y1 = Math.round(node.y1); + } -/** - * 获得元素的显示部分的区域 - */ -function getVisibleRectForElement(element) { - var visibleRect = { - left: 0, - right: Infinity, - top: 0, - bottom: Infinity - }; - var el = (0, _getOffsetParent2["default"])(element); - var scrollX = void 0; - var scrollY = void 0; - var winSize = void 0; - var doc = element.ownerDocument; - var win = doc.defaultView || doc.parentWindow; - var body = doc.body; - var documentElement = doc.documentElement; + function treemapDice(parent, x0, y0, x1, y1) { + var nodes = parent.children, + node, + i = -1, + n = nodes.length, + k = parent.value && (x1 - x0) / parent.value; - // Determine the size of the visible rect by climbing the dom accounting for - // all scrollable containers. - while (el) { - // clientWidth is zero for inline block elements in ie. - if ((navigator.userAgent.indexOf('MSIE') === -1 || el.clientWidth !== 0) && - // body may have overflow set on it, yet we still get the entire - // viewport. In some browsers, el.offsetParent may be - // document.documentElement, so check for that too. - el !== body && el !== documentElement && _utils2["default"].css(el, 'overflow') !== 'visible') { - var pos = _utils2["default"].offset(el); - // add border - pos.left += el.clientLeft; - pos.top += el.clientTop; - visibleRect.top = Math.max(visibleRect.top, pos.top); - visibleRect.right = Math.min(visibleRect.right, - // consider area without scrollBar - pos.left + el.clientWidth); - visibleRect.bottom = Math.min(visibleRect.bottom, pos.top + el.clientHeight); - visibleRect.left = Math.max(visibleRect.left, pos.left); - } else if (el === body || el === documentElement) { - break; + while (++i < n) { + node = nodes[i], node.y0 = y0, node.y1 = y1; + node.x0 = x0, node.x1 = x0 += node.value * k; } - el = (0, _getOffsetParent2["default"])(el); } - // Clip by window's viewport. - scrollX = _utils2["default"].getWindowScrollLeft(win); - scrollY = _utils2["default"].getWindowScrollTop(win); - visibleRect.left = Math.max(visibleRect.left, scrollX); - visibleRect.top = Math.max(visibleRect.top, scrollY); - winSize = { - width: _utils2["default"].viewportWidth(win), - height: _utils2["default"].viewportHeight(win) - }; - visibleRect.right = Math.min(visibleRect.right, scrollX + winSize.width); - visibleRect.bottom = Math.min(visibleRect.bottom, scrollY + winSize.height); - return visibleRect.top >= 0 && visibleRect.left >= 0 && visibleRect.bottom > visibleRect.top && visibleRect.right > visibleRect.left ? visibleRect : null; -} + function partition() { + var dx = 1, + dy = 1, + padding = 0, + round = false; -exports["default"] = getVisibleRectForElement; -module.exports = exports['default']; -},{"./getOffsetParent":139,"./utils":144}],142:[function(require,module,exports){ -'use strict'; + function partition(root) { + var n = root.height + 1; + root.x0 = + root.y0 = padding; + root.x1 = dx; + root.y1 = dy / n; + root.eachBefore(positionNode(dy, n)); + if (round) root.eachBefore(roundNode); + return root; + } -Object.defineProperty(exports, "__esModule", { - value: true -}); + function positionNode(dy, n) { + return function(node) { + if (node.children) { + treemapDice(node, node.x0, dy * (node.depth + 1) / n, node.x1, dy * (node.depth + 2) / n); + } + var x0 = node.x0, + y0 = node.y0, + x1 = node.x1 - padding, + y1 = node.y1 - padding; + if (x1 < x0) x0 = x1 = (x0 + x1) / 2; + if (y1 < y0) y0 = y1 = (y0 + y1) / 2; + node.x0 = x0; + node.y0 = y0; + node.x1 = x1; + node.y1 = y1; + }; + } -var _utils = require('./utils'); + partition.round = function(x) { + return arguments.length ? (round = !!x, partition) : round; + }; -var _utils2 = _interopRequireDefault(_utils); + partition.size = function(x) { + return arguments.length ? (dx = +x[0], dy = +x[1], partition) : [dx, dy]; + }; -var _getOffsetParent = require('./getOffsetParent'); + partition.padding = function(x) { + return arguments.length ? (padding = +x, partition) : padding; + }; -var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent); + return partition; + } -var _getVisibleRectForElement = require('./getVisibleRectForElement'); + var keyPrefix = "$"; + var preroot = {depth: -1}; + var ambiguous = {}; + function defaultId(d) { + return d.id; + } -var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement); + function defaultParentId(d) { + return d.parentId; + } -var _adjustForViewport = require('./adjustForViewport'); + function stratify() { + var id = defaultId, + parentId = defaultParentId; -var _adjustForViewport2 = _interopRequireDefault(_adjustForViewport); + function stratify(data) { + var d, + i, + n = data.length, + root, + parent, + node, + nodes = new Array(n), + nodeId, + nodeKey, + nodeByKey = {}; -var _getRegion = require('./getRegion'); + for (i = 0; i < n; ++i) { + d = data[i], node = nodes[i] = new Node(d); + if ((nodeId = id(d, i, data)) != null && (nodeId += "")) { + nodeKey = keyPrefix + (node.id = nodeId); + nodeByKey[nodeKey] = nodeKey in nodeByKey ? ambiguous : node; + } + } -var _getRegion2 = _interopRequireDefault(_getRegion); + for (i = 0; i < n; ++i) { + node = nodes[i], nodeId = parentId(data[i], i, data); + if (nodeId == null || !(nodeId += "")) { + if (root) throw new Error("multiple roots"); + root = node; + } else { + parent = nodeByKey[keyPrefix + nodeId]; + if (!parent) throw new Error("missing: " + nodeId); + if (parent === ambiguous) throw new Error("ambiguous: " + nodeId); + if (parent.children) parent.children.push(node); + else parent.children = [node]; + node.parent = parent; + } + } -var _getElFuturePos = require('./getElFuturePos'); + if (!root) throw new Error("no root"); + root.parent = preroot; + root.eachBefore(function(node) { node.depth = node.parent.depth + 1; --n; }).eachBefore(computeHeight); + root.parent = null; + if (n > 0) throw new Error("cycle"); -var _getElFuturePos2 = _interopRequireDefault(_getElFuturePos); + return root; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + stratify.id = function(x) { + return arguments.length ? (id = required(x), stratify) : id; + }; -// http://yiminghe.iteye.com/blog/1124720 + stratify.parentId = function(x) { + return arguments.length ? (parentId = required(x), stratify) : parentId; + }; -/** - * align dom node flexibly - * @author yiminghe@gmail.com - */ + return stratify; + } + + function defaultSeparation$1(a, b) { + return a.parent === b.parent ? 1 : 2; + } + + // function radialSeparation(a, b) { + // return (a.parent === b.parent ? 1 : 2) / a.depth; + // } + + // This function is used to traverse the left contour of a subtree (or + // subforest). It returns the successor of v on this contour. This successor is + // either given by the leftmost child of v or by the thread of v. The function + // returns null if and only if v is on the highest level of its subtree. + function nextLeft(v) { + var children = v.children; + return children ? children[0] : v.t; + } + + // This function works analogously to nextLeft. + function nextRight(v) { + var children = v.children; + return children ? children[children.length - 1] : v.t; + } + + // Shifts the current subtree rooted at w+. This is done by increasing + // prelim(w+) and mod(w+) by shift. + function moveSubtree(wm, wp, shift) { + var change = shift / (wp.i - wm.i); + wp.c -= change; + wp.s += shift; + wm.c += change; + wp.z += shift; + wp.m += shift; + } + + // All other shifts, applied to the smaller subtrees between w- and w+, are + // performed by this function. To prepare the shifts, we have to adjust + // change(w+), shift(w+), and change(w-). + function executeShifts(v) { + var shift = 0, + change = 0, + children = v.children, + i = children.length, + w; + while (--i >= 0) { + w = children[i]; + w.z += shift; + w.m += shift; + shift += w.s + (change += w.c); + } + } + + // If vi-’s ancestor is a sibling of v, returns vi-’s ancestor. Otherwise, + // returns the specified (default) ancestor. + function nextAncestor(vim, v, ancestor) { + return vim.a.parent === v.parent ? vim.a : ancestor; + } + + function TreeNode(node, i) { + this._ = node; + this.parent = null; + this.children = null; + this.A = null; // default ancestor + this.a = this; // ancestor + this.z = 0; // prelim + this.m = 0; // mod + this.c = 0; // change + this.s = 0; // shift + this.t = null; // thread + this.i = i; // number + } + + TreeNode.prototype = Object.create(Node.prototype); + + function treeRoot(root) { + var tree = new TreeNode(root, 0), + node, + nodes = [tree], + child, + children, + i, + n; + + while (node = nodes.pop()) { + if (children = node._.children) { + node.children = new Array(n = children.length); + for (i = n - 1; i >= 0; --i) { + nodes.push(child = node.children[i] = new TreeNode(children[i], i)); + child.parent = node; + } + } + } -function isFailX(elFuturePos, elRegion, visibleRect) { - return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right; -} + (tree.parent = new TreeNode(null, 0)).children = [tree]; + return tree; + } -function isFailY(elFuturePos, elRegion, visibleRect) { - return elFuturePos.top < visibleRect.top || elFuturePos.top + elRegion.height > visibleRect.bottom; -} + // Node-link tree diagram using the Reingold-Tilford "tidy" algorithm + function tree() { + var separation = defaultSeparation$1, + dx = 1, + dy = 1, + nodeSize = null; + + function tree(root) { + var t = treeRoot(root); + + // Compute the layout using Buchheim et al.’s algorithm. + t.eachAfter(firstWalk), t.parent.m = -t.z; + t.eachBefore(secondWalk); + + // If a fixed node size is specified, scale x and y. + if (nodeSize) root.eachBefore(sizeNode); + + // If a fixed tree size is specified, scale x and y based on the extent. + // Compute the left-most, right-most, and depth-most nodes for extents. + else { + var left = root, + right = root, + bottom = root; + root.eachBefore(function(node) { + if (node.x < left.x) left = node; + if (node.x > right.x) right = node; + if (node.depth > bottom.depth) bottom = node; + }); + var s = left === right ? 1 : separation(left, right) / 2, + tx = s - left.x, + kx = dx / (right.x + s + tx), + ky = dy / (bottom.depth || 1); + root.eachBefore(function(node) { + node.x = (node.x + tx) * kx; + node.y = node.depth * ky; + }); + } -function isCompleteFailX(elFuturePos, elRegion, visibleRect) { - return elFuturePos.left > visibleRect.right || elFuturePos.left + elRegion.width < visibleRect.left; -} + return root; + } -function isCompleteFailY(elFuturePos, elRegion, visibleRect) { - return elFuturePos.top > visibleRect.bottom || elFuturePos.top + elRegion.height < visibleRect.top; -} + // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is + // applied recursively to the children of v, as well as the function + // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the + // node v is placed to the midpoint of its outermost children. + function firstWalk(v) { + var children = v.children, + siblings = v.parent.children, + w = v.i ? siblings[v.i - 1] : null; + if (children) { + executeShifts(v); + var midpoint = (children[0].z + children[children.length - 1].z) / 2; + if (w) { + v.z = w.z + separation(v._, w._); + v.m = v.z - midpoint; + } else { + v.z = midpoint; + } + } else if (w) { + v.z = w.z + separation(v._, w._); + } + v.parent.A = apportion(v, w, v.parent.A || siblings[0]); + } + + // Computes all real x-coordinates by summing up the modifiers recursively. + function secondWalk(v) { + v._.x = v.z + v.parent.m; + v.m += v.parent.m; + } + + // The core of the algorithm. Here, a new subtree is combined with the + // previous subtrees. Threads are used to traverse the inside and outside + // contours of the left and right subtree up to the highest common level. The + // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the + // superscript o means outside and i means inside, the subscript - means left + // subtree and + means right subtree. For summing up the modifiers along the + // contour, we use respective variables si+, si-, so-, and so+. Whenever two + // nodes of the inside contours conflict, we compute the left one of the + // greatest uncommon ancestors using the function ANCESTOR and call MOVE + // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees. + // Finally, we add a new thread (if necessary). + function apportion(v, w, ancestor) { + if (w) { + var vip = v, + vop = v, + vim = w, + vom = vip.parent.children[0], + sip = vip.m, + sop = vop.m, + sim = vim.m, + som = vom.m, + shift; + while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) { + vom = nextLeft(vom); + vop = nextRight(vop); + vop.a = v; + shift = vim.z + sim - vip.z - sip + separation(vim._, vip._); + if (shift > 0) { + moveSubtree(nextAncestor(vim, v, ancestor), v, shift); + sip += shift; + sop += shift; + } + sim += vim.m; + sip += vip.m; + som += vom.m; + sop += vop.m; + } + if (vim && !nextRight(vop)) { + vop.t = vim; + vop.m += sim - sop; + } + if (vip && !nextLeft(vom)) { + vom.t = vip; + vom.m += sip - som; + ancestor = v; + } + } + return ancestor; + } -function flip(points, reg, map) { - var ret = []; - _utils2["default"].each(points, function (p) { - ret.push(p.replace(reg, function (m) { - return map[m]; - })); - }); - return ret; -} + function sizeNode(node) { + node.x *= dx; + node.y = node.depth * dy; + } -function flipOffset(offset, index) { - offset[index] = -offset[index]; - return offset; -} + tree.separation = function(x) { + return arguments.length ? (separation = x, tree) : separation; + }; -function convertOffset(str, offsetLen) { - var n = void 0; - if (/%$/.test(str)) { - n = parseInt(str.substring(0, str.length - 1), 10) / 100 * offsetLen; - } else { - n = parseInt(str, 10); + tree.size = function(x) { + return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : (nodeSize ? null : [dx, dy]); + }; + + tree.nodeSize = function(x) { + return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null); + }; + + return tree; } - return n || 0; -} -function normalizeOffset(offset, el) { - offset[0] = convertOffset(offset[0], el.width); - offset[1] = convertOffset(offset[1], el.height); -} + function treemapSlice(parent, x0, y0, x1, y1) { + var nodes = parent.children, + node, + i = -1, + n = nodes.length, + k = parent.value && (y1 - y0) / parent.value; -function domAlign(el, refNode, align) { - var points = align.points; - var offset = align.offset || [0, 0]; - var targetOffset = align.targetOffset || [0, 0]; - var overflow = align.overflow; - var target = align.target || refNode; - var source = align.source || el; - offset = [].concat(offset); - targetOffset = [].concat(targetOffset); - overflow = overflow || {}; - var newOverflowCfg = {}; + while (++i < n) { + node = nodes[i], node.x0 = x0, node.x1 = x1; + node.y0 = y0, node.y1 = y0 += node.value * k; + } + } - var fail = 0; - // 当前节点可以被放置的显示区域 - var visibleRect = (0, _getVisibleRectForElement2["default"])(source); - // 当前节点所占的区域, left/top/width/height - var elRegion = (0, _getRegion2["default"])(source); - // 参照节点所占的区域, left/top/width/height - var refNodeRegion = (0, _getRegion2["default"])(target); - // 将 offset 转换成数值,支持百分比 - normalizeOffset(offset, elRegion); - normalizeOffset(targetOffset, refNodeRegion); - // 当前节点将要被放置的位置 - var elFuturePos = (0, _getElFuturePos2["default"])(elRegion, refNodeRegion, points, offset, targetOffset); - // 当前节点将要所处的区域 - var newElRegion = _utils2["default"].merge(elRegion, elFuturePos); + var phi = (1 + Math.sqrt(5)) / 2; - // 如果可视区域不能完全放置当前节点时允许调整 - if (visibleRect && (overflow.adjustX || overflow.adjustY)) { - if (overflow.adjustX) { - // 如果横向不能放下 - if (isFailX(elFuturePos, elRegion, visibleRect)) { - // 对齐位置反下 - var newPoints = flip(points, /[lr]/ig, { - l: 'r', - r: 'l' - }); - // 偏移量也反下 - var newOffset = flipOffset(offset, 0); - var newTargetOffset = flipOffset(targetOffset, 0); - var newElFuturePos = (0, _getElFuturePos2["default"])(elRegion, refNodeRegion, newPoints, newOffset, newTargetOffset); - if (!isCompleteFailX(newElFuturePos, elRegion, visibleRect)) { - fail = 1; - points = newPoints; - offset = newOffset; - targetOffset = newTargetOffset; - } + function squarifyRatio(ratio, parent, x0, y0, x1, y1) { + var rows = [], + nodes = parent.children, + row, + nodeValue, + i0 = 0, + i1, + n = nodes.length, + dx, dy, + value = parent.value, + sumValue, + minValue, + maxValue, + newRatio, + minRatio, + alpha, + beta; + + while (i0 < n) { + dx = x1 - x0, dy = y1 - y0; + minValue = maxValue = sumValue = nodes[i0].value; + alpha = Math.max(dy / dx, dx / dy) / (value * ratio); + beta = sumValue * sumValue * alpha; + minRatio = Math.max(maxValue / beta, beta / minValue); + + // Keep adding nodes while the aspect ratio maintains or improves. + for (i1 = i0 + 1; i1 < n; ++i1) { + sumValue += nodeValue = nodes[i1].value; + if (nodeValue < minValue) minValue = nodeValue; + if (nodeValue > maxValue) maxValue = nodeValue; + beta = sumValue * sumValue * alpha; + newRatio = Math.max(maxValue / beta, beta / minValue); + if (newRatio > minRatio) { sumValue -= nodeValue; break; } + minRatio = newRatio; } + + // Position and record the row orientation. + rows.push(row = {value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1)}); + if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1); + else treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1); + value -= sumValue, i0 = i1; } - if (overflow.adjustY) { - // 如果纵向不能放下 - if (isFailY(elFuturePos, elRegion, visibleRect)) { - // 对齐位置反下 - var _newPoints = flip(points, /[tb]/ig, { - t: 'b', - b: 't' - }); - // 偏移量也反下 - var _newOffset = flipOffset(offset, 1); - var _newTargetOffset = flipOffset(targetOffset, 1); - var _newElFuturePos = (0, _getElFuturePos2["default"])(elRegion, refNodeRegion, _newPoints, _newOffset, _newTargetOffset); - if (!isCompleteFailY(_newElFuturePos, elRegion, visibleRect)) { - fail = 1; - points = _newPoints; - offset = _newOffset; - targetOffset = _newTargetOffset; - } - } + return rows; + } + + var squarify = (function custom(ratio) { + + function squarify(parent, x0, y0, x1, y1) { + squarifyRatio(ratio, parent, x0, y0, x1, y1); } - // 如果失败,重新计算当前节点将要被放置的位置 - if (fail) { - elFuturePos = (0, _getElFuturePos2["default"])(elRegion, refNodeRegion, points, offset, targetOffset); - _utils2["default"].mix(newElRegion, elFuturePos); + squarify.ratio = function(x) { + return custom((x = +x) > 1 ? x : 1); + }; + + return squarify; + })(phi); + + function index$1() { + var tile = squarify, + round = false, + dx = 1, + dy = 1, + paddingStack = [0], + paddingInner = constantZero, + paddingTop = constantZero, + paddingRight = constantZero, + paddingBottom = constantZero, + paddingLeft = constantZero; + + function treemap(root) { + root.x0 = + root.y0 = 0; + root.x1 = dx; + root.y1 = dy; + root.eachBefore(positionNode); + paddingStack = [0]; + if (round) root.eachBefore(roundNode); + return root; + } + + function positionNode(node) { + var p = paddingStack[node.depth], + x0 = node.x0 + p, + y0 = node.y0 + p, + x1 = node.x1 - p, + y1 = node.y1 - p; + if (x1 < x0) x0 = x1 = (x0 + x1) / 2; + if (y1 < y0) y0 = y1 = (y0 + y1) / 2; + node.x0 = x0; + node.y0 = y0; + node.x1 = x1; + node.y1 = y1; + if (node.children) { + p = paddingStack[node.depth + 1] = paddingInner(node) / 2; + x0 += paddingLeft(node) - p; + y0 += paddingTop(node) - p; + x1 -= paddingRight(node) - p; + y1 -= paddingBottom(node) - p; + if (x1 < x0) x0 = x1 = (x0 + x1) / 2; + if (y1 < y0) y0 = y1 = (y0 + y1) / 2; + tile(node, x0, y0, x1, y1); + } + } + + treemap.round = function(x) { + return arguments.length ? (round = !!x, treemap) : round; + }; + + treemap.size = function(x) { + return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy]; + }; + + treemap.tile = function(x) { + return arguments.length ? (tile = required(x), treemap) : tile; + }; + + treemap.padding = function(x) { + return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner(); + }; + + treemap.paddingInner = function(x) { + return arguments.length ? (paddingInner = typeof x === "function" ? x : constant(+x), treemap) : paddingInner; + }; + + treemap.paddingOuter = function(x) { + return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop(); + }; + + treemap.paddingTop = function(x) { + return arguments.length ? (paddingTop = typeof x === "function" ? x : constant(+x), treemap) : paddingTop; + }; + + treemap.paddingRight = function(x) { + return arguments.length ? (paddingRight = typeof x === "function" ? x : constant(+x), treemap) : paddingRight; + }; + + treemap.paddingBottom = function(x) { + return arguments.length ? (paddingBottom = typeof x === "function" ? x : constant(+x), treemap) : paddingBottom; + }; + + treemap.paddingLeft = function(x) { + return arguments.length ? (paddingLeft = typeof x === "function" ? x : constant(+x), treemap) : paddingLeft; + }; + + return treemap; + } + + function binary(parent, x0, y0, x1, y1) { + var nodes = parent.children, + i, n = nodes.length, + sum, sums = new Array(n + 1); + + for (sums[0] = sum = i = 0; i < n; ++i) { + sums[i + 1] = sum += nodes[i].value; } - // 检查反下后的位置是否可以放下了 - // 如果仍然放不下只有指定了可以调整当前方向才调整 - newOverflowCfg.adjustX = overflow.adjustX && isFailX(elFuturePos, elRegion, visibleRect); + partition(0, n, parent.value, x0, y0, x1, y1); - newOverflowCfg.adjustY = overflow.adjustY && isFailY(elFuturePos, elRegion, visibleRect); + function partition(i, j, value, x0, y0, x1, y1) { + if (i >= j - 1) { + var node = nodes[i]; + node.x0 = x0, node.y0 = y0; + node.x1 = x1, node.y1 = y1; + return; + } - // 确实要调整,甚至可能会调整高度宽度 - if (newOverflowCfg.adjustX || newOverflowCfg.adjustY) { - newElRegion = (0, _adjustForViewport2["default"])(elFuturePos, elRegion, visibleRect, newOverflowCfg); + var valueOffset = sums[i], + valueTarget = (value / 2) + valueOffset, + k = i + 1, + hi = j - 1; + + while (k < hi) { + var mid = k + hi >>> 1; + if (sums[mid] < valueTarget) k = mid + 1; + else hi = mid; + } + + var valueLeft = sums[k] - valueOffset, + valueRight = value - valueLeft; + + if ((y1 - y0) > (x1 - x0)) { + var yk = (y0 * valueRight + y1 * valueLeft) / value; + partition(i, k, valueLeft, x0, y0, x1, yk); + partition(k, j, valueRight, x0, yk, x1, y1); + } else { + var xk = (x0 * valueRight + x1 * valueLeft) / value; + partition(i, k, valueLeft, x0, y0, xk, y1); + partition(k, j, valueRight, xk, y0, x1, y1); + } } } - // need judge to in case set fixed with in css on height auto element - if (newElRegion.width !== elRegion.width) { - _utils2["default"].css(source, 'width', _utils2["default"].width(source) + newElRegion.width - elRegion.width); + function sliceDice(parent, x0, y0, x1, y1) { + (parent.depth & 1 ? treemapSlice : treemapDice)(parent, x0, y0, x1, y1); } - if (newElRegion.height !== elRegion.height) { - _utils2["default"].css(source, 'height', _utils2["default"].height(source) + newElRegion.height - elRegion.height); - } + var resquarify = (function custom(ratio) { - // https://github.com/kissyteam/kissy/issues/190 - // 相对于屏幕位置没变,而 left/top 变了 - // 例如
- _utils2["default"].offset(source, { - left: newElRegion.left, - top: newElRegion.top - }, { - useCssRight: align.useCssRight, - useCssBottom: align.useCssBottom, - useCssTransform: align.useCssTransform - }); + function resquarify(parent, x0, y0, x1, y1) { + if ((rows = parent._squarify) && (rows.ratio === ratio)) { + var rows, + row, + nodes, + i, + j = -1, + n, + m = rows.length, + value = parent.value; - return { - points: points, - offset: offset, - targetOffset: targetOffset, - overflow: newOverflowCfg - }; -} + while (++j < m) { + row = rows[j], nodes = row.children; + for (i = row.value = 0, n = nodes.length; i < n; ++i) row.value += nodes[i].value; + if (row.dice) treemapDice(row, x0, y0, x1, y0 += (y1 - y0) * row.value / value); + else treemapSlice(row, x0, y0, x0 += (x1 - x0) * row.value / value, y1); + value -= row.value; + } + } else { + parent._squarify = rows = squarifyRatio(ratio, parent, x0, y0, x1, y1); + rows.ratio = ratio; + } + } -domAlign.__getOffsetParent = _getOffsetParent2["default"]; + resquarify.ratio = function(x) { + return custom((x = +x) > 1 ? x : 1); + }; -domAlign.__getVisibleRectForElement = _getVisibleRectForElement2["default"]; + return resquarify; + })(phi); + + exports.cluster = cluster; + exports.hierarchy = hierarchy; + exports.pack = index; + exports.packSiblings = siblings; + exports.packEnclose = enclose; + exports.partition = partition; + exports.stratify = stratify; + exports.tree = tree; + exports.treemap = index$1; + exports.treemapBinary = binary; + exports.treemapDice = treemapDice; + exports.treemapSlice = treemapSlice; + exports.treemapSliceDice = sliceDice; + exports.treemapSquarify = squarify; + exports.treemapResquarify = resquarify; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); +},{}],137:[function(require,module,exports){ +// https://d3js.org/d3-interpolate/ Version 1.1.1. Copyright 2016 Mike Bostock. +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-color')) : + typeof define === 'function' && define.amd ? define(['exports', 'd3-color'], factory) : + (factory((global.d3 = global.d3 || {}),global.d3)); +}(this, function (exports,d3Color) { 'use strict'; + + function basis(t1, v0, v1, v2, v3) { + var t2 = t1 * t1, t3 = t2 * t1; + return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + + (4 - 6 * t2 + 3 * t3) * v1 + + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + + t3 * v3) / 6; + } + + function basis$1(values) { + var n = values.length - 1; + return function(t) { + var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), + v1 = values[i], + v2 = values[i + 1], + v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, + v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1; + return basis((t - i / n) * n, v0, v1, v2, v3); + }; + } -exports["default"] = domAlign; -/** - * 2012-04-26 yiminghe@gmail.com - * - 优化智能对齐算法 - * - 慎用 resizeXX - * - * 2011-07-13 yiminghe@gmail.com note: - * - 增加智能对齐,以及大小调整选项 - **/ + function basisClosed(values) { + var n = values.length; + return function(t) { + var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), + v0 = values[(i + n - 1) % n], + v1 = values[i % n], + v2 = values[(i + 1) % n], + v3 = values[(i + 2) % n]; + return basis((t - i / n) * n, v0, v1, v2, v3); + }; + } -module.exports = exports['default']; -},{"./adjustForViewport":136,"./getElFuturePos":138,"./getOffsetParent":139,"./getRegion":140,"./getVisibleRectForElement":141,"./utils":144}],143:[function(require,module,exports){ -'use strict'; + function constant(x) { + return function() { + return x; + }; + } -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getTransformName = getTransformName; -exports.setTransitionProperty = setTransitionProperty; -exports.getTransitionProperty = getTransitionProperty; -exports.getTransformXY = getTransformXY; -exports.setTransformXY = setTransformXY; -var vendorPrefix = void 0; + function linear(a, d) { + return function(t) { + return a + t * d; + }; + } -var jsCssMap = { - Webkit: '-webkit-', - Moz: '-moz-', - // IE did it wrong again ... - ms: '-ms-', - O: '-o-' -}; + function exponential(a, b, y) { + return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) { + return Math.pow(a + t * b, y); + }; + } -function getVendorPrefix() { - if (vendorPrefix !== undefined) { - return vendorPrefix; + function hue(a, b) { + var d = b - a; + return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a); } - vendorPrefix = ''; - var style = document.createElement('p').style; - var testProp = 'Transform'; - for (var key in jsCssMap) { - if (key + testProp in style) { - vendorPrefix = key; - } + + function gamma(y) { + return (y = +y) === 1 ? nogamma : function(a, b) { + return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a); + }; } - return vendorPrefix; -} -function getTransitionName() { - return getVendorPrefix() ? getVendorPrefix() + 'TransitionProperty' : 'transitionProperty'; -} + function nogamma(a, b) { + var d = b - a; + return d ? linear(a, d) : constant(isNaN(a) ? b : a); + } -function getTransformName() { - return getVendorPrefix() ? getVendorPrefix() + 'Transform' : 'transform'; -} + var rgb$1 = (function rgbGamma(y) { + var color = gamma(y); -function setTransitionProperty(node, value) { - var name = getTransitionName(); - if (name) { - node.style[name] = value; - if (name !== 'transitionProperty') { - node.style.transitionProperty = value; + function rgb(start, end) { + var r = color((start = d3Color.rgb(start)).r, (end = d3Color.rgb(end)).r), + g = color(start.g, end.g), + b = color(start.b, end.b), + opacity = color(start.opacity, end.opacity); + return function(t) { + start.r = r(t); + start.g = g(t); + start.b = b(t); + start.opacity = opacity(t); + return start + ""; + }; } + + rgb.gamma = rgbGamma; + + return rgb; + })(1); + + function rgbSpline(spline) { + return function(colors) { + var n = colors.length, + r = new Array(n), + g = new Array(n), + b = new Array(n), + i, color; + for (i = 0; i < n; ++i) { + color = d3Color.rgb(colors[i]); + r[i] = color.r || 0; + g[i] = color.g || 0; + b[i] = color.b || 0; + } + r = spline(r); + g = spline(g); + b = spline(b); + color.opacity = 1; + return function(t) { + color.r = r(t); + color.g = g(t); + color.b = b(t); + return color + ""; + }; + }; } -} -function setTransform(node, value) { - var name = getTransformName(); - if (name) { - node.style[name] = value; - if (name !== 'transform') { - node.style.transform = value; + var rgbBasis = rgbSpline(basis$1); + var rgbBasisClosed = rgbSpline(basisClosed); + + function array(a, b) { + var nb = b ? b.length : 0, + na = a ? Math.min(nb, a.length) : 0, + x = new Array(nb), + c = new Array(nb), + i; + + for (i = 0; i < na; ++i) x[i] = value(a[i], b[i]); + for (; i < nb; ++i) c[i] = b[i]; + + return function(t) { + for (i = 0; i < na; ++i) c[i] = x[i](t); + return c; + }; + } + + function date(a, b) { + var d = new Date; + return a = +a, b -= a, function(t) { + return d.setTime(a + b * t), d; + }; + } + + function number(a, b) { + return a = +a, b -= a, function(t) { + return a + b * t; + }; + } + + function object(a, b) { + var i = {}, + c = {}, + k; + + if (a === null || typeof a !== "object") a = {}; + if (b === null || typeof b !== "object") b = {}; + + for (k in b) { + if (k in a) { + i[k] = value(a[k], b[k]); + } else { + c[k] = b[k]; + } } + + return function(t) { + for (k in i) c[k] = i[k](t); + return c; + }; } -} -function getTransitionProperty(node) { - return node.style.transitionProperty || node.style[getTransitionName()]; -} + var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g; + var reB = new RegExp(reA.source, "g"); + function zero(b) { + return function() { + return b; + }; + } -function getTransformXY(node) { - var style = window.getComputedStyle(node, null); - var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName()); - if (transform && transform !== 'none') { - var matrix = transform.replace(/[^0-9\-.,]/g, '').split(','); - return { x: parseFloat(matrix[12] || matrix[4], 0), y: parseFloat(matrix[13] || matrix[5], 0) }; + function one(b) { + return function(t) { + return b(t) + ""; + }; } - return { - x: 0, - y: 0 + + function string(a, b) { + var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b + am, // current match in a + bm, // current match in b + bs, // string preceding current number in b, if any + i = -1, // index in s + s = [], // string constants and placeholders + q = []; // number interpolators + + // Coerce inputs to strings. + a = a + "", b = b + ""; + + // Interpolate pairs of numbers in a & b. + while ((am = reA.exec(a)) + && (bm = reB.exec(b))) { + if ((bs = bm.index) > bi) { // a string precedes the next number in b + bs = b.slice(bi, bs); + if (s[i]) s[i] += bs; // coalesce with previous string + else s[++i] = bs; + } + if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match + if (s[i]) s[i] += bm; // coalesce with previous string + else s[++i] = bm; + } else { // interpolate non-matching numbers + s[++i] = null; + q.push({i: i, x: number(am, bm)}); + } + bi = reB.lastIndex; + } + + // Add remains of b. + if (bi < b.length) { + bs = b.slice(bi); + if (s[i]) s[i] += bs; // coalesce with previous string + else s[++i] = bs; + } + + // Special optimization for only a single match. + // Otherwise, interpolate each of the numbers and rejoin the string. + return s.length < 2 ? (q[0] + ? one(q[0].x) + : zero(b)) + : (b = q.length, function(t) { + for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }); + } + + function value(a, b) { + var t = typeof b, c; + return b == null || t === "boolean" ? constant(b) + : (t === "number" ? number + : t === "string" ? ((c = d3Color.color(b)) ? (b = c, rgb$1) : string) + : b instanceof d3Color.color ? rgb$1 + : b instanceof Date ? date + : Array.isArray(b) ? array + : isNaN(b) ? object + : number)(a, b); + } + + function round(a, b) { + return a = +a, b -= a, function(t) { + return Math.round(a + b * t); + }; + } + + var degrees = 180 / Math.PI; + + var identity = { + translateX: 0, + translateY: 0, + rotate: 0, + skewX: 0, + scaleX: 1, + scaleY: 1 }; -} -var matrix2d = /matrix\((.*)\)/; -var matrix3d = /matrix3d\((.*)\)/; + function decompose(a, b, c, d, e, f) { + var scaleX, scaleY, skewX; + if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX; + if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX; + if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY; + if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX; + return { + translateX: e, + translateY: f, + rotate: Math.atan2(b, a) * degrees, + skewX: Math.atan(skewX) * degrees, + scaleX: scaleX, + scaleY: scaleY + }; + } -function setTransformXY(node, xy) { - var style = window.getComputedStyle(node, null); - var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName()); - if (transform && transform !== 'none') { - var arr = void 0; - var match2d = transform.match(matrix2d); - if (match2d) { - match2d = match2d[1]; - arr = match2d.split(',').map(function (item) { - return parseFloat(item, 10); - }); - arr[4] = xy.x; - arr[5] = xy.y; - setTransform(node, 'matrix(' + arr.join(',') + ')'); - } else { - var match3d = transform.match(matrix3d)[1]; - arr = match3d.split(',').map(function (item) { - return parseFloat(item, 10); - }); - arr[12] = xy.x; - arr[13] = xy.y; - setTransform(node, 'matrix3d(' + arr.join(',') + ')'); - } - } else { - setTransform(node, 'translateX(' + xy.x + 'px) translateY(' + xy.y + 'px) translateZ(0)'); + var cssNode; + var cssRoot; + var cssView; + var svgNode; + function parseCss(value) { + if (value === "none") return identity; + if (!cssNode) cssNode = document.createElement("DIV"), cssRoot = document.documentElement, cssView = document.defaultView; + cssNode.style.transform = value; + value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue("transform"); + cssRoot.removeChild(cssNode); + value = value.slice(7, -1).split(","); + return decompose(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]); } -} -},{}],144:[function(require,module,exports){ -'use strict'; -Object.defineProperty(exports, "__esModule", { - value: true -}); + function parseSvg(value) { + if (value == null) return identity; + if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); + svgNode.setAttribute("transform", value); + if (!(value = svgNode.transform.baseVal.consolidate())) return identity; + value = value.matrix; + return decompose(value.a, value.b, value.c, value.d, value.e, value.f); + } -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; + function interpolateTransform(parse, pxComma, pxParen, degParen) { -var _propertyUtils = require('./propertyUtils'); + function pop(s) { + return s.length ? s.pop() + " " : ""; + } -var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source; + function translate(xa, ya, xb, yb, s, q) { + if (xa !== xb || ya !== yb) { + var i = s.push("translate(", null, pxComma, null, pxParen); + q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)}); + } else if (xb || yb) { + s.push("translate(" + xb + pxComma + yb + pxParen); + } + } -var getComputedStyleX = void 0; + function rotate(a, b, s, q) { + if (a !== b) { + if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path + q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: number(a, b)}); + } else if (b) { + s.push(pop(s) + "rotate(" + b + degParen); + } + } -function force(x, y) { - return x + y; -} + function skewX(a, b, s, q) { + if (a !== b) { + q.push({i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: number(a, b)}); + } else if (b) { + s.push(pop(s) + "skewX(" + b + degParen); + } + } -function css(el, name, v) { - var value = v; - if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') { - for (var i in name) { - if (name.hasOwnProperty(i)) { - css(el, i, name[i]); + function scale(xa, ya, xb, yb, s, q) { + if (xa !== xb || ya !== yb) { + var i = s.push(pop(s) + "scale(", null, ",", null, ")"); + q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)}); + } else if (xb !== 1 || yb !== 1) { + s.push(pop(s) + "scale(" + xb + "," + yb + ")"); } } - return undefined; + + return function(a, b) { + var s = [], // string constants and placeholders + q = []; // number interpolators + a = parse(a), b = parse(b); + translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q); + rotate(a.rotate, b.rotate, s, q); + skewX(a.skewX, b.skewX, s, q); + scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q); + a = b = null; // gc + return function(t) { + var i = -1, n = q.length, o; + while (++i < n) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }; + }; } - if (typeof value !== 'undefined') { - if (typeof value === 'number') { - value = value + 'px'; + + var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)"); + var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")"); + + var rho = Math.SQRT2; + var rho2 = 2; + var rho4 = 4; + var epsilon2 = 1e-12; + function cosh(x) { + return ((x = Math.exp(x)) + 1 / x) / 2; + } + + function sinh(x) { + return ((x = Math.exp(x)) - 1 / x) / 2; + } + + function tanh(x) { + return ((x = Math.exp(2 * x)) - 1) / (x + 1); + } + + // p0 = [ux0, uy0, w0] + // p1 = [ux1, uy1, w1] + function zoom(p0, p1) { + var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], + ux1 = p1[0], uy1 = p1[1], w1 = p1[2], + dx = ux1 - ux0, + dy = uy1 - uy0, + d2 = dx * dx + dy * dy, + i, + S; + + // Special case for u0 ≅ u1. + if (d2 < epsilon2) { + S = Math.log(w1 / w0) / rho; + i = function(t) { + return [ + ux0 + t * dx, + uy0 + t * dy, + w0 * Math.exp(rho * t * S) + ]; + } + } + + // General case. + else { + var d1 = Math.sqrt(d2), + b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), + b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), + r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), + r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); + S = (r1 - r0) / rho; + i = function(t) { + var s = t * S, + coshr0 = cosh(r0), + u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0)); + return [ + ux0 + u * dx, + uy0 + u * dy, + w0 * coshr0 / cosh(rho * s + r0) + ]; + } + } + + i.duration = S * 1000; + + return i; + } + + function hsl$1(hue) { + return function(start, end) { + var h = hue((start = d3Color.hsl(start)).h, (end = d3Color.hsl(end)).h), + s = nogamma(start.s, end.s), + l = nogamma(start.l, end.l), + opacity = nogamma(start.opacity, end.opacity); + return function(t) { + start.h = h(t); + start.s = s(t); + start.l = l(t); + start.opacity = opacity(t); + return start + ""; + }; } - el.style[name] = value; - return undefined; } - return getComputedStyleX(el, name); -} -function getClientPosition(elem) { - var box = void 0; - var x = void 0; - var y = void 0; - var doc = elem.ownerDocument; - var body = doc.body; - var docElem = doc && doc.documentElement; - // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式 - box = elem.getBoundingClientRect(); + var hsl$2 = hsl$1(hue); + var hslLong = hsl$1(nogamma); - // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop - // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确 - // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin + function lab$1(start, end) { + var l = nogamma((start = d3Color.lab(start)).l, (end = d3Color.lab(end)).l), + a = nogamma(start.a, end.a), + b = nogamma(start.b, end.b), + opacity = nogamma(start.opacity, end.opacity); + return function(t) { + start.l = l(t); + start.a = a(t); + start.b = b(t); + start.opacity = opacity(t); + return start + ""; + }; + } - x = box.left; - y = box.top; + function hcl$1(hue) { + return function(start, end) { + var h = hue((start = d3Color.hcl(start)).h, (end = d3Color.hcl(end)).h), + c = nogamma(start.c, end.c), + l = nogamma(start.l, end.l), + opacity = nogamma(start.opacity, end.opacity); + return function(t) { + start.h = h(t); + start.c = c(t); + start.l = l(t); + start.opacity = opacity(t); + return start + ""; + }; + } + } - // In IE, most of the time, 2 extra pixels are added to the top and left - // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and - // IE6 standards mode, this border can be overridden by setting the - // document element's border to zero -- thus, we cannot rely on the - // offset always being 2 pixels. + var hcl$2 = hcl$1(hue); + var hclLong = hcl$1(nogamma); - // In quirks mode, the offset can be determined by querying the body's - // clientLeft/clientTop, but in standards mode, it is found by querying - // the document element's clientLeft/clientTop. Since we already called - // getClientBoundingRect we have already forced a reflow, so it is not - // too expensive just to query them all. + function cubehelix$1(hue) { + return (function cubehelixGamma(y) { + y = +y; - // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的 - // 窗口边框标准是设 documentElement ,quirks 时设置 body - // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去 - // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置 - // 标准 ie 下 docElem.clientTop 就是 border-top - // ie7 html 即窗口边框改变不了。永远为 2 - // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0 + function cubehelix(start, end) { + var h = hue((start = d3Color.cubehelix(start)).h, (end = d3Color.cubehelix(end)).h), + s = nogamma(start.s, end.s), + l = nogamma(start.l, end.l), + opacity = nogamma(start.opacity, end.opacity); + return function(t) { + start.h = h(t); + start.s = s(t); + start.l = l(Math.pow(t, y)); + start.opacity = opacity(t); + return start + ""; + }; + } - x -= docElem.clientLeft || body.clientLeft || 0; - y -= docElem.clientTop || body.clientTop || 0; + cubehelix.gamma = cubehelixGamma; + + return cubehelix; + })(1); + } + + var cubehelix$2 = cubehelix$1(hue); + var cubehelixLong = cubehelix$1(nogamma); + + function quantize(interpolator, n) { + var samples = new Array(n); + for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1)); + return samples; + } + + exports.interpolate = value; + exports.interpolateArray = array; + exports.interpolateBasis = basis$1; + exports.interpolateBasisClosed = basisClosed; + exports.interpolateDate = date; + exports.interpolateNumber = number; + exports.interpolateObject = object; + exports.interpolateRound = round; + exports.interpolateString = string; + exports.interpolateTransformCss = interpolateTransformCss; + exports.interpolateTransformSvg = interpolateTransformSvg; + exports.interpolateZoom = zoom; + exports.interpolateRgb = rgb$1; + exports.interpolateRgbBasis = rgbBasis; + exports.interpolateRgbBasisClosed = rgbBasisClosed; + exports.interpolateHsl = hsl$2; + exports.interpolateHslLong = hslLong; + exports.interpolateLab = lab$1; + exports.interpolateHcl = hcl$2; + exports.interpolateHclLong = hclLong; + exports.interpolateCubehelix = cubehelix$2; + exports.interpolateCubehelixLong = cubehelixLong; + exports.quantize = quantize; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); +},{"d3-color":134}],138:[function(require,module,exports){ +// https://d3js.org/d3-path/ Version 1.0.2. Copyright 2016 Mike Bostock. +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (factory((global.d3 = global.d3 || {}))); +}(this, (function (exports) { 'use strict'; + +var pi = Math.PI; +var tau = 2 * pi; +var epsilon = 1e-6; +var tauEpsilon = tau - epsilon; + +function Path() { + this._x0 = this._y0 = // start of current subpath + this._x1 = this._y1 = null; // end of current subpath + this._ = []; +} + +function path() { + return new Path; +} + +Path.prototype = path.prototype = { + constructor: Path, + moveTo: function(x, y) { + this._.push("M", this._x0 = this._x1 = +x, ",", this._y0 = this._y1 = +y); + }, + closePath: function() { + if (this._x1 !== null) { + this._x1 = this._x0, this._y1 = this._y0; + this._.push("Z"); + } + }, + lineTo: function(x, y) { + this._.push("L", this._x1 = +x, ",", this._y1 = +y); + }, + quadraticCurveTo: function(x1, y1, x, y) { + this._.push("Q", +x1, ",", +y1, ",", this._x1 = +x, ",", this._y1 = +y); + }, + bezierCurveTo: function(x1, y1, x2, y2, x, y) { + this._.push("C", +x1, ",", +y1, ",", +x2, ",", +y2, ",", this._x1 = +x, ",", this._y1 = +y); + }, + arcTo: function(x1, y1, x2, y2, r) { + x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r; + var x0 = this._x1, + y0 = this._y1, + x21 = x2 - x1, + y21 = y2 - y1, + x01 = x0 - x1, + y01 = y0 - y1, + l01_2 = x01 * x01 + y01 * y01; + + // Is the radius negative? Error. + if (r < 0) throw new Error("negative radius: " + r); + + // Is this path empty? Move to (x1,y1). + if (this._x1 === null) { + this._.push( + "M", this._x1 = x1, ",", this._y1 = y1 + ); + } - return { - left: x, - top: y - }; -} + // Or, is (x1,y1) coincident with (x0,y0)? Do nothing. + else if (!(l01_2 > epsilon)) {} -function getScroll(w, top) { - var ret = w['page' + (top ? 'Y' : 'X') + 'Offset']; - var method = 'scroll' + (top ? 'Top' : 'Left'); - if (typeof ret !== 'number') { - var d = w.document; - // ie6,7,8 standard mode - ret = d.documentElement[method]; - if (typeof ret !== 'number') { - // quirks mode - ret = d.body[method]; + // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear? + // Equivalently, is (x1,y1) coincident with (x2,y2)? + // Or, is the radius zero? Line to (x1,y1). + else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) { + this._.push( + "L", this._x1 = x1, ",", this._y1 = y1 + ); } - } - return ret; -} -function getScrollLeft(w) { - return getScroll(w); -} + // Otherwise, draw an arc! + else { + var x20 = x2 - x0, + y20 = y2 - y0, + l21_2 = x21 * x21 + y21 * y21, + l20_2 = x20 * x20 + y20 * y20, + l21 = Math.sqrt(l21_2), + l01 = Math.sqrt(l01_2), + l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), + t01 = l / l01, + t21 = l / l21; + + // If the start tangent is not coincident with (x0,y0), line to. + if (Math.abs(t01 - 1) > epsilon) { + this._.push( + "L", x1 + t01 * x01, ",", y1 + t01 * y01 + ); + } -function getScrollTop(w) { - return getScroll(w, true); -} + this._.push( + "A", r, ",", r, ",0,0,", +(y01 * x20 > x01 * y20), ",", this._x1 = x1 + t21 * x21, ",", this._y1 = y1 + t21 * y21 + ); + } + }, + arc: function(x, y, r, a0, a1, ccw) { + x = +x, y = +y, r = +r; + var dx = r * Math.cos(a0), + dy = r * Math.sin(a0), + x0 = x + dx, + y0 = y + dy, + cw = 1 ^ ccw, + da = ccw ? a0 - a1 : a1 - a0; -function getOffset(el) { - var pos = getClientPosition(el); - var doc = el.ownerDocument; - var w = doc.defaultView || doc.parentWindow; - pos.left += getScrollLeft(w); - pos.top += getScrollTop(w); - return pos; -} -function _getComputedStyle(elem, name, cs) { - var computedStyle = cs; - var val = ''; - var d = elem.ownerDocument; - computedStyle = computedStyle || d.defaultView.getComputedStyle(elem, null); + // Is the radius negative? Error. + if (r < 0) throw new Error("negative radius: " + r); - // https://github.com/kissyteam/kissy/issues/61 - if (computedStyle) { - val = computedStyle.getPropertyValue(name) || computedStyle[name]; + // Is this path empty? Move to (x0,y0). + if (this._x1 === null) { + this._.push( + "M", x0, ",", y0 + ); + } + + // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0). + else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) { + this._.push( + "L", x0, ",", y0 + ); + } + + // Is this arc empty? We’re done. + if (!r) return; + + // Is this a complete circle? Draw two arcs to complete the circle. + if (da > tauEpsilon) { + this._.push( + "A", r, ",", r, ",0,1,", cw, ",", x - dx, ",", y - dy, + "A", r, ",", r, ",0,1,", cw, ",", this._x1 = x0, ",", this._y1 = y0 + ); + } + + // Otherwise, draw an arc! + else { + if (da < 0) da = da % tau + tau; + this._.push( + "A", r, ",", r, ",0,", +(da >= pi), ",", cw, ",", this._x1 = x + r * Math.cos(a1), ",", this._y1 = y + r * Math.sin(a1) + ); + } + }, + rect: function(x, y, w, h) { + this._.push("M", this._x0 = this._x1 = +x, ",", this._y0 = this._y1 = +y, "h", +w, "v", +h, "h", -w, "Z"); + }, + toString: function() { + return this._.join(""); } +}; - return val; -} +exports.path = path; -var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i'); -var RE_POS = /^(top|right|bottom|left)$/; -var CURRENT_STYLE = 'currentStyle'; -var RUNTIME_STYLE = 'runtimeStyle'; -var LEFT = 'left'; -var PX = 'px'; +Object.defineProperty(exports, '__esModule', { value: true }); -function _getComputedStyleIE(elem, name) { - // currentStyle maybe null - // http://msdn.microsoft.com/en-us/library/ms535231.aspx - var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name]; +}))); +},{}],139:[function(require,module,exports){ +// https://d3js.org/d3-scale/ Version 1.0.3. Copyright 2016 Mike Bostock. +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array'), require('d3-collection'), require('d3-interpolate'), require('d3-format'), require('d3-time'), require('d3-time-format'), require('d3-color')) : + typeof define === 'function' && define.amd ? define(['exports', 'd3-array', 'd3-collection', 'd3-interpolate', 'd3-format', 'd3-time', 'd3-time-format', 'd3-color'], factory) : + (factory((global.d3 = global.d3 || {}),global.d3,global.d3,global.d3,global.d3,global.d3,global.d3,global.d3)); +}(this, function (exports,d3Array,d3Collection,d3Interpolate,d3Format,d3Time,d3TimeFormat,d3Color) { 'use strict'; - // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值 - // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19 - // 在 ie 下不对,需要直接用 offset 方式 - // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了 + var array = Array.prototype; - // From the awesome hack by Dean Edwards - // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - // If we're not dealing with a regular pixel number - // but a number that has a weird ending, we need to convert it to pixels - // exclude left right for relativity - if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) { - // Remember the original values - var style = elem.style; - var left = style[LEFT]; - var rsLeft = elem[RUNTIME_STYLE][LEFT]; + var map$1 = array.map; + var slice = array.slice; - // prevent flashing of content - elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT]; + var implicit = {name: "implicit"}; - // Put in the new values to get a computed value out - style[LEFT] = name === 'fontSize' ? '1em' : ret || 0; - ret = style.pixelLeft + PX; + function ordinal(range) { + var index = d3Collection.map(), + domain = [], + unknown = implicit; - // Revert the changed values - style[LEFT] = left; + range = range == null ? [] : slice.call(range); - elem[RUNTIME_STYLE][LEFT] = rsLeft; + function scale(d) { + var key = d + "", i = index.get(key); + if (!i) { + if (unknown !== implicit) return unknown; + index.set(key, i = domain.push(d)); + } + return range[(i - 1) % range.length]; + } + + scale.domain = function(_) { + if (!arguments.length) return domain.slice(); + domain = [], index = d3Collection.map(); + var i = -1, n = _.length, d, key; + while (++i < n) if (!index.has(key = (d = _[i]) + "")) index.set(key, domain.push(d)); + return scale; + }; + + scale.range = function(_) { + return arguments.length ? (range = slice.call(_), scale) : range.slice(); + }; + + scale.unknown = function(_) { + return arguments.length ? (unknown = _, scale) : unknown; + }; + + scale.copy = function() { + return ordinal() + .domain(domain) + .range(range) + .unknown(unknown); + }; + + return scale; + } + + function band() { + var scale = ordinal().unknown(undefined), + domain = scale.domain, + ordinalRange = scale.range, + range = [0, 1], + step, + bandwidth, + round = false, + paddingInner = 0, + paddingOuter = 0, + align = 0.5; + + delete scale.unknown; + + function rescale() { + var n = domain().length, + reverse = range[1] < range[0], + start = range[reverse - 0], + stop = range[1 - reverse]; + step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2); + if (round) step = Math.floor(step); + start += (stop - start - step * (n - paddingInner)) * align; + bandwidth = step * (1 - paddingInner); + if (round) start = Math.round(start), bandwidth = Math.round(bandwidth); + var values = d3Array.range(n).map(function(i) { return start + step * i; }); + return ordinalRange(reverse ? values.reverse() : values); + } + + scale.domain = function(_) { + return arguments.length ? (domain(_), rescale()) : domain(); + }; + + scale.range = function(_) { + return arguments.length ? (range = [+_[0], +_[1]], rescale()) : range.slice(); + }; + + scale.rangeRound = function(_) { + return range = [+_[0], +_[1]], round = true, rescale(); + }; + + scale.bandwidth = function() { + return bandwidth; + }; + + scale.step = function() { + return step; + }; + + scale.round = function(_) { + return arguments.length ? (round = !!_, rescale()) : round; + }; + + scale.padding = function(_) { + return arguments.length ? (paddingInner = paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingInner; + }; + + scale.paddingInner = function(_) { + return arguments.length ? (paddingInner = Math.max(0, Math.min(1, _)), rescale()) : paddingInner; + }; + + scale.paddingOuter = function(_) { + return arguments.length ? (paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingOuter; + }; + + scale.align = function(_) { + return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align; + }; + + scale.copy = function() { + return band() + .domain(domain()) + .range(range) + .round(round) + .paddingInner(paddingInner) + .paddingOuter(paddingOuter) + .align(align); + }; + + return rescale(); } - return ret === '' ? 'auto' : ret; -} -if (typeof window !== 'undefined') { - getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE; -} + function pointish(scale) { + var copy = scale.copy; -function getOffsetDirection(dir, option) { - if (dir === 'left') { - return option.useCssRight ? 'right' : dir; + scale.padding = scale.paddingOuter; + delete scale.paddingInner; + delete scale.paddingOuter; + + scale.copy = function() { + return pointish(copy()); + }; + + return scale; } - return option.useCssBottom ? 'bottom' : dir; -} -function oppositeOffsetDirection(dir) { - if (dir === 'left') { - return 'right'; - } else if (dir === 'right') { - return 'left'; - } else if (dir === 'top') { - return 'bottom'; - } else if (dir === 'bottom') { - return 'top'; + function point() { + return pointish(band().paddingInner(1)); } -} -// 设置 elem 相对 elem.ownerDocument 的坐标 -function setLeftTop(elem, offset, option) { - // set position first, in-case top/left are set even on static elem - if (css(elem, 'position') === 'static') { - elem.style.position = 'relative'; + function constant(x) { + return function() { + return x; + }; } - var presetH = -999; - var presetV = -999; - var horizontalProperty = getOffsetDirection('left', option); - var verticalProperty = getOffsetDirection('top', option); - var oppositeHorizontalProperty = oppositeOffsetDirection(horizontalProperty); - var oppositeVerticalProperty = oppositeOffsetDirection(verticalProperty); - if (horizontalProperty !== 'left') { - presetH = 999; + function number(x) { + return +x; } - if (verticalProperty !== 'top') { - presetV = 999; + var unit = [0, 1]; + + function deinterpolate(a, b) { + return (b -= (a = +a)) + ? function(x) { return (x - a) / b; } + : constant(b); } - var originalTransition = ''; - var originalOffset = getOffset(elem); - if ('left' in offset || 'top' in offset) { - originalTransition = (0, _propertyUtils.getTransitionProperty)(elem) || ''; - (0, _propertyUtils.setTransitionProperty)(elem, 'none'); + + function deinterpolateClamp(deinterpolate) { + return function(a, b) { + var d = deinterpolate(a = +a, b = +b); + return function(x) { return x <= a ? 0 : x >= b ? 1 : d(x); }; + }; } - if ('left' in offset) { - elem.style[oppositeHorizontalProperty] = ''; - elem.style[horizontalProperty] = presetH + 'px'; + + function reinterpolateClamp(reinterpolate) { + return function(a, b) { + var r = reinterpolate(a = +a, b = +b); + return function(t) { return t <= 0 ? a : t >= 1 ? b : r(t); }; + }; } - if ('top' in offset) { - elem.style[oppositeVerticalProperty] = ''; - elem.style[verticalProperty] = presetV + 'px'; + + function bimap(domain, range, deinterpolate, reinterpolate) { + var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1]; + if (d1 < d0) d0 = deinterpolate(d1, d0), r0 = reinterpolate(r1, r0); + else d0 = deinterpolate(d0, d1), r0 = reinterpolate(r0, r1); + return function(x) { return r0(d0(x)); }; } - var old = getOffset(elem); - var originalStyle = {}; - for (var key in offset) { - if (offset.hasOwnProperty(key)) { - var dir = getOffsetDirection(key, option); - var preset = key === 'left' ? presetH : presetV; - var off = originalOffset[key] - old[key]; - if (dir === key) { - originalStyle[dir] = preset + off; - } else { - originalStyle[dir] = preset - off; - } + + function polymap(domain, range, deinterpolate, reinterpolate) { + var j = Math.min(domain.length, range.length) - 1, + d = new Array(j), + r = new Array(j), + i = -1; + + // Reverse descending domains. + if (domain[j] < domain[0]) { + domain = domain.slice().reverse(); + range = range.slice().reverse(); + } + + while (++i < j) { + d[i] = deinterpolate(domain[i], domain[i + 1]); + r[i] = reinterpolate(range[i], range[i + 1]); } + + return function(x) { + var i = d3Array.bisect(domain, x, 1, j) - 1; + return r[i](d[i](x)); + }; } - css(elem, originalStyle); - // force relayout - force(elem.offsetTop, elem.offsetLeft); - if ('left' in offset || 'top' in offset) { - (0, _propertyUtils.setTransitionProperty)(elem, originalTransition); + + function copy(source, target) { + return target + .domain(source.domain()) + .range(source.range()) + .interpolate(source.interpolate()) + .clamp(source.clamp()); } - var ret = {}; - for (var _key in offset) { - if (offset.hasOwnProperty(_key)) { - var _dir = getOffsetDirection(_key, option); - var _off = offset[_key] - originalOffset[_key]; - if (_key === _dir) { - ret[_dir] = originalStyle[_dir] + _off; - } else { - ret[_dir] = originalStyle[_dir] - _off; + + // deinterpolate(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1]. + // reinterpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding domain value x in [a,b]. + function continuous(deinterpolate$$, reinterpolate) { + var domain = unit, + range = unit, + interpolate = d3Interpolate.interpolate, + clamp = false, + piecewise, + output, + input; + + function rescale() { + piecewise = Math.min(domain.length, range.length) > 2 ? polymap : bimap; + output = input = null; + return scale; + } + + function scale(x) { + return (output || (output = piecewise(domain, range, clamp ? deinterpolateClamp(deinterpolate$$) : deinterpolate$$, interpolate)))(+x); + } + + scale.invert = function(y) { + return (input || (input = piecewise(range, domain, deinterpolate, clamp ? reinterpolateClamp(reinterpolate) : reinterpolate)))(+y); + }; + + scale.domain = function(_) { + return arguments.length ? (domain = map$1.call(_, number), rescale()) : domain.slice(); + }; + + scale.range = function(_) { + return arguments.length ? (range = slice.call(_), rescale()) : range.slice(); + }; + + scale.rangeRound = function(_) { + return range = slice.call(_), interpolate = d3Interpolate.interpolateRound, rescale(); + }; + + scale.clamp = function(_) { + return arguments.length ? (clamp = !!_, rescale()) : clamp; + }; + + scale.interpolate = function(_) { + return arguments.length ? (interpolate = _, rescale()) : interpolate; + }; + + return rescale(); + } + + function tickFormat(domain, count, specifier) { + var start = domain[0], + stop = domain[domain.length - 1], + step = d3Array.tickStep(start, stop, count == null ? 10 : count), + precision; + specifier = d3Format.formatSpecifier(specifier == null ? ",f" : specifier); + switch (specifier.type) { + case "s": { + var value = Math.max(Math.abs(start), Math.abs(stop)); + if (specifier.precision == null && !isNaN(precision = d3Format.precisionPrefix(step, value))) specifier.precision = precision; + return d3Format.formatPrefix(specifier, value); + } + case "": + case "e": + case "g": + case "p": + case "r": { + if (specifier.precision == null && !isNaN(precision = d3Format.precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e"); + break; + } + case "f": + case "%": { + if (specifier.precision == null && !isNaN(precision = d3Format.precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2; + break; } } + return d3Format.format(specifier); } - css(elem, ret); -} -function setTransform(elem, offset) { - var originalOffset = getOffset(elem); - var originalXY = (0, _propertyUtils.getTransformXY)(elem); - var resultXY = { x: originalXY.x, y: originalXY.y }; - if ('left' in offset) { - resultXY.x = originalXY.x + offset.left - originalOffset.left; - } - if ('top' in offset) { - resultXY.y = originalXY.y + offset.top - originalOffset.top; - } - (0, _propertyUtils.setTransformXY)(elem, resultXY); -} + function linearish(scale) { + var domain = scale.domain; -function setOffset(elem, offset, option) { - if (option.useCssRight || option.useCssBottom) { - setLeftTop(elem, offset, option); - } else if (option.useCssTransform && (0, _propertyUtils.getTransformName)() in document.body.style) { - setTransform(elem, offset, option); - } else { - setLeftTop(elem, offset, option); - } -} + scale.ticks = function(count) { + var d = domain(); + return d3Array.ticks(d[0], d[d.length - 1], count == null ? 10 : count); + }; -function each(arr, fn) { - for (var i = 0; i < arr.length; i++) { - fn(arr[i]); + scale.tickFormat = function(count, specifier) { + return tickFormat(domain(), count, specifier); + }; + + scale.nice = function(count) { + var d = domain(), + i = d.length - 1, + n = count == null ? 10 : count, + start = d[0], + stop = d[i], + step = d3Array.tickStep(start, stop, n); + + if (step) { + step = d3Array.tickStep(Math.floor(start / step) * step, Math.ceil(stop / step) * step, n); + d[0] = Math.floor(start / step) * step; + d[i] = Math.ceil(stop / step) * step; + domain(d); + } + + return scale; + }; + + return scale; } -} -function isBorderBoxFn(elem) { - return getComputedStyleX(elem, 'boxSizing') === 'border-box'; -} + function linear() { + var scale = continuous(deinterpolate, d3Interpolate.interpolateNumber); -var BOX_MODELS = ['margin', 'border', 'padding']; -var CONTENT_INDEX = -1; -var PADDING_INDEX = 2; -var BORDER_INDEX = 1; -var MARGIN_INDEX = 0; + scale.copy = function() { + return copy(scale, linear()); + }; -function swap(elem, options, callback) { - var old = {}; - var style = elem.style; - var name = void 0; + return linearish(scale); + } - // Remember the old values, and insert the new ones - for (name in options) { - if (options.hasOwnProperty(name)) { - old[name] = style[name]; - style[name] = options[name]; + function identity() { + var domain = [0, 1]; + + function scale(x) { + return +x; } + + scale.invert = scale; + + scale.domain = scale.range = function(_) { + return arguments.length ? (domain = map$1.call(_, number), scale) : domain.slice(); + }; + + scale.copy = function() { + return identity().domain(domain); + }; + + return linearish(scale); } - callback.call(elem); + function nice(domain, interval) { + domain = domain.slice(); - // Revert the old values - for (name in options) { - if (options.hasOwnProperty(name)) { - style[name] = old[name]; + var i0 = 0, + i1 = domain.length - 1, + x0 = domain[i0], + x1 = domain[i1], + t; + + if (x1 < x0) { + t = i0, i0 = i1, i1 = t; + t = x0, x0 = x1, x1 = t; } + + domain[i0] = interval.floor(x0); + domain[i1] = interval.ceil(x1); + return domain; } -} -function getPBMWidth(elem, props, which) { - var value = 0; - var prop = void 0; - var j = void 0; - var i = void 0; - for (j = 0; j < props.length; j++) { - prop = props[j]; - if (prop) { - for (i = 0; i < which.length; i++) { - var cssProp = void 0; - if (prop === 'border') { - cssProp = '' + prop + which[i] + 'Width'; - } else { - cssProp = prop + which[i]; - } - value += parseFloat(getComputedStyleX(elem, cssProp)) || 0; - } - } + function deinterpolate$1(a, b) { + return (b = Math.log(b / a)) + ? function(x) { return Math.log(x / a) / b; } + : constant(b); } - return value; -} -/** - * A crude way of determining if an object is a window - * @member util - */ -function isWindow(obj) { - // must use == for ie8 - /* eslint eqeqeq:0 */ - return obj !== null && obj !== undefined && obj == obj.window; -} + function reinterpolate(a, b) { + return a < 0 + ? function(t) { return -Math.pow(-b, t) * Math.pow(-a, 1 - t); } + : function(t) { return Math.pow(b, t) * Math.pow(a, 1 - t); }; + } -var domUtils = {}; + function pow10(x) { + return isFinite(x) ? +("1e" + x) : x < 0 ? 0 : x; + } -each(['Width', 'Height'], function (name) { - domUtils['doc' + name] = function (refWin) { - var d = refWin.document; - return Math.max( - // firefox chrome documentElement.scrollHeight< body.scrollHeight - // ie standard mode : documentElement.scrollHeight> body.scrollHeight - d.documentElement['scroll' + name], - // quirks : documentElement.scrollHeight 最大等于可视窗口多一点? - d.body['scroll' + name], domUtils['viewport' + name](d)); - }; + function powp(base) { + return base === 10 ? pow10 + : base === Math.E ? Math.exp + : function(x) { return Math.pow(base, x); }; + } - domUtils['viewport' + name] = function (win) { - // pc browser includes scrollbar in window.innerWidth - var prop = 'client' + name; - var doc = win.document; - var body = doc.body; - var documentElement = doc.documentElement; - var documentElementProp = documentElement[prop]; - // 标准模式取 documentElement - // backcompat 取 body - return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp; - }; -}); + function logp(base) { + return base === Math.E ? Math.log + : base === 10 && Math.log10 + || base === 2 && Math.log2 + || (base = Math.log(base), function(x) { return Math.log(x) / base; }); + } -/* - 得到元素的大小信息 - @param elem - @param name - @param {String} [extra] 'padding' : (css width) + padding - 'border' : (css width) + padding + border - 'margin' : (css width) + padding + border + margin - */ -function getWH(elem, name, ex) { - var extra = ex; - if (isWindow(elem)) { - return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem); - } else if (elem.nodeType === 9) { - return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem); + function reflect(f) { + return function(x) { + return -f(-x); + }; } - var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; - var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight; - var computedStyle = getComputedStyleX(elem); - var isBorderBox = isBorderBoxFn(elem, computedStyle); - var cssBoxValue = 0; - if (borderBoxValue === null || borderBoxValue === undefined || borderBoxValue <= 0) { - borderBoxValue = undefined; - // Fall back to computed then un computed css if necessary - cssBoxValue = getComputedStyleX(elem, name); - if (cssBoxValue === null || cssBoxValue === undefined || Number(cssBoxValue) < 0) { - cssBoxValue = elem.style[name] || 0; + + function log() { + var scale = continuous(deinterpolate$1, reinterpolate).domain([1, 10]), + domain = scale.domain, + base = 10, + logs = logp(10), + pows = powp(10); + + function rescale() { + logs = logp(base), pows = powp(base); + if (domain()[0] < 0) logs = reflect(logs), pows = reflect(pows); + return scale; } - // Normalize '', auto, and prepare for extra - cssBoxValue = parseFloat(cssBoxValue) || 0; + + scale.base = function(_) { + return arguments.length ? (base = +_, rescale()) : base; + }; + + scale.domain = function(_) { + return arguments.length ? (domain(_), rescale()) : domain(); + }; + + scale.ticks = function(count) { + var d = domain(), + u = d[0], + v = d[d.length - 1], + r; + + if (r = v < u) i = u, u = v, v = i; + + var i = logs(u), + j = logs(v), + p, + k, + t, + n = count == null ? 10 : +count, + z = []; + + if (!(base % 1) && j - i < n) { + i = Math.round(i) - 1, j = Math.round(j) + 1; + if (u > 0) for (; i < j; ++i) { + for (k = 1, p = pows(i); k < base; ++k) { + t = p * k; + if (t < u) continue; + if (t > v) break; + z.push(t); + } + } else for (; i < j; ++i) { + for (k = base - 1, p = pows(i); k >= 1; --k) { + t = p * k; + if (t < u) continue; + if (t > v) break; + z.push(t); + } + } + } else { + z = d3Array.ticks(i, j, Math.min(j - i, n)).map(pows); + } + + return r ? z.reverse() : z; + }; + + scale.tickFormat = function(count, specifier) { + if (specifier == null) specifier = base === 10 ? ".0e" : ","; + if (typeof specifier !== "function") specifier = d3Format.format(specifier); + if (count === Infinity) return specifier; + if (count == null) count = 10; + var k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate? + return function(d) { + var i = d / pows(Math.round(logs(d))); + if (i * base < base - 0.5) i *= base; + return i <= k ? specifier(d) : ""; + }; + }; + + scale.nice = function() { + return domain(nice(domain(), { + floor: function(x) { return pows(Math.floor(logs(x))); }, + ceil: function(x) { return pows(Math.ceil(logs(x))); } + })); + }; + + scale.copy = function() { + return copy(scale, log().base(base)); + }; + + return scale; } - if (extra === undefined) { - extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX; + + function raise(x, exponent) { + return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent); } - var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox; - var val = borderBoxValue || cssBoxValue; - if (extra === CONTENT_INDEX) { - if (borderBoxValueOrIsBorderBox) { - return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle); + + function pow() { + var exponent = 1, + scale = continuous(deinterpolate, reinterpolate), + domain = scale.domain; + + function deinterpolate(a, b) { + return (b = raise(b, exponent) - (a = raise(a, exponent))) + ? function(x) { return (raise(x, exponent) - a) / b; } + : constant(b); } - return cssBoxValue; - } else if (borderBoxValueOrIsBorderBox) { - if (extra === BORDER_INDEX) { - return val; + + function reinterpolate(a, b) { + b = raise(b, exponent) - (a = raise(a, exponent)); + return function(t) { return raise(a + b * t, 1 / exponent); }; } - return val + (extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle)); - } - return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle); -} -var cssShow = { - position: 'absolute', - visibility: 'hidden', - display: 'block' -}; + scale.exponent = function(_) { + return arguments.length ? (exponent = +_, domain(domain())) : exponent; + }; -// fix #119 : https://github.com/kissyteam/kissy/issues/119 -function getWHIgnoreDisplay() { - for (var _len = arguments.length, args = Array(_len), _key2 = 0; _key2 < _len; _key2++) { - args[_key2] = arguments[_key2]; + scale.copy = function() { + return copy(scale, pow().exponent(exponent)); + }; + + return linearish(scale); } - var val = void 0; - var elem = args[0]; - // in case elem is window - // elem.offsetWidth === undefined - if (elem.offsetWidth !== 0) { - val = getWH.apply(undefined, args); - } else { - swap(elem, cssShow, function () { - val = getWH.apply(undefined, args); - }); + function sqrt() { + return pow().exponent(0.5); } - return val; -} -each(['width', 'height'], function (name) { - var first = name.charAt(0).toUpperCase() + name.slice(1); - domUtils['outer' + first] = function (el, includeMargin) { - return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX); - }; - var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; + function quantile$1() { + var domain = [], + range = [], + thresholds = []; - domUtils[name] = function (elem, v) { - var val = v; - if (val !== undefined) { - if (elem) { - var computedStyle = getComputedStyleX(elem); - var isBorderBox = isBorderBoxFn(elem); - if (isBorderBox) { - val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle); - } - return css(elem, name, val); - } - return undefined; + function rescale() { + var i = 0, n = Math.max(1, range.length); + thresholds = new Array(n - 1); + while (++i < n) thresholds[i - 1] = d3Array.quantile(domain, i / n); + return scale; } - return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX); - }; -}); -function mix(to, from) { - for (var i in from) { - if (from.hasOwnProperty(i)) { - to[i] = from[i]; + function scale(x) { + if (!isNaN(x = +x)) return range[d3Array.bisect(thresholds, x)]; } + + scale.invertExtent = function(y) { + var i = range.indexOf(y); + return i < 0 ? [NaN, NaN] : [ + i > 0 ? thresholds[i - 1] : domain[0], + i < thresholds.length ? thresholds[i] : domain[domain.length - 1] + ]; + }; + + scale.domain = function(_) { + if (!arguments.length) return domain.slice(); + domain = []; + for (var i = 0, n = _.length, d; i < n; ++i) if (d = _[i], d != null && !isNaN(d = +d)) domain.push(d); + domain.sort(d3Array.ascending); + return rescale(); + }; + + scale.range = function(_) { + return arguments.length ? (range = slice.call(_), rescale()) : range.slice(); + }; + + scale.quantiles = function() { + return thresholds.slice(); + }; + + scale.copy = function() { + return quantile$1() + .domain(domain) + .range(range); + }; + + return scale; } - return to; -} -var utils = { - getWindow: function getWindow(node) { - if (node && node.document && node.setTimeout) { - return node; + function quantize() { + var x0 = 0, + x1 = 1, + n = 1, + domain = [0.5], + range = [0, 1]; + + function scale(x) { + if (x <= x) return range[d3Array.bisect(domain, x, 0, n)]; } - var doc = node.ownerDocument || node; - return doc.defaultView || doc.parentWindow; - }, - offset: function offset(el, value, option) { - if (typeof value !== 'undefined') { - setOffset(el, value, option || {}); - } else { - return getOffset(el); + + function rescale() { + var i = -1; + domain = new Array(n); + while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1); + return scale; } - }, - isWindow: isWindow, - each: each, - css: css, - clone: function clone(obj) { - var i = void 0; - var ret = {}; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - ret[i] = obj[i]; - } + scale.domain = function(_) { + return arguments.length ? (x0 = +_[0], x1 = +_[1], rescale()) : [x0, x1]; + }; + + scale.range = function(_) { + return arguments.length ? (n = (range = slice.call(_)).length - 1, rescale()) : range.slice(); + }; + + scale.invertExtent = function(y) { + var i = range.indexOf(y); + return i < 0 ? [NaN, NaN] + : i < 1 ? [x0, domain[0]] + : i >= n ? [domain[n - 1], x1] + : [domain[i - 1], domain[i]]; + }; + + scale.copy = function() { + return quantize() + .domain([x0, x1]) + .range(range); + }; + + return linearish(scale); + } + + function threshold() { + var domain = [0.5], + range = [0, 1], + n = 1; + + function scale(x) { + if (x <= x) return range[d3Array.bisect(domain, x, 0, n)]; } - var overflow = obj.overflow; - if (overflow) { - for (i in obj) { - if (obj.hasOwnProperty(i)) { - ret.overflow[i] = obj.overflow[i]; + + scale.domain = function(_) { + return arguments.length ? (domain = slice.call(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice(); + }; + + scale.range = function(_) { + return arguments.length ? (range = slice.call(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice(); + }; + + scale.invertExtent = function(y) { + var i = range.indexOf(y); + return [domain[i - 1], domain[i]]; + }; + + scale.copy = function() { + return threshold() + .domain(domain) + .range(range); + }; + + return scale; + } + + var durationSecond = 1000; + var durationMinute = durationSecond * 60; + var durationHour = durationMinute * 60; + var durationDay = durationHour * 24; + var durationWeek = durationDay * 7; + var durationMonth = durationDay * 30; + var durationYear = durationDay * 365; + function date(t) { + return new Date(t); + } + + function number$1(t) { + return t instanceof Date ? +t : +new Date(+t); + } + + function calendar(year, month, week, day, hour, minute, second, millisecond, format) { + var scale = continuous(deinterpolate, d3Interpolate.interpolateNumber), + invert = scale.invert, + domain = scale.domain; + + var formatMillisecond = format(".%L"), + formatSecond = format(":%S"), + formatMinute = format("%I:%M"), + formatHour = format("%I %p"), + formatDay = format("%a %d"), + formatWeek = format("%b %d"), + formatMonth = format("%B"), + formatYear = format("%Y"); + + var tickIntervals = [ + [second, 1, durationSecond], + [second, 5, 5 * durationSecond], + [second, 15, 15 * durationSecond], + [second, 30, 30 * durationSecond], + [minute, 1, durationMinute], + [minute, 5, 5 * durationMinute], + [minute, 15, 15 * durationMinute], + [minute, 30, 30 * durationMinute], + [ hour, 1, durationHour ], + [ hour, 3, 3 * durationHour ], + [ hour, 6, 6 * durationHour ], + [ hour, 12, 12 * durationHour ], + [ day, 1, durationDay ], + [ day, 2, 2 * durationDay ], + [ week, 1, durationWeek ], + [ month, 1, durationMonth ], + [ month, 3, 3 * durationMonth ], + [ year, 1, durationYear ] + ]; + + function tickFormat(date) { + return (second(date) < date ? formatMillisecond + : minute(date) < date ? formatSecond + : hour(date) < date ? formatMinute + : day(date) < date ? formatHour + : month(date) < date ? (week(date) < date ? formatDay : formatWeek) + : year(date) < date ? formatMonth + : formatYear)(date); + } + + function tickInterval(interval, start, stop, step) { + if (interval == null) interval = 10; + + // If a desired tick count is specified, pick a reasonable tick interval + // based on the extent of the domain and a rough estimate of tick size. + // Otherwise, assume interval is already a time interval and use it. + if (typeof interval === "number") { + var target = Math.abs(stop - start) / interval, + i = d3Array.bisector(function(i) { return i[2]; }).right(tickIntervals, target); + if (i === tickIntervals.length) { + step = d3Array.tickStep(start / durationYear, stop / durationYear, interval); + interval = year; + } else if (i) { + i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i]; + step = i[1]; + interval = i[0]; + } else { + step = d3Array.tickStep(start, stop, interval); + interval = millisecond; } } + + return step == null ? interval : interval.every(step); } - return ret; - }, - mix: mix, - getWindowScrollLeft: function getWindowScrollLeft(w) { - return getScrollLeft(w); - }, - getWindowScrollTop: function getWindowScrollTop(w) { - return getScrollTop(w); - }, - merge: function merge() { - var ret = {}; + scale.invert = function(y) { + return new Date(invert(y)); + }; - for (var _len2 = arguments.length, args = Array(_len2), _key3 = 0; _key3 < _len2; _key3++) { - args[_key3] = arguments[_key3]; - } + scale.domain = function(_) { + return arguments.length ? domain(map$1.call(_, number$1)) : domain().map(date); + }; - for (var i = 0; i < args.length; i++) { - utils.mix(ret, args[i]); - } - return ret; - }, + scale.ticks = function(interval, step) { + var d = domain(), + t0 = d[0], + t1 = d[d.length - 1], + r = t1 < t0, + t; + if (r) t = t0, t0 = t1, t1 = t; + t = tickInterval(interval, t0, t1, step); + t = t ? t.range(t0, t1 + 1) : []; // inclusive stop + return r ? t.reverse() : t; + }; - viewportWidth: 0, - viewportHeight: 0 -}; + scale.tickFormat = function(count, specifier) { + return specifier == null ? tickFormat : format(specifier); + }; -mix(utils, domUtils); + scale.nice = function(interval, step) { + var d = domain(); + return (interval = tickInterval(interval, d[0], d[d.length - 1], step)) + ? domain(nice(d, interval)) + : scale; + }; -exports["default"] = utils; -module.exports = exports['default']; -},{"./propertyUtils":143}],145:[function(require,module,exports){ -'use strict'; + scale.copy = function() { + return copy(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format)); + }; -Object.defineProperty(exports, "__esModule", { - value: true -}); + return scale; + } -var _react = require('react'); + function time() { + return calendar(d3Time.timeYear, d3Time.timeMonth, d3Time.timeWeek, d3Time.timeDay, d3Time.timeHour, d3Time.timeMinute, d3Time.timeSecond, d3Time.timeMillisecond, d3TimeFormat.timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]); + } -var _react2 = _interopRequireDefault(_react); + function utcTime() { + return calendar(d3Time.utcYear, d3Time.utcMonth, d3Time.utcWeek, d3Time.utcDay, d3Time.utcHour, d3Time.utcMinute, d3Time.utcSecond, d3Time.utcMillisecond, d3TimeFormat.utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]); + } -var _ChildrenUtils = require('./ChildrenUtils'); + function colors(s) { + return s.match(/.{6}/g).map(function(x) { + return "#" + x; + }); + } -var _AnimateChild = require('./AnimateChild'); + var category10 = colors("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"); -var _AnimateChild2 = _interopRequireDefault(_AnimateChild); + var category20b = colors("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6"); -var _util = require('./util'); + var category20c = colors("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9"); -var _util2 = _interopRequireDefault(_util); + var category20 = colors("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5"); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + var cubehelix$1 = d3Interpolate.interpolateCubehelixLong(d3Color.cubehelix(300, 0.5, 0.0), d3Color.cubehelix(-240, 0.5, 1.0)); -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + var warm = d3Interpolate.interpolateCubehelixLong(d3Color.cubehelix(-100, 0.75, 0.35), d3Color.cubehelix(80, 1.50, 0.8)); -var defaultKey = 'rc_animate_' + Date.now(); + var cool = d3Interpolate.interpolateCubehelixLong(d3Color.cubehelix(260, 0.75, 0.35), d3Color.cubehelix(80, 1.50, 0.8)); + var rainbow = d3Color.cubehelix(); -function getChildrenFromProps(props) { - var children = props.children; - if (_react2["default"].isValidElement(children)) { - if (!children.key) { - return _react2["default"].cloneElement(children, { - key: defaultKey - }); - } + function rainbow$1(t) { + if (t < 0 || t > 1) t -= Math.floor(t); + var ts = Math.abs(t - 0.5); + rainbow.h = 360 * t - 100; + rainbow.s = 1.5 - 1.5 * ts; + rainbow.l = 0.8 - 0.9 * ts; + return rainbow + ""; } - return children; -} -function noop() {} + function ramp(range) { + var n = range.length; + return function(t) { + return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; + }; + } -var Animate = _react2["default"].createClass({ - displayName: 'Animate', + var viridis = ramp(colors("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")); - propTypes: { - component: _react2["default"].PropTypes.any, - animation: _react2["default"].PropTypes.object, - transitionName: _react2["default"].PropTypes.oneOfType([_react2["default"].PropTypes.string, _react2["default"].PropTypes.object]), - transitionEnter: _react2["default"].PropTypes.bool, - transitionAppear: _react2["default"].PropTypes.bool, - exclusive: _react2["default"].PropTypes.bool, - transitionLeave: _react2["default"].PropTypes.bool, - onEnd: _react2["default"].PropTypes.func, - onEnter: _react2["default"].PropTypes.func, - onLeave: _react2["default"].PropTypes.func, - onAppear: _react2["default"].PropTypes.func, - showProp: _react2["default"].PropTypes.string - }, + var magma = ramp(colors("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")); - getDefaultProps: function getDefaultProps() { - return { - animation: {}, - component: 'span', - transitionEnter: true, - transitionLeave: true, - transitionAppear: false, - onEnd: noop, - onEnter: noop, - onLeave: noop, - onAppear: noop + var inferno = ramp(colors("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")); + + var plasma = ramp(colors("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921")); + + function sequential(interpolator) { + var x0 = 0, + x1 = 1, + clamp = false; + + function scale(x) { + var t = (x - x0) / (x1 - x0); + return interpolator(clamp ? Math.max(0, Math.min(1, t)) : t); + } + + scale.domain = function(_) { + return arguments.length ? (x0 = +_[0], x1 = +_[1], scale) : [x0, x1]; }; - }, - getInitialState: function getInitialState() { - this.currentlyAnimatingKeys = {}; - this.keysToEnter = []; - this.keysToLeave = []; - return { - children: (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(this.props)) + + scale.clamp = function(_) { + return arguments.length ? (clamp = !!_, scale) : clamp; }; - }, - componentDidMount: function componentDidMount() { - var _this = this; - var showProp = this.props.showProp; - var children = this.state.children; - if (showProp) { - children = children.filter(function (child) { - return !!child.props[showProp]; - }); - } - children.forEach(function (child) { - if (child) { - _this.performAppear(child.key); + scale.interpolator = function(_) { + return arguments.length ? (interpolator = _, scale) : interpolator; + }; + + scale.copy = function() { + return sequential(interpolator).domain([x0, x1]).clamp(clamp); + }; + + return linearish(scale); + } + + exports.scaleBand = band; + exports.scalePoint = point; + exports.scaleIdentity = identity; + exports.scaleLinear = linear; + exports.scaleLog = log; + exports.scaleOrdinal = ordinal; + exports.scaleImplicit = implicit; + exports.scalePow = pow; + exports.scaleSqrt = sqrt; + exports.scaleQuantile = quantile$1; + exports.scaleQuantize = quantize; + exports.scaleThreshold = threshold; + exports.scaleTime = time; + exports.scaleUtc = utcTime; + exports.schemeCategory10 = category10; + exports.schemeCategory20b = category20b; + exports.schemeCategory20c = category20c; + exports.schemeCategory20 = category20; + exports.interpolateCubehelixDefault = cubehelix$1; + exports.interpolateRainbow = rainbow$1; + exports.interpolateWarm = warm; + exports.interpolateCool = cool; + exports.interpolateViridis = viridis; + exports.interpolateMagma = magma; + exports.interpolateInferno = inferno; + exports.interpolatePlasma = plasma; + exports.scaleSequential = sequential; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); +},{"d3-array":132,"d3-collection":133,"d3-color":134,"d3-format":135,"d3-interpolate":137,"d3-time":142,"d3-time-format":141}],140:[function(require,module,exports){ +// https://d3js.org/d3-shape/ Version 1.0.3. Copyright 2016 Mike Bostock. +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-path')) : + typeof define === 'function' && define.amd ? define(['exports', 'd3-path'], factory) : + (factory((global.d3 = global.d3 || {}),global.d3)); +}(this, (function (exports,d3Path) { 'use strict'; + +function constant(x) { + return function constant() { + return x; + }; +} + +var epsilon = 1e-12; +var pi = Math.PI; +var halfPi = pi / 2; +var tau = 2 * pi; + +function arcInnerRadius(d) { + return d.innerRadius; +} + +function arcOuterRadius(d) { + return d.outerRadius; +} + +function arcStartAngle(d) { + return d.startAngle; +} + +function arcEndAngle(d) { + return d.endAngle; +} + +function arcPadAngle(d) { + return d && d.padAngle; // Note: optional! +} + +function asin(x) { + return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x); +} + +function intersect(x0, y0, x1, y1, x2, y2, x3, y3) { + var x10 = x1 - x0, y10 = y1 - y0, + x32 = x3 - x2, y32 = y3 - y2, + t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / (y32 * x10 - x32 * y10); + return [x0 + t * x10, y0 + t * y10]; +} + +// Compute perpendicular offset line of length rc. +// http://mathworld.wolfram.com/Circle-LineIntersection.html +function cornerTangents(x0, y0, x1, y1, r1, rc, cw) { + var x01 = x0 - x1, + y01 = y0 - y1, + lo = (cw ? rc : -rc) / Math.sqrt(x01 * x01 + y01 * y01), + ox = lo * y01, + oy = -lo * x01, + x11 = x0 + ox, + y11 = y0 + oy, + x10 = x1 + ox, + y10 = y1 + oy, + x00 = (x11 + x10) / 2, + y00 = (y11 + y10) / 2, + dx = x10 - x11, + dy = y10 - y11, + d2 = dx * dx + dy * dy, + r = r1 - rc, + D = x11 * y10 - x10 * y11, + d = (dy < 0 ? -1 : 1) * Math.sqrt(Math.max(0, r * r * d2 - D * D)), + cx0 = (D * dy - dx * d) / d2, + cy0 = (-D * dx - dy * d) / d2, + cx1 = (D * dy + dx * d) / d2, + cy1 = (-D * dx + dy * d) / d2, + dx0 = cx0 - x00, + dy0 = cy0 - y00, + dx1 = cx1 - x00, + dy1 = cy1 - y00; + + // Pick the closer of the two intersection points. + // TODO Is there a faster way to determine which intersection to use? + if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1; + + return { + cx: cx0, + cy: cy0, + x01: -ox, + y01: -oy, + x11: cx0 * (r1 / r - 1), + y11: cy0 * (r1 / r - 1) + }; +} + +function arc() { + var innerRadius = arcInnerRadius, + outerRadius = arcOuterRadius, + cornerRadius = constant(0), + padRadius = null, + startAngle = arcStartAngle, + endAngle = arcEndAngle, + padAngle = arcPadAngle, + context = null; + + function arc() { + var buffer, + r, + r0 = +innerRadius.apply(this, arguments), + r1 = +outerRadius.apply(this, arguments), + a0 = startAngle.apply(this, arguments) - halfPi, + a1 = endAngle.apply(this, arguments) - halfPi, + da = Math.abs(a1 - a0), + cw = a1 > a0; + + if (!context) context = buffer = d3Path.path(); + + // Ensure that the outer radius is always larger than the inner radius. + if (r1 < r0) r = r1, r1 = r0, r0 = r; + + // Is it a point? + if (!(r1 > epsilon)) context.moveTo(0, 0); + + // Or is it a circle or annulus? + else if (da > tau - epsilon) { + context.moveTo(r1 * Math.cos(a0), r1 * Math.sin(a0)); + context.arc(0, 0, r1, a0, a1, !cw); + if (r0 > epsilon) { + context.moveTo(r0 * Math.cos(a1), r0 * Math.sin(a1)); + context.arc(0, 0, r0, a1, a0, cw); + } + } + + // Or is it a circular or annular sector? + else { + var a01 = a0, + a11 = a1, + a00 = a0, + a10 = a1, + da0 = da, + da1 = da, + ap = padAngle.apply(this, arguments) / 2, + rp = (ap > epsilon) && (padRadius ? +padRadius.apply(this, arguments) : Math.sqrt(r0 * r0 + r1 * r1)), + rc = Math.min(Math.abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), + rc0 = rc, + rc1 = rc, + t0, + t1; + + // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0. + if (rp > epsilon) { + var p0 = asin(rp / r0 * Math.sin(ap)), + p1 = asin(rp / r1 * Math.sin(ap)); + if ((da0 -= p0 * 2) > epsilon) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0; + else da0 = 0, a00 = a10 = (a0 + a1) / 2; + if ((da1 -= p1 * 2) > epsilon) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1; + else da1 = 0, a01 = a11 = (a0 + a1) / 2; + } + + var x01 = r1 * Math.cos(a01), + y01 = r1 * Math.sin(a01), + x10 = r0 * Math.cos(a10), + y10 = r0 * Math.sin(a10); + + // Apply rounded corners? + if (rc > epsilon) { + var x11 = r1 * Math.cos(a11), + y11 = r1 * Math.sin(a11), + x00 = r0 * Math.cos(a00), + y00 = r0 * Math.sin(a00); + + // Restrict the corner radius according to the sector angle. + if (da < pi) { + var oc = da0 > epsilon ? intersect(x01, y01, x00, y00, x11, y11, x10, y10) : [x10, y10], + ax = x01 - oc[0], + ay = y01 - oc[1], + bx = x11 - oc[0], + by = y11 - oc[1], + kc = 1 / Math.sin(Math.acos((ax * bx + ay * by) / (Math.sqrt(ax * ax + ay * ay) * Math.sqrt(bx * bx + by * by))) / 2), + lc = Math.sqrt(oc[0] * oc[0] + oc[1] * oc[1]); + rc0 = Math.min(rc, (r0 - lc) / (kc - 1)); + rc1 = Math.min(rc, (r1 - lc) / (kc + 1)); + } } - }); - }, - componentWillReceiveProps: function componentWillReceiveProps(nextProps) { - var _this2 = this; - this.nextProps = nextProps; - var nextChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(nextProps)); - var props = this.props; - // exclusive needs immediate response - if (props.exclusive) { - Object.keys(this.currentlyAnimatingKeys).forEach(function (key) { - _this2.stop(key); - }); - } - var showProp = props.showProp; - var currentlyAnimatingKeys = this.currentlyAnimatingKeys; - // last props children if exclusive - var currentChildren = props.exclusive ? (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)) : this.state.children; - // in case destroy in showProp mode - var newChildren = []; - if (showProp) { - currentChildren.forEach(function (currentChild) { - var nextChild = currentChild && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, currentChild.key); - var newChild = void 0; - if ((!nextChild || !nextChild.props[showProp]) && currentChild.props[showProp]) { - newChild = _react2["default"].cloneElement(nextChild || currentChild, _defineProperty({}, showProp, true)); - } else { - newChild = nextChild; - } - if (newChild) { - newChildren.push(newChild); - } - }); - nextChildren.forEach(function (nextChild) { - if (!nextChild || !(0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, nextChild.key)) { - newChildren.push(nextChild); - } - }); - } else { - newChildren = (0, _ChildrenUtils.mergeChildren)(currentChildren, nextChildren); + // Is the sector collapsed to a line? + if (!(da1 > epsilon)) context.moveTo(x01, y01); + + // Does the sector’s outer ring have rounded corners? + else if (rc1 > epsilon) { + t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw); + t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw); + + context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01); + + // Have the corners merged? + if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, Math.atan2(t0.y01, t0.x01), Math.atan2(t1.y01, t1.x01), !cw); + + // Otherwise, draw the two corners and the ring. + else { + context.arc(t0.cx, t0.cy, rc1, Math.atan2(t0.y01, t0.x01), Math.atan2(t0.y11, t0.x11), !cw); + context.arc(0, 0, r1, Math.atan2(t0.cy + t0.y11, t0.cx + t0.x11), Math.atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw); + context.arc(t1.cx, t1.cy, rc1, Math.atan2(t1.y11, t1.x11), Math.atan2(t1.y01, t1.x01), !cw); + } + } + + // Or is the outer ring just a circular arc? + else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw); + + // Is there no inner ring, and it’s a circular sector? + // Or perhaps it’s an annular sector collapsed due to padding? + if (!(r0 > epsilon) || !(da0 > epsilon)) context.lineTo(x10, y10); + + // Does the sector’s inner ring (or point) have rounded corners? + else if (rc0 > epsilon) { + t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw); + t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw); + + context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01); + + // Have the corners merged? + if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, Math.atan2(t0.y01, t0.x01), Math.atan2(t1.y01, t1.x01), !cw); + + // Otherwise, draw the two corners and the ring. + else { + context.arc(t0.cx, t0.cy, rc0, Math.atan2(t0.y01, t0.x01), Math.atan2(t0.y11, t0.x11), !cw); + context.arc(0, 0, r0, Math.atan2(t0.cy + t0.y11, t0.cx + t0.x11), Math.atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw); + context.arc(t1.cx, t1.cy, rc0, Math.atan2(t1.y11, t1.x11), Math.atan2(t1.y01, t1.x01), !cw); + } + } + + // Or is the inner ring just a circular arc? + else context.arc(0, 0, r0, a10, a00, cw); } - // need render to avoid update - this.setState({ - children: newChildren - }); + context.closePath(); - nextChildren.forEach(function (child) { - var key = child && child.key; - if (child && currentlyAnimatingKeys[key]) { - return; - } - var hasPrev = child && (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key); - if (showProp) { - var showInNext = child.props[showProp]; - if (hasPrev) { - var showInNow = (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp); - if (!showInNow && showInNext) { - _this2.keysToEnter.push(key); - } - } else if (showInNext) { - _this2.keysToEnter.push(key); - } - } else if (!hasPrev) { - _this2.keysToEnter.push(key); - } - }); + if (buffer) return context = null, buffer + "" || null; + } - currentChildren.forEach(function (child) { - var key = child && child.key; - if (child && currentlyAnimatingKeys[key]) { - return; - } - var hasNext = child && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, key); - if (showProp) { - var showInNow = child.props[showProp]; - if (hasNext) { - var showInNext = (0, _ChildrenUtils.findShownChildInChildrenByKey)(nextChildren, key, showProp); - if (!showInNext && showInNow) { - _this2.keysToLeave.push(key); - } - } else if (showInNow) { - _this2.keysToLeave.push(key); - } - } else if (!hasNext) { - _this2.keysToLeave.push(key); - } - }); + arc.centroid = function() { + var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, + a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2; + return [Math.cos(a) * r, Math.sin(a) * r]; + }; + + arc.innerRadius = function(_) { + return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant(+_), arc) : innerRadius; + }; + + arc.outerRadius = function(_) { + return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant(+_), arc) : outerRadius; + }; + + arc.cornerRadius = function(_) { + return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant(+_), arc) : cornerRadius; + }; + + arc.padRadius = function(_) { + return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant(+_), arc) : padRadius; + }; + + arc.startAngle = function(_) { + return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), arc) : startAngle; + }; + + arc.endAngle = function(_) { + return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), arc) : endAngle; + }; + + arc.padAngle = function(_) { + return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), arc) : padAngle; + }; + + arc.context = function(_) { + return arguments.length ? ((context = _ == null ? null : _), arc) : context; + }; + + return arc; +} + +function Linear(context) { + this._context = context; +} + +Linear.prototype = { + areaStart: function() { + this._line = 0; }, - componentDidUpdate: function componentDidUpdate() { - var keysToEnter = this.keysToEnter; - this.keysToEnter = []; - keysToEnter.forEach(this.performEnter); - var keysToLeave = this.keysToLeave; - this.keysToLeave = []; - keysToLeave.forEach(this.performLeave); + areaEnd: function() { + this._line = NaN; }, - performEnter: function performEnter(key) { - // may already remove by exclusive - if (this.refs[key]) { - this.currentlyAnimatingKeys[key] = true; - this.refs[key].componentWillEnter(this.handleDoneAdding.bind(this, key, 'enter')); - } + lineStart: function() { + this._point = 0; }, - performAppear: function performAppear(key) { - if (this.refs[key]) { - this.currentlyAnimatingKeys[key] = true; - this.refs[key].componentWillAppear(this.handleDoneAdding.bind(this, key, 'appear')); - } + lineEnd: function() { + if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); + this._line = 1 - this._line; }, - handleDoneAdding: function handleDoneAdding(key, type) { - var props = this.props; - delete this.currentlyAnimatingKeys[key]; - // if update on exclusive mode, skip check - if (props.exclusive && props !== this.nextProps) { - return; + point: function(x, y) { + x = +x, y = +y; + switch (this._point) { + case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; + case 1: this._point = 2; // proceed + default: this._context.lineTo(x, y); break; } - var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)); - if (!this.isValidChildByKey(currentChildren, key)) { - // exclusive will not need this - this.performLeave(key); - } else { - if (type === 'appear') { - if (_util2["default"].allowAppearCallback(props)) { - props.onAppear(key); - props.onEnd(key, true); - } - } else { - if (_util2["default"].allowEnterCallback(props)) { - props.onEnter(key); - props.onEnd(key, true); - } + } +}; + +function curveLinear(context) { + return new Linear(context); +} + +function x(p) { + return p[0]; +} + +function y(p) { + return p[1]; +} + +function line() { + var x$$ = x, + y$$ = y, + defined = constant(true), + context = null, + curve = curveLinear, + output = null; + + function line(data) { + var i, + n = data.length, + d, + defined0 = false, + buffer; + + if (context == null) output = curve(buffer = d3Path.path()); + + for (i = 0; i <= n; ++i) { + if (!(i < n && defined(d = data[i], i, data)) === defined0) { + if (defined0 = !defined0) output.lineStart(); + else output.lineEnd(); } + if (defined0) output.point(+x$$(d, i, data), +y$$(d, i, data)); } - }, - performLeave: function performLeave(key) { - // may already remove by exclusive - if (this.refs[key]) { - this.currentlyAnimatingKeys[key] = true; - this.refs[key].componentWillLeave(this.handleDoneLeaving.bind(this, key)); + + if (buffer) return output = null, buffer + "" || null; + } + + line.x = function(_) { + return arguments.length ? (x$$ = typeof _ === "function" ? _ : constant(+_), line) : x$$; + }; + + line.y = function(_) { + return arguments.length ? (y$$ = typeof _ === "function" ? _ : constant(+_), line) : y$$; + }; + + line.defined = function(_) { + return arguments.length ? (defined = typeof _ === "function" ? _ : constant(!!_), line) : defined; + }; + + line.curve = function(_) { + return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve; + }; + + line.context = function(_) { + return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context; + }; + + return line; +} + +function area() { + var x0 = x, + x1 = null, + y0 = constant(0), + y1 = y, + defined = constant(true), + context = null, + curve = curveLinear, + output = null; + + function area(data) { + var i, + j, + k, + n = data.length, + d, + defined0 = false, + buffer, + x0z = new Array(n), + y0z = new Array(n); + + if (context == null) output = curve(buffer = d3Path.path()); + + for (i = 0; i <= n; ++i) { + if (!(i < n && defined(d = data[i], i, data)) === defined0) { + if (defined0 = !defined0) { + j = i; + output.areaStart(); + output.lineStart(); + } else { + output.lineEnd(); + output.lineStart(); + for (k = i - 1; k >= j; --k) { + output.point(x0z[k], y0z[k]); + } + output.lineEnd(); + output.areaEnd(); + } + } + if (defined0) { + x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data); + output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]); + } } - }, - handleDoneLeaving: function handleDoneLeaving(key) { - var props = this.props; - delete this.currentlyAnimatingKeys[key]; - // if update on exclusive mode, skip check - if (props.exclusive && props !== this.nextProps) { - return; + + if (buffer) return output = null, buffer + "" || null; + } + + function arealine() { + return line().defined(defined).curve(curve).context(context); + } + + area.x = function(_) { + return arguments.length ? (x0 = typeof _ === "function" ? _ : constant(+_), x1 = null, area) : x0; + }; + + area.x0 = function(_) { + return arguments.length ? (x0 = typeof _ === "function" ? _ : constant(+_), area) : x0; + }; + + area.x1 = function(_) { + return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : constant(+_), area) : x1; + }; + + area.y = function(_) { + return arguments.length ? (y0 = typeof _ === "function" ? _ : constant(+_), y1 = null, area) : y0; + }; + + area.y0 = function(_) { + return arguments.length ? (y0 = typeof _ === "function" ? _ : constant(+_), area) : y0; + }; + + area.y1 = function(_) { + return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : constant(+_), area) : y1; + }; + + area.lineX0 = + area.lineY0 = function() { + return arealine().x(x0).y(y0); + }; + + area.lineY1 = function() { + return arealine().x(x0).y(y1); + }; + + area.lineX1 = function() { + return arealine().x(x1).y(y0); + }; + + area.defined = function(_) { + return arguments.length ? (defined = typeof _ === "function" ? _ : constant(!!_), area) : defined; + }; + + area.curve = function(_) { + return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve; + }; + + area.context = function(_) { + return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context; + }; + + return area; +} + +function descending(a, b) { + return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; +} + +function identity(d) { + return d; +} + +function pie() { + var value = identity, + sortValues = descending, + sort = null, + startAngle = constant(0), + endAngle = constant(tau), + padAngle = constant(0); + + function pie(data) { + var i, + n = data.length, + j, + k, + sum = 0, + index = new Array(n), + arcs = new Array(n), + a0 = +startAngle.apply(this, arguments), + da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)), + a1, + p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)), + pa = p * (da < 0 ? -1 : 1), + v; + + for (i = 0; i < n; ++i) { + if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) { + sum += v; + } } - var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)); - // in case state change is too fast - if (this.isValidChildByKey(currentChildren, key)) { - this.performEnter(key); - } else { - var end = function end() { - if (_util2["default"].allowLeaveCallback(props)) { - props.onLeave(key); - props.onEnd(key, false); - } + + // Optionally sort the arcs by previously-computed values or by data. + if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); }); + else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); }); + + // Compute the arcs! They are stored in the original data's order. + for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) { + j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = { + data: data[j], + index: i, + value: v, + startAngle: a0, + endAngle: a1, + padAngle: p }; - /* eslint react/no-is-mounted:0 */ - if (this.isMounted() && !(0, _ChildrenUtils.isSameChildren)(this.state.children, currentChildren, props.showProp)) { - this.setState({ - children: currentChildren - }, end); - } else { - end(); - } } + + return arcs; + } + + pie.value = function(_) { + return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), pie) : value; + }; + + pie.sortValues = function(_) { + return arguments.length ? (sortValues = _, sort = null, pie) : sortValues; + }; + + pie.sort = function(_) { + return arguments.length ? (sort = _, sortValues = null, pie) : sort; + }; + + pie.startAngle = function(_) { + return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), pie) : startAngle; + }; + + pie.endAngle = function(_) { + return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), pie) : endAngle; + }; + + pie.padAngle = function(_) { + return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), pie) : padAngle; + }; + + return pie; +} + +var curveRadialLinear = curveRadial(curveLinear); + +function Radial(curve) { + this._curve = curve; +} + +Radial.prototype = { + areaStart: function() { + this._curve.areaStart(); }, - isValidChildByKey: function isValidChildByKey(currentChildren, key) { - var showProp = this.props.showProp; - if (showProp) { - return (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp); - } - return (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key); + areaEnd: function() { + this._curve.areaEnd(); }, - stop: function stop(key) { - delete this.currentlyAnimatingKeys[key]; - var component = this.refs[key]; - if (component) { - component.stop(); - } + lineStart: function() { + this._curve.lineStart(); }, - render: function render() { - var props = this.props; - this.nextProps = props; - var stateChildren = this.state.children; - var children = null; - if (stateChildren) { - children = stateChildren.map(function (child) { - if (child === null || child === undefined) { - return child; - } - if (!child.key) { - throw new Error('must set key for children'); - } - return _react2["default"].createElement( - _AnimateChild2["default"], - { - key: child.key, - ref: child.key, - animation: props.animation, - transitionName: props.transitionName, - transitionEnter: props.transitionEnter, - transitionAppear: props.transitionAppear, - transitionLeave: props.transitionLeave - }, - child - ); - }); - } - var Component = props.component; - if (Component) { - var passedProps = props; - if (typeof Component === 'string') { - passedProps = { - className: props.className, - style: props.style - }; - } - return _react2["default"].createElement( - Component, - passedProps, - children - ); - } - return children[0] || null; + lineEnd: function() { + this._curve.lineEnd(); + }, + point: function(a, r) { + this._curve.point(r * Math.sin(a), r * -Math.cos(a)); } -}); +}; -exports["default"] = Animate; -module.exports = exports['default']; -},{"./AnimateChild":146,"./ChildrenUtils":147,"./util":149,"react":585}],146:[function(require,module,exports){ -'use strict'; +function curveRadial(curve) { -Object.defineProperty(exports, "__esModule", { - value: true -}); + function radial(context) { + return new Radial(curve(context)); + } -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; + radial._curve = curve; -var _react = require('react'); + return radial; +} -var _react2 = _interopRequireDefault(_react); +function radialLine(l) { + var c = l.curve; -var _reactDom = require('react-dom'); + l.angle = l.x, delete l.x; + l.radius = l.y, delete l.y; -var _reactDom2 = _interopRequireDefault(_reactDom); + l.curve = function(_) { + return arguments.length ? c(curveRadial(_)) : c()._curve; + }; -var _cssAnimation = require('css-animation'); + return l; +} -var _cssAnimation2 = _interopRequireDefault(_cssAnimation); +function radialLine$1() { + return radialLine(line().curve(curveRadialLinear)); +} -var _util = require('./util'); +function radialArea() { + var a = area().curve(curveRadialLinear), + c = a.curve, + x0 = a.lineX0, + x1 = a.lineX1, + y0 = a.lineY0, + y1 = a.lineY1; -var _util2 = _interopRequireDefault(_util); + a.angle = a.x, delete a.x; + a.startAngle = a.x0, delete a.x0; + a.endAngle = a.x1, delete a.x1; + a.radius = a.y, delete a.y; + a.innerRadius = a.y0, delete a.y0; + a.outerRadius = a.y1, delete a.y1; + a.lineStartAngle = function() { return radialLine(x0()); }, delete a.lineX0; + a.lineEndAngle = function() { return radialLine(x1()); }, delete a.lineX1; + a.lineInnerRadius = function() { return radialLine(y0()); }, delete a.lineY0; + a.lineOuterRadius = function() { return radialLine(y1()); }, delete a.lineY1; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + a.curve = function(_) { + return arguments.length ? c(curveRadial(_)) : c()._curve; + }; -var transitionMap = { - enter: 'transitionEnter', - appear: 'transitionAppear', - leave: 'transitionLeave' + return a; +} + +var circle = { + draw: function(context, size) { + var r = Math.sqrt(size / pi); + context.moveTo(r, 0); + context.arc(0, 0, r, 0, tau); + } }; -var AnimateChild = _react2["default"].createClass({ - displayName: 'AnimateChild', +var cross = { + draw: function(context, size) { + var r = Math.sqrt(size / 5) / 2; + context.moveTo(-3 * r, -r); + context.lineTo(-r, -r); + context.lineTo(-r, -3 * r); + context.lineTo(r, -3 * r); + context.lineTo(r, -r); + context.lineTo(3 * r, -r); + context.lineTo(3 * r, r); + context.lineTo(r, r); + context.lineTo(r, 3 * r); + context.lineTo(-r, 3 * r); + context.lineTo(-r, r); + context.lineTo(-3 * r, r); + context.closePath(); + } +}; - propTypes: { - children: _react2["default"].PropTypes.any +var tan30 = Math.sqrt(1 / 3); +var tan30_2 = tan30 * 2; +var diamond = { + draw: function(context, size) { + var y = Math.sqrt(size / tan30_2), + x = y * tan30; + context.moveTo(0, -y); + context.lineTo(x, 0); + context.lineTo(0, y); + context.lineTo(-x, 0); + context.closePath(); + } +}; + +var ka = 0.89081309152928522810; +var kr = Math.sin(pi / 10) / Math.sin(7 * pi / 10); +var kx = Math.sin(tau / 10) * kr; +var ky = -Math.cos(tau / 10) * kr; +var star = { + draw: function(context, size) { + var r = Math.sqrt(size * ka), + x = kx * r, + y = ky * r; + context.moveTo(0, -r); + context.lineTo(x, y); + for (var i = 1; i < 5; ++i) { + var a = tau * i / 5, + c = Math.cos(a), + s = Math.sin(a); + context.lineTo(s * r, -c * r); + context.lineTo(c * x - s * y, s * x + c * y); + } + context.closePath(); + } +}; + +var square = { + draw: function(context, size) { + var w = Math.sqrt(size), + x = -w / 2; + context.rect(x, x, w, w); + } +}; + +var sqrt3 = Math.sqrt(3); + +var triangle = { + draw: function(context, size) { + var y = -Math.sqrt(size / (sqrt3 * 3)); + context.moveTo(0, y * 2); + context.lineTo(-sqrt3 * y, -y); + context.lineTo(sqrt3 * y, -y); + context.closePath(); + } +}; + +var c = -0.5; +var s = Math.sqrt(3) / 2; +var k = 1 / Math.sqrt(12); +var a = (k / 2 + 1) * 3; +var wye = { + draw: function(context, size) { + var r = Math.sqrt(size / a), + x0 = r / 2, + y0 = r * k, + x1 = x0, + y1 = r * k + r, + x2 = -x1, + y2 = y1; + context.moveTo(x0, y0); + context.lineTo(x1, y1); + context.lineTo(x2, y2); + context.lineTo(c * x0 - s * y0, s * x0 + c * y0); + context.lineTo(c * x1 - s * y1, s * x1 + c * y1); + context.lineTo(c * x2 - s * y2, s * x2 + c * y2); + context.lineTo(c * x0 + s * y0, c * y0 - s * x0); + context.lineTo(c * x1 + s * y1, c * y1 - s * x1); + context.lineTo(c * x2 + s * y2, c * y2 - s * x2); + context.closePath(); + } +}; + +var symbols = [ + circle, + cross, + diamond, + square, + star, + triangle, + wye +]; + +function symbol() { + var type = constant(circle), + size = constant(64), + context = null; + + function symbol() { + var buffer; + if (!context) context = buffer = d3Path.path(); + type.apply(this, arguments).draw(context, +size.apply(this, arguments)); + if (buffer) return context = null, buffer + "" || null; + } + + symbol.type = function(_) { + return arguments.length ? (type = typeof _ === "function" ? _ : constant(_), symbol) : type; + }; + + symbol.size = function(_) { + return arguments.length ? (size = typeof _ === "function" ? _ : constant(+_), symbol) : size; + }; + + symbol.context = function(_) { + return arguments.length ? (context = _ == null ? null : _, symbol) : context; + }; + + return symbol; +} + +function noop() {} + +function point(that, x, y) { + that._context.bezierCurveTo( + (2 * that._x0 + that._x1) / 3, + (2 * that._y0 + that._y1) / 3, + (that._x0 + 2 * that._x1) / 3, + (that._y0 + 2 * that._y1) / 3, + (that._x0 + 4 * that._x1 + x) / 6, + (that._y0 + 4 * that._y1 + y) / 6 + ); +} + +function Basis(context) { + this._context = context; +} + +Basis.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x0 = this._x1 = + this._y0 = this._y1 = NaN; + this._point = 0; }, + lineEnd: function() { + switch (this._point) { + case 3: point(this, this._x1, this._y1); // proceed + case 2: this._context.lineTo(this._x1, this._y1); break; + } + if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x, y) { + x = +x, y = +y; + switch (this._point) { + case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; + case 1: this._point = 2; break; + case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // proceed + default: point(this, x, y); break; + } + this._x0 = this._x1, this._x1 = x; + this._y0 = this._y1, this._y1 = y; + } +}; - componentWillUnmount: function componentWillUnmount() { - this.stop(); +function basis(context) { + return new Basis(context); +} + +function BasisClosed(context) { + this._context = context; +} + +BasisClosed.prototype = { + areaStart: noop, + areaEnd: noop, + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = + this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN; + this._point = 0; }, - componentWillEnter: function componentWillEnter(done) { - if (_util2["default"].isEnterSupported(this.props)) { - this.transition('enter', done); - } else { - done(); + lineEnd: function() { + switch (this._point) { + case 1: { + this._context.moveTo(this._x2, this._y2); + this._context.closePath(); + break; + } + case 2: { + this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3); + this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3); + this._context.closePath(); + break; + } + case 3: { + this.point(this._x2, this._y2); + this.point(this._x3, this._y3); + this.point(this._x4, this._y4); + break; + } } }, - componentWillAppear: function componentWillAppear(done) { - if (_util2["default"].isAppearSupported(this.props)) { - this.transition('appear', done); - } else { - done(); + point: function(x, y) { + x = +x, y = +y; + switch (this._point) { + case 0: this._point = 1; this._x2 = x, this._y2 = y; break; + case 1: this._point = 2; this._x3 = x, this._y3 = y; break; + case 2: this._point = 3; this._x4 = x, this._y4 = y; this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); break; + default: point(this, x, y); break; } + this._x0 = this._x1, this._x1 = x; + this._y0 = this._y1, this._y1 = y; + } +}; + +function basisClosed(context) { + return new BasisClosed(context); +} + +function BasisOpen(context) { + this._context = context; +} + +BasisOpen.prototype = { + areaStart: function() { + this._line = 0; }, - componentWillLeave: function componentWillLeave(done) { - if (_util2["default"].isLeaveSupported(this.props)) { - this.transition('leave', done); - } else { - // always sync, do not interupt with react component life cycle - // update hidden -> animate hidden -> - // didUpdate -> animate leave -> unmount (if animate is none) - done(); + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x0 = this._x1 = + this._y0 = this._y1 = NaN; + this._point = 0; + }, + lineEnd: function() { + if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x, y) { + x = +x, y = +y; + switch (this._point) { + case 0: this._point = 1; break; + case 1: this._point = 2; break; + case 2: this._point = 3; var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); break; + case 3: this._point = 4; // proceed + default: point(this, x, y); break; } + this._x0 = this._x1, this._x1 = x; + this._y0 = this._y1, this._y1 = y; + } +}; + +function basisOpen(context) { + return new BasisOpen(context); +} + +function Bundle(context, beta) { + this._basis = new Basis(context); + this._beta = beta; +} + +Bundle.prototype = { + lineStart: function() { + this._x = []; + this._y = []; + this._basis.lineStart(); }, - transition: function transition(animationType, finishCallback) { - var _this = this; + lineEnd: function() { + var x = this._x, + y = this._y, + j = x.length - 1; - var node = _reactDom2["default"].findDOMNode(this); - var props = this.props; - var transitionName = props.transitionName; - var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object'; - this.stop(); - var end = function end() { - _this.stopper = null; - finishCallback(); - }; - if ((_cssAnimation.isCssAnimationSupported || !props.animation[animationType]) && transitionName && props[transitionMap[animationType]]) { - var name = nameIsObj ? transitionName[animationType] : transitionName + '-' + animationType; - var activeName = name + '-active'; - if (nameIsObj && transitionName[animationType + 'Active']) { - activeName = transitionName[animationType + 'Active']; + if (j > 0) { + var x0 = x[0], + y0 = y[0], + dx = x[j] - x0, + dy = y[j] - y0, + i = -1, + t; + + while (++i <= j) { + t = i / j; + this._basis.point( + this._beta * x[i] + (1 - this._beta) * (x0 + t * dx), + this._beta * y[i] + (1 - this._beta) * (y0 + t * dy) + ); } - this.stopper = (0, _cssAnimation2["default"])(node, { - name: name, - active: activeName - }, end); - } else { - this.stopper = props.animation[animationType](node, end); } + + this._x = this._y = null; + this._basis.lineEnd(); }, - stop: function stop() { - var stopper = this.stopper; - if (stopper) { - this.stopper = null; - stopper.stop(); + point: function(x, y) { + this._x.push(+x); + this._y.push(+y); + } +}; + +var bundle = (function custom(beta) { + + function bundle(context) { + return beta === 1 ? new Basis(context) : new Bundle(context, beta); + } + + bundle.beta = function(beta) { + return custom(+beta); + }; + + return bundle; +})(0.85); + +function point$1(that, x, y) { + that._context.bezierCurveTo( + that._x1 + that._k * (that._x2 - that._x0), + that._y1 + that._k * (that._y2 - that._y0), + that._x2 + that._k * (that._x1 - x), + that._y2 + that._k * (that._y1 - y), + that._x2, + that._y2 + ); +} + +function Cardinal(context, tension) { + this._context = context; + this._k = (1 - tension) / 6; +} + +Cardinal.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x0 = this._x1 = this._x2 = + this._y0 = this._y1 = this._y2 = NaN; + this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 2: this._context.lineTo(this._x2, this._y2); break; + case 3: point$1(this, this._x1, this._y1); break; } + if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); + this._line = 1 - this._line; }, - render: function render() { - return this.props.children; + point: function(x, y) { + x = +x, y = +y; + switch (this._point) { + case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; + case 1: this._point = 2; this._x1 = x, this._y1 = y; break; + case 2: this._point = 3; // proceed + default: point$1(this, x, y); break; + } + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; } -}); - -exports["default"] = AnimateChild; -module.exports = exports['default']; -},{"./util":149,"css-animation":151,"react":585,"react-dom":416}],147:[function(require,module,exports){ -'use strict'; +}; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.toArrayChildren = toArrayChildren; -exports.findChildInChildrenByKey = findChildInChildrenByKey; -exports.findShownChildInChildrenByKey = findShownChildInChildrenByKey; -exports.findHiddenChildInChildrenByKey = findHiddenChildInChildrenByKey; -exports.isSameChildren = isSameChildren; -exports.mergeChildren = mergeChildren; +var cardinal = (function custom(tension) { -var _react = require('react'); + function cardinal(context) { + return new Cardinal(context, tension); + } -var _react2 = _interopRequireDefault(_react); + cardinal.tension = function(tension) { + return custom(+tension); + }; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + return cardinal; +})(0); -function toArrayChildren(children) { - var ret = []; - _react2["default"].Children.forEach(children, function (child) { - ret.push(child); - }); - return ret; +function CardinalClosed(context, tension) { + this._context = context; + this._k = (1 - tension) / 6; } -function findChildInChildrenByKey(children, key) { - var ret = null; - if (children) { - children.forEach(function (child) { - if (ret) { - return; +CardinalClosed.prototype = { + areaStart: noop, + areaEnd: noop, + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = + this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; + this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 1: { + this._context.moveTo(this._x3, this._y3); + this._context.closePath(); + break; } - if (child && child.key === key) { - ret = child; + case 2: { + this._context.lineTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 3: { + this.point(this._x3, this._y3); + this.point(this._x4, this._y4); + this.point(this._x5, this._y5); + break; + } + } + }, + point: function(x, y) { + x = +x, y = +y; + switch (this._point) { + case 0: this._point = 1; this._x3 = x, this._y3 = y; break; + case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break; + case 2: this._point = 3; this._x5 = x, this._y5 = y; break; + default: point$1(this, x, y); break; + } + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + } +}; + +var cardinalClosed = (function custom(tension) { + + function cardinal(context) { + return new CardinalClosed(context, tension); + } + + cardinal.tension = function(tension) { + return custom(+tension); + }; + + return cardinal; +})(0); + +function CardinalOpen(context, tension) { + this._context = context; + this._k = (1 - tension) / 6; +} + +CardinalOpen.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x0 = this._x1 = this._x2 = + this._y0 = this._y1 = this._y2 = NaN; + this._point = 0; + }, + lineEnd: function() { + if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x, y) { + x = +x, y = +y; + switch (this._point) { + case 0: this._point = 1; break; + case 1: this._point = 2; break; + case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break; + case 3: this._point = 4; // proceed + default: point$1(this, x, y); break; + } + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + } +}; + +var cardinalOpen = (function custom(tension) { + + function cardinal(context) { + return new CardinalOpen(context, tension); + } + + cardinal.tension = function(tension) { + return custom(+tension); + }; + + return cardinal; +})(0); + +function point$2(that, x, y) { + var x1 = that._x1, + y1 = that._y1, + x2 = that._x2, + y2 = that._y2; + + if (that._l01_a > epsilon) { + var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a, + n = 3 * that._l01_a * (that._l01_a + that._l12_a); + x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n; + y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n; + } + + if (that._l23_a > epsilon) { + var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a, + m = 3 * that._l23_a * (that._l23_a + that._l12_a); + x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m; + y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m; + } + + that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2); +} + +function CatmullRom(context, alpha) { + this._context = context; + this._alpha = alpha; +} + +CatmullRom.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x0 = this._x1 = this._x2 = + this._y0 = this._y1 = this._y2 = NaN; + this._l01_a = this._l12_a = this._l23_a = + this._l01_2a = this._l12_2a = this._l23_2a = + this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 2: this._context.lineTo(this._x2, this._y2); break; + case 3: this.point(this._x2, this._y2); break; + } + if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x, y) { + x = +x, y = +y; + + if (this._point) { + var x23 = this._x2 - x, + y23 = this._y2 - y; + this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); + } + + switch (this._point) { + case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; + case 1: this._point = 2; break; + case 2: this._point = 3; // proceed + default: point$2(this, x, y); break; + } + + this._l01_a = this._l12_a, this._l12_a = this._l23_a; + this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + } +}; + +var catmullRom = (function custom(alpha) { + + function catmullRom(context) { + return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0); + } + + catmullRom.alpha = function(alpha) { + return custom(+alpha); + }; + + return catmullRom; +})(0.5); + +function CatmullRomClosed(context, alpha) { + this._context = context; + this._alpha = alpha; +} + +CatmullRomClosed.prototype = { + areaStart: noop, + areaEnd: noop, + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = + this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; + this._l01_a = this._l12_a = this._l23_a = + this._l01_2a = this._l12_2a = this._l23_2a = + this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 1: { + this._context.moveTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 2: { + this._context.lineTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 3: { + this.point(this._x3, this._y3); + this.point(this._x4, this._y4); + this.point(this._x5, this._y5); + break; + } + } + }, + point: function(x, y) { + x = +x, y = +y; + + if (this._point) { + var x23 = this._x2 - x, + y23 = this._y2 - y; + this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); + } + + switch (this._point) { + case 0: this._point = 1; this._x3 = x, this._y3 = y; break; + case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break; + case 2: this._point = 3; this._x5 = x, this._y5 = y; break; + default: point$2(this, x, y); break; + } + + this._l01_a = this._l12_a, this._l12_a = this._l23_a; + this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + } +}; + +var catmullRomClosed = (function custom(alpha) { + + function catmullRom(context) { + return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0); + } + + catmullRom.alpha = function(alpha) { + return custom(+alpha); + }; + + return catmullRom; +})(0.5); + +function CatmullRomOpen(context, alpha) { + this._context = context; + this._alpha = alpha; +} + +CatmullRomOpen.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x0 = this._x1 = this._x2 = + this._y0 = this._y1 = this._y2 = NaN; + this._l01_a = this._l12_a = this._l23_a = + this._l01_2a = this._l12_2a = this._l23_2a = + this._point = 0; + }, + lineEnd: function() { + if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x, y) { + x = +x, y = +y; + + if (this._point) { + var x23 = this._x2 - x, + y23 = this._y2 - y; + this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); + } + + switch (this._point) { + case 0: this._point = 1; break; + case 1: this._point = 2; break; + case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break; + case 3: this._point = 4; // proceed + default: point$2(this, x, y); break; + } + + this._l01_a = this._l12_a, this._l12_a = this._l23_a; + this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + } +}; + +var catmullRomOpen = (function custom(alpha) { + + function catmullRom(context) { + return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0); + } + + catmullRom.alpha = function(alpha) { + return custom(+alpha); + }; + + return catmullRom; +})(0.5); + +function LinearClosed(context) { + this._context = context; +} + +LinearClosed.prototype = { + areaStart: noop, + areaEnd: noop, + lineStart: function() { + this._point = 0; + }, + lineEnd: function() { + if (this._point) this._context.closePath(); + }, + point: function(x, y) { + x = +x, y = +y; + if (this._point) this._context.lineTo(x, y); + else this._point = 1, this._context.moveTo(x, y); + } +}; + +function linearClosed(context) { + return new LinearClosed(context); +} + +function sign(x) { + return x < 0 ? -1 : 1; +} + +// Calculate the slopes of the tangents (Hermite-type interpolation) based on +// the following paper: Steffen, M. 1990. A Simple Method for Monotonic +// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO. +// NOV(II), P. 443, 1990. +function slope3(that, x2, y2) { + var h0 = that._x1 - that._x0, + h1 = x2 - that._x1, + s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0), + s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0), + p = (s0 * h1 + s1 * h0) / (h0 + h1); + return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0; +} + +// Calculate a one-sided slope. +function slope2(that, t) { + var h = that._x1 - that._x0; + return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t; +} + +// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations +// "you can express cubic Hermite interpolation in terms of cubic Bézier curves +// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1". +function point$3(that, t0, t1) { + var x0 = that._x0, + y0 = that._y0, + x1 = that._x1, + y1 = that._y1, + dx = (x1 - x0) / 3; + that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1); +} + +function MonotoneX(context) { + this._context = context; +} + +MonotoneX.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x0 = this._x1 = + this._y0 = this._y1 = + this._t0 = NaN; + this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 2: this._context.lineTo(this._x1, this._y1); break; + case 3: point$3(this, this._t0, slope2(this, this._t0)); break; + } + if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x, y) { + var t1 = NaN; + + x = +x, y = +y; + if (x === this._x1 && y === this._y1) return; // Ignore coincident points. + switch (this._point) { + case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; + case 1: this._point = 2; break; + case 2: this._point = 3; point$3(this, slope2(this, t1 = slope3(this, x, y)), t1); break; + default: point$3(this, this._t0, t1 = slope3(this, x, y)); break; + } + + this._x0 = this._x1, this._x1 = x; + this._y0 = this._y1, this._y1 = y; + this._t0 = t1; + } +} + +function MonotoneY(context) { + this._context = new ReflectContext(context); +} + +(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) { + MonotoneX.prototype.point.call(this, y, x); +}; + +function ReflectContext(context) { + this._context = context; +} + +ReflectContext.prototype = { + moveTo: function(x, y) { this._context.moveTo(y, x); }, + closePath: function() { this._context.closePath(); }, + lineTo: function(x, y) { this._context.lineTo(y, x); }, + bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._context.bezierCurveTo(y1, x1, y2, x2, y, x); } +}; + +function monotoneX(context) { + return new MonotoneX(context); +} + +function monotoneY(context) { + return new MonotoneY(context); +} + +function Natural(context) { + this._context = context; +} + +Natural.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x = []; + this._y = []; + }, + lineEnd: function() { + var x = this._x, + y = this._y, + n = x.length; + + if (n) { + this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]); + if (n === 2) { + this._context.lineTo(x[1], y[1]); + } else { + var px = controlPoints(x), + py = controlPoints(y); + for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) { + this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]); + } + } + } + + if (this._line || (this._line !== 0 && n === 1)) this._context.closePath(); + this._line = 1 - this._line; + this._x = this._y = null; + }, + point: function(x, y) { + this._x.push(+x); + this._y.push(+y); + } +}; + +// See https://www.particleincell.com/2012/bezier-splines/ for derivation. +function controlPoints(x) { + var i, + n = x.length - 1, + m, + a = new Array(n), + b = new Array(n), + r = new Array(n); + a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1]; + for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1]; + a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n]; + for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1]; + a[n - 1] = r[n - 1] / b[n - 1]; + for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i]; + b[n - 1] = (x[n] + a[n - 1]) / 2; + for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1]; + return [a, b]; +} + +function natural(context) { + return new Natural(context); +} + +function Step(context, t) { + this._context = context; + this._t = t; +} + +Step.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x = this._y = NaN; + this._point = 0; + }, + lineEnd: function() { + if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y); + if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); + if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line; + }, + point: function(x, y) { + x = +x, y = +y; + switch (this._point) { + case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; + case 1: this._point = 2; // proceed + default: { + if (this._t <= 0) { + this._context.lineTo(this._x, y); + this._context.lineTo(x, y); + } else { + var x1 = this._x * (1 - this._t) + x * this._t; + this._context.lineTo(x1, this._y); + this._context.lineTo(x1, y); + } + break; + } + } + this._x = x, this._y = y; + } +}; + +function step(context) { + return new Step(context, 0.5); +} + +function stepBefore(context) { + return new Step(context, 0); +} + +function stepAfter(context) { + return new Step(context, 1); +} + +var slice = Array.prototype.slice; + +function none(series, order) { + if (!((n = series.length) > 1)) return; + for (var i = 1, s0, s1 = series[order[0]], n, m = s1.length; i < n; ++i) { + s0 = s1, s1 = series[order[i]]; + for (var j = 0; j < m; ++j) { + s1[j][1] += s1[j][0] = isNaN(s0[j][1]) ? s0[j][0] : s0[j][1]; + } + } +} + +function none$1(series) { + var n = series.length, o = new Array(n); + while (--n >= 0) o[n] = n; + return o; +} + +function stackValue(d, key) { + return d[key]; +} + +function stack() { + var keys = constant([]), + order = none$1, + offset = none, + value = stackValue; + + function stack(data) { + var kz = keys.apply(this, arguments), + i, + m = data.length, + n = kz.length, + sz = new Array(n), + oz; + + for (i = 0; i < n; ++i) { + for (var ki = kz[i], si = sz[i] = new Array(m), j = 0, sij; j < m; ++j) { + si[j] = sij = [0, +value(data[j], ki, j, data)]; + sij.data = data[j]; + } + si.key = ki; + } + + for (i = 0, oz = order(sz); i < n; ++i) { + sz[oz[i]].index = i; + } + + offset(sz, oz); + return sz; + } + + stack.keys = function(_) { + return arguments.length ? (keys = typeof _ === "function" ? _ : constant(slice.call(_)), stack) : keys; + }; + + stack.value = function(_) { + return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), stack) : value; + }; + + stack.order = function(_) { + return arguments.length ? (order = _ == null ? none$1 : typeof _ === "function" ? _ : constant(slice.call(_)), stack) : order; + }; + + stack.offset = function(_) { + return arguments.length ? (offset = _ == null ? none : _, stack) : offset; + }; + + return stack; +} + +function expand(series, order) { + if (!((n = series.length) > 0)) return; + for (var i, n, j = 0, m = series[0].length, y; j < m; ++j) { + for (y = i = 0; i < n; ++i) y += series[i][j][1] || 0; + if (y) for (i = 0; i < n; ++i) series[i][j][1] /= y; + } + none(series, order); +} + +function silhouette(series, order) { + if (!((n = series.length) > 0)) return; + for (var j = 0, s0 = series[order[0]], n, m = s0.length; j < m; ++j) { + for (var i = 0, y = 0; i < n; ++i) y += series[i][j][1] || 0; + s0[j][1] += s0[j][0] = -y / 2; + } + none(series, order); +} + +function wiggle(series, order) { + if (!((n = series.length) > 0) || !((m = (s0 = series[order[0]]).length) > 0)) return; + for (var y = 0, j = 1, s0, m, n; j < m; ++j) { + for (var i = 0, s1 = 0, s2 = 0; i < n; ++i) { + var si = series[order[i]], + sij0 = si[j][1] || 0, + sij1 = si[j - 1][1] || 0, + s3 = (sij0 - sij1) / 2; + for (var k = 0; k < i; ++k) { + var sk = series[order[k]], + skj0 = sk[j][1] || 0, + skj1 = sk[j - 1][1] || 0; + s3 += skj0 - skj1; + } + s1 += sij0, s2 += s3 * sij0; + } + s0[j - 1][1] += s0[j - 1][0] = y; + if (s1) y -= s2 / s1; + } + s0[j - 1][1] += s0[j - 1][0] = y; + none(series, order); +} + +function ascending(series) { + var sums = series.map(sum); + return none$1(series).sort(function(a, b) { return sums[a] - sums[b]; }); +} + +function sum(series) { + var s = 0, i = -1, n = series.length, v; + while (++i < n) if (v = +series[i][1]) s += v; + return s; +} + +function descending$1(series) { + return ascending(series).reverse(); +} + +function insideOut(series) { + var n = series.length, + i, + j, + sums = series.map(sum), + order = none$1(series).sort(function(a, b) { return sums[b] - sums[a]; }), + top = 0, + bottom = 0, + tops = [], + bottoms = []; + + for (i = 0; i < n; ++i) { + j = order[i]; + if (top < bottom) { + top += sums[j]; + tops.push(j); + } else { + bottom += sums[j]; + bottoms.push(j); + } + } + + return bottoms.reverse().concat(tops); +} + +function reverse(series) { + return none$1(series).reverse(); +} + +exports.arc = arc; +exports.area = area; +exports.line = line; +exports.pie = pie; +exports.radialArea = radialArea; +exports.radialLine = radialLine$1; +exports.symbol = symbol; +exports.symbols = symbols; +exports.symbolCircle = circle; +exports.symbolCross = cross; +exports.symbolDiamond = diamond; +exports.symbolSquare = square; +exports.symbolStar = star; +exports.symbolTriangle = triangle; +exports.symbolWye = wye; +exports.curveBasisClosed = basisClosed; +exports.curveBasisOpen = basisOpen; +exports.curveBasis = basis; +exports.curveBundle = bundle; +exports.curveCardinalClosed = cardinalClosed; +exports.curveCardinalOpen = cardinalOpen; +exports.curveCardinal = cardinal; +exports.curveCatmullRomClosed = catmullRomClosed; +exports.curveCatmullRomOpen = catmullRomOpen; +exports.curveCatmullRom = catmullRom; +exports.curveLinearClosed = linearClosed; +exports.curveLinear = curveLinear; +exports.curveMonotoneX = monotoneX; +exports.curveMonotoneY = monotoneY; +exports.curveNatural = natural; +exports.curveStep = step; +exports.curveStepAfter = stepAfter; +exports.curveStepBefore = stepBefore; +exports.stack = stack; +exports.stackOffsetExpand = expand; +exports.stackOffsetNone = none; +exports.stackOffsetSilhouette = silhouette; +exports.stackOffsetWiggle = wiggle; +exports.stackOrderAscending = ascending; +exports.stackOrderDescending = descending$1; +exports.stackOrderInsideOut = insideOut; +exports.stackOrderNone = none$1; +exports.stackOrderReverse = reverse; + +Object.defineProperty(exports, '__esModule', { value: true }); + +}))); +},{"d3-path":138}],141:[function(require,module,exports){ +// https://d3js.org/d3-time-format/ Version 2.0.2. Copyright 2016 Mike Bostock. +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-time')) : + typeof define === 'function' && define.amd ? define(['exports', 'd3-time'], factory) : + (factory((global.d3 = global.d3 || {}),global.d3)); +}(this, function (exports,d3Time) { 'use strict'; + + function localDate(d) { + if (0 <= d.y && d.y < 100) { + var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L); + date.setFullYear(d.y); + return date; + } + return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L); + } + + function utcDate(d) { + if (0 <= d.y && d.y < 100) { + var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L)); + date.setUTCFullYear(d.y); + return date; + } + return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L)); + } + + function newYear(y) { + return {y: y, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0}; + } + + function formatLocale(locale) { + var locale_dateTime = locale.dateTime, + locale_date = locale.date, + locale_time = locale.time, + locale_periods = locale.periods, + locale_weekdays = locale.days, + locale_shortWeekdays = locale.shortDays, + locale_months = locale.months, + locale_shortMonths = locale.shortMonths; + + var periodRe = formatRe(locale_periods), + periodLookup = formatLookup(locale_periods), + weekdayRe = formatRe(locale_weekdays), + weekdayLookup = formatLookup(locale_weekdays), + shortWeekdayRe = formatRe(locale_shortWeekdays), + shortWeekdayLookup = formatLookup(locale_shortWeekdays), + monthRe = formatRe(locale_months), + monthLookup = formatLookup(locale_months), + shortMonthRe = formatRe(locale_shortMonths), + shortMonthLookup = formatLookup(locale_shortMonths); + + var formats = { + "a": formatShortWeekday, + "A": formatWeekday, + "b": formatShortMonth, + "B": formatMonth, + "c": null, + "d": formatDayOfMonth, + "e": formatDayOfMonth, + "H": formatHour24, + "I": formatHour12, + "j": formatDayOfYear, + "L": formatMilliseconds, + "m": formatMonthNumber, + "M": formatMinutes, + "p": formatPeriod, + "S": formatSeconds, + "U": formatWeekNumberSunday, + "w": formatWeekdayNumber, + "W": formatWeekNumberMonday, + "x": null, + "X": null, + "y": formatYear, + "Y": formatFullYear, + "Z": formatZone, + "%": formatLiteralPercent + }; + + var utcFormats = { + "a": formatUTCShortWeekday, + "A": formatUTCWeekday, + "b": formatUTCShortMonth, + "B": formatUTCMonth, + "c": null, + "d": formatUTCDayOfMonth, + "e": formatUTCDayOfMonth, + "H": formatUTCHour24, + "I": formatUTCHour12, + "j": formatUTCDayOfYear, + "L": formatUTCMilliseconds, + "m": formatUTCMonthNumber, + "M": formatUTCMinutes, + "p": formatUTCPeriod, + "S": formatUTCSeconds, + "U": formatUTCWeekNumberSunday, + "w": formatUTCWeekdayNumber, + "W": formatUTCWeekNumberMonday, + "x": null, + "X": null, + "y": formatUTCYear, + "Y": formatUTCFullYear, + "Z": formatUTCZone, + "%": formatLiteralPercent + }; + + var parses = { + "a": parseShortWeekday, + "A": parseWeekday, + "b": parseShortMonth, + "B": parseMonth, + "c": parseLocaleDateTime, + "d": parseDayOfMonth, + "e": parseDayOfMonth, + "H": parseHour24, + "I": parseHour24, + "j": parseDayOfYear, + "L": parseMilliseconds, + "m": parseMonthNumber, + "M": parseMinutes, + "p": parsePeriod, + "S": parseSeconds, + "U": parseWeekNumberSunday, + "w": parseWeekdayNumber, + "W": parseWeekNumberMonday, + "x": parseLocaleDate, + "X": parseLocaleTime, + "y": parseYear, + "Y": parseFullYear, + "Z": parseZone, + "%": parseLiteralPercent + }; + + // These recursive directive definitions must be deferred. + formats.x = newFormat(locale_date, formats); + formats.X = newFormat(locale_time, formats); + formats.c = newFormat(locale_dateTime, formats); + utcFormats.x = newFormat(locale_date, utcFormats); + utcFormats.X = newFormat(locale_time, utcFormats); + utcFormats.c = newFormat(locale_dateTime, utcFormats); + + function newFormat(specifier, formats) { + return function(date) { + var string = [], + i = -1, + j = 0, + n = specifier.length, + c, + pad, + format; + + if (!(date instanceof Date)) date = new Date(+date); + + while (++i < n) { + if (specifier.charCodeAt(i) === 37) { + string.push(specifier.slice(j, i)); + if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i); + else pad = c === "e" ? " " : "0"; + if (format = formats[c]) c = format(date, pad); + string.push(c); + j = i + 1; + } + } + + string.push(specifier.slice(j, i)); + return string.join(""); + }; + } + + function newParse(specifier, newDate) { + return function(string) { + var d = newYear(1900), + i = parseSpecifier(d, specifier, string += "", 0); + if (i != string.length) return null; + + // The am-pm flag is 0 for AM, and 1 for PM. + if ("p" in d) d.H = d.H % 12 + d.p * 12; + + // Convert day-of-week and week-of-year to day-of-year. + if ("W" in d || "U" in d) { + if (!("w" in d)) d.w = "W" in d ? 1 : 0; + var day = "Z" in d ? utcDate(newYear(d.y)).getUTCDay() : newDate(newYear(d.y)).getDay(); + d.m = 0; + d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7; + } + + // If a time zone is specified, all fields are interpreted as UTC and then + // offset according to the specified time zone. + if ("Z" in d) { + d.H += d.Z / 100 | 0; + d.M += d.Z % 100; + return utcDate(d); + } + + // Otherwise, all fields are in local time. + return newDate(d); + }; + } + + function parseSpecifier(d, specifier, string, j) { + var i = 0, + n = specifier.length, + m = string.length, + c, + parse; + + while (i < n) { + if (j >= m) return -1; + c = specifier.charCodeAt(i++); + if (c === 37) { + c = specifier.charAt(i++); + parse = parses[c in pads ? specifier.charAt(i++) : c]; + if (!parse || ((j = parse(d, string, j)) < 0)) return -1; + } else if (c != string.charCodeAt(j++)) { + return -1; + } + } + + return j; + } + + function parsePeriod(d, string, i) { + var n = periodRe.exec(string.slice(i)); + return n ? (d.p = periodLookup[n[0].toLowerCase()], i + n[0].length) : -1; + } + + function parseShortWeekday(d, string, i) { + var n = shortWeekdayRe.exec(string.slice(i)); + return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1; + } + + function parseWeekday(d, string, i) { + var n = weekdayRe.exec(string.slice(i)); + return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1; + } + + function parseShortMonth(d, string, i) { + var n = shortMonthRe.exec(string.slice(i)); + return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1; + } + + function parseMonth(d, string, i) { + var n = monthRe.exec(string.slice(i)); + return n ? (d.m = monthLookup[n[0].toLowerCase()], i + n[0].length) : -1; + } + + function parseLocaleDateTime(d, string, i) { + return parseSpecifier(d, locale_dateTime, string, i); + } + + function parseLocaleDate(d, string, i) { + return parseSpecifier(d, locale_date, string, i); + } + + function parseLocaleTime(d, string, i) { + return parseSpecifier(d, locale_time, string, i); + } + + function formatShortWeekday(d) { + return locale_shortWeekdays[d.getDay()]; + } + + function formatWeekday(d) { + return locale_weekdays[d.getDay()]; + } + + function formatShortMonth(d) { + return locale_shortMonths[d.getMonth()]; + } + + function formatMonth(d) { + return locale_months[d.getMonth()]; + } + + function formatPeriod(d) { + return locale_periods[+(d.getHours() >= 12)]; + } + + function formatUTCShortWeekday(d) { + return locale_shortWeekdays[d.getUTCDay()]; + } + + function formatUTCWeekday(d) { + return locale_weekdays[d.getUTCDay()]; + } + + function formatUTCShortMonth(d) { + return locale_shortMonths[d.getUTCMonth()]; + } + + function formatUTCMonth(d) { + return locale_months[d.getUTCMonth()]; + } + + function formatUTCPeriod(d) { + return locale_periods[+(d.getUTCHours() >= 12)]; + } + + return { + format: function(specifier) { + var f = newFormat(specifier += "", formats); + f.toString = function() { return specifier; }; + return f; + }, + parse: function(specifier) { + var p = newParse(specifier += "", localDate); + p.toString = function() { return specifier; }; + return p; + }, + utcFormat: function(specifier) { + var f = newFormat(specifier += "", utcFormats); + f.toString = function() { return specifier; }; + return f; + }, + utcParse: function(specifier) { + var p = newParse(specifier, utcDate); + p.toString = function() { return specifier; }; + return p; } + }; + } + + var pads = {"-": "", "_": " ", "0": "0"}; + var numberRe = /^\s*\d+/; + var percentRe = /^%/; + var requoteRe = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g; + function pad(value, fill, width) { + var sign = value < 0 ? "-" : "", + string = (sign ? -value : value) + "", + length = string.length; + return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string); + } + + function requote(s) { + return s.replace(requoteRe, "\\$&"); + } + + function formatRe(names) { + return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i"); + } + + function formatLookup(names) { + var map = {}, i = -1, n = names.length; + while (++i < n) map[names[i].toLowerCase()] = i; + return map; + } + + function parseWeekdayNumber(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 1)); + return n ? (d.w = +n[0], i + n[0].length) : -1; + } + + function parseWeekNumberSunday(d, string, i) { + var n = numberRe.exec(string.slice(i)); + return n ? (d.U = +n[0], i + n[0].length) : -1; + } + + function parseWeekNumberMonday(d, string, i) { + var n = numberRe.exec(string.slice(i)); + return n ? (d.W = +n[0], i + n[0].length) : -1; + } + + function parseFullYear(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 4)); + return n ? (d.y = +n[0], i + n[0].length) : -1; + } + + function parseYear(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1; + } + + function parseZone(d, string, i) { + var n = /^(Z)|([+-]\d\d)(?:\:?(\d\d))?/.exec(string.slice(i, i + 6)); + return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1; + } + + function parseMonthNumber(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.m = n[0] - 1, i + n[0].length) : -1; + } + + function parseDayOfMonth(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.d = +n[0], i + n[0].length) : -1; + } + + function parseDayOfYear(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 3)); + return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1; + } + + function parseHour24(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.H = +n[0], i + n[0].length) : -1; + } + + function parseMinutes(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.M = +n[0], i + n[0].length) : -1; + } + + function parseSeconds(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.S = +n[0], i + n[0].length) : -1; + } + + function parseMilliseconds(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 3)); + return n ? (d.L = +n[0], i + n[0].length) : -1; + } + + function parseLiteralPercent(d, string, i) { + var n = percentRe.exec(string.slice(i, i + 1)); + return n ? i + n[0].length : -1; + } + + function formatDayOfMonth(d, p) { + return pad(d.getDate(), p, 2); + } + + function formatHour24(d, p) { + return pad(d.getHours(), p, 2); + } + + function formatHour12(d, p) { + return pad(d.getHours() % 12 || 12, p, 2); + } + + function formatDayOfYear(d, p) { + return pad(1 + d3Time.timeDay.count(d3Time.timeYear(d), d), p, 3); + } + + function formatMilliseconds(d, p) { + return pad(d.getMilliseconds(), p, 3); + } + + function formatMonthNumber(d, p) { + return pad(d.getMonth() + 1, p, 2); + } + + function formatMinutes(d, p) { + return pad(d.getMinutes(), p, 2); + } + + function formatSeconds(d, p) { + return pad(d.getSeconds(), p, 2); + } + + function formatWeekNumberSunday(d, p) { + return pad(d3Time.timeSunday.count(d3Time.timeYear(d), d), p, 2); + } + + function formatWeekdayNumber(d) { + return d.getDay(); + } + + function formatWeekNumberMonday(d, p) { + return pad(d3Time.timeMonday.count(d3Time.timeYear(d), d), p, 2); + } + + function formatYear(d, p) { + return pad(d.getFullYear() % 100, p, 2); + } + + function formatFullYear(d, p) { + return pad(d.getFullYear() % 10000, p, 4); + } + + function formatZone(d) { + var z = d.getTimezoneOffset(); + return (z > 0 ? "-" : (z *= -1, "+")) + + pad(z / 60 | 0, "0", 2) + + pad(z % 60, "0", 2); + } + + function formatUTCDayOfMonth(d, p) { + return pad(d.getUTCDate(), p, 2); + } + + function formatUTCHour24(d, p) { + return pad(d.getUTCHours(), p, 2); + } + + function formatUTCHour12(d, p) { + return pad(d.getUTCHours() % 12 || 12, p, 2); + } + + function formatUTCDayOfYear(d, p) { + return pad(1 + d3Time.utcDay.count(d3Time.utcYear(d), d), p, 3); + } + + function formatUTCMilliseconds(d, p) { + return pad(d.getUTCMilliseconds(), p, 3); + } + + function formatUTCMonthNumber(d, p) { + return pad(d.getUTCMonth() + 1, p, 2); + } + + function formatUTCMinutes(d, p) { + return pad(d.getUTCMinutes(), p, 2); + } + + function formatUTCSeconds(d, p) { + return pad(d.getUTCSeconds(), p, 2); + } + + function formatUTCWeekNumberSunday(d, p) { + return pad(d3Time.utcSunday.count(d3Time.utcYear(d), d), p, 2); + } + + function formatUTCWeekdayNumber(d) { + return d.getUTCDay(); + } + + function formatUTCWeekNumberMonday(d, p) { + return pad(d3Time.utcMonday.count(d3Time.utcYear(d), d), p, 2); + } + + function formatUTCYear(d, p) { + return pad(d.getUTCFullYear() % 100, p, 2); + } + + function formatUTCFullYear(d, p) { + return pad(d.getUTCFullYear() % 10000, p, 4); + } + + function formatUTCZone() { + return "+0000"; + } + + function formatLiteralPercent() { + return "%"; + } + + var locale; + defaultLocale({ + dateTime: "%x, %X", + date: "%-m/%-d/%Y", + time: "%-I:%M:%S %p", + periods: ["AM", "PM"], + days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], + shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], + shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] + }); + + function defaultLocale(definition) { + locale = formatLocale(definition); + exports.timeFormat = locale.format; + exports.timeParse = locale.parse; + exports.utcFormat = locale.utcFormat; + exports.utcParse = locale.utcParse; + return locale; + } + + var isoSpecifier = "%Y-%m-%dT%H:%M:%S.%LZ"; + + function formatIsoNative(date) { + return date.toISOString(); + } + + var formatIso = Date.prototype.toISOString + ? formatIsoNative + : exports.utcFormat(isoSpecifier); + + function parseIsoNative(string) { + var date = new Date(string); + return isNaN(date) ? null : date; + } + + var parseIso = +new Date("2000-01-01T00:00:00.000Z") + ? parseIsoNative + : exports.utcParse(isoSpecifier); + + exports.timeFormatDefaultLocale = defaultLocale; + exports.timeFormatLocale = formatLocale; + exports.isoFormat = formatIso; + exports.isoParse = parseIso; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); +},{"d3-time":142}],142:[function(require,module,exports){ +// https://d3js.org/d3-time/ Version 1.0.4. Copyright 2016 Mike Bostock. +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (factory((global.d3 = global.d3 || {}))); +}(this, (function (exports) { 'use strict'; + +var t0 = new Date; +var t1 = new Date; + +function newInterval(floori, offseti, count, field) { + + function interval(date) { + return floori(date = new Date(+date)), date; + } + + interval.floor = interval; + + interval.ceil = function(date) { + return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date; + }; + + interval.round = function(date) { + var d0 = interval(date), + d1 = interval.ceil(date); + return date - d0 < d1 - date ? d0 : d1; + }; + + interval.offset = function(date, step) { + return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date; + }; + + interval.range = function(start, stop, step) { + var range = []; + start = interval.ceil(start); + step = step == null ? 1 : Math.floor(step); + if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date + do range.push(new Date(+start)); while (offseti(start, step), floori(start), start < stop) + return range; + }; + + interval.filter = function(test) { + return newInterval(function(date) { + if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1); + }, function(date, step) { + if (date >= date) while (--step >= 0) while (offseti(date, 1), !test(date)) {} // eslint-disable-line no-empty }); + }; + + if (count) { + interval.count = function(start, end) { + t0.setTime(+start), t1.setTime(+end); + floori(t0), floori(t1); + return Math.floor(count(t0, t1)); + }; + + interval.every = function(step) { + step = Math.floor(step); + return !isFinite(step) || !(step > 0) ? null + : !(step > 1) ? interval + : interval.filter(field + ? function(d) { return field(d) % step === 0; } + : function(d) { return interval.count(0, d) % step === 0; }); + }; } - return ret; + + return interval; +} + +var millisecond = newInterval(function() { + // noop +}, function(date, step) { + date.setTime(+date + step); +}, function(start, end) { + return end - start; +}); + +// An optimized implementation for this simple case. +millisecond.every = function(k) { + k = Math.floor(k); + if (!isFinite(k) || !(k > 0)) return null; + if (!(k > 1)) return millisecond; + return newInterval(function(date) { + date.setTime(Math.floor(date / k) * k); + }, function(date, step) { + date.setTime(+date + step * k); + }, function(start, end) { + return (end - start) / k; + }); +}; + +var milliseconds = millisecond.range; + +var durationSecond = 1e3; +var durationMinute = 6e4; +var durationHour = 36e5; +var durationDay = 864e5; +var durationWeek = 6048e5; + +var second = newInterval(function(date) { + date.setTime(Math.floor(date / durationSecond) * durationSecond); +}, function(date, step) { + date.setTime(+date + step * durationSecond); +}, function(start, end) { + return (end - start) / durationSecond; +}, function(date) { + return date.getUTCSeconds(); +}); + +var seconds = second.range; + +var minute = newInterval(function(date) { + date.setTime(Math.floor(date / durationMinute) * durationMinute); +}, function(date, step) { + date.setTime(+date + step * durationMinute); +}, function(start, end) { + return (end - start) / durationMinute; +}, function(date) { + return date.getMinutes(); +}); + +var minutes = minute.range; + +var hour = newInterval(function(date) { + var offset = date.getTimezoneOffset() * durationMinute % durationHour; + if (offset < 0) offset += durationHour; + date.setTime(Math.floor((+date - offset) / durationHour) * durationHour + offset); +}, function(date, step) { + date.setTime(+date + step * durationHour); +}, function(start, end) { + return (end - start) / durationHour; +}, function(date) { + return date.getHours(); +}); + +var hours = hour.range; + +var day = newInterval(function(date) { + date.setHours(0, 0, 0, 0); +}, function(date, step) { + date.setDate(date.getDate() + step); +}, function(start, end) { + return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay; +}, function(date) { + return date.getDate() - 1; +}); + +var days = day.range; + +function weekday(i) { + return newInterval(function(date) { + date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7); + date.setHours(0, 0, 0, 0); + }, function(date, step) { + date.setDate(date.getDate() + step * 7); + }, function(start, end) { + return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek; + }); +} + +var sunday = weekday(0); +var monday = weekday(1); +var tuesday = weekday(2); +var wednesday = weekday(3); +var thursday = weekday(4); +var friday = weekday(5); +var saturday = weekday(6); + +var sundays = sunday.range; +var mondays = monday.range; +var tuesdays = tuesday.range; +var wednesdays = wednesday.range; +var thursdays = thursday.range; +var fridays = friday.range; +var saturdays = saturday.range; + +var month = newInterval(function(date) { + date.setDate(1); + date.setHours(0, 0, 0, 0); +}, function(date, step) { + date.setMonth(date.getMonth() + step); +}, function(start, end) { + return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12; +}, function(date) { + return date.getMonth(); +}); + +var months = month.range; + +var year = newInterval(function(date) { + date.setMonth(0, 1); + date.setHours(0, 0, 0, 0); +}, function(date, step) { + date.setFullYear(date.getFullYear() + step); +}, function(start, end) { + return end.getFullYear() - start.getFullYear(); +}, function(date) { + return date.getFullYear(); +}); + +// An optimized implementation for this simple case. +year.every = function(k) { + return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) { + date.setFullYear(Math.floor(date.getFullYear() / k) * k); + date.setMonth(0, 1); + date.setHours(0, 0, 0, 0); + }, function(date, step) { + date.setFullYear(date.getFullYear() + step * k); + }); +}; + +var years = year.range; + +var utcMinute = newInterval(function(date) { + date.setUTCSeconds(0, 0); +}, function(date, step) { + date.setTime(+date + step * durationMinute); +}, function(start, end) { + return (end - start) / durationMinute; +}, function(date) { + return date.getUTCMinutes(); +}); + +var utcMinutes = utcMinute.range; + +var utcHour = newInterval(function(date) { + date.setUTCMinutes(0, 0, 0); +}, function(date, step) { + date.setTime(+date + step * durationHour); +}, function(start, end) { + return (end - start) / durationHour; +}, function(date) { + return date.getUTCHours(); +}); + +var utcHours = utcHour.range; + +var utcDay = newInterval(function(date) { + date.setUTCHours(0, 0, 0, 0); +}, function(date, step) { + date.setUTCDate(date.getUTCDate() + step); +}, function(start, end) { + return (end - start) / durationDay; +}, function(date) { + return date.getUTCDate() - 1; +}); + +var utcDays = utcDay.range; + +function utcWeekday(i) { + return newInterval(function(date) { + date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7); + date.setUTCHours(0, 0, 0, 0); + }, function(date, step) { + date.setUTCDate(date.getUTCDate() + step * 7); + }, function(start, end) { + return (end - start) / durationWeek; + }); +} + +var utcSunday = utcWeekday(0); +var utcMonday = utcWeekday(1); +var utcTuesday = utcWeekday(2); +var utcWednesday = utcWeekday(3); +var utcThursday = utcWeekday(4); +var utcFriday = utcWeekday(5); +var utcSaturday = utcWeekday(6); + +var utcSundays = utcSunday.range; +var utcMondays = utcMonday.range; +var utcTuesdays = utcTuesday.range; +var utcWednesdays = utcWednesday.range; +var utcThursdays = utcThursday.range; +var utcFridays = utcFriday.range; +var utcSaturdays = utcSaturday.range; + +var utcMonth = newInterval(function(date) { + date.setUTCDate(1); + date.setUTCHours(0, 0, 0, 0); +}, function(date, step) { + date.setUTCMonth(date.getUTCMonth() + step); +}, function(start, end) { + return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12; +}, function(date) { + return date.getUTCMonth(); +}); + +var utcMonths = utcMonth.range; + +var utcYear = newInterval(function(date) { + date.setUTCMonth(0, 1); + date.setUTCHours(0, 0, 0, 0); +}, function(date, step) { + date.setUTCFullYear(date.getUTCFullYear() + step); +}, function(start, end) { + return end.getUTCFullYear() - start.getUTCFullYear(); +}, function(date) { + return date.getUTCFullYear(); +}); + +// An optimized implementation for this simple case. +utcYear.every = function(k) { + return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) { + date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k); + date.setUTCMonth(0, 1); + date.setUTCHours(0, 0, 0, 0); + }, function(date, step) { + date.setUTCFullYear(date.getUTCFullYear() + step * k); + }); +}; + +var utcYears = utcYear.range; + +exports.timeInterval = newInterval; +exports.timeMillisecond = millisecond; +exports.timeMilliseconds = milliseconds; +exports.utcMillisecond = millisecond; +exports.utcMilliseconds = milliseconds; +exports.timeSecond = second; +exports.timeSeconds = seconds; +exports.utcSecond = second; +exports.utcSeconds = seconds; +exports.timeMinute = minute; +exports.timeMinutes = minutes; +exports.timeHour = hour; +exports.timeHours = hours; +exports.timeDay = day; +exports.timeDays = days; +exports.timeWeek = sunday; +exports.timeWeeks = sundays; +exports.timeSunday = sunday; +exports.timeSundays = sundays; +exports.timeMonday = monday; +exports.timeMondays = mondays; +exports.timeTuesday = tuesday; +exports.timeTuesdays = tuesdays; +exports.timeWednesday = wednesday; +exports.timeWednesdays = wednesdays; +exports.timeThursday = thursday; +exports.timeThursdays = thursdays; +exports.timeFriday = friday; +exports.timeFridays = fridays; +exports.timeSaturday = saturday; +exports.timeSaturdays = saturdays; +exports.timeMonth = month; +exports.timeMonths = months; +exports.timeYear = year; +exports.timeYears = years; +exports.utcMinute = utcMinute; +exports.utcMinutes = utcMinutes; +exports.utcHour = utcHour; +exports.utcHours = utcHours; +exports.utcDay = utcDay; +exports.utcDays = utcDays; +exports.utcWeek = utcSunday; +exports.utcWeeks = utcSundays; +exports.utcSunday = utcSunday; +exports.utcSundays = utcSundays; +exports.utcMonday = utcMonday; +exports.utcMondays = utcMondays; +exports.utcTuesday = utcTuesday; +exports.utcTuesdays = utcTuesdays; +exports.utcWednesday = utcWednesday; +exports.utcWednesdays = utcWednesdays; +exports.utcThursday = utcThursday; +exports.utcThursdays = utcThursdays; +exports.utcFriday = utcFriday; +exports.utcFridays = utcFridays; +exports.utcSaturday = utcSaturday; +exports.utcSaturdays = utcSaturdays; +exports.utcMonth = utcMonth; +exports.utcMonths = utcMonths; +exports.utcYear = utcYear; +exports.utcYears = utcYears; + +Object.defineProperty(exports, '__esModule', { value: true }); + +}))); + +},{}],143:[function(require,module,exports){ +var pSlice = Array.prototype.slice; +var objectKeys = require('./lib/keys.js'); +var isArguments = require('./lib/is_arguments.js'); + +var deepEqual = module.exports = function (actual, expected, opts) { + if (!opts) opts = {}; + // 7.1. All identical values are equivalent, as determined by ===. + if (actual === expected) { + return true; + + } else if (actual instanceof Date && expected instanceof Date) { + return actual.getTime() === expected.getTime(); + + // 7.3. Other pairs that do not both pass typeof value == 'object', + // equivalence is determined by ==. + } else if (!actual || !expected || typeof actual != 'object' && typeof expected != 'object') { + return opts.strict ? actual === expected : actual == expected; + + // 7.4. For all other Object pairs, including Array objects, equivalence is + // determined by having the same number of owned properties (as verified + // with Object.prototype.hasOwnProperty.call), the same set of keys + // (although not necessarily the same order), equivalent values for every + // corresponding key, and an identical 'prototype' property. Note: this + // accounts for both named and indexed properties on Arrays. + } else { + return objEquiv(actual, expected, opts); + } +} + +function isUndefinedOrNull(value) { + return value === null || value === undefined; +} + +function isBuffer (x) { + if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false; + if (typeof x.copy !== 'function' || typeof x.slice !== 'function') { + return false; + } + if (x.length > 0 && typeof x[0] !== 'number') return false; + return true; +} + +function objEquiv(a, b, opts) { + var i, key; + if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) + return false; + // an identical 'prototype' property. + if (a.prototype !== b.prototype) return false; + //~~~I've managed to break Object.keys through screwy arguments passing. + // Converting to array solves the problem. + if (isArguments(a)) { + if (!isArguments(b)) { + return false; + } + a = pSlice.call(a); + b = pSlice.call(b); + return deepEqual(a, b, opts); + } + if (isBuffer(a)) { + if (!isBuffer(b)) { + return false; + } + if (a.length !== b.length) return false; + for (i = 0; i < a.length; i++) { + if (a[i] !== b[i]) return false; + } + return true; + } + try { + var ka = objectKeys(a), + kb = objectKeys(b); + } catch (e) {//happens when one is a string literal and the other isn't + return false; + } + // having the same number of owned properties (keys incorporates + // hasOwnProperty) + if (ka.length != kb.length) + return false; + //the same set of keys (although not necessarily the same order), + ka.sort(); + kb.sort(); + //~~~cheap key test + for (i = ka.length - 1; i >= 0; i--) { + if (ka[i] != kb[i]) + return false; + } + //equivalent values for every corresponding key, and + //~~~possibly expensive deep test + for (i = ka.length - 1; i >= 0; i--) { + key = ka[i]; + if (!deepEqual(a[key], b[key], opts)) return false; + } + return typeof a === typeof b; +} + +},{"./lib/is_arguments.js":144,"./lib/keys.js":145}],144:[function(require,module,exports){ +var supportsArgumentsClass = (function(){ + return Object.prototype.toString.call(arguments) +})() == '[object Arguments]'; + +exports = module.exports = supportsArgumentsClass ? supported : unsupported; + +exports.supported = supported; +function supported(object) { + return Object.prototype.toString.call(object) == '[object Arguments]'; +}; + +exports.unsupported = unsupported; +function unsupported(object){ + return object && + typeof object == 'object' && + typeof object.length == 'number' && + Object.prototype.hasOwnProperty.call(object, 'callee') && + !Object.prototype.propertyIsEnumerable.call(object, 'callee') || + false; +}; + +},{}],145:[function(require,module,exports){ +exports = module.exports = typeof Object.keys === 'function' + ? Object.keys : shim; + +exports.shim = shim; +function shim (obj) { + var keys = []; + for (var key in obj) keys.push(key); + return keys; +} + +},{}],146:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _utils = require('./utils'); + +var _utils2 = _interopRequireDefault(_utils); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function adjustForViewport(elFuturePos, elRegion, visibleRect, overflow) { + var pos = _utils2["default"].clone(elFuturePos); + var size = { + width: elRegion.width, + height: elRegion.height + }; + + if (overflow.adjustX && pos.left < visibleRect.left) { + pos.left = visibleRect.left; + } + + // Left edge inside and right edge outside viewport, try to resize it. + if (overflow.resizeWidth && pos.left >= visibleRect.left && pos.left + size.width > visibleRect.right) { + size.width -= pos.left + size.width - visibleRect.right; + } + + // Right edge outside viewport, try to move it. + if (overflow.adjustX && pos.left + size.width > visibleRect.right) { + // 保证左边界和可视区域左边界对齐 + pos.left = Math.max(visibleRect.right - size.width, visibleRect.left); + } + + // Top edge outside viewport, try to move it. + if (overflow.adjustY && pos.top < visibleRect.top) { + pos.top = visibleRect.top; + } + + // Top edge inside and bottom edge outside viewport, try to resize it. + if (overflow.resizeHeight && pos.top >= visibleRect.top && pos.top + size.height > visibleRect.bottom) { + size.height -= pos.top + size.height - visibleRect.bottom; + } + + // Bottom edge outside viewport, try to move it. + if (overflow.adjustY && pos.top + size.height > visibleRect.bottom) { + // 保证上边界和可视区域上边界对齐 + pos.top = Math.max(visibleRect.bottom - size.height, visibleRect.top); + } + + return _utils2["default"].mix(pos, size); +} + +exports["default"] = adjustForViewport; +module.exports = exports['default']; +},{"./utils":154}],147:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +/** + * 获取 node 上的 align 对齐点 相对于页面的坐标 + */ + +function getAlignOffset(region, align) { + var V = align.charAt(0); + var H = align.charAt(1); + var w = region.width; + var h = region.height; + var x = void 0; + var y = void 0; + + x = region.left; + y = region.top; + + if (V === 'c') { + y += h / 2; + } else if (V === 'b') { + y += h; + } + + if (H === 'c') { + x += w / 2; + } else if (H === 'r') { + x += w; + } + + return { + left: x, + top: y + }; +} + +exports["default"] = getAlignOffset; +module.exports = exports['default']; +},{}],148:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _getAlignOffset = require('./getAlignOffset'); + +var _getAlignOffset2 = _interopRequireDefault(_getAlignOffset); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function getElFuturePos(elRegion, refNodeRegion, points, offset, targetOffset) { + var xy = void 0; + var diff = void 0; + var p1 = void 0; + var p2 = void 0; + + xy = { + left: elRegion.left, + top: elRegion.top + }; + + p1 = (0, _getAlignOffset2["default"])(refNodeRegion, points[1]); + p2 = (0, _getAlignOffset2["default"])(elRegion, points[0]); + + diff = [p2.left - p1.left, p2.top - p1.top]; + + return { + left: xy.left - diff[0] + offset[0] - targetOffset[0], + top: xy.top - diff[1] + offset[1] - targetOffset[1] + }; +} + +exports["default"] = getElFuturePos; +module.exports = exports['default']; +},{"./getAlignOffset":147}],149:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _utils = require('./utils'); + +var _utils2 = _interopRequireDefault(_utils); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +/** + * 得到会导致元素显示不全的祖先元素 + */ + +function getOffsetParent(element) { + // ie 这个也不是完全可行 + /* +
+
+ 元素 6 高 100px 宽 50px
+
+
+ */ + // element.offsetParent does the right thing in ie7 and below. Return parent with layout! + // In other browsers it only includes elements with position absolute, relative or + // fixed, not elements with overflow set to auto or scroll. + // if (UA.ie && ieMode < 8) { + // return element.offsetParent; + // } + // 统一的 offsetParent 方法 + var doc = element.ownerDocument; + var body = doc.body; + var parent = void 0; + var positionStyle = _utils2["default"].css(element, 'position'); + var skipStatic = positionStyle === 'fixed' || positionStyle === 'absolute'; + + if (!skipStatic) { + return element.nodeName.toLowerCase() === 'html' ? null : element.parentNode; + } + + for (parent = element.parentNode; parent && parent !== body; parent = parent.parentNode) { + positionStyle = _utils2["default"].css(parent, 'position'); + if (positionStyle !== 'static') { + return parent; + } + } + return null; +} + +exports["default"] = getOffsetParent; +module.exports = exports['default']; +},{"./utils":154}],150:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _utils = require('./utils'); + +var _utils2 = _interopRequireDefault(_utils); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function getRegion(node) { + var offset = void 0; + var w = void 0; + var h = void 0; + if (!_utils2["default"].isWindow(node) && node.nodeType !== 9) { + offset = _utils2["default"].offset(node); + w = _utils2["default"].outerWidth(node); + h = _utils2["default"].outerHeight(node); + } else { + var win = _utils2["default"].getWindow(node); + offset = { + left: _utils2["default"].getWindowScrollLeft(win), + top: _utils2["default"].getWindowScrollTop(win) + }; + w = _utils2["default"].viewportWidth(win); + h = _utils2["default"].viewportHeight(win); + } + offset.width = w; + offset.height = h; + return offset; +} + +exports["default"] = getRegion; +module.exports = exports['default']; +},{"./utils":154}],151:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _utils = require('./utils'); + +var _utils2 = _interopRequireDefault(_utils); + +var _getOffsetParent = require('./getOffsetParent'); + +var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +/** + * 获得元素的显示部分的区域 + */ +function getVisibleRectForElement(element) { + var visibleRect = { + left: 0, + right: Infinity, + top: 0, + bottom: Infinity + }; + var el = (0, _getOffsetParent2["default"])(element); + var scrollX = void 0; + var scrollY = void 0; + var winSize = void 0; + var doc = element.ownerDocument; + var win = doc.defaultView || doc.parentWindow; + var body = doc.body; + var documentElement = doc.documentElement; + + // Determine the size of the visible rect by climbing the dom accounting for + // all scrollable containers. + while (el) { + // clientWidth is zero for inline block elements in ie. + if ((navigator.userAgent.indexOf('MSIE') === -1 || el.clientWidth !== 0) && + // body may have overflow set on it, yet we still get the entire + // viewport. In some browsers, el.offsetParent may be + // document.documentElement, so check for that too. + el !== body && el !== documentElement && _utils2["default"].css(el, 'overflow') !== 'visible') { + var pos = _utils2["default"].offset(el); + // add border + pos.left += el.clientLeft; + pos.top += el.clientTop; + visibleRect.top = Math.max(visibleRect.top, pos.top); + visibleRect.right = Math.min(visibleRect.right, + // consider area without scrollBar + pos.left + el.clientWidth); + visibleRect.bottom = Math.min(visibleRect.bottom, pos.top + el.clientHeight); + visibleRect.left = Math.max(visibleRect.left, pos.left); + } else if (el === body || el === documentElement) { + break; + } + el = (0, _getOffsetParent2["default"])(el); + } + + // Clip by window's viewport. + scrollX = _utils2["default"].getWindowScrollLeft(win); + scrollY = _utils2["default"].getWindowScrollTop(win); + visibleRect.left = Math.max(visibleRect.left, scrollX); + visibleRect.top = Math.max(visibleRect.top, scrollY); + winSize = { + width: _utils2["default"].viewportWidth(win), + height: _utils2["default"].viewportHeight(win) + }; + visibleRect.right = Math.min(visibleRect.right, scrollX + winSize.width); + visibleRect.bottom = Math.min(visibleRect.bottom, scrollY + winSize.height); + return visibleRect.top >= 0 && visibleRect.left >= 0 && visibleRect.bottom > visibleRect.top && visibleRect.right > visibleRect.left ? visibleRect : null; +} + +exports["default"] = getVisibleRectForElement; +module.exports = exports['default']; +},{"./getOffsetParent":149,"./utils":154}],152:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _utils = require('./utils'); + +var _utils2 = _interopRequireDefault(_utils); + +var _getOffsetParent = require('./getOffsetParent'); + +var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent); + +var _getVisibleRectForElement = require('./getVisibleRectForElement'); + +var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement); + +var _adjustForViewport = require('./adjustForViewport'); + +var _adjustForViewport2 = _interopRequireDefault(_adjustForViewport); + +var _getRegion = require('./getRegion'); + +var _getRegion2 = _interopRequireDefault(_getRegion); + +var _getElFuturePos = require('./getElFuturePos'); + +var _getElFuturePos2 = _interopRequireDefault(_getElFuturePos); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +// http://yiminghe.iteye.com/blog/1124720 + +/** + * align dom node flexibly + * @author yiminghe@gmail.com + */ + +function isFailX(elFuturePos, elRegion, visibleRect) { + return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right; +} + +function isFailY(elFuturePos, elRegion, visibleRect) { + return elFuturePos.top < visibleRect.top || elFuturePos.top + elRegion.height > visibleRect.bottom; +} + +function isCompleteFailX(elFuturePos, elRegion, visibleRect) { + return elFuturePos.left > visibleRect.right || elFuturePos.left + elRegion.width < visibleRect.left; +} + +function isCompleteFailY(elFuturePos, elRegion, visibleRect) { + return elFuturePos.top > visibleRect.bottom || elFuturePos.top + elRegion.height < visibleRect.top; +} + +function flip(points, reg, map) { + var ret = []; + _utils2["default"].each(points, function (p) { + ret.push(p.replace(reg, function (m) { + return map[m]; + })); + }); + return ret; +} + +function flipOffset(offset, index) { + offset[index] = -offset[index]; + return offset; +} + +function convertOffset(str, offsetLen) { + var n = void 0; + if (/%$/.test(str)) { + n = parseInt(str.substring(0, str.length - 1), 10) / 100 * offsetLen; + } else { + n = parseInt(str, 10); + } + return n || 0; +} + +function normalizeOffset(offset, el) { + offset[0] = convertOffset(offset[0], el.width); + offset[1] = convertOffset(offset[1], el.height); +} + +function domAlign(el, refNode, align) { + var points = align.points; + var offset = align.offset || [0, 0]; + var targetOffset = align.targetOffset || [0, 0]; + var overflow = align.overflow; + var target = align.target || refNode; + var source = align.source || el; + offset = [].concat(offset); + targetOffset = [].concat(targetOffset); + overflow = overflow || {}; + var newOverflowCfg = {}; + + var fail = 0; + // 当前节点可以被放置的显示区域 + var visibleRect = (0, _getVisibleRectForElement2["default"])(source); + // 当前节点所占的区域, left/top/width/height + var elRegion = (0, _getRegion2["default"])(source); + // 参照节点所占的区域, left/top/width/height + var refNodeRegion = (0, _getRegion2["default"])(target); + // 将 offset 转换成数值,支持百分比 + normalizeOffset(offset, elRegion); + normalizeOffset(targetOffset, refNodeRegion); + // 当前节点将要被放置的位置 + var elFuturePos = (0, _getElFuturePos2["default"])(elRegion, refNodeRegion, points, offset, targetOffset); + // 当前节点将要所处的区域 + var newElRegion = _utils2["default"].merge(elRegion, elFuturePos); + + // 如果可视区域不能完全放置当前节点时允许调整 + if (visibleRect && (overflow.adjustX || overflow.adjustY)) { + if (overflow.adjustX) { + // 如果横向不能放下 + if (isFailX(elFuturePos, elRegion, visibleRect)) { + // 对齐位置反下 + var newPoints = flip(points, /[lr]/ig, { + l: 'r', + r: 'l' + }); + // 偏移量也反下 + var newOffset = flipOffset(offset, 0); + var newTargetOffset = flipOffset(targetOffset, 0); + var newElFuturePos = (0, _getElFuturePos2["default"])(elRegion, refNodeRegion, newPoints, newOffset, newTargetOffset); + if (!isCompleteFailX(newElFuturePos, elRegion, visibleRect)) { + fail = 1; + points = newPoints; + offset = newOffset; + targetOffset = newTargetOffset; + } + } + } + + if (overflow.adjustY) { + // 如果纵向不能放下 + if (isFailY(elFuturePos, elRegion, visibleRect)) { + // 对齐位置反下 + var _newPoints = flip(points, /[tb]/ig, { + t: 'b', + b: 't' + }); + // 偏移量也反下 + var _newOffset = flipOffset(offset, 1); + var _newTargetOffset = flipOffset(targetOffset, 1); + var _newElFuturePos = (0, _getElFuturePos2["default"])(elRegion, refNodeRegion, _newPoints, _newOffset, _newTargetOffset); + if (!isCompleteFailY(_newElFuturePos, elRegion, visibleRect)) { + fail = 1; + points = _newPoints; + offset = _newOffset; + targetOffset = _newTargetOffset; + } + } + } + + // 如果失败,重新计算当前节点将要被放置的位置 + if (fail) { + elFuturePos = (0, _getElFuturePos2["default"])(elRegion, refNodeRegion, points, offset, targetOffset); + _utils2["default"].mix(newElRegion, elFuturePos); + } + + // 检查反下后的位置是否可以放下了 + // 如果仍然放不下只有指定了可以调整当前方向才调整 + newOverflowCfg.adjustX = overflow.adjustX && isFailX(elFuturePos, elRegion, visibleRect); + + newOverflowCfg.adjustY = overflow.adjustY && isFailY(elFuturePos, elRegion, visibleRect); + + // 确实要调整,甚至可能会调整高度宽度 + if (newOverflowCfg.adjustX || newOverflowCfg.adjustY) { + newElRegion = (0, _adjustForViewport2["default"])(elFuturePos, elRegion, visibleRect, newOverflowCfg); + } + } + + // need judge to in case set fixed with in css on height auto element + if (newElRegion.width !== elRegion.width) { + _utils2["default"].css(source, 'width', _utils2["default"].width(source) + newElRegion.width - elRegion.width); + } + + if (newElRegion.height !== elRegion.height) { + _utils2["default"].css(source, 'height', _utils2["default"].height(source) + newElRegion.height - elRegion.height); + } + + // https://github.com/kissyteam/kissy/issues/190 + // 相对于屏幕位置没变,而 left/top 变了 + // 例如
+ _utils2["default"].offset(source, { + left: newElRegion.left, + top: newElRegion.top + }, { + useCssRight: align.useCssRight, + useCssBottom: align.useCssBottom, + useCssTransform: align.useCssTransform + }); + + return { + points: points, + offset: offset, + targetOffset: targetOffset, + overflow: newOverflowCfg + }; +} + +domAlign.__getOffsetParent = _getOffsetParent2["default"]; + +domAlign.__getVisibleRectForElement = _getVisibleRectForElement2["default"]; + +exports["default"] = domAlign; +/** + * 2012-04-26 yiminghe@gmail.com + * - 优化智能对齐算法 + * - 慎用 resizeXX + * + * 2011-07-13 yiminghe@gmail.com note: + * - 增加智能对齐,以及大小调整选项 + **/ + +module.exports = exports['default']; +},{"./adjustForViewport":146,"./getElFuturePos":148,"./getOffsetParent":149,"./getRegion":150,"./getVisibleRectForElement":151,"./utils":154}],153:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getTransformName = getTransformName; +exports.setTransitionProperty = setTransitionProperty; +exports.getTransitionProperty = getTransitionProperty; +exports.getTransformXY = getTransformXY; +exports.setTransformXY = setTransformXY; +var vendorPrefix = void 0; + +var jsCssMap = { + Webkit: '-webkit-', + Moz: '-moz-', + // IE did it wrong again ... + ms: '-ms-', + O: '-o-' +}; + +function getVendorPrefix() { + if (vendorPrefix !== undefined) { + return vendorPrefix; + } + vendorPrefix = ''; + var style = document.createElement('p').style; + var testProp = 'Transform'; + for (var key in jsCssMap) { + if (key + testProp in style) { + vendorPrefix = key; + } + } + return vendorPrefix; +} + +function getTransitionName() { + return getVendorPrefix() ? getVendorPrefix() + 'TransitionProperty' : 'transitionProperty'; +} + +function getTransformName() { + return getVendorPrefix() ? getVendorPrefix() + 'Transform' : 'transform'; +} + +function setTransitionProperty(node, value) { + var name = getTransitionName(); + if (name) { + node.style[name] = value; + if (name !== 'transitionProperty') { + node.style.transitionProperty = value; + } + } +} + +function setTransform(node, value) { + var name = getTransformName(); + if (name) { + node.style[name] = value; + if (name !== 'transform') { + node.style.transform = value; + } + } +} + +function getTransitionProperty(node) { + return node.style.transitionProperty || node.style[getTransitionName()]; +} + +function getTransformXY(node) { + var style = window.getComputedStyle(node, null); + var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName()); + if (transform && transform !== 'none') { + var matrix = transform.replace(/[^0-9\-.,]/g, '').split(','); + return { x: parseFloat(matrix[12] || matrix[4], 0), y: parseFloat(matrix[13] || matrix[5], 0) }; + } + return { + x: 0, + y: 0 + }; +} + +var matrix2d = /matrix\((.*)\)/; +var matrix3d = /matrix3d\((.*)\)/; + +function setTransformXY(node, xy) { + var style = window.getComputedStyle(node, null); + var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName()); + if (transform && transform !== 'none') { + var arr = void 0; + var match2d = transform.match(matrix2d); + if (match2d) { + match2d = match2d[1]; + arr = match2d.split(',').map(function (item) { + return parseFloat(item, 10); + }); + arr[4] = xy.x; + arr[5] = xy.y; + setTransform(node, 'matrix(' + arr.join(',') + ')'); + } else { + var match3d = transform.match(matrix3d)[1]; + arr = match3d.split(',').map(function (item) { + return parseFloat(item, 10); + }); + arr[12] = xy.x; + arr[13] = xy.y; + setTransform(node, 'matrix3d(' + arr.join(',') + ')'); + } + } else { + setTransform(node, 'translateX(' + xy.x + 'px) translateY(' + xy.y + 'px) translateZ(0)'); + } +} +},{}],154:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; + +var _propertyUtils = require('./propertyUtils'); + +var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source; + +var getComputedStyleX = void 0; + +function force(x, y) { + return x + y; +} + +function css(el, name, v) { + var value = v; + if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') { + for (var i in name) { + if (name.hasOwnProperty(i)) { + css(el, i, name[i]); + } + } + return undefined; + } + if (typeof value !== 'undefined') { + if (typeof value === 'number') { + value = value + 'px'; + } + el.style[name] = value; + return undefined; + } + return getComputedStyleX(el, name); +} + +function getClientPosition(elem) { + var box = void 0; + var x = void 0; + var y = void 0; + var doc = elem.ownerDocument; + var body = doc.body; + var docElem = doc && doc.documentElement; + // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式 + box = elem.getBoundingClientRect(); + + // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop + // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确 + // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin + + x = box.left; + y = box.top; + + // In IE, most of the time, 2 extra pixels are added to the top and left + // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and + // IE6 standards mode, this border can be overridden by setting the + // document element's border to zero -- thus, we cannot rely on the + // offset always being 2 pixels. + + // In quirks mode, the offset can be determined by querying the body's + // clientLeft/clientTop, but in standards mode, it is found by querying + // the document element's clientLeft/clientTop. Since we already called + // getClientBoundingRect we have already forced a reflow, so it is not + // too expensive just to query them all. + + // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的 + // 窗口边框标准是设 documentElement ,quirks 时设置 body + // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去 + // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置 + // 标准 ie 下 docElem.clientTop 就是 border-top + // ie7 html 即窗口边框改变不了。永远为 2 + // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0 + + x -= docElem.clientLeft || body.clientLeft || 0; + y -= docElem.clientTop || body.clientTop || 0; + + return { + left: x, + top: y + }; +} + +function getScroll(w, top) { + var ret = w['page' + (top ? 'Y' : 'X') + 'Offset']; + var method = 'scroll' + (top ? 'Top' : 'Left'); + if (typeof ret !== 'number') { + var d = w.document; + // ie6,7,8 standard mode + ret = d.documentElement[method]; + if (typeof ret !== 'number') { + // quirks mode + ret = d.body[method]; + } + } + return ret; +} + +function getScrollLeft(w) { + return getScroll(w); +} + +function getScrollTop(w) { + return getScroll(w, true); +} + +function getOffset(el) { + var pos = getClientPosition(el); + var doc = el.ownerDocument; + var w = doc.defaultView || doc.parentWindow; + pos.left += getScrollLeft(w); + pos.top += getScrollTop(w); + return pos; +} +function _getComputedStyle(elem, name, cs) { + var computedStyle = cs; + var val = ''; + var d = elem.ownerDocument; + computedStyle = computedStyle || d.defaultView.getComputedStyle(elem, null); + + // https://github.com/kissyteam/kissy/issues/61 + if (computedStyle) { + val = computedStyle.getPropertyValue(name) || computedStyle[name]; + } + + return val; +} + +var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i'); +var RE_POS = /^(top|right|bottom|left)$/; +var CURRENT_STYLE = 'currentStyle'; +var RUNTIME_STYLE = 'runtimeStyle'; +var LEFT = 'left'; +var PX = 'px'; + +function _getComputedStyleIE(elem, name) { + // currentStyle maybe null + // http://msdn.microsoft.com/en-us/library/ms535231.aspx + var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name]; + + // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值 + // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19 + // 在 ie 下不对,需要直接用 offset 方式 + // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了 + + // From the awesome hack by Dean Edwards + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 + // If we're not dealing with a regular pixel number + // but a number that has a weird ending, we need to convert it to pixels + // exclude left right for relativity + if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) { + // Remember the original values + var style = elem.style; + var left = style[LEFT]; + var rsLeft = elem[RUNTIME_STYLE][LEFT]; + + // prevent flashing of content + elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT]; + + // Put in the new values to get a computed value out + style[LEFT] = name === 'fontSize' ? '1em' : ret || 0; + ret = style.pixelLeft + PX; + + // Revert the changed values + style[LEFT] = left; + + elem[RUNTIME_STYLE][LEFT] = rsLeft; + } + return ret === '' ? 'auto' : ret; +} + +if (typeof window !== 'undefined') { + getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE; +} + +function getOffsetDirection(dir, option) { + if (dir === 'left') { + return option.useCssRight ? 'right' : dir; + } + return option.useCssBottom ? 'bottom' : dir; +} + +function oppositeOffsetDirection(dir) { + if (dir === 'left') { + return 'right'; + } else if (dir === 'right') { + return 'left'; + } else if (dir === 'top') { + return 'bottom'; + } else if (dir === 'bottom') { + return 'top'; + } +} + +// 设置 elem 相对 elem.ownerDocument 的坐标 +function setLeftTop(elem, offset, option) { + // set position first, in-case top/left are set even on static elem + if (css(elem, 'position') === 'static') { + elem.style.position = 'relative'; + } + var presetH = -999; + var presetV = -999; + var horizontalProperty = getOffsetDirection('left', option); + var verticalProperty = getOffsetDirection('top', option); + var oppositeHorizontalProperty = oppositeOffsetDirection(horizontalProperty); + var oppositeVerticalProperty = oppositeOffsetDirection(verticalProperty); + + if (horizontalProperty !== 'left') { + presetH = 999; + } + + if (verticalProperty !== 'top') { + presetV = 999; + } + var originalTransition = ''; + var originalOffset = getOffset(elem); + if ('left' in offset || 'top' in offset) { + originalTransition = (0, _propertyUtils.getTransitionProperty)(elem) || ''; + (0, _propertyUtils.setTransitionProperty)(elem, 'none'); + } + if ('left' in offset) { + elem.style[oppositeHorizontalProperty] = ''; + elem.style[horizontalProperty] = presetH + 'px'; + } + if ('top' in offset) { + elem.style[oppositeVerticalProperty] = ''; + elem.style[verticalProperty] = presetV + 'px'; + } + var old = getOffset(elem); + var originalStyle = {}; + for (var key in offset) { + if (offset.hasOwnProperty(key)) { + var dir = getOffsetDirection(key, option); + var preset = key === 'left' ? presetH : presetV; + var off = originalOffset[key] - old[key]; + if (dir === key) { + originalStyle[dir] = preset + off; + } else { + originalStyle[dir] = preset - off; + } + } + } + css(elem, originalStyle); + // force relayout + force(elem.offsetTop, elem.offsetLeft); + if ('left' in offset || 'top' in offset) { + (0, _propertyUtils.setTransitionProperty)(elem, originalTransition); + } + var ret = {}; + for (var _key in offset) { + if (offset.hasOwnProperty(_key)) { + var _dir = getOffsetDirection(_key, option); + var _off = offset[_key] - originalOffset[_key]; + if (_key === _dir) { + ret[_dir] = originalStyle[_dir] + _off; + } else { + ret[_dir] = originalStyle[_dir] - _off; + } + } + } + css(elem, ret); +} + +function setTransform(elem, offset) { + var originalOffset = getOffset(elem); + var originalXY = (0, _propertyUtils.getTransformXY)(elem); + var resultXY = { x: originalXY.x, y: originalXY.y }; + if ('left' in offset) { + resultXY.x = originalXY.x + offset.left - originalOffset.left; + } + if ('top' in offset) { + resultXY.y = originalXY.y + offset.top - originalOffset.top; + } + (0, _propertyUtils.setTransformXY)(elem, resultXY); +} + +function setOffset(elem, offset, option) { + if (option.useCssRight || option.useCssBottom) { + setLeftTop(elem, offset, option); + } else if (option.useCssTransform && (0, _propertyUtils.getTransformName)() in document.body.style) { + setTransform(elem, offset, option); + } else { + setLeftTop(elem, offset, option); + } +} + +function each(arr, fn) { + for (var i = 0; i < arr.length; i++) { + fn(arr[i]); + } +} + +function isBorderBoxFn(elem) { + return getComputedStyleX(elem, 'boxSizing') === 'border-box'; +} + +var BOX_MODELS = ['margin', 'border', 'padding']; +var CONTENT_INDEX = -1; +var PADDING_INDEX = 2; +var BORDER_INDEX = 1; +var MARGIN_INDEX = 0; + +function swap(elem, options, callback) { + var old = {}; + var style = elem.style; + var name = void 0; + + // Remember the old values, and insert the new ones + for (name in options) { + if (options.hasOwnProperty(name)) { + old[name] = style[name]; + style[name] = options[name]; + } + } + + callback.call(elem); + + // Revert the old values + for (name in options) { + if (options.hasOwnProperty(name)) { + style[name] = old[name]; + } + } +} + +function getPBMWidth(elem, props, which) { + var value = 0; + var prop = void 0; + var j = void 0; + var i = void 0; + for (j = 0; j < props.length; j++) { + prop = props[j]; + if (prop) { + for (i = 0; i < which.length; i++) { + var cssProp = void 0; + if (prop === 'border') { + cssProp = '' + prop + which[i] + 'Width'; + } else { + cssProp = prop + which[i]; + } + value += parseFloat(getComputedStyleX(elem, cssProp)) || 0; + } + } + } + return value; +} + +/** + * A crude way of determining if an object is a window + * @member util + */ +function isWindow(obj) { + // must use == for ie8 + /* eslint eqeqeq:0 */ + return obj !== null && obj !== undefined && obj == obj.window; +} + +var domUtils = {}; + +each(['Width', 'Height'], function (name) { + domUtils['doc' + name] = function (refWin) { + var d = refWin.document; + return Math.max( + // firefox chrome documentElement.scrollHeight< body.scrollHeight + // ie standard mode : documentElement.scrollHeight> body.scrollHeight + d.documentElement['scroll' + name], + // quirks : documentElement.scrollHeight 最大等于可视窗口多一点? + d.body['scroll' + name], domUtils['viewport' + name](d)); + }; + + domUtils['viewport' + name] = function (win) { + // pc browser includes scrollbar in window.innerWidth + var prop = 'client' + name; + var doc = win.document; + var body = doc.body; + var documentElement = doc.documentElement; + var documentElementProp = documentElement[prop]; + // 标准模式取 documentElement + // backcompat 取 body + return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp; + }; +}); + +/* + 得到元素的大小信息 + @param elem + @param name + @param {String} [extra] 'padding' : (css width) + padding + 'border' : (css width) + padding + border + 'margin' : (css width) + padding + border + margin + */ +function getWH(elem, name, ex) { + var extra = ex; + if (isWindow(elem)) { + return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem); + } else if (elem.nodeType === 9) { + return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem); + } + var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; + var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight; + var computedStyle = getComputedStyleX(elem); + var isBorderBox = isBorderBoxFn(elem, computedStyle); + var cssBoxValue = 0; + if (borderBoxValue === null || borderBoxValue === undefined || borderBoxValue <= 0) { + borderBoxValue = undefined; + // Fall back to computed then un computed css if necessary + cssBoxValue = getComputedStyleX(elem, name); + if (cssBoxValue === null || cssBoxValue === undefined || Number(cssBoxValue) < 0) { + cssBoxValue = elem.style[name] || 0; + } + // Normalize '', auto, and prepare for extra + cssBoxValue = parseFloat(cssBoxValue) || 0; + } + if (extra === undefined) { + extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX; + } + var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox; + var val = borderBoxValue || cssBoxValue; + if (extra === CONTENT_INDEX) { + if (borderBoxValueOrIsBorderBox) { + return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle); + } + return cssBoxValue; + } else if (borderBoxValueOrIsBorderBox) { + if (extra === BORDER_INDEX) { + return val; + } + return val + (extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle)); + } + return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle); +} + +var cssShow = { + position: 'absolute', + visibility: 'hidden', + display: 'block' +}; + +// fix #119 : https://github.com/kissyteam/kissy/issues/119 +function getWHIgnoreDisplay() { + for (var _len = arguments.length, args = Array(_len), _key2 = 0; _key2 < _len; _key2++) { + args[_key2] = arguments[_key2]; + } + + var val = void 0; + var elem = args[0]; + // in case elem is window + // elem.offsetWidth === undefined + if (elem.offsetWidth !== 0) { + val = getWH.apply(undefined, args); + } else { + swap(elem, cssShow, function () { + val = getWH.apply(undefined, args); + }); + } + return val; +} + +each(['width', 'height'], function (name) { + var first = name.charAt(0).toUpperCase() + name.slice(1); + domUtils['outer' + first] = function (el, includeMargin) { + return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX); + }; + var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; + + domUtils[name] = function (elem, v) { + var val = v; + if (val !== undefined) { + if (elem) { + var computedStyle = getComputedStyleX(elem); + var isBorderBox = isBorderBoxFn(elem); + if (isBorderBox) { + val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle); + } + return css(elem, name, val); + } + return undefined; + } + return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX); + }; +}); + +function mix(to, from) { + for (var i in from) { + if (from.hasOwnProperty(i)) { + to[i] = from[i]; + } + } + return to; +} + +var utils = { + getWindow: function getWindow(node) { + if (node && node.document && node.setTimeout) { + return node; + } + var doc = node.ownerDocument || node; + return doc.defaultView || doc.parentWindow; + }, + offset: function offset(el, value, option) { + if (typeof value !== 'undefined') { + setOffset(el, value, option || {}); + } else { + return getOffset(el); + } + }, + + isWindow: isWindow, + each: each, + css: css, + clone: function clone(obj) { + var i = void 0; + var ret = {}; + for (i in obj) { + if (obj.hasOwnProperty(i)) { + ret[i] = obj[i]; + } + } + var overflow = obj.overflow; + if (overflow) { + for (i in obj) { + if (obj.hasOwnProperty(i)) { + ret.overflow[i] = obj.overflow[i]; + } + } + } + return ret; + }, + + mix: mix, + getWindowScrollLeft: function getWindowScrollLeft(w) { + return getScrollLeft(w); + }, + getWindowScrollTop: function getWindowScrollTop(w) { + return getScrollTop(w); + }, + merge: function merge() { + var ret = {}; + + for (var _len2 = arguments.length, args = Array(_len2), _key3 = 0; _key3 < _len2; _key3++) { + args[_key3] = arguments[_key3]; + } + + for (var i = 0; i < args.length; i++) { + utils.mix(ret, args[i]); + } + return ret; + }, + + viewportWidth: 0, + viewportHeight: 0 +}; + +mix(utils, domUtils); + +exports["default"] = utils; +module.exports = exports['default']; +},{"./propertyUtils":153}],155:[function(require,module,exports){ +'use strict'; + +var babelHelpers = require('./util/babelHelpers.js'); + +exports.__esModule = true; + +/** + * document.activeElement + */ +exports['default'] = activeElement; + +var _ownerDocument = require('./ownerDocument'); + +var _ownerDocument2 = babelHelpers.interopRequireDefault(_ownerDocument); + +function activeElement() { + var doc = arguments[0] === undefined ? document : arguments[0]; + + try { + return doc.activeElement; + } catch (e) {} +} + +module.exports = exports['default']; +},{"./ownerDocument":164,"./util/babelHelpers.js":177}],156:[function(require,module,exports){ +'use strict'; +var hasClass = require('./hasClass'); + +module.exports = function addClass(element, className) { + if (element.classList) element.classList.add(className);else if (!hasClass(element)) element.className = element.className + ' ' + className; +}; +},{"./hasClass":157}],157:[function(require,module,exports){ +'use strict'; +module.exports = function hasClass(element, className) { + if (element.classList) return !!className && element.classList.contains(className);else return (' ' + element.className + ' ').indexOf(' ' + className + ' ') !== -1; +}; +},{}],158:[function(require,module,exports){ +'use strict'; + +module.exports = { + addClass: require('./addClass'), + removeClass: require('./removeClass'), + hasClass: require('./hasClass') +}; +},{"./addClass":156,"./hasClass":157,"./removeClass":159}],159:[function(require,module,exports){ +'use strict'; + +module.exports = function removeClass(element, className) { + if (element.classList) element.classList.remove(className);else element.className = element.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)', 'g'), '$1').replace(/\s+/g, ' ').replace(/^\s*|\s*$/g, ''); +}; +},{}],160:[function(require,module,exports){ +'use strict'; + +var contains = require('../query/contains'), + qsa = require('../query/querySelectorAll'); + +module.exports = function (selector, handler) { + return function (e) { + var top = e.currentTarget, + target = e.target, + matches = qsa(top, selector); + + if (matches.some(function (match) { + return contains(match, target); + })) handler.call(this, e); + }; +}; +},{"../query/contains":165,"../query/querySelectorAll":170}],161:[function(require,module,exports){ +'use strict'; +var on = require('./on'), + off = require('./off'), + filter = require('./filter'); + +module.exports = { on: on, off: off, filter: filter }; +},{"./filter":160,"./off":162,"./on":163}],162:[function(require,module,exports){ +'use strict'; +var canUseDOM = require('../util/inDOM'); +var off = function off() {}; + +if (canUseDOM) { + + off = (function () { + + if (document.addEventListener) return function (node, eventName, handler, capture) { + return node.removeEventListener(eventName, handler, capture || false); + };else if (document.attachEvent) return function (node, eventName, handler) { + return node.detachEvent('on' + eventName, handler); + }; + })(); +} + +module.exports = off; +},{"../util/inDOM":182}],163:[function(require,module,exports){ +'use strict'; +var canUseDOM = require('../util/inDOM'); +var on = function on() {}; + +if (canUseDOM) { + on = (function () { + + if (document.addEventListener) return function (node, eventName, handler, capture) { + return node.addEventListener(eventName, handler, capture || false); + };else if (document.attachEvent) return function (node, eventName, handler) { + return node.attachEvent('on' + eventName, handler); + }; + })(); +} + +module.exports = on; +},{"../util/inDOM":182}],164:[function(require,module,exports){ +"use strict"; + +exports.__esModule = true; +exports["default"] = ownerDocument; + +function ownerDocument(node) { + return node && node.ownerDocument || document; +} + +module.exports = exports["default"]; +},{}],165:[function(require,module,exports){ +'use strict'; +var canUseDOM = require('../util/inDOM'); + +var contains = (function () { + var root = canUseDOM && document.documentElement; + + return root && root.contains ? function (context, node) { + return context.contains(node); + } : root && root.compareDocumentPosition ? function (context, node) { + return context === node || !!(context.compareDocumentPosition(node) & 16); + } : function (context, node) { + if (node) do { + if (node === context) return true; + } while (node = node.parentNode); + + return false; + }; +})(); + +module.exports = contains; +},{"../util/inDOM":182}],166:[function(require,module,exports){ +'use strict'; + +module.exports = function getWindow(node) { + return node === node.window ? node : node.nodeType === 9 ? node.defaultView || node.parentWindow : false; +}; +},{}],167:[function(require,module,exports){ +'use strict'; +var contains = require('./contains'), + getWindow = require('./isWindow'), + ownerDocument = require('../ownerDocument'); + +module.exports = function offset(node) { + var doc = ownerDocument(node), + win = getWindow(doc), + docElem = doc && doc.documentElement, + box = { top: 0, left: 0, height: 0, width: 0 }; + + if (!doc) return; + + // Make sure it's not a disconnected DOM node + if (!contains(docElem, node)) return box; + + if (node.getBoundingClientRect !== undefined) box = node.getBoundingClientRect(); + + if (box.width || box.height) { + + box = { + top: box.top + (win.pageYOffset || docElem.scrollTop) - (docElem.clientTop || 0), + left: box.left + (win.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || 0), + width: (box.width == null ? node.offsetWidth : box.width) || 0, + height: (box.height == null ? node.offsetHeight : box.height) || 0 + }; + } + + return box; +}; +},{"../ownerDocument":164,"./contains":165,"./isWindow":166}],168:[function(require,module,exports){ +'use strict'; + +var babelHelpers = require('../util/babelHelpers.js'); + +exports.__esModule = true; +exports['default'] = offsetParent; + +var _ownerDocument = require('../ownerDocument'); + +var _ownerDocument2 = babelHelpers.interopRequireDefault(_ownerDocument); + +var _style = require('../style'); + +var _style2 = babelHelpers.interopRequireDefault(_style); + +function nodeName(node) { + return node.nodeName && node.nodeName.toLowerCase(); +} + +function offsetParent(node) { + var doc = (0, _ownerDocument2['default'])(node), + offsetParent = node && node.offsetParent; + + while (offsetParent && nodeName(node) !== 'html' && (0, _style2['default'])(offsetParent, 'position') === 'static') { + offsetParent = offsetParent.offsetParent; + } + + return offsetParent || doc.documentElement; +} + +module.exports = exports['default']; +},{"../ownerDocument":164,"../style":174,"../util/babelHelpers.js":177}],169:[function(require,module,exports){ +'use strict'; + +var babelHelpers = require('../util/babelHelpers.js'); + +exports.__esModule = true; +exports['default'] = position; + +var _offset = require('./offset'); + +var _offset2 = babelHelpers.interopRequireDefault(_offset); + +var _offsetParent = require('./offsetParent'); + +var _offsetParent2 = babelHelpers.interopRequireDefault(_offsetParent); + +var _scrollTop = require('./scrollTop'); + +var _scrollTop2 = babelHelpers.interopRequireDefault(_scrollTop); + +var _scrollLeft = require('./scrollLeft'); + +var _scrollLeft2 = babelHelpers.interopRequireDefault(_scrollLeft); + +var _style = require('../style'); + +var _style2 = babelHelpers.interopRequireDefault(_style); + +function nodeName(node) { + return node.nodeName && node.nodeName.toLowerCase(); +} + +function position(node, offsetParent) { + var parentOffset = { top: 0, left: 0 }, + offset; + + // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, + // because it is its only offset parent + if ((0, _style2['default'])(node, 'position') === 'fixed') { + offset = node.getBoundingClientRect(); + } else { + offsetParent = offsetParent || (0, _offsetParent2['default'])(node); + offset = (0, _offset2['default'])(node); + + if (nodeName(offsetParent) !== 'html') parentOffset = (0, _offset2['default'])(offsetParent); + + parentOffset.top += parseInt((0, _style2['default'])(offsetParent, 'borderTopWidth'), 10) - (0, _scrollTop2['default'])(offsetParent) || 0; + parentOffset.left += parseInt((0, _style2['default'])(offsetParent, 'borderLeftWidth'), 10) - (0, _scrollLeft2['default'])(offsetParent) || 0; + } + + // Subtract parent offsets and node margins + return babelHelpers._extends({}, offset, { + top: offset.top - parentOffset.top - (parseInt((0, _style2['default'])(node, 'marginTop'), 10) || 0), + left: offset.left - parentOffset.left - (parseInt((0, _style2['default'])(node, 'marginLeft'), 10) || 0) + }); +} + +module.exports = exports['default']; +},{"../style":174,"../util/babelHelpers.js":177,"./offset":167,"./offsetParent":168,"./scrollLeft":171,"./scrollTop":172}],170:[function(require,module,exports){ +'use strict'; +// Zepto.js +// (c) 2010-2015 Thomas Fuchs +// Zepto.js may be freely distributed under the MIT license. +var simpleSelectorRE = /^[\w-]*$/, + toArray = Function.prototype.bind.call(Function.prototype.call, [].slice); + +module.exports = function qsa(element, selector) { + var maybeID = selector[0] === '#', + maybeClass = selector[0] === '.', + nameOnly = maybeID || maybeClass ? selector.slice(1) : selector, + isSimple = simpleSelectorRE.test(nameOnly), + found; + + if (isSimple) { + if (maybeID) { + element = element.getElementById ? element : document; + return (found = element.getElementById(nameOnly)) ? [found] : []; + } + + if (element.getElementsByClassName && maybeClass) return toArray(element.getElementsByClassName(nameOnly)); + + return toArray(element.getElementsByTagName(selector)); + } + + return toArray(element.querySelectorAll(selector)); +}; +},{}],171:[function(require,module,exports){ +'use strict'; +var getWindow = require('./isWindow'); + +module.exports = function scrollTop(node, val) { + var win = getWindow(node); + + if (val === undefined) return win ? 'pageXOffset' in win ? win.pageXOffset : win.document.documentElement.scrollLeft : node.scrollLeft; + + if (win) win.scrollTo(val, 'pageYOffset' in win ? win.pageYOffset : win.document.documentElement.scrollTop);else node.scrollLeft = val; +}; +},{"./isWindow":166}],172:[function(require,module,exports){ +'use strict'; +var getWindow = require('./isWindow'); + +module.exports = function scrollTop(node, val) { + var win = getWindow(node); + + if (val === undefined) return win ? 'pageYOffset' in win ? win.pageYOffset : win.document.documentElement.scrollTop : node.scrollTop; + + if (win) win.scrollTo('pageXOffset' in win ? win.pageXOffset : win.document.documentElement.scrollLeft, val);else node.scrollTop = val; +}; +},{"./isWindow":166}],173:[function(require,module,exports){ +'use strict'; + +var babelHelpers = require('../util/babelHelpers.js'); + +var _utilCamelizeStyle = require('../util/camelizeStyle'); + +var _utilCamelizeStyle2 = babelHelpers.interopRequireDefault(_utilCamelizeStyle); + +var rposition = /^(top|right|bottom|left)$/; +var rnumnonpx = /^([+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|))(?!px)[a-z%]+$/i; + +module.exports = function _getComputedStyle(node) { + if (!node) throw new TypeError('No Element passed to `getComputedStyle()`'); + var doc = node.ownerDocument; + + return 'defaultView' in doc ? doc.defaultView.opener ? node.ownerDocument.defaultView.getComputedStyle(node, null) : window.getComputedStyle(node, null) : { //ie 8 "magic" from: https://github.com/jquery/jquery/blob/1.11-stable/src/css/curCSS.js#L72 + getPropertyValue: function getPropertyValue(prop) { + var style = node.style; + + prop = (0, _utilCamelizeStyle2['default'])(prop); + + if (prop == 'float') prop = 'styleFloat'; + + var current = node.currentStyle[prop] || null; + + if (current == null && style && style[prop]) current = style[prop]; + + if (rnumnonpx.test(current) && !rposition.test(prop)) { + // Remember the original values + var left = style.left; + var runStyle = node.runtimeStyle; + var rsLeft = runStyle && runStyle.left; + + // Put in the new values to get a computed value out + if (rsLeft) runStyle.left = node.currentStyle.left; + + style.left = prop === 'fontSize' ? '1em' : current; + current = style.pixelLeft + 'px'; + + // Revert the changed values + style.left = left; + if (rsLeft) runStyle.left = rsLeft; + } + + return current; + } + }; +}; +},{"../util/babelHelpers.js":177,"../util/camelizeStyle":179}],174:[function(require,module,exports){ +'use strict'; + +var camelize = require('../util/camelizeStyle'), + hyphenate = require('../util/hyphenateStyle'), + _getComputedStyle = require('./getComputedStyle'), + removeStyle = require('./removeStyle'); + +var has = Object.prototype.hasOwnProperty; + +module.exports = function style(node, property, value) { + var css = '', + props = property; + + if (typeof property === 'string') { + + if (value === undefined) return node.style[camelize(property)] || _getComputedStyle(node).getPropertyValue(hyphenate(property));else (props = {})[property] = value; + } + + for (var key in props) if (has.call(props, key)) { + !props[key] && props[key] !== 0 ? removeStyle(node, hyphenate(key)) : css += hyphenate(key) + ':' + props[key] + ';'; + } + + node.style.cssText += ';' + css; +}; +},{"../util/camelizeStyle":179,"../util/hyphenateStyle":181,"./getComputedStyle":173,"./removeStyle":175}],175:[function(require,module,exports){ +'use strict'; + +module.exports = function removeStyle(node, key) { + return 'removeProperty' in node.style ? node.style.removeProperty(key) : node.style.removeAttribute(key); +}; +},{}],176:[function(require,module,exports){ +'use strict'; +var canUseDOM = require('../util/inDOM'); + +var has = Object.prototype.hasOwnProperty, + transform = 'transform', + transition = {}, + transitionTiming, + transitionDuration, + transitionProperty, + transitionDelay; + +if (canUseDOM) { + transition = getTransitionProperties(); + + transform = transition.prefix + transform; + + transitionProperty = transition.prefix + 'transition-property'; + transitionDuration = transition.prefix + 'transition-duration'; + transitionDelay = transition.prefix + 'transition-delay'; + transitionTiming = transition.prefix + 'transition-timing-function'; +} + +module.exports = { + transform: transform, + end: transition.end, + property: transitionProperty, + timing: transitionTiming, + delay: transitionDelay, + duration: transitionDuration +}; + +function getTransitionProperties() { + var endEvent, + prefix = '', + transitions = { + O: 'otransitionend', + Moz: 'transitionend', + Webkit: 'webkitTransitionEnd', + ms: 'MSTransitionEnd' + }; + + var element = document.createElement('div'); + + for (var vendor in transitions) if (has.call(transitions, vendor)) { + if (element.style[vendor + 'TransitionProperty'] !== undefined) { + prefix = '-' + vendor.toLowerCase() + '-'; + endEvent = transitions[vendor]; + break; + } + } + + if (!endEvent && element.style.transitionProperty !== undefined) endEvent = 'transitionend'; + + return { end: endEvent, prefix: prefix }; +} +},{"../util/inDOM":182}],177:[function(require,module,exports){ +(function (root, factory) { + if (typeof define === "function" && define.amd) { + define(["exports"], factory); + } else if (typeof exports === "object") { + factory(exports); + } else { + factory(root.babelHelpers = {}); + } +})(this, function (global) { + var babelHelpers = global; + + babelHelpers.interopRequireDefault = function (obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; + }; + + babelHelpers._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; + }; +}) +},{}],178:[function(require,module,exports){ +"use strict"; + +var rHyphen = /-(.)/g; + +module.exports = function camelize(string) { + return string.replace(rHyphen, function (_, chr) { + return chr.toUpperCase(); + }); +}; +},{}],179:[function(require,module,exports){ +/** + * Copyright 2014-2015, Facebook, Inc. + * All rights reserved. + * https://github.com/facebook/react/blob/2aeb8a2a6beb00617a4217f7f8284924fa2ad819/src/vendor/core/camelizeStyleName.js + */ + +'use strict'; +var camelize = require('./camelize'); +var msPattern = /^-ms-/; + +module.exports = function camelizeStyleName(string) { + return camelize(string.replace(msPattern, 'ms-')); +}; +},{"./camelize":178}],180:[function(require,module,exports){ +'use strict'; + +var rUpper = /([A-Z])/g; + +module.exports = function hyphenate(string) { + return string.replace(rUpper, '-$1').toLowerCase(); +}; +},{}],181:[function(require,module,exports){ +/** + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. + * https://github.com/facebook/react/blob/2aeb8a2a6beb00617a4217f7f8284924fa2ad819/src/vendor/core/hyphenateStyleName.js + */ + +"use strict"; + +var hyphenate = require("./hyphenate"); +var msPattern = /^ms-/; + +module.exports = function hyphenateStyleName(string) { + return hyphenate(string).replace(msPattern, "-ms-"); +}; +},{"./hyphenate":180}],182:[function(require,module,exports){ +'use strict'; +module.exports = !!(typeof window !== 'undefined' && window.document && window.document.createElement); +},{}],183:[function(require,module,exports){ +'use strict'; + +var canUseDOM = require('./inDOM'); + +var size; + +module.exports = function (recalc) { + if (!size || recalc) { + if (canUseDOM) { + var scrollDiv = document.createElement('div'); + + scrollDiv.style.position = 'absolute'; + scrollDiv.style.top = '-9999px'; + scrollDiv.style.width = '50px'; + scrollDiv.style.height = '50px'; + scrollDiv.style.overflow = 'scroll'; + + document.body.appendChild(scrollDiv); + size = scrollDiv.offsetWidth - scrollDiv.clientWidth; + document.body.removeChild(scrollDiv); + } + } + + return size; +}; +},{"./inDOM":182}],184:[function(require,module,exports){ +(function (process){ +'use strict'; + +/** + * Copyright (c) 2013-present, 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. + * + * @typechecks + */ + +var emptyFunction = require('./emptyFunction'); + +/** + * Upstream version of event listener. Does not take into account specific + * nature of platform. + */ +var EventListener = { + /** + * Listen to DOM events during the bubble phase. + * + * @param {DOMEventTarget} target DOM element to register listener on. + * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. + * @param {function} callback Callback function. + * @return {object} Object with a `remove` method. + */ + listen: function listen(target, eventType, callback) { + if (target.addEventListener) { + target.addEventListener(eventType, callback, false); + return { + remove: function remove() { + target.removeEventListener(eventType, callback, false); + } + }; + } else if (target.attachEvent) { + target.attachEvent('on' + eventType, callback); + return { + remove: function remove() { + target.detachEvent('on' + eventType, callback); + } + }; + } + }, + + /** + * Listen to DOM events during the capture phase. + * + * @param {DOMEventTarget} target DOM element to register listener on. + * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. + * @param {function} callback Callback function. + * @return {object} Object with a `remove` method. + */ + capture: function capture(target, eventType, callback) { + if (target.addEventListener) { + target.addEventListener(eventType, callback, true); + return { + remove: function remove() { + target.removeEventListener(eventType, callback, true); + } + }; + } else { + if (process.env.NODE_ENV !== 'production') { + console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.'); + } + return { + remove: emptyFunction + }; + } + }, + + registerDefault: function registerDefault() {} +}; + +module.exports = EventListener; +}).call(this,require('_process')) +},{"./emptyFunction":191,"_process":38}],185:[function(require,module,exports){ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); + +/** + * Simple, lightweight module assisting with the detection and context of + * Worker. Helps avoid circular dependencies and allows code to reason about + * whether or not they are in a Worker, even if they never include the main + * `ReactWorker` dependency. + */ +var ExecutionEnvironment = { + + canUseDOM: canUseDOM, + + canUseWorkers: typeof Worker !== 'undefined', + + canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent), + + canUseViewport: canUseDOM && !!window.screen, + + isInWorker: !canUseDOM // For now, this is true - might change in the future. + +}; + +module.exports = ExecutionEnvironment; +},{}],186:[function(require,module,exports){ +"use strict"; + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @typechecks + */ + +var _hyphenPattern = /-(.)/g; + +/** + * Camelcases a hyphenated string, for example: + * + * > camelize('background-color') + * < "backgroundColor" + * + * @param {string} string + * @return {string} + */ +function camelize(string) { + return string.replace(_hyphenPattern, function (_, character) { + return character.toUpperCase(); + }); +} + +module.exports = camelize; +},{}],187:[function(require,module,exports){ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @typechecks + */ + +'use strict'; + +var camelize = require('./camelize'); + +var msPattern = /^-ms-/; + +/** + * Camelcases a hyphenated CSS property name, for example: + * + * > camelizeStyleName('background-color') + * < "backgroundColor" + * > camelizeStyleName('-moz-transition') + * < "MozTransition" + * > camelizeStyleName('-ms-transition') + * < "msTransition" + * + * As Andi Smith suggests + * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix + * is converted to lowercase `ms`. + * + * @param {string} string + * @return {string} + */ +function camelizeStyleName(string) { + return camelize(string.replace(msPattern, 'ms-')); +} + +module.exports = camelizeStyleName; +},{"./camelize":186}],188:[function(require,module,exports){ +'use strict'; + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +var isTextNode = require('./isTextNode'); + +/*eslint-disable no-bitwise */ + +/** + * Checks if a given DOM node contains or is another DOM node. + */ +function containsNode(outerNode, innerNode) { + if (!outerNode || !innerNode) { + return false; + } else if (outerNode === innerNode) { + return true; + } else if (isTextNode(outerNode)) { + return false; + } else if (isTextNode(innerNode)) { + return containsNode(outerNode, innerNode.parentNode); + } else if ('contains' in outerNode) { + return outerNode.contains(innerNode); + } else if (outerNode.compareDocumentPosition) { + return !!(outerNode.compareDocumentPosition(innerNode) & 16); + } else { + return false; + } +} + +module.exports = containsNode; +},{"./isTextNode":201}],189:[function(require,module,exports){ +(function (process){ +'use strict'; + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @typechecks + */ + +var invariant = require('./invariant'); + +/** + * Convert array-like objects to arrays. + * + * This API assumes the caller knows the contents of the data type. For less + * well defined inputs use createArrayFromMixed. + * + * @param {object|function|filelist} obj + * @return {array} + */ +function toArray(obj) { + var length = obj.length; + + // Some browsers builtin objects can report typeof 'function' (e.g. NodeList + // in old versions of Safari). + !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : void 0; + + !(typeof length === 'number') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : void 0; + + !(length === 0 || length - 1 in obj) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : void 0; + + !(typeof obj.callee !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object can\'t be `arguments`. Use rest params ' + '(function(...args) {}) or Array.from() instead.') : invariant(false) : void 0; + + // Old IE doesn't give collections access to hasOwnProperty. Assume inputs + // without method will throw during the slice call and skip straight to the + // fallback. + if (obj.hasOwnProperty) { + try { + return Array.prototype.slice.call(obj); + } catch (e) { + // IE < 9 does not support Array#slice on collections objects + } + } + + // Fall back to copying key by key. This assumes all keys have a value, + // so will not preserve sparsely populated inputs. + var ret = Array(length); + for (var ii = 0; ii < length; ii++) { + ret[ii] = obj[ii]; + } + return ret; +} + +/** + * Perform a heuristic test to determine if an object is "array-like". + * + * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?" + * Joshu replied: "Mu." + * + * This function determines if its argument has "array nature": it returns + * true if the argument is an actual array, an `arguments' object, or an + * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()). + * + * It will return false for other array-like objects like Filelist. + * + * @param {*} obj + * @return {boolean} + */ +function hasArrayNature(obj) { + return ( + // not null/false + !!obj && ( + // arrays are objects, NodeLists are functions in Safari + typeof obj == 'object' || typeof obj == 'function') && + // quacks like an array + 'length' in obj && + // not window + !('setInterval' in obj) && + // no DOM node should be considered an array-like + // a 'select' element has 'length' and 'item' properties on IE8 + typeof obj.nodeType != 'number' && ( + // a real array + Array.isArray(obj) || + // arguments + 'callee' in obj || + // HTMLCollection/NodeList + 'item' in obj) + ); +} + +/** + * Ensure that the argument is an array by wrapping it in an array if it is not. + * Creates a copy of the argument if it is already an array. + * + * This is mostly useful idiomatically: + * + * var createArrayFromMixed = require('createArrayFromMixed'); + * + * function takesOneOrMoreThings(things) { + * things = createArrayFromMixed(things); + * ... + * } + * + * This allows you to treat `things' as an array, but accept scalars in the API. + * + * If you need to convert an array-like object, like `arguments`, into an array + * use toArray instead. + * + * @param {*} obj + * @return {array} + */ +function createArrayFromMixed(obj) { + if (!hasArrayNature(obj)) { + return [obj]; + } else if (Array.isArray(obj)) { + return obj.slice(); + } else { + return toArray(obj); + } +} + +module.exports = createArrayFromMixed; +}).call(this,require('_process')) +},{"./invariant":199,"_process":38}],190:[function(require,module,exports){ +(function (process){ +'use strict'; + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @typechecks + */ + +/*eslint-disable fb-www/unsafe-html*/ + +var ExecutionEnvironment = require('./ExecutionEnvironment'); + +var createArrayFromMixed = require('./createArrayFromMixed'); +var getMarkupWrap = require('./getMarkupWrap'); +var invariant = require('./invariant'); + +/** + * Dummy container used to render all markup. + */ +var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; + +/** + * Pattern used by `getNodeName`. + */ +var nodeNamePattern = /^\s*<(\w+)/; + +/** + * Extracts the `nodeName` of the first element in a string of markup. + * + * @param {string} markup String of markup. + * @return {?string} Node name of the supplied markup. + */ +function getNodeName(markup) { + var nodeNameMatch = markup.match(nodeNamePattern); + return nodeNameMatch && nodeNameMatch[1].toLowerCase(); +} + +/** + * Creates an array containing the nodes rendered from the supplied markup. The + * optionally supplied `handleScript` function will be invoked once for each + *